gio-miniprogram-sdk 4.6.0 → 4.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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/mpvue.js +1 -1
- package/dist/mpx.js +1 -1
- package/dist/plugins/gioABTest.js +1 -1
- package/dist/plugins/gioCompress.js +1 -1
- package/dist/plugins/gioEventAutoTracking.js +1 -1
- package/dist/plugins/gioImpressionTracking.js +1 -1
- package/dist/plugins/gioMultipleInstances.js +1 -1
- package/dist/plugins/gioPerformance.js +1 -1
- package/dist/qq.js +1 -1
- package/dist/quickapp.js +1 -1
- package/dist/taobao.js +1 -1
- package/dist/taro.js +1 -1
- package/dist/uniapp.js +1 -1
- package/dist/wechat.js +1 -1
- package/dist/xiaohongshu.js +1 -1
- package/package.json +2 -2
package/dist/mpx.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+n+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return n=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},n.apply(this,arguments)};function r(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 i=/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/,o=function(e){return["undefined","null"].includes(x(e))},a=function(e){return"string"===x(e)},u=function(e){return"number"===x(e)},s=function(e){return"boolean"===x(e)},c=function(e){return"[object Object]"==={}.toString.call(e)&&!o(e)},l=function(e){return["function","asyncfunction"].includes(x(e))},g=function(e){return Array.isArray(e)&&"array"===x(e)},d=function(e){return"date"===x(e)},f=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}},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,r=[],i=0,o=e;i<o.length;i++){var a=o[i];a&&!A(a)&&(r[n++]=a),t&&0===a&&(r[n++]=a)}return r}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"===x(e)?e.split(t):e},S=function(e){if(a(e)){var t=y(e,"");return"".concat(f(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)},k=function(e){return c(e)?Object.keys(e):[]},P=function(e,t){k(e).forEach(function(n){return t(e[n],n)})},T=function(e,t){var n=k(e);return!(!c(e)||!c(t)||n.length!==k(t).length||n.map(function(n,r){return c(e[n])?T(e[n],t[n]):e[n]===t[n]}).includes(!1))},b=function(e,t,n){var r=e;return c(e)?(t.split(".").forEach(function(e){r=r?r[e]:n}),r):n},E=function(e,t){if(!c(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&&k(e).forEach(function(n){t.test(n)&&E(e,n)})}catch(e){return!1}},C=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))}},A=function(e){return g(e)?0===e.length:c(e)?0===k(e).length:!e},x=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:f,last:p,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(f(t).toUpperCase()).concat(v(t).join(""))}return e},startsWith:w,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:_,has:O,keys:k,forEach:P,isEqual:T,get:b,unset:E,throttle:C,isEmpty:A,typeOf:x,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]||"")},L=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),U("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},H=function(e){try{return e()}catch(e){return}},D=function(e,t){if(l(e))try{e(t)}catch(e){U("回调执行失败!".concat(e),"error")}},B=function(e){return a(e)?e.trim().substring(0,100):e},K=function(e,t){return a(e)&&!A(e)&&e.match(i)?t():(U("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},F=function(e){return o(e)||k(e).forEach(function(t){l(e[t])?e[t]=H(function(){return e[t]()}):c(e[t])?E(e,t):g(e[t])||(e[t]=I(e[t]))}),e},j=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},R=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,"")},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},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 H(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=H(function(){return xhs})),t||(t=H(function(){return swan})),t||(t=H(function(){return my})),t||(t=H(function(){return tt})),t||(t=H(function(){return qq})),t||(t=H(function(){return ks})),t||(t=H(function(){return jd})),t||(t=H(function(){return wx})),t}})},W=function(e){return H(function(){switch(e){case"wx":return __wxConfig;case"swan":return appConfig;case"tt":return H(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 H(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&&H(function(){return xhs})&&(e="xhs"),!e&&H(function(){return swan})&&(e="swan"),!e&&H(function(){return tt})&&(e="tt"),!e&&H(function(){return qq})&&(e="qq"),!e&&H(function(){return my.tb})&&(e="tb"),!e&&H(function(){return my})&&(e="my"),!e&&H(function(){return ks})&&(e="ks"),!e&&H(function(){return jd})&&(e="jd"),!e&&H(function(){return wx})&&(e="wx"),e||m(k(global),function(e){return I(e).toLowerCase().includes("quickapp")})&&(e="quickapp"),e},Z=function(){var e;return null!==(e=H(function(){var e;return null!==(e=H(function(){var e;return null!==(e=H(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"),P(e,function(e,n){var r=I(n).slice(0,100);c(e)?t[r]=X(e):g(e)?(t[r]=h(e.slice(0,100),!0),t[r]=t[r].join("||").slice(0,1e3)):d(e)?t[r]=q(e):t[r]=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,r=t.value;return e.setStorageSync(n,r)})};try{return e.minip.canIUse("batchSetStorageSync")?e.minip.batchSetStorageSync(t):n()}catch(e){return n()}},ne=function(e){return k(e||{}).map(function(t){return t?"".concat(t,"=").concat(o(e[t])?"":e[t]):""}).join("&")},re=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},ie=["wxShoppingListScene","$taroTimestamp","gdpCircleRoomCollectUrl"],oe=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n="string"==typeof e?re(e):e||{};function r(e,t){if("object"!=typeof e||null===e||Array.isArray(e))return e;var r={};return k(e).forEach(function(i){var o=ie.some(function(e){return i.includes(e)}),a=O(n,i);if(!(o||t&&a)){var u=e[i];"string"==typeof u?ie.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))},ae=Object.freeze({__proto__:null,consoleText:U,callError:L,niceTry:H,niceCallback:D,limitString:B,eventNameValidate:K,getDynamicAttributes:F,guid:j,getScreenHeight:R,getScreenWidth:M,getOS:V,compareVersion:G,getVueVersion:function(e){if(e){var t=Number(f(y(e.version,".")));return Number.isNaN(t)?0:t}return 0},splitPath:Q,normalizePath:function(e){var t=Q(e)[0];return((null==t?void 0:t.replace(/^\/+/,""))||"").replace(/\.html$/,"")},normalPath:$,getSafeDuration:function(e,t,n){if("number"==typeof e)return"number"!=typeof t||t>e?"number"!=typeof n||n>e?0:e-n:e-t},isTaro3:function(e){var t=e.Current,n=e.createComponent;return!(!e||!t||n)},getPlainMinip:z,getPlainConfig:W,getPlainAppCode:J,getPlainPlatform:Y,getSubKeys:function(e){return k(e).filter(function(e){return e.indexOf("__sub")>-1&&e.indexOf("gio__")>-1}).sort()},getAppInst:function(){var e=H(function(){return getApp({allowDefault:!0})});return e||(e=Z()),e},getGlobal:Z,limitObject:X,batchGetStorageSync:ee,batchSetStorageSync:te,qsStringify:ne,qsParse:re,hashCode:function(e,t){void 0===t&&(t=!1);var n=0;if(A(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 a(e)?null!==(t=H(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},mpvue:{type:["object","function"],default:!1},mpx:{type:["module","function"],default:!1},tbConfig:{type:"object",default:{cloud:void 0,cloudFuncSend:!1,cloudFuncName:"httpTunnel",cloudFuncHandler:"main",cloudAppId:void 0,path:void 0}},trackPage:{type:"boolean",default:!0},uniVue:{type:["object","function"],default:!1},uploadInterval:{type:"number",default:1e3},version:{type:"string",default:"1.0.0"}},ce=["clearGeneralProps","clearPageAttributes","clearLocation","clearTrackTimer","clearUserId","getABTest","getGioInfo","getOption","identify","removeTimer","sendPage","sendVisit","setGeneralProps","setLocation","setOption","setPageAttributes","setUserAttributes","setUserId","track","trackTimerEnd","trackTimerPause","trackTimerResume","trackTimerStart"],le=r(r(["init","registerPlugins"],["getPlugins","getDeviceId","updateImpression"],!0),ce,!0),ge={autotrack:"无埋点",dataCollect:"数据采集",debug:"调试模式",serverUrl:"数据上报服务地址",ignoreFields:"忽略上报字段"},de=["enableDebug","setAutotrack","setDataCollect","setTrackerHost","setTrackerScheme","setConfig","collectImp","setPlatformProfile","getLocation"],fe=["deviceBrand","deviceModel","deviceType","networkState","screenHeight","screenWidth","operatingSystem"],pe=r(r([],fe,!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",ke="OPTION_CHANGE",Pe="OPTION_INITIALIZED",Te="SDK_INITIALIZED",be="SESSIONID_UPDATE",Ee=function(e){var t=this;this.growingIO=e,this.main=function(e,r,i){var o;void 0===i&&(i=!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,f=d.scene,p=d.eventHooks.currentPage,v=d.generalProps,h=g.getTrackerVds(e),m=h.version,I=h.dataSourceId,y=h.appId,S=h.idMapping,w=h.ignoreFields,_=g.locationData[e],O=c.systemInfo,k=void 0===O?{}:O,P=c.network,T=void 0===P?{}:P,b=k.brand,C=k.model,x=k.platform,q=k.language,N=p.getPagePath(),U={appChannel:"scn:".concat(f||"NA"),appVersion:m,dataSourceId:I,deviceBrand:b,deviceId:l.getUid(),deviceModel:C,deviceType:V(x,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(x,s.name),path:N,platform:s.platform,platformVersion:s.name+(k.version?" ".concat(k.version):""),query:N?p.getPageQuery():"",screenHeight:R(k),screenWidth:M(k),sdkVersion:u,sessionId:l.getSessionId(e),title:p.getPageTitle(),timestamp:Date.now(),timezoneOffset:(new Date).getTimezoneOffset(),userId:l.getUserId(e)};return S&&(U.userKey=l.getUserKey(e)),i&&!A(v[e])&&(U.attributes=n({},v[e])),A(U.attributes)||(U.attributes=X(F(n({},U.attributes)))),A(w)||w.forEach(function(e){E(U,e)}),A(r)?n(n({},U),{trackingId:e}):n(n(n({},U),r),{trackingId:e})}},Ce=function(e){var t=this;this.growingIO=e,this.enterParams={},this.main=function(e,r){var i,o,a=Date.now(),u=t.growingIO,s=u.emitter,c=u.userStore,l=u.vdsConfig,g=u.platformConfig,d=u.uploader,f=u.dataStore,p=u.minipInstance,v=u.dataStore,h=v.trackersExecute,m=v.shareOut,I=v.lastCloseTime,y=v.saveStorageInfo,S=v.setOriginalSource;s.emit(he,{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(ye,{event:"App ".concat(e),params:null!==(o=r[0])&&void 0!==o?o:{}}),e){case w.appLaunch:t.enterParams=n({},r[0]);break;case w.appCreate:case w.appShow:var _=t.enterParamsParse(r[0]),O=_.path,k=_.query,P=_.referralPage;!m&&l.originalSource&&O&&h(function(e){S(e,{path:O,query:k,referralPage:P})}),I?(Date.now()-I>60*l.keepAlive*1e3||f.lastScene&&f.scene!==f.lastScene)&&h(function(e){c.setSessionId(e)}):h(function(e){f.lastVisitEvent[e]={path:O,query:k,referralPage:P},t.buildVisitEvent(e,{path:O,query:k,referralPage:P})}),p.setNetworkStatusListener();break;case w.appClose:f.lastScene=f.scene,f.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 r=t.growingIO,i=r.gioPlatform,o=r.minipInstance,a=r.dataStore,u="",s="",c="";if("quickapp"!==i&&o.minip.canIUse("getEnterOptionsSync")){var l=o.minip.getEnterOptionsSync()||{},g=l.path,d=l.query,f=l.scene,p=l.referrerInfo||l.refererInfo;u=g||e.path,s=d||e.query,c=(null==p?void 0:p.appId)||(null===(n=null==e?void 0:e.referrerInfo)||void 0===n?void 0:n.appId)||"",a.scene=f||e.scene,E(d,"gdpCircleRoomCollectUrl"),s=ne(oe(s,(null==p?void 0:p.extraData)||{}))}else g=e.path,d=e.query,p=e.referrerInfo,u=g,s=ne(d),c=(null==p?void 0:p.appId)||"",t.parseScene(e);return{path:u,query:s,referralPage:c}},this.parseScene=function(e){var n,r,i=t.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 A(e)||((null===(n=null==e?void 0:e.query)||void 0===n?void 0:n.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=t.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=n({eventType:"VISIT"},u(e,{}));!A(r)&&r.path&&(d.path=r.path||"",d.query="string"===x(g)?g:ne(g),r.referralPage&&(d.referralPage=r.referralPage)),c.originalSource&&!A(l)&&(d=n(n({},d),l)),s(d)},this.buildCloseEvent=function(e){var r=t.growingIO.dataStore,i=r.eventContextBuilder;(0,r.eventInterceptor)(n({eventType:"APP_CLOSED"},i(e)))}},Ae=function(){function e(e){var t=this;this.growingIO=e,this.lifeBeforeShow=!0,this.getPagePath=function(){var e,n,r,i=t.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===(n=u.lastPageEvent[s])||void 0===n?void 0:n.path)||(null===(r=u.lastVisitEvent[s])||void 0===r?void 0:r.path)},this.getPageQuery=function(){var e,n,r,i,o,a,u=t.growingIO,s=u.minipInstance,c=u.dataStore,l=u.trackingId,g=s.getCurrentPage(),d=s.getCurrentPath(),f=c.eventHooks.appEffects.enterParams,p=void 0===f?{}:f;if(!d)return p.path?ne(oe(null==p?void 0:p.query,null===(r=null==p?void 0:p.referrerInfo)||void 0===r?void 0:r.extraData)):(null===(i=c.lastPageEvent[l])||void 0===i?void 0:i.path)?null===(o=c.lastPageEvent[l])||void 0===o?void 0:o.query:null===(a=c.lastVisitEvent[l])||void 0===a?void 0:a.query;var v=null!==(e=g.options)&&void 0!==e?e:g.$taroParams;return A(v)?A(t.queryOptions[d])?d===p.path?ne(oe(null==p?void 0:p.query,null===(n=null==p?void 0:p.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,r=n.minipInstance,i=n.inPlugin,o=n.dataStore,a=r.getCurrentPath(),u=t.configuredTitle[a]||r.getPageTitle(r.getCurrentPage());if(i){var s=o.getTrackerVds(e||t.growingIO.trackingId);return u||"/插件".concat(s.appId).concat(a?"_"+p(a.split("/")):"")}return u},this.getReferralPage=function(e){var n,r,i,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===(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,n){void 0===n&&(n=!0);var r=t.buildShareQuery(e),i=r[0],o=r[1];return(n||O(e,"path"))&&(e.path=$(i+(o?"?".concat(o):""))),(n||O(e,"query"))&&(e.query=o),e},this.eventSetPageProps=function(e,r){var i=H(function(){return t.pageProps[e][t.getPagePath()]});return A(i)?r.attributes:X(F(n(n({},r.attributes),i)))},this.queryOptions={},this.configuredTitle={},this.pageProps={}}return e.prototype.buildShareQuery=function(e){var t,r,i=Q(null!==(t=e.path)&&void 0!==t?t:""),o=e.path||this.getPagePath(),a={},u=O(e,"path");if(O(e,"query"))a=re(null!==(r=e.query)&&void 0!==r?r:"")||{};else if(u)a=re(p(i))||{};else{var s=this.growingIO.minipInstance.getCurrentPage();a=n({},s.options||this.queryOptions[s.route]||{}),h(k(a)).forEach(function(e){e.toLowerCase().startsWith("utm_")&&E(a,e)})}return[o,ne(a)]},e}(),xe=function(e){var t=this;this.growingIO=e,this.getPrevEventBucket=function(e){if(!e||"object"!=typeof e)return null;var n=t.prevEventByPage.get(e);if(n)return n;var r={};return t.prevEventByPage.set(e,r),r},this.setPrevEventTime=function(e,n,r){var i,o=t.getPrevEventBucket(e);if(o)o[n]=r;else{var a=(null==e?void 0:e.route)||(null==e?void 0:e.uri)||(null==e?void 0:e.__route__)||(null===(i=null==e?void 0:e.$page)||void 0===i?void 0:i.fullPath)||"";t.prevEvent["".concat(n,":").concat(a)]=r}},this.main=function(e,r,i){var o,a,u=Date.now(),s=t.growingIO,c=s.emitter,g=s.minipInstance,d=s.plugins,f=s.vdsConfig,p=s.platformConfig,v=s.dataStore,h=v.getTrackerVds,m=v.getOriginalSource,I=v.setOriginalSource,y=v.trackersExecute,S=v.eventHooks,w=v.toggleShareOut,_=v.buildAppMessageEvent,O=v.buildTimelineEvent,k=v.buildAddFavorites,P=S.currentPage;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="".concat(r,":").concat(T),x=t.getPrevEventBucket(e),q=x?x[r]:t.prevEvent[C];if(q&&50>u-Number(q))return!1;c.emit(he,{event:"Page ".concat(r),timestamp:u,params:{page:e,args:i[0]}}),f.debug&&console.log("Page:",T,"#",r,u),t.setPrevEventTime(e,r,u);var N=p.listeners.page;switch(c.emit(ye,{page:e,event:"Page ".concat(r),params:{page:e,args:i[0]}}),P.lastLifecycle=P.currentLifecycle,P.currentLifecycle=r,r){case N.pageLoad:P.queryOptions[T]=b(e,"options")||b(e,"__displayReporter.query")||b(e,"$page.query")||b(e,"$wx.__displayReporter.query")||b(e,"$taroParams")||i[0]||{},E(P.queryOptions[T],["$taroTimestamp","gdpCircleRoomCollectUrl"]);break;case N.pageShow:y(function(e){var r=m(e);A(r)||r.path!==T||I(e,n(n({},r),{title:P.getPageTitle()})),h(e).trackPage&&t.buildPageEvent(e)}),w(!1);break;case N.pageHide:case N.pageUnload:break;case N.shareChat:case N.shareApp:w(!0),y(function(e){h(e).followShare&&_(e,i)});break;case N.shareTime:"xhsp"===g.platform&&w(!0),y(function(e){h(e).followShare&&O(e,i)});break;case N.addFavorites:y(function(e){h(e).followShare&&k(e,i)});break;case N.tabTap:var U=null===(a=null==d?void 0:d.gioEventAutoTracking)||void 0===a?void 0:a.buildTabClickEvent;f.autotrack&&U&&l(U)&&U(t.growingIO.trackingId,i[0])}return P.lastLifecycle=P.currentLifecycle,P.currentLifecycle="".concat(r,"End"),["onHideEnd","onUnloadEnd"].includes(P.currentLifecycle)&&(P.lifeBeforeShow=!0),"onShowEnd"===P.currentLifecycle&&(P.lifeBeforeShow=!1),!0},this.buildPageEvent=function(e,r){var i=t.growingIO.dataStore,o=i.eventContextBuilder,a=i.eventInterceptor,u=i.eventHooks.currentPage,s=n({eventType:"PAGE",referralPage:u.getReferralPage(e)},o(e));s.attributes=u.eventSetPageProps(e,s),!A(r)&&r.title&&(s.title=r.title),a(s)},this.prevEvent={},this.prevEventByPage=new WeakMap},qe=function(e){var t,r=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(r["".concat(t,"Handlers")])&&r["".concat(t,"Handlers")].forEach(function(t){l(e[t])||["onShareAppMessage","onShareTimeline"].includes(t)||(e[t]=function(){})})},this.lifeFcEffectsFn=function(e,t,n,i,o){void 0===o&&(o=void 0);var a=r.getLifeArgs(t,o);return r.runLifeEffects(e,a,n,i),r.emitLifeEnd(e,a,n,i),o},this.getLifeArgs=function(e,t){void 0===t&&(t=void 0);var n="array"===x(e)?[].slice.call(e):[];return A(t)||n.push(t),n},this.runLifeEffects=function(e,t,n,i){return r["def".concat(n,"Cbs")][i].apply(e,t)},this.emitLifeEnd=function(e,t,n,i){r.growingIO.emitter.emit(he,{event:"".concat(n," ").concat(i,"End"),timestamp:Date.now(),params:{instance:e,arguments:Array.from(t)}})},this.lifeFcEffects=function(e,t,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=t.apply(this,c))&&void 0!==r?r:{};if(!o.growingIO.vdsConfig.followShare)return g;var d="promise"===x(g),f="promise"===x(g.promise),p=O(g,"_result")&&O(g,"_state");if(d||f||p){var v=function(t){void 0===t&&(t={});try{var r=n(n({},g),t),a=o.currentPage.updateShareResult(r);o.lifeFcEffectsFn(s,c,i,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")}),f&&Promise.race([g.promise,new Promise(function(e){setTimeout(function(){e({})},3e3)})]).then(v).catch(function(e){return U(e,"error")}),p&&(null===(a=o.growingIO.minipInstance)||void 0===a||a.handleSharePromise(g,v)),u=o.currentPage.updateShareResult(g,!1)}else u=o.currentPage.updateShareResult(g),o.lifeFcEffectsFn(this,c,i,e,u)}else{var h=o.getLifeArgs(c);o.runLifeEffects(this,h,i,e),u=t.apply(this,c),o.emitLifeEnd(this,h,i,e)}return u}},this.customFcEffects=function(e,t){var n=r;return function(){for(var r,i,o=[],a=0;arguments.length>a;a++)o[a]=arguments[a];if(n.growingIO.vdsConfig.autotrack&&n.growingIO.plugins.gioEventAutoTracking)try{var u=o[0]||{};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===(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){U(e,"error")}return t.apply(this,o)}},this.appApplyProxy=function(e,t){return r.appHandlers.includes(e)?r.lifeFcEffects(e,t,"App"):r.customFcEffects(e,t)},this.pageApplyProxy=function(e,t){return r.pageHandlers.includes(e)?r.lifeFcEffects(e,t,"Page"):r.customFcEffects(e,t)},this.appOverriding=function(e){return r.setAppEffectCbs(),r.supLifeFcs(e,"app"),r.objectTraverse(e,function(e,t){r.isNormalFc(e,t[e])&&(t[e]=r.appApplyProxy(e,t[e]))}),e},this.pageOverriding=function(e){return r.setPageEffectCbs(),r.supLifeFcs(e,"page"),r.objectTraverse(e,function(e,t){r.isNormalFc(e,t[e])&&(t[e]=r.pageApplyProxy(e,t[e]))}),e},this.componentOverriding=function(e){return r.setPageEffectCbs(),e.methods||(e.methods={}),r.supLifeFcs(r.growingIO.inPlugin?e:e.methods,"page"),r.objectTraverse(r.growingIO.inPlugin?e:e.methods,function(e,t){r.isNormalFc(e,t[e])&&(t[e]=r.pageApplyProxy(e,t[e]))}),e},this.setAppEffectCbs=function(){var e=r;r.appHandlers.forEach(function(t){r.defAppCbs[t]=function(){for(var n=[],r=0;arguments.length>r;r++)n[r]=arguments[r];return e.appEffects.main(t,n)}})},this.setPageEffectCbs=function(){var e=r;r.pageHandlers.forEach(function(t){r.defPageCbs[t]=function(){for(var n=[],r=0;arguments.length>r;r++)n[r]=arguments[r];return e.pageEffects.main(this,t,n)}})},this.growingApp=function(e){return l(r.originalApp)?r.originalApp(r.appOverriding(e)):r.appOverriding(e)},this.growingPage=function(e){return l(r.originalPage)?r.originalPage(r.pageOverriding(e)):r.pageOverriding(e)},this.growingComponent=function(e){return l(r.originalComponent)?r.originalComponent(r.componentOverriding(e)):r.componentOverriding(e)},this.growingBehavior=function(e){return l(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=H(function(){return App||global.App}),r.originalPage=H(function(){return Page||global.Page}),r.originalComponent=H(function(){return Component||global.Component}),r.originalBehavior=H(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(),Z().GioApp=H(function(){return null!==App&&void 0!==App?App:r.originalApp}),Z().GioPage=H(function(){return null!==Page&&void 0!==Page?Page:r.originalPage}),Z().GioComponent=H(function(){return null!==Component&&void 0!==Component?Component:r.originalComponent}),Z().GioBehavior=H(function(){return null!==Behavior&&void 0!==Behavior?Behavior:r.originalBehavior})):"quickapp"===i&&(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 i=null===(t=this.growingIO)||void 0===t?void 0:t.platformConfig;this.defAppCbs={},this.defPageCbs={},this.appHandlers=i.appHandlers,this.pageHandlers=i.pageHandlers,this.shareEventTypes=i.shareEventTypes,this.actionEventTypes=i.actionEventTypes,this.appEffects=new Ce(this.growingIO),this.pageEffects=new xe(this.growingIO),this.currentPage=new Ae(this.growingIO)},Ne=function(){function e(e){var t,i,o=this;this.growingIO=e,this.ALLOW_SETTING_KEYS=k(se),this.getStorageKey=function(e,t){var n=o.growingIO.inPlugin;return"".concat(e===o.growingIO.trackingId?"":e).concat(ve[n?"plugin_"+t:t])},this.getGsid=function(e){var t=Number(o._gsid[e]);return Number.isNaN(t)||t>=1e9||1>t?(o.setGsid(e,1),1):t},this.setGsid=function(e,t){var n=Number(t);(Number.isNaN(n)||n>=1e9||1>n)&&(n=1),o._gsid[e]=n,10>o._gsid[e]-o._stid[e]||o.saveStorageInfo()},this.initStorageInfo=function(e){var t=o.growingIO.minipInstance,n=t.getStorageSync(o.getStorageKey(e,"gsid")),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=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=H(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,r,i,a=o.growingIO,u=a.platformConfig,s=a.inPlugin,c=a.minipInstance,l=a.plugins,g=e.uniVue,d=e.taro,f=e.mpx,p=e.mpvue;g||d||p||"quickapp"===c.platform||(u.canHook=!0),!s||["tbp","jdp"].includes(c.platform)?o.eventHooks.initEventHooks():o.eventHooks.initOriginalValue();try{g&&(null===(t=null==l?void 0:l.gioUniAppAdapter)||void 0===t||t.main()),d&&(null===(n=null==l?void 0:l.gioTaroAdapter)||void 0===n||n.main()),p&&(null===(r=null==l?void 0:l.gioMpvueAdapter)||void 0===r||r.main()),f&&(null===(i=null==l?void 0:l.gioMpxAdapter)||void 0===i||i.main())}catch(e){U(e,"error")}},this.initOptions=function(e){var t,r,i,a,u,s,c=e.projectId,l=e.dataSourceId,d=e.appId,f=e.trackingId,p={};return o.ALLOW_SETTING_KEYS.forEach(function(t){var n=se[t].type;(g(n)?n.includes(x(e[t])):x(e[t])===se[t].type)?"ignoreFields"===t?p.ignoreFields=e.ignoreFields.filter(function(e){return fe.includes(e)}):"extraParams"===t?p.extraParams=e.extraParams.filter(function(e){return pe.includes(e)}):(p[t]=e[t],["dataCollect","autotrack"].includes(t)&&!p[t]&&U("已关闭".concat(ge[t]),"info")):p[t]=se[t].default}),p.uploadInterval=Math.round(p.uploadInterval),(Number.isNaN(p.uploadInterval)||0>p.uploadInterval||p.uploadInterval>3e3)&&(p.uploadInterval=1e3),p.enableIdMapping&&!p.idMapping&&(p.idMapping=!0),p.idMapping||o.growingIO.userStore.setUserKey(f,""),E(p,"enableIdMapping"),p.pluginMode&&(o.growingIO.inPlugin=!0),!isNaN(Number(p.requestTimeout))&&p.requestTimeout>0||(p.requestTimeout=5e3),(0>p.impressionScale||p.impressionScale>1)&&(p.impressionScale=0),(0>p.keepAlive||p.keepAlive>1440)&&(p.keepAlive=5),(1>p.sessionExpires||p.sessionExpires>1440)&&(p.sessionExpires=-1),n(n({},p),{projectId:c,dataSourceId:l,appId:d,trackingId:f,performance:{monitor:null===(r=null===(t=p.performance)||void 0===t?void 0:t.monitor)||void 0===r||r,exception:null===(a=null===(i=p.performance)||void 0===i?void 0:i.exception)||void 0===a||a,network:null!==(s=null===(u=p.performance)||void 0===u?void 0:u.network)&&void 0!==s&&s}})},this.setOption=function(e,t,r){var i,a=o.growingIO,u=a.userStore,s=a.emitter,c=o.getTrackerVds(e),l=n({},c);return"ignoreFields"===t&&(r=r.filter(function(e){return fe.includes(e)})),o.updateVdsConfig(e,n(n({},c),((i={})[t]=r,i))),"dataCollect"===t&&l.dataCollect!==r&&r&&u.setSessionId(e),s.emit(ke,{optionName:t,optionValue:r}),!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]:A(t)?n:void L("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,r=t.dataStore,i=t.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=f(e))&&void 0!==n?n:{};P(r,function(e,t){A(e)&&0!==e||(a[t]=e)})}else A(e)&&0!==e||(a[t]=e)}),o.growingIO.emitter.emit(Ie,{composedEvent:a}),i.commitRequest(n(n({},a),{requestId:j()}))}},this.eventRefactor=function(e){var t,r,i=n(n({},e),o.eventContextBuilder(e.trackingId,{path:e.path,query:e.query,timestamp:e.timestamp}));return i.attributes=n(n({},null!==(t=i.attributes)&&void 0!==t?t:{}),null!==(r=e.attributes)&&void 0!==r?r:{}),i},this.eventInterceptor=function(e){var t=o.growingIO.minipInstance,n=t.systemInfo,i=t.network;A(n)||A(i)?o.interceptEvents.push(e):A(o.interceptEvents)?o.eventConverter(e):(r(r([],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&&!A(o.interceptEvents)&&(r([],o.interceptEvents,!0).forEach(function(e){o.eventConverter(o.eventRefactor(e))}),o.interceptEvents=[])},this.buildAppMessageEvent=function(e,t){var r,i,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!==(r=d.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:f(g),$share_query:g[1]}),null==a?void 0:a.attributes)),l(d)},this.buildTimelineEvent=function(e,t){var r,i,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!==(r=d.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:f(g),$share_query:g[1]}),null==a?void 0:a.attributes)),l(d)},this.buildAddFavorites=function(e,t){var r,i,a=t[0];2>t.length?1===t.length&&(i=a):i=t[1];var u=o.growingIO.dataStore,s=u.eventContextBuilder,c=u.eventInterceptor,l=((null==i?void 0:i.path)||"").split("?"),g=n({eventType:"CUSTOM",eventName:"$mp_add_favorites"},s(e));g.attributes=X(n(n({},null!==(r=g.attributes)&&void 0!==r?r:{}),{$share_title:null==i?void 0:i.title,$share_path:f(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 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];P(t,function(e){e.start&&(e.leng=e.leng+(+Date.now()-e.start))})})}),l(null===(i=c.minip)||void 0===i?void 0:i.onAppShow)&&c.minip.onAppShow(function(){o.trackersExecute(function(e){var t=o.trackTimers[e];P(t,function(e){e.start&&(e.start=+Date.now())})})}),u.on(ke,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 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}(),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"]}}},Le=n(n({},Ue),{pageHandlers:r(r([],Ue.pageHandlers,!0),["onShareChat","onCopyUrl","onShareAppMessage","onShareTimeline"],!1),shareEventTypes:r(r([],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_"}),He=n(n({},Ue),{listeners:n({},Ue.listeners),name:"JingDong",platform:"jdp",scnPrefix:"jd_"}),De=n(n({},Ue),{listeners:n({},Ue.listeners),name:"KuaiShou",platform:"kuaishoup",scnPrefix:"ks_"}),Be=n(n({},Ue),{listeners:n({},Ue.listeners),name:"Alipay",platform:"alip",scnPrefix:"alip_",shareEventTypes:["onShareAppMessage"],hooks:n(n({},Ue.hooks),{Behavior:!1})}),Ke=n(n({},Ue),{listeners:n({},Ue.listeners),name:"QQ",platform:"qq",scnPrefix:"qq_"});Ke.pageHandlers=r(r([],Ue.pageHandlers,!0),["onAddToFavorites"],!1),Ke.listeners.page.addFavorites="onAddToFavorites";var Fe=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_"}),Re=n(n({},Ue),{listeners:n({},Ue.listeners),name:"Weixin",platform:"MinP"});Re.pageHandlers=r(r([],Ue.pageHandlers,!0),["onShareTimeline","onAddToFavorites"],!1),Re.listeners.page=n(n({},Ue.listeners.page),{shareTime:"onShareTimeline",addFavorites:"onAddToFavorites"});var Me=Y(),Ve=n(n({},Ue),{name:"UnsupportedFrameworkPlatform",canHook:!1,supported:!1,hooks:{App:!1,Page:!1,Component:!1,Behavior:!1}}),Ge=H(function(){var e={xhs:Le,jd:He,ks:De,my:Be,qq:Ke,swan:Fe,tt:je,wx:Re}[Me];return e?n(n({},e),{canHook:!1}):Ve})||Ve,Qe=function(e){var t=this;this.growingIO=e,this.minip=z("framework"),this.loadMetadata=function(e,n){new Promise(function(e,t){var r=setTimeout(function(){return e(void 0)},3e3);Promise.resolve(H(n)).then(function(t){clearTimeout(r),e(t)},function(e){clearTimeout(r),t(e)})}).then(function(n){var r;A(t[e])&&(t[e]=A(n)?{__gioFailed:!0}:n),null===(r=t.growingIO.dataStore)||void 0===r||r.eventReleaseInspector()},function(){var n;t[e]={__gioFailed:!0},null===(n=t.growingIO.dataStore)||void 0===n||n.eventReleaseInspector()})},this.hookSetTitle=function(){var e,n=null===(e=t.minip)||void 0===e?void 0:e.setNavigationBarTitle,r=t;n&&Object.defineProperty(t.minip,"setNavigationBarTitle",{writable:!0,enumerable:!0,configurable:!0,value:function(){if(r.growingIO.gioSDKInitialized){var e=r.getCurrentPath(),t=(arguments[0]||{}).title;r.growingIO.dataStore.eventHooks.currentPage.configuredTitle[e]=t}return n.apply(this,arguments)}})},this.initImpression=function(e){var n,r;null===(r=null===(n=t.growingIO.plugins)||void 0===n?void 0:n.gioImpressionTracking)||void 0===r||r.main(e,"observeAll")},this.getCurrentPage=function(){return H(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,o,u,s,c,l,d=Y(),f="",p=W(d);"string"===x(p)&&(p=null!==(n=H(function(){return JSON.parse(p)}))&&void 0!==n?n:{});var v,h=(null==e?void 0:e.data)||e.$data||{};if((f=a(null==h?void 0:h.gioPageTitle)?null==h?void 0:h.gioPageTitle:"")||H(function(){var t,n,r=J(d);r&&(v=r["".concat(e.route,".json")]||{},f=(null==v?void 0:v.navigationBarTitleText)||(null===(n=null===(t=null==v?void 0:v.mod)||void 0===t?void 0:t.exports)||void 0===n?void 0:n.navigationBarTitleText))}),!f&&p){var m=t.growingIO.dataStore.eventHooks.appEffects.enterParams;if(e.route||A(m)||(e.route=m.path||"",f=e.route?t._getTitleFromTabBar(p,e.route):""),!f&&(v=g(p.pages)?null!==(r=p.pages.find(function(t){return t.path===e.route}))&&void 0!==r?r:{}:p.page||{})){var I=v[e.route]||v["".concat(e.route,".html")]||v;f=(null==I?void 0:I.navigationBarTitleText)||(null===(i=null==I?void 0:I.window)||void 0===i?void 0:i.navigationBarTitleText)}f||(f=t._getTitleFromTabBar(p,e.route))}return f||(f=["wx","tt"].includes(d)?null===(s=null===(u=null===(o=p||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=p||global||$global)||void 0===c?void 0:c.window)||void 0===l?void 0:l.navigationBarTitleText),B(f)},this._getTitleFromTabBar=function(e,t){var n,r,i=null===(r=null===(n=null==e?void 0:e.tabBar)||void 0===n?void 0:n.list)||void 0===r?void 0:r.find(function(e){return e.pagePath===t||e.pagePath==="".concat(t,".html")});return(null==i?void 0:i.text)||""},this.getStorageSync=function(e){var n,r=null===(n=t.minip)||void 0===n?void 0:n.getStorageSync(e);return c(r)&&r.expiredAt?r.expiredAt<Date.now()?"":r.value:r},this.setStorageSync=function(e,n,r){var i;r&&(n={value:n,expiredAt:r}),null===(i=t.minip)||void 0===i||i.setStorageSync(e,n)},this.setStorage=function(e,n){var r;null===(r=t.minip)||void 0===r||r.setStorage({key:e,data:n})},this.removeStorageSync=function(e){var n;null===(n=t.minip)||void 0===n||n.removeStorageSync(e)},this.getNetworkType=function(){var e=t;return new Promise(function(n){var r;null===(r=t.minip)||void 0===r||r.getNetworkType({success:function(t){e.network=t,n(t)},fail:function(){e.network={__gioFailed:!0},n(e.network)}})})},this.request=function(e){var n,r=e.url,i=e.data,o=e.header,a=e.timeout,u=e.method,s=e.success,c=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:c,complete:g}),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},this.getSystemInfo=function(){var e=t;return new Promise(function(n){var r;null===(r=t.minip)||void 0===r||r.getSystemInfo({success:function(t){e.systemInfo=t,n(t)},fail:function(){e.systemInfo={__gioFailed:!0},n(e.systemInfo)}})})},this.setNetworkStatusListener=function(){var e;null===(e=t.minip)||void 0===e||e.onNetworkStatusChange(function(e){var n=e.networkType;n&&(t.network&&c(t.network)||(t.network={}),t.network.networkType=n)})};var n=this.growingIO.platformConfig,r=n.platform,i=n.scnPrefix;this.platform=r,this.scnPrefix=i,this.growingIO.emitter.on(Pe,function(){t.loadMetadata("network",function(){return t.getNetworkType()}),t.loadMetadata("systemInfo",function(){return t.getSystemInfo()})})},$e=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.initImpression=function(e){var t,r;null===(r=null===(t=n.growingIO.plugins)||void 0===t?void 0:t.gioImpressionTracking)||void 0===r||r.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,r=n;t&&Object.defineProperty(n.minip,"setNavigationBar",{writable:!0,enumerable:!0,configurable:!0,value:function(){if(r.growingIO.gioSDKInitialized){var e=r.getCurrentPath(),n=(arguments[0]||{}).title;r.growingIO.dataStore.eventHooks.currentPage.configuredTitle[e]=n}return t.apply(this,arguments)}})},n.initImpression=function(e){var t,r;null===(r=null===(t=n.growingIO.plugins)||void 0===t?void 0:t.gioImpressionTracking)||void 0===r||r.main(e,"selectAll")},n.getStorageSync=function(e){return my.getStorageSync({key:e}).data},n.setStorageSync=function(e,t){var r;null===(r=n.minip)||void 0===r||r.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,r=e.url,i=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:r,data:i,headers:o,timeout:a,method:u,success:s,fail:c,complete:g}),f=n.minip.SDKVersion;if(G(f,"2.0.0")>=0)var 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},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,r;null===(r=null===(t=n.growingIO.plugins)||void 0===t?void 0:t.gioImpressionTracking)||void 0===r||r.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 r(t){var r=e.call(this,t)||this;return r.growingIO=t,r.getSystemInfo=function(){return e=r,t=void 0,o=function(){var e,t,r,i=this;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}(this,function(o){switch(o.label){case 0:return e=n(n(n({},H(function(){var e,t;return null===(t=null===(e=i.minip)||void 0===e?void 0:e.getDeviceInfo)||void 0===t?void 0:t.call(e)})||{}),H(function(){var e,t;return null===(t=null===(e=i.minip)||void 0===e?void 0:e.getWindowInfo)||void 0===t?void 0:t.call(e)})||{}),H(function(){var e,t;return null===(t=null===(e=i.minip)||void 0===e?void 0:e.getAppBaseInfo)||void 0===t?void 0:t.call(e)})||{}),t=H(function(){var e,t;return null===(t=null===(e=i.minip)||void 0===e?void 0:e.getSystemInfoSync)||void 0===t?void 0:t.call(e)})||{},r=n(n({},t),e),A(r)?[4,new Promise(function(e){var t,n={__gioFailed:!0};if(!(null===(t=i.minip)||void 0===t?void 0:t.getSystemInfo))return i.systemInfo=n,void e(n);try{i.minip.getSystemInfo({success:function(t){i.systemInfo=A(t)?n:t,e(i.systemInfo)},fail:function(){i.systemInfo=n,e(n)}})}catch(t){i.systemInfo=n,e(n)}})]:(this.systemInfo=r,[2,r]);case 1:return[2,o.sent()]}})},new((i=void 0)||(i=Promise))(function(n,r){function a(e){try{s(o.next(e))}catch(e){r(e)}}function u(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,u)}s((o=o.apply(e,t||[])).next())});var e,t,i,o},r.hookSetTitle(),r}return t(r,e),r}(Qe),nt=Y(),rt={wx:et,swan:Ze,my:Je,qq:Ye,tt:Xe,ks:We,jd:ze,xhs:$e},it=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n}(Qe),ot=rt[nt]||it,at=["gioPerformance"],ut=null,st={name:"GioMpxAdapter",method:function(e){var t,n=this;this.growingIO=e,this.actionEventTypes=[],this.customFcEffects=function(e,t){var r=n;return function(){for(var n,i,o,a,u=[],s=0;arguments.length>s;s++)u[s]=arguments[s];if(r.growingIO.vdsConfig.autotrack&&r.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))&&r.actionEventTypes.includes(c.type)){l(r.actionEffects)||(r.actionEffects=(null===(i=null===(n=r.growingIO.plugins)||void 0===n?void 0:n.gioEventAutoTracking)||void 0===i?void 0:i.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==r||r.actionEffects(c,d)}}catch(e){U(e,"error")}return t.apply(this,u)}},this.main=function(){var e=n.growingIO,t=e.dataStore,r=e.vdsConfig;n.mpx=r.mpx,t.eventHooks.customFcEffects=n.customFcEffects,ut=t.eventHooks,n.setupAppLifecycleHook()},this.runAppLifecycle=function(e,t,n){var r,i;null===(r=null==ut?void 0:ut.appEffects)||void 0===r||r.main(t,n),null===(i=null==ut?void 0:ut.emitLifeEnd)||void 0===i||i.call(ut,e,n,"App",t)},this.setupAppLifecycleHook=function(){if(n.mpx){var e=n.mpx.injectMixins;if("function"==typeof e){var t=n.growingIO.dataStore,r=n,i={onLaunch:function(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t];r.runAppLifecycle(this,"onLaunch",e)},onShow:function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];t.lastCloseTime&&t.shareOut&&t.toggleShareOut(!1),r.runAppLifecycle(this,"onShow",e)},onHide:function(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t];r.runAppLifecycle(this,"onHide",e)}};e(i,{types:"app"})}}},this.pluginVersion="__PLUGIN_VERSION__";var r=this.growingIO.dataStore;this.actionEventTypes=(null===(t=null==r?void 0:r.eventHooks)||void 0===t?void 0:t.actionEventTypes)||[]}},ct=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.pluginsContext={plugins:{gioMpxAdapter:st}},n}return t(n,e),n}(function(e){var t,n,i,o,a,u,s=this;this.growingIO=e,this.innerPluginInit=function(){var e;at.forEach(function(e){var t;return E(null===(t=s.pluginsContext)||void 0===t?void 0:t.plugins,e)}),k(null===(e=s.pluginsContext)||void 0===e?void 0:e.plugins).forEach(function(e){var t,n,r=null!==(n=null===(t=s.pluginsContext)||void 0===t?void 0:t.plugins[e])&&void 0!==n?n:{},i=r.name,o=r.method;m(s.pluginItems,function(e){return e.name===i})||s.pluginItems.push({name:S(i||e),method:o||function(e){}})}),A(s.pluginItems)||s.installAll()},this.install=function(e,t,n){var r,i,o=s.growingIO.emitter,a=t||m(s.pluginItems,function(t){return t.name===e});if((null===(r=s.growingIO)||void 0===r?void 0:r.plugins)[e])return U("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return U("插件加载失败!不存在名为 ".concat(e," 的插件!"),"error"),!1;try{return(null===(i=s.growingIO)||void 0===i?void 0:i.plugins)[e]=new a.method(s.growingIO,n),t&&(o.emit(we,e),U("加载插件 ".concat(e),"info")),!0}catch(n){return s.lifeError(t,n),U("插件【".concat(e,"】加载异常 ").concat(n),"error"),!1}},this.installAll=function(e){(e||s.pluginItems).forEach(function(t){s.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!m(s.pluginItems,function(e){return e.name===t.name})&&s.pluginItems.push({name:S(t.name),method:t.method?t.method:function(){}})})},this.uninstall=function(e){var t,n=s.pluginItems.findIndex(function(t){return t.name===e});n>-1&&s.pluginItems.splice(n,1);var r=E(null===(t=s.growingIO)||void 0===t?void 0:t.plugins,e);return r||U("卸载插件 ".concat(e," 失败!"),"error"),r},this.uninstallAll=function(){r([],s.pluginItems,!0).forEach(function(e){return s.uninstall(e.name)})},this.lifeError=function(e,t){if(!s.handlingError){s.handlingError=!0;try{s.growingIO.emitter.emit(Se,{plugin:e,error:t})}finally{s.handlingError=!1}}U("插件执行错误 ".concat((null==e?void 0:e.name)||"unknown"," ").concat(t),"error")},this.callLifeCycle=function(e,t){s.pluginItems.forEach(function(n){var r=s.growingIO.plugins[n.name]?s.growingIO.plugins[n.name][e]:void 0;if(r&&l(r))try{r(t)}catch(e){s.lifeError(n,e)}})},this.pluginsContext={plugins:{}},this.pluginItems=[],this.handlingError=!1,null===(t=this.growingIO.emitter)||void 0===t||t.on(we,function(e){return s.callLifeCycle("onInstall",e)}),null===(n=this.growingIO.emitter)||void 0===n||n.on(Se,function(e){return s.callLifeCycle("onError",e)}),null===(i=this.growingIO.emitter)||void 0===i||i.on(ye,function(e){return s.callLifeCycle("onComposeBefore",e)}),null===(o=this.growingIO.emitter)||void 0===o||o.on(Ie,function(e){return s.callLifeCycle("onComposeAfter",e)}),null===(a=this.growingIO.emitter)||void 0===a||a.on(Oe,function(e){return s.callLifeCycle("onSendBefore",e)}),null===(u=this.growingIO.emitter)||void 0===u||u.on(_e,function(e){return s.callLifeCycle("onSendAfter",e)})}),lt={},gt={}.hasOwnProperty;function dt(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function ft(e){try{return encodeURIComponent(e)}catch(e){return null}}lt.stringify=function(e,t){t=t||"";var n,r,i=[];for(r in"string"!=typeof t&&(t="?"),e)if(gt.call(e,r)){if((n=e[r])||null!=n&&!isNaN(n)||(n=""),r=ft(r),n=ft(n),null===r||null===n)continue;i.push(r+"="+n)}return i.length?t+i.join("&"):""},lt.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,r={};t=n.exec(e);){var i=dt(t[1]),o=dt(t[2]);null===i||null===o||i in r||(r[i]=o)}return r};var pt=function(e){var t=this;this.growingIO=e,this.generateURL=function(e){var n=t.growingIO.dataStore.getTrackerVds(e),r=n.serverUrl,i=n.projectId;return w(r,"http")?"".concat(r,"/v3/projects/").concat(i,"/collect"):"https://".concat(r,"/v3/projects/").concat(i,"/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 r,i,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===(r=t.hoardingQueue[e.trackingId])||void 0===r||r.push(a)):(o(t.requestQueue[e.trackingId])&&(t.requestQueue[e.trackingId]=[]),null===(i=t.requestQueue[e.trackingId])||void 0===i||i.push(a),t.initiateRequest(e.trackingId))},this.initiateRequest=function(e,n){var i=t.growingIO,o=i.plugins,a=i.vdsConfig,u=i.minipInstance,s=i.dataStore,c=t.getHoardingQueue(e),l=t.getRequestQueue(e),g=r(r([],c,!0),l,!0),d=function(e){var r,i;if(null===(r=null==a?void 0:a.tbConfig)||void 0===r?void 0:r.cloudFuncSend)null===(i=null==o?void 0:o.gioTaobaoAdapter)||void 0===i||i.singleInvoke(e);else if(n)t.batchInvoke(e);else{var c=t.growingIO.dataStore.getTrackerVds(e).uploadInterval;t.getThrottledBatchInvoke(e,c)(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 f=setInterval(function(){t.requestingNum<t.requestLimit&&(d(e),clearInterval(f),f=void 0)},500)},this.getThrottledBatchInvoke=function(e,n){var r=t.throttledBatchInvoke[e];return r&&r.uploadInterval===n||(t.throttledBatchInvoke[e]={uploadInterval:n,invoke:C(function(e){return t.batchInvoke(e)},n,!1,!1)}),t.throttledBatchInvoke[e].invoke},this.getHttpCode=function(e){var t,n;return Number(null!==(n=null!==(t=null==e?void 0:e.statusCode)&&void 0!==t?t:null==e?void 0:e.status)&&void 0!==n?n:null==e?void 0:e.code)},this.batchInvoke=function(e){var i=t.growingIO,o=i.vdsConfig,a=i.emitter,u=t.getHoardingQueue(e),s=t.getRequestQueue(e),c=r(r([],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(!A(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 i,o=f(e).trackingId,a=t.growingIO,u=a.minipInstance,s=a.dataStore,c=a.emitter,l=a.plugins,g=s.getTrackerVds(o),d=g.compress,p=g.requestTimeout;t.requestingNum+=1;var v=function(r){e.forEach(function(e){t.requestFailFn(e)}),U("请求失败!".concat(JSON.stringify(r)),"error"),c.emit("ON_SEND_ERROR",{eventsQueue:e,requestData:n,trackingId:o})},h={"content-type":"jdp"===u.platform?"application/json":"application/json;charset=UTF-8"},m=r([],n,!0),I=!!d&&(null===(i=null==l?void 0:l.gioCompress)||void 0===i?void 0:i.compressToUTF16);I&&(m=l.gioCompress.compressToUTF16(JSON.stringify(n)),h["X-Compress-Codec"]="1");var y=t.generateURL(o);u.request({url:"".concat(y,"?stm=").concat(Date.now(),"&compress=").concat(I?"1":"0"),header:h,method:"POST",data:m,timeout:p,success:function(e){[200,204].includes(t.getHttpCode(e))||v(e)},fail:function(e){v(e)},complete:function(e){t.requestingNum-=1,c.emit(_e,{result:e,requestData:n,trackingId:o}),t.initiateRequest(o)}})},this.requestFailFn=function(e){var n;if(t.retryIds[e.requestId]||(t.retryIds[e.requestId]=0),t.retryIds[e.requestId]+=1,!(null!==(n=t.requestQueue[e.trackingId])&&void 0!==n?n:t.requestQueue[e.trackingId]=[]).some(function(t){return t.requestId===e.requestId}))var r=setTimeout(function(){var n,i=null!==(n=t.requestQueue[e.trackingId])&&void 0!==n?n:t.requestQueue[e.trackingId]=[];if(i.some(function(t){return t.requestId===e.requestId}))return clearTimeout(r),void(r=null);A(i)?(i.push(e),t.initiateRequest(e.trackingId)):i.push(e),clearTimeout(r),r=null},800)},this.hoardingQueue={},this.requestQueue={},this.requestLimit=3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.throttledBatchInvoke={},this.growingIO.emitter.on(Oe,function(e){var n,r,i=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===(r=null==c?void 0:c.gioTaobaoAdapter)||void 0===r||r.tbCloudAppInvoke(i,o):t.sendEvent(i,o))})},vt=function(e){var t=this;this.growingIO=e,this._getUidKey=function(){return t.growingIO.inPlugin?"_growing_plugin_uid_":"_growing_uid_"},this.getUid=function(){var e=t.growingIO.minipInstance;return"quickapp"===t.growingIO.gioPlatform&&!1===e.identityReady?"":(t._uid||(t._uid=e.getStorageSync(t._getUidKey())),t._uid||t.setUid(j()),t._uid)},this.setUid=function(e){var n=t._uid;t._uid=e,n!==t._uid&&(t.growingIO.minipInstance.setStorage(t._getUidKey(),t._uid),t.growingIO.emitter.emit("UID_UPDATE",{newUId:e,oldUId:n}))},this.getSessionId=function(e){var n=t.growingIO,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=j()),t._sessionId[e]=n;var i=t.growingIO.vdsConfig.sessionExpires;i>-1&&(t._sessionExpires=Date.now()+6e4*i),r!==n&&t.growingIO.emitter.emit(be,{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]=o(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]=o(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]=o(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=ee(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){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},ht=new function(){var e,t=this;this.init=function(e){var n,r;t.emitter.emit("ON_SDK_INITIALIZE_BEFORE",{options:e});try{if(U("Gio小程序SDK 初始化中...","info"),!1===(null===(n=t.platformConfig)||void 0===n?void 0:n.supported))throw Error("当前 ".concat(t.gioFramework," SDK 不支持 ").concat(t.gioPlatform||"未知"," 平台,已停止初始化!"));if(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===(r=t.emitter)||void 0===r||r.emit(Pe,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,i){var o=t.dataStore,a=o.initializedTrackingIds;if((0,o.getTrackerVds)(e)&&a.includes(e))return t[n].apply(t,r([e],i,!1));U("不存在实例:".concat(e,",请检查!"),"warn")},this.registerPlugins=function(e){t.plugins.pluginItems=r(r([],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,r){var i;return k(ge).includes(n)?x(r)===(null===(i=se[n])||void 0===i?void 0:i.type)?(t.dataStore.setOption(e,n,r),U("已修改".concat(ge[n],": ").concat(r),"info"),!0):(U("参数格式不正确:".concat(r,",请检查后重试!"),"error"),!1):(U("不存在可修改的配置项:".concat(n,",请检查后重试!"),"error"),!1)},this.setPageAttributes=function(e,n){if(c(n)&&!A(n)){var r=t.dataStore.eventHooks.currentPage,i=r.getPagePath();return A(r.pageProps[e])&&(r.pageProps[e]={}),A(r.pageProps[e][i])&&(r.pageProps[e][i]={}),A(n)||P(n,function(t,n){l(r.pageProps[e][i][n])&&!l(t)||(r.pageProps[e][i][n]=t)}),!0}return L("setPageAttributes"),!1},this.clearPageAttributes=function(e,n){try{if(!A(t.dataStore.eventHooks.currentPage.pageProps[e])){var r=t.dataStore.eventHooks.currentPage,i=r.getPagePath();g(n)&&!A(n)?n.forEach(function(t){E(r.pageProps[e][i],t)}):r.pageProps[e][i]={}}}catch(e){return L("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 L("identify");var r=I(n).slice(0,1e3);t.userStore.setUid(r),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=r}),t.uploader.initiateRequest(e,!0)})}else t._identified?L("identify",!1,"请勿重复调用"):L("identify",!1,"forceLogin未开启");else L("identify",!1,"子实例不允许调用identify")},this.setUserAttributes=function(e,r){var i,o,a,u;if(c(r)&&!A(r)){var s=t.dataStore,l=s.eventContextBuilder,g=s.eventInterceptor,d=s.lastVisitEvent,f=n({eventType:"LOGIN_USER_ATTRIBUTES"},l(e));f.attributes=X(n(n({},null!==(i=f.attributes)&&void 0!==i?i:{}),F(r))),f.path||(f.path=null===(o=d[e])||void 0===o?void 0:o.path,f.query=null===(a=d[e])||void 0===a?void 0:a.query,f.title=null===(u=d[e])||void 0===u?void 0:u.title),g(f)}else L("setUserAttributes")},this.setUserId=function(e,n,r){if(ue(n)){var i=t.userStore.getGioId(e);n=I(n).slice(0,1e3),r=I(r).slice(0,1e3),t.userStore.setUserId(e,n);var a=!o(r)&&I(r).length>0?I(r).slice(0,1e3):"";!t.dataStore.getTrackerVds(e).idMapping&&a&&(U("您设置了 userKey ,请初始化开启 idMapping!","warn"),a=""),t.userStore.setUserKey(e,a),i&&i!==n&&t.userStore.setSessionId(e)}else L("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)&&!A(n)?(A(t.dataStore.generalProps[e])&&(t.dataStore.generalProps[e]={}),P(n,function(n,r){l(t.dataStore.generalProps[e][r])&&!l(n)||(t.dataStore.generalProps[e][r]=n)}),!0):(L("setGeneralProps"),!1)},this.clearGeneralProps=function(e,n){try{A(t.dataStore.generalProps[e])||(g(n)&&!A(n)?n.forEach(function(n){E(t.dataStore.generalProps[e],n)}):t.dataStore.generalProps[e]={})}catch(e){return L("clearGeneralProps"),!1}},this.track=function(e,r,i){K(r,function(){var o,a=t.dataStore,u=a.eventContextBuilder,s=a.eventInterceptor,l=n({eventType:"CUSTOM",eventName:r},u(e));l.attributes=X(n(n({},null!==(o=l.attributes)&&void 0!==o?o:{}),F(n({},c(i)&&!A(i)?i:{})))),t.plugins.gioMultipleInstances&&i&&i["&&sendTo"]&&(l["&&sendTo"]=i["&&sendTo"]),s(l)})},this.trackTimerStart=function(e,n){return t.dataStore.getTrackerVds(e).dataCollect?K(n,function(){var r=j();return t.dataStore.trackTimers[e]||(t.dataStore.trackTimers[e]={}),t.dataStore.trackTimers[e][r]={ended:!1,eventName:n,leng:0,start:+Date.now()},r}):(U("指定实例未开启数据采集,请检查!","error"),!1)},this.trackTimerPause=function(e,n){var r=t.dataStore.trackTimers[e];if(n&&r&&r[n]){var i=r[n];return!i.ended&&(i.start&&(i.leng=i.leng+(+Date.now()-i.start)),i.start=0,!0)}return!1},this.trackTimerResume=function(e,n){var r=t.dataStore.trackTimers[e];if(n&&r&&r[n]){var i=r[n];return!i.ended&&(0===i.start&&(i.start=+Date.now()),!0)}return!1},this.trackTimerEnd=function(e,r,i){var o,a=t.dataStore.getTrackerVds(e).dataCollect,u=t.dataStore.trackTimers[e];if(r&&u&&u[r]){var s=u[r];if(s.ended)return U("指定计时器已结束,请勿重复调用!","warn"),!1;if(a){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,f=g.eventInterceptor,p=n({eventType:"CUSTOM",eventName:s.eventName},d(e));return p.attributes=X(n(n({},null!==(o=p.attributes)&&void 0!==o?o:{}),F(n(n({},c(i)&&!A(i)?i:{}),{event_duration:s.leng>864e5?0:s.leng/1e3})))),t.plugins.gioMultipleInstances&&i&&i["&&sendTo"]&&(p["&&sendTo"]=i["&&sendTo"]),f(p),s.ended=!0,s.start=0,!0}return U("指定实例未开启数据采集,计时器已停止,请检查!","error"),s.ended=!0,s.start=0,!1}return U("未查询到指定计时器,请检查!","error"),!1},this.removeTimer=function(e,n){var r=t.dataStore.trackTimers[e];return n&&r&&r[n]?(delete r[n],!0):(U("未查询到指定计时器,请检查!","error"),!1)},this.clearTrackTimer=function(e){t.dataStore.trackTimers[e]={}},this.setLocation=function(e,n,r){A(t.dataStore.locationData[e])&&(t.dataStore.locationData[e]={});var i,o=t.dataStore.locationData[e];-90>(i=n)||i>90||!function(e){return e>=-180&&180>=e}(r)||o.latitude===n&&o.longitude===r||(t.dataStore.locationData[e]={latitude:n,longitude:r})},this.clearLocation=function(e){t.dataStore.locationData[e]={}},this.updateImpression=function(){U("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.getABTest=function(e,t,n){U("获取ABTest数据错误! 请集成ABTest插件后重试!","error"),D(n,{})},this.getGioInfo=function(e){var n,r,i=t.userStore,o=i.getUid,a=i.getUserId,u=i.getUserKey,s=i.getSessionId,c=t.dataStore.getTrackerVds(e),l=c.projectId,g=c.appId,d=c.dataSourceId,f=c.dataCollect,p=c.idMapping,v=c.extraParams,h=c.ignoreFields,m={gioappid:g,giocs1:a(e)||"",gioplatform:t.platformConfig.platform,gioprojectid:l,gios:s(e),giou:o()};if(m.giodatacollect=f,m.giodatasourceid=d,p&&(m.giouserkey=u(e)),A(v)||v.forEach(function(n){var r;h.includes(n)||(m["gio".concat(n)]=(null!==(r=t.dataStore.lastVisitEvent[e])&&void 0!==r?r:{})[n])}),e===t.trackingId){var I=null!==(r=null===(n=t.plugins)||void 0===n?void 0:n.gioEventAutoTracking)&&void 0!==r?r:{},y=I.circleServerUrl,S=I.circleOpen;if(y&&S){var w=re(y.split("?")[1]);w.roomId&&(m.giocircleroomid=w.roomId)}}return lt.stringify(m)},this.utils=n(n(n({},N),ae),{qs:lt}),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=Y(),this.gioFramework="mpx",this.sdkVersion="4.6.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 ot(this),this.dataStore=new Ne(this),this.userStore=new vt(this),this.uploader=new pt(this),this.plugins=new ct(this),this.plugins.innerPluginInit()},mt=function(){var e,t=arguments[0],r="g0",i=t;if(a(t)&&t.indexOf(".")>-1&&(r=null!==(e=t.split(".")[0])&&void 0!==e?e:"g0",i=t.split(".")[1]),a(i)&&le.includes(i)&&ht[i]){var o=v(Array.from(arguments));if("init"===i){var u=function(e,t){var n=I(t[0]),r=I(t[1]),i=a(t[2])?t[2].trim():t[2],o=ue(i)?I(i):"",u=t[3]||{};return n&&r&&o?e.dataStore.initializedTrackingIds.some(function(t,i){var o=0===i?e.vdsConfig:e.subInstance[t];return o.projectId===n&&o.dataSourceId===r})?(U("SDK初始化失败,重复初始化,请检查初始化参数!","error"),!1):{projectId:n,dataSourceId:r,appId:o,userOptions:u}:(U('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", "您的小程序 AppId", options: { serverUrl: "您的数据上报地址" }); 进行初始化!',"error"),!1)}(ht,o);if(u){var s=u.projectId,c=u.dataSourceId,l=u.appId,g=u.userOptions;return ht.init(n(n({},g),{projectId:s,dataSourceId:c,appId:l,trackingId:r}))}return!1}if("registerPlugins"===i)ht.registerPlugins(o[0]);else{if(ht.gioSDKInitialized&&ht.vdsConfig)return ce.includes(i)?H(function(){return ht.handlerDistribute(r,i,o)}):H(function(){return ht[i].apply(ht,o)});U("SDK未初始化!","error")}}else if(de.includes(i))U("方法 ".concat(I(i)," 已被弃用,请移除!"),"warn");else{if("canIUse"===i)return le.includes(arguments[1])&&!!ht[arguments[1]];U("不存在名为 ".concat(I(i)," 的方法调用!"),"error")}};Z().gdp=mt,Z().gioSDKVersion=ht.sdkVersion;var It=ht.dataStore.eventHooks,yt=It.growingApp,St=It.growingPage,wt=It.growingComponent,_t=It.growingBehavior;(0,It.initOriginalValue)();var Ot=H(function(){return null!=yt?yt:App}),kt=H(function(){return null!=St?St:Page}),Pt=H(function(){return null!=wt?wt:Component}),Tt=H(function(){return null!=_t?_t:Behavior});export{Ot as GioApp,Tt as GioBehavior,Pt as GioComponent,kt as GioPage,mt as default};
|
|
1
|
+
var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+n+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;i>n;n++)for(var r in t=arguments[n])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function i(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var r=/^[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)},f=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}},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},I=function(e,t){if(g(e)){var n=e.findIndex(t);return 0>n?void 0:e[n]}},m=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(f(t).toLowerCase()).concat(v(t).join(""))}return e},w=function(e,t){return a(e)||(e=m(e)),e.slice(0,t.length)===t},k={}.hasOwnProperty,O=function(e,t){return null!=e&&("object"==typeof e||"function"==typeof e)&&k.call(e,t)},P=function(e){return c(e)?Object.keys(e):[]},_=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"===m(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"!==m(Number(e))?Number(Number(e).toFixed(u(t)?t:2)):e},head:f,last:p,drop:v,dropWhile:function(e,t){return g(e)?e.filter(function(e){return!t(e)}):e},compact:h,find:I,isEqualArray:function(e,t){return!(!g(e)||!g(t)||e.length!==t.length)&&e.every(function(e,n){return e===t[n]})},toString:m,split:y,lowerFirst:S,upperFirst:function(e){if(a(e)){var t=y(e,"");return"".concat(f(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:k,has:O,keys:P,forEach:_,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]||"")},D=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),U("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},L=function(e){try{return e()}catch(e){return}},H=function(e,t){if(l(e))try{e(t)}catch(e){U("回调执行失败!".concat(e),"error")}},F=function(e){return a(e)?e.trim().substring(0,100):e},B=function(e,t){return a(e)&&!x(e)&&e.match(r)?t():(U("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},K=function(e){return o(e)||P(e).forEach(function(t){l(e[t])?e[t]=L(function(){return e[t]()}):c(e[t])?E(e,t):g(e[t])||(e[t]=m(e[t]))}),e},j=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},R=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){if(a(e)){var t=e.indexOf("?");return-1!==t?[e.substring(0,t),e.substring(t+1)]:[e,""]}return["",""]},Q=function(e){return a(e)?e.startsWith("/")?e:"/".concat(e):""},z=function(e){return L(function(){switch(e){case"wx":return wx;case"my":case"tb":return my;case"swan":return swan;case"tt":return tt;case"qq":return qq;case"ks":return ks;case"jd":return jd;case"xhs":return xhs;default:var t=void 0;return t||(t=L(function(){return xhs})),t||(t=L(function(){return swan})),t||(t=L(function(){return my})),t||(t=L(function(){return tt})),t||(t=L(function(){return qq})),t||(t=L(function(){return ks})),t||(t=L(function(){return jd})),t||(t=L(function(){return wx})),t}})},$=function(e){return L(function(){switch(e){case"wx":return __wxConfig;case"swan":return appConfig;case"tt":return L(function(){return __ttConfig})||(null===global||void 0===global?void 0:global.TMAConfig)||(null===globalThis||void 0===globalThis?void 0:globalThis.TMAConfig);case"qq":return __qqConfig;case"ks":return __ksConfig;case"jd":return __jdConfig;case"xhs":return null!==__MP_APP_JSON_MIGRATION__&&void 0!==__MP_APP_JSON_MIGRATION__?__MP_APP_JSON_MIGRATION__:__MP_APP_JSON__;default:return}})},W=function(e){return L(function(){switch(e){case"wx":case"qq":return __wxAppCode__;case"tt":return __allConfig__;case"ks":return __module__;case"jd":return __jdAppCode__;default:return}})},J=function(){var e;return!e&&L(function(){return xhs})&&(e="xhs"),!e&&L(function(){return swan})&&(e="swan"),!e&&L(function(){return tt})&&(e="tt"),!e&&L(function(){return qq})&&(e="qq"),!e&&L(function(){return my.tb})&&(e="tb"),!e&&L(function(){return my})&&(e="my"),!e&&L(function(){return ks})&&(e="ks"),!e&&L(function(){return jd})&&(e="jd"),!e&&L(function(){return wx})&&(e="wx"),e||I(P(global),function(e){return m(e).toLowerCase().includes("quickapp")})&&(e="quickapp"),e},Y=function(){var e;return null!==(e=L(function(){var e;return null!==(e=L(function(){var e;return null!==(e=L(function(){return $global}))&&void 0!==e?e:global}))&&void 0!==e?e:window}))&&void 0!==e?e:globalThis},Z=function(e){var t={};return c(e)&&(E(e,"&&sendTo"),_(e,function(e,n){var i=m(n).slice(0,100);c(e)?t[i]=Z(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)?"":m(e).slice(0,1e3)})),t},X=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()}},ee=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()}},te=function(e){return P(e||{}).map(function(t){return t?"".concat(t,"=").concat(o(e[t])?"":e[t]):""}).join("&")},ne=function(e){(w(e,"?")||w(e,"&"))&&(e=e.slice(1,e.length));var t={};return e.split("&").forEach(function(e){var n=e.indexOf("="),i=0>n?e:e.slice(0,n);i&&(t[i]=0>n?void 0:e.slice(n+1))}),t},ie=function(e){var t;return a(e)?null!==(t=L(function(){return JSON.parse(e)}))&&void 0!==t?t:{}:null!=e?e:{}},re=["wxShoppingListScene","$taroTimestamp","gdpCircleRoomCollectUrl"],oe=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n="string"==typeof e?ne(e):e||{};function i(e,t){if("object"!=typeof e||null===e||Array.isArray(e))return{};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(ie(t),!0))},ae=Object.freeze({__proto__:null,consoleText:U,callError:D,niceTry:L,niceCallback:H,limitString:F,eventNameValidate:B,getDynamicAttributes:K,guid:j,getScreenHeight:R,getScreenWidth:M,getOS:V,compareVersion:function(e,t){void 0===e&&(e=""),void 0===t&&(t="");for(var n=function(e){return e.replace(/\s+/g,"")},i=function(e){return e.replace(/[vV]/g,"")},r=n(i(e)),o=n(i(t)),a=r.split("."),u=o.split("."),s=0;3>s;s++){var c=Number(a[s]),l=Number(u[s]);if(c>l)return 1;if(l>c)return-1;if(!isNaN(c)&&isNaN(l))return 1;if(isNaN(c)&&!isNaN(l))return-1}return 0},getVueVersion:function(e){if(e){var t=Number(f(y(e.version,".")));return Number.isNaN(t)?0:t}return 0},splitPath:G,normalizePath:function(e){var t=G(e)[0];return((null==t?void 0:t.replace(/^\/+/,""))||"").replace(/\.html$/,"")},normalPath:Q,getSafeDuration:function(e,t,n){if("number"==typeof e)return"number"!=typeof t||t>e?"number"!=typeof n||n>e?0:e-n:e-t},isTaro3:function(e){var t=e.Current,n=e.createComponent;return!(!e||!t||n)},getPlainMinip:z,getPlainConfig:$,getPlainAppCode:W,getPlainPlatform:J,getSubKeys:function(e){return P(e).filter(function(e){return e.indexOf("__sub")>-1&&e.indexOf("gio__")>-1}).sort()},getAppInst:function(){var e=L(function(){return getApp({allowDefault:!0})});return e||(e=Y()),e},getGlobal:Y,limitObject:Z,batchGetStorageSync:X,batchSetStorageSync:ee,qsStringify:te,qsParse:ne,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:ie,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},mpvue:{type:["object","function"],default:!1},mpx:{type:["module","function"],default:!1},tbConfig:{type:"object",default:{cloud:void 0,cloudFuncSend:!1,cloudFuncName:"httpTunnel",cloudFuncHandler:"main",cloudAppId:void 0,path:void 0}},trackPage:{type:"boolean",default:!0},uniVue:{type:["object","function"],default:!1},uploadInterval:{type:"number",default:1e3},version:{type:"string",default:"1.0.0"}},ce=["clearGeneralProps","clearPageAttributes","clearLocation","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"],fe=["deviceBrand","deviceModel","deviceType","networkState","screenHeight","screenWidth","operatingSystem"],pe=i(i([],fe,!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=function(e,t,n){var i,r,o,a=function(e,i){void 0===i&&(i=!1);try{i?e(t,n):e(n)}catch(e){L(function(){return U("事件监听器执行失败 ".concat(t,": ").concat(e),"error")})}};(null===(i=null==e?void 0:e.all)||void 0===i?void 0:i.get)?(null===(r=e.all.get(t))||void 0===r||r.slice().forEach(function(e){return a(e)}),null===(o=e.all.get("*"))||void 0===o||o.slice().forEach(function(e){return a(e,!0)})):a(function(n){return null==e?void 0:e.emit(t,n)})},Ie="MINIP_LIFECYCLE",me="ON_COMPOSE_AFTER",ye="ON_COMPOSE_BEFORE",Se="ON_ERROR",we="ON_INSTALL",ke="ON_SEND_AFTER",Oe="ON_SEND_BEFORE",Pe="ON_SEND_ERROR",_e="OPTION_CHANGE",Te="OPTION_INITIALIZED",be="SESSIONID_UPDATE",Ee="UID_UPDATE",Ce=function(e){var t=this;this.growingIO=e,this.main=function(e,i,r,o){var a;void 0===r&&(r=!0),e||(e=t.growingIO.trackingId);var u=t.growingIO,s=u.sdkVersion,c=u.platformConfig,l=u.minipInstance,g=u.userStore,d=u.dataStore,f=u.dataStore,p=f.scene,v=f.eventHooks.currentPage,h=f.generalProps,I=d.getTrackerVds(e),m=I.version,y=I.dataSourceId,S=I.appId,w=I.idMapping,k=I.ignoreFields,O=d.locationData[e],P=l.systemInfo,_=void 0===P?{}:P,T=l.network,b=void 0===T?{}:T,C=_.brand,A=_.model,q=_.platform,N=_.language,U=o||v.getPageContext(e,{resolveTitle:!1}),D={appChannel:"scn:".concat(p||"NA"),appVersion:m,dataSourceId:y,deviceBrand:C,deviceId:g.getUid(),deviceModel:A,deviceType:V(q,c.name),domain:S,language:N,latitude:null==O?void 0:O.latitude,longitude:null==O?void 0:O.longitude,networkState:(null===(a=null==b?void 0:b.networkType)||void 0===a?void 0:a.result)||(null==b?void 0:b.networkType)||(null==b?void 0:b.type)||(null==b?void 0:b.subtype),operatingSystem:V(q,c.name),path:U.path,platform:c.platform,platformVersion:c.name+(_.version?" ".concat(_.version):""),query:U.path?U.query:"",screenHeight:R(_),screenWidth:M(_),sdkVersion:s,sessionId:g.getSessionId(e),title:v.getPageTitle(),timestamp:Date.now(),timezoneOffset:(new Date).getTimezoneOffset(),userId:g.getUserId(e)};return w&&(D.userKey=g.getUserKey(e)),r&&!x(h[e])&&(D.attributes=n({},h[e])),x(D.attributes)||(D.attributes=Z(K(n({},D.attributes)))),x(k)||k.forEach(function(e){E(D,e)}),x(i)?n(n({},D),{trackingId:e}):n(n(n({},D),i),{trackingId:e})}},xe=function(e){var t=this;this.growingIO=e,this.enterParams={},this.entryExtraData={},this.parsedEntryExtraData={},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,f=u.dataStore,p=u.minipInstance,v=u.dataStore,h=v.trackersExecute,I=v.shareOut,m=v.lastCloseTime,y=v.saveStorageInfo,S=v.setOriginalSource,w=v.removeOriginalSource;s.emit(Ie,{event:"App ".concat(e),timestamp:a,params:null!==(r=i[0])&&void 0!==r?r:{}}),l.debug&&console.log("App:",e,a);var k=g.listeners.app;switch(s.emit(ye,{event:"App ".concat(e),params:null!==(o=i[0])&&void 0!==o?o:{}}),e){case k.appLaunch:t.enterParams=n({},i[0]);break;case k.appCreate:case k.appShow:var O=t.enterParamsParse(i[0]),P=O.path,_=O.query,T=O.referralPage;t.enterParams={path:P,query:_,scene:f.scene,referrerInfo:{appId:T}};var b=!m||a-m>60*l.keepAlive*1e3||!(!f.lastScene||f.scene===f.lastScene);if(b&&(t.entryExtraData=t.parsedEntryExtraData,h(function(e){!I&&l.originalSource&&P?S(e,{path:P,query:_,referralPage:T}):w(e)})),m){if(b){var E=t.sessionEntry;t.sessionEntry=P?O:void 0;try{h(function(e){c.setSessionId(e)})}finally{t.sessionEntry=E}}}else h(function(e){f.lastVisitEvent[e]={path:P,query:_,referralPage:T},t.buildVisitEvent(e,{path:P,query:_,referralPage:T})});p.setNetworkStatusListener();break;case k.appClose:f.lastScene=f.scene,f.lastCloseTime=Date.now(),y(),c.saveUserInfo(),h(function(e){t.buildCloseEvent(e),l.forceLogin||d.initiateRequest(e,!0)})}},this.enterParamsParse=function(e){var n,i,r;void 0===e&&(e={});var o=t.growingIO,a=o.gioPlatform,u=o.minipInstance,s=o.dataStore,c="",l="",g="",d=null===(n=u.minip)||void 0===n?void 0:n.canIUse,f=null===(i=u.minip)||void 0===i?void 0:i.getEnterOptionsSync;if("quickapp"!==a&&"function"==typeof d&&"function"==typeof f&&L(function(){return d.call(u.minip,"getEnterOptionsSync")})){var p=L(function(){return f.call(u.minip)})||{},v=p.path,h=p.query,I=p.scene,m=[p.referrerInfo,p.refererInfo,e.referrerInfo,e.refererInfo].find(function(e){return!x(e)});t.parsedEntryExtraData=oe({},null==m?void 0:m.extraData),c=v||e.path,l=x(h)?e.query:h,g=(null==m?void 0:m.appId)||(null===(r=null==e?void 0:e.referrerInfo)||void 0===r?void 0:r.appId)||"",s.scene=I||e.scene,l=te(oe(l,(null==m?void 0:m.extraData)||{}))}else v=e.path,h=e.query,m=e.referrerInfo||e.refererInfo,t.parsedEntryExtraData=oe({},null==m?void 0:m.extraData),c=v,l=te(oe(h,(null==m?void 0:m.extraData)||{})),g=(null==m?void 0:m.appId)||"",t.parseScene(e);return{path:c,query:l,referralPage:g}},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=o.eventHooks.currentPage,l=r.vdsConfig,g=a(e),d=(null==i?void 0:i.query)||"",f=!x(i)&&i.path,p=c.getPageContext(e,f?{path:i.path,query:d,resolveTitle:!1}:{resolveTitle:!1}),v=n({eventType:"VISIT"},u(e,{},!0,p));f&&i.referralPage&&(v.referralPage=i.referralPage),l.originalSource&&!x(g)&&(v=n(n({},v),g)),s(v)},this.buildCloseEvent=function(e){var i=t.growingIO.dataStore,r=i.eventContextBuilder;(0,i.eventInterceptor)(n({eventType:"APP_CLOSED"},r(e)))}},Ae=function(e){var t,n;return!!e&&!e.isComponent&&"component"!==e.mpType&&"component"!==(null===(t=e.$vm)||void 0===t?void 0:t.mpType)&&void 0===(null===(n=e.$page)||void 0===n?void 0:n.$id)&&!!qe(e)},qe=function(e){var t,n;return(null==e?void 0:e.route)||(null==e?void 0:e.uri)||(null==e?void 0:e.__route__)||(null===(t=null==e?void 0:e.$vm)||void 0===t?void 0:t.__route__)||G((null===(n=null==e?void 0:e.$page)||void 0===n?void 0:n.fullPath)||(null==e?void 0:e.$taroPath))[0]||""},Ne=function(){function e(e){var t=this;this.growingIO=e,this.pageContextStack=[],this.queryByPage=new WeakMap,this.lifeBeforeShow=!0,this.withPageContext=function(e,n){t.pageContextStack.push(e);try{return n()}finally{t.pageContextStack.pop()}},this.getContextPage=function(){return p(t.pageContextStack)},this.isPageTarget=Ae,this.getPageIdentityPath=qe,this.getTargetPage=function(e){if(t.isPageTarget(e))return e;var n=t.getContextPage();return t.isPageTarget(n)?n:t.growingIO.minipInstance.getCurrentPage()},this.getPathFromPage=function(e){return t.getPageIdentityPath(e)||t.growingIO.minipInstance.getCurrentPath(e)||""},this.stringifyQuery=function(e){return"string"===A(e)?e:te(e||{})},this.setPageQuery=function(e,n,i){void 0===i&&(i=t.getPagePath(e));var r=oe(n);t.isPageTarget(e)&&t.queryByPage.set(e,r),t.queryOptions[i]=r},this.setConfiguredTitle=function(e){var n=t.growingIO.minipInstance.getCurrentPath();t.configuredTitle[n]=e},this.getQueryFromPage=function(e,n){var i,r,o,a=[null==e?void 0:e.options,null==e?void 0:e.$taroParams,null===(i=null==e?void 0:e.$page)||void 0===i?void 0:i.query].find(function(e){return!x(e)});if(!x(a))return t.stringifyQuery(oe(a));if(e&&t.queryByPage.has(e))return t.stringifyQuery(t.queryByPage.get(e));var u=t.queryOptions[n];if(!x(u))return t.stringifyQuery(oe(u));var s=(null===(r=null==e?void 0:e.$page)||void 0===r?void 0:r.fullPath)||(null==e?void 0:e.$taroPath),c=G(s)[1];if(c)return t.stringifyQuery(oe(c));var l=t.growingIO.dataStore.eventHooks.appEffects.enterParams,g=void 0===l?{}:l;return n===g.path?t.stringifyQuery(oe(g.query,null===(o=g.referrerInfo)||void 0===o?void 0:o.extraData)):""},this.getHistoryLocation=function(e){var n,i=t.growingIO.dataStore,r=i.eventHooks.appEffects.enterParams,o=void 0===r?{}:r;if(o.path)return{path:o.path,query:t.stringifyQuery(oe(o.query,null===(n=o.referrerInfo)||void 0===n?void 0:n.extraData))};var a=i.lastPageEvent[e];if(null==a?void 0:a.path)return{path:a.path,query:t.stringifyQuery(a.query)};var u=i.lastVisitEvent[e];return{path:(null==u?void 0:u.path)||"",query:t.stringifyQuery(null==u?void 0:u.query)}},this.getPageLocation=function(e,i){var r=t.getTargetPage(i),o=t.getPathFromPage(r);if(o)return{page:r,path:o,query:t.getQueryFromPage(r,o)};if(t.growingIO.inPlugin){var a=t.growingIO.dataStore.getTrackerVds(e);return{page:r,path:"/插件".concat(a.appId),query:""}}return n({page:r},t.getHistoryLocation(e))},this.getPagePath=function(e){return t.getPageLocation(t.growingIO.trackingId,e).path},this.getPageQuery=function(e,n){var i=t.getPageLocation(t.growingIO.trackingId,e);return"string"==typeof n&&n!==i.path?"":i.query},this.getPageTitle=function(e){var n=t.growingIO,i=n.minipInstance,r=n.inPlugin,o=n.dataStore,a=i.getCurrentPath(),u=t.configuredTitle[a]||L(function(){return i.getPageTitle(i.getCurrentPage())})||"";if(r){var s=o.getTrackerVds(e||t.growingIO.trackingId);return u||"/插件".concat(s.appId).concat(a?"_"+p(a.split("/")):"")}return u},this.getPageContext=function(e,n){void 0===e&&(e=t.growingIO.trackingId),void 0===n&&(n={});var i=t.getPageLocation(e,n.page),r=O(n,"path"),o=r?n.path||"":i.path,a=i.query;O(n,"query")?a=t.stringifyQuery(n.query):r&&o!==i.path&&(a="");var u=O(n,"title")?n.title||"":!1===n.resolveTitle?"":t.getPageTitle();return{page:i.page,path:o,query:a,title: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,i){void 0===n&&(n=!0);var r=t.buildShareQuery(e,i),o=r[0],a=r[1];return(n||O(e,"path"))&&(e.path=Q(o+(a?"?".concat(a):""))),(n||O(e,"query"))&&(e.query=a),e},this.eventSetPageProps=function(e,i){var r=L(function(){return t.pageProps[e][i.path||t.getPagePath()]});return x(r)?i.attributes:Z(K(n(n({},i.attributes),r)))},this.queryOptions={},this.configuredTitle={},this.pageProps={}}return e.prototype.buildShareQuery=function(e,t){var n,i,r=G(null!==(n=e.path)&&void 0!==n?n:""),o=t||this.getPageContext(),a=e.path||o.path,u={},s=O(e,"path");return O(e,"query")?u=ne(null!==(i=e.query)&&void 0!==i?i:"")||{}:s?u=ne(p(r))||{}:(u=ne(o.query)||{},h(P(u)).forEach(function(e){e.toLowerCase().startsWith("utm_")&&E(u,e)})),[a,te(u)]},e}(),Ue=function(e){var t=this;this.growingIO=e,this.getPrevEventBucket=function(e){if(!e||"object"!=typeof e)return null;var n=t.prevEventByPage.get(e);if(n)return n;var i={};return t.prevEventByPage.set(e,i),i},this.setPrevEventTime=function(e,n,i){var r,o=t.getPrevEventBucket(e);if(o)o[n]=i;else{var a=(null==e?void 0:e.route)||(null==e?void 0:e.uri)||(null==e?void 0:e.__route__)||(null===(r=null==e?void 0:e.$page)||void 0===r?void 0:r.fullPath)||"";t.prevEvent["".concat(n,":").concat(a)]=i}},this.main=function(e,n,i){var r,o=Date.now(),a=t.growingIO,u=a.emitter,s=a.minipInstance,c=a.plugins,g=a.vdsConfig,d=a.platformConfig,f=a.dataStore,p=f.getTrackerVds,v=f.getOriginalSource,h=f.updateOriginalSourceTitle,I=f.trackersExecute,m=f.eventHooks,y=f.toggleShareOut,S=f.buildAppMessageEvent,w=f.buildTimelineEvent,k=f.buildAddFavorites,O=m.currentPage;e||(e=s.getCurrentPage());var P=O.getPagePath(e),_="".concat(n,":").concat(P),T=t.getPrevEventBucket(e),E=T?T[n]:t.prevEvent[_];if(E&&50>o-Number(E))return!1;u.emit(Ie,{event:"Page ".concat(n),timestamp:o,params:{page:e,args:i[0]}}),g.debug&&console.log("Page:",P,"#",n,o),t.setPrevEventTime(e,n,o);var C=d.listeners.page;switch(u.emit(ye,{page:e,event:"Page ".concat(n),params:{page:e,args:i[0]}}),O.lastLifecycle=O.currentLifecycle,O.currentLifecycle=n,n){case C.pageLoad:var A=[b(e,"options"),b(e,"__displayReporter.query"),b(e,"$page.query"),b(e,"$wx.__displayReporter.query"),b(e,"$taroParams"),i[0]].find(function(e){return!x(e)});O.setPageQuery(e,A||{},P);break;case C.pageShow:I(function(n){var i=v(n);x(i)||i.path!==P||h(n,P,O.getPageTitle()),p(n).trackPage&&t.buildPageEvent(n,void 0,e)}),y(!1);break;case C.pageHide:case C.pageUnload:break;case C.shareChat:case C.shareApp:y(!0),I(function(e){p(e).followShare&&S(e,i)});break;case C.shareTime:"xhsp"===s.platform&&y(!0),I(function(e){p(e).followShare&&w(e,i)});break;case C.addFavorites:I(function(e){p(e).followShare&&k(e,i)});break;case C.tabTap:var q=null===(r=null==c?void 0:c.gioEventAutoTracking)||void 0===r?void 0:r.buildTabClickEvent;g.autotrack&&q&&l(q)&&q(t.growingIO.trackingId,i[0])}return O.lastLifecycle=O.currentLifecycle,O.currentLifecycle="".concat(n,"End"),["onHideEnd","onUnloadEnd"].includes(O.currentLifecycle)&&(O.lifeBeforeShow=!0),"onShowEnd"===O.currentLifecycle&&(O.lifeBeforeShow=!1),!0},this.buildPageEvent=function(e,i,r){var o=t.growingIO.dataStore,a=o.eventContextBuilder,u=o.eventInterceptor,s=o.eventHooks.currentPage,c={page:r,resolveTitle:!1};x(i)||(O(i,"path")?(c.path=i.path,c.query=O(i,"query")?i.query:""):O(i,"query")&&(c.query=i.query));var l=s.getPageContext(e,c),g=n({eventType:"PAGE",referralPage:s.getReferralPage(e)},a(e,void 0,!0,l));g.attributes=s.eventSetPageProps(e,g),!x(i)&&i.title&&(g.title=i.title),u(g)},this.prevEvent={},this.prevEventByPage=new WeakMap},De=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=i.getLifeArgs(t,o);return i.runLifeEffects(e,a,n,r),i.emitLifeEnd(e,a,n,r),o},this.getLifeArgs=function(e,t){void 0===t&&(t=void 0);var n="array"===A(e)?[].slice.call(e):[];return x(t)||n.push(t),n},this.runLifeEffects=function(e,t,n,r){return i["def".concat(n,"Cbs")][r].apply(e,t)},this.emitLifeEnd=function(e,t,n,r){i.growingIO.emitter.emit(Ie,{event:"".concat(n," ").concat(r,"End"),timestamp:Date.now(),params:{instance:e,arguments:Array.from(t)}})},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.growingIO.gioSDKInitialized)return t.apply(this,c);if(!o.shareEventTypes.includes(e)){var g=function(){var n=o.getLifeArgs(c);return L(function(){return o.runLifeEffects(s,n,r,e)}),u=t.apply(s,c),L(function(){return o.emitLifeEnd(s,n,r,e)}),u};return"Page"===r?o.currentPage.withPageContext(this,g):g()}var d=L(function(){return o.currentPage.getPageContext(o.growingIO.trackingId,{page:s})}),f=(null==d?void 0:d.page)||this,p=function(e){return o.currentPage.withPageContext(f,e)},v=null!==(i=p(function(){return t.apply(s,c)}))&&void 0!==i?i:{};if(!o.growingIO.vdsConfig.followShare)return v;var h="promise"===A(v),I="promise"===A(v.promise),m=O(v,"_result")&&O(v,"_state");if(h||I||m){var y=function(t){void 0===t&&(t={});try{var i=n(n({},v),t);p(function(){var t=o.currentPage.updateShareResult(i,!0,d);o.lifeFcEffectsFn(s,c,r,e,t)})}catch(e){U(e,"error")}};h&&Promise.race([v,new Promise(function(e){setTimeout(function(){e({})},3e3)})]).then(y).catch(function(e){return U(e,"error")}),I&&Promise.race([v.promise,new Promise(function(e){setTimeout(function(){e({})},3e3)})]).then(y).catch(function(e){return U(e,"error")}),m&&(null===(a=o.growingIO.minipInstance)||void 0===a||a.handleSharePromise(v,y)),u=p(function(){return o.currentPage.updateShareResult(v,!1,d)})}else u=p(function(){var t=o.currentPage.updateShareResult(v,!0,d);return o.lifeFcEffectsFn(s,c,r,e,t)});return u}},this.customFcEffects=function(e,t){var n=i;return function(){for(var i,r,o=[],a=0;arguments.length>a;a++)o[a]=arguments[a];if(!n.growingIO.gioSDKInitialized)return t.apply(this,o);if(n.growingIO.vdsConfig.autotrack&&n.growingIO.plugins.gioEventAutoTracking)try{var u=o[0]||{};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];return e.appEffects.main(t,n)}})},this.setPageEffectCbs=function(){var e=i;i.pageHandlers.forEach(function(t){i.defPageCbs[t]=function(){for(var n=[],i=0;arguments.length>i;i++)n[i]=arguments[i];return e.pageEffects.main(this,t,n)}})},this.growingApp=function(e){return 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&&l(i.originalApp)&&(App=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalApp(t.appOverriding(e[0]))},i.appHooked=!0)}catch(e){}if(e.includes("Page"))try{n.Page&&!i.pageHooked&&l(i.originalPage)&&(Page=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalPage(t.pageOverriding(e[0]))},i.pageHooked=!0)}catch(e){}if(e.includes("Component"))try{n.Component&&!i.componentHooked&&l(i.originalComponent)&&(Component=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalComponent(t.componentOverriding(e[0]))},i.componentHooked=!0)}catch(e){}if(e.includes("Behavior"))try{n.Behavior&&!i.behaviorHooked&&l(i.originalBehavior)&&(Behavior=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalBehavior(t.componentOverriding(e[0]))},i.behaviorHooked=!0)}catch(e){}},this.initOriginalValue=function(){i.setAppEffectCbs(),i.setPageEffectCbs(),l(i.originalApp)||(i.originalApp=L(function(){return App||global.App})),l(i.originalPage)||(i.originalPage=L(function(){return Page||global.Page})),l(i.originalComponent)||(i.originalComponent=L(function(){return Component||global.Component})),l(i.originalBehavior)||(i.originalBehavior=L(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(),Y().GioApp=L(function(){return null!==App&&void 0!==App?App:i.originalApp}),Y().GioPage=L(function(){return null!==Page&&void 0!==Page?Page:i.originalPage}),Y().GioComponent=L(function(){return null!==Component&&void 0!==Component?Component:i.originalComponent}),Y().GioBehavior=L(function(){return null!==Behavior&&void 0!==Behavior?Behavior:i.originalBehavior})):"quickapp"===r&&(Y().GioApp=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.appOverriding(t[0])},Y().GioPage=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.pageOverriding(t[0])},Y().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 xe(this.growingIO),this.pageEffects=new Ue(this.growingIO),this.currentPage=new Ne(this.growingIO)},Le=function(){function e(e){var t,i,r=this;this.growingIO=e,this.ALLOW_SETTING_KEYS=P(se),this.originalSources={},this.originalSourceGeneration=0,this.getStorageKey=function(e,t){var n=r.growingIO.inPlugin;return"".concat(e===r.growingIO.trackingId?"":e).concat(ve[n?"plugin_"+t:t])},this.getGsid=function(e){var t=Number(r._gsid[e]);return Number.isNaN(t)||t>=1e9||1>t?(r.setGsid(e,1),1):t},this.setGsid=function(e,t){var n=Number(t);(Number.isNaN(n)||n>=1e9||1>n)&&(n=1),r._gsid[e]=n,10>r._gsid[e]-r._stid[e]||r.saveStorageInfo()},this.initStorageInfo=function(e){var t=r.growingIO.minipInstance,n=t.getStorageSync(r.getStorageKey(e,"gsid")),i=Number(n);(Number.isNaN(i)||i>=1e9||1>i)&&(i=1),r._gsid[e]=i,r._stid[e]=i,i!==n&&t.setStorageSync(r.getStorageKey(e,"gsid"),i)},this.saveStorageInfo=function(){var e=r.growingIO.minipInstance;r._stid=n({},r._gsid),ee(e,r.initializedTrackingIds.map(function(e){return{key:r.getStorageKey(e,"gsid"),value:r._gsid[e]}}))},this.normalizeOriginalSource=function(e){if(!c(e)||!a(e.path)||!e.path)return{};var t={path:e.path,query:a(e.query)?e.query:"",referralPage:a(e.referralPage)?e.referralPage:""};return a(e.title)&&(t.title=e.title),t},this.setOriginalSource=function(e,t){var n=r.growingIO.minipInstance,i=r.normalizeOriginalSource(t);if(x(i))r.removeOriginalSource(e);else{var o=r.getStorageKey(e,"originalSource");r.originalSources[e]={source:i,generation:++r.originalSourceGeneration},L(function(){return n.setStorageSync(o,JSON.stringify(i))})}},this.removeOriginalSource=function(e){var t=r.getStorageKey(e,"originalSource");r.originalSources[e]={source:{},generation:++r.originalSourceGeneration},L(function(){return r.growingIO.minipInstance.removeStorageSync(t)})},this.getOriginalSource=function(e){var t,i=r.growingIO.minipInstance,o=r.getStorageKey(e,"originalSource");if(O(r.originalSources,e))return n({},r.originalSources[e].source);try{t=i.getStorageSync(o)}catch(e){return{}}var a=r.normalizeOriginalSource(L(function(){return JSON.parse(t)}));return t&&x(a)?r.removeOriginalSource(e):r.originalSources[e]={source:a,generation:++r.originalSourceGeneration},n({},a)},this.bindOriginalSource=function(e){var t,n;if("VISIT"===e.eventType&&void 0===e.originalSourceId){var i=r.getOriginalSource(e.trackingId),o=null===(n=null===(t=r.growingIO.userStore)||void 0===t?void 0:t.getSessionSnapshot)||void 0===n?void 0:n.call(t,e.trackingId);!i.path||e.path!==i.path||(e.query||"")!==i.query||o&&e.sessionId!==o||(e.originalSourceId=r.originalSources[e.trackingId].generation)}},this.consumeOriginalSource=function(e,t){var n=r.originalSources[e];(null==n?void 0:n.source.path)&&t.some(function(e){return"VISIT"===e.eventType&&e.originalSourceId===n.generation})&&r.removeOriginalSource(e)},this.updateOriginalSourceTitle=function(e,t,i){var o=r.getOriginalSource(e);if(x(o)||o.path!==t||!a(i))return!1;var u=n(n({},o),{title:i});return r.originalSources[e].source=u,L(function(){return r.growingIO.minipInstance.setStorageSync(r.getStorageKey(e,"originalSource"),JSON.stringify(u))}),!0},this.getTrackerVds=function(e){return r.growingIO.trackingId===e?n({},r.growingIO.vdsConfig):void 0},this.initTrackerOptions=function(e){var t=r.initOptions(e);return t.trackingId=e.trackingId,r.growingIO.trackingId=e.trackingId,r.growingIO.vdsConfig=t,t},this.initTrackerHooker=function(e){var t=r.growingIO,n=t.platformConfig,i=t.inPlugin,o=t.minipInstance,a=t.plugins,u=e.uniVue,s=e.taro,c=e.mpx,g=e.mpvue;return r.validateTrackerFramework(e),u||s||g||"quickapp"===o.platform||(n.canHook=!0),!i||["tbp","jdp"].includes(o.platform)?r.eventHooks.initEventHooks():r.eventHooks.initOriginalValue(),u||s||g||c||i||L(function(){return l(getApp)&&!!getApp()})&&U("检测到 App 已创建:请将 gdp('init') 放在 App() 注册之前,否则自动事件可能缺失。","warn"),u&&a.gioUniAppAdapter.main(),s&&a.gioTaroAdapter.main(),g&&a.gioMpvueAdapter.main(),c&&a.gioMpxAdapter.main(),!0},this.validateTrackerFramework=function(e){var t,n,i,o,a=e.uniVue,u=e.taro,s=e.mpvue,c=e.mpx,g=r.growingIO.plugins;if(a){if(!a.version)throw Error("未获取到有效的 uni-app Vue 实例");if(!l(null===(t=null==g?void 0:g.gioUniAppAdapter)||void 0===t?void 0:t.main))throw Error("当前构建未包含 uni-app 框架适配器")}if(u){if(!u.Current&&!u.createComponent)throw Error("未获取到受支持的 Taro 实例");if(!l(null===(n=null==g?void 0:g.gioTaroAdapter)||void 0===n?void 0:n.main))throw Error("当前构建未包含 Taro 框架适配器")}if(s){if(!l(s.mixin))throw Error("未获取到支持 mixin 的 mpvue 实例");if(!l(null===(i=null==g?void 0:g.gioMpvueAdapter)||void 0===i?void 0:i.main))throw Error("当前构建未包含 mpvue 框架适配器")}if(c){if(!l(c.injectMixins))throw Error("未获取到支持 injectMixins 的 MPX 实例");if(!l(null===(o=null==g?void 0:g.gioMpxAdapter)||void 0===o?void 0:o.main))throw Error("当前构建未包含 MPX 框架适配器")}},this.initOptions=function(e){var t,i,o,a,u,s,c,l,d=e.projectId,f=e.dataSourceId,p=e.appId,v=e.trackingId,h={};r.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?h.ignoreFields=e.ignoreFields.filter(function(e){return fe.includes(e)}):"extraParams"===t?h.extraParams=e.extraParams.filter(function(e){return pe.includes(e)}):(h[t]=e[t],["dataCollect","autotrack"].includes(t)&&!h[t]&&U("已关闭".concat(ge[t]),"info")):h[t]=se[t].default}),h.uploadInterval=Math.round(h.uploadInterval),(Number.isNaN(h.uploadInterval)||0>h.uploadInterval||h.uploadInterval>3e3)&&(h.uploadInterval=1e3),h.enableIdMapping&&!h.idMapping&&(h.idMapping=!0),E(h,"enableIdMapping"),!isNaN(Number(h.requestTimeout))&&h.requestTimeout>0||(h.requestTimeout=5e3);var I=r.normalizeServerUrl(h.serverUrl);if(!I)throw Error("serverUrl 必须是有效的 HTTP(S) 域名或基础地址");h.serverUrl=I;var m=!r.growingIO.trackingId||r.growingIO.trackingId===v;if(m&&((null===(t=h.tbConfig)||void 0===t?void 0:t.cloudFuncSend)||(null===(i=h.tbConfig)||void 0===i?void 0:i.cloudAppId))&&"tbp"!==r.growingIO.minipInstance.platform)throw Error("tbConfig 云转发仅支持淘宝小程序构建");return(0>h.impressionScale||h.impressionScale>1)&&(h.impressionScale=0),(0>h.keepAlive||h.keepAlive>1440)&&(h.keepAlive=5),(1>h.sessionExpires||h.sessionExpires>1440)&&(h.sessionExpires=-1),m&&(r.validateTrackerFramework(h),h.pluginMode&&(r.growingIO.inPlugin=!0)),h.idMapping||r.growingIO.userStore.setUserKey(v,""),n(n({},h),{projectId:d,dataSourceId:f,appId:p,trackingId:v,performance:{monitor:null===(a=null===(o=h.performance)||void 0===o?void 0:o.monitor)||void 0===a||a,exception:null===(s=null===(u=h.performance)||void 0===u?void 0:u.exception)||void 0===s||s,network:null!==(l=null===(c=h.performance)||void 0===c?void 0:c.network)&&void 0!==l&&l}})},this.setOption=function(e,t,i){var o,a=r.growingIO,u=a.userStore,s=a.emitter;if(!O(ge,t))return D("setOption > ".concat(t)),!1;var c=r.getTrackerVds(e),l=n({},c);return"ignoreFields"===t&&(i=i.filter(function(e){return fe.includes(e)})),"serverUrl"!==t||(i=r.normalizeServerUrl(i))?(r.updateVdsConfig(e,n(n({},c),((o={})[t]=i,o))),"dataCollect"===t&&l.dataCollect!==i&&i&&u.setSessionId(e),he(s,_e,{trackingId:e,optionName:t,optionValue:i}),!0):(D("setOption > serverUrl"),!1)},this.setInternalOption=function(e,t,i){var o,a=r.getTrackerVds(e);return r.updateVdsConfig(e,n(n({},a),((o={})[t]=i,o))),he(r.growingIO.emitter,_e,{trackingId:e,optionName:t,optionValue:i}),!0},this.normalizeServerUrl=function(e){if("string"!==A(e))return"";var t=e.trim();if(!t)return"";if(!/^https?:\/\//i.test(t)){if(/^[a-z][a-z\d+.-]*:\/\//i.test(t))return"";t="https://".concat(t)}return t=(t=t.replace(/^https?:\/\//i,function(e){return e.toLowerCase()})).replace(/\/+$/,""),/^https?:\/\/[^\s/?#]+(?:\/[^\s?#]*)?$/i.test(t)?t:""},this.getOption=function(e,t){var n=r.getTrackerVds(e);return t&&O(r.growingIO.vdsConfig,t)?O(n,t)?n[t]:r.growingIO.vdsConfig[t]:x(t)?n:void D("getOption > ".concat(t))},this.updateVdsConfig=function(e,t){e===r.growingIO.trackingId?(r.growingIO.vdsConfig=n(n({},r.growingIO.vdsConfig),t),Y().vdsConfig=r.growingIO.vdsConfig):(r.growingIO.subInstance[e]=n(n({},r.growingIO.subInstance[e]),t),Y().vdsConfig.subInstance[e]=r.growingIO.subInstance[e])},this.toggleShareOut=function(e){s(e)?r.shareOut=e:r.shareOut=!r.shareOut},this.sendVisit=function(e,t){r.eventHooks.appEffects.buildVisitEvent(e,t)},this.sendPage=function(e,t){r.eventHooks.pageEffects.buildPageEvent(e,t)},this.eventConverter=function(e){var t=r.growingIO,i=t.dataStore,o=t.uploader;if(r.getTrackerVds(e.trackingId).dataCollect){["LOGIN_USER_ATTRIBUTES","APP_CLOSED"].includes(e.eventType)||(e.eventSequenceId=i.getGsid(e.trackingId),i.setGsid(e.trackingId,e.eventSequenceId+1));var a={};_(e,function(e,t){var n;if("element"===t){var i=null!==(n=f(e))&&void 0!==n?n:{};_(i,function(e,t){x(e)&&0!==e||(a[t]=e)})}else x(e)&&0!==e||(a[t]=e)}),he(r.growingIO.emitter,me,{composedEvent:a});var u=n(n({},a),{requestId:j()});o.commitRequest(u)}},this.eventRefactor=function(e){var t,i,o=n(n({},e),r.eventContextBuilder(e.trackingId,{path:e.path,query:e.query,timestamp:e.timestamp}));return o.attributes=n(n({},null!==(t=o.attributes)&&void 0!==t?t:{}),null!==(i=e.attributes)&&void 0!==i?i:{}),o},this.eventInterceptor=function(e){r.bindOriginalSource(e);var t=r.growingIO.minipInstance,n=t.systemInfo,i=t.network;x(n)||x(i)?r.interceptEvents.push(e):x(r.interceptEvents)?r.eventConverter(e):r.releaseInterceptedEvents(e)},this.releaseInterceptedEvents=function(e){var t=r.interceptEvents;r.interceptEvents=[],e&&t.push(e),t.forEach(function(e){r.eventConverter(r.eventRefactor(e))})},this.eventReleaseInspector=function(){var e=r.growingIO.minipInstance,t=e.systemInfo,n=e.network;x(t)||x(n)||x(r.interceptEvents)||r.releaseInterceptedEvents()},this.buildAppMessageEvent=function(e,t){var i,o,a,u=t[0];2>t.length?1===t.length&&(a=u):a=t[1];var s=r.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=Z(n(n(n({},null!==(i=d.attributes)&&void 0!==i?i:{}),{$from:null==u?void 0:u.from,$target:null===(o=null==u?void 0:u.target)||void 0===o?void 0:o.id,$share_title:null==a?void 0:a.title,$share_path:f(g),$share_query:g[1]}),null==a?void 0:a.attributes)),l(d)},this.buildTimelineEvent=function(e,t){var i,o,a,u=t[0];2>t.length?1===t.length&&(a=u):a=t[1];var s=r.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=Z(n(n(n({},null!==(i=d.attributes)&&void 0!==i?i:{}),{$target:null===(o=null==u?void 0:u.target)||void 0===o?void 0:o.id,$share_title:null==a?void 0:a.title,$share_path:f(g),$share_query:g[1]}),null==a?void 0:a.attributes)),l(d)},this.buildAddFavorites=function(e,t){var i,o,a=t[0];2>t.length?1===t.length&&(o=a):o=t[1];var u=r.growingIO.dataStore,s=u.eventContextBuilder,c=u.eventInterceptor,l=((null==o?void 0:o.path)||"").split("?"),g=n({eventType:"CUSTOM",eventName:"$mp_add_favorites"},s(e));g.attributes=Z(n(n({},null!==(i=g.attributes)&&void 0!==i?i:{}),{$share_title:null==o?void 0:o.title,$share_path:f(l),$share_query:l[1]})),c(g)},this.trackersExecute=function(e){r.initializedTrackingIds.forEach(function(t){"function"===A(e)&&e(t)})},this.initializedTrackingIds=[],this.eventContextBuilder=new Ce(this.growingIO).main,this.eventHooks=new De(this.growingIO),this.shareOut=!1,this._gsid={},this._stid={},this.lastVisitEvent={},this.lastPageEvent={},this.locationData={},this.generalProps={},this.trackTimers={},this.interceptEvents=[];var o=this.growingIO,u=o.emitter,d=o.minipInstance;l(null===(t=d.minip)||void 0===t?void 0:t.onAppHide)&&d.minip.onAppHide(function(){r.trackersExecute(function(e){var t=r.trackTimers[e];_(t,function(e){e.start&&(e.leng=e.leng+(+Date.now()-e.start))})})}),l(null===(i=d.minip)||void 0===i?void 0:i.onAppShow)&&d.minip.onAppShow(function(){r.trackersExecute(function(e){var t=r.trackTimers[e];_(t,function(e){e.start&&(e.start=+Date.now())})})}),u.on(_e,function(e){var t=e.optionName,n=e.optionValue;"dataCollect"===t&&!1===n&&r.trackersExecute(function(e){r.growingIO.clearTrackTimer(e)})}),this.growingIO.emitter.on(be,function(e){var t=e.oldSessionId,n=e.trackingId;if(t){var i=r.eventHooks.appEffects.sessionEntry,o=i||r.eventHooks.currentPage.getPageContext(n),a=o.path,u=o.query;if(a)r.sendVisit(n,i||{path:a,query:u});else{var s=r.lastPageEvent[n];r.sendVisit(n,{path:s.path,query:s.query})}r.eventHooks.currentPage.lifeBeforeShow||r.sendPage(n)}})}return Object.defineProperty(e.prototype,"scene",{get:function(){return this._scene},set:function(e){var t=this._scene;this._scene=e,t!==this._scene&&this.growingIO.emitter.emit("SCENE_UPDATE",{newScene:e,oldScene:t})},enumerable:!1,configurable:!0}),e}(),He={scnPrefix:"",appHandlers:["onLaunch","onShow","onHide","onError","onPageNotFound","onUnhandledRejection","onThemeChange"],pageHandlers:["onLoad","onShow","onReady","onHide","onShareAppMessage","onTabItemTap","onUnload","onPullDownRefresh","onReachBottom","onResize"],shareEventTypes:["onShareAppMessage","onShareTimeline","onAddToFavorites"],actionEventTypes:["onclick","tap","onTap","longpress","longTap","blur","change","onChange","submit","confirm","getuserinfo","getphonenumber","contact","mouseup"],canHook:!0,hooks:{App:!0,Page:!0,Component:!0,Behavior:!0},listeners:{app:{appLaunch:"onLaunch",appShow:"onShow",appClose:"onHide"},page:{pageLoad:"onLoad",pageShow:"onShow",pageReady:"onReady",pageHide:"onHide",pageUnload:"onUnload",tabTap:"onTabItemTap",shareApp:"onShareAppMessage"},actions:{click:["onclick","tap","longpress","longTap","getuserinfo","getphonenumber","contact","mouseup"],change:["blur","change","confirm"],submit:["submit"]}}},Fe=n(n({},He),{pageHandlers:i(i([],He.pageHandlers,!0),["onShareChat","onCopyUrl","onShareAppMessage","onShareTimeline"],!1),shareEventTypes:i(i([],He.shareEventTypes,!0),["onShareChat","onCopyUrl"],!1),listeners:n(n({},He.listeners),{page:n(n({},He.listeners.page),{shareTime:"onShareTimeline",shareChat:"onShareChat",copyUrl:"onCopyUrl"})}),name:"XiaoHongShu",platform:"xhsp",scnPrefix:"xhs_"}),Be=n(n({},He),{listeners:n({},He.listeners),name:"JingDong",platform:"jdp",scnPrefix:"jd_"}),Ke=n(n({},He),{listeners:n({},He.listeners),name:"KuaiShou",platform:"kuaishoup",scnPrefix:"ks_"}),je=n(n({},He),{listeners:n({},He.listeners),name:"Alipay",platform:"alip",scnPrefix:"alip_",shareEventTypes:["onShareAppMessage"],hooks:n(n({},He.hooks),{Behavior:!1})}),Re=n(n({},He),{listeners:n({},He.listeners),name:"QQ",platform:"qq",scnPrefix:"qq_"});Re.pageHandlers=i(i([],He.pageHandlers,!0),["onAddToFavorites"],!1),Re.listeners.page.addFavorites="onAddToFavorites";var Me=n(n({},He),{listeners:n({},He.listeners),name:"Baidu",platform:"baidup",scnPrefix:"baidup_"}),Ve=n(n({},He),{listeners:n({},He.listeners),name:"Bytedance",platform:"bytedance",scnPrefix:"bytedance_"}),Ge=n(n({},He),{listeners:n({},He.listeners),name:"Weixin",platform:"MinP"});Ge.pageHandlers=i(i([],He.pageHandlers,!0),["onShareTimeline","onAddToFavorites"],!1),Ge.listeners.page=n(n({},He.listeners.page),{shareTime:"onShareTimeline",addFavorites:"onAddToFavorites"});var Qe=J(),ze=n(n({},He),{name:"UnsupportedFrameworkPlatform",canHook:!1,supported:!1,hooks:{App:!1,Page:!1,Component:!1,Behavior:!1}}),$e=L(function(){var e={xhs:Fe,jd:Be,ks:Ke,my:je,qq:Re,swan:Me,tt:Ve,wx:Ge}[Qe];return e?n(n({},e),{canHook:!1}):ze})||ze,We=function(e){var t=this;this.growingIO=e,this.minip=z("framework"),this.networkStatusListenerRegistered=!1,this.loadMetadata=function(e,n){new Promise(function(e,t){var i=setTimeout(function(){return e(void 0)},3e3);Promise.resolve(L(n)).then(function(t){clearTimeout(i),e(t)},function(e){clearTimeout(i),t(e)})}).then(function(n){var i;x(t[e])&&(t[e]=x(n)?{__gioFailed:!0}:n),null===(i=t.growingIO.dataStore)||void 0===i||i.eventReleaseInspector()},function(){var n;t[e]={__gioFailed:!0},null===(n=t.growingIO.dataStore)||void 0===n||n.eventReleaseInspector()})},this.hookSetTitle=function(){var e,n=null===(e=t.minip)||void 0===e?void 0:e.setNavigationBarTitle,i=t;n&&Object.defineProperty(t.minip,"setNavigationBarTitle",{writable:!0,enumerable:!0,configurable:!0,value:function(){var e=(arguments[0]||{}).title;return i.growingIO.gioSDKInitialized&&L(function(){i.growingIO.dataStore.eventHooks.currentPage.setConfiguredTitle(e)}),n.apply(this,arguments)}})},this.initImpression=function(e){var n,i;null===(i=null===(n=t.growingIO.plugins)||void 0===n?void 0:n.gioImpressionTracking)||void 0===i||i.main(e,"observeAll")},this.getCurrentPage=function(){return L(function(){return p(getCurrentPages())})||{}},this.getCurrentPath=function(e){return qe(e)||qe(t.getCurrentPage())},this.getPageTitle=function(e){var n,i,r,o,u,s,c,l,d=qe(e)||(null==e?void 0:e.route),f=J(),p="",v=$(f);"string"===A(v)&&(v=null!==(n=L(function(){return JSON.parse(v)}))&&void 0!==n?n:{});var h,I=(null==e?void 0:e.data)||(null==e?void 0:e.$data)||{};if((p=a(null==I?void 0:I.gioPageTitle)?null==I?void 0:I.gioPageTitle:"")||L(function(){var e,t,n=W(f);n&&(h=n["".concat(d,".json")]||{},p=(null==h?void 0:h.navigationBarTitleText)||(null===(t=null===(e=null==h?void 0:h.mod)||void 0===e?void 0:e.exports)||void 0===t?void 0:t.navigationBarTitleText))}),!p&&v){var m=t.growingIO.dataStore.eventHooks.appEffects.enterParams;if(d||x(m)||(d=m.path||"",p=d?t._getTitleFromTabBar(v,d):""),!p&&(h=g(v.pages)?null!==(i=v.pages.find(function(e){return e.path===d}))&&void 0!==i?i:{}:v.page||{})){var y=h[d]||h["".concat(d,".html")]||h;p=(null==y?void 0:y.navigationBarTitleText)||(null===(r=null==y?void 0:y.window)||void 0===r?void 0:r.navigationBarTitleText)}p||(p=t._getTitleFromTabBar(v,d))}return p||(p=["wx","tt"].includes(f)?null===(s=null===(u=null===(o=v||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=v||global||$global)||void 0===c?void 0:c.window)||void 0===l?void 0:l.navigationBarTitleText),F(p)},this._getTitleFromTabBar=function(e,t){var n,i,r=null===(i=null===(n=null==e?void 0:e.tabBar)||void 0===n?void 0:n.list)||void 0===i?void 0:i.find(function(e){return e.pagePath===t||e.pagePath==="".concat(t,".html")});return(null==r?void 0:r.text)||""},this.getStorageSync=function(e){var n,i=null===(n=t.minip)||void 0===n?void 0:n.getStorageSync(e);return c(i)&&i.expiredAt?i.expiredAt<Date.now()?(t.removeStorageSync(e),""):i.value:i},this.setStorageSync=function(e,n,i){var r;i&&(n={value:n,expiredAt:i}),null===(r=t.minip)||void 0===r||r.setStorageSync(e,n)},this.setStorage=function(e,n){var i;null===(i=t.minip)||void 0===i||i.setStorage({key:e,data:n})},this.removeStorageSync=function(e){var n;null===(n=t.minip)||void 0===n||n.removeStorageSync(e)},this.getNetworkType=function(){var e=t;return new Promise(function(n){var i;null===(i=t.minip)||void 0===i||i.getNetworkType({success:function(t){e.network=t,n(t)},fail:function(){e.network={__gioFailed:!0},n(e.network)}})})},this.request=function(e){var n,i=e.url,r=e.data,o=e.header,a=e.timeout,u=e.method,s=e.success,c=e.fail,l=e.complete;return null===(n=t.minip)||void 0===n?void 0:n.request({url:i,data:r,header:o,timeout:a,method:u,success:s,fail:c,complete:l})},this.getSystemInfo=function(){var e=t;return new Promise(function(n){var i;null===(i=t.minip)||void 0===i||i.getSystemInfo({success:function(t){e.systemInfo=t,n(t)},fail:function(){e.systemInfo={__gioFailed:!0},n(e.systemInfo)}})})},this.setNetworkStatusListener=function(){var e;if(!t.networkStatusListenerRegistered){var n=null===(e=t.minip)||void 0===e?void 0:e.onNetworkStatusChange;if(l(n))try{n.call(t.minip,function(e){var n=e.networkType;n&&(t.network&&c(t.network)||(t.network={}),t.network.networkType=n)}),t.networkStatusListenerRegistered=!0}catch(e){U(e,"warn")}}};var n=this.growingIO.platformConfig,i=n.platform,r=n.scnPrefix;this.platform=i,this.scnPrefix=r,this.growingIO.emitter.on(Te,function(){t.loadMetadata("network",function(){return t.getNetworkType()}),t.loadMetadata("systemInfo",function(){return t.getSystemInfo()})})},Je=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}(We),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}(We),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}(We),Xe=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(){var e=(arguments[0]||{}).title;return i.growingIO.gioSDKInitialized&&L(function(){i.growingIO.dataStore.eventHooks.currentPage.setConfiguredTitle(e)}),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){var t=my.getStorageSync({key:e}).data;return c(t)&&t.expiredAt?t.expiredAt<Date.now()?(n.removeStorageSync(e),""):t.value:t},n.setStorageSync=function(e,t,i){var r;null===(r=n.minip)||void 0===r||r.setStorageSync({key:e,data:i?{value:t,expiredAt:i}: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,l=e.complete;return 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:l})},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}(We),et=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.hookSetTitle(),n}return t(n,e),n}(We),nt=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}(We),it=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.hookSetTitle(),n}return t(n,e),n}(We),rt=function(e){function i(t){var i=e.call(this,t)||this;return i.growingIO=t,i.getSystemInfo=function(){return e=i,t=void 0,o=function(){var e,t,i,r=this;return function(e,t){var n,i,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&u[0]?i.return:u[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,u[1])).done)return r;switch(i=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,i=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){o.label=u[1];break}if(6===u[0]&&o.label<r[1]){o.label=r[1],r=u;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(u);break}r[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],i=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}(this,function(o){switch(o.label){case 0:return e=n(n(n({},L(function(){var e,t;return null===(t=null===(e=r.minip)||void 0===e?void 0:e.getDeviceInfo)||void 0===t?void 0:t.call(e)})||{}),L(function(){var e,t;return null===(t=null===(e=r.minip)||void 0===e?void 0:e.getWindowInfo)||void 0===t?void 0:t.call(e)})||{}),L(function(){var e,t;return null===(t=null===(e=r.minip)||void 0===e?void 0:e.getAppBaseInfo)||void 0===t?void 0:t.call(e)})||{}),t=L(function(){var e,t;return null===(t=null===(e=r.minip)||void 0===e?void 0:e.getSystemInfoSync)||void 0===t?void 0:t.call(e)})||{},i=n(n({},t),e),x(i)?[4,new Promise(function(e){var t,n={__gioFailed:!0};if(!(null===(t=r.minip)||void 0===t?void 0:t.getSystemInfo))return r.systemInfo=n,void e(n);try{r.minip.getSystemInfo({success:function(t){r.systemInfo=x(t)?n:t,e(r.systemInfo)},fail:function(){r.systemInfo=n,e(n)}})}catch(t){r.systemInfo=n,e(n)}})]:(this.systemInfo=i,[2,i]);case 1:return[2,o.sent()]}})},new((r=void 0)||(r=Promise))(function(n,i){function a(e){try{s(o.next(e))}catch(e){i(e)}}function u(e){try{s(o.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,u)}s((o=o.apply(e,t||[])).next())});var e,t,r,o},i.hookSetTitle(),i}return t(i,e),i}(We),ot=J(),at={wx:rt,swan:nt,my:Xe,qq:et,tt:it,ks:Ze,jd:Ye,xhs:Je},ut=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n}(We),st=at[ot]||ut,ct=["gioPerformance"],lt=null,gt={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,lt=t.eventHooks,n.setupAppLifecycleHook()},this.runAppLifecycle=function(e,t,n){var i,r;null===(i=null==lt?void 0:lt.appEffects)||void 0===i||i.main(t,n),null===(r=null==lt?void 0:lt.emitLifeEnd)||void 0===r||r.call(lt,e,n,"App",t)},this.setupAppLifecycleHook=function(){if(n.mpx){var e=n.mpx.injectMixins;if("function"==typeof e){var t=n.growingIO.dataStore,i=n,r={onLaunch:function(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t];i.runAppLifecycle(this,"onLaunch",e)},onShow:function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];t.lastCloseTime&&t.shareOut&&t.toggleShareOut(!1),i.runAppLifecycle(this,"onShow",e)},onHide:function(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t];i.runAppLifecycle(this,"onHide",e)}};e(r,{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)||[]}},dt=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.pluginsContext={plugins:{gioMpxAdapter:gt}},n}return t(n,e),n}(function(e){var t,n,r,o,a,u,s=this;this.growingIO=e,this.innerPluginInit=function(){var e;ct.forEach(function(e){var t;return E(null===(t=s.pluginsContext)||void 0===t?void 0:t.plugins,e)}),P(null===(e=s.pluginsContext)||void 0===e?void 0:e.plugins).forEach(function(e){var t,n,i=null!==(n=null===(t=s.pluginsContext)||void 0===t?void 0:t.plugins[e])&&void 0!==n?n:{},r=i.name,o=i.method;I(s.pluginItems,function(e){return e.name===r})||s.pluginItems.push({name:S(r||e),method:o||function(e){}})}),x(s.pluginItems)||s.installAll()},this.install=function(e,t,n){var i,r,o=s.growingIO.emitter,a=t||I(s.pluginItems,function(t){return t.name===e});if((null===(i=s.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=s.growingIO)||void 0===r?void 0:r.plugins)[e]=new a.method(s.growingIO,n),t&&(o.emit(we,e),U("加载插件 ".concat(e),"info")),!0}catch(n){return s.lifeError(t,n),U("插件【".concat(e,"】加载异常 ").concat(n),"error"),!1}},this.installAll=function(e){(e||s.pluginItems).forEach(function(t){s.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!I(s.pluginItems,function(e){return e.name===t.name})&&s.pluginItems.push({name:S(t.name),method:t.method?t.method:function(){}})})},this.uninstall=function(e){var t,n=s.pluginItems.findIndex(function(t){return t.name===e});n>-1&&s.pluginItems.splice(n,1);var i=E(null===(t=s.growingIO)||void 0===t?void 0:t.plugins,e);return i||U("卸载插件 ".concat(e," 失败!"),"error"),i},this.uninstallAll=function(){i([],s.pluginItems,!0).forEach(function(e){return s.uninstall(e.name)})},this.lifeError=function(e,t){if(!s.handlingError){s.handlingError=!0;try{s.growingIO.emitter.emit(Se,{plugin:e,error:t})}finally{s.handlingError=!1}}U("插件执行错误 ".concat((null==e?void 0:e.name)||"unknown"," ").concat(t),"error")},this.callLifeCycle=function(e,t){s.pluginItems.forEach(function(n){var i=s.growingIO.plugins[n.name]?s.growingIO.plugins[n.name][e]:void 0;if(i&&l(i))try{i(t)}catch(e){s.lifeError(n,e)}})},this.pluginsContext={plugins:{}},this.pluginItems=[],this.handlingError=!1,null===(t=this.growingIO.emitter)||void 0===t||t.on(we,function(e){return s.callLifeCycle("onInstall",e)}),null===(n=this.growingIO.emitter)||void 0===n||n.on(Se,function(e){return s.callLifeCycle("onError",e)}),null===(r=this.growingIO.emitter)||void 0===r||r.on(ye,function(e){return s.callLifeCycle("onComposeBefore",e)}),null===(o=this.growingIO.emitter)||void 0===o||o.on(me,function(e){return s.callLifeCycle("onComposeAfter",e)}),null===(a=this.growingIO.emitter)||void 0===a||a.on(Oe,function(e){return s.callLifeCycle("onSendBefore",e)}),null===(u=this.growingIO.emitter)||void 0===u||u.on(ke,function(e){return s.callLifeCycle("onSendAfter",e)})}),ft={},pt={}.hasOwnProperty;function vt(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function ht(e){try{return encodeURIComponent(e)}catch(e){return null}}ft.stringify=function(e,t){t=t||"";var n,i,r=[];for(i in"string"!=typeof t&&(t="?"),e)if(pt.call(e,i)){if((n=e[i])||null!=n&&!isNaN(n)||(n=""),i=ht(i),n=ht(n),null===i||null===n)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""},ft.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,i={};t=n.exec(e);){var r=vt(t[1]),o=vt(t[2]);null===r||null===o||r in i||(i[r]=o)}return i};var It=function(e){var t=this;this.growingIO=e,this.activeBatches=new WeakSet,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.emitUploadEvent=function(e,n){return he(t.growingIO.emitter,e,n)},this.commitRequest=function(e){var i,r,a=n({},e),u=t.growingIO,s=u.vdsConfig,c=u.emitter,l=t.growingIO.dataStore;"VISIT"===e.eventType&&(l.lastVisitEvent[e.trackingId]=e),"PAGE"===e.eventType&&(l.lastPageEvent[e.trackingId]=e),he(c,"ON_COMMIT_REQUEST",{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.prepareBatch=function(e,n){t.growingIO.dataStore.consumeOriginalSource(e,n)},this.initiateRequest=function(e,n){var r=t.growingIO,o=r.plugins,a=r.vdsConfig,u=t.getHoardingQueue(e),s=t.getRequestQueue(e);i(i([],u,!0),s,!0).length>0&&(t.requestingNum<t.requestLimit?function(e){var i,r;if(e===t.growingIO.trackingId&&(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 u=t.growingIO.dataStore.getTrackerVds(e).uploadInterval;t.getThrottledBatchInvoke(e,u)(e)}}(e):t.pendingInitiates[e]=t.pendingInitiates[e]||!!n)},this.flushPendingInitiates=function(){var e=t.pendingInitiates,n=Object.keys(e);t.pendingInitiates={},n.forEach(function(n){return t.initiateRequest(n,e[n])})},this.getThrottledBatchInvoke=function(e,n){var i=t.throttledBatchInvoke[e];return i&&i.uploadInterval===n||(t.throttledBatchInvoke[e]={uploadInterval:n,invoke:C(function(e){return t.batchInvoke(e)},n,!1,!1)}),t.throttledBatchInvoke[e].invoke},this.getHttpCode=function(e){var t,n;return Number(null!==(n=null!==(t=null==e?void 0:e.statusCode)&&void 0!==t?t:null==e?void 0:e.status)&&void 0!==n?n:null==e?void 0:e.code)},this.batchInvoke=function(e){var r;if(t.requestingNum<t.requestLimit){var o=t.growingIO.vdsConfig,a=t.getHoardingQueue(e),u=t.getRequestQueue(e),s=i(i([],a,!0),u,!0);s.length>50?(s=s.slice(0,50),a.length>50?t.hoardingQueue[e]=a.slice(50):(t.requestQueue[e]=u.slice(50-a.length),t.hoardingQueue[e]=[])):(t.hoardingQueue[e]=[],t.requestQueue[e]=[]);var c=s;if(x(c))t.initiateRequest(e);else{t.prepareBatch(e,c);var l=c.map(function(e){var t=n({},e);return E(t,["requestId","trackingId","originalSourceId"]),t});o.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(l,null,2)),e===t.growingIO.trackingId&&(null===(r=null==o?void 0:o.tbConfig)||void 0===r?void 0:r.cloudAppId)?t.growingIO.plugins.gioTaobaoAdapter.tbCloudAppInvoke(c,l):t.sendEvent(c,l)}}else t.initiateRequest(e,!0)},this.createRequestFinalizer=function(e,r,o,a,u){if(!t.activeBatches.has(e)){var s=f(e).trackingId;t.activeBatches.add(e),t.requestingNum+=1;var c,l=function(n,o,u){void 0===o&&(o=!1),void 0===u&&(u=a);try{if(o){var c=Math.max.apply(Math,i([1],e.map(function(e){return(t.retryIds[e.requestId]||0)+1}),!1));e.forEach(function(e){return t.requestFailFn(e)}),U("请求失败!".concat(function(e){try{return JSON.stringify(e)}catch(t){return e+""}}(n)),"error"),t.emitUploadEvent(Pe,{eventsQueue:e,trackingId:s,result:n,failureStage:u,attempts:c})}else e.forEach(function(e){return delete t.retryIds[e.requestId]})}finally{t.activeBatches.delete(e),t.requestingNum=Math.max(0,t.requestingNum-1),t.emitUploadEvent(ke,{result:n,requestData:r,trackingId:s,failed:o,failureStage:o?u:void 0}),t.flushPendingInitiates(),t.initiateRequest(s)}};t.emitUploadEvent(Oe,n({eventsQueue:e,requestData:r,trackingId:s},u?{externalTransport:u}:{}));try{c=o()}catch(e){return void l(e,!0,"configuration")}var g,d,p,v,h,I,m,y=(g=function(){return l({errMsg:"GrowingIO request watchdog timeout"},!0,"watchdog")},p=!1,v=!1,h=function(){return L(function(){var e;return null===(e=null==d?void 0:d.abort)||void 0===e?void 0:e.call(d)})},I=function(){return!p&&(p=!0,clearTimeout(m),!0)},m=setTimeout(function(){if(I()){v=!0;try{g()}finally{h()}}},c),{finish:I,cancel:function(){I()&&(v=!0,h())},setTask:function(e){d=e,v&&h()}});return Object.assign(function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=a),y.finish()&&l(e,t,n)},{setTask:y.setTask})}},this.sendEvent=function(e,n){var r,o,a=f(e).trackingId,u=t.growingIO,s=u.minipInstance,c=u.dataStore,l=u.plugins;try{var g;if(!(o=t.createRequestFinalizer(e,n,function(){return(g=c.getTrackerVds(a)).requestTimeout},"transport")))return;var d=g.compress,p=g.requestTimeout,v={"content-type":"jdp"===s.platform?"application/json":"application/json;charset=UTF-8"},h=i([],n,!0),I=!!d&&(null===(r=null==l?void 0:l.gioCompress)||void 0===r?void 0:r.compressToUTF16);I&&(h=l.gioCompress.compressToUTF16(JSON.stringify(n)),v["X-Compress-Codec"]="1");var m=t.generateURL(a),y=s.request({url:"".concat(m,"?stm=").concat(Date.now(),"&compress=").concat(I?"1":"0"),header:v,method:"POST",data:h,timeout:p,success:function(e){[200,204].includes(t.getHttpCode(e))?o(e):o(e,!0,"http")},fail:function(e){return o(e,!0,"transport")},complete:function(e){var n=![200,204].includes(t.getHttpCode(e));o(e,n,"http")}});o.setTask(y)}catch(n){o?o(n,!0,"sync"):(e.forEach(function(e){return t.requestFailFn(e)}),t.emitUploadEvent(Pe,{eventsQueue:e,trackingId:a,result:n,failureStage:"configuration",attempts:1}))}},this.sendExternalEvent=function(e,n,i,r,o){var a=f(e).trackingId,u=t.createRequestFinalizer(e,n,function(){return t.growingIO.dataStore.getTrackerVds(a).requestTimeout},o,o);u&&Promise.resolve().then(i).then(function(e){r(e)?u(e):u(e,!0,"".concat(o,"_response"))}).catch(function(e){return u(e,!0,o)})},this.requestFailFn=function(e){var n;if(t.retryIds[e.requestId]||(t.retryIds[e.requestId]=0),t.retryIds[e.requestId]+=1,t.retryIds[e.requestId]>t.retryLimit)return U("请求已达到重试上限,事件将丢弃: ".concat(e.requestId),"warn"),void delete t.retryIds[e.requestId];if(!(null!==(n=t.requestQueue[e.trackingId])&&void 0!==n?n:t.requestQueue[e.trackingId]=[]).some(function(t){return t.requestId===e.requestId}))var i=800*Math.pow(2,t.retryIds[e.requestId]-1),r=Math.round(i*(.8+.4*Math.random())),o=setTimeout(function(){var n,i=null!==(n=t.requestQueue[e.trackingId])&&void 0!==n?n:t.requestQueue[e.trackingId]=[];if(i.some(function(t){return t.requestId===e.requestId}))return clearTimeout(o),void(o=null);x(i)?(i.push(e),t.initiateRequest(e.trackingId)):i.push(e),clearTimeout(o),o=null},r)},this.hoardingQueue={},this.requestQueue={},this.requestLimit=3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.throttledBatchInvoke={},this.pendingInitiates={}},mt=function(e){var t=this;this.growingIO=e,this.identityTransactionDepth=0,this.changedIdentities=new Set,this.deviceIdentityChanged=!1,this.identityRevisions={},this.identityNotifications=[],this.runIdentityTransaction=function(e,n){t.identityTransactionDepth+=1;try{return n()}finally{t.identityTransactionDepth-=1,t.identityTransactionDepth||t.flushIdentityNotifications()}},this.getSessionSnapshot=function(e){return t._sessionId[e]},this.getIdentitySnapshot=function(e){var n,i,r;return Object.freeze({deviceId:t._uid||"",userId:null!==(n=t._userId[e])&&void 0!==n?n:"",userKey:null!==(i=t._userKey[e])&&void 0!==i?i:"",gioId:null!==(r=t._gioId[e])&&void 0!==r?r:"",sessionId:t.getSessionSnapshot(e),revision:t.identityRevisions[e]||0})},this.recordIdentityChange=function(e){e?t.changedIdentities.add(e):t.deviceIdentityChanged=!0},this.notifyIdentityField=function(e,n){t.identityNotifications.push({message:e,payload:n})},this.flushIdentityNotifications=function(){var e=new Set(t.changedIdentities);t.deviceIdentityChanged&&i(i(i([t.growingIO.trackingId],t.growingIO.dataStore.initializedTrackingIds||[],!0),Object.keys(t._sessionId),!0),Object.keys(t._userId),!0).forEach(function(t){t&&e.add(t)});var n=t.identityNotifications;t.changedIdentities.clear(),t.deviceIdentityChanged=!1,t.identityNotifications=[],Array.from(e,function(e){return t.identityRevisions[e]=(t.identityRevisions[e]||0)+1,Object.freeze({trackingId:e,identity:t.getIdentitySnapshot(e)})}).forEach(function(e){return he(t.growingIO.emitter,"IDENTITY_CHANGED",e)}),n.forEach(function(e){var n=e.message,i=e.payload;return he(t.growingIO.emitter,n,i)})},this._getUidKey=function(){return t.growingIO.inPlugin?"_growing_plugin_uid_":"_growing_uid_"},this.getUid=function(){var e=t.growingIO.minipInstance;return"quickapp"===t.growingIO.gioPlatform&&!1===e.identityReady?"":(t._uid||(t._uid=e.getStorageSync(t._getUidKey())),t._uid||t.setUid(j()),t._uid)},this.setUid=function(e){return t.runIdentityTransaction(t.growingIO.trackingId,function(){var n=t.growingIO.minipInstance,i=t._uid||L(function(){return n.getStorageSync(t._getUidKey())});t._uid=e,!i&&e&&(t.isNewDevice=!0,Object.keys(t._sessionId).forEach(function(e){t._newDeviceSessionIds[e]||(t._newDeviceSessionIds[e]=t._sessionId[e])})),i!==t._uid&&(L(function(){return n.setStorage(t._getUidKey(),t._uid)}),t.recordIdentityChange(),t.notifyIdentityField(Ee,{newUId:e,oldUId:i}))})},this.restoreUid=function(e){return t.runIdentityTransaction(t.growingIO.trackingId,function(){var n=t._uid;t._uid=e,t.isNewDevice=!1,t._newDeviceSessionIds={},t.recordIdentityChange(),n!==e&&t.notifyIdentityField(Ee,{newUId:e,oldUId:n})})},this.getSessionId=function(e){var n=t.growingIO,i=n.vdsConfig.sessionExpires,r=n.dataStore.trackersExecute;return t._sessionId[e]||t.setSessionId(e),i>-1&&(Date.now()>t._sessionExpires&&r(function(e){t.setSessionId(e)}),t._sessionExpires=Date.now()+6e4*i),t._sessionId[e]},this.setSessionId=function(e,n){var i=t._sessionId[e];n||(n=j()),t._sessionId[e]=n,t.isNewDevice&&!t._newDeviceSessionIds[e]&&(t._newDeviceSessionIds[e]=n);var r=t.growingIO.vdsConfig.sessionExpires;r>-1&&(t._sessionExpires=Date.now()+6e4*r),i!==n&&he(t.growingIO.emitter,be,{trackingId:e,newSessionId:n,oldSessionId:i})},this.isNewDeviceInSession=function(e){if(!t.isNewDevice)return!1;var n=t.getSessionId(e);return t._newDeviceSessionIds[e]===n},this._getUserIdKey=function(e){return t.growingIO.dataStore.getStorageKey(e,"userId")},this.getUserId=function(e){var n,i=t.growingIO.minipInstance;return o(t._userId[e])&&(t._userId[e]=null!==(n=i.getStorageSync(t._getUserIdKey(e)))&&void 0!==n?n:""),t._userId[e]},this.setUserId=function(e,n){return t.runIdentityTransaction(e,function(){var i=t._userId[e];t._userId[e]=o(n)?"":n,i!==t._userId[e]&&(L(function(){return t.growingIO.minipInstance.setStorage(t._getUserIdKey(e),t._userId[e])}),t.recordIdentityChange(e),t.notifyIdentityField("USERID_UPDATE",{trackingId:e,newUserId:n,oldUserId:i})),n&&t.setGioId(e,n)})},this._getUserKeyKey=function(e){return t.growingIO.dataStore.getStorageKey(e,"userKey")},this.getUserKey=function(e){var n,i=t.growingIO.minipInstance;return o(t._userKey[e])&&(t._userKey[e]=null!==(n=i.getStorageSync(t._getUserKeyKey(e)))&&void 0!==n?n:""),t._userKey[e]},this.setUserKey=function(e,n){return t.runIdentityTransaction(e,function(){var i=t._userKey[e];t._userKey[e]=o(n)?"":n,i!==t._userKey[e]&&(L(function(){return t.growingIO.minipInstance.setStorage(t._getUserKeyKey(e),t._userKey[e])}),t.recordIdentityChange(e),t.notifyIdentityField("USERKEY_UPDATE",{trackingId:e,newUserKey:n,oldUserKey:i}))})},this._getGioIdKey=function(e){return t.growingIO.dataStore.getStorageKey(e,"gioId")},this.getGioId=function(e){var n,i=t.growingIO.minipInstance;return o(t._gioId[e])&&(t._gioId[e]=null!==(n=i.getStorageSync(t._getGioIdKey(e)))&&void 0!==n?n:""),t._gioId[e]},this.setGioId=function(e,n){return t.runIdentityTransaction(e,function(){var i=t._gioId[e];t._gioId[e]=o(n)?"":n,i!==t._gioId[e]&&(L(function(){return t.growingIO.minipInstance.setStorage(t._getGioIdKey(e),t._gioId[e])}),t.notifyIdentityField("GIOID_UPDATE",{trackingId:e,newGioId:n,oldGioId:i}))})},this.initUserInfo=function(e){return t.runIdentityTransaction(e,function(){var n,i=t.getIdentitySnapshot(e),r=t.growingIO.minipInstance,o=[t._getUidKey(),t._getUserIdKey(e),t._getUserKeyKey(e),t._getGioIdKey(e)],a=null!==(n=X(r,o))&&void 0!==n?n:[];["_uid","_userId","_userKey","_gioId"].forEach(function(n,i){var r;"_uid"===n?t.getUid():t[n][e]=null!==(r=a[i])&&void 0!==r?r:""});var u=t.getIdentitySnapshot(e);i.deviceId===u.deviceId&&i.userId===u.userId&&i.userKey===u.userKey||t.recordIdentityChange(e)})},this.saveUserInfo=function(){var e=t.growingIO,n=e.minipInstance;(0,e.dataStore.trackersExecute)(function(e){ee(n,[{key:t._getUidKey(),value:t._uid},{key:t._getUserIdKey(e),value:t._userId[e]},{key:t._getUserKeyKey(e),value:t._userKey[e]},{key:t._getGioIdKey(e),value:t._gioId[e]}])})},this._uid=void 0,this._sessionId={},this._userId={},this._userKey={},this._gioId={},this._sessionExpires=-1,this.isNewDevice=!1,this._newDeviceSessionIds={}},yt=new function(){var e,t=this;this.init=function(e){var n,i,r,o,a,u,s=null==e?void 0:e.trackingId,c=Y(),l={trackingId:t.trackingId,vdsConfig:t.vdsConfig,initialized:t.gioSDKInitialized,inPlugin:t.inPlugin,canHook:t.platformConfig.canHook,subConfig:null===(n=t.subInstance)||void 0===n?void 0:n[s],globalConfig:c.vdsConfig,globalSubInstances:null===(i=c.vdsConfig)||void 0===i?void 0:i.subInstance,globalSubConfig:null===(o=null===(r=c.vdsConfig)||void 0===r?void 0:r.subInstance)||void 0===o?void 0:o[s]},g=t.dataStore.initializedTrackingIds.includes(s);try{if(t.emitter.emit("ON_SDK_INITIALIZE_BEFORE",{options:e}),U("Gio小程序SDK 初始化中...","info"),!1===(null===(a=t.platformConfig)||void 0===a?void 0:a.supported))throw Error("当前 ".concat(t.gioFramework," SDK 不支持 ").concat(t.gioPlatform||"未知"," 平台,已停止初始化!"));if(e.trackingId&&t.dataStore.initializedTrackingIds.includes(e.trackingId))throw Error("已存在实例 ".concat(e.trackingId,",请勿重复初始化!"));if(t.trackingId&&!t.plugins.gioMultipleInstances)throw Error("您正在尝试初始化另一个实例,请集成多实例插件后重试!");if(u=t.dataStore.initTrackerOptions(e),he(t.emitter,Te,u),!t.dataStore.initTrackerHooker(u))throw Error("SDK 框架适配初始化失败,已停止采集以避免假成功");t.dataStore.initStorageInfo(s),"quickapp"!==t.gioPlatform&&t.userStore.initUserInfo(s)}catch(e){return g||t.dataStore.initializedTrackingIds.includes(s)||(t.gioSDKInitialized=!!l.initialized,t.trackingId=l.trackingId,t.vdsConfig=l.vdsConfig,t.inPlugin=l.inPlugin,t.platformConfig.canHook=l.canHook,t.subInstance&&(void 0===l.subConfig?E(t.subInstance,s):t.subInstance[s]=l.subConfig),c.vdsConfig=l.globalConfig,l.globalConfig&&(l.globalSubInstances?(void 0===l.globalSubConfig?E(l.globalSubInstances,s):l.globalSubInstances[s]=l.globalSubConfig,l.globalConfig.subInstance=l.globalSubInstances):E(l.globalConfig,"subInstance"))),U(e,"error"),!1}return t.dataStore.initializedTrackingIds.push(s),t.gioSDKInitialized=!0,he(t.emitter,"SDK_INITIALIZED",u),L(function(){t.trackingId&&t.trackingId!==s||(c.__gio__=function(){return t})}),L(function(){return U("Gio小程序SDK 初始化完成!","success")}),t.inPlugin&&"tbp"!==t.minipInstance.platform&&L(function(){return t.dataStore.sendVisit(u.trackingId)}),t.vdsConfig.forceLogin&&L(function(){return U("forceLogin已开启,请调用 identify 方法设置 openId 以继续上报!","info")}),!0},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)||_(n,function(t,n){l(i.pageProps[e][r][n])&&!l(t)||(i.pageProps[e][r][n]=t)}),!0}return D("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 D("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 D("identify");var i=m(n).slice(0,1e3);t.userStore.runIdentityTransaction(e,function(){t.userStore.setUid(i),t.dataStore.setInternalOption(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?D("identify",!1,"请勿重复调用"):D("identify",!1,"forceLogin未开启");else D("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,f=n({eventType:"LOGIN_USER_ATTRIBUTES"},l(e));f.attributes=Z(n(n({},null!==(r=f.attributes)&&void 0!==r?r:{}),K(i))),f.path||(f.path=null===(o=d[e])||void 0===o?void 0:o.path,f.query=null===(a=d[e])||void 0===a?void 0:a.query,f.title=null===(u=d[e])||void 0===u?void 0:u.title),g(f)}else D("setUserAttributes")},this.setUserId=function(e,n,i){if(ue(n)){var r=t.userStore.getGioId(e),a=m(n).slice(0,1e3);i=m(i).slice(0,1e3);var u=!o(i)&&m(i).length>0?m(i).slice(0,1e3):"";!t.dataStore.getTrackerVds(e).idMapping&&u&&(U("您设置了 userKey ,请初始化开启 idMapping!","warn"),u=""),t.userStore.runIdentityTransaction(e,function(){t.userStore.setUserId(e,a),t.userStore.setUserKey(e,u),r&&r!==a&&t.userStore.setSessionId(e)})}else D("setUserId")},this.clearUserId=function(e){t.userStore.runIdentityTransaction(e,function(){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]={}),_(n,function(n,i){l(t.dataStore.generalProps[e][i])&&!l(n)||(t.dataStore.generalProps[e][i]=n)}),!0):(D("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 D("clearGeneralProps"),!1}},this.track=function(e,i,r){B(i,function(){var o,a=t.dataStore,u=a.eventContextBuilder,s=a.eventInterceptor,l=n({eventType:"CUSTOM",eventName:i},u(e));l.attributes=Z(n(n({},null!==(o=l.attributes)&&void 0!==o?o:{}),K(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?B(n,function(){var i=j();return t.dataStore.trackTimers[e]||(t.dataStore.trackTimers[e]={}),t.dataStore.trackTimers[e][i]={ended:!1,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.ended&&(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!r.ended&&(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]){var s=u[i];if(s.ended)return U("指定计时器已结束,请勿重复调用!","warn"),!1;if(a){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,f=g.eventInterceptor,p=n({eventType:"CUSTOM",eventName:s.eventName},d(e));return p.attributes=Z(n(n({},null!==(o=p.attributes)&&void 0!==o?o:{}),K(n(n({},c(r)&&!x(r)?r:{}),{event_duration:s.leng>864e5?0:s.leng/1e3})))),t.plugins.gioMultipleInstances&&r&&r["&&sendTo"]&&(p["&&sendTo"]=r["&&sendTo"]),f(p),s.ended=!0,s.start=0,!0}return U("指定实例未开启数据采集,计时器已停止,请检查!","error"),s.ended=!0,s.start=0,!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,o=t.dataStore.locationData[e];-90>(r=n)||r>90||!function(e){return e>=-180&&180>=e}(i)||o.latitude===n&&o.longitude===i||(t.dataStore.locationData[e]={latitude:n,longitude:i})},this.clearLocation=function(e){t.dataStore.locationData[e]={}},this.updateImpression=function(){U("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.getABTest=function(e,t,n){U("获取ABTest数据错误! 请集成ABTest插件后重试!","error"),H(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,f=c.dataCollect,p=c.idMapping,v=c.extraParams,h=c.ignoreFields,I=o(),m=s(e),y={gioappid:g,giocs1:a(e)||"",gioplatform:t.platformConfig.platform,gioprojectid:l,gios:m,giou:I,gionewdevice:t.userStore.isNewDeviceInSession(e)};if(y.giodatacollect=f,y.giodatasourceid=d,p&&(y.giouserkey=u(e)),x(v)||v.forEach(function(n){var i;h.includes(n)||(y["gio".concat(n)]=(null!==(i=t.dataStore.lastVisitEvent[e])&&void 0!==i?i:{})[n])}),e===t.trackingId){var S=null!==(i=null===(n=t.plugins)||void 0===n?void 0:n.gioEventAutoTracking)&&void 0!==i?i:{},w=S.circleServerUrl,k=S.circleOpen;if(w&&k){var O=ne(w.split("?")[1]);O.roomId&&(y.giocircleroomid=O.roomId)}}return ft.stringify(y)},this.gioSDKInitialized=!1,this.utils=n(n(n({},N),ae),{qs:ft}),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=J(),this.gioFramework="mpx",this.sdkVersion="4.6.1";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=$e,this.minipInstance=new st(this),this.dataStore=new Le(this),this.userStore=new mt(this),this.uploader=new It(this),this.plugins=new dt(this),this.plugins.innerPluginInit()},St=function(){var e,t=arguments[0],i="g0",r=t;if(a(t)&&t.indexOf(".")>-1&&(i=null!==(e=t.split(".")[0])&&void 0!==e?e:"g0",r=t.split(".")[1]),a(r)&&le.includes(r)&&yt[r]){var o=v(Array.from(arguments));if("init"===r){var u=function(e,t){var n=m(t[0]),i=m(t[1]),r=a(t[2])?t[2].trim():t[2],o=ue(r)?m(r):"",u=t[3]||{};return n&&i&&o?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:o,userOptions:u}:(U('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", "您的小程序 AppId", options: { serverUrl: "您的数据上报地址" }); 进行初始化!',"error"),!1)}(yt,o);if(u){var s=u.projectId,c=u.dataSourceId,l=u.appId,g=u.userOptions;return yt.init(n(n({},g),{projectId:s,dataSourceId:c,appId:l,trackingId:i}))}return!1}if("registerPlugins"===r)yt.registerPlugins(o[0]);else{if(yt.gioSDKInitialized&&yt.vdsConfig)return ce.includes(r)?L(function(){return yt.handlerDistribute(i,r,o)}):L(function(){return yt[r].apply(yt,o)});U("SDK未初始化!","error")}}else if(de.includes(r))U("方法 ".concat(m(r)," 已被弃用,请移除!"),"warn");else{if("canIUse"===r)return le.includes(arguments[1])&&!!yt[arguments[1]];U("不存在名为 ".concat(m(r)," 的方法调用!"),"error")}};Y().gdp=St,Y().gioSDKVersion=yt.sdkVersion;var wt=yt.dataStore.eventHooks,kt=wt.growingApp,Ot=wt.growingPage,Pt=wt.growingComponent,_t=wt.growingBehavior;(0,wt.initOriginalValue)();var Tt=L(function(){return null!=kt?kt:App}),bt=L(function(){return null!=Ot?Ot:Page}),Et=L(function(){return null!=Pt?Pt:Component}),Ct=L(function(){return null!=_t?_t:Behavior});export{Tt as GioApp,Ct as GioBehavior,Et as GioComponent,bt as GioPage,St 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},h={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=d.growingIO.minipInstance,t=function(){try{return function(){var t,r;return null===(r=null===(t=e.minip)||void 0===t?void 0:t.getStorageInfoSync)||void 0===r?void 0:r.call(t)}()}catch(e){return}}()||{},r=Array.isArray(t.keys)?t.keys:[];r.filter(function(e){return l.test(e)}).forEach(function(t){var r=e.getStorageSync(t);r&&r>=Date.now()||e.removeStorageSync(t)}),r.filter(function(e){return f.test(e)}).forEach(function(t){g(e.getStorageSync(t))&&e.removeStorageSync(t)})},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||Date.now()>i?d.initiateRequest(e,t,o,r):m(r,o)},this.initiateRequest=function(t,r,n,i,a){void 0===a&&(a=0);var s=d.growingIO,u=s.userStore,g=u.getUid,l=u.getSessionId,f=s.dataStore,y=s.minipInstance,I=f.getTrackerVds(t),h=I.projectId,p=I.dataSourceId,S=function(e){void 0===e&&(e={});var o=c((null==e?void 0:e.errMsg)||e);o.indexOf("timeout")>-1?(v("获取ABTest数据失败! 请求超时!","error"),m(i,{})):2>a?d.initiateRequest(t,r,n,i,a+1):(v("获取ABTest数据失败! ".concat(JSON.stringify(o).slice(0,30),"!"),"error"),m(i,{}))};try{y.request({url:d.url[t],header:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",data:{accountId:h,datasourceId:p,distinctId:g(),layerId:r,newDevice:d.visitSids[t]===l(t)},timeout:d.requestTimeout,success:function(a){void 0===a&&(a={});var c=null==a?void 0:a.data;if(!o(c))return v("获取ABTest数据失败! 响应数据格式不正确!","error"),void m(i,{});0===c.code?d.experimentVerify(t,e(e({},c),{layerId:r}),n,i):(v("获取ABTest数据失败! ".concat(c.errorMsg,"!"),"error"),m(i,{})),y.setStorageSync("".concat(d.getHashKey(t,r),"_gdp_abt_sign"),Date.now()+6e4*d.requestInterval)},fail:S})}catch(e){S({errMsg:e})}},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"),h={layerId:c(o),strategyId:c(a),experimentId:c(s),variables:v},p=e({},n);u(p,["layerName","strategyName","experimentName"]);var S=I(JSON.stringify(h)),b=I(JSON.stringify(p)),w=e(e({},h),{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.6.0";var h=null!=a?a:{},p=h.abServerUrl,S=void 0===p?"https://ab.growingio.com":p,b=h.requestInterval,w=h.requestTimeout;this.timeoutCheck(b,w);var _=this.growingIO,N=_.emitter,T=_.userStore;this.growingIO.getABTest=this.getABTest,this.newDevice=!1,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(d.newDevice=!0,r(S)){var n=d.growingIO.trackingId,i=T.getSessionId(n);d.visitSids[n]=i}else o(S)&&s(S).forEach(function(e){var t=T.getSessionId(e);d.visitSids[e]=t})})}};export{h as default};
|
|
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 t(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;a>i;i++)!n&&i in t||(n||(n=[].slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||[].slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var r=function(e){return["undefined","null"].includes(g(e))},n=function(e){return"string"===g(e)},i=function(e){return"NaN"===u(Number(e))},a=function(e){return"number"===g(e)},o=function(e){return"[object Object]"==={}.toString.call(e)&&!r(e)},s=function(e){return Array.isArray(e)&&"array"===g(e)},u=function(e){return r(e)?"":"".concat(e)},c=function(e){return o(e)?Object.keys(e):[]},l=function(e,t){if(!o(e))return!1;try{if("string"===g(t))return delete e[t];if("array"===g(t))return t.map(function(t){return delete e[t]});"object"===g(t)&&t.constructor===RegExp&&c(e).forEach(function(r){t.test(r)&&l(e,r)})}catch(e){return!1}},d=function(e){return s(e)?0===e.length:o(e)?0===c(e).length:!e},g=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},f=/^\d+_gdp_abt_sign$/,v=/^\d+_gdp_abtd$/,I=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){try{return e()}catch(e){return}},S=function(e,t){if(["function","asyncfunction"].includes(g(e)))try{e(t)}catch(e){I("回调执行失败!".concat(e),"error")}},y=function(e){var t={};return o(e)&&(l(e,"&&sendTo"),function(e){c(e).forEach(function(n){return function(e,n){var i=u(n).slice(0,100);o(e)?t[i]=y(e):s(e)?(t[i]=function(e,t){if(void 0===t&&(t=!1),s(e)){for(var r=0,n=[],i=0,a=e;i<a.length;i++){var o=a[i];o&&!d(o)&&(n[r++]=o),t&&0===o&&(n[r++]=o)}return n}return e}(e.slice(0,100),!0),t[i]=t[i].join("||").slice(0,1e3)):function(e){return"date"===g(e)}(e)?t[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):t[i]=r(e)?"":u(e).slice(0,1e3)}(e[n],n)})}(e)),t},E=function(e,t){void 0===t&&(t=!1);var r=0;if(d(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},h={GIOID_UPDATE:"GIOID_UPDATE",IDENTITY_CHANGED:"IDENTITY_CHANGED",MINIP_LIFECYCLE:"MINIP_LIFECYCLE",ON_COMMIT_REQUEST:"ON_COMMIT_REQUEST",ON_COMPOSE_AFTER:"ON_COMPOSE_AFTER",ON_COMPOSE_BEFORE:"ON_COMPOSE_BEFORE",ON_ERROR:"ON_ERROR",ON_INSTALL:"ON_INSTALL",ON_SDK_INITIALIZE_BEFORE:"ON_SDK_INITIALIZE_BEFORE",ON_SEND_AFTER:"ON_SEND_AFTER",ON_SEND_BEFORE:"ON_SEND_BEFORE",ON_SEND_ERROR:"ON_SEND_ERROR",OPTION_CHANGE:"OPTION_CHANGE",OPTION_INITIALIZED:"OPTION_INITIALIZED",SCENE_UPDATE:"SCENE_UPDATE",SDK_INITIALIZED:"SDK_INITIALIZED",SESSIONID_UPDATE:"SESSIONID_UPDATE",SET_USERID:"SET_USERID",SET_USERKEY:"SET_USERKEY",UID_UPDATE:"UID_UPDATE",UN_EXECUTE_CALL:"UN_EXECUTE_CALL",USERID_UPDATE:"USERID_UPDATE",USERKEY_UPDATE:"USERKEY_UPDATE"},p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A=function(e){for(var t=[],r=0;r<e.length;r+=1){var n=e.charCodeAt(r);if(55296>n||n>56319)56320>n||n>57343||(n=65533);else{var i=e.charCodeAt(r+1);56320>i||i>57343?n=65533:(n=65536+(n-55296<<10)+i-56320,r+=1)}n>127?n>2047?n>65535?t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n):t.push(224|n>>12,128|n>>6&63,128|63&n):t.push(192|n>>6,128|63&n):t.push(n)}return t},_=function(e){return A(e).map(function(e){return e>=65&&90>=e||e>=97&&122>=e||e>=48&&57>=e||45===e||46===e||95===e||126===e?String.fromCharCode(e):"%".concat("0".concat(e.toString(16).toUpperCase()).slice(-2))}).join("")},O=function(e,t){return function(e){for(var t="",r=0;r<e.length;r+=3){var n=e[r],i=e[r+1],a=e[r+2];t+=p.charAt(n>>2),t+=p.charAt((3&n)<<4|i>>4),t+=void 0===i?"=":p.charAt((15&i)<<2|a>>6),t+=void 0===a?"=":p.charAt(63&a)}return t}(function(e,t){var r=function(e){var t=e+"";if(!/^\d+$/.test(t))throw Error("stm must be a non-negative integer");for(var r=0,n=0;n<t.length;n+=1)r=10*r+t.charCodeAt(n)-48&255;return r}(t);return e.map(function(e){return e^r})}(A(e),t))},N=function(e){var t=A(e),r=8*t.length;for(t.push(128);t.length%64!=56;)t.push(0);for(var n=7;n>=0;n-=1)t.push(n>3?0:r>>>8*n&255);for(var i=1732584193,a=4023233417,o=2562383102,s=271733878,u=3285377520,c=0;c<t.length;c+=64){var l=Array(80);for(n=0;16>n;n+=1){var d=c+4*n;l[n]=t[d]<<24|t[d+1]<<16|t[d+2]<<8|t[d+3]}for(n=16;80>n;n+=1){var g=l[n-3]^l[n-8]^l[n-14]^l[n-16];l[n]=g<<1|g>>>31}var f=i,v=a,I=o,m=s,S=u;for(n=0;80>n;n+=1){var y=void 0,E=void 0;20>n?(y=v&I|~v&m,E=1518500249):40>n?(y=v^I^m,E=1859775393):60>n?(y=v&I|v&m|I&m,E=2400959708):(y=v^I^m,E=3395469782);var h=(f<<5|f>>>27)+y+S+E+l[n]|0;S=m,m=I,I=v<<30|v>>>2,v=f,f=h}i=i+f|0,a=a+v|0,o=o+I|0,s=s+m|0,u=u+S|0}return[i,a,o,s,u].map(function(e){return"00000000".concat((e>>>0).toString(16)).slice(-8)}).join("")},T=function(e,t){var r=e.indexOf("#"),n=-1===r?e:e.slice(0,r),i=-1===r?"":e.slice(r);return"".concat(n).concat(-1===n.indexOf("?")?"?":"&","stm=").concat(_(t)).concat(i)},D=function(e,t){var r={accountId:e.projectId,datasourceId:e.dataSourceId,distinctId:e.deviceId,layerId:e.layerId,newDevice:e.newDevice};return e.identity.userId&&(r.userId=O(e.identity.userId,t)),e.identity.userKey&&(r.userKey=O(e.identity.userKey,t)),function(e){return Object.keys(e).filter(function(t){return void 0!==e[t]&&null!==e[t]}).map(function(t){return"".concat(_(t),"=").concat(_(e[t]+""))}).join("&")}(r)},R=function(){var e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()},b="gdp_abt_v2_manifest",K=/^gdp_abt_v2_[a-f0-9]{40}_(sign|data)$/,q=function(r,n){var i=this;this.getStorage=r,this.getRequestInterval=n,this.failedStorageOrigins={},this.read=function(e){var t;i.pruneFailedStorageOrigins();var r=i.failedStorageOrigins[e.dataKey],n=i.getABStorageItem(e.signKey)||0,a=i.getABStorageItem(e.dataKey),s=i.getManifest().slots[e.signKey],u=o(a),c=!!n&&n>=Date.now()&&(null==s?void 0:s.dataKey)===e.dataKey&&u&&(!r||s.expiresAt===n&&i.getExperimentStorageSignature(a)===r.signature),l=r?JSON.parse(r.signature):u?a:{};return u||i.removeRequestSlot(e),c&&delete i.failedStorageOrigins[e.dataKey],{hit:c,result:a,originData:l,originDataExpiresAt:null!==(t=null==r?void 0:r.expiresAt)&&void 0!==t?t:R()}},this.commit=function(e,t){var r=R();if(i.setABStorageItem(e.dataKey,t,r),i.saveRequestSlot(e,t))delete i.failedStorageOrigins[e.dataKey];else{var n=i.getExperimentStorageSignature(t);n&&(i.failedStorageOrigins[e.dataKey]={signature:n,expiresAt:r})}},this.prune=function(){var e=i.getStorage(),r=Date.now();i.pruneFailedStorageOrigins(r);var n=i.getManifest();i.pruneManifest(n,r),i.setManifest(n);var a=m(function(){var t,r;return null===(r=null===(t=e.minip)||void 0===t?void 0:t.getStorageInfoSync)||void 0===r?void 0:r.call(t)})||{},o=Array.isArray(a.keys)?a.keys:[],s=o.filter(function(e){return f.test(e)}),u=o.filter(function(e){return v.test(e)});t(t([],s,!0),u,!0).forEach(function(e){return i.removeABStorageItem(e)}),o.filter(function(e){return K.test(e)}).forEach(function(e){var t,r=e.replace(/_(sign|data)$/,""),a="".concat(r,"_sign"),o="".concat(r,"_data");(null===(t=n.slots[a])||void 0===t?void 0:t.dataKey)!==o&&(i.removeABStorageItem(a),i.removeABStorageItem(o))})},this.getManifest=function(){var t=i.getABStorageItem(b);return 2===(null==t?void 0:t.version)&&o(t.slots)?{version:2,slots:e({},t.slots)}:{version:2,slots:{}}},this.setManifest=function(e){return i.setABStorageItem(b,e)},this.getABStorageItem=function(e){return m(function(){return i.getStorage().getStorageSync(e)})},this.setABStorageItem=function(e,t,r){return m(function(){return i.getStorage().setStorageSync(e,t,r)})},this.removeABStorageItem=function(e){e&&m(function(){return i.getStorage().removeStorageSync(e)})},this.pruneFailedStorageOrigins=function(e){void 0===e&&(e=Date.now()),Object.keys(i.failedStorageOrigins).forEach(function(t){i.failedStorageOrigins[t].expiresAt>e||delete i.failedStorageOrigins[t]})},this.pruneManifest=function(e,t){void 0===t&&(t=Date.now()),Object.keys(e.slots).forEach(function(r){var n=e.slots[r];if(!(null==n?void 0:n.dataKey))return i.removeABStorageItem(r),void delete e.slots[r];var a=i.getABStorageItem(r),s=i.getABStorageItem(n.dataKey);if(!o(s))return i.removeABStorageItem(r),i.removeABStorageItem(n.dataKey),void delete e.slots[r];(!a||t>a||n.expiresAt<t)&&i.removeABStorageItem(r)})},this.saveRequestSlot=function(e,t){var r=i.getManifest();delete r.slots[e.signKey],i.pruneManifest(r);var n=i.getExperimentStorageSignature(t),a=i.getExperimentStorageSignature(i.getABStorageItem(e.dataKey));if(!n||a!==n)return i.removeABStorageItem(e.signKey),i.removeABStorageItem(e.dataKey),i.setManifest(r),!1;var o=Date.now()+6e4*i.getRequestInterval();i.setABStorageItem(e.signKey,o),r.slots[e.signKey]={dataKey:e.dataKey,expiresAt:o},i.setManifest(r);var s=i.getManifest().slots[e.signKey];return i.getABStorageItem(e.signKey)===o&&(null==s?void 0:s.dataKey)===e.dataKey&&(null==s?void 0:s.expiresAt)===o||(i.removeABStorageItem(e.signKey),i.removeABStorageItem(e.dataKey),delete r.slots[e.signKey],i.setManifest(r),!1)},this.getExperimentStorageSignature=function(e){return o(e)&&m(function(){return JSON.stringify({layerId:e.layerId,strategyId:e.strategyId,experimentId:e.experimentId,variables:e.variables,layerName:e.layerName,strategyName:e.strategyName,experimentName:e.experimentName})})||""},this.removeRequestSlot=function(e){i.removeABStorageItem(e.signKey),i.removeABStorageItem(e.dataKey);var t=i.getManifest();delete t.slots[e.signKey],i.setManifest(t)}},x={name:"gioABTest",method:function(t,r){var s=this;this.growingIO=t,this.pluginVersion="4.6.1",this.url={},this.pendingRequests={},this.timeoutCheck=function(e,t){s.requestInterval=a(Number(e))&&!i(Number(e))?Number(e):5,(s.requestInterval>1440||0>s.requestInterval)&&(s.requestInterval=5),s.requestTimeout=a(Number(t))&&!i(Number(t))?Number(t):1e3,(s.requestTimeout>5e3||100>s.requestTimeout)&&(s.requestTimeout=1e3)},this.cloneExperimentResult=function(e){if(Array.isArray(e))return e.map(function(e){return s.cloneExperimentResult(e)});if(!o(e))return e;var t={};return c(e).forEach(function(r){Object.defineProperty(t,r,{value:s.cloneExperimentResult(e[r]),enumerable:!0,writable:!0,configurable:!0})}),t},this.generateUrl=function(e,t){s.identityProvider.ensureTracker(e);var r,i,a=(i="http",n(r=t)||(r=u(r)),r.slice(0,4)===i?t:"https://".concat(t));s.url[e]="".concat(a,"/diversion/specified-layer-variables")},this.isDataCollectEnabled=function(e){var t;return!!(null===(t=s.growingIO.dataStore.getTrackerVds(e))||void 0===t?void 0:t.dataCollect)},this.isRequestJobActive=function(e){if(e.cancelled)return!1;var t=e.snapshot,r=s.growingIO,n=r.userStore,i=r.dataStore.getTrackerVds(t.trackingId),a=u(n.getUserId(t.trackingId)||""),o=(null==i?void 0:i.idMapping)?u(n.getUserKey(t.trackingId)||""):"";return!(!(null==i?void 0:i.dataCollect)||u(n.getUid())!==t.deviceId||a!==t.identity.userId||o!==t.identity.userKey)||(e.cancelled=!0,!1)},this.detachRequest=function(e){var t=e.snapshot,r=t.trackingId,n=t.signKey,i=s.pendingRequests[r];(null==i?void 0:i[n])===e&&(delete i[n],c(i).length||delete s.pendingRequests[r])},this.settleRequest=function(e,t,r){var n;if(void 0===r&&(r=!1),!e.settled){e.settled=!0,s.detachRequest(e),null===(n=e.attempt)||void 0===n||n.cancel();var i=function(){return e.callbacks.slice().forEach(function(r){return S(r,s.isRequestJobActive(e)?s.cloneExperimentResult(t):{})})};r?Promise.resolve().then(i):i()}},this.cancelRequests=function(e,t){void 0===t&&(t=!1),e.forEach(function(e){e.cancelled=!0,s.detachRequest(e)}),e.forEach(function(e){return s.settleRequest(e,{},t)})},this.cancelPendingRequests=function(e){var t=s.pendingRequests[e]||{};s.cancelRequests(c(t).map(function(e){return t[e]}))},this.onIdentityChanged=function(e){(e.trackingId?[e.trackingId]:c(s.pendingRequests)).forEach(function(t){var r=s.pendingRequests[t];if(r&&(!e.identity||s.growingIO.userStore.getIdentitySnapshot(t).revision===e.identity.revision)){var n=c(r).map(function(e){return r[e]}).filter(function(r){var n;if(!e.identity)return!s.isRequestJobActive(r);var i=r.snapshot,a=(null===(n=s.growingIO.dataStore.getTrackerVds(t))||void 0===n?void 0:n.idMapping)?e.identity.userKey:"";return i.deviceId!==e.identity.deviceId||i.identity.userId!==e.identity.userId||i.identity.userKey!==a});s.cancelRequests(n,e.legacy)}})},this.getABTest=function(e,t,r){if(s.isDataCollectEnabled(e)){if(d(s.url[e])&&s.generateUrl(e,"https://ab.growingio.com"),!t)return I("获取ABTest数据失败! 实验层Id不合法!","error"),void S(r,{});var n=s.createRequestSnapshot(e,t),i=s.cacheStore.read(n);i.hit?S(r,s.cloneExperimentResult(i.result)):s.requestOrJoin(n,r,i.originData,i.originDataExpiresAt)}else S(r,{})},this.createRequestSnapshot=function(t,r){var n=s.growingIO,i=n.userStore,a=n.dataStore.getTrackerVds(t)||{},o=u(a.projectId),c=u(i.getUserId(t)||""),l=a.idMapping?u(i.getUserKey(t)||""):"",d=N(JSON.stringify([c,l])),g=u(i.getUid());return Object.freeze(e({trackingId:t,layerId:r,projectId:o,dataSourceId:u(a.dataSourceId),deviceId:g,newDevice:s.identityProvider.getNewDevice(t),url:s.url[t],identity:Object.freeze({userId:c,userKey:l})},function(e,t,r,n,i){var a=N(JSON.stringify([e,t,r,n+"",i])),o="gdp_abt_v2_".concat(a);return{signKey:"".concat(o,"_sign"),dataKey:"".concat(o,"_data")}}(t,o,g,r,d)))},this.getNextStm=function(e){var t=Date.now(),r=e.lastStm&&t<=e.lastStm?e.lastStm+1:t;return e.lastStm=r,r+""},this.requestOrJoin=function(e,t,r,n){var i=s.pendingRequests[e.trackingId]||(s.pendingRequests[e.trackingId]={}),a=i[e.signKey];if(a)a.callbacks.push(t);else{var o={snapshot:e,originData:s.cloneExperimentResult(r),originDataExpiresAt:n,callbacks:[t],retryCount:0,cancelled:!1,settled:!1,settle:function(e){return s.settleRequest(o,e)}};i[e.signKey]=o,s.initiateRequest(o)}},this.initiateRequest=function(t){if(s.isRequestJobActive(t)){var r,n,i,a,c,l,d,g,f=t.snapshot,v=(r=s.requestTimeout,n=function(){t.cancelled=!0,I("获取ABTest数据失败! 请求超时!","error"),t.settle({})},a=!1,c=!1,l=function(){return m(function(){var e;return null===(e=null==i?void 0:i.abort)||void 0===e?void 0:e.call(i)})},d=function(){return!a&&(a=!0,clearTimeout(g),!0)},g=setTimeout(function(){if(d()){c=!0;try{n()}finally{l()}}},r),{finish:d,cancel:function(){d()&&(c=!0,l())},setTask:function(e){i=e,c&&l()}});t.attempt=v;var S=function(e){if(void 0===e&&(e={}),v.finish())if(s.isRequestJobActive(t)){var r=u((null==e?void 0:e.errMsg)||e);r.indexOf("timeout")>-1?(I("获取ABTest数据失败! 请求超时!","error"),t.settle({})):2>t.retryCount?(t.retryCount+=1,s.initiateRequest(t)):(I("获取ABTest数据失败! ".concat(JSON.stringify(r).slice(0,30),"!"),"error"),t.settle({}))}else t.settle({})};try{var y=s.getNextStm(t);v.setTask(s.growingIO.minipInstance.request({url:T(f.url,y),header:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",data:D(f,y),timeout:s.requestTimeout,success:function(r){if(void 0===r&&(r={}),v.finish())if(s.isRequestJobActive(t))try{var n=null==r?void 0:r.data;o(n)?0===n.code?s.experimentVerify(t,e(e({},n),{layerId:f.layerId})):(I("获取ABTest数据失败! ".concat(n.errorMsg,"!"),"error"),t.settle({})):(I("获取ABTest数据失败! 响应数据格式不正确!","error"),t.settle({}))}catch(e){I("获取ABTest数据失败! ".concat(e,"!"),"error"),t.settle({})}else t.settle({})},fail:S}))}catch(e){S({errMsg:e})}}else t.settle({})},this.experimentVerify=function(t,r){if(s.isRequestJobActive(t)){var n=r.layerId,i=r.strategyId,a=r.experimentId,o=r.layerName,c=r.experimentName,d=r.strategyName,g=r.variables,f={layerId:u(n),strategyId:u(i),experimentId:u(a),variables:g},v=e({},Date.now()<t.originDataExpiresAt?t.originData:{});l(v,["layerName","strategyName","experimentName"]);var I=e(e({},f),{layerName:o,strategyName:d,experimentName:c});s.cacheStore.commit(t.snapshot,I),E(JSON.stringify(f))!==E(JSON.stringify(v))&&i&&a&&s.buildExperimentHitEvent(t.snapshot.trackingId,I),t.settle(I)}else t.settle({})},this.buildExperimentHitEvent=function(t,r){var n,i=s.growingIO.dataStore,a=i.eventContextBuilder,o=i.eventConverter,u=e({eventType:"CUSTOM",eventName:"$exp_hit"},a(t)),c=r.layerId,l=r.experimentId,d=r.strategyId,g=r.layerName,f=r.experimentName,v=r.strategyName;u.attributes=y(e(e({},null!==(n=u.attributes)&&void 0!==n?n:{}),{$exp_layer_id:c,$exp_id:l,$exp_strategy_id:d,$exp_layer_name:g,$exp_name:f,$exp_strategy_name:v})),o(u)};var g=null!=r?r:{},f=g.abServerUrl,v=void 0===f?"https://ab.growingio.com":f,p=g.requestInterval,A=g.requestTimeout;this.timeoutCheck(p,A),this.cacheStore=new q(function(){return t.minipInstance},function(){return s.requestInterval}),this.identityProvider=function(e,t){var r,i=e.userStore,a=e.emitter,o=function(){};if("function"==typeof i.isNewDeviceInSession)r=function(e){return i.isNewDeviceInSession(e)};else{var s=!1,u={};o=function(e){s&&!u[e]&&(u[e]=i.getSessionId(e))},a.on(h.UID_UPDATE,function(r){var i=r.newUId;!r.oldUId&&i&&(s=!0,(n(t)?[e.trackingId]:c(t)).forEach(o))}),r=function(e){return u[e]===i.getSessionId(e)}}var l="function"==typeof i.runIdentityTransaction?function(e){return a.on(h.IDENTITY_CHANGED,e)}:function(e){[h.USERID_UPDATE,h.USERKEY_UPDATE,h.UID_UPDATE].forEach(function(t){return a.on(t,function(t){return void 0===t&&(t={}),e({trackingId:t.trackingId,legacy:!0})})})};return{getNewDevice:r,ensureTracker:o,subscribe:l}}(t,v),this.growingIO.getABTest=this.getABTest;var _=t.emitter;_.on(h.OPTION_INITIALIZED,function(e){void 0===e&&(e={}),d(v)?I("如果您需要使用ABTest功能,请配置服务地址 abServerUrl!","warn"):(!1!==e.dataCollect&&s.cacheStore.prune(),s.url={},n(v)?s.generateUrl(t.trackingId,v):o(v)&&c(v).forEach(function(e){return s.generateUrl(e,v[e])}))}),_.on(h.OPTION_CHANGE,function(e){var r=void 0===e?{}:e,n=r.trackingId,i=r.optionName,a=r.optionValue;"dataCollect"===i&&!1===a&&s.cancelPendingRequests(n||t.trackingId)}),this.identityProvider.subscribe(this.onIdentityChanged)}};export{x 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.6.
|
|
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.6.1",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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=function(){return e=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},e.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var t
|
|
1
|
+
var e=function(){return e=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},e.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var t=/^\d{1,10}$/,n=/^_[0-9a-z]+/,r=/^_n_[0-9]+$/,i=function(e){return"[object Object]"==={}.toString.call(e)&&!function(e){return["undefined","null"].includes(o(e))}(e)},o=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},a=function(e){try{return e()}catch(e){return}},l="ON_SEND_AFTER",c={},u={}.hasOwnProperty;function s(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function g(e){try{return encodeURIComponent(e)}catch(e){return null}}c.stringify=function(e,t){t=t||"";var n,r,i=[];for(r in"string"!=typeof t&&(t="?"),e)if(u.call(e,r)){if((n=e[r])||null!=n&&!isNaN(n)||(n=""),r=g(r),n=g(n),null===r||null===n)continue;i.push(r+"="+n)}return i.length?t+i.join("&"):""},c.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,r={};t=n.exec(e);){var i=s(t[1]),o=s(t[2]);null===i||null===o||i in r||(r[i]=o)}return r};var v,d={name:"gioEventAutoTracking",method:function(u){var s=this;this.growingIO=u,this.circleOpen=!1,this.main=function(e,t){var n,r,i=s.growingIO,o=i.vdsConfig,a=i.platformConfig,l=i.plugins,c=i.emitter,u=i.trackingId;if(!(!o.autotrack||!t||v.get(e,"currentTarget.dataset.growingIgnore")||v.get(e,"target.dataset.growingIgnore")||!v.get(e,"target.dataset.growingTrack")&&"autoplay"===v.get(e,"detail.source")||e.type===(null===(n=s.prevEvent)||void 0===n?void 0:n.type)&&10>Math.abs(Number(e.timeStamp)-Number(null===(r=s.prevEvent)||void 0===r?void 0:r.timeStamp))||o.taro&&["#eh","eh"].includes(t))){s.prevEvent=e,o.uniVue&&(t=null==l?void 0:l.gioUniAppAdapter.getHandlerName(t,e)),o.debug&&console.log("Action:",e.type,Date.now()),c.emit("ON_COMPOSE_BEFORE",{event:t,params:null!=e?e:{}});var g=a.listeners.actions;g.click.includes(e.type)?s.buildClickEvent(u,e,t):g.change.includes(e.type)&&s.buildChangeEvent(u,e,t)}},this.getNodeXpath=function(e,t){var i,o,a,l=s.growingIO,c=l.gioPlatform,u=l.vdsConfig,g=(e.currentTarget||e.target).id;return(!g||"swan"===c&&n.test(g)||(o=(i=u.taro).Current,a=i.createComponent,i&&o&&!a&&r.test(g)))&&(g=""),"".concat(g,"#").concat(t)},this.buildClickEvent=function(n,r,i){var o,a,l,c,u=s.getNodeXpath(r,i);if(u){var g=s.growingIO.dataStore,d=g.eventContextBuilder,p=g.eventInterceptor,f=g.eventHooks,h=r.currentTarget||r.target,m=void 0;if(v.has(null==h?void 0:h.dataset,"index")&&""!==(null===(o=null==h?void 0:h.dataset)||void 0===o?void 0:o.index)){var I=v.toString(h.dataset.index);t.test(I)&&I-0>0&&2147483647>I-0?m=+I:(c="".concat(h.dataset.index,",index标记应为 大于 0 且小于 2147483647 的整数!"),console.log("%c[GrowingIO]:".concat(c),"color: #F59E0B"))}var y=e({eventType:"VIEW_CLICK",element:[{xpath:u,index:m,textValue:null===(a=null==h?void 0:h.dataset)||void 0===a?void 0:a.title,hyperlink:null===(l=null==h?void 0:h.dataset)||void 0===l?void 0:l.src}]},d(n));y.attributes=f.currentPage.eventSetPageProps(n,y),p(y)}},this.buildTabClickEvent=function(t,n){var r=s.growingIO.dataStore,i=r.eventContextBuilder,o=r.eventInterceptor,a=r.eventHooks,l=e({eventType:"VIEW_CLICK",element:[{xpath:"#onTabItemTap",textValue:n.text,index:n.index+1,hyperlink:v.toString(n.pagePath)}]},i(t));l.attributes=a.currentPage.eventSetPageProps(t,l),o(l)},this.buildChangeEvent=function(t,n,r){var i,o,a=s.getNodeXpath(n,r);if(a){var l=s.growingIO.dataStore,c=l.eventContextBuilder,u=l.eventInterceptor,g=l.eventHooks,d=n.currentTarget||n.target,p=e({eventType:"VIEW_CHANGE",element:{xpath:a}},c(t)),f=v.get(n,"detail.value");v.isNil(f)&&(f=v.get(n,"target.value")),v.isNil(f)&&(f=v.get(n,"target.attr.value")),((null===(i=null==d?void 0:d.dataset)||void 0===i?void 0:i.growingTrack)||(null===(o=null==d?void 0:d.dataset)||void 0===o?void 0:o.growingtrack))&&(v.isNil(f)||(p.element.textValue=s.getPickerDisplayValue(n,f))),p.element=[p.element],p.attributes=g.currentPage.eventSetPageProps(t,p),u(p)}},this.getPickerDisplayValue=function(e,t){var n,r,i=null!==(n=v.get(e,"currentTarget.dataset.growingPickerRange"))&&void 0!==n?n:v.get(e,"target.dataset.growingPickerRange"),o=v.isArray(i)?i:a(function(){return JSON.parse(i)}),l=Number(t);if(!v.isArray(o)||!Number.isInteger(l)||0>l||l>=o.length)return v.toString(t);var c=o[l],u=null!==(r=v.get(e,"currentTarget.dataset.growingPickerRangeKey"))&&void 0!==r?r:v.get(e,"target.dataset.growingPickerRangeKey"),s=u&&c&&"object"==typeof c?c[u]:c;return v.isNil(s)||"object"==typeof s?v.toString(t):v.toString(s)},this.listenForLunchEvent=function(){s.growingIO.emitter.on("MINIP_LIFECYCLE",function(e){var t=e.event,n=e.params;["App onLaunch","App onShow"].includes(t)&&s.circleInit(n)})},this.getCircleUrlByTT=function(e){var t,n=e.query;if(n&&n.q&&n.url){var r=a(function(){var e;return null===(e=JSON.parse(n.q))||void 0===e?void 0:e.gdpCircleRoomCollectUrl});return r||(null!==(t=a(function(){var e;return null===(e=c.parse(n.url.split("?")[1]))||void 0===e?void 0:e.gdpCircleRoomCollectUrl}))&&void 0!==t?t:"")}},this.circleInit=function(e){var t,n=s.growingIO.emitter,r=function(e){var t;return"string"===o(e)?null!==(t=a(function(){return JSON.parse(e)}))&&void 0!==t?t:{}:null!=e?e:{}}((null===(t=e.referrerInfo)||void 0===t?void 0:t.extraData)||e.query||{}),i=(null==r?void 0:r.gdpCircleRoomCollectUrl)||s.getCircleUrlByTT(e);i&&(s.circleServerUrl!==i&&(s.circleServerUrl=i,n.off(l,s.collectorSendFn),n.on(l,s.collectorSendFn),s.showPromptModal("enter")),s.circleOpen=!0)},this.collectorSendFn=function(e){var t,n=e.requestData,r=e.trackingId,a=s.growingIO.uploader;if(s.circleOpen){var l=n.filter(function(e){return"CUSTOM"!==e.eventType&&r===s.growingIO.trackingId});if(!(function(e){return Array.isArray(e)&&"array"===o(e)}(t=l)?0===t.length:i(t)?0===function(e){return i(e)?Object.keys(e):[]}(t).length:!t))if(a.requestingNum<a.requestLimit)s.circleRequest(l);else var c=setInterval(function(){a.requestingNum<a.requestLimit&&(s.circleRequest(l),clearInterval(c),c=void 0)},500)}},this.circleClose=function(){s.circleOpen=!1,s.circleServerUrl="",s.growingIO.emitter.off(l,s.collectorSendFn)},this.showPromptModal=function(e,t){s.growingIO.minipInstance.minip.showModal({title:"GrowingIO提示",content:"error"===e?t:"您已进入圈选模式",showCancel:!1})},this.circleRequest=function(e){var t=s.growingIO.minipInstance,n=function(e){var t=e.statusCode,n=e.data,r=e.errMsg;204===t||200===t&&!0===(null==n?void 0:n.success)||(s.showPromptModal("error",(null==n?void 0:n.message)||n||r||"圈选请求失败,请重试!"),s.circleClose())},r=function(){var e,t=!1,r=!1,i=function(){return a(function(){var t;return null===(t=null==e?void 0:e.abort)||void 0===t?void 0:t.call(e)})},o=function(){return!t&&(t=!0,clearTimeout(l),!0)},l=setTimeout(function(){if(o()){r=!0;try{n({errMsg:"圈选请求超时,请重试!"})}finally{i()}}},1e4);return{finish:o,cancel:function(){o()&&(r=!0,i())},setTask:function(t){e=t,r&&i()}}}();try{var i=t.request({url:s.circleServerUrl,header:{"content-type":"application/json;charset=UTF-8"},method:"POST",data:e,timeout:1e4,complete:function(e){r.finish()&&n(e)}});r.setTask(i)}catch(e){r.finish()&&n({errMsg:e+""})}console.log(e,"-----\x3ecircleRequest")},this.pluginVersion="4.6.1",v=this.growingIO.utils,this.prevEvent={},this.listenForLunchEvent()}};export{d as default};
|