my-uniapp-tools
Version:
一个简洁稳定的 uni-app 开发工具库,提供剪贴板、本地存储、导航、系统信息等常用功能
2 lines (1 loc) • 38.9 kB
JavaScript
import{areaList as e,useCascaderAreaData as t}from"@vant/area-data";const n="5.0.3";class r extends Error{code;module;timestamp;constructor(e,t,n){super(t),this.name="UniAppToolsError",this.code=e,this.module=n,this.timestamp=Date.now()}}class o{static instance;errorCallbacks=[];static getInstance(){return o.instance||(o.instance=new o),o.instance}onError(e){return"function"!=typeof e?()=>{}:(this.errorCallbacks.push(e),()=>{const t=this.errorCallbacks.indexOf(e);t>=0&&this.errorCallbacks.splice(t,1)})}handleError(e,t){const n=e instanceof Error?e:new Error(String(e)),o={code:n instanceof r?n.code:"UNKNOWN_ERROR",message:n.message,module:n instanceof r?n.module:t,timestamp:n instanceof r?n.timestamp:Date.now(),stack:n.stack};console.error(`[${o.module}] ${o.code}: ${o.message}`,o),this.errorCallbacks.forEach(e=>{try{e(o)}catch(e){console.error("Error in error callback:",e)}})}createModuleErrorHandler(e){return(t,n,o)=>{const s=new r(t,n,e);return o instanceof Error&&(s.stack=o.stack),this.handleError(s,e),s}}}async function s(e,t,n="ASYNC_ERROR"){try{return await e()}catch(e){return o.getInstance().createModuleErrorHandler(t)(n,`异步操作失败: ${e instanceof Error?e.message:String(e)}`,e),null}}function i(e,t,n="SYNC_ERROR",r=null){try{return e()}catch(e){return o.getInstance().createModuleErrorHandler(t)(n,`同步操作失败: ${e instanceof Error?e.message:String(e)}`,e),r}}const a=o.getInstance();let c=null,u=null,l=null;const f=()=>{l=null},m=e=>"weixin"===e||"alipay"===e;let p=!1;const d=()=>{if(c)return c;let e="unknown";try{"undefined"!=typeof wx&&wx.getSystemInfoSync?e="weixin":"undefined"!=typeof my&&my.getSystemInfoSync?e="alipay":"undefined"!=typeof window&&window.document?e="h5":"undefined"!=typeof plus&&(e="app")}catch(t){e="weixin",e="web",e="app",e="alipay",e="h5"}return c=e,e},g=(e=!0)=>e&&l?l:i(()=>{if("undefined"==typeof uni||"function"!=typeof uni.getWindowInfo)return null;const t=uni.getWindowInfo();return e&&(l=t),t},"system","GET_WINDOW_INFO_ERROR",null),y=()=>{try{if("undefined"==typeof uni||"function"!=typeof uni.getAccountInfoSync)throw new Error("当前环境不支持 getAccountInfoSync");const e=uni.getAccountInfoSync();return{appId:e.miniProgram?.appId||"",version:e.miniProgram?.version||"",envVersion:e.miniProgram?.envVersion||"",accountInfo:e}}catch(e){return a.handleError(new r("GET_ACCOUNT_INFO_ERROR",`获取小程序账户信息失败: ${e instanceof Error?e.message:String(e)}`,"system"),"system"),{appId:"",version:"",envVersion:"",accountInfo:{}}}},h=()=>{if(!p)try{if("undefined"==typeof uni||"function"!=typeof uni.getUpdateManager)return;const e=uni.getUpdateManager();p=!0,e.onCheckForUpdate(function(e){e.hasUpdate}),e.onUpdateReady(function(t){uni.showModal({title:"更新提示",content:"新版本已经准备好,是否重启应用?",showCancel:!0,cancelText:"稍后",confirmText:"立即重启",success(t){t.confirm&&e.applyUpdate()}})}),e.onUpdateFailed(function(e){a.handleError(new r("UPDATE_DOWNLOAD_FAILED","新版本下载失败","system"),"system"),uni.showModal({title:"更新失败",content:"新版本下载失败,请检查网络连接或稍后重试",showCancel:!1,confirmText:"知道了"})})}catch(e){a.handleError(new r("CHECK_UPDATE_ERROR",`版本更新检查失败: ${e instanceof Error?e.message:String(e)}`,"system"),"system")}},w=()=>{if(null!==u)return u;try{const e=g();return u=e?.statusBarHeight||0,u}catch(e){return a.handleError(new r("GET_STATUS_BAR_HEIGHT_ERROR",`获取状态栏高度失败: ${e instanceof Error?e.message:String(e)}`,"system"),"system"),0}},E=()=>{try{const e=d();return m(e)?uni.getMenuButtonBoundingClientRect():null}catch(e){return a.handleError(new r("GET_MENU_BUTTON_ERROR",`获取菜单按钮边界信息失败: ${e instanceof Error?e.message:String(e)}`,"system"),"system"),null}},S=()=>{try{const e=d();if(m(e)){const e=E();return e?.height||44}return 44}catch(e){return a.handleError(new r("GET_NAVIGATION_BAR_HEIGHT_ERROR",`获取导航栏高度失败: ${e instanceof Error?e.message:String(e)}`,"system"),"system"),44}},R=()=>{const e=d(),t=w(),n=S();return{platform:e,statusBarHeight:t,navigationBarHeight:n,totalTopHeight:t+n}},A=()=>{const e=R();return{statusBarHeight:e.statusBarHeight,navHeight:e.totalTopHeight}},T=()=>R().totalTopHeight,v=e=>"string"!=typeof e?(console.warn("setPageTitle: title必须是字符串"),Promise.resolve(!1)):""===e.trim()?(console.warn("setPageTitle: title不能为空"),Promise.resolve(!1)):new Promise(t=>{try{if("undefined"==typeof uni||"function"!=typeof uni.setNavigationBarTitle)return void t(!1);uni.setNavigationBarTitle({title:e,success:()=>{t(!0)},fail:e=>{console.warn("设置页面标题失败:",e),t(!1)}})}catch(e){a.handleError(new r("SET_PAGE_TITLE_ERROR",`setPageTitle执行异常: ${e instanceof Error?e.message:String(e)}`,"system"),"system"),t(!1)}}),b=(e,t="image/x-icon")=>i(()=>{if("string"!=typeof e||""===e.trim())return!1;const n=d();if("h5"===n||"web"===n){if("undefined"!=typeof document){document.querySelectorAll('link[rel*="icon"]').forEach(e=>e.remove());const n=document.createElement("link");return n.rel="icon",n.type=t,n.href=e,document.head.appendChild(n),!0}}else console.warn("setPageIcon 仅在H5/Web平台有效");return!1},"system","SET_PAGE_ICON_ERROR",!1),_=o.getInstance();function O(e){if(null===e||"object"!=typeof e)return e;try{return"undefined"!=typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e))}catch(e){const t=e instanceof Error?e.message:String(e);throw _.handleError(new r("DEEP_CLONE_ERROR",`深拷贝失败: ${t}`,"utils"),"utils"),new Error(`深拷贝失败: ${t}`)}}function I(e,t){if(!e||"object"!=typeof e||Array.isArray(e))return O(t||{});if(!t||"object"!=typeof t||Array.isArray(t))return O(e);const n=O(e);return function e(t,n){for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const o=n[r],s=t[r];o&&"object"==typeof o&&!Array.isArray(o)&&s&&"object"==typeof s&&!Array.isArray(s)?e(s,o):t[r]=O(o)}}(n,t),n}function C(e,t){if(!e||"object"!=typeof e||Array.isArray(e))return e;if(!t||0===Object.keys(t).length)return e;const n={...e};for(const r of Object.keys(e))t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function P(e,t,n=!1){let r,o=null;const s=function(...s){const i=n&&!o;return o&&clearTimeout(o),o=setTimeout(()=>{o=null,n||(r=e.apply(this,s))},t),i&&(r=e.apply(this,s)),r};return s.cancel=()=>{o&&(clearTimeout(o),o=null)},s}function M(e,t,n={}){let r,o=null,s=0;const{leading:i=!0,trailing:a=!0}=n,c=function(...n){const c=Date.now();s||i||(s=c);const u=t-(c-s);return u<=0||u>t?(o&&(clearTimeout(o),o=null),s=c,r=e.apply(this,n)):!o&&a&&(o=setTimeout(()=>{s=i?Date.now():0,o=null,r=e.apply(this,n)},u)),r};return c.cancel=()=>{o&&(clearTimeout(o),o=null),s=0},c}const N=e=>{try{if("undefined"==typeof window||!window.location)throw new Error("不在 H5 浏览器环境中");const t=new URLSearchParams(window.location.search),n={};return t.forEach((e,t)=>{try{n[t]=decodeURIComponent(e)}catch(r){n[t]=e}}),e?Object.prototype.hasOwnProperty.call(n,e)?n[e]:null:n}catch(t){return _.handleError(new r("GET_H5_URL_PARAMS_ERROR",`获取H5 URL参数失败: ${t instanceof Error?t.message:String(t)}`,"utils"),"utils"),e?null:{}}};function L(e){try{if("string"!=typeof e||!e.trim())throw new Error("URL不能为空");const t=new URL(e,"http://localhost"),n=t.pathname,r={};return t.searchParams.forEach((e,t)=>{r[t]=e}),{path:n,params:r}}catch(t){return _.handleError(new r("EXTRACT_URL_PARTS_ERROR",`无效的URL: ${e}`,"utils"),"utils"),{path:"",params:{}}}}const F=e,j=t;function x(){return t()}const D=(e="",t=!1,n="none",r=2e3)=>{const o="undefined"==typeof uni?null:uni;o&&"function"==typeof o.showToast&&o.showToast({title:"string"==typeof e?e:String(e??""),icon:n,mask:Boolean(t),duration:Number.isFinite(r)&&r>0?r:2e3})},$=o.getInstance();let k={defaultHomePage:"/pages/index/index"};function U(e){e&&"object"==typeof e&&(k={...k,...e})}function B(e,t){const n="string"==typeof e?e:String(e??"");if(!t||"object"!=typeof t)return n;const r=Object.entries(t).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(String(t))}`).join("&");return r?n+(n.includes("?")?"&":"?")+r:n}const H=B;function J(e,t,n){const o=n?.errMsg?`${t} - ${n.errMsg}`:t;$.handleError(new r(e,o,"navigation"),"navigation")}function W(){return"function"==typeof getCurrentPages?getCurrentPages():[]}function G(){return"undefined"==typeof uni?null:uni}async function K(e="",t={}){return new Promise(n=>{const r=t&&"object"==typeof t?t:{},o="number"==typeof r.delta&&Number.isFinite(r.delta)&&r.delta>0?Math.floor(r.delta):1,s="number"==typeof r.timeout&&Number.isFinite(r.timeout)&&r.timeout>0?r.timeout:5e3,i=G();if(!i||"function"!=typeof i.navigateBack)return J("NAVIGATION_ENV_ERROR","当前环境不支持 navigateBack"),void n(!1);const a=W();if(a.length<=o)return console.warn(`[navigation] 无法返回${o}页,当前页面栈深度不足(当前: ${a.length})`),void n(!1);let c=!1;const u=setTimeout(()=>{c||(c=!0,console.warn("[navigation] 页面init回调执行超时"),n(!1))},s);i.navigateBack({delta:o,success:()=>{clearTimeout(u),setTimeout(()=>{if(!c)try{const t=W();if(t.length>0){const n=t[t.length-1];n.$vm&&"function"==typeof n.$vm.init&&n.$vm.init(e)}c=!0,n(!0)}catch(e){J("PAGE_CALLBACK_ERROR",`页面回调执行失败: ${e instanceof Error?e.message:String(e)}`),c=!0,n(!0)}},100)},fail:e=>{clearTimeout(u),J("NAVIGATE_BACK_FAILED","导航返回失败",e),c=!0,n(!1)}})})}async function z(e="",t={}){const n=t&&"object"==typeof t?t:{},r=W(),o="number"==typeof n.delta&&Number.isFinite(n.delta)&&n.delta>0?Math.floor(n.delta):1;if(r.length>o)return await K(e,t);const s=n.homePage||k.defaultHomePage,i=s.startsWith("/")?s:`/${s}`;return console.info(`[navigation] 页面栈深度不足,重定向到首页: ${i}`),new Promise(e=>{const t=G();if(!t||"function"!=typeof t.reLaunch)return J("NAVIGATION_ENV_ERROR","当前环境不支持 reLaunch"),void e(!1);const r=B(i,n.homeParams);t.reLaunch({url:r,success:()=>e(!0),fail:t=>{J("RELAUNCH_FAILED",`重新启动失败: ${r}`,t),e(!1)}})})}const Y=P(K,300);function V(){try{const e=W();if(0===e.length)return null;const t=e[e.length-1];return{route:t.route||"",options:t.options||{}}}catch(e){return J("GET_CURRENT_PAGE_ERROR",`获取当前页面信息失败: ${e instanceof Error?e.message:String(e)}`),null}}const q=V;function X(){try{return W().map(e=>({route:e.route||"",options:e.options||{}}))}catch(e){return J("GET_PAGE_STACK_ERROR",`获取页面栈信息失败: ${e instanceof Error?e.message:String(e)}`),[]}}const Q=X,Z={showToast:!0,successMessage:"复制成功",failMessage:"复制失败",timeout:5e3};async function ee(e,t={}){const n={...Z,...t},r="number"==typeof n.timeout&&Number.isFinite(n.timeout)&&n.timeout>0?n.timeout:0,o="string"==typeof e?e:String(e??"");return o?o.length>1e4?(n.showToast&&D("复制内容过长",!1,"error"),!1):await s(()=>new Promise(e=>{const t="undefined"==typeof uni?null:uni;if(!t||"function"!=typeof t.setClipboardData)return n.showToast&&D(n.failMessage,!1,"error"),void e(!1);let s=!1,i=null;const a=t=>{s||(s=!0,i&&(clearTimeout(i),i=null),e(t))};r>0&&(i=setTimeout(()=>{n.showToast&&D(n.failMessage,!1,"error"),a(!1)},r)),t.setClipboardData({data:o,showToast:!1,success:()=>{n.showToast&&D(n.successMessage),a(!0)},fail:()=>{n.showToast&&D(n.failMessage),a(!1)}})}),"clipboard","COPY_TEXT_ERROR")??!1:(n.showToast&&D("复制内容不能为空",!1,"error"),!1)}const te=o.getInstance();function ne(){return"undefined"==typeof uni?null:uni}class re{static instance;cache=new Map;maxCacheSize=100;static getInstance(){return re.instance||(re.instance=new re),re.instance}isExpired(e){return!!e.ttl&&Date.now()-e.timestamp>e.ttl}remember(e,t){if(this.cache.size>=this.maxCacheSize){const e=this.cache.keys().next().value;e&&this.cache.delete(e)}this.cache.set(e,t)}createItem(e,t={}){return{value:e,timestamp:Date.now(),ttl:t.ttl}}set(e,t,n={}){try{if(!e||"string"!=typeof e)return!1;const r=ne();if(!r||"function"!=typeof r.setStorageSync)return!1;const o=this.createItem(t,n),s=JSON.stringify(o);if(s.length>1048576)throw new Error("存储数据过大");return r.setStorageSync(e,s),this.remember(e,o),!0}catch(e){return te.handleError(new r("SET_STORAGE_ERROR",`设置存储失败: ${e instanceof Error?e.message:String(e)}`,"localStorage"),"localStorage"),!1}}async setAsync(e,t,n={}){try{if(!e||"string"!=typeof e)return!1;const r=ne();if(!r||"function"!=typeof r.setStorage)return this.set(e,t,n);const o=this.createItem(t,n),s=JSON.stringify(o);return!(s.length>1048576)&&await new Promise(t=>{r.setStorage({key:e,data:s,success:()=>{this.remember(e,o),t(!0)},fail:()=>t(!1)})})}catch(e){return te.handleError(new r("SET_STORAGE_ASYNC_ERROR",`异步设置存储失败: ${e instanceof Error?e.message:String(e)}`,"localStorage"),"localStorage"),!1}}get(e,t){try{if(!e||"string"!=typeof e)return t;if(this.cache.has(e)){const n=this.cache.get(e);return this.isExpired(n)?(this.cache.delete(e),this.remove(e),t):n.value}const n=ne();if(!n||"function"!=typeof n.getStorageSync)return t;const r=n.getStorageSync(e);if(!r||"string"!=typeof r)return t;const o=JSON.parse(r);let s;return s=o&&"object"==typeof o&&"value"in o&&"timestamp"in o?o:{value:o,timestamp:Date.now()},this.isExpired(s)?(this.remove(e),t):(this.cache.set(e,s),s.value)}catch(n){return console.warn(`[localStorage] 获取存储失败 [${e}]:`,n),t}}async getAsync(e,t){try{if(!e||"string"!=typeof e)return t;if(this.cache.has(e)){const n=this.cache.get(e);return this.isExpired(n)?(this.cache.delete(e),this.remove(e),t):n.value}const n=ne();if(!n||"function"!=typeof n.getStorage)return this.get(e,t);const r=await new Promise(t=>{n.getStorage({key:e,success:e=>t(e.data),fail:()=>t(void 0)})});if(!r||"string"!=typeof r)return t;const o=JSON.parse(r),s=o&&"object"==typeof o&&"value"in o&&"timestamp"in o?o:{value:o,timestamp:Date.now()};return this.isExpired(s)?(this.remove(e),t):(this.remember(e,s),s.value)}catch(n){return console.warn(`[localStorage] 异步获取存储失败 [${e}]:`,n),t}}remove(e){try{if(!e||"string"!=typeof e)return!1;const t=ne();return!(!t||"function"!=typeof t.removeStorageSync||(t.removeStorageSync(e),this.cache.delete(e),0))}catch(t){return te.handleError(new r("REMOVE_STORAGE_ERROR",`删除存储失败: ${e}`,"localStorage"),"localStorage"),!1}}clear(){try{const e=ne();return!(!e||"function"!=typeof e.clearStorageSync||(e.clearStorageSync(),this.cache.clear(),0))}catch(e){return te.handleError(new r("CLEAR_STORAGE_ERROR","清空存储失败","localStorage"),"localStorage"),!1}}getInfo(){try{const e=ne();if(!e||"function"!=typeof e.getStorageInfoSync)return{keys:[],currentSize:0,limitSize:0};const t=e.getStorageInfoSync();return{keys:t.keys||[],currentSize:t.currentSize||0,limitSize:t.limitSize||0}}catch(e){return te.handleError(new r("GET_STORAGE_INFO_ERROR",`获取存储信息失败: ${e instanceof Error?e.message:String(e)}`,"localStorage"),"localStorage"),{keys:[],currentSize:0,limitSize:0}}}cleanExpired(){try{const e=this.getInfo();let t=0;return e.keys.forEach(e=>{void 0===this.get(e)&&t++}),t}catch(e){return te.handleError(new r("CLEAN_EXPIRED_ERROR",`清理过期数据失败: ${e instanceof Error?e.message:String(e)}`,"localStorage"),"localStorage"),0}}}const oe=re.getInstance();function se(e,t,n={}){return oe.set(e,t,n)}function ie(e,t){return oe.get(e,t)}function ae(e){return void 0!==e?oe.remove(e):oe.clear()}async function ce(e,t,n={}){return await oe.setAsync(e,t,n)}async function ue(e,t){return await oe.getAsync(e,t)}function le(){return oe.getInfo()}function fe(){return oe.cleanExpired()}function me(e,t={}){if(!e||"object"!=typeof e||Array.isArray(e))return 0;let n=0;return Object.entries(e).forEach(([e,r])=>{se(e,r,t)&&n++}),n}function pe(e){const t={};return Array.isArray(e)?(e.forEach(e=>{t[e]=ie(e)}),t):t}const de="上传失败",ge="已取消上传",ye="选择文件失败",he="用户取消选择",we="未选择任何文件",Ee=e=>`部分文件大小超过 ${e}MB 限制`,Se=e=>`存在不支持的文件类型,仅支持:${e.join(", ")}`,Re="当前环境不支持文件选择",Ae=e=>`上传超时(${e}ms)`,Te=e=>`上传请求失败: ${e}`,ve=e=>`上传失败,状态码:${e}`,be={FIELD_NAME:"file",FILE_TYPE:"image",COUNT:1,SHOW_TOAST:!0};function _e(e){if(!e||"string"!=typeof e)return;const t=e.split(/[?#]/)[0].match(/\.([^./\\]+)$/);return t?t[1].toLowerCase():void 0}function Oe(e){if("string"!=typeof e)return"";const t=e.trim().toLowerCase().replace(/^\./,"");return"jpeg"===t||"jpe"===t?"jpg":t}function Ie(e){if(!Array.isArray(e))return;const t=Array.from(new Set(e.map(e=>Oe(e)).filter(Boolean)));return t.length>0?t:void 0}function Ce(e){return`${Date.now()}_${e}_${Math.random().toString(16).slice(2)}`}function Pe(e){return"string"==typeof e&&e.startsWith("blob:")}function Me(e){if(Pe(e)&&"undefined"!=typeof URL&&"function"==typeof URL.revokeObjectURL)try{URL.revokeObjectURL(e)}catch{}}function Ne(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch{return e}}function Le(e){if(null==e)return"";const t=typeof e;if("string"===t||"number"===t||"boolean"===t)return String(e);if("object"===t)try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function Fe(e){if(!e||"object"!=typeof e||Array.isArray(e))return;const t={},n=e;return Object.keys(n).forEach(e=>{t[e]=Le(n[e])}),t}function je(e){if(!e||"object"!=typeof e||Array.isArray(e))return;const t={};return Object.keys(e).forEach(n=>{const r=e[n];null!=r&&(t[n]=String(r))}),Object.keys(t).length>0?t:void 0}function xe(e){const t=(e||"").trim();if(!t)return"选择文件失败";const n=t.toLowerCase();return n.includes("fail cancel")||n.includes("cancel")?"用户取消选择":/[\u4e00-\u9fff]/.test(t)?t:"选择文件失败"}function De(e,t){return null==t||"number"!=typeof t||!Number.isFinite(t)||t<0?{valid:!0}:("number"==typeof e&&Number.isFinite(e)&&e>0?e:0)>1024*t*1024?{valid:!1,message:`文件大小不能超过 ${t}MB`}:{valid:!0}}function $e(e,t){return!Number.isFinite(t)||t<=0?0:"number"!=typeof e||!Number.isFinite(e)||e<=0?t:Math.min(Math.floor(e),t)}function ke(e){return{toast:"function"==typeof e.toast?e.toast:D,shouldShowToast:void 0===e.showToast?be.SHOW_TOAST:Boolean(e.showToast)}}function Ue(e){return Boolean(e?.aborted)}function Be(e){return[{file:null,success:!1,message:e}]}function He(){return Be(ge)}function Je(e,t){t.autoRevokeObjectURL&&e.forEach(e=>{Me(e.path)})}async function We(e,t,n){const r=function(e){const t=e&&"object"==typeof e?e:{},n="image"===t.type||"file"===t.type||"any"===t.type?t.type:be.FILE_TYPE,r="number"==typeof t.count&&Number.isFinite(t.count)&&t.count>0?Math.floor(t.count):be.COUNT,o="number"==typeof t.timeoutMs&&Number.isFinite(t.timeoutMs)&&t.timeoutMs>0?t.timeoutMs:void 0,s=Array.isArray(t.files)?t.files.filter(e=>Boolean(e)&&"object"==typeof e&&"string"==typeof e.path):void 0;return{...t,url:"string"==typeof t.url?t.url:"",files:s,type:n,count:r,extensions:Ie(t.extensions),fieldName:"string"==typeof t.fieldName&&t.fieldName.trim()?t.fieldName:be.FIELD_NAME,formData:Fe(t.formData),headers:je(t.headers),timeoutMs:o,autoRevokeObjectURL:Boolean(t.autoRevokeObjectURL),signal:(i=t.signal,Boolean(i&&"object"==typeof i&&"function"==typeof i.addEventListener)?t.signal:void 0),beforeUpload:"function"==typeof t.beforeUpload?t.beforeUpload:void 0,onProgress:"function"==typeof t.onProgress?t.onProgress:void 0,toast:"function"==typeof t.toast?t.toast:void 0,progressToastFormatter:"function"==typeof t.progressToastFormatter?t.progressToastFormatter:void 0,successMessage:"string"==typeof t.successMessage?t.successMessage:void 0,failMessage:"string"==typeof t.failMessage?t.failMessage:void 0};var i}(e),{url:o,files:s,type:i=be.FILE_TYPE,count:a=be.COUNT,maxSizeMB:c,extensions:u,signal:l,successMessage:f}=r,m=o,{toast:p,shouldShowToast:d}=ke(r);if(!m.trim()){const e="上传地址不能为空";return d&&p(e,!1,"none"),Be(e)}if(Ue(l))return d&&p(ge,!1,"none"),He();const g=Array.isArray(s);let y=Array.isArray(s)?s:[];if(0===y.length&&!g)try{const e=await t({type:i,count:a,extensions:u});if(!e.success)return d&&e.message&&p(e.message,!1,"none"),[{file:null,success:!1,message:e.message}];y=e.files}catch(e){const t=e instanceof Error?e.message:ye;return d&&p(t,!1,"none"),Be(t)}if(0===y.length)return Be(we);const h=function(e,t){if(!e||0===e.length)return{success:!1,message:we};const{maxSizeMB:n,extensions:r}=t||{};if(0===n)return{success:!1,message:"当前不允许选择文件"};const o=null!=n&&"number"==typeof n&&Number.isFinite(n)&&n>0,s=Ie(r)||[],i=s.length>0;if(!o&&!i)return{success:!0};const a=i?new Set(s):null;for(const t of e){if(o&&!De(t.size,n).valid)return{success:!1,message:Ee(n)};if(i&&a){const e=t.ext?Oe(t.ext):void 0;if(!e||!a.has(e))return{success:!1,message:Se(s)}}}return{success:!0}}(y,{maxSizeMB:c,extensions:u});if(!h.success){const e=h.message||ye;return d&&p(e,!1,"none"),Je(y,r),Be(e)}if(Ue(l))return d&&p(ge,!1,"none"),Je(y,r),He();const w=await async function(e,t,n,r){const{concurrency:o,signal:s,beforeUpload:i,onProgress:a,showProgressToast:c,progressToastFormatter:u}=t,{toast:l,shouldShowToast:f}=ke(t),m=new Array(e.length);let p=0;const d=e.length,g=$e(o,d),y=Boolean(c&&d>0),h="undefined"!=typeof uni?uni:null,w=Boolean(y&&h&&"function"==typeof h.showLoading&&"function"==typeof h.hideLoading),E=w,S=M((t,n)=>{if(!w)return;const r=function(e){const{files:t,index:n,pct:r,finishedCount:o,totalCount:s,progressToastFormatter:i}=e;if("function"==typeof i)try{return i(t[n],r,n+1,s)}catch{}return 1===s?`上传中 ${r}%`:`上传中 (${o}/${s})`}({files:e,index:t,pct:n,finishedCount:p,totalCount:d,progressToastFormatter:u});h.showLoading({title:r,mask:!0})},200);const R=async o=>{const c=e[o];let u=null;try{if(Ue(s))return u={file:c,success:!1,message:ge},Je([c],t),void(w&&S(o,0));const e=await async function(e){if(!i)return null;try{return await i(e)?null:{file:e,success:!1,message:ge}}catch(t){const n=(e=>`上传前检查失败: ${e}`)(t instanceof Error?t.message:String(t??"unknown"));return f&&l(n,!1,"error"),{file:e,success:!1,message:n}}}(c);if(e)return u=e,void Je([c],t);const m=function(e){return E?{...t,onProgress:(t,n)=>{S(e,n),a&&a(t,n)}}:t}(o);u=await r(c,m,n)}catch(e){u={file:c,success:!1,message:e instanceof Error?e.message:String(e??"Unknown error")}}finally{u||(u={file:c,success:!1,message:"Unknown error"}),m[o]=u,p++,u.success&&S(o,100)}};for(let e=0;e<d;e+=g){const t=Math.min(e+g,d),n=[];for(let r=e;r<t;r+=1)n.push(R(r));await Promise.all(n)}return w&&(S.cancel?.(),h.hideLoading()),m}(y,r,m,n);return w.filter(e=>e.success).length===w.length&&1===w.length&&d&&p(f||"上传成功",!1,"none"),w}function Ge(e){const{type:t="image",count:n=1,extensions:r}=e;return new Promise(e=>{if("undefined"==typeof document||"undefined"==typeof window)return void e({success:!1,files:[],message:Re});const o=document.createElement("input");o.type="file",o.multiple=n>1,o.style.display="none";const s=Ie(r);"image"===t?o.accept="image/*":s&&(o.accept=s.map(e=>`.${e}`).join(","));let i=!1,a=null;const c=t=>{i||(i=!0,(()=>{a&&(clearTimeout(a),a=null),window.removeEventListener("focus",l);try{o.remove()}catch{}})(),e(t))},u=e=>{if(!e||0===e.length)return void c({success:!1,files:[],message:he});const t=Array.from(e).slice(0,n).map((e,t)=>({id:Ce(t),name:e.name,size:e.size,path:URL.createObjectURL(e),mimeType:e.type,ext:_e(e.name),source:"file",platform:"h5",raw:e}));c({success:!0,files:t})};o.addEventListener("change",()=>u(o.files)),o.addEventListener("cancel",()=>c({success:!1,files:[],message:he}));const l=()=>{i||(a=window.setTimeout(()=>{i||(o.files&&0!==o.files.length?u(o.files):c({success:!1,files:[],message:he}))},300))};window.addEventListener("focus",l),document.body.appendChild(o),o.click()})}function Ke(e,t,n){const{fieldName:r="file",formData:o,headers:s,timeoutMs:i,autoRevokeObjectURL:a}=t,{signal:c,onProgress:u}=t,l="string"==typeof r&&r.trim()?r:"file",f="number"==typeof i&&Number.isFinite(i)&&i>0?i:void 0,m=je(s),p=Fe(o),d="function"==typeof u?u:void 0;return new Promise(t=>{const r=e.raw;if(!("undefined"!=typeof File&&r&&r instanceof File))return void t({file:e,success:!1,message:"H5 环境缺少原生文件对象"});const o=new XMLHttpRequest;let s=!1,i=null;const u=n=>{s||(s=!0,c&&i&&"function"==typeof c.removeEventListener&&(c.removeEventListener("abort",i),i=null),a&&Pe(e.path)&&Me(e.path),t(n))};if(c&&"function"==typeof c.addEventListener){if(c.aborted)return void u({file:e,success:!1,message:ge});i=()=>{o.abort(),u({file:e,success:!1,message:ge})},c.addEventListener("abort",i,{once:!0})}o.open("POST",n),f&&f>0&&(o.timeout=f),m&&Object.keys(m).forEach(e=>{o.setRequestHeader(e,m[e])});const g=new FormData;g.append(l,r,e.name),p&&Object.keys(p).forEach(e=>{g.append(e,Le(p[e]))}),o.upload.onprogress=t=>{if(t.lengthComputable&&d){const n=Math.round(t.loaded/t.total*100);d(e,n)}},o.onload=()=>{const t=o.status,n=t>=200&&t<300;let r=Ne(o.responseText);u({file:e,success:n,statusCode:t,data:r,message:n?void 0:ve(t)})},o.onerror=()=>u({file:e,success:!1,message:de}),o.ontimeout=()=>u({file:e,success:!1,message:Ae(f||0)}),o.onabort=()=>u({file:e,success:!1,message:ge});try{o.send(g)}catch(t){const n=t instanceof Error?t.message:"Unknown error";u({file:e,success:!1,message:Te(n)})}})}function ze(e){const{type:t="image",count:n=1,extensions:r}=e,o=Ie(r);return new Promise(e=>{const r="undefined"==typeof uni?null:uni;if(!r)return void e({success:!1,files:[],message:Re});const s=function(){if("undefined"!=typeof wx&&wx?.getSystemInfoSync)return"weixin";if("undefined"!=typeof my&&my?.getSystemInfoSync)return"alipay";if("undefined"!=typeof window&&"undefined"!=typeof document)return"h5";if("undefined"!=typeof plus)return"app";let e="unknown";return e="h5",e="weixin",e="alipay",e="app","app"}(),i=t=>{e({success:!1,files:[],message:xe(t?.errMsg)})},a=[{name:"chooseMedia(image)",when:()=>"image"===t&&"weixin"===s&&"function"==typeof r.chooseMedia,run:()=>{r.chooseMedia({count:n,mediaType:["image"],success:t=>{const n=(Array.isArray(t?.tempFiles)?t.tempFiles:[]).map((e,t)=>{const n=e.size||e.fileSize||e.originalFileSize||0;return Ye(e.tempFilePath,t,n,"album",s,e)});e({success:!0,files:n})},fail:i})}},{name:"chooseImage",when:()=>"image"===t&&"function"==typeof r.chooseImage,run:()=>{r.chooseImage({count:n,success:t=>{const n=(Array.isArray(t?.tempFiles)?t.tempFiles:t?.tempFiles?[t.tempFiles]:[]).map((e,t)=>Ye(e.path,t,e.size,"album",s,e));e({success:!0,files:n})},fail:i})}},{name:"chooseFile",when:()=>"image"!==t&&"function"==typeof r.chooseFile,run:()=>{r.chooseFile({count:n,type:"all",extension:o?.map(e=>`.${e}`),success:t=>{const n=(Array.isArray(t?.tempFiles)?t.tempFiles:Array.isArray(t?.tempFilePaths)?t.tempFilePaths:[]).map((e,t)=>"string"==typeof e?Ye(e,t,0,"file",s,e):Ye(e?.path||e?.tempFilePath||e?.filePath||"",t,e?.size||e?.fileSize||0,"file",s,e,e?.name));e({success:!0,files:n})},fail:i})}},{name:"chooseMessageFile(all)",when:()=>"function"==typeof r.chooseMessageFile,run:()=>{r.chooseMessageFile({count:n,type:"all",success:t=>{const n=(Array.isArray(t?.tempFiles)?t.tempFiles:[]).map((e,t)=>Ye(e.path,t,e.size,"file",s,e,e.name));e({success:!0,files:n})},fail:i})}}];for(const e of a)if(e.when())return void e.run();e({success:!1,files:[],message:"当前平台不支持文件选择"})})}function Ye(e,t,n,r,o,s,i){const a="string"==typeof e?e:"",c="string"==typeof i&&i.trim()?i:a.split(/[\\/]/).pop()||`file_${t}`,u="number"==typeof n&&Number.isFinite(n)&&n>0?n:0;return{id:Ce(t),name:c,size:u,path:a,ext:_e(c||a),source:r,platform:o,raw:s}}function Ve(e,t,n){const{fieldName:r="file",formData:o,headers:s,timeoutMs:i}=t,{signal:a,onProgress:c}=t,u="string"==typeof r&&r.trim()?r:"file",l="number"==typeof i&&Number.isFinite(i)&&i>0?i:void 0,f=je(s),m=Fe(o),p="function"==typeof c?c:void 0;return new Promise(t=>{const r="undefined"==typeof uni?null:uni;if(!r?.uploadFile)return void t({file:e,success:!1,message:"当前环境不支持文件上传"});let o=!1,s=null,i=null,c=null;const d=e=>{o||(o=!0,s&&clearTimeout(s),a&&c&&"function"==typeof a.removeEventListener&&(a.removeEventListener("abort",c),c=null),t(e))};l&&l>0&&(s=setTimeout(()=>{i?.abort?.(),d({file:e,success:!1,message:Ae(l)})},l)),i=r.uploadFile({url:n,filePath:e.path,name:u,header:f,formData:m,success:t=>{const n=function(e){if(e&&"number"==typeof e.statusCode)return e.statusCode;if(e&&"number"==typeof e.status)return e.status;const t="string"==typeof e?.errMsg?e.errMsg:"";return/:ok\b/i.test(t)?200:0}(t),r=n>=200&&n<300,o=Ne(t.data);d({file:e,success:r,statusCode:n,data:o,message:r?void 0:ve(n)})},fail:t=>{o||d({file:e,success:!1,message:t?.errMsg||de})}}),p&&i?.onProgressUpdate&&i.onProgressUpdate(t=>{o||"number"!=typeof t.progress||p(e,t.progress)}),a&&"function"==typeof a.addEventListener&&(a.aborted?(i?.abort?.(),d({file:e,success:!1,message:ge})):(c=()=>{i?.abort?.(),d({file:e,success:!1,message:ge})},a.addEventListener("abort",c,{once:!0})))})}async function qe(e){const{pickFiles:t,uploadFile:n}="undefined"==typeof window||"undefined"==typeof document||function(){const e="undefined"==typeof uni?null:uni;return Boolean(e&&"function"==typeof e.uploadFile)}()?{pickFiles:ze,uploadFile:Ve}:{pickFiles:Ge,uploadFile:Ke};return We(e,t,n)}async function Xe(e){return qe({...e||{},type:"image"})}const Qe=o.getInstance(),Ze="https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.min.js";let et=!1,tt=null;const nt=()=>{et=!1,tt=null},rt=(e=Ze,t={})=>{const n="string"==typeof e&&""!==e.trim()?e:Ze,o=t&&"object"==typeof t?t:{},s="number"==typeof o.timeoutMs&&Number.isFinite(o.timeoutMs)&&o.timeoutMs>0?o.timeoutMs:1e4;return"undefined"!=typeof window&&window.document?et||window.ap?(et=!0,Promise.resolve(!0)):tt||(tt=new Promise(e=>{const t={settled:!1,timeoutId:null,script:null,createdByThisCall:!1},o=n=>{t.settled||(t.settled=!0,t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=null),n.success?et=!0:Qe.handleError(new r(n.code,n.message,"payment"),"payment"),tt=null,e(n.success))};try{let e;try{e=new URL(n,window.location.href).href}catch{return void o({success:!1,code:"ALIPAY_SDK_INVALID_URL",message:`无效的 JSSDK 地址: ${n}`})}const r=Array.from(document.getElementsByTagName("script")).find(t=>t.src===e),i=r??document.createElement("script");t.script=i,t.createdByThisCall=!r;const a=()=>{setTimeout(()=>{window.ap?o({success:!0}):o({success:!1,code:"ALIPAY_SDK_INIT_ERROR",message:"支付宝 JSSDK 加载成功但未能初始化 window.ap"})},50)},c=e=>{t.createdByThisCall&&i.parentNode&&i.parentNode.removeChild(i),o({success:!1,code:"ALIPAY_SDK_LOAD_ERROR",message:`支付宝 JSSDK 加载失败: ${String(e?.type||"error")}`})};i.addEventListener("load",a,{once:!0}),i.addEventListener("error",c,{once:!0}),t.timeoutId=setTimeout(()=>{t.createdByThisCall&&i.parentNode&&i.parentNode.removeChild(i),o({success:!1,code:"ALIPAY_SDK_LOAD_TIMEOUT",message:"支付宝 JSSDK 加载超时"})},s),t.createdByThisCall&&(i.type="text/javascript",i.src=e,i.async=!0,i.setAttribute("data-uniapp-tools","alipay-jssdk"),(document.head||document.body||document.documentElement).appendChild(i)),window.ap&&o({success:!0})}catch(e){o({success:!1,code:"ALIPAY_SDK_UNEXPECTED_ERROR",message:`支付宝 JSSDK 注入过程发生意外异常: ${e instanceof Error?e.message:String(e)}`})}}),tt):(Qe.handleError(new r("ALIPAY_SDK_ENV_ERROR","不在浏览器环境中,无法注入支付宝 JSSDK","payment"),"payment"),Promise.resolve(!1))},ot=o.getInstance(),st="WECHAT_PAY_INVALID_CONFIG",it=(e,t={})=>{const n=t&&"object"==typeof t?t:{},o=!1!==n.reportError,s="number"==typeof n.timeoutMs&&Number.isFinite(n.timeoutMs)&&n.timeoutMs>0?n.timeoutMs:1e4;return new Promise(t=>{let n=!1,i=null;const a=e=>{n||(n=!0,i&&(clearTimeout(i),i=null),t(e))},c=(e,t,n=null)=>{const s=new r(e,t,"payment");return o&&ot.handleError(s,"payment"),{success:!1,status:"error",code:e,message:t,raw:n}};if(!(e&&"object"==typeof e&&e?.appId&&e?.timeStamp&&e?.nonceStr&&e?.package&&e?.signType&&e?.paySign))return void a(c(st,"微信支付配置参数不完整"));if("string"!=typeof e.package||!e.package.startsWith("prepay_id="))return void a(c(st,"微信支付 package 格式非法,应以 'prepay_id=' 开头"));if("undefined"==typeof window||!window.navigator)return void a(c("WECHAT_PAY_ENV_ERROR","不在浏览器环境中,无法调用微信支付"));const u=()=>{try{window.WeixinJSBridge.invoke("getBrandWCPayRequest",e,e=>{"get_brand_wcpay_request:ok"===e.err_msg?a({success:!0,status:"success",code:"WECHAT_PAY_SUCCESS",message:"支付成功",raw:e}):"get_brand_wcpay_request:cancel"===e.err_msg?a({success:!1,status:"cancel",code:"WECHAT_PAY_CANCEL",message:"用户取消支付",raw:e}):a({success:!1,status:"error",code:"WECHAT_PAY_FAIL",message:e.err_desc||"支付失败",raw:e})})}catch(e){a(c("WECHAT_PAY_INVOKE_ERROR",`调用微信支付接口失败: ${e instanceof Error?e.message:String(e)}`))}};if(void 0===window.WeixinJSBridge){const e=()=>{u(),window.document.removeEventListener("WeixinJSBridgeReady",e,!1)};i=setTimeout(()=>{window.document.removeEventListener("WeixinJSBridgeReady",e,!1),a(c("WECHAT_PAY_READY_TIMEOUT","等待微信支付环境就绪超时"))},s),window.document.addEventListener("WeixinJSBridgeReady",e,!1)}else u()})},at=o.getInstance(),ct=()=>!("undefined"==typeof navigator||!navigator.userAgent)&&navigator.userAgent.toLowerCase().includes("micromessenger"),ut=()=>"undefined"!=typeof window&&"undefined"!=typeof document,lt=()=>ut()&&ct()&&window.wx||null,ft=(e,t=!1)=>{const n={};return e.forEach(e=>{"string"==typeof e&&""!==e.trim()&&(n[e]=t)}),n};let mt=!1,pt=null,dt=!1,gt=null;const yt=["https://res.wx.qq.com/open/js/jweixin-1.6.0.js","https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"],ht=()=>{mt=!1,dt=!1,pt=null,gt=null},wt=(e={})=>{const t=e&&"object"==typeof e?e:{},n="number"==typeof t.timeoutMs&&Number.isFinite(t.timeoutMs)&&t.timeoutMs>0?t.timeoutMs:1e4;if(mt||ut()&&window.wx)return mt=!0,Promise.resolve(!0);if(!ut())return Promise.resolve(!1);if(pt)return pt;const r=Array.isArray(t.cdnUrls)&&t.cdnUrls.length>0?t.cdnUrls.filter(e=>"string"==typeof e&&""!==e.trim()):[],o=r.length>0?r:yt;return pt=new Promise(e=>{let t=!1,r=null,s=null,i=0;const a=n=>{t||(t=!0,r&&(clearTimeout(r),r=null),s&&s.parentNode&&s.parentNode.removeChild(s),n&&(mt=!0),pt=null,e(n))},c=()=>{if(i>=o.length)return void a(!1);if(!document.head)return void a(!1);const e=o[i];i+=1;const t=document.createElement("script");s=t,t.src=e,t.async=!0,t.onload=()=>a(!0),t.onerror=()=>{t.parentNode&&t.parentNode.removeChild(t),s=null,c()},document.head.appendChild(t)};r=setTimeout(()=>{a(!1)},n),c()}),pt},Et=async(e,t={})=>{const n=t&&"object"==typeof t?t:{},o="number"==typeof n.timeoutMs&&Number.isFinite(n.timeoutMs)&&n.timeoutMs>0?n.timeoutMs:1e4;return!(!e||"object"!=typeof e||"string"!=typeof e.appId||"string"!=typeof e.nonceStr||"string"!=typeof e.signature||"number"!=typeof e.timestamp||!Array.isArray(e.jsApiList))&&(ct()?gt||(gt=(async()=>{if(!await wt({timeoutMs:o}))return at.handleError(new r("WECHAT_JSSDK_LOAD_FAILED","微信 JS-SDK 加载失败","weixin"),"weixin"),!1;const t=lt();if(!t||"function"!=typeof t.config||"function"!=typeof t.ready||"function"!=typeof t.error)return!1;const n=t.config,s=t.ready,i=t.error,a=await new Promise(t=>{let a=!1,c=null;const u=e=>{a||(a=!0,c&&(clearTimeout(c),c=null),t(e))};c=setTimeout(()=>u(!1),o);try{n({debug:e.debug||!1,appId:e.appId,timestamp:e.timestamp,nonceStr:e.nonceStr,signature:e.signature,jsApiList:e.jsApiList}),s(()=>u(!0)),i(e=>{at.handleError(new r("WECHAT_JSSDK_CONFIG_ERROR",`微信 JS-SDK 配置错误: ${(e=>{try{return JSON.stringify(e)}catch{return String(e)}})(e)}`,"weixin"),"weixin"),u(!1)})}catch(e){at.handleError(new r("WECHAT_JSSDK_CONFIG_EXCEPTION",`微信 JS-SDK 配置异常: ${e instanceof Error?e.message:String(e)}`,"weixin"),"weixin"),u(!1)}});return dt=a,a})().finally(()=>{gt=null}),gt):(console.warn("当前不在微信环境中"),!1))},St=(e,t={})=>{const n=t&&"object"==typeof t?t:{},o="number"==typeof n.timeoutMs&&Number.isFinite(n.timeoutMs)&&n.timeoutMs>0?n.timeoutMs:8e3,s=Array.isArray(e)?e:[];return new Promise(e=>{const t=lt();if(!t||"function"!=typeof t.checkJsApi)return void e(ft(s,!1));let n=!1;const i=t=>{n||(n=!0,e(t))},a=setTimeout(()=>i(ft(s,!1)),o);try{t.checkJsApi({jsApiList:s,success:e=>{clearTimeout(a),i({...ft(s,!1),...e?.checkResult||{}})}})}catch(e){clearTimeout(a),at.handleError(new r("CHECK_WECHAT_JSAPI_ERROR",`检查微信 JS-SDK API 异常: ${e instanceof Error?e.message:String(e)}`,"weixin"),"weixin"),i(ft(s,!1))}})},Rt=e=>{if(!e||"object"!=typeof e)return;const t=lt();t&&(t.updateTimelineShareData?t.updateTimelineShareData(e):t.onMenuShareTimeline&&t.onMenuShareTimeline(e))},At=e=>{if(!e||"object"!=typeof e)return;const t=lt();t&&(t.updateAppMessageShareData?t.updateAppMessageShareData(e):t.onMenuShareAppMessage&&t.onMenuShareAppMessage(e))};class Tt{static instance;isConfigured=!1;config=null;initPromise=null;constructor(){}static getInstance(){return Tt.instance||(Tt.instance=new Tt),Tt.instance}async init(e){return this.initPromise||(this.initPromise=Et(e).then(t=>(this.isConfigured=t,this.config=t?e:null,t)).finally(()=>{this.initPromise=null})),this.initPromise}isReady(){return(this.isConfigured||dt)&&ct()}getConfig(){return this.config}reset(){this.isConfigured=!1,this.config=null,this.initPromise=null,ht()}setShareData(e){this.isReady()?(Rt(e),At(e)):console.warn("微信 SDK 未就绪")}}export{o as ErrorHandler,r as UniAppToolsError,n as VERSION,Tt as WechatSDK,F as areaList,pe as batchGetStorage,me as batchSetStorage,H as buildUrl,St as checkWechatJSAPI,fe as cleanExpiredStorage,ae as clearStorageSync,f as clearSystemCache,Et as configWechatJSSDK,U as configureNavigation,ee as copyText,P as debounce,O as deepClone,I as deepMerge,L as extractUrlParts,y as getCurrentEnv,q as getCurrentPageInfo,_e as getExtension,N as getH5UrlParams,E as getMenuButtonBoundingClientRect,T as getNavHeight,S as getNavigationBarHeight,Q as getPageStack,d as getPlatform,w as getStatusBarHeight,ue as getStorage,le as getStorageInfo,ie as getStorageSync,R as getTopBarMetrics,A as getTopNavBarHeight,rt as injectAlipayJsSdk,ct as isWechat,wt as loadWechatJSSDK,C as mergeObjects,$e as normalizeConcurrency,h as onCheckForUpdate,nt as resetAlipayJsSdk,ht as resetWechatJSSDK,s as safeAsync,i as safeSync,qe as selectAndUpload,Xe as selectAndUploadImage,b as setPageIcon,v as setPageTitle,ce as setStorage,se as setStorageSync,At as shareToFriend,Rt as shareToTimeline,M as throttle,K as useBack,Y as useBackDebounced,z as useBackOrHome,B as useBuildUrl,j as useCascaderAreaData,V as useCurrentPageInfo,X as usePageStack,x as useRegions,D as useToast,g as useWindowInfo,De as validateSizeWithLimit,it as wechatH5Pay};