@smart100/spu-web-plugin 0.0.35 → 0.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -11
- package/dist/spu-web-plugin.mjs +2263 -1937
- package/package.json +1 -1
- package/src/apaasSpuTrack.ts +17 -21
- package/src/axios.ts +32 -15
- package/src/core.js +158 -4
- package/src/index.ts +8 -1
- package/src/nativeApi.ts +60 -0
- package/src/package/apaas-track/apaas-spu/index.js +6 -6
- package/src/package/apaas-track/apaas-spu/index.mjs +1586 -1564
- package/src/package/apaas-track/apaas-spu/index.umd.js +6 -6
- package/src/urlquery.ts +4 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function Ut(){return((1+Math.random())*65536|0).toString(16).substring(1)}function
|
|
2
|
-
`}let l="{",w="}";Et(n)&&(l="[",w="]"),e.ret+=l+u;const p=pi(n);for(let f=0;f<p.length;f++){const v=p[f];e.ret+=a;try{Et(n)||(Yt(v)||Et(v)||Jn(v)?e.ret+=Object.prototype.toString.call(v):Je(v)&&e.standardJSON?e.ret+='"'+v+'"':e.ret+=v,e.ret+=": ")}catch{continue}try{const h=n[v];Et(h)?e.maxDepth>-1&&s>=e.maxDepth?e.ret+="Array("+h.length+")":On(h,e,s+1):Yt(h)?e.maxDepth>-1&&s>=e.maxDepth?e.ret+=(((i=h.constructor)==null?void 0:i.name)||"Object")+" {}":On(h,e,s+1):e.ret+=ys(h,e.keyMaxLen)}catch{e.ret+=e.standardJSON?'"(PARSE_ERROR)"':"(PARSE_ERROR)"}if(e.keyMaxLen>0&&e.ret.length>=e.keyMaxLen*10){e.ret+=", (...)";break}f<p.length-1&&(e.ret+=", "),e.ret+=u}e.ret+=a.substring(0,a.length-2)+w};function ks(n,e={maxDepth:-1,keyMaxLen:-1,pretty:!1,standardJSON:!1}){const s=Object.assign({ret:"",maxDepth:-1,keyMaxLen:-1,pretty:!1,standardJSON:!1,circularFinder:hi()},e);return On(n,s),s.ret}function li(n){try{return self.Blob?new self.Blob([n],{type:"text/plain"}).size:encodeURI(n).split(/%(?:u[0-9A-F]{2})?[0-9A-F]{2}|./).length-1}catch{return 0}}function je(n){return n<=0?"":n>=1e3*1e3?(n/1e3/1e3).toFixed(1)+" MB":n>=1e3*1?(n/1e3).toFixed(1)+" KB":n+" B"}function Zs(n,e){return n.length>e&&(n=n.substring(0,e)+`...(${je(li(n))})`),n}function pi(n){return!Yt(n)&&!Et(n)?[]:Object.keys(n)}function di(n=[],e=1024*1024){if(!n.length)return[];if(JSON.stringify(n).length<=e)return[n];let s=[],r=[],i=0;for(let a=0;a<n.length;a++){const u=n[a],l=JSON.stringify(u).length;i+l<e?(r.push(u),i+=l):r.length?(s.push(r),r=[u],i=l):(s.push([u]),i=0)}return s}const mi=n=>typeof n=="object"?(n.config&&n.request&&(n.config=void 0,n.request=void 0),n.status!==void 0?n.data?(n.detail=typeof n.data=="object"?JSON.stringify(n.data):n.data,n=new Error(n.detail)):n.body?(n.detail=typeof n.body=="object"?JSON.stringify(n.body):n.body,n=new Error(n.detail)):(n.message=`${n.statusText||n.bodyText||""}`,n=new Error(n.message)):n=new Error(JSON.stringify(n)),n):new Error(n),Gn=n=>{var e;let s=null;n?n&&n instanceof Error?s=n:s=mi(n):(n=new Error("error"),s=n);const r={message:"",detail:"",name:"",stack:[]};if(r.message=s.message,r.name=s.name,r.detail=((e=s.stack)==null?void 0:e.toString())||s.message,s.stack){let i=s.stack.split(/\n\s+at/);i.length&&(i=i.slice(1)),r.stack=i}return r},zn=n=>new Promise(e=>{setTimeout(()=>{e(void 0),n&&n()},0)}),we=()=>{if(typeof wx<"u"&&!window){const n=getCurrentPages();return n.length?n[n.length-1].route:"applaunch"}else return window.location.href};var fi=Object.defineProperty,gi=(n,e,s)=>e in n?fi(n,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[e]=s,I=(n,e,s)=>(gi(n,typeof e!="symbol"?e+"":e,s),s);class Ys{constructor(e){I(this,"limit"),I(this,"runningSize"),I(this,"taskList"),this.limit=e,this.taskList=[],this.runningSize=0}addTask(e){this.taskList.push(e),this.run()}async run(){for(;this.taskList.length&&this.runningSize<this.limit;){const e=this.taskList.shift();e&&(this.runningSize++,await e(),this.runningSize--,this.run())}}}var Xn=(n=>(n[n.NORMAL=0]="NORMAL",n[n.HIGH=1]="HIGH",n[n.EMERGEN=2]="EMERGEN",n))(Xn||{});class at{constructor(e,s,r){I(this,"_level",0),this.apaasTrack=e,this.type=s,r&&(this._level=r)}getProperties(){return{}}setProperties(e){}getEventLog(e){const s=e||Date.now();return{...this.apaasTrack.baseLog,types:this.type,logtime:String(s),epochnanos:String(s)+"000000",event:this.type,properties:this.getProperties(),url:we()}}}I(at,"eventOptions"),I(at,"initApaasTrackHook"),I(at,"startApaasTrackHook"),I(at,"destroyApaasTrackHook");class tr extends at{constructor(e){super(e,"init")}getProperties(){const e=this.apaasTrack.baseLog;return{system:e.system||"",systemver:e.systemver||"",manufacturer:e.manufacturer||"",browser:e.browser||"",browserver:e.browserver||"",terminalid:e.terminalid||"",client:e.client||"",clientver:e.clientver||""}}}class er extends at{constructor(e){super(e,"custom"),I(this,"info",{})}setCustomType(e){this.type=e}getProperties(){return{...this.info}}setProperties(e){this.info=e}}const ee={init:tr,custom:er},Bt=(n,e)=>{const s=ee[e];return new s(n)},nr=(n,e,s)=>{const r=s||Date.now(),i=Bt(n,e);return{...n.baseLog,types:e,logtime:String(r),epochnanos:String(r)+"000000",event:e,properties:i.getProperties(),url:we()}},Fn=(n,e,s)=>{const r=s||Date.now();return{...n.baseLog,types:e.type,logtime:String(r),epochnanos:String(r)+"000000",event:e.type,properties:e.getProperties(),url:we()}},Wn=(n,e)=>{if(ee[n])throw Error(`\u8BE5\u4E8B\u4EF6${n} \u5DF2\u5B58\u5728\uFF0C\u6CE8\u518C\u5931\u8D25`);ee[n]=e};class sr{constructor(e,s){I(this,"name",""),I(this,"time",0),I(this,"info",{}),e&&(this.name=e),s&&(this.info=s),this.time=Date.now()}get epochnanos(){return this.time*1e6}get attributes(){return this.getAttributes()}getAttributes(){return{}}getJson(){return{name:this.name,epochnanos:this.time*1e6,attributes:this.getAttributes(),...this.info}}setInfo(e){this.info=e||{}}}class rr extends sr{constructor(){super(...arguments),I(this,"name","exception"),I(this,"exceptionType",""),I(this,"exceptionMessage",""),I(this,"exceptionStackTrace","")}getAttributes(){return{"exception.type":this.exceptionType,"exception.message":this.exceptionMessage,"exception.stacktrace":this.exceptionStackTrace}}setInfo(e){this.exceptionMessage=e.exceptionMessage,this.exceptionType=e.exceptionType,this.exceptionStackTrace=e.exceptionStackTrace}}class ln extends at{constructor(e,s,r){super(e,"span"),I(this,"spanid",""),I(this,"traceid",""),I(this,"parentspanid",""),I(this,"name",""),I(this,"attributes",{}),I(this,"events",[]),I(this,"statuscode","OK"),I(this,"statusmessage",""),I(this,"startTime",0),I(this,"endTime",0),this.name=s,this.traceid=be(),this.spanid=Xs(),this.parentspanid=r||"",this.start()}trackLog(){this.apaasTrack.addLogByEvent(this)}createSpanEvent(e,s){return new ln(this.apaasTrack,e,s)}setAttribute(e){const s=e.getAttributes();this.attributes=s}addEvent(e){this.events.push(e)}exception(e){const s=new rr;let r="",i="",a="";if(e instanceof Error){const u=Gn(e);r=u.detail,i=u.name,a=u.stack.join(",")}else r=e.exceptionMessage,i=e.exceptionType,a=e.exceptionStackTrace;s.setInfo({exceptionMessage:r,exceptionType:i,exceptionStackTrace:a}),this.events.push(s)}start(){this.startTime=Date.now()}end(e,s){e&&(this.statusmessage=e),s&&(this.statuscode=s),this.endTime=Date.now()}getProperties(){return{traceid:this.traceid,spanid:this.spanid,parentspanid:this.parentspanid,name:this.name,attributes:this.attributes,events:this.events.map(e=>e.getJson()),statuscode:this.statuscode,statusmessage:this.statusmessage,startepochnanos:this.startTime*1e6,endepochnanos:this.endTime*1e6,duration:(this.endTime-this.startTime)*1e6}}}const En="1.0.17";class Ge{constructor(e){I(this,"_version",En),I(this,"commonLog",null),I(this,"browserLog",null),I(this,"options"),this.options=e,typeof window<"u"&&(window.__apaasTrackVersion__=En),typeof wx<"u"&&!window&&(wx.__apaasTrackVersion__=En),e.commonLog&&this.initCommonLog(e.commonLog),this.runEventInitHooks()}registerEvent(e,s){Wn(e,s),s.initApaasTrackHook&&s.initApaasTrackHook(this),s.startApaasTrackHook&&s.startApaasTrackHook(this)}get groupid(){var e;return(e=this.browserLog)==null?void 0:e.distinctid}runEventInitHooks(){Object.values(ee).forEach(e=>{e.initApaasTrackHook&&e.initApaasTrackHook(this)})}runEventStartHooks(){Object.values(ee).forEach(e=>{e.startApaasTrackHook&&e.startApaasTrackHook(this)})}runEventDestroyHooks(){Object.values(ee).forEach(e=>{e.destroyApaasTrackHook&&e.destroyApaasTrackHook(this)})}get anonymousid(){var e;return(e=this.browserLog)==null?void 0:e.anonymousid}get distinctid(){var e;return(e=this.browserLog)==null?void 0:e.distinctid}get baseLog(){return{...this.browserLog,...this.commonLog}}initCommonLog(e){this.commonLog=e}createEventLog(e,s){return nr(this,e,s)}addLogByType(e,s){const r=this.createEventLog(e,s);this.addLogToQueue(r)}addLogByEvent(e,s){const r=Fn(this,e,s);this.addLogToQueue(r)}createCustomEvent(e){const s=Bt(this,"custom");return s.setCustomType(e),s}createSpanEvent(e,s){return new ln(this,e,s)}addLogByCustomEvent(e,s={},r){const i=this.createCustomEvent(e);i.setProperties(s);const a=Fn(this,i,r);this.addLogToQueue(a)}executeInitEvent(){const e=Bt(this,"init");e.setProperties({groupid:this.groupid}),this.addLogByEvent(e)}updateCommonLog(e){this.commonLog={...this.commonLog,...e}}trackEvent(e,s={},r){const i=Bt(this,e);i.setProperties(s),this.addLogByEvent(i,r)}start(...e){this.executeInitEvent(),this.runEventStartHooks()}destroy(){this.runEventDestroyHooks()}transformLog(e){return e}async addLogToQueue(e,s=!1,r=!0){r&&(e=this.transformLog(e)),await this.sendLog(e,s)}}I(Ge,"registerEvent",Wn);class _i{constructor(e){I(this,"name",""),I(this,"groupid",""),this.name=e.name,this.groupid=e.groupid}getJson(){return{name:this.name,attributes:this.getAttributes()}}}var vi=Object.defineProperty,bi=(n,e,s)=>e in n?vi(n,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[e]=s,b=(n,e,s)=>(bi(n,typeof e!="symbol"?e+"":e,s),s),wi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Hn={exports:{}};(function(n,e){(function(s,r){var i="1.0.32",a="",u="?",l="function",w="undefined",p="object",f="string",v="major",h="model",_="name",y="type",k="vendor",T="version",R="architecture",tt="console",M="mobile",C="tablet",V="smarttv",J="wearable",ht="embedded",gt=350,zt="Amazon",ie="Apple",Se="ASUS",Xe="BlackBerry",Ft="Browser",Jt="Chrome",wn="Edge",ae="Firefox",Gt="Google",We="Huawei",Y="LG",Tt="Microsoft",Ht="Motorola",oe="Opera",Pe="Samsung",Le="Sharp",Xt="Sony",It="Xiaomi",Ee="Zebra",Qe="Facebook",yn=function(z,q){var A={};for(var W in z)q[W]&&q[W].length%2===0?A[W]=q[W].concat(z[W]):A[W]=z[W];return A},Mt=function(z){for(var q={},A=0;A<z.length;A++)q[z[A].toUpperCase()]=z[A];return q},xe=function(z,q){return typeof z===f?Wt(q).indexOf(Wt(z))!==-1:!1},Wt=function(z){return z.toLowerCase()},kn=function(z){return typeof z===f?z.replace(/[^\d\.]/g,a).split(".")[0]:r},Qt=function(z,q){if(typeof z===f)return z=z.replace(/^\s\s*/,a).replace(/\s\s*$/,a),typeof q===w?z:z.substring(0,gt)},lt=function(z,q){for(var A=0,W,O,ue,G,dt,_t;A<q.length&&!dt;){var Ze=q[A],Ce=q[A+1];for(W=O=0;W<Ze.length&&!dt;)if(dt=Ze[W++].exec(z),dt)for(ue=0;ue<Ce.length;ue++)_t=dt[++O],G=Ce[ue],typeof G===p&&G.length>0?G.length===2?typeof G[1]==l?this[G[0]]=G[1].call(this,_t):this[G[0]]=G[1]:G.length===3?typeof G[1]===l&&!(G[1].exec&&G[1].test)?this[G[0]]=_t?G[1].call(this,_t,G[2]):r:this[G[0]]=_t?_t.replace(G[1],G[2]):r:G.length===4&&(this[G[0]]=_t?G[3].call(this,_t.replace(G[1],G[2])):r):this[G]=_t||r;A+=2}},Be=function(z,q){for(var A in q)if(typeof q[A]===p&&q[A].length>0){for(var W=0;W<q[A].length;W++)if(xe(q[A][W],z))return A===u?r:A}else if(xe(q[A],z))return A===u?r:A;return z},Ve={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},Ke={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Rt={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[T,[_,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[T,[_,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[_,T],[/opios[\/ ]+([\w\.]+)/i],[T,[_,oe+" Mini"]],[/\bopr\/([\w\.]+)/i],[T,[_,oe]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[_,T],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[T,[_,"UC"+Ft]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[T,[_,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[T,[_,"WeChat"]],[/konqueror\/([\w\.]+)/i],[T,[_,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[T,[_,"IE"]],[/yabrowser\/([\w\.]+)/i],[T,[_,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[_,/(.+)/,"$1 Secure "+Ft],T],[/\bfocus\/([\w\.]+)/i],[T,[_,ae+" Focus"]],[/\bopt\/([\w\.]+)/i],[T,[_,oe+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[T,[_,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[T,[_,"Dolphin"]],[/coast\/([\w\.]+)/i],[T,[_,oe+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[T,[_,"MIUI "+Ft]],[/fxios\/([-\w\.]+)/i],[T,[_,ae]],[/\bqihu|(qi?ho?o?|360)browser/i],[[_,"360 "+Ft]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[_,/(.+)/,"$1 "+Ft],T],[/(comodo_dragon)\/([\w\.]+)/i],[[_,/_/g," "],T],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[_,T],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[_],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[_,Qe],T],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[_,T],[/\bgsa\/([\w\.]+) .*safari\//i],[T,[_,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[T,[_,Jt+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[_,Jt+" WebView"],T],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[T,[_,"Android "+Ft]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[_,T],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[T,[_,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[T,_],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[_,[T,Be,Ve]],[/(webkit|khtml)\/([\w\.]+)/i],[_,T],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[_,"Netscape"],T],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[T,[_,ae+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[_,T]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[R,"amd64"]],[/(ia32(?=;))/i],[[R,Wt]],[/((?:i[346]|x)86)[;\)]/i],[[R,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[R,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[R,"armhf"]],[/windows (ce|mobile); ppc;/i],[[R,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[R,/ower/,a,Wt]],[/(sun4\w)[;\)]/i],[[R,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[R,Wt]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[h,[k,Pe],[y,C]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[h,[k,Pe],[y,M]],[/\((ip(?:hone|od)[\w ]*);/i],[h,[k,ie],[y,M]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[h,[k,ie],[y,C]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[h,[k,We],[y,C]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[h,[k,We],[y,M]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[h,/_/g," "],[k,It],[y,M]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[h,/_/g," "],[k,It],[y,C]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[h,[k,"OPPO"],[y,M]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[h,[k,"Vivo"],[y,M]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[h,[k,"Realme"],[y,M]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[h,[k,Ht],[y,M]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[h,[k,Ht],[y,C]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[h,[k,Y],[y,C]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[h,[k,Y],[y,M]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[h,[k,"Lenovo"],[y,C]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[h,/_/g," "],[k,"Nokia"],[y,M]],[/(pixel c)\b/i],[h,[k,Gt],[y,C]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[h,[k,Gt],[y,M]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[h,[k,Xt],[y,M]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[h,"Xperia Tablet"],[k,Xt],[y,C]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[h,[k,"OnePlus"],[y,M]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[h,[k,zt],[y,C]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[h,/(.+)/g,"Fire Phone $1"],[k,zt],[y,M]],[/(playbook);[-\w\),; ]+(rim)/i],[h,k,[y,C]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[h,[k,Xe],[y,M]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[h,[k,Se],[y,C]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[h,[k,Se],[y,M]],[/(nexus 9)/i],[h,[k,"HTC"],[y,C]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[k,[h,/_/g," "],[y,M]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[h,[k,"Acer"],[y,C]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[h,[k,"Meizu"],[y,M]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[h,[k,Le],[y,M]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[k,h,[y,M]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[k,h,[y,C]],[/(surface duo)/i],[h,[k,Tt],[y,C]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[h,[k,"Fairphone"],[y,M]],[/(u304aa)/i],[h,[k,"AT&T"],[y,M]],[/\bsie-(\w*)/i],[h,[k,"Siemens"],[y,M]],[/\b(rct\w+) b/i],[h,[k,"RCA"],[y,C]],[/\b(venue[\d ]{2,7}) b/i],[h,[k,"Dell"],[y,C]],[/\b(q(?:mv|ta)\w+) b/i],[h,[k,"Verizon"],[y,C]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[h,[k,"Barnes & Noble"],[y,C]],[/\b(tm\d{3}\w+) b/i],[h,[k,"NuVision"],[y,C]],[/\b(k88) b/i],[h,[k,"ZTE"],[y,C]],[/\b(nx\d{3}j) b/i],[h,[k,"ZTE"],[y,M]],[/\b(gen\d{3}) b.+49h/i],[h,[k,"Swiss"],[y,M]],[/\b(zur\d{3}) b/i],[h,[k,"Swiss"],[y,C]],[/\b((zeki)?tb.*\b) b/i],[h,[k,"Zeki"],[y,C]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[k,"Dragon Touch"],h,[y,C]],[/\b(ns-?\w{0,9}) b/i],[h,[k,"Insignia"],[y,C]],[/\b((nxa|next)-?\w{0,9}) b/i],[h,[k,"NextBook"],[y,C]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[k,"Voice"],h,[y,M]],[/\b(lvtel\-)?(v1[12]) b/i],[[k,"LvTel"],h,[y,M]],[/\b(ph-1) /i],[h,[k,"Essential"],[y,M]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[h,[k,"Envizen"],[y,C]],[/\b(trio[-\w\. ]+) b/i],[h,[k,"MachSpeed"],[y,C]],[/\btu_(1491) b/i],[h,[k,"Rotor"],[y,C]],[/(shield[\w ]+) b/i],[h,[k,"Nvidia"],[y,C]],[/(sprint) (\w+)/i],[k,h,[y,M]],[/(kin\.[onetw]{3})/i],[[h,/\./g," "],[k,Tt],[y,M]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[h,[k,Ee],[y,C]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[h,[k,Ee],[y,M]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[k,h,[y,tt]],[/droid.+; (shield) bui/i],[h,[k,"Nvidia"],[y,tt]],[/(playstation [345portablevi]+)/i],[h,[k,Xt],[y,tt]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[h,[k,Tt],[y,tt]],[/smart-tv.+(samsung)/i],[k,[y,V]],[/hbbtv.+maple;(\d+)/i],[[h,/^/,"SmartTV"],[k,Pe],[y,V]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[k,Y],[y,V]],[/(apple) ?tv/i],[k,[h,ie+" TV"],[y,V]],[/crkey/i],[[h,Jt+"cast"],[k,Gt],[y,V]],[/droid.+aft(\w)( bui|\))/i],[h,[k,zt],[y,V]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[h,[k,Le],[y,V]],[/(bravia[\w ]+)( bui|\))/i],[h,[k,Xt],[y,V]],[/(mitv-\w{5}) bui/i],[h,[k,It],[y,V]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[k,Qt],[h,Qt],[y,V]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[y,V]],[/((pebble))app/i],[k,h,[y,J]],[/droid.+; (glass) \d/i],[h,[k,Gt],[y,J]],[/droid.+; (wt63?0{2,3})\)/i],[h,[k,Ee],[y,J]],[/(quest( 2)?)/i],[h,[k,Qe],[y,J]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[k,[y,ht]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[h,[y,M]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[h,[y,C]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[y,C]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[y,M]],[/(android[-\w\. ]{0,9});.+buil/i],[h,[k,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[T,[_,wn+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[T,[_,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[_,T],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[T,_]],os:[[/microsoft (windows) (vista|xp)/i],[_,T],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[_,[T,Be,Ke]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[_,"Windows"],[T,Be,Ke]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[T,/_/g,"."],[_,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[_,"Mac OS"],[T,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[T,_],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[_,T],[/\(bb(10);/i],[T,[_,Xe]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[T,[_,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[T,[_,ae+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[T,[_,"webOS"]],[/crkey\/([\d\.]+)/i],[T,[_,Jt+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[_,"Chromium OS"],T],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[_,T],[/(sunos) ?([\w\.\d]*)/i],[[_,"Solaris"],T],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[_,T]]},ot=function(z,q){if(typeof z===p&&(q=z,z=r),!(this instanceof ot))return new ot(z,q).getResult();var A=z||(typeof s!==w&&s.navigator&&s.navigator.userAgent?s.navigator.userAgent:a),W=q?yn(Rt,q):Rt;return this.getBrowser=function(){var O={};return O[_]=r,O[T]=r,lt.call(O,A,W.browser),O.major=kn(O.version),O},this.getCPU=function(){var O={};return O[R]=r,lt.call(O,A,W.cpu),O},this.getDevice=function(){var O={};return O[k]=r,O[h]=r,O[y]=r,lt.call(O,A,W.device),O},this.getEngine=function(){var O={};return O[_]=r,O[T]=r,lt.call(O,A,W.engine),O},this.getOS=function(){var O={};return O[_]=r,O[T]=r,lt.call(O,A,W.os),O},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return A},this.setUA=function(O){return A=typeof O===f&&O.length>gt?Qt(O,gt):O,this},this.setUA(A),this};ot.VERSION=i,ot.BROWSER=Mt([_,T,v]),ot.CPU=Mt([R]),ot.DEVICE=Mt([h,k,y,tt,M,V,C,J,ht]),ot.ENGINE=ot.OS=Mt([_,T]),n.exports&&(e=n.exports=ot),e.UAParser=ot;var Nt=typeof s!==w&&(s.jQuery||s.Zepto);if(Nt&&!Nt.ua){var ce=new ot;Nt.ua=ce.getResult(),Nt.ua.get=function(){return ce.getUA()},Nt.ua.set=function(z){ce.setUA(z);var q=ce.getResult();for(var A in q)Nt.ua[A]=q[A]}}})(typeof window=="object"?window:wi)})(Hn,Hn.exports);var ir={exports:{}},ar={exports:{}};(function(){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(s,r){return s<<r|s>>>32-r},rotr:function(s,r){return s<<32-r|s>>>r},endian:function(s){if(s.constructor==Number)return e.rotl(s,8)&16711935|e.rotl(s,24)&4278255360;for(var r=0;r<s.length;r++)s[r]=e.endian(s[r]);return s},randomBytes:function(s){for(var r=[];s>0;s--)r.push(Math.floor(Math.random()*256));return r},bytesToWords:function(s){for(var r=[],i=0,a=0;i<s.length;i++,a+=8)r[a>>>5]|=s[i]<<24-a%32;return r},wordsToBytes:function(s){for(var r=[],i=0;i<s.length*32;i+=8)r.push(s[i>>>5]>>>24-i%32&255);return r},bytesToHex:function(s){for(var r=[],i=0;i<s.length;i++)r.push((s[i]>>>4).toString(16)),r.push((s[i]&15).toString(16));return r.join("")},hexToBytes:function(s){for(var r=[],i=0;i<s.length;i+=2)r.push(parseInt(s.substr(i,2),16));return r},bytesToBase64:function(s){for(var r=[],i=0;i<s.length;i+=3)for(var a=s[i]<<16|s[i+1]<<8|s[i+2],u=0;u<4;u++)i*8+u*6<=s.length*8?r.push(n.charAt(a>>>6*(3-u)&63)):r.push("=");return r.join("")},base64ToBytes:function(s){s=s.replace(/[^A-Z0-9+\/]/ig,"");for(var r=[],i=0,a=0;i<s.length;a=++i%4)a!=0&&r.push((n.indexOf(s.charAt(i-1))&Math.pow(2,-2*a+8)-1)<<a*2|n.indexOf(s.charAt(i))>>>6-a*2);return r}};ar.exports=e})();var In={utf8:{stringToBytes:function(n){return In.bin.stringToBytes(unescape(encodeURIComponent(n)))},bytesToString:function(n){return decodeURIComponent(escape(In.bin.bytesToString(n)))}},bin:{stringToBytes:function(n){for(var e=[],s=0;s<n.length;s++)e.push(n.charCodeAt(s)&255);return e},bytesToString:function(n){for(var e=[],s=0;s<n.length;s++)e.push(String.fromCharCode(n[s]));return e.join("")}}},Ts=In;/*!
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function Ut(){return((1+Math.random())*65536|0).toString(16).substring(1)}function we(){return Ut()+Ut()+"-"+Ut()+"-"+Ut()+"-"+Ut()+"-"+Ut()+Ut()+Ut()}function Gs(){return we().replace(/-/g,"").slice(0,16)}function Xs(r){let e=r>0?new Date(r):new Date,s=e.getDate()<10?"0"+e.getDate():e.getDate(),n=e.getMonth()<9?"0"+(e.getMonth()+1):e.getMonth()+1,i=e.getFullYear(),a=e.getHours()<10?"0"+e.getHours():e.getHours(),u=e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes(),h=e.getSeconds()<10?"0"+e.getSeconds():e.getSeconds(),_=e.getMilliseconds()<10?"0"+e.getMilliseconds():e.getMilliseconds();return _<100&&(_="0"+_),{time:+e,year:i,month:n,day:s,hour:a,minute:u,second:h,millisecond:_}}function Ws(r){return Object.prototype.toString.call(r)==="[object Number]"}function Qs(r){return typeof r=="bigint"}function Je(r){return typeof r=="string"}function Et(r){return Object.prototype.toString.call(r)==="[object Array]"}function ti(r){return typeof r=="boolean"}function ei(r){return r===void 0}function ri(r){return r===null}function $r(r){return typeof r=="symbol"}function Yt(r){return Object.prototype.toString.call(r)==="[object Object]"||!Ws(r)&&!Qs(r)&&!Je(r)&&!ti(r)&&!Et(r)&&!ri(r)&&!Vs(r)&&!ei(r)&&!$r(r)}function Vs(r){return typeof r=="function"}function si(r){const e=Object.prototype.toString.call(r);return e==="[object Window]"||e==="[object DOMWindow]"||e==="[object global]"}function ni(r){return r==null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||typeof r=="function"||typeof r=="symbol"||typeof r=="bigint"?!1:typeof Symbol<"u"&&typeof r[Symbol.iterator]=="function"}function ii(r){return Object.prototype.toString.call(r).replace(/\[object (.*)\]/,"$1")}function ai(r){let e=Object.prototype.hasOwnProperty;if(!r||typeof r!="object"||r.nodeType||si(r))return!1;try{if(r.constructor&&!e.call(r,"constructor")&&!e.call(r.constructor.prototype,"isPrototypeOf"))return!1}catch{return!1}let s;for(s in r);return s===void 0||e.call(r,s)}const oi=/[\n\t]/g,ci=r=>({"\n":"\\n"," ":"\\t"})[r];function ui(r){return typeof r!="string"?r:String(r).replace(oi,ci)}const hi=()=>{const r=new WeakSet;return e=>{if(typeof e=="object"&&e!==null){if(r.has(e))return!0;r.add(e)}return!1}},ys=(r,e=0)=>{let s="";return Je(r)?(e>0&&(r=Ks(r,e)),s+='"'+ui(r)+'"'):$r(r)?s+=String(r).replace(/^Symbol\((.*)\)$/i,'Symbol("$1")'):Vs(r)?s+=(r.name||"function")+"()":Qs(r)?s+=String(r)+"n":s+=String(r),s},Ar=(r,e,s=0)=>{var n,i;if(!Yt(r)&&!Et(r)){e.ret+=ys(r,e.keyMaxLen);return}if(e.circularFinder(r)){let f="";Et(r)?f="(Circular Array)":Yt(r)&&(f=`(Circular ${((n=r.constructor)==null?void 0:n.name)||"Object"})`),e.ret+=e.standardJSON?`"${f}"`:f;return}let a="",u="";if(e.pretty){for(let f=0;f<=s;f++)a+=" ";u=`
|
|
2
|
+
`}let h="{",_="}";Et(r)&&(h="[",_="]"),e.ret+=h+u;const p=pi(r);for(let f=0;f<p.length;f++){const w=p[f];e.ret+=a;try{Et(r)||(Yt(w)||Et(w)||$r(w)?e.ret+=Object.prototype.toString.call(w):Je(w)&&e.standardJSON?e.ret+='"'+w+'"':e.ret+=w,e.ret+=": ")}catch{continue}try{const l=r[w];Et(l)?e.maxDepth>-1&&s>=e.maxDepth?e.ret+="Array("+l.length+")":Ar(l,e,s+1):Yt(l)?e.maxDepth>-1&&s>=e.maxDepth?e.ret+=(((i=l.constructor)==null?void 0:i.name)||"Object")+" {}":Ar(l,e,s+1):e.ret+=ys(l,e.keyMaxLen)}catch{e.ret+=e.standardJSON?'"(PARSE_ERROR)"':"(PARSE_ERROR)"}if(e.keyMaxLen>0&&e.ret.length>=e.keyMaxLen*10){e.ret+=", (...)";break}f<p.length-1&&(e.ret+=", "),e.ret+=u}e.ret+=a.substring(0,a.length-2)+_};function bs(r,e={maxDepth:-1,keyMaxLen:-1,pretty:!1,standardJSON:!1}){const s=Object.assign({ret:"",maxDepth:-1,keyMaxLen:-1,pretty:!1,standardJSON:!1,circularFinder:hi()},e);return Ar(r,s),s.ret}function li(r){try{return self.Blob?new self.Blob([r],{type:"text/plain"}).size:encodeURI(r).split(/%(?:u[0-9A-F]{2})?[0-9A-F]{2}|./).length-1}catch{return 0}}function je(r){return r<=0?"":r>=1e3*1e3?(r/1e3/1e3).toFixed(1)+" MB":r>=1e3*1?(r/1e3).toFixed(1)+" KB":r+" B"}function Ks(r,e){return r.length>e&&(r=r.substring(0,e)+`...(${je(li(r))})`),r}function pi(r){return!Yt(r)&&!Et(r)?[]:Object.keys(r)}function di(r=[],e=1024*1024){if(!r.length)return[];if(JSON.stringify(r).length<=e)return[r];let s=[],n=[],i=0;for(let a=0;a<r.length;a++){const u=r[a],h=JSON.stringify(u).length;i+h<e?(n.push(u),i+=h):n.length?(s.push(n),n=[u],i=h):(s.push([u]),i=0)}return s}const mi=r=>typeof r=="object"?(r.config&&r.request&&(r.config=void 0,r.request=void 0),r.status!==void 0?r.data?(r.detail=typeof r.data=="object"?JSON.stringify(r.data):r.data,r=new Error(r.detail)):r.body?(r.detail=typeof r.body=="object"?JSON.stringify(r.body):r.body,r=new Error(r.detail)):(r.message=`${r.statusText||r.bodyText||""}`,r=new Error(r.message)):r=new Error(JSON.stringify(r)),r):new Error(r),Jr=r=>{var e;let s=null;r?r&&r instanceof Error?s=r:s=mi(r):(r=new Error("error"),s=r);const n={message:"",detail:"",name:"",stack:[]};if(n.message=s.message,n.name=s.name,n.detail=((e=s.stack)==null?void 0:e.toString())||s.message,s.stack){let i=s.stack.split(/\n\s+at/);i.length&&(i=i.slice(1)),n.stack=i}return n},Or=r=>new Promise(e=>{setTimeout(()=>{e(void 0),r&&r()},0)}),ye=()=>{if(typeof wx<"u"&&!window){const r=getCurrentPages();return r.length?r[r.length-1].route:"applaunch"}else return window.location.href};var fi=Object.defineProperty,gi=(r,e,s)=>e in r?fi(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s,I=(r,e,s)=>(gi(r,typeof e!="symbol"?e+"":e,s),s);class Zs{constructor(e){I(this,"limit"),I(this,"runningSize"),I(this,"taskList"),this.limit=e,this.taskList=[],this.runningSize=0}addTask(e){this.taskList.push(e),this.run()}async run(){for(;this.taskList.length&&this.runningSize<this.limit;){const e=this.taskList.shift();e&&(this.runningSize++,await e(),this.runningSize--,this.run())}}}var Gr=(r=>(r[r.NORMAL=0]="NORMAL",r[r.HIGH=1]="HIGH",r[r.EMERGEN=2]="EMERGEN",r))(Gr||{});class at{constructor(e,s,n){I(this,"_level",0),this.apaasTrack=e,this.type=s,n&&(this._level=n)}getProperties(){return{}}setProperties(e){}getEventLog(e){const s=e||Date.now();return{...this.apaasTrack.baseLog,types:this.type,logtime:String(s),epochnanos:String(s)+"000000",event:this.type,properties:this.getProperties(),url:ye()}}}I(at,"eventOptions"),I(at,"initApaasTrackHook"),I(at,"startApaasTrackHook"),I(at,"destroyApaasTrackHook");class Ys extends at{constructor(e){super(e,"init")}getProperties(){const e=this.apaasTrack.baseLog;return{system:e.system||"",systemver:e.systemver||"",manufacturer:e.manufacturer||"",browser:e.browser||"",browserver:e.browserver||"",terminalid:e.terminalid||"",client:e.client||"",clientver:e.clientver||""}}}class tn extends at{constructor(e){super(e,"custom"),I(this,"info",{})}setCustomType(e){this.type=e}getProperties(){return{...this.info}}setProperties(e){this.info=e}}const ee={init:Ys,custom:tn},Bt=(r,e)=>{const s=ee[e];return new s(r)},en=(r,e,s)=>{const n=s||Date.now(),i=Bt(r,e);return{...r.baseLog,types:e,logtime:String(n),epochnanos:String(n)+"000000",event:e,properties:i.getProperties(),url:ye()}},zr=(r,e,s)=>{const n=s||Date.now();return{...r.baseLog,types:e.type,logtime:String(n),epochnanos:String(n)+"000000",event:e.type,properties:e.getProperties(),url:ye()}},Xr=(r,e)=>{if(ee[r])throw Error(`\u8BE5\u4E8B\u4EF6${r} \u5DF2\u5B58\u5728\uFF0C\u6CE8\u518C\u5931\u8D25`);ee[r]=e};class rn{constructor(e,s){I(this,"name",""),I(this,"time",0),I(this,"info",{}),e&&(this.name=e),s&&(this.info=s),this.time=Date.now()}get epochnanos(){return this.time*1e6}get attributes(){return this.getAttributes()}getAttributes(){return{}}getJson(){return{name:this.name,epochnanos:this.time*1e6,attributes:this.getAttributes(),...this.info}}setInfo(e){this.info=e||{}}}class sn extends rn{constructor(){super(...arguments),I(this,"name","exception"),I(this,"exceptionType",""),I(this,"exceptionMessage",""),I(this,"exceptionStackTrace","")}getAttributes(){return{"exception.type":this.exceptionType,"exception.message":this.exceptionMessage,"exception.stacktrace":this.exceptionStackTrace}}setInfo(e){this.exceptionMessage=e.exceptionMessage,this.exceptionType=e.exceptionType,this.exceptionStackTrace=e.exceptionStackTrace}}class hr extends at{constructor(e,s,n){super(e,"span"),I(this,"spanid",""),I(this,"traceid",""),I(this,"parentspanid",""),I(this,"name",""),I(this,"attributes",{}),I(this,"events",[]),I(this,"statuscode","OK"),I(this,"statusmessage",""),I(this,"startTime",0),I(this,"endTime",0),this.name=s,this.traceid=we(),this.spanid=Gs(),this.parentspanid=n||"",this.start()}trackLog(){this.apaasTrack.addLogByEvent(this)}createSpanEvent(e,s){return new hr(this.apaasTrack,e,s)}setAttribute(e){const s=e.getAttributes();this.attributes=s}addEvent(e){this.events.push(e)}exception(e){const s=new sn;let n="",i="",a="";if(e instanceof Error){const u=Jr(e);n=u.detail,i=u.name,a=u.stack.join(",")}else n=e.exceptionMessage,i=e.exceptionType,a=e.exceptionStackTrace;s.setInfo({exceptionMessage:n,exceptionType:i,exceptionStackTrace:a}),this.events.push(s)}start(){this.startTime=Date.now()}end(e,s){e&&(this.statusmessage=e),s&&(this.statuscode=s),this.endTime=Date.now()}getProperties(){return{traceid:this.traceid,spanid:this.spanid,parentspanid:this.parentspanid,name:this.name,attributes:this.attributes,events:this.events.map(e=>e.getJson()),statuscode:this.statuscode,statusmessage:this.statusmessage,startepochnanos:this.startTime*1e6,endepochnanos:this.endTime*1e6,duration:(this.endTime-this.startTime)*1e6}}}const Lr="1.0.22";class Ge{constructor(e){I(this,"_version",Lr),I(this,"commonLog",null),I(this,"browserLog",null),I(this,"options"),this.options=e,typeof window<"u"&&(window.__apaasTrackVersion__=Lr),typeof wx<"u"&&!window&&(wx.__apaasTrackVersion__=Lr),e.commonLog&&this.initCommonLog(e.commonLog),this.runEventInitHooks()}registerEvent(e,s){Xr(e,s),s.initApaasTrackHook&&s.initApaasTrackHook(this),s.startApaasTrackHook&&s.startApaasTrackHook(this)}get groupid(){var e;return(e=this.browserLog)==null?void 0:e.distinctid}runEventInitHooks(){Object.values(ee).forEach(e=>{e.initApaasTrackHook&&e.initApaasTrackHook(this)})}runEventStartHooks(){Object.values(ee).forEach(e=>{e.startApaasTrackHook&&e.startApaasTrackHook(this)})}runEventDestroyHooks(){Object.values(ee).forEach(e=>{e.destroyApaasTrackHook&&e.destroyApaasTrackHook(this)})}get anonymousid(){var e;return(e=this.browserLog)==null?void 0:e.anonymousid}get distinctid(){var e;return(e=this.browserLog)==null?void 0:e.distinctid}get baseLog(){return{...this.browserLog,...this.commonLog}}initCommonLog(e){this.commonLog=e}createEventLog(e,s){return en(this,e,s)}addLogByType(e,s){const n=this.createEventLog(e,s);this.addLogToQueue(n)}addLogByEvent(e,s){const n=zr(this,e,s);this.addLogToQueue(n)}createCustomEvent(e){const s=Bt(this,"custom");return s.setCustomType(e),s}createSpanEvent(e,s){return new hr(this,e,s)}addLogByCustomEvent(e,s={},n){const i=this.createCustomEvent(e);i.setProperties(s);const a=zr(this,i,n);this.addLogToQueue(a)}executeInitEvent(){const e=Bt(this,"init");e.setProperties({groupid:this.groupid}),this.addLogByEvent(e)}updateCommonLog(e){this.commonLog={...this.commonLog,...e}}trackEvent(e,s={},n){const i=Bt(this,e);i.setProperties(s),this.addLogByEvent(i,n)}start(...e){this.executeInitEvent(),this.runEventStartHooks()}destroy(){this.runEventDestroyHooks()}transformLog(e){return e}async addLogToQueue(e,s=!1,n=!0){n&&(e=this.transformLog(e)),await this.sendLog(e,s)}}I(Ge,"registerEvent",Xr);class vi{constructor(e){I(this,"name",""),I(this,"groupid",""),this.name=e.name,this.groupid=e.groupid}getJson(){return{name:this.name,attributes:this.getAttributes()}}}var _i=Object.defineProperty,wi=(r,e,s)=>e in r?_i(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s,y=(r,e,s)=>(wi(r,typeof e!="symbol"?e+"":e,s),s),yi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Fr={exports:{}};(function(r,e){(function(s,n){var i="1.0.32",a="",u="?",h="function",_="undefined",p="object",f="string",w="major",l="model",v="name",b="type",k="vendor",T="version",R="architecture",tt="console",M="mobile",C="tablet",V="smarttv",J="wearable",ht="embedded",gt=350,zt="Amazon",ie="Apple",Se="ASUS",Xe="BlackBerry",Ft="Browser",Jt="Chrome",wr="Edge",ae="Firefox",Gt="Google",We="Huawei",Y="LG",Tt="Microsoft",Ht="Motorola",oe="Opera",Pe="Samsung",Le="Sharp",Xt="Sony",It="Xiaomi",Ee="Zebra",Qe="Facebook",yr=function(z,q){var A={};for(var W in z)q[W]&&q[W].length%2===0?A[W]=q[W].concat(z[W]):A[W]=z[W];return A},Mt=function(z){for(var q={},A=0;A<z.length;A++)q[z[A].toUpperCase()]=z[A];return q},xe=function(z,q){return typeof z===f?Wt(q).indexOf(Wt(z))!==-1:!1},Wt=function(z){return z.toLowerCase()},br=function(z){return typeof z===f?z.replace(/[^\d\.]/g,a).split(".")[0]:n},Qt=function(z,q){if(typeof z===f)return z=z.replace(/^\s\s*/,a).replace(/\s\s*$/,a),typeof q===_?z:z.substring(0,gt)},lt=function(z,q){for(var A=0,W,O,ue,G,dt,vt;A<q.length&&!dt;){var Ze=q[A],Ce=q[A+1];for(W=O=0;W<Ze.length&&!dt;)if(dt=Ze[W++].exec(z),dt)for(ue=0;ue<Ce.length;ue++)vt=dt[++O],G=Ce[ue],typeof G===p&&G.length>0?G.length===2?typeof G[1]==h?this[G[0]]=G[1].call(this,vt):this[G[0]]=G[1]:G.length===3?typeof G[1]===h&&!(G[1].exec&&G[1].test)?this[G[0]]=vt?G[1].call(this,vt,G[2]):n:this[G[0]]=vt?vt.replace(G[1],G[2]):n:G.length===4&&(this[G[0]]=vt?G[3].call(this,vt.replace(G[1],G[2])):n):this[G]=vt||n;A+=2}},Be=function(z,q){for(var A in q)if(typeof q[A]===p&&q[A].length>0){for(var W=0;W<q[A].length;W++)if(xe(q[A][W],z))return A===u?n:A}else if(xe(q[A],z))return A===u?n:A;return z},Ve={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},Ke={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Rt={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[T,[v,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[T,[v,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[v,T],[/opios[\/ ]+([\w\.]+)/i],[T,[v,oe+" Mini"]],[/\bopr\/([\w\.]+)/i],[T,[v,oe]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[v,T],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[T,[v,"UC"+Ft]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[T,[v,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[T,[v,"WeChat"]],[/konqueror\/([\w\.]+)/i],[T,[v,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[T,[v,"IE"]],[/yabrowser\/([\w\.]+)/i],[T,[v,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[v,/(.+)/,"$1 Secure "+Ft],T],[/\bfocus\/([\w\.]+)/i],[T,[v,ae+" Focus"]],[/\bopt\/([\w\.]+)/i],[T,[v,oe+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[T,[v,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[T,[v,"Dolphin"]],[/coast\/([\w\.]+)/i],[T,[v,oe+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[T,[v,"MIUI "+Ft]],[/fxios\/([-\w\.]+)/i],[T,[v,ae]],[/\bqihu|(qi?ho?o?|360)browser/i],[[v,"360 "+Ft]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[v,/(.+)/,"$1 "+Ft],T],[/(comodo_dragon)\/([\w\.]+)/i],[[v,/_/g," "],T],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[v,T],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[v],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[v,Qe],T],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[v,T],[/\bgsa\/([\w\.]+) .*safari\//i],[T,[v,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[T,[v,Jt+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[v,Jt+" WebView"],T],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[T,[v,"Android "+Ft]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[v,T],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[T,[v,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[T,v],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[v,[T,Be,Ve]],[/(webkit|khtml)\/([\w\.]+)/i],[v,T],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[v,"Netscape"],T],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[T,[v,ae+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[v,T]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[R,"amd64"]],[/(ia32(?=;))/i],[[R,Wt]],[/((?:i[346]|x)86)[;\)]/i],[[R,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[R,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[R,"armhf"]],[/windows (ce|mobile); ppc;/i],[[R,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[R,/ower/,a,Wt]],[/(sun4\w)[;\)]/i],[[R,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[R,Wt]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[l,[k,Pe],[b,C]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[l,[k,Pe],[b,M]],[/\((ip(?:hone|od)[\w ]*);/i],[l,[k,ie],[b,M]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[k,ie],[b,C]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[k,We],[b,C]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[k,We],[b,M]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[l,/_/g," "],[k,It],[b,M]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[k,It],[b,C]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[k,"OPPO"],[b,M]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[k,"Vivo"],[b,M]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[l,[k,"Realme"],[b,M]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[l,[k,Ht],[b,M]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[k,Ht],[b,C]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[k,Y],[b,C]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[k,Y],[b,M]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[k,"Lenovo"],[b,C]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[k,"Nokia"],[b,M]],[/(pixel c)\b/i],[l,[k,Gt],[b,C]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[k,Gt],[b,M]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[l,[k,Xt],[b,M]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[k,Xt],[b,C]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[k,"OnePlus"],[b,M]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[k,zt],[b,C]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[k,zt],[b,M]],[/(playbook);[-\w\),; ]+(rim)/i],[l,k,[b,C]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[k,Xe],[b,M]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[k,Se],[b,C]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[k,Se],[b,M]],[/(nexus 9)/i],[l,[k,"HTC"],[b,C]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[k,[l,/_/g," "],[b,M]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[k,"Acer"],[b,C]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[k,"Meizu"],[b,M]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[k,Le],[b,M]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[k,l,[b,M]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[k,l,[b,C]],[/(surface duo)/i],[l,[k,Tt],[b,C]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[k,"Fairphone"],[b,M]],[/(u304aa)/i],[l,[k,"AT&T"],[b,M]],[/\bsie-(\w*)/i],[l,[k,"Siemens"],[b,M]],[/\b(rct\w+) b/i],[l,[k,"RCA"],[b,C]],[/\b(venue[\d ]{2,7}) b/i],[l,[k,"Dell"],[b,C]],[/\b(q(?:mv|ta)\w+) b/i],[l,[k,"Verizon"],[b,C]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[k,"Barnes & Noble"],[b,C]],[/\b(tm\d{3}\w+) b/i],[l,[k,"NuVision"],[b,C]],[/\b(k88) b/i],[l,[k,"ZTE"],[b,C]],[/\b(nx\d{3}j) b/i],[l,[k,"ZTE"],[b,M]],[/\b(gen\d{3}) b.+49h/i],[l,[k,"Swiss"],[b,M]],[/\b(zur\d{3}) b/i],[l,[k,"Swiss"],[b,C]],[/\b((zeki)?tb.*\b) b/i],[l,[k,"Zeki"],[b,C]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[k,"Dragon Touch"],l,[b,C]],[/\b(ns-?\w{0,9}) b/i],[l,[k,"Insignia"],[b,C]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[k,"NextBook"],[b,C]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[k,"Voice"],l,[b,M]],[/\b(lvtel\-)?(v1[12]) b/i],[[k,"LvTel"],l,[b,M]],[/\b(ph-1) /i],[l,[k,"Essential"],[b,M]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[k,"Envizen"],[b,C]],[/\b(trio[-\w\. ]+) b/i],[l,[k,"MachSpeed"],[b,C]],[/\btu_(1491) b/i],[l,[k,"Rotor"],[b,C]],[/(shield[\w ]+) b/i],[l,[k,"Nvidia"],[b,C]],[/(sprint) (\w+)/i],[k,l,[b,M]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[k,Tt],[b,M]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[k,Ee],[b,C]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[k,Ee],[b,M]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[k,l,[b,tt]],[/droid.+; (shield) bui/i],[l,[k,"Nvidia"],[b,tt]],[/(playstation [345portablevi]+)/i],[l,[k,Xt],[b,tt]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[k,Tt],[b,tt]],[/smart-tv.+(samsung)/i],[k,[b,V]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[k,Pe],[b,V]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[k,Y],[b,V]],[/(apple) ?tv/i],[k,[l,ie+" TV"],[b,V]],[/crkey/i],[[l,Jt+"cast"],[k,Gt],[b,V]],[/droid.+aft(\w)( bui|\))/i],[l,[k,zt],[b,V]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[k,Le],[b,V]],[/(bravia[\w ]+)( bui|\))/i],[l,[k,Xt],[b,V]],[/(mitv-\w{5}) bui/i],[l,[k,It],[b,V]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[k,Qt],[l,Qt],[b,V]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[b,V]],[/((pebble))app/i],[k,l,[b,J]],[/droid.+; (glass) \d/i],[l,[k,Gt],[b,J]],[/droid.+; (wt63?0{2,3})\)/i],[l,[k,Ee],[b,J]],[/(quest( 2)?)/i],[l,[k,Qe],[b,J]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[k,[b,ht]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[l,[b,M]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[b,C]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[b,C]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[b,M]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[k,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[T,[v,wr+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[T,[v,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[v,T],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[T,v]],os:[[/microsoft (windows) (vista|xp)/i],[v,T],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[v,[T,Be,Ke]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[v,"Windows"],[T,Be,Ke]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[T,/_/g,"."],[v,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[v,"Mac OS"],[T,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[T,v],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[v,T],[/\(bb(10);/i],[T,[v,Xe]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[T,[v,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[T,[v,ae+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[T,[v,"webOS"]],[/crkey\/([\d\.]+)/i],[T,[v,Jt+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[v,"Chromium OS"],T],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[v,T],[/(sunos) ?([\w\.\d]*)/i],[[v,"Solaris"],T],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[v,T]]},ot=function(z,q){if(typeof z===p&&(q=z,z=n),!(this instanceof ot))return new ot(z,q).getResult();var A=z||(typeof s!==_&&s.navigator&&s.navigator.userAgent?s.navigator.userAgent:a),W=q?yr(Rt,q):Rt;return this.getBrowser=function(){var O={};return O[v]=n,O[T]=n,lt.call(O,A,W.browser),O.major=br(O.version),O},this.getCPU=function(){var O={};return O[R]=n,lt.call(O,A,W.cpu),O},this.getDevice=function(){var O={};return O[k]=n,O[l]=n,O[b]=n,lt.call(O,A,W.device),O},this.getEngine=function(){var O={};return O[v]=n,O[T]=n,lt.call(O,A,W.engine),O},this.getOS=function(){var O={};return O[v]=n,O[T]=n,lt.call(O,A,W.os),O},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return A},this.setUA=function(O){return A=typeof O===f&&O.length>gt?Qt(O,gt):O,this},this.setUA(A),this};ot.VERSION=i,ot.BROWSER=Mt([v,T,w]),ot.CPU=Mt([R]),ot.DEVICE=Mt([l,k,b,tt,M,V,C,J,ht]),ot.ENGINE=ot.OS=Mt([v,T]),r.exports&&(e=r.exports=ot),e.UAParser=ot;var Nt=typeof s!==_&&(s.jQuery||s.Zepto);if(Nt&&!Nt.ua){var ce=new ot;Nt.ua=ce.getResult(),Nt.ua.get=function(){return ce.getUA()},Nt.ua.set=function(z){ce.setUA(z);var q=ce.getResult();for(var A in q)Nt.ua[A]=q[A]}}})(typeof window=="object"?window:yi)})(Fr,Fr.exports);var nn={exports:{}},an={exports:{}};(function(){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(s,n){return s<<n|s>>>32-n},rotr:function(s,n){return s<<32-n|s>>>n},endian:function(s){if(s.constructor==Number)return e.rotl(s,8)&16711935|e.rotl(s,24)&4278255360;for(var n=0;n<s.length;n++)s[n]=e.endian(s[n]);return s},randomBytes:function(s){for(var n=[];s>0;s--)n.push(Math.floor(Math.random()*256));return n},bytesToWords:function(s){for(var n=[],i=0,a=0;i<s.length;i++,a+=8)n[a>>>5]|=s[i]<<24-a%32;return n},wordsToBytes:function(s){for(var n=[],i=0;i<s.length*32;i+=8)n.push(s[i>>>5]>>>24-i%32&255);return n},bytesToHex:function(s){for(var n=[],i=0;i<s.length;i++)n.push((s[i]>>>4).toString(16)),n.push((s[i]&15).toString(16));return n.join("")},hexToBytes:function(s){for(var n=[],i=0;i<s.length;i+=2)n.push(parseInt(s.substr(i,2),16));return n},bytesToBase64:function(s){for(var n=[],i=0;i<s.length;i+=3)for(var a=s[i]<<16|s[i+1]<<8|s[i+2],u=0;u<4;u++)i*8+u*6<=s.length*8?n.push(r.charAt(a>>>6*(3-u)&63)):n.push("=");return n.join("")},base64ToBytes:function(s){s=s.replace(/[^A-Z0-9+\/]/ig,"");for(var n=[],i=0,a=0;i<s.length;a=++i%4)a!=0&&n.push((r.indexOf(s.charAt(i-1))&Math.pow(2,-2*a+8)-1)<<a*2|r.indexOf(s.charAt(i))>>>6-a*2);return n}};an.exports=e})();var Hr={utf8:{stringToBytes:function(r){return Hr.bin.stringToBytes(unescape(encodeURIComponent(r)))},bytesToString:function(r){return decodeURIComponent(escape(Hr.bin.bytesToString(r)))}},bin:{stringToBytes:function(r){for(var e=[],s=0;s<r.length;s++)e.push(r.charCodeAt(s)&255);return e},bytesToString:function(r){for(var e=[],s=0;s<r.length;s++)e.push(String.fromCharCode(r[s]));return e.join("")}}},ks=Hr;/*!
|
|
3
3
|
* Determine if an object is a Buffer
|
|
4
4
|
*
|
|
5
5
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
6
6
|
* @license MIT
|
|
7
|
-
*/var
|
|
8
|
-
function Ti(n){var e=1,s=2,r=3,i={},a=new Worker(n||"./lzma_worker-min.js");return a.onmessage=function(u){u.data.action===r?i[u.data.cbn]&&typeof i[u.data.cbn].on_progress=="function"&&i[u.data.cbn].on_progress(u.data.result):i[u.data.cbn]&&typeof i[u.data.cbn].on_finish=="function"&&(i[u.data.cbn].on_finish(u.data.result,u.data.error),delete i[u.data.cbn])},a.onerror=function(u){var l=new Error(u.message+" ("+u.filename+":"+u.lineno+")");for(var w in i)i[w].on_finish(null,l);console.error("Uncaught error in lzma_worker",l)},function(){function u(l,w,p,f,v){var h;do h=Math.floor(Math.random()*1e7);while(typeof i[h]<"u");i[h]={on_finish:f,on_progress:v},a.postMessage({action:l,cbn:h,data:w,mode:p})}return{compress:function(l,w,p,f){u(e,l,w,p,f)},decompress:function(l,w,p){u(s,l,!1,w,p)},worker:function(){return a}}}()}var Nn=function(){var n=1,e=3,s=typeof setImmediate=="function"?setImmediate:setTimeout,r=4294967296,i=[4294967295,-r],a=[0,-9223372036854776e3],u=[0,0],l=[1,0];function w(t,o){postMessage({action:e,cbn:o,result:t})}function p(t){var o=[];return o[t-1]=void 0,o}function f(t,o){return _(t[0]+o[0],t[1]+o[1])}function v(t,o){return R(~~Math.max(Math.min(t[1]/r,2147483647),-2147483648)&~~Math.max(Math.min(o[1]/r,2147483647),-2147483648),T(t)&T(o))}function h(t,o){var c,d;return t[0]==o[0]&&t[1]==o[1]?0:(c=t[1]<0,d=o[1]<0,c&&!d?-1:!c&&d?1:J(t,o)[1]<0?-1:1)}function _(t,o){var c,d;for(o%=18446744073709552e3,t%=18446744073709552e3,c=o%r,d=Math.floor(t/r)*r,o=o-c+d,t=t-d+c;t<0;)t+=r,o-=r;for(;t>4294967295;)t-=r,o+=r;for(o=o%18446744073709552e3;o>9223372032559809e3;)o-=18446744073709552e3;for(;o<-9223372036854776e3;)o+=18446744073709552e3;return[t,o]}function y(t,o){return t[0]==o[0]&&t[1]==o[1]}function k(t){return t>=0?[t,0]:[t+r,-r]}function T(t){return t[0]>=2147483648?~~Math.max(Math.min(t[0]-r,2147483647),-2147483648):~~Math.max(Math.min(t[0],2147483647),-2147483648)}function R(t,o){var c,d;return c=t*r,d=o,o<0&&(d+=r),[d,c]}function tt(t){return t<=30?1<<t:tt(30)*tt(t-30)}function M(t,o){var c,d,m,g;if(o&=63,y(t,a))return o?u:t;if(t[1]<0)throw new Error("Neg");return g=tt(o),d=t[1]*g%18446744073709552e3,m=t[0]*g,c=m-m%r,d+=c,m-=c,d>=9223372036854776e3&&(d-=18446744073709552e3),[m,d]}function C(t,o){var c;return o&=63,c=tt(o),_(Math.floor(t[0]/c),t[1]/c)}function V(t,o){var c;return o&=63,c=C(t,o),t[1]<0&&(c=f(c,M([2,0],63-o))),c}function J(t,o){return _(t[0]-o[0],t[1]-o[1])}function ht(t,o){return t.buf=o,t.pos=0,t.count=o.length,t}function gt(t,o,c,d){return t.pos>=t.count?-1:(d=Math.min(d,t.count-t.pos),Jt(t.buf,t.pos,o,c,d),t.pos+=d,d)}function zt(t){return t.buf=p(32),t.count=0,t}function ie(t){var o=t.buf;return o.length=t.count,o}function Se(t,o){t.buf[t.count++]=o<<24>>24}function Xe(t,o,c,d){Jt(o,c,t.buf,t.count,d),t.count+=d}function Ft(t,o,c,d,m){var g;for(g=o;g<c;++g)d[m++]=t.charCodeAt(g)}function Jt(t,o,c,d,m){for(var g=0;g<m;++g)c[d+g]=t[o+g]}function wn(t,o){zr(o,1<<t.s),o._numFastBytes=t.f,Fr(o,t.m),o._numLiteralPosStateBits=0,o._numLiteralContextBits=3,o._posStateBits=2,o._posStateMask=3}function ae(t,o,c,d,m){var g,S;if(h(d,i)<0)throw new Error("invalid length "+d);for(t.length_0=d,g=q({}),wn(m,g),g._writeEndMark=typeof Nn.disableEndMark>"u",Hr(g,c),S=0;S<64;S+=8)Se(c,T(C(d,S))&255);t.chunker=(g._needReleaseMFStream=0,g._inStream=o,g._finished=0,z(g),g._rangeEncoder.Stream=c,Ze(g),W(g),A(g),g._lenEncoder._tableSize=g._numFastBytes+1-2,os(g._lenEncoder,1<<g._posStateBits),g._repMatchLenEncoder._tableSize=g._numFastBytes+1-2,os(g._repMatchLenEncoder,1<<g._posStateBits),g.nowPos64=u,Be({},g))}function Gt(t,o,c){return t.output=zt({}),ae(t,ht({},o),t.output,k(o.length),c),t}function We(t,o,c,d){var m;t._keepSizeBefore=o,t._keepSizeAfter=c,m=o+c+d,(t._bufferBase==null||t._blockSize!=m)&&(t._bufferBase=null,t._blockSize=m,t._bufferBase=p(t._blockSize)),t._pointerToLastSafePosition=t._blockSize-c}function Y(t,o){return t._bufferBase[t._bufferOffset+t._pos+o]}function Tt(t,o,c,d){var m,g;for(t._streamEndWasReached&&t._pos+o+d>t._streamPos&&(d=t._streamPos-(t._pos+o)),++c,g=t._bufferOffset+t._pos+o,m=0;m<d&&t._bufferBase[g+m]==t._bufferBase[g+m-c];++m);return m}function Ht(t){return t._streamPos-t._pos}function oe(t){var o,c,d;for(d=t._bufferOffset+t._pos-t._keepSizeBefore,d>0&&--d,c=t._bufferOffset+t._streamPos-d,o=0;o<c;++o)t._bufferBase[o]=t._bufferBase[d+o];t._bufferOffset-=d}function Pe(t){var o;++t._pos,t._pos>t._posLimit&&(o=t._bufferOffset+t._pos,o>t._pointerToLastSafePosition&&oe(t),Le(t))}function Le(t){var o,c,d;if(!t._streamEndWasReached)for(;;){if(d=-t._bufferOffset+t._blockSize-t._streamPos,!d)return;if(o=gt(t._stream,t._bufferBase,t._bufferOffset+t._streamPos,d),o==-1){t._posLimit=t._streamPos,c=t._bufferOffset+t._posLimit,c>t._pointerToLastSafePosition&&(t._posLimit=t._pointerToLastSafePosition-t._bufferOffset),t._streamEndWasReached=1;return}t._streamPos+=o,t._streamPos>=t._pos+t._keepSizeAfter&&(t._posLimit=t._streamPos-t._keepSizeAfter)}}function Xt(t,o){t._bufferOffset+=o,t._posLimit-=o,t._pos-=o,t._streamPos-=o}var It=function(){var t,o,c,d=[];for(t=0;t<256;++t){for(c=t,o=0;o<8;++o)(c&1)!=0?c=c>>>1^-306674912:c>>>=1;d[t]=c}return d}();function Ee(t,o,c,d,m){var g,S,B;o<1073741567&&(t._cutValue=16+(d>>1),B=~~((o+c+d+m)/2)+256,We(t,o+c,d+m,B),t._matchMaxLen=d,g=o+1,t._cyclicBufferSize!=g&&(t._son=p((t._cyclicBufferSize=g)*2)),S=65536,t.HASH_ARRAY&&(S=o-1,S|=S>>1,S|=S>>2,S|=S>>4,S|=S>>8,S>>=1,S|=65535,S>16777216&&(S>>=1),t._hashMask=S,++S,S+=t.kFixHashSize),S!=t._hashSizeSum&&(t._hash=p(t._hashSizeSum=S)))}function Qe(t,o){var c,d,m,g,S,B,D,L,x,X,F,H,et,P,N,K,j,vt,st,bt,St;if(t._pos+t._matchMaxLen<=t._streamPos)P=t._matchMaxLen;else if(P=t._streamPos-t._pos,P<t.kMinMatchCheck)return Mt(t),0;for(j=0,N=t._pos>t._cyclicBufferSize?t._pos-t._cyclicBufferSize:0,d=t._bufferOffset+t._pos,K=1,L=0,x=0,t.HASH_ARRAY?(St=It[t._bufferBase[d]&255]^t._bufferBase[d+1]&255,L=St&1023,St^=(t._bufferBase[d+2]&255)<<8,x=St&65535,X=(St^It[t._bufferBase[d+3]&255]<<5)&t._hashMask):X=t._bufferBase[d]&255^(t._bufferBase[d+1]&255)<<8,m=t._hash[t.kFixHashSize+X]||0,t.HASH_ARRAY&&(g=t._hash[L]||0,S=t._hash[1024+x]||0,t._hash[L]=t._pos,t._hash[1024+x]=t._pos,g>N&&t._bufferBase[t._bufferOffset+g]==t._bufferBase[d]&&(o[j++]=K=2,o[j++]=t._pos-g-1),S>N&&t._bufferBase[t._bufferOffset+S]==t._bufferBase[d]&&(S==g&&(j-=2),o[j++]=K=3,o[j++]=t._pos-S-1,g=S),j!=0&&g==m&&(j-=2,K=1)),t._hash[t.kFixHashSize+X]=t._pos,st=(t._cyclicBufferPos<<1)+1,bt=t._cyclicBufferPos<<1,H=et=t.kNumHashDirectBytes,t.kNumHashDirectBytes!=0&&m>N&&t._bufferBase[t._bufferOffset+m+t.kNumHashDirectBytes]!=t._bufferBase[d+t.kNumHashDirectBytes]&&(o[j++]=K=t.kNumHashDirectBytes,o[j++]=t._pos-m-1),c=t._cutValue;;){if(m<=N||c--==0){t._son[st]=t._son[bt]=0;break}if(D=t._pos-m,B=(D<=t._cyclicBufferPos?t._cyclicBufferPos-D:t._cyclicBufferPos-D+t._cyclicBufferSize)<<1,vt=t._bufferOffset+m,F=H<et?H:et,t._bufferBase[vt+F]==t._bufferBase[d+F]){for(;++F!=P&&t._bufferBase[vt+F]==t._bufferBase[d+F];);if(K<F&&(o[j++]=K=F,o[j++]=D-1,F==P)){t._son[bt]=t._son[B],t._son[st]=t._son[B+1];break}}(t._bufferBase[vt+F]&255)<(t._bufferBase[d+F]&255)?(t._son[bt]=m,bt=B+1,m=t._son[bt],et=F):(t._son[st]=m,st=B,m=t._son[st],H=F)}return Mt(t),j}function yn(t){t._bufferOffset=0,t._pos=0,t._streamPos=0,t._streamEndWasReached=0,Le(t),t._cyclicBufferPos=0,Xt(t,-1)}function Mt(t){var o;++t._cyclicBufferPos>=t._cyclicBufferSize&&(t._cyclicBufferPos=0),Pe(t),t._pos==1073741823&&(o=t._pos-t._cyclicBufferSize,xe(t._son,t._cyclicBufferSize*2,o),xe(t._hash,t._hashSizeSum,o),Xt(t,o))}function xe(t,o,c){var d,m;for(d=0;d<o;++d)m=t[d]||0,m<=c?m=0:m-=c,t[d]=m}function Wt(t,o){t.HASH_ARRAY=o>2,t.HASH_ARRAY?(t.kNumHashDirectBytes=0,t.kMinMatchCheck=4,t.kFixHashSize=66560):(t.kNumHashDirectBytes=2,t.kMinMatchCheck=3,t.kFixHashSize=0)}function kn(t,o){var c,d,m,g,S,B,D,L,x,X,F,H,et,P,N,K,j;do{if(t._pos+t._matchMaxLen<=t._streamPos)H=t._matchMaxLen;else if(H=t._streamPos-t._pos,H<t.kMinMatchCheck){Mt(t);continue}for(et=t._pos>t._cyclicBufferSize?t._pos-t._cyclicBufferSize:0,d=t._bufferOffset+t._pos,t.HASH_ARRAY?(j=It[t._bufferBase[d]&255]^t._bufferBase[d+1]&255,B=j&1023,t._hash[B]=t._pos,j^=(t._bufferBase[d+2]&255)<<8,D=j&65535,t._hash[1024+D]=t._pos,L=(j^It[t._bufferBase[d+3]&255]<<5)&t._hashMask):L=t._bufferBase[d]&255^(t._bufferBase[d+1]&255)<<8,m=t._hash[t.kFixHashSize+L],t._hash[t.kFixHashSize+L]=t._pos,N=(t._cyclicBufferPos<<1)+1,K=t._cyclicBufferPos<<1,X=F=t.kNumHashDirectBytes,c=t._cutValue;;){if(m<=et||c--==0){t._son[N]=t._son[K]=0;break}if(S=t._pos-m,g=(S<=t._cyclicBufferPos?t._cyclicBufferPos-S:t._cyclicBufferPos-S+t._cyclicBufferSize)<<1,P=t._bufferOffset+m,x=X<F?X:F,t._bufferBase[P+x]==t._bufferBase[d+x]){for(;++x!=H&&t._bufferBase[P+x]==t._bufferBase[d+x];);if(x==H){t._son[K]=t._son[g],t._son[N]=t._son[g+1];break}}(t._bufferBase[P+x]&255)<(t._bufferBase[d+x]&255)?(t._son[K]=m,K=g+1,m=t._son[K],F=x):(t._son[N]=m,N=g,m=t._son[N],X=x)}Mt(t)}while(--o!=0)}function Qt(t){return t-=2,t<4?t:3}function lt(t){return t<4?0:t<10?t-3:t-6}function Be(t,o){return t.encoder=o,t.decoder=null,t.alive=1,t}function Ve(t){if(!t.alive)throw new Error("bad state");if(t.encoder)Ke(t);else throw new Error("No decoding");return t.alive}function Ke(t){ce(t.encoder,t.encoder.processedInSize,t.encoder.processedOutSize,t.encoder.finished),t.inBytesProcessed=t.encoder.processedInSize[0],t.encoder.finished[0]&&(Or(t.encoder),t.alive=0)}var Rt=function(){var t,o,c,d=2,m=[0,1];for(c=2;c<22;++c)for(o=1<<(c>>1)-1,t=0;t<o;++t,++d)m[d]=c<<24>>24;return m}();function ot(t,o){var c,d,m,g;t._optimumEndIndex=o,m=t._optimum[o].PosPrev,d=t._optimum[o].BackPrev;do t._optimum[o].Prev1IsChar&&(us(t._optimum[m]),t._optimum[m].PosPrev=m-1,t._optimum[o].Prev2&&(t._optimum[m-1].Prev1IsChar=0,t._optimum[m-1].PosPrev=t._optimum[o].PosPrev2,t._optimum[m-1].BackPrev=t._optimum[o].BackPrev2)),g=m,c=d,d=t._optimum[g].BackPrev,m=t._optimum[g].PosPrev,t._optimum[g].BackPrev=c,t._optimum[g].PosPrev=o,o=g;while(o>0);return t.backRes=t._optimum[0].BackPrev,t._optimumCurrentIndex=t._optimum[0].PosPrev,t._optimumCurrentIndex}function Nt(t){t._state=0,t._previousByte=0;for(var o=0;o<4;++o)t._repDistances[o]=0}function ce(t,o,c,d){var m,g,S,B,D,L,x,X,F,H,et,P,N,K,j;if(o[0]=u,c[0]=u,d[0]=1,t._inStream&&(t._matchFinder._stream=t._inStream,yn(t._matchFinder),t._needReleaseMFStream=1,t._inStream=null),!t._finished){if(t._finished=1,K=t.nowPos64,y(t.nowPos64,u)){if(!Ht(t._matchFinder)){O(t,T(t.nowPos64));return}Tn(t),N=T(t.nowPos64)&t._posStateMask,Q(t._rangeEncoder,t._isMatch,(t._state<<4)+N,0),t._state=lt(t._state),S=Y(t._matchFinder,-t._additionalOffset),cs(he(t._literalEncoder,T(t.nowPos64),t._previousByte),t._rangeEncoder,S),t._previousByte=S,--t._additionalOffset,t.nowPos64=f(t.nowPos64,l)}if(!Ht(t._matchFinder)){O(t,T(t.nowPos64));return}for(;;){if(x=ue(t,T(t.nowPos64)),H=t.backRes,N=T(t.nowPos64)&t._posStateMask,g=(t._state<<4)+N,x==1&&H==-1)Q(t._rangeEncoder,t._isMatch,g,0),S=Y(t._matchFinder,-t._additionalOffset),j=he(t._literalEncoder,T(t.nowPos64),t._previousByte),t._state<7?cs(j,t._rangeEncoder,S):(F=Y(t._matchFinder,-t._repDistances[0]-1-t._additionalOffset),Jr(j,t._rangeEncoder,F,S)),t._previousByte=S,t._state=lt(t._state);else{if(Q(t._rangeEncoder,t._isMatch,g,1),H<4){if(Q(t._rangeEncoder,t._isRep,t._state,1),H?(Q(t._rangeEncoder,t._isRepG0,t._state,1),H==1?Q(t._rangeEncoder,t._isRepG1,t._state,0):(Q(t._rangeEncoder,t._isRepG1,t._state,1),Q(t._rangeEncoder,t._isRepG2,t._state,H-2))):(Q(t._rangeEncoder,t._isRepG0,t._state,0),x==1?Q(t._rangeEncoder,t._isRep0Long,g,0):Q(t._rangeEncoder,t._isRep0Long,g,1)),x==1?t._state=t._state<7?9:11:(Pn(t._repMatchLenEncoder,t._rangeEncoder,x-2,N),t._state=t._state<7?8:11),B=t._repDistances[H],H!=0){for(L=H;L>=1;--L)t._repDistances[L]=t._repDistances[L-1];t._repDistances[0]=B}}else{for(Q(t._rangeEncoder,t._isRep,t._state,0),t._state=t._state<7?7:10,Pn(t._lenEncoder,t._rangeEncoder,x-2,N),H-=4,P=Sn(H),X=Qt(x),Re(t._posSlotEncoder[X],t._rangeEncoder,P),P>=4&&(D=(P>>1)-1,m=(2|P&1)<<D,et=H-m,P<14?Qr(t._posEncoders,m-P-1,t._rangeEncoder,D,et):(ls(t._rangeEncoder,et>>4,D-4),hs(t._posAlignEncoder,t._rangeEncoder,et&15),++t._alignPriceCount)),B=H,L=3;L>=1;--L)t._repDistances[L]=t._repDistances[L-1];t._repDistances[0]=B,++t._matchPriceCount}t._previousByte=Y(t._matchFinder,x-1-t._additionalOffset)}if(t._additionalOffset-=x,t.nowPos64=f(t.nowPos64,k(x)),!t._additionalOffset){if(t._matchPriceCount>=128&&W(t),t._alignPriceCount>=16&&A(t),o[0]=t.nowPos64,c[0]=Kr(t._rangeEncoder),!Ht(t._matchFinder)){O(t,T(t.nowPos64));return}if(h(J(t.nowPos64,K),[4096,0])>=0){t._finished=0,d[0]=0;return}}}}}function z(t){var o,c;t._matchFinder||(o={},c=4,t._matchFinderType||(c=2),Wt(o,c),t._matchFinder=o),qr(t._literalEncoder,t._numLiteralPosStateBits,t._numLiteralContextBits),!(t._dictionarySize==t._dictionarySizePrev&&t._numFastBytesPrev==t._numFastBytes)&&(Ee(t._matchFinder,t._dictionarySize,4096,t._numFastBytes,274),t._dictionarySizePrev=t._dictionarySize,t._numFastBytesPrev=t._numFastBytes)}function q(t){var o;for(t._repDistances=p(4),t._optimum=[],t._rangeEncoder={},t._isMatch=p(192),t._isRep=p(12),t._isRepG0=p(12),t._isRepG1=p(12),t._isRepG2=p(12),t._isRep0Long=p(192),t._posSlotEncoder=[],t._posEncoders=p(114),t._posAlignEncoder=Me({},4),t._lenEncoder=as({}),t._repMatchLenEncoder=as({}),t._literalEncoder={},t._matchDistances=[],t._posSlotPrices=[],t._distancesPrices=[],t._alignPrices=p(16),t.reps=p(4),t.repLens=p(4),t.processedInSize=[u],t.processedOutSize=[u],t.finished=[0],t.properties=p(5),t.tempPrices=p(128),t._longestMatchLength=0,t._matchFinderType=1,t._numDistancePairs=0,t._numFastBytesPrev=-1,t.backRes=0,o=0;o<4096;++o)t._optimum[o]={};for(o=0;o<4;++o)t._posSlotEncoder[o]=Me({},6);return t}function A(t){for(var o=0;o<16;++o)t._alignPrices[o]=Wr(t._posAlignEncoder,o);t._alignPriceCount=0}function W(t){var o,c,d,m,g,S,B,D;for(m=4;m<128;++m)S=Sn(m),d=(S>>1)-1,o=(2|S&1)<<d,t.tempPrices[m]=Vr(t._posEncoders,o-S-1,d,m-o);for(g=0;g<4;++g){for(c=t._posSlotEncoder[g],B=g<<6,S=0;S<t._distTableSize;++S)t._posSlotPrices[B+S]=tn(c,S);for(S=14;S<t._distTableSize;++S)t._posSlotPrices[B+S]+=(S>>1)-1-4<<6;for(D=g*128,m=0;m<4;++m)t._distancesPrices[D+m]=t._posSlotPrices[B+m];for(;m<128;++m)t._distancesPrices[D+m]=t._posSlotPrices[B+Sn(m)]+t.tempPrices[m]}t._matchPriceCount=0}function O(t,o){ss(t),Ir(t,o&t._posStateMask);for(var c=0;c<5;++c)Ln(t._rangeEncoder)}function ue(t,o){var c,d,m,g,S,B,D,L,x,X,F,H,et,P,N,K,j,vt,st,bt,St,pt,le,en,wt,Pt,Lt,ut,Dt,Z,E,jt,Kt,rt,it,fs,yt,Ae,Zt,At,pe,Oe,U,nt,de,gs,_s,vs,bs,ws;if(t._optimumEndIndex!=t._optimumCurrentIndex)return et=t._optimum[t._optimumCurrentIndex].PosPrev-t._optimumCurrentIndex,t.backRes=t._optimum[t._optimumCurrentIndex].BackPrev,t._optimumCurrentIndex=t._optimum[t._optimumCurrentIndex].PosPrev,et;if(t._optimumCurrentIndex=t._optimumEndIndex=0,t._longestMatchWasFound?(H=t._longestMatchLength,t._longestMatchWasFound=0):H=Tn(t),Lt=t._numDistancePairs,wt=Ht(t._matchFinder)+1,wt<2)return t.backRes=-1,1;for(wt>273&&(wt=273),At=0,x=0;x<4;++x)t.reps[x]=t._repDistances[x],t.repLens[x]=Tt(t._matchFinder,-1,t.reps[x],273),t.repLens[x]>t.repLens[At]&&(At=x);if(t.repLens[At]>=t._numFastBytes)return t.backRes=At,et=t.repLens[At],Ce(t,et-1),et;if(H>=t._numFastBytes)return t.backRes=t._matchDistances[Lt-1]+4,Ce(t,H-1),H;if(D=Y(t._matchFinder,-1),j=Y(t._matchFinder,-t._repDistances[0]-1-1),H<2&&D!=j&&t.repLens[At]<2)return t.backRes=-1,1;if(t._optimum[0].State=t._state,rt=o&t._posStateMask,t._optimum[1].Price=$[t._isMatch[(t._state<<4)+rt]>>>2]+Ye(he(t._literalEncoder,o,t._previousByte),t._state>=7,j,D),us(t._optimum[1]),vt=$[2048-t._isMatch[(t._state<<4)+rt]>>>2],Zt=vt+$[2048-t._isRep[t._state]>>>2],j==D&&(pe=Zt+_t(t,t._state,rt),pe<t._optimum[1].Price&&(t._optimum[1].Price=pe,Xr(t._optimum[1]))),F=H>=t.repLens[At]?H:t.repLens[At],F<2)return t.backRes=t._optimum[1].BackPrev,1;t._optimum[1].PosPrev=0,t._optimum[0].Backs0=t.reps[0],t._optimum[0].Backs1=t.reps[1],t._optimum[0].Backs2=t.reps[2],t._optimum[0].Backs3=t.reps[3],X=F;do t._optimum[X--].Price=268435455;while(X>=2);for(x=0;x<4;++x)if(Ae=t.repLens[x],!(Ae<2)){fs=Zt+dt(t,x,t._state,rt);do g=fs+Vt(t._repMatchLenEncoder,Ae-2,rt),E=t._optimum[Ae],g<E.Price&&(E.Price=g,E.PosPrev=0,E.BackPrev=x,E.Prev1IsChar=0);while(--Ae>=2)}if(en=vt+$[t._isRep[t._state]>>>2],X=t.repLens[0]>=2?t.repLens[0]+1:2,X<=H){for(ut=0;X>t._matchDistances[ut];)ut+=2;for(;L=t._matchDistances[ut+1],g=en+G(t,L,X,rt),E=t._optimum[X],g<E.Price&&(E.Price=g,E.PosPrev=0,E.BackPrev=L+4,E.Prev1IsChar=0),!(X==t._matchDistances[ut]&&(ut+=2,ut==Lt));++X);}for(c=0;;){if(++c,c==F)return ot(t,c);if(st=Tn(t),Lt=t._numDistancePairs,st>=t._numFastBytes)return t._longestMatchLength=st,t._longestMatchWasFound=1,ot(t,c);if(++o,Kt=t._optimum[c].PosPrev,t._optimum[c].Prev1IsChar?(--Kt,t._optimum[c].Prev2?(U=t._optimum[t._optimum[c].PosPrev2].State,t._optimum[c].BackPrev2<4?U=U<7?8:11:U=U<7?7:10):U=t._optimum[Kt].State,U=lt(U)):U=t._optimum[Kt].State,Kt==c-1?t._optimum[c].BackPrev?U=lt(U):U=U<7?9:11:(t._optimum[c].Prev1IsChar&&t._optimum[c].Prev2?(Kt=t._optimum[c].PosPrev2,jt=t._optimum[c].BackPrev2,U=U<7?8:11):(jt=t._optimum[c].BackPrev,jt<4?U=U<7?8:11:U=U<7?7:10),Z=t._optimum[Kt],jt<4?jt?jt==1?(t.reps[0]=Z.Backs1,t.reps[1]=Z.Backs0,t.reps[2]=Z.Backs2,t.reps[3]=Z.Backs3):jt==2?(t.reps[0]=Z.Backs2,t.reps[1]=Z.Backs0,t.reps[2]=Z.Backs1,t.reps[3]=Z.Backs3):(t.reps[0]=Z.Backs3,t.reps[1]=Z.Backs0,t.reps[2]=Z.Backs1,t.reps[3]=Z.Backs2):(t.reps[0]=Z.Backs0,t.reps[1]=Z.Backs1,t.reps[2]=Z.Backs2,t.reps[3]=Z.Backs3):(t.reps[0]=jt-4,t.reps[1]=Z.Backs0,t.reps[2]=Z.Backs1,t.reps[3]=Z.Backs2)),t._optimum[c].State=U,t._optimum[c].Backs0=t.reps[0],t._optimum[c].Backs1=t.reps[1],t._optimum[c].Backs2=t.reps[2],t._optimum[c].Backs3=t.reps[3],B=t._optimum[c].Price,D=Y(t._matchFinder,-1),j=Y(t._matchFinder,-t.reps[0]-1-1),rt=o&t._posStateMask,d=B+$[t._isMatch[(U<<4)+rt]>>>2]+Ye(he(t._literalEncoder,o,Y(t._matchFinder,-2)),U>=7,j,D),pt=t._optimum[c+1],bt=0,d<pt.Price&&(pt.Price=d,pt.PosPrev=c,pt.BackPrev=-1,pt.Prev1IsChar=0,bt=1),vt=B+$[2048-t._isMatch[(U<<4)+rt]>>>2],Zt=vt+$[2048-t._isRep[U]>>>2],j==D&&!(pt.PosPrev<c&&!pt.BackPrev)&&(pe=Zt+($[t._isRepG0[U]>>>2]+$[t._isRep0Long[(U<<4)+rt]>>>2]),pe<=pt.Price&&(pt.Price=pe,pt.PosPrev=c,pt.BackPrev=0,pt.Prev1IsChar=0,bt=1)),Pt=Ht(t._matchFinder)+1,Pt=4095-c<Pt?4095-c:Pt,wt=Pt,!(wt<2)){if(wt>t._numFastBytes&&(wt=t._numFastBytes),!bt&&j!=D&&(de=Math.min(Pt-1,t._numFastBytes),N=Tt(t._matchFinder,0,t.reps[0],de),N>=2)){for(nt=lt(U),it=o+1&t._posStateMask,le=d+$[2048-t._isMatch[(nt<<4)+it]>>>2]+$[2048-t._isRep[nt]>>>2],Dt=c+1+N;F<Dt;)t._optimum[++F].Price=268435455;g=le+(gs=Vt(t._repMatchLenEncoder,N-2,it),gs+dt(t,0,nt,it)),E=t._optimum[Dt],g<E.Price&&(E.Price=g,E.PosPrev=c+1,E.BackPrev=0,E.Prev1IsChar=1,E.Prev2=0)}for(Oe=2,yt=0;yt<4;++yt)if(P=Tt(t._matchFinder,-1,t.reps[yt],wt),!(P<2)){K=P;do{for(;F<c+P;)t._optimum[++F].Price=268435455;g=Zt+(_s=Vt(t._repMatchLenEncoder,P-2,rt),_s+dt(t,yt,U,rt)),E=t._optimum[c+P],g<E.Price&&(E.Price=g,E.PosPrev=c,E.BackPrev=yt,E.Prev1IsChar=0)}while(--P>=2);if(P=K,yt||(Oe=P+1),P<Pt&&(de=Math.min(Pt-1-P,t._numFastBytes),N=Tt(t._matchFinder,P,t.reps[yt],de),N>=2)){for(nt=U<7?8:11,it=o+P&t._posStateMask,m=Zt+(vs=Vt(t._repMatchLenEncoder,P-2,rt),vs+dt(t,yt,U,rt))+$[t._isMatch[(nt<<4)+it]>>>2]+Ye(he(t._literalEncoder,o+P,Y(t._matchFinder,P-1-1)),1,Y(t._matchFinder,P-1-(t.reps[yt]+1)),Y(t._matchFinder,P-1)),nt=lt(nt),it=o+P+1&t._posStateMask,St=m+$[2048-t._isMatch[(nt<<4)+it]>>>2],le=St+$[2048-t._isRep[nt]>>>2],Dt=P+1+N;F<c+Dt;)t._optimum[++F].Price=268435455;g=le+(bs=Vt(t._repMatchLenEncoder,N-2,it),bs+dt(t,0,nt,it)),E=t._optimum[c+Dt],g<E.Price&&(E.Price=g,E.PosPrev=c+P+1,E.BackPrev=0,E.Prev1IsChar=1,E.Prev2=1,E.PosPrev2=c,E.BackPrev2=yt)}}if(st>wt){for(st=wt,Lt=0;st>t._matchDistances[Lt];Lt+=2);t._matchDistances[Lt]=st,Lt+=2}if(st>=Oe){for(en=vt+$[t._isRep[U]>>>2];F<c+st;)t._optimum[++F].Price=268435455;for(ut=0;Oe>t._matchDistances[ut];)ut+=2;for(P=Oe;;++P)if(S=t._matchDistances[ut+1],g=en+G(t,S,P,rt),E=t._optimum[c+P],g<E.Price&&(E.Price=g,E.PosPrev=c,E.BackPrev=S+4,E.Prev1IsChar=0),P==t._matchDistances[ut]){if(P<Pt&&(de=Math.min(Pt-1-P,t._numFastBytes),N=Tt(t._matchFinder,P,S,de),N>=2)){for(nt=U<7?7:10,it=o+P&t._posStateMask,m=g+$[t._isMatch[(nt<<4)+it]>>>2]+Ye(he(t._literalEncoder,o+P,Y(t._matchFinder,P-1-1)),1,Y(t._matchFinder,P-(S+1)-1),Y(t._matchFinder,P-1)),nt=lt(nt),it=o+P+1&t._posStateMask,St=m+$[2048-t._isMatch[(nt<<4)+it]>>>2],le=St+$[2048-t._isRep[nt]>>>2],Dt=P+1+N;F<c+Dt;)t._optimum[++F].Price=268435455;g=le+(ws=Vt(t._repMatchLenEncoder,N-2,it),ws+dt(t,0,nt,it)),E=t._optimum[c+Dt],g<E.Price&&(E.Price=g,E.PosPrev=c+P+1,E.BackPrev=0,E.Prev1IsChar=1,E.Prev2=1,E.PosPrev2=c,E.BackPrev2=S+4)}if(ut+=2,ut==Lt)break}}}}}function G(t,o,c,d){var m,g=Qt(c);return o<128?m=t._distancesPrices[g*128+o]:m=t._posSlotPrices[(g<<6)+Nr(o)]+t._alignPrices[o&15],m+Vt(t._lenEncoder,c-2,d)}function dt(t,o,c,d){var m;return o?(m=$[2048-t._isRepG0[c]>>>2],o==1?m+=$[t._isRepG1[c]>>>2]:(m+=$[2048-t._isRepG1[c]>>>2],m+=De(t._isRepG2[c],o-2))):(m=$[t._isRepG0[c]>>>2],m+=$[2048-t._isRep0Long[(c<<4)+d]>>>2]),m}function _t(t,o,c){return $[t._isRepG0[o]>>>2]+$[t._isRep0Long[(o<<4)+c]>>>2]}function Ze(t){Nt(t),Zr(t._rangeEncoder),ct(t._isMatch),ct(t._isRep0Long),ct(t._isRep),ct(t._isRepG0),ct(t._isRepG1),ct(t._isRepG2),ct(t._posEncoders),$r(t._literalEncoder);for(var o=0;o<4;++o)ct(t._posSlotEncoder[o].Models);rs(t._lenEncoder,1<<t._posStateBits),rs(t._repMatchLenEncoder,1<<t._posStateBits),ct(t._posAlignEncoder.Models),t._longestMatchWasFound=0,t._optimumEndIndex=0,t._optimumCurrentIndex=0,t._additionalOffset=0}function Ce(t,o){o>0&&(kn(t._matchFinder,o),t._additionalOffset+=o)}function Tn(t){var o=0;return t._numDistancePairs=Qe(t._matchFinder,t._matchDistances),t._numDistancePairs>0&&(o=t._matchDistances[t._numDistancePairs-2],o==t._numFastBytes&&(o+=Tt(t._matchFinder,o-1,t._matchDistances[t._numDistancePairs-1],273-o))),++t._additionalOffset,o}function ss(t){t._matchFinder&&t._needReleaseMFStream&&(t._matchFinder._stream=null,t._needReleaseMFStream=0)}function Or(t){ss(t),t._rangeEncoder.Stream=null}function zr(t,o){t._dictionarySize=o;for(var c=0;o>1<<c;++c);t._distTableSize=c*2}function Fr(t,o){var c=t._matchFinderType;t._matchFinderType=o,t._matchFinder&&c!=t._matchFinderType&&(t._dictionarySizePrev=-1,t._matchFinder=null)}function Hr(t,o){t.properties[0]=(t._posStateBits*5+t._numLiteralPosStateBits)*9+t._numLiteralContextBits<<24>>24;for(var c=0;c<4;++c)t.properties[1+c]=t._dictionarySize>>8*c<<24>>24;Xe(o,t.properties,0,5)}function Ir(t,o){if(t._writeEndMark){Q(t._rangeEncoder,t._isMatch,(t._state<<4)+o,1),Q(t._rangeEncoder,t._isRep,t._state,0),t._state=t._state<7?7:10,Pn(t._lenEncoder,t._rangeEncoder,0,o);var c=Qt(2);Re(t._posSlotEncoder[c],t._rangeEncoder,63),ls(t._rangeEncoder,67108863,26),hs(t._posAlignEncoder,t._rangeEncoder,15)}}function Sn(t){return t<2048?Rt[t]:t<2097152?Rt[t>>10]+20:Rt[t>>20]+40}function Nr(t){return t<131072?Rt[t>>6]+12:t<134217728?Rt[t>>16]+32:Rt[t>>26]+52}function jr(t,o,c,d){c<8?(Q(o,t._choice,0,0),Re(t._lowCoder[d],o,c)):(c-=8,Q(o,t._choice,0,1),c<8?(Q(o,t._choice,1,0),Re(t._midCoder[d],o,c)):(Q(o,t._choice,1,1),Re(t._highCoder,o,c-8)))}function Ur(t){t._choice=p(2),t._lowCoder=p(16),t._midCoder=p(16),t._highCoder=Me({},8);for(var o=0;o<16;++o)t._lowCoder[o]=Me({},3),t._midCoder[o]=Me({},3);return t}function rs(t,o){ct(t._choice);for(var c=0;c<o;++c)ct(t._lowCoder[c].Models),ct(t._midCoder[c].Models);ct(t._highCoder.Models)}function is(t,o,c,d,m){var g,S,B,D,L;for(g=$[t._choice[0]>>>2],S=$[2048-t._choice[0]>>>2],B=S+$[t._choice[1]>>>2],D=S+$[2048-t._choice[1]>>>2],L=0,L=0;L<8;++L){if(L>=c)return;d[m+L]=g+tn(t._lowCoder[o],L)}for(;L<16;++L){if(L>=c)return;d[m+L]=B+tn(t._midCoder[o],L-8)}for(;L<c;++L)d[m+L]=D+tn(t._highCoder,L-8-8)}function Pn(t,o,c,d){jr(t,o,c,d),--t._counters[d]==0&&(is(t,d,t._tableSize,t._prices,d*272),t._counters[d]=t._tableSize)}function as(t){return Ur(t),t._prices=[],t._counters=[],t}function Vt(t,o,c){return t._prices[c*272+o]}function os(t,o){for(var c=0;c<o;++c)is(t,c,t._tableSize,t._prices,c*272),t._counters[c]=t._tableSize}function qr(t,o,c){var d,m;if(!(t.m_Coders!=null&&t.m_NumPrevBits==c&&t.m_NumPosBits==o))for(t.m_NumPosBits=o,t.m_PosMask=(1<<o)-1,t.m_NumPrevBits=c,m=1<<t.m_NumPrevBits+t.m_NumPosBits,t.m_Coders=p(m),d=0;d<m;++d)t.m_Coders[d]=Gr({})}function he(t,o,c){return t.m_Coders[((o&t.m_PosMask)<<t.m_NumPrevBits)+((c&255)>>>8-t.m_NumPrevBits)]}function $r(t){var o,c=1<<t.m_NumPrevBits+t.m_NumPosBits;for(o=0;o<c;++o)ct(t.m_Coders[o].m_Encoders)}function cs(t,o,c){var d,m,g=1;for(m=7;m>=0;--m)d=c>>m&1,Q(o,t.m_Encoders,g,d),g=g<<1|d}function Jr(t,o,c,d){var m,g,S,B,D=1,L=1;for(g=7;g>=0;--g)m=d>>g&1,B=L,D&&(S=c>>g&1,B+=1+S<<8,D=S==m),Q(o,t.m_Encoders,B,m),L=L<<1|m}function Gr(t){return t.m_Encoders=p(768),t}function Ye(t,o,c,d){var m,g=1,S=7,B,D=0;if(o){for(;S>=0;--S)if(B=c>>S&1,m=d>>S&1,D+=De(t.m_Encoders[(1+B<<8)+g],m),g=g<<1|m,B!=m){--S;break}}for(;S>=0;--S)m=d>>S&1,D+=De(t.m_Encoders[g],m),g=g<<1|m;return D}function us(t){t.BackPrev=-1,t.Prev1IsChar=0}function Xr(t){t.BackPrev=0,t.Prev1IsChar=0}function Me(t,o){return t.NumBitLevels=o,t.Models=p(1<<o),t}function Re(t,o,c){var d,m,g=1;for(m=t.NumBitLevels;m!=0;)--m,d=c>>>m&1,Q(o,t.Models,g,d),g=g<<1|d}function tn(t,o){var c,d,m=1,g=0;for(d=t.NumBitLevels;d!=0;)--d,c=o>>>d&1,g+=De(t.Models[m],c),m=(m<<1)+c;return g}function hs(t,o,c){var d,m,g=1;for(m=0;m<t.NumBitLevels;++m)d=c&1,Q(o,t.Models,g,d),g=g<<1|d,c>>=1}function Wr(t,o){var c,d,m=1,g=0;for(d=t.NumBitLevels;d!=0;--d)c=o&1,o>>>=1,g+=De(t.Models[m],c),m=m<<1|c;return g}function Qr(t,o,c,d,m){var g,S,B=1;for(S=0;S<d;++S)g=m&1,Q(c,t,o+B,g),B=B<<1|g,m>>=1}function Vr(t,o,c,d){var m,g,S=1,B=0;for(g=c;g!=0;--g)m=d&1,d>>>=1,B+=$[((t[o+S]-m^-m)&2047)>>>2],S=S<<1|m;return B}function ct(t){for(var o=t.length-1;o>=0;--o)t[o]=1024}var $=function(){var t,o,c,d,m=[];for(o=8;o>=0;--o)for(d=1<<9-o-1,t=1<<9-o,c=d;c<t;++c)m[c]=(o<<6)+(t-c<<6>>>9-o-1);return m}();function Q(t,o,c,d){var m,g=o[c];m=(t.Range>>>11)*g,d?(t.Low=f(t.Low,v(k(m),[4294967295,0])),t.Range-=m,o[c]=g-(g>>>5)<<16>>16):(t.Range=m,o[c]=g+(2048-g>>>5)<<16>>16),t.Range&-16777216||(t.Range<<=8,Ln(t))}function ls(t,o,c){for(var d=c-1;d>=0;--d)t.Range>>>=1,(o>>>d&1)==1&&(t.Low=f(t.Low,k(t.Range))),t.Range&-16777216||(t.Range<<=8,Ln(t))}function Kr(t){return f(f(k(t._cacheSize),t._position),[4,0])}function Zr(t){t._position=u,t.Low=u,t.Range=-1,t._cacheSize=1,t._cache=0}function Ln(t){var o,c=T(V(t.Low,32));if(c!=0||h(t.Low,[4278190080,0])<0){t._position=f(t._position,k(t._cacheSize)),o=t._cache;do Se(t.Stream,o+c),o=255;while(--t._cacheSize!=0);t._cache=T(t.Low)>>>24}++t._cacheSize,t.Low=M(v(t.Low,[16777215,0]),8)}function De(t,o){return $[((t-o^-o)&2047)>>>2]}function ps(t){var o,c=[],d,m=0,g,S=t.length;if(typeof t=="object")return t;for(Ft(t,0,S,c,0),g=0;g<S;++g)o=c[g],o>=1&&o<=127?++m:!o||o>=128&&o<=2047?m+=2:m+=3;for(d=[],m=0,g=0;g<S;++g)o=c[g],o>=1&&o<=127?d[m++]=o<<24>>24:!o||o>=128&&o<=2047?(d[m++]=(192|o>>6&31)<<24>>24,d[m++]=(128|o&63)<<24>>24):(d[m++]=(224|o>>12&15)<<24>>24,d[m++]=(128|o>>6&63)<<24>>24,d[m++]=(128|o&63)<<24>>24);return d}function ds(t){return t[1]+t[0]}function Yr(t,o,c,d){var m={},g,S,B=typeof c>"u"&&typeof d>"u";if(typeof c!="function"&&(S=c,c=d=0),d=d||function(L){if(!(typeof S>"u"))return w(L,S)},c=c||function(L,x){if(!(typeof S>"u"))return postMessage({action:n,cbn:S,result:L,error:x})},B){for(m.c=Gt({},ps(t),ms(o));Ve(m.c.chunker););return ie(m.c.output)}try{m.c=Gt({},ps(t),ms(o)),d(0)}catch(L){return c(null,L)}function D(){try{for(var L,x=new Date().getTime();Ve(m.c.chunker);)if(g=ds(m.c.chunker.inBytesProcessed)/ds(m.c.length_0),new Date().getTime()-x>200)return d(g),s(D,0),0;d(1),L=ie(m.c.output),s(c.bind(null,L),0)}catch(X){c(null,X)}}s(D,0)}var ms=function(){var t=[{s:16,f:64,m:0},{s:20,f:64,m:0},{s:19,f:64,m:1},{s:20,f:64,m:1},{s:21,f:128,m:1},{s:22,f:128,m:1},{s:23,f:128,m:1},{s:24,f:255,m:1},{s:25,f:255,m:1}];return function(o){return t[o-1]||t[6]}}();return typeof onmessage<"u"&&(typeof window>"u"||typeof window.document>"u")&&function(){onmessage=function(t){t&&t.data&&t.data.action==n&&Nn.compress(t.data.data,t.data.mode,t.data.cbn)}}(),{compress:Yr}}();const Si=async n=>await Li(n);let nn=null;const Pi=async n=>(n=n||'"./lzma_worker-min.js"',nn||(await Si(n)?nn=Ti(n):(console.error("lzma\u65E0\u6CD5\u627E\u5230"+n+": \u65E0\u6CD5\u542F\u52A8worker\u6A21\u5F0F\uFF0C\u5C06\u542F\u7528\u6D4F\u89C8\u5668\u8BA1\u7B97\u6A21\u5F0F\uFF0C\u6027\u80FD\u53D7\u5F71\u54CD"),nn=Nn),nn)),Li=n=>new Promise((e,s)=>{const r=new XMLHttpRequest;r.open("get",n,!0),r.addEventListener("error",i=>{e(!1)}),r.addEventListener("load",i=>{r.status===200&&e(!0),e(!1)}),r.send()}),Ei=new Ys(5);let cr="";const xi=n=>{cr=n};let Ss=null;const ur=n=>{const e=typeof n=="string"?n:JSON.stringify(n);let s=location.pathname;s=s.replace(/[^\/\/.]+\.(html|html)$/,"").replace("//","/");const r=cr||location.origin+s+"static/lzma_worker.js";return console.log("lzma_worker",r),new Promise(async i=>{let a=Date.now();window.requestIdleCallback(async()=>{Ss=await Pi(r),Ss.compress(e,5,(u,l)=>{if(!u)throw Error("static/lzma_worker.js \u65E0\u6CD5\u52A0\u8F7D\uFF0C\u8BF7\u68C0\u67E5\u8BE5\u6587\u4EF6");console.log("compress finish",Date.now()-a);const w=[...u],p=new Int8Array(w.length);for(let f=0;f<w.length;f++)p[f]=w[f];console.log("compress success",Date.now()-a),i(p)})})})},cn=async(n,e,s)=>new Promise((r,i)=>{const a=new XMLHttpRequest;a.open("POST",n,!0),s?(a.setRequestHeader("xw-body-encoding","v1"),Ei.addTask(()=>new Promise((u,l)=>{ur(e).then(w=>{a.send(w.buffer)}).finally(()=>{u()})}))):a.send(JSON.stringify(e)),a.onreadystatechange=()=>{},a.addEventListener("readystatechange",u=>{a.readyState===4&&a.status===200?r(void 0):a.status===500&&i(a.statusText)}),a.addEventListener("error",u=>{console.error("\u957F\u5EA6",JSON.stringify(e).length),i(u)})}),Bi=(n,e,s)=>{window.navigator.sendBeacon!==void 0?s?ur(e).then(r=>{window.navigator.sendBeacon(n,r.buffer)}):window.navigator.sendBeacon(n,JSON.stringify(e)):cn(n,e,s)};class Ci{constructor(){b(this,"logs",[])}get length(){return this.logs.length}async init(){}async push(e){try{this.logs.push(e)}catch(s){console.error(s)}}async compulsionSave(){}clearArray(){this.logs.length=0}async shift(e=1){let s=[[...this.logs]];return this.clearArray(),s}}async function Mi(n){const e=new Ci;return await e.init(),e}var Ri=typeof global=="object"&&global&&global.Object===Object&&global;const Di=Ri;var Ai=typeof self=="object"&&self&&self.Object===Object&&self,Oi=Di||Ai||Function("return this")();const pn=Oi;var zi=pn.Symbol;const $t=zi;var hr=Object.prototype,Fi=hr.hasOwnProperty,Hi=hr.toString,ze=$t?$t.toStringTag:void 0;function Ii(n){var e=Fi.call(n,ze),s=n[ze];try{n[ze]=void 0;var r=!0}catch{}var i=Hi.call(n);return r&&(e?n[ze]=s:delete n[ze]),i}var Ni=Object.prototype,ji=Ni.toString;function Ui(n){return ji.call(n)}var qi="[object Null]",$i="[object Undefined]",Ps=$t?$t.toStringTag:void 0;function Qn(n){return n==null?n===void 0?$i:qi:Ps&&Ps in Object(n)?Ii(n):Ui(n)}function Vn(n){return n!=null&&typeof n=="object"}var Ji="[object Symbol]";function dn(n){return typeof n=="symbol"||Vn(n)&&Qn(n)==Ji}function Gi(n,e){for(var s=-1,r=n==null?0:n.length,i=Array(r);++s<r;)i[s]=e(n[s],s,n);return i}var Xi=Array.isArray;const mn=Xi;var Wi=1/0,Ls=$t?$t.prototype:void 0,Es=Ls?Ls.toString:void 0;function lr(n){if(typeof n=="string")return n;if(mn(n))return Gi(n,lr)+"";if(dn(n))return Es?Es.call(n):"";var e=n+"";return e=="0"&&1/n==-Wi?"-0":e}var Qi=/\s/;function Vi(n){for(var e=n.length;e--&&Qi.test(n.charAt(e)););return e}var Ki=/^\s+/;function Zi(n){return n&&n.slice(0,Vi(n)+1).replace(Ki,"")}function Ue(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var xs=0/0,Yi=/^[-+]0x[0-9a-f]+$/i,ta=/^0b[01]+$/i,ea=/^0o[0-7]+$/i,na=parseInt;function Bs(n){if(typeof n=="number")return n;if(dn(n))return xs;if(Ue(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=Ue(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=Zi(n);var s=ta.test(n);return s||ea.test(n)?na(n.slice(2),s?2:8):Yi.test(n)?xs:+n}var sa="[object AsyncFunction]",ra="[object Function]",ia="[object GeneratorFunction]",aa="[object Proxy]";function oa(n){if(!Ue(n))return!1;var e=Qn(n);return e==ra||e==ia||e==sa||e==aa}var ca=pn["__core-js_shared__"];const xn=ca;var Cs=function(){var n=/[^.]+$/.exec(xn&&xn.keys&&xn.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function ua(n){return!!Cs&&Cs in n}var ha=Function.prototype,la=ha.toString;function pa(n){if(n!=null){try{return la.call(n)}catch{}try{return n+""}catch{}}return""}var da=/[\\^$.*+?()[\]{}|]/g,ma=/^\[object .+?Constructor\]$/,fa=Function.prototype,ga=Object.prototype,_a=fa.toString,va=ga.hasOwnProperty,ba=RegExp("^"+_a.call(va).replace(da,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function wa(n){if(!Ue(n)||ua(n))return!1;var e=oa(n)?ba:ma;return e.test(pa(n))}function ya(n,e){return n==null?void 0:n[e]}function pr(n,e){var s=ya(n,e);return wa(s)?s:void 0}function ka(n,e){return n===e||n!==n&&e!==e}var Ta="[object Arguments]";function Ms(n){return Vn(n)&&Qn(n)==Ta}var dr=Object.prototype,Sa=dr.hasOwnProperty,Pa=dr.propertyIsEnumerable,La=Ms(function(){return arguments}())?Ms:function(n){return Vn(n)&&Sa.call(n,"callee")&&!Pa.call(n,"callee")};const Ea=La;var xa=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ba=/^\w*$/;function Ca(n,e){if(mn(n))return!1;var s=typeof n;return s=="number"||s=="symbol"||s=="boolean"||n==null||dn(n)?!0:Ba.test(n)||!xa.test(n)||e!=null&&n in Object(e)}var Ma=pr(Object,"create");const qe=Ma;function Ra(){this.__data__=qe?qe(null):{},this.size=0}function Da(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var Aa="__lodash_hash_undefined__",Oa=Object.prototype,za=Oa.hasOwnProperty;function Fa(n){var e=this.__data__;if(qe){var s=e[n];return s===Aa?void 0:s}return za.call(e,n)?e[n]:void 0}var Ha=Object.prototype,Ia=Ha.hasOwnProperty;function Na(n){var e=this.__data__;return qe?e[n]!==void 0:Ia.call(e,n)}var ja="__lodash_hash_undefined__";function Ua(n,e){var s=this.__data__;return this.size+=this.has(n)?0:1,s[n]=qe&&e===void 0?ja:e,this}function ne(n){var e=-1,s=n==null?0:n.length;for(this.clear();++e<s;){var r=n[e];this.set(r[0],r[1])}}ne.prototype.clear=Ra;ne.prototype.delete=Da;ne.prototype.get=Fa;ne.prototype.has=Na;ne.prototype.set=Ua;function qa(){this.__data__=[],this.size=0}function fn(n,e){for(var s=n.length;s--;)if(ka(n[s][0],e))return s;return-1}var $a=Array.prototype,Ja=$a.splice;function Ga(n){var e=this.__data__,s=fn(e,n);if(s<0)return!1;var r=e.length-1;return s==r?e.pop():Ja.call(e,s,1),--this.size,!0}function Xa(n){var e=this.__data__,s=fn(e,n);return s<0?void 0:e[s][1]}function Wa(n){return fn(this.__data__,n)>-1}function Qa(n,e){var s=this.__data__,r=fn(s,n);return r<0?(++this.size,s.push([n,e])):s[r][1]=e,this}function ye(n){var e=-1,s=n==null?0:n.length;for(this.clear();++e<s;){var r=n[e];this.set(r[0],r[1])}}ye.prototype.clear=qa;ye.prototype.delete=Ga;ye.prototype.get=Xa;ye.prototype.has=Wa;ye.prototype.set=Qa;var Va=pr(pn,"Map");const Ka=Va;function Za(){this.size=0,this.__data__={hash:new ne,map:new(Ka||ye),string:new ne}}function Ya(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function gn(n,e){var s=n.__data__;return Ya(e)?s[typeof e=="string"?"string":"hash"]:s.map}function to(n){var e=gn(this,n).delete(n);return this.size-=e?1:0,e}function eo(n){return gn(this,n).get(n)}function no(n){return gn(this,n).has(n)}function so(n,e){var s=gn(this,n),r=s.size;return s.set(n,e),this.size+=s.size==r?0:1,this}function se(n){var e=-1,s=n==null?0:n.length;for(this.clear();++e<s;){var r=n[e];this.set(r[0],r[1])}}se.prototype.clear=Za;se.prototype.delete=to;se.prototype.get=eo;se.prototype.has=no;se.prototype.set=so;var ro="Expected a function";function Kn(n,e){if(typeof n!="function"||e!=null&&typeof e!="function")throw new TypeError(ro);var s=function(){var r=arguments,i=e?e.apply(this,r):r[0],a=s.cache;if(a.has(i))return a.get(i);var u=n.apply(this,r);return s.cache=a.set(i,u)||a,u};return s.cache=new(Kn.Cache||se),s}Kn.Cache=se;var io=500;function ao(n){var e=Kn(n,function(r){return s.size===io&&s.clear(),r}),s=e.cache;return e}var oo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,co=/\\(\\)?/g,uo=ao(function(n){var e=[];return n.charCodeAt(0)===46&&e.push(""),n.replace(oo,function(s,r,i,a){e.push(i?a.replace(co,"$1"):r||s)}),e});const ho=uo;function lo(n){return n==null?"":lr(n)}function po(n,e){return mn(n)?n:Ca(n,e)?[n]:ho(lo(n))}var mo=1/0;function fo(n){if(typeof n=="string"||dn(n))return n;var e=n+"";return e=="0"&&1/n==-mo?"-0":e}function go(n,e){e=po(e,n);for(var s=0,r=e.length;n!=null&&s<r;)n=n[fo(e[s++])];return s&&s==r?n:void 0}function mr(n,e,s){var r=n==null?void 0:go(n,e);return r===void 0?s:r}function _o(n,e){for(var s=-1,r=e.length,i=n.length;++s<r;)n[i+s]=e[s];return n}var Rs=$t?$t.isConcatSpreadable:void 0;function vo(n){return mn(n)||Ea(n)||!!(Rs&&n&&n[Rs])}function fr(n,e,s,r,i){var a=-1,u=n.length;for(s||(s=vo),i||(i=[]);++a<u;){var l=n[a];e>0&&s(l)?e>1?fr(l,e-1,s,r,i):_o(i,l):r||(i[i.length]=l)}return i}function gr(n){var e=n==null?0:n.length;return e?fr(n,1):[]}var bo=function(){return pn.Date.now()};const Bn=bo;var wo="Expected a function",yo=Math.max,ko=Math.min;function To(n,e,s){var r,i,a,u,l,w,p=0,f=!1,v=!1,h=!0;if(typeof n!="function")throw new TypeError(wo);e=Bs(e)||0,Ue(s)&&(f=!!s.leading,v="maxWait"in s,a=v?yo(Bs(s.maxWait)||0,e):a,h="trailing"in s?!!s.trailing:h);function _(J){var ht=r,gt=i;return r=i=void 0,p=J,u=n.apply(gt,ht),u}function y(J){return p=J,l=setTimeout(R,e),f?_(J):u}function k(J){var ht=J-w,gt=J-p,zt=e-ht;return v?ko(zt,a-gt):zt}function T(J){var ht=J-w,gt=J-p;return w===void 0||ht>=e||ht<0||v&>>=a}function R(){var J=Bn();if(T(J))return tt(J);l=setTimeout(R,k(J))}function tt(J){return l=void 0,h&&r?_(J):(r=i=void 0,u)}function M(){l!==void 0&&clearTimeout(l),p=0,r=w=i=l=void 0}function C(){return l===void 0?u:tt(Bn())}function V(){var J=Bn(),ht=T(J);if(r=arguments,i=this,w=J,ht){if(l===void 0)return y(w);if(v)return clearTimeout(l),l=setTimeout(R,e),_(w)}return l===void 0&&(l=setTimeout(R,e)),u}return V.cancel=M,V.flush=C,V}class So{constructor(){b(this,"logsObj"),b(this,"initPromise"),this.initPromise=this.init()}async init(){return this.logsObj=await Mi(),this.logsObj}get length(){var e,s;return(s=(e=this.logsObj)==null?void 0:e.length)!=null?s:0}getLogs(){var e;return((e=this.logsObj)==null?void 0:e.logs)||[]}async cacheLog(e){var s;await this.initPromise,await((s=this.logsObj)==null?void 0:s.push(e))}async send(e){var s;await this.initPromise;const r=await((s=this.logsObj)==null?void 0:s.shift());r!=null&&r.length&&await e(gr(r))}async sendByBeacon(e){var s;await this.initPromise;const r=await((s=this.logsObj)==null?void 0:s.shift());r!=null&&r.length&&await e(r)}}function Po(n){return _n(n,"String")}function Lo(n){return _n(n,"Array")}function Eo(n){return _n(n,"Object")}function xo(n){return typeof n=="function"}function Ds(n,e="Object"){return Lo(n)?n.every(s=>_n(s,e)):!1}function _n(n,e="Object"){return Object.prototype.toString.call(n)===`[object ${e}]`}const Bo=window.indexedDB,Co=new Set(["add","clear","count","delete","get","getAll","getAllKeys","getKey","openCursor","openKeyCursor","put"]);function Mo(n,e,...s){return new Promise(async(r,i)=>{try{const a=(await this.createTransaction(n)).objectStore(n);let u=a[e].call(a,...s);u?(u.onsuccess=function(l){r(mr(l,"target.result"))},u.onerror=function(l){console.log("---storeOperate onerror",n,e,l),i(l)}):r(void 0)}catch(a){i(a)}})}function Ro(n){const e=this;let s={};return Co.forEach(r=>{s[r]=function(...i){var a;return(a=e==null?void 0:e.manager)==null?void 0:a.pushTask(()=>Mo.call(e,n,r,...i))}}),s}class Do{constructor(){b(this,"dbManagerMap",new Map)}getOrCreateDBManager(e){if(this.dbManagerMap.has(e))return this.dbManagerMap.get(e);const s=new Ao(e);return this.dbManagerMap.set(e,s),s}get(e){return this.getOrCreateDBManager(e)}clear(e){const s=this.dbManagerMap.get(e);!s||(s.close(),this.dbManagerMap.delete(e))}}class Ao{constructor(e){b(this,"initPromise",Promise.resolve()),b(this,"openStatus",""),b(this,"version",0),b(this,"dbName"),b(this,"db",null),b(this,"isClose",!0),b(this,"task",Promise.resolve()),this.dbName=e,this.init()}pushTask(e){if(this.isClose){console.log("----task error, IndexDB is close");return}let s=this.task.then(()=>{try{return xo(e)?e():e}catch(r){console.log("----task error",r)}});return this.task=s,s}close(){const e=()=>{this.openStatus="",this.version=0,this.db&&(this.db.close(),this.db=null)};if(this.isClose)e();else{let s=this.pushTask(e);return this.isClose=!0,s}}transTransactionParam(e){return Po(e)?[{storeName:e}]:Ds(e,"String")?e.map(s=>({storeName:s})):Eo(e)?[e]:Ds(e)?e:(console.warn("[transTransactionParam]\u5165\u53C2\u683C\u5F0F\u4E0D\u6B63\u786E",e),[])}async transaction(e,s="readonly"){await this.initPromise;const r=this.transTransactionParam(e);if(!r.length)return;const i=[];return r.forEach(a=>{!this.db||this.db.objectStoreNames.contains(a.storeName)||i.push(u=>{u.createObjectStore(a.storeName,a.option)})}),i.length>0&&await this.upgradeneeded(i),Ro.bind({manager:this,createTransaction:async a=>{if(await this.initPromise,!!this.db)return this.db.transaction(a,s)}})}init(e,s){let r=this.initPromise;this.initPromise=new Promise(async(i,a)=>{await r,await this.close();const u=Bo.open(this.dbName,e);let l=setTimeout(()=>{a(new Error("[IndexDB\u8FDE\u63A5\u8D85\u65F6] name: "+this.dbName+" \u8BF7\u5C1D\u8BD5\u5237\u65B0\u6216\u91CD\u542F\u6D4F\u89C8\u5668"))},1e4);u.onsuccess=()=>{clearTimeout(l),this.openStatus="success",this.db=u.result;const w=this.db;this.isClose=!1;const p=w.version;this.version=w.version,w.onclose=()=>{this.isClose=!0,console.log("[indexDB\u5173\u95ED]",p)},console.log(`[indexDB\u521D\u59CB\u5316]
|
|
7
|
+
*/var bi=function(r){return r!=null&&(on(r)||ki(r)||!!r._isBuffer)};function on(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function ki(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&on(r.slice(0,0))}(function(){var r=an.exports,e=ks.utf8,s=bi,n=ks.bin,i=function(a,u){a.constructor==String?u&&u.encoding==="binary"?a=n.stringToBytes(a):a=e.stringToBytes(a):s(a)?a=Array.prototype.slice.call(a,0):!Array.isArray(a)&&a.constructor!==Uint8Array&&(a=a.toString());for(var h=r.bytesToWords(a),_=a.length*8,p=1732584193,f=-271733879,w=-1732584194,l=271733878,v=0;v<h.length;v++)h[v]=(h[v]<<8|h[v]>>>24)&16711935|(h[v]<<24|h[v]>>>8)&4278255360;h[_>>>5]|=128<<_%32,h[(_+64>>>9<<4)+14]=_;for(var b=i._ff,k=i._gg,T=i._hh,R=i._ii,v=0;v<h.length;v+=16){var tt=p,M=f,C=w,V=l;p=b(p,f,w,l,h[v+0],7,-680876936),l=b(l,p,f,w,h[v+1],12,-389564586),w=b(w,l,p,f,h[v+2],17,606105819),f=b(f,w,l,p,h[v+3],22,-1044525330),p=b(p,f,w,l,h[v+4],7,-176418897),l=b(l,p,f,w,h[v+5],12,1200080426),w=b(w,l,p,f,h[v+6],17,-1473231341),f=b(f,w,l,p,h[v+7],22,-45705983),p=b(p,f,w,l,h[v+8],7,1770035416),l=b(l,p,f,w,h[v+9],12,-1958414417),w=b(w,l,p,f,h[v+10],17,-42063),f=b(f,w,l,p,h[v+11],22,-1990404162),p=b(p,f,w,l,h[v+12],7,1804603682),l=b(l,p,f,w,h[v+13],12,-40341101),w=b(w,l,p,f,h[v+14],17,-1502002290),f=b(f,w,l,p,h[v+15],22,1236535329),p=k(p,f,w,l,h[v+1],5,-165796510),l=k(l,p,f,w,h[v+6],9,-1069501632),w=k(w,l,p,f,h[v+11],14,643717713),f=k(f,w,l,p,h[v+0],20,-373897302),p=k(p,f,w,l,h[v+5],5,-701558691),l=k(l,p,f,w,h[v+10],9,38016083),w=k(w,l,p,f,h[v+15],14,-660478335),f=k(f,w,l,p,h[v+4],20,-405537848),p=k(p,f,w,l,h[v+9],5,568446438),l=k(l,p,f,w,h[v+14],9,-1019803690),w=k(w,l,p,f,h[v+3],14,-187363961),f=k(f,w,l,p,h[v+8],20,1163531501),p=k(p,f,w,l,h[v+13],5,-1444681467),l=k(l,p,f,w,h[v+2],9,-51403784),w=k(w,l,p,f,h[v+7],14,1735328473),f=k(f,w,l,p,h[v+12],20,-1926607734),p=T(p,f,w,l,h[v+5],4,-378558),l=T(l,p,f,w,h[v+8],11,-2022574463),w=T(w,l,p,f,h[v+11],16,1839030562),f=T(f,w,l,p,h[v+14],23,-35309556),p=T(p,f,w,l,h[v+1],4,-1530992060),l=T(l,p,f,w,h[v+4],11,1272893353),w=T(w,l,p,f,h[v+7],16,-155497632),f=T(f,w,l,p,h[v+10],23,-1094730640),p=T(p,f,w,l,h[v+13],4,681279174),l=T(l,p,f,w,h[v+0],11,-358537222),w=T(w,l,p,f,h[v+3],16,-722521979),f=T(f,w,l,p,h[v+6],23,76029189),p=T(p,f,w,l,h[v+9],4,-640364487),l=T(l,p,f,w,h[v+12],11,-421815835),w=T(w,l,p,f,h[v+15],16,530742520),f=T(f,w,l,p,h[v+2],23,-995338651),p=R(p,f,w,l,h[v+0],6,-198630844),l=R(l,p,f,w,h[v+7],10,1126891415),w=R(w,l,p,f,h[v+14],15,-1416354905),f=R(f,w,l,p,h[v+5],21,-57434055),p=R(p,f,w,l,h[v+12],6,1700485571),l=R(l,p,f,w,h[v+3],10,-1894986606),w=R(w,l,p,f,h[v+10],15,-1051523),f=R(f,w,l,p,h[v+1],21,-2054922799),p=R(p,f,w,l,h[v+8],6,1873313359),l=R(l,p,f,w,h[v+15],10,-30611744),w=R(w,l,p,f,h[v+6],15,-1560198380),f=R(f,w,l,p,h[v+13],21,1309151649),p=R(p,f,w,l,h[v+4],6,-145523070),l=R(l,p,f,w,h[v+11],10,-1120210379),w=R(w,l,p,f,h[v+2],15,718787259),f=R(f,w,l,p,h[v+9],21,-343485551),p=p+tt>>>0,f=f+M>>>0,w=w+C>>>0,l=l+V>>>0}return r.endian([p,f,w,l])};i._ff=function(a,u,h,_,p,f,w){var l=a+(u&h|~u&_)+(p>>>0)+w;return(l<<f|l>>>32-f)+u},i._gg=function(a,u,h,_,p,f,w){var l=a+(u&_|h&~_)+(p>>>0)+w;return(l<<f|l>>>32-f)+u},i._hh=function(a,u,h,_,p,f,w){var l=a+(u^h^_)+(p>>>0)+w;return(l<<f|l>>>32-f)+u},i._ii=function(a,u,h,_,p,f,w){var l=a+(h^(u|~_))+(p>>>0)+w;return(l<<f|l>>>32-f)+u},i._blocksize=16,i._digestsize=16,nn.exports=function(a,u){if(a==null)throw new Error("Illegal argument "+a);var h=r.wordsToBytes(i(a,u));return u&&u.asBytes?h:u&&u.asString?n.bytesToString(h):r.bytesToHex(h)}})();const nr="1.0.22";//! © 2015 Nathan Rugg <nmrugg@gmail.com> | MIT
|
|
8
|
+
function Ti(r){var e=1,s=2,n=3,i={},a=new Worker(r||"./lzma_worker-min.js");return a.onmessage=function(u){u.data.action===n?i[u.data.cbn]&&typeof i[u.data.cbn].on_progress=="function"&&i[u.data.cbn].on_progress(u.data.result):i[u.data.cbn]&&typeof i[u.data.cbn].on_finish=="function"&&(i[u.data.cbn].on_finish(u.data.result,u.data.error),delete i[u.data.cbn])},a.onerror=function(u){var h=new Error(u.message+" ("+u.filename+":"+u.lineno+")");for(var _ in i)i[_].on_finish(null,h);console.error("Uncaught error in lzma_worker",h)},function(){function u(h,_,p,f,w){var l;do l=Math.floor(Math.random()*1e7);while(typeof i[l]<"u");i[l]={on_finish:f,on_progress:w},a.postMessage({action:h,cbn:l,data:_,mode:p})}return{compress:function(h,_,p,f){u(e,h,_,p,f)},decompress:function(h,_,p){u(s,h,!1,_,p)},worker:function(){return a}}}()}var Ir=function(){var r=1,e=3,s=typeof setImmediate=="function"?setImmediate:setTimeout,n=4294967296,i=[4294967295,-n],a=[0,-9223372036854776e3],u=[0,0],h=[1,0];function _(t,o){postMessage({action:e,cbn:o,result:t})}function p(t){var o=[];return o[t-1]=void 0,o}function f(t,o){return v(t[0]+o[0],t[1]+o[1])}function w(t,o){return R(~~Math.max(Math.min(t[1]/n,2147483647),-2147483648)&~~Math.max(Math.min(o[1]/n,2147483647),-2147483648),T(t)&T(o))}function l(t,o){var c,d;return t[0]==o[0]&&t[1]==o[1]?0:(c=t[1]<0,d=o[1]<0,c&&!d?-1:!c&&d?1:J(t,o)[1]<0?-1:1)}function v(t,o){var c,d;for(o%=18446744073709552e3,t%=18446744073709552e3,c=o%n,d=Math.floor(t/n)*n,o=o-c+d,t=t-d+c;t<0;)t+=n,o-=n;for(;t>4294967295;)t-=n,o+=n;for(o=o%18446744073709552e3;o>9223372032559809e3;)o-=18446744073709552e3;for(;o<-9223372036854776e3;)o+=18446744073709552e3;return[t,o]}function b(t,o){return t[0]==o[0]&&t[1]==o[1]}function k(t){return t>=0?[t,0]:[t+n,-n]}function T(t){return t[0]>=2147483648?~~Math.max(Math.min(t[0]-n,2147483647),-2147483648):~~Math.max(Math.min(t[0],2147483647),-2147483648)}function R(t,o){var c,d;return c=t*n,d=o,o<0&&(d+=n),[d,c]}function tt(t){return t<=30?1<<t:tt(30)*tt(t-30)}function M(t,o){var c,d,m,g;if(o&=63,b(t,a))return o?u:t;if(t[1]<0)throw new Error("Neg");return g=tt(o),d=t[1]*g%18446744073709552e3,m=t[0]*g,c=m-m%n,d+=c,m-=c,d>=9223372036854776e3&&(d-=18446744073709552e3),[m,d]}function C(t,o){var c;return o&=63,c=tt(o),v(Math.floor(t[0]/c),t[1]/c)}function V(t,o){var c;return o&=63,c=C(t,o),t[1]<0&&(c=f(c,M([2,0],63-o))),c}function J(t,o){return v(t[0]-o[0],t[1]-o[1])}function ht(t,o){return t.buf=o,t.pos=0,t.count=o.length,t}function gt(t,o,c,d){return t.pos>=t.count?-1:(d=Math.min(d,t.count-t.pos),Jt(t.buf,t.pos,o,c,d),t.pos+=d,d)}function zt(t){return t.buf=p(32),t.count=0,t}function ie(t){var o=t.buf;return o.length=t.count,o}function Se(t,o){t.buf[t.count++]=o<<24>>24}function Xe(t,o,c,d){Jt(o,c,t.buf,t.count,d),t.count+=d}function Ft(t,o,c,d,m){var g;for(g=o;g<c;++g)d[m++]=t.charCodeAt(g)}function Jt(t,o,c,d,m){for(var g=0;g<m;++g)c[d+g]=t[o+g]}function wr(t,o){zn(o,1<<t.s),o._numFastBytes=t.f,Fn(o,t.m),o._numLiteralPosStateBits=0,o._numLiteralContextBits=3,o._posStateBits=2,o._posStateMask=3}function ae(t,o,c,d,m){var g,S;if(l(d,i)<0)throw new Error("invalid length "+d);for(t.length_0=d,g=q({}),wr(m,g),g._writeEndMark=typeof Ir.disableEndMark>"u",Hn(g,c),S=0;S<64;S+=8)Se(c,T(C(d,S))&255);t.chunker=(g._needReleaseMFStream=0,g._inStream=o,g._finished=0,z(g),g._rangeEncoder.Stream=c,Ze(g),W(g),A(g),g._lenEncoder._tableSize=g._numFastBytes+1-2,as(g._lenEncoder,1<<g._posStateBits),g._repMatchLenEncoder._tableSize=g._numFastBytes+1-2,as(g._repMatchLenEncoder,1<<g._posStateBits),g.nowPos64=u,Be({},g))}function Gt(t,o,c){return t.output=zt({}),ae(t,ht({},o),t.output,k(o.length),c),t}function We(t,o,c,d){var m;t._keepSizeBefore=o,t._keepSizeAfter=c,m=o+c+d,(t._bufferBase==null||t._blockSize!=m)&&(t._bufferBase=null,t._blockSize=m,t._bufferBase=p(t._blockSize)),t._pointerToLastSafePosition=t._blockSize-c}function Y(t,o){return t._bufferBase[t._bufferOffset+t._pos+o]}function Tt(t,o,c,d){var m,g;for(t._streamEndWasReached&&t._pos+o+d>t._streamPos&&(d=t._streamPos-(t._pos+o)),++c,g=t._bufferOffset+t._pos+o,m=0;m<d&&t._bufferBase[g+m]==t._bufferBase[g+m-c];++m);return m}function Ht(t){return t._streamPos-t._pos}function oe(t){var o,c,d;for(d=t._bufferOffset+t._pos-t._keepSizeBefore,d>0&&--d,c=t._bufferOffset+t._streamPos-d,o=0;o<c;++o)t._bufferBase[o]=t._bufferBase[d+o];t._bufferOffset-=d}function Pe(t){var o;++t._pos,t._pos>t._posLimit&&(o=t._bufferOffset+t._pos,o>t._pointerToLastSafePosition&&oe(t),Le(t))}function Le(t){var o,c,d;if(!t._streamEndWasReached)for(;;){if(d=-t._bufferOffset+t._blockSize-t._streamPos,!d)return;if(o=gt(t._stream,t._bufferBase,t._bufferOffset+t._streamPos,d),o==-1){t._posLimit=t._streamPos,c=t._bufferOffset+t._posLimit,c>t._pointerToLastSafePosition&&(t._posLimit=t._pointerToLastSafePosition-t._bufferOffset),t._streamEndWasReached=1;return}t._streamPos+=o,t._streamPos>=t._pos+t._keepSizeAfter&&(t._posLimit=t._streamPos-t._keepSizeAfter)}}function Xt(t,o){t._bufferOffset+=o,t._posLimit-=o,t._pos-=o,t._streamPos-=o}var It=function(){var t,o,c,d=[];for(t=0;t<256;++t){for(c=t,o=0;o<8;++o)(c&1)!=0?c=c>>>1^-306674912:c>>>=1;d[t]=c}return d}();function Ee(t,o,c,d,m){var g,S,B;o<1073741567&&(t._cutValue=16+(d>>1),B=~~((o+c+d+m)/2)+256,We(t,o+c,d+m,B),t._matchMaxLen=d,g=o+1,t._cyclicBufferSize!=g&&(t._son=p((t._cyclicBufferSize=g)*2)),S=65536,t.HASH_ARRAY&&(S=o-1,S|=S>>1,S|=S>>2,S|=S>>4,S|=S>>8,S>>=1,S|=65535,S>16777216&&(S>>=1),t._hashMask=S,++S,S+=t.kFixHashSize),S!=t._hashSizeSum&&(t._hash=p(t._hashSizeSum=S)))}function Qe(t,o){var c,d,m,g,S,B,D,L,x,X,F,H,et,P,N,K,j,_t,st,wt,St;if(t._pos+t._matchMaxLen<=t._streamPos)P=t._matchMaxLen;else if(P=t._streamPos-t._pos,P<t.kMinMatchCheck)return Mt(t),0;for(j=0,N=t._pos>t._cyclicBufferSize?t._pos-t._cyclicBufferSize:0,d=t._bufferOffset+t._pos,K=1,L=0,x=0,t.HASH_ARRAY?(St=It[t._bufferBase[d]&255]^t._bufferBase[d+1]&255,L=St&1023,St^=(t._bufferBase[d+2]&255)<<8,x=St&65535,X=(St^It[t._bufferBase[d+3]&255]<<5)&t._hashMask):X=t._bufferBase[d]&255^(t._bufferBase[d+1]&255)<<8,m=t._hash[t.kFixHashSize+X]||0,t.HASH_ARRAY&&(g=t._hash[L]||0,S=t._hash[1024+x]||0,t._hash[L]=t._pos,t._hash[1024+x]=t._pos,g>N&&t._bufferBase[t._bufferOffset+g]==t._bufferBase[d]&&(o[j++]=K=2,o[j++]=t._pos-g-1),S>N&&t._bufferBase[t._bufferOffset+S]==t._bufferBase[d]&&(S==g&&(j-=2),o[j++]=K=3,o[j++]=t._pos-S-1,g=S),j!=0&&g==m&&(j-=2,K=1)),t._hash[t.kFixHashSize+X]=t._pos,st=(t._cyclicBufferPos<<1)+1,wt=t._cyclicBufferPos<<1,H=et=t.kNumHashDirectBytes,t.kNumHashDirectBytes!=0&&m>N&&t._bufferBase[t._bufferOffset+m+t.kNumHashDirectBytes]!=t._bufferBase[d+t.kNumHashDirectBytes]&&(o[j++]=K=t.kNumHashDirectBytes,o[j++]=t._pos-m-1),c=t._cutValue;;){if(m<=N||c--==0){t._son[st]=t._son[wt]=0;break}if(D=t._pos-m,B=(D<=t._cyclicBufferPos?t._cyclicBufferPos-D:t._cyclicBufferPos-D+t._cyclicBufferSize)<<1,_t=t._bufferOffset+m,F=H<et?H:et,t._bufferBase[_t+F]==t._bufferBase[d+F]){for(;++F!=P&&t._bufferBase[_t+F]==t._bufferBase[d+F];);if(K<F&&(o[j++]=K=F,o[j++]=D-1,F==P)){t._son[wt]=t._son[B],t._son[st]=t._son[B+1];break}}(t._bufferBase[_t+F]&255)<(t._bufferBase[d+F]&255)?(t._son[wt]=m,wt=B+1,m=t._son[wt],et=F):(t._son[st]=m,st=B,m=t._son[st],H=F)}return Mt(t),j}function yr(t){t._bufferOffset=0,t._pos=0,t._streamPos=0,t._streamEndWasReached=0,Le(t),t._cyclicBufferPos=0,Xt(t,-1)}function Mt(t){var o;++t._cyclicBufferPos>=t._cyclicBufferSize&&(t._cyclicBufferPos=0),Pe(t),t._pos==1073741823&&(o=t._pos-t._cyclicBufferSize,xe(t._son,t._cyclicBufferSize*2,o),xe(t._hash,t._hashSizeSum,o),Xt(t,o))}function xe(t,o,c){var d,m;for(d=0;d<o;++d)m=t[d]||0,m<=c?m=0:m-=c,t[d]=m}function Wt(t,o){t.HASH_ARRAY=o>2,t.HASH_ARRAY?(t.kNumHashDirectBytes=0,t.kMinMatchCheck=4,t.kFixHashSize=66560):(t.kNumHashDirectBytes=2,t.kMinMatchCheck=3,t.kFixHashSize=0)}function br(t,o){var c,d,m,g,S,B,D,L,x,X,F,H,et,P,N,K,j;do{if(t._pos+t._matchMaxLen<=t._streamPos)H=t._matchMaxLen;else if(H=t._streamPos-t._pos,H<t.kMinMatchCheck){Mt(t);continue}for(et=t._pos>t._cyclicBufferSize?t._pos-t._cyclicBufferSize:0,d=t._bufferOffset+t._pos,t.HASH_ARRAY?(j=It[t._bufferBase[d]&255]^t._bufferBase[d+1]&255,B=j&1023,t._hash[B]=t._pos,j^=(t._bufferBase[d+2]&255)<<8,D=j&65535,t._hash[1024+D]=t._pos,L=(j^It[t._bufferBase[d+3]&255]<<5)&t._hashMask):L=t._bufferBase[d]&255^(t._bufferBase[d+1]&255)<<8,m=t._hash[t.kFixHashSize+L],t._hash[t.kFixHashSize+L]=t._pos,N=(t._cyclicBufferPos<<1)+1,K=t._cyclicBufferPos<<1,X=F=t.kNumHashDirectBytes,c=t._cutValue;;){if(m<=et||c--==0){t._son[N]=t._son[K]=0;break}if(S=t._pos-m,g=(S<=t._cyclicBufferPos?t._cyclicBufferPos-S:t._cyclicBufferPos-S+t._cyclicBufferSize)<<1,P=t._bufferOffset+m,x=X<F?X:F,t._bufferBase[P+x]==t._bufferBase[d+x]){for(;++x!=H&&t._bufferBase[P+x]==t._bufferBase[d+x];);if(x==H){t._son[K]=t._son[g],t._son[N]=t._son[g+1];break}}(t._bufferBase[P+x]&255)<(t._bufferBase[d+x]&255)?(t._son[K]=m,K=g+1,m=t._son[K],F=x):(t._son[N]=m,N=g,m=t._son[N],X=x)}Mt(t)}while(--o!=0)}function Qt(t){return t-=2,t<4?t:3}function lt(t){return t<4?0:t<10?t-3:t-6}function Be(t,o){return t.encoder=o,t.decoder=null,t.alive=1,t}function Ve(t){if(!t.alive)throw new Error("bad state");if(t.encoder)Ke(t);else throw new Error("No decoding");return t.alive}function Ke(t){ce(t.encoder,t.encoder.processedInSize,t.encoder.processedOutSize,t.encoder.finished),t.inBytesProcessed=t.encoder.processedInSize[0],t.encoder.finished[0]&&(On(t.encoder),t.alive=0)}var Rt=function(){var t,o,c,d=2,m=[0,1];for(c=2;c<22;++c)for(o=1<<(c>>1)-1,t=0;t<o;++t,++d)m[d]=c<<24>>24;return m}();function ot(t,o){var c,d,m,g;t._optimumEndIndex=o,m=t._optimum[o].PosPrev,d=t._optimum[o].BackPrev;do t._optimum[o].Prev1IsChar&&(cs(t._optimum[m]),t._optimum[m].PosPrev=m-1,t._optimum[o].Prev2&&(t._optimum[m-1].Prev1IsChar=0,t._optimum[m-1].PosPrev=t._optimum[o].PosPrev2,t._optimum[m-1].BackPrev=t._optimum[o].BackPrev2)),g=m,c=d,d=t._optimum[g].BackPrev,m=t._optimum[g].PosPrev,t._optimum[g].BackPrev=c,t._optimum[g].PosPrev=o,o=g;while(o>0);return t.backRes=t._optimum[0].BackPrev,t._optimumCurrentIndex=t._optimum[0].PosPrev,t._optimumCurrentIndex}function Nt(t){t._state=0,t._previousByte=0;for(var o=0;o<4;++o)t._repDistances[o]=0}function ce(t,o,c,d){var m,g,S,B,D,L,x,X,F,H,et,P,N,K,j;if(o[0]=u,c[0]=u,d[0]=1,t._inStream&&(t._matchFinder._stream=t._inStream,yr(t._matchFinder),t._needReleaseMFStream=1,t._inStream=null),!t._finished){if(t._finished=1,K=t.nowPos64,b(t.nowPos64,u)){if(!Ht(t._matchFinder)){O(t,T(t.nowPos64));return}kr(t),N=T(t.nowPos64)&t._posStateMask,Q(t._rangeEncoder,t._isMatch,(t._state<<4)+N,0),t._state=lt(t._state),S=Y(t._matchFinder,-t._additionalOffset),os(he(t._literalEncoder,T(t.nowPos64),t._previousByte),t._rangeEncoder,S),t._previousByte=S,--t._additionalOffset,t.nowPos64=f(t.nowPos64,h)}if(!Ht(t._matchFinder)){O(t,T(t.nowPos64));return}for(;;){if(x=ue(t,T(t.nowPos64)),H=t.backRes,N=T(t.nowPos64)&t._posStateMask,g=(t._state<<4)+N,x==1&&H==-1)Q(t._rangeEncoder,t._isMatch,g,0),S=Y(t._matchFinder,-t._additionalOffset),j=he(t._literalEncoder,T(t.nowPos64),t._previousByte),t._state<7?os(j,t._rangeEncoder,S):(F=Y(t._matchFinder,-t._repDistances[0]-1-t._additionalOffset),Jn(j,t._rangeEncoder,F,S)),t._previousByte=S,t._state=lt(t._state);else{if(Q(t._rangeEncoder,t._isMatch,g,1),H<4){if(Q(t._rangeEncoder,t._isRep,t._state,1),H?(Q(t._rangeEncoder,t._isRepG0,t._state,1),H==1?Q(t._rangeEncoder,t._isRepG1,t._state,0):(Q(t._rangeEncoder,t._isRepG1,t._state,1),Q(t._rangeEncoder,t._isRepG2,t._state,H-2))):(Q(t._rangeEncoder,t._isRepG0,t._state,0),x==1?Q(t._rangeEncoder,t._isRep0Long,g,0):Q(t._rangeEncoder,t._isRep0Long,g,1)),x==1?t._state=t._state<7?9:11:(Sr(t._repMatchLenEncoder,t._rangeEncoder,x-2,N),t._state=t._state<7?8:11),B=t._repDistances[H],H!=0){for(L=H;L>=1;--L)t._repDistances[L]=t._repDistances[L-1];t._repDistances[0]=B}}else{for(Q(t._rangeEncoder,t._isRep,t._state,0),t._state=t._state<7?7:10,Sr(t._lenEncoder,t._rangeEncoder,x-2,N),H-=4,P=Tr(H),X=Qt(x),Re(t._posSlotEncoder[X],t._rangeEncoder,P),P>=4&&(D=(P>>1)-1,m=(2|P&1)<<D,et=H-m,P<14?Qn(t._posEncoders,m-P-1,t._rangeEncoder,D,et):(hs(t._rangeEncoder,et>>4,D-4),us(t._posAlignEncoder,t._rangeEncoder,et&15),++t._alignPriceCount)),B=H,L=3;L>=1;--L)t._repDistances[L]=t._repDistances[L-1];t._repDistances[0]=B,++t._matchPriceCount}t._previousByte=Y(t._matchFinder,x-1-t._additionalOffset)}if(t._additionalOffset-=x,t.nowPos64=f(t.nowPos64,k(x)),!t._additionalOffset){if(t._matchPriceCount>=128&&W(t),t._alignPriceCount>=16&&A(t),o[0]=t.nowPos64,c[0]=Kn(t._rangeEncoder),!Ht(t._matchFinder)){O(t,T(t.nowPos64));return}if(l(J(t.nowPos64,K),[4096,0])>=0){t._finished=0,d[0]=0;return}}}}}function z(t){var o,c;t._matchFinder||(o={},c=4,t._matchFinderType||(c=2),Wt(o,c),t._matchFinder=o),qn(t._literalEncoder,t._numLiteralPosStateBits,t._numLiteralContextBits),!(t._dictionarySize==t._dictionarySizePrev&&t._numFastBytesPrev==t._numFastBytes)&&(Ee(t._matchFinder,t._dictionarySize,4096,t._numFastBytes,274),t._dictionarySizePrev=t._dictionarySize,t._numFastBytesPrev=t._numFastBytes)}function q(t){var o;for(t._repDistances=p(4),t._optimum=[],t._rangeEncoder={},t._isMatch=p(192),t._isRep=p(12),t._isRepG0=p(12),t._isRepG1=p(12),t._isRepG2=p(12),t._isRep0Long=p(192),t._posSlotEncoder=[],t._posEncoders=p(114),t._posAlignEncoder=Me({},4),t._lenEncoder=is({}),t._repMatchLenEncoder=is({}),t._literalEncoder={},t._matchDistances=[],t._posSlotPrices=[],t._distancesPrices=[],t._alignPrices=p(16),t.reps=p(4),t.repLens=p(4),t.processedInSize=[u],t.processedOutSize=[u],t.finished=[0],t.properties=p(5),t.tempPrices=p(128),t._longestMatchLength=0,t._matchFinderType=1,t._numDistancePairs=0,t._numFastBytesPrev=-1,t.backRes=0,o=0;o<4096;++o)t._optimum[o]={};for(o=0;o<4;++o)t._posSlotEncoder[o]=Me({},6);return t}function A(t){for(var o=0;o<16;++o)t._alignPrices[o]=Wn(t._posAlignEncoder,o);t._alignPriceCount=0}function W(t){var o,c,d,m,g,S,B,D;for(m=4;m<128;++m)S=Tr(m),d=(S>>1)-1,o=(2|S&1)<<d,t.tempPrices[m]=Vn(t._posEncoders,o-S-1,d,m-o);for(g=0;g<4;++g){for(c=t._posSlotEncoder[g],B=g<<6,S=0;S<t._distTableSize;++S)t._posSlotPrices[B+S]=tr(c,S);for(S=14;S<t._distTableSize;++S)t._posSlotPrices[B+S]+=(S>>1)-1-4<<6;for(D=g*128,m=0;m<4;++m)t._distancesPrices[D+m]=t._posSlotPrices[B+m];for(;m<128;++m)t._distancesPrices[D+m]=t._posSlotPrices[B+Tr(m)]+t.tempPrices[m]}t._matchPriceCount=0}function O(t,o){rs(t),In(t,o&t._posStateMask);for(var c=0;c<5;++c)Pr(t._rangeEncoder)}function ue(t,o){var c,d,m,g,S,B,D,L,x,X,F,H,et,P,N,K,j,_t,st,wt,St,pt,le,er,yt,Pt,Lt,ut,Dt,Z,E,jt,Kt,nt,it,ms,bt,Ae,Zt,At,pe,Oe,U,rt,de,fs,gs,vs,_s,ws;if(t._optimumEndIndex!=t._optimumCurrentIndex)return et=t._optimum[t._optimumCurrentIndex].PosPrev-t._optimumCurrentIndex,t.backRes=t._optimum[t._optimumCurrentIndex].BackPrev,t._optimumCurrentIndex=t._optimum[t._optimumCurrentIndex].PosPrev,et;if(t._optimumCurrentIndex=t._optimumEndIndex=0,t._longestMatchWasFound?(H=t._longestMatchLength,t._longestMatchWasFound=0):H=kr(t),Lt=t._numDistancePairs,yt=Ht(t._matchFinder)+1,yt<2)return t.backRes=-1,1;for(yt>273&&(yt=273),At=0,x=0;x<4;++x)t.reps[x]=t._repDistances[x],t.repLens[x]=Tt(t._matchFinder,-1,t.reps[x],273),t.repLens[x]>t.repLens[At]&&(At=x);if(t.repLens[At]>=t._numFastBytes)return t.backRes=At,et=t.repLens[At],Ce(t,et-1),et;if(H>=t._numFastBytes)return t.backRes=t._matchDistances[Lt-1]+4,Ce(t,H-1),H;if(D=Y(t._matchFinder,-1),j=Y(t._matchFinder,-t._repDistances[0]-1-1),H<2&&D!=j&&t.repLens[At]<2)return t.backRes=-1,1;if(t._optimum[0].State=t._state,nt=o&t._posStateMask,t._optimum[1].Price=$[t._isMatch[(t._state<<4)+nt]>>>2]+Ye(he(t._literalEncoder,o,t._previousByte),t._state>=7,j,D),cs(t._optimum[1]),_t=$[2048-t._isMatch[(t._state<<4)+nt]>>>2],Zt=_t+$[2048-t._isRep[t._state]>>>2],j==D&&(pe=Zt+vt(t,t._state,nt),pe<t._optimum[1].Price&&(t._optimum[1].Price=pe,Xn(t._optimum[1]))),F=H>=t.repLens[At]?H:t.repLens[At],F<2)return t.backRes=t._optimum[1].BackPrev,1;t._optimum[1].PosPrev=0,t._optimum[0].Backs0=t.reps[0],t._optimum[0].Backs1=t.reps[1],t._optimum[0].Backs2=t.reps[2],t._optimum[0].Backs3=t.reps[3],X=F;do t._optimum[X--].Price=268435455;while(X>=2);for(x=0;x<4;++x)if(Ae=t.repLens[x],!(Ae<2)){ms=Zt+dt(t,x,t._state,nt);do g=ms+Vt(t._repMatchLenEncoder,Ae-2,nt),E=t._optimum[Ae],g<E.Price&&(E.Price=g,E.PosPrev=0,E.BackPrev=x,E.Prev1IsChar=0);while(--Ae>=2)}if(er=_t+$[t._isRep[t._state]>>>2],X=t.repLens[0]>=2?t.repLens[0]+1:2,X<=H){for(ut=0;X>t._matchDistances[ut];)ut+=2;for(;L=t._matchDistances[ut+1],g=er+G(t,L,X,nt),E=t._optimum[X],g<E.Price&&(E.Price=g,E.PosPrev=0,E.BackPrev=L+4,E.Prev1IsChar=0),!(X==t._matchDistances[ut]&&(ut+=2,ut==Lt));++X);}for(c=0;;){if(++c,c==F)return ot(t,c);if(st=kr(t),Lt=t._numDistancePairs,st>=t._numFastBytes)return t._longestMatchLength=st,t._longestMatchWasFound=1,ot(t,c);if(++o,Kt=t._optimum[c].PosPrev,t._optimum[c].Prev1IsChar?(--Kt,t._optimum[c].Prev2?(U=t._optimum[t._optimum[c].PosPrev2].State,t._optimum[c].BackPrev2<4?U=U<7?8:11:U=U<7?7:10):U=t._optimum[Kt].State,U=lt(U)):U=t._optimum[Kt].State,Kt==c-1?t._optimum[c].BackPrev?U=lt(U):U=U<7?9:11:(t._optimum[c].Prev1IsChar&&t._optimum[c].Prev2?(Kt=t._optimum[c].PosPrev2,jt=t._optimum[c].BackPrev2,U=U<7?8:11):(jt=t._optimum[c].BackPrev,jt<4?U=U<7?8:11:U=U<7?7:10),Z=t._optimum[Kt],jt<4?jt?jt==1?(t.reps[0]=Z.Backs1,t.reps[1]=Z.Backs0,t.reps[2]=Z.Backs2,t.reps[3]=Z.Backs3):jt==2?(t.reps[0]=Z.Backs2,t.reps[1]=Z.Backs0,t.reps[2]=Z.Backs1,t.reps[3]=Z.Backs3):(t.reps[0]=Z.Backs3,t.reps[1]=Z.Backs0,t.reps[2]=Z.Backs1,t.reps[3]=Z.Backs2):(t.reps[0]=Z.Backs0,t.reps[1]=Z.Backs1,t.reps[2]=Z.Backs2,t.reps[3]=Z.Backs3):(t.reps[0]=jt-4,t.reps[1]=Z.Backs0,t.reps[2]=Z.Backs1,t.reps[3]=Z.Backs2)),t._optimum[c].State=U,t._optimum[c].Backs0=t.reps[0],t._optimum[c].Backs1=t.reps[1],t._optimum[c].Backs2=t.reps[2],t._optimum[c].Backs3=t.reps[3],B=t._optimum[c].Price,D=Y(t._matchFinder,-1),j=Y(t._matchFinder,-t.reps[0]-1-1),nt=o&t._posStateMask,d=B+$[t._isMatch[(U<<4)+nt]>>>2]+Ye(he(t._literalEncoder,o,Y(t._matchFinder,-2)),U>=7,j,D),pt=t._optimum[c+1],wt=0,d<pt.Price&&(pt.Price=d,pt.PosPrev=c,pt.BackPrev=-1,pt.Prev1IsChar=0,wt=1),_t=B+$[2048-t._isMatch[(U<<4)+nt]>>>2],Zt=_t+$[2048-t._isRep[U]>>>2],j==D&&!(pt.PosPrev<c&&!pt.BackPrev)&&(pe=Zt+($[t._isRepG0[U]>>>2]+$[t._isRep0Long[(U<<4)+nt]>>>2]),pe<=pt.Price&&(pt.Price=pe,pt.PosPrev=c,pt.BackPrev=0,pt.Prev1IsChar=0,wt=1)),Pt=Ht(t._matchFinder)+1,Pt=4095-c<Pt?4095-c:Pt,yt=Pt,!(yt<2)){if(yt>t._numFastBytes&&(yt=t._numFastBytes),!wt&&j!=D&&(de=Math.min(Pt-1,t._numFastBytes),N=Tt(t._matchFinder,0,t.reps[0],de),N>=2)){for(rt=lt(U),it=o+1&t._posStateMask,le=d+$[2048-t._isMatch[(rt<<4)+it]>>>2]+$[2048-t._isRep[rt]>>>2],Dt=c+1+N;F<Dt;)t._optimum[++F].Price=268435455;g=le+(fs=Vt(t._repMatchLenEncoder,N-2,it),fs+dt(t,0,rt,it)),E=t._optimum[Dt],g<E.Price&&(E.Price=g,E.PosPrev=c+1,E.BackPrev=0,E.Prev1IsChar=1,E.Prev2=0)}for(Oe=2,bt=0;bt<4;++bt)if(P=Tt(t._matchFinder,-1,t.reps[bt],yt),!(P<2)){K=P;do{for(;F<c+P;)t._optimum[++F].Price=268435455;g=Zt+(gs=Vt(t._repMatchLenEncoder,P-2,nt),gs+dt(t,bt,U,nt)),E=t._optimum[c+P],g<E.Price&&(E.Price=g,E.PosPrev=c,E.BackPrev=bt,E.Prev1IsChar=0)}while(--P>=2);if(P=K,bt||(Oe=P+1),P<Pt&&(de=Math.min(Pt-1-P,t._numFastBytes),N=Tt(t._matchFinder,P,t.reps[bt],de),N>=2)){for(rt=U<7?8:11,it=o+P&t._posStateMask,m=Zt+(vs=Vt(t._repMatchLenEncoder,P-2,nt),vs+dt(t,bt,U,nt))+$[t._isMatch[(rt<<4)+it]>>>2]+Ye(he(t._literalEncoder,o+P,Y(t._matchFinder,P-1-1)),1,Y(t._matchFinder,P-1-(t.reps[bt]+1)),Y(t._matchFinder,P-1)),rt=lt(rt),it=o+P+1&t._posStateMask,St=m+$[2048-t._isMatch[(rt<<4)+it]>>>2],le=St+$[2048-t._isRep[rt]>>>2],Dt=P+1+N;F<c+Dt;)t._optimum[++F].Price=268435455;g=le+(_s=Vt(t._repMatchLenEncoder,N-2,it),_s+dt(t,0,rt,it)),E=t._optimum[c+Dt],g<E.Price&&(E.Price=g,E.PosPrev=c+P+1,E.BackPrev=0,E.Prev1IsChar=1,E.Prev2=1,E.PosPrev2=c,E.BackPrev2=bt)}}if(st>yt){for(st=yt,Lt=0;st>t._matchDistances[Lt];Lt+=2);t._matchDistances[Lt]=st,Lt+=2}if(st>=Oe){for(er=_t+$[t._isRep[U]>>>2];F<c+st;)t._optimum[++F].Price=268435455;for(ut=0;Oe>t._matchDistances[ut];)ut+=2;for(P=Oe;;++P)if(S=t._matchDistances[ut+1],g=er+G(t,S,P,nt),E=t._optimum[c+P],g<E.Price&&(E.Price=g,E.PosPrev=c,E.BackPrev=S+4,E.Prev1IsChar=0),P==t._matchDistances[ut]){if(P<Pt&&(de=Math.min(Pt-1-P,t._numFastBytes),N=Tt(t._matchFinder,P,S,de),N>=2)){for(rt=U<7?7:10,it=o+P&t._posStateMask,m=g+$[t._isMatch[(rt<<4)+it]>>>2]+Ye(he(t._literalEncoder,o+P,Y(t._matchFinder,P-1-1)),1,Y(t._matchFinder,P-(S+1)-1),Y(t._matchFinder,P-1)),rt=lt(rt),it=o+P+1&t._posStateMask,St=m+$[2048-t._isMatch[(rt<<4)+it]>>>2],le=St+$[2048-t._isRep[rt]>>>2],Dt=P+1+N;F<c+Dt;)t._optimum[++F].Price=268435455;g=le+(ws=Vt(t._repMatchLenEncoder,N-2,it),ws+dt(t,0,rt,it)),E=t._optimum[c+Dt],g<E.Price&&(E.Price=g,E.PosPrev=c+P+1,E.BackPrev=0,E.Prev1IsChar=1,E.Prev2=1,E.PosPrev2=c,E.BackPrev2=S+4)}if(ut+=2,ut==Lt)break}}}}}function G(t,o,c,d){var m,g=Qt(c);return o<128?m=t._distancesPrices[g*128+o]:m=t._posSlotPrices[(g<<6)+Nn(o)]+t._alignPrices[o&15],m+Vt(t._lenEncoder,c-2,d)}function dt(t,o,c,d){var m;return o?(m=$[2048-t._isRepG0[c]>>>2],o==1?m+=$[t._isRepG1[c]>>>2]:(m+=$[2048-t._isRepG1[c]>>>2],m+=De(t._isRepG2[c],o-2))):(m=$[t._isRepG0[c]>>>2],m+=$[2048-t._isRep0Long[(c<<4)+d]>>>2]),m}function vt(t,o,c){return $[t._isRepG0[o]>>>2]+$[t._isRep0Long[(o<<4)+c]>>>2]}function Ze(t){Nt(t),Zn(t._rangeEncoder),ct(t._isMatch),ct(t._isRep0Long),ct(t._isRep),ct(t._isRepG0),ct(t._isRepG1),ct(t._isRepG2),ct(t._posEncoders),$n(t._literalEncoder);for(var o=0;o<4;++o)ct(t._posSlotEncoder[o].Models);ss(t._lenEncoder,1<<t._posStateBits),ss(t._repMatchLenEncoder,1<<t._posStateBits),ct(t._posAlignEncoder.Models),t._longestMatchWasFound=0,t._optimumEndIndex=0,t._optimumCurrentIndex=0,t._additionalOffset=0}function Ce(t,o){o>0&&(br(t._matchFinder,o),t._additionalOffset+=o)}function kr(t){var o=0;return t._numDistancePairs=Qe(t._matchFinder,t._matchDistances),t._numDistancePairs>0&&(o=t._matchDistances[t._numDistancePairs-2],o==t._numFastBytes&&(o+=Tt(t._matchFinder,o-1,t._matchDistances[t._numDistancePairs-1],273-o))),++t._additionalOffset,o}function rs(t){t._matchFinder&&t._needReleaseMFStream&&(t._matchFinder._stream=null,t._needReleaseMFStream=0)}function On(t){rs(t),t._rangeEncoder.Stream=null}function zn(t,o){t._dictionarySize=o;for(var c=0;o>1<<c;++c);t._distTableSize=c*2}function Fn(t,o){var c=t._matchFinderType;t._matchFinderType=o,t._matchFinder&&c!=t._matchFinderType&&(t._dictionarySizePrev=-1,t._matchFinder=null)}function Hn(t,o){t.properties[0]=(t._posStateBits*5+t._numLiteralPosStateBits)*9+t._numLiteralContextBits<<24>>24;for(var c=0;c<4;++c)t.properties[1+c]=t._dictionarySize>>8*c<<24>>24;Xe(o,t.properties,0,5)}function In(t,o){if(t._writeEndMark){Q(t._rangeEncoder,t._isMatch,(t._state<<4)+o,1),Q(t._rangeEncoder,t._isRep,t._state,0),t._state=t._state<7?7:10,Sr(t._lenEncoder,t._rangeEncoder,0,o);var c=Qt(2);Re(t._posSlotEncoder[c],t._rangeEncoder,63),hs(t._rangeEncoder,67108863,26),us(t._posAlignEncoder,t._rangeEncoder,15)}}function Tr(t){return t<2048?Rt[t]:t<2097152?Rt[t>>10]+20:Rt[t>>20]+40}function Nn(t){return t<131072?Rt[t>>6]+12:t<134217728?Rt[t>>16]+32:Rt[t>>26]+52}function jn(t,o,c,d){c<8?(Q(o,t._choice,0,0),Re(t._lowCoder[d],o,c)):(c-=8,Q(o,t._choice,0,1),c<8?(Q(o,t._choice,1,0),Re(t._midCoder[d],o,c)):(Q(o,t._choice,1,1),Re(t._highCoder,o,c-8)))}function Un(t){t._choice=p(2),t._lowCoder=p(16),t._midCoder=p(16),t._highCoder=Me({},8);for(var o=0;o<16;++o)t._lowCoder[o]=Me({},3),t._midCoder[o]=Me({},3);return t}function ss(t,o){ct(t._choice);for(var c=0;c<o;++c)ct(t._lowCoder[c].Models),ct(t._midCoder[c].Models);ct(t._highCoder.Models)}function ns(t,o,c,d,m){var g,S,B,D,L;for(g=$[t._choice[0]>>>2],S=$[2048-t._choice[0]>>>2],B=S+$[t._choice[1]>>>2],D=S+$[2048-t._choice[1]>>>2],L=0,L=0;L<8;++L){if(L>=c)return;d[m+L]=g+tr(t._lowCoder[o],L)}for(;L<16;++L){if(L>=c)return;d[m+L]=B+tr(t._midCoder[o],L-8)}for(;L<c;++L)d[m+L]=D+tr(t._highCoder,L-8-8)}function Sr(t,o,c,d){jn(t,o,c,d),--t._counters[d]==0&&(ns(t,d,t._tableSize,t._prices,d*272),t._counters[d]=t._tableSize)}function is(t){return Un(t),t._prices=[],t._counters=[],t}function Vt(t,o,c){return t._prices[c*272+o]}function as(t,o){for(var c=0;c<o;++c)ns(t,c,t._tableSize,t._prices,c*272),t._counters[c]=t._tableSize}function qn(t,o,c){var d,m;if(!(t.m_Coders!=null&&t.m_NumPrevBits==c&&t.m_NumPosBits==o))for(t.m_NumPosBits=o,t.m_PosMask=(1<<o)-1,t.m_NumPrevBits=c,m=1<<t.m_NumPrevBits+t.m_NumPosBits,t.m_Coders=p(m),d=0;d<m;++d)t.m_Coders[d]=Gn({})}function he(t,o,c){return t.m_Coders[((o&t.m_PosMask)<<t.m_NumPrevBits)+((c&255)>>>8-t.m_NumPrevBits)]}function $n(t){var o,c=1<<t.m_NumPrevBits+t.m_NumPosBits;for(o=0;o<c;++o)ct(t.m_Coders[o].m_Encoders)}function os(t,o,c){var d,m,g=1;for(m=7;m>=0;--m)d=c>>m&1,Q(o,t.m_Encoders,g,d),g=g<<1|d}function Jn(t,o,c,d){var m,g,S,B,D=1,L=1;for(g=7;g>=0;--g)m=d>>g&1,B=L,D&&(S=c>>g&1,B+=1+S<<8,D=S==m),Q(o,t.m_Encoders,B,m),L=L<<1|m}function Gn(t){return t.m_Encoders=p(768),t}function Ye(t,o,c,d){var m,g=1,S=7,B,D=0;if(o){for(;S>=0;--S)if(B=c>>S&1,m=d>>S&1,D+=De(t.m_Encoders[(1+B<<8)+g],m),g=g<<1|m,B!=m){--S;break}}for(;S>=0;--S)m=d>>S&1,D+=De(t.m_Encoders[g],m),g=g<<1|m;return D}function cs(t){t.BackPrev=-1,t.Prev1IsChar=0}function Xn(t){t.BackPrev=0,t.Prev1IsChar=0}function Me(t,o){return t.NumBitLevels=o,t.Models=p(1<<o),t}function Re(t,o,c){var d,m,g=1;for(m=t.NumBitLevels;m!=0;)--m,d=c>>>m&1,Q(o,t.Models,g,d),g=g<<1|d}function tr(t,o){var c,d,m=1,g=0;for(d=t.NumBitLevels;d!=0;)--d,c=o>>>d&1,g+=De(t.Models[m],c),m=(m<<1)+c;return g}function us(t,o,c){var d,m,g=1;for(m=0;m<t.NumBitLevels;++m)d=c&1,Q(o,t.Models,g,d),g=g<<1|d,c>>=1}function Wn(t,o){var c,d,m=1,g=0;for(d=t.NumBitLevels;d!=0;--d)c=o&1,o>>>=1,g+=De(t.Models[m],c),m=m<<1|c;return g}function Qn(t,o,c,d,m){var g,S,B=1;for(S=0;S<d;++S)g=m&1,Q(c,t,o+B,g),B=B<<1|g,m>>=1}function Vn(t,o,c,d){var m,g,S=1,B=0;for(g=c;g!=0;--g)m=d&1,d>>>=1,B+=$[((t[o+S]-m^-m)&2047)>>>2],S=S<<1|m;return B}function ct(t){for(var o=t.length-1;o>=0;--o)t[o]=1024}var $=function(){var t,o,c,d,m=[];for(o=8;o>=0;--o)for(d=1<<9-o-1,t=1<<9-o,c=d;c<t;++c)m[c]=(o<<6)+(t-c<<6>>>9-o-1);return m}();function Q(t,o,c,d){var m,g=o[c];m=(t.Range>>>11)*g,d?(t.Low=f(t.Low,w(k(m),[4294967295,0])),t.Range-=m,o[c]=g-(g>>>5)<<16>>16):(t.Range=m,o[c]=g+(2048-g>>>5)<<16>>16),t.Range&-16777216||(t.Range<<=8,Pr(t))}function hs(t,o,c){for(var d=c-1;d>=0;--d)t.Range>>>=1,(o>>>d&1)==1&&(t.Low=f(t.Low,k(t.Range))),t.Range&-16777216||(t.Range<<=8,Pr(t))}function Kn(t){return f(f(k(t._cacheSize),t._position),[4,0])}function Zn(t){t._position=u,t.Low=u,t.Range=-1,t._cacheSize=1,t._cache=0}function Pr(t){var o,c=T(V(t.Low,32));if(c!=0||l(t.Low,[4278190080,0])<0){t._position=f(t._position,k(t._cacheSize)),o=t._cache;do Se(t.Stream,o+c),o=255;while(--t._cacheSize!=0);t._cache=T(t.Low)>>>24}++t._cacheSize,t.Low=M(w(t.Low,[16777215,0]),8)}function De(t,o){return $[((t-o^-o)&2047)>>>2]}function ls(t){var o,c=[],d,m=0,g,S=t.length;if(typeof t=="object")return t;for(Ft(t,0,S,c,0),g=0;g<S;++g)o=c[g],o>=1&&o<=127?++m:!o||o>=128&&o<=2047?m+=2:m+=3;for(d=[],m=0,g=0;g<S;++g)o=c[g],o>=1&&o<=127?d[m++]=o<<24>>24:!o||o>=128&&o<=2047?(d[m++]=(192|o>>6&31)<<24>>24,d[m++]=(128|o&63)<<24>>24):(d[m++]=(224|o>>12&15)<<24>>24,d[m++]=(128|o>>6&63)<<24>>24,d[m++]=(128|o&63)<<24>>24);return d}function ps(t){return t[1]+t[0]}function Yn(t,o,c,d){var m={},g,S,B=typeof c>"u"&&typeof d>"u";if(typeof c!="function"&&(S=c,c=d=0),d=d||function(L){if(!(typeof S>"u"))return _(L,S)},c=c||function(L,x){if(!(typeof S>"u"))return postMessage({action:r,cbn:S,result:L,error:x})},B){for(m.c=Gt({},ls(t),ds(o));Ve(m.c.chunker););return ie(m.c.output)}try{m.c=Gt({},ls(t),ds(o)),d(0)}catch(L){return c(null,L)}function D(){try{for(var L,x=new Date().getTime();Ve(m.c.chunker);)if(g=ps(m.c.chunker.inBytesProcessed)/ps(m.c.length_0),new Date().getTime()-x>200)return d(g),s(D,0),0;d(1),L=ie(m.c.output),s(c.bind(null,L),0)}catch(X){c(null,X)}}s(D,0)}var ds=function(){var t=[{s:16,f:64,m:0},{s:20,f:64,m:0},{s:19,f:64,m:1},{s:20,f:64,m:1},{s:21,f:128,m:1},{s:22,f:128,m:1},{s:23,f:128,m:1},{s:24,f:255,m:1},{s:25,f:255,m:1}];return function(o){return t[o-1]||t[6]}}();return typeof onmessage<"u"&&(typeof window>"u"||typeof window.document>"u")&&function(){onmessage=function(t){t&&t.data&&t.data.action==r&&Ir.compress(t.data.data,t.data.mode,t.data.cbn)}}(),{compress:Yn}}();const Si=async r=>await Li(r);let rr=null;const Pi=async r=>(r=r||'"./lzma_worker-min.js"',rr||(await Si(r)?rr=Ti(r):(console.error("lzma\u65E0\u6CD5\u627E\u5230"+r+": \u65E0\u6CD5\u542F\u52A8worker\u6A21\u5F0F\uFF0C\u5C06\u542F\u7528\u6D4F\u89C8\u5668\u8BA1\u7B97\u6A21\u5F0F\uFF0C\u6027\u80FD\u53D7\u5F71\u54CD"),rr=Ir),rr)),Li=r=>new Promise((e,s)=>{const n=new XMLHttpRequest;n.open("get",r,!0),n.addEventListener("error",i=>{e(!1)}),n.addEventListener("load",i=>{n.status===200&&e(!0),e(!1)}),n.send()}),Ei=new Zs(5);let cn="";const xi=r=>{cn=r};let Ts=null;const un=r=>{const e=typeof r=="string"?r:JSON.stringify(r);let s=location.pathname;s=s.replace(/[^\/\/.]+\.(html|html)$/,"").replace("//","/");const n=cn||location.origin+s+"static/lzma_worker.js";return console.log("lzma_worker",n),new Promise(async i=>{let a=Date.now();window.requestIdleCallback(async()=>{Ts=await Pi(n),Ts.compress(e,5,(u,h)=>{if(!u)throw Error("static/lzma_worker.js \u65E0\u6CD5\u52A0\u8F7D\uFF0C\u8BF7\u68C0\u67E5\u8BE5\u6587\u4EF6");console.log("compress finish",Date.now()-a);const _=[...u],p=new Int8Array(_.length);for(let f=0;f<_.length;f++)p[f]=_[f];console.log("compress success",Date.now()-a),i(p)})})})},or=async(r,e,s)=>new Promise((n,i)=>{const a=new XMLHttpRequest;a.open("POST",r,!0),s?(a.setRequestHeader("xw-body-encoding","v1"),Ei.addTask(()=>new Promise((u,h)=>{un(e).then(_=>{a.send(_.buffer)}).finally(()=>{u()})}))):a.send(JSON.stringify(e)),a.onreadystatechange=()=>{},a.addEventListener("readystatechange",u=>{a.readyState===4&&a.status===200?n(void 0):a.status===500&&i(a.statusText)}),a.addEventListener("error",u=>{console.error("\u957F\u5EA6",JSON.stringify(e).length),i(u)})}),Bi=(r,e,s)=>{window.navigator.sendBeacon!==void 0?s?un(e).then(n=>{window.navigator.sendBeacon(r,n.buffer)}):window.navigator.sendBeacon(r,JSON.stringify(e)):or(r,e,s)};class Ci{constructor(){y(this,"logs",[])}get length(){return this.logs.length}async init(){}async push(e){try{this.logs.push(e)}catch(s){console.error(s)}}async compulsionSave(){}clearArray(){this.logs.length=0}async shift(e=1){let s=[[...this.logs]];return this.clearArray(),s}}async function Mi(r){const e=new Ci;return await e.init(),e}var Ri=typeof global=="object"&&global&&global.Object===Object&&global;const Di=Ri;var Ai=typeof self=="object"&&self&&self.Object===Object&&self,Oi=Di||Ai||Function("return this")();const lr=Oi;var zi=lr.Symbol;const $t=zi;var hn=Object.prototype,Fi=hn.hasOwnProperty,Hi=hn.toString,ze=$t?$t.toStringTag:void 0;function Ii(r){var e=Fi.call(r,ze),s=r[ze];try{r[ze]=void 0;var n=!0}catch{}var i=Hi.call(r);return n&&(e?r[ze]=s:delete r[ze]),i}var Ni=Object.prototype,ji=Ni.toString;function Ui(r){return ji.call(r)}var qi="[object Null]",$i="[object Undefined]",Ss=$t?$t.toStringTag:void 0;function Wr(r){return r==null?r===void 0?$i:qi:Ss&&Ss in Object(r)?Ii(r):Ui(r)}function Qr(r){return r!=null&&typeof r=="object"}var Ji="[object Symbol]";function pr(r){return typeof r=="symbol"||Qr(r)&&Wr(r)==Ji}function Gi(r,e){for(var s=-1,n=r==null?0:r.length,i=Array(n);++s<n;)i[s]=e(r[s],s,r);return i}var Xi=Array.isArray;const dr=Xi;var Wi=1/0,Ps=$t?$t.prototype:void 0,Ls=Ps?Ps.toString:void 0;function ln(r){if(typeof r=="string")return r;if(dr(r))return Gi(r,ln)+"";if(pr(r))return Ls?Ls.call(r):"";var e=r+"";return e=="0"&&1/r==-Wi?"-0":e}var Qi=/\s/;function Vi(r){for(var e=r.length;e--&&Qi.test(r.charAt(e)););return e}var Ki=/^\s+/;function Zi(r){return r&&r.slice(0,Vi(r)+1).replace(Ki,"")}function Ue(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var Es=0/0,Yi=/^[-+]0x[0-9a-f]+$/i,ta=/^0b[01]+$/i,ea=/^0o[0-7]+$/i,ra=parseInt;function xs(r){if(typeof r=="number")return r;if(pr(r))return Es;if(Ue(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Ue(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=Zi(r);var s=ta.test(r);return s||ea.test(r)?ra(r.slice(2),s?2:8):Yi.test(r)?Es:+r}var sa="[object AsyncFunction]",na="[object Function]",ia="[object GeneratorFunction]",aa="[object Proxy]";function oa(r){if(!Ue(r))return!1;var e=Wr(r);return e==na||e==ia||e==sa||e==aa}var ca=lr["__core-js_shared__"];const Er=ca;var Bs=function(){var r=/[^.]+$/.exec(Er&&Er.keys&&Er.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function ua(r){return!!Bs&&Bs in r}var ha=Function.prototype,la=ha.toString;function pa(r){if(r!=null){try{return la.call(r)}catch{}try{return r+""}catch{}}return""}var da=/[\\^$.*+?()[\]{}|]/g,ma=/^\[object .+?Constructor\]$/,fa=Function.prototype,ga=Object.prototype,va=fa.toString,_a=ga.hasOwnProperty,wa=RegExp("^"+va.call(_a).replace(da,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ya(r){if(!Ue(r)||ua(r))return!1;var e=oa(r)?wa:ma;return e.test(pa(r))}function ba(r,e){return r==null?void 0:r[e]}function pn(r,e){var s=ba(r,e);return ya(s)?s:void 0}function ka(r,e){return r===e||r!==r&&e!==e}var Ta="[object Arguments]";function Cs(r){return Qr(r)&&Wr(r)==Ta}var dn=Object.prototype,Sa=dn.hasOwnProperty,Pa=dn.propertyIsEnumerable,La=Cs(function(){return arguments}())?Cs:function(r){return Qr(r)&&Sa.call(r,"callee")&&!Pa.call(r,"callee")};const Ea=La;var xa=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ba=/^\w*$/;function Ca(r,e){if(dr(r))return!1;var s=typeof r;return s=="number"||s=="symbol"||s=="boolean"||r==null||pr(r)?!0:Ba.test(r)||!xa.test(r)||e!=null&&r in Object(e)}var Ma=pn(Object,"create");const qe=Ma;function Ra(){this.__data__=qe?qe(null):{},this.size=0}function Da(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var Aa="__lodash_hash_undefined__",Oa=Object.prototype,za=Oa.hasOwnProperty;function Fa(r){var e=this.__data__;if(qe){var s=e[r];return s===Aa?void 0:s}return za.call(e,r)?e[r]:void 0}var Ha=Object.prototype,Ia=Ha.hasOwnProperty;function Na(r){var e=this.__data__;return qe?e[r]!==void 0:Ia.call(e,r)}var ja="__lodash_hash_undefined__";function Ua(r,e){var s=this.__data__;return this.size+=this.has(r)?0:1,s[r]=qe&&e===void 0?ja:e,this}function re(r){var e=-1,s=r==null?0:r.length;for(this.clear();++e<s;){var n=r[e];this.set(n[0],n[1])}}re.prototype.clear=Ra;re.prototype.delete=Da;re.prototype.get=Fa;re.prototype.has=Na;re.prototype.set=Ua;function qa(){this.__data__=[],this.size=0}function mr(r,e){for(var s=r.length;s--;)if(ka(r[s][0],e))return s;return-1}var $a=Array.prototype,Ja=$a.splice;function Ga(r){var e=this.__data__,s=mr(e,r);if(s<0)return!1;var n=e.length-1;return s==n?e.pop():Ja.call(e,s,1),--this.size,!0}function Xa(r){var e=this.__data__,s=mr(e,r);return s<0?void 0:e[s][1]}function Wa(r){return mr(this.__data__,r)>-1}function Qa(r,e){var s=this.__data__,n=mr(s,r);return n<0?(++this.size,s.push([r,e])):s[n][1]=e,this}function be(r){var e=-1,s=r==null?0:r.length;for(this.clear();++e<s;){var n=r[e];this.set(n[0],n[1])}}be.prototype.clear=qa;be.prototype.delete=Ga;be.prototype.get=Xa;be.prototype.has=Wa;be.prototype.set=Qa;var Va=pn(lr,"Map");const Ka=Va;function Za(){this.size=0,this.__data__={hash:new re,map:new(Ka||be),string:new re}}function Ya(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function fr(r,e){var s=r.__data__;return Ya(e)?s[typeof e=="string"?"string":"hash"]:s.map}function to(r){var e=fr(this,r).delete(r);return this.size-=e?1:0,e}function eo(r){return fr(this,r).get(r)}function ro(r){return fr(this,r).has(r)}function so(r,e){var s=fr(this,r),n=s.size;return s.set(r,e),this.size+=s.size==n?0:1,this}function se(r){var e=-1,s=r==null?0:r.length;for(this.clear();++e<s;){var n=r[e];this.set(n[0],n[1])}}se.prototype.clear=Za;se.prototype.delete=to;se.prototype.get=eo;se.prototype.has=ro;se.prototype.set=so;var no="Expected a function";function Vr(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(no);var s=function(){var n=arguments,i=e?e.apply(this,n):n[0],a=s.cache;if(a.has(i))return a.get(i);var u=r.apply(this,n);return s.cache=a.set(i,u)||a,u};return s.cache=new(Vr.Cache||se),s}Vr.Cache=se;var io=500;function ao(r){var e=Vr(r,function(n){return s.size===io&&s.clear(),n}),s=e.cache;return e}var oo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,co=/\\(\\)?/g,uo=ao(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(oo,function(s,n,i,a){e.push(i?a.replace(co,"$1"):n||s)}),e});const ho=uo;function lo(r){return r==null?"":ln(r)}function po(r,e){return dr(r)?r:Ca(r,e)?[r]:ho(lo(r))}var mo=1/0;function fo(r){if(typeof r=="string"||pr(r))return r;var e=r+"";return e=="0"&&1/r==-mo?"-0":e}function go(r,e){e=po(e,r);for(var s=0,n=e.length;r!=null&&s<n;)r=r[fo(e[s++])];return s&&s==n?r:void 0}function mn(r,e,s){var n=r==null?void 0:go(r,e);return n===void 0?s:n}function vo(r,e){for(var s=-1,n=e.length,i=r.length;++s<n;)r[i+s]=e[s];return r}var Ms=$t?$t.isConcatSpreadable:void 0;function _o(r){return dr(r)||Ea(r)||!!(Ms&&r&&r[Ms])}function fn(r,e,s,n,i){var a=-1,u=r.length;for(s||(s=_o),i||(i=[]);++a<u;){var h=r[a];e>0&&s(h)?e>1?fn(h,e-1,s,n,i):vo(i,h):n||(i[i.length]=h)}return i}function gn(r){var e=r==null?0:r.length;return e?fn(r,1):[]}var wo=function(){return lr.Date.now()};const xr=wo;var yo="Expected a function",bo=Math.max,ko=Math.min;function To(r,e,s){var n,i,a,u,h,_,p=0,f=!1,w=!1,l=!0;if(typeof r!="function")throw new TypeError(yo);e=xs(e)||0,Ue(s)&&(f=!!s.leading,w="maxWait"in s,a=w?bo(xs(s.maxWait)||0,e):a,l="trailing"in s?!!s.trailing:l);function v(J){var ht=n,gt=i;return n=i=void 0,p=J,u=r.apply(gt,ht),u}function b(J){return p=J,h=setTimeout(R,e),f?v(J):u}function k(J){var ht=J-_,gt=J-p,zt=e-ht;return w?ko(zt,a-gt):zt}function T(J){var ht=J-_,gt=J-p;return _===void 0||ht>=e||ht<0||w&>>=a}function R(){var J=xr();if(T(J))return tt(J);h=setTimeout(R,k(J))}function tt(J){return h=void 0,l&&n?v(J):(n=i=void 0,u)}function M(){h!==void 0&&clearTimeout(h),p=0,n=_=i=h=void 0}function C(){return h===void 0?u:tt(xr())}function V(){var J=xr(),ht=T(J);if(n=arguments,i=this,_=J,ht){if(h===void 0)return b(_);if(w)return clearTimeout(h),h=setTimeout(R,e),v(_)}return h===void 0&&(h=setTimeout(R,e)),u}return V.cancel=M,V.flush=C,V}class So{constructor(){y(this,"logsObj"),y(this,"initPromise"),this.initPromise=this.init()}async init(){return this.logsObj=await Mi(),this.logsObj}get length(){var e,s;return(s=(e=this.logsObj)==null?void 0:e.length)!=null?s:0}getLogs(){var e;return((e=this.logsObj)==null?void 0:e.logs)||[]}async cacheLog(e){var s;await this.initPromise,await((s=this.logsObj)==null?void 0:s.push(e))}async send(e){var s;await this.initPromise;const n=await((s=this.logsObj)==null?void 0:s.shift());n!=null&&n.length&&await e(gn(n))}async sendByBeacon(e){var s;await this.initPromise;const n=await((s=this.logsObj)==null?void 0:s.shift());n!=null&&n.length&&await e(n)}}function Po(r){return gr(r,"String")}function Lo(r){return gr(r,"Array")}function Eo(r){return gr(r,"Object")}function xo(r){return typeof r=="function"}function Rs(r,e="Object"){return Lo(r)?r.every(s=>gr(s,e)):!1}function gr(r,e="Object"){return Object.prototype.toString.call(r)===`[object ${e}]`}const Bo=window.indexedDB,Co=new Set(["add","clear","count","delete","get","getAll","getAllKeys","getKey","openCursor","openKeyCursor","put"]);function Mo(r,e,...s){return new Promise(async(n,i)=>{try{const a=(await this.createTransaction(r)).objectStore(r);let u=a[e].call(a,...s);u?(u.onsuccess=function(h){n(mn(h,"target.result"))},u.onerror=function(h){console.log("---storeOperate onerror",r,e,h),i(h)}):n(void 0)}catch(a){i(a)}})}function Ro(r){const e=this;let s={};return Co.forEach(n=>{s[n]=function(...i){var a;return(a=e==null?void 0:e.manager)==null?void 0:a.pushTask(()=>Mo.call(e,r,n,...i))}}),s}class Do{constructor(){y(this,"dbManagerMap",new Map)}getOrCreateDBManager(e){if(this.dbManagerMap.has(e))return this.dbManagerMap.get(e);const s=new Ao(e);return this.dbManagerMap.set(e,s),s}get(e){return this.getOrCreateDBManager(e)}clear(e){const s=this.dbManagerMap.get(e);!s||(s.close(),this.dbManagerMap.delete(e))}}class Ao{constructor(e){y(this,"initPromise",Promise.resolve()),y(this,"openStatus",""),y(this,"version",0),y(this,"dbName"),y(this,"db",null),y(this,"isClose",!0),y(this,"task",Promise.resolve()),this.dbName=e,this.init()}pushTask(e){if(this.isClose){console.log("----task error, IndexDB is close");return}let s=this.task.then(()=>{try{return xo(e)?e():e}catch(n){console.log("----task error",n)}});return this.task=s,s}close(){const e=()=>{this.openStatus="",this.version=0,this.db&&(this.db.close(),this.db=null)};if(this.isClose)e();else{let s=this.pushTask(e);return this.isClose=!0,s}}transTransactionParam(e){return Po(e)?[{storeName:e}]:Rs(e,"String")?e.map(s=>({storeName:s})):Eo(e)?[e]:Rs(e)?e:(console.warn("[transTransactionParam]\u5165\u53C2\u683C\u5F0F\u4E0D\u6B63\u786E",e),[])}async transaction(e,s="readonly"){await this.initPromise;const n=this.transTransactionParam(e);if(!n.length)return;const i=[];return n.forEach(a=>{!this.db||this.db.objectStoreNames.contains(a.storeName)||i.push(u=>{u.createObjectStore(a.storeName,a.option)})}),i.length>0&&await this.upgradeneeded(i),Ro.bind({manager:this,createTransaction:async a=>{if(await this.initPromise,!!this.db)return this.db.transaction(a,s)}})}init(e,s){let n=this.initPromise;this.initPromise=new Promise(async(i,a)=>{await n,await this.close();const u=Bo.open(this.dbName,e);let h=setTimeout(()=>{a(new Error("[IndexDB\u8FDE\u63A5\u8D85\u65F6] name: "+this.dbName+" \u8BF7\u5C1D\u8BD5\u5237\u65B0\u6216\u91CD\u542F\u6D4F\u89C8\u5668"))},1e4);u.onsuccess=()=>{clearTimeout(h),this.openStatus="success",this.db=u.result;const _=this.db;this.isClose=!1;const p=_.version;this.version=_.version,_.onclose=()=>{this.isClose=!0,console.log("[indexDB\u5173\u95ED]",p)},console.log(`[indexDB\u521D\u59CB\u5316]
|
|
9
9
|
onsuccess name: `+this.dbName+`
|
|
10
|
-
version: `+p),i()},u.onupgradeneeded=w=>{this.openStatus="upgradeneeded";const p=mr(w,"target.result");p?(s&&s(p),console.log("[indexDB\u521D\u59CB\u5316] onupgradeneeded name: "+this.dbName)):console.error("[indexDB\u521D\u59CB\u5316\u5931\u8D25] onupgradeneeded name: "+this.dbName)},u.onerror=w=>{clearTimeout(l),console.error("[indexDB\u521D\u59CB\u5316\u5931\u8D25] name: "+this.dbName,w),i()}})}async upgradeneeded(e){try{this.init(this.version+1,function(s){let r=e.length;for(;r--;)e[r](s)}),await this.initPromise}catch(s){console.error("[DBManager.upgradeneeded\u5931\u8D25]",s)}}}const Cn=new Do;class Oo{constructor(e="logs"){b(this,"logs",[]),b(this,"thisSize",0),b(this,"dbLength",0),b(this,"dbName","apaas-track"),b(this,"storeName","logs"),b(this,"maxSize",1024*1024),this.storeName=e}get length(){return this.dbLength+this.logs.length}async init(){let e=[];const s=await(await Cn.get(this.dbName)).transaction(this.storeName,"readonly");s&&(e=await s(this.storeName).getAllKeys()),this.dbLength=e.length}async push(e){try{const s=JSON.stringify(e).length;this.thisSize+s>=this.maxSize?(await this.save(),this.logs.push(e),this.thisSize=s,s>=this.maxSize&&await this.save()):(this.logs.push(e),this.thisSize+=JSON.stringify(e).length)}catch(s){console.error(s)}}async compulsionSave(){this.logs.length!==0&&await this.save()}clearArray(){this.logs.length=0,this.thisSize=0}async save(){try{const e=this.logs;if(e.length===0)return;const s=await(await Cn.get(this.dbName)).transaction(this.storeName,"readwrite");s&&(await s(this.storeName).add(e,Date.now()),this.dbLength++,this.clearArray())}catch(e){console.error(e)}}async shift(e=1){let s=[];if(this.dbLength!==0&&(s=await this.shiftDB(e)),e-s.length>0&&this.logs.length>0){let r=[...this.logs];this.clearArray(),s.push(r)}return s}async shiftDB(e){try{let s=[];const r=await(await Cn.get(this.dbName)).transaction(this.storeName,"readwrite");if(r){const i=r(this.storeName);let a=await i.getAllKeys();if(a.length===0)return[];const u=this.getRange(e,a),l=[];u.forEach(p=>{l.push(i.get(p))}),s=await Promise.all(l);const w=[];u.forEach(p=>{w.push(i.delete(p))}),await Promise.all(w),a=await i.getAllKeys(),this.dbLength=a.length}return s}catch(s){return console.error(s),[]}}getRange(e,s){const r=[];for(let i=0;i<e&&i<s.length;i++)r.push(s[i]);return r}}async function zo(n){const e=new Oo(n);return await e.init(),e}class Fo{constructor(){b(this,"logsDB"),b(this,"initPromise"),this.initPromise=this.init()}async init(){return this.logsDB=await zo(),this.logsDB}get length(){var e,s;return(s=(e=this.logsDB)==null?void 0:e.length)!=null?s:0}getLogs(){var e;return((e=this.logsDB)==null?void 0:e.logs)||[]}async cacheLog(e){var s;await this.initPromise,await((s=this.logsDB)==null?void 0:s.push(e))}async send(e){var s;await this.initPromise;const r=await((s=this.logsDB)==null?void 0:s.shift(5));r!=null&&r.length&&e(gr(r))}async sendByBeacon(e){var s;await this.initPromise,await((s=this.logsDB)==null?void 0:s.compulsionSave())}}class Ct extends Ge{constructor(e){super(e),b(this,"options"),b(this,"logsSender"),b(this,"nextTickLogs",[]),b(this,"isStart",!1),b(this,"listenPostMessageHandler"),this.options=e,this.initStorageData(),this.initBrowserLog(),e.commonLog&&this.initCommonLog(e.commonLog),console.log("this.options.useIndexDB",this.options.useIndexDB),this.options.useIndexDB?this.logsSender=new Fo:this.logsSender=new So}initStorageData(){const e=JSON.parse(localStorage.getItem("apaas-track")||"{}");e.anonymousid||(e.anonymousid=be()),e.logs||(e.logs=[]),e.distinctid=be(),localStorage.setItem("apaas-track",JSON.stringify(e))}getStorageData(){return JSON.parse(localStorage.getItem("apaas-track")||"{}")}updateStorageData(e){localStorage.setItem("apaas-track",JSON.stringify(e))}get anonymousid(){var e;return((e=this.browserLog)==null?void 0:e.anonymousid)||this.getStorageData().anonymousid}get distinctid(){var e;return((e=this.browserLog)==null?void 0:e.distinctid)||this.getStorageData().distinctid}initBrowserLog(){const e=new Hn.exports.UAParser;e.setUA(navigator.userAgent);const s=e.getResult(),r=s.os.version||"",i=s.os.name||"",a=s.browser.name||"",u=s.browser.version||"",l=navigator.vendor,w=ir.exports(`${i}${r}${l}${a}${u}`),p=location.href;this.browserLog={system:i,systemver:r,manufacturer:l,browser:a,browserver:u,terminalid:w,anonymousid:this.anonymousid,distinctid:this.distinctid,url:p,logsdkver:rn}}start(...e){if(this.isStart)return;let s=0,r=60*5*1e3,i=null,a=window.setInterval(()=>{u()},this.options.timer||1e4);setTimeout(()=>{u()},2e3);const u=()=>{this.send().then(()=>{s&&(s=0),i&&(clearInterval(i),i=null),a||(a=window.setInterval(()=>{u()},this.options.timer||1e4))}).catch(l=>{console.error("track send error",l),s++,s>=5&&(a&&clearInterval(a),a=null,i||(i=window.setInterval(()=>{u()},r)))})};super.start(),this.sendLegancyLogs(),this.isStart=!0,this.listenPostMessage()}getLegancyLogs(){return this.getStorageData().logs||[]}clearLegancyLogs(){const e=this.getStorageData();delete e.logs,this.updateStorageData(e)}sendLegancyLogs(){this.getLegancyLogs().forEach(e=>{this.addLogToQueue(e,!1,!1)}),this.clearLegancyLogs()}addToLegancyLog(e){e=this.transformLog(e);const s=[...this.getLegancyLogs()||[],e],r=this.getStorageData();r.logs=s,this.updateStorageData(r)}listenPostMessage(){this.listenPostMessageHandler=e=>{var s;const r=(e==null?void 0:e.data)||{};if(r.type==="getWebCommonParams"){const i=Array.from(document.querySelectorAll("iframe"));for(let a of i)(s=a==null?void 0:a.contentWindow)==null||s.postMessage({type:"receiveWebCommonParams",data:{url:this.options.url,timer:this.options.timer||1e4,zip:this.options.zip,commonLog:this.commonLog}},"*")}else if(r.type==="sendApaasLog"){const i=r.data,{log:a,isImmediate:u}=i;this.sendLog(a,u)}},window.addEventListener("message",this.listenPostMessageHandler)}divideLogsSend(e){return this.options.useIndexDB?cn(this.options.url,e,this.getZip()):Ho(e,{url:this.options.url,zip:this.getZip(),maxSize:this.getMaxSize()})}async sendByNextTick(e){if(this.nextTickLogs.push(e),await zn(),!this.nextTickLogs.length)return;const s=JSON.parse(JSON.stringify(this.nextTickLogs));this.divideLogsSend(this.nextTickLogs).catch(r=>{this.nextTickLogs=[...s,this.nextTickLogs]}),this.nextTickLogs.length=0}async send(){if(this.logsSender.length)try{await this.logsSender.send(this.divideLogsSend.bind(this))}catch{}}async sendLog(e,s=!1){try{e=JSON.parse(JSON.stringify(e))}catch{}s?this.sendByNextTick(e):await this.logsSender.cacheLog(e)}getZip(){return this.options.zip!==void 0?this.options.zip:!0}getMaxSize(){const e=this.options.zip!==void 0?this.options.zip:!0;return 1024*1024/(e?2:1)}async sendByBeacon(e){const s=async r=>Bi(`${this.options.url}`,r,e!==void 0?e:this.getZip());this.logsSender.length&&await this.logsSender.sendByBeacon(s.bind(this))}}function Ho(n,e){const{url:s,zip:r,maxSize:i}=e;if(JSON.stringify(n).length<=i||n.length===1)return cn(s,n,r);{const a=di(n,i),u=[];return a.forEach(l=>{u.push(cn(s,l,r))}),Promise.all(u)}}class me extends at{constructor(e){super(e,"click"),b(this,"paths",""),b(this,"customProperties",{}),b(this,"name","")}getProperties(){return{name:this.name,paths:this.paths,customProperties:this.customProperties}}setProperties(e){e.paths&&(this.paths=e.paths),e.name&&(this.name=e.name),this.customProperties=e.customProperties}}const Io=n=>!n||n===document||n.tagName==="HTML"||!n.hasAttribute?!1:n.hasAttribute("apaas-track-click")&&n.getAttribute("apaas-track-click")!=="false",As=n=>{n.target;const e=n.composedPath();if(!e.length)return!1;for(let s=0;s<e.length;s++){const r=e[s];if(r===window)return!1;if(Io(r))return r}return!1},jn=n=>{const e=n.tagName,s=n.id,r=n.className,i=(l,w,p)=>`${l}${w?"#"+w:""}${p?"."+p:""}`;let a=i(e,s,r)+" > ",u=n.parentElement;for(;u;){const l=u.tagName,w=u.id,p=u.className;a+=i(l,w,p)+" > ",u=u.parentElement}return a=a.replace(/\s>\s$/,""),a&&(a=a.split(" > ").reverse().join(" > ")),a},No=(n,e)=>{const s=(r,i)=>r===i;if(n===document)return!0;{const r=e.target;if(s(n,r))return!0;let i=r.parentElement;if(!i)return!1;for(;i;){if(s(n,i))return!0;i=i.parentElement}return!1}},jo=(n,e)=>{const s=()=>!0,r=a=>As(a),i=a=>{a.target;const u=(e==null?void 0:e.collectSelectors)||[];if(!u.length)return null;let l=[];for(let p=0;p<u.length;p++){const{selector:f,name:v}=u[p],h=document.querySelectorAll(f);!h||!h.length||h.forEach(_=>{l.push({name:v,selector:f,element:_})})}if(!l.length)return null;let w=[];for(let p=0;p<l.length;p++){const{element:f,name:v,selector:h}=l[p];f&&No(f,a)&&w.push({name:v,selector:h,element:f})}return w};e&&document.addEventListener("click",a=>{if(!((e==null?void 0:e.collectUrl)||s)(location))return;const u=((e==null?void 0:e.collectElement)||r)(a),l=i(a);if(!u&&(!l||!l.length))return;const w=As(a);if(w){let p={};const f=(e==null?void 0:e.customProperty)||[],v=w.attributes;let h="";const _=v.getNamedItem("apaas-track-click");if(_&&_.nodeName==="apaas-track-click"){const T=_.nodeValue;T&&T!=="false"&&T!=="true"&&(h=T)}for(let T of v){let R=T.nodeName;const tt=T.nodeValue;R.startsWith("data-apaastrack-")?p[R.replace("data-apaastrack-","")]=tt||"":f.length&&f.forEach(M=>{if(R===M){const C=R.replace(/-[A-Za-z]/,V=>V[1].toUpperCase());p[C]=tt||""}})}let y="";e!=null&&e.trackElementPath&&(y=jn(w));const k=new me(n);k.setProperties({name:p.name||h,paths:y,customProperties:p}),n.addLogByEvent(k)}if(l&&l.length)for(let p of l){let f="";e!=null&&e.trackElementPath&&(f=jn(p.element));const v=new me(n);v.setProperties({name:p.name,paths:f,customProperties:{selector:p.selector,name:p.name}}),n.addLogByEvent(v)}},!0)},Uo=(n,e,s,r)=>{const i={paths:"",customProperties:{}};"customProperties"in e?i.customProperties=e.customProperties:i.customProperties=e;const a=Bt(n,"click");let u=e.paths||"";r&&!u&&(s==null?void 0:s.trackElementPath)&&(u=jn(r.target),i.paths=u),a.setProperties(i),n.addLogByEvent(a)},qo=n=>{n||(n={}),me.eventOptions=n,me.initApaasTrackHook=e=>{e.executeClickEvent=(s,r)=>{Uo(e,s,n,r)}},me.startApaasTrackHook=e=>{jo(e,n)},Ct.registerEvent("click",me)},ge=[],_r=n=>{ge.length||window.addEventListener("pagehide",(...e)=>{ge.forEach(s=>{s(...e)})}),ge.push(n)},$o=n=>{for(let e=0;e<ge.length;e++){const s=ge[e];n===s&&ge.splice(e,1)}},Ot=[],Jo=n=>{Ot.length||(document.addEventListener("click",(...e)=>{Ot.forEach(s=>{s(...e)})}),document.addEventListener("mouseover",(...e)=>{Ot.forEach(s=>{s(...e)})}),document.addEventListener("scroll",(...e)=>{Ot.forEach(s=>{s(...e)})}),document.addEventListener("keydown",(...e)=>{Ot.forEach(s=>{s(...e)})})),Ot.push(n)},Go=n=>{for(let e=0;e<Ot.length;e++){const s=Ot[e];n===s&&Ot.splice(e,1)}};class Os extends at{constructor(e){super(e,"close")}}const Xo=n=>{_r(e=>{if(n){n.sendByBeacon();const s=Bt(n,"close").getEventLog();n.addToLegancyLog(s)}})},Wo=()=>{Os.startApaasTrackHook=n=>{Xo(n)},Ct.registerEvent("close",Os)};class zs extends at{constructor(e){super(e,"entermain"),b(this,"groupid",""),b(this,"localtime",""),b(this,"cheatinfo",{})}getProperties(){return{groupid:this.groupid,localtime:this.localtime,cheatinfo:this.cheatinfo}}setProperties(e){this.groupid=e.groupid,this.localtime=Date.now().toString()}}const Qo=()=>{zs.initApaasTrackHook=n=>{n.executeEnterMainEvent=()=>{const e=Bt(n,"entermain");e.setProperties({groupid:n.groupid}),n.addLogByEvent(e)}},Ge.registerEvent("entermain",zs)},Vo=(n,e={})=>{Yt(e)||(e={});let s=n?n.split("?"):[];if(s.shift(),s.length>0){s=s.join("?").split("&");for(const r of s){const i=r.split("=");try{e[i[0]]=decodeURIComponent(i[1])}catch{e[i[0]]=i[1]}}}return e},Ie=(n,e)=>{let s="";switch(n){case"":case"text":case"json":if(Je(e))try{s=JSON.parse(e),s=ks(s,{maxDepth:10,keyMaxLen:1e4,pretty:!0,standardJSON:!0})}catch{s=Zs(String(e),1e4)}else Yt(e)||Et(e)?s=ks(e,{maxDepth:10,keyMaxLen:1e4,pretty:!0,standardJSON:!0}):typeof e<"u"&&(s=Object.prototype.toString.call(e));break;case"blob":case"document":case"arraybuffer":case"formdata":default:typeof e<"u"&&(s=Object.prototype.toString.call(e));break}return s},vr=n=>{if(!n)return null;let e=null;if(typeof n=="string")try{e=JSON.parse(n)}catch{const s=n.split("&");if(s.length===1)e=n;else{e={};for(let r of s){const i=r.split("=");e[i[0]]=i[1]===void 0?"undefined":i[1]}}}else if(ri(n))if(e={},Et(n)&&Qs(n[0]))e=n;else for(const[s,r]of n)e[s]=typeof r=="string"?r:"[object Object]";else ai(n)?e=n:e=`[object ${ii(n)}]`;return e},Fs=(n="")=>(n.startsWith("//")&&(n=`${new URL(window.location.href).protocol}${n}`),n.startsWith("http")?new URL(n):new URL(n,window.location.href));class br{constructor(){b(this,"id",""),b(this,"name",""),b(this,"method",""),b(this,"url",""),b(this,"status",0),b(this,"statusText",""),b(this,"cancelState",0),b(this,"readyState",0),b(this,"header",null),b(this,"responseType",""),b(this,"requestType","xhr"),b(this,"requestHeader",null),b(this,"response"),b(this,"responseSize",0),b(this,"responseSizeText",""),b(this,"startTime",0),b(this,"startTimeText",""),b(this,"endTime",0),b(this,"costTime",0),b(this,"getData",null),b(this,"postData",null),b(this,"postLength",0),b(this,"actived",!1),b(this,"noVConsole",!1),b(this,"_XMLReq",null),this.id=be()}}class Ko{constructor(e,s,r){b(this,"resp"),b(this,"item"),b(this,"onUpdateCallback"),this.resp=e,this.item=s,this.onUpdateCallback=r,this.mockReader()}set(e,s,r){return Reflect.set(e,s,r)}get(e,s){const r=Reflect.get(e,s);switch(s){case"arrayBuffer":case"blob":case"formData":case"json":case"text":return()=>(this.item.responseType=s.toLowerCase(),r.apply(e).then(i=>(this.item.response=Ie(this.item.responseType,i),this.onUpdateCallback(this.item),i)))}return typeof r=="function"?r.bind(e):r}mockReader(){let e;if(!this.resp.body||typeof this.resp.body.getReader!="function")return;const s=this.resp.body.getReader;this.resp.body.getReader=()=>{const r=s.apply(this.resp.body);if(this.item.readyState===4)return r;const i=r.read,a=r.cancel;return this.item.responseType="arraybuffer",r.read=()=>i.apply(r).then(u=>{if(!e)e=new Uint8Array(u.value);else{const l=new Uint8Array(e.length+u.value.length);l.set(e),l.set(u.value,e.length),e=l}return this.item.endTime=Date.now(),this.item.costTime=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.readyState=u.done?4:3,this.item.statusText=u.done?String(this.item.status):"Loading",this.item.responseSize=e.length,this.item.responseSizeText=je(this.item.responseSize),u.done&&(this.item.response=Ie(this.item.responseType,e)),this.onUpdateCallback(this.item),u}),r.cancel=(...u)=>(this.item.cancelState=2,this.item.statusText="Cancel",this.item.endTime=Date.now(),this.item.costTime=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.response=Ie(this.item.responseType,e),this.onUpdateCallback(this.item),a.apply(r,u)),r}}}class Zo{constructor(e){b(this,"onUpdateCallback"),this.onUpdateCallback=e}apply(e,s,r){const i=r[0],a=r[1],u=new br;return this.beforeFetch(u,i,a),e.apply(window,r).then(this.afterFetch(u)).catch(l=>{throw u.endTime=Date.now(),u.costTime=u.endTime-(u.startTime||u.endTime),this.onUpdateCallback(u),l})}beforeFetch(e,s,r){let i,a="GET",u=null;if(Je(s)?(a=(r==null?void 0:r.method)||"GET",i=Fs(s),u=(r==null?void 0:r.headers)||null):(a=s.method||"GET",i=Fs(s.url),u=s.headers),e.method=a,e.requestType="fetch",e.requestHeader=u,e.url=i.toString(),e.name=(i.pathname.split("/").pop()||"")+i.search,e.status=0,e.statusText="Pending",e.readyState=1,!e.startTime){e.startTime=Date.now();const l=Ws(e.startTime);e.startTimeText=`${l.year}-${l.month}-${l.day} ${l.hour}:${l.minute}:${l.second}.${l.millisecond}`}if(Object.prototype.toString.call(u)==="[object Headers]"){e.requestHeader={};for(const[l,w]of u)e.requestHeader[l]=w}else e.requestHeader=u;if(i.search&&i.searchParams){e.getData={};for(const[l,w]of i.searchParams)e.getData[l]=w}r!=null&&r.body&&(e.postData=vr(r.body)),this.onUpdateCallback(e)}afterFetch(e){return s=>{e.endTime=Date.now(),e.costTime=e.endTime-(e.startTime||e.endTime),e.status=s.status,e.statusText=String(s.status);let r=!1;e.header={};for(const[i,a]of s.headers)e.header[i]=a,r=a.toLowerCase().indexOf("chunked")>-1?!0:r;return r?e.readyState=3:(e.readyState=4,this.handleResponseBody(s.clone(),e).then(i=>{e.responseSize=typeof i=="string"?i.length:i.byteLength,e.responseSizeText=je(e.responseSize),e.response=Ie(e.responseType,i),this.onUpdateCallback(e)})),this.onUpdateCallback(e),new Proxy(s,new Ko(s,e,this.onUpdateCallback))}}handleResponseBody(e,s){const r=e.headers.get("content-type");return r&&r.includes("application/json")?(s.responseType="json",e.text()):r&&(r.includes("text/html")||r.includes("text/plain"))?(s.responseType="text",e.text()):(s.responseType="arraybuffer",e.arrayBuffer())}}class wr{static create(e){return new Proxy(window.fetch,new Zo(e))}}b(wr,"origFetch",window.fetch);class Yo{constructor(e,s){b(this,"XMLReq"),b(this,"item"),b(this,"onUpdateCallback"),this.XMLReq=e,this.XMLReq.onreadystatechange=()=>{this.onReadyStateChange()},this.XMLReq.onabort=()=>{this.onAbort()},this.XMLReq.ontimeout=()=>{this.onTimeout()},this.item=new br,this.item._XMLReq=e,this.item.requestType="xhr",this.onUpdateCallback=s}get(e,s){switch(s){case"_noVConsole":return this.item.noVConsole;case"open":return this.getOpen(e);case"send":return this.getSend(e);case"setRequestHeader":return this.getSetRequestHeader(e);default:const r=Reflect.get(e,s);return typeof r=="function"?r.bind(e):r}}set(e,s,r){switch(s){case"_noVConsole":return this.item.noVConsole=!!r,!1;case"onreadystatechange":return this.setOnReadyStateChange(e,s,r);case"onabort":return this.setOnAbort(e,s,r);case"ontimeout":return this.setOnTimeout(e,s,r)}return Reflect.set(e,s,r)}onReadyStateChange(){this.item.readyState=this.XMLReq.readyState,this.item.responseType=this.XMLReq.responseType,this.item.endTime=Date.now(),this.item.costTime=this.item.endTime-this.item.startTime,this.updateItemByReadyState(),this.item.response=Ie(this.item.responseType,this.item.response),this.triggerUpdate()}onAbort(){this.item.cancelState=1,this.item.statusText="Abort",this.triggerUpdate()}onTimeout(){this.item.cancelState=3,this.item.statusText="Timeout",this.triggerUpdate()}triggerUpdate(){this.item.noVConsole||this.onUpdateCallback(this.item)}getOpen(e){const s=Reflect.get(e,"open");return(...r)=>{const i=r[0],a=r[1];return this.item.method=i?i.toUpperCase():"GET",this.item.url=a||"",this.item.name=this.item.url.replace(new RegExp("[/]*$"),"").split("/").pop()||"",this.item.getData=Vo(this.item.url,{}),this.triggerUpdate(),s.apply(e,r)}}getSend(e){const s=Reflect.get(e,"send");return(...r)=>{const i=r[0];return i&&Object.prototype.hasOwnProperty.call(i,"length")&&(this.item.postLength=i.length),this.item.postData=vr(i),this.triggerUpdate(),s.apply(e,r)}}getSetRequestHeader(e){const s=Reflect.get(e,"setRequestHeader");return(...r)=>(this.item.requestHeader||(this.item.requestHeader={}),this.item.requestHeader[r[0]]=r[1],this.triggerUpdate(),s.apply(e,r))}setOnReadyStateChange(e,s,r){return Reflect.set(e,s,(...i)=>{this.onReadyStateChange(),r.apply(e,i)})}setOnAbort(e,s,r){return Reflect.set(e,s,(...i)=>{this.onAbort(),r.apply(e,i)})}setOnTimeout(e,s,r){return Reflect.set(e,s,(...i)=>{this.onTimeout(),r.apply(e,i)})}updateItemByReadyState(){switch(this.XMLReq.readyState){case 0:case 1:if(this.item.status=0,this.item.statusText="Pending",!this.item.startTime){this.item.startTime=Date.now();const r=Ws(this.item.startTime);this.item.startTimeText=`${r.year}-${r.month}-${r.day} ${r.hour}:${r.minute}:${r.second}.${r.millisecond}`}break;case 2:this.item.status=this.XMLReq.status,this.item.statusText="Loading",this.item.header={};const e=this.XMLReq.getAllResponseHeaders()||"",s=e.split(`
|
|
11
|
-
`);for(let r=0;r<s.length;r++){const i=s[r];if(!i)continue;const a=i.split(": "),u=a[0],l=a.slice(1).join(": ");this.item.header[u]=l}break;case 3:this.item.status=this.XMLReq.status,this.item.statusText="Loading",!!this.XMLReq.response&&this.XMLReq.response.length&&(this.item.responseSize=this.XMLReq.response.length,this.item.responseSizeText=je(this.item.responseSize));break;case 4:this.item.status=this.XMLReq.status||this.item.status||0,this.item.statusText=String(this.item.status),this.item.endTime=Date.now(),this.item.costTime=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.response=this.XMLReq.response,!!this.XMLReq.response&&this.XMLReq.response.length&&(this.item.responseSize=this.XMLReq.response.length,this.item.responseSizeText=je(this.item.responseSize));break;default:this.item.status=this.XMLReq.status,this.item.statusText="Unknown";break}}}class yr{static create(e){return new Proxy(XMLHttpRequest,{construct(s){const r=new s;return new Proxy(r,new Yo(r,e))}})}}b(yr,"origXMLHttpRequest",XMLHttpRequest);class an extends at{constructor(e){super(e,"http"),b(this,"url",""),b(this,"method",""),b(this,"startTime",0),b(this,"endTime",0),b(this,"requestContentLength",0),b(this,"responseContentLength",0),b(this,"statusCode",0),b(this,"headers",{}),b(this,"trackOptions",{trackHeaders:!0})}setTrackOptions(e){this.trackOptions=e}getProperties(){return{url:this.url,method:this.method,header:this.trackOptions.trackHeaders?this.headers:void 0,code:this.statusCode,duration:(this.endTime-this.startTime)*1e6,reqcontentlength:this.requestContentLength,respcontentlength:this.responseContentLength,start:this.startTime*1e6,end:this.endTime*1e6}}start(e,s,r,i){this.startTime=Date.now(),this.url=e,this.method=s,this.headers=i,this.requestContentLength=r}end(e,s){this.endTime=Date.now(),this.responseContentLength=e,this.statusCode=s}setProperties(e){this.url=e.url,this.method=e.method,this.startTime=e.startTime,this.endTime=e.endTime,this.requestContentLength=e.requestContentLength,this.responseContentLength=e.responseContentLength,this.statusCode=e.statusCode;let s=e.headers;s&&(s={...s,token:""}),this.headers=s}}const tc=(n,e)=>{const s=(r,i)=>{if(i.readyState===4&&i.url!==r.options.url){const a=new an(r);a.setTrackOptions(e),a.setProperties({url:i.url,method:i.method,startTime:i.startTime,endTime:i.endTime,requestContentLength:i.postLength,responseContentLength:i.responseSize,statusCode:i.status,headers:i.header||{}}),r.addLogByEvent(a)}};window.XMLHttpRequest=yr.create(r=>{s(n,r)}),window.fetch=wr.create(r=>{s(n,r)})},ec=n=>{n||(n={trackHeaders:!0}),an.eventOptions=n,an.startApaasTrackHook=e=>{tc(e,n)},Ge.registerEvent("http",an)},kt=(n,e=!1)=>{let s=location.href.replace(/#\/.+$/,n);return e&&(s=s.replace(/\?\S+$/,"")),s},kr=(n,e)=>{let s=history.pushState,r=history.replaceState,i=kt(location.hash),a=null;history.pushState=function(...u){const l=kt(location.hash),w=kt(u[2]||"");return i=w,n&&(a={newURL:w,oldURL:l,type:"push"},zn(()=>{a&&(e(a),a=null)})),s.apply(this,u)},history.replaceState=function(...u){if(n){const l=kt(location.hash),w=kt(u[2]||"");a={newURL:w,oldURL:l,type:"replace"},i=w,zn(()=>{if(a&&a.oldURL===l&&a.newURL===w){let p=kt(location.hash);l===w?w!==p?(a.newURL=p,a.type="push"):a.type="onload":a.type="replace",e(a),a=null}})}return r.apply(this,u)},window.addEventListener("popstate",u=>{if(n){const l=kt(location.hash);u.state&&(a={newURL:l,oldURL:i,type:u.state.forward?"back":"forward"},i=l,e(a),a=null)}})};var nc=function(n,e){e===!0&&(e=0);var s="";if(typeof n=="string")try{s=new URL(n).protocol}catch{}else n&&n.constructor===URL&&(s=n.protocol);var r=s.split(/\:|\+/).filter(Boolean);return typeof e=="number"?r[e]:r},sc=nc;function rc(n){var e={protocols:[],protocol:null,port:null,resource:"",host:"",user:"",password:"",pathname:"",hash:"",search:"",href:n,query:{},parse_failed:!1};try{var s=new URL(n);e.protocols=sc(s),e.protocol=e.protocols[0],e.port=s.port,e.resource=s.hostname,e.host=s.host,e.user=s.username||"",e.password=s.password||"",e.pathname=s.pathname,e.hash=s.hash.slice(1),e.search=s.search.slice(1),e.href=s.href,e.query=Object.fromEntries(s.searchParams)}catch{e.protocols=["file"],e.protocol=e.protocols[0],e.port="",e.resource="",e.user="",e.pathname="",e.hash="",e.search="",e.href=n,e.query={},e.parse_failed=!0}return e}var ic=rc;const ac="text/plain",oc="us-ascii",Hs=(n,e)=>e.some(s=>s instanceof RegExp?s.test(n):s===n),cc=(n,{stripHash:e})=>{const s=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(n);if(!s)throw new Error(`Invalid URL: ${n}`);let{type:r,data:i,hash:a}=s.groups;const u=r.split(";");a=e?"":a;let l=!1;u[u.length-1]==="base64"&&(u.pop(),l=!0);const w=(u.shift()||"").toLowerCase(),p=[...u.map(f=>{let[v,h=""]=f.split("=").map(_=>_.trim());return v==="charset"&&(h=h.toLowerCase(),h===oc)?"":`${v}${h?`=${h}`:""}`}).filter(Boolean)];return l&&p.push("base64"),(p.length>0||w&&w!==ac)&&p.unshift(w),`data:${p.join(";")},${l?i.trim():i}${a?`#${a}`:""}`};function uc(n,e){if(e={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...e},n=n.trim(),/^data:/i.test(n))return cc(n,e);if(/^view-source:/i.test(n))throw new Error("`view-source:` is not supported as it is a non-standard protocol");const s=n.startsWith("//");!s&&/^\.*\//.test(n)||(n=n.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));const r=new URL(n);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&r.protocol==="https:"&&(r.protocol="http:"),e.forceHttps&&r.protocol==="http:"&&(r.protocol="https:"),e.stripAuthentication&&(r.username="",r.password=""),e.stripHash?r.hash="":e.stripTextFragment&&(r.hash=r.hash.replace(/#?:~:text.*?$/i,"")),r.pathname){const a=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g;let u=0,l="";for(;;){const w=a.exec(r.pathname);if(!w)break;const p=w[0],f=w.index;l+=r.pathname.slice(u,f).replace(/\/{2,}/g,"/"),l+=p,u=f+p.length}l+=r.pathname.slice(u,r.pathname.length).replace(/\/{2,}/g,"/"),r.pathname=l}if(r.pathname)try{r.pathname=decodeURI(r.pathname)}catch{}if(e.removeDirectoryIndex===!0&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let a=r.pathname.split("/");const u=a[a.length-1];Hs(u,e.removeDirectoryIndex)&&(a=a.slice(0,-1),r.pathname=a.slice(1).join("/")+"/")}if(r.hostname&&(r.hostname=r.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(r.hostname)&&(r.hostname=r.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(const a of[...r.searchParams.keys()])Hs(a,e.removeQueryParameters)&&r.searchParams.delete(a);if(e.removeQueryParameters===!0&&(r.search=""),e.sortQueryParameters){r.searchParams.sort();try{r.search=decodeURIComponent(r.search)}catch{}}e.removeTrailingSlash&&(r.pathname=r.pathname.replace(/\/$/,""));const i=n;return n=r.toString(),!e.removeSingleSlash&&r.pathname==="/"&&!i.endsWith("/")&&r.hash===""&&(n=n.replace(/\/$/,"")),(e.removeTrailingSlash||r.pathname==="/")&&r.hash===""&&e.removeSingleSlash&&(n=n.replace(/\/$/,"")),s&&!e.normalizeProtocol&&(n=n.replace(/^http:\/\//,"//")),e.stripProtocol&&(n=n.replace(/^(?:https?:)?\/\//,"")),n}const $e=(n,e=!1)=>{const s=/^(?:([a-z_][a-z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:]([\~,\.\w,\-,\_,\/]+?(?:\.git|\/)?)$/,r=a=>{const u=new Error(a);throw u.subject_url=n,u};(typeof n!="string"||!n.trim())&&r("Invalid url."),n.length>$e.MAX_INPUT_LENGTH&&r("Input exceeds maximum length. If needed, change the value of parseUrl.MAX_INPUT_LENGTH."),e&&(typeof e!="object"&&(e={stripHash:!1}),n=uc(n,e));const i=ic(n);if(i.parse_failed){const a=i.href.match(s);a?(i.protocols=["ssh"],i.protocol="ssh",i.resource=a[2],i.host=a[2],i.user=a[1],i.pathname=`/${a[3]}`,i.parse_failed=!1):r("URL parsing failed.")}return i};$e.MAX_INPUT_LENGTH=2048;$e.MAX_INPUT_LENGTH=2048*1024;class _e extends at{constructor(e){super(e,"online"),b(this,"url",""),b(this,"duration",0),b(this,"startTime",0),b(this,"endTime",0),b(this,"views",[])}getProperties(){return{url:this.url,duration:this.duration,startTime:this.startTime,endTime:this.endTime}}setProperties(e){this.duration=e.duration,this.url=e.url,this.startTime=e.startTime,this.endTime=e.endTime,e.views&&(this.views=e.views)}}let Fe=null;const Is=(n,e)=>{const s=()=>!0;let r=typeof e=="object"&&e.collectUrl?e.collectUrl:s;return i=>{let a=$e(i.newURL),u=$e(i.oldURL),l=kt(`#${a.hash}`,!0);i.oldURL&&kt(`#${u.hash}`,!0),Fe&&(Fe.stop(),Fe.destroy(),Fe=null),r(location)&&(Fe=new hc(n,l))}};class hc{constructor(e,s,r){b(this,"url",""),b(this,"duration",0),b(this,"startTime",0),b(this,"onlineOptions"),b(this,"apaasTrack"),b(this,"visibleChangeHandler"),b(this,"beforeUnLoadHandler"),b(this,"userActionHandler"),b(this,"onlineTimer",null),b(this,"stopTimeout",null),this.url=s,this.apaasTrack=e,this.onlineOptions=r||{collectUrl:void 0},this.visibleChangeHandler=i=>{const a=i.target.visibilityState;this.stopUserActionMonitor(),a==="visible"?this.start():this.startUserActionMonitor()},this.beforeUnLoadHandler=i=>{if(this.apaasTrack){const a=Date.now()-this.startTime;this.saveOnlineData(a);const u=this.apaasTrack.getStorageData();if(u.onlineData)for(let l in u.onlineData){const w=u.onlineData[l],p=new _e(this.apaasTrack);p.setProperties({duration:w.duration,url:l,startTime:w.startTime,endTime:w.lastTime,views:w.views});const f=p.getEventLog();e.addToLegancyLog(f)}this.cleanOnlineData()}},this.userActionHandler=To(i=>{console.log("\u6709\u7528\u6237\u884C\u4E3A"),this.stopUserActionMonitor(),this.start(),this.startUserActionMonitor()},60*1e3,{leading:!0,trailing:!1}),_r(this.beforeUnLoadHandler),Jo(this.userActionHandler),this.init()}startUserActionMonitor(){console.log("startUserActionMonitor"),!this.stopTimeout&&(this.stopTimeout=window.setTimeout(()=>{this.onlineTimer&&(console.log("\u65E0\u6548\u64CD\u4F5C\u65F6\u957F\uFF0C\u7528\u6237\u5DF2\u4E0B\u7EBF..."),clearInterval(this.onlineTimer),this.onlineTimer=null,this.saveOnlineData(this.duration),this.sendRecord(!1,this.url))},1e3*60))}stopUserActionMonitor(){console.log("stopUserActionMonitor"),this.stopTimeout&&(clearTimeout(this.stopTimeout),this.stopTimeout=null)}init(){let e=this.apaasTrack.getStorageData();e||(this.apaasTrack.initStorageData(),e=this.apaasTrack.getStorageData()),e.onlineData?this.cleanOnlineData():e.onlineData={},localStorage.setItem("apaas-track",JSON.stringify(e)),document.addEventListener("visibilitychange",this.visibleChangeHandler),this.start();const s=window.document.createEvent("MouseEvent");this.userActionHandler(s)}saveOnlineData(e,s){const r=this.apaasTrack.getStorageData();let i=r.onlineData,a=i[this.url]||(i[this.url]={duration:0,lastTime:Date.now()});a.duration=e,a.lastTime=Date.now(),a.startTime=this.startTime,s&&(a.views||(a.views=[]),a.views.push({name:s.name,duration:s.duration})),r.onlineData[this.url]=a,localStorage.setItem("apaas-track",JSON.stringify(r))}getStorageOnlineData(){return this.apaasTrack.getStorageData().onlineData}cleanOnlineData(e){const s=this.apaasTrack.getStorageData();!s.onlineData||(e?delete s.onlineData[e]:s.onlineData={},localStorage.setItem("apaas-track",JSON.stringify(s)))}start(){if(this.onlineTimer)return;this.startTime=Date.now(),this.duration=0;let e=10*1e3;this.onlineTimer=window.setInterval(()=>{console.log("onlineTimer---"),this.duration+=e,this.saveOnlineData(this.duration)},e)}stop(){if(this.onlineTimer){clearInterval(this.onlineTimer),this.onlineTimer=null;const e=Date.now()-this.startTime;this.duration=e,this.saveOnlineData(e),this.sendRecord(!1,this.url)}}destroy(){this.stopUserActionMonitor(),document.removeEventListener("visibilitychange",this.visibleChangeHandler),this.beforeUnLoadHandler&&$o(this.beforeUnLoadHandler),this.userActionHandler&&Go(this.userActionHandler)}sendRecord(e=!1,s){const r=this.getStorageOnlineData();if(r)if(s){const i=r[s];if(i!=null&&i.duration){const a=new _e(this.apaasTrack);a.setProperties({duration:i.duration,url:s,startTime:i.startTime,endTime:i.lastTime,views:i.views}),this.apaasTrack.addLogByEvent(a),e&&this.apaasTrack.sendByBeacon()}this.cleanOnlineData(s)}else{for(let i in r){const a=r[i];if(a.duration){const u=new _e(this.apaasTrack);u.setProperties({duration:a.duration,url:i,startTime:a.startTime,endTime:a.lastTime,views:a.views}),this.apaasTrack.addLogByEvent(u),e&&this.apaasTrack.sendByBeacon()}}this.cleanOnlineData()}this.duration=0,this.startTime=0}}const lc=n=>{console.log("registerOnlineEvent"),n||(n={}),_e.eventOptions=n,_e.startApaasTrackHook=e=>{console.log("registerOnlineEvent startApaasTrackHook");let s=null;kr(e,a=>{console.log("online listenHistoryChange"),s||(s=Is(e)),s(a)});const r=()=>{i&&clearTimeout(i),s||(s=Is(e));const a={newURL:kt(location.hash),oldURL:kt(location.hash),type:"onload"};s(a),window.removeEventListener("load",r)};let i=null;window.self!==window.top&&(window.addEventListener("load",r),i=setTimeout(()=>{r(),clearTimeout(i)},3e3))},Ct.registerEvent("online",_e)};class Un extends at{constructor(e){super(e,"pageview",Xn.HIGH),b(this,"oldURL",""),b(this,"newURL",""),b(this,"entertype","")}getProperties(){return{from:this.oldURL,to:this.newURL,entertype:this.entertype}}setProperties(e){this.oldURL=e.oldURL,this.newURL=e.newURL,this.entertype=e.type}}const pc=(n,e)=>{const s=new Un(n);s.setProperties(e);const r=s.getEventLog();n.addLogToQueue(r,!0)},dc=()=>{Un.startApaasTrackHook=n=>{kr(n,e=>{pc(n,e)})},Ct.registerEvent("pageview",Un)};var qt,Ne,Tr,un,qn,Sr=-1,re=function(n){addEventListener("pageshow",function(e){e.persisted&&(Sr=e.timeStamp,n(e))},!0)},Zn=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},vn=function(){var n=Zn();return n&&n.activationStart||0},mt=function(n,e){var s=Zn(),r="navigate";return Sr>=0?r="back-forward-cache":s&&(r=document.prerendering||vn()>0?"prerender":document.wasDiscarded?"restore":s.type.replace(/_/g,"-")),{name:n,value:e===void 0?-1:e,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},ke=function(n,e,s){try{if(PerformanceObserver.supportedEntryTypes.includes(n)){var r=new PerformanceObserver(function(i){Promise.resolve().then(function(){e(i.getEntries())})});return r.observe(Object.assign({type:n,buffered:!0},s||{})),r}}catch{}},bn=function(n,e){var s=function r(i){i.type!=="pagehide"&&document.visibilityState!=="hidden"||(n(i),e&&(removeEventListener("visibilitychange",r,!0),removeEventListener("pagehide",r,!0)))};addEventListener("visibilitychange",s,!0),addEventListener("pagehide",s,!0)},ft=function(n,e,s,r){var i,a;return function(u){e.value>=0&&(u||r)&&((a=e.value-(i||0))||i===void 0)&&(i=e.value,e.delta=a,e.rating=function(l,w){return l>w[1]?"poor":l>w[0]?"needs-improvement":"good"}(e.value,s),n(e))}},Yn=function(n){requestAnimationFrame(function(){return requestAnimationFrame(function(){return n()})})},Te=function(n){document.prerendering?addEventListener("prerenderingchange",function(){return n()},!0):n()},fe=-1,Ns=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},hn=function(n){document.visibilityState==="hidden"&&fe>-1&&(fe=n.type==="visibilitychange"?n.timeStamp:0,mc())},js=function(){addEventListener("visibilitychange",hn,!0),addEventListener("prerenderingchange",hn,!0)},mc=function(){removeEventListener("visibilitychange",hn,!0),removeEventListener("prerenderingchange",hn,!0)},ts=function(){return fe<0&&(fe=Ns(),js(),re(function(){setTimeout(function(){fe=Ns(),js()},0)})),{get firstHiddenTime(){return fe}}},Pr=function(n,e){e=e||{},Te(function(){var s,r=[1800,3e3],i=ts(),a=mt("FCP"),u=ke("paint",function(l){l.forEach(function(w){w.name==="first-contentful-paint"&&(u.disconnect(),w.startTime<i.firstHiddenTime&&(a.value=Math.max(w.startTime-vn(),0),a.entries.push(w),s(!0)))})});u&&(s=ft(n,a,r,e.reportAllChanges),re(function(l){a=mt("FCP"),s=ft(n,a,r,e.reportAllChanges),Yn(function(){a.value=performance.now()-l.timeStamp,s(!0)})}))})},fc=function(n,e){e=e||{},Te(function(){var s,r=[.1,.25],i=mt("CLS"),a=-1,u=0,l=[],w=function(v){a>-1&&n(v)},p=function(v){v.forEach(function(h){if(!h.hadRecentInput){var _=l[0],y=l[l.length-1];u&&h.startTime-y.startTime<1e3&&h.startTime-_.startTime<5e3?(u+=h.value,l.push(h)):(u=h.value,l=[h]),u>i.value&&(i.value=u,i.entries=l,s())}})},f=ke("layout-shift",p);f&&(s=ft(w,i,r,e.reportAllChanges),Pr(function(v){a=v.value,i.value<0&&(i.value=0,s())}),bn(function(){p(f.takeRecords()),s(!0)}),re(function(){u=0,a=-1,i=mt("CLS",0),s=ft(w,i,r,e.reportAllChanges),Yn(function(){return s()})}))})},He={passive:!0,capture:!0},gc=new Date,Us=function(n,e){qt||(qt=e,Ne=n,Tr=new Date,Er(removeEventListener),Lr())},Lr=function(){if(Ne>=0&&Ne<Tr-gc){var n={entryType:"first-input",name:qt.type,target:qt.target,cancelable:qt.cancelable,startTime:qt.timeStamp,processingStart:qt.timeStamp+Ne};un.forEach(function(e){e(n)}),un=[]}},_c=function(n){if(n.cancelable){var e=(n.timeStamp>1e12?new Date:performance.now())-n.timeStamp;n.type=="pointerdown"?function(s,r){var i=function(){Us(s,r),u()},a=function(){u()},u=function(){removeEventListener("pointerup",i,He),removeEventListener("pointercancel",a,He)};addEventListener("pointerup",i,He),addEventListener("pointercancel",a,He)}(e,n):Us(e,n)}},Er=function(n){["mousedown","keydown","touchstart","pointerdown"].forEach(function(e){return n(e,_c,He)})},vc=function(n,e){e=e||{},Te(function(){var s,r=[100,300],i=ts(),a=mt("FID"),u=function(p){p.startTime<i.firstHiddenTime&&(a.value=p.processingStart-p.startTime,a.entries.push(p),s(!0))},l=function(p){p.forEach(u)},w=ke("first-input",l);s=ft(n,a,r,e.reportAllChanges),w&&bn(function(){l(w.takeRecords()),w.disconnect()},!0),w&&re(function(){var p;a=mt("FID"),s=ft(n,a,r,e.reportAllChanges),un=[],Ne=-1,qt=null,Er(addEventListener),p=u,un.push(p),Lr()})})},xr=0,Mn=1/0,sn=0,bc=function(n){n.forEach(function(e){e.interactionId&&(Mn=Math.min(Mn,e.interactionId),sn=Math.max(sn,e.interactionId),xr=sn?(sn-Mn)/7+1:0)})},Br=function(){return qn?xr:performance.interactionCount||0},wc=function(){"interactionCount"in performance||qn||(qn=ke("event",bc,{type:"event",buffered:!0,durationThreshold:0}))},Cr=0,qs=function(){return Br()-Cr},xt=[],Rn={},$s=function(n){var e=xt[xt.length-1],s=Rn[n.interactionId];if(s||xt.length<10||n.duration>e.latency){if(s)s.entries.push(n),s.latency=Math.max(s.latency,n.duration);else{var r={id:n.interactionId,latency:n.duration,entries:[n]};Rn[r.id]=r,xt.push(r)}xt.sort(function(i,a){return a.latency-i.latency}),xt.splice(10).forEach(function(i){delete Rn[i.id]})}},yc=function(n,e){e=e||{},Te(function(){var s=[200,500];wc();var r,i=mt("INP"),a=function(l){l.forEach(function(f){f.interactionId&&$s(f),f.entryType==="first-input"&&!xt.some(function(v){return v.entries.some(function(h){return f.duration===h.duration&&f.startTime===h.startTime})})&&$s(f)});var w,p=(w=Math.min(xt.length-1,Math.floor(qs()/50)),xt[w]);p&&p.latency!==i.value&&(i.value=p.latency,i.entries=p.entries,r())},u=ke("event",a,{durationThreshold:e.durationThreshold||40});r=ft(n,i,s,e.reportAllChanges),u&&(u.observe({type:"first-input",buffered:!0}),bn(function(){a(u.takeRecords()),i.value<0&&qs()>0&&(i.value=0,i.entries=[]),r(!0)}),re(function(){xt=[],Cr=Br(),i=mt("INP"),r=ft(n,i,s,e.reportAllChanges)}))})},Dn={},kc=function(n,e){e=e||{},Te(function(){var s,r=[2500,4e3],i=ts(),a=mt("LCP"),u=function(p){var f=p[p.length-1];if(f){var v=Math.max(f.startTime-vn(),0);v<i.firstHiddenTime&&(a.value=v,a.entries=[f],s())}},l=ke("largest-contentful-paint",u);if(l){s=ft(n,a,r,e.reportAllChanges);var w=function(){Dn[a.id]||(u(l.takeRecords()),l.disconnect(),Dn[a.id]=!0,s(!0))};["keydown","click"].forEach(function(p){addEventListener(p,w,{once:!0,capture:!0})}),bn(w,!0),re(function(p){a=mt("LCP"),s=ft(n,a,r,e.reportAllChanges),Yn(function(){a.value=performance.now()-p.timeStamp,Dn[a.id]=!0,s(!0)})})}})},Tc=function n(e){document.prerendering?Te(function(){return n(e)}):document.readyState!=="complete"?addEventListener("load",function(){return n(e)},!0):setTimeout(e,0)},Sc=function(n,e){e=e||{};var s=[800,1800],r=mt("TTFB"),i=ft(n,r,s,e.reportAllChanges);Tc(function(){var a=Zn();if(a){var u=a.responseStart;if(u<=0||u>performance.now())return;r.value=Math.max(u-vn(),0),r.entries=[a],i(!0),re(function(){r=mt("TTFB",0),(i=ft(n,r,s,e.reportAllChanges))(!0)})}})};class $n extends at{constructor(e){super(e,"performance"),b(this,"performanceData",null)}getProperties(){return{...this.performanceData}}setProperties(e){this.performanceData=e}track(){return new Promise((e,s)=>{let r={cls:null,lcp:null,ttfb:null,fcp:null,fid:null,inp:null};setTimeout(()=>{const a=performance.timing,u={...r,connectEnd:a.connectEnd,connectStart:a.connectStart,domComplete:a.domComplete,domContentLoadedEventEnd:a.domContentLoadedEventEnd,domContentLoadedEventStart:a.domContentLoadedEventStart,domInteractive:a.domInteractive,domLoading:a.domLoading,domainLookupEnd:a.domainLookupEnd,domainLookupStart:a.domainLookupStart,fetchStart:a.fetchStart,loadEventEnd:a.loadEventEnd,loadEventStart:a.loadEventStart,navigationStart:a.navigationStart,redirectEnd:a.redirectEnd,redirectStart:a.redirectStart,requestStart:a.requestStart,responseEnd:a.responseEnd,responseStart:a.responseStart,secureConnectionStart:a.secureConnectionStart,unloadEventEnd:a.unloadEventEnd,unloadEventStart:a.unloadEventStart};this.setProperties(u),e(u)},1e4),kc(a=>{i(a)}),fc(a=>{i(a)}),Sc(a=>{i(a)}),Pr(a=>{i(a)}),vc(a=>{i(a)}),yc(a=>{i(a)});const i=a=>{a.name==="FID"?r.fid=a.value:a.name==="CLS"?r.cls=a.value:a.name==="FCP"?r.fcp=a.value:a.name==="TTFB"?r.ttfb=a.value:a.name==="LCP"?r.lcp=a.value:a.name==="INP"&&(r.inp=a.value)}})}}const Pc=async n=>{const e=new $n(n);await e.track(),n.addLogByEvent(e)},Lc=()=>{$n.startApaasTrackHook=n=>{Pc(n)},Ct.registerEvent("performance",$n)};class Js extends at{constructor(e){super(e,"throw"),b(this,"message",""),b(this,"detailmessage",""),b(this,"name",""),b(this,"stack",[]),b(this,"cause",{})}getProperties(){return{message:this.message,detailmessage:this.detailmessage,name:this.name,stack:this.stack,cause:this.cause}}setError(e){const s=Gn(e);this.message=s.message,this.detailmessage=s.detail,this.name=s.name,this.stack=s.stack}}const Ec=n=>{window.addEventListener("error",e=>{const s=Bt(n,"throw");s.setError(e.error),n.addLogByEvent(s)}),window.addEventListener("unhandledrejection",e=>{const s=Bt(n,"throw");s.setError(e.reason),n.addLogByEvent(s)})},xc=()=>{Js.startApaasTrackHook=n=>{Ec(n)},Ct.registerEvent("throw",Js)},Bc=()=>{Lc(),xc(),Qo()},Cc=n=>{Bc(),dc(),Wo(),(n==null?void 0:n.http)!==!1&&ec(),n!=null&&n.click&&qo(typeof n.click=="object"?n.click:void 0),n!=null&&n.online&&lc(typeof n.online=="object"?n.online:void 0)},Mc=n=>(Cc(n),Rc(n)),Rc=n=>new Ct(n);class te{constructor(e,s,r){b(this,"_level",0),this.apaasTrack=e,this.type=s,r&&(this._level=r)}getProperties(){return{}}setProperties(e){}getEventLog(e){const s=e||Date.now();return{...this.apaasTrack.baseLog,types:this.type,logtime:String(s),epochnanos:String(s)+"000000",event:this.type,properties:this.getProperties(),url:we()}}}b(te,"eventOptions"),b(te,"initApaasTrackHook"),b(te,"startApaasTrackHook"),b(te,"destroyApaasTrackHook");class Dc extends te{constructor(e){super(e,"init")}getProperties(){const e=this.apaasTrack.baseLog;return{system:e.system||"",systemver:e.systemver||"",manufacturer:e.manufacturer||"",browser:e.browser||"",browserver:e.browserver||"",terminalid:e.terminalid||"",client:e.client||"",clientver:e.clientver||""}}}class Ac extends te{constructor(e){super(e,"custom"),b(this,"info",{})}setCustomType(e){this.type=e}getProperties(){return{...this.info}}setProperties(e){this.info=e}}const ve={init:Dc,custom:Ac},on=(n,e)=>{const s=ve[e];return new s(n)},Oc=(n,e,s)=>{const r=s||Date.now(),i=on(n,e);return{...n.baseLog,types:e,logtime:String(r),epochnanos:String(r)+"000000",event:e,properties:i.getProperties(),url:we()}},Gs=(n,e,s)=>{const r=s||Date.now();return{...n.baseLog,types:e.type,logtime:String(r),epochnanos:String(r)+"000000",event:e.type,properties:e.getProperties(),url:we()}},Mr=(n,e)=>{if(ve[n])throw Error(`\u8BE5\u4E8B\u4EF6${n} \u5DF2\u5B58\u5728\uFF0C\u6CE8\u518C\u5931\u8D25`);ve[n]=e};class zc{constructor(e,s){b(this,"name",""),b(this,"time",0),b(this,"info",{}),e&&(this.name=e),s&&(this.info=s),this.time=Date.now()}get epochnanos(){return this.time*1e6}get attributes(){return this.getAttributes()}getAttributes(){return{}}getJson(){return{name:this.name,epochnanos:this.time*1e6,attributes:this.getAttributes(),...this.info}}setInfo(e){this.info=e||{}}}class Fc extends zc{constructor(){super(...arguments),b(this,"name","exception"),b(this,"exceptionType",""),b(this,"exceptionMessage",""),b(this,"exceptionStackTrace","")}getAttributes(){return{"exception.type":this.exceptionType,"exception.message":this.exceptionMessage,"exception.stacktrace":this.exceptionStackTrace}}setInfo(e){this.exceptionMessage=e.exceptionMessage,this.exceptionType=e.exceptionType,this.exceptionStackTrace=e.exceptionStackTrace}}class es extends te{constructor(e,s,r){super(e,"span"),b(this,"spanid",""),b(this,"traceid",""),b(this,"parentspanid",""),b(this,"name",""),b(this,"attributes",{}),b(this,"events",[]),b(this,"statuscode","OK"),b(this,"statusmessage",""),b(this,"startTime",0),b(this,"endTime",0),this.name=s,this.traceid=be(),this.spanid=Xs(),this.parentspanid=r||"",this.start()}trackLog(){this.apaasTrack.addLogByEvent(this)}createSpanEvent(e,s){return new es(this.apaasTrack,e,s)}setAttribute(e){const s=e.getAttributes();this.attributes=s}addEvent(e){this.events.push(e)}exception(e){const s=new Fc;let r="",i="",a="";if(e instanceof Error){const u=Gn(e);r=u.detail,i=u.name,a=u.stack.join(",")}else r=e.exceptionMessage,i=e.exceptionType,a=e.exceptionStackTrace;s.setInfo({exceptionMessage:r,exceptionType:i,exceptionStackTrace:a}),this.events.push(s)}start(){this.startTime=Date.now()}end(e,s){e&&(this.statusmessage=e),s&&(this.statuscode=s),this.endTime=Date.now()}getProperties(){return{traceid:this.traceid,spanid:this.spanid,parentspanid:this.parentspanid,name:this.name,attributes:this.attributes,events:this.events.map(e=>e.getJson()),statuscode:this.statuscode,statusmessage:this.statusmessage,startepochnanos:this.startTime*1e6,endepochnanos:this.endTime*1e6,duration:(this.endTime-this.startTime)*1e6}}}class Rr{constructor(e){b(this,"_version",rn),b(this,"commonLog",null),b(this,"browserLog",null),b(this,"options"),this.options=e,typeof window<"u"&&(window.__apaasTrackVersion__=rn),typeof wx<"u"&&!window&&(wx.__apaasTrackVersion__=rn),e.commonLog&&this.initCommonLog(e.commonLog),this.runEventInitHooks()}registerEvent(e,s){Mr(e,s),s.initApaasTrackHook&&s.initApaasTrackHook(this),s.startApaasTrackHook&&s.startApaasTrackHook(this)}get groupid(){var e;return(e=this.browserLog)==null?void 0:e.distinctid}runEventInitHooks(){Object.values(ve).forEach(e=>{e.initApaasTrackHook&&e.initApaasTrackHook(this)})}runEventStartHooks(){Object.values(ve).forEach(e=>{e.startApaasTrackHook&&e.startApaasTrackHook(this)})}runEventDestroyHooks(){Object.values(ve).forEach(e=>{e.destroyApaasTrackHook&&e.destroyApaasTrackHook(this)})}get anonymousid(){var e;return(e=this.browserLog)==null?void 0:e.anonymousid}get distinctid(){var e;return(e=this.browserLog)==null?void 0:e.distinctid}get baseLog(){return{...this.browserLog,...this.commonLog}}initCommonLog(e){this.commonLog=e}createEventLog(e,s){return Oc(this,e,s)}addLogByType(e,s){const r=this.createEventLog(e,s);this.addLogToQueue(r)}addLogByEvent(e,s){const r=Gs(this,e,s);this.addLogToQueue(r)}createCustomEvent(e){const s=on(this,"custom");return s.setCustomType(e),s}createSpanEvent(e,s){return new es(this,e,s)}addLogByCustomEvent(e,s={},r){const i=this.createCustomEvent(e);i.setProperties(s);const a=Gs(this,i,r);this.addLogToQueue(a)}executeInitEvent(){const e=on(this,"init");e.setProperties({groupid:this.groupid}),this.addLogByEvent(e)}updateCommonLog(e){this.commonLog={...this.commonLog,...e}}trackEvent(e,s={},r){const i=on(this,e);i.setProperties(s),this.addLogByEvent(i,r)}start(...e){this.executeInitEvent(),this.runEventStartHooks()}destroy(){this.runEventDestroyHooks()}transformLog(e){return e}async addLogToQueue(e,s=!1,r=!0){r&&(e=this.transformLog(e)),await this.sendLog(e,s)}}b(Rr,"registerEvent",Mr);const Dr=async n=>{var i;let e=await n.getWebInitParams();const s=location.origin+"/static/apaas-track/apaas-spu/lzma_worker.js";console.log("createApaasTrack lzma_worker",s),xi(s);const r=Mc({url:n.url||"",click:{trackElementPath:!0},commonLog:{client:"Web",...e},online:(n==null?void 0:n.online)||!1,pageview:!0,http:!0,zip:n.zip!==void 0?n.zip:!0,useIndexDB:(i=n==null?void 0:n.useIndexDB)!=null?i:!1});return r.sendLog=n.sendLog,r.start=function(...a){return Rr.prototype.start.call(this,...a)},n.sendLog===ns&&(r.start=function(...a){return Ct.prototype.start.call(this,...a)}),n.startFn&&(r.start=n.startFn),r};let An=null;const Hc=async n=>{var s,r;if(An)return An;const e=await Dr({url:(n==null?void 0:n.url)||"",sendLog:(n==null?void 0:n.sendLog)||ns,startFn:(n==null?void 0:n.startFn)||null,online:(n==null?void 0:n.online)||!1,getWebInitParams:(n==null?void 0:n.getWebInitParams)||Ar,zip:(s=n==null?void 0:n.zip)!=null?s:!0,useIndexDB:(r=n==null?void 0:n.useIndexDB)!=null?r:!1});return An=e,e},Ar=()=>new Promise((n,e)=>{if(window.aPaaS&&window.aPaaS.getWebInitParams){const s=window.aPaaS.getWebInitParams(r=>{n(r)});s&&s.then&&s.then(r=>{n(r)})}else{window.parent.postMessage({type:"getWebInitParams"},"*");const s=i=>{const a=(i==null?void 0:i.data)||{};if(a.type==="receiveWebInitParams")if(a.data){const u=a.data;n(u),r&&(clearTimeout(r),r=null),window.removeEventListener("message",s)}else e(Error("receiveWebInitParams response null"))};window.addEventListener("message",s);let r=window.setTimeout(()=>{e(Error("postMessage getWebInitParams timeout"))},2e3)}});function Ic(...n){return Ct.prototype.start.call(this,n)}function ns(n,e){var s;return(s=window.aPaaS)!=null&&s.sendLog?window.aPaaS.sendLog(n,e):Ct.prototype.sendLog.call(this,n,e)}exports.BaseEvent=at;exports.BaseSpanAttribute=_i;exports.BaseTrack=Ge;exports.CustomEvent=er;exports.EventLevel=Xn;exports.EventMap=ee;exports.ExceptionSpanEvent=rr;exports.InitEvent=tr;exports.SpanEvent=ln;exports.SpanPropertyEvent=sr;exports.TaskQueue=Ys;exports.createApaasTrack=Dr;exports.createEvent=Bt;exports.defaultGetWebInitParams=Ar;exports.defaultWebSendFunction=ns;exports.defaultWebStartFunction=Ic;exports.getApaasSpuTrack=Hc;exports.getEventLog=Fn;exports.getEventLogByType=nr;exports.registerEvent=Wn;
|
|
10
|
+
version: `+p),i()},u.onupgradeneeded=_=>{this.openStatus="upgradeneeded";const p=mn(_,"target.result");p?(s&&s(p),console.log("[indexDB\u521D\u59CB\u5316] onupgradeneeded name: "+this.dbName)):console.error("[indexDB\u521D\u59CB\u5316\u5931\u8D25] onupgradeneeded name: "+this.dbName)},u.onerror=_=>{clearTimeout(h),console.error("[indexDB\u521D\u59CB\u5316\u5931\u8D25] name: "+this.dbName,_),i()}})}async upgradeneeded(e){try{this.init(this.version+1,function(s){let n=e.length;for(;n--;)e[n](s)}),await this.initPromise}catch(s){console.error("[DBManager.upgradeneeded\u5931\u8D25]",s)}}}const Br=new Do;class Oo{constructor(e="logs"){y(this,"logs",[]),y(this,"thisSize",0),y(this,"dbLength",0),y(this,"dbName","apaas-track"),y(this,"storeName","logs"),y(this,"maxSize",1024*1024),this.storeName=e}get length(){return this.dbLength+this.logs.length}async init(){let e=[];const s=await(await Br.get(this.dbName)).transaction(this.storeName,"readonly");s&&(e=await s(this.storeName).getAllKeys()),this.dbLength=e.length}async push(e){try{const s=JSON.stringify(e).length;this.thisSize+s>=this.maxSize?(await this.save(),this.logs.push(e),this.thisSize=s,s>=this.maxSize&&await this.save()):(this.logs.push(e),this.thisSize+=JSON.stringify(e).length)}catch(s){console.error(s)}}async compulsionSave(){this.logs.length!==0&&await this.save()}clearArray(){this.logs.length=0,this.thisSize=0}async save(){try{const e=this.logs;if(e.length===0)return;const s=await(await Br.get(this.dbName)).transaction(this.storeName,"readwrite");s&&(await s(this.storeName).add(e,Date.now()),this.dbLength++,this.clearArray())}catch(e){console.error(e)}}async shift(e=1){let s=[];if(this.dbLength!==0&&(s=await this.shiftDB(e)),e-s.length>0&&this.logs.length>0){let n=[...this.logs];this.clearArray(),s.push(n)}return s}async shiftDB(e){try{let s=[];const n=await(await Br.get(this.dbName)).transaction(this.storeName,"readwrite");if(n){const i=n(this.storeName);let a=await i.getAllKeys();if(a.length===0)return[];const u=this.getRange(e,a),h=[];u.forEach(p=>{h.push(i.get(p))}),s=await Promise.all(h);const _=[];u.forEach(p=>{_.push(i.delete(p))}),await Promise.all(_),a=await i.getAllKeys(),this.dbLength=a.length}return s}catch(s){return console.error(s),[]}}getRange(e,s){const n=[];for(let i=0;i<e&&i<s.length;i++)n.push(s[i]);return n}}async function zo(r){const e=new Oo(r);return await e.init(),e}class Fo{constructor(){y(this,"logsDB"),y(this,"initPromise"),this.initPromise=this.init()}async init(){return this.logsDB=await zo(),this.logsDB}get length(){var e,s;return(s=(e=this.logsDB)==null?void 0:e.length)!=null?s:0}getLogs(){var e;return((e=this.logsDB)==null?void 0:e.logs)||[]}async cacheLog(e){var s;await this.initPromise,await((s=this.logsDB)==null?void 0:s.push(e))}async send(e){var s;await this.initPromise;const n=await((s=this.logsDB)==null?void 0:s.shift(5));n!=null&&n.length&&e(gn(n))}async sendByBeacon(e){var s;await this.initPromise,await((s=this.logsDB)==null?void 0:s.compulsionSave())}}class Ct extends Ge{constructor(e){super(e),y(this,"options"),y(this,"logsSender"),y(this,"nextTickLogs",[]),y(this,"isStart",!1),y(this,"listenPostMessageHandler"),this.options=e,this.initStorageData(),this.initBrowserLog(),e.commonLog&&this.initCommonLog(e.commonLog),console.log("this.options.useIndexDB",this.options.useIndexDB),this.options.useIndexDB?this.logsSender=new Fo:this.logsSender=new So}initStorageData(){const e=JSON.parse(localStorage.getItem("apaas-track")||"{}");e.anonymousid||(e.anonymousid=we()),e.logs||(e.logs=[]),e.distinctid=we(),localStorage.setItem("apaas-track",JSON.stringify(e))}getStorageData(){return JSON.parse(localStorage.getItem("apaas-track")||"{}")}updateStorageData(e){localStorage.setItem("apaas-track",JSON.stringify(e))}get anonymousid(){var e;return((e=this.browserLog)==null?void 0:e.anonymousid)||this.getStorageData().anonymousid}get distinctid(){var e;return((e=this.browserLog)==null?void 0:e.distinctid)||this.getStorageData().distinctid}initBrowserLog(){const e=new Fr.exports.UAParser;e.setUA(navigator.userAgent);const s=e.getResult(),n=s.os.version||"",i=s.os.name||"",a=s.browser.name||"",u=s.browser.version||"",h=navigator.vendor,_=nn.exports(`${i}${n}${h}${a}${u}`),p=location.href;this.browserLog={system:i,systemver:n,manufacturer:h,browser:a,browserver:u,terminalid:_,anonymousid:this.anonymousid,distinctid:this.distinctid,url:p,logsdkver:nr}}start(...e){if(this.isStart)return;let s=0,n=60*5*1e3,i=null,a=window.setInterval(()=>{u()},this.options.timer||1e4);setTimeout(()=>{u()},2e3);const u=()=>{this.send().then(()=>{s&&(s=0),i&&(clearInterval(i),i=null),a||(a=window.setInterval(()=>{u()},this.options.timer||1e4))}).catch(h=>{console.error("track send error",h),s++,s>=5&&(a&&clearInterval(a),a=null,i||(i=window.setInterval(()=>{u()},n)))})};super.start(),this.sendLegancyLogs(),this.isStart=!0,this.listenPostMessage()}getLegancyLogs(){return this.getStorageData().logs||[]}clearLegancyLogs(){const e=this.getStorageData();delete e.logs,this.updateStorageData(e)}sendLegancyLogs(){this.getLegancyLogs().forEach(e=>{this.addLogToQueue(e,!1,!1)}),this.clearLegancyLogs()}addToLegancyLog(e){e=this.transformLog(e);const s=[...this.getLegancyLogs()||[],e],n=this.getStorageData();n.logs=s,this.updateStorageData(n)}listenPostMessage(){this.listenPostMessageHandler=e=>{var s;const n=(e==null?void 0:e.data)||{};if(n.type==="getWebCommonParams"){const i=Array.from(document.querySelectorAll("iframe"));for(let a of i)(s=a==null?void 0:a.contentWindow)==null||s.postMessage({type:"receiveWebCommonParams",data:{url:this.options.url,timer:this.options.timer||1e4,zip:this.options.zip,commonLog:this.commonLog}},"*")}else if(n.type==="sendApaasLog"){const i=n.data,{log:a,isImmediate:u}=i;this.sendLog(a,u)}},window.addEventListener("message",this.listenPostMessageHandler)}divideLogsSend(e){return this.options.useIndexDB?or(this.options.url,e,this.getZip()):Ho(e,{url:this.options.url,zip:this.getZip(),maxSize:this.getMaxSize()})}async sendByNextTick(e){if(this.nextTickLogs.push(e),await Or(),!this.nextTickLogs.length)return;const s=JSON.parse(JSON.stringify(this.nextTickLogs));this.divideLogsSend(this.nextTickLogs).catch(n=>{this.nextTickLogs=[...s,this.nextTickLogs]}),this.nextTickLogs.length=0}async send(){if(this.logsSender.length)try{await this.logsSender.send(this.divideLogsSend.bind(this))}catch{}}async sendLog(e,s=!1){try{e=JSON.parse(JSON.stringify(e))}catch{}s?this.sendByNextTick(e):await this.logsSender.cacheLog(e)}getZip(){return this.options.zip!==void 0?this.options.zip:!0}getMaxSize(){const e=this.options.zip!==void 0?this.options.zip:!0;return 1024*1024/(e?2:1)}async sendByBeacon(e){const s=async n=>Bi(`${this.options.url}`,n,e!==void 0?e:this.getZip());this.logsSender.length&&await this.logsSender.sendByBeacon(s.bind(this))}}function Ho(r,e){const{url:s,zip:n,maxSize:i}=e;if(JSON.stringify(r).length<=i||r.length===1)return or(s,r,n);{const a=di(r,i),u=[];return a.forEach(h=>{u.push(or(s,h,n))}),Promise.all(u)}}class me extends at{constructor(e){super(e,"click"),y(this,"paths",""),y(this,"customProperties",{}),y(this,"name","")}getProperties(){return{name:this.name,paths:this.paths,customProperties:this.customProperties}}setProperties(e){e.paths&&(this.paths=e.paths),e.name&&(this.name=e.name),this.customProperties=e.customProperties}}const Io=r=>!r||r===document||r.tagName==="HTML"||!r.hasAttribute?!1:r.hasAttribute("apaas-track-click")&&r.getAttribute("apaas-track-click")!=="false",Ds=r=>{r.target;const e=r.composedPath();if(!e.length)return!1;for(let s=0;s<e.length;s++){const n=e[s];if(n===window)return!1;if(Io(n))return n}return!1},Nr=r=>{const e=r.tagName,s=r.id,n=r.className,i=(h,_,p)=>`${h}${_?"#"+_:""}${p?"."+p:""}`;let a=i(e,s,n)+" > ",u=r.parentElement;for(;u;){const h=u.tagName,_=u.id,p=u.className;a+=i(h,_,p)+" > ",u=u.parentElement}return a=a.replace(/\s>\s$/,""),a&&(a=a.split(" > ").reverse().join(" > ")),a},No=(r,e)=>{const s=(n,i)=>n===i;if(r===document)return!0;{const n=e.target;if(s(r,n))return!0;let i=n.parentElement;if(!i)return!1;for(;i;){if(s(r,i))return!0;i=i.parentElement}return!1}},jo=(r,e)=>{const s=()=>!0,n=a=>Ds(a),i=a=>{a.target;const u=(e==null?void 0:e.collectSelectors)||[];if(!u.length)return null;let h=[];for(let p=0;p<u.length;p++){const{selector:f,name:w}=u[p],l=document.querySelectorAll(f);!l||!l.length||l.forEach(v=>{h.push({name:w,selector:f,element:v})})}if(!h.length)return null;let _=[];for(let p=0;p<h.length;p++){const{element:f,name:w,selector:l}=h[p];f&&No(f,a)&&_.push({name:w,selector:l,element:f})}return _};e&&document.addEventListener("click",a=>{if(!((e==null?void 0:e.collectUrl)||s)(location))return;const u=((e==null?void 0:e.collectElement)||n)(a),h=i(a);if(!u&&(!h||!h.length))return;const _=Ds(a);if(_){let p={};const f=(e==null?void 0:e.customProperty)||[],w=_.attributes;let l="";const v=w.getNamedItem("apaas-track-click");if(v&&v.nodeName==="apaas-track-click"){const T=v.nodeValue;T&&T!=="false"&&T!=="true"&&(l=T)}for(let T of w){let R=T.nodeName;const tt=T.nodeValue;R.startsWith("data-apaastrack-")?p[R.replace("data-apaastrack-","")]=tt||"":f.length&&f.forEach(M=>{if(R===M){const C=R.replace(/-[A-Za-z]/,V=>V[1].toUpperCase());p[C]=tt||""}})}let b="";e!=null&&e.trackElementPath&&(b=Nr(_));const k=new me(r);k.setProperties({name:p.name||l,paths:b,customProperties:p}),r.addLogByEvent(k)}if(h&&h.length)for(let p of h){let f="";e!=null&&e.trackElementPath&&(f=Nr(p.element));const w=new me(r);w.setProperties({name:p.name,paths:f,customProperties:{selector:p.selector,name:p.name}}),r.addLogByEvent(w)}},!0)},Uo=(r,e,s,n)=>{const i={paths:"",customProperties:{}};"customProperties"in e?i.customProperties=e.customProperties:i.customProperties=e;const a=Bt(r,"click");let u=e.paths||"";n&&!u&&(s==null?void 0:s.trackElementPath)&&(u=Nr(n.target),i.paths=u),a.setProperties(i),r.addLogByEvent(a)},qo=r=>{r||(r={}),me.eventOptions=r,me.initApaasTrackHook=e=>{e.executeClickEvent=(s,n)=>{Uo(e,s,r,n)}},me.startApaasTrackHook=e=>{jo(e,r)},Ct.registerEvent("click",me)},ge=[],vn=r=>{ge.length||window.addEventListener("pagehide",(...e)=>{ge.forEach(s=>{s(...e)})}),ge.push(r)},$o=r=>{for(let e=0;e<ge.length;e++){const s=ge[e];r===s&&ge.splice(e,1)}},Ot=[],Jo=r=>{Ot.length||(document.addEventListener("click",(...e)=>{Ot.forEach(s=>{s(...e)})}),document.addEventListener("mouseover",(...e)=>{Ot.forEach(s=>{s(...e)})}),document.addEventListener("scroll",(...e)=>{Ot.forEach(s=>{s(...e)})}),document.addEventListener("keydown",(...e)=>{Ot.forEach(s=>{s(...e)})})),Ot.push(r)},Go=r=>{for(let e=0;e<Ot.length;e++){const s=Ot[e];r===s&&Ot.splice(e,1)}};class As extends at{constructor(e){super(e,"close")}}const Xo=r=>{vn(e=>{if(r){r.sendByBeacon();const s=Bt(r,"close").getEventLog();r.addToLegancyLog(s)}})},Wo=()=>{As.startApaasTrackHook=r=>{Xo(r)},Ct.registerEvent("close",As)};class Os extends at{constructor(e){super(e,"entermain"),y(this,"groupid",""),y(this,"localtime",""),y(this,"cheatinfo",{})}getProperties(){return{groupid:this.groupid,localtime:this.localtime,cheatinfo:this.cheatinfo}}setProperties(e){this.groupid=e.groupid,this.localtime=Date.now().toString()}}const Qo=()=>{Os.initApaasTrackHook=r=>{r.executeEnterMainEvent=()=>{const e=Bt(r,"entermain");e.setProperties({groupid:r.groupid}),r.addLogByEvent(e)}},Ge.registerEvent("entermain",Os)},Vo=(r,e={})=>{Yt(e)||(e={});let s=r?r.split("?"):[];if(s.shift(),s.length>0){s=s.join("?").split("&");for(const n of s){const i=n.split("=");try{e[i[0]]=decodeURIComponent(i[1])}catch{e[i[0]]=i[1]}}}return e},Ie=(r,e)=>{let s="";switch(r){case"":case"text":case"json":if(Je(e))try{s=JSON.parse(e),s=bs(s,{maxDepth:10,keyMaxLen:1e4,pretty:!0,standardJSON:!0})}catch{s=Ks(String(e),1e4)}else Yt(e)||Et(e)?s=bs(e,{maxDepth:10,keyMaxLen:1e4,pretty:!0,standardJSON:!0}):typeof e<"u"&&(s=Object.prototype.toString.call(e));break;case"blob":case"document":case"arraybuffer":case"formdata":default:typeof e<"u"&&(s=Object.prototype.toString.call(e));break}return s},_n=r=>{if(!r)return null;let e=null;if(typeof r=="string")try{e=JSON.parse(r)}catch{const s=r.split("&");if(s.length===1)e=r;else{e={};for(let n of s){const i=n.split("=");e[i[0]]=i[1]===void 0?"undefined":i[1]}}}else if(ni(r))if(e={},Et(r)&&Ws(r[0]))e=r;else for(const[s,n]of r)e[s]=typeof n=="string"?n:"[object Object]";else ai(r)?e=r:e=`[object ${ii(r)}]`;return e},zs=(r="")=>(r.startsWith("//")&&(r=`${new URL(window.location.href).protocol}${r}`),r.startsWith("http")?new URL(r):new URL(r,window.location.href));class wn{constructor(){y(this,"id",""),y(this,"name",""),y(this,"method",""),y(this,"url",""),y(this,"status",0),y(this,"statusText",""),y(this,"cancelState",0),y(this,"readyState",0),y(this,"header",null),y(this,"responseType",""),y(this,"requestType","xhr"),y(this,"requestHeader",null),y(this,"response"),y(this,"responseSize",0),y(this,"responseSizeText",""),y(this,"startTime",0),y(this,"startTimeText",""),y(this,"endTime",0),y(this,"costTime",0),y(this,"getData",null),y(this,"postData",null),y(this,"postLength",0),y(this,"actived",!1),y(this,"noVConsole",!1),y(this,"_XMLReq",null),this.id=we()}}class Ko{constructor(e,s,n){y(this,"resp"),y(this,"item"),y(this,"onUpdateCallback"),this.resp=e,this.item=s,this.onUpdateCallback=n,this.mockReader()}set(e,s,n){return Reflect.set(e,s,n)}get(e,s){const n=Reflect.get(e,s);switch(s){case"arrayBuffer":case"blob":case"formData":case"json":case"text":return()=>(this.item.responseType=s.toLowerCase(),n.apply(e).then(i=>(this.item.response=Ie(this.item.responseType,i),this.onUpdateCallback(this.item),i)))}return typeof n=="function"?n.bind(e):n}mockReader(){let e;if(!this.resp.body||typeof this.resp.body.getReader!="function")return;const s=this.resp.body.getReader;this.resp.body.getReader=()=>{const n=s.apply(this.resp.body);if(this.item.readyState===4)return n;const i=n.read,a=n.cancel;return this.item.responseType="arraybuffer",n.read=()=>i.apply(n).then(u=>{if(!e)e=new Uint8Array(u.value);else{const h=new Uint8Array(e.length+u.value.length);h.set(e),h.set(u.value,e.length),e=h}return this.item.endTime=Date.now(),this.item.costTime=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.readyState=u.done?4:3,this.item.statusText=u.done?String(this.item.status):"Loading",this.item.responseSize=e.length,this.item.responseSizeText=je(this.item.responseSize),u.done&&(this.item.response=Ie(this.item.responseType,e)),this.onUpdateCallback(this.item),u}),n.cancel=(...u)=>(this.item.cancelState=2,this.item.statusText="Cancel",this.item.endTime=Date.now(),this.item.costTime=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.response=Ie(this.item.responseType,e),this.onUpdateCallback(this.item),a.apply(n,u)),n}}}class Zo{constructor(e){y(this,"onUpdateCallback"),this.onUpdateCallback=e}apply(e,s,n){const i=n[0],a=n[1],u=new wn;return this.beforeFetch(u,i,a),e.apply(window,n).then(this.afterFetch(u)).catch(h=>{throw u.endTime=Date.now(),u.costTime=u.endTime-(u.startTime||u.endTime),this.onUpdateCallback(u),h})}beforeFetch(e,s,n){let i,a="GET",u=null;if(Je(s)?(a=(n==null?void 0:n.method)||"GET",i=zs(s),u=(n==null?void 0:n.headers)||null):(a=s.method||"GET",i=zs(s.url),u=s.headers),e.method=a,e.requestType="fetch",e.requestHeader=u,e.url=i.toString(),e.name=(i.pathname.split("/").pop()||"")+i.search,e.status=0,e.statusText="Pending",e.readyState=1,!e.startTime){e.startTime=Date.now();const h=Xs(e.startTime);e.startTimeText=`${h.year}-${h.month}-${h.day} ${h.hour}:${h.minute}:${h.second}.${h.millisecond}`}if(Object.prototype.toString.call(u)==="[object Headers]"){e.requestHeader={};for(const[h,_]of u)e.requestHeader[h]=_}else e.requestHeader=u;if(i.search&&i.searchParams){e.getData={};for(const[h,_]of i.searchParams)e.getData[h]=_}n!=null&&n.body&&(e.postData=_n(n.body)),this.onUpdateCallback(e)}afterFetch(e){return s=>{e.endTime=Date.now(),e.costTime=e.endTime-(e.startTime||e.endTime),e.status=s.status,e.statusText=String(s.status);let n=!1;e.header={};for(const[i,a]of s.headers)e.header[i]=a,n=a.toLowerCase().indexOf("chunked")>-1?!0:n;return n?e.readyState=3:(e.readyState=4,this.handleResponseBody(s.clone(),e).then(i=>{e.responseSize=typeof i=="string"?i.length:i.byteLength,e.responseSizeText=je(e.responseSize),e.response=Ie(e.responseType,i),this.onUpdateCallback(e)})),this.onUpdateCallback(e),new Proxy(s,new Ko(s,e,this.onUpdateCallback))}}handleResponseBody(e,s){const n=e.headers.get("content-type");return n&&n.includes("application/json")?(s.responseType="json",e.text()):n&&(n.includes("text/html")||n.includes("text/plain"))?(s.responseType="text",e.text()):(s.responseType="arraybuffer",e.arrayBuffer())}}class yn{static create(e){return new Proxy(window.fetch,new Zo(e))}}y(yn,"origFetch",window.fetch);class Yo{constructor(e,s){y(this,"XMLReq"),y(this,"item"),y(this,"onUpdateCallback"),this.XMLReq=e,this.XMLReq.onreadystatechange=()=>{this.onReadyStateChange()},this.XMLReq.onabort=()=>{this.onAbort()},this.XMLReq.ontimeout=()=>{this.onTimeout()},this.item=new wn,this.item._XMLReq=e,this.item.requestType="xhr",this.onUpdateCallback=s}get(e,s){switch(s){case"_noVConsole":return this.item.noVConsole;case"open":return this.getOpen(e);case"send":return this.getSend(e);case"setRequestHeader":return this.getSetRequestHeader(e);default:const n=Reflect.get(e,s);return typeof n=="function"?n.bind(e):n}}set(e,s,n){switch(s){case"_noVConsole":return this.item.noVConsole=!!n,!1;case"onreadystatechange":return this.setOnReadyStateChange(e,s,n);case"onabort":return this.setOnAbort(e,s,n);case"ontimeout":return this.setOnTimeout(e,s,n)}return Reflect.set(e,s,n)}onReadyStateChange(){this.item.readyState=this.XMLReq.readyState,this.item.responseType=this.XMLReq.responseType,this.item.endTime=Date.now(),this.item.costTime=this.item.endTime-this.item.startTime,this.updateItemByReadyState(),this.item.response=Ie(this.item.responseType,this.item.response),this.triggerUpdate()}onAbort(){this.item.cancelState=1,this.item.statusText="Abort",this.triggerUpdate()}onTimeout(){this.item.cancelState=3,this.item.statusText="Timeout",this.triggerUpdate()}triggerUpdate(){this.item.noVConsole||this.onUpdateCallback(this.item)}getOpen(e){const s=Reflect.get(e,"open");return(...n)=>{const i=n[0],a=n[1];return this.item.method=i?i.toUpperCase():"GET",this.item.url=a||"",this.item.name=this.item.url.replace(new RegExp("[/]*$"),"").split("/").pop()||"",this.item.getData=Vo(this.item.url,{}),this.triggerUpdate(),s.apply(e,n)}}getSend(e){const s=Reflect.get(e,"send");return(...n)=>{const i=n[0];return i&&Object.prototype.hasOwnProperty.call(i,"length")&&(this.item.postLength=i.length),this.item.postData=_n(i),this.triggerUpdate(),s.apply(e,n)}}getSetRequestHeader(e){const s=Reflect.get(e,"setRequestHeader");return(...n)=>(this.item.requestHeader||(this.item.requestHeader={}),this.item.requestHeader[n[0]]=n[1],this.triggerUpdate(),s.apply(e,n))}setOnReadyStateChange(e,s,n){return Reflect.set(e,s,(...i)=>{this.onReadyStateChange(),n.apply(e,i)})}setOnAbort(e,s,n){return Reflect.set(e,s,(...i)=>{this.onAbort(),n.apply(e,i)})}setOnTimeout(e,s,n){return Reflect.set(e,s,(...i)=>{this.onTimeout(),n.apply(e,i)})}updateItemByReadyState(){switch(this.XMLReq.readyState){case 0:case 1:if(this.item.status=0,this.item.statusText="Pending",!this.item.startTime){this.item.startTime=Date.now();const n=Xs(this.item.startTime);this.item.startTimeText=`${n.year}-${n.month}-${n.day} ${n.hour}:${n.minute}:${n.second}.${n.millisecond}`}break;case 2:this.item.status=this.XMLReq.status,this.item.statusText="Loading",this.item.header={};const e=this.XMLReq.getAllResponseHeaders()||"",s=e.split(`
|
|
11
|
+
`);for(let n=0;n<s.length;n++){const i=s[n];if(!i)continue;const a=i.split(": "),u=a[0],h=a.slice(1).join(": ");this.item.header[u]=h}break;case 3:this.item.status=this.XMLReq.status,this.item.statusText="Loading",!!this.XMLReq.response&&this.XMLReq.response.length&&(this.item.responseSize=this.XMLReq.response.length,this.item.responseSizeText=je(this.item.responseSize));break;case 4:this.item.status=this.XMLReq.status||this.item.status||0,this.item.statusText=String(this.item.status),this.item.endTime=Date.now(),this.item.costTime=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.response=this.XMLReq.response,!!this.XMLReq.response&&this.XMLReq.response.length&&(this.item.responseSize=this.XMLReq.response.length,this.item.responseSizeText=je(this.item.responseSize));break;default:this.item.status=this.XMLReq.status,this.item.statusText="Unknown";break}}}class bn{static create(e){return new Proxy(XMLHttpRequest,{construct(s){const n=new s;return new Proxy(n,new Yo(n,e))}})}}y(bn,"origXMLHttpRequest",XMLHttpRequest);class ir extends at{constructor(e){super(e,"http"),y(this,"url",""),y(this,"method",""),y(this,"startTime",0),y(this,"endTime",0),y(this,"requestContentLength",0),y(this,"responseContentLength",0),y(this,"responseContent",null),y(this,"requestContent",null),y(this,"statusCode",0),y(this,"headers",{}),y(this,"trackOptions",{trackHeaders:!0,trackRequesetData:!1,trackResponseData:!1,trackFilter:void 0})}setTrackOptions(e){this.trackOptions={...this.trackOptions,...e}}getProperties(){return{url:this.url,method:this.method,header:this.trackOptions.trackHeaders?this.headers:void 0,code:this.statusCode,duration:(this.endTime-this.startTime)*1e6,reqcontentlength:this.requestContentLength,respcontentlength:this.responseContentLength,requestContent:this.trackOptions.trackRequesetData?this.requestContent:void 0,responseContent:this.trackOptions.trackResponseData?this.responseContent:void 0,start:this.startTime*1e6,end:this.endTime*1e6}}start(e,s,n,i){this.startTime=Date.now(),this.url=e,this.method=s,this.headers=i,this.requestContentLength=n}end(e,s){this.endTime=Date.now(),this.responseContentLength=e,this.statusCode=s}setProperties(e){this.url=e.url,this.method=e.method,this.startTime=e.startTime,this.endTime=e.endTime,this.requestContentLength=e.requestContentLength,this.responseContentLength=e.responseContentLength,this.statusCode=e.statusCode,this.trackOptions.trackResponseData&&(this.responseContent=e.responseContent),this.trackOptions.trackRequesetData&&(this.requestContent=e.requestContent);let s=e.headers;s&&(s={...s,token:""}),this.headers=s}}const tc=(r,e)=>{const s=(n,i)=>{var a,u,h;if(i.readyState===4&&i.url!==n.options.url){let _={url:i.url,method:i.method,startTime:i.startTime,endTime:i.endTime,requestContentLength:i.postLength,responseContentLength:i.responseSize,responseContent:i.response,requestContent:i.postData||i.getData,statusCode:i.status,headers:i.header||{}};if(e.trackFilter){const f=e.trackFilter(_,i);if(f===!1)return;typeof f=="object"?_=f:f===!0&&(e.trackResponseData&&_.responseContent&&((a=_.responseContent)==null?void 0:a.length)>1048576&&(_.responseContent=void 0),e.trackRequesetData&&_.requestContent&&((u=_.requestContent)==null?void 0:u.length)>1048576&&(_.requestContent=void 0))}else e.trackResponseData&&_.responseContent&&_.responseContent.length>1048576&&(_.responseContent=void 0),e.trackRequesetData&&_.requestContent&&((h=_.requestContent)==null?void 0:h.length)>1048576&&(_.requestContent=void 0);const p=new ir(n);p.setTrackOptions(e),p.setProperties(_),n.addLogByEvent(p)}};window.XMLHttpRequest=bn.create(n=>{s(r,n)}),window.fetch=yn.create(n=>{s(r,n)})},ec=r=>{r||(r={trackHeaders:!0,trackResponseData:!1,trackRequesetData:!1}),ir.eventOptions=r,ir.startApaasTrackHook=e=>{tc(e,r)},Ge.registerEvent("http",ir)},kt=(r,e=!1)=>{let s=location.href.replace(/#\/.+$/,r);return e&&(s=s.replace(/\?\S+$/,"")),s},kn=(r,e)=>{let s=history.pushState,n=history.replaceState,i=kt(location.hash),a=null;history.pushState=function(...u){const h=kt(location.hash),_=kt(u[2]||"");return i=_,r&&(a={newURL:_,oldURL:h,type:"push"},Or(()=>{a&&(e(a),a=null)})),s.apply(this,u)},history.replaceState=function(...u){if(r){const h=kt(location.hash),_=kt(u[2]||"");a={newURL:_,oldURL:h,type:"replace"},i=_,Or(()=>{if(a&&a.oldURL===h&&a.newURL===_){let p=kt(location.hash);h===_?_!==p?(a.newURL=p,a.type="push"):a.type="onload":a.type="replace",e(a),a=null}})}return n.apply(this,u)},window.addEventListener("popstate",u=>{if(r){const h=kt(location.hash);u.state&&(a={newURL:h,oldURL:i,type:u.state.forward?"back":"forward"},i=h,e(a),a=null)}})};var rc=function(r,e){e===!0&&(e=0);var s="";if(typeof r=="string")try{s=new URL(r).protocol}catch{}else r&&r.constructor===URL&&(s=r.protocol);var n=s.split(/\:|\+/).filter(Boolean);return typeof e=="number"?n[e]:n},sc=rc;function nc(r){var e={protocols:[],protocol:null,port:null,resource:"",host:"",user:"",password:"",pathname:"",hash:"",search:"",href:r,query:{},parse_failed:!1};try{var s=new URL(r);e.protocols=sc(s),e.protocol=e.protocols[0],e.port=s.port,e.resource=s.hostname,e.host=s.host,e.user=s.username||"",e.password=s.password||"",e.pathname=s.pathname,e.hash=s.hash.slice(1),e.search=s.search.slice(1),e.href=s.href,e.query=Object.fromEntries(s.searchParams)}catch{e.protocols=["file"],e.protocol=e.protocols[0],e.port="",e.resource="",e.user="",e.pathname="",e.hash="",e.search="",e.href=r,e.query={},e.parse_failed=!0}return e}var ic=nc;const ac="text/plain",oc="us-ascii",Fs=(r,e)=>e.some(s=>s instanceof RegExp?s.test(r):s===r),cc=(r,{stripHash:e})=>{const s=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(r);if(!s)throw new Error(`Invalid URL: ${r}`);let{type:n,data:i,hash:a}=s.groups;const u=n.split(";");a=e?"":a;let h=!1;u[u.length-1]==="base64"&&(u.pop(),h=!0);const _=(u.shift()||"").toLowerCase(),p=[...u.map(f=>{let[w,l=""]=f.split("=").map(v=>v.trim());return w==="charset"&&(l=l.toLowerCase(),l===oc)?"":`${w}${l?`=${l}`:""}`}).filter(Boolean)];return h&&p.push("base64"),(p.length>0||_&&_!==ac)&&p.unshift(_),`data:${p.join(";")},${h?i.trim():i}${a?`#${a}`:""}`};function uc(r,e){if(e={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...e},r=r.trim(),/^data:/i.test(r))return cc(r,e);if(/^view-source:/i.test(r))throw new Error("`view-source:` is not supported as it is a non-standard protocol");const s=r.startsWith("//");!s&&/^\.*\//.test(r)||(r=r.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));const n=new URL(r);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&n.protocol==="https:"&&(n.protocol="http:"),e.forceHttps&&n.protocol==="http:"&&(n.protocol="https:"),e.stripAuthentication&&(n.username="",n.password=""),e.stripHash?n.hash="":e.stripTextFragment&&(n.hash=n.hash.replace(/#?:~:text.*?$/i,"")),n.pathname){const a=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g;let u=0,h="";for(;;){const _=a.exec(n.pathname);if(!_)break;const p=_[0],f=_.index;h+=n.pathname.slice(u,f).replace(/\/{2,}/g,"/"),h+=p,u=f+p.length}h+=n.pathname.slice(u,n.pathname.length).replace(/\/{2,}/g,"/"),n.pathname=h}if(n.pathname)try{n.pathname=decodeURI(n.pathname)}catch{}if(e.removeDirectoryIndex===!0&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let a=n.pathname.split("/");const u=a[a.length-1];Fs(u,e.removeDirectoryIndex)&&(a=a.slice(0,-1),n.pathname=a.slice(1).join("/")+"/")}if(n.hostname&&(n.hostname=n.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(n.hostname)&&(n.hostname=n.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(const a of[...n.searchParams.keys()])Fs(a,e.removeQueryParameters)&&n.searchParams.delete(a);if(e.removeQueryParameters===!0&&(n.search=""),e.sortQueryParameters){n.searchParams.sort();try{n.search=decodeURIComponent(n.search)}catch{}}e.removeTrailingSlash&&(n.pathname=n.pathname.replace(/\/$/,""));const i=r;return r=n.toString(),!e.removeSingleSlash&&n.pathname==="/"&&!i.endsWith("/")&&n.hash===""&&(r=r.replace(/\/$/,"")),(e.removeTrailingSlash||n.pathname==="/")&&n.hash===""&&e.removeSingleSlash&&(r=r.replace(/\/$/,"")),s&&!e.normalizeProtocol&&(r=r.replace(/^http:\/\//,"//")),e.stripProtocol&&(r=r.replace(/^(?:https?:)?\/\//,"")),r}const $e=(r,e=!1)=>{const s=/^(?:([a-z_][a-z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:]([\~,\.\w,\-,\_,\/]+?(?:\.git|\/)?)$/,n=a=>{const u=new Error(a);throw u.subject_url=r,u};(typeof r!="string"||!r.trim())&&n("Invalid url."),r.length>$e.MAX_INPUT_LENGTH&&n("Input exceeds maximum length. If needed, change the value of parseUrl.MAX_INPUT_LENGTH."),e&&(typeof e!="object"&&(e={stripHash:!1}),r=uc(r,e));const i=ic(r);if(i.parse_failed){const a=i.href.match(s);a?(i.protocols=["ssh"],i.protocol="ssh",i.resource=a[2],i.host=a[2],i.user=a[1],i.pathname=`/${a[3]}`,i.parse_failed=!1):n("URL parsing failed.")}return i};$e.MAX_INPUT_LENGTH=2048;$e.MAX_INPUT_LENGTH=2048*1024;class ve extends at{constructor(e){super(e,"online"),y(this,"url",""),y(this,"duration",0),y(this,"startTime",0),y(this,"endTime",0),y(this,"views",[])}getProperties(){return{url:this.url,duration:this.duration,startTime:this.startTime,endTime:this.endTime}}setProperties(e){this.duration=e.duration,this.url=e.url,this.startTime=e.startTime,this.endTime=e.endTime,e.views&&(this.views=e.views)}}let Fe=null;const Hs=(r,e)=>{const s=()=>!0;let n=typeof e=="object"&&e.collectUrl?e.collectUrl:s;return i=>{let a=$e(i.newURL),u=$e(i.oldURL),h=kt(`#${a.hash}`,!0);i.oldURL&&kt(`#${u.hash}`,!0),Fe&&(Fe.stop(),Fe.destroy(),Fe=null),n(location)&&(Fe=new hc(r,h))}};class hc{constructor(e,s,n){y(this,"url",""),y(this,"duration",0),y(this,"startTime",0),y(this,"onlineOptions"),y(this,"apaasTrack"),y(this,"visibleChangeHandler"),y(this,"beforeUnLoadHandler"),y(this,"userActionHandler"),y(this,"onlineTimer",null),y(this,"stopTimeout",null),this.url=s,this.apaasTrack=e,this.onlineOptions=n||{collectUrl:void 0},this.visibleChangeHandler=i=>{const a=i.target.visibilityState;this.stopUserActionMonitor(),a==="visible"?this.start():this.startUserActionMonitor()},this.beforeUnLoadHandler=i=>{if(this.apaasTrack){const a=Date.now()-this.startTime;this.saveOnlineData(a);const u=this.apaasTrack.getStorageData();if(u.onlineData)for(let h in u.onlineData){const _=u.onlineData[h],p=new ve(this.apaasTrack);p.setProperties({duration:_.duration,url:h,startTime:_.startTime,endTime:_.lastTime,views:_.views});const f=p.getEventLog();e.addToLegancyLog(f)}this.cleanOnlineData()}},this.userActionHandler=To(i=>{console.log("\u6709\u7528\u6237\u884C\u4E3A"),this.stopUserActionMonitor(),this.start(),this.startUserActionMonitor()},60*1e3,{leading:!0,trailing:!1}),vn(this.beforeUnLoadHandler),Jo(this.userActionHandler),this.init()}startUserActionMonitor(){console.log("startUserActionMonitor"),!this.stopTimeout&&(this.stopTimeout=window.setTimeout(()=>{this.onlineTimer&&(console.log("\u65E0\u6548\u64CD\u4F5C\u65F6\u957F\uFF0C\u7528\u6237\u5DF2\u4E0B\u7EBF..."),clearInterval(this.onlineTimer),this.onlineTimer=null,this.saveOnlineData(this.duration),this.sendRecord(!1,this.url))},1e3*60))}stopUserActionMonitor(){console.log("stopUserActionMonitor"),this.stopTimeout&&(clearTimeout(this.stopTimeout),this.stopTimeout=null)}init(){let e=this.apaasTrack.getStorageData();e||(this.apaasTrack.initStorageData(),e=this.apaasTrack.getStorageData()),e.onlineData?this.cleanOnlineData():e.onlineData={},localStorage.setItem("apaas-track",JSON.stringify(e)),document.addEventListener("visibilitychange",this.visibleChangeHandler),this.start();const s=window.document.createEvent("MouseEvent");this.userActionHandler(s)}saveOnlineData(e,s){const n=this.apaasTrack.getStorageData();let i=n.onlineData,a=i[this.url]||(i[this.url]={duration:0,lastTime:Date.now()});a.duration=e,a.lastTime=Date.now(),a.startTime=this.startTime,s&&(a.views||(a.views=[]),a.views.push({name:s.name,duration:s.duration})),n.onlineData[this.url]=a,localStorage.setItem("apaas-track",JSON.stringify(n))}getStorageOnlineData(){return this.apaasTrack.getStorageData().onlineData}cleanOnlineData(e){const s=this.apaasTrack.getStorageData();!s.onlineData||(e?delete s.onlineData[e]:s.onlineData={},localStorage.setItem("apaas-track",JSON.stringify(s)))}start(){if(this.onlineTimer)return;this.startTime=Date.now(),this.duration=0;let e=10*1e3;this.onlineTimer=window.setInterval(()=>{console.log("onlineTimer---"),this.duration+=e,this.saveOnlineData(this.duration)},e)}stop(){if(this.onlineTimer){clearInterval(this.onlineTimer),this.onlineTimer=null;const e=Date.now()-this.startTime;this.duration=e,this.saveOnlineData(e),this.sendRecord(!1,this.url)}}destroy(){this.stopUserActionMonitor(),document.removeEventListener("visibilitychange",this.visibleChangeHandler),this.beforeUnLoadHandler&&$o(this.beforeUnLoadHandler),this.userActionHandler&&Go(this.userActionHandler)}sendRecord(e=!1,s){const n=this.getStorageOnlineData();if(n)if(s){const i=n[s];if(i!=null&&i.duration){const a=new ve(this.apaasTrack);a.setProperties({duration:i.duration,url:s,startTime:i.startTime,endTime:i.lastTime,views:i.views}),this.apaasTrack.addLogByEvent(a),e&&this.apaasTrack.sendByBeacon()}this.cleanOnlineData(s)}else{for(let i in n){const a=n[i];if(a.duration){const u=new ve(this.apaasTrack);u.setProperties({duration:a.duration,url:i,startTime:a.startTime,endTime:a.lastTime,views:a.views}),this.apaasTrack.addLogByEvent(u),e&&this.apaasTrack.sendByBeacon()}}this.cleanOnlineData()}this.duration=0,this.startTime=0}}const lc=r=>{console.log("registerOnlineEvent"),r||(r={}),ve.eventOptions=r,ve.startApaasTrackHook=e=>{console.log("registerOnlineEvent startApaasTrackHook");let s=null;kn(e,a=>{console.log("online listenHistoryChange"),s||(s=Hs(e)),s(a)});const n=()=>{i&&clearTimeout(i),s||(s=Hs(e));const a={newURL:kt(location.hash),oldURL:kt(location.hash),type:"onload"};s(a),window.removeEventListener("load",n)};let i=null;window.self!==window.top&&(window.addEventListener("load",n),i=setTimeout(()=>{n(),clearTimeout(i)},3e3))},Ct.registerEvent("online",ve)};class jr extends at{constructor(e){super(e,"pageview",Gr.HIGH),y(this,"oldURL",""),y(this,"newURL",""),y(this,"entertype","")}getProperties(){return{from:this.oldURL,to:this.newURL,entertype:this.entertype}}setProperties(e){this.oldURL=e.oldURL,this.newURL=e.newURL,this.entertype=e.type}}const pc=(r,e)=>{const s=new jr(r);s.setProperties(e);const n=s.getEventLog();r.addLogToQueue(n,!0)},dc=()=>{jr.startApaasTrackHook=r=>{kn(r,e=>{pc(r,e)})},Ct.registerEvent("pageview",jr)};var qt,Ne,Tn,cr,Ur,Sn=-1,ne=function(r){addEventListener("pageshow",function(e){e.persisted&&(Sn=e.timeStamp,r(e))},!0)},Kr=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},vr=function(){var r=Kr();return r&&r.activationStart||0},mt=function(r,e){var s=Kr(),n="navigate";return Sn>=0?n="back-forward-cache":s&&(n=document.prerendering||vr()>0?"prerender":document.wasDiscarded?"restore":s.type.replace(/_/g,"-")),{name:r,value:e===void 0?-1:e,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:n}},ke=function(r,e,s){try{if(PerformanceObserver.supportedEntryTypes.includes(r)){var n=new PerformanceObserver(function(i){Promise.resolve().then(function(){e(i.getEntries())})});return n.observe(Object.assign({type:r,buffered:!0},s||{})),n}}catch{}},_r=function(r,e){var s=function n(i){i.type!=="pagehide"&&document.visibilityState!=="hidden"||(r(i),e&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",s,!0),addEventListener("pagehide",s,!0)},ft=function(r,e,s,n){var i,a;return function(u){e.value>=0&&(u||n)&&((a=e.value-(i||0))||i===void 0)&&(i=e.value,e.delta=a,e.rating=function(h,_){return h>_[1]?"poor":h>_[0]?"needs-improvement":"good"}(e.value,s),r(e))}},Zr=function(r){requestAnimationFrame(function(){return requestAnimationFrame(function(){return r()})})},Te=function(r){document.prerendering?addEventListener("prerenderingchange",function(){return r()},!0):r()},fe=-1,Is=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},ur=function(r){document.visibilityState==="hidden"&&fe>-1&&(fe=r.type==="visibilitychange"?r.timeStamp:0,mc())},Ns=function(){addEventListener("visibilitychange",ur,!0),addEventListener("prerenderingchange",ur,!0)},mc=function(){removeEventListener("visibilitychange",ur,!0),removeEventListener("prerenderingchange",ur,!0)},Yr=function(){return fe<0&&(fe=Is(),Ns(),ne(function(){setTimeout(function(){fe=Is(),Ns()},0)})),{get firstHiddenTime(){return fe}}},Pn=function(r,e){e=e||{},Te(function(){var s,n=[1800,3e3],i=Yr(),a=mt("FCP"),u=ke("paint",function(h){h.forEach(function(_){_.name==="first-contentful-paint"&&(u.disconnect(),_.startTime<i.firstHiddenTime&&(a.value=Math.max(_.startTime-vr(),0),a.entries.push(_),s(!0)))})});u&&(s=ft(r,a,n,e.reportAllChanges),ne(function(h){a=mt("FCP"),s=ft(r,a,n,e.reportAllChanges),Zr(function(){a.value=performance.now()-h.timeStamp,s(!0)})}))})},fc=function(r,e){e=e||{},Te(function(){var s,n=[.1,.25],i=mt("CLS"),a=-1,u=0,h=[],_=function(w){a>-1&&r(w)},p=function(w){w.forEach(function(l){if(!l.hadRecentInput){var v=h[0],b=h[h.length-1];u&&l.startTime-b.startTime<1e3&&l.startTime-v.startTime<5e3?(u+=l.value,h.push(l)):(u=l.value,h=[l]),u>i.value&&(i.value=u,i.entries=h,s())}})},f=ke("layout-shift",p);f&&(s=ft(_,i,n,e.reportAllChanges),Pn(function(w){a=w.value,i.value<0&&(i.value=0,s())}),_r(function(){p(f.takeRecords()),s(!0)}),ne(function(){u=0,a=-1,i=mt("CLS",0),s=ft(_,i,n,e.reportAllChanges),Zr(function(){return s()})}))})},He={passive:!0,capture:!0},gc=new Date,js=function(r,e){qt||(qt=e,Ne=r,Tn=new Date,En(removeEventListener),Ln())},Ln=function(){if(Ne>=0&&Ne<Tn-gc){var r={entryType:"first-input",name:qt.type,target:qt.target,cancelable:qt.cancelable,startTime:qt.timeStamp,processingStart:qt.timeStamp+Ne};cr.forEach(function(e){e(r)}),cr=[]}},vc=function(r){if(r.cancelable){var e=(r.timeStamp>1e12?new Date:performance.now())-r.timeStamp;r.type=="pointerdown"?function(s,n){var i=function(){js(s,n),u()},a=function(){u()},u=function(){removeEventListener("pointerup",i,He),removeEventListener("pointercancel",a,He)};addEventListener("pointerup",i,He),addEventListener("pointercancel",a,He)}(e,r):js(e,r)}},En=function(r){["mousedown","keydown","touchstart","pointerdown"].forEach(function(e){return r(e,vc,He)})},_c=function(r,e){e=e||{},Te(function(){var s,n=[100,300],i=Yr(),a=mt("FID"),u=function(p){p.startTime<i.firstHiddenTime&&(a.value=p.processingStart-p.startTime,a.entries.push(p),s(!0))},h=function(p){p.forEach(u)},_=ke("first-input",h);s=ft(r,a,n,e.reportAllChanges),_&&_r(function(){h(_.takeRecords()),_.disconnect()},!0),_&&ne(function(){var p;a=mt("FID"),s=ft(r,a,n,e.reportAllChanges),cr=[],Ne=-1,qt=null,En(addEventListener),p=u,cr.push(p),Ln()})})},xn=0,Cr=1/0,sr=0,wc=function(r){r.forEach(function(e){e.interactionId&&(Cr=Math.min(Cr,e.interactionId),sr=Math.max(sr,e.interactionId),xn=sr?(sr-Cr)/7+1:0)})},Bn=function(){return Ur?xn:performance.interactionCount||0},yc=function(){"interactionCount"in performance||Ur||(Ur=ke("event",wc,{type:"event",buffered:!0,durationThreshold:0}))},Cn=0,Us=function(){return Bn()-Cn},xt=[],Mr={},qs=function(r){var e=xt[xt.length-1],s=Mr[r.interactionId];if(s||xt.length<10||r.duration>e.latency){if(s)s.entries.push(r),s.latency=Math.max(s.latency,r.duration);else{var n={id:r.interactionId,latency:r.duration,entries:[r]};Mr[n.id]=n,xt.push(n)}xt.sort(function(i,a){return a.latency-i.latency}),xt.splice(10).forEach(function(i){delete Mr[i.id]})}},bc=function(r,e){e=e||{},Te(function(){var s=[200,500];yc();var n,i=mt("INP"),a=function(h){h.forEach(function(f){f.interactionId&&qs(f),f.entryType==="first-input"&&!xt.some(function(w){return w.entries.some(function(l){return f.duration===l.duration&&f.startTime===l.startTime})})&&qs(f)});var _,p=(_=Math.min(xt.length-1,Math.floor(Us()/50)),xt[_]);p&&p.latency!==i.value&&(i.value=p.latency,i.entries=p.entries,n())},u=ke("event",a,{durationThreshold:e.durationThreshold||40});n=ft(r,i,s,e.reportAllChanges),u&&(u.observe({type:"first-input",buffered:!0}),_r(function(){a(u.takeRecords()),i.value<0&&Us()>0&&(i.value=0,i.entries=[]),n(!0)}),ne(function(){xt=[],Cn=Bn(),i=mt("INP"),n=ft(r,i,s,e.reportAllChanges)}))})},Rr={},kc=function(r,e){e=e||{},Te(function(){var s,n=[2500,4e3],i=Yr(),a=mt("LCP"),u=function(p){var f=p[p.length-1];if(f){var w=Math.max(f.startTime-vr(),0);w<i.firstHiddenTime&&(a.value=w,a.entries=[f],s())}},h=ke("largest-contentful-paint",u);if(h){s=ft(r,a,n,e.reportAllChanges);var _=function(){Rr[a.id]||(u(h.takeRecords()),h.disconnect(),Rr[a.id]=!0,s(!0))};["keydown","click"].forEach(function(p){addEventListener(p,_,{once:!0,capture:!0})}),_r(_,!0),ne(function(p){a=mt("LCP"),s=ft(r,a,n,e.reportAllChanges),Zr(function(){a.value=performance.now()-p.timeStamp,Rr[a.id]=!0,s(!0)})})}})},Tc=function r(e){document.prerendering?Te(function(){return r(e)}):document.readyState!=="complete"?addEventListener("load",function(){return r(e)},!0):setTimeout(e,0)},Sc=function(r,e){e=e||{};var s=[800,1800],n=mt("TTFB"),i=ft(r,n,s,e.reportAllChanges);Tc(function(){var a=Kr();if(a){var u=a.responseStart;if(u<=0||u>performance.now())return;n.value=Math.max(u-vr(),0),n.entries=[a],i(!0),ne(function(){n=mt("TTFB",0),(i=ft(r,n,s,e.reportAllChanges))(!0)})}})};class qr extends at{constructor(e){super(e,"performance"),y(this,"performanceData",null)}getProperties(){return{...this.performanceData}}setProperties(e){this.performanceData=e}track(){return new Promise((e,s)=>{let n={cls:null,lcp:null,ttfb:null,fcp:null,fid:null,inp:null};setTimeout(()=>{const a=performance.timing,u={...n,connectEnd:a.connectEnd,connectStart:a.connectStart,domComplete:a.domComplete,domContentLoadedEventEnd:a.domContentLoadedEventEnd,domContentLoadedEventStart:a.domContentLoadedEventStart,domInteractive:a.domInteractive,domLoading:a.domLoading,domainLookupEnd:a.domainLookupEnd,domainLookupStart:a.domainLookupStart,fetchStart:a.fetchStart,loadEventEnd:a.loadEventEnd,loadEventStart:a.loadEventStart,navigationStart:a.navigationStart,redirectEnd:a.redirectEnd,redirectStart:a.redirectStart,requestStart:a.requestStart,responseEnd:a.responseEnd,responseStart:a.responseStart,secureConnectionStart:a.secureConnectionStart,unloadEventEnd:a.unloadEventEnd,unloadEventStart:a.unloadEventStart};this.setProperties(u),e(u)},1e4),kc(a=>{i(a)}),fc(a=>{i(a)}),Sc(a=>{i(a)}),Pn(a=>{i(a)}),_c(a=>{i(a)}),bc(a=>{i(a)});const i=a=>{a.name==="FID"?n.fid=a.value:a.name==="CLS"?n.cls=a.value:a.name==="FCP"?n.fcp=a.value:a.name==="TTFB"?n.ttfb=a.value:a.name==="LCP"?n.lcp=a.value:a.name==="INP"&&(n.inp=a.value)}})}}const Pc=async r=>{const e=new qr(r);await e.track(),r.addLogByEvent(e)},Lc=()=>{qr.startApaasTrackHook=r=>{Pc(r)},Ct.registerEvent("performance",qr)};class $s extends at{constructor(e){super(e,"throw"),y(this,"message",""),y(this,"detailmessage",""),y(this,"name",""),y(this,"stack",[]),y(this,"cause",{})}getProperties(){return{message:this.message,detailmessage:this.detailmessage,name:this.name,stack:this.stack,cause:this.cause}}setError(e){const s=Jr(e);this.message=s.message,this.detailmessage=s.detail,this.name=s.name,this.stack=s.stack}}const Ec=r=>{window.addEventListener("error",e=>{const s=Bt(r,"throw");s.setError(e.error),r.addLogByEvent(s)}),window.addEventListener("unhandledrejection",e=>{const s=Bt(r,"throw");s.setError(e.reason),r.addLogByEvent(s)})},xc=()=>{$s.startApaasTrackHook=r=>{Ec(r)},Ct.registerEvent("throw",$s)},Bc=()=>{Lc(),xc(),Qo()},Cc=r=>{Bc(),dc(),Wo(),(r==null?void 0:r.http)!==!1&&ec(typeof(r==null?void 0:r.http)=="object"?r.http:void 0),r!=null&&r.click&&qo(typeof r.click=="object"?r.click:void 0),r!=null&&r.online&&lc(typeof r.online=="object"?r.online:void 0)},Mc=r=>(Cc(r),Rc(r)),Rc=r=>new Ct(r);class te{constructor(e,s,n){y(this,"_level",0),this.apaasTrack=e,this.type=s,n&&(this._level=n)}getProperties(){return{}}setProperties(e){}getEventLog(e){const s=e||Date.now();return{...this.apaasTrack.baseLog,types:this.type,logtime:String(s),epochnanos:String(s)+"000000",event:this.type,properties:this.getProperties(),url:ye()}}}y(te,"eventOptions"),y(te,"initApaasTrackHook"),y(te,"startApaasTrackHook"),y(te,"destroyApaasTrackHook");class Dc extends te{constructor(e){super(e,"init")}getProperties(){const e=this.apaasTrack.baseLog;return{system:e.system||"",systemver:e.systemver||"",manufacturer:e.manufacturer||"",browser:e.browser||"",browserver:e.browserver||"",terminalid:e.terminalid||"",client:e.client||"",clientver:e.clientver||""}}}class Ac extends te{constructor(e){super(e,"custom"),y(this,"info",{})}setCustomType(e){this.type=e}getProperties(){return{...this.info}}setProperties(e){this.info=e}}const _e={init:Dc,custom:Ac},ar=(r,e)=>{const s=_e[e];return new s(r)},Oc=(r,e,s)=>{const n=s||Date.now(),i=ar(r,e);return{...r.baseLog,types:e,logtime:String(n),epochnanos:String(n)+"000000",event:e,properties:i.getProperties(),url:ye()}},Js=(r,e,s)=>{const n=s||Date.now();return{...r.baseLog,types:e.type,logtime:String(n),epochnanos:String(n)+"000000",event:e.type,properties:e.getProperties(),url:ye()}},Mn=(r,e)=>{if(_e[r])throw Error(`\u8BE5\u4E8B\u4EF6${r} \u5DF2\u5B58\u5728\uFF0C\u6CE8\u518C\u5931\u8D25`);_e[r]=e};class zc{constructor(e,s){y(this,"name",""),y(this,"time",0),y(this,"info",{}),e&&(this.name=e),s&&(this.info=s),this.time=Date.now()}get epochnanos(){return this.time*1e6}get attributes(){return this.getAttributes()}getAttributes(){return{}}getJson(){return{name:this.name,epochnanos:this.time*1e6,attributes:this.getAttributes(),...this.info}}setInfo(e){this.info=e||{}}}class Fc extends zc{constructor(){super(...arguments),y(this,"name","exception"),y(this,"exceptionType",""),y(this,"exceptionMessage",""),y(this,"exceptionStackTrace","")}getAttributes(){return{"exception.type":this.exceptionType,"exception.message":this.exceptionMessage,"exception.stacktrace":this.exceptionStackTrace}}setInfo(e){this.exceptionMessage=e.exceptionMessage,this.exceptionType=e.exceptionType,this.exceptionStackTrace=e.exceptionStackTrace}}class ts extends te{constructor(e,s,n){super(e,"span"),y(this,"spanid",""),y(this,"traceid",""),y(this,"parentspanid",""),y(this,"name",""),y(this,"attributes",{}),y(this,"events",[]),y(this,"statuscode","OK"),y(this,"statusmessage",""),y(this,"startTime",0),y(this,"endTime",0),this.name=s,this.traceid=we(),this.spanid=Gs(),this.parentspanid=n||"",this.start()}trackLog(){this.apaasTrack.addLogByEvent(this)}createSpanEvent(e,s){return new ts(this.apaasTrack,e,s)}setAttribute(e){const s=e.getAttributes();this.attributes=s}addEvent(e){this.events.push(e)}exception(e){const s=new Fc;let n="",i="",a="";if(e instanceof Error){const u=Jr(e);n=u.detail,i=u.name,a=u.stack.join(",")}else n=e.exceptionMessage,i=e.exceptionType,a=e.exceptionStackTrace;s.setInfo({exceptionMessage:n,exceptionType:i,exceptionStackTrace:a}),this.events.push(s)}start(){this.startTime=Date.now()}end(e,s){e&&(this.statusmessage=e),s&&(this.statuscode=s),this.endTime=Date.now()}getProperties(){return{traceid:this.traceid,spanid:this.spanid,parentspanid:this.parentspanid,name:this.name,attributes:this.attributes,events:this.events.map(e=>e.getJson()),statuscode:this.statuscode,statusmessage:this.statusmessage,startepochnanos:this.startTime*1e6,endepochnanos:this.endTime*1e6,duration:(this.endTime-this.startTime)*1e6}}}class Rn{constructor(e){y(this,"_version",nr),y(this,"commonLog",null),y(this,"browserLog",null),y(this,"options"),this.options=e,typeof window<"u"&&(window.__apaasTrackVersion__=nr),typeof wx<"u"&&!window&&(wx.__apaasTrackVersion__=nr),e.commonLog&&this.initCommonLog(e.commonLog),this.runEventInitHooks()}registerEvent(e,s){Mn(e,s),s.initApaasTrackHook&&s.initApaasTrackHook(this),s.startApaasTrackHook&&s.startApaasTrackHook(this)}get groupid(){var e;return(e=this.browserLog)==null?void 0:e.distinctid}runEventInitHooks(){Object.values(_e).forEach(e=>{e.initApaasTrackHook&&e.initApaasTrackHook(this)})}runEventStartHooks(){Object.values(_e).forEach(e=>{e.startApaasTrackHook&&e.startApaasTrackHook(this)})}runEventDestroyHooks(){Object.values(_e).forEach(e=>{e.destroyApaasTrackHook&&e.destroyApaasTrackHook(this)})}get anonymousid(){var e;return(e=this.browserLog)==null?void 0:e.anonymousid}get distinctid(){var e;return(e=this.browserLog)==null?void 0:e.distinctid}get baseLog(){return{...this.browserLog,...this.commonLog}}initCommonLog(e){this.commonLog=e}createEventLog(e,s){return Oc(this,e,s)}addLogByType(e,s){const n=this.createEventLog(e,s);this.addLogToQueue(n)}addLogByEvent(e,s){const n=Js(this,e,s);this.addLogToQueue(n)}createCustomEvent(e){const s=ar(this,"custom");return s.setCustomType(e),s}createSpanEvent(e,s){return new ts(this,e,s)}addLogByCustomEvent(e,s={},n){const i=this.createCustomEvent(e);i.setProperties(s);const a=Js(this,i,n);this.addLogToQueue(a)}executeInitEvent(){const e=ar(this,"init");e.setProperties({groupid:this.groupid}),this.addLogByEvent(e)}updateCommonLog(e){this.commonLog={...this.commonLog,...e}}trackEvent(e,s={},n){const i=ar(this,e);i.setProperties(s),this.addLogByEvent(i,n)}start(...e){this.executeInitEvent(),this.runEventStartHooks()}destroy(){this.runEventDestroyHooks()}transformLog(e){return e}async addLogToQueue(e,s=!1,n=!0){n&&(e=this.transformLog(e)),await this.sendLog(e,s)}}y(Rn,"registerEvent",Mn);const Dn=async r=>{var i,a;let e=await r.getWebInitParams();const s=location.origin+"/static/apaas-track/apaas-spu/lzma_worker.js";console.log("createApaasTrack lzma_worker",s),xi(s);const n=Mc({url:r.url||"",click:{trackElementPath:!0},commonLog:{client:"Web",...e},online:(r==null?void 0:r.online)||!1,pageview:!0,http:(i=r.http)!=null?i:!0,zip:r.zip!==void 0?r.zip:!0,useIndexDB:(a=r==null?void 0:r.useIndexDB)!=null?a:!1});return n.sendLog=r.sendLog,n.start=function(...u){return Rn.prototype.start.call(this,...u)},r.sendLog===es&&(n.start=function(...u){return Ct.prototype.start.call(this,...u)}),r.startFn&&(n.start=r.startFn),n};let Dr=null;const Hc=async r=>{var s,n,i;if(Dr)return Dr;const e=await Dn({url:(r==null?void 0:r.url)||"",sendLog:(r==null?void 0:r.sendLog)||es,startFn:(r==null?void 0:r.startFn)||null,online:(r==null?void 0:r.online)||!1,getWebInitParams:(r==null?void 0:r.getWebInitParams)||An,zip:(s=r==null?void 0:r.zip)!=null?s:!0,useIndexDB:(n=r==null?void 0:r.useIndexDB)!=null?n:!1,http:(i=r==null?void 0:r.http)!=null?i:!0});return Dr=e,e},An=()=>new Promise((r,e)=>{if(window.aPaaS&&window.aPaaS.getWebInitParams){const s=window.aPaaS.getWebInitParams(n=>{r(n)});s&&s.then&&s.then(n=>{r(n)})}else{window.parent.postMessage({type:"getWebInitParams"},"*");const s=i=>{const a=(i==null?void 0:i.data)||{};if(a.type==="receiveWebInitParams")if(a.data){const u=a.data;r(u),n&&(clearTimeout(n),n=null),window.removeEventListener("message",s)}else e(Error("receiveWebInitParams response null"))};window.addEventListener("message",s);let n=window.setTimeout(()=>{e(Error("postMessage getWebInitParams timeout"))},2e3)}});function Ic(...r){return Ct.prototype.start.call(this,r)}function es(r,e){var s;return(s=window.aPaaS)!=null&&s.sendLog?window.aPaaS.sendLog(r,e):Ct.prototype.sendLog.call(this,r,e)}exports.BaseEvent=at;exports.BaseSpanAttribute=vi;exports.BaseTrack=Ge;exports.CustomEvent=tn;exports.EventLevel=Gr;exports.EventMap=ee;exports.ExceptionSpanEvent=sn;exports.InitEvent=Ys;exports.SpanEvent=hr;exports.SpanPropertyEvent=rn;exports.TaskQueue=Zs;exports.createApaasTrack=Dn;exports.createEvent=Bt;exports.defaultGetWebInitParams=An;exports.defaultWebSendFunction=es;exports.defaultWebStartFunction=Ic;exports.getApaasSpuTrack=Hc;exports.getEventLog=zr;exports.getEventLogByType=en;exports.registerEvent=Xr;
|