gio-miniprogram-sdk 4.4.2 → 4.5.0
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/README.md +13 -11
- 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/mpx.js +1 -0
- 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 +13 -2
- package/.eslintignore +0 -11
- package/.eslintrc.js +0 -120
- package/.github/workflows/greetings.yml +0 -13
- package/.github/workflows/publish.yml +0 -45
- package/.prettierignore +0 -19
- package/.prettierrc.js +0 -9
- package/babel.config.js +0 -6
- package/rollup.config.js +0 -100
- package/rollup.plugins.config.js +0 -84
- package/src/adapters/gioTaobaoAdapter.ts +0 -202
- package/src/adapters/gioTaroAdapter.ts +0 -467
- package/src/adapters/gioUniAppAdapter.ts +0 -431
- package/src/constants/config.ts +0 -170
- package/src/constants/emitMsg.ts +0 -24
- package/src/constants/regex.ts +0 -18
- package/src/core/dataStore/eventContextBuilder.ts +0 -95
- package/src/core/dataStore/eventHooks/appEffects.ts +0 -218
- package/src/core/dataStore/eventHooks/index.ts +0 -468
- package/src/core/dataStore/eventHooks/minipPage.ts +0 -221
- package/src/core/dataStore/eventHooks/pageEffects.ts +0 -189
- package/src/core/dataStore/index.ts +0 -661
- package/src/core/growingIO.ts +0 -637
- package/src/core/pluginsInstance/base.ts +0 -157
- package/src/core/pluginsInstance/taro.ts +0 -15
- package/src/core/pluginsInstance/tb.ts +0 -15
- package/src/core/pluginsInstance/uniapp.ts +0 -15
- package/src/core/uploader.ts +0 -272
- package/src/core/userStore.ts +0 -267
- package/src/index.ts +0 -77
- package/src/minipInstance/base.ts +0 -352
- package/src/minipInstance/framework.ts +0 -24
- package/src/minipInstance/jd.ts +0 -11
- package/src/minipInstance/ks.ts +0 -12
- package/src/minipInstance/my.ts +0 -131
- package/src/minipInstance/qq.ts +0 -12
- package/src/minipInstance/quickapp.ts +0 -233
- package/src/minipInstance/swan.ts +0 -20
- package/src/minipInstance/tb.ts +0 -58
- package/src/minipInstance/tt.ts +0 -12
- package/src/minipInstance/wx.ts +0 -27
- package/src/minipInstance/xhs.ts +0 -20
- package/src/platformConfig/base.ts +0 -82
- package/src/platformConfig/framework.ts +0 -31
- package/src/platformConfig/jd.ts +0 -11
- package/src/platformConfig/ks.ts +0 -11
- package/src/platformConfig/my.ts +0 -16
- package/src/platformConfig/qq.ts +0 -13
- package/src/platformConfig/quickapp.ts +0 -48
- package/src/platformConfig/swan.ts +0 -11
- package/src/platformConfig/tb.ts +0 -29
- package/src/platformConfig/tt.ts +0 -11
- package/src/platformConfig/wx.ts +0 -20
- package/src/platformConfig/xhs.ts +0 -27
- package/src/plugins/gioABTest.ts +0 -348
- package/src/plugins/gioCompress.ts +0 -253
- package/src/plugins/gioEventAutoTracking.ts +0 -310
- package/src/plugins/gioImpressionTracking.ts +0 -386
- package/src/plugins/gioMultipleInstances.ts +0 -189
- package/src/plugins/gioPerformance/exception.ts +0 -152
- package/src/plugins/gioPerformance/monitor.ts +0 -284
- package/src/plugins/gioPerformance/network.ts +0 -197
- package/src/plugins/gioPerformance.ts +0 -131
- package/src/types/base.ts +0 -167
- package/src/types/dataStore.ts +0 -62
- package/src/types/eventHooks.ts +0 -146
- package/src/types/gioCustomTracking.ts +0 -9
- package/src/types/gioEventTracking.ts +0 -10
- package/src/types/gioPerformance.ts +0 -8
- package/src/types/growingIO.ts +0 -137
- package/src/types/minipInstance.ts +0 -133
- package/src/types/platforms.ts +0 -64
- package/src/types/plugins.ts +0 -24
- package/src/types/uploader.ts +0 -30
- package/src/types/userStore.ts +0 -28
- package/src/utils/glodash.ts +0 -430
- package/src/utils/tools.ts +0 -511
- package/src/utils/verifiers.ts +0 -52
- package/tsconfig.json +0 -32
- package/typings/global.d.ts +0 -105
package/dist/kuaishou.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};function n(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var r=/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/,i=function(e){return["undefined","null"].includes(A(e))},o=function(e){return"string"===A(e)},a=function(e){return"number"===A(e)},u=function(e){return"boolean"===A(e)},s=function(e){return"[object Object]"==={}.toString.call(e)&&!i(e)},c=function(e){return["function","asyncfunction"].includes(A(e))},l=function(e){return Array.isArray(e)&&"array"===A(e)},g=function(e){return"date"===A(e)},d=function(e){try{return Array.from(e)[0]}catch(e){return}},p=function(e){try{var t=Array.from(e);return t[t.length-1]}catch(e){return}},f=function(e,t){return void 0===t&&(t=1),l(e)&&a(t)?e.slice(t>0?t:1,e.length):e},v=function(e,t){if(void 0===t&&(t=!1),l(e)){for(var n=0,r=[],i=0,o=e;i<o.length;i++){var a=o[i];a&&!C(a)&&(r[n++]=a),t&&0===a&&(r[n++]=a)}return r}return e},h=function(e,t){if(l(e)){var n=e.findIndex(t);return 0>n?void 0:e[n]}},m=function(e){return i(e)?"":"".concat(e)},I=function(e,t){return"string"===A(e)?e.split(t):e},y=function(e){if(o(e)){var t=I(e,"");return"".concat(d(t).toLowerCase()).concat(f(t).join(""))}return e},S=function(e,t){return o(e)||(e=m(e)),e.slice(0,t.length)===t},w={}.hasOwnProperty,_=function(e,t){return!i(e)&&w.call(e,t)},O=function(e){return s(e)?Object.keys(e):[]},P=function(e,t){O(e).forEach(function(n){return t(e[n],n)})},k=function(e,t){var n=O(e);return!(!s(e)||!s(t)||n.length!==O(t).length||n.map(function(n,r){return s(e[n])?k(e[n],t[n]):e[n]===t[n]}).includes(!1))},T=function(e,t,n){var r=e;return s(e)?(t.split(".").forEach(function(e){r=r?r[e]:n}),r):n},b=function(e,t){if(!s(e))return!1;try{if("string"===A(t))return delete e[t];if("array"===A(t))return t.map(function(t){return delete e[t]});"object"===A(t)&&t.constructor===RegExp&&O(e).forEach(function(n){t.test(n)&&b(e,n)})}catch(e){return!1}},E=function(e,t,n,r){var i;void 0===t&&(t=250);var o=0;return"boolean"!==A(n)&&(r=e,e=n,n=void 0),function(){for(var a=[],u=0;arguments.length>u;u++)a[u]=arguments[u];var s=this,c=Date.now()-o;function l(){o=Date.now(),e.apply(s,a)}r&&!i&&l(),i&&clearTimeout(i),void 0===r&&c>t?l():!0!==n&&(i=setTimeout(r?function(){i=void 0}:l,void 0===r?t-c:t))}},C=function(e){return l(e)?0===e.length:s(e)?0===O(e).length:!e},A=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},x=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())},N=Object.freeze({__proto__:null,isNil:i,isString:o,isNaN:function(e){return"NaN"===m(Number(e))},isNumber:a,isBoolean:u,isObject:s,isRegExp:function(e){return"[object RegExp]"==={}.toString.call(e)},isFunction:c,isArray:l,isDate:g,fixed:function(e,t){return a(e)?Number(e.toFixed(a(t)?t:2)):o(e)&&"NaN"!==m(Number(e))?Number(Number(e).toFixed(a(t)?t:2)):e},head:d,last:p,drop:f,dropWhile:function(e,t){return l(e)?e.filter(function(e){return!t(e)}):e},compact:v,find:h,isEqualArray:function(e,t){return!(!l(e)||!l(t)||e.length!==t.length)&&e.every(function(e,n){return e===t[n]})},toString:m,split:I,lowerFirst:y,upperFirst:function(e){if(o(e)){var t=I(e,"");return"".concat(d(t).toUpperCase()).concat(f(t).join(""))}return e},startsWith:S,endsWith:function(e,t){var n=e.length,r=n;r>n&&(r=n);var i=r;return(r-=t.length)>=0&&e.slice(r,i)===t},hasOwnProperty:w,has:_,keys:O,forEach:P,isEqual:k,get:T,unset:b,throttle:E,isEmpty:C,typeOf:A,formatDate:x}),q=function(e,t){console.log("%c[GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444",warn:"color: #F59E0B",success:"color: #10B981"}[t]||"")},U=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),q("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},D=function(e){try{return e()}catch(e){return}},K=function(e,t){if(c(e))try{e(t)}catch(e){q("回调执行失败!".concat(e),"error")}},L=function(e){return o(e)?e.trim().substring(0,100):e},H=function(e,t){return o(e)&&!C(e)&&e.match(r)?t():(q("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},R=function(e){return i(e)||O(e).forEach(function(t){c(e[t])?e[t]=D(function(){return e[t]()}):s(e[t])?b(e,t):l(e[t])||(e[t]=m(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)})},F=function(e){return e.pixelRatio?Math.round(e.screenHeight*e.pixelRatio):e.screenHeight},j=function(e){return e.pixelRatio?Math.round(e.screenWidth*e.pixelRatio):e.screenWidth},V=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)}},M=function(e){if(o(e)){var t=e.indexOf("?");return-1!==t?[e.substring(0,t),e.substring(t+1)]:[e,""]}return["",""]},G=function(e){return o(e)?e.startsWith("/")?e:"/".concat(e):""},Q=function(e){return D(function(){switch(e){case"wx":return wx;case"my":case"tb":return my;case"swan":return swan;case"tt":return tt;case"qq":return qq;case"ks":return ks;case"jd":return jd;case"xhs":return xhs;default:var t=void 0;return t||(t=D(function(){return xhs})),t||(t=D(function(){return swan})),t||(t=D(function(){return my})),t||(t=D(function(){return tt})),t||(t=D(function(){return qq})),t||(t=D(function(){return ks})),t||(t=D(function(){return jd})),t||(t=D(function(){return wx})),t}})},$=function(e){return D(function(){switch(e){case"wx":return __wxConfig;case"swan":return appConfig;case"tt":return D(function(){return __ttConfig})||(null===global||void 0===global?void 0:global.TMAConfig)||(null===globalThis||void 0===globalThis?void 0:globalThis.TMAConfig);case"qq":return __qqConfig;case"ks":return __ksConfig;case"jd":return __jdConfig;case"xhs":return null!==__MP_APP_JSON_MIGRATION__&&void 0!==__MP_APP_JSON_MIGRATION__?__MP_APP_JSON_MIGRATION__:__MP_APP_JSON__;default:return}})},z=function(e){return D(function(){switch(e){case"wx":case"qq":return __wxAppCode__;case"tt":return __allConfig__;case"ks":return __module__;case"jd":return __jdAppCode__;default:return}})},W=function(){var e;return!e&&D(function(){return xhs})&&(e="xhs"),!e&&D(function(){return swan})&&(e="swan"),!e&&D(function(){return tt})&&(e="tt"),!e&&D(function(){return qq})&&(e="qq"),!e&&D(function(){return my.tb})&&(e="tb"),!e&&D(function(){return my})&&(e="my"),!e&&D(function(){return ks})&&(e="ks"),!e&&D(function(){return jd})&&(e="jd"),!e&&D(function(){return wx})&&(e="wx"),e||h(O(global),function(e){return m(e).toLowerCase().includes("quickapp")})&&(e="quickapp"),e},J=function(){var e;return null!==(e=D(function(){var e;return null!==(e=D(function(){var e;return null!==(e=D(function(){return $global}))&&void 0!==e?e:global}))&&void 0!==e?e:window}))&&void 0!==e?e:globalThis},Y=function(e){var t={};return s(e)&&(b(e,"&&sendTo"),P(e,function(e,n){var r=m(n).slice(0,100);s(e)?t[r]=Y(e):l(e)?(t[r]=v(e.slice(0,100),!0),t[r]=t[r].join("||").slice(0,1e3)):g(e)?t[r]=x(e):t[r]=i(e)?"":m(e).slice(0,1e3)})),t},Z=function(e,t){var n=function(){return t.map(function(t){return e.getStorageSync(t)})};try{return e.minip.canIUse("batchGetStorageSync")?e.minip.batchGetStorageSync(t):n()}catch(e){return n()}},X=function(e,t){var n=function(){return t.map(function(t){var n=t.key,r=t.value;return e.setStorageSync(n,r)})};try{return e.minip.canIUse("batchSetStorageSync")?e.minip.batchSetStorageSync(t):n()}catch(e){return n()}},ee=function(e){return O(e||{}).map(function(t){return t?"".concat(t,"=").concat(i(e[t])?"":e[t]):""}).join("&")},te=function(e){(S(e,"?")||S(e,"&"))&&(e=e.slice(1,e.length));var t={};return e.split("&").forEach(function(e){var n=e.split("=");n[0]&&(t[n[0]]=n[1])}),t},ne=["wxShoppingListScene","$taroTimestamp","gdpCircleRoomCollectUrl"],re=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n="string"==typeof e?te(e):e||{};function r(e,t){if("object"!=typeof e||null===e||Array.isArray(e))return e;var r={};return O(e).forEach(function(i){var o=ne.some(function(e){return i.includes(e)}),a=_(n,i);if(!(o||t&&a)){var u=e[i];"string"==typeof u?ne.some(function(e){return u.includes(e)})||(r[i]=u):"number"!=typeof u&&"boolean"!=typeof u||(r[i]=u)}}),r}return Object.assign({},r(n,!1),r(t,!0))},ie=Object.freeze({__proto__:null,consoleText:q,callError:U,niceTry:D,niceCallback:K,limitString:L,eventNameValidate:H,getDynamicAttributes:R,guid:B,getScreenHeight:F,getScreenWidth:j,getOS:V,compareVersion:function(e,t){void 0===e&&(e=""),void 0===t&&(t="");for(var n=function(e){return e.replace(/\s+/g,"")},r=function(e){return e.replace(/[vV]/g,"")},i=n(r(e)),o=n(r(t)),a=i.split("."),u=o.split("."),s=0;3>s;s++){var c=Number(a[s]),l=Number(u[s]);if(c>l)return 1;if(l>c)return-1;if(!isNaN(c)&&isNaN(l))return 1;if(isNaN(c)&&!isNaN(l))return-1}return 0},getVueVersion:function(e){if(e){var t=Number(d(I(e.version,".")));return Number.isNaN(t)?0:t}return 0},splitPath:M,normalPath:G,isTaro3:function(e){var t=e.Current,n=e.createComponent;return!(!e||!t||n)},getPlainMinip:Q,getPlainConfig:$,getPlainAppCode:z,getPlainPlatform:W,getSubKeys:function(e){return O(e).filter(function(e){return e.indexOf("__sub")>-1&&e.indexOf("gio__")>-1}).sort()},getAppInst:function(){var e=D(function(){return getApp({allowDefault:!0})});return e||(e=J()),e},getGlobal:J,limitObject:Y,batchGetStorageSync:Z,batchSetStorageSync:X,qsStringify:ee,qsParse:te,hashCode:function(e,t){void 0===t&&(t=!1);var n=0;if(C(e)||"boolean"==typeof e)return n;for(var r=0;r<e.length;)n=(n<<5)-n+e.charCodeAt(r),n&=n,r++;return t?Math.abs(n):n},getExtraData:function(e){var t;return o(e)?null!==(t=D(function(){return JSON.parse(e)}))&&void 0!==t?t:{}:null!=e?e:{}},getPureParams:re}),oe=function(e){return(o(e)&&e.length>0||a(e)&&e>0)&&!["-","null","undefined"].includes(e)},ae={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},idMapping:{type:"boolean",default:!1},enableIdMapping:{type:"boolean",default:!1},extraParams:{type:"array",default:[]},followShare:{type:"boolean",default:!0},forceLogin:{type:"boolean",default:!1},ignoreFields:{type:"array",default:[]},impressionScale:{type:"number",default:0},pluginMode:{type:"boolean",default:!1},originalSource:{type:"boolean",default:!0},keepAlive:{type:"number",default:5},performance:{type:"object",default:{monitor:!0,exception:!0}},serverUrl:{type:"string",default:"https://napi.growingio.com"},sessionExpires:{type:"number",default:-1},requestTimeout:{type:"number",default:5e3},taro:{type:["object","module"],default:!1},taroVue:{type:["object","function"],default:!1},tbConfig:{type:"object",default:{cloud:void 0,cloudFuncSend:!1,cloudFuncName:"httpTunnel",cloudFuncHandler:"main",cloudAppId:void 0,path:void 0}},trackPage:{type:"boolean",default:!0},uniVue:{type:["object","function"],default:!1},uploadInterval:{type:"number",default:1e3},version:{type:"string",default:"1.0.0"}},ue=["clearGeneralProps","clearPageAttributes","clearTrackTimer","clearUserId","getABTest","getGioInfo","getOption","identify","removeTimer","sendPage","sendVisit","setGeneralProps","setLocation","setOption","setPageAttributes","setUserAttributes","setUserId","track","trackTimerEnd","trackTimerPause","trackTimerResume","trackTimerStart"],se=n(n(["init","registerPlugins"],["getPlugins","getDeviceId","updateImpression"],!0),ue,!0),ce={autotrack:"无埋点",dataCollect:"数据采集",debug:"调试模式",serverUrl:"数据上报服务地址"},le=["enableDebug","setAutotrack","setDataCollect","setTrackerHost","setTrackerScheme","setConfig","collectImp","setPlatformProfile","getLocation"],ge=["deviceBrand","deviceModel","deviceType","networkState","screenHeight","screenWidth","operatingSystem"],de=n(n([],ge,!0),["appChannel","language","platformVersion"],!1),pe={gsid:"_growing_gsid_",originalSource:"_gdp_original_source_",userId:"_growing_userId_",userKey:"_growing_userKey_",gioId:"_growing_gioId_",plugin_gsid:"_growing_plugin_gsid_",plugin_originalSource:"_gdp_plugin_original_source_",plugin_userId:"_growing_plugin_userId_",plugin_userKey:"_growing_plugin_userKey_",plugin_gioId:"_growing_plugin_gioId_"},fe="MINIP_LIFECYCLE",ve="ON_COMMIT_REQUEST",he="ON_COMPOSE_AFTER",me="ON_COMPOSE_BEFORE",Ie="ON_ERROR",ye="ON_INSTALL",Se="ON_SEND_AFTER",we="ON_SEND_BEFORE",_e="OPTION_CHANGE",Oe="OPTION_INITIALIZED",Pe="SDK_INITIALIZED",ke="SESSIONID_UPDATE",Te=function(e){var n=this;this.growingIO=e,this.main=function(e,r,i){void 0===i&&(i=!0),e||(e=n.growingIO.trackingId);var o=n.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],_=s.systemInfo,O=void 0===_?{}:_,P=s.network,k=void 0===P?{}:P,T=O.brand,E=O.model,A=O.platform,x=O.language,N=p.getPagePath(),q={appChannel:"scn:".concat(d||"NA"),appVersion:h,dataSourceId:m,deviceBrand:T,deviceId:c.getUid(),deviceModel:E,deviceType:V(A,u.name),domain:I,language:x,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:V(A,u.name),path:N,platform:u.platform,platformVersion:u.name+(O.version?" ".concat(O.version):""),query:N?p.getPageQuery():"",screenHeight:F(O),screenWidth:j(O),sdkVersion:a,sessionId:c.getSessionId(e),title:p.getPageTitle(),timestamp:Date.now(),timezoneOffset:(new Date).getTimezoneOffset(),userId:c.getUserId(e)};return y&&(q.userKey=c.getUserKey(e)),i&&!C(f[e])&&(q.attributes=t({},f[e])),C(q.attributes)||(q.attributes=Y(R(t({},q.attributes)))),C(S)||S.forEach(function(e){b(q,e)}),C(r)?t(t({},q),{trackingId:e}):t(t(t({},q),r),{trackingId:e})}},be=function(e){var n=this;this.growingIO=e,this.enterParams={},this.main=function(e,r){var i,o,a=Date.now(),u=n.growingIO,s=u.emitter,c=u.userStore,l=u.vdsConfig,g=u.platformConfig,d=u.uploader,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(fe,{event:"App ".concat(e),timestamp:a,params:null!==(i=r[0])&&void 0!==i?i:{}}),l.debug&&console.log("App:",e,a);var w=g.listeners.app;switch(s.emit(me,{event:"App ".concat(e),params:null!==(o=r[0])&&void 0!==o?o:{}}),e){case w.appLaunch:n.enterParams=t({},r[0]);break;case w.appCreate:case w.appShow:var _=n.enterParamsParse(r[0]),O=_.path,P=_.query,k=_.referralPage;!m&&l.originalSource&&O&&h(function(e){S(e,{path:O,query:P,referralPage:k})}),I?(Date.now()-I>60*l.keepAlive*1e3||p.lastScene&&p.scene!==p.lastScene)&&h(function(e){c.setSessionId(e)}):h(function(e){p.lastVisitEvent[e]={path:O,query:P,referralPage:k},n.buildVisitEvent(e,{path:O,query:P,referralPage:k})}),f.setNetworkStatusListener();break;case w.appClose:p.lastScene=p.scene,p.lastCloseTime=Date.now(),y(),c.saveUserInfo(),h(function(e){n.buildCloseEvent(e),l.forceLogin||d.initiateRequest(e,!0)})}},this.enterParamsParse=function(e){var t;void 0===e&&(e={});var r=n.growingIO,i=r.gioPlatform,o=r.minipInstance,a=r.dataStore,u="",s="",c="";if("quickapp"!==i&&o.minip.canIUse("getEnterOptionsSync")){var l=o.minip.getEnterOptionsSync()||{},g=l.path,d=l.query,p=l.scene,f=l.referrerInfo||l.refererInfo;u=g||e.path,s=d||e.query,c=(null==f?void 0:f.appId)||(null===(t=null==e?void 0:e.referrerInfo)||void 0===t?void 0:t.appId)||"",a.scene=p||e.scene,b(d,"gdpCircleRoomCollectUrl"),s=ee(re(s,(null==f?void 0:f.extraData)||{}))}else g=e.path,d=e.query,f=e.referrerInfo,u=g,s=ee(d),c=(null==f?void 0:f.appId)||"",n.parseScene(e);return{path:u,query:s,referralPage:c}},this.parseScene=function(e){var t,r,i=n.growingIO,o=i.minipInstance,a=i.gioPlatform,u=i.dataStore;if("quickapp"===a){var s=o.getAppSource(),c=s.extra,l=s.type;r=(null==c?void 0:c.scene)||l}else C(e)||((null===(t=null==e?void 0:e.query)||void 0===t?void 0:t.wxShoppingListScene)?r=e.query.wxShoppingListScene:(null==e?void 0:e.scene)?r=e.scene:u.scene="NA");u.scene=r},this.buildVisitEvent=function(e,r){var i=n.growingIO,o=i.dataStore,a=o.getOriginalSource,u=o.eventContextBuilder,s=o.eventInterceptor,c=i.vdsConfig,l=a(e),g=(null==r?void 0:r.query)||"",d=t({eventType:"VISIT"},u(e,{}));!C(r)&&r.path&&(d.path=r.path||"",d.query="string"===A(g)?g:ee(g),r.referralPage&&(d.referralPage=r.referralPage)),c.originalSource&&!C(l)&&(d=t(t({},d),l)),s(d)},this.buildCloseEvent=function(e){var r=n.growingIO.dataStore,i=r.eventContextBuilder;(0,r.eventInterceptor)(t({eventType:"APP_CLOSED"},i(e)))}},Ee=function(){function e(e){var n=this;this.growingIO=e,this.lifeBeforeShow=!0,this.getPagePath=function(){var e,t,r,i=n.growingIO,o=i.minipInstance,a=i.inPlugin,u=i.dataStore,s=i.trackingId,c=o.getCurrentPath();if(a){var l=u.getTrackerVds(s);return c||"/插件".concat(l.appId)}return c||(null===(e=u.eventHooks.appEffects.enterParams)||void 0===e?void 0:e.path)||(null===(t=u.lastPageEvent[s])||void 0===t?void 0:t.path)||(null===(r=u.lastVisitEvent[s])||void 0===r?void 0:r.path)},this.getPageQuery=function(){var e,t,r,i,o,a,u=n.growingIO,s=u.minipInstance,c=u.dataStore,l=u.trackingId,g=s.getCurrentPage(),d=s.getCurrentPath(),p=c.eventHooks.appEffects.enterParams,f=void 0===p?{}:p;if(!d)return f.path?ee(re(null==f?void 0:f.query,null===(r=null==f?void 0:f.referrerInfo)||void 0===r?void 0:r.extraData)):(null===(i=c.lastPageEvent[l])||void 0===i?void 0:i.path)?null===(o=c.lastPageEvent[l])||void 0===o?void 0:o.query:null===(a=c.lastVisitEvent[l])||void 0===a?void 0:a.query;var v=null!==(e=g.options)&&void 0!==e?e:g.$taroParams;return C(v)?C(n.queryOptions[d])?d===f.path?ee(re(null==f?void 0:f.query,null===(t=null==f?void 0:f.referrerInfo)||void 0===t?void 0:t.extraData)):void 0:ee(re(n.queryOptions[d])):ee(re(v))},this.getPageTitle=function(e){var t=n.growingIO,r=t.minipInstance,i=t.inPlugin,o=t.dataStore,a=r.getCurrentPath(),u=n.configuredTitle[a]||r.getPageTitle(r.getCurrentPage());if(i){var s=o.getTrackerVds(e||n.growingIO.trackingId);return u||"/插件".concat(s.appId).concat(a?"_"+p(a.split("/")):"")}return u},this.getReferralPage=function(e){var t,r,i,o=n.growingIO,a=o.minipInstance,u=o.dataStore,s=u.lastPageEvent,c=u.scene,l=u.eventHooks;return(null===(t=s[e])||void 0===t?void 0:t.path)||(null===(i=null===(r=l.appEffects.enterParams)||void 0===r?void 0:r.referrerInfo)||void 0===i?void 0:i.appId)||(c?"scn:".concat(a.scnPrefix).concat(c):null)},this.updateShareResult=function(e,t){void 0===t&&(t=!0);var r=n.buildShareQuery(e),i=r[0],o=r[1];return(t||_(e,"path"))&&(e.path=G(i+(o?"?".concat(o):""))),(t||_(e,"query"))&&(e.query=o),e},this.eventSetPageProps=function(e,r){var i=D(function(){return n.pageProps[e][n.getPagePath()]});return C(i)?r.attributes:Y(R(t(t({},r.attributes),i)))},this.queryOptions={},this.configuredTitle={},this.pageProps={}}return e.prototype.buildShareQuery=function(e){var n,r,i=M(null!==(n=e.path)&&void 0!==n?n:""),o=e.path||this.getPagePath(),a={},u=_(e,"path");if(_(e,"query"))a=te(null!==(r=e.query)&&void 0!==r?r:"")||{};else if(u)a=te(p(i))||{};else{var s=this.growingIO.minipInstance.getCurrentPage();a=t({},s.options||this.queryOptions[s.route]||{}),v(O(a)).forEach(function(e){e.toLowerCase().startsWith("utm_")&&b(a,e)})}return[o,ee(a)]},e}(),Ce=function(e){var n=this;this.growingIO=e,this.main=function(e,r,i){var o,a,u=Date.now(),s=n.growingIO,l=s.emitter,g=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,_=v.buildAppMessageEvent,O=v.buildTimelineEvent,P=v.buildAddFavorites,k=S.currentPage;if(!n.prevEvent[r]||Date.now()-Number(n.prevEvent[r])>=50){e||(e=g.getCurrentPage()),e.route||(e.route=g.getCurrentPath(e));var E=e.route||e.uri||e.__route__||(null===(o=null==e?void 0:e.$page)||void 0===o?void 0:o.fullPath)||"";l.emit(fe,{event:"Page ".concat(r),timestamp:u,params:{page:e,args:i[0]}}),p.debug&&console.log("Page:",E,"#",r,u),n.prevEvent[r]=Date.now();var A=f.listeners.page;switch(l.emit(me,{page:e,event:"Page ".concat(r),params:{page:e,args:i[0]}}),k.lastLifecycle=k.currentLifecycle,k.currentLifecycle=r,r){case A.pageLoad:k.queryOptions[E]=T(e,"options")||T(e,"__displayReporter.query")||T(e,"$page.query")||T(e,"$wx.__displayReporter.query")||T(e,"$taroParams")||i[0]||{},b(k.queryOptions[E],["$taroTimestamp","gdpCircleRoomCollectUrl"]);break;case A.pageShow:y(function(e){var r=m(e);C(r)||r.path!==E||I(e,t(t({},r),{title:k.getPageTitle()})),h(e).trackPage&&n.buildPageEvent(e)}),w(!1);break;case A.pageHide:case A.pageUnload:break;case A.shareChat:case A.shareApp:w(!0),y(function(e){h(e).followShare&&_(e,i)});break;case A.shareTime:"xhsp"===g.platform&&w(!0),y(function(e){h(e).followShare&&O(e,i)});break;case A.addFavorites:y(function(e){h(e).followShare&&P(e,i)});break;case A.tabTap:var x=null===(a=null==d?void 0:d.gioEventAutoTracking)||void 0===a?void 0:a.buildTabClickEvent;p.autotrack&&x&&c(x)&&x(n.growingIO.trackingId,i[0])}k.lastLifecycle=k.currentLifecycle,k.currentLifecycle="".concat(r,"End"),["onHideEnd","onUnloadEnd"].includes(k.currentLifecycle)&&(k.lifeBeforeShow=!0),"onShowEnd"===k.currentLifecycle&&(k.lifeBeforeShow=!1)}},this.buildPageEvent=function(e,r){var i=n.growingIO.dataStore,o=i.eventContextBuilder,a=i.eventInterceptor,u=i.eventHooks.currentPage,s=t({eventType:"PAGE",referralPage:u.getReferralPage(e)},o(e));s.attributes=u.eventSetPageProps(e,s),!C(r)&&r.title&&(s.title=r.title),a(s)},this.prevEvent={}},Ae=function(e){var n,r=this;this.growingIO=e,this.isNormalFc=function(e,t){return c(t)&&"constructor"!==e},this.objectTraverse=function(e,t){Object.getOwnPropertyNames(e).forEach(function(n){return t(n,e)}),_(e,"methods")&&Object.getOwnPropertyNames(e.methods).forEach(function(n){e[n]||t(n,e.methods)}),_(e,"lifetimes")&&Object.getOwnPropertyNames(e.lifetimes).forEach(function(n){e[n]||t(n,e.lifetimes)}),_(e,"pageLifetimes")&&Object.getOwnPropertyNames(e.pageLifetimes).forEach(function(n){e[n]||t(n,e.pageLifetimes)})},this.supLifeFcs=function(e,t){l(r["".concat(t,"Handlers")])&&r["".concat(t,"Handlers")].forEach(function(t){c(e[t])||["onShareAppMessage","onShareTimeline"].includes(t)||(e[t]=function(){})})},this.lifeFcEffectsFn=function(e,t,n,i,o){void 0===o&&(o=void 0);var a="array"===A(t)?[].slice.call(t):[];return C(o)||a.push(o),r["def".concat(n,"Cbs")][i].apply(e,a),r.growingIO.emitter.emit(fe,{event:"".concat(n," ").concat(i,"End"),timestamp:Date.now(),params:{instance:e,arguments:Array.from(a)}}),o},this.lifeFcEffects=function(e,n,i){var o=r;return function(){for(var r,a,u,s=this,c=[],l=0;arguments.length>l;l++)c[l]=arguments[l];if(o.shareEventTypes.includes(e)){var g=null!==(r=n.apply(this,c))&&void 0!==r?r:{};if(!o.growingIO.vdsConfig.followShare)return g;var d="promise"===A(g),p="promise"===A(g.promise),f=_(g,"_result")&&_(g,"_state");if(d||p||f){var v=function(n){void 0===n&&(n={});try{var r=t(t({},g),n),a=o.currentPage.updateShareResult(r);o.lifeFcEffectsFn(s,c,i,e,a)}catch(e){q(e,"error")}};d&&Promise.race([g,new Promise(function(e){setTimeout(function(){e({})},3e3)})]).then(v).catch(function(e){return q(e,"error")}),p&&Promise.race([g.promise,new Promise(function(e){setTimeout(function(){e({})},3e3)})]).then(v).catch(function(e){return q(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,i,e,u)}else o.lifeFcEffectsFn(this,c,i,e),u=n.apply(this,c);return u}},this.customFcEffects=function(e,t){var n=r;return function(){for(var r,i,o=[],a=0;arguments.length>a;a++)o[a]=arguments[a];if(n.growingIO.vdsConfig.autotrack&&n.growingIO.plugins.gioEventAutoTracking)try{var u=o[0]||{};_(u,"type")&&((null==u?void 0:u.currentTarget)||(null==u?void 0:u.target))||(u=o[o.length-1]),((null==u?void 0:u.currentTarget)||(null==u?void 0:u.target))&&n.actionEventTypes.includes(u.type)&&(c(n.actionEffects)||(n.actionEffects=(null===(i=null===(r=n.growingIO.plugins)||void 0===r?void 0:r.gioEventAutoTracking)||void 0===i?void 0:i.main)||function(){}),null==n||n.actionEffects(u,e))}catch(e){q(e,"error")}return t.apply(this,o)}},this.appApplyProxy=function(e,t){return r.appHandlers.includes(e)?r.lifeFcEffects(e,t,"App"):r.customFcEffects(e,t)},this.pageApplyProxy=function(e,t){return r.pageHandlers.includes(e)?r.lifeFcEffects(e,t,"Page"):r.customFcEffects(e,t)},this.appOverriding=function(e){return r.setAppEffectCbs(),r.supLifeFcs(e,"app"),r.objectTraverse(e,function(e,t){r.isNormalFc(e,t[e])&&(t[e]=r.appApplyProxy(e,t[e]))}),e},this.pageOverriding=function(e){return r.setPageEffectCbs(),r.supLifeFcs(e,"page"),r.objectTraverse(e,function(e,t){r.isNormalFc(e,t[e])&&(t[e]=r.pageApplyProxy(e,t[e]))}),e},this.componentOverriding=function(e){return r.setPageEffectCbs(),e.methods||(e.methods={}),r.supLifeFcs(r.growingIO.inPlugin?e:e.methods,"page"),r.objectTraverse(r.growingIO.inPlugin?e:e.methods,function(e,t){r.isNormalFc(e,t[e])&&(t[e]=r.pageApplyProxy(e,t[e]))}),e},this.setAppEffectCbs=function(){var e=r;r.appHandlers.forEach(function(t){r.defAppCbs[t]=function(){for(var n=[],r=0;arguments.length>r;r++)n[r]=arguments[r];e.appEffects.main(t,n)}})},this.setPageEffectCbs=function(){var e=r;r.pageHandlers.forEach(function(t){r.defPageCbs[t]=function(){for(var n=[],r=0;arguments.length>r;r++)n[r]=arguments[r];e.pageEffects.main(this,t,n)}})},this.growingApp=function(e){return c(r.originalApp)?r.originalApp(r.appOverriding(e)):r.appOverriding(e)},this.growingPage=function(e){return c(r.originalPage)?r.originalPage(r.pageOverriding(e)):r.pageOverriding(e)},this.growingComponent=function(e){return c(r.originalComponent)?r.originalComponent(r.componentOverriding(e)):r.componentOverriding(e)},this.growingBehavior=function(e){return c(r.originalBehavior)?r.originalBehavior(r.componentOverriding(e)):r.componentOverriding(e)},this.nativeGrowing=function(e){void 0===e&&(e=["App","Page","Component","Behavior"]);var t=r,n=r.growingIO.platformConfig.hooks;if(e.includes("App"))try{n.App&&!r.appHooked&&(App=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalApp(t.appOverriding(e[0]))},r.appHooked=!0)}catch(e){}if(e.includes("Page"))try{n.Page&&!r.pageHooked&&(Page=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalPage(t.pageOverriding(e[0]))},r.pageHooked=!0)}catch(e){}if(e.includes("Component"))try{n.Component&&!r.componentHooked&&(Component=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalComponent(t.componentOverriding(e[0]))},r.componentHooked=!0)}catch(e){}if(e.includes("Behavior"))try{n.Behavior&&!r.behaviorHooked&&(Behavior=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalBehavior(t.componentOverriding(e[0]))},r.behaviorHooked=!0)}catch(e){}},this.initOriginalValue=function(){r.setAppEffectCbs(),r.setPageEffectCbs(),r.originalApp=D(function(){return App||global.App}),r.originalPage=D(function(){return Page||global.Page}),r.originalComponent=D(function(){return Component||global.Component}),r.originalBehavior=D(function(){return Behavior||global.Behavior})},this.initEventHooks=function(){var e=r,t=r.growingIO,n=t.platformConfig,i=t.gioPlatform;r.initOriginalValue(),n.canHook?(r.nativeGrowing(),J().GioApp=D(function(){return null!==App&&void 0!==App?App:r.originalApp}),J().GioPage=D(function(){return null!==Page&&void 0!==Page?Page:r.originalPage}),J().GioComponent=D(function(){return null!==Component&&void 0!==Component?Component:r.originalComponent}),J().GioBehavior=D(function(){return null!==Behavior&&void 0!==Behavior?Behavior:r.originalBehavior})):"quickapp"===i&&(J().GioApp=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.appOverriding(t[0])},J().GioPage=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.pageOverriding(t[0])},J().GioComponent=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.pageOverriding(t[0])})};var i=null===(n=this.growingIO)||void 0===n?void 0:n.platformConfig;this.defAppCbs={},this.defPageCbs={},this.appHandlers=i.appHandlers,this.pageHandlers=i.pageHandlers,this.shareEventTypes=i.shareEventTypes,this.actionEventTypes=i.actionEventTypes,this.appEffects=new be(this.growingIO),this.pageEffects=new Ce(this.growingIO),this.currentPage=new Ee(this.growingIO)},xe=function(){function e(e){var r,i,a=this;this.growingIO=e,this.ALLOW_SETTING_KEYS=O(ae),this.getStorageKey=function(e,t){var n=a.growingIO.inPlugin;return"".concat(e===a.growingIO.trackingId?"":e).concat(pe[n?"plugin_"+t:t])},this.getGsid=function(e){var t=Number(a._gsid[e]);return Number.isNaN(t)||t>=1e9||1>t?(a.setGsid(e,1),1):t},this.setGsid=function(e,t){var n=Number(t);(Number.isNaN(n)||n>=1e9||1>n)&&(n=1),a._gsid[e]=n,10>a._gsid[e]-a._stid[e]||a.saveStorageInfo()},this.initStorageInfo=function(e){var t=a.growingIO.minipInstance,n=t.getStorageSync(a.getStorageKey(e,"gsid")),r=Number(n);(Number.isNaN(r)||r>=1e9||1>r)&&(r=1),a._gsid[e]=r,a._stid[e]=r,r!==n&&t.setStorageSync(a.getStorageKey(e,"gsid"),r)},this.saveStorageInfo=function(){var e=a.growingIO.minipInstance;a._stid=t({},a._gsid),X(e,a.initializedTrackingIds.map(function(e){return{key:a.getStorageKey(e,"gsid"),value:a._gsid[e]}}))},this.setOriginalSource=function(e,t){a.growingIO.minipInstance.setStorageSync(a.getStorageKey(e,"originalSource"),JSON.stringify(t))},this.getOriginalSource=function(e){var t,n=a.growingIO.minipInstance;return null!==(t=D(function(){return JSON.parse(n.getStorageSync(a.getStorageKey(e,"originalSource")))}))&&void 0!==t?t:{}},this.getTrackerVds=function(e){return a.growingIO.trackingId===e?t({},a.growingIO.vdsConfig):void 0},this.initTrackerOptions=function(e){var t=a.initOptions(e);return t.trackingId=e.trackingId,a.growingIO.trackingId=e.trackingId,a.growingIO.vdsConfig=t,t},this.initTrackerHooker=function(e){var t,n,r=a.growingIO,i=r.platformConfig,o=r.inPlugin,u=r.minipInstance,s=r.plugins,c=e.uniVue,l=e.taro;c||l||"quickapp"===u.platform||(i.canHook=!0),!o||["tbp","jdp"].includes(u.platform)?a.eventHooks.initEventHooks():a.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 n,r,i,o,u,s,c=e.projectId,g=e.dataSourceId,d=e.appId,p=e.trackingId,f={};return a.ALLOW_SETTING_KEYS.forEach(function(t){var n=ae[t].type;(l(n)?n.includes(A(e[t])):A(e[t])===ae[t].type)?"ignoreFields"===t?f.ignoreFields=e.ignoreFields.filter(function(e){return ge.includes(e)}):"extraParams"===t?f.extraParams=e.extraParams.filter(function(e){return de.includes(e)}):(f[t]=e[t],["dataCollect","autotrack"].includes(t)&&!f[t]&&q("已关闭".concat(ce[t]),"info")):f[t]=ae[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||a.growingIO.userStore.setUserKey(p,"")),b(f,"enableIdMapping"),f.pluginMode&&(a.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),t(t({},f),{projectId:c,dataSourceId:g,appId:d,trackingId:p,performance:{monitor:null===(r=null===(n=f.performance)||void 0===n?void 0:n.monitor)||void 0===r||r,exception:null===(o=null===(i=f.performance)||void 0===i?void 0:i.exception)||void 0===o||o,network:null!==(s=null===(u=f.performance)||void 0===u?void 0:u.network)&&void 0!==s&&s}})},this.setOption=function(e,n,r){var i,u,s=a.growingIO,c=s.userStore,l=s.emitter,g=a.getTrackerVds(e),d=o(n)&&a.ALLOW_SETTING_KEYS.includes(n),p=d&&typeof r===(null===(u=ae[n])||void 0===u?void 0:u.type);if(d&&p){var f=t({},g);return a.updateVdsConfig(e,t(t({},g),((i={})[n]=r,i))),"dataCollect"===n&&f.dataCollect!==r&&r&&c.setSessionId(e),l.emit(_e,{optionName:n,optionValue:r}),!0}return U("setOption > ".concat(n)),!1},this.getOption=function(e,t){var n=a.getTrackerVds(e);return t&&_(a.growingIO.vdsConfig,t)?_(n,t)?n[t]:a.growingIO.vdsConfig[t]:C(t)?n:void U("getOption > ".concat(t))},this.updateVdsConfig=function(e,n){e===a.growingIO.trackingId?(a.growingIO.vdsConfig=t(t({},a.growingIO.vdsConfig),n),J().vdsConfig=a.growingIO.vdsConfig):(a.growingIO.subInstance[e]=t(t({},a.growingIO.subInstance[e]),n),J().vdsConfig.subInstance[e]=a.growingIO.subInstance[e])},this.toggleShareOut=function(e){u(e)?a.shareOut=e:a.shareOut=!a.shareOut},this.sendVisit=function(e,t){a.eventHooks.appEffects.buildVisitEvent(e,t)},this.sendPage=function(e,t){a.eventHooks.pageEffects.buildPageEvent(e,t)},this.eventConverter=function(e){var n=a.growingIO,r=n.dataStore,i=n.uploader;if(a.getTrackerVds(e.trackingId).dataCollect){["LOGIN_USER_ATTRIBUTES","APP_CLOSED"].includes(e.eventType)||(e.eventSequenceId=r.getGsid(e.trackingId),r.setGsid(e.trackingId,e.eventSequenceId+1));var o={};P(e,function(e,t){var n;if("element"===t){var r=null!==(n=d(e))&&void 0!==n?n:{};P(r,function(e,t){C(e)&&0!==e||(o[t]=e)})}else C(e)&&0!==e||(o[t]=e)}),a.growingIO.emitter.emit(he,{composedEvent:o}),i.commitRequest(t(t({},o),{requestId:B()}))}},this.eventRefactor=function(e){var n,r,i=t(t({},e),a.eventContextBuilder(e.trackingId,{path:e.path,query:e.query,timestamp:e.timestamp}));return i.attributes=t(t({},null!==(n=i.attributes)&&void 0!==n?n:{}),null!==(r=e.attributes)&&void 0!==r?r:{}),i},this.eventInterceptor=function(e){var t=a.growingIO.minipInstance,r=t.systemInfo,i=t.network;C(r)||C(i)?a.interceptEvents.push(e):C(a.interceptEvents)?a.eventConverter(e):(n(n([],a.interceptEvents,!0),[e],!1).forEach(function(e){a.eventConverter(a.eventRefactor(e))}),a.interceptEvents=[])},this.eventReleaseInspector=function(){var e=a.growingIO.minipInstance,t=e.systemInfo,r=e.network;t&&r&&!C(a.interceptEvents)&&(n([],a.interceptEvents,!0).forEach(function(e){a.eventConverter(a.eventRefactor(e))}),a.interceptEvents=[])},this.buildAppMessageEvent=function(e,n){var r,i,o,u=n[0];2>n.length?1===n.length&&(o=u):o=n[1];var s=a.growingIO.dataStore,c=s.eventContextBuilder,l=s.eventInterceptor,g=((null==o?void 0:o.path)||"").split("?"),p=t({eventType:"CUSTOM",eventName:"$mp_on_share"},c(e));p.attributes=Y(t(t(t({},null!==(r=p.attributes)&&void 0!==r?r:{}),{$from:null==u?void 0:u.from,$target:null===(i=null==u?void 0:u.target)||void 0===i?void 0:i.id,$share_title:null==o?void 0:o.title,$share_path:d(g),$share_query:g[1]}),null==o?void 0:o.attributes)),l(p)},this.buildTimelineEvent=function(e,n){var r,i,o,u=n[0];2>n.length?1===n.length&&(o=u):o=n[1];var s=a.growingIO.dataStore,c=s.eventContextBuilder,l=s.eventInterceptor,g=((null==o?void 0:o.path)||"").split("?"),p=t({eventType:"CUSTOM",eventName:"$mp_share_timeline"},c(e));p.attributes=Y(t(t(t({},null!==(r=p.attributes)&&void 0!==r?r:{}),{$target:null===(i=null==u?void 0:u.target)||void 0===i?void 0:i.id,$share_title:null==o?void 0:o.title,$share_path:d(g),$share_query:g[1]}),null==o?void 0:o.attributes)),l(p)},this.buildAddFavorites=function(e,n){var r,i,o=n[0];2>n.length?1===n.length&&(i=o):i=n[1];var u=a.growingIO.dataStore,s=u.eventContextBuilder,c=u.eventInterceptor,l=((null==i?void 0:i.path)||"").split("?"),g=t({eventType:"CUSTOM",eventName:"$mp_add_favorites"},s(e));g.attributes=Y(t(t({},null!==(r=g.attributes)&&void 0!==r?r:{}),{$share_title:null==i?void 0:i.title,$share_path:d(l),$share_query:l[1]})),c(g)},this.trackersExecute=function(e){a.initializedTrackingIds.forEach(function(t){"function"===A(e)&&e(t)})},this.initializedTrackingIds=[],this.eventContextBuilder=new Te(this.growingIO).main,this.eventHooks=new Ae(this.growingIO),this.shareOut=!1,this._gsid={},this._stid={},this.lastVisitEvent={},this.lastPageEvent={},this.locationData={},this.generalProps={},this.trackTimers={},this.interceptEvents=[];var s=this.growingIO,g=s.emitter,p=s.minipInstance;g.on(Pe,function(e){var t=e.trackingId;a.initializedTrackingIds.push(t),a.initStorageInfo(t)}),g.on(ve,function(e){var t=e.eventData,n=e.trackingId;"VISIT"===t.eventType&&(a.lastVisitEvent[n]=t),"PAGE"===t.eventType&&(a.lastPageEvent[n]=t)}),c(null===(r=p.minip)||void 0===r?void 0:r.onAppHide)&&p.minip.onAppHide(function(){a.trackersExecute(function(e){var t=a.trackTimers[e];P(t,function(e){e.start&&(e.leng=e.leng+(+Date.now()-e.start))})})}),c(null===(i=p.minip)||void 0===i?void 0:i.onAppShow)&&p.minip.onAppShow(function(){a.trackersExecute(function(e){var t=a.trackTimers[e];P(t,function(e){e.start&&(e.start=+Date.now())})})}),g.on(_e,function(e){var t=e.optionName,n=e.optionValue;"dataCollect"===t&&!1===n&&a.trackersExecute(function(e){a.growingIO.clearTrackTimer(e)})}),this.growingIO.emitter.on(ke,function(e){var t=e.oldSessionId,n=e.trackingId;if(t){var r=a.eventHooks.currentPage,i=r.getPagePath,o=r.getPageQuery,u=i(),s=o();if(u)a.sendVisit(n,{path:u,query:s});else{var c=a.lastPageEvent[n];a.sendVisit(n,{path:c.path,query:c.query})}a.eventHooks.currentPage.lifeBeforeShow||a.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}(),Ne={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"]}}},qe=t(t({},Ne),{listeners:t({},Ne.listeners),name:"KuaiShou",platform:"kuaishoup",scnPrefix:"ks_"}),Ue=function(t){function n(e){var n=t.call(this,e)||this;return n.growingIO=e,n.hookSetTitle(),n}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+n+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(n,t),n}(function(e){var t=this;this.growingIO=e,this.minip=Q("ks"),this.hookSetTitle=function(){var e,n=null===(e=t.minip)||void 0===e?void 0:e.setNavigationBarTitle,r=t;n&&Object.defineProperty(t.minip,"setNavigationBarTitle",{writable:!0,enumerable:!0,configurable:!0,value:function(){if(r.growingIO.gioSDKInitialized){var e=r.getCurrentPath(),t=(arguments[0]||{}).title;r.growingIO.dataStore.eventHooks.currentPage.configuredTitle[e]=t}return n.apply(this,arguments)}})},this.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,r=e.src,i=e.success,o=e.fail,a=e.complete;return null===(n=t.minip)||void 0===n?void 0:n.getImageInfo({src:r,success:i,fail:o,complete:a})},this.initImpression=function(e){var n,r;null===(r=null===(n=t.growingIO.plugins)||void 0===n?void 0:n.gioImpressionTracking)||void 0===r||r.main(e,"observeAll")},this.getCurrentPage=function(){return D(function(){return p(getCurrentPages())})||{}},this.getCurrentPath=function(){var e=t.getCurrentPage();return(null==e?void 0:e.route)||(null==e?void 0:e.uri)||(null==e?void 0:e.__route__)||""},this.getPageTitle=function(e){var n,r,i,a,u,s,c,g,d=W(),p="",f=$(d);"string"===A(f)&&(f=null!==(n=D(function(){return JSON.parse(f)}))&&void 0!==n?n:{});var v,h=(null==e?void 0:e.data)||e.$data||{};if((p=o(null==h?void 0:h.gioPageTitle)?null==h?void 0:h.gioPageTitle:"")||D(function(){var t,n,r=z(d);r&&(v=r["".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||C(m)||(e.route=m.path||"",p=e.route?t._getTitleFromTabBar(f,e.route):""),!p&&(v=l(f.pages)?null!==(r=f.pages.find(function(t){return t.path===e.route}))&&void 0!==r?r:{}:f.page||{})){var I=v[e.route]||v["".concat(e.route,".html")]||v;p=(null==I?void 0:I.navigationBarTitleText)||(null===(i=null==I?void 0:I.window)||void 0===i?void 0:i.navigationBarTitleText)}p||(p=t._getTitleFromTabBar(f,e.route))}return p||(p=["wx","tt"].includes(d)?null===(s=null===(u=null===(a=f||global||$global)||void 0===a?void 0:a.global)||void 0===u?void 0:u.window)||void 0===s?void 0:s.navigationBarTitleText:null===(g=null===(c=f||global||$global)||void 0===c?void 0:c.window)||void 0===g?void 0:g.navigationBarTitleText),L(p)},this._getTitleFromTabBar=function(e,t){var n,r,i=null===(r=null===(n=null==e?void 0:e.tabBar)||void 0===n?void 0:n.list)||void 0===r?void 0:r.find(function(e){return e.pagePath===t||e.pagePath==="".concat(t,".html")});return(null==i?void 0:i.text)||""},this.getStorageSync=function(e){var n,r=null===(n=t.minip)||void 0===n?void 0:n.getStorageSync(e);return s(r)&&r.expiredAt?r.expiredAt<Date.now()?"":r.value:r},this.getStorage=function(e){return new Promise(function(n){var r;null===(r=t.minip)||void 0===r||r.getStorage({key:e,success:function(e){var t=e.data;return n(t)},fail:function(){return n("")}})})},this.setStorageSync=function(e,n,r){var i;r&&(n={value:n,expiredAt:r}),null===(i=t.minip)||void 0===i||i.setStorageSync(e,n)},this.setStorage=function(e,n){var r;null===(r=t.minip)||void 0===r||r.setStorage({key:e,data:n})},this.removeStorageSync=function(e){var n;null===(n=t.minip)||void 0===n||n.removeStorageSync(e)},this.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 r;null===(r=t.minip)||void 0===r||r.getNetworkType({success:function(t){e.network=t,n(t)},fail:function(){return n(null)}})})},this.request=function(e){var n,r=e.url,i=e.data,o=e.header,a=e.timeout,u=e.method,s=e.success,l=e.fail,g=e.complete,d=null===(n=t.minip)||void 0===n?void 0:n.request({url:r,data:i,header:o,timeout:a,method:u,success:s,fail:l,complete:g}),p=setTimeout(function(){(null==d?void 0:d.abort)&&c(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 r;null===(r=t.minip)||void 0===r||r.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,r=n.platform,i=n.scnPrefix;this.platform=r,this.scnPrefix=i,this.growingIO.emitter.on(Oe,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()})})}),De=["gioPerformance"],Ke=function(e){var t,n,r,i,o,a,u=this;this.growingIO=e,this.innerPluginInit=function(){var e;De.forEach(function(e){var t;return b(null===(t=u.pluginsContext)||void 0===t?void 0:t.plugins,e)}),O(null===(e=u.pluginsContext)||void 0===e?void 0:e.plugins).forEach(function(e){var t,n,r=null!==(n=null===(t=u.pluginsContext)||void 0===t?void 0:t.plugins[e])&&void 0!==n?n:{},i=r.name,o=r.method;h(u.pluginItems,function(e){return e.name===i})||u.pluginItems.push({name:y(i||e),method:o||function(e){}})}),C(u.pluginItems)||u.installAll()},this.install=function(e,t,n){var r,i,o=u.growingIO.emitter,a=t||h(u.pluginItems,function(t){return t.name===e});if((null===(r=u.growingIO)||void 0===r?void 0:r.plugins)[e])return q("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return q("插件加载失败!不存在名为 ".concat(e," 的插件!"),"error"),!1;try{return(null===(i=u.growingIO)||void 0===i?void 0:i.plugins)[e]=new a.method(u.growingIO,n),t&&(o.emit(ye,e),q("加载插件 ".concat(e),"info")),!0}catch(n){return u.lifeError(t,n),q("插件【".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)&&!h(u.pluginItems,function(e){return e.name===t.name})&&u.pluginItems.push({name:y(t.name),method:t.method?t.method:function(){}})})},this.uninstall=function(e){var t;b(u.pluginItems,e);var n=b(null===(t=u.growingIO)||void 0===t?void 0:t.plugins,e);return n||q("卸载插件 ".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(Ie,{plugin:e,error:t}),q("插件执行错误 ".concat(e.name," ").concat(t),"error")},this.callLifeCycle=function(e,t){u.pluginItems.forEach(function(n){var r=u.growingIO.plugins[n.name]?u.growingIO.plugins[n.name][e]:void 0;if(r&&c(r))try{r(t)}catch(e){u.lifeError(n,e)}})},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on(ye,function(e){return u.callLifeCycle("onInstall",e)}),null===(n=this.growingIO.emitter)||void 0===n||n.on(Ie,function(e){return u.callLifeCycle("onError",e)}),null===(r=this.growingIO.emitter)||void 0===r||r.on(me,function(e){return u.callLifeCycle("onComposeBefore",e)}),null===(i=this.growingIO.emitter)||void 0===i||i.on(he,function(e){return u.callLifeCycle("onComposeAfter",e)}),null===(o=this.growingIO.emitter)||void 0===o||o.on(we,function(e){return u.callLifeCycle("onSendBefore",e)}),null===(a=this.growingIO.emitter)||void 0===a||a.on(Se,function(e){return u.callLifeCycle("onSendAfter",e)})},Le={},He={}.hasOwnProperty;function Re(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Be(e){try{return encodeURIComponent(e)}catch(e){return null}}Le.stringify=function(e,t){t=t||"";var n,r,i=[];for(r in"string"!=typeof t&&(t="?"),e)if(He.call(e,r)){if((n=e[r])||null!=n&&!isNaN(n)||(n=""),r=Be(r),n=Be(n),null===r||null===n)continue;i.push(r+"="+n)}return i.length?t+i.join("&"):""},Le.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,r={};t=n.exec(e);){var i=Re(t[1]),o=Re(t[2]);null===i||null===o||i in r||(r[i]=o)}return r};var Fe=function(e){var r=this;this.growingIO=e,this.generateURL=function(e){var t=r.growingIO.dataStore.getTrackerVds(e),n=t.serverUrl,i=t.projectId;return S(n,"http")?"".concat(n,"/v3/projects/").concat(i,"/collect"):"https://".concat(n,"/v3/projects/").concat(i,"/collect")},this.getHoardingQueue=function(e){var t;return null!==(t=r.hoardingQueue[e])&&void 0!==t?t:[]},this.getRequestQueue=function(e){var t;return null!==(t=r.requestQueue[e])&&void 0!==t?t:[]},this.commitRequest=function(e){var n,o,a=t({},e),u=r.growingIO,s=u.vdsConfig;u.emitter.emit(ve,{eventData:e,trackingId:e.trackingId}),s.forceLogin?(i(r.hoardingQueue[e.trackingId])&&(r.hoardingQueue[e.trackingId]=[]),null===(n=r.hoardingQueue[e.trackingId])||void 0===n||n.push(a)):(i(r.requestQueue[e.trackingId])&&(r.requestQueue[e.trackingId]=[]),null===(o=r.requestQueue[e.trackingId])||void 0===o||o.push(a),r.initiateRequest(e.trackingId))},this.initiateRequest=function(e,t){var i=r.growingIO,o=i.plugins,a=i.vdsConfig,u=i.minipInstance,s=i.dataStore,c=r.getHoardingQueue(e),l=r.getRequestQueue(e),g=n(n([],c,!0),l,!0),d=function(e){var n,i;if(null===(n=null==a?void 0:a.tbConfig)||void 0===n?void 0:n.cloudFuncSend)null===(i=null==o?void 0:o.gioTaobaoAdapter)||void 0===i||i.singleInvoke(e);else if(t)r.batchInvoke(e);else{var c=r.growingIO.dataStore.getTrackerVds(e).uploadInterval;E(r.batchInvoke,c,!1,!1)(e)}g.some(function(e){return"VISIT"===e.eventType})&&u.removeStorageSync(s.getStorageKey(e,"originalSource"))};if(g.length>0)if(r.requestingNum<r.requestLimit)d(e);else var p=setInterval(function(){r.requestingNum<r.requestLimit&&(d(e),clearInterval(p),p=void 0)},500)},this.batchInvoke=function(e){var i=r.growingIO,o=i.vdsConfig,a=i.emitter,u=r.getHoardingQueue(e),s=r.getRequestQueue(e),c=n(n([],u,!0),s,!0);c.length>50?(c=c.slice(0,50),u.length>50?r.hoardingQueue[e]=u.slice(50):(r.requestQueue[e]=s.slice(50-u.length),r.hoardingQueue[e]=[])):(r.hoardingQueue[e]=[],r.requestQueue[e]=[]);var l=c.filter(function(e){return(r.retryIds[e.requestId]||0)<=r.retryLimit});if(!C(l)){var g=l.map(function(e){var n=t({},e);return b(n,["requestId","trackingId"]),n});o.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(g,null,2)),a.emit(we,{eventsQueue:l,requestData:g,trackingId:e})}},this.sendEvent=function(e,t){var i,o=d(e).trackingId,a=r.growingIO,u=a.minipInstance,s=a.dataStore,c=a.emitter,l=a.plugins,g=s.getTrackerVds(o),p=g.compress,f=g.requestTimeout;r.requestingNum+=1;var v={"content-type":"jdp"===u.platform?"application/json":"application/json;charset=UTF-8"},h=n([],t,!0),m=!!p&&(null===(i=null==l?void 0:l.gioCompress)||void 0===i?void 0:i.compressToUTF16);m&&(h=l.gioCompress.compressToUTF16(JSON.stringify(t)),v["X-Compress-Codec"]="1");var I=r.generateURL(o);u.request({url:"".concat(I,"?stm=").concat(Date.now(),"&compress=").concat(m?"1":"0"),header:v,method:"POST",data:h,timeout:f,fail:function(n){[200,204].includes(n.code)||(e.forEach(function(e){r.requestFailFn(e)}),q("请求失败!".concat(JSON.stringify(n)),"error"),c.emit("ON_SEND_ERROR",{eventsQueue:e,requestData:t,trackingId:o}))},complete:function(e){r.requestingNum-=1,c.emit(Se,{result:e,requestData:t,trackingId:o}),r.initiateRequest(o)}})},this.requestFailFn=function(e){if(r.retryIds[e.requestId]||(r.retryIds[e.requestId]=0),r.retryIds[e.requestId]+=1,!r.requestQueue[e.trackingId].some(function(t){return t.requestId===e.requestId}))var t=setTimeout(function(){C(r.requestQueue[e.trackingId])?(r.requestQueue[e.trackingId].push(e),r.initiateRequest(e.trackingId)):r.requestQueue[e.trackingId].push(e),clearTimeout(t),t=null},800)},this.hoardingQueue={},this.requestQueue={},this.requestLimit=3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.growingIO.emitter.on(we,function(e){var t,n,i=e.eventsQueue,o=e.requestData,a=e.trackingId,u=r.growingIO,s=u.vdsConfig,c=u.plugins;a===r.growingIO.trackingId&&((null===(t=null==s?void 0:s.tbConfig)||void 0===t?void 0:t.cloudAppId)?null===(n=null==c?void 0:c.gioTaobaoAdapter)||void 0===n||n.tbCloudAppInvoke(i,o):r.sendEvent(i,o))})},je=function(e){var t=this;this.growingIO=e,this._getUidKey=function(){return t.growingIO.inPlugin?"_growing_plugin_uid_":"_growing_uid_"},this.getUid=function(){var e=t.growingIO.minipInstance;return 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,r=n.vdsConfig.sessionExpires,i=n.dataStore.trackersExecute;return t._sessionId[e]||t.setSessionId(e),r>-1&&(Date.now()>t._sessionExpires&&i(function(e){t.setSessionId(e)}),t._sessionExpires=Date.now()+6e4*r),t._sessionId[e]},this.setSessionId=function(e,n){var r=t._sessionId[e];n||(n=B()),t._sessionId[e]=n;var i=t.growingIO.vdsConfig.sessionExpires;i>-1&&(t._sessionExpires=Date.now()+6e4*i),r!==n&&t.growingIO.emitter.emit(ke,{trackingId:e,newSessionId:n,oldSessionId:r})},this._getUserIdKey=function(e){return t.growingIO.dataStore.getStorageKey(e,"userId")},this.getUserId=function(e){var n=t.growingIO.minipInstance;return t._userId[e]||(t._userId[e]=n.getStorageSync(t._getUserIdKey(e))),t._userId[e]},this.setUserId=function(e,n){var r=t._userId[e];t._userId[e]=i(n)?"":n,r!==t._userId[e]&&(t.growingIO.minipInstance.setStorage(t._getUserIdKey(e),t._userId[e]),t.growingIO.emitter.emit("USERID_UPDATE",{newUserId:n,oldUserId:r})),n&&t.setGioId(e,n)},this._getUserKeyKey=function(e){return t.growingIO.dataStore.getStorageKey(e,"userKey")},this.getUserKey=function(e){var n=t.growingIO.minipInstance;return t._userKey[e]||(t._userKey[e]=n.getStorageSync(t._getUserKeyKey(e))),t._userKey[e]},this.setUserKey=function(e,n){var r=t._userKey[e];t._userKey[e]=i(n)?"":n,r!==t._userKey[e]&&(t.growingIO.minipInstance.setStorage(t._getUserKeyKey(e),t._userKey[e]),t.growingIO.emitter.emit("USERKEY_UPDATE",{newUserKey:n,oldUserKey:r}))},this._getGioIdKey=function(e){return t.growingIO.dataStore.getStorageKey(e,"gioId")},this.getGioId=function(e){var n=t.growingIO.minipInstance;return t._gioId[e]||(t._gioId[e]=n.getStorageSync(t._getGioIdKey(e))),t._gioId[e]},this.setGioId=function(e,n){var r=t._gioId[e];t._gioId[e]=i(n)?"":n,r!==t._gioId[e]&&(t.growingIO.minipInstance.setStorage(t._getGioIdKey(e),t._gioId[e]),t.growingIO.emitter.emit("GIOID_UPDATE",{newGioId:n,oldGioId:r}))},this.initUserInfo=function(e){var n,r=t.growingIO.minipInstance,i=[t._getUidKey(),t._getUserIdKey(e),t._getUserKeyKey(e),t._getGioIdKey(e)],o=null!==(n=Z(r,i))&&void 0!==n?n:[];["_uid","_userId","_userKey","_gioId"].forEach(function(n,r){"_uid"===n?t.getUid():t[n][e]=o[r]})},this.saveUserInfo=function(){var e=t.growingIO,n=e.minipInstance;(0,e.dataStore.trackersExecute)(function(e){X(n,[{key:t._getUidKey(),value:t._uid},{key:t._getUserIdKey(e),value:t._userId[e]},{key:t._getUserKeyKey(e),value:t._userKey[e]},{key:t._getGioIdKey(e),value:t._gioId[e]}])})},this._uid=void 0,this._sessionId={},this._userId={},this._userKey={},this._gioId={},this._sessionExpires=-1},Ve=new function(){var e,r=this;this.init=function(e){var t;r.emitter.emit("ON_SDK_INITIALIZE_BEFORE",{options:e});try{if(q("Gio小程序SDK 初始化中...","info"),e.trackingId&&r.dataStore.initializedTrackingIds.includes(e.trackingId))throw Error("已存在实例 ".concat(e.trackingId,",请勿重复初始化!"));if(r.trackingId&&!r.plugins.gioMultipleInstances)throw Error("您正在尝试初始化另一个实例,请集成多实例插件后重试!");var n=r.dataStore.initTrackerOptions(e);return null===(t=r.emitter)||void 0===t||t.emit(Oe,n),r.gioSDKInitialized=!0,r.dataStore.initTrackerHooker(n),"quickapp"!==r.gioPlatform&&r.userStore.initUserInfo(e.trackingId),r.emitter.emit(Pe,n),r.trackingId&&r.trackingId!==e.trackingId||(J().__gio__=function(){return r}),q("Gio小程序SDK 初始化完成!","success"),r.inPlugin&&"tbp"!==r.minipInstance.platform&&r.dataStore.sendVisit(n.trackingId),r.vdsConfig.forceLogin&&q("forceLogin已开启,请调用 identify 方法设置 openId 以继续上报!","info"),!0}catch(e){return q(e,"error"),!1}},this.handlerDistribute=function(e,t,i){var o=r.dataStore,a=o.initializedTrackingIds;if((0,o.getTrackerVds)(e)&&a.includes(e))return r[t].apply(r,n([e],i,!1));q("不存在实例:".concat(e,",请检查!"),"warn")},this.registerPlugins=function(e){r.plugins.pluginItems=n(n([],r.plugins.pluginItems,!0),e,!0),r.plugins.installAll(e)},this.getPlugins=function(){return r.plugins.pluginItems},this.getDeviceId=function(){return r.userStore.getUid()},this.getOption=function(e,t){return r.dataStore.getOption(e,t)},this.setOption=function(e,t,n){var i;return O(ce).includes(t)?typeof n===(null===(i=ae[t])||void 0===i?void 0:i.type)?(r.dataStore.setOption(e,t,n),q("已修改".concat(ce[t],": ").concat(n),"info"),!0):(q("参数格式不正确:".concat(n,",请检查后重试!"),"error"),!1):(q("不存在可修改的配置项:".concat(t,",请检查后重试!"),"error"),!1)},this.setPageAttributes=function(e,t){if(s(t)&&!C(t)){var n=r.dataStore.eventHooks.currentPage,i=n.getPagePath();return C(n.pageProps[e])&&(n.pageProps[e]={}),C(n.pageProps[e][i])&&(n.pageProps[e][i]={}),C(t)||P(t,function(t,r){c(n.pageProps[e][i][r])&&!c(t)||(n.pageProps[e][i][r]=t)}),!0}return U("setPageAttributes"),!1},this.clearPageAttributes=function(e,t){try{if(!C(r.dataStore.eventHooks.currentPage.pageProps[e])){var n=r.dataStore.eventHooks.currentPage,i=n.getPagePath();l(t)&&!C(t)?t.forEach(function(t){b(n.pageProps[e][i],t)}):n.pageProps[e][i]={}}}catch(e){return U("clearPageAttributes"),!1}},this.sendPage=function(e,t){r.dataStore.getTrackerVds(e).trackPage?q("仅在关闭trackPage时允许调用sendPage,请确认后修改初始化配置项!","error"):r.dataStore.sendPage(e,t)},this.identify=function(e,t){if(e===r.trackingId)if(r.vdsConfig.forceLogin){if(!oe(t))return void U("identify");var n=m(t).slice(0,1e3);r.userStore.setUid(n),r.dataStore.setOption(r.trackingId,"forceLogin",!1),r._identified=!0,r.dataStore.trackersExecute(function(e){var t=r.uploader.getHoardingQueue(e);t.forEach(function(e,r){return t[r].deviceId=n}),r.uploader.initiateRequest(e,!0)})}else r._identified?U("identify",!1,"请勿重复调用"):U("identify",!1,"forceLogin未开启");else U("identify",!1,"子实例不允许调用identify")},this.setUserAttributes=function(e,n){var i,o,a,u;if(s(n)&&!C(n)){var c=r.dataStore,l=c.eventContextBuilder,g=c.eventInterceptor,d=c.lastVisitEvent,p=t({eventType:"LOGIN_USER_ATTRIBUTES"},l(e));p.attributes=Y(t(t({},null!==(i=p.attributes)&&void 0!==i?i:{}),R(n))),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 U("setUserAttributes")},this.setUserId=function(e,t,n){if(oe(t)){var o=r.userStore.getGioId(e);t=m(t).slice(0,1e3),n=m(n).slice(0,1e3),r.userStore.setUserId(e,t);var a=!i(n)&&m(n).length>0?m(n).slice(0,1e3):"";r.userStore.setUserKey(e,a),!r.dataStore.getTrackerVds(e).idMapping&&a&&q("您设置了 userKey ,请初始化开启 idMapping!","warn"),o&&o!==t&&r.userStore.setSessionId(e)}else U("setUserId")},this.clearUserId=function(e){r.userStore.setUserId(e,void 0),r.userStore.setUserKey(e,void 0)},this.setGeneralProps=function(e,t){return s(t)&&!C(t)?(C(r.dataStore.generalProps[e])&&(r.dataStore.generalProps[e]={}),P(t,function(t,n){c(r.dataStore.generalProps[e][n])&&!c(t)||(r.dataStore.generalProps[e][n]=t)}),!0):(U("setGeneralProps"),!1)},this.clearGeneralProps=function(e,t){try{C(r.dataStore.generalProps[e])||(l(t)&&!C(t)?t.forEach(function(t){b(r.dataStore.generalProps[e],t)}):r.dataStore.generalProps[e]={})}catch(e){return U("clearGeneralProps"),!1}},this.track=function(e,n,i){H(n,function(){var o,a=r.dataStore,u=a.eventContextBuilder,c=a.eventInterceptor,l=t({eventType:"CUSTOM",eventName:n},u(e));l.attributes=Y(t(t({},null!==(o=l.attributes)&&void 0!==o?o:{}),R(t({},s(i)&&!C(i)?i:{})))),r.plugins.gioMultipleInstances&&i&&i["&&sendTo"]&&(l["&&sendTo"]=i["&&sendTo"]),c(l)})},this.trackTimerStart=function(e,t){return r.dataStore.getTrackerVds(e).dataCollect?H(t,function(){var n=B();return r.dataStore.trackTimers[e]||(r.dataStore.trackTimers[e]={}),r.dataStore.trackTimers[e][n]={eventName:t,leng:0,start:+Date.now()},n}):(q("指定实例未开启数据采集,请检查!","error"),!1)},this.trackTimerPause=function(e,t){var n=r.dataStore.trackTimers[e];if(t&&n&&n[t]){var i=n[t];return i.start&&(i.leng=i.leng+(+Date.now()-i.start)),i.start=0,!0}return!1},this.trackTimerResume=function(e,t){var n=r.dataStore.trackTimers[e];if(t&&n&&n[t]){var i=n[t];return 0===i.start&&(i.start=+Date.now()),!0}return!1},this.trackTimerEnd=function(e,n,i){var o,a=r.dataStore.getTrackerVds(e).dataCollect,u=r.dataStore.trackTimers[e];if(n&&u&&u[n]){if(a){var c=u[n];if(0!==c.start){var l=+Date.now()-c.start;c.leng=l>0?c.leng+l:0}var g=r.dataStore,d=g.eventContextBuilder,p=g.eventInterceptor,f=t({eventType:"CUSTOM",eventName:c.eventName},d(e));return f.attributes=Y(t(t({},null!==(o=f.attributes)&&void 0!==o?o:{}),R(t(t({},s(i)&&!C(i)?i:{}),{event_duration:c.leng>864e5?0:c.leng/1e3})))),r.plugins.gioMultipleInstances&&i&&i["&&sendTo"]&&(f["&&sendTo"]=i["&&sendTo"]),p(f),!0}return q("指定实例未开启数据采集,计时器已移除,请检查!","error"),!1}return q("未查询到指定计时器,请检查!","error"),!1},this.removeTimer=function(e,t){var n=r.dataStore.trackTimers[e];return t&&n&&n[t]?(delete n[t],!0):(q("未查询到指定计时器,请检查!","error"),!1)},this.clearTrackTimer=function(e){r.dataStore.trackTimers[e]={}},this.setLocation=function(e,t,n){C(r.dataStore.locationData[e])&&(r.dataStore.locationData[e]={});var i=r.dataStore.locationData[e],o=function(e){return e>=-180&&180>=e};o(t)&&o(n)&&(i.latitude!==t||i.longitude!==n)&&(r.dataStore.locationData[e]={latitude:t,longitude:n})},this.updateImpression=function(){q("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.getABTest=function(e,t,n){q("获取ABTest数据错误! 请集成ABTest插件后重试!","error"),K(n,{})},this.getGioInfo=function(e){var t,n,i=r.userStore,o=i.getUid,a=i.getUserId,u=i.getUserKey,s=i.getSessionId,c=r.dataStore.getTrackerVds(e),l=c.projectId,g=c.appId,d=c.dataSourceId,p=c.dataCollect,f=c.idMapping,v=c.extraParams,h=c.ignoreFields,m={gioappid:g,giocs1:a(e)||"",gioplatform:r.platformConfig.platform,gioprojectid:l,gios:s(e),giou:o()};if(m.giodatacollect=p,m.giodatasourceid=d,f&&(m.giouserkey=u(e)),C(v)||v.forEach(function(t){var n;h.includes(t)||(m["gio".concat(t)]=(null!==(n=r.dataStore.lastVisitEvent[e])&&void 0!==n?n:{})[t])}),e===r.trackingId){var I=null!==(n=null===(t=r.plugins)||void 0===t?void 0:t.gioEventAutoTracking)&&void 0!==n?n:{},y=I.circleServerUrl,S=I.circleOpen;if(y&&S){var w=te(y.split("?")[1]);w.roomId&&(m.giocircleroomid=w.roomId)}}return Le.stringify(m)},this.utils=t(t(t({},N),ie),{qs:Le}),this.emitter={all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(e){e(n)}),(r=e.get("*"))&&r.slice().map(function(e){e(t,n)})}},this.gioPlatform="ks",this.gioFramework="native",this.sdkVersion="4.4.2";try{"quickapp"===this.gioPlatform||c(getApp)&&c(App)?this.inPlugin=!1:this.inPlugin=!0}catch(e){this.inPlugin=!0}this.inPlugin&&q("未检测到小程序实例,自动切换为插件模式!","info"),this.platformConfig=qe,this.minipInstance=new Ue(this),this.dataStore=new xe(this),this.userStore=new je(this),this.uploader=new Fe(this),this.plugins=new Ke(this),this.plugins.innerPluginInit()},Me=function(){var e,n=arguments[0],r="g0",i=n;if(n.indexOf(".")>-1&&(r=null!==(e=n.split(".")[0])&&void 0!==e?e:"g0",i=n.split(".")[1]),o(i)&&se.includes(i)&&Ve[i]){var a=f(Array.from(arguments));if("init"===i){var u=function(e,t){var n=m(t[0]),r=m(t[1]),i=(4===t.length?t[3]:t[2])||{};return n&&r?e.dataStore.initializedTrackingIds.some(function(t,i){var o=0===i?e.vdsConfig:e.subInstance[t];return o.projectId===n&&o.dataSourceId===r})?(q("SDK初始化失败,重复初始化,请检查初始化参数!","error"),!1):{projectId:n,dataSourceId:r,appId:m(4===t.length?t[2]:""),userOptions:i}:(q('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", "您的小程序 AppId(可选)", options: { serverUrl: "您的数据上报地址" }); 进行初始化!',"error"),!1)}(Ve,a);if(u){var s=u.projectId,c=u.dataSourceId,l=u.appId,g=u.userOptions;return Ve.init(t(t({},g),{projectId:s,dataSourceId:c,appId:l,trackingId:r}))}return!1}if("registerPlugins"===i)Ve.registerPlugins(a[0]);else{if(Ve.gioSDKInitialized&&Ve.vdsConfig)return ue.includes(i)?D(function(){return Ve.handlerDistribute(r,i,a)}):D(function(){return Ve[i].apply(Ve,a)});q("SDK未初始化!","error")}}else if(le.includes(i))q("方法 ".concat(m(i)," 已被弃用,请移除!"),"warn");else{if("canIUse"===i)return se.includes(arguments[1])&&!!Ve[arguments[1]];q("不存在名为 ".concat(m(i)," 的方法调用!"),"error")}};J().gdp=Me,J().gioSDKVersion=Ve.sdkVersion;var Ge=Ve.dataStore.eventHooks,Qe=Ge.growingApp,$e=Ge.growingPage,ze=Ge.growingComponent,We=Ge.growingBehavior;(0,Ge.initOriginalValue)();var Je=D(function(){return null!=Qe?Qe:App}),Ye=D(function(){return null!=$e?$e:Page}),Ze=D(function(){return null!=ze?ze:Component}),Xe=D(function(){return null!=We?We:Behavior});export{Je as GioApp,Xe as GioBehavior,Ze as GioComponent,Ye as GioPage,Me as default};
|
|
1
|
+
var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};function n(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var r=/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/,i=function(e){return["undefined","null"].includes(x(e))},o=function(e){return"string"===x(e)},a=function(e){return"number"===x(e)},u=function(e){return"boolean"===x(e)},s=function(e){return"[object Object]"==={}.toString.call(e)&&!i(e)},c=function(e){return["function","asyncfunction"].includes(x(e))},l=function(e){return Array.isArray(e)&&"array"===x(e)},g=function(e){return"date"===x(e)},d=function(e){try{return Array.from(e)[0]}catch(e){return}},p=function(e){try{var t=Array.from(e);return t[t.length-1]}catch(e){return}},f=function(e,t){return void 0===t&&(t=1),l(e)&&a(t)?e.slice(t>0?t:1,e.length):e},v=function(e,t){if(void 0===t&&(t=!1),l(e)){for(var n=0,r=[],i=0,o=e;i<o.length;i++){var a=o[i];a&&!C(a)&&(r[n++]=a),t&&0===a&&(r[n++]=a)}return r}return e},h=function(e,t){if(l(e)){var n=e.findIndex(t);return 0>n?void 0:e[n]}},m=function(e){return i(e)?"":"".concat(e)},I=function(e,t){return"string"===x(e)?e.split(t):e},y=function(e){if(o(e)){var t=I(e,"");return"".concat(d(t).toLowerCase()).concat(f(t).join(""))}return e},S=function(e,t){return o(e)||(e=m(e)),e.slice(0,t.length)===t},w={}.hasOwnProperty,_=function(e,t){return null!=e&&("object"==typeof e||"function"==typeof e)&&w.call(e,t)},O=function(e){return s(e)?Object.keys(e):[]},P=function(e,t){O(e).forEach(function(n){return t(e[n],n)})},k=function(e,t){var n=O(e);return!(!s(e)||!s(t)||n.length!==O(t).length||n.map(function(n,r){return s(e[n])?k(e[n],t[n]):e[n]===t[n]}).includes(!1))},T=function(e,t,n){var r=e;return s(e)?(t.split(".").forEach(function(e){r=r?r[e]:n}),r):n},b=function(e,t){if(!s(e))return!1;try{if("string"===x(t))return delete e[t];if("array"===x(t))return t.map(function(t){return delete e[t]});"object"===x(t)&&t.constructor===RegExp&&O(e).forEach(function(n){t.test(n)&&b(e,n)})}catch(e){return!1}},E=function(e,t,n,r){var i;void 0===t&&(t=250);var o=0;return"boolean"!==x(n)&&(r=e,e=n,n=void 0),function(){for(var a=[],u=0;arguments.length>u;u++)a[u]=arguments[u];var s=this,c=Date.now()-o;function l(){o=Date.now(),e.apply(s,a)}r&&!i&&l(),i&&clearTimeout(i),void 0===r&&c>t?l():!0!==n&&(i=setTimeout(r?function(){i=void 0}:l,void 0===r?t-c:t))}},C=function(e){return l(e)?0===e.length:s(e)?0===O(e).length:!e},x=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},A=function(e){function t(e){return 10>e?"0"+e:e}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+" "+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+"."+t(e.getMilliseconds())},q=Object.freeze({__proto__:null,isNil:i,isString:o,isNaN:function(e){return"NaN"===m(Number(e))},isNumber:a,isBoolean:u,isObject:s,isRegExp:function(e){return"[object RegExp]"==={}.toString.call(e)},isFunction:c,isArray:l,isDate:g,fixed:function(e,t){return a(e)?Number(e.toFixed(a(t)?t:2)):o(e)&&"NaN"!==m(Number(e))?Number(Number(e).toFixed(a(t)?t:2)):e},head:d,last:p,drop:f,dropWhile:function(e,t){return l(e)?e.filter(function(e){return!t(e)}):e},compact:v,find:h,isEqualArray:function(e,t){return!(!l(e)||!l(t)||e.length!==t.length)&&e.every(function(e,n){return e===t[n]})},toString:m,split:I,lowerFirst:y,upperFirst:function(e){if(o(e)){var t=I(e,"");return"".concat(d(t).toUpperCase()).concat(f(t).join(""))}return e},startsWith:S,endsWith:function(e,t){var n=e.length,r=n;r>n&&(r=n);var i=r;return(r-=t.length)>=0&&e.slice(r,i)===t},hasOwnProperty:w,has:_,keys:O,forEach:P,isEqual:k,get:T,unset:b,throttle:E,isEmpty:C,typeOf:x,formatDate:A}),N=function(e,t){console.log("%c[GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444",warn:"color: #F59E0B",success:"color: #10B981"}[t]||"")},U=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),N("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},D=function(e){try{return e()}catch(e){return}},K=function(e,t){if(c(e))try{e(t)}catch(e){N("回调执行失败!".concat(e),"error")}},L=function(e){return o(e)?e.trim().substring(0,100):e},H=function(e,t){return o(e)&&!C(e)&&e.match(r)?t():(N("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},R=function(e){return i(e)||O(e).forEach(function(t){c(e[t])?e[t]=D(function(){return e[t]()}):s(e[t])?b(e,t):l(e[t])||(e[t]=m(e[t]))}),e},F=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},B=function(e){return e.pixelRatio?Math.round(e.screenHeight*e.pixelRatio):e.screenHeight},j=function(e){return e.pixelRatio?Math.round(e.screenWidth*e.pixelRatio):e.screenWidth},V=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)}},M=function(e){if(o(e)){var t=e.indexOf("?");return-1!==t?[e.substring(0,t),e.substring(t+1)]:[e,""]}return["",""]},G=function(e){return o(e)?e.startsWith("/")?e:"/".concat(e):""},Q=function(e){return D(function(){switch(e){case"wx":return wx;case"my":case"tb":return my;case"swan":return swan;case"tt":return tt;case"qq":return qq;case"ks":return ks;case"jd":return jd;case"xhs":return xhs;default:var t=void 0;return t||(t=D(function(){return xhs})),t||(t=D(function(){return swan})),t||(t=D(function(){return my})),t||(t=D(function(){return tt})),t||(t=D(function(){return qq})),t||(t=D(function(){return ks})),t||(t=D(function(){return jd})),t||(t=D(function(){return wx})),t}})},$=function(e){return D(function(){switch(e){case"wx":return __wxConfig;case"swan":return appConfig;case"tt":return D(function(){return __ttConfig})||(null===global||void 0===global?void 0:global.TMAConfig)||(null===globalThis||void 0===globalThis?void 0:globalThis.TMAConfig);case"qq":return __qqConfig;case"ks":return __ksConfig;case"jd":return __jdConfig;case"xhs":return null!==__MP_APP_JSON_MIGRATION__&&void 0!==__MP_APP_JSON_MIGRATION__?__MP_APP_JSON_MIGRATION__:__MP_APP_JSON__;default:return}})},z=function(e){return D(function(){switch(e){case"wx":case"qq":return __wxAppCode__;case"tt":return __allConfig__;case"ks":return __module__;case"jd":return __jdAppCode__;default:return}})},W=function(){var e;return!e&&D(function(){return xhs})&&(e="xhs"),!e&&D(function(){return swan})&&(e="swan"),!e&&D(function(){return tt})&&(e="tt"),!e&&D(function(){return qq})&&(e="qq"),!e&&D(function(){return my.tb})&&(e="tb"),!e&&D(function(){return my})&&(e="my"),!e&&D(function(){return ks})&&(e="ks"),!e&&D(function(){return jd})&&(e="jd"),!e&&D(function(){return wx})&&(e="wx"),e||h(O(global),function(e){return m(e).toLowerCase().includes("quickapp")})&&(e="quickapp"),e},J=function(){var e;return null!==(e=D(function(){var e;return null!==(e=D(function(){var e;return null!==(e=D(function(){return $global}))&&void 0!==e?e:global}))&&void 0!==e?e:window}))&&void 0!==e?e:globalThis},Y=function(e){var t={};return s(e)&&(b(e,"&&sendTo"),P(e,function(e,n){var r=m(n).slice(0,100);s(e)?t[r]=Y(e):l(e)?(t[r]=v(e.slice(0,100),!0),t[r]=t[r].join("||").slice(0,1e3)):g(e)?t[r]=A(e):t[r]=i(e)?"":m(e).slice(0,1e3)})),t},Z=function(e,t){var n=function(){return t.map(function(t){return e.getStorageSync(t)})};try{return e.minip.canIUse("batchGetStorageSync")?e.minip.batchGetStorageSync(t):n()}catch(e){return n()}},X=function(e,t){var n=function(){return t.map(function(t){var n=t.key,r=t.value;return e.setStorageSync(n,r)})};try{return e.minip.canIUse("batchSetStorageSync")?e.minip.batchSetStorageSync(t):n()}catch(e){return n()}},ee=function(e){return O(e||{}).map(function(t){return t?"".concat(t,"=").concat(i(e[t])?"":e[t]):""}).join("&")},te=function(e){(S(e,"?")||S(e,"&"))&&(e=e.slice(1,e.length));var t={};return e.split("&").forEach(function(e){var n=e.split("=");n[0]&&(t[n[0]]=n[1])}),t},ne=["wxShoppingListScene","$taroTimestamp","gdpCircleRoomCollectUrl"],re=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n="string"==typeof e?te(e):e||{};function r(e,t){if("object"!=typeof e||null===e||Array.isArray(e))return e;var r={};return O(e).forEach(function(i){var o=ne.some(function(e){return i.includes(e)}),a=_(n,i);if(!(o||t&&a)){var u=e[i];"string"==typeof u?ne.some(function(e){return u.includes(e)})||(r[i]=u):"number"!=typeof u&&"boolean"!=typeof u||(r[i]=u)}}),r}return Object.assign({},r(n,!1),r(t,!0))},ie=Object.freeze({__proto__:null,consoleText:N,callError:U,niceTry:D,niceCallback:K,limitString:L,eventNameValidate:H,getDynamicAttributes:R,guid:F,getScreenHeight:B,getScreenWidth:j,getOS:V,compareVersion:function(e,t){void 0===e&&(e=""),void 0===t&&(t="");for(var n=function(e){return e.replace(/\s+/g,"")},r=function(e){return e.replace(/[vV]/g,"")},i=n(r(e)),o=n(r(t)),a=i.split("."),u=o.split("."),s=0;3>s;s++){var c=Number(a[s]),l=Number(u[s]);if(c>l)return 1;if(l>c)return-1;if(!isNaN(c)&&isNaN(l))return 1;if(isNaN(c)&&!isNaN(l))return-1}return 0},getVueVersion:function(e){if(e){var t=Number(d(I(e.version,".")));return Number.isNaN(t)?0:t}return 0},splitPath:M,normalPath:G,isTaro3:function(e){var t=e.Current,n=e.createComponent;return!(!e||!t||n)},getPlainMinip:Q,getPlainConfig:$,getPlainAppCode:z,getPlainPlatform:W,getSubKeys:function(e){return O(e).filter(function(e){return e.indexOf("__sub")>-1&&e.indexOf("gio__")>-1}).sort()},getAppInst:function(){var e=D(function(){return getApp({allowDefault:!0})});return e||(e=J()),e},getGlobal:J,limitObject:Y,batchGetStorageSync:Z,batchSetStorageSync:X,qsStringify:ee,qsParse:te,hashCode:function(e,t){void 0===t&&(t=!1);var n=0;if(C(e)||"boolean"==typeof e)return n;for(var r=0;r<e.length;)n=(n<<5)-n+e.charCodeAt(r),n&=n,r++;return t?Math.abs(n):n},getExtraData:function(e){var t;return o(e)?null!==(t=D(function(){return JSON.parse(e)}))&&void 0!==t?t:{}:null!=e?e:{}},getPureParams:re}),oe=function(e){return(o(e)&&e.length>0||a(e)&&e>0)&&!["-","null","undefined"].includes(e)},ae={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},idMapping:{type:"boolean",default:!1},enableIdMapping:{type:"boolean",default:!1},extraParams:{type:"array",default:[]},followShare:{type:"boolean",default:!0},forceLogin:{type:"boolean",default:!1},ignoreFields:{type:"array",default:[]},impressionScale:{type:"number",default:0},pluginMode:{type:"boolean",default:!1},originalSource:{type:"boolean",default:!0},keepAlive:{type:"number",default:5},performance:{type:"object",default:{monitor:!0,exception:!0}},serverUrl:{type:"string",default:"https://napi.growingio.com"},sessionExpires:{type:"number",default:-1},requestTimeout:{type:"number",default:5e3},taro:{type:["object","module"],default:!1},taroVue:{type:["object","function"],default:!1},mpx:{type:["module","function"],default:!1},tbConfig:{type:"object",default:{cloud:void 0,cloudFuncSend:!1,cloudFuncName:"httpTunnel",cloudFuncHandler:"main",cloudAppId:void 0,path:void 0}},trackPage:{type:"boolean",default:!0},uniVue:{type:["object","function"],default:!1},uploadInterval:{type:"number",default:1e3},version:{type:"string",default:"1.0.0"}},ue=["clearGeneralProps","clearPageAttributes","clearTrackTimer","clearUserId","getABTest","getGioInfo","getOption","identify","removeTimer","sendPage","sendVisit","setGeneralProps","setLocation","setOption","setPageAttributes","setUserAttributes","setUserId","track","trackTimerEnd","trackTimerPause","trackTimerResume","trackTimerStart"],se=n(n(["init","registerPlugins"],["getPlugins","getDeviceId","updateImpression"],!0),ue,!0),ce={autotrack:"无埋点",dataCollect:"数据采集",debug:"调试模式",serverUrl:"数据上报服务地址",ignoreFields:"忽略上报字段"},le=["enableDebug","setAutotrack","setDataCollect","setTrackerHost","setTrackerScheme","setConfig","collectImp","setPlatformProfile","getLocation"],ge=["deviceBrand","deviceModel","deviceType","networkState","screenHeight","screenWidth","operatingSystem"],de=n(n([],ge,!0),["appChannel","language","platformVersion"],!1),pe={gsid:"_growing_gsid_",originalSource:"_gdp_original_source_",userId:"_growing_userId_",userKey:"_growing_userKey_",gioId:"_growing_gioId_",plugin_gsid:"_growing_plugin_gsid_",plugin_originalSource:"_gdp_plugin_original_source_",plugin_userId:"_growing_plugin_userId_",plugin_userKey:"_growing_plugin_userKey_",plugin_gioId:"_growing_plugin_gioId_"},fe="MINIP_LIFECYCLE",ve="ON_COMMIT_REQUEST",he="ON_COMPOSE_AFTER",me="ON_COMPOSE_BEFORE",Ie="ON_ERROR",ye="ON_INSTALL",Se="ON_SEND_AFTER",we="ON_SEND_BEFORE",_e="OPTION_CHANGE",Oe="OPTION_INITIALIZED",Pe="SDK_INITIALIZED",ke="SESSIONID_UPDATE",Te=function(e){var n=this;this.growingIO=e,this.main=function(e,r,i){var o;void 0===i&&(i=!0),e||(e=n.growingIO.trackingId);var a=n.growingIO,u=a.sdkVersion,s=a.platformConfig,c=a.minipInstance,l=a.userStore,g=a.dataStore,d=a.dataStore,p=d.scene,f=d.eventHooks.currentPage,v=d.generalProps,h=g.getTrackerVds(e),m=h.version,I=h.dataSourceId,y=h.appId,S=h.idMapping,w=h.ignoreFields,_=g.locationData[e],O=c.systemInfo,P=void 0===O?{}:O,k=c.network,T=void 0===k?{}:k,E=P.brand,x=P.model,A=P.platform,q=P.language,N=f.getPagePath(),U={appChannel:"scn:".concat(p||"NA"),appVersion:m,dataSourceId:I,deviceBrand:E,deviceId:l.getUid(),deviceModel:x,deviceType:V(A,s.name),domain:y,language:q,latitude:null==_?void 0:_.latitude,longitude:null==_?void 0:_.longitude,networkState:(null===(o=null==T?void 0:T.networkType)||void 0===o?void 0:o.result)||(null==T?void 0:T.networkType)||(null==T?void 0:T.type)||(null==T?void 0:T.subtype),operatingSystem:V(A,s.name),path:N,platform:s.platform,platformVersion:s.name+(P.version?" ".concat(P.version):""),query:N?f.getPageQuery():"",screenHeight:B(P),screenWidth:j(P),sdkVersion:u,sessionId:l.getSessionId(e),title:f.getPageTitle(),timestamp:Date.now(),timezoneOffset:(new Date).getTimezoneOffset(),userId:l.getUserId(e)};return S&&(U.userKey=l.getUserKey(e)),i&&!C(v[e])&&(U.attributes=t({},v[e])),C(U.attributes)||(U.attributes=Y(R(t({},U.attributes)))),C(w)||w.forEach(function(e){b(U,e)}),C(r)?t(t({},U),{trackingId:e}):t(t(t({},U),r),{trackingId:e})}},be=function(e){var n=this;this.growingIO=e,this.enterParams={},this.main=function(e,r){var i,o,a=Date.now(),u=n.growingIO,s=u.emitter,c=u.userStore,l=u.vdsConfig,g=u.platformConfig,d=u.uploader,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(fe,{event:"App ".concat(e),timestamp:a,params:null!==(i=r[0])&&void 0!==i?i:{}}),l.debug&&console.log("App:",e,a);var w=g.listeners.app;switch(s.emit(me,{event:"App ".concat(e),params:null!==(o=r[0])&&void 0!==o?o:{}}),e){case w.appLaunch:n.enterParams=t({},r[0]);break;case w.appCreate:case w.appShow:var _=n.enterParamsParse(r[0]),O=_.path,P=_.query,k=_.referralPage;!m&&l.originalSource&&O&&h(function(e){S(e,{path:O,query:P,referralPage:k})}),I?(Date.now()-I>60*l.keepAlive*1e3||p.lastScene&&p.scene!==p.lastScene)&&h(function(e){c.setSessionId(e)}):h(function(e){p.lastVisitEvent[e]={path:O,query:P,referralPage:k},n.buildVisitEvent(e,{path:O,query:P,referralPage:k})}),f.setNetworkStatusListener();break;case w.appClose:p.lastScene=p.scene,p.lastCloseTime=Date.now(),y(),c.saveUserInfo(),h(function(e){n.buildCloseEvent(e),l.forceLogin||d.initiateRequest(e,!0)})}},this.enterParamsParse=function(e){var t;void 0===e&&(e={});var r=n.growingIO,i=r.gioPlatform,o=r.minipInstance,a=r.dataStore,u="",s="",c="";if("quickapp"!==i&&o.minip.canIUse("getEnterOptionsSync")){var l=o.minip.getEnterOptionsSync()||{},g=l.path,d=l.query,p=l.scene,f=l.referrerInfo||l.refererInfo;u=g||e.path,s=d||e.query,c=(null==f?void 0:f.appId)||(null===(t=null==e?void 0:e.referrerInfo)||void 0===t?void 0:t.appId)||"",a.scene=p||e.scene,b(d,"gdpCircleRoomCollectUrl"),s=ee(re(s,(null==f?void 0:f.extraData)||{}))}else g=e.path,d=e.query,f=e.referrerInfo,u=g,s=ee(d),c=(null==f?void 0:f.appId)||"",n.parseScene(e);return{path:u,query:s,referralPage:c}},this.parseScene=function(e){var t,r,i=n.growingIO,o=i.minipInstance,a=i.gioPlatform,u=i.dataStore;if("quickapp"===a){var s=o.getAppSource(),c=s.extra,l=s.type;r=(null==c?void 0:c.scene)||l}else C(e)||((null===(t=null==e?void 0:e.query)||void 0===t?void 0:t.wxShoppingListScene)?r=e.query.wxShoppingListScene:(null==e?void 0:e.scene)?r=e.scene:u.scene="NA");u.scene=r},this.buildVisitEvent=function(e,r){var i=n.growingIO,o=i.dataStore,a=o.getOriginalSource,u=o.eventContextBuilder,s=o.eventInterceptor,c=i.vdsConfig,l=a(e),g=(null==r?void 0:r.query)||"",d=t({eventType:"VISIT"},u(e,{}));!C(r)&&r.path&&(d.path=r.path||"",d.query="string"===x(g)?g:ee(g),r.referralPage&&(d.referralPage=r.referralPage)),c.originalSource&&!C(l)&&(d=t(t({},d),l)),s(d)},this.buildCloseEvent=function(e){var r=n.growingIO.dataStore,i=r.eventContextBuilder;(0,r.eventInterceptor)(t({eventType:"APP_CLOSED"},i(e)))}},Ee=function(){function e(e){var n=this;this.growingIO=e,this.lifeBeforeShow=!0,this.getPagePath=function(){var e,t,r,i=n.growingIO,o=i.minipInstance,a=i.inPlugin,u=i.dataStore,s=i.trackingId,c=o.getCurrentPath();if(a){var l=u.getTrackerVds(s);return c||"/插件".concat(l.appId)}return c||(null===(e=u.eventHooks.appEffects.enterParams)||void 0===e?void 0:e.path)||(null===(t=u.lastPageEvent[s])||void 0===t?void 0:t.path)||(null===(r=u.lastVisitEvent[s])||void 0===r?void 0:r.path)},this.getPageQuery=function(){var e,t,r,i,o,a,u=n.growingIO,s=u.minipInstance,c=u.dataStore,l=u.trackingId,g=s.getCurrentPage(),d=s.getCurrentPath(),p=c.eventHooks.appEffects.enterParams,f=void 0===p?{}:p;if(!d)return f.path?ee(re(null==f?void 0:f.query,null===(r=null==f?void 0:f.referrerInfo)||void 0===r?void 0:r.extraData)):(null===(i=c.lastPageEvent[l])||void 0===i?void 0:i.path)?null===(o=c.lastPageEvent[l])||void 0===o?void 0:o.query:null===(a=c.lastVisitEvent[l])||void 0===a?void 0:a.query;var v=null!==(e=g.options)&&void 0!==e?e:g.$taroParams;return C(v)?C(n.queryOptions[d])?d===f.path?ee(re(null==f?void 0:f.query,null===(t=null==f?void 0:f.referrerInfo)||void 0===t?void 0:t.extraData)):void 0:ee(re(n.queryOptions[d])):ee(re(v))},this.getPageTitle=function(e){var t=n.growingIO,r=t.minipInstance,i=t.inPlugin,o=t.dataStore,a=r.getCurrentPath(),u=n.configuredTitle[a]||r.getPageTitle(r.getCurrentPage());if(i){var s=o.getTrackerVds(e||n.growingIO.trackingId);return u||"/插件".concat(s.appId).concat(a?"_"+p(a.split("/")):"")}return u},this.getReferralPage=function(e){var t,r,i,o=n.growingIO,a=o.minipInstance,u=o.dataStore,s=u.lastPageEvent,c=u.scene,l=u.eventHooks;return(null===(t=s[e])||void 0===t?void 0:t.path)||(null===(i=null===(r=l.appEffects.enterParams)||void 0===r?void 0:r.referrerInfo)||void 0===i?void 0:i.appId)||(c?"scn:".concat(a.scnPrefix).concat(c):null)},this.updateShareResult=function(e,t){void 0===t&&(t=!0);var r=n.buildShareQuery(e),i=r[0],o=r[1];return(t||_(e,"path"))&&(e.path=G(i+(o?"?".concat(o):""))),(t||_(e,"query"))&&(e.query=o),e},this.eventSetPageProps=function(e,r){var i=D(function(){return n.pageProps[e][n.getPagePath()]});return C(i)?r.attributes:Y(R(t(t({},r.attributes),i)))},this.queryOptions={},this.configuredTitle={},this.pageProps={}}return e.prototype.buildShareQuery=function(e){var n,r,i=M(null!==(n=e.path)&&void 0!==n?n:""),o=e.path||this.getPagePath(),a={},u=_(e,"path");if(_(e,"query"))a=te(null!==(r=e.query)&&void 0!==r?r:"")||{};else if(u)a=te(p(i))||{};else{var s=this.growingIO.minipInstance.getCurrentPage();a=t({},s.options||this.queryOptions[s.route]||{}),v(O(a)).forEach(function(e){e.toLowerCase().startsWith("utm_")&&b(a,e)})}return[o,ee(a)]},e}(),Ce=function(e){var n=this;this.growingIO=e,this.main=function(e,r,i){var o,a,u=Date.now(),s=n.growingIO,l=s.emitter,g=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,_=v.buildAppMessageEvent,O=v.buildTimelineEvent,P=v.buildAddFavorites,k=S.currentPage;if(!n.prevEvent[r]||Date.now()-Number(n.prevEvent[r])>=50){e||(e=g.getCurrentPage()),e.route||(e.route=g.getCurrentPath(e));var E=e.route||e.uri||e.__route__||(null===(o=null==e?void 0:e.$page)||void 0===o?void 0:o.fullPath)||"";l.emit(fe,{event:"Page ".concat(r),timestamp:u,params:{page:e,args:i[0]}}),p.debug&&console.log("Page:",E,"#",r,u),n.prevEvent[r]=Date.now();var x=f.listeners.page;switch(l.emit(me,{page:e,event:"Page ".concat(r),params:{page:e,args:i[0]}}),k.lastLifecycle=k.currentLifecycle,k.currentLifecycle=r,r){case x.pageLoad:k.queryOptions[E]=T(e,"options")||T(e,"__displayReporter.query")||T(e,"$page.query")||T(e,"$wx.__displayReporter.query")||T(e,"$taroParams")||i[0]||{},b(k.queryOptions[E],["$taroTimestamp","gdpCircleRoomCollectUrl"]);break;case x.pageShow:y(function(e){var r=m(e);C(r)||r.path!==E||I(e,t(t({},r),{title:k.getPageTitle()})),h(e).trackPage&&n.buildPageEvent(e)}),w(!1);break;case x.pageHide:case x.pageUnload:break;case x.shareChat:case x.shareApp:w(!0),y(function(e){h(e).followShare&&_(e,i)});break;case x.shareTime:"xhsp"===g.platform&&w(!0),y(function(e){h(e).followShare&&O(e,i)});break;case x.addFavorites:y(function(e){h(e).followShare&&P(e,i)});break;case x.tabTap:var A=null===(a=null==d?void 0:d.gioEventAutoTracking)||void 0===a?void 0:a.buildTabClickEvent;p.autotrack&&A&&c(A)&&A(n.growingIO.trackingId,i[0])}k.lastLifecycle=k.currentLifecycle,k.currentLifecycle="".concat(r,"End"),["onHideEnd","onUnloadEnd"].includes(k.currentLifecycle)&&(k.lifeBeforeShow=!0),"onShowEnd"===k.currentLifecycle&&(k.lifeBeforeShow=!1)}},this.buildPageEvent=function(e,r){var i=n.growingIO.dataStore,o=i.eventContextBuilder,a=i.eventInterceptor,u=i.eventHooks.currentPage,s=t({eventType:"PAGE",referralPage:u.getReferralPage(e)},o(e));s.attributes=u.eventSetPageProps(e,s),!C(r)&&r.title&&(s.title=r.title),a(s)},this.prevEvent={}},xe=function(e){var n,r=this;this.growingIO=e,this.isNormalFc=function(e,t){return c(t)&&"constructor"!==e},this.objectTraverse=function(e,t){Object.getOwnPropertyNames(e).forEach(function(n){return t(n,e)}),_(e,"methods")&&Object.getOwnPropertyNames(e.methods).forEach(function(n){e[n]||t(n,e.methods)}),_(e,"lifetimes")&&Object.getOwnPropertyNames(e.lifetimes).forEach(function(n){e[n]||t(n,e.lifetimes)}),_(e,"pageLifetimes")&&Object.getOwnPropertyNames(e.pageLifetimes).forEach(function(n){e[n]||t(n,e.pageLifetimes)})},this.supLifeFcs=function(e,t){l(r["".concat(t,"Handlers")])&&r["".concat(t,"Handlers")].forEach(function(t){c(e[t])||["onShareAppMessage","onShareTimeline"].includes(t)||(e[t]=function(){})})},this.lifeFcEffectsFn=function(e,t,n,i,o){void 0===o&&(o=void 0);var a="array"===x(t)?[].slice.call(t):[];return C(o)||a.push(o),r["def".concat(n,"Cbs")][i].apply(e,a),r.growingIO.emitter.emit(fe,{event:"".concat(n," ").concat(i,"End"),timestamp:Date.now(),params:{instance:e,arguments:Array.from(a)}}),o},this.lifeFcEffects=function(e,n,i){var o=r;return function(){for(var r,a,u,s=this,c=[],l=0;arguments.length>l;l++)c[l]=arguments[l];if(o.shareEventTypes.includes(e)){var g=null!==(r=n.apply(this,c))&&void 0!==r?r:{};if(!o.growingIO.vdsConfig.followShare)return g;var d="promise"===x(g),p="promise"===x(g.promise),f=_(g,"_result")&&_(g,"_state");if(d||p||f){var v=function(n){void 0===n&&(n={});try{var r=t(t({},g),n),a=o.currentPage.updateShareResult(r);o.lifeFcEffectsFn(s,c,i,e,a)}catch(e){N(e,"error")}};d&&Promise.race([g,new Promise(function(e){setTimeout(function(){e({})},3e3)})]).then(v).catch(function(e){return N(e,"error")}),p&&Promise.race([g.promise,new Promise(function(e){setTimeout(function(){e({})},3e3)})]).then(v).catch(function(e){return N(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,i,e,u)}else o.lifeFcEffectsFn(this,c,i,e),u=n.apply(this,c);return u}},this.customFcEffects=function(e,t){var n=r;return function(){for(var r,i,o=[],a=0;arguments.length>a;a++)o[a]=arguments[a];if(n.growingIO.vdsConfig.autotrack&&n.growingIO.plugins.gioEventAutoTracking)try{var u=o[0]||{};_(u,"type")&&((null==u?void 0:u.currentTarget)||(null==u?void 0:u.target))||(u=o[o.length-1]),((null==u?void 0:u.currentTarget)||(null==u?void 0:u.target))&&n.actionEventTypes.includes(u.type)&&(c(n.actionEffects)||(n.actionEffects=(null===(i=null===(r=n.growingIO.plugins)||void 0===r?void 0:r.gioEventAutoTracking)||void 0===i?void 0:i.main)||function(){}),null==n||n.actionEffects(u,e))}catch(e){N(e,"error")}return t.apply(this,o)}},this.appApplyProxy=function(e,t){return r.appHandlers.includes(e)?r.lifeFcEffects(e,t,"App"):r.customFcEffects(e,t)},this.pageApplyProxy=function(e,t){return r.pageHandlers.includes(e)?r.lifeFcEffects(e,t,"Page"):r.customFcEffects(e,t)},this.appOverriding=function(e){return r.setAppEffectCbs(),r.supLifeFcs(e,"app"),r.objectTraverse(e,function(e,t){r.isNormalFc(e,t[e])&&(t[e]=r.appApplyProxy(e,t[e]))}),e},this.pageOverriding=function(e){return r.setPageEffectCbs(),r.supLifeFcs(e,"page"),r.objectTraverse(e,function(e,t){r.isNormalFc(e,t[e])&&(t[e]=r.pageApplyProxy(e,t[e]))}),e},this.componentOverriding=function(e){return r.setPageEffectCbs(),e.methods||(e.methods={}),r.supLifeFcs(r.growingIO.inPlugin?e:e.methods,"page"),r.objectTraverse(r.growingIO.inPlugin?e:e.methods,function(e,t){r.isNormalFc(e,t[e])&&(t[e]=r.pageApplyProxy(e,t[e]))}),e},this.setAppEffectCbs=function(){var e=r;r.appHandlers.forEach(function(t){r.defAppCbs[t]=function(){for(var n=[],r=0;arguments.length>r;r++)n[r]=arguments[r];e.appEffects.main(t,n)}})},this.setPageEffectCbs=function(){var e=r;r.pageHandlers.forEach(function(t){r.defPageCbs[t]=function(){for(var n=[],r=0;arguments.length>r;r++)n[r]=arguments[r];e.pageEffects.main(this,t,n)}})},this.growingApp=function(e){return c(r.originalApp)?r.originalApp(r.appOverriding(e)):r.appOverriding(e)},this.growingPage=function(e){return c(r.originalPage)?r.originalPage(r.pageOverriding(e)):r.pageOverriding(e)},this.growingComponent=function(e){return c(r.originalComponent)?r.originalComponent(r.componentOverriding(e)):r.componentOverriding(e)},this.growingBehavior=function(e){return c(r.originalBehavior)?r.originalBehavior(r.componentOverriding(e)):r.componentOverriding(e)},this.nativeGrowing=function(e){void 0===e&&(e=["App","Page","Component","Behavior"]);var t=r,n=r.growingIO.platformConfig.hooks;if(e.includes("App"))try{n.App&&!r.appHooked&&(App=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalApp(t.appOverriding(e[0]))},r.appHooked=!0)}catch(e){}if(e.includes("Page"))try{n.Page&&!r.pageHooked&&(Page=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalPage(t.pageOverriding(e[0]))},r.pageHooked=!0)}catch(e){}if(e.includes("Component"))try{n.Component&&!r.componentHooked&&(Component=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalComponent(t.componentOverriding(e[0]))},r.componentHooked=!0)}catch(e){}if(e.includes("Behavior"))try{n.Behavior&&!r.behaviorHooked&&(Behavior=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalBehavior(t.componentOverriding(e[0]))},r.behaviorHooked=!0)}catch(e){}},this.initOriginalValue=function(){r.setAppEffectCbs(),r.setPageEffectCbs(),r.originalApp=D(function(){return App||global.App}),r.originalPage=D(function(){return Page||global.Page}),r.originalComponent=D(function(){return Component||global.Component}),r.originalBehavior=D(function(){return Behavior||global.Behavior})},this.initEventHooks=function(){var e=r,t=r.growingIO,n=t.platformConfig,i=t.gioPlatform;r.initOriginalValue(),n.canHook?(r.nativeGrowing(),J().GioApp=D(function(){return null!==App&&void 0!==App?App:r.originalApp}),J().GioPage=D(function(){return null!==Page&&void 0!==Page?Page:r.originalPage}),J().GioComponent=D(function(){return null!==Component&&void 0!==Component?Component:r.originalComponent}),J().GioBehavior=D(function(){return null!==Behavior&&void 0!==Behavior?Behavior:r.originalBehavior})):"quickapp"===i&&(J().GioApp=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.appOverriding(t[0])},J().GioPage=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.pageOverriding(t[0])},J().GioComponent=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.pageOverriding(t[0])})};var i=null===(n=this.growingIO)||void 0===n?void 0:n.platformConfig;this.defAppCbs={},this.defPageCbs={},this.appHandlers=i.appHandlers,this.pageHandlers=i.pageHandlers,this.shareEventTypes=i.shareEventTypes,this.actionEventTypes=i.actionEventTypes,this.appEffects=new be(this.growingIO),this.pageEffects=new Ce(this.growingIO),this.currentPage=new Ee(this.growingIO)},Ae=function(){function e(e){var r,i,o=this;this.growingIO=e,this.ALLOW_SETTING_KEYS=O(ae),this.getStorageKey=function(e,t){var n=o.growingIO.inPlugin;return"".concat(e===o.growingIO.trackingId?"":e).concat(pe[n?"plugin_"+t:t])},this.getGsid=function(e){var t=Number(o._gsid[e]);return Number.isNaN(t)||t>=1e9||1>t?(o.setGsid(e,1),1):t},this.setGsid=function(e,t){var n=Number(t);(Number.isNaN(n)||n>=1e9||1>n)&&(n=1),o._gsid[e]=n,10>o._gsid[e]-o._stid[e]||o.saveStorageInfo()},this.initStorageInfo=function(e){var t=o.growingIO.minipInstance,n=t.getStorageSync(o.getStorageKey(e,"gsid")),r=Number(n);(Number.isNaN(r)||r>=1e9||1>r)&&(r=1),o._gsid[e]=r,o._stid[e]=r,r!==n&&t.setStorageSync(o.getStorageKey(e,"gsid"),r)},this.saveStorageInfo=function(){var e=o.growingIO.minipInstance;o._stid=t({},o._gsid),X(e,o.initializedTrackingIds.map(function(e){return{key:o.getStorageKey(e,"gsid"),value:o._gsid[e]}}))},this.setOriginalSource=function(e,t){o.growingIO.minipInstance.setStorageSync(o.getStorageKey(e,"originalSource"),JSON.stringify(t))},this.getOriginalSource=function(e){var t,n=o.growingIO.minipInstance;return null!==(t=D(function(){return JSON.parse(n.getStorageSync(o.getStorageKey(e,"originalSource")))}))&&void 0!==t?t:{}},this.getTrackerVds=function(e){return o.growingIO.trackingId===e?t({},o.growingIO.vdsConfig):void 0},this.initTrackerOptions=function(e){var t=o.initOptions(e);return t.trackingId=e.trackingId,o.growingIO.trackingId=e.trackingId,o.growingIO.vdsConfig=t,t},this.initTrackerHooker=function(e){var t,n,r,i=o.growingIO,a=i.platformConfig,u=i.inPlugin,s=i.minipInstance,c=i.plugins,l=e.uniVue,g=e.taro,d=e.mpx;l||g||"quickapp"===s.platform||(a.canHook=!0),!u||["tbp","jdp"].includes(s.platform)?o.eventHooks.initEventHooks():o.eventHooks.initOriginalValue();try{l&&(null===(t=null==c?void 0:c.gioUniAppAdapter)||void 0===t||t.main()),g&&(null===(n=null==c?void 0:c.gioTaroAdapter)||void 0===n||n.main()),d&&(null===(r=null==c?void 0:c.gioMpxAdapter)||void 0===r||r.main())}catch(e){N(e,"error")}},this.initOptions=function(e){var n,r,i,a,u,s,c=e.projectId,g=e.dataSourceId,d=e.appId,p=e.trackingId,f={};return o.ALLOW_SETTING_KEYS.forEach(function(t){var n=ae[t].type;(l(n)?n.includes(x(e[t])):x(e[t])===ae[t].type)?"ignoreFields"===t?f.ignoreFields=e.ignoreFields.filter(function(e){return ge.includes(e)}):"extraParams"===t?f.extraParams=e.extraParams.filter(function(e){return de.includes(e)}):(f[t]=e[t],["dataCollect","autotrack"].includes(t)&&!f[t]&&N("已关闭".concat(ce[t]),"info")):f[t]=ae[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,"")),b(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),t(t({},f),{projectId:c,dataSourceId:g,appId:d,trackingId:p,performance:{monitor:null===(r=null===(n=f.performance)||void 0===n?void 0:n.monitor)||void 0===r||r,exception:null===(a=null===(i=f.performance)||void 0===i?void 0:i.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,n,r){var i,a=o.growingIO,u=a.userStore,s=a.emitter,c=o.getTrackerVds(e),l=t({},c);return"ignoreFields"===n&&(r=r.filter(function(e){return ge.includes(e)})),o.updateVdsConfig(e,t(t({},c),((i={})[n]=r,i))),"dataCollect"===n&&l.dataCollect!==r&&r&&u.setSessionId(e),s.emit(_e,{optionName:n,optionValue:r}),!0},this.getOption=function(e,t){var n=o.getTrackerVds(e);return t&&_(o.growingIO.vdsConfig,t)?_(n,t)?n[t]:o.growingIO.vdsConfig[t]:C(t)?n:void U("getOption > ".concat(t))},this.updateVdsConfig=function(e,n){e===o.growingIO.trackingId?(o.growingIO.vdsConfig=t(t({},o.growingIO.vdsConfig),n),J().vdsConfig=o.growingIO.vdsConfig):(o.growingIO.subInstance[e]=t(t({},o.growingIO.subInstance[e]),n),J().vdsConfig.subInstance[e]=o.growingIO.subInstance[e])},this.toggleShareOut=function(e){u(e)?o.shareOut=e:o.shareOut=!o.shareOut},this.sendVisit=function(e,t){o.eventHooks.appEffects.buildVisitEvent(e,t)},this.sendPage=function(e,t){o.eventHooks.pageEffects.buildPageEvent(e,t)},this.eventConverter=function(e){var n=o.growingIO,r=n.dataStore,i=n.uploader;if(o.getTrackerVds(e.trackingId).dataCollect){["LOGIN_USER_ATTRIBUTES","APP_CLOSED"].includes(e.eventType)||(e.eventSequenceId=r.getGsid(e.trackingId),r.setGsid(e.trackingId,e.eventSequenceId+1));var a={};P(e,function(e,t){var n;if("element"===t){var r=null!==(n=d(e))&&void 0!==n?n:{};P(r,function(e,t){C(e)&&0!==e||(a[t]=e)})}else C(e)&&0!==e||(a[t]=e)}),o.growingIO.emitter.emit(he,{composedEvent:a}),i.commitRequest(t(t({},a),{requestId:F()}))}},this.eventRefactor=function(e){var n,r,i=t(t({},e),o.eventContextBuilder(e.trackingId,{path:e.path,query:e.query,timestamp:e.timestamp}));return i.attributes=t(t({},null!==(n=i.attributes)&&void 0!==n?n:{}),null!==(r=e.attributes)&&void 0!==r?r:{}),i},this.eventInterceptor=function(e){var t=o.growingIO.minipInstance,r=t.systemInfo,i=t.network;C(r)||C(i)?o.interceptEvents.push(e):C(o.interceptEvents)?o.eventConverter(e):(n(n([],o.interceptEvents,!0),[e],!1).forEach(function(e){o.eventConverter(o.eventRefactor(e))}),o.interceptEvents=[])},this.eventReleaseInspector=function(){var e=o.growingIO.minipInstance,t=e.systemInfo,r=e.network;t&&r&&!C(o.interceptEvents)&&(n([],o.interceptEvents,!0).forEach(function(e){o.eventConverter(o.eventRefactor(e))}),o.interceptEvents=[])},this.buildAppMessageEvent=function(e,n){var r,i,a,u=n[0];2>n.length?1===n.length&&(a=u):a=n[1];var s=o.growingIO.dataStore,c=s.eventContextBuilder,l=s.eventInterceptor,g=((null==a?void 0:a.path)||"").split("?"),p=t({eventType:"CUSTOM",eventName:"$mp_on_share"},c(e));p.attributes=Y(t(t(t({},null!==(r=p.attributes)&&void 0!==r?r:{}),{$from:null==u?void 0:u.from,$target:null===(i=null==u?void 0:u.target)||void 0===i?void 0:i.id,$share_title:null==a?void 0:a.title,$share_path:d(g),$share_query:g[1]}),null==a?void 0:a.attributes)),l(p)},this.buildTimelineEvent=function(e,n){var r,i,a,u=n[0];2>n.length?1===n.length&&(a=u):a=n[1];var s=o.growingIO.dataStore,c=s.eventContextBuilder,l=s.eventInterceptor,g=((null==a?void 0:a.path)||"").split("?"),p=t({eventType:"CUSTOM",eventName:"$mp_share_timeline"},c(e));p.attributes=Y(t(t(t({},null!==(r=p.attributes)&&void 0!==r?r:{}),{$target:null===(i=null==u?void 0:u.target)||void 0===i?void 0:i.id,$share_title:null==a?void 0:a.title,$share_path:d(g),$share_query:g[1]}),null==a?void 0:a.attributes)),l(p)},this.buildAddFavorites=function(e,n){var r,i,a=n[0];2>n.length?1===n.length&&(i=a):i=n[1];var u=o.growingIO.dataStore,s=u.eventContextBuilder,c=u.eventInterceptor,l=((null==i?void 0:i.path)||"").split("?"),g=t({eventType:"CUSTOM",eventName:"$mp_add_favorites"},s(e));g.attributes=Y(t(t({},null!==(r=g.attributes)&&void 0!==r?r:{}),{$share_title:null==i?void 0:i.title,$share_path:d(l),$share_query:l[1]})),c(g)},this.trackersExecute=function(e){o.initializedTrackingIds.forEach(function(t){"function"===x(e)&&e(t)})},this.initializedTrackingIds=[],this.eventContextBuilder=new Te(this.growingIO).main,this.eventHooks=new xe(this.growingIO),this.shareOut=!1,this._gsid={},this._stid={},this.lastVisitEvent={},this.lastPageEvent={},this.locationData={},this.generalProps={},this.trackTimers={},this.interceptEvents=[];var a=this.growingIO,s=a.emitter,g=a.minipInstance;s.on(Pe,function(e){var t=e.trackingId;o.initializedTrackingIds.push(t),o.initStorageInfo(t)}),s.on(ve,function(e){var t=e.eventData,n=e.trackingId;"VISIT"===t.eventType&&(o.lastVisitEvent[n]=t),"PAGE"===t.eventType&&(o.lastPageEvent[n]=t)}),c(null===(r=g.minip)||void 0===r?void 0:r.onAppHide)&&g.minip.onAppHide(function(){o.trackersExecute(function(e){var t=o.trackTimers[e];P(t,function(e){e.start&&(e.leng=e.leng+(+Date.now()-e.start))})})}),c(null===(i=g.minip)||void 0===i?void 0:i.onAppShow)&&g.minip.onAppShow(function(){o.trackersExecute(function(e){var t=o.trackTimers[e];P(t,function(e){e.start&&(e.start=+Date.now())})})}),s.on(_e,function(e){var t=e.optionName,n=e.optionValue;"dataCollect"===t&&!1===n&&o.trackersExecute(function(e){o.growingIO.clearTrackTimer(e)})}),this.growingIO.emitter.on(ke,function(e){var t=e.oldSessionId,n=e.trackingId;if(t){var r=o.eventHooks.currentPage,i=r.getPagePath,a=r.getPageQuery,u=i(),s=a();if(u)o.sendVisit(n,{path:u,query:s});else{var c=o.lastPageEvent[n];o.sendVisit(n,{path:c.path,query:c.query})}o.eventHooks.currentPage.lifeBeforeShow||o.sendPage(n)}})}return Object.defineProperty(e.prototype,"scene",{get:function(){return this._scene},set:function(e){var t=this._scene;this._scene=e,t!==this._scene&&this.growingIO.emitter.emit("SCENE_UPDATE",{newScene:e,oldScene:t})},enumerable:!1,configurable:!0}),e}(),qe={scnPrefix:"",appHandlers:["onLaunch","onShow","onHide","onError","onPageNotFound","onUnhandledRejection","onThemeChange"],pageHandlers:["onLoad","onShow","onReady","onHide","onShareAppMessage","onTabItemTap","onUnload","onPullDownRefresh","onReachBottom","onResize"],shareEventTypes:["onShareAppMessage","onShareTimeline","onAddToFavorites"],actionEventTypes:["onclick","tap","onTap","longpress","longTap","blur","change","onChange","submit","confirm","getuserinfo","getphonenumber","contact","mouseup"],canHook:!0,hooks:{App:!0,Page:!0,Component:!0,Behavior:!0},listeners:{app:{appLaunch:"onLaunch",appShow:"onShow",appClose:"onHide"},page:{pageLoad:"onLoad",pageShow:"onShow",pageReady:"onReady",pageHide:"onHide",pageUnload:"onUnload",tabTap:"onTabItemTap",shareApp:"onShareAppMessage"},actions:{click:["onclick","tap","longpress","longTap","getuserinfo","getphonenumber","contact","mouseup"],change:["blur","change","confirm"],submit:["submit"]}}},Ne=t(t({},qe),{listeners:t({},qe.listeners),name:"KuaiShou",platform:"kuaishoup",scnPrefix:"ks_"}),Ue=function(t){function n(e){var n=t.call(this,e)||this;return n.growingIO=e,n.hookSetTitle(),n}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+n+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(n,t),n}(function(e){var t=this;this.growingIO=e,this.minip=Q("ks"),this.hookSetTitle=function(){var e,n=null===(e=t.minip)||void 0===e?void 0:e.setNavigationBarTitle,r=t;n&&Object.defineProperty(t.minip,"setNavigationBarTitle",{writable:!0,enumerable:!0,configurable:!0,value:function(){if(r.growingIO.gioSDKInitialized){var e=r.getCurrentPath(),t=(arguments[0]||{}).title;r.growingIO.dataStore.eventHooks.currentPage.configuredTitle[e]=t}return n.apply(this,arguments)}})},this.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,r=e.src,i=e.success,o=e.fail,a=e.complete;return null===(n=t.minip)||void 0===n?void 0:n.getImageInfo({src:r,success:i,fail:o,complete:a})},this.initImpression=function(e){var n,r;null===(r=null===(n=t.growingIO.plugins)||void 0===n?void 0:n.gioImpressionTracking)||void 0===r||r.main(e,"observeAll")},this.getCurrentPage=function(){return D(function(){return p(getCurrentPages())})||{}},this.getCurrentPath=function(){var e=t.getCurrentPage();return(null==e?void 0:e.route)||(null==e?void 0:e.uri)||(null==e?void 0:e.__route__)||""},this.getPageTitle=function(e){var n,r,i,a,u,s,c,g,d=W(),p="",f=$(d);"string"===x(f)&&(f=null!==(n=D(function(){return JSON.parse(f)}))&&void 0!==n?n:{});var v,h=(null==e?void 0:e.data)||e.$data||{};if((p=o(null==h?void 0:h.gioPageTitle)?null==h?void 0:h.gioPageTitle:"")||D(function(){var t,n,r=z(d);r&&(v=r["".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||C(m)||(e.route=m.path||"",p=e.route?t._getTitleFromTabBar(f,e.route):""),!p&&(v=l(f.pages)?null!==(r=f.pages.find(function(t){return t.path===e.route}))&&void 0!==r?r:{}:f.page||{})){var I=v[e.route]||v["".concat(e.route,".html")]||v;p=(null==I?void 0:I.navigationBarTitleText)||(null===(i=null==I?void 0:I.window)||void 0===i?void 0:i.navigationBarTitleText)}p||(p=t._getTitleFromTabBar(f,e.route))}return p||(p=["wx","tt"].includes(d)?null===(s=null===(u=null===(a=f||global||$global)||void 0===a?void 0:a.global)||void 0===u?void 0:u.window)||void 0===s?void 0:s.navigationBarTitleText:null===(g=null===(c=f||global||$global)||void 0===c?void 0:c.window)||void 0===g?void 0:g.navigationBarTitleText),L(p)},this._getTitleFromTabBar=function(e,t){var n,r,i=null===(r=null===(n=null==e?void 0:e.tabBar)||void 0===n?void 0:n.list)||void 0===r?void 0:r.find(function(e){return e.pagePath===t||e.pagePath==="".concat(t,".html")});return(null==i?void 0:i.text)||""},this.getStorageSync=function(e){var n,r=null===(n=t.minip)||void 0===n?void 0:n.getStorageSync(e);return s(r)&&r.expiredAt?r.expiredAt<Date.now()?"":r.value:r},this.getStorage=function(e){return new Promise(function(n){var r;null===(r=t.minip)||void 0===r||r.getStorage({key:e,success:function(e){var t=e.data;return n(t)},fail:function(){return n("")}})})},this.setStorageSync=function(e,n,r){var i;r&&(n={value:n,expiredAt:r}),null===(i=t.minip)||void 0===i||i.setStorageSync(e,n)},this.setStorage=function(e,n){var r;null===(r=t.minip)||void 0===r||r.setStorage({key:e,data:n})},this.removeStorageSync=function(e){var n;null===(n=t.minip)||void 0===n||n.removeStorageSync(e)},this.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 r;null===(r=t.minip)||void 0===r||r.getNetworkType({success:function(t){e.network=t,n(t)},fail:function(){return n(null)}})})},this.request=function(e){var n,r=e.url,i=e.data,o=e.header,a=e.timeout,u=e.method,s=e.success,l=e.fail,g=e.complete,d=null===(n=t.minip)||void 0===n?void 0:n.request({url:r,data:i,header:o,timeout:a,method:u,success:s,fail:l,complete:g}),p=setTimeout(function(){(null==d?void 0:d.abort)&&c(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 r;null===(r=t.minip)||void 0===r||r.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,r=n.platform,i=n.scnPrefix;this.platform=r,this.scnPrefix=i,this.growingIO.emitter.on(Oe,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()})})}),De=["gioPerformance"],Ke=function(e){var t,n,r,i,o,a,u=this;this.growingIO=e,this.innerPluginInit=function(){var e;De.forEach(function(e){var t;return b(null===(t=u.pluginsContext)||void 0===t?void 0:t.plugins,e)}),O(null===(e=u.pluginsContext)||void 0===e?void 0:e.plugins).forEach(function(e){var t,n,r=null!==(n=null===(t=u.pluginsContext)||void 0===t?void 0:t.plugins[e])&&void 0!==n?n:{},i=r.name,o=r.method;h(u.pluginItems,function(e){return e.name===i})||u.pluginItems.push({name:y(i||e),method:o||function(e){}})}),C(u.pluginItems)||u.installAll()},this.install=function(e,t,n){var r,i,o=u.growingIO.emitter,a=t||h(u.pluginItems,function(t){return t.name===e});if((null===(r=u.growingIO)||void 0===r?void 0:r.plugins)[e])return N("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return N("插件加载失败!不存在名为 ".concat(e," 的插件!"),"error"),!1;try{return(null===(i=u.growingIO)||void 0===i?void 0:i.plugins)[e]=new a.method(u.growingIO,n),t&&(o.emit(ye,e),N("加载插件 ".concat(e),"info")),!0}catch(n){return u.lifeError(t,n),N("插件【".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)&&!h(u.pluginItems,function(e){return e.name===t.name})&&u.pluginItems.push({name:y(t.name),method:t.method?t.method:function(){}})})},this.uninstall=function(e){var t;b(u.pluginItems,e);var n=b(null===(t=u.growingIO)||void 0===t?void 0:t.plugins,e);return n||N("卸载插件 ".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(Ie,{plugin:e,error:t}),N("插件执行错误 ".concat((null==e?void 0:e.name)||"unknown"," ").concat(t),"error")},this.callLifeCycle=function(e,t){u.pluginItems.forEach(function(n){var r=u.growingIO.plugins[n.name]?u.growingIO.plugins[n.name][e]:void 0;if(r&&c(r))try{r(t)}catch(e){u.lifeError(n,e)}})},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on(ye,function(e){return u.callLifeCycle("onInstall",e)}),null===(n=this.growingIO.emitter)||void 0===n||n.on(Ie,function(e){return u.callLifeCycle("onError",e)}),null===(r=this.growingIO.emitter)||void 0===r||r.on(me,function(e){return u.callLifeCycle("onComposeBefore",e)}),null===(i=this.growingIO.emitter)||void 0===i||i.on(he,function(e){return u.callLifeCycle("onComposeAfter",e)}),null===(o=this.growingIO.emitter)||void 0===o||o.on(we,function(e){return u.callLifeCycle("onSendBefore",e)}),null===(a=this.growingIO.emitter)||void 0===a||a.on(Se,function(e){return u.callLifeCycle("onSendAfter",e)})},Le={},He={}.hasOwnProperty;function Re(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Fe(e){try{return encodeURIComponent(e)}catch(e){return null}}Le.stringify=function(e,t){t=t||"";var n,r,i=[];for(r in"string"!=typeof t&&(t="?"),e)if(He.call(e,r)){if((n=e[r])||null!=n&&!isNaN(n)||(n=""),r=Fe(r),n=Fe(n),null===r||null===n)continue;i.push(r+"="+n)}return i.length?t+i.join("&"):""},Le.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,r={};t=n.exec(e);){var i=Re(t[1]),o=Re(t[2]);null===i||null===o||i in r||(r[i]=o)}return r};var Be=function(e){var r=this;this.growingIO=e,this.generateURL=function(e){var t=r.growingIO.dataStore.getTrackerVds(e),n=t.serverUrl,i=t.projectId;return S(n,"http")?"".concat(n,"/v3/projects/").concat(i,"/collect"):"https://".concat(n,"/v3/projects/").concat(i,"/collect")},this.getHoardingQueue=function(e){var t;return null!==(t=r.hoardingQueue[e])&&void 0!==t?t:[]},this.getRequestQueue=function(e){var t;return null!==(t=r.requestQueue[e])&&void 0!==t?t:[]},this.commitRequest=function(e){var n,o,a=t({},e),u=r.growingIO,s=u.vdsConfig;u.emitter.emit(ve,{eventData:e,trackingId:e.trackingId}),s.forceLogin?(i(r.hoardingQueue[e.trackingId])&&(r.hoardingQueue[e.trackingId]=[]),null===(n=r.hoardingQueue[e.trackingId])||void 0===n||n.push(a)):(i(r.requestQueue[e.trackingId])&&(r.requestQueue[e.trackingId]=[]),null===(o=r.requestQueue[e.trackingId])||void 0===o||o.push(a),r.initiateRequest(e.trackingId))},this.initiateRequest=function(e,t){var i=r.growingIO,o=i.plugins,a=i.vdsConfig,u=i.minipInstance,s=i.dataStore,c=r.getHoardingQueue(e),l=r.getRequestQueue(e),g=n(n([],c,!0),l,!0),d=function(e){var n,i;if(null===(n=null==a?void 0:a.tbConfig)||void 0===n?void 0:n.cloudFuncSend)null===(i=null==o?void 0:o.gioTaobaoAdapter)||void 0===i||i.singleInvoke(e);else if(t)r.batchInvoke(e);else{var c=r.growingIO.dataStore.getTrackerVds(e).uploadInterval;E(r.batchInvoke,c,!1,!1)(e)}g.some(function(e){return"VISIT"===e.eventType})&&u.removeStorageSync(s.getStorageKey(e,"originalSource"))};if(g.length>0)if(r.requestingNum<r.requestLimit)d(e);else var p=setInterval(function(){r.requestingNum<r.requestLimit&&(d(e),clearInterval(p),p=void 0)},500)},this.batchInvoke=function(e){var i=r.growingIO,o=i.vdsConfig,a=i.emitter,u=r.getHoardingQueue(e),s=r.getRequestQueue(e),c=n(n([],u,!0),s,!0);c.length>50?(c=c.slice(0,50),u.length>50?r.hoardingQueue[e]=u.slice(50):(r.requestQueue[e]=s.slice(50-u.length),r.hoardingQueue[e]=[])):(r.hoardingQueue[e]=[],r.requestQueue[e]=[]);var l=c.filter(function(e){return(r.retryIds[e.requestId]||0)<=r.retryLimit});if(!C(l)){var g=l.map(function(e){var n=t({},e);return b(n,["requestId","trackingId"]),n});o.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(g,null,2)),a.emit(we,{eventsQueue:l,requestData:g,trackingId:e})}},this.sendEvent=function(e,t){var i,o=d(e).trackingId,a=r.growingIO,u=a.minipInstance,s=a.dataStore,c=a.emitter,l=a.plugins,g=s.getTrackerVds(o),p=g.compress,f=g.requestTimeout;r.requestingNum+=1;var v={"content-type":"jdp"===u.platform?"application/json":"application/json;charset=UTF-8"},h=n([],t,!0),m=!!p&&(null===(i=null==l?void 0:l.gioCompress)||void 0===i?void 0:i.compressToUTF16);m&&(h=l.gioCompress.compressToUTF16(JSON.stringify(t)),v["X-Compress-Codec"]="1");var I=r.generateURL(o);u.request({url:"".concat(I,"?stm=").concat(Date.now(),"&compress=").concat(m?"1":"0"),header:v,method:"POST",data:h,timeout:f,fail:function(n){[200,204].includes(n.code)||(e.forEach(function(e){r.requestFailFn(e)}),N("请求失败!".concat(JSON.stringify(n)),"error"),c.emit("ON_SEND_ERROR",{eventsQueue:e,requestData:t,trackingId:o}))},complete:function(e){r.requestingNum-=1,c.emit(Se,{result:e,requestData:t,trackingId:o}),r.initiateRequest(o)}})},this.requestFailFn=function(e){if(r.retryIds[e.requestId]||(r.retryIds[e.requestId]=0),r.retryIds[e.requestId]+=1,!r.requestQueue[e.trackingId].some(function(t){return t.requestId===e.requestId}))var t=setTimeout(function(){C(r.requestQueue[e.trackingId])?(r.requestQueue[e.trackingId].push(e),r.initiateRequest(e.trackingId)):r.requestQueue[e.trackingId].push(e),clearTimeout(t),t=null},800)},this.hoardingQueue={},this.requestQueue={},this.requestLimit=3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.growingIO.emitter.on(we,function(e){var t,n,i=e.eventsQueue,o=e.requestData,a=e.trackingId,u=r.growingIO,s=u.vdsConfig,c=u.plugins;a===r.growingIO.trackingId&&((null===(t=null==s?void 0:s.tbConfig)||void 0===t?void 0:t.cloudAppId)?null===(n=null==c?void 0:c.gioTaobaoAdapter)||void 0===n||n.tbCloudAppInvoke(i,o):r.sendEvent(i,o))})},je=function(e){var t=this;this.growingIO=e,this._getUidKey=function(){return t.growingIO.inPlugin?"_growing_plugin_uid_":"_growing_uid_"},this.getUid=function(){var e=t.growingIO.minipInstance;return t._uid||(t._uid=e.getStorageSync(t._getUidKey())),t._uid||t.setUid(F()),t._uid},this.setUid=function(e){var n=t._uid;t._uid=e,n!==t._uid&&(t.growingIO.minipInstance.setStorage(t._getUidKey(),t._uid),t.growingIO.emitter.emit("UID_UPDATE",{newUId:e,oldUId:n}))},this.getSessionId=function(e){var n=t.growingIO,r=n.vdsConfig.sessionExpires,i=n.dataStore.trackersExecute;return t._sessionId[e]||t.setSessionId(e),r>-1&&(Date.now()>t._sessionExpires&&i(function(e){t.setSessionId(e)}),t._sessionExpires=Date.now()+6e4*r),t._sessionId[e]},this.setSessionId=function(e,n){var r=t._sessionId[e];n||(n=F()),t._sessionId[e]=n;var i=t.growingIO.vdsConfig.sessionExpires;i>-1&&(t._sessionExpires=Date.now()+6e4*i),r!==n&&t.growingIO.emitter.emit(ke,{trackingId:e,newSessionId:n,oldSessionId:r})},this._getUserIdKey=function(e){return t.growingIO.dataStore.getStorageKey(e,"userId")},this.getUserId=function(e){var n=t.growingIO.minipInstance;return t._userId[e]||(t._userId[e]=n.getStorageSync(t._getUserIdKey(e))),t._userId[e]},this.setUserId=function(e,n){var r=t._userId[e];t._userId[e]=i(n)?"":n,r!==t._userId[e]&&(t.growingIO.minipInstance.setStorage(t._getUserIdKey(e),t._userId[e]),t.growingIO.emitter.emit("USERID_UPDATE",{newUserId:n,oldUserId:r})),n&&t.setGioId(e,n)},this._getUserKeyKey=function(e){return t.growingIO.dataStore.getStorageKey(e,"userKey")},this.getUserKey=function(e){var n=t.growingIO.minipInstance;return t._userKey[e]||(t._userKey[e]=n.getStorageSync(t._getUserKeyKey(e))),t._userKey[e]},this.setUserKey=function(e,n){var r=t._userKey[e];t._userKey[e]=i(n)?"":n,r!==t._userKey[e]&&(t.growingIO.minipInstance.setStorage(t._getUserKeyKey(e),t._userKey[e]),t.growingIO.emitter.emit("USERKEY_UPDATE",{newUserKey:n,oldUserKey:r}))},this._getGioIdKey=function(e){return t.growingIO.dataStore.getStorageKey(e,"gioId")},this.getGioId=function(e){var n=t.growingIO.minipInstance;return t._gioId[e]||(t._gioId[e]=n.getStorageSync(t._getGioIdKey(e))),t._gioId[e]},this.setGioId=function(e,n){var r=t._gioId[e];t._gioId[e]=i(n)?"":n,r!==t._gioId[e]&&(t.growingIO.minipInstance.setStorage(t._getGioIdKey(e),t._gioId[e]),t.growingIO.emitter.emit("GIOID_UPDATE",{newGioId:n,oldGioId:r}))},this.initUserInfo=function(e){var n,r=t.growingIO.minipInstance,i=[t._getUidKey(),t._getUserIdKey(e),t._getUserKeyKey(e),t._getGioIdKey(e)],o=null!==(n=Z(r,i))&&void 0!==n?n:[];["_uid","_userId","_userKey","_gioId"].forEach(function(n,r){"_uid"===n?t.getUid():t[n][e]=o[r]})},this.saveUserInfo=function(){var e=t.growingIO,n=e.minipInstance;(0,e.dataStore.trackersExecute)(function(e){X(n,[{key:t._getUidKey(),value:t._uid},{key:t._getUserIdKey(e),value:t._userId[e]},{key:t._getUserKeyKey(e),value:t._userKey[e]},{key:t._getGioIdKey(e),value:t._gioId[e]}])})},this._uid=void 0,this._sessionId={},this._userId={},this._userKey={},this._gioId={},this._sessionExpires=-1},Ve=new function(){var e,r=this;this.init=function(e){var t;r.emitter.emit("ON_SDK_INITIALIZE_BEFORE",{options:e});try{if(N("Gio小程序SDK 初始化中...","info"),e.trackingId&&r.dataStore.initializedTrackingIds.includes(e.trackingId))throw Error("已存在实例 ".concat(e.trackingId,",请勿重复初始化!"));if(r.trackingId&&!r.plugins.gioMultipleInstances)throw Error("您正在尝试初始化另一个实例,请集成多实例插件后重试!");var n=r.dataStore.initTrackerOptions(e);return null===(t=r.emitter)||void 0===t||t.emit(Oe,n),r.gioSDKInitialized=!0,r.dataStore.initTrackerHooker(n),"quickapp"!==r.gioPlatform&&r.userStore.initUserInfo(e.trackingId),r.emitter.emit(Pe,n),r.trackingId&&r.trackingId!==e.trackingId||(J().__gio__=function(){return r}),N("Gio小程序SDK 初始化完成!","success"),r.inPlugin&&"tbp"!==r.minipInstance.platform&&r.dataStore.sendVisit(n.trackingId),r.vdsConfig.forceLogin&&N("forceLogin已开启,请调用 identify 方法设置 openId 以继续上报!","info"),!0}catch(e){return N(e,"error"),!1}},this.handlerDistribute=function(e,t,i){var o=r.dataStore,a=o.initializedTrackingIds;if((0,o.getTrackerVds)(e)&&a.includes(e))return r[t].apply(r,n([e],i,!1));N("不存在实例:".concat(e,",请检查!"),"warn")},this.registerPlugins=function(e){r.plugins.pluginItems=n(n([],r.plugins.pluginItems,!0),e,!0),r.plugins.installAll(e)},this.getPlugins=function(){return r.plugins.pluginItems},this.getDeviceId=function(){return r.userStore.getUid()},this.getOption=function(e,t){return r.dataStore.getOption(e,t)},this.setOption=function(e,t,n){var i;return O(ce).includes(t)?x(n)===(null===(i=ae[t])||void 0===i?void 0:i.type)?(r.dataStore.setOption(e,t,n),N("已修改".concat(ce[t],": ").concat(n),"info"),!0):(N("参数格式不正确:".concat(n,",请检查后重试!"),"error"),!1):(N("不存在可修改的配置项:".concat(t,",请检查后重试!"),"error"),!1)},this.setPageAttributes=function(e,t){if(s(t)&&!C(t)){var n=r.dataStore.eventHooks.currentPage,i=n.getPagePath();return C(n.pageProps[e])&&(n.pageProps[e]={}),C(n.pageProps[e][i])&&(n.pageProps[e][i]={}),C(t)||P(t,function(t,r){c(n.pageProps[e][i][r])&&!c(t)||(n.pageProps[e][i][r]=t)}),!0}return U("setPageAttributes"),!1},this.clearPageAttributes=function(e,t){try{if(!C(r.dataStore.eventHooks.currentPage.pageProps[e])){var n=r.dataStore.eventHooks.currentPage,i=n.getPagePath();l(t)&&!C(t)?t.forEach(function(t){b(n.pageProps[e][i],t)}):n.pageProps[e][i]={}}}catch(e){return U("clearPageAttributes"),!1}},this.sendPage=function(e,t){r.dataStore.getTrackerVds(e).trackPage?N("仅在关闭trackPage时允许调用sendPage,请确认后修改初始化配置项!","error"):r.dataStore.sendPage(e,t)},this.identify=function(e,t){if(e===r.trackingId)if(r.vdsConfig.forceLogin){if(!oe(t))return void U("identify");var n=m(t).slice(0,1e3);r.userStore.setUid(n),r.dataStore.setOption(r.trackingId,"forceLogin",!1),r._identified=!0,r.dataStore.trackersExecute(function(e){var t=r.uploader.getHoardingQueue(e);t.forEach(function(e,r){return t[r].deviceId=n}),r.uploader.initiateRequest(e,!0)})}else r._identified?U("identify",!1,"请勿重复调用"):U("identify",!1,"forceLogin未开启");else U("identify",!1,"子实例不允许调用identify")},this.setUserAttributes=function(e,n){var i,o,a,u;if(s(n)&&!C(n)){var c=r.dataStore,l=c.eventContextBuilder,g=c.eventInterceptor,d=c.lastVisitEvent,p=t({eventType:"LOGIN_USER_ATTRIBUTES"},l(e));p.attributes=Y(t(t({},null!==(i=p.attributes)&&void 0!==i?i:{}),R(n))),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 U("setUserAttributes")},this.setUserId=function(e,t,n){if(oe(t)){var o=r.userStore.getGioId(e);t=m(t).slice(0,1e3),n=m(n).slice(0,1e3),r.userStore.setUserId(e,t);var a=!i(n)&&m(n).length>0?m(n).slice(0,1e3):"";r.userStore.setUserKey(e,a),!r.dataStore.getTrackerVds(e).idMapping&&a&&N("您设置了 userKey ,请初始化开启 idMapping!","warn"),o&&o!==t&&r.userStore.setSessionId(e)}else U("setUserId")},this.clearUserId=function(e){r.userStore.setUserId(e,void 0),r.userStore.setUserKey(e,void 0)},this.setGeneralProps=function(e,t){return s(t)&&!C(t)?(C(r.dataStore.generalProps[e])&&(r.dataStore.generalProps[e]={}),P(t,function(t,n){c(r.dataStore.generalProps[e][n])&&!c(t)||(r.dataStore.generalProps[e][n]=t)}),!0):(U("setGeneralProps"),!1)},this.clearGeneralProps=function(e,t){try{C(r.dataStore.generalProps[e])||(l(t)&&!C(t)?t.forEach(function(t){b(r.dataStore.generalProps[e],t)}):r.dataStore.generalProps[e]={})}catch(e){return U("clearGeneralProps"),!1}},this.track=function(e,n,i){H(n,function(){var o,a=r.dataStore,u=a.eventContextBuilder,c=a.eventInterceptor,l=t({eventType:"CUSTOM",eventName:n},u(e));l.attributes=Y(t(t({},null!==(o=l.attributes)&&void 0!==o?o:{}),R(t({},s(i)&&!C(i)?i:{})))),r.plugins.gioMultipleInstances&&i&&i["&&sendTo"]&&(l["&&sendTo"]=i["&&sendTo"]),c(l)})},this.trackTimerStart=function(e,t){return r.dataStore.getTrackerVds(e).dataCollect?H(t,function(){var n=F();return r.dataStore.trackTimers[e]||(r.dataStore.trackTimers[e]={}),r.dataStore.trackTimers[e][n]={eventName:t,leng:0,start:+Date.now()},n}):(N("指定实例未开启数据采集,请检查!","error"),!1)},this.trackTimerPause=function(e,t){var n=r.dataStore.trackTimers[e];if(t&&n&&n[t]){var i=n[t];return i.start&&(i.leng=i.leng+(+Date.now()-i.start)),i.start=0,!0}return!1},this.trackTimerResume=function(e,t){var n=r.dataStore.trackTimers[e];if(t&&n&&n[t]){var i=n[t];return 0===i.start&&(i.start=+Date.now()),!0}return!1},this.trackTimerEnd=function(e,n,i){var o,a=r.dataStore.getTrackerVds(e).dataCollect,u=r.dataStore.trackTimers[e];if(n&&u&&u[n]){if(a){var c=u[n];if(0!==c.start){var l=+Date.now()-c.start;c.leng=l>0?c.leng+l:0}var g=r.dataStore,d=g.eventContextBuilder,p=g.eventInterceptor,f=t({eventType:"CUSTOM",eventName:c.eventName},d(e));return f.attributes=Y(t(t({},null!==(o=f.attributes)&&void 0!==o?o:{}),R(t(t({},s(i)&&!C(i)?i:{}),{event_duration:c.leng>864e5?0:c.leng/1e3})))),r.plugins.gioMultipleInstances&&i&&i["&&sendTo"]&&(f["&&sendTo"]=i["&&sendTo"]),p(f),!0}return N("指定实例未开启数据采集,计时器已移除,请检查!","error"),!1}return N("未查询到指定计时器,请检查!","error"),!1},this.removeTimer=function(e,t){var n=r.dataStore.trackTimers[e];return t&&n&&n[t]?(delete n[t],!0):(N("未查询到指定计时器,请检查!","error"),!1)},this.clearTrackTimer=function(e){r.dataStore.trackTimers[e]={}},this.setLocation=function(e,t,n){C(r.dataStore.locationData[e])&&(r.dataStore.locationData[e]={});var i=r.dataStore.locationData[e],o=function(e){return e>=-180&&180>=e};o(t)&&o(n)&&(i.latitude!==t||i.longitude!==n)&&(r.dataStore.locationData[e]={latitude:t,longitude:n})},this.updateImpression=function(){N("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.getABTest=function(e,t,n){N("获取ABTest数据错误! 请集成ABTest插件后重试!","error"),K(n,{})},this.getGioInfo=function(e){var t,n,i=r.userStore,o=i.getUid,a=i.getUserId,u=i.getUserKey,s=i.getSessionId,c=r.dataStore.getTrackerVds(e),l=c.projectId,g=c.appId,d=c.dataSourceId,p=c.dataCollect,f=c.idMapping,v=c.extraParams,h=c.ignoreFields,m={gioappid:g,giocs1:a(e)||"",gioplatform:r.platformConfig.platform,gioprojectid:l,gios:s(e),giou:o()};if(m.giodatacollect=p,m.giodatasourceid=d,f&&(m.giouserkey=u(e)),C(v)||v.forEach(function(t){var n;h.includes(t)||(m["gio".concat(t)]=(null!==(n=r.dataStore.lastVisitEvent[e])&&void 0!==n?n:{})[t])}),e===r.trackingId){var I=null!==(n=null===(t=r.plugins)||void 0===t?void 0:t.gioEventAutoTracking)&&void 0!==n?n:{},y=I.circleServerUrl,S=I.circleOpen;if(y&&S){var w=te(y.split("?")[1]);w.roomId&&(m.giocircleroomid=w.roomId)}}return Le.stringify(m)},this.utils=t(t(t({},q),ie),{qs:Le}),this.emitter={all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(e){e(n)}),(r=e.get("*"))&&r.slice().map(function(e){e(t,n)})}},this.gioPlatform="ks",this.gioFramework="native",this.sdkVersion="4.5.0";try{"quickapp"===this.gioPlatform||c(getApp)&&c(App)?this.inPlugin=!1:this.inPlugin=!0}catch(e){this.inPlugin=!0}this.inPlugin&&N("未检测到小程序实例,自动切换为插件模式!","info"),this.platformConfig=Ne,this.minipInstance=new Ue(this),this.dataStore=new Ae(this),this.userStore=new je(this),this.uploader=new Be(this),this.plugins=new Ke(this),this.plugins.innerPluginInit()},Me=function(){var e,n=arguments[0],r="g0",i=n;if(n.indexOf(".")>-1&&(r=null!==(e=n.split(".")[0])&&void 0!==e?e:"g0",i=n.split(".")[1]),o(i)&&se.includes(i)&&Ve[i]){var a=f(Array.from(arguments));if("init"===i){var u=function(e,t){var n=m(t[0]),r=m(t[1]),i=(4===t.length?t[3]:t[2])||{};return n&&r?e.dataStore.initializedTrackingIds.some(function(t,i){var o=0===i?e.vdsConfig:e.subInstance[t];return o.projectId===n&&o.dataSourceId===r})?(N("SDK初始化失败,重复初始化,请检查初始化参数!","error"),!1):{projectId:n,dataSourceId:r,appId:m(4===t.length?t[2]:""),userOptions:i}:(N('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", "您的小程序 AppId(可选)", options: { serverUrl: "您的数据上报地址" }); 进行初始化!',"error"),!1)}(Ve,a);if(u){var s=u.projectId,c=u.dataSourceId,l=u.appId,g=u.userOptions;return Ve.init(t(t({},g),{projectId:s,dataSourceId:c,appId:l,trackingId:r}))}return!1}if("registerPlugins"===i)Ve.registerPlugins(a[0]);else{if(Ve.gioSDKInitialized&&Ve.vdsConfig)return ue.includes(i)?D(function(){return Ve.handlerDistribute(r,i,a)}):D(function(){return Ve[i].apply(Ve,a)});N("SDK未初始化!","error")}}else if(le.includes(i))N("方法 ".concat(m(i)," 已被弃用,请移除!"),"warn");else{if("canIUse"===i)return se.includes(arguments[1])&&!!Ve[arguments[1]];N("不存在名为 ".concat(m(i)," 的方法调用!"),"error")}};J().gdp=Me,J().gioSDKVersion=Ve.sdkVersion;var Ge=Ve.dataStore.eventHooks,Qe=Ge.growingApp,$e=Ge.growingPage,ze=Ge.growingComponent,We=Ge.growingBehavior;(0,Ge.initOriginalValue)();var Je=D(function(){return null!=Qe?Qe:App}),Ye=D(function(){return null!=$e?$e:Page}),Ze=D(function(){return null!=ze?ze:Component}),Xe=D(function(){return null!=We?We:Behavior});export{Je as GioApp,Xe as GioBehavior,Ze as GioComponent,Ye as GioPage,Me as default};
|
package/dist/mpx.js
ADDED
|
@@ -0,0 +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=/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/,o=function(e){return["undefined","null"].includes(A(e))},a=function(e){return"string"===A(e)},u=function(e){return"number"===A(e)},s=function(e){return"boolean"===A(e)},c=function(e){return"[object Object]"==={}.toString.call(e)&&!o(e)},l=function(e){return["function","asyncfunction"].includes(A(e))},g=function(e){return Array.isArray(e)&&"array"===A(e)},d=function(e){return"date"===A(e)},p=function(e){try{return Array.from(e)[0]}catch(e){return}},f=function(e){try{var t=Array.from(e);return t[t.length-1]}catch(e){return}},v=function(e,t){return void 0===t&&(t=1),g(e)&&u(t)?e.slice(t>0?t:1,e.length):e},h=function(e,t){if(void 0===t&&(t=!1),g(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},m=function(e,t){if(g(e)){var n=e.findIndex(t);return 0>n?void 0:e[n]}},I=function(e){return o(e)?"":"".concat(e)},y=function(e,t){return"string"===A(e)?e.split(t):e},S=function(e){if(a(e)){var t=y(e,"");return"".concat(p(t).toLowerCase()).concat(v(t).join(""))}return e},w=function(e,t){return a(e)||(e=I(e)),e.slice(0,t.length)===t},_={}.hasOwnProperty,O=function(e,t){return null!=e&&("object"==typeof e||"function"==typeof e)&&_.call(e,t)},P=function(e){return c(e)?Object.keys(e):[]},k=function(e,t){P(e).forEach(function(n){return t(e[n],n)})},T=function(e,t){var n=P(e);return!(!c(e)||!c(t)||n.length!==P(t).length||n.map(function(n,i){return c(e[n])?T(e[n],t[n]):e[n]===t[n]}).includes(!1))},b=function(e,t,n){var i=e;return c(e)?(t.split(".").forEach(function(e){i=i?i[e]:n}),i):n},E=function(e,t){if(!c(e))return!1;try{if("string"===A(t))return delete e[t];if("array"===A(t))return t.map(function(t){return delete e[t]});"object"===A(t)&&t.constructor===RegExp&&P(e).forEach(function(n){t.test(n)&&E(e,n)})}catch(e){return!1}},C=function(e,t,n,i){var r;void 0===t&&(t=250);var o=0;return"boolean"!==A(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 g(e)?0===e.length:c(e)?0===P(e).length:!e},A=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},q=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())},N=Object.freeze({__proto__:null,isNil:o,isString:a,isNaN:function(e){return"NaN"===I(Number(e))},isNumber:u,isBoolean:s,isObject:c,isRegExp:function(e){return"[object RegExp]"==={}.toString.call(e)},isFunction:l,isArray:g,isDate:d,fixed:function(e,t){return u(e)?Number(e.toFixed(u(t)?t:2)):a(e)&&"NaN"!==I(Number(e))?Number(Number(e).toFixed(u(t)?t:2)):e},head:p,last:f,drop:v,dropWhile:function(e,t){return g(e)?e.filter(function(e){return!t(e)}):e},compact:h,find:m,isEqualArray:function(e,t){return!(!g(e)||!g(t)||e.length!==t.length)&&e.every(function(e,n){return e===t[n]})},toString:I,split:y,lowerFirst:S,upperFirst:function(e){if(a(e)){var t=y(e,"");return"".concat(p(t).toUpperCase()).concat(v(t).join(""))}return e},startsWith:w,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:O,keys:P,forEach:k,isEqual:T,get:b,unset:E,throttle:C,isEmpty:x,typeOf:A,formatDate:q}),U=function(e,t){console.log("%c[GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444",warn:"color: #F59E0B",success:"color: #10B981"}[t]||"")},H=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),U("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},D=function(e){try{return e()}catch(e){return}},K=function(e,t){if(l(e))try{e(t)}catch(e){U("回调执行失败!".concat(e),"error")}},L=function(e){return a(e)?e.trim().substring(0,100):e},F=function(e,t){return a(e)&&!x(e)&&e.match(r)?t():(U("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},B=function(e){return o(e)||P(e).forEach(function(t){l(e[t])?e[t]=D(function(){return e[t]()}):c(e[t])?E(e,t):g(e[t])||(e[t]=I(e[t]))}),e},R=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)})},j=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},V=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)}},G=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},Q=function(e){if(a(e)){var t=e.indexOf("?");return-1!==t?[e.substring(0,t),e.substring(t+1)]:[e,""]}return["",""]},$=function(e){return a(e)?e.startsWith("/")?e:"/".concat(e):""},z=function(e){return D(function(){switch(e){case"wx":return wx;case"my":case"tb":return my;case"swan":return swan;case"tt":return tt;case"qq":return qq;case"ks":return ks;case"jd":return jd;case"xhs":return xhs;default:var t=void 0;return t||(t=D(function(){return xhs})),t||(t=D(function(){return swan})),t||(t=D(function(){return my})),t||(t=D(function(){return tt})),t||(t=D(function(){return qq})),t||(t=D(function(){return ks})),t||(t=D(function(){return jd})),t||(t=D(function(){return wx})),t}})},W=function(e){return D(function(){switch(e){case"wx":return __wxConfig;case"swan":return appConfig;case"tt":return D(function(){return __ttConfig})||(null===global||void 0===global?void 0:global.TMAConfig)||(null===globalThis||void 0===globalThis?void 0:globalThis.TMAConfig);case"qq":return __qqConfig;case"ks":return __ksConfig;case"jd":return __jdConfig;case"xhs":return null!==__MP_APP_JSON_MIGRATION__&&void 0!==__MP_APP_JSON_MIGRATION__?__MP_APP_JSON_MIGRATION__:__MP_APP_JSON__;default:return}})},J=function(e){return D(function(){switch(e){case"wx":case"qq":return __wxAppCode__;case"tt":return __allConfig__;case"ks":return __module__;case"jd":return __jdAppCode__;default:return}})},Y=function(){var e;return!e&&D(function(){return xhs})&&(e="xhs"),!e&&D(function(){return swan})&&(e="swan"),!e&&D(function(){return tt})&&(e="tt"),!e&&D(function(){return qq})&&(e="qq"),!e&&D(function(){return my.tb})&&(e="tb"),!e&&D(function(){return my})&&(e="my"),!e&&D(function(){return ks})&&(e="ks"),!e&&D(function(){return jd})&&(e="jd"),!e&&D(function(){return wx})&&(e="wx"),e||m(P(global),function(e){return I(e).toLowerCase().includes("quickapp")})&&(e="quickapp"),e},Z=function(){var e;return null!==(e=D(function(){var e;return null!==(e=D(function(){var e;return null!==(e=D(function(){return $global}))&&void 0!==e?e:global}))&&void 0!==e?e:window}))&&void 0!==e?e:globalThis},X=function(e){var t={};return c(e)&&(E(e,"&&sendTo"),k(e,function(e,n){var i=I(n).slice(0,100);c(e)?t[i]=X(e):g(e)?(t[i]=h(e.slice(0,100),!0),t[i]=t[i].join("||").slice(0,1e3)):d(e)?t[i]=q(e):t[i]=o(e)?"":I(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 P(e||{}).map(function(t){return t?"".concat(t,"=").concat(o(e[t])?"":e[t]):""}).join("&")},ie=function(e){(w(e,"?")||w(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 P(e).forEach(function(r){var o=re.some(function(e){return r.includes(e)}),a=O(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:U,callError:H,niceTry:D,niceCallback:K,limitString:L,eventNameValidate:F,getDynamicAttributes:B,guid:R,getScreenHeight:j,getScreenWidth:M,getOS:V,compareVersion:G,getVueVersion:function(e){if(e){var t=Number(p(y(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:W,getPlainAppCode:J,getPlainPlatform:Y,getSubKeys:function(e){return P(e).filter(function(e){return e.indexOf("__sub")>-1&&e.indexOf("gio__")>-1}).sort()},getAppInst:function(){var e=D(function(){return getApp({allowDefault:!0})});return e||(e=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 a(e)?null!==(t=D(function(){return JSON.parse(e)}))&&void 0!==t?t:{}:null!=e?e:{}},getPureParams:oe}),ue=function(e){return(a(e)&&e.length>0||u(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},mpx:{type:["module","function"],default:!1},tbConfig:{type:"object",default:{cloud:void 0,cloudFuncSend:!1,cloudFuncName:"httpTunnel",cloudFuncHandler:"main",cloudAppId:void 0,path:void 0}},trackPage:{type:"boolean",default:!0},uniVue:{type:["object","function"],default:!1},uploadInterval:{type:"number",default:1e3},version:{type:"string",default:"1.0.0"}},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:"数据上报服务地址",ignoreFields:"忽略上报字段"},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",_e="ON_SEND_AFTER",Oe="ON_SEND_BEFORE",Pe="OPTION_CHANGE",ke="OPTION_INITIALIZED",Te="SDK_INITIALIZED",be="SESSIONID_UPDATE",Ee=function(e){var t=this;this.growingIO=e,this.main=function(e,i,r){var o;void 0===r&&(r=!0),e||(e=t.growingIO.trackingId);var a=t.growingIO,u=a.sdkVersion,s=a.platformConfig,c=a.minipInstance,l=a.userStore,g=a.dataStore,d=a.dataStore,p=d.scene,f=d.eventHooks.currentPage,v=d.generalProps,h=g.getTrackerVds(e),m=h.version,I=h.dataSourceId,y=h.appId,S=h.idMapping,w=h.ignoreFields,_=g.locationData[e],O=c.systemInfo,P=void 0===O?{}:O,k=c.network,T=void 0===k?{}:k,b=P.brand,C=P.model,A=P.platform,q=P.language,N=f.getPagePath(),U={appChannel:"scn:".concat(p||"NA"),appVersion:m,dataSourceId:I,deviceBrand:b,deviceId:l.getUid(),deviceModel:C,deviceType:V(A,s.name),domain:y,language:q,latitude:null==_?void 0:_.latitude,longitude:null==_?void 0:_.longitude,networkState:(null===(o=null==T?void 0:T.networkType)||void 0===o?void 0:o.result)||(null==T?void 0:T.networkType)||(null==T?void 0:T.type)||(null==T?void 0:T.subtype),operatingSystem:V(A,s.name),path:N,platform:s.platform,platformVersion:s.name+(P.version?" ".concat(P.version):""),query:N?f.getPageQuery():"",screenHeight:j(P),screenWidth:M(P),sdkVersion:u,sessionId:l.getSessionId(e),title:f.getPageTitle(),timestamp:Date.now(),timezoneOffset:(new Date).getTimezoneOffset(),userId:l.getUserId(e)};return S&&(U.userKey=l.getUserKey(e)),r&&!x(v[e])&&(U.attributes=n({},v[e])),x(U.attributes)||(U.attributes=X(B(n({},U.attributes)))),x(w)||w.forEach(function(e){E(U,e)}),x(i)?n(n({},U),{trackingId:e}):n(n(n({},U),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 _=t.enterParamsParse(i[0]),O=_.path,P=_.query,k=_.referralPage;!m&&l.originalSource&&O&&h(function(e){S(e,{path:O,query:P,referralPage:k})}),I?(Date.now()-I>60*l.keepAlive*1e3||p.lastScene&&p.scene!==p.lastScene)&&h(function(e){c.setSessionId(e)}):h(function(e){p.lastVisitEvent[e]={path:O,query:P,referralPage:k},t.buildVisitEvent(e,{path:O,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,E(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"===A(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)))}},xe=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?"_"+f(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||O(e,"path"))&&(e.path=$(r+(o?"?".concat(o):""))),(n||O(e,"query"))&&(e.query=o),e},this.eventSetPageProps=function(e,i){var r=D(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=O(e,"path");if(O(e,"query"))a=ie(null!==(i=e.query)&&void 0!==i?i:"")||{};else if(u)a=ie(f(r))||{};else{var s=this.growingIO.minipInstance.getCurrentPage();a=n({},s.options||this.queryOptions[s.route]||{}),h(P(a)).forEach(function(e){e.toLowerCase().startsWith("utm_")&&E(a,e)})}return[o,ne(a)]},e}(),Ae=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,g=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,_=v.buildAppMessageEvent,O=v.buildTimelineEvent,P=v.buildAddFavorites,k=S.currentPage;if(!t.prevEvent[i]||Date.now()-Number(t.prevEvent[i])>=50){e||(e=g.getCurrentPage()),e.route||(e.route=g.getCurrentPath(e));var T=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:",T,"#",i,u),t.prevEvent[i]=Date.now();var C=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 C.pageLoad:k.queryOptions[T]=b(e,"options")||b(e,"__displayReporter.query")||b(e,"$page.query")||b(e,"$wx.__displayReporter.query")||b(e,"$taroParams")||r[0]||{},E(k.queryOptions[T],["$taroTimestamp","gdpCircleRoomCollectUrl"]);break;case C.pageShow:y(function(e){var i=m(e);x(i)||i.path!==T||I(e,n(n({},i),{title:k.getPageTitle()})),h(e).trackPage&&t.buildPageEvent(e)}),w(!1);break;case C.pageHide:case C.pageUnload:break;case C.shareChat:case C.shareApp:w(!0),y(function(e){h(e).followShare&&_(e,r)});break;case C.shareTime:"xhsp"===g.platform&&w(!0),y(function(e){h(e).followShare&&O(e,r)});break;case C.addFavorites:y(function(e){h(e).followShare&&P(e,r)});break;case C.tabTap:var A=null===(a=null==d?void 0:d.gioEventAutoTracking)||void 0===a?void 0:a.buildTabClickEvent;p.autotrack&&A&&l(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 l(t)&&"constructor"!==e},this.objectTraverse=function(e,t){Object.getOwnPropertyNames(e).forEach(function(n){return t(n,e)}),O(e,"methods")&&Object.getOwnPropertyNames(e.methods).forEach(function(n){e[n]||t(n,e.methods)}),O(e,"lifetimes")&&Object.getOwnPropertyNames(e.lifetimes).forEach(function(n){e[n]||t(n,e.lifetimes)}),O(e,"pageLifetimes")&&Object.getOwnPropertyNames(e.pageLifetimes).forEach(function(n){e[n]||t(n,e.pageLifetimes)})},this.supLifeFcs=function(e,t){g(i["".concat(t,"Handlers")])&&i["".concat(t,"Handlers")].forEach(function(t){l(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"===A(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"===A(g),p="promise"===A(g.promise),f=O(g,"_result")&&O(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){U(e,"error")}};d&&Promise.race([g,new Promise(function(e){setTimeout(function(){e({})},3e3)})]).then(v).catch(function(e){return U(e,"error")}),p&&Promise.race([g.promise,new Promise(function(e){setTimeout(function(){e({})},3e3)})]).then(v).catch(function(e){return U(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]||{};O(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)&&(l(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){U(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 l(i.originalApp)?i.originalApp(i.appOverriding(e)):i.appOverriding(e)},this.growingPage=function(e){return l(i.originalPage)?i.originalPage(i.pageOverriding(e)):i.pageOverriding(e)},this.growingComponent=function(e){return l(i.originalComponent)?i.originalComponent(i.componentOverriding(e)):i.componentOverriding(e)},this.growingBehavior=function(e){return l(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=D(function(){return App||global.App}),i.originalPage=D(function(){return Page||global.Page}),i.originalComponent=D(function(){return Component||global.Component}),i.originalBehavior=D(function(){return Behavior||global.Behavior})},this.initEventHooks=function(){var e=i,t=i.growingIO,n=t.platformConfig,r=t.gioPlatform;i.initOriginalValue(),n.canHook?(i.nativeGrowing(),Z().GioApp=D(function(){return null!==App&&void 0!==App?App:i.originalApp}),Z().GioPage=D(function(){return null!==Page&&void 0!==Page?Page:i.originalPage}),Z().GioComponent=D(function(){return null!==Component&&void 0!==Component?Component:i.originalComponent}),Z().GioBehavior=D(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 Ae(this.growingIO),this.currentPage=new xe(this.growingIO)},Ne=function(){function e(e){var t,r,o=this;this.growingIO=e,this.ALLOW_SETTING_KEYS=P(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=D(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,r=o.growingIO,a=r.platformConfig,u=r.inPlugin,s=r.minipInstance,c=r.plugins,l=e.uniVue,g=e.taro,d=e.mpx;l||g||"quickapp"===s.platform||(a.canHook=!0),!u||["tbp","jdp"].includes(s.platform)?o.eventHooks.initEventHooks():o.eventHooks.initOriginalValue();try{l&&(null===(t=null==c?void 0:c.gioUniAppAdapter)||void 0===t||t.main()),g&&(null===(n=null==c?void 0:c.gioTaroAdapter)||void 0===n||n.main()),d&&(null===(i=null==c?void 0:c.gioMpxAdapter)||void 0===i||i.main())}catch(e){U(e,"error")}},this.initOptions=function(e){var t,i,r,a,u,s,c=e.projectId,l=e.dataSourceId,d=e.appId,p=e.trackingId,f={};return o.ALLOW_SETTING_KEYS.forEach(function(t){var n=se[t].type;(g(n)?n.includes(A(e[t])):A(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]&&U("已关闭".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,"")),E(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:d,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=o.growingIO,u=a.userStore,s=a.emitter,c=o.getTrackerVds(e),l=n({},c);return"ignoreFields"===t&&(i=i.filter(function(e){return pe.includes(e)})),o.updateVdsConfig(e,n(n({},c),((r={})[t]=i,r))),"dataCollect"===t&&l.dataCollect!==i&&i&&u.setSessionId(e),s.emit(Pe,{optionName:t,optionValue:i}),!0},this.getOption=function(e,t){var n=o.getTrackerVds(e);return t&&O(o.growingIO.vdsConfig,t)?O(n,t)?n[t]:o.growingIO.vdsConfig[t]:x(t)?n:void H("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){s(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={};k(e,function(e,t){var n;if("element"===t){var i=null!==(n=p(e))&&void 0!==n?n:{};k(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:R()}))}},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:p(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:p(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:p(l),$share_query:l[1]})),c(g)},this.trackersExecute=function(e){o.initializedTrackingIds.forEach(function(t){"function"===A(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,u=a.emitter,c=a.minipInstance;u.on(Te,function(e){var t=e.trackingId;o.initializedTrackingIds.push(t),o.initStorageInfo(t)}),u.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)}),l(null===(t=c.minip)||void 0===t?void 0:t.onAppHide)&&c.minip.onAppHide(function(){o.trackersExecute(function(e){var t=o.trackTimers[e];k(t,function(e){e.start&&(e.leng=e.leng+(+Date.now()-e.start))})})}),l(null===(r=c.minip)||void 0===r?void 0:r.onAppShow)&&c.minip.onAppShow(function(){o.trackersExecute(function(e){var t=o.trackTimers[e];k(t,function(e){e.start&&(e.start=+Date.now())})})}),u.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(be,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"]}}},He=n(n({},Ue),{pageHandlers:i(i([],Ue.pageHandlers,!0),["onShareChat","onCopyUrl","onShareAppMessage","onShareTimeline"],!1),shareEventTypes:i(i([],Ue.shareEventTypes,!0),["onShareChat","onCopyUrl"],!1),listeners:n(n({},Ue.listeners),{page:n(n({},Ue.listeners.page),{shareTime:"onShareTimeline",shareChat:"onShareChat",copyUrl:"onCopyUrl"})}),name:"XiaoHongShu",platform:"xhsp",scnPrefix:"xhs_"}),De=n(n({},Ue),{listeners:n({},Ue.listeners),name:"JingDong",platform:"jdp",scnPrefix:"jd_"}),Ke=n(n({},Ue),{listeners:n({},Ue.listeners),name:"KuaiShou",platform:"kuaishoup",scnPrefix:"ks_"}),Le=n(n({},Ue),{listeners:n({},Ue.listeners),name:"Alipay",platform:"alip",scnPrefix:"alip_",shareEventTypes:["onShareAppMessage"],hooks:n(n({},Ue.hooks),{Behavior:!1})}),Fe=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})}),Be=n(n({},Ue),{listeners:n({},Ue.listeners),name:"QQ",platform:"qq",scnPrefix:"qq_"});Be.pageHandlers=i(i([],Ue.pageHandlers,!0),["onAddToFavorites"],!1),Be.listeners.page.addFavorites="onAddToFavorites";var Re=n(n({},Ue),{listeners:n({},Ue.listeners),name:"Baidu",platform:"baidup",scnPrefix:"baidup_"}),je=n(n({},Ue),{listeners:n({},Ue.listeners),name:"Bytedance",platform:"bytedance",scnPrefix:"bytedance_"}),Me=n(n({},Ue),{listeners:n({},Ue.listeners),name:"Weixin",platform:"MinP"});Me.pageHandlers=i(i([],Ue.pageHandlers,!0),["onShareTimeline","onAddToFavorites"],!1),Me.listeners.page=n(n({},Ue.listeners.page),{shareTime:"onShareTimeline",addFavorites:"onAddToFavorites"});var Ve=Y(),Ge=D(function(){var e={xhs:He,jd:De,ks:Ke,my:Le,tb:Fe,qq:Be,swan:Re,tt:je,wx:Me}[Ve];return e.canHook=!1,e}),Qe=function(e){var t=this;this.growingIO=e,this.minip=z("framework"),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 D(function(){return f(getCurrentPages())})||{}},this.getCurrentPath=function(){var e=t.getCurrentPage();return(null==e?void 0:e.route)||(null==e?void 0:e.uri)||(null==e?void 0:e.__route__)||""},this.getPageTitle=function(e){var n,i,r,o,u,s,c,l,d=Y(),p="",f=W(d);"string"===A(f)&&(f=null!==(n=D(function(){return JSON.parse(f)}))&&void 0!==n?n:{});var v,h=(null==e?void 0:e.data)||e.$data||{};if((p=a(null==h?void 0:h.gioPageTitle)?null==h?void 0:h.gioPageTitle:"")||D(function(){var t,n,i=J(d);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=g(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(d)?null===(s=null===(u=null===(o=f||global||$global)||void 0===o?void 0:o.global)||void 0===u?void 0:u.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),L(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 c(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,g=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:g}),p=setTimeout(function(){(null==d?void 0:d.abort)&&l(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()})})},$e=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,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.hookSetTitle(),n}return t(n,e),n}(Qe),ze=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.hookSetTitle(),n}return t(n,e),n}(Qe),We=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.hookSetTitle(),n}return t(n,e),n}(Qe),Je=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.request=function(e){var t,i=e.url,r=e.data,o=e.header,a=e.timeout,u=e.method,s=e.success,c=e.fail,g=e.complete,d=null===(t=n.minip)||void 0===t?void 0:t.request({url:i,data:r,headers:o,timeout:a,method:u,success:s,fail:c,complete:g}),p=n.minip.SDKVersion;if(G(p,"2.0.0")>=0)var f=setTimeout(function(){(null==d?void 0:d.abort)&&l(null==d?void 0:d.abort)&&(null==d||d.abort()),clearTimeout(f),f=null},(a||1e4)+10);return d},n.handleSharePromise=function(e,t){var n=new Promise(function(t){e._result?t(e._result):Object.defineProperty(e,"_result",{set:function(e){this.__result=e,t(e)},get:function(){return this.__result}})});Promise.race([n,new Promise(function(t){setTimeout(function(){t(e._result||{})},3e3)})]).then(t).catch(function(e){return U(e,"error")})},n.hookSetTitle(),n}return t(n,e),n}(Qe),Ye=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.hookSetTitle(),n}return t(n,e),n}(Qe),Ze=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,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.hookSetTitle(),n}return t(n,e),n}(Qe),Xe=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.hookSetTitle(),n}return t(n,e),n}(Qe),et=function(e){function i(t){var i=e.call(this,t)||this;return i.growingIO=t,i.getSystemInfo=function(){var e=i;return new Promise(function(t){var r,o,a,u=n(n(n({},null===(r=i.minip)||void 0===r?void 0:r.getDeviceInfo()),null===(o=i.minip)||void 0===o?void 0:o.getWindowInfo()),null===(a=i.minip)||void 0===a?void 0:a.getAppBaseInfo());e.systemInfo=u,t(u)})},i.hookSetTitle(),i}return t(i,e),i}(Qe),nt={wx:et,swan:Ze,my:Je,qq:Ye,tt:Xe,ks:We,jd:ze,xhs:$e}[Y()],it=["gioPerformance"],rt=null,ot={name:"GioMpxAdapter",method:function(e){var t,n=this;this.growingIO=e,this.actionEventTypes=[],this.customFcEffects=function(e,t){var i=n;return function(){for(var n,r,o,a,u=[],s=0;arguments.length>s;s++)u[s]=arguments[s];if(i.growingIO.vdsConfig.autotrack&&i.growingIO.plugins.gioEventAutoTracking)try{var c=u[0]||{};if(O(c,"type")&&((null==c?void 0:c.currentTarget)||(null==c?void 0:c.target))||(c=u[u.length-1]),((null==c?void 0:c.currentTarget)||(null==c?void 0:c.target))&&i.actionEventTypes.includes(c.type)){l(i.actionEffects)||(i.actionEffects=(null===(r=null===(n=i.growingIO.plugins)||void 0===n?void 0:n.gioEventAutoTracking)||void 0===r?void 0:r.main)||function(){});var g=((((null===(o=null==c?void 0:c.currentTarget)||void 0===o?void 0:o.dataset)||(null===(a=null==c?void 0:c.target)||void 0===a?void 0:a.dataset)||{}).eventconfigs||{}).bubble||{})[c.type]||[],d=Array.isArray(g)&&g[0]&&g[0][0]?g[0][0]:e;null==i||i.actionEffects(c,d)}}catch(e){U(e,"error")}return t.apply(this,u)}},this.main=function(){var e=n.growingIO,t=e.dataStore,i=e.vdsConfig;n.mpx=i.mpx,t.eventHooks.customFcEffects=n.customFcEffects,rt=t.eventHooks,n.setupAppLifecycleHook()},this.setupAppLifecycleHook=function(){if(n.mpx){var e=n.mpx.injectMixins;if("function"==typeof e){var t=n.growingIO.dataStore,i={onLaunch:function(){for(var e,t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];null===(e=null==rt?void 0:rt.appEffects)||void 0===e||e.main("onLaunch",t)},onShow:function(){for(var e,n=[],i=0;arguments.length>i;i++)n[i]=arguments[i];t.lastCloseTime&&t.shareOut&&t.toggleShareOut(!1),null===(e=null==rt?void 0:rt.appEffects)||void 0===e||e.main("onShow",n)},onHide:function(){for(var e,t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];null===(e=null==rt?void 0:rt.appEffects)||void 0===e||e.main("onHide",t)}};e(i,{types:"app"})}}},this.pluginVersion="__PLUGIN_VERSION__";var i=this.growingIO.dataStore;this.actionEventTypes=(null===(t=null==i?void 0:i.eventHooks)||void 0===t?void 0:t.actionEventTypes)||[]}},at=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.pluginsContext={plugins:{gioMpxAdapter:ot}},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;it.forEach(function(e){var t;return E(null===(t=u.pluginsContext)||void 0===t?void 0:t.plugins,e)}),P(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;m(u.pluginItems,function(e){return e.name===r})||u.pluginItems.push({name:S(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||m(u.pluginItems,function(t){return t.name===e});if((null===(i=u.growingIO)||void 0===i?void 0:i.plugins)[e])return U("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return U("插件加载失败!不存在名为 ".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),U("加载插件 ".concat(e),"info")),!0}catch(n){return u.lifeError(t,n),U("插件【".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)&&!m(u.pluginItems,function(e){return e.name===t.name})&&u.pluginItems.push({name:S(t.name),method:t.method?t.method:function(){}})})},this.uninstall=function(e){var t;E(u.pluginItems,e);var n=E(null===(t=u.growingIO)||void 0===t?void 0:t.plugins,e);return n||U("卸载插件 ".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}),U("插件执行错误 ".concat((null==e?void 0:e.name)||"unknown"," ").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&&l(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(Oe,function(e){return u.callLifeCycle("onSendBefore",e)}),null===(a=this.growingIO.emitter)||void 0===a||a.on(_e,function(e){return u.callLifeCycle("onSendAfter",e)})}),ut={},st={}.hasOwnProperty;function ct(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function lt(e){try{return encodeURIComponent(e)}catch(e){return null}}ut.stringify=function(e,t){t=t||"";var n,i,r=[];for(i in"string"!=typeof t&&(t="?"),e)if(st.call(e,i)){if((n=e[i])||null!=n&&!isNaN(n)||(n=""),i=lt(i),n=lt(n),null===i||null===n)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""},ut.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,i={};t=n.exec(e);){var r=ct(t[1]),o=ct(t[2]);null===r||null===o||r in i||(i[r]=o)}return i};var gt=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 w(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,a=n({},e),u=t.growingIO,s=u.vdsConfig;u.emitter.emit(me,{eventData:e,trackingId:e.trackingId}),s.forceLogin?(o(t.hoardingQueue[e.trackingId])&&(t.hoardingQueue[e.trackingId]=[]),null===(i=t.hoardingQueue[e.trackingId])||void 0===i||i.push(a)):(o(t.requestQueue[e.trackingId])&&(t.requestQueue[e.trackingId]=[]),null===(r=t.requestQueue[e.trackingId])||void 0===r||r.push(a),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;C(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 E(t,["requestId","trackingId"]),t});o.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(g,null,2)),a.emit(Oe,{eventsQueue:l,requestData:g,trackingId:e})}},this.sendEvent=function(e,n){var r,o=p(e).trackingId,a=t.growingIO,u=a.minipInstance,s=a.dataStore,c=a.emitter,l=a.plugins,g=s.getTrackerVds(o),d=g.compress,f=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:f,fail:function(i){[200,204].includes(i.code)||(e.forEach(function(e){t.requestFailFn(e)}),U("请求失败!".concat(JSON.stringify(i)),"error"),c.emit("ON_SEND_ERROR",{eventsQueue:e,requestData:n,trackingId:o}))},complete:function(e){t.requestingNum-=1,c.emit(_e,{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(Oe,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))})},dt=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(R()),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=R()),t._sessionId[e]=n;var r=t.growingIO.vdsConfig.sessionExpires;r>-1&&(t._sessionExpires=Date.now()+6e4*r),i!==n&&t.growingIO.emitter.emit(be,{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]=o(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]=o(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]=o(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},pt=new function(){var e,t=this;this.init=function(e){var n;t.emitter.emit("ON_SDK_INITIALIZE_BEFORE",{options:e});try{if(U("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(Te,i),t.trackingId&&t.trackingId!==e.trackingId||(Z().__gio__=function(){return t}),U("Gio小程序SDK 初始化完成!","success"),t.inPlugin&&"tbp"!==t.minipInstance.platform&&t.dataStore.sendVisit(i.trackingId),t.vdsConfig.forceLogin&&U("forceLogin已开启,请调用 identify 方法设置 openId 以继续上报!","info"),!0}catch(e){return U(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));U("不存在实例:".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 P(ge).includes(n)?A(i)===(null===(r=se[n])||void 0===r?void 0:r.type)?(t.dataStore.setOption(e,n,i),U("已修改".concat(ge[n],": ").concat(i),"info"),!0):(U("参数格式不正确:".concat(i,",请检查后重试!"),"error"),!1):(U("不存在可修改的配置项:".concat(n,",请检查后重试!"),"error"),!1)},this.setPageAttributes=function(e,n){if(c(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)||k(n,function(t,n){l(i.pageProps[e][r][n])&&!l(t)||(i.pageProps[e][r][n]=t)}),!0}return H("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();g(n)&&!x(n)?n.forEach(function(t){E(i.pageProps[e][r],t)}):i.pageProps[e][r]={}}}catch(e){return H("clearPageAttributes"),!1}},this.sendPage=function(e,n){t.dataStore.getTrackerVds(e).trackPage?U("仅在关闭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 H("identify");var i=I(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?H("identify",!1,"请勿重复调用"):H("identify",!1,"forceLogin未开启");else H("identify",!1,"子实例不允许调用identify")},this.setUserAttributes=function(e,i){var r,o,a,u;if(c(i)&&!x(i)){var s=t.dataStore,l=s.eventContextBuilder,g=s.eventInterceptor,d=s.lastVisitEvent,p=n({eventType:"LOGIN_USER_ATTRIBUTES"},l(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 H("setUserAttributes")},this.setUserId=function(e,n,i){if(ue(n)){var r=t.userStore.getGioId(e);n=I(n).slice(0,1e3),i=I(i).slice(0,1e3),t.userStore.setUserId(e,n);var a=!o(i)&&I(i).length>0?I(i).slice(0,1e3):"";t.userStore.setUserKey(e,a),!t.dataStore.getTrackerVds(e).idMapping&&a&&U("您设置了 userKey ,请初始化开启 idMapping!","warn"),r&&r!==n&&t.userStore.setSessionId(e)}else H("setUserId")},this.clearUserId=function(e){t.userStore.setUserId(e,void 0),t.userStore.setUserKey(e,void 0)},this.setGeneralProps=function(e,n){return c(n)&&!x(n)?(x(t.dataStore.generalProps[e])&&(t.dataStore.generalProps[e]={}),k(n,function(n,i){l(t.dataStore.generalProps[e][i])&&!l(n)||(t.dataStore.generalProps[e][i]=n)}),!0):(H("setGeneralProps"),!1)},this.clearGeneralProps=function(e,n){try{x(t.dataStore.generalProps[e])||(g(n)&&!x(n)?n.forEach(function(n){E(t.dataStore.generalProps[e],n)}):t.dataStore.generalProps[e]={})}catch(e){return H("clearGeneralProps"),!1}},this.track=function(e,i,r){F(i,function(){var o,a=t.dataStore,u=a.eventContextBuilder,s=a.eventInterceptor,l=n({eventType:"CUSTOM",eventName:i},u(e));l.attributes=X(n(n({},null!==(o=l.attributes)&&void 0!==o?o:{}),B(n({},c(r)&&!x(r)?r:{})))),t.plugins.gioMultipleInstances&&r&&r["&&sendTo"]&&(l["&&sendTo"]=r["&&sendTo"]),s(l)})},this.trackTimerStart=function(e,n){return t.dataStore.getTrackerVds(e).dataCollect?F(n,function(){var i=R();return t.dataStore.trackTimers[e]||(t.dataStore.trackTimers[e]={}),t.dataStore.trackTimers[e][i]={eventName:n,leng:0,start:+Date.now()},i}):(U("指定实例未开启数据采集,请检查!","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 l=+Date.now()-s.start;s.leng=l>0?s.leng+l: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({},c(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 U("指定实例未开启数据采集,计时器已移除,请检查!","error"),!1}return U("未查询到指定计时器,请检查!","error"),!1},this.removeTimer=function(e,n){var i=t.dataStore.trackTimers[e];return n&&i&&i[n]?(delete i[n],!0):(U("未查询到指定计时器,请检查!","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(){U("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.getABTest=function(e,t,n){U("获取ABTest数据错误! 请集成ABTest插件后重试!","error"),K(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 ut.stringify(m)},this.utils=n(n(n({},N),ae),{qs:ut}),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=Y(),this.gioFramework="mpx",this.sdkVersion="4.5.0";try{"quickapp"===this.gioPlatform||l(getApp)&&l(App)?this.inPlugin=!1:this.inPlugin=!0}catch(e){this.inPlugin=!0}this.inPlugin&&U("未检测到小程序实例,自动切换为插件模式!","info"),this.platformConfig=Ge,this.minipInstance=new nt(this),this.dataStore=new Ne(this),this.userStore=new dt(this),this.uploader=new gt(this),this.plugins=new at(this),this.plugins.innerPluginInit()},ft=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]),a(r)&&le.includes(r)&&pt[r]){var o=v(Array.from(arguments));if("init"===r){var u=function(e,t){var n=I(t[0]),i=I(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})?(U("SDK初始化失败,重复初始化,请检查初始化参数!","error"),!1):{projectId:n,dataSourceId:i,appId:I(4===t.length?t[2]:""),userOptions:r}:(U('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", "您的小程序 AppId(可选)", options: { serverUrl: "您的数据上报地址" }); 进行初始化!',"error"),!1)}(pt,o);if(u){var s=u.projectId,c=u.dataSourceId,l=u.appId,g=u.userOptions;return pt.init(n(n({},g),{projectId:s,dataSourceId:c,appId:l,trackingId:i}))}return!1}if("registerPlugins"===r)pt.registerPlugins(o[0]);else{if(pt.gioSDKInitialized&&pt.vdsConfig)return ce.includes(r)?D(function(){return pt.handlerDistribute(i,r,o)}):D(function(){return pt[r].apply(pt,o)});U("SDK未初始化!","error")}}else if(de.includes(r))U("方法 ".concat(I(r)," 已被弃用,请移除!"),"warn");else{if("canIUse"===r)return le.includes(arguments[1])&&!!pt[arguments[1]];U("不存在名为 ".concat(I(r)," 的方法调用!"),"error")}};Z().gdp=ft,Z().gioSDKVersion=pt.sdkVersion;var vt=pt.dataStore.eventHooks,ht=vt.growingApp,mt=vt.growingPage,It=vt.growingComponent,yt=vt.growingBehavior;(0,vt.initOriginalValue)();var St=D(function(){return null!=ht?ht:App}),wt=D(function(){return null!=mt?mt:Page}),_t=D(function(){return null!=It?It:Component}),Ot=D(function(){return null!=yt?yt:Behavior});export{St as GioApp,Ot as GioBehavior,_t as GioComponent,wt as GioPage,ft as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=function(){return e=Object.assign||function(e){for(var t,r=1,n=arguments.length;n>r;r++)for(var i in t=arguments[r])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var t=function(e){return["undefined","null"].includes(d(e))},r=function(e){return"string"===d(e)},n=function(e){return"NaN"===c(Number(e))},i=function(e){return"number"===d(e)},o=function(e){return"[object Object]"==={}.toString.call(e)&&!t(e)},a=function(e){return Array.isArray(e)&&"array"===d(e)},c=function(e){return t(e)?"":"".concat(e)},s=function(e){return o(e)?Object.keys(e):[]},u=function(e,t){if(!o(e))return!1;try{if("string"===d(t))return delete e[t];if("array"===d(t))return t.map(function(t){return delete e[t]});"object"===d(t)&&t.constructor===RegExp&&s(e).forEach(function(r){t.test(r)&&u(e,r)})}catch(e){return!1}},g=function(e){return a(e)?0===e.length:o(e)?0===s(e).length:!e},d=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},l=/^\d+_gdp_abt_sign$/,f=/^\d+_gdp_abtd$/,v=function(e,t){console.log("%c[GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444",warn:"color: #F59E0B",success:"color: #10B981"}[t]||"")},m=function(e,t){if(["function","asyncfunction"].includes(d(e)))try{e(t)}catch(e){v("回调执行失败!".concat(e),"error")}},y=function(e){var r={};return o(e)&&(u(e,"&&sendTo"),function(e){s(e).forEach(function(n){return function(e,n){var i=c(n).slice(0,100);o(e)?r[i]=y(e):a(e)?(r[i]=function(e,t){if(void 0===t&&(t=!1),a(e)){for(var r=0,n=[],i=0,o=e;i<o.length;i++){var c=o[i];c&&!g(c)&&(n[r++]=c),t&&0===c&&(n[r++]=c)}return n}return e}(e.slice(0,100),!0),r[i]=r[i].join("||").slice(0,1e3)):function(e){return"date"===d(e)}(e)?r[i]=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())}(e):r[i]=t(e)?"":c(e).slice(0,1e3)}(e[n],n)})}(e)),r},I=function(e,t){void 0===t&&(t=!1);var r=0;if(g(e)||"boolean"==typeof e)return r;for(var n=0;n<e.length;)r=(r<<5)-r+e.charCodeAt(n),r&=r,n++;return t?Math.abs(r):r},p={name:"gioABTest",method:function(t,a){var d=this;this.growingIO=t,this.timeoutCheck=function(e,t){d.requestInterval=i(Number(e))&&!n(Number(e))?Number(e):5,(d.requestInterval>1440||0>d.requestInterval)&&(d.requestInterval=5),d.requestTimeout=i(Number(t))&&!n(Number(t))?Number(t):1e3,(d.requestTimeout>5e3||100>d.requestTimeout)&&(d.requestTimeout=1e3)},this.abtStorageCheck=function(){var e,t=d.growingIO.minipInstance,r=(null===(e=t.minip)||void 0===e?void 0:e.getStorageInfoSync().keys)||[];r.filter(function(e){return l.test(e)}).forEach(function(e){var r=t.getStorageSync(e);r&&r>=Date.now()||t.removeStorageSync(e)}),r.filter(function(e){return f.test(e)}).forEach(function(e){g(t.getStorageSync(e))&&t.removeStorageSync(e)})},this.getHashKey=function(e,t){var r=d.growingIO,n=r.userStore.getUid,i=r.vdsConfig.projectId;return I("".concat(e,"#").concat(i,"#").concat(n(),"#").concat(t),!0)},this.generateUrl=function(e,t){var n,i;d.newDevice&&!d.visitSids[e]&&(d.visitSids[e]=d.growingIO.userStore.getSessionId(e)),i="http",r(n=t)||(n=c(n)),n.slice(0,4)!==i?d.url[e]="https://".concat(t,"/diversion/specified-layer-variables"):d.url[e]="".concat(t,"/diversion/specified-layer-variables")},this.getABTest=function(e,t,r){if(g(d.url[e])&&d.generateUrl(e,"https://ab.growingio.com"),!t)return v("获取ABTest数据失败! 实验层Id不合法!","error"),void m(r,{});var n=d.growingIO.minipInstance,i=n.getStorageSync("".concat(d.getHashKey(e,t),"_gdp_abt_sign"))||0,o=n.getStorageSync("".concat(d.getHashKey(e,t),"_gdp_abtd"))||{};!i||i<Date.now()?d.initiateRequest(e,t,o,r):m(r,o)},this.initiateRequest=function(t,r,n,i){var o=d.growingIO,a=o.userStore,c=a.getUid,s=a.getSessionId,u=o.dataStore,g=o.minipInstance,l=u.getTrackerVds(t),f=l.projectId,y=l.dataSourceId;g.request({url:d.url[t],header:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",data:{accountId:f,datasourceId:y,distinctId:c(),layerId:r,newDevice:d.visitSids[t]===s(t)},timeout:d.requestTimeout,success:function(o){var a=o.data;0===a.code?d.experimentVerify(t,e(e({},a),{layerId:r}),n,i):(v("获取ABTest数据失败! ".concat(a.errorMsg,"!"),"error"),m(i,{})),g.setStorageSync("".concat(d.getHashKey(t,r),"_gdp_abt_sign"),Date.now()+6e4*d.requestInterval)},fail:function(e){var o=e.errMsg;o.indexOf("timeout")>-1?(v("获取ABTest数据失败! 请求超时!","error"),m(i,{})):2>d.retryCount?(d.initiateRequest(t,r,n,i),d.retryCount+=1):(v("获取ABTest数据失败! ".concat(JSON.stringify(o).slice(0,30),"!"),"error"),m(i,{}))}})},this.experimentVerify=function(t,r,n,i){var o=r.layerId,a=r.strategyId,s=r.experimentId,g=r.layerName,l=r.experimentName,f=r.strategyName,v=r.variables,y="".concat(d.getHashKey(t,o),"_gdp_abtd"),p={layerId:c(o),strategyId:c(a),experimentId:c(s),variables:v},h=e({},n);u(h,["layerName","strategyName","experimentName"]);var S=I(JSON.stringify(p)),b=I(JSON.stringify(h)),w=e(e({},p),{layerName:g,strategyName:f,experimentName:l});d.growingIO.minipInstance.setStorageSync(y,w,new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1).getTime()),S!==b&&a&&s&&d.buildExperimentHitEvent(t,w),m(i,w)},this.buildExperimentHitEvent=function(t,r){var n,i=d.growingIO.dataStore,o=i.eventContextBuilder,a=i.eventConverter,c=e({eventType:"CUSTOM",eventName:"$exp_hit"},o(t)),s=r.layerId,u=r.experimentId,g=r.strategyId,l=r.layerName,f=r.experimentName,v=r.strategyName;c.attributes=y(e(e({},null!==(n=c.attributes)&&void 0!==n?n:{}),{$exp_layer_id:s,$exp_id:u,$exp_strategy_id:g,$exp_layer_name:l,$exp_name:f,$exp_strategy_name:v})),a(c)},this.pluginVersion="4.
|
|
1
|
+
var e=function(){return e=Object.assign||function(e){for(var t,r=1,n=arguments.length;n>r;r++)for(var i in t=arguments[r])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var t=function(e){return["undefined","null"].includes(d(e))},r=function(e){return"string"===d(e)},n=function(e){return"NaN"===c(Number(e))},i=function(e){return"number"===d(e)},o=function(e){return"[object Object]"==={}.toString.call(e)&&!t(e)},a=function(e){return Array.isArray(e)&&"array"===d(e)},c=function(e){return t(e)?"":"".concat(e)},s=function(e){return o(e)?Object.keys(e):[]},u=function(e,t){if(!o(e))return!1;try{if("string"===d(t))return delete e[t];if("array"===d(t))return t.map(function(t){return delete e[t]});"object"===d(t)&&t.constructor===RegExp&&s(e).forEach(function(r){t.test(r)&&u(e,r)})}catch(e){return!1}},g=function(e){return a(e)?0===e.length:o(e)?0===s(e).length:!e},d=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},l=/^\d+_gdp_abt_sign$/,f=/^\d+_gdp_abtd$/,v=function(e,t){console.log("%c[GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444",warn:"color: #F59E0B",success:"color: #10B981"}[t]||"")},m=function(e,t){if(["function","asyncfunction"].includes(d(e)))try{e(t)}catch(e){v("回调执行失败!".concat(e),"error")}},y=function(e){var r={};return o(e)&&(u(e,"&&sendTo"),function(e){s(e).forEach(function(n){return function(e,n){var i=c(n).slice(0,100);o(e)?r[i]=y(e):a(e)?(r[i]=function(e,t){if(void 0===t&&(t=!1),a(e)){for(var r=0,n=[],i=0,o=e;i<o.length;i++){var c=o[i];c&&!g(c)&&(n[r++]=c),t&&0===c&&(n[r++]=c)}return n}return e}(e.slice(0,100),!0),r[i]=r[i].join("||").slice(0,1e3)):function(e){return"date"===d(e)}(e)?r[i]=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())}(e):r[i]=t(e)?"":c(e).slice(0,1e3)}(e[n],n)})}(e)),r},I=function(e,t){void 0===t&&(t=!1);var r=0;if(g(e)||"boolean"==typeof e)return r;for(var n=0;n<e.length;)r=(r<<5)-r+e.charCodeAt(n),r&=r,n++;return t?Math.abs(r):r},p={name:"gioABTest",method:function(t,a){var d=this;this.growingIO=t,this.timeoutCheck=function(e,t){d.requestInterval=i(Number(e))&&!n(Number(e))?Number(e):5,(d.requestInterval>1440||0>d.requestInterval)&&(d.requestInterval=5),d.requestTimeout=i(Number(t))&&!n(Number(t))?Number(t):1e3,(d.requestTimeout>5e3||100>d.requestTimeout)&&(d.requestTimeout=1e3)},this.abtStorageCheck=function(){var e,t=d.growingIO.minipInstance,r=(null===(e=t.minip)||void 0===e?void 0:e.getStorageInfoSync().keys)||[];r.filter(function(e){return l.test(e)}).forEach(function(e){var r=t.getStorageSync(e);r&&r>=Date.now()||t.removeStorageSync(e)}),r.filter(function(e){return f.test(e)}).forEach(function(e){g(t.getStorageSync(e))&&t.removeStorageSync(e)})},this.getHashKey=function(e,t){var r=d.growingIO,n=r.userStore.getUid,i=r.vdsConfig.projectId;return I("".concat(e,"#").concat(i,"#").concat(n(),"#").concat(t),!0)},this.generateUrl=function(e,t){var n,i;d.newDevice&&!d.visitSids[e]&&(d.visitSids[e]=d.growingIO.userStore.getSessionId(e)),i="http",r(n=t)||(n=c(n)),n.slice(0,4)!==i?d.url[e]="https://".concat(t,"/diversion/specified-layer-variables"):d.url[e]="".concat(t,"/diversion/specified-layer-variables")},this.getABTest=function(e,t,r){if(g(d.url[e])&&d.generateUrl(e,"https://ab.growingio.com"),!t)return v("获取ABTest数据失败! 实验层Id不合法!","error"),void m(r,{});var n=d.growingIO.minipInstance,i=n.getStorageSync("".concat(d.getHashKey(e,t),"_gdp_abt_sign"))||0,o=n.getStorageSync("".concat(d.getHashKey(e,t),"_gdp_abtd"))||{};!i||i<Date.now()?d.initiateRequest(e,t,o,r):m(r,o)},this.initiateRequest=function(t,r,n,i){var o=d.growingIO,a=o.userStore,c=a.getUid,s=a.getSessionId,u=o.dataStore,g=o.minipInstance,l=u.getTrackerVds(t),f=l.projectId,y=l.dataSourceId;g.request({url:d.url[t],header:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",data:{accountId:f,datasourceId:y,distinctId:c(),layerId:r,newDevice:d.visitSids[t]===s(t)},timeout:d.requestTimeout,success:function(o){var a=o.data;0===a.code?d.experimentVerify(t,e(e({},a),{layerId:r}),n,i):(v("获取ABTest数据失败! ".concat(a.errorMsg,"!"),"error"),m(i,{})),g.setStorageSync("".concat(d.getHashKey(t,r),"_gdp_abt_sign"),Date.now()+6e4*d.requestInterval)},fail:function(e){var o=e.errMsg;o.indexOf("timeout")>-1?(v("获取ABTest数据失败! 请求超时!","error"),m(i,{})):2>d.retryCount?(d.initiateRequest(t,r,n,i),d.retryCount+=1):(v("获取ABTest数据失败! ".concat(JSON.stringify(o).slice(0,30),"!"),"error"),m(i,{}))}})},this.experimentVerify=function(t,r,n,i){var o=r.layerId,a=r.strategyId,s=r.experimentId,g=r.layerName,l=r.experimentName,f=r.strategyName,v=r.variables,y="".concat(d.getHashKey(t,o),"_gdp_abtd"),p={layerId:c(o),strategyId:c(a),experimentId:c(s),variables:v},h=e({},n);u(h,["layerName","strategyName","experimentName"]);var S=I(JSON.stringify(p)),b=I(JSON.stringify(h)),w=e(e({},p),{layerName:g,strategyName:f,experimentName:l});d.growingIO.minipInstance.setStorageSync(y,w,new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1).getTime()),S!==b&&a&&s&&d.buildExperimentHitEvent(t,w),m(i,w)},this.buildExperimentHitEvent=function(t,r){var n,i=d.growingIO.dataStore,o=i.eventContextBuilder,a=i.eventConverter,c=e({eventType:"CUSTOM",eventName:"$exp_hit"},o(t)),s=r.layerId,u=r.experimentId,g=r.strategyId,l=r.layerName,f=r.experimentName,v=r.strategyName;c.attributes=y(e(e({},null!==(n=c.attributes)&&void 0!==n?n:{}),{$exp_layer_id:s,$exp_id:u,$exp_strategy_id:g,$exp_layer_name:l,$exp_name:f,$exp_strategy_name:v})),a(c)},this.pluginVersion="4.5.0";var p=null!=a?a:{},h=p.abServerUrl,S=void 0===h?"https://ab.growingio.com":h,b=p.requestInterval,w=p.requestTimeout;this.timeoutCheck(b,w);var _=this.growingIO,N=_.emitter,O=_.userStore;this.growingIO.getABTest=this.getABTest,this.visitSids={},N.on("OPTION_INITIALIZED",function(){g(S)?v("如果您需要使用ABTest功能,请配置服务地址 abServerUrl!","warn"):(d.abtStorageCheck(),d.url={},r(S)?d.generateUrl(d.growingIO.trackingId,S):o(S)&&s(S).forEach(function(e){d.generateUrl(e,S[e])}))}),N.on("UID_UPDATE",function(e){var t=e.newUId;if(!e.oldUId&&t)if(r(S)){var n=d.growingIO.trackingId,i=O.getSessionId(n);d.visitSids[n]=i}else o(S)&&s(S).forEach(function(e){var t=O.getSessionId(e);d.visitSids[e]=t})}),this.retryCount=0}};export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var r={name:"gioCompress",method:function(r){var o=this;this.growingIO=r,this.compressToUTF16=function(r){var e=o;return null===r?"":o._compress(r,15,function(r){return e.f(r+32)})+" "},this.pluginVersion="4.
|
|
1
|
+
var r={name:"gioCompress",method:function(r){var o=this;this.growingIO=r,this.compressToUTF16=function(r){var e=o;return null===r?"":o._compress(r,15,function(r){return e.f(r+32)})+" "},this.pluginVersion="4.5.0",this.f=String.fromCharCode,this._compress=function(r,o,e){if(null===r)return"";var s,h,t,f={},a={},p="",n="",i="",u=2,l=3,c=2,d=[],w=0,C=0;for(t=0;t<r.length;t+=1)if(p=r.charAt(t),{}.hasOwnProperty.call(f,p)||(f[p]=l++,a[p]=!0),n=i+p,{}.hasOwnProperty.call(f,n))i=n;else{if({}.hasOwnProperty.call(a,i)){if(256>i.charCodeAt(0)){for(s=0;c>s;s++)w<<=1,C===o-1?(C=0,d.push(e(w)),w=0):C++;for(h=i.charCodeAt(0),s=0;8>s;s++)w=w<<1|1&h,C===o-1?(C=0,d.push(e(w)),w=0):C++,h>>=1}else{for(h=1,s=0;c>s;s++)w=w<<1|h,C===o-1?(C=0,d.push(e(w)),w=0):C++,h=0;for(h=i.charCodeAt(0),s=0;16>s;s++)w=w<<1|1&h,C===o-1?(C=0,d.push(e(w)),w=0):C++,h>>=1}0===--u&&(u=Math.pow(2,c),c++),delete a[i]}else for(h=f[i],s=0;c>s;s++)w=w<<1|1&h,C===o-1?(C=0,d.push(e(w)),w=0):C++,h>>=1;0===--u&&(u=Math.pow(2,c),c++),f[n]=l++,i=p+""}if(""!==i){if({}.hasOwnProperty.call(a,i)){if(256>i.charCodeAt(0)){for(s=0;c>s;s++)w<<=1,C===o-1?(C=0,d.push(e(w)),w=0):C++;for(h=i.charCodeAt(0),s=0;8>s;s++)w=w<<1|1&h,C===o-1?(C=0,d.push(e(w)),w=0):C++,h>>=1}else{for(h=1,s=0;c>s;s++)w=w<<1|h,C===o-1?(C=0,d.push(e(w)),w=0):C++,h=0;for(h=i.charCodeAt(0),s=0;16>s;s++)w=w<<1|1&h,C===o-1?(C=0,d.push(e(w)),w=0):C++,h>>=1}0===--u&&(u=Math.pow(2,c),c++),delete a[i]}else for(h=f[i],s=0;c>s;s++)w=w<<1|1&h,C===o-1?(C=0,d.push(e(w)),w=0):C++,h>>=1;0===--u&&(u=Math.pow(2,c),c++)}for(h=2,s=0;c>s;s++)w=w<<1|1&h,C===o-1?(C=0,d.push(e(w)),w=0):C++,h>>=1;for(;;){if(w<<=1,C===o-1){d.push(e(w));break}C++}return d.join("")}}};export{r as default};
|