Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

veplayer-mp-douyin

Package Overview
Dependencies
Maintainers
0
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

veplayer-mp-douyin - npm Package Compare versions

Comparing version 1.2.11-rc.1 to 1.2.11-rc.2

2

dist/enums/index.js

@@ -26,3 +26,3 @@ "use strict";

exports.PKG = 'douyin';
exports.VERSION = '1.2.11-rc.1';
exports.VERSION = '1.2.11-rc.2';
exports.TRANSFORM_TYPE = 'douyin';

@@ -29,0 +29,0 @@ /**

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).XGAppletsLogger={})}(this,(function(e){"use strict";const t="videoplayer_oneplay",s=0,i={PLAY:"play",PAUSE:"pause",TIME_UPDATE:"timeupdate",ENDED:"ended",WAITING:"waiting",PROGRESS:"progress",LOADED_META_DATA:"loadedmetadata",SEEK_COMPLETE:"seekcomplete",ERROR:"error",PLAYBACK_RATECHANGE:"playbackratechange",MUTE_CHANGE:"mutechange",SRC_CHANGE:"srcchange",DETACHED:"detached",PAGE_UNLOAD:"pageunload",READY:"ready",BREAK:"break"},n={pause:"onPause",play:"onPlay",ended:"onEnded",timeupdate:"onTimeupdate",waiting:"onWaiting",progress:"onProgress",loadedmetadata:"onLoadedmetadata",seekcomplete:"onSeekComplete",error:"onError",playbackratechange:"onPlaybackRatechange",mutechange:"onMuteChange",srcchange:"onSrcChange",detached:"onDetached",pageunload:"onPageUnload",ready:"onReady",break:"onBreak",active:"onActive"},o="unknown",r="default",a="active",h="standby";class d{constructor(){this.initData={bitrate:0,codecType:o,vtype:o,sourceType:o,vid:"",src:"",albumId:"",episodeId:"",isVideoPlayer:!1,autoplay:!1,muted:!1,loop:!1,volume:1,playbackRate:1,initialTime:0},this.currentTime=0,this.duration=0,this.paused=!1,this.ended=!1,this.videoWidth=0,this.videoHeight=0,this.buffered=0,this.bufferedTime=0,this._error={code:0,type:0,message:""},this.wait={count:0,time:0,cost:0,firstBuffer:0,lastBuffer:0,firstTime:0,lastTime:0},this.seek={count:0,time:0,cost:0,lastBuffer:0,firstTime:0,lastTime:0,seekedTime:0},this.firstFrame={ntState:"",nt:0,vt:0,vtState:"",pt:0,ptState:"",et:0,lt:0,lpt:0,fvt:0,bft:0,bftCost:0,nvt:0},this.accPlayed={t:0,acc:0,loopAcc:0},this.pauseInfo={acuTime:0},this.playInfo={loopCount:0,playCount:0},this.resolution={init:"",final:""},this.useAction={},this.activeState=r,this.isActive=-1}getIsActive(){return this.activeState===h?0:this.activeState===a?2:1}set error(e){this._error=e}get error(){return this._error}_resetObj(e){Object.keys(e).forEach((t=>{const s=typeof e[t];"number"===s?e[t]=0:"string"===s?e[t]="":"boolean"===s&&(e[t]=!1)}))}resetOnEnded(){["wait","seek","firstFrame","pauseInfo"].forEach((e=>{const t=this[e];Object.keys(t).forEach((e=>{t[e]=0}))})),this.accPlayed.acc=0,this.accPlayed.t=0}set(e){const{initData:t}=this;Object.keys(t).forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),this.initData=t}reset(){Object.keys(this).forEach((e=>{const t=typeof this[e];"number"===t?this[e]=0:"string"===t?this[e]="":"boolean"===t?this[e]=!1:"object"===t&&null!==this[e]&&this._resetObj(this[e])}))}}function c(){return(new Date).getTime()}function p(e){if(null==e||""===e||"string"!=typeof e)return"";const t=e.split("/");let s="";return t.length>3&&t[2]&&(s=t[2]),s}const l=[{key:"480",s:480,e:576},{key:"540",s:576,e:720},{key:"720",s:720,e:1080},{key:"1080",s:1080,e:1920}];const u=2,f=1,m={appletsId:-1,appType:"",baseVersion:"",aVersion:""},g={brand:"",markLevel:0,model:"",system:"",platform:"",cpuType:"",memorySize:0};!function(){if("undefined"!=typeof wx&&"function"==typeof wx.getDeviceInfo){m.appType="wechat",m.appletsId=f;try{const e=wx.getAppBaseInfo();m.baseVersion=e.SDKVersion,m.aVersion=e.version}catch(e){}try{const e=wx.getDeviceInfo();g.cpuType=e.cpuType||"",g.memorySize=Number(e.memorySize)||0,g.system=e.system,g.brand=e.brand,g.model=e.model,g.markLevel=e.benchmarkLevel||0}catch(e){}}else if("undefined"!=typeof tt&&"function"==typeof tt.getSystemInfo){m.appType="douyin",m.appletsId=u;try{tt.getSystemInfo({success:e=>{e&&(m.appType=e.appName,m.baseVersion=e.SDKVersion,m.aVersion=e.version,g.system=e.system,g.platform=e.platform,g.brand=e.brand,g.model=e.model)}})}catch(e){}try{const e=tt.getDeviceInfoSync?tt.getDeviceInfoSync():{};g.cpuType=e.CPUType||"",g.memorySize=Number(e.memorySize)||0,g.markLevel=e.benchmarkLevel||0}catch(e){}}}();let _=null;const v="1.2.11-rc.1";class y{static get EVENTS(){return i}static set uploader(e){_=e}static get uploader(){return _}static get version(){return v}static getDefaultConfig(){return{playType:0,sourceType:"",playerVersion:"",lineAppId:0,lineUserId:0,vtype:"MP4",codecType:"h264",bitrate:0,vid:"",tag:"",subTag:"",logger:!1}}static get deviceInfo(){return g}static get envInfo(){return m}constructor(e={}){this._tm=c(),this._eventlTime=0,this._eventsTime=0,this._pEvents=[],this._hasTimeupdate=!1,this.videoInfo=new d,this.config=y.getDefaultConfig(),e.config&&this.setConfig(e.config),e.videoInfo&&this.setVideoInfo(e.videoInfo),this.setNt("new"),this.isStartPlay=!1,this.waitingStart=0,this.pauseStart=0,this.isOnePlaySend=!1,this.loadState=s,this.playbackState=0,this._sessionId=this.getSessionId(),this.setEnvParams(m,g),this.curWaitInfo={type:-1,cost:-1,time:-1,bufferedTime:0,currentTime:0}}log(e,...t){if(this.config.logger){const s=c();console.log(`[Collector][${m.appletsId}][${s-this._tm}]${e}`,...t),this._tm=s}}setConfig(e={}){Object.keys(e).forEach((t=>{this.config[t]=e[t]})),this.setCommendParams()}setVideoInfo(e={}){this.log("setVideoInfo",e.activeState,e),this.videoInfo.set(e)}trigger(e,t,s){const i=n[e];i&&this[i]?this[i](t,s):console.warn("evenName not exist",e,n[e])}reset(){this.videoInfo.reset(),this.log("videoInfo reset",this.videoInfo.buffered),this.curWaitInfo={type:-1,cost:-1,time:-1,bufferedTime:0,currentTime:0},this.isStartPlay=!1,this.waitingStart=0,this.pauseStart=0,this.isOnePlaySend=!1,this._hasTimeupdate=!1,this._eventsTime=0,this._eventlTime=0,this._pEvents=[]}setCommendParams(){const{config:e}=this,t=e.codecType||"h264";this.commendParams={session_id:this.getSessionId(),play_type:e.playType,source_type:e.sourceType,sdk_version:v,line_app_id:e.lineAppId,line_user_id:e.lineUserId||_.webId,vtype:e.vtype,codec_type:t.toLocaleLowerCase(),v:e.vid||"",bitrate:e.bitrate||0,tag:e.tag||"",subtag:e.subTag||"",log_type:e.logType||"video_playq"}}setEnvParams(e,t){this.envParams={app_type:e.appType,base_version:e.baseVersion,a_version:e.aVersion,memory_size:t.memorySize,cpu_type:t.cpuType,model:t.model,brand:t.brand,mark_level:t.markLevel,pc:e.baseVersion,pv:e.aVersion}}getSessionId(){if(!this._sessionId){const e=_.webId||"";this._sessionId=function(e){let t=(new Date).getTime();try{e=parseInt(e)}catch(t){e=0}t+=e,t+=(new Date).getSeconds();const s="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const s=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?s:3&s|8).toString(16)}));return s}(e)}return this.log("getSessionId111",this._sessionId),this._sessionId}onPause(e,t={}){this.log("onPause",e.type,e.detail),this.pauseStart=c(),this.videoInfo.paused=!0,this.updateAcc("pause"),this.susSpendWait("pause"),this.pushEvents("pause")}onPlay(e,t={}){this.isStartPlay||(this.isStartPlay=!0);const{videoInfo:s}=this;this.log("onPlay",`ended:${s.ended} vt:${s.firstFrame.vt} pt:${s.firstFrame.pt}`),s.ended&&this.resetEnded("play"),this.setPt("play"),this.pushEvents("play"),this.pauseStart&&(s.pauseInfo.acuTime+=c()-this.pauseStart,this.pauseStart=0),s.error&&!s.error.code||(s.error={code:0,type:0,message:""}),s.paused&&(s.paused=!1),s.accPlayed.t||(s.accPlayed.t=c()),s.playInfo.playCount++}onEnded(e,t={}){this.log("onEnded",e.type,e.detail,this.videoInfo.firstFrame.pt,this.videoInfo.firstFrame.vt),this.videoInfo.ended=!0,this.videoInfo.firstFrame.et=c(),this.updateAcc("ended"),this.pushEvents("ended"),this.sendOnePlay("ended")}onTimeupdate(e,t={}){const{videoInfo:s}=this,{detail:i}=e,{accPlayed:n}=s;s.currentTime=i.currentTime,s.duration=i.duration,n.t||s.paused||s.ended||(n.t=c()),!this._hasTimeupdate&&s.duration>0&&(this.pushEvents("timeupdate",{curt:i.currentTime,d:s.duration}),this._hasTimeupdate=!0),this.susSpendWait("timeupdate")}onWaiting(e,t={}){this.log("onWaiting",e.type,e.detail);const{firstFrame:s,currentTime:i,bufferedTime:n}=this.videoInfo;this.pushEvents("waiting",{curt:i,bf:n,diff:i-n}),s.pt||this.setPt("waiting"),this.updateAcc("waiting"),s.vt&&(this.waitingStart=c(),this.curWaitInfo.currentTime=i,this.curWaitInfo.bufferedTime=n)}onProgress(e,t={}){const{detail:s}=e,{videoInfo:i}=this,n=parseInt(100*s.buffered,10)/100;i.ended&&this.resetEnded("progress"),!this._hasTimeupdate&&this.pushEvents("progress",{bf:n}),i.firstFrame.pt||this.setPt("progress"),s.buffered>=1&&this.setVt("progress"),s.buffered>0&&(i.buffered=parseInt(100*s.buffered,10)/100,i.bufferedTime=s.buffered*i.duration/100),s.buffered>=100&&this.setBft(s)}onLoadedmetadata(e,t){const{detail:s}=e,{videoInfo:i}=this;if(m.appletsId===u&&i.ended&&this.resetEnded("loadedmetadata"),this.pushEvents("loadedmetadata",{bf:i.buffered}),i.duration=s.duration||0,i.videoWidth=s.width,i.videoHeight=s.height,this.log("onLoadedmetadata",this.isStartPlay,`duration:${s.duration} buffered:${i.buffered} ended: ${i.ended}`),i.videoWidth>0&&i.videoHeight>0){const e=function(e,t){const s=e>t?t:e,i=l.length;if(s<=l[0].s)return l[0].key;if(s>=l[i-1].s)return l[i-1].key;for(let e=0;e<l.length;e++)if(s>=l[e].s&&s<l[e].e)return l[e].key}(i.videoWidth,i.videoHeight);i.resolution.final=i.resolution.init=e}i.firstFrame.pt||this.setPt("loadedmetadata"),(i.buffered>=1||m.appletsId===f)&&this.setVt("loadedmetadata")}onSeekComplete(e,t){this.log("onSeekComplete",this.waitingStart,e),this.susSpendWait("seeked"),this.pushEvents("seekcomplete");const{firstFrame:s}=this.videoInfo;s.pt&&!s.vt&&this.setVt("seekcomplete")}onError(e,t){this.log("onError",e,t);const{detail:s,code:i,message:n}=e,o=s&&s.code?s.code:5001,r=s&&s.message?s.message:n;this.videoInfo.error={code:i||o,type:1004,message:r||(s?s.errMsg:"unknown")},this.setPt("error"),this.pushEvents("error"),this.updateAcc("error"),this.susSpendWait("error"),this.sendOnePlay("error"),this.reset("error")}onReady(){this.log("onReady"),this.setNt("ready"),this.pushEvents("ready")}onSrcChange(e,t){this.log("onSrcChange",e,t),this.setLt("srcChange"),this.pushEvents("src_change"),this.sendOnePlay("src_change"),this.reset()}onActive(e){const{videoInfo:t}=this,s=t.activeState,{activeState:i,isActive:n}=e;this.log("onActive",`activeState: new ${i} old:${s} isActive:${n}`),i!==s&&("boolean"==typeof n?t.isActive=n?2:1:s===a&&i===h?(this.sendOnePlay("activechange"),this.reset(),t.activeState=i):t.activeState=i)}onBreak(){this.log("onBreak"),this.updateAcc("break"),this.pushEvents("break"),this.sendOnePlay("break"),this.reset()}onDetached(e,t){this.log("onDetached",e,t),this.setLt("detached"),this.pushEvents("detached"),this.sendOnePlay("detached")}onPageUnload(e,t){this.log("onPageUnload",e,t),this.setLt("pageunload"),this.pushEvents("pageunload"),this.sendOnePlay("page_unload")}onPlaybackRatechange(e,t){this.log("onPlaybackRatechange",e,t),this.videoInfo.playbackRate=e.detail.playbackRate||1}onMuteChange(e,t){this.log("onMuteChange",e,t),this.videoInfo.muted=e.isMuted}onFullscreenchange(e,t){this.log("onFullscreenchange",e,t)}onLeavepictureinpicture(e,t){this.log("onLeavepictureinpicture",e,e)}onEnterpictureinpicture(e,t){this.log("onEnterpictureinpicture",e,e)}resetEnded(e){const{videoInfo:t}=this;if(!t)return;const{firstFrame:s}=t;this.log(`resetEnded>${e} pt:${s.pt} nt:${s.nt} fvt:${s.fvt}`),this.isOnePlaySend&&(this.isOnePlaySend=!1),this._hasTimeupdate=!1,this._pEvents=[],t.resetOnEnded(),t.ended=!1,t.playInfo.loopCount++}pushEvents(e,t){const s=c();!this._eventlTime&&(this._eventlTime=s),!this._eventsTime&&(this._eventsTime=s);const{_pEvents:i}=this,n=i.length-1;if(n>=0&&i[n].e===e){const e=i[n];i[n]={...e,nt:s-this._eventlTime,ct:s-this._eventsTime+e.ct,...t}}else this._pEvents.push({e:e,nt:s-this._eventlTime,ct:s-this._eventsTime,...t});this.log("pushEvents",e,t,this._pEvents),this._eventsTime=s}setNt(e){const{firstFrame:t}=this.videoInfo;t.pt||(this.log(`setNt: nt>${e} nt:${t.nt}`),t.nt=c(),t.ntState=e)}setPt(e){const{firstFrame:t}=this.videoInfo;t.pt||(t.nt||this.setNt(e),t.pt=c(),t.ptState=e,this.log(`setPt>${e} pt:${t.pt} nt:${t.nt} fvt:${t.fvt}`))}setVt(e){const{firstFrame:t}=this.videoInfo;if(t.vt)return;const s=c();t.nt||(t.nt=s),t.pt||(t.pt=s),t.vt=s,t.vtState=e,t.fvt=s-t.pt,t.nvt=s-t.nt,0===t.fvt&&(t.fvt=1),this.log(`setVt: ${e} pt>${t.pt} vt:${t.vt} fvt:${t.fvt} nvt:${t.nvt}`)}setLt(e){const{firstFrame:t}=this.videoInfo;if(!t.vt){const s=c();t.lt=s,t.lpt=s-t.pt,this.log(`setLt: endType:${e} vt:${t.vt} pt:${t.pt} lt:${t.lt}\n lpt:${t.lpt}`)}}setBft(e){const{firstFrame:t}=this.videoInfo;if(e.buffered>=100&&!t.bft){const e=c();t.bft=e,t.bftCost=e-t.pt,this.log("setBft:",`bft:${t.bft} bftCost:${t.bftCost}`)}}updateAcc(e,t=!1){const{accPlayed:s}=this.videoInfo;if(s.t){const t=c()-s.t;s.acc+=t,s.t=0,("ended"===e||this.videoInfo.ended)&&(s.loopAcc=s.acc)}}susSpendWait(e){const{curWaitInfo:t,videoInfo:s}=this;if(t.type>-1){this.log("susSpendWait update",e,this.waitingStart,s.currentTime,t);let i=null;"seeked"===e?(i=s.seek,i.seekedTime=s.currentTime):i=s.wait,0===i.count&&(i.firstTime=t.currentTime,i.firstBuffer=t.bufferedTime),i.lastTime=t.currentTime,i.lastBuffer=t.bufferedTime,i.count++,i.time+=t.cost,i.cost=t.cost,this.curWaitInfo={type:-1,cost:-1,currentTime:-1,bufferedTime:0},this.log("susSpendWait after waiting",s.wait,s.seek)}if(this.waitingStart){const e=c()-this.waitingStart;t.cost=e,t.type=0,this.waitingStart=0}}sendOnePlay(e){const{videoInfo:s}=this,{firstFrame:i,seek:n,wait:o,playInfo:r,pauseInfo:a,accPlayed:h,error:d,resolution:l,initData:u}=s;if(this.log(`sendOnePlay: ${e} pt:${i.pt} isOnePlaySend:${this.isOnePlaySend}`),this.isOnePlaySend||!i.pt)return;const f=h.acc;this._sessionId||(this.commendParams.session_id=this.getSessionId()),this.isOnePlaySend=!0,this.envParams.a_version||this.setEnvParams(m,g);const _={...this.commendParams,...this.envParams,initial_url:u.src,initial_host:p(u.src),pt:i.pt,vt:i.vt,et:i.et,lt:i.lt,bft:i.bft,fvt:i.fvt,nvt:i.nvt,lpt:i.lpt,sc:n.count,bc:o.count,first_buf_startt:parseInt(o.firstTime,10),first_buf_endt:parseInt(o.lastTime,10),lc:r.loopCount,sat:n.time,bu_acu_t:o.time,pause_acu_t:a.acuTime,cur_play_pos:parseInt(1e3*s.currentTime,10),load_state:this.loadState,playback_state:0|this.playbackState,watch_dur:f>432e5?0:f,switch_resolution_c:0,is_start_play_automatically:s.autoplay?1:0,start_time:u.initialTime||0,finish:s.ended?1:0,errt:d?d.type:0,errc:d?d.code:0,message:d?d.message:"",vsc:0,vsc_message:"",width:s.videoWidth,height:s.videoHeight,vd:parseInt(1e3*s.duration,10),play_c:r.playCount,player_created_t:this.player_created_t||0,mute:u.muted?1:0,volume:u.volume,prepare_start_time:i.nt,prepare_end_time:i.rt||c(),play_speed:u.playbackRate,end_state:e,initial_resolution:l.init,final_resolution:l.final,vt_state:i.vtState,pt_state:i.ptState,nt_state:i.ntState,is_active:s.getIsActive(),ext:JSON.stringify(this._pEvents),album_id:u.albumId,episode_id:u.episodeId,is_video_player:u.isVideoPlayer};this._params=_,this.log("REPORT_EVENTS.ONE_PLAY",this._pEvents,_),this.sendLog(t,_)}sendLog(e,t){const s={...this.commendParams,...this.envParams,...t};_&&_.event(e,s),this.emit(e,s)}emit(e,t,...s){}on(e,t,...s){}once(e,t,...s){}off(e,t,...s){}offAll(){}destroy(){this.offAll(),this.videoInfo=null}}function b(e,t){var s={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(s[i[n]]=e[i[n]])}return s}const k=void 0;let I={};I={cn:"https://mcs.zijieapi.com",va:"https://maliva-mcs.byteoversea.com",sg:"https://sgali-mcs.byteoversea.com"};const P={appOnShow:"app_launch",appOnHide:"app_terminate",appOnError:"on_error",pageOnShow:"predefine_pageview",pageOnHide:"predefine_pageview_hide",pageOnShareAppMessage:"on_share"},w=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],S=["__profile_set","__profile_set_once","__profile_increment","__profile_unset","__profile_append"],T=e=>null!=e&&"[object Object]"==Object.prototype.toString.call(e),C=e=>"function"==typeof e,O=e=>"number"==typeof e&&!isNaN(e),E=()=>+new Date;class A{constructor(e){this.sdk=e,this.env=this.init()}init(){return{user:{web_id:k,user_unique_id:k,user_id:k,user_type:k,user_is_auth:k,user_is_login:k,ip_addr_id:k,device_id:k},header:{app_id:k,app_name:k,app_install_id:k,install_id:k,app_package:k,app_channel:k,app_version:k,os_name:k,os_version:k,device_model:k,device_brand:k,traffic_type:k,client_ip:k,os_api:k,access:k,language:k,app_language:k,creative_id:k,ad_id:k,campaign_id:k,ab_client:k,ab_version:k,platform:k,sdk_version:k,sdk_lib:k,app_region:k,region:k,province:k,city:k,timezone:k,tz_offset:k,tz_name:k,sim_region:k,carrier:k,resolution:k,screen_width:k,screen_height:k,browser:k,browser_version:k,referrer:k,referrer_host:k,utm_source:k,utm_medium:k,utm_campaign:k,utm_term:k,utm_content:k,custom:{},ab_sdk_version:k,_sdk_version:k,_sdk_name:k}}}set(e){this.sdk.emit(this.sdk.types.EnvTransform,e),Object.keys(e).forEach((t=>{if("evtParams"===t)this.evtParams=Object.assign(Object.assign({},this.evtParams||{}),e.evtParams||{});else if("_staging_flag"===t)this.evtParams=Object.assign(Object.assign({},this.evtParams||{}),{_staging_flag:e._staging_flag});else{let s=t,i=e[t];if(null===i)return!1;let n="";s.indexOf(".")>-1&&([n,s]=s.split(".")),"os_version"!==s&&"mp_platform"!==s||(i=`${i}`),n?("headers"===n&&(n="header"),"user"===n||"header"===n?this.env[n][s]=i:this.env.header.custom[s]=i):this.env.user.hasOwnProperty(s)?["user_type","ip_addr_id"].indexOf(s)>-1?this.env.user[s]=Number(i):["user_id","web_id","user_unique_id"].indexOf(s)>-1?this.env.user[s]=String(i):["user_is_auth","user_is_login"].indexOf(s)>-1?this.env.user[s]=Boolean(i):["device_id"].indexOf(s)>-1&&(this.env.user[s]=i):this.env.header.hasOwnProperty(s)?this.env.header[s]=i:this.env.header.custom[s]=i}}))}get(e){return e&&"env"!==e?"evtParams"===e?Object.assign({},this[e]):this.env.hasOwnProperty(e)?this.clone(this.env[e]):this.env.user.hasOwnProperty(e)?this.clone(this.env.user[e]):this.env.header.hasOwnProperty(e)?this.clone(this.env.header[e]):this.env.header.custom.hasOwnProperty(e)?this.clone(this.env.header.custom[e]):void 0:this.clone(this.env)}compose(e,t=[]){const{user:s,header:i}=this.env,{evtParams:n}=this,o=e.map((e=>(e.event&&!t.includes(e.event)&&n&&Object.keys(n).forEach((t=>{void 0===e.params[t]&&(e.params[t]=n[t])})),e.params=JSON.stringify(e.params),e)));return this.clone({events:o,user:s,header:i})}merge(e,t=[]){const s=this.compose(e,t);return s.local_time=Math.floor(E()/1e3),[s]}clone(e){return T(e)?JSON.parse(JSON.stringify(e)):e}}class ${constructor(){this.domains=I,this.init()}init(){this.option={caller:"",log:!1,channel:"cn",report_channel:"cn",channel_domain:"",report_url:"",auto_report:!1,auto_profile:!1,profile_channel:"cn",enable_profile:!1,enable_ab_test:!1,ab_channel_domain:"",clear_ab_cache_on_user_change:!0,enable_et_test:!1,event_verify_url:"",enable_buffer:!1,buffer_interval:5e3,buffer_number:5,enable_storage_only:!1,enable_filter_list:!1,enable_third:!1,enable_filter_crawler:!1,request_timeout:0,enable_initiative_launch:!1,enable_custom_webid:!1,disable_sdk_monitor:!1},this.cloneOption=Object.assign({},this.option),this.initDomain()}initDomain(){if(this.option.channel_domain)return void(this.domain=this.option.channel_domain);let e=this.option.report_channel;Object.keys(this.domains).includes(e)||(e="cn"),this.domain=this.domains[e]}set(e){T(e)&&Object.keys(e).forEach((t=>{this.option.hasOwnProperty(t)&&("channel"===t||"report_channel"===t?(this.option.report_channel=this.option.channel=e[t]?e[t]:this.cloneOption[t],this.initDomain()):(this.option[t]=void 0===e[t]?this.cloneOption[t]:e[t],"channel_domain"===t&&this.initDomain()))}))}get(e){return e?this.hasOwnProperty(e)?this[e]:this.option.hasOwnProperty(e)?this.option[e]:void 0:Object.assign({},this.option)}}class x{constructor(){this.hooks={}}on(e,t){e&&t&&"function"==typeof t&&(this.hooks[e]||(this.hooks[e]=[]),this.hooks[e].push(t))}once(e,t){if(!e||!t||"function"!=typeof t)return;const s=i=>{t(i),this.off(e,s)};this.on(e,s)}off(e,t){if(e&&this.hooks[e]&&this.hooks[e].length)if(t){const s=this.hooks[e].indexOf(t);-1!==s&&this.hooks[e].splice(s,1)}else this.hooks[e]=[]}emit(e,t){e&&this.hooks[e]&&this.hooks[e].length&&[...this.hooks[e]].forEach((e=>{try{e(t)}catch(e){}}))}}class q{constructor(e){this.ready=!1,this.sdk=e}setLog(e){e&&C(e.log)&&(this._log=e)}setRequest(e){if(C(e)){const t=e(this.sdk);C(t)&&(this._request=t)}}setStorage(e){T(e)&&C(e.get)&&C(e.set)&&C(e.remove)&&(this._storage=e)}check(){this._request&&this._storage&&(this.ready=!0)}log(...e){if(this._log)try{this.sdk.option.get("log")&&this._log.log(...e)}catch(e){}}request(e){var t;if(!this.ready)return Promise.reject();try{return null===(t=this._request)||void 0===t?void 0:t.call(this,e)}catch(e){}}get(e){return this.ready?this._storage.get(e):Promise.reject(null)}set(e,t){return this.ready?this._storage.set(e,t):Promise.reject(!1)}remove(e){return this.ready?this._storage.remove(e):Promise.reject(!1)}}var U;!function(e){e.Init="$init",e.Config="$config",e.Send="$send",e.Ready="$ready",e.TokenComplete="$token-complete",e.TokenStorage="$token-storage",e.TokenFetch="$token-fetch",e.TokenGet="$token-get",e.LaunchComplete="$launch-complete",e.ConfigUuid="$config-uuid",e.ConfigWebId="$config-webid",e.ConfigTransform="$config-transform",e.UuidChangeBefore="$uuid-change-before",e.UuidChangeAfter="$uuid-change-after",e.EnvTransform="$env-transform",e.Event="$event",e.Report="$report",e.AppOpen="$app-open",e.AppClose="$app-close",e.AppShowStart="$app-show-start",e.AppShow="$app-show",e.AppHide="$app-hide",e.AppError="$app-error",e.AppShare="$app-share",e.AppOnShare="$app-on-share",e.PageShow="$page-show",e.PageHide="$page-hide",e.PageShare="$page-share",e.SubmitBefore="$submit-before",e.SubmitAfter="$submit-after",e.SubmitError="$submit-error",e.FilterCrawler="$filter-crawler",e.LaunchInfo="$launch-info",e.AbVar="$ab-var",e.AbAllVars="$ab-all-vars",e.AbExternalVersion="$ab-external-version",e.AbVersionChangeOn="$ab-version-change-on",e.AbVersionChangeOff="$ab-version-change-off",e.AbRefresh="$ab-refresh",e.AbFetchAfter="$ab-fetch-After",e.ProfileSet="$profile-set",e.ProfileSetOnce="$profile-set-once",e.ProfileUnset="$profile-unset",e.ProfileIncrement="$profile-increment",e.ProfileAppend="$profile-append",e.ProfileClear="$profile-clear",e.ProfileSubmitAfter="$profile-submit-after",e.ProfileSubmitError="$profile-submit-error",e.TransformInfo="$transform-info"}(U||(U={}));var D,j=U,R=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));class N{constructor(){this.types=j,this.EventType=P,this.ProfileType=S,this.UtmType=w,this.SdkHook=j,this.inited=!1,this.sended=!1,this.pluginInstances=[],this.data=new Map,this.ready=!1,this.sessionId="",this.env=new A(this),this.option=new $,this.hook=new x,N.instances.push(this);try{this.adapter=new q(this),this.adapter.setLog(N._log),this.adapter.setRequest(N._request),this.adapter.setStorage(N._storage),this.adapter.check(),N.plugins.reduce(((e,t)=>{const{plugin:s}=t;return e.push(new s),e}),this.pluginInstances)}catch(e){}}on(e,t){var s;null===(s=this.hook)||void 0===s||s.on(e,t)}once(e,t){var s;null===(s=this.hook)||void 0===s||s.once(e,t)}off(e,t){var s;!t&&this.types[e]||null===(s=this.hook)||void 0===s||s.off(e,t)}emit(e,t){var s;this.adapter.log(`emit ${e}`,t||""),null===(s=this.hook)||void 0===s||s.emit(e,t)}static useAdapterLog(e){N._log=e}static useAdapterRequest(e){N._request=e}static useAdapterStorage(e){N._storage=e}static usePlugin(e,t){const s=t||e.pluginName;if(s){let t=!1;for(let i=0,n=N.plugins.length;i<n;i++)if(N.plugins[i].name===s){N.plugins[i].plugin=e,t=!0;break}t||N.plugins.push({name:s,plugin:e})}else N.plugins.push({plugin:e});if("function"==typeof e.init)try{e.init(N)}catch(e){}}get appId(){return this._appId}checkUsePlugin(e){return!!N.plugins.find((({name:t})=>t===e))}init(e){if(this.inited||!T(e))return;const{app_id:t,log:s}=e,i=b(e,["app_id","log"]);if(void 0!==s&&this.option.set({log:s}),!(O(t)&&t>0))return void this.adapter.log("app_id invalid");this._appId=t,this.option.set(i),this.env.set({app_id:t}),Promise.all([new Promise((e=>{this.once(j.TokenComplete,(()=>{e(!0)}))})),new Promise((e=>{this.checkUsePlugin("official:auto")?this.on(j.LaunchComplete,(()=>{e(!0)})):e(!0)})),new Promise((e=>{this.sended?e(!0):this.once(j.Send,(()=>{e(!0)}))}))]).then((()=>{this.ready=!0,this.emit(j.Ready)}));const n=this.option.get();this.pluginInstances.forEach((e=>{e.apply(this,n)})),this.get("is-crawler")||(this.inited=!0,this.emit(j.Init),this.sessionId=R(),this.on(j.AppShowStart,(()=>{this.sessionId=R()})))}config(e){if(!this.inited||!T(e))return;this.emit(j.Config,e);const{web_id:t,user_unique_id:s}=e,i=b(e,["web_id","user_unique_id"]);void 0!==t&&this.emit(j.ConfigWebId,t),void 0!==s&&this.emit(j.ConfigUuid,s),this.env.set(i)}send(){this.inited&&!this.sended&&(this.sended=!0,this.emit(j.Send))}event(e,t){if(!this.get("is-crawler"))if(Array.isArray(e)){const t=E(),s=[];e.forEach((e=>{let i,n,o;Array.isArray(e)?[i,n,o]=e:T(e)&&(i=e.event,n=e.params,o=e.local_time_ms),i&&((!O(o)||o<0||o>t)&&(o=t),s.push(this.createEvent({event:i,params:n,time:o})))})),s.length>0&&this.emit(j.Event,s)}else this.emit(j.Event,this.createEvent({event:e,params:t}))}createEvent(e,t=!0){const s=Object.assign({event:e.event,params:e.params||{},local_time_ms:e.time||E()},this.sessionId?{session_id:this.sessionId}:{});if(!t)return s;let i="";const n=this.get("ab_sdk_version");n&&(i+=n);const o=this.get("ab_sdk_version_external");return o&&(i?i+=","+o:i=o),Object.assign(Object.assign({},s),i?{ab_sdk_version:i}:{})}set(e,t){this.data.set(e,t)}get(e){return this.data.get(e)}getKey(e){const t=this.appId;if("ab_version"===e||"ab_version_external"===e)return`__tea_sdk_${e}_${t}`;const s={token:"tokens",report:"reports",event:"events",utm:"utm",first:"first",compensate:"compensate"};return s[e]?`__tea_cache_${s[e]}_${t}`:void 0}getUrl(e){const{option:t,env:s}=this,i=s.get("_sdk_version"),n=(s.get("_sdk_name")||"").replace(/@.+\//,""),o=`${t.get("domain")}${e}?sdk_version=${i}&sdk_name=${n}`,r=t.get("caller");return r?`${o}&app_id=${this.appId}&caller=${r}`:o}getToken(e){if(!e)return new Promise((e=>{this.emit(j.TokenGet,{callback:t=>{e(t)}})}));this.emit(j.TokenGet,{callback:e})}getConfig(e){return this.env.get(e||"header")}stash(e,t={}){const s="stash";this.set(s,[...this.get(s)||[],this.createEvent({event:e,params:t})])}commit(){const e="stash",t=this.get(e)||[];t.length>0&&(this.event(t),this.set(e,[]))}getVar(e,t,s){if(!s)return new Promise((s=>{this.emit(j.AbVar,{name:e,defaultValue:t,callback:e=>{s(e)}})}));this.emit(j.AbVar,{name:e,defaultValue:t,callback:s})}getAllVars(e){if(!e)return new Promise((e=>{this.emit(j.AbAllVars,(t=>{e(t)}))}));this.emit(j.AbAllVars,e)}getAbSdkVersion(){const e=this.get("ab_versions")||[];return e.length>0?e[e.length-1].ab:""}onAbSdkVersionChange(e){return this.emit(j.AbVersionChangeOn,e),()=>{this.emit(j.AbVersionChangeOff,e)}}offAbSdkVersionChange(e){this.emit(j.AbVersionChangeOff,e)}setExternalAbVersion(e){this.emit(j.AbExternalVersion,"string"==typeof e&&e?`${e}`.trim():null)}getAbConfig(e,t){if(!t)return new Promise((t=>{this.emit(j.AbRefresh,{params:e,callback:e=>{t(e)}})}));this.emit(j.AbRefresh,{params:e,callback:t})}profileSet(e){this.emit(j.ProfileSet,e)}profileSetOnce(e){this.emit(j.ProfileSetOnce,e)}profileUnset(e){this.emit(j.ProfileUnset,e)}profileIncrement(e){this.emit(j.ProfileIncrement,e)}profileAppend(e){this.emit(j.ProfileAppend,e)}autoInitializationRangers(e){const{onTokenReady:t}=e,s=b(e,["onTokenReady"]);return this.init(Object.assign(Object.assign({},s),{log:!1,enable_third:!0})),this.send(),this.getToken().then((e=>{const{web_id:s}=e;try{if("function"==typeof t)return void t(`${s}`)}catch(e){}return`${s}`}))}}N.plugins=[],N.instances=[];class V{apply(e,t){e.env.set({sdk_version:"3.0.0",_sdk_version:"3.0.0",_sdk_name:"@dp/tea-sdk-common"})}}V.pluginName="official:info",function(e){e.Default="default",e.Custom="custom"}(D||(D={}));class L{constructor(e,t){this.wrap=e,this.sdk=t,this.url="/webid/"}storageNoData(){this.fetch()}storageHasData(e){return this.wrap.dataComplete(e)}fetch(){const{adapter:e,appId:t}=this.sdk;e.request({url:this.sdk.getUrl(`${this.url}`),method:"POST",data:{app_id:t,url:"-",user_agent:"-",referer:"-",user_unique_id:""}}).then((t=>{try{const{data:{e:s=-1e4,web_id:i=""}={}}=t;if(0===s)return void this.fetchComplete(i);e.log("parse web_id error",s)}catch(t){e.log("parse web_id error",t)}this.fetchComplete()})).catch((t=>{this.fetchComplete(),e.log("fetch web_id error",t)}))}fetchComplete(e){e&&this.wrap.webIdComplete(e)}storageComplete(e){if(e)try{if(e[this.wrap.typeKey]===D.Default){const t=this.storageHasData(e);this.wrap.complete(t)}else this.storageNoData()}catch(e){}else this.storageNoData()}}class W{constructor(e,t){this.wrap=e,this.sdk=t,this.sdk.on(this.sdk.types.ConfigWebId,(e=>{e=`${e}`,this.wrap.tokenComplete?this.waitComplete(e):this.waitResolve?this.waitResolve(e):this.tmpWebId=e}))}storageNoData(){this.wait()}storageHasData(e){return this.wrap.dataComplete(e,this.tmpWebId)}wait(){new Promise((e=>{void 0!==this.tmpWebId?(e(this.tmpWebId),this.tmpWebId=void 0):this.waitResolve=e})).then((e=>{this.waitComplete(e)}))}waitComplete(e){this.wrap.webIdComplete(e)}storageComplete(e){if(e)try{if(e[this.wrap.typeKey]===D.Custom){const t=this.storageHasData(e);this.wrap.complete(t)}else this.storageNoData()}catch(e){}else this.storageNoData()}}class F{constructor(){this.tokenComplete=!1,this.tobid="",this.tobidUrl="/tobid/",this.tobidKey="",this.isCustom=!1,this.typeKey="_type_"}apply(e,t){this.sdk=e,this.options=t,this.key=this.sdk.getKey("token"),this.tobidKey="diss".split("").reverse().join(""),this.options.enable_custom_webid?(this.isCustom=!0,this.token=new W(this,this.sdk)):(this.isCustom=!1,this.token=new L(this,this.sdk));const{types:s}=this.sdk;this.sdk.on(s.ConfigUuid,(e=>{this.setUserUniqueId(e)})),this.sdk.on(s.TokenGet,(({callback:e})=>{const t=()=>{this.fetchTobid().then((()=>{const t=this.sdk.env.get("user"),s=Object.assign(Object.assign({},t),{web_id:this.webId,user_unique_id:this.userUniqueId});s[this.tobidKey]=this.tobid,"function"==typeof e&&e(s)}))};this.sdk.ready?t():this.sdk.once(s.Ready,(()=>{t()}))})),this.storage()}storage(){const{adapter:e}=this.sdk;e.get(this.key).then((t=>{T(t)&&t.web_id?(t[this.typeKey]&&!t[this.tobidKey]&&t.user_unique_id||(t={web_id:t.web_id,user_unique_id:t.user_unique_id||t.web_id},e.set(this.key,t)),this.storageComplete(t)):this.storageComplete(null)})).catch((t=>{this.storageComplete(null),e.log("get token error",t)}))}storageComplete(e){this.token.storageComplete(e)}dataComplete(e,t){let s=e.web_id;void 0!==t&&t!==s&&(s=t),this.webId=s;let i=e.web_id===e.user_unique_id?s:e.user_unique_id;return void 0!==this.tmpUserUniqueId&&this.tmpUserUniqueId!==i&&(i=this.tmpUserUniqueId?this.tmpUserUniqueId:s,this.tmpUserUniqueId=void 0),this.userUniqueId=i,s!==e.web_id||i!==e.user_unique_id}webIdComplete(e){this.webId=e,this.tmpUserUniqueId?(this.userUniqueId=this.tmpUserUniqueId,this.tmpUserUniqueId=void 0):this.userUniqueId=e,this.complete(!0)}complete(e=!1){const{types:t}=this.sdk,s={web_id:this.webId,user_unique_id:this.userUniqueId,[this.typeKey]:this.isCustom?D.Custom:D.Default};this.sdk.env.set(s),e&&this.sdk.adapter.set(this.key,s),this.tokenComplete=!0,this.sdk.emit(t.TokenComplete)}setUserUniqueId(e){const{adapter:t,env:s,types:i}=this.sdk;if(this.tokenComplete){if(this.userUniqueId===e)return;this.sdk.emit(i.UuidChangeBefore),this.userUniqueId=e||this.webId,s.set({user_unique_id:this.userUniqueId});const n={web_id:this.webId,user_unique_id:this.userUniqueId,[this.typeKey]:this.isCustom?D.Custom:D.Default};t.set(this.key,n),this.sdk.emit(i.UuidChangeAfter)}else this.tmpUserUniqueId=e}fetchTobid(){const{adapter:e,appId:t}=this.sdk;return e.request({url:this.sdk.getUrl(`${this.tobidUrl}`),method:"POST",data:{app_id:t,web_id:this.webId,user_unique_id:this.userUniqueId}}).then((e=>{try{const{data:{e:t=-1e4,tobid:s=""}={}}=e;if(0===t)return void(this.tobid=s)}catch(e){}})).catch((t=>{e.log("fetch tobid error",t)}))}}F.pluginName="official:token";class M{constructor(){this.url="/list/",this.cache=[]}apply(e,t){this.sdk=e,this.options=t,this.key=this.sdk.getKey("report"),this.reportUrl=this.sdk.getUrl(`${this.url}`),this.sdk.set("report_url",this.reportUrl);const{types:s}=this.sdk;this.sdk.on(s.Report,(e=>{Array.isArray(e)||(e=[e]),this.sdk.ready?this.report(e):e.forEach((e=>this.cache.push(e)))})),this.sdk.on(s.Ready,(()=>{this.cache.length>0&&(this.report([...this.cache]),this.cache.length=0)}));const{adapter:i}=this.sdk;this.sdk.on(s.AppOpen,(()=>{i.get(this.key).then((()=>{}))})),this.sdk.on(s.AppClose,(()=>{this.cache.length>0&&(i.set(this.key,[...this.cache]),this.cache.length=0)}))}report(e){this.submit(e)}submit(e){const{types:t}=this.sdk;this.sdk.emit(t.SubmitBefore,e),this.sdk.adapter.request({url:this.reportUrl,method:"POST",data:e}).then((s=>{this.sdk.emit(t.SubmitAfter,{isError:!1,response:s,event:e})})).catch((s=>{this.sdk.emit(t.SubmitAfter,{isError:!0,error:s,event:e}),this.sdk.emit(t.SubmitError,{event:e})}))}}M.pluginName="official:report";class K{constructor(){this.buffer=[],this.timer=0,this.unReadyCache=[]}apply(e,t){var s,i;this.sdk=e,this.options=t,this.enable=!!this.options.enable_buffer;const n=!0===this.options.enable_storage||!1===this.options.disable_storage;if(n&&(this.enable=!0),this.enable){this.interval=this.options.buffer_interval,this.number=this.options.buffer_number,n&&((null===(s=this.options)||void 0===s?void 0:s.report_interval)>0&&(this.interval=this.options.report_interval),(null===(i=this.options)||void 0===i?void 0:i.max_batch_event)>0&&(this.number=this.options.max_batch_event));try{this.interval=Number(this.interval),this.number=Number(this.number)}catch(e){}}this.sdk.set("enable_storage",this.enable);const{types:o}=this.sdk;this.sdk.on(o.Event,(e=>{this.sdk.ready?this.process(Array.isArray(e)?e:[e]):this.unReadyCache=[...this.unReadyCache,...Array.isArray(e)?e:[e]]})),this.sdk.on(o.Ready,(()=>{this.unReadyCache.length>0&&(this.process(this.unReadyCache),this.unReadyCache=[])})),this.sdk.on(o.AppClose,(()=>{this.buffer.length>0&&(this.report(this.buffer),this.buffer.length=0)}))}process(e){const t=this.sdk.env.compose(e);this.enable?(this.buffer=[...this.buffer,t],this.refresh()):this.report(t)}refresh(){this.timer&&clearTimeout(this.timer),this.buffer.length>=this.number?(this.report([...this.buffer]),this.buffer.length=0):this.timer=setTimeout((()=>{this.report([...this.buffer]),this.buffer.length=0}),this.interval)}report(e){this.sdk.emit(this.sdk.types.Report,e)}}K.pluginName="official:buffer";class B{apply(e,t){this.sdk=e,this.options=t;const{types:s,env:i}=this.sdk,n=(()=>{try{const e=(new Date).getTimezoneOffset();return{timezone:Math.floor(Math.abs(e)/60),offset:60*e}}catch(e){return{timezone:8,offset:-28800}}})();i.set({timezone:n.timezone,tz_offset:n.offset}),this.sdk.on(s.ConfigTransform,(e=>{if(void 0!==e.gender&&([1,2,"1","2"].includes(e.gender)?e.gender=e.gender<2?"male":"female":delete e.gender),this.options.enable_profile){const t={};["nick_name","gender","avatar_url"].forEach((s=>{void 0!==e[s]&&(t[s]=e[s],delete e[s])})),this.sdk.emit(s.ProfileSet,t)}})),this.sdk.on(s.EnvTransform,(e=>{if(this.options.enable_profile){const t={};["$mp_from_uuid"].forEach((s=>{void 0!==e[s]&&(t[s]=e[s],delete e[s])})),Object.keys(t).length>0&&this.sdk.emit(s.ProfileSetOnce,t)}}))}}B.pluginName="official:transform",N.usePlugin(V),N.usePlugin(F),N.usePlugin(M),N.usePlugin(K),N.usePlugin(B);var H=console;let z="undefined";const G=()=>("undefined"!==z||(z="undefined"!=typeof tt?{target:tt,config:"undefined"!=typeof __ttConfig?__ttConfig:null,customPlatform:"ttMiniProduct",mpPlatform:2,is:"tt"}:"undefined"!=typeof my?{target:my,config:null,customPlatform:"aliMiniProduct",mpPlatform:1,is:"my"}:"undefined"!=typeof swan?{target:swan,config:null,customPlatform:"swanMiniProduct",mpPlatform:5,is:"swan"}:"undefined"!=typeof qq?{target:qq,config:"undefined"!=typeof __qqConfig?__qqConfig:null,customPlatform:"qqMiniProduct",mpPlatform:6,is:"qq"}:"undefined"!=typeof wx?{target:wx,config:"undefined"!=typeof __wxConfig?__wxConfig:null,customPlatform:"miniProduct",mpPlatform:0,is:"wx"}:"undefined"!=typeof uni?{target:uni,config:null,customPlatform:"uniMiniProduct",mpPlatform:7,is:"uni"}:{target:{},config:null,customPlatform:"",mpPlatform:-1,is:""}),z),J=G();var Y="my"===J.is?e=>t=>{const s=t.timeout||e.option.get("request_timeout"),i="number"==typeof s&&s>0;return new Promise(((e,n)=>{const o=my[my.request?"request":"httpRequest"](Object.assign(Object.assign({},t),{dataType:t.dataType||"json",success:t=>{e(t)},fail:e=>{n(e)}}));i&&setTimeout((()=>{try{o&&o.abort()}catch(e){}}),s)}))}:J.target?((e,t=!1)=>s=>i=>{const n=i.timeout||s.option.get("request_timeout"),o="number"==typeof n&&n>0;return new Promise(((s,r)=>{const a=e.request(Object.assign(Object.assign(Object.assign({},i),o&&!t?{timeout:n}:{}),{dataType:i.dataType||"json",success:e=>{s(e)},fail:e=>{r(e)}}));o&&t&&setTimeout((()=>{try{a&&a.abort()}catch(e){}}),n)}))})(J.target,"swan"===J.is):e=>e=>Promise.reject("request adapter error");const X=G();var Q="my"===X.is?new class{get(e){return new Promise(((t,s)=>{try{t(my.getStorageSync({key:e}).data)}catch(e){s(e)}}))}set(e,t){return new Promise(((s,i)=>{try{my.setStorageSync({key:e,data:t}),s(!0)}catch(e){i(!1)}}))}remove(e){return new Promise(((t,s)=>{try{my.removeStorageSync({key:e}),t(!0)}catch(e){s(!1)}}))}}:X.target?new class{constructor(e){this.target=e}get(e){return new Promise(((t,s)=>{try{t(this.target.getStorageSync(e))}catch(e){s(e)}}))}set(e,t){return new Promise(((s,i)=>{try{this.target.setStorageSync(e,t),s(!0)}catch(e){i(!1)}}))}remove(e){return new Promise(((t,s)=>{try{this.target.removeStorageSync(e),t(!0)}catch(e){s(!1)}}))}}(X.target):(()=>{const e="storage adapter error";return{get:t=>Promise.reject(e),set:(t,s)=>Promise.reject(e),remove:t=>Promise.reject(e)}})();class Z{apply(e,t){this.sdk=e,this.options=t,this.boost();const{types:s}=this.sdk;this.getInfo(),this.sdk.on(s.AppOpen,(()=>{this.getInfo()}))}boost(){}getInfo(){const e=this,{target:t,env:s}=this.sdk;t&&(t.getSystemInfo&&t.getSystemInfo({success(t){const i=Math.ceil(t.screenWidth),n=Math.ceil(t.screenHeight),o={device_brand:t.brand,device_model:t.model,os_version:t.system,os_name:t.platform,platform:t.platform,resolution:`${i}x${n}`,screen_width:i,screen_height:n};e.overlap(t,o),s.set(o)}}),t.getNetworkType&&t.getNetworkType({success(e){const t={access:e.networkType};s.set(t)}}))}overlap(e,t){t.language=e.language,t.mp_platform_app_version=e.version,t.mp_platform_basic_version=e.SDKVersion}}Z.pluginName="official:device",N.useAdapterLog(H),N.useAdapterRequest(Y),N.useAdapterStorage(Q),N.usePlugin(class extends Z{static init(e){const t=G();e.platform=t.is?t.target:null,e.platformIs=t.is}boost(){super.boost(),this.which=G(),this.sdk.target=this.which.target,this.sdk.targetEnvConfig=this.which.config,this.sdk.env.set({sdk_lib:"mp_common",custom_platform:this.which.customPlatform,mp_platform:this.which.mpPlatform})}overlap(e,t){super.overlap(e,t)}});class ee{apply(e,t){const{event_verify_url:s}=t;if(!s)return;const{adapter:i,types:n}=e;e.on(n.SubmitBefore,(e=>{i.request({url:`${`${s}`.replace(/\/+$/,"")}/v1/list_test`,method:"POST",data:e}).catch((()=>{}))}))}}ee.pluginName="official:et",N.usePlugin(ee);let te=null,se="",ie=!1;const ne={get TEA(){return te},get webId(){return se},init(e,t){if(!te){te=new N;const s={app_id:488781,log:!1,channel:"cn"};Object.keys(e).forEach((t=>{s[t]=e[t]})),t&&(s.app_id=t),ie=s.log,te.init(s),te.on("$token-complete",(()=>{se=te.env.get("user_unique_id"),ie&&console.log("TEA_SDK_token-complete",se)})),ie&&console.log("TEA_SDK_INIT",s,te)}const s={app_name:"微信小程序",app_version:"1.0.0"};["app_name","app_version","user_unique_id","device_id"].forEach((t=>{e[t]&&(s[t]=e[t])})),ie&&console.log("TEA_SDK_CONFIG",s),te.config(s),te.send()},config(e={}){ie&&console.log("TEA_SDK_CONFIG",e),te.config(e)},event(e,t={}){te.event(e,t)}};class oe extends y{}oe.uploader=ne;let re=null;"undefined"!=typeof tt?re=tt:"undefined"!=typeof wx&&(re=wx),e.DefaultCollector=oe,e.default=oe,e.initCollector=function(e={appVersion:"1.0.0",appName:"视频云小程序",appId:0,userId:0,needET:!1,log:!1}){if(re&&(re.__COLLECTOR__=y,re.__COLLECTOR_INFO__={lineAppId:e.appId,lineUserId:e.userId||0},re.__COLLECTOR__&&re.__COLLECTOR__.uploader)){const t={log:e.log,app_name:e.appName||"视频云微信小程序",app_version:e.appVersion||"1.0.0",user_unique_id:e.userId||"",channel_domain:e.channelDomain};e.channelDomain&&(t.channel_domain=e.channelDomain),e.needET&&(t.event_verify_url=e.verifyUrl||"https:xx.xx.com"),e.log&&(t.log=e.log),re.__COLLECTOR__.uploader.init(t)}},e.setUserId=function(e){e&&y.uploader.config({user_unique_id:e})},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).XGAppletsLogger={})}(this,(function(e){"use strict";const t="videoplayer_oneplay",s=0,i={PLAY:"play",PAUSE:"pause",TIME_UPDATE:"timeupdate",ENDED:"ended",WAITING:"waiting",PROGRESS:"progress",LOADED_META_DATA:"loadedmetadata",SEEK_COMPLETE:"seekcomplete",ERROR:"error",PLAYBACK_RATECHANGE:"playbackratechange",MUTE_CHANGE:"mutechange",SRC_CHANGE:"srcchange",DETACHED:"detached",PAGE_UNLOAD:"pageunload",READY:"ready",BREAK:"break"},n={pause:"onPause",play:"onPlay",ended:"onEnded",timeupdate:"onTimeupdate",waiting:"onWaiting",progress:"onProgress",loadedmetadata:"onLoadedmetadata",seekcomplete:"onSeekComplete",error:"onError",playbackratechange:"onPlaybackRatechange",mutechange:"onMuteChange",srcchange:"onSrcChange",detached:"onDetached",pageunload:"onPageUnload",ready:"onReady",break:"onBreak",active:"onActive"},o="unknown",r="default",a="active",h="standby";class d{constructor(){this.initData={bitrate:0,codecType:o,vtype:o,sourceType:o,vid:"",src:"",albumId:"",episodeId:"",isVideoPlayer:!1,autoplay:!1,muted:!1,loop:!1,volume:1,playbackRate:1,initialTime:0},this.currentTime=0,this.duration=0,this.paused=!1,this.ended=!1,this.videoWidth=0,this.videoHeight=0,this.buffered=0,this.bufferedTime=0,this._error={code:0,type:0,message:""},this.wait={count:0,time:0,cost:0,firstBuffer:0,lastBuffer:0,firstTime:0,lastTime:0},this.seek={count:0,time:0,cost:0,lastBuffer:0,firstTime:0,lastTime:0,seekedTime:0},this.firstFrame={ntState:"",nt:0,vt:0,vtState:"",pt:0,ptState:"",et:0,lt:0,lpt:0,fvt:0,bft:0,bftCost:0,nvt:0},this.accPlayed={t:0,acc:0,loopAcc:0},this.pauseInfo={acuTime:0},this.playInfo={loopCount:0,playCount:0},this.resolution={init:"",final:""},this.useAction={},this.activeState=r,this.isActive=-1}getIsActive(){return this.activeState===h?0:this.activeState===a?2:1}set error(e){this._error=e}get error(){return this._error}_resetObj(e){Object.keys(e).forEach((t=>{const s=typeof e[t];"number"===s?e[t]=0:"string"===s?e[t]="":"boolean"===s&&(e[t]=!1)}))}resetOnEnded(){["wait","seek","firstFrame","pauseInfo"].forEach((e=>{const t=this[e];Object.keys(t).forEach((e=>{t[e]=0}))})),this.accPlayed.acc=0,this.accPlayed.t=0}set(e){const{initData:t}=this;Object.keys(t).forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),this.initData=t}reset(){Object.keys(this).forEach((e=>{const t=typeof this[e];"number"===t?this[e]=0:"string"===t?this[e]="":"boolean"===t?this[e]=!1:"object"===t&&null!==this[e]&&this._resetObj(this[e])}))}}function c(){return(new Date).getTime()}function p(e){if(null==e||""===e||"string"!=typeof e)return"";const t=e.split("/");let s="";return t.length>3&&t[2]&&(s=t[2]),s}const l=[{key:"480",s:480,e:576},{key:"540",s:576,e:720},{key:"720",s:720,e:1080},{key:"1080",s:1080,e:1920}];const u=2,f=1,m={appletsId:-1,appType:"",baseVersion:"",aVersion:""},g={brand:"",markLevel:0,model:"",system:"",platform:"",cpuType:"",memorySize:0};!function(){if("undefined"!=typeof wx&&"function"==typeof wx.getDeviceInfo){m.appType="wechat",m.appletsId=f;try{const e=wx.getAppBaseInfo();m.baseVersion=e.SDKVersion,m.aVersion=e.version}catch(e){}try{const e=wx.getDeviceInfo();g.cpuType=e.cpuType||"",g.memorySize=Number(e.memorySize)||0,g.system=e.system,g.brand=e.brand,g.model=e.model,g.markLevel=e.benchmarkLevel||0}catch(e){}}else if("undefined"!=typeof tt&&"function"==typeof tt.getSystemInfo){m.appType="douyin",m.appletsId=u;try{tt.getSystemInfo({success:e=>{e&&(m.appType=e.appName,m.baseVersion=e.SDKVersion,m.aVersion=e.version,g.system=e.system,g.platform=e.platform,g.brand=e.brand,g.model=e.model)}})}catch(e){}try{const e=tt.getDeviceInfoSync?tt.getDeviceInfoSync():{};g.cpuType=e.CPUType||"",g.memorySize=Number(e.memorySize)||0,g.markLevel=e.benchmarkLevel||0}catch(e){}}}();let _=null;const v="1.2.11-rc.2";class y{static get EVENTS(){return i}static set uploader(e){_=e}static get uploader(){return _}static get version(){return v}static getDefaultConfig(){return{playType:0,sourceType:"",playerVersion:"",lineAppId:0,lineUserId:0,vtype:"MP4",codecType:"h264",bitrate:0,vid:"",tag:"",subTag:"",logger:!1}}static get deviceInfo(){return g}static get envInfo(){return m}constructor(e={}){this._tm=c(),this._eventlTime=0,this._eventsTime=0,this._pEvents=[],this._hasTimeupdate=!1,this.videoInfo=new d,this.config=y.getDefaultConfig(),e.config&&this.setConfig(e.config),e.videoInfo&&this.setVideoInfo(e.videoInfo),this.setNt("new"),this.isStartPlay=!1,this.waitingStart=0,this.pauseStart=0,this.isOnePlaySend=!1,this.loadState=s,this.playbackState=0,this._sessionId=this.getSessionId(),this.setEnvParams(m,g),this.curWaitInfo={type:-1,cost:-1,time:-1,bufferedTime:0,currentTime:0}}log(e,...t){if(this.config.logger){const s=c();console.log(`[Collector][${m.appletsId}][${s-this._tm}]${e}`,...t),this._tm=s}}setConfig(e={}){Object.keys(e).forEach((t=>{this.config[t]=e[t]})),this.setCommendParams()}setVideoInfo(e={}){this.log("setVideoInfo",e.activeState,e),this.videoInfo.set(e)}trigger(e,t,s){const i=n[e];i&&this[i]?this[i](t,s):console.warn("evenName not exist",e,n[e])}reset(){this.videoInfo.reset(),this.log("videoInfo reset",this.videoInfo.buffered),this.curWaitInfo={type:-1,cost:-1,time:-1,bufferedTime:0,currentTime:0},this.isStartPlay=!1,this.waitingStart=0,this.pauseStart=0,this.isOnePlaySend=!1,this._hasTimeupdate=!1,this._eventsTime=0,this._eventlTime=0,this._pEvents=[]}setCommendParams(){const{config:e}=this,t=e.codecType||"h264";this.commendParams={session_id:this.getSessionId(),play_type:e.playType,source_type:e.sourceType,sdk_version:v,line_app_id:e.lineAppId,line_user_id:e.lineUserId||_.webId,vtype:e.vtype,codec_type:t.toLocaleLowerCase(),v:e.vid||"",bitrate:e.bitrate||0,tag:e.tag||"",subtag:e.subTag||"",log_type:e.logType||"video_playq"}}setEnvParams(e,t){this.envParams={app_type:e.appType,base_version:e.baseVersion,a_version:e.aVersion,memory_size:t.memorySize,cpu_type:t.cpuType,model:t.model,brand:t.brand,mark_level:t.markLevel,pc:e.baseVersion,pv:e.aVersion}}getSessionId(){if(!this._sessionId){const e=_.webId||"";this._sessionId=function(e){let t=(new Date).getTime();try{e=parseInt(e)}catch(t){e=0}t+=e,t+=(new Date).getSeconds();const s="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const s=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?s:3&s|8).toString(16)}));return s}(e)}return this.log("getSessionId111",this._sessionId),this._sessionId}onPause(e,t={}){this.log("onPause",e.type,e.detail),this.pauseStart=c(),this.videoInfo.paused=!0,this.updateAcc("pause"),this.susSpendWait("pause"),this.pushEvents("pause")}onPlay(e,t={}){this.isStartPlay||(this.isStartPlay=!0);const{videoInfo:s}=this;this.log("onPlay",`ended:${s.ended} vt:${s.firstFrame.vt} pt:${s.firstFrame.pt}`),s.ended&&this.resetEnded("play"),this.setPt("play"),this.pushEvents("play"),this.pauseStart&&(s.pauseInfo.acuTime+=c()-this.pauseStart,this.pauseStart=0),s.error&&!s.error.code||(s.error={code:0,type:0,message:""}),s.paused&&(s.paused=!1),s.accPlayed.t||(s.accPlayed.t=c()),s.playInfo.playCount++}onEnded(e,t={}){this.log("onEnded",e.type,e.detail,this.videoInfo.firstFrame.pt,this.videoInfo.firstFrame.vt),this.videoInfo.ended=!0,this.videoInfo.firstFrame.et=c(),this.updateAcc("ended"),this.pushEvents("ended"),this.sendOnePlay("ended")}onTimeupdate(e,t={}){const{videoInfo:s}=this,{detail:i}=e,{accPlayed:n}=s;s.currentTime=i.currentTime,s.duration=i.duration,n.t||s.paused||s.ended||(n.t=c()),!this._hasTimeupdate&&s.duration>0&&(this.pushEvents("timeupdate",{curt:i.currentTime,d:s.duration}),this._hasTimeupdate=!0),this.susSpendWait("timeupdate")}onWaiting(e,t={}){this.log("onWaiting",e.type,e.detail);const{firstFrame:s,currentTime:i,bufferedTime:n}=this.videoInfo;this.pushEvents("waiting",{curt:i,bf:n,diff:i-n}),s.pt||this.setPt("waiting"),this.updateAcc("waiting"),s.vt&&(this.waitingStart=c(),this.curWaitInfo.currentTime=i,this.curWaitInfo.bufferedTime=n)}onProgress(e,t={}){const{detail:s}=e,{videoInfo:i}=this,n=parseInt(100*s.buffered,10)/100;i.ended&&this.resetEnded("progress"),!this._hasTimeupdate&&this.pushEvents("progress",{bf:n}),i.firstFrame.pt||this.setPt("progress"),s.buffered>=1&&this.setVt("progress"),s.buffered>0&&(i.buffered=parseInt(100*s.buffered,10)/100,i.bufferedTime=s.buffered*i.duration/100),s.buffered>=100&&this.setBft(s)}onLoadedmetadata(e,t){const{detail:s}=e,{videoInfo:i}=this;if(m.appletsId===u&&i.ended&&this.resetEnded("loadedmetadata"),this.pushEvents("loadedmetadata",{bf:i.buffered}),i.duration=s.duration||0,i.videoWidth=s.width,i.videoHeight=s.height,this.log("onLoadedmetadata",this.isStartPlay,`duration:${s.duration} buffered:${i.buffered} ended: ${i.ended}`),i.videoWidth>0&&i.videoHeight>0){const e=function(e,t){const s=e>t?t:e,i=l.length;if(s<=l[0].s)return l[0].key;if(s>=l[i-1].s)return l[i-1].key;for(let e=0;e<l.length;e++)if(s>=l[e].s&&s<l[e].e)return l[e].key}(i.videoWidth,i.videoHeight);i.resolution.final=i.resolution.init=e}i.firstFrame.pt||this.setPt("loadedmetadata"),(i.buffered>=1||m.appletsId===f)&&this.setVt("loadedmetadata")}onSeekComplete(e,t){this.log("onSeekComplete",this.waitingStart,e),this.susSpendWait("seeked"),this.pushEvents("seekcomplete");const{firstFrame:s}=this.videoInfo;s.pt&&!s.vt&&this.setVt("seekcomplete")}onError(e,t){this.log("onError",e,t);const{detail:s,code:i,message:n}=e,o=s&&s.code?s.code:5001,r=s&&s.message?s.message:n;this.videoInfo.error={code:i||o,type:1004,message:r||(s?s.errMsg:"unknown")},this.setPt("error"),this.pushEvents("error"),this.updateAcc("error"),this.susSpendWait("error"),this.sendOnePlay("error"),this.reset("error")}onReady(){this.log("onReady"),this.setNt("ready"),this.pushEvents("ready")}onSrcChange(e,t){this.log("onSrcChange",e,t),this.setLt("srcChange"),this.pushEvents("src_change"),this.sendOnePlay("src_change"),this.reset()}onActive(e){const{videoInfo:t}=this,s=t.activeState,{activeState:i,isActive:n}=e;this.log("onActive",`activeState: new ${i} old:${s} isActive:${n}`),i!==s&&("boolean"==typeof n?t.isActive=n?2:1:s===a&&i===h?(this.sendOnePlay("activechange"),this.reset(),t.activeState=i):t.activeState=i)}onBreak(){this.log("onBreak"),this.updateAcc("break"),this.pushEvents("break"),this.sendOnePlay("break"),this.reset()}onDetached(e,t){this.log("onDetached",e,t),this.setLt("detached"),this.pushEvents("detached"),this.sendOnePlay("detached")}onPageUnload(e,t){this.log("onPageUnload",e,t),this.setLt("pageunload"),this.pushEvents("pageunload"),this.sendOnePlay("page_unload")}onPlaybackRatechange(e,t){this.log("onPlaybackRatechange",e,t),this.videoInfo.playbackRate=e.detail.playbackRate||1}onMuteChange(e,t){this.log("onMuteChange",e,t),this.videoInfo.muted=e.isMuted}onFullscreenchange(e,t){this.log("onFullscreenchange",e,t)}onLeavepictureinpicture(e,t){this.log("onLeavepictureinpicture",e,e)}onEnterpictureinpicture(e,t){this.log("onEnterpictureinpicture",e,e)}resetEnded(e){const{videoInfo:t}=this;if(!t)return;const{firstFrame:s}=t;this.log(`resetEnded>${e} pt:${s.pt} nt:${s.nt} fvt:${s.fvt}`),this.isOnePlaySend&&(this.isOnePlaySend=!1),this._hasTimeupdate=!1,this._pEvents=[],t.resetOnEnded(),t.ended=!1,t.playInfo.loopCount++}pushEvents(e,t){const s=c();!this._eventlTime&&(this._eventlTime=s),!this._eventsTime&&(this._eventsTime=s);const{_pEvents:i}=this,n=i.length-1;if(n>=0&&i[n].e===e){const e=i[n];i[n]={...e,nt:s-this._eventlTime,ct:s-this._eventsTime+e.ct,...t}}else this._pEvents.push({e:e,nt:s-this._eventlTime,ct:s-this._eventsTime,...t});this.log("pushEvents",e,t,this._pEvents),this._eventsTime=s}setNt(e){const{firstFrame:t}=this.videoInfo;t.pt||(this.log(`setNt: nt>${e} nt:${t.nt}`),t.nt=c(),t.ntState=e)}setPt(e){const{firstFrame:t}=this.videoInfo;t.pt||(t.nt||this.setNt(e),t.pt=c(),t.ptState=e,this.log(`setPt>${e} pt:${t.pt} nt:${t.nt} fvt:${t.fvt}`))}setVt(e){const{firstFrame:t}=this.videoInfo;if(t.vt)return;const s=c();t.nt||(t.nt=s),t.pt||(t.pt=s),t.vt=s,t.vtState=e,t.fvt=s-t.pt,t.nvt=s-t.nt,0===t.fvt&&(t.fvt=1),this.log(`setVt: ${e} pt>${t.pt} vt:${t.vt} fvt:${t.fvt} nvt:${t.nvt}`)}setLt(e){const{firstFrame:t}=this.videoInfo;if(!t.vt){const s=c();t.lt=s,t.lpt=s-t.pt,this.log(`setLt: endType:${e} vt:${t.vt} pt:${t.pt} lt:${t.lt}\n lpt:${t.lpt}`)}}setBft(e){const{firstFrame:t}=this.videoInfo;if(e.buffered>=100&&!t.bft){const e=c();t.bft=e,t.bftCost=e-t.pt,this.log("setBft:",`bft:${t.bft} bftCost:${t.bftCost}`)}}updateAcc(e,t=!1){const{accPlayed:s}=this.videoInfo;if(s.t){const t=c()-s.t;s.acc+=t,s.t=0,("ended"===e||this.videoInfo.ended)&&(s.loopAcc=s.acc)}}susSpendWait(e){const{curWaitInfo:t,videoInfo:s}=this;if(t.type>-1){this.log("susSpendWait update",e,this.waitingStart,s.currentTime,t);let i=null;"seeked"===e?(i=s.seek,i.seekedTime=s.currentTime):i=s.wait,0===i.count&&(i.firstTime=t.currentTime,i.firstBuffer=t.bufferedTime),i.lastTime=t.currentTime,i.lastBuffer=t.bufferedTime,i.count++,i.time+=t.cost,i.cost=t.cost,this.curWaitInfo={type:-1,cost:-1,currentTime:-1,bufferedTime:0},this.log("susSpendWait after waiting",s.wait,s.seek)}if(this.waitingStart){const e=c()-this.waitingStart;t.cost=e,t.type=0,this.waitingStart=0}}sendOnePlay(e){const{videoInfo:s}=this,{firstFrame:i,seek:n,wait:o,playInfo:r,pauseInfo:a,accPlayed:h,error:d,resolution:l,initData:u}=s;if(this.log(`sendOnePlay: ${e} pt:${i.pt} isOnePlaySend:${this.isOnePlaySend}`),this.isOnePlaySend||!i.pt)return;const f=h.acc;this._sessionId||(this.commendParams.session_id=this.getSessionId()),this.isOnePlaySend=!0,this.envParams.a_version||this.setEnvParams(m,g);const _={...this.commendParams,...this.envParams,initial_url:u.src,initial_host:p(u.src),pt:i.pt,vt:i.vt,et:i.et,lt:i.lt,bft:i.bft,fvt:i.fvt,nvt:i.nvt,lpt:i.lpt,sc:n.count,bc:o.count,first_buf_startt:parseInt(o.firstTime,10),first_buf_endt:parseInt(o.lastTime,10),lc:r.loopCount,sat:n.time,bu_acu_t:o.time,pause_acu_t:a.acuTime,cur_play_pos:parseInt(1e3*s.currentTime,10),load_state:this.loadState,playback_state:0|this.playbackState,watch_dur:f>432e5?0:f,switch_resolution_c:0,is_start_play_automatically:s.autoplay?1:0,start_time:u.initialTime||0,finish:s.ended?1:0,errt:d?d.type:0,errc:d?d.code:0,message:d?d.message:"",vsc:0,vsc_message:"",width:s.videoWidth,height:s.videoHeight,vd:parseInt(1e3*s.duration,10),play_c:r.playCount,player_created_t:this.player_created_t||0,mute:u.muted?1:0,volume:u.volume,prepare_start_time:i.nt,prepare_end_time:i.rt||c(),play_speed:u.playbackRate,end_state:e,initial_resolution:l.init,final_resolution:l.final,vt_state:i.vtState,pt_state:i.ptState,nt_state:i.ntState,is_active:s.getIsActive(),ext:JSON.stringify(this._pEvents),album_id:u.albumId,episode_id:u.episodeId,is_video_player:u.isVideoPlayer};this._params=_,this.log("REPORT_EVENTS.ONE_PLAY",this._pEvents,_),this.sendLog(t,_)}sendLog(e,t){const s={...this.commendParams,...this.envParams,...t};_&&_.event(e,s),this.emit(e,s)}emit(e,t,...s){}on(e,t,...s){}once(e,t,...s){}off(e,t,...s){}offAll(){}destroy(){this.offAll(),this.videoInfo=null}}function b(e,t){var s={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(s[i[n]]=e[i[n]])}return s}const k=void 0;let I={};I={cn:"https://mcs.zijieapi.com",va:"https://maliva-mcs.byteoversea.com",sg:"https://sgali-mcs.byteoversea.com"};const P={appOnShow:"app_launch",appOnHide:"app_terminate",appOnError:"on_error",pageOnShow:"predefine_pageview",pageOnHide:"predefine_pageview_hide",pageOnShareAppMessage:"on_share"},w=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],S=["__profile_set","__profile_set_once","__profile_increment","__profile_unset","__profile_append"],T=e=>null!=e&&"[object Object]"==Object.prototype.toString.call(e),C=e=>"function"==typeof e,O=e=>"number"==typeof e&&!isNaN(e),E=()=>+new Date;class A{constructor(e){this.sdk=e,this.env=this.init()}init(){return{user:{web_id:k,user_unique_id:k,user_id:k,user_type:k,user_is_auth:k,user_is_login:k,ip_addr_id:k,device_id:k},header:{app_id:k,app_name:k,app_install_id:k,install_id:k,app_package:k,app_channel:k,app_version:k,os_name:k,os_version:k,device_model:k,device_brand:k,traffic_type:k,client_ip:k,os_api:k,access:k,language:k,app_language:k,creative_id:k,ad_id:k,campaign_id:k,ab_client:k,ab_version:k,platform:k,sdk_version:k,sdk_lib:k,app_region:k,region:k,province:k,city:k,timezone:k,tz_offset:k,tz_name:k,sim_region:k,carrier:k,resolution:k,screen_width:k,screen_height:k,browser:k,browser_version:k,referrer:k,referrer_host:k,utm_source:k,utm_medium:k,utm_campaign:k,utm_term:k,utm_content:k,custom:{},ab_sdk_version:k,_sdk_version:k,_sdk_name:k}}}set(e){this.sdk.emit(this.sdk.types.EnvTransform,e),Object.keys(e).forEach((t=>{if("evtParams"===t)this.evtParams=Object.assign(Object.assign({},this.evtParams||{}),e.evtParams||{});else if("_staging_flag"===t)this.evtParams=Object.assign(Object.assign({},this.evtParams||{}),{_staging_flag:e._staging_flag});else{let s=t,i=e[t];if(null===i)return!1;let n="";s.indexOf(".")>-1&&([n,s]=s.split(".")),"os_version"!==s&&"mp_platform"!==s||(i=`${i}`),n?("headers"===n&&(n="header"),"user"===n||"header"===n?this.env[n][s]=i:this.env.header.custom[s]=i):this.env.user.hasOwnProperty(s)?["user_type","ip_addr_id"].indexOf(s)>-1?this.env.user[s]=Number(i):["user_id","web_id","user_unique_id"].indexOf(s)>-1?this.env.user[s]=String(i):["user_is_auth","user_is_login"].indexOf(s)>-1?this.env.user[s]=Boolean(i):["device_id"].indexOf(s)>-1&&(this.env.user[s]=i):this.env.header.hasOwnProperty(s)?this.env.header[s]=i:this.env.header.custom[s]=i}}))}get(e){return e&&"env"!==e?"evtParams"===e?Object.assign({},this[e]):this.env.hasOwnProperty(e)?this.clone(this.env[e]):this.env.user.hasOwnProperty(e)?this.clone(this.env.user[e]):this.env.header.hasOwnProperty(e)?this.clone(this.env.header[e]):this.env.header.custom.hasOwnProperty(e)?this.clone(this.env.header.custom[e]):void 0:this.clone(this.env)}compose(e,t=[]){const{user:s,header:i}=this.env,{evtParams:n}=this,o=e.map((e=>(e.event&&!t.includes(e.event)&&n&&Object.keys(n).forEach((t=>{void 0===e.params[t]&&(e.params[t]=n[t])})),e.params=JSON.stringify(e.params),e)));return this.clone({events:o,user:s,header:i})}merge(e,t=[]){const s=this.compose(e,t);return s.local_time=Math.floor(E()/1e3),[s]}clone(e){return T(e)?JSON.parse(JSON.stringify(e)):e}}class ${constructor(){this.domains=I,this.init()}init(){this.option={caller:"",log:!1,channel:"cn",report_channel:"cn",channel_domain:"",report_url:"",auto_report:!1,auto_profile:!1,profile_channel:"cn",enable_profile:!1,enable_ab_test:!1,ab_channel_domain:"",clear_ab_cache_on_user_change:!0,enable_et_test:!1,event_verify_url:"",enable_buffer:!1,buffer_interval:5e3,buffer_number:5,enable_storage_only:!1,enable_filter_list:!1,enable_third:!1,enable_filter_crawler:!1,request_timeout:0,enable_initiative_launch:!1,enable_custom_webid:!1,disable_sdk_monitor:!1},this.cloneOption=Object.assign({},this.option),this.initDomain()}initDomain(){if(this.option.channel_domain)return void(this.domain=this.option.channel_domain);let e=this.option.report_channel;Object.keys(this.domains).includes(e)||(e="cn"),this.domain=this.domains[e]}set(e){T(e)&&Object.keys(e).forEach((t=>{this.option.hasOwnProperty(t)&&("channel"===t||"report_channel"===t?(this.option.report_channel=this.option.channel=e[t]?e[t]:this.cloneOption[t],this.initDomain()):(this.option[t]=void 0===e[t]?this.cloneOption[t]:e[t],"channel_domain"===t&&this.initDomain()))}))}get(e){return e?this.hasOwnProperty(e)?this[e]:this.option.hasOwnProperty(e)?this.option[e]:void 0:Object.assign({},this.option)}}class x{constructor(){this.hooks={}}on(e,t){e&&t&&"function"==typeof t&&(this.hooks[e]||(this.hooks[e]=[]),this.hooks[e].push(t))}once(e,t){if(!e||!t||"function"!=typeof t)return;const s=i=>{t(i),this.off(e,s)};this.on(e,s)}off(e,t){if(e&&this.hooks[e]&&this.hooks[e].length)if(t){const s=this.hooks[e].indexOf(t);-1!==s&&this.hooks[e].splice(s,1)}else this.hooks[e]=[]}emit(e,t){e&&this.hooks[e]&&this.hooks[e].length&&[...this.hooks[e]].forEach((e=>{try{e(t)}catch(e){}}))}}class q{constructor(e){this.ready=!1,this.sdk=e}setLog(e){e&&C(e.log)&&(this._log=e)}setRequest(e){if(C(e)){const t=e(this.sdk);C(t)&&(this._request=t)}}setStorage(e){T(e)&&C(e.get)&&C(e.set)&&C(e.remove)&&(this._storage=e)}check(){this._request&&this._storage&&(this.ready=!0)}log(...e){if(this._log)try{this.sdk.option.get("log")&&this._log.log(...e)}catch(e){}}request(e){var t;if(!this.ready)return Promise.reject();try{return null===(t=this._request)||void 0===t?void 0:t.call(this,e)}catch(e){}}get(e){return this.ready?this._storage.get(e):Promise.reject(null)}set(e,t){return this.ready?this._storage.set(e,t):Promise.reject(!1)}remove(e){return this.ready?this._storage.remove(e):Promise.reject(!1)}}var U;!function(e){e.Init="$init",e.Config="$config",e.Send="$send",e.Ready="$ready",e.TokenComplete="$token-complete",e.TokenStorage="$token-storage",e.TokenFetch="$token-fetch",e.TokenGet="$token-get",e.LaunchComplete="$launch-complete",e.ConfigUuid="$config-uuid",e.ConfigWebId="$config-webid",e.ConfigTransform="$config-transform",e.UuidChangeBefore="$uuid-change-before",e.UuidChangeAfter="$uuid-change-after",e.EnvTransform="$env-transform",e.Event="$event",e.Report="$report",e.AppOpen="$app-open",e.AppClose="$app-close",e.AppShowStart="$app-show-start",e.AppShow="$app-show",e.AppHide="$app-hide",e.AppError="$app-error",e.AppShare="$app-share",e.AppOnShare="$app-on-share",e.PageShow="$page-show",e.PageHide="$page-hide",e.PageShare="$page-share",e.SubmitBefore="$submit-before",e.SubmitAfter="$submit-after",e.SubmitError="$submit-error",e.FilterCrawler="$filter-crawler",e.LaunchInfo="$launch-info",e.AbVar="$ab-var",e.AbAllVars="$ab-all-vars",e.AbExternalVersion="$ab-external-version",e.AbVersionChangeOn="$ab-version-change-on",e.AbVersionChangeOff="$ab-version-change-off",e.AbRefresh="$ab-refresh",e.AbFetchAfter="$ab-fetch-After",e.ProfileSet="$profile-set",e.ProfileSetOnce="$profile-set-once",e.ProfileUnset="$profile-unset",e.ProfileIncrement="$profile-increment",e.ProfileAppend="$profile-append",e.ProfileClear="$profile-clear",e.ProfileSubmitAfter="$profile-submit-after",e.ProfileSubmitError="$profile-submit-error",e.TransformInfo="$transform-info"}(U||(U={}));var D,j=U,R=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));class N{constructor(){this.types=j,this.EventType=P,this.ProfileType=S,this.UtmType=w,this.SdkHook=j,this.inited=!1,this.sended=!1,this.pluginInstances=[],this.data=new Map,this.ready=!1,this.sessionId="",this.env=new A(this),this.option=new $,this.hook=new x,N.instances.push(this);try{this.adapter=new q(this),this.adapter.setLog(N._log),this.adapter.setRequest(N._request),this.adapter.setStorage(N._storage),this.adapter.check(),N.plugins.reduce(((e,t)=>{const{plugin:s}=t;return e.push(new s),e}),this.pluginInstances)}catch(e){}}on(e,t){var s;null===(s=this.hook)||void 0===s||s.on(e,t)}once(e,t){var s;null===(s=this.hook)||void 0===s||s.once(e,t)}off(e,t){var s;!t&&this.types[e]||null===(s=this.hook)||void 0===s||s.off(e,t)}emit(e,t){var s;this.adapter.log(`emit ${e}`,t||""),null===(s=this.hook)||void 0===s||s.emit(e,t)}static useAdapterLog(e){N._log=e}static useAdapterRequest(e){N._request=e}static useAdapterStorage(e){N._storage=e}static usePlugin(e,t){const s=t||e.pluginName;if(s){let t=!1;for(let i=0,n=N.plugins.length;i<n;i++)if(N.plugins[i].name===s){N.plugins[i].plugin=e,t=!0;break}t||N.plugins.push({name:s,plugin:e})}else N.plugins.push({plugin:e});if("function"==typeof e.init)try{e.init(N)}catch(e){}}get appId(){return this._appId}checkUsePlugin(e){return!!N.plugins.find((({name:t})=>t===e))}init(e){if(this.inited||!T(e))return;const{app_id:t,log:s}=e,i=b(e,["app_id","log"]);if(void 0!==s&&this.option.set({log:s}),!(O(t)&&t>0))return void this.adapter.log("app_id invalid");this._appId=t,this.option.set(i),this.env.set({app_id:t}),Promise.all([new Promise((e=>{this.once(j.TokenComplete,(()=>{e(!0)}))})),new Promise((e=>{this.checkUsePlugin("official:auto")?this.on(j.LaunchComplete,(()=>{e(!0)})):e(!0)})),new Promise((e=>{this.sended?e(!0):this.once(j.Send,(()=>{e(!0)}))}))]).then((()=>{this.ready=!0,this.emit(j.Ready)}));const n=this.option.get();this.pluginInstances.forEach((e=>{e.apply(this,n)})),this.get("is-crawler")||(this.inited=!0,this.emit(j.Init),this.sessionId=R(),this.on(j.AppShowStart,(()=>{this.sessionId=R()})))}config(e){if(!this.inited||!T(e))return;this.emit(j.Config,e);const{web_id:t,user_unique_id:s}=e,i=b(e,["web_id","user_unique_id"]);void 0!==t&&this.emit(j.ConfigWebId,t),void 0!==s&&this.emit(j.ConfigUuid,s),this.env.set(i)}send(){this.inited&&!this.sended&&(this.sended=!0,this.emit(j.Send))}event(e,t){if(!this.get("is-crawler"))if(Array.isArray(e)){const t=E(),s=[];e.forEach((e=>{let i,n,o;Array.isArray(e)?[i,n,o]=e:T(e)&&(i=e.event,n=e.params,o=e.local_time_ms),i&&((!O(o)||o<0||o>t)&&(o=t),s.push(this.createEvent({event:i,params:n,time:o})))})),s.length>0&&this.emit(j.Event,s)}else this.emit(j.Event,this.createEvent({event:e,params:t}))}createEvent(e,t=!0){const s=Object.assign({event:e.event,params:e.params||{},local_time_ms:e.time||E()},this.sessionId?{session_id:this.sessionId}:{});if(!t)return s;let i="";const n=this.get("ab_sdk_version");n&&(i+=n);const o=this.get("ab_sdk_version_external");return o&&(i?i+=","+o:i=o),Object.assign(Object.assign({},s),i?{ab_sdk_version:i}:{})}set(e,t){this.data.set(e,t)}get(e){return this.data.get(e)}getKey(e){const t=this.appId;if("ab_version"===e||"ab_version_external"===e)return`__tea_sdk_${e}_${t}`;const s={token:"tokens",report:"reports",event:"events",utm:"utm",first:"first",compensate:"compensate"};return s[e]?`__tea_cache_${s[e]}_${t}`:void 0}getUrl(e){const{option:t,env:s}=this,i=s.get("_sdk_version"),n=(s.get("_sdk_name")||"").replace(/@.+\//,""),o=`${t.get("domain")}${e}?sdk_version=${i}&sdk_name=${n}`,r=t.get("caller");return r?`${o}&app_id=${this.appId}&caller=${r}`:o}getToken(e){if(!e)return new Promise((e=>{this.emit(j.TokenGet,{callback:t=>{e(t)}})}));this.emit(j.TokenGet,{callback:e})}getConfig(e){return this.env.get(e||"header")}stash(e,t={}){const s="stash";this.set(s,[...this.get(s)||[],this.createEvent({event:e,params:t})])}commit(){const e="stash",t=this.get(e)||[];t.length>0&&(this.event(t),this.set(e,[]))}getVar(e,t,s){if(!s)return new Promise((s=>{this.emit(j.AbVar,{name:e,defaultValue:t,callback:e=>{s(e)}})}));this.emit(j.AbVar,{name:e,defaultValue:t,callback:s})}getAllVars(e){if(!e)return new Promise((e=>{this.emit(j.AbAllVars,(t=>{e(t)}))}));this.emit(j.AbAllVars,e)}getAbSdkVersion(){const e=this.get("ab_versions")||[];return e.length>0?e[e.length-1].ab:""}onAbSdkVersionChange(e){return this.emit(j.AbVersionChangeOn,e),()=>{this.emit(j.AbVersionChangeOff,e)}}offAbSdkVersionChange(e){this.emit(j.AbVersionChangeOff,e)}setExternalAbVersion(e){this.emit(j.AbExternalVersion,"string"==typeof e&&e?`${e}`.trim():null)}getAbConfig(e,t){if(!t)return new Promise((t=>{this.emit(j.AbRefresh,{params:e,callback:e=>{t(e)}})}));this.emit(j.AbRefresh,{params:e,callback:t})}profileSet(e){this.emit(j.ProfileSet,e)}profileSetOnce(e){this.emit(j.ProfileSetOnce,e)}profileUnset(e){this.emit(j.ProfileUnset,e)}profileIncrement(e){this.emit(j.ProfileIncrement,e)}profileAppend(e){this.emit(j.ProfileAppend,e)}autoInitializationRangers(e){const{onTokenReady:t}=e,s=b(e,["onTokenReady"]);return this.init(Object.assign(Object.assign({},s),{log:!1,enable_third:!0})),this.send(),this.getToken().then((e=>{const{web_id:s}=e;try{if("function"==typeof t)return void t(`${s}`)}catch(e){}return`${s}`}))}}N.plugins=[],N.instances=[];class V{apply(e,t){e.env.set({sdk_version:"3.0.0",_sdk_version:"3.0.0",_sdk_name:"@dp/tea-sdk-common"})}}V.pluginName="official:info",function(e){e.Default="default",e.Custom="custom"}(D||(D={}));class L{constructor(e,t){this.wrap=e,this.sdk=t,this.url="/webid/"}storageNoData(){this.fetch()}storageHasData(e){return this.wrap.dataComplete(e)}fetch(){const{adapter:e,appId:t}=this.sdk;e.request({url:this.sdk.getUrl(`${this.url}`),method:"POST",data:{app_id:t,url:"-",user_agent:"-",referer:"-",user_unique_id:""}}).then((t=>{try{const{data:{e:s=-1e4,web_id:i=""}={}}=t;if(0===s)return void this.fetchComplete(i);e.log("parse web_id error",s)}catch(t){e.log("parse web_id error",t)}this.fetchComplete()})).catch((t=>{this.fetchComplete(),e.log("fetch web_id error",t)}))}fetchComplete(e){e&&this.wrap.webIdComplete(e)}storageComplete(e){if(e)try{if(e[this.wrap.typeKey]===D.Default){const t=this.storageHasData(e);this.wrap.complete(t)}else this.storageNoData()}catch(e){}else this.storageNoData()}}class W{constructor(e,t){this.wrap=e,this.sdk=t,this.sdk.on(this.sdk.types.ConfigWebId,(e=>{e=`${e}`,this.wrap.tokenComplete?this.waitComplete(e):this.waitResolve?this.waitResolve(e):this.tmpWebId=e}))}storageNoData(){this.wait()}storageHasData(e){return this.wrap.dataComplete(e,this.tmpWebId)}wait(){new Promise((e=>{void 0!==this.tmpWebId?(e(this.tmpWebId),this.tmpWebId=void 0):this.waitResolve=e})).then((e=>{this.waitComplete(e)}))}waitComplete(e){this.wrap.webIdComplete(e)}storageComplete(e){if(e)try{if(e[this.wrap.typeKey]===D.Custom){const t=this.storageHasData(e);this.wrap.complete(t)}else this.storageNoData()}catch(e){}else this.storageNoData()}}class F{constructor(){this.tokenComplete=!1,this.tobid="",this.tobidUrl="/tobid/",this.tobidKey="",this.isCustom=!1,this.typeKey="_type_"}apply(e,t){this.sdk=e,this.options=t,this.key=this.sdk.getKey("token"),this.tobidKey="diss".split("").reverse().join(""),this.options.enable_custom_webid?(this.isCustom=!0,this.token=new W(this,this.sdk)):(this.isCustom=!1,this.token=new L(this,this.sdk));const{types:s}=this.sdk;this.sdk.on(s.ConfigUuid,(e=>{this.setUserUniqueId(e)})),this.sdk.on(s.TokenGet,(({callback:e})=>{const t=()=>{this.fetchTobid().then((()=>{const t=this.sdk.env.get("user"),s=Object.assign(Object.assign({},t),{web_id:this.webId,user_unique_id:this.userUniqueId});s[this.tobidKey]=this.tobid,"function"==typeof e&&e(s)}))};this.sdk.ready?t():this.sdk.once(s.Ready,(()=>{t()}))})),this.storage()}storage(){const{adapter:e}=this.sdk;e.get(this.key).then((t=>{T(t)&&t.web_id?(t[this.typeKey]&&!t[this.tobidKey]&&t.user_unique_id||(t={web_id:t.web_id,user_unique_id:t.user_unique_id||t.web_id},e.set(this.key,t)),this.storageComplete(t)):this.storageComplete(null)})).catch((t=>{this.storageComplete(null),e.log("get token error",t)}))}storageComplete(e){this.token.storageComplete(e)}dataComplete(e,t){let s=e.web_id;void 0!==t&&t!==s&&(s=t),this.webId=s;let i=e.web_id===e.user_unique_id?s:e.user_unique_id;return void 0!==this.tmpUserUniqueId&&this.tmpUserUniqueId!==i&&(i=this.tmpUserUniqueId?this.tmpUserUniqueId:s,this.tmpUserUniqueId=void 0),this.userUniqueId=i,s!==e.web_id||i!==e.user_unique_id}webIdComplete(e){this.webId=e,this.tmpUserUniqueId?(this.userUniqueId=this.tmpUserUniqueId,this.tmpUserUniqueId=void 0):this.userUniqueId=e,this.complete(!0)}complete(e=!1){const{types:t}=this.sdk,s={web_id:this.webId,user_unique_id:this.userUniqueId,[this.typeKey]:this.isCustom?D.Custom:D.Default};this.sdk.env.set(s),e&&this.sdk.adapter.set(this.key,s),this.tokenComplete=!0,this.sdk.emit(t.TokenComplete)}setUserUniqueId(e){const{adapter:t,env:s,types:i}=this.sdk;if(this.tokenComplete){if(this.userUniqueId===e)return;this.sdk.emit(i.UuidChangeBefore),this.userUniqueId=e||this.webId,s.set({user_unique_id:this.userUniqueId});const n={web_id:this.webId,user_unique_id:this.userUniqueId,[this.typeKey]:this.isCustom?D.Custom:D.Default};t.set(this.key,n),this.sdk.emit(i.UuidChangeAfter)}else this.tmpUserUniqueId=e}fetchTobid(){const{adapter:e,appId:t}=this.sdk;return e.request({url:this.sdk.getUrl(`${this.tobidUrl}`),method:"POST",data:{app_id:t,web_id:this.webId,user_unique_id:this.userUniqueId}}).then((e=>{try{const{data:{e:t=-1e4,tobid:s=""}={}}=e;if(0===t)return void(this.tobid=s)}catch(e){}})).catch((t=>{e.log("fetch tobid error",t)}))}}F.pluginName="official:token";class M{constructor(){this.url="/list/",this.cache=[]}apply(e,t){this.sdk=e,this.options=t,this.key=this.sdk.getKey("report"),this.reportUrl=this.sdk.getUrl(`${this.url}`),this.sdk.set("report_url",this.reportUrl);const{types:s}=this.sdk;this.sdk.on(s.Report,(e=>{Array.isArray(e)||(e=[e]),this.sdk.ready?this.report(e):e.forEach((e=>this.cache.push(e)))})),this.sdk.on(s.Ready,(()=>{this.cache.length>0&&(this.report([...this.cache]),this.cache.length=0)}));const{adapter:i}=this.sdk;this.sdk.on(s.AppOpen,(()=>{i.get(this.key).then((()=>{}))})),this.sdk.on(s.AppClose,(()=>{this.cache.length>0&&(i.set(this.key,[...this.cache]),this.cache.length=0)}))}report(e){this.submit(e)}submit(e){const{types:t}=this.sdk;this.sdk.emit(t.SubmitBefore,e),this.sdk.adapter.request({url:this.reportUrl,method:"POST",data:e}).then((s=>{this.sdk.emit(t.SubmitAfter,{isError:!1,response:s,event:e})})).catch((s=>{this.sdk.emit(t.SubmitAfter,{isError:!0,error:s,event:e}),this.sdk.emit(t.SubmitError,{event:e})}))}}M.pluginName="official:report";class K{constructor(){this.buffer=[],this.timer=0,this.unReadyCache=[]}apply(e,t){var s,i;this.sdk=e,this.options=t,this.enable=!!this.options.enable_buffer;const n=!0===this.options.enable_storage||!1===this.options.disable_storage;if(n&&(this.enable=!0),this.enable){this.interval=this.options.buffer_interval,this.number=this.options.buffer_number,n&&((null===(s=this.options)||void 0===s?void 0:s.report_interval)>0&&(this.interval=this.options.report_interval),(null===(i=this.options)||void 0===i?void 0:i.max_batch_event)>0&&(this.number=this.options.max_batch_event));try{this.interval=Number(this.interval),this.number=Number(this.number)}catch(e){}}this.sdk.set("enable_storage",this.enable);const{types:o}=this.sdk;this.sdk.on(o.Event,(e=>{this.sdk.ready?this.process(Array.isArray(e)?e:[e]):this.unReadyCache=[...this.unReadyCache,...Array.isArray(e)?e:[e]]})),this.sdk.on(o.Ready,(()=>{this.unReadyCache.length>0&&(this.process(this.unReadyCache),this.unReadyCache=[])})),this.sdk.on(o.AppClose,(()=>{this.buffer.length>0&&(this.report(this.buffer),this.buffer.length=0)}))}process(e){const t=this.sdk.env.compose(e);this.enable?(this.buffer=[...this.buffer,t],this.refresh()):this.report(t)}refresh(){this.timer&&clearTimeout(this.timer),this.buffer.length>=this.number?(this.report([...this.buffer]),this.buffer.length=0):this.timer=setTimeout((()=>{this.report([...this.buffer]),this.buffer.length=0}),this.interval)}report(e){this.sdk.emit(this.sdk.types.Report,e)}}K.pluginName="official:buffer";class B{apply(e,t){this.sdk=e,this.options=t;const{types:s,env:i}=this.sdk,n=(()=>{try{const e=(new Date).getTimezoneOffset();return{timezone:Math.floor(Math.abs(e)/60),offset:60*e}}catch(e){return{timezone:8,offset:-28800}}})();i.set({timezone:n.timezone,tz_offset:n.offset}),this.sdk.on(s.ConfigTransform,(e=>{if(void 0!==e.gender&&([1,2,"1","2"].includes(e.gender)?e.gender=e.gender<2?"male":"female":delete e.gender),this.options.enable_profile){const t={};["nick_name","gender","avatar_url"].forEach((s=>{void 0!==e[s]&&(t[s]=e[s],delete e[s])})),this.sdk.emit(s.ProfileSet,t)}})),this.sdk.on(s.EnvTransform,(e=>{if(this.options.enable_profile){const t={};["$mp_from_uuid"].forEach((s=>{void 0!==e[s]&&(t[s]=e[s],delete e[s])})),Object.keys(t).length>0&&this.sdk.emit(s.ProfileSetOnce,t)}}))}}B.pluginName="official:transform",N.usePlugin(V),N.usePlugin(F),N.usePlugin(M),N.usePlugin(K),N.usePlugin(B);var H=console;let z="undefined";const G=()=>("undefined"!==z||(z="undefined"!=typeof tt?{target:tt,config:"undefined"!=typeof __ttConfig?__ttConfig:null,customPlatform:"ttMiniProduct",mpPlatform:2,is:"tt"}:"undefined"!=typeof my?{target:my,config:null,customPlatform:"aliMiniProduct",mpPlatform:1,is:"my"}:"undefined"!=typeof swan?{target:swan,config:null,customPlatform:"swanMiniProduct",mpPlatform:5,is:"swan"}:"undefined"!=typeof qq?{target:qq,config:"undefined"!=typeof __qqConfig?__qqConfig:null,customPlatform:"qqMiniProduct",mpPlatform:6,is:"qq"}:"undefined"!=typeof wx?{target:wx,config:"undefined"!=typeof __wxConfig?__wxConfig:null,customPlatform:"miniProduct",mpPlatform:0,is:"wx"}:"undefined"!=typeof uni?{target:uni,config:null,customPlatform:"uniMiniProduct",mpPlatform:7,is:"uni"}:{target:{},config:null,customPlatform:"",mpPlatform:-1,is:""}),z),J=G();var Y="my"===J.is?e=>t=>{const s=t.timeout||e.option.get("request_timeout"),i="number"==typeof s&&s>0;return new Promise(((e,n)=>{const o=my[my.request?"request":"httpRequest"](Object.assign(Object.assign({},t),{dataType:t.dataType||"json",success:t=>{e(t)},fail:e=>{n(e)}}));i&&setTimeout((()=>{try{o&&o.abort()}catch(e){}}),s)}))}:J.target?((e,t=!1)=>s=>i=>{const n=i.timeout||s.option.get("request_timeout"),o="number"==typeof n&&n>0;return new Promise(((s,r)=>{const a=e.request(Object.assign(Object.assign(Object.assign({},i),o&&!t?{timeout:n}:{}),{dataType:i.dataType||"json",success:e=>{s(e)},fail:e=>{r(e)}}));o&&t&&setTimeout((()=>{try{a&&a.abort()}catch(e){}}),n)}))})(J.target,"swan"===J.is):e=>e=>Promise.reject("request adapter error");const X=G();var Q="my"===X.is?new class{get(e){return new Promise(((t,s)=>{try{t(my.getStorageSync({key:e}).data)}catch(e){s(e)}}))}set(e,t){return new Promise(((s,i)=>{try{my.setStorageSync({key:e,data:t}),s(!0)}catch(e){i(!1)}}))}remove(e){return new Promise(((t,s)=>{try{my.removeStorageSync({key:e}),t(!0)}catch(e){s(!1)}}))}}:X.target?new class{constructor(e){this.target=e}get(e){return new Promise(((t,s)=>{try{t(this.target.getStorageSync(e))}catch(e){s(e)}}))}set(e,t){return new Promise(((s,i)=>{try{this.target.setStorageSync(e,t),s(!0)}catch(e){i(!1)}}))}remove(e){return new Promise(((t,s)=>{try{this.target.removeStorageSync(e),t(!0)}catch(e){s(!1)}}))}}(X.target):(()=>{const e="storage adapter error";return{get:t=>Promise.reject(e),set:(t,s)=>Promise.reject(e),remove:t=>Promise.reject(e)}})();class Z{apply(e,t){this.sdk=e,this.options=t,this.boost();const{types:s}=this.sdk;this.getInfo(),this.sdk.on(s.AppOpen,(()=>{this.getInfo()}))}boost(){}getInfo(){const e=this,{target:t,env:s}=this.sdk;t&&(t.getSystemInfo&&t.getSystemInfo({success(t){const i=Math.ceil(t.screenWidth),n=Math.ceil(t.screenHeight),o={device_brand:t.brand,device_model:t.model,os_version:t.system,os_name:t.platform,platform:t.platform,resolution:`${i}x${n}`,screen_width:i,screen_height:n};e.overlap(t,o),s.set(o)}}),t.getNetworkType&&t.getNetworkType({success(e){const t={access:e.networkType};s.set(t)}}))}overlap(e,t){t.language=e.language,t.mp_platform_app_version=e.version,t.mp_platform_basic_version=e.SDKVersion}}Z.pluginName="official:device",N.useAdapterLog(H),N.useAdapterRequest(Y),N.useAdapterStorage(Q),N.usePlugin(class extends Z{static init(e){const t=G();e.platform=t.is?t.target:null,e.platformIs=t.is}boost(){super.boost(),this.which=G(),this.sdk.target=this.which.target,this.sdk.targetEnvConfig=this.which.config,this.sdk.env.set({sdk_lib:"mp_common",custom_platform:this.which.customPlatform,mp_platform:this.which.mpPlatform})}overlap(e,t){super.overlap(e,t)}});class ee{apply(e,t){const{event_verify_url:s}=t;if(!s)return;const{adapter:i,types:n}=e;e.on(n.SubmitBefore,(e=>{i.request({url:`${`${s}`.replace(/\/+$/,"")}/v1/list_test`,method:"POST",data:e}).catch((()=>{}))}))}}ee.pluginName="official:et",N.usePlugin(ee);let te=null,se="",ie=!1;const ne={get TEA(){return te},get webId(){return se},init(e,t){if(!te){te=new N;const s={app_id:488781,log:!1,channel:"cn"};Object.keys(e).forEach((t=>{s[t]=e[t]})),t&&(s.app_id=t),ie=s.log,te.init(s),te.on("$token-complete",(()=>{se=te.env.get("user_unique_id"),ie&&console.log("TEA_SDK_token-complete",se)})),ie&&console.log("TEA_SDK_INIT",s,te)}const s={app_name:"微信小程序",app_version:"1.0.0"};["app_name","app_version","user_unique_id","device_id"].forEach((t=>{e[t]&&(s[t]=e[t])})),ie&&console.log("TEA_SDK_CONFIG",s),te.config(s),te.send()},config(e={}){ie&&console.log("TEA_SDK_CONFIG",e),te.config(e)},event(e,t={}){te.event(e,t)}};class oe extends y{}oe.uploader=ne;let re=null;"undefined"!=typeof tt?re=tt:"undefined"!=typeof wx&&(re=wx),e.DefaultCollector=oe,e.default=oe,e.initCollector=function(e={appVersion:"1.0.0",appName:"视频云小程序",appId:0,userId:0,needET:!1,log:!1}){if(re&&(re.__COLLECTOR__=y,re.__COLLECTOR_INFO__={lineAppId:e.appId,lineUserId:e.userId||0},re.__COLLECTOR__&&re.__COLLECTOR__.uploader)){const t={log:e.log,app_name:e.appName||"视频云微信小程序",app_version:e.appVersion||"1.0.0",user_unique_id:e.userId||"",channel_domain:e.channelDomain};e.channelDomain&&(t.channel_domain=e.channelDomain),e.needET&&(t.event_verify_url=e.verifyUrl||"https:xx.xx.com"),e.log&&(t.log=e.log),re.__COLLECTOR__.uploader.init(t)}},e.setUserId=function(e){e&&y.uploader.config({user_unique_id:e})},Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "veplayer-mp-douyin",
"version": "1.2.11-rc.1",
"version": "1.2.11-rc.2",
"dependencies": {
"eventemitter3": "^5.0.1",
"xgplayer-service-miniprogram": "0.5.1-0",
"veplayer-mp-logger": "1.2.11-rc.1"
"veplayer-mp-logger": "1.2.11-rc.2"
},

@@ -12,3 +12,3 @@ "main": "./dist/index.js",

"components": {
"veplayer": "./index"
"veplayer": "dist/index"
}

@@ -15,0 +15,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc