UNPKG

android-bot

Version:

Android-bot is built on the AutoBot JavaScript library and provides features such as wireless screen casting and real-time control within a local network, key simulation, screen recording, screenshot capture, layout analysis, file management, application

5 lines 55.5 kB
(function(w,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(w=typeof globalThis<"u"?globalThis:w||self,c(w.androidbot={}))})(this,function(w){"use strict";function c(t,e,s,r){function n(i){return i instanceof s?i:new s(function(o){o(i)})}return new(s||(s=Promise))(function(i,o){function u(l){try{p(r.next(l))}catch(f){o(f)}}function h(l){try{p(r.throw(l))}catch(f){o(f)}}function p(l){l.done?i(l.value):n(l.value).then(u,h)}p((r=r.apply(t,e||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;function ce(t,e){return function(){return t.apply(e,arguments)}}const{toString:Je}=Object.prototype,{getPrototypeOf:V}=Object,I=(t=>e=>{const s=Je.call(e);return t[s]||(t[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),A=t=>(t=t.toLowerCase(),e=>I(e)===t),U=t=>e=>typeof e===t,{isArray:N}=Array,M=U("undefined");function ze(t){return t!==null&&!M(t)&&t.constructor!==null&&!M(t.constructor)&&x(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const de=A("ArrayBuffer");function $e(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&de(t.buffer),e}const Ve=U("string"),x=U("function"),he=U("number"),q=t=>t!==null&&typeof t=="object",Ye=t=>t===!0||t===!1,D=t=>{if(I(t)!=="object")return!1;const e=V(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Xe=A("Date"),Ge=A("File"),Qe=A("Blob"),Ze=A("FileList"),Ke=t=>q(t)&&x(t.pipe),et=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||x(t.append)&&((e=I(t))==="formdata"||e==="object"&&x(t.toString)&&t.toString()==="[object FormData]"))},tt=A("URLSearchParams"),st=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function k(t,e,{allOwnKeys:s=!1}={}){if(t===null||typeof t>"u")return;let r,n;if(typeof t!="object"&&(t=[t]),N(t))for(r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else{const i=s?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let u;for(r=0;r<o;r++)u=i[r],e.call(null,t[u],u,t)}}function pe(t,e){e=e.toLowerCase();const s=Object.keys(t);let r=s.length,n;for(;r-- >0;)if(n=s[r],e===n.toLowerCase())return n;return null}const fe=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),me=t=>!M(t)&&t!==fe;function Y(){const{caseless:t}=me(this)&&this||{},e={},s=(r,n)=>{const i=t&&pe(e,n)||n;D(e[i])&&D(r)?e[i]=Y(e[i],r):D(r)?e[i]=Y({},r):N(r)?e[i]=r.slice():e[i]=r};for(let r=0,n=arguments.length;r<n;r++)arguments[r]&&k(arguments[r],s);return e}const rt=(t,e,s,{allOwnKeys:r}={})=>(k(e,(n,i)=>{s&&x(n)?t[i]=ce(n,s):t[i]=n},{allOwnKeys:r}),t),nt=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),it=(t,e,s,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),s&&Object.assign(t.prototype,s)},ot=(t,e,s,r)=>{let n,i,o;const u={};if(e=e||{},t==null)return e;do{for(n=Object.getOwnPropertyNames(t),i=n.length;i-- >0;)o=n[i],(!r||r(o,t,e))&&!u[o]&&(e[o]=t[o],u[o]=!0);t=s!==!1&&V(t)}while(t&&(!s||s(t,e))&&t!==Object.prototype);return e},at=(t,e,s)=>{t=String(t),(s===void 0||s>t.length)&&(s=t.length),s-=e.length;const r=t.indexOf(e,s);return r!==-1&&r===s},lt=t=>{if(!t)return null;if(N(t))return t;let e=t.length;if(!he(e))return null;const s=new Array(e);for(;e-- >0;)s[e]=t[e];return s},ut=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&V(Uint8Array)),ct=(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let n;for(;(n=r.next())&&!n.done;){const i=n.value;e.call(t,i[0],i[1])}},dt=(t,e)=>{let s;const r=[];for(;(s=t.exec(e))!==null;)r.push(s);return r},ht=A("HTMLFormElement"),pt=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(s,r,n){return r.toUpperCase()+n}),ye=(({hasOwnProperty:t})=>(e,s)=>t.call(e,s))(Object.prototype),ft=A("RegExp"),Se=(t,e)=>{const s=Object.getOwnPropertyDescriptors(t),r={};k(s,(n,i)=>{let o;(o=e(n,i,t))!==!1&&(r[i]=o||n)}),Object.defineProperties(t,r)},mt=t=>{Se(t,(e,s)=>{if(x(t)&&["arguments","caller","callee"].indexOf(s)!==-1)return!1;const r=t[s];if(x(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},yt=(t,e)=>{const s={},r=n=>{n.forEach(i=>{s[i]=!0})};return N(t)?r(t):r(String(t).split(e)),s},St=()=>{},vt=(t,e)=>(t=+t,Number.isFinite(t)?t:e),X="abcdefghijklmnopqrstuvwxyz",ve="0123456789",Re={DIGIT:ve,ALPHA:X,ALPHA_DIGIT:X+X.toUpperCase()+ve},Rt=(t=16,e=Re.ALPHA_DIGIT)=>{let s="";const{length:r}=e;for(;t--;)s+=e[Math.random()*r|0];return s};function gt(t){return!!(t&&x(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const xt=t=>{const e=new Array(10),s=(r,n)=>{if(q(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[n]=r;const i=N(r)?[]:{};return k(r,(o,u)=>{const h=s(o,n+1);!M(h)&&(i[u]=h)}),e[n]=void 0,i}}return r};return s(t,0)},At=A("AsyncFunction");var a={isArray:N,isArrayBuffer:de,isBuffer:ze,isFormData:et,isArrayBufferView:$e,isString:Ve,isNumber:he,isBoolean:Ye,isObject:q,isPlainObject:D,isUndefined:M,isDate:Xe,isFile:Ge,isBlob:Qe,isRegExp:ft,isFunction:x,isStream:Ke,isURLSearchParams:tt,isTypedArray:ut,isFileList:Ze,forEach:k,merge:Y,extend:rt,trim:st,stripBOM:nt,inherits:it,toFlatObject:ot,kindOf:I,kindOfTest:A,endsWith:at,toArray:lt,forEachEntry:ct,matchAll:dt,isHTMLForm:ht,hasOwnProperty:ye,hasOwnProp:ye,reduceDescriptors:Se,freezeMethods:mt,toObjectSet:yt,toCamelCase:pt,noop:St,toFiniteNumber:vt,findKey:pe,global:fe,isContextDefined:me,ALPHABET:Re,generateString:Rt,isSpecCompliantForm:gt,toJSONObject:xt,isAsyncFn:At,isThenable:t=>t&&(q(t)||x(t))&&x(t.then)&&x(t.catch)};function y(t,e,s,r,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),s&&(this.config=s),r&&(this.request=r),n&&(this.response=n)}a.inherits(y,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const ge=y.prototype,xe={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{xe[t]={value:t}}),Object.defineProperties(y,xe),Object.defineProperty(ge,"isAxiosError",{value:!0}),y.from=(t,e,s,r,n,i)=>{const o=Object.create(ge);return a.toFlatObject(t,o,function(h){return h!==Error.prototype},u=>u!=="isAxiosError"),y.call(o,t.message,e,s,r,n),o.cause=t,o.name=t.name,i&&Object.assign(o,i),o};var Ct=null;function G(t){return a.isPlainObject(t)||a.isArray(t)}function Ae(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function Ce(t,e,s){return t?t.concat(e).map(function(n,i){return n=Ae(n),!s&&i?"["+n+"]":n}).join(s?".":""):e}function Et(t){return a.isArray(t)&&!t.some(G)}const Tt=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function B(t,e,s){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,s=a.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,g){return!a.isUndefined(g[m])});const r=s.metaTokens,n=s.visitor||l,i=s.dots,o=s.indexes,h=(s.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(n))throw new TypeError("visitor must be a function");function p(d){if(d===null)return"";if(a.isDate(d))return d.toISOString();if(!h&&a.isBlob(d))throw new y("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(d)||a.isTypedArray(d)?h&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function l(d,m,g){let O=d;if(d&&!g&&typeof d=="object"){if(a.endsWith(m,"{}"))m=r?m:m.slice(0,-2),d=JSON.stringify(d);else if(a.isArray(d)&&Et(d)||(a.isFileList(d)||a.endsWith(m,"[]"))&&(O=a.toArray(d)))return m=Ae(m),O.forEach(function($,us){!(a.isUndefined($)||$===null)&&e.append(o===!0?Ce([m],us,i):o===null?m:m+"[]",p($))}),!1}return G(d)?!0:(e.append(Ce(g,m,i),p(d)),!1)}const f=[],v=Object.assign(Tt,{defaultVisitor:l,convertValue:p,isVisitable:G});function R(d,m){if(!a.isUndefined(d)){if(f.indexOf(d)!==-1)throw Error("Circular reference detected in "+m.join("."));f.push(d),a.forEach(d,function(O,T){(!(a.isUndefined(O)||O===null)&&n.call(e,O,a.isString(T)?T.trim():T,m,v))===!0&&R(O,m?m.concat(T):[T])}),f.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return R(t),e}function Ee(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Q(t,e){this._pairs=[],t&&B(t,this,e)}const Te=Q.prototype;Te.append=function(e,s){this._pairs.push([e,s])},Te.toString=function(e){const s=e?function(r){return e.call(this,r,Ee)}:Ee;return this._pairs.map(function(n){return s(n[0])+"="+s(n[1])},"").join("&")};function wt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function we(t,e,s){if(!e)return t;const r=s&&s.encode||wt,n=s&&s.serialize;let i;if(n?i=n(e,s):i=a.isURLSearchParams(e)?e.toString():new Q(e,s).toString(r),i){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class bt{constructor(){this.handlers=[]}use(e,s,r){return this.handlers.push({fulfilled:e,rejected:s,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(r){r!==null&&e(r)})}}var be=bt,Oe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ot=typeof URLSearchParams<"u"?URLSearchParams:Q,Pt=typeof FormData<"u"?FormData:null,Nt=typeof Blob<"u"?Blob:null;const _t=(()=>{let t;return typeof navigator<"u"&&((t=navigator.product)==="ReactNative"||t==="NativeScript"||t==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),Mt=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")();var C={isBrowser:!0,classes:{URLSearchParams:Ot,FormData:Pt,Blob:Nt},isStandardBrowserEnv:_t,isStandardBrowserWebWorkerEnv:Mt,protocols:["http","https","file","blob","url","data"]};function kt(t,e){return B(t,new C.classes.URLSearchParams,Object.assign({visitor:function(s,r,n,i){return C.isNode&&a.isBuffer(s)?(this.append(r,s.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function Lt(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Ft(t){const e={},s=Object.keys(t);let r;const n=s.length;let i;for(r=0;r<n;r++)i=s[r],e[i]=t[i];return e}function Pe(t){function e(s,r,n,i){let o=s[i++];const u=Number.isFinite(+o),h=i>=s.length;return o=!o&&a.isArray(n)?n.length:o,h?(a.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!u):((!n[o]||!a.isObject(n[o]))&&(n[o]=[]),e(s,r,n[o],i)&&a.isArray(n[o])&&(n[o]=Ft(n[o])),!u)}if(a.isFormData(t)&&a.isFunction(t.entries)){const s={};return a.forEachEntry(t,(r,n)=>{e(Lt(r),n,s,0)}),s}return null}function It(t,e,s){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(s||JSON.stringify)(t)}const Z={transitional:Oe,adapter:["xhr","http"],transformRequest:[function(e,s){const r=s.getContentType()||"",n=r.indexOf("application/json")>-1,i=a.isObject(e);if(i&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return n&&n?JSON.stringify(Pe(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return s.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let u;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return kt(e,this.formSerializer).toString();if((u=a.isFileList(e))||r.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return B(u?{"files[]":e}:e,h&&new h,this.formSerializer)}}return i||n?(s.setContentType("application/json",!1),It(e)):e}],transformResponse:[function(e){const s=this.transitional||Z.transitional,r=s&&s.forcedJSONParsing,n=this.responseType==="json";if(e&&a.isString(e)&&(r&&!this.responseType||n)){const o=!(s&&s.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(u){if(o)throw u.name==="SyntaxError"?y.from(u,y.ERR_BAD_RESPONSE,this,null,this.response):u}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:C.classes.FormData,Blob:C.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{Z.headers[t]={}});var K=Z;const Ut=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var qt=t=>{const e={};let s,r,n;return t&&t.split(` `).forEach(function(o){n=o.indexOf(":"),s=o.substring(0,n).trim().toLowerCase(),r=o.substring(n+1).trim(),!(!s||e[s]&&Ut[s])&&(s==="set-cookie"?e[s]?e[s].push(r):e[s]=[r]:e[s]=e[s]?e[s]+", "+r:r)}),e};const Ne=Symbol("internals");function L(t){return t&&String(t).trim().toLowerCase()}function j(t){return t===!1||t==null?t:a.isArray(t)?t.map(j):String(t)}function Dt(t){const e=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=s.exec(t);)e[r[1]]=r[2];return e}const Bt=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function ee(t,e,s,r,n){if(a.isFunction(r))return r.call(this,e,s);if(n&&(e=s),!!a.isString(e)){if(a.isString(r))return e.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(e)}}function jt(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,s,r)=>s.toUpperCase()+r)}function Wt(t,e){const s=a.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+s,{value:function(n,i,o){return this[r].call(this,e,n,i,o)},configurable:!0})})}class W{constructor(e){e&&this.set(e)}set(e,s,r){const n=this;function i(u,h,p){const l=L(h);if(!l)throw new Error("header name must be a non-empty string");const f=a.findKey(n,l);(!f||n[f]===void 0||p===!0||p===void 0&&n[f]!==!1)&&(n[f||h]=j(u))}const o=(u,h)=>a.forEach(u,(p,l)=>i(p,l,h));return a.isPlainObject(e)||e instanceof this.constructor?o(e,s):a.isString(e)&&(e=e.trim())&&!Bt(e)?o(qt(e),s):e!=null&&i(s,e,r),this}get(e,s){if(e=L(e),e){const r=a.findKey(this,e);if(r){const n=this[r];if(!s)return n;if(s===!0)return Dt(n);if(a.isFunction(s))return s.call(this,n,r);if(a.isRegExp(s))return s.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,s){if(e=L(e),e){const r=a.findKey(this,e);return!!(r&&this[r]!==void 0&&(!s||ee(this,this[r],r,s)))}return!1}delete(e,s){const r=this;let n=!1;function i(o){if(o=L(o),o){const u=a.findKey(r,o);u&&(!s||ee(r,r[u],u,s))&&(delete r[u],n=!0)}}return a.isArray(e)?e.forEach(i):i(e),n}clear(e){const s=Object.keys(this);let r=s.length,n=!1;for(;r--;){const i=s[r];(!e||ee(this,this[i],i,e,!0))&&(delete this[i],n=!0)}return n}normalize(e){const s=this,r={};return a.forEach(this,(n,i)=>{const o=a.findKey(r,i);if(o){s[o]=j(n),delete s[i];return}const u=e?jt(i):String(i).trim();u!==i&&delete s[i],s[u]=j(n),r[u]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const s=Object.create(null);return a.forEach(this,(r,n)=>{r!=null&&r!==!1&&(s[n]=e&&a.isArray(r)?r.join(", "):r)}),s}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,s])=>e+": "+s).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...s){const r=new this(e);return s.forEach(n=>r.set(n)),r}static accessor(e){const r=(this[Ne]=this[Ne]={accessors:{}}).accessors,n=this.prototype;function i(o){const u=L(o);r[u]||(Wt(n,o),r[u]=!0)}return a.isArray(e)?e.forEach(i):i(e),this}}W.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(W.prototype,({value:t},e)=>{let s=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[s]=r}}}),a.freezeMethods(W);var b=W;function te(t,e){const s=this||K,r=e||s,n=b.from(r.headers);let i=r.data;return a.forEach(t,function(u){i=u.call(s,i,n.normalize(),e?e.status:void 0)}),n.normalize(),i}function _e(t){return!!(t&&t.__CANCEL__)}function F(t,e,s){y.call(this,t??"canceled",y.ERR_CANCELED,e,s),this.name="CanceledError"}a.inherits(F,y,{__CANCEL__:!0});function Ht(t,e,s){const r=s.config.validateStatus;!s.status||!r||r(s.status)?t(s):e(new y("Request failed with status code "+s.status,[y.ERR_BAD_REQUEST,y.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))}var Jt=C.isStandardBrowserEnv?function(){return{write:function(s,r,n,i,o,u){const h=[];h.push(s+"="+encodeURIComponent(r)),a.isNumber(n)&&h.push("expires="+new Date(n).toGMTString()),a.isString(i)&&h.push("path="+i),a.isString(o)&&h.push("domain="+o),u===!0&&h.push("secure"),document.cookie=h.join("; ")},read:function(s){const r=document.cookie.match(new RegExp("(^|;\\s*)("+s+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(s){this.write(s,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function zt(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function $t(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}function Me(t,e){return t&&!zt(e)?$t(t,e):e}var Vt=C.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),s=document.createElement("a");let r;function n(i){let o=i;return e&&(s.setAttribute("href",o),o=s.href),s.setAttribute("href",o),{href:s.href,protocol:s.protocol?s.protocol.replace(/:$/,""):"",host:s.host,search:s.search?s.search.replace(/^\?/,""):"",hash:s.hash?s.hash.replace(/^#/,""):"",hostname:s.hostname,port:s.port,pathname:s.pathname.charAt(0)==="/"?s.pathname:"/"+s.pathname}}return r=n(window.location.href),function(o){const u=a.isString(o)?n(o):o;return u.protocol===r.protocol&&u.host===r.host}}():function(){return function(){return!0}}();function Yt(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Xt(t,e){t=t||10;const s=new Array(t),r=new Array(t);let n=0,i=0,o;return e=e!==void 0?e:1e3,function(h){const p=Date.now(),l=r[i];o||(o=p),s[n]=h,r[n]=p;let f=i,v=0;for(;f!==n;)v+=s[f++],f=f%t;if(n=(n+1)%t,n===i&&(i=(i+1)%t),p-o<e)return;const R=l&&p-l;return R?Math.round(v*1e3/R):void 0}}function ke(t,e){let s=0;const r=Xt(50,250);return n=>{const i=n.loaded,o=n.lengthComputable?n.total:void 0,u=i-s,h=r(u),p=i<=o;s=i;const l={loaded:i,total:o,progress:o?i/o:void 0,bytes:u,rate:h||void 0,estimated:h&&o&&p?(o-i)/h:void 0,event:n};l[e?"download":"upload"]=!0,t(l)}}var Gt=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(s,r){let n=t.data;const i=b.from(t.headers).normalize(),o=t.responseType;let u;function h(){t.cancelToken&&t.cancelToken.unsubscribe(u),t.signal&&t.signal.removeEventListener("abort",u)}let p;a.isFormData(n)&&(C.isStandardBrowserEnv||C.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.getContentType(/^\s*multipart\/form-data/)?a.isString(p=i.getContentType())&&i.setContentType(p.replace(/^\s*(multipart\/form-data);+/,"$1")):i.setContentType("multipart/form-data"));let l=new XMLHttpRequest;if(t.auth){const d=t.auth.username||"",m=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.set("Authorization","Basic "+btoa(d+":"+m))}const f=Me(t.baseURL,t.url);l.open(t.method.toUpperCase(),we(f,t.params,t.paramsSerializer),!0),l.timeout=t.timeout;function v(){if(!l)return;const d=b.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),g={data:!o||o==="text"||o==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:d,config:t,request:l};Ht(function(T){s(T),h()},function(T){r(T),h()},g),l=null}if("onloadend"in l?l.onloadend=v:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(v)},l.onabort=function(){l&&(r(new y("Request aborted",y.ECONNABORTED,t,l)),l=null)},l.onerror=function(){r(new y("Network Error",y.ERR_NETWORK,t,l)),l=null},l.ontimeout=function(){let m=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const g=t.transitional||Oe;t.timeoutErrorMessage&&(m=t.timeoutErrorMessage),r(new y(m,g.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,t,l)),l=null},C.isStandardBrowserEnv){const d=(t.withCredentials||Vt(f))&&t.xsrfCookieName&&Jt.read(t.xsrfCookieName);d&&i.set(t.xsrfHeaderName,d)}n===void 0&&i.setContentType(null),"setRequestHeader"in l&&a.forEach(i.toJSON(),function(m,g){l.setRequestHeader(g,m)}),a.isUndefined(t.withCredentials)||(l.withCredentials=!!t.withCredentials),o&&o!=="json"&&(l.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&l.addEventListener("progress",ke(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",ke(t.onUploadProgress)),(t.cancelToken||t.signal)&&(u=d=>{l&&(r(!d||d.type?new F(null,t,l):d),l.abort(),l=null)},t.cancelToken&&t.cancelToken.subscribe(u),t.signal&&(t.signal.aborted?u():t.signal.addEventListener("abort",u)));const R=Yt(f);if(R&&C.protocols.indexOf(R)===-1){r(new y("Unsupported protocol "+R+":",y.ERR_BAD_REQUEST,t));return}l.send(n||null)})};const se={http:Ct,xhr:Gt};a.forEach(se,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Le=t=>`- ${t}`,Qt=t=>a.isFunction(t)||t===null||t===!1;var Fe={getAdapter:t=>{t=a.isArray(t)?t:[t];const{length:e}=t;let s,r;const n={};for(let i=0;i<e;i++){s=t[i];let o;if(r=s,!Qt(s)&&(r=se[(o=String(s)).toLowerCase()],r===void 0))throw new y(`Unknown adapter '${o}'`);if(r)break;n[o||"#"+i]=r}if(!r){const i=Object.entries(n).map(([u,h])=>`adapter ${u} `+(h===!1?"is not supported by the environment":"is not available in the build"));let o=e?i.length>1?`since : `+i.map(Le).join(` `):" "+Le(i[0]):"as no adapter specified";throw new y("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:se};function re(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new F(null,t)}function Ie(t){return re(t),t.headers=b.from(t.headers),t.data=te.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Fe.getAdapter(t.adapter||K.adapter)(t).then(function(r){return re(t),r.data=te.call(t,t.transformResponse,r),r.headers=b.from(r.headers),r},function(r){return _e(r)||(re(t),r&&r.response&&(r.response.data=te.call(t,t.transformResponse,r.response),r.response.headers=b.from(r.response.headers))),Promise.reject(r)})}const Ue=t=>t instanceof b?t.toJSON():t;function _(t,e){e=e||{};const s={};function r(p,l,f){return a.isPlainObject(p)&&a.isPlainObject(l)?a.merge.call({caseless:f},p,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function n(p,l,f){if(a.isUndefined(l)){if(!a.isUndefined(p))return r(void 0,p,f)}else return r(p,l,f)}function i(p,l){if(!a.isUndefined(l))return r(void 0,l)}function o(p,l){if(a.isUndefined(l)){if(!a.isUndefined(p))return r(void 0,p)}else return r(void 0,l)}function u(p,l,f){if(f in e)return r(p,l);if(f in t)return r(void 0,p)}const h={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:u,headers:(p,l)=>n(Ue(p),Ue(l),!0)};return a.forEach(Object.keys(Object.assign({},t,e)),function(l){const f=h[l]||n,v=f(t[l],e[l],l);a.isUndefined(v)&&f!==u||(s[l]=v)}),s}const qe="1.5.1",ne={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{ne[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const De={};ne.transitional=function(e,s,r){function n(i,o){return"[Axios v"+qe+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,u)=>{if(e===!1)throw new y(n(o," has been removed"+(s?" in "+s:"")),y.ERR_DEPRECATED);return s&&!De[o]&&(De[o]=!0,console.warn(n(o," has been deprecated since v"+s+" and will be removed in the near future"))),e?e(i,o,u):!0}};function Zt(t,e,s){if(typeof t!="object")throw new y("options must be an object",y.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let n=r.length;for(;n-- >0;){const i=r[n],o=e[i];if(o){const u=t[i],h=u===void 0||o(u,i,t);if(h!==!0)throw new y("option "+i+" must be "+h,y.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new y("Unknown option "+i,y.ERR_BAD_OPTION)}}var ie={assertOptions:Zt,validators:ne};const P=ie.validators;class H{constructor(e){this.defaults=e,this.interceptors={request:new be,response:new be}}request(e,s){typeof e=="string"?(s=s||{},s.url=e):s=e||{},s=_(this.defaults,s);const{transitional:r,paramsSerializer:n,headers:i}=s;r!==void 0&&ie.assertOptions(r,{silentJSONParsing:P.transitional(P.boolean),forcedJSONParsing:P.transitional(P.boolean),clarifyTimeoutError:P.transitional(P.boolean)},!1),n!=null&&(a.isFunction(n)?s.paramsSerializer={serialize:n}:ie.assertOptions(n,{encode:P.function,serialize:P.function},!0)),s.method=(s.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[s.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),s.headers=b.concat(o,i);const u=[];let h=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(s)===!1||(h=h&&m.synchronous,u.unshift(m.fulfilled,m.rejected))});const p=[];this.interceptors.response.forEach(function(m){p.push(m.fulfilled,m.rejected)});let l,f=0,v;if(!h){const d=[Ie.bind(this),void 0];for(d.unshift.apply(d,u),d.push.apply(d,p),v=d.length,l=Promise.resolve(s);f<v;)l=l.then(d[f++],d[f++]);return l}v=u.length;let R=s;for(f=0;f<v;){const d=u[f++],m=u[f++];try{R=d(R)}catch(g){m.call(this,g);break}}try{l=Ie.call(this,R)}catch(d){return Promise.reject(d)}for(f=0,v=p.length;f<v;)l=l.then(p[f++],p[f++]);return l}getUri(e){e=_(this.defaults,e);const s=Me(e.baseURL,e.url);return we(s,e.params,e.paramsSerializer)}}a.forEach(["delete","get","head","options"],function(e){H.prototype[e]=function(s,r){return this.request(_(r||{},{method:e,url:s,data:(r||{}).data}))}}),a.forEach(["post","put","patch"],function(e){function s(r){return function(i,o,u){return this.request(_(u||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}H.prototype[e]=s(),H.prototype[e+"Form"]=s(!0)});var J=H;class oe{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(i){s=i});const r=this;this.promise.then(n=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](n);r._listeners=null}),this.promise.then=n=>{let i;const o=new Promise(u=>{r.subscribe(u),i=u}).then(n);return o.cancel=function(){r.unsubscribe(i)},o},e(function(i,o,u){r.reason||(r.reason=new F(i,o,u),s(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const s=this._listeners.indexOf(e);s!==-1&&this._listeners.splice(s,1)}static source(){let e;return{token:new oe(function(n){e=n}),cancel:e}}}var Kt=oe;function es(t){return function(s){return t.apply(null,s)}}function ts(t){return a.isObject(t)&&t.isAxiosError===!0}const ae={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ae).forEach(([t,e])=>{ae[e]=t});var ss=ae;function Be(t){const e=new J(t),s=ce(J.prototype.request,e);return a.extend(s,J.prototype,e,{allOwnKeys:!0}),a.extend(s,e,null,{allOwnKeys:!0}),s.create=function(n){return Be(_(t,n))},s}const S=Be(K);S.Axios=J,S.CanceledError=F,S.CancelToken=Kt,S.isCancel=_e,S.VERSION=qe,S.toFormData=B,S.AxiosError=y,S.Cancel=S.CanceledError,S.all=function(e){return Promise.all(e)},S.spread=es,S.isAxiosError=ts,S.mergeConfig=_,S.AxiosHeaders=b,S.formToJSON=t=>Pe(a.isHTMLForm(t)?new FormData(t):t),S.getAdapter=Fe.getAdapter,S.HttpStatusCode=ss,S.default=S;var rs=S;const le=rs.create({timeout:1e4,headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:"0"}});le.interceptors.request.use(t=>t,t=>Promise.reject(t)),le.interceptors.response.use(t=>t,t=>Promise.reject(t));const je={hello:"/hello",version:"/version",getActiveInfo:"/getActiveInfo",getDeviceId:"/getDeviceId",screenInfo:"/screenInfo",getSystemInfo:"/getSystemInfo",screenJson:"/screenJson",screenXml:"/screenXml",screenShotBase64:"/screenShotBase64",screenShot:"/screenShot",screenRotation:"/screenRotation",getAllContact:"/getAllContact",deleteContact:"/deleteContact",getClipText:"/getClipText",clearText:"/clearText",startRecoreScreen:"/startRecoreScreen",stopRecoreScreen:"/stopRecoreScreen",turnScreenOff:"/turnScreenOff",turnScreenOn:"/turnScreenOn",exit:"/exit",checkNotification:"/checkNotification",getIp:"/getIp",getAllSms:"/getAllSms",deleteSms:"/deleteSms",download:"/download",getDisplayName:"/getDisplayName",getTopActivity:"/getTopActivity",getStartActivity:"/getStartActivity",startPackage:"/startPackage",stopPackage:"/stopPackage",clearPackage:"/clearPackage",getAllPackage:"/getAllPackage",getPackageInfo:"/getPackageInfo",stopMusic:"/stopMusic",cancelAllNotifications:"/cancelAllNotifications",callPhone:"/callPhone",endCall:"/endCall",stopAllScript:"/stopAllScript",turnSafeModeOn:"/turnSafeModeOn",turnSafeModeOff:"/turnSafeModeOff",isSafeMode:"/isSafeMode",upload:"/upload",active:"/active",inputText:"/inputText",execCmd:"/execCmd",inputChar:"/inputChar",pressKeyCode:"/pressKeyCode",insertContact:"/insertContact",click:"/click",longClick:"/longClick",press:"/press",swipe:"/swipe",gestures:"/gestures",gesture:"/gesture",emptyDir:"/emptyDir",delFile:"/delFile",sendSms:"/sendSms",listFile:"/listFile",setDisplayName:"/setDisplayName",playMusic:"/playMusic",execScript:"/execScript",setClipText:"/setClipText"};class ns{constructor(e,s=!1){this.urlMap={},this.baseUrl=e,this.isSsl=s,this.initUrlMap()}initUrlMap(){let e=this.isSsl?"https://":"http://";Object.keys(je).forEach(s=>{this.urlMap[s]=`${e}${this.baseUrl}/api${je[s]}`})}addErrorListener(e){this.mErrorListener=e}_request(e){return c(this,void 0,void 0,function*(){const s=yield le(e);return s.data.code===0&&this.mErrorListener&&this.mErrorListener(s.data.msg),s})}hello(e=null){return this._request({url:this.urlMap.hello,method:"get",params:e})}version(e=null){return this._request({url:this.urlMap.version,method:"get",params:e})}getActiveInfo(e=null){return this._request({url:this.urlMap.getActiveInfo,method:"get",params:e})}getDeviceId(e=null){return this._request({url:this.urlMap.getDeviceId,method:"get",params:e})}screenInfo(e=null){return this._request({url:this.urlMap.screenInfo,method:"get",params:e})}getSystemInfo(e=null){return this._request({url:this.urlMap.getSystemInfo,method:"get",params:e})}screenJson(e=null){return this._request({url:this.urlMap.screenJson,method:"get",params:e})}screenXml(e=null){return this._request({url:this.urlMap.screenXml,method:"get",params:e})}screenShotBase64(e=null){return this._request({url:this.urlMap.screenShotBase64,method:"get",params:e})}screenShot(e=null){return this._request({url:this.urlMap.screenShot,method:"get",params:e,responseType:"arraybuffer"})}screenRotation(e=null){return this._request({url:this.urlMap.screenRotation,method:"get",params:e})}getAllContact(e){return this._request({url:this.urlMap.getAllContact,method:"get",params:e})}deleteContact(e){return this._request({url:this.urlMap.deleteContact,method:"get",params:e})}getClipText(e=null){return this._request({url:this.urlMap.getClipText,method:"get",params:e})}clearText(e=null){return this._request({url:this.urlMap.clearText,method:"get",params:e})}startRecoreScreen(e=null){return this._request({url:this.urlMap.startRecoreScreen,method:"get",params:e})}stopRecoreScreen(e=null){return this._request({url:this.urlMap.stopRecoreScreen,method:"get",params:e})}turnScreenOff(e=null){return this._request({url:this.urlMap.turnScreenOff,method:"get",params:e})}turnScreenOn(e=null){return this._request({url:this.urlMap.turnScreenOn,method:"get",params:e})}exit(e){return this._request({url:this.urlMap.exit,method:"get",params:e})}checkNotification(e=null){return this._request({url:this.urlMap.checkNotification,method:"get",params:e})}getIp(e=null){return this._request({url:this.urlMap.getIp,method:"get",params:e})}getAllSms(e=null){return this._request({url:this.urlMap.getAllSms,method:"get",params:e})}deleteSms(e=null){return this._request({url:this.urlMap.deleteSms,method:"get",params:e})}download(e=null){return this._request({url:this.urlMap.download,method:"get",params:e})}downloadUrl(){return this.urlMap.download}getDisplayName(e=null){return this._request({url:this.urlMap.getDisplayName,method:"get",params:e})}getTopActivity(e=null){return this._request({url:this.urlMap.getTopActivity,method:"get",params:e})}getStartActivity(e=null){return this._request({url:this.urlMap.getStartActivity,method:"get",params:e})}startPackage(e=null){return this._request({url:this.urlMap.startPackage,method:"get",params:e})}stopPackage(e=null){return this._request({url:this.urlMap.stopPackage,method:"get",params:e})}clearPackage(e=null){return this._request({url:this.urlMap.clearPackage,method:"get",params:e})}getAllPackage(e=null){return this._request({url:this.urlMap.getAllPackage,method:"get",params:e})}getPackageInfo(e=null){return this._request({url:this.urlMap.getPackageInfo,method:"get",params:e})}stopMusic(e=null){return this._request({url:this.urlMap.stopMusic,method:"get",params:e})}cancelAllNotifications(e=null){return this._request({url:this.urlMap.cancelAllNotifications,method:"get",params:e})}callPhone(e=null){return this._request({url:this.urlMap.callPhone,method:"get",params:e})}endCall(e=null){return this._request({url:this.urlMap.endCall,method:"get",params:e})}stopAllScript(e=null){return this._request({url:this.urlMap.stopAllScript,method:"get",params:e})}turnSafeModeOn(e=null){return this._request({url:this.urlMap.turnSafeModeOn,method:"get",params:e})}turnSafeModeOff(e=null){return this._request({url:this.urlMap.turnSafeModeOff,method:"get",params:e})}isSafeMode(e=null){return this._request({url:this.urlMap.isSafeMode,method:"get",params:e})}upload(e,s={}){return this._request(Object.assign({url:this.urlMap.upload,method:"post",data:e,timeout:5*60*1e3},s))}uploadUrl(){return this.urlMap.upload}active(e){return this._request({url:this.urlMap.active,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}inputText(e){return this._request({url:this.urlMap.inputText,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}execCmd(e){return this._request({timeout:e.timeout*1e3+1e3,url:this.urlMap.execCmd,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}inputChar(e){return this._request({url:this.urlMap.inputChar,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}pressKeyCode(e){return this._request({url:this.urlMap.pressKeyCode,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}insertContact(e){return this._request({url:this.urlMap.insertContact,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}click(e){return this._request({url:this.urlMap.click,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}longClick(e){return this._request({url:this.urlMap.longClick,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}press(e){return this._request({url:this.urlMap.press,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}swipe(e){return this._request({url:this.urlMap.swipe,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}gestures(e){return this._request({url:this.urlMap.gestures,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}gesture(e){return this._request({url:this.urlMap.gesture,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}emptyDir(e){return this._request({url:this.urlMap.emptyDir,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}delFile(e){return this._request({url:this.urlMap.delFile,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}sendSms(e=null){return this._request({url:this.urlMap.sendSms,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}listFile(e){return this._request({url:this.urlMap.listFile,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}setDisplayName(e){return this._request({url:this.urlMap.setDisplayName,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}playMusic(e){return this._request({url:this.urlMap.playMusic,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}execScript(e=null){return this._request({url:this.urlMap.execScript,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}setClipText(e=null){return this._request({url:this.urlMap.setClipText,headers:{"Content-Type":"application/json;charset=UTF-8"},method:"post",data:e})}}class We{constructor(e){this.mRotation=Number(e)}isLandscape(){return this.mRotation==1||this.mRotation==3}}class He{constructor(e){this.width=e.width,this.height=e.height,this.rotation=e.rotation,this.mRotation=new We(this.rotation)}isLandscape(){return this.mRotation.isLandscape()}}class is{constructor(e){this.shortClassName=e.shortClassName,this.className=e.className,this.main=e.main,this.packageName=e.packageName,this.startPath=`${e.packageName}/${e.shortClassName}`}}class ue{constructor(e){this.isFile=e.isFile,this.name=e.name,this.path=e.path,this.size=e.size,this.isRead=e.isRead,this.isWrite=e.isWrite,this.isExecute=e.isExecute,this.lastModified=e.lastModified}static convertFileItem(e){return e.map(s=>new ue(s))}}function z(t=30){return new Promise(e=>{setTimeout(e,t)})}var E;(function(t){t[t.STREAM_TYPE_INITIATIVE=1]="STREAM_TYPE_INITIATIVE",t[t.STREAM_TYPE_PASSIVE=2]="STREAM_TYPE_PASSIVE",t[t.STREAM_TYPE_STOP=0]="STREAM_TYPE_STOP"})(E||(E={}));class os{constructor(e,s=!1){this.isConnected=!1,this.isRetury=!1,this.isPassiveReceive=!1,this.isStartScreenStream=!1,this.mSale=1,this.mQuality=50,this.mFps=50,this.mRetryNumber=6,this.mCurrentState=E.STREAM_TYPE_STOP;let r=s?"wss://":"ws://";this.url=`${r}${e}/api/screen`}addErrorListener(e){this.mErrorListener=e}addCloseListener(e){this.mCloseListener=e}onError(e){this.mErrorListener&&this.mErrorListener(e)}onClose(e){this.mCloseListener&&this.mCloseListener(e)}setWebSocktClient(e){this.mWs=e.createWebSocket(this.url),this.mWs.addOnOpenListener(this),this.mWs.addOnCloseListener(this),this.mWs.addOnMessageListener(this),this.mWs.addOnErrorListener(this)}setRetryNumber(e){this.mRetryNumber=e}checkClientIsNull(){if(!this.mWs)throw new Error("\u8BF7\u5148\u8C03\u7528setWebSocktClient\u65B9\u6CD5\uFF0C\u8BBE\u7F6E\u5F53\u524D\u73AF\u5883\u7684websocket Client")}buildPara(e){return JSON.stringify(e)}send(e){try{this.mWs.send(this.buildPara(e))}catch(s){console.warn(s)}}waitForConnect(e=5){return c(this,void 0,void 0,function*(){let s=e*1e3,r=0;for(;!(r>s||this.isConnected);)yield z(1e3),r+=1e3;if(!this.isConnected)throw this.onError("\u8FDE\u63A5\u5931\u8D25"),new Error("\u8FDE\u63A5\u5931\u8D25")})}resetScreenStream(){return c(this,void 0,void 0,function*(){this.checkClientIsNull(),this.send({action:101}),this.isStartScreenStream=!1,this.mCurrentState=E.STREAM_TYPE_STOP,this.isPassiveReceive=!0,yield z(this.mFps+200)})}startScreenStream(e=1,s=50,r=50){return c(this,void 0,void 0,function*(){yield this.waitForConnect(),this.setScreenStreamConfig(e,s,r),yield this.resetScreenStream(),this.mCurrentState=E.STREAM_TYPE_INITIATIVE,this.send({action:100})})}startScreenStreamByPassive(e=1,s=50,r=50){return c(this,void 0,void 0,function*(){yield this.waitForConnect(),this.setScreenStreamConfig(e,s,r),yield this.resetScreenStream(),this.isStartScreenStream=!0,this.mCurrentState=E.STREAM_TYPE_PASSIVE,this.startRefreshScreenByPassive()})}startRefreshScreenByPassive(){return c(this,void 0,void 0,function*(){let e=0;for(;this.isConnected&&this.isStartScreenStream;)this.isPassiveReceive||e>5?(e=0,this.isPassiveReceive=!1,this.send({action:103})):e++,yield z(this.mFps)})}setScreenStreamConfig(e=1,s=50,r=50){this.mSale=e,this.mQuality=s,this.mFps=r,this.checkClientIsNull(),this.send({action:102,scale:e,quality:s,fps:r})}stopScreenStream(){this.checkClientIsNull(),this.send({action:101}),this.isStartScreenStream=!1,this.mCurrentState=E.STREAM_TYPE_STOP}sendTouchDown(e,s){this.checkClientIsNull(),this.send({action:1,touch_event:0,x:e,y:s})}sendTouchMove(e,s){this.checkClientIsNull(),this.send({action:1,touch_event:2,x:e,y:s})}sendTouchUp(e,s){this.checkClientIsNull(),this.send({action:1,touch_event:1,x:e,y:s})}pressKeyCode(e){this.checkClientIsNull(),this.send({action:4,value:e})}sendSpaceKey(){this.pressKeyCode(62)}sendBackSpaceKey(){this.pressKeyCode(67)}sendEnterKey(){this.pressKeyCode(66)}sendCtrlA(){this.checkClientIsNull(),this.send({action:5})}sendInputText(e){this.checkClientIsNull(),this.send({action:2,value:e})}sendInputChar(e){this.checkClientIsNull(),this.send({action:3,value:e})}startHeartBeat(){return c(this,void 0,void 0,function*(){for(;this.isConnected;){try{this.mWs.send("")}catch{}yield z(500)}})}reStoreState(){this.mCurrentState==E.STREAM_TYPE_INITIATIVE?this.startScreenStream(this.mSale,this.mQuality,this.mFps):this.mCurrentState==E.STREAM_TYPE_PASSIVE&&this.startScreenStreamByPassive(this.mSale,this.mQuality,this.mFps)}retry(){return c(this,void 0,void 0,function*(){if(!this.isRetury){this.isRetury=!0;for(let e=0;e<this.mRetryNumber;e++){console.log(`\u610F\u5916\u65AD\u5F00\uFF0C\u6B63\u5728\u8FDB\u884C\u7B2C${e}\u6B21\u91CD\u8BD5`),this.mWs.distory(),this.setWebSocktClient(this.mWs);try{yield this.waitForConnect(),console.log("\u91CD\u8FDE\u6210\u529F"),this.isRetury=!1,this.reStoreState();return}catch{continue}}console.log("\u91CD\u8BD5\u5931\u8D25\uFF0C\u5C06\u8FDB\u884C\u9500\u6BC1"),this.destory()}})}onclose(e){this.isConnected=!1,this.onClose(e),console.log("websocket \u5173\u95ED")}onerror(e){this.onError("websocket \u51FA\u9519\uFF1A"+e.message),console.log("websocket \u51FA\u9519",e),this.retry()}addScreenOrentationChangeListener(e){this.mOrentationChangeListenr=e}addNotificationChangeListener(e){this.mNotificationChangeListenr=e}addScreenChangeListener(e){this.mScreenChangeListenr=e}addClipTextChangeListener(e){this.mClipTextChangeListenr=e}onmessage(e){if(typeof e.data=="string"){let{action:s,value:r}=JSON.parse(e.data);switch(s){case 1:let n=new He(r);this.onScreenOrentationChange(n);break;case 2:this.onNotificationChange(r);break;case 3:this.onClipTextChange(r);break}}else this.isPassiveReceive=!0,this.onScreenChange(e.data)}onNotificationChange(e){this.mNotificationChangeListenr&&this.mNotificationChangeListenr(e)}onClipTextChange(e){this.mClipTextChangeListenr&&this.mClipTextChangeListenr(e)}onScreenOrentationChange(e){this.mOrentationChangeListenr&&this.mOrentationChangeListenr(e.width,e.height,e.rotation,e.isLandscape())}onScreenChange(e){if(this.mScreenChangeListenr){if(e instanceof ArrayBuffer)try{e=new Blob([e])}catch{}this.mScreenChangeListenr(e)}}onopen(){this.isConnected=!0,this.startHeartBeat()}destory(){if(this.isRetury=!1,this.isConnected=!1,this.mOrentationChangeListenr=null,this.mScreenChangeListenr=null,this.mNotificationChangeListenr=null,this.mCurrentState=E.STREAM_TYPE_STOP,this.mWs)try{this.mWs.distory()}catch{}}}class as{constructor(e,s=!1){this.url=e,this.serverApi=new ns(e,s),this.mScreenControl=new os(e,s),this.init()}addErrorListener(e){this.mErrorListener=e,this.serverApi.addErrorListener(e),this.mScreenControl.addErrorListener(e)}setWebSocketClient(e){this.mScreenControl.setWebSocktClient(e)}init(){return c(this,void 0,void 0,function*(){try{this.deviceId=yield this.getDeviceId()}catch{this.deviceId=""}try{this.displayName=yield this.getDisplayName()}catch{this.displayName=""}})}hello(){return c(this,void 0,void 0,function*(){try{return!!(yield this.serverApi.hello(null)).data}catch{return!1}})}version(){return c(this,void 0,void 0,function*(){return(yield this.serverApi.version(null)).data})}getActiveInfo(){return c(this,void 0,void 0,function*(){return(yield this.serverApi.getActiveInfo(null)).data.data})}getDeviceId(){return c(this,void 0,void 0,function*(){return(yield this.serverApi.getDeviceId(null)).data.data})}startRecoreScreen(e){return c(this,void 0,void 0,function*(){return(yield this.serverApi.startRecoreScreen({limit:e})).data.data=="1"})}stopRecoreScreen(){return c(this,void 0,void 0,function*(){return(yield this.serverApi.stopRecoreScreen(null)).data.data=="1"})}screenInfo(){return c(this,void 0,void 0,function*(){let e=yield this.serverApi.screenInfo(null);return new He(e.data.data)})}getSystemInfo(){return c(this,void 0,void 0,function*(){return(yield this.serverApi.getSystemInfo(null)).data.data})}screenJson(e=!1){return c(this,void 0,void 0,function*(){return(yield this.serverApi.screenJson({isWait:e?1:0})).data.data})}screenXml(e=!1){return c(this,void 0,void 0,function*(){return(yield this.serverApi.screenXml({isWait:e?1:0})).data.data})}screenShotBase64(){return c(this,void 0,void 0,function*(){return(yield this.serverApi.screenShotBase64(null)).data.data})}screenShot(){return c(this,void 0,void 0,function*(){return(yield this.serverApi.screenShot(null)).data})}screenRotation(){return c(this,void 0,void 0,function*(){let e=yield this.serverApi.screenRotation(null);return new We(e.data.data)})}getAllContact(e="*"){return c(this,void 0,void 0,function*(){return(yield this.serverApi.getAllContact({number:e})).data.data})}deleteContact(e){return c(this,void 0,void 0,function*(){let s=yield this.serverApi.deleteContact({number:e});return Number(s.data.data)})}getClipText(){return c(this,void 0,void 0,function*(){return(yield this.serverApi.getClipText()).data.data})}clearText(){return c(this,void 0,void 0,function*(){return(yield this.serverApi.clearText()).data.data=="1"})}turnScreenOff(){return c(this,void 0,void 0,function*(){return(yield this.serverApi.turnScreenOff()).data.data=="1"})}turnScreenOn(){return c(this,void 0,void 0,function*(){return(yield this.serverApi.turnScreenOn()).data.data=="1"})}exit(){return c(this,void 0,void 0,function*(){try{yield this.serverApi.exit(null)}catch{}})}checkNotification(){return c(this,void 0,void 0,function*(){return(yield this.serverApi.checkNotification(null)).data.data=="1"})}getIp(){return c(this,void 0,void 0,function*(){return(yield this.serverApi.getIp(null)).data.data})}getAllSms(e="*"){return c(this,void 0,void 0,function*(){return(yield this.serverApi.getAllSms({number:e})).data.data})}deleteSms(e="*"){return c(this,void 0,void 0,function*(){let s=yield this.serverApi.deleteSms({number:e});return Number(s.data.data)})}download(e,s){return c(this,void 0,void 0,function*(){return(yield this.serverApi.download(null)).data.data})}downloadUrl(e){return this.serverApi.downloadUrl()+"?path="+encodeURIComponent(e)}getDisplayName(){return c(this,void 0,void 0,function*(){return(yield this.serverApi.getDisplayName(null)).data.data})}getTopActivity(){return c(this,void 0,void 0,function*(){let e=yield this.serverApi.getTopActivity(null);return new is(e.data.data)})}getStartActivity(e){return c(this,void 0,void 0,function*(){return(yield this.serverApi.getStartActivity({packageName:e})).data.data})}startPackage(e){return c(this,void 0,void 0,function*(){return(yield this.serverApi.startPackage({packageName:e})).data.data=="1"})}stopPackage(e){return c(this,void 0,void 0,function*(){return(yield this.serverApi.stopPackage({packageName:e})).data.data=="1"})}clearPackage(e){return c(this,void 0,void 0,function*(){return(yield this.serverApi.clearPackage({packageName:e})).data.data=="1"})}getAllPackage(){return c(this,void 0,void 0,function*(){retur