"use strict";const e=require("../../../../common/vendor.js");function n(){return e.index.getDeviceInfo||e.index.canIUse("getDeviceInfo")?e.index.getDeviceInfo():e.index.getSystemInfoSync()}function t(t){const{platform:o}=n();let{SDKVersion:r}=e.index.getAppBaseInfo||e.index.canIUse("getAppBaseInfo")?e.index.getAppBaseInfo():e.index.getSystemInfoSync();return"mac"!==o&&function(e,n){e=e.split("."),n=n.split(".");const t=Math.max(e.length,n.length);for(;e.length<t;)e.push("0");for(;n.length<t;)n.push("0");for(let o=0;o<t;o++){const t=parseInt(e[o],10),r=parseInt(n[o],10);if(t>r)return 1;if(t<r)return-1}return 0}(r,t)>=0}function o(e){return Array.isArray(e)?e:"object"==typeof e&&null!==e?Object.values(e):e}const r=(e.index.getWindowInfo||e.index.canIUse("getWindowInfo")?e.index.getWindowInfo():e.index.getSystemInfoSync()).pixelRatio;exports.canIUseCanvas2d=function(){return t("2.9.0")},exports.convertTouchesToArray=o,exports.devicePixelRatio=r,exports.getDeviceInfo=n,exports.getRect=function(n,t,o){return new Promise(((r,s)=>{const i=e.index.createSelectorQuery().in(t).select(n),c=e=>{e?r(e):s()};o?i.fields({node:!0,size:!0,rect:!0},c).exec():i.boundingClientRect(c).exec()}))},exports.sleep=function(e){return new Promise((n=>{setTimeout((()=>{n(!0)}),e)}))},exports.wrapTouch=function(e){e.touches=o(e.touches);for(let n=0;n<e.touches.length;++n){const t=e.touches[n];t.offsetX=t.x,t.offsetY=t.y}return e};
