/*! *****************************************************************************Copyright (c) Microsoft Corporation.Permission to use, copy, modify, and/or distribute this software for anypurpose with or without fee is hereby granted.THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITHREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITYAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROMLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OROTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE ORPERFORMANCE OF THIS SOFTWARE.***************************************************************************** */
function__spreadArrays(){for(vars=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;varr=Array(s),k=0;for(i=0;i<il;i++)for(vara=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];returnr}vargetRandomValues="undefined"!=typeofcrypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeofmsCrypto&&"function"==typeofmsCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),rnds8=newUint8Array(16);functionrng(){if(!getRandomValues)thrownewError("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");returngetRandomValues(rnds8)}for(varbyteToHex=[],i=0;i<256;++i)byteToHex[i]=(i+256).toString(16).substr(1);functionv4(options,buf,offset){vari=buf&&offset||0;"string"==typeofoptions&&(buf="binary"===options?newArray(16):null,options=null);varrnds=(options=options||{}).random||(options.rng||rng)();if(rnds[6]=15&rnds[6]|64,rnds[8]=63&rnds[8]|128,buf)for(varii=0;ii<16;++ii)buf[i+ii]=rnds[ii];returnbuf||function(buf,offset){vari=offset||0,bth=byteToHex;return[bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]]].join("")}(rnds)}varhasOwnProperty=Object.prototype.hasOwnProperty,isArray=Array.isArray,PATH_RE=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;functiongetPaths(path,data){if(isArray(path))returnpath;if(data&&(val=data,key=path,hasOwnProperty.call(val,key)))return[path];varval,key,res=[];returnpath.replace(PATH_RE,(function(match,p1,offset,string){returnres.push(offset?string.replace(/\\(\\)?/g,"$1"):p1||match),string})),res}functiongetDataByPath(data,path){vardataPath,paths=getPaths(path,data);for(dataPath=paths.shift();null!=dataPath;){if(null==(data=data[dataPath]))return;dataPath=paths.shift()}returndata}functiongetVmNodeId(vm){if(vm._$weex)returnvm._uid;if(vm._$id)returnvm._$id;varparent_1=function(vm){for(varparent=vm.$parent;parent;){if(parent._$id)returnparent;parent=parent.$parent}}(vm);if(!vm.$parent)return"-1";varvnode=vm.$vnode,context=vnode.context;returncontext&&context!==parent_1&&context._$id?context._$id+";"+parent_1._$id+","+vnode.data.attrs._i:parent_1._$id+","+vnode.data.attrs._i}varelementMap=newMap;functiontransEl(el){var_a,_b;if(!function(el){if(el){vartagName=el.tagName;return0===tagName.indexOf("UNI-")||"BODY"===tagName||0===tagName.indexOf("V-UNI-")||el.__isUniElement}return!1}(el))throwError("no such element");varelement,elementId,vm,elem={elementId:(element=el,elementId=element._id,elementId||(elementId=v4(),element._id=elementId,elementMap.set(elementId,{id:elementId,element:element})),elementId),tagName:el.tagName.toLocaleLowerCase().replace("uni-","")};el.__vue__?(vm=el.__vue__)&&(vm.$parent&&vm.$parent.$el===el&&(vm=vm.$parent),vm&&!(null===(_a=vm.$options)||void0===_a?void0:_a.isReserved)&&(elem.nodeId=getVmNodeId(vm))):(vm=el.__vnode)&&(vm.el===el&&(vm=vm.ctx.parent),vm&&!(null===(_b=vm.type)||void0===_b?void0:_b.__reserved)&&(elem.nodeId=getVmNodeId(vm)));return"video"===elem.tagName&&(elem.videoId=elem.nodeId),elem}varFUNCTIONS={input:{input:function(el,value){varvm=el.__vue__;vm?(vm.valueSync=value,vm.$triggerInput({},{value:value})):(vm=el.__vnode).ctx.exposed.$triggerInput({value:value})}},textarea:{input:function(el,value){varvm=el.__vue__;vm?(vm.valueSync=value,vm.$triggerInput({},{value:value})):(vm=el.__vnode).ctx.exposed.$triggerInput({value:value})}},"scroll-view":{scrollTo:function(el,x,y){varmain=el.__vue__?el.__vue__.$refs.main:el;main.scrollLeft=x,main.scrollTop=y},scrollTop:function(el){returnel.__vue__?el.__vue__.$refs.main.scrollTop:el.scrollTop},scrollLeft:function(el){returnel.__vue__?el.__vue__.$refs.main.scrollLeft:el.scrollLeft},scrollWidth:function(el){returnel.__vue__?el.__vue__.$refs.main.scrollWidth:el.scrollWidth},scrollHeight:function(el){returnel.__vue__?el.__vue__.$refs.main.scrollHeight:el.scrollHeight}},swiper:{swipeTo:function(el,index){el.__vue__.current=index}},"movable-view":{moveTo:function(el,x,y){el.__vue__._animationTo(x,y)}},switch:{tap:function(el){el.click()}},slider:{slideTo:function(el,value){varvm=el.__vue__,slider=vm.$refs["uni-slider"],offsetWidth=slider.offsetWidth,boxLeft=slider.getBoundingClientRect().left;vm.value=value,vm._onClick({x:(value-vm.min)*offsetWidth/(vm.max-vm.min)+boxLeft})}}};functioncreateTouchList(touchInits){var_a,touches=touchInits.map((function(touch){returnfunction(touch){if(document.createTouch)returndocument.createTouch(window,touch.target,touch.identifier,touch.pageX,touch.pageY,touch.screenX,touch.screenY);returnnewTouch(touch)}(touch)}));returndocument.createTouchList?(_a=document).createTouchList.apply(_a,touches):touches}varWebAdapter={getWindow:function(pageId){returnwindow},getDocument:function(pageId){returndocument},getEl:function(elementId){varelement=elementMap.get(elementId);if(!element)throwError("element destroyed");returnelement.element},getOffset:function(node){varrect=node.getBoundingClientRect();returnPromise.resolve({left:rect.left+window.pageXOffset,top:rect.top+window.pageYOffset})},querySelector:function(context,selector){return"page"===selector&&(selector="body"),Promise.resolve(transEl(context.querySelector(selector)))},querySelectorAll:function(context,selector){varelements=[],nodeList=document.querySelectorAll(selector);return[].forEach.call(nodeList,(function(node){try{elements.push(transEl(node))}catch(e){}})),Promise.resolve({elements:elements})},queryProperties:function(context,names){returnPromise.resolve({properties:names.map((function(name){varvalue=getDataByPath(context,name.replace(/-([a-z])/g,(function(g){returng[1].toUpperCase()})));return"document.documentElement.scrollTop"===name&&0===value&&(value=getDataByPath(context,"document.body.scrollTop")),"innerText"===name?value.replace(/\n/g,""):value}))})},queryAttributes:function(context,names){returnPromise.resolve({attributes:names.map((function(name){returnString(context.getAttribute(name))}))})},queryStyles:function(context,names){varstyle=getComputedStyle(context);returnPromise.resolve({styles:names.map((function(name){returnstyle[name]}))})},queryHTML:function(context,type){returnPromise.resolve({html:(html="outer"===type?context.outerHTML:context.innerHTML,html.replace(/\n/g,"").replace(/(<uni-text[^>]*>)(<span[^>]*>[^<]*<\/span>)(.*?<\/uni-text>)/g,"$1$3").replace(/<\/?[^>]*>/g,(function(replacement){return-1<replacement.indexOf("<body")?"<page>":"</body>"===replacement?"</page>":0!==replacement.indexOf("<uni-")&&0!==replacement.indexOf("</uni-")?"":replacement.replace(/uni-/g,"").replace(/ role=""/g,"").replace(/ aria-label=""/g,"")})))});varhtml},dispatchTapEvent:function(el){returnel.click(),Promise.resolve()},dispatchLongpressEvent:function(el){returnPromise.resolve()},dispatchTouchEvent:function(el,type,eventInitDict){eventInitDict||(eventInitDict={}),eventInitDict.touches||(eventInitDict.touches=[]),eventInitDict.changedTouches||(eventInitDict.changedTouches=[]),eventInitDict.touches.length||eventInitDict.touches.push({identifier:Date.now(),target:el});vartouches=createTouchList(eventInitDict.touches),changedTouches=createTouchList(eventInitDict.changedTouches),targetTouches=createTouchList([]);returnel.dispatchEvent(newTouchEvent(type,{cancelable:!0,bubbles:!0,touches:touches,targetTouches:targetTouches,changedTouches:changedTouches})),Promise.resolve()},callFunction:function(el,functionName,args){varfn=getDataByPath(FUNCTIONS,functionName);returnfn?Promise.resolve({result:fn.apply(null,__spreadArrays([el],args))}):Promise.reject(Error(functionName+" not exists"))},triggerEvent:function(el,type,detail){varvm=el.__vue__;returnvm.$trigger&&vm.$trigger(type,{},detail),Promise.resolve()}};varApi=Object.assign({},function(adapter){return{"Page.getElement":function(params){returnadapter.querySelector(adapter.getDocument(params.pageId),params.selector)},"Page.getElements":function(params){returnadapter.querySelectorAll(adapter.getDocument(params.pageId),params.selector)},"Page.getWindowProperties":function(params){returnadapter.queryProperties(adapter.getWindow(params.pageId),params.names)}}}(WebAdapter),function(adapter){vargetEl=function(params){returnadapter.getEl(params.elementId,params.pageId)};return{"Element.getElement":function(params){returnadapter.querySelector(getEl(params),params.selector)},"Element.getElements":function(params){returnadapter.querySelectorAll(getEl(params),params.selector)},"Element.getDOMProperties":function(params){returnadapter.queryProperties(getEl(params),params.names)},"Element.getProperties":function(params){varel=getEl(params),ctx=el.__vue__||el.attr||{};returnel.__vueParentComponent&&(ctx=Object.assign({},ctx,el.__vueParentComponent.attrs,el.__vueParentComponent.props)),adapter.queryProperties(ctx,params.names)},"Element.getOffset":function(params){returnadapter.getOffset(getEl(params))},"Element.getAttributes":function(params){returnadapter.queryAttributes(getEl(params),params.names)},"Element.getStyles":function(params){returnadapter.queryStyles(getEl(params),params.names)},"Element.getHTML":function(params){returnadapter.queryHTML(getEl(params),params.type)},"Element.tap":function(params){returnadapter.dispatchTapEvent(getEl(params))},"Element.longpress":function(params){returnadapter.dispatchLongpressEvent(getEl(params))},"Element.touchstart":function(params){returnadapter.dispatchTouchEvent(getEl(params),"touchstart",params)},"Element.touchmove":function(params){returnadapter.dispatchTouchEvent(getEl(params),"touchmove",params)},"Element.touchend":function(params){returnadapter.dispatchTouchEvent(getEl(params),"touchend",params)},"Element.callFunction":function(params){returnadapter.callFunction(getEl(params),params.functionName,params.args)},"Element.triggerEvent":function(params){returnadapter.triggerEvent(getEl(params),params.type,params.detail)}}}(WebAdapter));functionsend(data){returnUniViewJSBridge.publishHandler("onAutoMessageReceive",data)}UniViewJSBridge.subscribe("sendAutoMessage",(function(_a){varid=_a.id,method=_a.method,params=_a.params,data={id:id};if("ping"==method)returndata.result="pong",voidsend(data);varfn=Api[method];if(!fn)returndata.error={message:method+" unimplemented"},send(data);try{fn(params).then((function(res){res&&(data.result=res)})).catch((function(err){data.error={message:err.message}})).finally((function(){send(data)}))}catch(err){data.error={message:err.message},send(data)}}));