"use strict";const e=require("../common/vendor.js"),t=require("../api/http.js");exports.copy=t=>e.index.setClipboardData({data:t,success:function(){console.log("success")}}),exports.timeFormat=(e,t="yyyy-MM-dd hh:mm:ss",o=8)=>{try{if(!e)return"";let s;"string"!=typeof e||isNaN(e)||(e=Number(e)),"number"==typeof e?(10==e.toString().length&&(e*=1e3),s=new Date(e)):s=e;const n=60*s.getTimezoneOffset()*1e3+60*o*60*1e3,r=s.getTime()+n;s=new Date(r);let a={"M+":s.getMonth()+1,"d+":s.getDate(),"h+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in a)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?a[e]:("00"+a[e]).substr((""+a[e]).length)));return t}catch(s){return e}},exports.toast=(t,o="none")=>{e.index.showToast({title:t,icon:o})},exports.uploadFiles=o=>(console.log(o),new Promise((async(s,n)=>{e.index.uploadFile({url:`${t.proxyObj.production}/app-api/infra/file/upload`,filePath:o,name:"file",formData:{},header:{"Tenant-id":"134"},success:e=>{console.log(e);const t=JSON.parse(e.data);0==t.code?s(t.data):n(t.msg)},fail:e=>{n(e)}})})));
