!function(e,n){"object"==typeofexports&&"undefined"!=typeofmodule?n():"function"==typeofdefine&&define.amd?define(n):n()}(0,function(){"use strict";functione(e){varn=this.constructor;returnthis.then(function(t){returnn.resolve(e()).then(function(){returnt})},function(t){returnn.resolve(e()).then(function(){returnn.reject(t)})})}functionn(e){return!(!e||"undefined"==typeofe.length)}functiont(){}functiono(e){if(!(thisinstanceofo))thrownewTypeError("Promises must be constructed via new");if("function"!=typeofe)thrownewTypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],c(e,this)}functionr(e,n){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,o._immediateFn(function(){vart=1===e._state?n.onFulfilled:n.onRejected;if(null!==t){varo;try{o=t(e._value)}catch(r){returnvoidf(n.promise,r)}i(n.promise,o)}else(1===e._state?i:f)(n.promise,e._value)})):e._deferreds.push(n)}functioni(e,n){try{if(n===e)thrownewTypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeofn||"function"==typeofn)){vart=n.then;if(ninstanceofo)returne._state=3,e._value=n,voidu(e);if("function"==typeoft)returnvoidc(function(e,n){returnfunction(){e.apply(n,arguments)}}(t,n),e)}e._state=1,e._value=n,u(e)}catch(r){f(e,r)}}functionf(e,n){e._state=2,e._value=n,u(e)}functionu(e){2===e._state&&0===e._deferreds.length&&o._immediateFn(function(){e._handled||o._unhandledRejectionFn(e._value)});for(varn=0,t=e._deferreds.length;t>n;n++)r(e,e._deferreds[n]);e._deferreds=null}functionc(e,n){vart=!1;try{e(function(e){t||(t=!0,i(n,e))},function(e){t||(t=!0,f(n,e))})}catch(o){if(t)return;t=!0,f(n,o)}}vara=setTimeout;o.prototype["catch"]=function(e){returnthis.then(null,e)},o.prototype.then=function(e,n){varo=newthis.constructor(t);returnr(this,newfunction(e,n,t){this.onFulfilled="function"==typeofe?e:null,this.onRejected="function"==typeofn?n:null,this.promise=t}(e,n,o)),o},o.prototype["finally"]=e,o.all=function(e){returnnewo(function(t,o){functionr(e,n){try{if(n&&("object"==typeofn||"function"==typeofn)){varu=n.then;if("function"==typeofu)returnvoidu.call(n,function(n){r(e,n)},o)}i[e]=n,0==--f&&t(i)}catch(c){o(c)}}if(!n(e))returno(newTypeError("Promise.all accepts an array"));vari=Array.prototype.slice.call(e);if(0===i.length)returnt([]);for(varf=i.length,u=0;i.length>u;u++)r(u,i[u])})},o.resolve=function(e){returne&&"object"==typeofe&&e.constructor===o?e:newo(function(n){n(e)})},o.reject=function(e){returnnewo(function(n,t){t(e)})},o.race=function(e){returnnewo(function(t,r){if(!n(e))returnr(newTypeError("Promise.race accepts an array"));for(vari=0,f=e.length;f>i;i++)o.resolve(e[i]).then(t,r)})},o._immediateFn="function"==typeofsetImmediate&&function(e){setImmediate(e)}||function(e){a(e,0)},o._unhandledRejectionFn=function(e){void0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};varl=function(){if("undefined"!=typeofself)returnself;if("undefined"!=typeofwindow)returnwindow;if("undefined"!=typeofglobal)returnglobal;throwError("unable to locate global object")}();"Promise"inl?l.Promise.prototype["finally"]||(l.Promise.prototype["finally"]=e):l.Promise=o});
functione(){for(vare=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;varr=Array(e),o=0;for(t=0;t<n;t++)for(vari=arguments[t],u=0,c=i.length;u<c;u++,o++)r[o]=i[u];returnr}!function(e,t){"object"==typeofexports&&"undefined"!=typeofmodule?t():"function"==typeofdefine&&define.amd?define(t):t()}(0,(function(){functione(e){vart=this.constructor;returnthis.then((function(n){returnt.resolve(e()).then((function(){returnn}))}),(function(n){returnt.resolve(e()).then((function(){returnt.reject(n)}))}))}functiont(e){return!(!e||void0===e.length)}functionn(){}functionr(e){if(!(thisinstanceofr))thrownewTypeError("Promises must be constructed via new");if("function"!=typeofe)thrownewTypeError("not a function");this._state=0,this._handled=!1,this._value=void0,this._deferreds=[],a(e,this)}functiono(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,r._immediateFn((function(){varn=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){varr;try{r=n(e._value)}catch(e){returnvoidu(t.promise,e)}i(t.promise,r)}else(1===e._state?i:u)(t.promise,e._value)}))):e._deferreds.push(t)}functioni(e,t){try{if(t===e)thrownewTypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeoft||"function"==typeoft)){varn=t.then;if(tinstanceofr)returne._state=3,e._value=t,voidc(e);if("function"==typeofn)returnvoida(function(e,t){returnfunction(){e.apply(t,arguments)}}(n,t),e)}e._state=1,e._value=t,c(e)}catch(t){u(e,t)}}functionu(e,t){e._state=2,e._value=t,c(e)}functionc(e){2===e._state&&0===e._deferreds.length&&r._immediateFn((function(){e._handled||r._unhandledRejectionFn(e._value)}));for(vart=0,n=e._deferreds.length;n>t;t++)o(e,e._deferreds[t]);e._deferreds=null}functiona(e,t){varn=!1;try{e((function(e){n||(n=!0,i(t,e))}),(function(e){n||(n=!0,u(t,e))}))}catch(e){if(n)return;n=!0,u(t,e)}}vars=setTimeout;r.prototype.catch=function(e){returnthis.then(null,e)},r.prototype.then=function(e,t){varr=newthis.constructor(n);returno(this,newfunction(e,t,n){this.onFulfilled="function"==typeofe?e:null,this.onRejected="function"==typeoft?t:null,this.promise=n}(e,t,r)),r},r.prototype.finally=e,r.all=function(e){returnnewr((function(n,r){functiono(e,t){try{if(t&&("object"==typeoft||"function"==typeoft)){varc=t.then;if("function"==typeofc)returnvoidc.call(t,(function(t){o(e,t)}),r)}i[e]=t,0==--u&&n(i)}catch(e){r(e)}}if(!t(e))returnr(newTypeError("Promise.all accepts an array"));vari=Array.prototype.slice.call(e);if(0===i.length)returnn([]);for(varu=i.length,c=0;i.length>c;c++)o(c,i[c])}))},r.resolve=function(e){returne&&"object"==typeofe&&e.constructor===r?e:newr((function(t){t(e)}))},r.reject=function(e){returnnewr((function(t,n){n(e)}))},r.race=function(e){returnnewr((function(n,o){if(!t(e))returno(newTypeError("Promise.race accepts an array"));for(vari=0,u=e.length;u>i;i++)r.resolve(e[i]).then(n,o)}))},r._immediateFn="function"==typeofsetImmediate&&function(e){setImmediate(e)}||function(e){s(e,0)},r._unhandledRejectionFn=function(e){void0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};varl=function(){if("undefined"!=typeofself)returnself;if("undefined"!=typeofwindow)returnwindow;if("undefined"!=typeofglobal)returnglobal;throwError("unable to locate global object")}();"Promise"inl?l.Promise.prototype.finally||(l.Promise.prototype.finally=e):l.Promise=r}));vart="undefined"!=typeofcrypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeofmsCrypto&&"function"==typeofmsCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),n=newUint8Array(16);functionr(){if(!t)thrownewError("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");returnt(n)}for(varo=[],i=0;i<256;++i)o[i]=(i+256).toString(16).substr(1);functionu(e,t,n){vari=t&&n||0;"string"==typeofe&&(t="binary"===e?newArray(16):null,e=null);varu=(e=e||{}).random||(e.rng||r)();if(u[6]=15&u[6]|64,u[8]=63&u[8]|128,t)for(varc=0;c<16;++c)t[i+c]=u[c];returnt||function(e,t){varn=t||0,r=o;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}(u)}varc=Object.prototype.hasOwnProperty,a=Array.isArray,s=function(e){vart=Object.create(null);returnfunction(n){returnt[n]||(t[n]=e(n))}},l=/-(\w)/g,f=s((function(e){returne.replace(l,(function(e,t){returnt?t.toUpperCase():""}))})),d=s((function(e){returne.charAt(0).toUpperCase()+e.slice(1)})),p=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;functionm(e,t){if(a(e))returne;if(t&&(n=t,r=e,c.call(n,r)))return[e];varn,r,o=[];returne.replace(p,(function(e,t,n,r){returno.push(n?r.replace(/\\(\\)?/g,"$1"):t||e),r})),o}functionv(e,t){varn,r=m(t,e);for(n=r.shift();null!=n;){if(null==(e=e[n]))return;n=r.shift()}returne}varh=newMap;functiong(e){if(!function(e){if(e){vart=e.tagName;return0===t.indexOf("UNI-")||"BODY"===t}return!1}(e))throwError("no such element");vart,n,r={elementId:(t=e,n=t._id,n||(n=u(),t._id=n,h.set(n,{id:n,element:t})),n),tagName:e.tagName.toLocaleLowerCase().replace("uni-","")},o=e.__vue__;returno&&(o.$parent&&o.$parent.$el===e&&(o=o.$parent),o&&!o.$options.isReserved&&(r.nodeId=function(e){if(e._$weex)returne._uid;if(e._$id)returne._$id;vart=function(e){for(vart=e.$parent;t;){if(t._$id)returnt;t=t.$parent}}(e);if(!e.$parent)return"-1";varn=e.$vnode,r=n.context;returnr&&r!==t&&r._$id?r._$id+";"+t._$id+","+n.data.attrs._i:t._$id+","+n.data.attrs._i}(o))),"video"===r.tagName&&(r.videoId=r.nodeId),r}var_={input:{input:function(e,t){varn=e.__vue__;n.valueSync=t,n.$triggerInput({},{value:t})}},textarea:{input:function(e,t){varn=e.__vue__;n.valueSync=t,n.$triggerInput({},{value:t})}},"scroll-view":{scrollTo:function(e,t,n){varr=e.__vue__.$refs.main;r.scrollLeft=t,r.scrollTop=n},scrollTop:function(e){returne.__vue__.$refs.main.scrollTop},scrollLeft:function(e){returne.__vue__.$refs.main.scrollLeft},scrollWidth:function(e){returne.__vue__.$refs.main.scrollWidth},scrollHeight:function(e){returne.__vue__.$refs.main.scrollHeight}},swiper:{swipeTo:function(e,t){e.__vue__.current=t}},"movable-view":{moveTo:function(e,t,n){e.__vue__._animationTo(t,n)}},switch:{tap:function(e){e.click()}},slider:{slideTo:function(e,t){varn=e.__vue__,r=n.$refs["uni-slider"],o=r.offsetWidth,i=r.getBoundingClientRect().left;n.value=t,n._onClick({x:(t-n.min)*o/(n.max-n.min)+i})}}},y={getWindow:function(e){returnwindow},getDocument:function(e){returndocument},getEl:function(e){vart=h.get(e);if(!t)throwError("element destroyed");returnt.element},getOffset:function(e){vart=e.getBoundingClientRect();returnPromise.resolve({left:t.left+window.pageXOffset,top:t.top+window.pageYOffset})},querySelector:function(e,t){return"page"===t&&(t="body"),Promise.resolve(g(e.querySelector(t)))},querySelectorAll:function(e,t){varn=[],r=document.querySelectorAll(t);return[].forEach.call(r,(function(e){try{n.push(g(e))}catch(e){}})),Promise.resolve({elements:n})},queryProperties:function(e,t){returnPromise.resolve({properties:t.map((function(t){varn=v(e,t);return"document.documentElement.scrollTop"===t&&0===n&&(n=v(e,"document.body.scrollTop")),n}))})},queryAttributes:function(e,t){returnPromise.resolve({attributes:t.map((function(t){returnString(e.getAttribute(t))}))})},queryStyles:function(e,t){varn=getComputedStyle(e);returnPromise.resolve({styles:t.map((function(e){returnn[e]}))})},queryHTML:function(e,t){returnPromise.resolve({html:(n="outer"===t?e.outerHTML:e.innerHTML,n.replace(/\n/g,"").replace(/(<uni-text[^>]*>)(<span[^>]*>[^<]*<\/span>)(.*?<\/uni-text>)/g,"$1$3").replace(/<\/?[^>]*>/g,(function(e){return-1<e.indexOf("<body")?"<page>":"</body>"===e?"</page>":0!==e.indexOf("<uni-")&&0!==e.indexOf("</uni-")?"":e.replace(/uni-/g,"").replace(/ role=""/g,"").replace(/ aria-label=""/g,"")})))});varn},dispatchTapEvent:function(e){returne.click(),Promise.resolve()},dispatchLongpressEvent:function(e){returnPromise.resolve()},dispatchTouchEvent:function(e,t,n){n||(n={}),n.touches||(n.touches=[]),n.changedTouches||(n.changedTouches=[]),n.touches.length||n.touches.push({identifier:Date.now(),target:e});varr=w(n.touches),o=w(n.changedTouches),i=w([]);returne.dispatchEvent(newTouchEvent(t,{cancelable:!0,bubbles:!0,touches:r,targetTouches:i,changedTouches:o})),Promise.resolve()},callFunction:function(t,n,r){varo=v(_,n);returno?Promise.resolve({result:o.apply(null,e([t],r))}):Promise.reject(Error(n+" not exists"))},triggerEvent:function(e,t,n){varr=e.__vue__;returnr.$trigger&&r.$trigger(t,{},n),Promise.resolve()}};functionw(e){vart,n=e.map((function(e){returnfunction(e){if(document.createTouch)returndocument.createTouch(window,e.target,e.identifier,e.pageX,e.pageY,e.screenX,e.screenY);returnnewTouch(e)}(e)}));returndocument.createTouchList?(t=document).createTouchList.apply(t,n):n}["movable-view","picker","ad","button","checkbox-group","checkbox","form","icon","label","movable-area","navigator","picker-view-column","picker-view","progress","radio-group","radio","rich-text","u-slider","swiper-item","swiper","switch"].map((function(e){returnd(f(e))}));varE=Object.assign({},function(e){return{"Page.getElement":function(t){returne.querySelector(e.getDocument(t.pageId),t.selector)},"Page.getElements":function(t){returne.querySelectorAll(e.getDocument(t.pageId),t.selector)},"Page.getWindowProperties":function(t){returne.queryProperties(e.getWindow(t.pageId),t.names)}}}(y),function(e){vart=function(t){returne.getEl(t.elementId,t.pageId)};return{"Element.getElement":function(n){returne.querySelector(t(n),n.selector)},"Element.getElements":function(n){returne.querySelectorAll(t(n),n.selector)},"Element.getDOMProperties":function(n){returne.queryProperties(t(n),n.names)},"Element.getProperties":function(n){varr=t(n),o=r.__vue__||r.attr||{};returne.queryProperties(o,n.names)},"Element.getOffset":function(n){returne.getOffset(t(n))},"Element.getAttributes":function(n){returne.queryAttributes(t(n),n.names)},"Element.getStyles":function(n){returne.queryStyles(t(n),n.names)},"Element.getHTML":function(n){returne.queryHTML(t(n),n.type)},"Element.tap":function(n){returne.dispatchTapEvent(t(n))},"Element.longpress":function(n){returne.dispatchLongpressEvent(t(n))},"Element.touchstart":function(n){returne.dispatchTouchEvent(t(n),"touchstart",n)},"Element.touchmove":function(n){returne.dispatchTouchEvent(t(n),"touchmove",n)},"Element.touchend":function(n){returne.dispatchTouchEvent(t(n),"touchend",n)},"Element.callFunction":function(n){returne.callFunction(t(n),n.functionName,n.args)},"Element.triggerEvent":function(n){returne.triggerEvent(t(n),n.type,n.detail)}}}(y));functionb(e){returnUniViewJSBridge.publishHandler("onAutoMessageReceive",e)}UniViewJSBridge.subscribe("sendAutoMessage",(function(e){vart=e.id,n=e.method,r=e.params,o={id:t},i=E[n];if(!i)returno.error={message:n+" unimplemented"},b(o);try{i(r).then((function(e){e&&(o.result=e)})).catch((function(e){o.error={message:e.message}})).finally((function(){b(o)}))}catch(e){o.error={message:e.message},b(o)}}));
functionD(t,e,n,s){vari,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeofReflect&&"function"==typeofReflect.decorate)r=Reflect.decorate(t,e,n,s);elsefor(vara=t.length-1;a>=0;a--)(i=t[a])&&(r=(o<3?i(r):o>3?i(e,n,r):i(e,n))||r);returno>3&&r&&Object.defineProperty(e,n,r),r}varj;functionA(t,e){constn=e.value;returne.value=asyncfunction(e){return(await(null==n?void0:n.call(this,e)))(t)},e}functionR(t,e,n){returnA(j.RUNTIME,n)}functionS(t,e,n){returnA(j.DEVTOOL,n)}!function(t){t.RUNTIME="runtime",t.DEVTOOL="devtool"}(j||(j={}));classq{constructor(t){this.puppet=t}invoke(t,e){returnasyncn=>this.puppet.devtoolConnection?(n===j.DEVTOOL?this.puppet.devtoolConnection:this.puppet.runtimeConnection).send(t,e):this.puppet.runtimeConnection.send(t,e)}on(t,e){this.puppet.on(t,e)}}classxextendsq{constructor(t,e){super(t),this.id=e.elementId,this.pageId=e.pageId,this.nodeId=e.nodeId,this.videoId=e.videoId}asyncgetData(t){returnthis.invokeMethod("Element.getData",t)}asyncsetData(t){returnthis.invokeMethod("Element.setData",t)}asynccallMethod(t){returnthis.invokeMethod("Element.callMethod",t)}asyncgetElement(t){returnthis.invokeMethod("Element.getElement",t)}asyncgetElements(t){returnthis.invokeMethod("Element.getElements",t)}asyncgetOffset(){returnthis.invokeMethod("Element.getOffset")}asyncgetHTML(t){returnthis.invokeMethod("Element.getHTML",t)}asyncgetAttributes(t){returnthis.invokeMethod("Element.getAttributes",t)}asyncgetStyles(t){returnthis.invokeMethod("Element.getStyles",t)}asyncgetDOMProperties(t){returnthis.invokeMethod("Element.getDOMProperties",t)}asyncgetProperties(t){returnthis.invokeMethod("Element.getProperties",t)}asynctap(){returnthis.invokeMethod("Element.tap")}asynclongpress(){returnthis.invokeMethod("Element.longpress")}asynctouchstart(t){returnthis.invokeMethod("Element.touchstart",t)}asynctouchmove(t){returnthis.invokeMethod("Element.touchmove",t)}asynctouchend(t){returnthis.invokeMethod("Element.touchend",t)}asynctriggerEvent(t){returnthis.invokeMethod("Element.triggerEvent",t)}asynccallFunction(t){returnthis.invokeMethod("Element.callFunction",t)}asynccallContextMethod(t){returnthis.invokeMethod("Element.callContextMethod",t)}invokeMethod(t,e={}){returne.elementId=this.id,e.pageId=this.pageId,this.nodeId&&(e.nodeId=this.nodeId),this.videoId&&(e.videoId=this.videoId),this.invoke(t,e)}}D([R],x.prototype,"getData",null),D([R],x.prototype,"setData",null),D([R],x.prototype,"callMethod",null),D([S],x.prototype,"getElement",null),D([S],x.prototype,"getElements",null),D([S],x.prototype,"getOffset",null),D([S],x.prototype,"getHTML",null),D([S],x.prototype,"getAttributes",null),D([S],x.prototype,"getStyles",null),D([S],x.prototype,"getDOMProperties",null),D([S],x.prototype,"getProperties",null),D([S],x.prototype,"tap",null),D([S],x.prototype,"longpress",null),D([S],x.prototype,"touchstart",null),D([S],x.prototype,"touchmove",null),D([S],x.prototype,"touchend",null),D([S],x.prototype,"triggerEvent",null),D([S],x.prototype,"callFunction",null),D([S],x.prototype,"callContextMethod",null);constN=require("util");classO{constructor(t,e,n){this.puppet=t,this.id=e.elementId,this.pageId=e.pageId,this.nodeId=e.nodeId||null,this.videoId=e.videoId||null,this.tagName=e.tagName,this.nvue=e.nvue,this.elementMap=n,"body"!==this.tagName&&"page-body"!==this.tagName||(this.tagName="page"),this.api=newx(t,e)}toJSON(){returnJSON.stringify({id:this.id,tagName:this.tagName,pageId:this.pageId,nodeId:this.nodeId,videoId:this.videoId})}toString(){returnthis.toJSON()}[N.inspect.custom](){returnthis.toJSON()}async$(t){try{conste=awaitthis.api.getElement({selector:t});returnO.create(this.puppet,Object.assign({},e,{pageId:this.pageId}),this.elementMap)}catch(t){returnnull}}async$$(t){const{elements:e}=awaitthis.api.getElements({selector:t});returne.map(t=>O.create(this.puppet,Object.assign({},t,{pageId:this.pageId}),this.elementMap))}asyncsize(){const[t,e]=awaitthis.domProperty(["offsetWidth","offsetHeight"]);return{width:t,height:e}}asyncoffset(){const{left:t,top:e}=awaitthis.api.getOffset();return{left:t,top:e}}asynctext(){returnthis.domProperty("innerText")}asyncattribute(t){if(!m(t))throwError("name must be a string");return(awaitthis.api.getAttributes({names:[t]})).attributes[0]}asyncvalue(){returnthis.property("value")}asyncproperty(t){if(!m(t))throwError("name must be a string");if(this.puppet.checkProperty){lete=this.publicProps;if(e||(this.publicProps=e=awaitthis._property("__propPublic")),!e[t])throwError(`${this.tagName}.${t} not exists`)}returnthis._property(t)}asynchtml(){return(awaitthis.api.getHTML({type:"inner"})).html}asyncouterHtml(){return(awaitthis.api.getHTML({type:"outer"})).html}asyncstyle(t){if(!m(t))throwError("name must be a string");return(awaitthis.api.getStyles({names:[t]})).styles[0]}asynctap(){returnthis.api.tap()}asynclongpress(){returnthis.nvue?this.api.longpress():(awaitthis.touchstart(),awaitv(350),this.touchend())}asynctrigger(t,e){constn={type:t};returnw(e)||(n.detail=e),this.api.triggerEvent(n)}asynctouchstart(t){returnthis.api.touchstart(t)}asynctouchmove(t){returnthis.api.touchmove(t)}asynctouchend(t){returnthis.api.touchend(t)}asyncdomProperty(t){returnT(asynct=>(awaitthis.api.getDOMProperties({names:t})).properties,t)}_property(t){returnT(asynct=>(awaitthis.api.getProperties({names:t})).properties,t)}send(t,e){returne.elementId=this.id,e.pageId=this.pageId,this.nodeId&&(e.nodeId=this.nodeId),this.videoId&&(e.videoId=this.videoId),this.puppet.send(t,e)}asynccallFunction(t,...e){return(awaitthis.api.callFunction({functionName:t,args:e})).result}staticcreate(t,e,n){lets,i=n.get(e.elementId);if(i)returni;if(e.nodeId)s=$;elseswitch(e.tagName){case"input":s=U;break;case"textarea":s=_;break;case"scroll-view":s=F;break;case"swiper":s=L;break;case"movable-view":s=H;break;case"switch":s=B;break;case"slider":s=J;break;case"video":s=W;break;default:s=O}returni=news(t,e,n),n.set(e.elementId,i),i}}class$extendsO{asyncsetData(t){returnthis.api.setData({data:t})}asyncdata(t){conste={};returnt&&(e.path=t),(awaitthis.api.getData(e)).data}asynccallMethod(t,...e){return(awaitthis.api.callMethod({method:t,args:e})).result}}classUextendsO{asyncinput(t){returnthis.callFunction("input.input",t)}}class_extendsO{asyncinput(t){returnthis.callFunction("textarea.input",t)}}classFextendsO{asyncscrollTo(t,e){returnthis.callFunction("scroll-view.scrollTo",t,e)}asyncproperty(t){return"scrollTop"===t?this.callFunction("scroll-view.scrollTop"):"scrollLeft"===t?this.callFunction("scroll-view.scrollLeft"):super.property(t)}asyncscrollWidth(){returnthis.callFunction("scroll-view.scrollWidth")}asyncscrollHeight(){returnthis.callFunction("scroll-view.scrollHeight")}}classLextendsO{asyncswipeTo(t){returnthis.callFunction("swiper.swipeTo",t)}}classHextendsO{asyncmoveTo(t,e){returnthis.callFunction("movable-view.moveTo",t,e)}asyncproperty(t){return"x"===t?this._property("_translateX"):"y"===t?this._property("_translateY"):super.property(t)}}classBextendsO{asynctap(){returnthis.callFunction("switch.tap")}}classJextendsO{asyncslideTo(t){returnthis.callFunction("slider.slideTo",t)}}classWextendsO{asynccallContextMethod(t,...e){returnawaitthis.api.callContextMethod({method:t,args:e})}}classVextendsq{constructor(t,e){super(t),this.id=e.id}asyncgetData(t){returnthis.invokeMethod("Page.getData",t)}asyncsetData(t){returnthis.invokeMethod("Page.setData",t)}asynccallMethod(t){returnthis.invokeMethod("Page.callMethod",t)}asyncgetElement(t){returnthis.invokeMethod("Page.getElement",t)}asyncgetElements(t){returnthis.invokeMethod("Page.getElements",t)}asyncgetWindowProperties(t){returnthis.invokeMethod("Page.getWindowProperties",t)}invokeMethod(t,e={}){returne.pageId=this.id,this.invoke(t,e)}}D([R],V.prototype,"getData",null),D([R],V.prototype,"setData",null),D([R],V.prototype,"callMethod",null),D([S],V.prototype,"getElement",null),D([S],V.prototype,"getElements",null),D([S],V.prototype,"getWindowProperties",null);constz=require("util");classG{constructor(t,e){this.puppet=t,this.id=e.id,this.path=e.path,this.query=e.query,this.elementMap=newMap,this.api=newV(t,e)}toJSON(){returnJSON.stringify({id:this.id,path:this.path,query:this.query})}toString(){returnthis.toJSON()}[z.inspect.custom](){returnthis.toJSON()}asyncwaitFor(t){returny(t)?awaitv(t):h(t)?l(t):m(t)?l(async()=>(awaitthis.$$(t)).length>0):void0}async$(t){try{conste=awaitthis.api.getElement({selector:t});returnO.create(this.puppet,Object.assign({selector:t},e,{pageId:this.id}),this.elementMap)}catch(t){returnnull}}async$$(t){const{elements:e}=awaitthis.api.getElements({selector:t});returne.map(e=>O.create(this.puppet,Object.assign({selector:t},e,{pageId:this.id}),this.elementMap))}asyncdata(t){conste={};returnt&&(e.path=t),(awaitthis.api.getData(e)).data}asyncsetData(t){returnthis.api.setData({data:t})}asyncsize(){const[t,e]=awaitthis.windowProperty(["document.documentElement.scrollWidth","document.documentElement.scrollHeight"]);return{width:t,height:e}}asynccallMethod(t,...e){return(awaitthis.api.callMethod({method:t,args:e})).result}asyncscrollTop(){returnthis.windowProperty("document.documentElement.scrollTop")}asyncwindowProperty(t){conste=m(t);e&&(t=[t]);const{properties:n}=awaitthis.api.getWindowProperties({names:t});returne?n[0]:n}staticcreate(t,e,n){lets=n.get(e.id);returns?(s.query=e.query,s):(s=newG(t,e),n.set(e.id,s),s)}}classXextendsq{asyncgetPageStack(){returnthis.invoke("App.getPageStack")}asynccallUniMethod(t){returnthis.invoke("App.callUniMethod",t)}asyncgetCurrentPage(){returnthis.invoke("App.getCurrentPage")}asyncmockUniMethod(t){returnthis.invoke("App.mockUniMethod",t)}asynccallFunction(t){returnthis.invoke("App.callFunction",t)}asynccaptureScreenshot(t){returnthis.invoke("App.captureScreenshot",t)}asyncexit(){returnthis.invoke("App.exit")}asyncaddBinding(t){returnthis.invoke("App.addBinding",t)}asyncenableLog(){returnthis.invoke("App.enableLog")}onLogAdded(t){returnthis.on("App.logAdded",t)}onBindingCalled(t){returnthis.on("App.bindingCalled",t)}onExceptionThrown(t){returnthis.on("App.exceptionThrown",t)}}D([R],X.prototype,"getPageStack",null),D([R],X.prototype,"callUniMethod",null),D([R],X.prototype,"getCurrentPage",null),D([R],X.prototype,"mockUniMethod",null),D([S],X.prototype,"callFunction",null),D([S],X.prototype,"captureScreenshot",null),D([S],X.prototype,"exit",null),D([S],X.prototype,"addBinding",null),D([S],X.prototype,"enableLog",null);classYextendsq{asyncgetInfo(){returnthis.invoke("Tool.getInfo")}asyncenableRemoteDebug(t){returnthis.invoke("Tool.enableRemoteDebug")}asyncclose(){returnthis.invoke("Tool.close")}asyncgetTestAccounts(){returnthis.invoke("Tool.getTestAccounts")}onRemoteDebugConnected(t){this.puppet.once("Tool.onRemoteDebugConnected",t),this.puppet.once("Tool.onPreviewConnected",t)}}functionK(t){returnnewPromise(e=>setTimeout(e,t))}D([S],Y.prototype,"getInfo",null),D([S],Y.prototype,"enableRemoteDebug",null),D([S],Y.prototype,"close",null),D([S],Y.prototype,"getTestAccounts",null);classQextendsr.EventEmitter{constructor(t,e){super(),this.puppet=t,this.options=e,this.pageMap=newMap,this.appBindings=newMap,this.appApi=newX(t),this.toolApi=newY(t),this.appApi.onLogAdded(t=>{this.emit("console",t)}),this.appApi.onBindingCalled(({name:t,args:e})=>{try{constn=this.appBindings.get(t);n&&n(...e)}catch(t){}}),this.appApi.onExceptionThrown(t=>{this.emit("exception",t)})}asyncpageStack(){return(awaitthis.appApi.getPageStack()).pageStack.map(t=>G.create(this.puppet,t,this.pageMap))}asyncnavigateTo(t){returnthis.changeRoute("navigateTo",t)}asyncredirectTo(t){returnthis.changeRoute("redirectTo",t)}asyncnavigateBack(){returnthis.changeRoute("navigateBack")}asyncreLaunch(t){returnthis.changeRoute("reLaunch",t)}asyncswitchTab(t){returnthis.changeRoute("switchTab",t)}asynccurrentPage(){const{id:t,path:e,query:n}=awaitthis.appApi.getCurrentPage();returnG.create(this.puppet,{id:t,path:e,query:n},this.pageMap)}asyncsystemInfo(){returnthis.callUniMethod("getSystemInfoSync")}asynccallUniMethod(t,...e){return(awaitthis.appApi.callUniMethod({method:t,args:e})).result}asyncmockUniMethod(t,e,...n){returnh(e)||m(s=e)&&(s=d(s),g(s,"function")||g(s,"() =>"))?this.appApi.mockUniMethod({method:t,functionDeclaration:e.toString(),args:n}):this.appApi.mockUniMethod({method:t,result:e});vars}asyncrestoreUniMethod(t){returnthis.appApi.mockUniMethod({method:t})}asyncevaluate(t,...e){return(awaitthis.appApi.callFunction({functionDeclaration:t.toString(),args:e})).result}asyncpageScrollTo(t){awaitthis.callUniMethod("pageScrollTo",{scrollTop:t,duration:0})}asyncclose(){try{awaitthis.appApi.exit()}catch(t){}awaitK(1e3),this.puppet.disposeRuntimeServer(),awaitthis.toolApi.close(),this.disconnect()}asyncteardown(){returnthis["disconnect"===this.options.teardown?"disconnect":"close"]()}asyncremote(t){if(!this.puppet.devtools.remote)returnconsole.warn(`Failed to enable remote, ${this.puppet.devtools.name} is unimplemented`);const{qrCode:e}=awaitthis.toolApi.enableRemoteDebug({auto:t});varn;e&&await(n=e,newPromise(t=>{C.generate(n,{small:!0},e=>{process.stdout.write(e),t(void0)})}));consts=newPromise(t=>{this.toolApi.onRemoteDebugConnected(async()=>{awaitK(1e3),t(void0)})}),i=newPromise(t=>{this.puppet.setRemoteRuntimeConnectionCallback(()=>{t(void0)})});returnPromise.all([s,i])}disconnect(){this.puppet.dispose()}on(t,e){return"console"===t&&this.appApi.enableLog(),super.on(t,e),this}asyncexposeFunction(t,e){if(this.appBindings.has(t))throwError(`Failed to expose function with name ${t}: already exists!`);this.appBindings.set(t,e),awaitthis.appApi.addBinding({name:t})}asynccheckVersion(){}asyncscreenshot(t){const{data:e}=awaitthis.appApi.captureScreenshot({fullPage:null==t?void0:t.fullPage});if(!(null==t?void0:t.path))returne;awaitu.writeFile(t.path,e,"base64")}asynctestAccounts(){return(awaitthis.toolApi.getTestAccounts()).accounts}asyncchangeRoute(t,e){returnawaitthis.callUniMethod(t,{url:e}),awaitK(3e3),this.currentPage()}}classZ{constructor(t){this.options=t}has(t){return!!this.options[t]}send(t,e,n){consts=this.options[e];if(!s)returnPromise.reject(Error(`adapter for ${e} not found`));consti=s.reflect;returni?(s.params&&(n=s.params(n)),"function"==typeofi?i(t.send.bind(t),n):(e=i,t.send(e,n))):Promise.reject(Error(e+"'s reflect is required"))}}consttt=s("automator:puppet");functionet(t){try{returnrequire(t)}catch(t){}}functionnt(t,e,s,i){consto=function(t,e,s){leti,o;returnprocess.env.UNI_OUTPUT_DIR?(o=n.join(process.env.UNI_OUTPUT_DIR,"../.automator/"+e,".automator.json"),i=et(o)):(o=n.join(t,`dist/${s}/.automator/${e}`,".automator.json"),i=et(o),i||(o=n.join(t,`unpackage/dist/${s}/.automator/${e}`,".automator.json"),i=et(o))),tt(`${o}=>${JSON.stringify(i)}`),i}(t,s,i);if(!o||!o.wsEndpoint)return!1;constr=require("../package.json").version;if(o.version!==r)returntt(`unmet=>${o.version}!==${r}`),!1;consta=function(t){lete;try{constt=P.v4.sync();e=f.ip(t&&t.interface),e&&(/^10[.]|^172[.](1[6-9]|2[0-9]|3[0-1])[.]|^192[.]168[.]/.test(e)||(e=void0))}catch(t){}return"ws://"+(e||"localhost")+":"+t}(e);returntt("wsEndpoint=>"+a),o.wsEndpoint===a}classstextendsr.EventEmitter{constructor(t,e){if(super(),e)this.target=e;else{if(this.target=null,"h5"===t)try{this.target=require("@dcloudio/uni-h5/lib/h5/uni.automator.js")}catch(t){}this.target||(this.target=require(`@dcloudio/uni-${"app"===t?"app-plus":t}/lib/uni.automator.js`))}if(!this.target)throwError("puppet is not provided");this.platform=t,this.adapter=newZ(this.target.adapter||{})}setCompiler(t){this.compiler=t}setRuntimeServer(t){this.wss=t}setRemoteRuntimeConnectionCallback(t){this.remoteRuntimeConnectionCallback=t}setRuntimeConnection(t){this.runtimeConnection=t,this.remoteRuntimeConnectionCallback&&(this.remoteRuntimeConnectionCallback(),this.remoteRuntimeConnectionCallback=null)}setDevtoolConnection(t){this.devtoolConnection=t}disposeRuntimeServer(){this.wss&&this.wss.close()}disposeRuntime(){this.runtimeConnection.dispose()}disposeDevtool(){this.compiler&&this.compiler.stop(),this.devtoolConnection&&this.devtoolConnection.dispose()}dispose(){this.disposeRuntime(),this.disposeDevtool(),this.disposeRuntimeServer()}send(t,e){returnthis.runtimeConnection.send(t,e)}validateProject(t){consts=this.target.devtools.required;return!s||!s.find(s=>!e.existsSync(n.join(t,s)))}validateDevtools(t){conste=this.target.devtools.validate;returne?e(t,this):Promise.resolve(t)}createDevtools(t,e,n){consts=this.target.devtools.create;returns?(e.timeout=n,s(t,e,this)):Promise.resolve()}shouldCompile(t,e,n,s){this.compiled=!0;consti=this.target.shouldCompile;returni?this.compiled=i(n,s):!0===n.compile?this.compiled=!0:this.compiled=!nt(t,e,this.platform,this.mode),this.compiled}getcheckProperty(){return"mp-weixin"===this.platform}getdevtools(){returnthis.target.devtools}getmode(){constt=this.target.mode;returnt||("production"===process.env.NODE_ENV?"build":"dev")}}constit=s("automator:compiler"),ot=/The\s+(.*)\s+directory is ready/;classrt{constructor(t){this.puppet=t,this.puppet.setCompiler(this)}compile(t){consts=this.puppet.mode,i=this.puppet.platform;leto=t.silent;constr=t.port,a=t.host,c=`${s}:${i}`,p=t.projectPath,[l,u]=this.getSpawnArgs(t,c);u.push("--auto-port"),u.push(E(r)),a&&(u.push("--auto-host"),u.push(a));consth={cwd:t.cliPath,env:Object.assign(Object.assign({},process.env),{NODE_ENV:"build"===s?"production":"development"})};returnnewPromise((t,r)=>{consta=r=>{consta=r.toString().trim();if(!o&&console.log(a),a.includes("- Network")||a.includes("> Network")){conste=a.match(/Network:(.*)/)[1].trim();it("url: "+e),t({path:e})}elseif(a.includes("DONE Build complete")){constr=a.match(ot);letc="";r&&r.length>1?c=n.join(p,r[1]):(c=n.join(p,`dist/${s}/${i}`),e.existsSync(c)||(c=n.join(p,`unpackage/dist/${s}/${i}`))),o=!0,this.stop(),t({path:c})}};it(`${l}${u.join("")} %o`,h),this.cliProcess=k.spawn(l,u,h),this.cliProcess.on("error",t=>{r(t)}),this.cliProcess.stdout.on("data",a),this.cliProcess.stderr.on("data",a)})}stop(){this.cliProcess&&this.cliProcess.kill("SIGTERM")}getSpawnArgs(t,e){lets;consti=t.cliPath;try{s=require(n.join(i,"package.json"))}catch(t){}returns&&s.scripts&&s.scripts[e]?[process.env.UNI_NPM_PATH||(/^win/.test(process.platform)?"npm.cmd":"npm"),["run",e,"--"]]:(process.env.UNI_INPUT_DIR=t.projectPath,process.env.UNI_OUTPUT_DIR=n.join(t.projectPath,`unpackage/dist/${this.puppet.mode}/${this.puppet.platform}`),[process.env.UNI_NODE_PATH||"node",[n.join(i,"bin/uniapp-cli.js")]])}}classat{asynclaunch(t){lete=("app"===t.platform?t.app||t["app-plus"]:t[t.platform])||{};this.puppet=newst(t.platform,e.puppet);const{port:i,cliPath:o,timeout:r,projectPath:a}=awaitthis.validate(t);e=awaitthis.puppet.validateDevtools(e);letc=this.puppet.shouldCompile(a,i,t,e),p=process.env.UNI_OUTPUT_DIR||a;if(c||this.puppet.validateProject(p)||(p=n.join(a,"dist/"+this.puppet.mode+"/"+this.puppet.platform),this.puppet.validateProject(p)||(p=n.join(a,"unpackage/dist/"+this.puppet.mode+"/"+this.puppet.platform),this.puppet.validateProject(p)||(c=!0))),c){this.puppet.compiled=t.compile=!0,this.compiler=newrt(this.puppet);conste=awaitthis.compiler.compile({host:t.host,port:i,cliPath:o,projectPath:a,silent:!!t.silent});e.path&&(p=e.path)}constl=[];returnl.push(this.createRuntimeConnection(i,r)),l.push(this.puppet.createDevtools(p,e,r)),newPromise((t,n)=>{Promise.all(l).then(([n,o])=>{n&&this.puppet.setRuntimeConnection(n),o&&this.puppet.setDevtoolConnection(o),s("automator:program")("ready");constr=e.teardown||"disconnect";t(newQ(this.puppet,{teardown:r,port:i}))}).catch(t=>n(t))})}resolveCliPath(t){if(!t)returnt;try{const{dependencies:e,devDependencies:s}=require(n.join(t,"package.json"));if(ct(s)||ct(e))returnt}catch(t){}}resolveProjectPath(t,s){returnt||(t=process.env.UNI_INPUT_DIR||process.cwd()),i(t)&&(t=n.resolve(t)),e.existsSync(t)||function(t){throwError(t)}(`Project path ${t} doesn't exist`),t}asyncvalidate(t){conste=this.resolveProjectPath(t.projectPath,t);letn=process.env.UNI_CLI_PATH||t.cliPath;if(n=this.resolveCliPath(n||""),!n&&(n=this.resolveCliPath(process.cwd())),!n&&(n=this.resolveCliPath(e)),!n)throwError("cliPath is not provided");return{port:awaitasyncfunction(t,e){constn=awaitM(t||e);if(t&&n!==t)throwError(`Port ${t} is in use, please specify another port`);returnn}(t.port||9520),cliPath:n,timeout:t.timeout||6e4,projectPath:e}}asynccreateRuntimeConnection(t,e){returnI.createRuntimeConnection(t,this.puppet,e)}}functionct(t){return!!t&&!(!t["@dcloudio/vue-cli-plugin-uni"]&&!t["@dcloudio/vite-plugin-uni"])}module.exports=class{constructor(){this.launcher=newat}asynclaunch(t){returnthis.launcher.launch(t)}};
vare,t=Object.prototype.hasOwnProperty,n=function(e){returnnull==e},r=Array.isArray,o=function(e){vart=Object.create(null);returnfunction(n){returnt[n]||(t[n]=e(n))}},a=/-(\w)/g,i=o((function(e){returne.replace(a,(function(e,t){returnt?t.toUpperCase():""}))})),u=o((function(e){returne.charAt(0).toUpperCase()+e.slice(1)})),c=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;functions(e,n){if(r(e))returne;if(n&&(o=n,a=e,t.call(o,a)))return[e];varo,a,i=[];returne.replace(c,(function(e,t,n,r){returni.push(n?r.replace(/\\(\\)?/g,"$1"):t||e),r})),i}functionf(e){returne.__wxWebviewId__?e.__wxWebviewId__:e.privateProperties?e.privateProperties.slaveId:e.$page?e.$page.id:void0}functionp(e){returne.route||e.uri}functiond(e){returne.options||e.$page&&e.$page.options||{}}functionl(e){return{id:f(e),path:p(e),query:d(e)}}functiong(e){vart=function(e){returngetCurrentPages().find((function(t){returnf(t)===e}))}(e);returnt&&t.$vm}functionm(e,t){varn=g(e);returnn&&functione(t,n){varr;returnt&&(!function(e,t){returne.$scope&&((n=e.$scope).__wxExparserNodeId__||n.nodeId||n.id)===t;varn}(t,n)?t.$children.find((function(t){returnr=e(t,n)})):r=t),r}(n,t)}functionv(e,t){varr;returne&&(r=t?function(e,t){varr,o=s(t,e);for(r=o.shift();!n(r);){if(null==(e=e[r]))return;r=o.shift()}returne}(e.$data,t):Object.assign({},e.$data)),Promise.resolve({data:r})}functionh(e,t){returne&&Object.keys(t).forEach((function(n){e[n]=t[n]})),Promise.resolve()}functionT(t,n,r){returnnewPromise((function(o,a){if(!t)returna(e.VM_NOT_EXISTS);if(!t[n])returna(e.VM_NOT_EXISTS);vari,u=t[n].apply(t,r);!(i=u)||"object"!=typeofi&&"function"!=typeofi||"function"!=typeofi.then?o({result:u}):u.then((function(e){o({result:e})}))}))}!function(e){e.VM_NOT_EXISTS="VM_NOT_EXISTS",e.METHOD_NOT_EXISTS="METHOD_NOT_EXISTS"}(e||(e={}));var_=["stopRecord","getRecorderManager","pauseVoice","stopVoice","pauseBackgroundAudio","stopBackgroundAudio","getBackgroundAudioManager","createAudioContext","createInnerAudioContext","createVideoContext","createCameraContext","createMapContext","canIUse","startAccelerometer","stopAccelerometer","startCompass","stopCompass","hideToast","hideLoading","showNavigationBarLoading","hideNavigationBarLoading","navigateBack","createAnimation","pageScrollTo","createSelectorQuery","createCanvasContext","createContext","drawCanvas","hideKeyboard","stopPullDownRefresh","arrayBufferToBase64","base64ToArrayBuffer"],y={},O=/Sync$/,S=/^on|^off/;functionE(e){returnO.test(e)||-1!==_.indexOf(e)}varI={getPageStack:function(){returnPromise.resolve({pageStack:getCurrentPages().map((function(e){returnl(e)}))})},getCurrentPage:function(){vare=getCurrentPages(),t=e.length;returnnewPromise((function(n,r){t?n(l(e[t-1])):r(Error("getCurrentPages().length=0"))}))},callUniMethod:function(e){vart=e.method,n=e.args;returnnewPromise((function(e,r){if(!uni[t])returnr(Error("uni."+t+" not exists"));if(E(t))returne({result:uni[t].apply(uni,n)});varo=[Object.assign({},n[0]||{},{success:function(n){setTimeout((function(){e({result:n})}),"pageScrollTo"===t?350:0)},fail:function(e){r(Error(e.errMsg.replace(t+":fail ","")))}})];uni[t].apply(uni,o)}))},mockUniMethod:function(e){vart=e.method;if(!uni[t])throwError("uni."+t+" not exists");if(!function(e){return!S.test(e)}(t))throwError("You can't mock uni."+t);varr=e.result;if(n(r))returny[t]&&(uni[t]=y[t],deletey[t]),Promise.resolve();varo=E(t)?function(){returnr}:function(e){setTimeout((function(){r.errMsg&&-1!==r.errMsg.indexOf(":fail")?e.fail&&e.fail(r):e.success&&e.success(r),e.complete&&e.complete(r)}),4)};returny[t]||(y[t]=uni[t]),uni[t]=o,Promise.resolve()}},C={getData:function(e){returnv(g(e.pageId),e.path)},setData:function(e){returnh(g(e.pageId),e.data)},callMethod:function(t){varn,r=((n={})[e.VM_NOT_EXISTS]="Page["+t.pageId+"] not exists",n[e.METHOD_NOT_EXISTS]="page."+t.method+" not exists",n);returnnewPromise((function(e,n){T(g(t.pageId),t.method,t.args).then((function(t){returne(t)})).catch((function(e){n(Error(r[e]))}))}))}};functionw(e){returne.nodeId||e.elementId}for(varM={getData:function(e){returnv(m(e.pageId,w(e)),e.path)},setData:function(e){returnh(m(e.pageId,w(e)),e.data)},callMethod:function(t){varn,r=w(t),o=((n={})[e.VM_NOT_EXISTS]="Component["+t.pageId+":"+r+"] not exists",n[e.METHOD_NOT_EXISTS]="component."+t.method+" not exists",n);returnnewPromise((function(e,n){T(m(t.pageId,r),t.method,t.args).then((function(t){returne(t)})).catch((function(e){n(Error(o[e]))}))}))}},P=("undefined"!=typeofcrypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeofmsCrypto&&"function"==typeofmsCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),[]),b=0;b<256;++b)P[b]=(b+256).toString(16).substr(1);["movable-view","picker","ad","button","checkbox-group","checkbox","form","icon","label","movable-area","navigator","picker-view-column","picker-view","progress","radio-group","radio","rich-text","u-slider","swiper-item","swiper","switch"].map((function(e){returnu(i(e))}));varx={};Object.keys(I).forEach((function(e){x["App."+e]=I[e]})),Object.keys(C).forEach((function(e){x["Page."+e]=C[e]})),Object.keys(M).forEach((function(e){x["Element."+e]=M[e]}));var$,k=process.env.UNI_AUTOMATOR_WS_ENDPOINT;functionA(e){$.send({data:JSON.stringify(e)})}functionN(e){vart=JSON.parse(e.data),n=t.id,r=t.method,o=t.params,a={id:n},i=x[r];if(!i&&!i)returna.error={message:r+" unimplemented"},A(a);try{i(o).then((function(e){e&&(a.result=e)})).catch((function(e){a.error={message:e.message}})).finally((function(){A(a)}))}catch(e){a.error={message:e.message},A(a)}}swan.$$initRuntimeAutomator=function(e){void0===e&&(e={}),($=uni.connectSocket({url:k,complete:function(){}})).onMessage(N),$.onOpen((function(t){e.success&&e.success(),console.log("已开启自动化测试...")})),$.onError((function(e){console.log("automator.onError",e)})),$.onClose((function(){e.fail&&e.fail({errMsg:"$$initRuntimeAutomator:fail"}),console.log("automator.onClose")}))},setTimeout((function(){swan.$$initRuntimeAutomator()}),500);
"use strict";functione(e){returne&&"object"==typeofe&&"default"ine?e.default:e}vart=e(require("os")),r=e(require("path")),s=e(require("debug")),a=e(require("licia/isWindows")),n=e(require("fs")),o=e(require("child_process")),i=e(require("licia/sleep")),c=e(require("licia/toStr")),l=e(require("licia/waitUntil")),p=e(require("licia/concat")),u=e(require("licia/getPort")),m=e(require("licia/dateFormat"));require("address"),require("default-gateway"),require("licia/isStr");vard=e(require("ws")),h=require("events"),f=e(require("licia/uuid")),g=e(require("licia/stringify"));constw=/(^[a-z][a-z0-9-]*)/i,y=/^navigator/i,E=/^swan-nav$/i;varb;!function(e){e.SELECTOR="selector",e.TAGNAME="tagName"}(b||(b={}));constv={[b.SELECTOR]:[{test:y,processor:e=>e.replace(y,"nav")},{test:w,processor:e=>"swan-"+e}],[b.TAGNAME]:[{test:E,processor:e=>e.replace(E,"swan-navigator")},{test:w,processor:e=>e.toLocaleLowerCase().replace("swan-","")}]},P=e=>t=>{constr=(v[e]||[]).filter(e=>e.test.test(t));for(consteofr)t=e.processor(t);returnt},j=P(b.SELECTOR),q=P(b.TAGNAME),O=e=>Object.assign({},e,{type:"id",info:{id:e.elementId}});require("qrcode-terminal"),require("qrcode-reader"),/^win/.test(process.platform);classMextendsh.EventEmitter{constructor(e){super(),this.ws=e,this.ws.addEventListener("message",e=>{this.emit("message",e.data)}),this.ws.addEventListener("close",()=>{this.emit("close")})}send(e){this.ws.send(e)}close(){this.ws.close()}}classCextendsh.EventEmitter{constructor(e,t,r){super(),this.puppet=t,this.namespace=r,this.callbacks=newMap,this.transport=e,this.debug=s("automator:protocol:"+this.namespace),this.onMessage=e=>{this.debug(`${m("yyyy-mm-dd HH:MM:ss:l")} ◀ RECV ${e}`);const{id:t,method:r,error:s,result:a,params:n}=JSON.parse(e);if(!t)returnthis.puppet.emit(r,n);const{callbacks:o}=this;if(t&&o.has(t)){conste=o.get(t);o.delete(t),s?e.reject(Error(s.message)):e.resolve(a)}},this.onClose=()=>{this.callbacks.forEach(e=>{e.reject(Error("Connection closed"))})},this.transport.on("message",this.onMessage),this.transport.on("close",this.onClose)}send(e,t={},r=!0){if(r&&this.puppet.adapter.has(e))returnthis.puppet.adapter.send(this,e,t);consts=f(),a=g({id:s,method:e,params:t});returnthis.debug(`${m("yyyy-mm-dd HH:MM:ss:l")} SEND ► ${a}`),newPromise((e,t)=>{try{this.transport.send(a)}catch(e){t(Error("Connection closed"))}this.callbacks.set(s,{resolve:e,reject:t})})}dispose(){this.transport.close()}staticcreateDevtoolConnection(e,t){returnnewPromise((r,s)=>{consta=newd(e);a.addEventListener("open",()=>{r(newC(newM(a),t,"devtool"))}),a.addEventListener("error",s)})}staticcreateRuntimeConnection(e,t,r){returnnewPromise((a,n)=>{s("automator:runtime")(`${m("yyyy-mm-dd HH:MM:ss:l")} port=${e}`);consto=newd.Server({port:e});l(async()=>{if(t.runtimeConnection)return!0},r,1e3).catch(()=>{o.close(),n("Failed to connect to runtime, please make sure the project is running")}),o.on("connection",(function(e){s("automator:runtime")(m("yyyy-mm-dd HH:MM:ss:l")+" connected");constr=newC(newM(e),t,"runtime");t.setRuntimeConnection(r),a(r)})),t.setRuntimeServer(o)})}}const$=s("automator:devtool");asyncfunctionS(e,t,r){const{port:s,cliPath:a,timeout:n,cwd:u="",account:d="",args:h=[],launch:f=!0}=t;letg=!1,w=!1;if(!1!==f){constt={stdio:"ignore"};u&&(t.cwd=u);letr=p(h,[]);r=p(r,["--auto"]),r=p(r,[e,"--auto-port",c(s)]),d&&(r=p(r,["--auto-account",d]));try{$("%s %o %o",a,r,t);conste=o.spawn(a,r,t);e.on("error",e=>{g=!0}),e.on("exit",()=>{setTimeout(()=>{w=!0},15e3)}),e.unref()}catch(e){g=!1}}elsesetTimeout(()=>{w=!0},15e3);consty=awaitl(async()=>{try{if(g||w)return!0;returnawaitasyncfunction(e,t){letr;try{r=awaitC.createDevtoolConnection(e.wsEndpoint,t)}catch(t){throwError(`Failed connecting to ${e.wsEndpoint}, check if target project window is opened with automation enabled`)}returnr}({wsEndpoint:"ws://127.0.0.1:"+s},r)}catch(e){}},n,1e3);if(g)throwError(`Failed to launch ${r.devtools.name}, please make sure cliPath is correctly specified`);if(w)throwError(`Failed to launch ${r.devtools.name} , please make sure http port is open`);returnawaiti(5e3),$(m("yyyy-mm-dd HH:MM:ss:l")+" connected"),y}constA=[];["","-rc"].forEach(e=>{a?(A.push(r.join(t.homedir(),`AppData/Local/Programs/swan-ide-gui${e}/cli.bat`)),A.push(`C:/Program Files/swan-ide-gui${e}/cli.bat`)):A.push(`/Applications/百度开发者工具${e}.app/Contents/MacOS/cli`)});constT={devtools:{name:"Baidu DevTools",remote:!0,automator:!0,paths:A,required:["project.swan.json","app.json","app.js"],defaultPort:9430,validate:asyncfunction(e,t){constr=function(e,t){constr=t.devtools.paths.slice(0);e&&r.unshift(e);for(consteofr)if(n.existsSync(e))returne;throwError(t.devtools.name+" not found, please specify executablePath option")}(e.executablePath,t);lets=e.port||t.devtools.defaultPort;if(!1!==e.launch)try{s=awaitasyncfunction(e,t){constr=awaitu(e||t);if(e&&r!==e)throwError(`Port ${e} is in use, please specify another port`);returnr}(s)}catch(t){e.launch=!1}else{s===awaitu(s)&&(e.launch=!0)}returnObject.assign(Object.assign({},e),{port:s,cliPath:r})},asynccreate(e,t,r){consta=awaitS(e,t,r);returnr.compiled?s("automator:devtool")("Waiting for runtime automator"):(s("automator:devtool")("initRuntimeAutomator"),a.send("smartapp.swan",{api:"$$initRuntimeAutomator",params:[]})),a}},adapter:{"Tool.enableRemoteDebug":{reflect:asynce=>({qrCode:(awaite("Tool.enablePreview")).url})},"App.exit":{reflect:async()=>Promise.resolve()},"Page.getElement":{reflect:async(e,t)=>(awaite("Page.getElements",t)).elements[0]},"Page.getElements":{reflect:async(e,t)=>{return{elements:(awaite("smartapp.element.getBySelector",Object.assign(Object.assign({},t),{properties:["id","tagName"],selector:(r=t.selector,r.split("").map(e=>j(e)).join(""))}))).map(e=>{constt=e.properties;return{elementId:t.id,nodeId:t.id,tagName:q(t.tagName)}})};varr}},"Page.getWindowProperties":{reflect:async(e,t)=>{constr=t.names.map(e=>e.replace("document.documentElement.","")),s=(awaite("smartapp.element.getBySelector",{properties:r,selector:"html"}))[0];return{properties:r.map(e=>s.properties[e])}}},"Element.getHTML":{reflect:async(e,t)=>{constr=[t.type+"HTML"];return{html:(awaite("Element.getDOMProperties",Object.assign(Object.assign({},t),{names:r}))).properties[0]}}},"Element.getElement":{reflect:async(e,t)=>(awaite("Element.getElements",t)).elements[0]},"Element.getElements":{reflect:async(e,t)=>{const{elements:r}=awaite("Page.getElements",Object.assign(Object.assign({},t),{selector:`#${t.elementId}${t.selector}`}));returnr.forEach(e=>{e.nodeId=e.id}),{elements:r}}},"Element.getAttributes":{reflect:async(e,t)=>{constr=[];for(constsoft.names)r.push(awaite("smartapp.element.getAttribute",Object.assign({attribute:s},t)));return{attributes:r}},params:O},"Element.getStyles":{reflect:async(e,t)=>{constr=[];for(constsoft.names)r.push(awaite("smartapp.element.getComputedStyle",Object.assign({style:s},t)));return{styles:r}},params:O},"Element.getDOMProperties":{reflect:async(e,t)=>{constr=[];for(constsoft.names)r.push(awaite("smartapp.element.getProperty",Object.assign({property:s},t)));return{properties:r}},params:O},"Element.getProperties":{reflect:async(e,t)=>{constr=[];for(constsoft.names)r.push(awaite("smartapp.element.getAttribute",Object.assign({attribute:s},t)));return{properties:r}},params:O},"Element.getOffset":{reflect:async(e,t)=>({left:awaite("smartapp.element.getProperty",Object.assign({property:"offsetLeft"},t)),top:awaite("smartapp.element.getProperty",Object.assign({property:"offsetTop"},t))}),params:O},"Element.tap":{reflect:"smartapp.element.touch",params:O}}};module.exports=T;
vare,t=Object.prototype.hasOwnProperty,n=function(e){returnnull==e},r=Array.isArray,o=function(e){vart=Object.create(null);returnfunction(n){returnt[n]||(t[n]=e(n))}},i=/-(\w)/g,a=o((function(e){returne.replace(i,(function(e,t){returnt?t.toUpperCase():""}))})),u=o((function(e){returne.charAt(0).toUpperCase()+e.slice(1)})),c=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;functions(e,n){if(r(e))returne;if(n&&(o=n,i=e,t.call(o,i)))return[e];varo,i,a=[];returne.replace(c,(function(e,t,n,r){returna.push(n?r.replace(/\\(\\)?/g,"$1"):t||e),r})),a}functionf(e){returne.__wxWebviewId__?e.__wxWebviewId__:e.privateProperties?e.privateProperties.slaveId:e.$page?e.$page.id:void0}functionp(e){returne.route||e.uri}functiond(e){returne.options||e.$page&&e.$page.options||{}}functionl(e){return{id:f(e),path:p(e),query:d(e)}}functiong(e){vart=function(e){returngetCurrentPages().find((function(t){returnf(t)===e}))}(e);returnt&&t.$vm}functionm(e,t){varn=g(e);returnn&&functione(t,n){varr;returnt&&(!function(e,t){returne.$scope&&((n=e.$scope).__wxExparserNodeId__||n.nodeId||n.id)===t;varn}(t,n)?t.$children.find((function(t){returnr=e(t,n)})):r=t),r}(n,t)}functionv(e,t){varr;returne&&(r=t?function(e,t){varr,o=s(t,e);for(r=o.shift();!n(r);){if(null==(e=e[r]))return;r=o.shift()}returne}(e.$data,t):Object.assign({},e.$data)),Promise.resolve({data:r})}functionh(e,t){returne&&Object.keys(t).forEach((function(n){e[n]=t[n]})),Promise.resolve()}functionT(t,n,r){returnnewPromise((function(o,i){if(!t)returni(e.VM_NOT_EXISTS);if(!t[n])returni(e.VM_NOT_EXISTS);vara,u=t[n].apply(t,r);!(a=u)||"object"!=typeofa&&"function"!=typeofa||"function"!=typeofa.then?o({result:u}):u.then((function(e){o({result:e})}))}))}!function(e){e.VM_NOT_EXISTS="VM_NOT_EXISTS",e.METHOD_NOT_EXISTS="METHOD_NOT_EXISTS"}(e||(e={}));var_=["stopRecord","getRecorderManager","pauseVoice","stopVoice","pauseBackgroundAudio","stopBackgroundAudio","getBackgroundAudioManager","createAudioContext","createInnerAudioContext","createVideoContext","createCameraContext","createMapContext","canIUse","startAccelerometer","stopAccelerometer","startCompass","stopCompass","hideToast","hideLoading","showNavigationBarLoading","hideNavigationBarLoading","navigateBack","createAnimation","pageScrollTo","createSelectorQuery","createCanvasContext","createContext","drawCanvas","hideKeyboard","stopPullDownRefresh","arrayBufferToBase64","base64ToArrayBuffer"],y={},O=/Sync$/,S=/^on|^off/;functionE(e){returnO.test(e)||-1!==_.indexOf(e)}varI={getPageStack:function(){returnPromise.resolve({pageStack:getCurrentPages().map((function(e){returnl(e)}))})},getCurrentPage:function(){vare=getCurrentPages(),t=e.length;returnnewPromise((function(n,r){t?n(l(e[t-1])):r(Error("getCurrentPages().length=0"))}))},callUniMethod:function(e){vart=e.method,n=e.args;returnnewPromise((function(e,r){if(!uni[t])returnr(Error("uni."+t+" not exists"));if(E(t))returne({result:uni[t].apply(uni,n)});varo=[Object.assign({},n[0]||{},{success:function(n){setTimeout((function(){e({result:n})}),"pageScrollTo"===t?350:0)},fail:function(e){r(Error(e.errMsg.replace(t+":fail ","")))}})];uni[t].apply(uni,o)}))},mockUniMethod:function(e){vart=e.method;if(!uni[t])throwError("uni."+t+" not exists");if(!function(e){return!S.test(e)}(t))throwError("You can't mock uni."+t);varr=e.result;if(n(r))returny[t]&&(uni[t]=y[t],deletey[t]),Promise.resolve();varo=E(t)?function(){returnr}:function(e){setTimeout((function(){r.errMsg&&-1!==r.errMsg.indexOf(":fail")?e.fail&&e.fail(r):e.success&&e.success(r),e.complete&&e.complete(r)}),4)};returny[t]||(y[t]=uni[t]),uni[t]=o,Promise.resolve()}},C={getData:function(e){returnv(g(e.pageId),e.path)},setData:function(e){returnh(g(e.pageId),e.data)},callMethod:function(t){varn,r=((n={})[e.VM_NOT_EXISTS]="Page["+t.pageId+"] not exists",n[e.METHOD_NOT_EXISTS]="page."+t.method+" not exists",n);returnnewPromise((function(e,n){T(g(t.pageId),t.method,t.args).then((function(t){returne(t)})).catch((function(e){n(Error(r[e]))}))}))}};functionw(e){returne.nodeId||e.elementId}for(varx={getData:function(e){returnv(m(e.pageId,w(e)),e.path)},setData:function(e){returnh(m(e.pageId,w(e)),e.data)},callMethod:function(t){varn,r=w(t),o=((n={})[e.VM_NOT_EXISTS]="Component["+t.pageId+":"+r+"] not exists",n[e.METHOD_NOT_EXISTS]="component."+t.method+" not exists",n);returnnewPromise((function(e,n){T(m(t.pageId,r),t.method,t.args).then((function(t){returne(t)})).catch((function(e){n(Error(o[e]))}))}))}},M=("undefined"!=typeofcrypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeofmsCrypto&&"function"==typeofmsCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),[]),P=0;P<256;++P)M[P]=(P+256).toString(16).substr(1);["movable-view","picker","ad","button","checkbox-group","checkbox","form","icon","label","movable-area","navigator","picker-view-column","picker-view","progress","radio-group","radio","rich-text","u-slider","swiper-item","swiper","switch"].map((function(e){returnu(a(e))}));varb={};Object.keys(I).forEach((function(e){b["App."+e]=I[e]})),Object.keys(C).forEach((function(e){b["Page."+e]=C[e]})),Object.keys(x).forEach((function(e){b["Element."+e]=x[e]}));var$,k=process.env.UNI_AUTOMATOR_WS_ENDPOINT;functionA(e){$.send({data:JSON.stringify(e)})}functionN(e){vart=JSON.parse(e.data),n=t.id,r=t.method,o=t.params,i={id:n},a=b[r];if(!a&&!a)returni.error={message:r+" unimplemented"},A(i);try{a(o).then((function(e){e&&(i.result=e)})).catch((function(e){i.error={message:e.message}})).finally((function(){A(i)}))}catch(e){i.error={message:e.message},A(i)}}wx.$$initRuntimeAutomator=function(e){void0===e&&(e={}),($=uni.connectSocket({url:k,complete:function(){}})).onMessage(N),$.onOpen((function(t){e.success&&e.success(),console.log("已开启自动化测试...")})),$.onError((function(e){console.log("automator.onError",e)})),$.onClose((function(){e.fail&&e.fail({errMsg:"$$initRuntimeAutomator:fail"}),console.log("automator.onClose")}))},setTimeout((function(){wx.$$initRuntimeAutomator()}),500);
"use strict";functione(e){returne&&"object"==typeofe&&"default"ine?e.default:e}vart=e(require("debug")),r=e(require("licia/isWindows"));require("address"),require("default-gateway"),require("licia/isStr");varo=e(require("licia/getPort")),n=e(require("fs")),s=e(require("child_process")),a=e(require("licia/sleep")),i=e(require("licia/toStr")),c=e(require("licia/waitUntil")),u=e(require("licia/concat")),l=e(require("licia/dateFormat")),d=e(require("ws")),p=require("events"),m=e(require("licia/uuid")),h=e(require("licia/stringify"));require("qrcode-terminal");constw=require("qrcode-reader");/^win/.test(process.platform);classfextendsp.EventEmitter{constructor(e){super(),this.ws=e,this.ws.addEventListener("message",e=>{this.emit("message",e.data)}),this.ws.addEventListener("close",()=>{this.emit("close")})}send(e){this.ws.send(e)}close(){this.ws.close()}}classyextendsp.EventEmitter{constructor(e,r,o){super(),this.puppet=r,this.namespace=o,this.callbacks=newMap,this.transport=e,this.debug=t("automator:protocol:"+this.namespace),this.onMessage=e=>{this.debug(`${l("yyyy-mm-dd HH:MM:ss:l")} ◀ RECV ${e}`);const{id:t,method:r,error:o,result:n,params:s}=JSON.parse(e);if(!t)returnthis.puppet.emit(r,s);const{callbacks:a}=this;if(t&&a.has(t)){conste=a.get(t);a.delete(t),o?e.reject(Error(o.message)):e.resolve(n)}},this.onClose=()=>{this.callbacks.forEach(e=>{e.reject(Error("Connection closed"))})},this.transport.on("message",this.onMessage),this.transport.on("close",this.onClose)}send(e,t={},r=!0){if(r&&this.puppet.adapter.has(e))returnthis.puppet.adapter.send(this,e,t);consto=m(),n=h({id:o,method:e,params:t});returnthis.debug(`${l("yyyy-mm-dd HH:MM:ss:l")} SEND ► ${n}`),newPromise((e,t)=>{try{this.transport.send(n)}catch(e){t(Error("Connection closed"))}this.callbacks.set(o,{resolve:e,reject:t})})}dispose(){this.transport.close()}staticcreateDevtoolConnection(e,t){returnnewPromise((r,o)=>{constn=newd(e);n.addEventListener("open",()=>{r(newy(newf(n),t,"devtool"))}),n.addEventListener("error",o)})}staticcreateRuntimeConnection(e,r,o){returnnewPromise((n,s)=>{t("automator:runtime")(`${l("yyyy-mm-dd HH:MM:ss:l")} port=${e}`);consta=newd.Server({port:e});c(async()=>{if(r.runtimeConnection)return!0},o,1e3).catch(()=>{a.close(),s("Failed to connect to runtime, please make sure the project is running")}),a.on("connection",(function(e){t("automator:runtime")(l("yyyy-mm-dd HH:MM:ss:l")+" connected");consto=newy(newf(e),r,"runtime");r.setRuntimeConnection(o),n(o)})),r.setRuntimeServer(a)})}}constg=t("automator:devtool");asyncfunctionv(e,t,r){const{port:o,cliPath:n,timeout:d,cwd:p="",account:m="",args:h=[],launch:w=!0}=t;letf=!1,v=!1;if(!1!==w){constt={stdio:"ignore",detached:!0};p&&(t.cwd=p);letr=u(h,[]);r=u(r,["auto","--project"]),r=u(r,[e,"--auto-port",i(o)]),m&&(r=u(r,["--auto-account",m]));try{g("%s %o %o",n,r,t);conste=s.spawn(n,r,t);e.on("error",e=>{f=!0}),e.on("exit",()=>{setTimeout(()=>{v=!0},15e3)}),e.unref()}catch(e){f=!1}}elsesetTimeout(()=>{v=!0},15e3);constb=awaitc(async()=>{try{if(f||v)return!0;returnawaitasyncfunction(e,t){letr;try{r=awaity.createDevtoolConnection(e.wsEndpoint,t)}catch(t){throwError(`Failed connecting to ${e.wsEndpoint}, check if target project window is opened with automation enabled`)}returnr}({wsEndpoint:"ws://127.0.0.1:"+o},r)}catch(e){}},d,1e3);if(f)throwError(`Failed to launch ${r.devtools.name}, please make sure cliPath is correctly specified`);if(v)throwError(`Failed to launch ${r.devtools.name} , please make sure http port is open`);returnawaita(5e3),g(l("yyyy-mm-dd HH:MM:ss:l")+" connected"),b}constb={devtools:{name:"Wechat web devTools",remote:!0,automator:!0,paths:[r?"C:/Program Files (x86)/Tencent/微信web开发者工具/cli.bat":"/Applications/wechatwebdevtools.app/Contents/MacOS/cli"],required:["project.config.json","app.json","app.js"],defaultPort:9420,validate:asyncfunction(e,t){constr=function(e,t){constr=t.devtools.paths.slice(0);e&&r.unshift(e);for(consteofr)if(n.existsSync(e))returne;throwError(t.devtools.name+" not found, please specify executablePath option")}(e.executablePath,t);lets=e.port||t.devtools.defaultPort;if(!1!==e.launch)try{s=awaitasyncfunction(e,t){constr=awaito(e||t);if(e&&r!==e)throwError(`Port ${e} is in use, please specify another port`);returnr}(s)}catch(t){e.launch=!1}else{s===awaito(s)&&(e.launch=!0)}returnObject.assign(Object.assign({},e),{port:s,cliPath:r})},asynccreate(e,r,o){constn=awaitv(e,r,o);returno.compiled?t("automator:devtool")("Waiting for runtime automator"):(t("automator:devtool")("initRuntimeAutomator"),n.send("App.callWxMethod",{method:"$$initRuntimeAutomator",args:[]})),n}},adapter:{"Tool.enableRemoteDebug":{reflect:async(e,t)=>{let{qrCode:r}=awaite("Tool.enableRemoteDebug",t,!1);returnr&&(r=awaitfunction(e){constt=newBuffer(e,"base64");returnnewPromise(async(e,r)=>{consto=awaitrequire("jimp").read(t),n=neww;n.callback=function(t,o){if(t)returnr(t);e(o.result)},n.decode(o.bitmap)})}(r)),{qrCode:r}}},"App.callFunction":{reflect:async(e,t)=>{returne("App.callFunction",Object.assign(Object.assign({},t),{functionDeclaration:(r=t.functionDeclaration,"}"===r[r.length-1]?r.replace("{","{\nvar uni = wx;\n"):r.replace("=>","=>{\nvar uni = wx;\nreturn ")+"}")}),!1);varr}},"Element.getHTML":{reflect:async(e,t)=>({html:(awaite("Element.getWXML",t,!1)).wxml})}}};module.exports=b;