UNPKG

zhytech-ui-mobile

Version:

一个基于Vue3 + wot-design-uni + TypeScript + unocss封装的前端UI组件库

1,795 lines 748 kB
var __defProp = Object.defineProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __publicField = (obj, key, value) => { __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); return value; }; import { inject, ref, getCurrentInstance, createVNode, mergeProps, withModifiers, defineComponent, Fragment, renderSlot, openBlock, createBlock, withCtx, Comment, createTextVNode, provide, reactive, watchEffect, onActivated, computed, onBeforeUnmount, onMounted, watch, withDirectives, vModelDynamic, vShow, nextTick, renderList, isReactive, onUnmounted, shallowRef, isVNode as isVNode$1, onBeforeMount, createApp, Transition, effectScope, markRaw, normalizeClass, normalizeStyle, createCommentVNode, onDeactivated, createElementBlock, toDisplayString, useSlots, toRefs, resolveDynamicComponent, unref, createSlots, Teleport, normalizeProps, isRef, resolveComponent, useCssVars } from "vue"; const iconfont = ""; const index$1 = ""; const __uno = ""; const view = ""; const toast = ""; const extend = Object.assign; const hasOwnProperty$1 = Object.prototype.hasOwnProperty; const hasOwn$1 = (val, key) => hasOwnProperty$1.call(val, key); const isArray$1 = Array.isArray; const isFunction$1 = (val) => typeof val === "function"; const isString$1 = (val) => typeof val === "string"; const isObject$1 = (val) => val !== null && typeof val === "object"; const isPromise$1 = (val) => { return (isObject$1(val) || isFunction$1(val)) && isFunction$1(val.then) && isFunction$1(val.catch); }; const objectToString = Object.prototype.toString; const toTypeString = (value) => objectToString.call(value); const isPlainObject = (val) => toTypeString(val) === "[object Object]"; const cacheStringFunction = (fn) => { const cache = /* @__PURE__ */ Object.create(null); return (str) => { const hit = cache[str]; return hit || (cache[str] = fn(str)); }; }; const hyphenateRE = /\B([A-Z])/g; const hyphenate = cacheStringFunction( (str) => str.replace(hyphenateRE, "-$1").toLowerCase() ); const LINEFEED = "\n"; const UNI_STORAGE_LOCALE = "UNI_LOCALE"; const SCHEME_RE = /^([a-z-]+:)?\/\//i; const DATA_RE = /^data:.*,.*/; const ON_HIDE = "onHide"; const ON_THEME_CHANGE = "onThemeChange"; const ON_UNLOAD = "onUnload"; const ON_BACK_PRESS = "onBackPress"; const ON_NAVIGATION_BAR_CHANGE = "onNavigationBarChange"; function isComponentInternalInstance(vm) { return !!vm.appContext; } function resolveComponentInstance(instance) { return instance && (isComponentInternalInstance(instance) ? instance.proxy : instance); } function getLen(str = "") { return ("" + str).replace(/[^\x00-\xff]/g, "**").length; } function hasLeadingSlash(str) { return str.indexOf("/") === 0; } function addLeadingSlash(str) { return hasLeadingSlash(str) ? str : "/" + str; } function removeLeadingSlash(str) { return hasLeadingSlash(str) ? str.slice(1) : str; } const invokeArrayFns = (fns, arg) => { let ret; for (let i = 0; i < fns.length; i++) { ret = fns[i](arg); } return ret; }; function updateElementStyle(element, styles) { for (const attrName in styles) { element.style[attrName] = styles[attrName]; } } function once(fn, ctx = null) { let res; return (...args) => { if (fn) { res = fn.apply(ctx, args); fn = null; } return res; }; } function callOptions(options, data) { options = options || {}; if (isString$1(data)) { data = { errMsg: data }; } if (/:ok$/.test(data.errMsg)) { if (isFunction$1(options.success)) { options.success(data); } } else { if (isFunction$1(options.fail)) { options.fail(data); } } if (isFunction$1(options.complete)) { options.complete(data); } } function sortObject(obj) { let sortObj = {}; if (isPlainObject(obj)) { Object.keys(obj).sort().forEach((key) => { const _key = key; sortObj[_key] = obj[_key]; }); } return !Object.keys(sortObj) ? obj : sortObj; } function getCustomDataset(el) { return extend({}, el.dataset, el.__uniDataset); } function passive(passive2) { return { passive: passive2 }; } function normalizeTarget(el) { const { id: id2, offsetTop, offsetLeft } = el; return { id: id2, dataset: getCustomDataset(el), offsetTop, offsetLeft }; } function decode(text2) { try { return decodeURIComponent("" + text2); } catch (err) { } return "" + text2; } const PLUS_RE = /\+/g; function parseQuery(search) { const query = {}; if (search === "" || search === "?") return query; const hasLeadingIM = search[0] === "?"; const searchParams = (hasLeadingIM ? search.slice(1) : search).split("&"); for (let i = 0; i < searchParams.length; ++i) { const searchParam = searchParams[i].replace(PLUS_RE, " "); let eqPos = searchParam.indexOf("="); let key = decode(eqPos < 0 ? searchParam : searchParam.slice(0, eqPos)); let value = eqPos < 0 ? null : decode(searchParam.slice(eqPos + 1)); if (key in query) { let currentValue = query[key]; if (!isArray$1(currentValue)) { currentValue = query[key] = [currentValue]; } currentValue.push(value); } else { query[key] = value; } } return query; } function parseUrl(url) { const [path, querystring] = url.split("?", 2); return { path, query: parseQuery(querystring || "") }; } function debounce$1(fn, delay, { clearTimeout: clearTimeout2, setTimeout: setTimeout2 }) { let timeout; const newFn = function() { clearTimeout2(timeout); const timerFn = () => fn.apply(this, arguments); timeout = setTimeout2(timerFn, delay); }; newFn.cancel = function() { clearTimeout2(timeout); }; return newFn; } class EventChannel { constructor(id2, events) { this.id = id2; this.listener = {}; this.emitCache = []; if (events) { Object.keys(events).forEach((name) => { this.on(name, events[name]); }); } } emit(eventName, ...args) { const fns = this.listener[eventName]; if (!fns) { return this.emitCache.push({ eventName, args }); } fns.forEach((opt) => { opt.fn.apply(opt.fn, args); }); this.listener[eventName] = fns.filter((opt) => opt.type !== "once"); } on(eventName, fn) { this._addListener(eventName, "on", fn); this._clearCache(eventName); } once(eventName, fn) { this._addListener(eventName, "once", fn); this._clearCache(eventName); } off(eventName, fn) { const fns = this.listener[eventName]; if (!fns) { return; } if (fn) { for (let i = 0; i < fns.length; ) { if (fns[i].fn === fn) { fns.splice(i, 1); i--; } i++; } } else { delete this.listener[eventName]; } } _clearCache(eventName) { for (let index2 = 0; index2 < this.emitCache.length; index2++) { const cache = this.emitCache[index2]; const _name = eventName ? cache.eventName === eventName ? eventName : null : cache.eventName; if (!_name) continue; const location = this.emit.apply(this, [_name, ...cache.args]); if (typeof location === "number") { this.emitCache.pop(); continue; } this.emitCache.splice(index2, 1); index2--; } } _addListener(eventName, type, fn) { (this.listener[eventName] || (this.listener[eventName] = [])).push({ fn, type }); } } const E = function() { }; E.prototype = { on: function(name, callback, ctx) { var e2 = this.e || (this.e = {}); (e2[name] || (e2[name] = [])).push({ fn: callback, ctx }); return this; }, once: function(name, callback, ctx) { var self = this; function listener() { self.off(name, listener); callback.apply(ctx, arguments); } listener._ = callback; return this.on(name, listener, ctx); }, emit: function(name) { var data = [].slice.call(arguments, 1); var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); var i = 0; var len = evtArr.length; for (i; i < len; i++) { evtArr[i].fn.apply(evtArr[i].ctx, data); } return this; }, off: function(name, callback) { var e2 = this.e || (this.e = {}); var evts = e2[name]; var liveEvents = []; if (evts && callback) { for (var i = evts.length - 1; i >= 0; i--) { if (evts[i].fn === callback || evts[i].fn._ === callback) { evts.splice(i, 1); break; } } liveEvents = evts; } liveEvents.length ? e2[name] = liveEvents : delete e2[name]; return this; } }; var E$1 = E; const borderStyles = { black: "rgba(0,0,0,0.4)", white: "rgba(255,255,255,0.4)" }; function normalizeTabBarStyles(borderStyle) { if (borderStyle && borderStyle in borderStyles) { return borderStyles[borderStyle]; } return borderStyle; } function normalizeTitleColor(titleColor) { return titleColor === "black" ? "#000000" : "#ffffff"; } function normalizeStyles(pageStyle, themeConfig = {}, mode = "light") { const modeStyle = themeConfig[mode]; const styles = {}; if (!modeStyle) { return pageStyle; } Object.keys(pageStyle).forEach((key) => { let styleItem = pageStyle[key]; styles[key] = (() => { if (isPlainObject(styleItem)) { return normalizeStyles(styleItem, themeConfig, mode); } else if (isArray$1(styleItem)) { return styleItem.map((item) => isPlainObject(item) ? normalizeStyles(item, themeConfig, mode) : item); } else if (isString$1(styleItem) && styleItem.startsWith("@")) { const _key = styleItem.replace("@", ""); let _styleItem = modeStyle[_key] || styleItem; switch (key) { case "titleColor": _styleItem = normalizeTitleColor(_styleItem); break; case "borderStyle": _styleItem = normalizeTabBarStyles(_styleItem); break; } return _styleItem; } return styleItem; })(); }); return styles; } const isObject = (val) => val !== null && typeof val === "object"; const defaultDelimiters = ["{", "}"]; class BaseFormatter { constructor() { this._caches = /* @__PURE__ */ Object.create(null); } interpolate(message, values, delimiters = defaultDelimiters) { if (!values) { return [message]; } let tokens = this._caches[message]; if (!tokens) { tokens = parse(message, delimiters); this._caches[message] = tokens; } return compile(tokens, values); } } const RE_TOKEN_LIST_VALUE = /^(?:\d)+/; const RE_TOKEN_NAMED_VALUE = /^(?:\w)+/; function parse(format, [startDelimiter, endDelimiter]) { const tokens = []; let position = 0; let text2 = ""; while (position < format.length) { let char = format[position++]; if (char === startDelimiter) { if (text2) { tokens.push({ type: "text", value: text2 }); } text2 = ""; let sub = ""; char = format[position++]; while (char !== void 0 && char !== endDelimiter) { sub += char; char = format[position++]; } const isClosed = char === endDelimiter; const type = RE_TOKEN_LIST_VALUE.test(sub) ? "list" : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? "named" : "unknown"; tokens.push({ value: sub, type }); } else { text2 += char; } } text2 && tokens.push({ type: "text", value: text2 }); return tokens; } function compile(tokens, values) { const compiled = []; let index2 = 0; const mode = Array.isArray(values) ? "list" : isObject(values) ? "named" : "unknown"; if (mode === "unknown") { return compiled; } while (index2 < tokens.length) { const token = tokens[index2]; switch (token.type) { case "text": compiled.push(token.value); break; case "list": compiled.push(values[parseInt(token.value, 10)]); break; case "named": if (mode === "named") { compiled.push(values[token.value]); } break; } index2++; } return compiled; } const LOCALE_ZH_HANS = "zh-Hans"; const LOCALE_ZH_HANT = "zh-Hant"; const LOCALE_EN = "en"; const LOCALE_FR = "fr"; const LOCALE_ES = "es"; const hasOwnProperty = Object.prototype.hasOwnProperty; const hasOwn = (val, key) => hasOwnProperty.call(val, key); const defaultFormatter = new BaseFormatter(); function include(str, parts) { return !!parts.find((part) => str.indexOf(part) !== -1); } function startsWith(str, parts) { return parts.find((part) => str.indexOf(part) === 0); } function normalizeLocale(locale, messages2) { if (!locale) { return; } locale = locale.trim().replace(/_/g, "-"); if (messages2 && messages2[locale]) { return locale; } locale = locale.toLowerCase(); if (locale === "chinese") { return LOCALE_ZH_HANS; } if (locale.indexOf("zh") === 0) { if (locale.indexOf("-hans") > -1) { return LOCALE_ZH_HANS; } if (locale.indexOf("-hant") > -1) { return LOCALE_ZH_HANT; } if (include(locale, ["-tw", "-hk", "-mo", "-cht"])) { return LOCALE_ZH_HANT; } return LOCALE_ZH_HANS; } let locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES]; if (messages2 && Object.keys(messages2).length > 0) { locales = Object.keys(messages2); } const lang2 = startsWith(locale, locales); if (lang2) { return lang2; } } class I18n { constructor({ locale, fallbackLocale, messages: messages2, watcher, formater }) { this.locale = LOCALE_EN; this.fallbackLocale = LOCALE_EN; this.message = {}; this.messages = {}; this.watchers = []; if (fallbackLocale) { this.fallbackLocale = fallbackLocale; } this.formater = formater || defaultFormatter; this.messages = messages2 || {}; this.setLocale(locale || LOCALE_EN); if (watcher) { this.watchLocale(watcher); } } setLocale(locale) { const oldLocale = this.locale; this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale; if (!this.messages[this.locale]) { this.messages[this.locale] = {}; } this.message = this.messages[this.locale]; if (oldLocale !== this.locale) { this.watchers.forEach((watcher) => { watcher(this.locale, oldLocale); }); } } getLocale() { return this.locale; } watchLocale(fn) { const index2 = this.watchers.push(fn) - 1; return () => { this.watchers.splice(index2, 1); }; } add(locale, message, override = true) { const curMessages = this.messages[locale]; if (curMessages) { if (override) { Object.assign(curMessages, message); } else { Object.keys(message).forEach((key) => { if (!hasOwn(curMessages, key)) { curMessages[key] = message[key]; } }); } } else { this.messages[locale] = message; } } f(message, values, delimiters) { return this.formater.interpolate(message, values, delimiters).join(""); } t(key, locale, values) { let message = this.message; if (typeof locale === "string") { locale = normalizeLocale(locale, this.messages); locale && (message = this.messages[locale]); } else { values = locale; } if (!hasOwn(message, key)) { console.warn(`Cannot translate the value of keypath ${key}. Use the value of keypath as default.`); return key; } return this.formater.interpolate(message[key], values).join(""); } } function getDefaultLocale() { if (typeof uni !== "undefined" && getLocale) { return getLocale(); } if (typeof global !== "undefined" && global.getLocale) { return global.getLocale(); } return LOCALE_EN; } function initVueI18n(locale, messages2 = {}, fallbackLocale, watcher) { if (typeof locale !== "string") { [locale, messages2] = [ messages2, locale ]; } if (typeof locale !== "string") { locale = getDefaultLocale(); } if (typeof fallbackLocale !== "string") { fallbackLocale = typeof __uniConfig !== "undefined" && __uniConfig.fallbackLocale || LOCALE_EN; } const i18n2 = new I18n({ locale, fallbackLocale, messages: messages2, watcher }); let t2 = (key, values) => { if (typeof getApp$1 !== "function") { t2 = function(key2, values2) { return i18n2.t(key2, values2); }; } else { t2 = function(key2, values2) { getApp$1().$vm; return i18n2.t(key2, values2); }; } return t2(key, values); }; return { i18n: i18n2, f(message, values, delimiters) { return i18n2.f(message, values, delimiters); }, t(key, values) { return t2(key, values); }, add(locale2, message, override = true) { return i18n2.add(locale2, message, override); }, watch(fn) { return i18n2.watchLocale(fn); }, getLocale() { return i18n2.getLocale(); }, setLocale(newLocale) { return i18n2.setLocale(newLocale); } }; } /*! * vue-router v4.5.1 * (c) 2025 Eduardo San Martin Morote * @license MIT */ var NavigationType; (function(NavigationType2) { NavigationType2["pop"] = "pop"; NavigationType2["push"] = "push"; })(NavigationType || (NavigationType = {})); var NavigationDirection; (function(NavigationDirection2) { NavigationDirection2["back"] = "back"; NavigationDirection2["forward"] = "forward"; NavigationDirection2["unknown"] = ""; })(NavigationDirection || (NavigationDirection = {})); const NavigationFailureSymbol = Symbol(""); var NavigationFailureType; (function(NavigationFailureType2) { NavigationFailureType2[NavigationFailureType2["aborted"] = 4] = "aborted"; NavigationFailureType2[NavigationFailureType2["cancelled"] = 8] = "cancelled"; NavigationFailureType2[NavigationFailureType2["duplicated"] = 16] = "duplicated"; })(NavigationFailureType || (NavigationFailureType = {})); function isNavigationFailure(error, type) { return error instanceof Error && NavigationFailureSymbol in error && (type == null || !!(error.type & type)); } const routeLocationKey = Symbol(""); function useRoute(_name) { return inject(routeLocationKey); } const isEnableLocale = /* @__PURE__ */ once( () => typeof __uniConfig !== "undefined" && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length ); let i18n; function useI18n() { if (!i18n) { let locale; { { locale = navigator.cookieEnabled && window.localStorage && localStorage[UNI_STORAGE_LOCALE] || __uniConfig.locale || navigator.language; } } i18n = initVueI18n(locale); if (isEnableLocale()) { const localeKeys = Object.keys(__uniConfig.locales || {}); if (localeKeys.length) { localeKeys.forEach( (locale2) => i18n.add(locale2, __uniConfig.locales[locale2]) ); } i18n.setLocale(locale); } } return i18n; } function normalizeMessages(module, keys, values) { return keys.reduce((res, name, index2) => { res[module + name] = values[index2]; return res; }, {}); } const initI18nShowToastMsgsOnce = /* @__PURE__ */ once(() => { const name = "uni.showToast."; const keys = ["unpaired"]; { useI18n().add( LOCALE_EN, normalizeMessages(name, keys, [ "Please note showToast must be paired with hideToast" ]), false ); } { useI18n().add( LOCALE_ES, normalizeMessages(name, keys, [ "Tenga en cuenta que showToast debe estar emparejado con hideToast" ]), false ); } { useI18n().add( LOCALE_FR, normalizeMessages(name, keys, [ "Veuillez noter que showToast doit être associé à hideToast" ]), false ); } { useI18n().add( LOCALE_ZH_HANS, normalizeMessages(name, keys, [ "请注意 showToast 与 hideToast 必须配对使用" ]), false ); } { useI18n().add( LOCALE_ZH_HANT, normalizeMessages(name, keys, [ "請注意 showToast 與 hideToast 必須配對使用" ]), false ); } }); const initI18nShowLoadingMsgsOnce = /* @__PURE__ */ once(() => { const name = "uni.showLoading."; const keys = ["unpaired"]; { useI18n().add( LOCALE_EN, normalizeMessages(name, keys, [ "Please note showLoading must be paired with hideLoading" ]), false ); } { useI18n().add( LOCALE_ES, normalizeMessages(name, keys, [ "Tenga en cuenta que showLoading debe estar emparejado con hideLoading" ]), false ); } { useI18n().add( LOCALE_FR, normalizeMessages(name, keys, [ "Veuillez noter que showLoading doit être associé à hideLoading" ]), false ); } { useI18n().add( LOCALE_ZH_HANS, normalizeMessages(name, keys, [ "请注意 showLoading 与 hideLoading 必须配对使用" ]), false ); } { useI18n().add( LOCALE_ZH_HANT, normalizeMessages(name, keys, [ "請注意 showLoading 與 hideLoading 必須配對使用" ]), false ); } }); const initI18nChooseFileMsgsOnce = /* @__PURE__ */ once(() => { const name = "uni.chooseFile."; const keys = ["notUserActivation"]; { useI18n().add( LOCALE_EN, normalizeMessages(name, keys, [ "File chooser dialog can only be shown with a user activation" ]), false ); } { useI18n().add( LOCALE_ES, normalizeMessages(name, keys, [ "El cuadro de diálogo del selector de archivos solo se puede mostrar con la activación del usuario" ]), false ); } { useI18n().add( LOCALE_FR, normalizeMessages(name, keys, [ "La boîte de dialogue du sélecteur de fichier ne peut être affichée qu'avec une activation par l'utilisateur" ]), false ); } { useI18n().add( LOCALE_ZH_HANS, normalizeMessages(name, keys, ["文件选择器对话框只能在由用户激活时显示"]), false ); } { useI18n().add( LOCALE_ZH_HANT, normalizeMessages(name, keys, ["文件選擇器對話框只能在由用戶激活時顯示"]), false ); } }); const initI18nVideoMsgsOnce = /* @__PURE__ */ once(() => { const name = "uni.video."; const keys = ["danmu", "volume"]; { useI18n().add( LOCALE_EN, normalizeMessages(name, keys, ["Danmu", "Volume"]), false ); } { useI18n().add( LOCALE_ES, normalizeMessages(name, keys, ["Danmu", "Volumen"]), false ); } { useI18n().add( LOCALE_FR, normalizeMessages(name, keys, ["Danmu", "Le Volume"]), false ); } { useI18n().add( LOCALE_ZH_HANS, normalizeMessages(name, keys, ["弹幕", "音量"]), false ); } { useI18n().add( LOCALE_ZH_HANT, normalizeMessages(name, keys, ["彈幕", "音量"]), false ); } }); function initBridge(subscribeNamespace) { const emitter2 = new E$1(); return { on(event, callback) { return emitter2.on(event, callback); }, once(event, callback) { return emitter2.once(event, callback); }, off(event, callback) { return emitter2.off(event, callback); }, emit(event, ...args) { return emitter2.emit(event, ...args); }, subscribe(event, callback, once2 = false) { emitter2[once2 ? "once" : "on"](`${subscribeNamespace}.${event}`, callback); }, unsubscribe(event, callback) { emitter2.off(`${subscribeNamespace}.${event}`, callback); }, subscribeHandler(event, args, pageId) { emitter2.emit(`${subscribeNamespace}.${event}`, args, pageId); } }; } const INVOKE_VIEW_API = "invokeViewApi"; const INVOKE_SERVICE_API = "invokeServiceApi"; let invokeServiceMethodId = 1; const invokeServiceMethod = (name, args, callback) => { const { subscribe, publishHandler } = UniViewJSBridge$1; const id2 = callback ? invokeServiceMethodId++ : 0; callback && subscribe(INVOKE_SERVICE_API + "." + id2, callback, true); publishHandler(INVOKE_SERVICE_API, { id: id2, name, args }); }; const viewMethods = /* @__PURE__ */ Object.create(null); function normalizeViewMethodName(pageId, name) { return pageId + "." + name; } function registerViewMethod(pageId, name, fn) { name = normalizeViewMethodName(pageId, name); if (!viewMethods[name]) { viewMethods[name] = fn; } } function unregisterViewMethod(pageId, name) { name = normalizeViewMethodName(pageId, name); delete viewMethods[name]; } const ViewJSBridge = /* @__PURE__ */ extend( /* @__PURE__ */ initBridge("service"), { invokeServiceMethod } ); function getDefaultExportFromCjs(x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; } var attrs = ["top", "left", "right", "bottom"]; var inited$1; var elementComputedStyle = {}; var support; function getSupport() { if (!("CSS" in window) || typeof CSS.supports != "function") { support = ""; } else if (CSS.supports("top: env(safe-area-inset-top)")) { support = "env"; } else if (CSS.supports("top: constant(safe-area-inset-top)")) { support = "constant"; } else { support = ""; } return support; } function init() { support = typeof support === "string" ? support : getSupport(); if (!support) { attrs.forEach(function(attr2) { elementComputedStyle[attr2] = 0; }); return; } function setStyle(el, style) { var elStyle = el.style; Object.keys(style).forEach(function(key) { var val = style[key]; elStyle[key] = val; }); } var cbs = []; function parentReady(callback) { if (callback) { cbs.push(callback); } else { cbs.forEach(function(cb) { cb(); }); } } var passiveEvents = false; try { var opts = Object.defineProperty({}, "passive", { get: function() { passiveEvents = { passive: true }; } }); window.addEventListener("test", null, opts); } catch (e2) { } function addChild(parent, attr2) { var a1 = document.createElement("div"); var a2 = document.createElement("div"); var a1Children = document.createElement("div"); var a2Children = document.createElement("div"); var W2 = 100; var MAX = 1e4; var aStyle = { position: "absolute", width: W2 + "px", height: "200px", boxSizing: "border-box", overflow: "hidden", paddingBottom: support + "(safe-area-inset-" + attr2 + ")" }; setStyle(a1, aStyle); setStyle(a2, aStyle); setStyle(a1Children, { transition: "0s", animation: "none", width: "400px", height: "400px" }); setStyle(a2Children, { transition: "0s", animation: "none", width: "250%", height: "250%" }); a1.appendChild(a1Children); a2.appendChild(a2Children); parent.appendChild(a1); parent.appendChild(a2); parentReady(function() { a1.scrollTop = a2.scrollTop = MAX; var a1LastScrollTop = a1.scrollTop; var a2LastScrollTop = a2.scrollTop; function onScroll() { if (this.scrollTop === (this === a1 ? a1LastScrollTop : a2LastScrollTop)) { return; } a1.scrollTop = a2.scrollTop = MAX; a1LastScrollTop = a1.scrollTop; a2LastScrollTop = a2.scrollTop; attrChange(attr2); } a1.addEventListener("scroll", onScroll, passiveEvents); a2.addEventListener("scroll", onScroll, passiveEvents); }); var computedStyle = getComputedStyle(a1); Object.defineProperty(elementComputedStyle, attr2, { configurable: true, get: function() { return parseFloat(computedStyle.paddingBottom); } }); } var parentDiv = document.createElement("div"); setStyle(parentDiv, { position: "absolute", left: "0", top: "0", width: "0", height: "0", zIndex: "-1", overflow: "hidden", visibility: "hidden" }); attrs.forEach(function(key) { addChild(parentDiv, key); }); document.body.appendChild(parentDiv); parentReady(); inited$1 = true; } function getAttr(attr2) { if (!inited$1) { init(); } return elementComputedStyle[attr2]; } var changeAttrs = []; function attrChange(attr2) { if (!changeAttrs.length) { setTimeout(function() { var style = {}; changeAttrs.forEach(function(attr3) { style[attr3] = elementComputedStyle[attr3]; }); changeAttrs.length = 0; callbacks.forEach(function(callback) { callback(style); }); }, 0); } changeAttrs.push(attr2); } var callbacks = []; function onChange(callback) { if (!getSupport()) { return; } if (!inited$1) { init(); } if (typeof callback === "function") { callbacks.push(callback); } } function offChange(callback) { var index2 = callbacks.indexOf(callback); if (index2 >= 0) { callbacks.splice(index2, 1); } } var safeAreaInsets = { get support() { return (typeof support === "string" ? support : getSupport()).length != 0; }, get top() { return getAttr("top"); }, get left() { return getAttr("left"); }, get right() { return getAttr("right"); }, get bottom() { return getAttr("bottom"); }, onChange, offChange }; var out = safeAreaInsets; const safeAreaInsets$1 = /* @__PURE__ */ getDefaultExportFromCjs(out); const onEventPrevent = /* @__PURE__ */ withModifiers(() => { }, ["prevent"]); function getWindowOffsetCssVar(style, name) { return parseInt((style.getPropertyValue(name).match(/\d+/) || ["0"])[0]); } function getWindowTop() { const style = document.documentElement.style; const top = getWindowOffsetCssVar(style, "--window-top"); return top ? top + safeAreaInsets$1.top : 0; } function getWindowOffset() { const style = document.documentElement.style; const top = getWindowTop(); const bottom = getWindowOffsetCssVar(style, "--window-bottom"); const left = getWindowOffsetCssVar(style, "--window-left"); const right = getWindowOffsetCssVar(style, "--window-right"); const topWindowHeight = getWindowOffsetCssVar(style, "--top-window-height"); return { top, bottom: bottom ? bottom + safeAreaInsets$1.bottom : 0, left: left ? left + safeAreaInsets$1.left : 0, right: right ? right + safeAreaInsets$1.right : 0, topWindowHeight: topWindowHeight || 0 }; } function PolySymbol(name) { return Symbol(name); } function hasRpx(str) { str = str + ""; return str.indexOf("rpx") !== -1 || str.indexOf("upx") !== -1; } function rpx2px(str, replace = false) { if (replace) { return rpx2pxWithReplace(str); } if (isString$1(str)) { const res = parseInt(str) || 0; if (hasRpx(str)) { return upx2px(res); } return res; } return str; } function rpx2pxWithReplace(str) { if (!hasRpx(str)) { return str; } return str.replace(/(\d+(\.\d+)?)[ru]px/g, (_a, b) => { return upx2px(parseFloat(b)) + "px"; }); } const ICON_PATH_SUCCESS_NO_CIRCLE = "M1.952 18.080q-0.32-0.352-0.416-0.88t0.128-0.976l0.16-0.352q0.224-0.416 0.64-0.528t0.8 0.176l6.496 4.704q0.384 0.288 0.912 0.272t0.88-0.336l17.312-14.272q0.352-0.288 0.848-0.256t0.848 0.352l-0.416-0.416q0.32 0.352 0.32 0.816t-0.32 0.816l-18.656 18.912q-0.32 0.352-0.8 0.352t-0.8-0.32l-7.936-8.064z"; const ICON_PATH_WARN = "M15.808 0.16q-4.224 0-7.872 2.176-3.552 2.112-5.632 5.728-2.144 3.744-2.144 8.128 0 4.192 2.144 7.872 2.112 3.52 5.632 5.632 3.68 2.144 7.872 2.144 4.384 0 8.128-2.144 3.616-2.080 5.728-5.632 2.176-3.648 2.176-7.872 0-4.384-2.176-8.128-2.112-3.616-5.728-5.728-3.744-2.176-8.128-2.176zM15.136 8.672h1.728q0.128 0 0.224 0.096t0.096 0.256l-0.384 10.24q0 0.064-0.048 0.112t-0.112 0.048h-1.248q-0.096 0-0.144-0.048t-0.048-0.112l-0.384-10.24q0-0.16 0.096-0.256t0.224-0.096zM16 23.328q-0.48 0-0.832-0.352t-0.352-0.848 0.352-0.848 0.832-0.352 0.832 0.352 0.352 0.848-0.352 0.848-0.832 0.352z"; const ICON_PATH_BACK = "M21.781 7.844l-9.063 8.594 9.063 8.594q0.25 0.25 0.25 0.609t-0.25 0.578q-0.25 0.25-0.578 0.25t-0.578-0.25l-9.625-9.125q-0.156-0.125-0.203-0.297t-0.047-0.359q0-0.156 0.047-0.328t0.203-0.297l9.625-9.125q0.25-0.25 0.578-0.25t0.578 0.25q0.25 0.219 0.25 0.578t-0.25 0.578z"; const ICON_PATH_CLOSE = "M17.25 16.156l7.375-7.313q0.281-0.281 0.281-0.641t-0.281-0.641q-0.25-0.25-0.625-0.25t-0.625 0.25l-7.375 7.344-7.313-7.344q-0.25-0.25-0.625-0.25t-0.625 0.25q-0.281 0.25-0.281 0.625t0.281 0.625l7.313 7.344-7.375 7.344q-0.281 0.25-0.281 0.625t0.281 0.625q0.125 0.125 0.281 0.188t0.344 0.063q0.156 0 0.328-0.063t0.297-0.188l7.375-7.344 7.375 7.406q0.125 0.156 0.297 0.219t0.328 0.063q0.188 0 0.344-0.078t0.281-0.203q0.281-0.25 0.281-0.609t-0.281-0.641l-7.375-7.406z"; function createSvgIconVNode(path, color = "#000", size = 27) { return createVNode( "svg", { width: size, height: size, viewBox: "0 0 32 32" }, [ createVNode( "path", { d: path, fill: color }, null, 8, ["d", "fill"] ) ], 8, ["width", "height"] ); } function useCurrentPageId() { { const { $pageInstance } = getCurrentInstance(); return $pageInstance && $pageInstance.proxy.$page.id; } } function getPageIdByVm(instance2) { const vm = resolveComponentInstance(instance2); if (vm.$page) { return vm.$page.id; } if (!vm.$) { return; } { const { $pageInstance } = vm.$; return $pageInstance && $pageInstance.proxy.$page.id; } } function getCurrentPage() { const pages = getCurrentPages$1(); const len = pages.length; if (len) { return pages[len - 1]; } } function getCurrentPageMeta() { const page = getCurrentPage(); if (page) { return page.$page.meta; } } function getCurrentPageId() { const meta = getCurrentPageMeta(); if (meta) { return meta.id; } return -1; } function getCurrentPageVm() { const page = getCurrentPage(); if (page) { return page.$vm; } } const PAGE_META_KEYS = ["navigationBar", "pullToRefresh"]; function initGlobalStyle() { return JSON.parse(JSON.stringify(__uniConfig.globalStyle || {})); } function initRouteMeta(pageMeta, id2) { const globalStyle = initGlobalStyle(); const res = extend({ id: id2 }, globalStyle, pageMeta); PAGE_META_KEYS.forEach((name) => { res[name] = extend({}, globalStyle[name], pageMeta[name]); }); const { navigationBar } = res; navigationBar.titleText && navigationBar.titleImage && (navigationBar.titleText = ""); return res; } function invokeHook(vm, name, args) { if (isString$1(vm)) { args = name; name = vm; vm = getCurrentPageVm(); } else if (typeof vm === "number") { const page = getCurrentPages$1().find((page2) => page2.$page.id === vm); if (page) { vm = page.$vm; } else { vm = getCurrentPageVm(); } } if (!vm) { return; } const hooks = vm.$[name]; return hooks && invokeArrayFns(hooks, args); } function normalizeRoute(toRoute) { if (toRoute.indexOf("/") === 0) { return toRoute; } let fromRoute = ""; const pages = getCurrentPages$1(); if (pages.length) { fromRoute = pages[pages.length - 1].$page.route; } return getRealRoute(fromRoute, toRoute); } function getRealRoute(fromRoute, toRoute) { if (toRoute.indexOf("/") === 0) { return toRoute; } if (toRoute.indexOf("./") === 0) { return getRealRoute(fromRoute, toRoute.slice(2)); } const toRouteArray = toRoute.split("/"); const toRouteLength = toRouteArray.length; let i = 0; for (; i < toRouteLength && toRouteArray[i] === ".."; i++) { } toRouteArray.splice(0, i); toRoute = toRouteArray.join("/"); const fromRouteArray = fromRoute.length > 0 ? fromRoute.split("/") : []; fromRouteArray.splice(fromRouteArray.length - i - 1, i + 1); return addLeadingSlash(fromRouteArray.concat(toRouteArray).join("/")); } function getRouteOptions(path, alias = false) { if (alias) { return __uniRoutes.find( (route) => route.path === path || route.alias === path ); } return __uniRoutes.find((route) => route.path === path); } const invokeOnCallback = (name, res) => UniServiceJSBridge$1.emit("api." + name, res); let invokeViewMethodId = 1; function publishViewMethodName(pageId) { return (pageId || getCurrentPageId()) + "." + INVOKE_VIEW_API; } const invokeViewMethod = (name, args, pageId, callback) => { const { subscribe, publishHandler } = UniServiceJSBridge$1; const id2 = callback ? invokeViewMethodId++ : 0; callback && subscribe(INVOKE_VIEW_API + "." + id2, callback, true); publishHandler(publishViewMethodName(pageId), { id: id2, name, args }, pageId); }; const invokeViewMethodKeepAlive = (name, args, callback, pageId) => { const { subscribe, unsubscribe, publishHandler } = UniServiceJSBridge$1; const id2 = invokeViewMethodId++; const subscribeName = INVOKE_VIEW_API + "." + id2; subscribe(subscribeName, callback); publishHandler(publishViewMethodName(pageId), { id: id2, name, args }, pageId); return () => { unsubscribe(subscribeName); }; }; const ServiceJSBridge = /* @__PURE__ */ extend( /* @__PURE__ */ initBridge( "view" /* view 指的是 service 层订阅的是 view 层事件 */ ), { invokeOnCallback, invokeViewMethod, invokeViewMethodKeepAlive } ); function converPx(value) { if (/^-?\d+[ur]px$/i.test(value)) { return value.replace(/(^-?\d+)[ur]px$/i, (text2, num) => { return `${upx2px(parseFloat(num))}px`; }); } else if (/^-?[\d\.]+$/.test(value)) { return `${value}px`; } return value || ""; } function converType(type) { return type.replace(/[A-Z]/g, (text2) => { return `-${text2.toLowerCase()}`; }).replace("webkit", "-webkit"); } function getStyle(action) { const animateTypes1 = [ "matrix", "matrix3d", "scale", "scale3d", "rotate3d", "skew", "translate", "translate3d" ]; const animateTypes2 = [ "scaleX", "scaleY", "scaleZ", "rotate", "rotateX", "rotateY", "rotateZ", "skewX", "skewY", "translateX", "translateY", "translateZ" ]; const animateTypes3 = ["opacity", "background-color"]; const animateTypes4 = ["width", "height", "left", "right", "top", "bottom"]; const animates = action.animates; const option = action.option; const transition = option.transition; const style = {}; const transform = []; animates.forEach((animate) => { let type = animate.type; let args = [...animate.args]; if (animateTypes1.concat(animateTypes2).includes(type)) { if (type.startsWith("rotate") || type.startsWith("skew")) { args = args.map((value) => parseFloat(value) + "deg"); } else if (type.startsWith("translate")) { args = args.map(converPx); } if (animateTypes2.indexOf(type) >= 0) { args.length = 1; } transform.push(`${type}(${args.join(",")})`); } else if (animateTypes3.concat(animateTypes4).includes(args[0])) { type = args[0]; const value = args[1]; style[type] = animateTypes4.includes(type) ? converPx(value) : value; } }); style.transform = style.webkitTransform = transform.join(" "); style.transition = style.webkitTransition = Object.keys(style).map( (type) => `${converType(type)} ${transition.duration}ms ${transition.timingFunction} ${transition.delay}ms` ).join(","); style.transformOrigin = style.webkitTransformOrigin = option.transformOrigin; return style; } function startAnimation(context2) { const animation2 = context2.animation; if (!animation2 || !animation2.actions || !animation2.actions.length) { return; } let index2 = 0; const actions = animation2.actions; const length = animation2.actions.length; function animate() { const action = actions[index2]; const transition = action.option.transition; const style = getStyle(action); Object.keys(style).forEach((key) => { context2.$el.style[key] = style[key]; }); index2 += 1; if (index2 < length) { setTimeout(animate, transition.duration + transition.delay); } } setTimeout(() => { animate(); }, 0); } const animation = { props: ["animation"], watch: { animation: { deep: true, handler() { startAnimation(this); } } }, mounted() { startAnimation(this); } }; const defineBuiltInComponent = (options) => { options.__reserved = true; const { props: props2, mixins } = options; if (!props2 || !props2.animation) { (mixins || (options.mixins = [])).push(animation); } return defineSystemComponent(options); }; const defineSystemComponent = (options) => { options.__reserved = true; options.compatConfig = { MODE: 3 // 标记为vue3 }; return defineComponent(options); }; function withWebEvent(fn) { return fn.__wwe = true, fn; } function useCustomEvent(ref2, emit2) { return (name, evt, detail) => { if (ref2.value) { emit2(name, normalizeCustomEvent(name, evt, ref2.value, detail || {})); } }; } function normalizeCustomEvent(name, domEvt, el, detail) { let target; target = normalizeTarget(el); return { type: detail.type || name, timeStamp: domEvt.timeStamp || 0, target, currentTarget: target, detail }; } const hoverProps = { hoverClass: { type: String, default: "none" }, hoverStopPropagation: { type: Boolean, default: false }, hoverStartTime: { type: [Number, String], default: 50 }, hoverStayTime: { type: [Number, String], default: 400 } }; function useHover(props2) { const hovering = ref(false); let hoverTouch = false; let hoverStartTimer; let hoverStayTimer; function hoverReset() { requestAnimationFrame(() => { clearTimeout(hoverStayTimer); hoverStayTimer = setTimeout(() => { hovering.value = false; }, parseInt(props2.hoverStayTime)); }); } function onTouchstartPassive(evt) { if (evt.touches.length > 1) { return; } handleHoverStart(evt); } function onMousedown(evt) { if (hoverTouch) { return; } handleHoverStart(evt); window.addEventListener("mouseup", handlePCHoverEnd); } function handleHoverStart(evt) { if (evt._hoverPropagationStopped) { return; } if (!props2.hoverClass || props2.hoverClass === "none" || props2.disabled) { return; } if (props2.hoverStopPropagation) { evt._hoverPropagationStopped = true; } hoverTouch = true; hoverStartTimer = setTimeout(() => { hovering.value = true; if (!hoverTouch) { hoverReset(); } }, parseInt(props2.hoverStartTime)); } function onTouchend() { handleHoverEnd(); } function onMouseup() { if (!hoverTouch) { return; } handlePCHoverEnd(); } function handleHoverEnd() { hoverTouch = false; if (hovering.value) { hoverReset(); } } function handlePCHoverEnd() { handleHoverEnd(); window.removeEventListener("mouseup", handlePCHoverEnd); } function onTouchcancel() { hoverTouch = false; hovering.value = false; clearTimeout(hoverStartTimer); } return { hovering, binding: { onTouchstartPassive: withWebEvent(onTouchstartPassive), onMousedown: withWebEvent(onMousedown), onTouchend: withWebEvent(onTouchend), onMouseup: withWebEvent(onMouseup), onTouchcancel: withWebEvent(onTouchcancel) } }; } function useBooleanAttr(props2, keys) { if (isString$1(keys)) { keys = [keys]; } return keys.reduce((res, key) => { if (props2[key]) { res[key] = true; } return res; }, /* @__PURE__ */ Object.create(null)); } const uniFormKey = PolySymbol("uf"); const uniLabelKey = PolySymbol("ul"); function useListeners$1(props2, listeners2) { _addListeners(props2.id, listeners2); watch( () => props2.id, (newId, oldId) => { _removeListeners(oldId, listeners2, true); _addListeners(newId, listeners2, true); } ); onUnmounted(() => { _removeListeners(props2.id, listeners2); }); } function _addListeners(id2, listeners2, watch2) { const pageId = useCurrentPageId(); if (watch2 && !id2) { return; } if (!isPlainObject(listeners2)) { return; } Object.keys(listeners2).forEach((name) => { if (watch2) { if (name.indexOf("@") !== 0 && name.indexOf("uni-") !== 0) { UniViewJSBridge$1.on(`uni-${name}-${pageId}-${id2}`, listeners2[name]); } } else { if (name.indexOf("uni-") === 0) { UniViewJSBridge$1.on(name, listeners2[name]); } else if (id2) { UniViewJSBridge$1.on(`uni-${name}-${pageId}-${id2}`, listeners2[name]); } } }); } function _removeListeners(id2, listeners2, watch2) { const pageId = useCurrentPageId(); if (watch2 && !id2) { return; } if (!isPlainObject(listeners2)) { return; } Object.keys(listeners2).forEach((name) => { if (watch2) { if (name.indexOf("@") !== 0 && name.indexOf("uni-") !== 0) { UniViewJSBridge$1.off(`uni-${name}-${pageId}-${id2}`, listeners2[name]); } } else { if (name.indexOf("uni-") === 0) { UniViewJSBridge$1.off(name, listeners2[name]); } else if (id2) { UniViewJSBridge$1.off(`uni-${name}-${pageId}-${id2}`, listeners2[name]); } } }); } const buttonProps$1 = { id: { type: String, default: "" }, hoverClass: { type: String, default: "button-hover" }, hoverStartTime: { type: [Number, String], default: 20 }, hoverStayTime: { type: [Number, String], default: 70 }, hoverStopPropagation: { type: Boolean, default: false }, disabled: { type: [Boolean, String], default: false }, formType: { type: String, default: "" }, openType: { type: String, default: "" }, loading: { type: [Boolean, String], default: false }, plain: { type: [Boolean, String], default: false } }; const index$x = /* @__PURE__ */ defineBuiltInComponent({ name: "Button", props: buttonProps$1, setup(props2, { slots }) { const rootRef = ref(null); const uniForm = inject(uniFormKey, false); const { hovering, binding } = useHover(props2); useI18n(); const onClick = withWebEvent((e2, isLabelClick) => { if (props2.disabled) { return e2.stopImmediatePropagation(); } if (isLabelClick) { rootRef.value.click(); } const formType = props2.formType; if (formType) { if (!uniForm) { return; } if (formType === "submit") { uniForm.submit(e2); } else if (formType === "reset") { uniForm.reset(e2); } return; } }); const uniLabel = inject(uniLabelKey, false); if (uniLabel) { uniLabel.addHandler(onClick); onBeforeUnmount(() => { uniLabel.removeHandler(onClick); }); } useListeners$1(props2, { "label-click": onClick }); return () => { const hoverClass = props2.hoverClass; const booleanAttrs = useBooleanAttr(props2, "disabled"); const loadingAttrs = useBooleanAttr(props2, "loading"); const plainAttrs = useBooleanAttr(props2, "plain"); const hasHoverClass = hoverClass && hoverClass !== "none"; return createVNode("uni-button", mergeProps({ "ref": rootRef, "onClick": onClick, "id": props2.id, "class": hasHoverClass && hovering.value ? hoverClass : "" }, hasHoverClass && binding, booleanAttrs, loadingAttrs, plainAttrs), [slots.default && slots.default()], 16, ["onClick", "id"]); }; } }); function findElem(vm) { return vm.$el; } function addBase(filePath) { const { base: baseUrl } = __uniConfig.router; if (addLeadingSlash(filePath).indexOf(baseUrl) === 0) { return addLeadingSlash(filePath); } return baseUrl + filePath; } function getRealPath(filePath) { const { base, assets } = __uniConfig.router; if (base === "./") { if (filePath.indexOf("./static/") === 0 || assets && filePath.indexOf("./" + assets + "/") === 0) { filePath = filePath.slice(1); } } if (filePath.indexOf("/") === 0) { if (filePath.indexOf("//") === 0) { filePath = "https:" + filePath; } else { return addBase(filePath.slice(1)); } } if (SCHEME_RE.test(filePath) || DATA_RE.test(filePath) || filePath.indexOf("blob:") === 0) { return filePath; } const pages = getCurrentPages$1(); if (pages.length) { return addBase( getRealRoute(pages[pages.length - 1].$page.route, filePath).slice(1) ); } return filePath; } const ua = navigator.userAgent; const isAndroid = /* @__PURE__ */ /android/i.test(ua); const isIOS$1 = /* @__PURE__ */ /iphone|ipad|ipod/i.test(ua); const isWindows = /* @__PURE__ */ ua.match(/Windows NT ([\d|\d.\d]*)/i); const isMac = /* @__PURE__ */ /Macintosh|Mac/i.test(ua); const isLinux = /* @__PURE__ */ /Linux|X11/i.test(ua); const isIPadOS = isMac && navigator.maxTouchPoints > 0; function getScreenFix() { return /^Apple/.test(navigator.vendor) && typeof window.orientation === "number"; } function isLandscape(screenFix) { return screenFix && Math.abs(window.orientation) === 90; } function getScreenWidth(screenFix, landscape) { return screenFix ? Math[landscape ? "max" : "min"](screen.width, screen.height) : screen.width; } function getScreenHeight(screenFix, landscape) { return screenFix ? Math[landscape ? "min" : "max"](screen.height, screen.width) : screen.height; } function getWindowWidth(screenWidth) { return Math.min( window.innerWidth, document.documentElement.clientWidth, screenWidth ) || screenWidth; } function getBaseSystemInfo() { const screenFix = getScreenFix(); const windowWidth = getWindowWidth( getScreenWidth(screenFix, isLandscape(