Files
OpenMaopaoya/frontend-uni/node_modules/@dcloudio/uni-h5/dist-x-vapor/uni-h5.cjs.js
T

16650 lines
522 KiB
JavaScript

"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const uniShared = require("@dcloudio/uni-shared");
const Vue = require("vue");
const shared = require("@vue/shared");
const vueRouter = require("vue-router");
const uniI18n = require("@dcloudio/uni-i18n");
function _interopNamespaceDefault(e2) {
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
if (e2) {
for (const k in e2) {
if (k !== "default") {
const d = Object.getOwnPropertyDescriptor(e2, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: () => e2[k]
});
}
}
}
n.default = e2;
return n;
}
const Vue__namespace = /* @__PURE__ */ _interopNamespaceDefault(Vue);
const realGlobal = uniShared.getGlobal();
realGlobal.UTS = uniShared.UTS;
realGlobal.UTSJSONObject = uniShared.UTSJSONObject;
realGlobal.UTSValueIterable = uniShared.UTSValueIterable;
realGlobal.UniError = uniShared.UniError;
function defineComponent(options) {
const setup = options.setup;
if (setup) {
options.setup = (props2, context) => {
const result = setup(props2, context);
return typeof result === "function" ? result() : result;
};
}
return Vue.defineVaporComponent(options);
}
function createUnsupportedRender$1(name) {
const element = Vue.createPlainElement("div", null, null, true);
element.setAttribute("uni-" + name, "");
element.setAttribute("uni-view", "");
element.textContent = name + " is unsupported";
return element;
}
function converPx(value) {
if (/^-?\d+[ur]px$/i.test(value)) {
return value.replace(/(^-?\d+)[ur]px$/i, (text, num) => {
return `${uni.upx2px(parseFloat(num))}px`;
});
} else if (/^-?[\d\.]+$/.test(value)) {
return `${value}px`;
}
return value || "";
}
function converType(type) {
return type.replace(/[A-Z]/g, (text) => {
return `-${text.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(context) {
const animation2 = context.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) => {
context.$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 defineRuntimeComponent = defineComponent;
const createUnsupportedRender = createUnsupportedRender$1;
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 defineRuntimeComponent(options);
};
const defineUnsupportedComponent = (name) => {
return defineBuiltInComponent({
name: shared.capitalize(shared.camelize(name)),
setup() {
return createUnsupportedRender(name);
}
});
};
let UniElement$1 = class UniElement extends Object {
getPage() {
return uniShared.getUniElementPage(this);
}
get uniPage() {
return this.getPage();
}
getBoundingClientRectAsync(callback) {
var _a, _b;
if (callback) {
const domRect = this.getBoundingClientRect();
try {
(_a = callback.success) == null ? void 0 : _a.call(callback, domRect);
} catch (error) {
console.error(error);
}
try {
(_b = callback.complete) == null ? void 0 : _b.call(callback, domRect);
} catch (error) {
console.error(error);
}
return;
}
return new Promise((resolve, reject) => {
const domRect = this.getBoundingClientRect();
resolve(domRect);
});
}
};
const UniElement2 = UniElement$1;
const _UniCanvasElement = class _UniCanvasElement extends UniElement2 {
static [Symbol.hasInstance](value) {
const el = value;
return this === _UniCanvasElement && (el == null ? void 0 : el.nodeType) === 1 && el.localName === "canvas" && el.hasAttribute("uni-canvas") || Function.prototype[Symbol.hasInstance].call(this, value);
}
};
_UniCanvasElement.__uniElement = {};
let UniCanvasElement = _UniCanvasElement;
const canvasProps = {
disableScroll: {
type: [Boolean, String],
default: false
}
};
const _t0$e = Vue.template("<canvas uni-canvas class=uni-canvas-canvas>", 3);
const indexVapor$a = /* @__PURE__ */ defineBuiltInComponent({
name: "Canvas",
props: canvasProps,
rootElement: {
name: "uni-canvas",
class: UniCanvasElement
},
setup() {
const root = (() => {
const _n0 = _t0$e();
return _n0;
})();
return root;
}
});
const selectionProperty = "--uni-selection-background-color";
const selectionAttribute = "data-uni-selection";
const probeBackgroundProperty = "--uni-selection-probe-background-color";
const fieldSelectionProps = {
selectionClass: {
type: String,
default: ""
}
};
const fieldSelectionProbeStyle = "display: none !important;";
function clearSelection(field) {
field.style.removeProperty(selectionProperty);
field.removeAttribute(selectionAttribute);
}
function resolveSelectionColor(probe) {
const color = getComputedStyle(probe).backgroundColor;
if (color === "transparent" || color.replace(/\s/g, "") === "rgba(0,0,0,0)") {
probe.style.setProperty(probeBackgroundProperty, "#000000");
try {
return getComputedStyle(probe).backgroundColor === color ? color : "";
} finally {
probe.style.removeProperty(probeBackgroundProperty);
}
}
return color;
}
function updateSelection(field, color) {
if (!color) {
clearSelection(field);
return;
}
if (field.style.getPropertyValue(selectionProperty) !== color) {
field.style.setProperty(selectionProperty, color);
}
if (!field.hasAttribute(selectionAttribute)) {
field.setAttribute(selectionAttribute, "");
}
}
function observeSelection(probe, field) {
let refreshFrame = null;
function refreshSelection() {
refreshFrame = null;
if (!field.isConnected || field.ownerDocument.activeElement !== field) {
return;
}
updateSelection(field, resolveSelectionColor(probe));
refreshFrame = requestAnimationFrame(refreshSelection);
}
function startRefresh() {
if (refreshFrame === null) {
refreshSelection();
}
}
function stopRefresh() {
if (refreshFrame !== null) {
cancelAnimationFrame(refreshFrame);
refreshFrame = null;
}
}
field.addEventListener("focus", startRefresh);
field.addEventListener("blur", stopRefresh);
startRefresh();
return () => {
field.removeEventListener("focus", startRefresh);
field.removeEventListener("blur", stopRefresh);
stopRefresh();
clearSelection(field);
};
}
function useFieldSelection(props2, fieldRef) {
const selectionRef = Vue.ref(null);
Vue.watch(
[() => props2.selectionClass, fieldRef, selectionRef],
([className, field, probe], _, onCleanup) => {
if (className && field && probe) {
onCleanup(observeSelection(probe, field));
}
},
{ immediate: true, flush: "post" }
);
return selectionRef;
}
const nativeHasInstance = Function.prototype[Symbol.hasInstance];
function isUniNativeElement(value, tag, marker) {
const el = value;
return (el == null ? void 0 : el.nodeType) === 1 && el.localName === tag && el.hasAttribute(marker);
}
const NativeUniElement = UniElement2;
class UniViewElement extends NativeUniElement {
static [Symbol.hasInstance](value) {
return this === UniViewElement && isUniNativeElement(value, "div", "uni-view") || nativeHasInstance.call(this, value);
}
}
class UniTextElement extends NativeUniElement {
// Web 直接读取 DOM 文字,不缓存、不触发布局;不提供会删除 Vue 子节点的 setter。
// 类上保留 getter,供 Button 等复合 Element 的 super.value 复用。
get value() {
return this.textContent ?? "";
}
static [Symbol.hasInstance](value) {
return this === UniTextElement && isUniNativeElement(value, "span", "uni-text") || nativeHasInstance.call(this, value);
}
}
class UniImageElement extends NativeUniElement {
static [Symbol.hasInstance](value) {
return this === UniImageElement && isUniNativeElement(value, "img", "uni-image") || nativeHasInstance.call(this, value);
}
}
const _UniInputElement = class _UniInputElement extends UniViewElement {
static [Symbol.hasInstance](value) {
return this === _UniInputElement && value instanceof UniViewElement && value.hasAttribute("uni-input") || Function.prototype[Symbol.hasInstance].call(this, value);
}
focus(options) {
var _a;
(_a = this.querySelector("input")) == null ? void 0 : _a.focus(options);
}
get value() {
return this.querySelector("input").value;
}
set value(value) {
this.querySelector("input").value = value;
}
};
_UniInputElement.__uniElement = {};
let UniInputElement = _UniInputElement;
const descriptors$1 = {
uniTagName: { value: "INPUT" },
focus: Object.getOwnPropertyDescriptor(UniInputElement.prototype, "focus"),
value: Object.getOwnPropertyDescriptor(UniInputElement.prototype, "value")
};
function initInputElement(root) {
Object.defineProperties(root, descriptors$1);
}
const isEnableLocale = /* @__PURE__ */ uniShared.once(
() => typeof __uniConfig !== "undefined" && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length
);
let i18n;
function getLocaleMessage() {
const locale = uni.getLocale();
const locales = __uniConfig.locales;
return locales[locale] || locales[__uniConfig.fallbackLocale] || locales.en || {};
}
function formatI18n(message) {
if (uniI18n.isI18nStr(message, uniShared.I18N_JSON_DELIMITERS)) {
return useI18n().f(message, getLocaleMessage(), uniShared.I18N_JSON_DELIMITERS);
}
return message;
}
function resolveJsonObj(jsonObj, names) {
if (names.length === 1) {
if (jsonObj) {
const _isI18nStr = (value2) => shared.isString(value2) && uniI18n.isI18nStr(value2, uniShared.I18N_JSON_DELIMITERS);
const _name = names[0];
let filterJsonObj = [];
if (shared.isArray(jsonObj) && (filterJsonObj = jsonObj.filter((item) => _isI18nStr(item[_name]))).length) {
return filterJsonObj;
}
const value = jsonObj[names[0]];
if (_isI18nStr(value)) {
return jsonObj;
}
}
return;
}
const name = names.shift();
return resolveJsonObj(jsonObj && jsonObj[name], names);
}
function defineI18nProperties(obj, names) {
return names.map((name) => defineI18nProperty(obj, name));
}
function defineI18nProperty(obj, names) {
const jsonObj = resolveJsonObj(obj, names);
if (!jsonObj) {
return false;
}
const prop = names[names.length - 1];
if (shared.isArray(jsonObj)) {
jsonObj.forEach((item) => defineI18nProperty(item, [prop]));
} else {
let value = jsonObj[prop];
Object.defineProperty(jsonObj, prop, {
get() {
return formatI18n(value);
},
set(v2) {
value = v2;
}
});
}
return true;
}
function useI18n() {
if (!i18n) {
let locale;
{
{
locale = uniShared.getEnvLocale();
}
}
i18n = uniI18n.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(module2, keys, values) {
return keys.reduce((res, name, index2) => {
res[module2 + name] = values[index2];
return res;
}, {});
}
const initI18nAppVmMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
const name = "uni.appVm.";
const keys = ["methodWarning"];
if (__UNI_FEATURE_I18N_EN__) {
useI18n().add(
uniI18n.LOCALE_EN,
normalizeMessages(name, keys, [
'Method "{methodName}" should not be called directly on UniApp. Use "{methodCall}" instead.'
]),
false
);
}
if (__UNI_FEATURE_I18N_ES__) {
useI18n().add(
uniI18n.LOCALE_ES,
normalizeMessages(name, keys, [
'El método "{methodName}" no debe llamarse directamente en UniApp. Use "{methodCall}" en su lugar.'
]),
false
);
}
if (__UNI_FEATURE_I18N_FR__) {
useI18n().add(
uniI18n.LOCALE_FR,
normalizeMessages(name, keys, [
'La méthode "{methodName}" ne doit pas être appelée directement sur UniApp. Utilisez "{methodCall}" à la place.'
]),
false
);
}
if (__UNI_FEATURE_I18N_ZH_HANS__) {
useI18n().add(
uniI18n.LOCALE_ZH_HANS,
normalizeMessages(name, keys, [
"不应直接通过 UniApp 调用方法“{methodName}”,请改用“{methodCall}”。"
]),
false
);
}
if (__UNI_FEATURE_I18N_ZH_HANT__) {
useI18n().add(
uniI18n.LOCALE_ZH_HANT,
normalizeMessages(name, keys, [
"不應直接透過 UniApp 呼叫方法「{methodName}」,請改用「{methodCall}」。"
]),
false
);
}
});
const initI18nAsyncMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
const name = "uni.async.";
const keys = ["error"];
if (__UNI_FEATURE_I18N_EN__) {
useI18n().add(
uniI18n.LOCALE_EN,
normalizeMessages(name, keys, [
"The connection timed out, click the screen to try again."
]),
false
);
}
if (__UNI_FEATURE_I18N_ES__) {
useI18n().add(
uniI18n.LOCALE_ES,
normalizeMessages(name, keys, [
"Se agotó el tiempo de conexión, haga clic en la pantalla para volver a intentarlo."
]),
false
);
}
if (__UNI_FEATURE_I18N_FR__) {
useI18n().add(
uniI18n.LOCALE_FR,
normalizeMessages(name, keys, [
"La connexion a expiré, cliquez sur l'écran pour réessayer."
]),
false
);
}
if (__UNI_FEATURE_I18N_ZH_HANS__) {
useI18n().add(
uniI18n.LOCALE_ZH_HANS,
normalizeMessages(name, keys, ["连接服务器超时,点击屏幕重试"]),
false
);
}
if (__UNI_FEATURE_I18N_ZH_HANT__) {
useI18n().add(
uniI18n.LOCALE_ZH_HANT,
normalizeMessages(name, keys, ["連接服務器超時,點擊屏幕重試"]),
false
);
}
});
const initI18nVideoMsgsOnce = /* @__PURE__ */ uniShared.once(() => {
const name = "uni.video.";
const keys = ["danmu", "volume"];
if (__UNI_FEATURE_I18N_EN__) {
useI18n().add(
uniI18n.LOCALE_EN,
normalizeMessages(name, keys, ["Danmu", "Volume"]),
false
);
}
if (__UNI_FEATURE_I18N_ES__) {
useI18n().add(
uniI18n.LOCALE_ES,
normalizeMessages(name, keys, ["Danmu", "Volumen"]),
false
);
}
if (__UNI_FEATURE_I18N_FR__) {
useI18n().add(
uniI18n.LOCALE_FR,
normalizeMessages(name, keys, ["Danmu", "Le Volume"]),
false
);
}
if (__UNI_FEATURE_I18N_ZH_HANS__) {
useI18n().add(
uniI18n.LOCALE_ZH_HANS,
normalizeMessages(name, keys, ["弹幕", "音量"]),
false
);
}
if (__UNI_FEATURE_I18N_ZH_HANT__) {
useI18n().add(
uniI18n.LOCALE_ZH_HANT,
normalizeMessages(name, keys, ["彈幕", "音量"]),
false
);
}
});
function initNavigationBarI18n(navigationBar) {
if (isEnableLocale()) {
return defineI18nProperties(navigationBar, [
["titleText"],
["searchInput", "placeholder"],
["buttons", "text"]
]);
}
}
function initTabBarI18n(tabBar) {
if (isEnableLocale() && tabBar.list) {
tabBar.list.forEach((item) => {
defineI18nProperty(item, ["text"]);
});
}
if (isEnableLocale() && tabBar.midButton) {
defineI18nProperty(tabBar.midButton, ["text"]);
}
return tabBar;
}
function initBridge(subscribeNamespace) {
const emitter = new uniShared.Emitter();
return {
on(event, callback) {
return emitter.on(event, callback);
},
once(event, callback) {
return emitter.once(event, callback);
},
off(event, callback) {
return emitter.off(event, callback);
},
emit(event, ...args) {
return emitter.emit(event, ...args);
},
subscribe(event, callback, once = false) {
emitter[once ? "once" : "on"](`${subscribeNamespace}.${event}`, callback);
},
unsubscribe(event, callback) {
emitter.off(`${subscribeNamespace}.${event}`, callback);
},
subscribeHandler(event, args, pageId) {
emitter.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;
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;
}
}
const ViewJSBridge = /* @__PURE__ */ shared.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;
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 W = 100;
var MAX = 1e4;
var aStyle = {
position: "absolute",
width: W + "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 = true;
}
function getAttr(attr2) {
if (!inited) {
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) {
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);
function updateCssVar(cssVars) {
const style = document.documentElement.style;
Object.keys(cssVars).forEach((name) => {
style.setProperty(name, cssVars[name]);
});
}
function updatePageCssVar(cssVars) {
return updateCssVar(cssVars);
}
function PolySymbol(name) {
return Symbol(process.env.NODE_ENV !== "production" ? "[uni-app]: " + name : name);
}
function rpx2px(str, replace = false) {
if (replace) {
return rpx2pxWithReplace(str);
}
{
return parseInt(str + "");
}
}
function rpx2pxWithReplace(str) {
{
return str;
}
}
function get$pageByPage(page) {
return page.vm.$basePage;
}
let svgIcon = () => {
svgIcon = Vue.template('<svg viewBox="0 0 32 32"><path></path></svg>', 0, 1);
return svgIcon();
};
function createSvgIcon(path, color = "#000", size = 27, stroke = false) {
const svg = svgIcon();
Vue.setAttr(svg, "width", size, true);
Vue.setAttr(svg, "height", size, true);
Vue.setAttr(svg.firstChild, "d", path, true);
Vue.setAttr(svg.firstChild, "fill", stroke ? "none" : color, true);
if (stroke) {
Vue.setAttr(svg.firstChild, "stroke", color, true);
Vue.setAttr(svg.firstChild, "stroke-width", 2, true);
Vue.setAttr(svg.firstChild, "stroke-linecap", "round", true);
}
return svg;
}
const createSvgIconVNode = createSvgIcon;
const ICON_PATH_CANCEL = "M20.928 10.176l-4.928 4.928-4.928-4.928-0.896 0.896 4.928 4.928-4.928 4.928 0.896 0.896 4.928-4.928 4.928 4.928 0.896-0.896-4.928-4.928 4.928-4.928-0.896-0.896zM16 2.080q-3.776 0-7.040 1.888-3.136 1.856-4.992 4.992-1.888 3.264-1.888 7.040t1.888 7.040q1.856 3.136 4.992 4.992 3.264 1.888 7.040 1.888t7.040-1.888q3.136-1.856 4.992-4.992 1.888-3.264 1.888-7.040t-1.888-7.040q-1.856-3.136-4.992-4.992-3.264-1.888-7.040-1.888zM16 28.64q-3.424 0-6.4-1.728-2.848-1.664-4.512-4.512-1.728-2.976-1.728-6.4t1.728-6.4q1.664-2.848 4.512-4.512 2.976-1.728 6.4-1.728t6.4 1.728q2.848 1.664 4.512 4.512 1.728 2.976 1.728 6.4t-1.728 6.4q-1.664 2.848-4.512 4.512-2.976 1.728-6.4 1.728z";
const ICON_PATH_CLEAR = "M16 0q-4.352 0-8.064 2.176-3.616 2.144-5.76 5.76-2.176 3.712-2.176 8.064t2.176 8.064q2.144 3.616 5.76 5.76 3.712 2.176 8.064 2.176t8.064-2.176q3.616-2.144 5.76-5.76 2.176-3.712 2.176-8.064t-2.176-8.064q-2.144-3.616-5.76-5.76-3.712-2.176-8.064-2.176zM22.688 21.408q0.32 0.32 0.304 0.752t-0.336 0.736-0.752 0.304-0.752-0.32l-5.184-5.376-5.376 5.184q-0.32 0.32-0.752 0.304t-0.736-0.336-0.304-0.752 0.32-0.752l5.376-5.184-5.184-5.376q-0.32-0.32-0.304-0.752t0.336-0.752 0.752-0.304 0.752 0.336l5.184 5.376 5.376-5.184q0.32-0.32 0.752-0.304t0.752 0.336 0.304 0.752-0.336 0.752l-5.376 5.184 5.184 5.376z";
const ICON_PATH_DOWNLOAD = "M15.808 1.696q-3.776 0-7.072 1.984-3.2 1.888-5.088 5.152-1.952 3.392-1.952 7.36 0 3.776 1.952 7.072 1.888 3.2 5.088 5.088 3.296 1.952 7.072 1.952 3.968 0 7.36-1.952 3.264-1.888 5.152-5.088 1.984-3.296 1.984-7.072 0-4-1.984-7.36-1.888-3.264-5.152-5.152-3.36-1.984-7.36-1.984zM20.864 18.592l-3.776 4.928q-0.448 0.576-1.088 0.576t-1.088-0.576l-3.776-4.928q-0.448-0.576-0.24-0.992t0.944-0.416h2.976v-8.928q0-0.256 0.176-0.432t0.4-0.176h1.216q0.224 0 0.4 0.176t0.176 0.432v8.928h2.976q0.736 0 0.944 0.416t-0.24 0.992z";
const ICON_PATH_INFO = "M15.808 0.128q-4.224 0-7.872 2.176-3.552 2.112-5.632 5.728-2.176 3.776-2.176 8.16 0 4.224 2.176 7.872 2.080 3.552 5.632 5.632 3.648 2.176 7.872 2.176 4.384 0 8.16-2.176 3.616-2.080 5.728-5.632 2.176-3.648 2.176-7.872 0-4.416-2.176-8.16-2.112-3.616-5.728-5.728-3.744-2.176-8.16-2.176zM16.864 23.776q0 0.064-0.064 0.064h-1.568q-0.096 0-0.096-0.064l-0.256-11.328q0-0.064 0.064-0.064h2.112q0.096 0 0.064 0.064l-0.256 11.328zM16 10.88q-0.576 0-0.976-0.4t-0.4-0.96 0.4-0.96 0.976-0.4 0.976 0.4 0.4 0.96-0.4 0.96-0.976 0.4z";
const ICON_PATH_SEARCH = "M20.928 22.688q-1.696 1.376-3.744 2.112-2.112 0.768-4.384 0.768-3.488 0-6.464-1.728-2.88-1.696-4.576-4.608-1.76-2.976-1.76-6.464t1.76-6.464q1.696-2.88 4.576-4.576 2.976-1.76 6.464-1.76t6.464 1.76q2.912 1.696 4.608 4.576 1.728 2.976 1.728 6.464 0 2.272-0.768 4.384-0.736 2.048-2.112 3.744l9.312 9.28-1.824 1.824-9.28-9.312zM12.8 23.008q2.784 0 5.184-1.376 2.304-1.376 3.68-3.68 1.376-2.4 1.376-5.184t-1.376-5.152q-1.376-2.336-3.68-3.68-2.4-1.408-5.184-1.408t-5.152 1.408q-2.336 1.344-3.68 3.68-1.408 2.368-1.408 5.152t1.408 5.184q1.344 2.304 3.68 3.68 2.368 1.376 5.152 1.376zM12.8 23.008v0z";
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_SUCCESS = "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.176zM24.832 11.328l-11.264 11.104q-0.032 0.032-0.112 0.032t-0.112-0.032l-5.216-5.376q-0.096-0.128 0-0.288l0.704-0.96q0.032-0.064 0.112-0.064t0.112 0.032l4.256 3.264q0.064 0.032 0.144 0.032t0.112-0.032l10.336-8.608q0.064-0.064 0.144-0.064t0.112 0.064l0.672 0.672q0.128 0.128 0 0.224z";
const ICON_PATH_WAITING = "M15.84 0.096q-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.176zM23.008 21.92l-0.512 0.896q-0.096 0.128-0.224 0.064l-8-3.808q-0.096-0.064-0.16-0.128-0.128-0.096-0.128-0.288l0.512-12.096q0-0.064 0.048-0.112t0.112-0.048h1.376q0.064 0 0.112 0.048t0.048 0.112l0.448 10.848 6.304 4.256q0.064 0.064 0.080 0.128t-0.016 0.128z";
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 = "M20 25L11 16L20 7";
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 useCurrentPageId() {
{
const { $pageInstance } = Vue.getCurrentInstance();
return $pageInstance && getPageProxyId($pageInstance.proxy);
}
}
function getCurrentPage() {
const pages = getCurrentPages();
const len = pages.length;
if (len) {
return pages[len - 1];
}
}
function getCurrentPageMeta() {
var _a, _b;
const $page = (_b = (_a = getCurrentPage()) == null ? void 0 : _a.vm) == null ? void 0 : _b.$basePage;
if ($page) {
return $page.meta;
}
}
function getCurrentPageId() {
const meta = getCurrentPageMeta();
if (meta) {
return meta.id;
}
return -1;
}
function getCurrentPageVm() {
var _a;
const page = (_a = getCurrentPage()) == null ? void 0 : _a.vm;
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 = shared.extend({ id: id2 }, globalStyle, pageMeta);
PAGE_META_KEYS.forEach((name) => {
res[name] = shared.extend({}, globalStyle[name], pageMeta[name]);
});
const { navigationBar } = res;
navigationBar.titleText && navigationBar.titleImage && (navigationBar.titleText = "");
return res;
}
function normalizePullToRefreshRpx(pullToRefresh) {
if (pullToRefresh.offset) {
pullToRefresh.offset = rpx2px(pullToRefresh.offset);
}
if (pullToRefresh.height) {
pullToRefresh.height = rpx2px(pullToRefresh.height);
}
if (pullToRefresh.range) {
pullToRefresh.range = rpx2px(pullToRefresh.range);
}
return pullToRefresh;
}
function initPageInternalInstance(openType, url, pageQuery, meta, eventChannel, themeMode) {
const { id: id2, route } = meta;
const titleColor = uniShared.normalizeStyles(
meta.navigationBar,
__uniConfig.themeConfig,
themeMode
).titleColor;
return {
id: id2,
path: uniShared.addLeadingSlash(route),
route,
fullPath: url,
options: pageQuery,
meta,
openType,
eventChannel,
statusBarStyle: titleColor === "#ffffff" ? "light" : "dark"
};
}
function getPageProxyId(proxy) {
var _a, _b;
return ((_a = proxy.$page) == null ? void 0 : _a.id) || ((_b = proxy.$basePage) == null ? void 0 : _b.id);
}
function invokeHook(vm, name, args) {
if (shared.isString(vm)) {
args = name;
name = vm;
vm = getCurrentPageVm();
} else if (typeof vm === "number") {
const page = getCurrentPages().find(
(page2) => get$pageByPage(page2).id === vm
);
if (page) {
vm = page.$vm;
} else {
vm = getCurrentPageVm();
}
}
if (!vm) {
return;
}
const hooks = vm.$[name];
if (name === uniShared.ON_BACK_PRESS) {
return hooks && uniShared.invokeArrayFnsWithResults(hooks, args).some((ret) => ret === true);
}
return hooks && uniShared.invokeArrayFns(hooks, args);
}
function normalizeRoute(toRoute) {
if (toRoute.indexOf("/") === 0 || toRoute.indexOf("uni:") === 0) {
return toRoute;
}
let fromRoute = "";
const pages = getCurrentPages();
if (pages.length) {
fromRoute = get$pageByPage(pages[pages.length - 1]).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 uniShared.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);
}
function getPageInstanceByChild(child) {
var _a;
let pageInstance = child;
while (pageInstance && ((_a = pageInstance.type) == null ? void 0 : _a.name) !== "Page") {
pageInstance = pageInstance.parent;
}
return pageInstance;
}
const DIALOG_TAG = "dialog";
const SYSTEM_DIALOG_TAG = "systemDialog";
function isDialogPageInstance(vm) {
if (!vm)
return false;
return isNormalDialogPageInstance(vm) || isSystemDialogPageInstance(vm);
}
function isNormalDialogPageInstance(vm) {
return vm.attrs["data-type"] === DIALOG_TAG;
}
function isSystemDialogPageInstance(vm) {
return vm.attrs["data-type"] === SYSTEM_DIALOG_TAG;
}
function warnUniAppVmMethod(methodName) {
initI18nAppVmMsgsOnce();
const methodCall = `getApp().vm?.${methodName}()`;
Vue.warn(
useI18n().t("uni.appVm.methodWarning", {
methodName,
methodCall
})
);
}
function createInitUniAppVmMethodWarnings() {
const VM_METHOD_WARNING_GETTER = Symbol.for(
"uni-app.vm-method-warning-getter"
);
const UNI_APP_METHODS = /* @__PURE__ */ new Set([
"$vm",
"globalData",
"getAndroidApplication",
"getHarmonyAbility",
"restart",
"vm"
]);
function getMethodSources(vm) {
var _a;
const instance = vm.$;
if (instance.exposed) {
return [instance.exposed];
}
return [
instance.ctx,
((_a = instance.setupState) == null ? void 0 : _a.__isScriptSetup) ? void 0 : instance.setupState
];
}
function getVmMethodNames(vm) {
const methodNames = /* @__PURE__ */ new Set();
getMethodSources(vm).forEach((source) => {
if (!source) {
return;
}
Object.getOwnPropertyNames(source).forEach((name) => {
const descriptor = Object.getOwnPropertyDescriptor(source, name);
if (typeof Vue.unref(descriptor == null ? void 0 : descriptor.value) === "function") {
methodNames.add(name);
}
});
});
return methodNames;
}
function createWarningGetter(methodName, getter) {
const warningGetter = function() {
warnUniAppVmMethod(methodName);
return Reflect.apply(getter, this, []);
};
Object.defineProperty(warningGetter, VM_METHOD_WARNING_GETTER, {
value: { methodName }
});
return warningGetter;
}
function findPropertyDescriptor(target, methodName) {
try {
let owner = target;
while (owner) {
const descriptor = Object.getOwnPropertyDescriptor(owner, methodName);
if (descriptor) {
return { descriptor, own: owner === target };
}
owner = Object.getPrototypeOf(owner);
}
} catch {
return;
}
}
function defineProperty(target, methodName, descriptor) {
try {
Object.defineProperty(target, methodName, descriptor);
} catch {
}
}
function wrapAccessor(uniApp, methodName, descriptor, own) {
var _a;
const getter = descriptor.get;
if (!getter || ((_a = getter[VM_METHOD_WARNING_GETTER]) == null ? void 0 : _a.methodName) === methodName || own && !descriptor.configurable) {
return;
}
defineProperty(uniApp, methodName, {
configurable: own ? descriptor.configurable : true,
enumerable: descriptor.enumerable,
get: createWarningGetter(methodName, getter),
set: descriptor.set
});
}
function wrapDataProperty(uniApp, methodName, value, descriptor, own = false) {
if (own && !(descriptor == null ? void 0 : descriptor.configurable)) {
return;
}
let currentValue = value;
defineProperty(uniApp, methodName, {
configurable: own ? descriptor == null ? void 0 : descriptor.configurable : true,
enumerable: (descriptor == null ? void 0 : descriptor.enumerable) ?? false,
get: createWarningGetter(methodName, () => currentValue),
set: (descriptor == null ? void 0 : descriptor.writable) === false ? void 0 : (value2) => {
currentValue = value2;
}
});
}
function wrapUniAppMethod(uniApp, methodName, wrapMissingProperty = false) {
if (UNI_APP_METHODS.has(methodName)) {
return;
}
const property = findPropertyDescriptor(uniApp, methodName);
if (property) {
const { descriptor, own } = property;
if (descriptor.get) {
wrapAccessor(uniApp, methodName, descriptor, own);
} else if (typeof descriptor.value === "function") {
wrapDataProperty(uniApp, methodName, descriptor.value, descriptor, own);
}
return;
}
let method;
try {
method = uniApp[methodName];
} catch {
return;
}
if (typeof method === "function" || wrapMissingProperty) {
wrapDataProperty(uniApp, methodName, method);
}
}
return function initUniAppVmMethodWarnings2(uniApp) {
if (!uniApp.vm) {
return /* @__PURE__ */ new Set();
}
const methodNames = getVmMethodNames(uniApp.vm);
UNI_APP_METHODS.forEach((methodName) => methodNames.delete(methodName));
methodNames.forEach((methodName) => {
wrapUniAppMethod(uniApp, methodName, false);
});
return methodNames;
};
}
const initUniAppVmMethodWarnings = process.env.NODE_ENV !== "production" ? createInitUniAppVmMethodWarnings() : () => /* @__PURE__ */ new Set();
const invokeOnCallback = (name, res) => UniServiceJSBridge.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;
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;
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__ */ shared.extend(
/* @__PURE__ */ initBridge(
"view"
/* view 指的是 service 层订阅的是 view 层事件 */
),
{
invokeOnCallback,
invokeViewMethod,
invokeViewMethodKeepAlive
}
);
function initAppVm(appVm2) {
appVm2.$vm = appVm2;
appVm2.$mpType = "app";
const locale = Vue.ref(useI18n().getLocale());
Object.defineProperty(appVm2, "$locale", {
get() {
return locale.value;
},
set(v2) {
locale.value = v2;
}
});
}
function initPageVm(pageVm, page) {
pageVm.route = page.route;
pageVm.$vm = pageVm;
{
pageVm.$basePage = page;
}
pageVm.$mpType = "page";
pageVm.$fontFamilySet = /* @__PURE__ */ new Set();
if (page.meta.isTabBar) {
pageVm.$.__isTabBar = true;
pageVm.$.__isActive = true;
}
}
function defineGlobalData(app, defaultGlobalData) {
const options = app.$options || {};
options.globalData = shared.extend(options.globalData || {}, defaultGlobalData);
Object.defineProperty(app, "globalData", {
get() {
return options.globalData;
},
set(newGlobalData) {
options.globalData = newGlobalData;
}
});
}
function throttle(fn, wait) {
let last = 0;
let timeout;
let waitCallback;
const newFn = function(...arg) {
const now = Date.now();
clearTimeout(timeout);
waitCallback = () => {
waitCallback = null;
last = now;
fn.apply(this, arg);
};
if (now - last < wait) {
timeout = setTimeout(waitCallback, wait - (now - last));
return;
}
waitCallback();
};
newFn.cancel = function() {
clearTimeout(timeout);
waitCallback = null;
};
newFn.flush = function() {
clearTimeout(timeout);
waitCallback && waitCallback();
};
return newFn;
}
function withWebEvent(fn) {
return fn.__wwe = true, fn;
}
function useCustomEvent(ref, emit2) {
return (name, evt, detail) => {
if (ref.value) {
emit2(name, normalizeCustomEvent(name, evt, ref.value, detail || {}));
}
};
}
function normalizeCustomEvent(name, domEvt, el, detail) {
const target = uniShared.normalizeTarget(el);
return {
type: domEvt.__evName || detail.type || name,
timeStamp: domEvt.timeStamp || 0,
target,
currentTarget: target,
detail
};
}
function useUserAction() {
const state = Vue.reactive({
/**
* 是否用户激活
*/
userAction: false
});
return {
state
};
}
let resetTimer;
function iosHideKeyboard() {
}
const props$a = {
cursorSpacing: {
type: [Number, String],
default: 0
},
showConfirmBar: {
type: [Boolean, String],
default: "auto"
},
adjustPosition: {
type: [Boolean, String],
default: true
},
autoBlur: {
type: [Boolean, String],
default: false
}
};
const emit$1 = ["keyboardheightchange"];
function useKeyboard(props2, elRef, trigger) {
function initKeyboard(el) {
const isApple = Vue.computed(
() => String(navigator.vendor).indexOf("Apple") === 0
);
el.addEventListener("focus", () => {
clearTimeout(resetTimer);
document.addEventListener("click", iosHideKeyboard, false);
});
const onKeyboardHide = () => {
document.removeEventListener("click", iosHideKeyboard, false);
if (isApple.value) {
document.documentElement.scrollTo(
document.documentElement.scrollLeft,
document.documentElement.scrollTop
);
}
};
el.addEventListener("blur", () => {
if (isApple.value) {
el.blur();
}
onKeyboardHide();
});
}
Vue.watch(
() => elRef.value,
(el) => el && initKeyboard(el)
);
}
function useScopedAttrs() {
const state = Vue.reactive({
attrs: {}
});
return {
state
};
}
function useVaporFormField(props2, state) {
const form = Vue.inject("UNI_FORM_CTX", null);
if (!form)
return;
const initialValue = state.value;
const getValue = () => state.value;
const reset = () => {
state.value = initialValue;
};
Vue.watch(
() => props2.name,
(name, oldName) => {
if (oldName)
form.unregisterField(oldName);
if (name)
form.registerField({ name, getValue, reset });
},
{ immediate: true, flush: "sync" }
);
}
function getSelectedTextRange(_, resolve) {
const activeElement = document.activeElement;
if (!activeElement) {
return resolve({});
}
const data = {};
if (["input", "textarea"].includes(activeElement.tagName.toLowerCase())) {
data.start = activeElement.selectionStart;
data.end = activeElement.selectionEnd;
}
resolve(data);
}
const UniViewJSBridgeSubscribe = function() {
registerViewMethod(
getCurrentPageId(),
"getSelectedTextRange",
getSelectedTextRange
);
};
function getValueString(value, type, maxlength) {
if (type === "number" && isNaN(Number(value))) {
value = "";
}
const valueStr = value === null || value === void 0 ? "" : String(value);
if (maxlength == void 0) {
return valueStr;
}
return valueStr.slice(0, maxlength);
}
const INPUT_MODES = [
"none",
"text",
"decimal",
"numeric",
"tel",
"search",
"email",
"url"
];
const props$9 = /* @__PURE__ */ shared.extend(
{},
{
name: {
type: String,
default: ""
},
modelValue: {
type: [String, Number]
},
value: {
type: [String, Number]
},
disabled: {
type: [Boolean, String],
default: false
},
/**
* 已废弃属性,用于历史兼容
*/
autoFocus: {
type: [Boolean, String],
default: false
},
focus: {
type: [Boolean, String],
default: false
},
cursor: {
type: [Number, String],
default: -1
},
selectionStart: {
type: [Number, String],
default: -1
},
selectionEnd: {
type: [Number, String],
default: -1
},
type: {
type: String,
default: "text"
},
password: {
type: [Boolean, String],
default: false
},
placeholder: {
type: String,
default: ""
},
placeholderStyle: {
type: String,
default: ""
},
placeholderClass: {
type: String,
default: ""
},
maxlength: {
type: [Number, String],
default: Infinity
},
confirmType: {
type: String,
default: "done"
},
confirmHold: {
type: Boolean,
default: false
},
ignoreCompositionEvent: {
type: Boolean,
default: true
},
step: {
type: String,
default: "0.000000000000000001"
},
inputmode: {
type: String,
default: void 0,
validator: (value) => !!~INPUT_MODES.indexOf(value)
},
cursorColor: {
type: String,
default: ""
}
},
props$a
);
const emit = [
"input",
"focus",
"blur",
"update:value",
"update:modelValue",
"update:focus",
"compositionstart",
"compositionupdate",
"compositionend",
...emit$1
];
function useBase(props2, rootRef, emit2) {
const fieldRef = Vue.ref(null);
const trigger = useCustomEvent(rootRef, emit2);
const selectionStart = Vue.computed(() => {
const selectionStart2 = Number(props2.selectionStart);
return isNaN(selectionStart2) ? -1 : selectionStart2;
});
const selectionEnd = Vue.computed(() => {
const selectionEnd2 = Number(props2.selectionEnd);
return isNaN(selectionEnd2) ? -1 : selectionEnd2;
});
const cursor = Vue.computed(() => {
const cursor2 = Number(props2.cursor);
return isNaN(cursor2) ? -1 : cursor2;
});
const maxlength = Vue.computed(() => {
var maxlength2 = Number(props2.maxlength);
{
return isNaN(maxlength2) || maxlength2 < 0 ? Infinity : Math.floor(maxlength2);
}
});
let value = "";
{
const modelValueString = getValueString(
props2.modelValue,
props2.type,
maxlength.value
);
const valueString = getValueString(props2.value, props2.type, maxlength.value);
value = props2.modelValue !== void 0 ? modelValueString !== null && modelValueString !== void 0 ? modelValueString : valueString : valueString;
}
const state = Vue.reactive({
value,
valueOrigin: value,
maxlength,
focus: props2.focus,
composing: false,
selectionStart,
selectionEnd,
cursor
});
Vue.watch(
() => state.focus,
(val) => emit2("update:focus", val)
);
Vue.watch(
() => state.maxlength,
(val) => {
if (val >= 0) {
state.value = state.value.slice(0, val);
}
},
{
immediate: true
}
);
return {
fieldRef,
state,
trigger
};
}
function useValueSync(props2, state, emit2, trigger, fieldRef) {
let valueChangeFn = null;
{
valueChangeFn = throttle((val) => {
state.value = getValueString(val, props2.type, state.maxlength);
}, 100);
}
Vue.watch(() => props2.modelValue, valueChangeFn);
Vue.watch(() => props2.value, valueChangeFn);
const triggerInputFn = throttle((event, detail) => {
valueChangeFn.cancel();
emit2("update:modelValue", detail.value);
emit2("update:value", detail.value);
trigger("input", event, detail);
}, 100);
const triggerInput = (event, detail, force) => {
valueChangeFn.cancel();
detail.value;
triggerInputFn(event, detail);
if (force) {
triggerInputFn.flush();
}
};
return {
trigger,
triggerInput
};
}
function useAutoFocus(props2, fieldRef) {
useUserAction();
const needFocus = Vue.computed(() => props2.autoFocus || props2.focus);
function focus() {
if (!needFocus.value) {
return;
}
const field = fieldRef.value;
if (!field || false) {
setTimeout(focus, 100);
return;
}
{
field.focus();
}
}
function blur() {
const field = fieldRef.value;
if (field) {
field.blur();
}
}
Vue.watch(
() => props2.focus,
(value) => {
if (value) {
focus();
} else {
blur();
}
}
);
}
function useEvent(fieldRef, state, props2, trigger, triggerInput, beforeInput) {
function checkSelection() {
const field = fieldRef.value;
if (field && state.focus && state.selectionStart > -1 && state.selectionEnd > -1 && typeof field.selectionStart === "number") {
field.selectionStart = state.selectionStart;
field.selectionEnd = state.selectionEnd;
}
}
function checkCursor() {
const field = fieldRef.value;
if (field && state.focus && state.selectionStart < 0 && state.selectionEnd < 0 && state.cursor > -1 && typeof field.selectionStart === "number") {
field.selectionEnd = field.selectionStart = state.cursor;
}
}
function getFieldSelectionEnd(field) {
if (field.type === "number") {
return null;
} else {
return field.selectionEnd;
}
}
function initField() {
const field = fieldRef.value;
if (!field)
return;
const onFocus = function(event) {
state.focus = true;
trigger("focus", event, {
value: state.value
});
checkSelection();
checkCursor();
};
const onInput = function(event, force) {
event.stopPropagation();
if (shared.isFunction(beforeInput) && beforeInput(event, state) === false) {
return;
}
state.value = field.value;
if (!state.composing || !props2.ignoreCompositionEvent) {
triggerInput(
event,
{
value: field.value,
cursor: getFieldSelectionEnd(field)
},
force
);
}
};
const onBlur = function(event) {
if (state.composing) {
state.composing = false;
onInput(event, true);
}
state.focus = false;
trigger("blur", event, {
value: state.value,
cursor: getFieldSelectionEnd(event.target)
});
};
field.addEventListener("change", (event) => event.stopPropagation());
field.addEventListener("focus", onFocus);
field.addEventListener("blur", onBlur);
field.addEventListener("input", onInput);
field.addEventListener("compositionstart", (event) => {
event.stopPropagation();
state.composing = true;
_onComposition(event);
});
field.addEventListener("compositionend", (event) => {
event.stopPropagation();
if (state.composing) {
state.composing = false;
onInput(event);
}
_onComposition(event);
});
field.addEventListener("compositionupdate", _onComposition);
function _onComposition(event) {
if (!props2.ignoreCompositionEvent) {
trigger(event.type, event, {
value: event.data
});
}
}
}
Vue.watch([() => state.selectionStart, () => state.selectionEnd], checkSelection);
Vue.watch(() => state.cursor, checkCursor);
Vue.watch(() => fieldRef.value, initField);
}
function useField(props2, rootRef, emit2, beforeInput) {
UniViewJSBridgeSubscribe();
const { fieldRef, state, trigger } = useBase(props2, rootRef, emit2);
const { triggerInput } = useValueSync(props2, state, emit2, trigger);
useAutoFocus(props2, fieldRef);
useKeyboard(props2, fieldRef);
const { state: scopedAttrsState } = useScopedAttrs();
useVaporFormField(props2, state);
useEvent(fieldRef, state, props2, trigger, triggerInput, beforeInput);
const fixDisabledColor = false;
return {
fieldRef,
state,
scopedAttrsState,
fixDisabledColor,
trigger
};
}
uniShared.once(() => {
});
const webSelectionProps$1 = fieldSelectionProps;
const props$8 = /* @__PURE__ */ shared.extend(
{},
props$9,
{
placeholderClass: {
type: String,
default: "input-placeholder"
},
textContentType: {
type: String,
default: ""
}
},
webSelectionProps$1
);
function isPaste(event) {
return event.inputType === "insertFromPaste";
}
function useCache(props2, type) {
if (type.value === "number") {
const value = typeof props2.modelValue === "undefined" ? props2.value : props2.modelValue;
const cache = Vue.ref(
typeof value !== "undefined" && value !== null ? value.toLocaleString() : ""
);
Vue.watch(
() => props2.modelValue,
(value2) => {
cache.value = typeof value2 !== "undefined" && value2 !== null ? value2.toLocaleString() : "";
}
);
Vue.watch(
() => props2.value,
(value2) => {
cache.value = typeof value2 !== "undefined" && value2 !== null ? value2.toLocaleString() : "";
}
);
return cache;
} else {
return Vue.ref("");
}
}
const emits$2 = ["confirm", ...emit];
function useInput(props2, { emit: emit2, expose }) {
const INPUT_TYPES = [
"text",
"number",
"idcard",
"digit",
"password",
"tel",
"search",
"email"
];
const AUTOCOMPLETES = ["off", "one-time-code"];
const type = Vue.computed(() => {
let type2 = "";
switch (props2.type) {
case "text":
type2 = "text";
if (props2.confirmType === "search") {
type2 = "search";
}
break;
case "idcard":
type2 = "text";
break;
case "digit":
type2 = "number";
break;
case "none":
type2 = "text";
break;
default:
type2 = INPUT_TYPES.includes(props2.type) ? props2.type : "text";
break;
}
return props2.password ? "password" : type2;
});
const autocomplete = Vue.computed(() => {
const camelizeIndex = AUTOCOMPLETES.indexOf(props2.textContentType);
const kebabCaseIndex = AUTOCOMPLETES.indexOf(
shared.hyphenate(props2.textContentType)
);
const index2 = camelizeIndex !== -1 ? camelizeIndex : kebabCaseIndex !== -1 ? kebabCaseIndex : 0;
return AUTOCOMPLETES[index2];
});
const inputmode = Vue.computed(() => {
if (props2.inputmode !== void 0) {
return props2.inputmode;
}
if (INPUT_MODES.includes(props2.type)) {
return props2.type;
}
let inputmodeMap = {};
{
inputmodeMap = {
number: "numeric",
digit: "decimal",
idcard: "text"
};
}
return inputmodeMap[props2.type];
});
let cache = useCache(props2, type);
const rootRef = Vue.ref(null);
const { fieldRef, state, scopedAttrsState, fixDisabledColor, trigger } = useField(props2, rootRef, emit2, (event, state2) => {
{
return;
}
});
const selectionRef = useFieldSelection(props2, fieldRef);
Vue.watch(
() => state.value,
(value) => {
if (props2.type === "number" && !(cache.value === "-" && value === "")) {
cache.value = value.toString();
}
}
);
Vue.watch(
() => props2.maxlength,
(length) => {
length = parseInt(length, 10);
if (!(length >= 0)) {
return;
}
const realValue = state.value.slice(0, length);
realValue !== state.value && (state.value = realValue);
}
);
const NUMBER_TYPES = ["number", "digit"];
const step = Vue.computed(
() => NUMBER_TYPES.includes(props2.type) ? props2.step : ""
);
function onKeyUpEnter(event) {
if (event.key !== "Enter") {
return;
}
const input = event.target;
event.stopPropagation();
trigger("confirm", event, {
value: input.value
});
!props2.confirmHold && input.blur();
}
expose({
$triggerInput: (detail) => {
emit2("update:modelValue", detail.value);
emit2("update:value", detail.value);
state.value = detail.value;
}
});
function onInput(event) {
const value = event.target.value.toString();
if (type.value === "number" && state.maxlength > 0 && value.length > state.maxlength) {
if (isPaste(event)) {
state.value = value.slice(0, state.maxlength);
}
return;
}
if (value.length === 0 && event.inputType === "insertText" && event.data === ".") {
return;
}
state.value = value;
}
return {
rootRef,
fieldRef,
state,
scopedAttrsState,
selectionRef,
fixDisabledColor,
type,
autocomplete,
inputmode,
cache,
step,
onKeyUpEnter,
onInput
};
}
const createComponent = (type, ...args) => {
if (type === Vue.Fragment) {
const slots = args[1];
return slots ? typeof slots === "function" ? slots() : typeof slots.default === "function" ? slots.default() : [] : [];
}
return Vue__namespace.createComponentWithFallback(
createProxyComponent(Vue__namespace.resolveDynamicComponent(type)),
...args
);
};
const proxyCache = /* @__PURE__ */ new WeakMap();
function createProxyComponent(type, normalizeNode2) {
if (typeof type === "function") {
const existing = proxyCache.get(type);
if (existing)
return existing;
const i = Vue__namespace.currentInstance || Vue.getCurrentInstance();
const proxy = new Proxy(type, {
apply(target, ctx, args) {
if (typeof target.__setup === "function") {
target.__setup.apply(ctx, args);
}
const node = Reflect.apply(target, ctx, args);
return node;
},
get(target, p2, receiver) {
const result = Reflect.get(target, p2, receiver);
if (p2 === "__vapor" && result === void 0 && i && i.appContext.vapor) {
return true;
}
return result;
}
});
proxyCache.set(type, proxy);
return proxy;
}
return type;
}
function createFragment(nodes, anchor = document.createTextNode("")) {
const frag = new Vue__namespace.VaporFragment(nodes);
frag.anchor = anchor;
return frag;
}
function normalizeBlock(node, anchor, processFunction = false) {
if (node instanceof Node || Vue__namespace.isFragment(node)) {
return node;
} else if (Vue__namespace.isVaporComponent(node)) {
return createFragment(node, anchor);
} else if (Array.isArray(node)) {
return createFragment(
node.map((i) => normalizeBlock(i, void 0, processFunction)),
anchor
);
} else if (processFunction && typeof node === "function") {
return resolveValues([node], anchor, true)[0];
} else {
const result = node == null || typeof node === "boolean" ? "" : String(node);
if (anchor) {
anchor.textContent = result;
return anchor;
} else {
return document.createTextNode(result);
}
}
}
function resolveValue(current, value, anchor, processFunction = false) {
anchor = anchor || (current instanceof Node && current.nodeType === 3 ? current : void 0);
const node = normalizeBlock(value, anchor, processFunction);
if (current) {
if (Vue__namespace.isFragment(current)) {
if (current.anchor && current.anchor.parentNode) {
Vue__namespace.remove(current.nodes, current.anchor.parentNode);
Vue__namespace.insert(node, current.anchor.parentNode, current.anchor);
if (!anchor)
current.anchor.parentNode.removeChild(current.anchor);
if (current.scope)
current.scope.stop();
}
} else if (current instanceof Node) {
if (current.nodeType === 3 && (!(node instanceof Node) || node.nodeType !== 3)) {
current.textContent = "";
}
if (Vue__namespace.isFragment(node) && current.parentNode) {
Vue__namespace.insert(node, current.parentNode, current);
if (!anchor || current.nodeType !== 3) {
current.parentNode.removeChild(current);
}
} else if (node instanceof Node) {
if (current.nodeType === 3 && node.nodeType === 3) {
current.textContent = node.textContent;
return current;
} else if (current.parentNode) {
current.parentNode.replaceChild(node, current);
}
}
}
}
return node;
}
function resolveValues(values = [], _anchor, processFunction = false) {
const nodes = [];
const scopes = [];
for (const [index2, value] of values.entries()) {
const anchor = index2 === values.length - 1 ? _anchor : void 0;
if (typeof value === "function") {
Vue__namespace.renderEffect(() => {
if (scopes[index2])
scopes[index2].stop();
scopes[index2] = new Vue.EffectScope();
nodes[index2] = scopes[index2].run(
() => resolveValue(nodes[index2], value(), anchor, processFunction)
);
});
} else {
nodes[index2] = resolveValue(nodes[index2], value, anchor, processFunction);
}
}
return nodes;
}
function setNodes(anchor, ...values) {
const resolvedValues = resolveValues(values, anchor);
if (anchor.parentNode)
Vue__namespace.insert(resolvedValues, anchor.parentNode, anchor);
}
function createNodes(...values) {
return resolveValues(values);
}
const _t0$d = Vue.template("<input tabindex=-1>");
const _t1$3 = Vue.template("<input>");
const _t2$2 = Vue.template("<form action novalidate class=uni-input-form> ");
const _t3$2 = Vue.template("<div uni-input uni-view><div class=uni-input-wrapper> <div> </div>", 1);
const _t4$2 = Vue.template("<div>", 1);
const Input = /* @__PURE__ */ defineBuiltInComponent({
name: "Input",
props: props$8,
emits: emits$2,
rootElement: {
name: "uni-input",
class: UniInputElement
},
setup(props2, context) {
const { rootRef, fieldRef, state, scopedAttrsState, selectionRef, fixDisabledColor, type, autocomplete, inputmode, cache, step, onKeyUpEnter, onInput } = useInput(props2, context);
const renderInput = () => (() => {
const _setTemplateRef = Vue.createTemplateRefSetter();
const _n0 = Vue.createIf(() => props2.disabled && fixDisabledColor, () => {
const _n2 = _t0$d();
Vue.setBlockKey(_n2, "disabled-input");
Vue.on(
_n2,
// fix: 禁止 readonly 状态获取焦点
"focus",
(event) => event.target.blur()
);
Vue.renderEffect(() => {
Vue.setValue(_n2, state.value);
Vue.setProp(_n2, "readonly", !!props2.disabled);
Vue.setProp(_n2, "type", type.value);
Vue.setProp(_n2, "maxlength", state.maxlength);
Vue.setProp(_n2, "step", step.value);
Vue.setClass(_n2, props2.selectionClass ? "uni-input-input uni-field-selection" : "uni-input-input");
Vue.setStyle(_n2, props2.cursorColor ? { caretColor: props2.cursorColor } : {});
Vue.setProp(_n2, "inputmode", inputmode.value);
_setTemplateRef(_n2, fieldRef);
});
return _n2;
}, () => {
const _n4 = _t1$3();
Vue.setBlockKey(_n4, "input");
Vue.on(_n4, "input", Vue.withModifiers(onInput, ["stop"]));
Vue.on(_n4, "keyup", onKeyUpEnter);
Vue.renderEffect(() => {
Vue.setValue(_n4, state.value);
Vue.setProp(_n4, "disabled", !!props2.disabled);
Vue.setProp(_n4, "type", type.value);
Vue.setProp(_n4, "maxlength", state.maxlength);
Vue.setProp(_n4, "step", step.value);
Vue.setProp(_n4, "enterkeyhint", props2.confirmType);
Vue.setProp(_n4, "pattern", props2.type === "number" ? "[0-9]*" : void 0);
Vue.setClass(_n4, props2.selectionClass ? "uni-input-input uni-field-selection" : "uni-input-input");
Vue.setStyle(_n4, props2.cursorColor ? { caretColor: props2.cursorColor } : {});
Vue.setProp(_n4, "autocomplete", autocomplete.value);
Vue.setProp(_n4, "inputmode", inputmode.value);
_setTemplateRef(_n4, fieldRef);
});
return _n4;
}, 261);
return _n0;
})();
const root = (() => {
const _setTemplateRef = Vue.createTemplateRefSetter();
const _n8 = _t3$2();
const _n7 = Vue.child(_n8);
const _n0 = Vue.child(_n7, true);
const _n1 = Vue.next(_n0);
setNodes(_n0, () => props2.selectionClass && (() => {
const _setTemplateRef2 = Vue.createTemplateRefSetter();
const _n02 = _t4$2();
Vue.renderEffect(() => {
Vue.setDynamicProps(_n02, [scopedAttrsState.attrs, {
class: ["uni-field-selection-probe", props2.selectionClass],
"aria-hidden": "true",
style: fieldSelectionProbeStyle
}]);
_setTemplateRef2(_n02, selectionRef);
});
return _n02;
})());
Vue.applyVShow(_n1, () => !(state.value.length || cache.value === "-" || cache.value.includes(".")));
const _x1 = Vue.txt(_n1);
setNodes(_x1, () => props2.placeholder);
Vue.renderEffect(() => Vue.setDynamicProps(_n1, [scopedAttrsState.attrs, {
style: props2.placeholderStyle,
class: ["uni-input-placeholder", props2.placeholderClass]
}]));
Vue.setInsertionState(_n7, 2);
Vue.createIf(() => props2.confirmType === "search", () => {
const _n4 = _t2$2();
Vue.on(_n4, "submit", (event) => event.preventDefault());
const _x4 = Vue.txt(_n4);
setNodes(_x4, () => renderInput());
return _n4;
}, () => {
const _n6 = createNodes(() => renderInput());
return _n6;
}, 265);
Vue.renderEffect(() => _setTemplateRef(_n8, rootRef));
return _n8;
})();
initInputElement(root);
return root;
}
});
const resizeSensorProps = {
initial: {
type: Boolean,
default: false
}
};
function useResizeSensor(props2, emit2) {
const rootRef = Vue.ref(null);
const reset = useResizeSensorReset(rootRef);
const update = useResizeSensorUpdate(rootRef, emit2, reset);
return { rootRef, update };
}
function useResizeSensorUpdate(rootRef, emit2, reset) {
const size = Vue.reactive({ width: -1, height: -1 });
Vue.watch(
() => shared.extend({}, size),
(value) => emit2("resize", value)
);
return () => {
const rootEl = rootRef.value;
if (!rootEl)
return;
const rect = rootEl.getBoundingClientRect();
size.width = rect.width;
size.height = rect.height;
reset();
};
}
function useResizeSensorReset(rootRef) {
return () => {
const { firstElementChild, lastElementChild } = rootRef.value;
firstElementChild.scrollLeft = 1e5;
firstElementChild.scrollTop = 1e5;
lastElementChild.scrollLeft = 1e5;
lastElementChild.scrollTop = 1e5;
};
}
const _t0$c = Vue.template("<div uni-resize-sensor><div><div></div></div><div><div>", 1);
const ResizeSensor = /* @__PURE__ */ defineBuiltInComponent({
name: "ResizeSensor",
props: resizeSensorProps,
emits: ["resize"],
setup(props2, { emit: emit2 }) {
const { rootRef, update } = useResizeSensor(props2, emit2);
const root = (() => {
const _setTemplateRef = Vue.createTemplateRefSetter();
const _n2 = _t0$c();
const _n0 = Vue.child(_n2);
const _n1 = Vue.next(_n0);
Vue.on(_n0, "scroll", update);
Vue.on(_n1, "scroll", update);
Vue.renderEffect(() => _setTemplateRef(_n2, rootRef));
return _n2;
})();
return root;
}
});
const _UniTextareaElement = class _UniTextareaElement extends UniViewElement {
static [Symbol.hasInstance](value) {
return this === _UniTextareaElement && value instanceof UniViewElement && value.hasAttribute("uni-textarea") || Function.prototype[Symbol.hasInstance].call(this, value);
}
focus(options) {
var _a;
(_a = this.querySelector("textarea")) == null ? void 0 : _a.focus(options);
}
};
_UniTextareaElement.__uniElement = {};
let UniTextareaElement = _UniTextareaElement;
const descriptors = {
uniTagName: { value: "TEXTAREA" },
focus: Object.getOwnPropertyDescriptor(
UniTextareaElement.prototype,
"focus"
)
};
function setValue(value) {
this.querySelector("textarea").value = value;
}
function initTextareaElement(root, state) {
Object.defineProperties(root, descriptors);
Object.defineProperty(root, "value", {
get: () => state.value,
set: setValue
});
}
const webSelectionProps = fieldSelectionProps;
const props$7 = /* @__PURE__ */ shared.extend(
{},
props$9,
{
placeholderClass: {
type: String,
default: "input-placeholder"
},
autoHeight: {
type: [Boolean, String],
default: false
},
confirmType: {
type: String,
default: "return",
validator(val) {
return ConfirmTypes.concat("return").includes(val);
}
}
},
webSelectionProps
);
const ConfirmTypes = ["done", "go", "next", "search", "send"];
const emits$1 = ["confirm", "change", "linechange", ...emit];
function useTextarea(props2, { emit: emit2, expose }) {
const rootRef = Vue.ref(null);
const wrapperRef = Vue.ref(null);
const { fieldRef, state, scopedAttrsState, fixDisabledColor, trigger } = useField(props2, rootRef, emit2);
const selectionRef = useFieldSelection(props2, fieldRef);
const valueCompute = Vue.computed(() => state.value.split(uniShared.LINEFEED));
const isDone = Vue.computed(() => ConfirmTypes.includes(props2.confirmType));
const heightRef = Vue.ref(0);
const lineRef = Vue.ref(null);
Vue.watch(
() => heightRef.value,
(height) => {
const el = rootRef.value;
const lineEl = lineRef.value;
const wrapper = wrapperRef.value;
let lineHeight = parseFloat(getComputedStyle(el).lineHeight);
if (isNaN(lineHeight)) {
lineHeight = lineEl.offsetHeight;
}
var lineCount = Math.round(height / lineHeight);
trigger("linechange", {}, {
height,
heightRpx: 750 / window.innerWidth * height,
lineCount
});
if (props2.autoHeight) {
wrapper.style.height = height + "px";
}
}
);
Vue.watch(
() => props2.autoHeight,
(autoHeight) => {
const wrapper = wrapperRef.value;
if (autoHeight) {
wrapper.style.height = heightRef.value + "px";
} else {
wrapper.style.height = "";
}
}
);
function onResize2({ height }) {
heightRef.value = height;
}
function onChange2(event) {
{
trigger("change", event, {
value: state.value
});
}
}
function confirm(event) {
trigger("confirm", event, {
value: state.value
});
}
function onKeyDownEnter(event) {
if (event.key !== "Enter") {
return;
}
if (isDone.value) {
event.preventDefault();
}
}
function onKeyUpEnter(event) {
if (event.key !== "Enter") {
return;
}
if (isDone.value) {
confirm(event);
const textarea = event.target;
!props2.confirmHold && textarea.blur();
}
}
expose({
$triggerInput: (detail) => {
emit2("update:modelValue", detail.value);
emit2("update:value", detail.value);
state.value = detail.value;
}
});
return {
rootRef,
wrapperRef,
fieldRef,
state,
scopedAttrsState,
selectionRef,
fixDisabledColor,
valueCompute,
lineRef,
onResize: onResize2,
onChange: onChange2,
onKeyDownEnter,
onKeyUpEnter
};
}
const _t0$b = Vue.template("<textarea tabindex=-1>");
const _t1$2 = Vue.template("<textarea>");
const _t2$1 = Vue.template("<form action class=uni-input-form> ");
const _t3$1 = Vue.template("<div uni-textarea uni-view><div class=uni-textarea-wrapper> <div> </div><div class=uni-textarea-line> </div><div> </div>", 1);
const _t4$1 = Vue.template("<div>", 1);
const indexVapor$9 = /* @__PURE__ */ defineBuiltInComponent({
name: "Textarea",
props: props$7,
emits: emits$1,
rootElement: {
name: "uni-textarea",
class: UniTextareaElement
},
setup(props2, context) {
const { rootRef, wrapperRef, fieldRef, state, scopedAttrsState, selectionRef, fixDisabledColor, valueCompute, lineRef, onResize: onResize2, onChange: onChange2, onKeyDownEnter, onKeyUpEnter } = useTextarea(props2, context);
const renderTextarea = () => (() => {
const _setTemplateRef = Vue.createTemplateRefSetter();
const _n0 = Vue.createIf(() => props2.disabled && fixDisabledColor, () => {
const _n2 = _t0$b();
Vue.setBlockKey(_n2, "disabled-textarea");
Vue.on(
_n2,
// fix: 禁止 readonly 状态获取焦点
"focus",
(event) => event.target.blur()
);
Vue.renderEffect(() => {
Vue.setValue(_n2, state.value);
Vue.setProp(_n2, "readonly", !!props2.disabled);
Vue.setProp(_n2, "maxlength", state.maxlength);
Vue.setClassName(_n2, 1 | (!!props2.selectionClass ? 2 : 0) | 0, [
" uni-textarea-textarea",
" uni-field-selection",
" uni-textarea-textarea-fix-margin"
]);
Vue.setStyle(_n2, {
overflowY: props2.autoHeight ? "hidden" : "auto",
/* eslint-disable no-restricted-syntax */
...props2.cursorColor && { caretColor: props2.cursorColor }
});
_setTemplateRef(_n2, fieldRef);
});
return _n2;
}, () => {
const _n4 = _t1$2();
Vue.setBlockKey(_n4, "textarea");
Vue.on(_n4, "keydown", onKeyDownEnter);
Vue.on(_n4, "keyup", onKeyUpEnter);
Vue.on(_n4, "change", onChange2);
Vue.renderEffect(() => {
Vue.setValue(_n4, state.value);
Vue.setProp(_n4, "disabled", !!props2.disabled);
Vue.setProp(_n4, "maxlength", state.maxlength);
Vue.setProp(_n4, "enterkeyhint", props2.confirmType);
Vue.setProp(_n4, "inputmode", props2.inputmode);
Vue.setClassName(_n4, 1 | (!!props2.selectionClass ? 2 : 0) | 0, [
" uni-textarea-textarea",
" uni-field-selection",
" uni-textarea-textarea-fix-margin"
]);
Vue.setStyle(_n4, {
overflowY: props2.autoHeight ? "hidden" : "auto",
/* eslint-disable no-restricted-syntax */
...props2.cursorColor && { caretColor: props2.cursorColor }
});
_setTemplateRef(_n4, fieldRef);
});
return _n4;
}, 261);
return _n0;
})();
const root = (() => {
const _setTemplateRef = Vue.createTemplateRefSetter();
const _n12 = _t3$1();
const _n11 = Vue.child(_n12);
const _n0 = Vue.child(_n11, true);
const _n1 = Vue.next(_n0);
const _n2 = Vue.next(_n1);
const _n5 = Vue.next(_n2);
const _n3 = Vue.child(_n5, true);
setNodes(_n0, () => props2.selectionClass && (() => {
const _setTemplateRef2 = Vue.createTemplateRefSetter();
const _n02 = _t4$1();
Vue.renderEffect(() => {
Vue.setDynamicProps(_n02, [scopedAttrsState.attrs, {
class: ["uni-field-selection-probe", props2.selectionClass],
"aria-hidden": "true",
style: fieldSelectionProbeStyle
}]);
_setTemplateRef2(_n02, selectionRef);
});
return _n02;
})());
Vue.applyVShow(_n1, () => !state.value.length);
const _x1 = Vue.txt(_n1);
setNodes(_x1, () => props2.placeholder);
setNodes(_n3, () => valueCompute.value.map((item) => (() => {
const _n52 = _t4$1();
Vue.setInsertionState(_n52);
Vue.createIf(() => item.trim(), () => {
const _n22 = createNodes(() => item);
return _n22;
}, () => {
const _n42 = createNodes(".");
return _n42;
}, 266);
return _n52;
})()));
Vue.renderEffect(() => {
Vue.setAttr(_n12, "auto-height", props2.autoHeight);
Vue.setDynamicProps(_n1, [scopedAttrsState.attrs, {
style: props2.placeholderStyle,
class: ["uni-textarea-placeholder", props2.placeholderClass]
}]);
_setTemplateRef(_n2, lineRef);
Vue.setClassName(_n5, 1 | (props2.autoHeight ? 2 : 0), [" uni-textarea-compute", " uni-textarea-compute-auto-height"]);
});
Vue.setInsertionState(_n5, 1);
createComponent(ResizeSensor, {
initial: true,
onResize: () => onResize2
});
Vue.setInsertionState(_n11, 4);
Vue.createIf(() => props2.confirmType === "search", () => {
const _n8 = _t2$1();
Vue.on(_n8, "submit", (event) => event.preventDefault());
const _x8 = Vue.txt(_n8);
setNodes(_x8, () => renderTextarea());
return _n8;
}, () => {
const _n10 = createNodes(() => renderTextarea());
return _n10;
}, 265);
Vue.renderEffect(() => {
_setTemplateRef(_n11, wrapperRef);
_setTemplateRef(_n12, rootRef);
});
return _n12;
})();
initTextareaElement(root, state);
return root;
}
});
function useSubscribe(callback, name, multiple, pageId) {
const instance = Vue.getCurrentInstance();
instance.proxy;
pageId = pageId == null ? useCurrentPageId() : pageId;
}
let index$6 = 0;
function useContextInfo(_id) {
useCurrentPageId();
const instance = Vue.getCurrentInstance();
const vm = instance.proxy;
const type = vm.$options.name.toLowerCase();
const id2 = vm.id || `context${index$6++}`;
return `${type}.${id2}`;
}
function entries(obj) {
return Object.keys(obj).map((key) => [key, obj[key]]);
}
const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
const LISTENER_PREFIX = /^on[A-Z]+/;
const useAttrs = (params = {}) => {
const { excludeListeners = false, excludeKeys = [] } = params;
const instance = Vue.getCurrentInstance();
const attrs2 = Vue.shallowRef({});
const listeners = Vue.shallowRef({});
const excludeAttrs = Vue.shallowRef({});
const allExcludeKeys = excludeKeys.concat(DEFAULT_EXCLUDE_KEYS);
instance.attrs = Vue.reactive(instance.attrs);
Vue.watchEffect(() => {
const res = entries(instance.attrs).reduce(
(acc, [key, val]) => {
if (allExcludeKeys.includes(key)) {
acc.exclude[key] = val;
} else if (LISTENER_PREFIX.test(key)) {
if (!excludeListeners) {
acc.attrs[key] = val;
}
acc.listeners[key] = val;
} else {
acc.attrs[key] = val;
}
return acc;
},
{
exclude: {},
attrs: {},
listeners: {}
}
);
attrs2.value = res.attrs;
listeners.value = res.listeners;
excludeAttrs.value = res.exclude;
});
return { $attrs: attrs2, $listeners: listeners, $excludeAttrs: excludeAttrs };
};
const pageMetaKey = PolySymbol(process.env.NODE_ENV !== "production" ? "UniPageMeta" : "upm");
function usePageMeta() {
return Vue.inject(pageMetaKey);
}
function providePageMeta(id2) {
const pageMeta = initPageMeta(id2);
Vue.provide(pageMetaKey, pageMeta);
return pageMeta;
}
function usePageRoute() {
if (__UNI_FEATURE_PAGES__) {
return vueRouter.useRoute();
}
const url = location.href;
const searchPos = url.indexOf("?");
const hashPos = url.indexOf("#", searchPos > -1 ? searchPos : 0);
let query = {};
if (searchPos > -1) {
query = uniShared.parseQuery(
url.slice(searchPos + 1, hashPos > -1 ? hashPos : url.length)
);
}
const { meta } = __uniRoutes[0];
const path = uniShared.addLeadingSlash(meta.route);
return {
meta,
query,
path,
matched: [{ path }]
};
}
function initPageMeta(id2) {
if (__UNI_FEATURE_PAGES__) {
return Vue.reactive(
normalizePageMeta(
JSON.parse(
JSON.stringify(
initRouteMeta(
vueRouter.useRoute().meta,
id2
)
)
)
)
);
}
return Vue.reactive(
normalizePageMeta(
JSON.parse(JSON.stringify(initRouteMeta(__uniRoutes[0].meta, id2)))
)
);
}
function normalizePageMeta(pageMeta) {
if (__UNI_FEATURE_PULL_DOWN_REFRESH__) {
const { enablePullDownRefresh, navigationBar } = pageMeta;
{
const pullToRefresh = normalizePullToRefreshRpx(
shared.extend(
{
support: true,
color: "#2BD009",
style: "circle",
height: 70,
range: 150,
offset: 0
},
pageMeta.pullToRefresh
)
);
const { type, style } = navigationBar;
if (style !== "custom" && type !== "transparent") {
pullToRefresh.offset += uniShared.NAVBAR_HEIGHT + 0;
}
pageMeta.pullToRefresh = pullToRefresh;
}
}
if (__UNI_FEATURE_NAVIGATIONBAR__ || __UNI_FEATURE_I18N_LOCALE__) {
const { navigationBar } = pageMeta;
const { titleSize, titleColor, backgroundColor } = navigationBar;
navigationBar.titleText = navigationBar.titleText || "";
navigationBar.type = navigationBar.type || "default";
navigationBar.titleSize = titleSize || "16px";
navigationBar.titleColor = titleColor || "#000000";
navigationBar.backgroundColor = backgroundColor || "#F8F8F8";
__UNI_FEATURE_I18N_LOCALE__ && initNavigationBarI18n(navigationBar);
}
return pageMeta;
}
function getStateId() {
{
return 1;
}
}
let router;
function setRouterInstance(value) {
router = value;
}
function getRouterInstance() {
return router;
}
const HTTP_METHODS = [
"GET",
"OPTIONS",
"HEAD",
"POST",
"PUT",
"DELETE",
"TRACE",
"CONNECT",
"PATCH"
];
function elemInArray(str, arr) {
if (!str || arr.indexOf(str) === -1) {
return arr[0];
}
return str;
}
function validateProtocolFail(name, msg) {
console.warn(`${name}: ${msg}`);
}
function validateProtocol(name, data, protocol, onFail) {
if (!onFail) {
onFail = validateProtocolFail;
}
for (const key in protocol) {
const errMsg = validateProp(
key,
data[key],
protocol[key],
!shared.hasOwn(data, key)
);
if (shared.isString(errMsg)) {
onFail(name, errMsg);
}
}
}
function validateProtocols(name, args, protocol, onFail) {
if (!protocol) {
return;
}
if (!shared.isArray(protocol)) {
return validateProtocol(
name,
args[0] || /* @__PURE__ */ Object.create(null),
protocol,
onFail
);
}
const len = protocol.length;
const argsLen = args.length;
for (let i = 0; i < len; i++) {
const opts = protocol[i];
const data = /* @__PURE__ */ Object.create(null);
if (argsLen > i) {
data[opts.name] = args[i];
}
validateProtocol(name, data, { [opts.name]: opts }, onFail);
}
}
function validateProp(name, value, prop, isAbsent) {
if (!shared.isPlainObject(prop)) {
prop = { type: prop };
}
const { type, required, validator } = prop;
if (required && isAbsent) {
return 'Missing required args: "' + name + '"';
}
if (value == null && !required) {
return;
}
if (type != null) {
let isValid = false;
const types = shared.isArray(type) ? type : [type];
const expectedTypes = [];
for (let i = 0; i < types.length && !isValid; i++) {
const { valid, expectedType } = assertType(value, types[i]);
expectedTypes.push(expectedType || "");
isValid = valid;
}
if (!isValid) {
return getInvalidTypeMessage(name, value, expectedTypes);
}
}
if (validator) {
return validator(value);
}
}
const isSimpleType = /* @__PURE__ */ shared.makeMap(
"String,Number,Boolean,Function,Symbol"
);
function assertType(value, type) {
let valid;
const expectedType = getType(type);
if (isSimpleType(expectedType)) {
const t12 = typeof value;
valid = t12 === expectedType.toLowerCase();
if (!valid && t12 === "object") {
valid = value instanceof type;
}
} else if (expectedType === "Object") {
valid = shared.isObject(value);
} else if (expectedType === "Array") {
valid = shared.isArray(value);
} else {
{
valid = value instanceof type;
}
}
return {
valid,
expectedType
};
}
function getInvalidTypeMessage(name, value, expectedTypes) {
let message = `Invalid args: type check failed for args "${name}". Expected ${expectedTypes.map(shared.capitalize).join(", ")}`;
const expectedType = expectedTypes[0];
const receivedType = shared.toRawType(value);
const expectedValue = styleValue(value, expectedType);
const receivedValue = styleValue(value, receivedType);
if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
message += ` with value ${expectedValue}`;
}
message += `, got ${receivedType} `;
if (isExplicable(receivedType)) {
message += `with value ${receivedValue}.`;
}
return message;
}
function getType(ctor) {
const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
return match ? match[1] : "";
}
function styleValue(value, type) {
if (type === "String") {
return `"${value}"`;
} else if (type === "Number") {
return `${Number(value)}`;
} else {
return `${value}`;
}
}
function isExplicable(type) {
const explicitTypes = ["string", "number", "boolean"];
return explicitTypes.some((elem) => type.toLowerCase() === elem);
}
function isBoolean(...args) {
return args.some((elem) => elem.toLowerCase() === "boolean");
}
function tryCatch(fn) {
return function() {
try {
return fn.apply(fn, arguments);
} catch (e2) {
console.error(e2);
}
};
}
let invokeCallbackId = 1;
const invokeCallbacks = {};
function addInvokeCallback(id2, name, callback, keepAlive = false) {
invokeCallbacks[id2] = {
name,
keepAlive,
callback
};
return id2;
}
function invokeCallback(id2, res, extras) {
if (typeof id2 === "number") {
const opts = invokeCallbacks[id2];
if (opts) {
if (!opts.keepAlive) {
delete invokeCallbacks[id2];
}
return opts.callback(res, extras);
}
}
return res;
}
function findInvokeCallbackByName(name) {
for (const key in invokeCallbacks) {
if (invokeCallbacks[key].name === name) {
return true;
}
}
return false;
}
function removeKeepAliveApiCallback(name, callback) {
for (const key in invokeCallbacks) {
const item = invokeCallbacks[key];
if (item.callback === callback && item.name === name) {
delete invokeCallbacks[key];
}
}
}
function removeAllKeepAliveApiCallbacks(name) {
for (const key in invokeCallbacks) {
if (invokeCallbacks[key].name === name) {
delete invokeCallbacks[key];
}
}
}
function offKeepAliveApiCallback(name, eventTransport2) {
const eventName = eventTransport2 ? name : "api." + name;
const transport = eventTransport2 || UniServiceJSBridge;
transport.off(eventName);
}
function onKeepAliveApiCallback(name, eventTransport2) {
const eventName = eventTransport2 ? name : "api." + name;
const transport = eventTransport2 || UniServiceJSBridge;
transport.on(eventName, (res) => {
for (const key in invokeCallbacks) {
const opts = invokeCallbacks[key];
if (opts.name === name) {
opts.callback(res);
}
}
});
}
function createKeepAliveApiCallback(name, callback) {
return addInvokeCallback(invokeCallbackId++, name, callback, true);
}
const API_SUCCESS = "success";
const API_FAIL = "fail";
const API_COMPLETE = "complete";
function getApiCallbacks(args) {
const apiCallbacks = {};
for (const name in args) {
const fn = args[name];
if (shared.isFunction(fn)) {
apiCallbacks[name] = tryCatch(fn);
delete args[name];
}
}
return apiCallbacks;
}
function normalizeErrMsg(errMsg, name) {
if (!errMsg || errMsg.indexOf(":fail") === -1) {
return name + ":ok";
}
return name + errMsg.substring(errMsg.indexOf(":fail"));
}
function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
if (!shared.isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = shared.isFunction(success);
const hasFail = shared.isFunction(fail);
const hasComplete = shared.isFunction(complete);
const callbackId = invokeCallbackId++;
addInvokeCallback(callbackId, name, (res) => {
res = res || {};
res.errMsg = normalizeErrMsg(res.errMsg, name);
shared.isFunction(beforeAll) && beforeAll(res);
if (res.errMsg === name + ":ok") {
shared.isFunction(beforeSuccess) && beforeSuccess(res, args);
hasSuccess && success(res);
} else {
hasFail && fail(res);
}
hasComplete && complete(res);
});
return callbackId;
}
const HOOK_SUCCESS = "success";
const HOOK_FAIL = "fail";
const HOOK_COMPLETE = "complete";
const globalInterceptors = {};
const scopedInterceptors = {};
function wrapperHook(hook, params) {
return function(data) {
return hook(data, params) || data;
};
}
function queue(hooks, data, params) {
let promise = false;
for (let i = 0; i < hooks.length; i++) {
const hook = hooks[i];
if (promise) {
promise = Promise.resolve(wrapperHook(hook, params));
} else {
const res = hook(data, params);
if (shared.isPromise(res)) {
promise = Promise.resolve(res);
}
if (res === false) {
return {
then() {
},
catch() {
}
};
}
}
}
return promise || {
then(callback) {
return callback(data);
},
catch() {
}
};
}
function wrapperOptions(interceptors, options = {}) {
[HOOK_SUCCESS, HOOK_FAIL, HOOK_COMPLETE].forEach((name) => {
const hooks = interceptors[name];
if (!shared.isArray(hooks)) {
return;
}
const oldCallback = options[name];
options[name] = function callbackInterceptor(res) {
queue(hooks, res, options).then((res2) => {
return shared.isFunction(oldCallback) && oldCallback(res2) || res2;
});
};
});
return options;
}
function wrapperReturnValue(method, returnValue) {
const returnValueHooks = [];
if (shared.isArray(globalInterceptors.returnValue)) {
returnValueHooks.push(...globalInterceptors.returnValue);
}
const interceptor = scopedInterceptors[method];
if (interceptor && shared.isArray(interceptor.returnValue)) {
returnValueHooks.push(...interceptor.returnValue);
}
returnValueHooks.forEach((hook) => {
returnValue = hook(returnValue) || returnValue;
});
return returnValue;
}
function getApiInterceptorHooks(method) {
const interceptor = /* @__PURE__ */ Object.create(null);
Object.keys(globalInterceptors).forEach((hook) => {
if (hook !== "returnValue") {
interceptor[hook] = globalInterceptors[hook].slice();
}
});
const scopedInterceptor = scopedInterceptors[method];
if (scopedInterceptor) {
Object.keys(scopedInterceptor).forEach((hook) => {
if (hook !== "returnValue") {
interceptor[hook] = (interceptor[hook] || []).concat(
scopedInterceptor[hook]
);
}
});
}
return interceptor;
}
function invokeApi(method, api2, options, params) {
const interceptor = getApiInterceptorHooks(method);
if (interceptor && Object.keys(interceptor).length) {
if (shared.isArray(interceptor.invoke)) {
const res = queue(interceptor.invoke, options);
return res.then((options2) => {
return api2(
wrapperOptions(getApiInterceptorHooks(method), options2),
...params
);
});
} else {
return api2(wrapperOptions(interceptor, options), ...params);
}
}
return api2(options, ...params);
}
function hasCallback(args) {
if (shared.isPlainObject(args) && [API_SUCCESS, API_FAIL, API_COMPLETE].find(
(cb) => shared.isFunction(args[cb])
)) {
return true;
}
return false;
}
function handlePromise(promise) {
return promise;
}
function promisify(name, fn) {
return (args = {}, ...rest) => {
if (hasCallback(args)) {
return wrapperReturnValue(
name,
invokeApi(name, fn, shared.extend({}, args), rest)
);
}
return wrapperReturnValue(
name,
handlePromise(
new Promise((resolve, reject) => {
invokeApi(
name,
fn,
shared.extend({}, args, { success: resolve, fail: reject }),
rest
);
})
)
);
};
}
function normalizeFormatApiParams(args) {
const params = args[0];
if (shared.isPlainObject(params)) {
return params;
}
const normalizedParams = {};
args[0] = normalizedParams;
return normalizedParams;
}
function formatApiArgs(args, options) {
const rawParams = args[0];
if (!options || !options.formatArgs || !shared.isPlainObject(options.formatArgs) && shared.isPlainObject(rawParams)) {
return;
}
const params = normalizeFormatApiParams(args);
const formatArgs = options.formatArgs;
const keys = Object.keys(formatArgs);
for (let i = 0; i < keys.length; i++) {
const name = keys[i];
const formatterOrDefaultValue = formatArgs[name];
if (shared.isFunction(formatterOrDefaultValue)) {
const errMsg = formatterOrDefaultValue(params[name], params);
if (shared.isString(errMsg)) {
return errMsg;
}
} else {
if (!shared.hasOwn(params, name)) {
params[name] = formatterOrDefaultValue;
}
}
}
}
function invokeSuccess(id2, name, res) {
const result = {
errMsg: name + ":ok"
};
{
result.errSubject = name;
}
return invokeCallback(id2, shared.extend(res || {}, result));
}
function invokeFail(id2, name, errMsg, errRes = {}) {
const errMsgPrefix = name + ":fail";
let apiErrMsg = "";
if (!errMsg) {
apiErrMsg = errMsgPrefix;
} else if (errMsg.indexOf(errMsgPrefix) === 0) {
apiErrMsg = errMsg;
} else {
apiErrMsg = errMsgPrefix + " " + errMsg;
}
let res = shared.extend({ errMsg: apiErrMsg }, errRes);
{
if (typeof UniError !== "undefined") {
const errOptions = shared.extend({}, errRes);
if (typeof errOptions.errSubject === "undefined") {
errOptions.errSubject = name;
}
res = new UniError(apiErrMsg, errOptions);
}
}
return invokeCallback(id2, res);
}
function beforeInvokeApi(name, args, protocol, options) {
if (process.env.NODE_ENV !== "production") {
validateProtocols(name, args, protocol);
}
if (options && options.beforeInvoke) {
const errMsg2 = options.beforeInvoke(args);
if (shared.isString(errMsg2)) {
return errMsg2;
}
}
const errMsg = formatApiArgs(args, options);
if (errMsg) {
return errMsg;
}
}
function checkCallback(callback) {
if (!shared.isFunction(callback)) {
throw new Error(
'Invalid args: type check failed for args "callback". Expected Function'
);
}
}
function wrapperOnApi(name, fn, options) {
return (callback) => {
checkCallback(callback);
const errMsg = beforeInvokeApi(name, [callback], void 0, options);
if (errMsg) {
throw new Error(errMsg);
}
const isFirstInvokeOnApi = !findInvokeCallbackByName(name);
createKeepAliveApiCallback(name, callback);
if (isFirstInvokeOnApi) {
onKeepAliveApiCallback(name, options == null ? void 0 : options.eventTransport);
fn();
}
};
}
function wrapperOffApi(name, fn, options) {
return (callback) => {
const clearAll = (options == null ? void 0 : options.allowClearAll) === true && callback == null;
if (!clearAll) {
checkCallback(callback);
}
const errMsg = beforeInvokeApi(
name,
clearAll ? [] : [callback],
void 0,
options
);
if (errMsg) {
throw new Error(errMsg);
}
const onApiName = name.replace("off", "on");
if (clearAll) {
removeAllKeepAliveApiCallbacks(onApiName);
} else {
removeKeepAliveApiCallback(onApiName, callback);
}
const hasInvokeOnApi = findInvokeCallbackByName(onApiName);
if (!hasInvokeOnApi) {
offKeepAliveApiCallback(onApiName, options == null ? void 0 : options.eventTransport);
fn();
}
};
}
function parseErrMsg(errMsg) {
if (!errMsg || shared.isString(errMsg)) {
return errMsg;
}
if (errMsg.stack) {
return errMsg.message;
}
return errMsg;
}
function wrapperTaskApi(name, fn, protocol, options) {
return (args) => {
const id2 = createAsyncApiCallback(name, args, options);
const errMsg = beforeInvokeApi(name, [args], protocol, options);
if (errMsg) {
return invokeFail(id2, name, errMsg);
}
return fn(args, {
resolve: (res) => invokeSuccess(id2, name, res),
reject: (errMsg2, errRes) => invokeFail(id2, name, parseErrMsg(errMsg2), errRes)
});
};
}
function wrapperSyncApi(name, fn, protocol, options) {
return (...args) => {
const errMsg = beforeInvokeApi(name, args, protocol, options);
if (errMsg) {
throw new Error(errMsg);
}
return fn.apply(null, args);
};
}
function wrapperAsyncApi(name, fn, protocol, options) {
return wrapperTaskApi(name, fn, protocol, options);
}
function defineOnApi(name, fn, options) {
return wrapperOnApi(name, fn, options);
}
function defineOffApi(name, fn, options) {
return wrapperOffApi(name, fn, options);
}
function defineTaskApi(name, fn, protocol, options) {
return promisify(
name,
wrapperTaskApi(name, fn, process.env.NODE_ENV !== "production" ? protocol : void 0, options)
);
}
function defineSyncApi(name, fn, protocol, options) {
return wrapperSyncApi(
name,
fn,
process.env.NODE_ENV !== "production" ? protocol : void 0,
options
);
}
function defineAsyncApi(name, fn, protocol, options) {
return promisify(
name,
wrapperAsyncApi(name, fn, process.env.NODE_ENV !== "production" ? protocol : void 0, options)
);
}
const API_ON_TAB_BAR_MID_BUTTON_TAP = "onTabBarMidButtonTap";
const API_GET_LOCALE = "getLocale";
const getLocale = /* @__PURE__ */ defineSyncApi(
API_GET_LOCALE,
() => {
const app = getApp({ allowDefault: true });
if (app && app.$vm) {
return app.$vm.$locale;
}
return useI18n().getLocale();
}
);
const API_ON_APP_ROUTE = "onAppRoute";
const API_OFF_APP_ROUTE = "offAppRoute";
const API_ON_BEFORE_APP_ROUTE = "onBeforeAppRoute";
const API_OFF_BEFORE_APP_ROUTE = "offBeforeAppRoute";
const API_REWRITE_ROUTE = "rewriteRoute";
const eventTransport = /* @__PURE__ */ new uniShared.Emitter();
let activeBeforeAppRouteContext;
const MAX_APP_ROUTE_REWRITE_COUNT = 100;
const APP_ROUTE_ERROR_CODE = 4;
function createAppRouteRuntime(options = {}) {
let routeEventId = 0;
const onAppRoute = /* @__PURE__ */ defineOnApi(API_ON_APP_ROUTE, () => {
}, {
eventTransport
});
const offAppRoute = /* @__PURE__ */ defineOffApi(API_OFF_APP_ROUTE, () => {
}, {
allowClearAll: true,
eventTransport
});
const onBeforeAppRoute = /* @__PURE__ */ defineOnApi(
API_ON_BEFORE_APP_ROUTE,
() => {
},
{ eventTransport }
);
const offBeforeAppRoute = /* @__PURE__ */ defineOffApi(
API_OFF_BEFORE_APP_ROUTE,
() => {
},
{
allowClearAll: true,
eventTransport
}
);
const rewriteRoute = /* @__PURE__ */ defineAsyncApi(
API_REWRITE_ROUTE,
({ url, preserveQuery }, { resolve, reject }) => {
const rejectRewriteRoute = (errMsg) => reject(errMsg, { errCode: APP_ROUTE_ERROR_CODE });
const context = activeBeforeAppRouteContext;
if (!context) {
rejectRewriteRoute(
"rewriteRoute is only allowed in a onBeforeAppRoute callback"
);
return;
}
if (context.event.openType === "navigateBack") {
rejectRewriteRoute(
'a "navigateBack" event is not allowed to be rewritten'
);
return;
}
if (context.rewrite) {
rejectRewriteRoute(
`rewriteRoute can only be called once in a route event, this page has been rewritten to "${context.rewrite.path}"`
);
return;
}
if ((context.rewriteCount || 0) >= MAX_APP_ROUTE_REWRITE_COUNT) {
rejectRewriteRoute(
`rewriteRoute exceeded the maximum rewrite count of ${MAX_APP_ROUTE_REWRITE_COUNT}`
);
return;
}
if (!context.normalizeRewriteRoute) {
rejectRewriteRoute("not supported");
return;
}
const rewrite = context.normalizeRewriteRoute(
{ url, preserveQuery },
context.event
);
if (typeof rewrite === "string") {
rejectRewriteRoute(rewrite);
return;
}
context.rewrite = rewrite;
resolve();
},
{
url: {
type: String,
required: true
},
preserveQuery: Boolean
}
);
function createAppRouteContext2(event) {
const timeStamp = event.timeStamp ?? Date.now();
return {
event: {
path: event.path,
query: Object.assign({}, event.query),
openType: event.openType,
notFound: event.notFound,
timeStamp,
routeEventId: event.routeEventId ?? `${timeStamp}-${++routeEventId}`
},
normalizeRewriteRoute: options.normalizeRewriteRoute
};
}
function dispatchBeforeAppRoute(context) {
const event = context.event;
const beforeEvent = {
path: event.path,
query: Object.assign({}, event.query),
openType: event.openType,
notFound: event.notFound,
routeEventId: event.routeEventId
};
const previousContext = activeBeforeAppRouteContext;
activeBeforeAppRouteContext = context;
try {
eventTransport.emit(API_ON_BEFORE_APP_ROUTE, beforeEvent);
} catch (error) {
console.error(error);
} finally {
activeBeforeAppRouteContext = previousContext;
}
return context.rewrite;
}
function dispatchAppRoute(context) {
const event = context.event;
try {
const routeEvent = {
path: event.path,
query: Object.assign({}, event.query),
openType: event.openType,
notFound: event.notFound,
timeStamp: event.timeStamp,
routeEventId: event.routeEventId
};
eventTransport.emit(API_ON_APP_ROUTE, routeEvent);
} catch (error) {
console.error(error);
}
}
return {
onAppRoute,
offAppRoute,
onBeforeAppRoute,
offBeforeAppRoute,
rewriteRoute,
createAppRouteContext: createAppRouteContext2,
dispatchBeforeAppRoute,
dispatchAppRoute
};
}
const API_GET_STORAGE = "getStorage";
const GetStorageProtocol = {
key: {
type: String,
required: true
}
};
const API_GET_STORAGE_SYNC = "getStorageSync";
const GetStorageSyncProtocol = [
{
name: "key",
type: String,
required: true
}
];
const API_SET_STORAGE = "setStorage";
const SetStorageProtocol = {
key: {
type: String,
required: true
},
data: {
required: true
}
};
const API_SET_STORAGE_SYNC = "setStorageSync";
const SetStorageSyncProtocol = [
{
name: "key",
type: String,
required: true
},
{
name: "data",
required: true
}
];
const API_REMOVE_STORAGE = "removeStorage";
const RemoveStorageProtocol = GetStorageProtocol;
const RemoveStorageSyncProtocol = GetStorageSyncProtocol;
const API_REQUEST = "request";
const dataType = {
JSON: "json"
};
const RESPONSE_TYPE = ["text", "arraybuffer"];
const DEFAULT_RESPONSE_TYPE = "text";
const encode = encodeURIComponent;
function stringifyQuery(url, data) {
let str = url.split("#");
const hash = str[1] || "";
str = str[0].split("?");
let query = str[1] || "";
url = str[0];
const search = query.split("&").filter((item) => item);
const params = {};
search.forEach((item) => {
const part = item.split("=");
params[part[0]] = part[1];
});
for (const key in data) {
if (shared.hasOwn(data, key)) {
let v2 = data[key];
if (typeof v2 === "undefined" || v2 === null) {
v2 = "";
} else if (shared.isPlainObject(v2)) {
v2 = JSON.stringify(v2);
}
params[encode(key)] = encode(v2);
}
}
query = Object.keys(params).map((item) => `${item}=${params[item]}`).join("&");
return url + (query ? "?" + query : "") + (hash ? "#" + hash : "");
}
const RequestProtocol = {
method: String,
data: [Object, String, Array, ArrayBuffer],
url: {
type: String,
required: true
},
header: Object,
dataType: String,
responseType: String,
withCredentials: Boolean
};
const RequestOptions = {
formatArgs: {
method(value, params) {
params.method = elemInArray(
(value || "").toUpperCase(),
HTTP_METHODS
);
},
data(value, params) {
params.data = value || "";
},
url(value, params) {
if (params.method === HTTP_METHODS[0] && shared.isPlainObject(params.data) && Object.keys(params.data).length) {
params.url = stringifyQuery(value, params.data);
}
},
header(value, params) {
const header = params.header = value || {};
if (params.method !== HTTP_METHODS[0]) {
if (!Object.keys(header).find(
(key) => key.toLowerCase() === "content-type"
)) {
header["Content-Type"] = "application/json";
}
}
},
dataType(value, params) {
params.dataType = (value || dataType.JSON).toLowerCase();
},
responseType(value, params) {
params.responseType = (value || "").toLowerCase();
if (RESPONSE_TYPE.indexOf(params.responseType) === -1) {
params.responseType = DEFAULT_RESPONSE_TYPE;
}
}
}
};
function encodeQueryString(url) {
if (!shared.isString(url)) {
return url;
}
const index2 = url.indexOf("?");
if (index2 === -1) {
return url;
}
const query = url.slice(index2 + 1).trim().replace(/^(\?|#|&)/, "");
if (!query) {
return url;
}
url = url.slice(0, index2);
const params = [];
query.split("&").forEach((param) => {
const parts = param.replace(/\+/g, " ").split("=");
const key = parts.shift();
const val = parts.length > 0 ? parts.join("=") : "";
params.push(key + "=" + encodeURIComponent(val));
});
return params.length ? url + "?" + params.join("&") : url;
}
const API_NAVIGATE_TO = "navigateTo";
const API_REDIRECT_TO = "redirectTo";
const API_SWITCH_TAB = "switchTab";
const API_PRELOAD_PAGE = "preloadPage";
const API_UN_PRELOAD_PAGE = "unPreloadPage";
let navigatorLock;
let navigatorLockId = 0;
function beforeRoute() {
navigatorLock = "";
navigatorLockId++;
}
function createNormalizeUrl(type, options = {}) {
return function normalizeUrl(url, params) {
var _a;
if (!url) {
return `Missing required args: "url"`;
}
url = normalizeRoute(url);
const pagePath = url.split("?")[0];
const routeOptions = getRouteOptions(pagePath, true);
if (!routeOptions) {
return "page `" + url + "` is not found";
}
if (type === API_NAVIGATE_TO || type === API_REDIRECT_TO) {
if (routeOptions.meta.isTabBar) {
return `can not ${type} a tabbar page`;
}
} else if (type === API_SWITCH_TAB) {
if (!routeOptions.meta.isTabBar) {
return "can not switch to no-tabBar page";
}
}
if ((type === API_SWITCH_TAB || type === API_PRELOAD_PAGE) && routeOptions.meta.isTabBar && params.openType !== "appLaunch") {
url = pagePath;
}
if (routeOptions.meta.isEntry) {
url = url.replace(routeOptions.alias, "/");
}
params.url = encodeQueryString(url);
if (type === API_UN_PRELOAD_PAGE) {
return;
} else if (type === API_PRELOAD_PAGE) {
if (routeOptions.meta.isTabBar) {
const pages = getCurrentPages();
const tabBarPagePath = routeOptions.path.slice(1);
if (pages.find((page) => page.route === tabBarPagePath)) {
return "tabBar page `" + tabBarPagePath + "` already exists";
}
}
return;
}
if (!options.skipNavigatorLock && navigatorLock === url && params.openType !== "appLaunch") {
return `${navigatorLock} locked`;
}
if (!options.skipNavigatorLock && __uniConfig.ready) {
navigatorLock = url;
const lockId = ++navigatorLockId;
(_a = options.onNavigatorLock) == null ? void 0 : _a.call(options, () => {
if (lockId === navigatorLockId) {
beforeRoute();
}
});
}
};
}
const API_SET_NAVIGATION_BAR_COLOR = "setNavigationBarColor";
const API_SET_NAVIGATION_BAR_TITLE = "setNavigationBarTitle";
const SetNavigationBarTitleProtocol = {
title: {
type: String,
required: true
}
};
const API_SHOW_NAVIGATION_BAR_LOADING = "showNavigationBarLoading";
const API_HIDE_NAVIGATION_BAR_LOADING = "hideNavigationBarLoading";
function normalizeAppRoutePath(path) {
const route = getRouteOptions(path, true);
const pagePath = route == null ? void 0 : route.meta.route;
return typeof pagePath === "string" ? pagePath : uniShared.removeLeadingSlash((route == null ? void 0 : route.path) || path);
}
function normalizeRewriteRoute({ url, preserveQuery }, event) {
if (preserveQuery) {
url = uniShared.parseUrl(url).path + uniShared.stringifyQuery(event.query);
}
const params = { url, openType: event.openType };
const errMsg = createNormalizeUrl(event.openType, {
skipNavigatorLock: true
})(url, params);
if (errMsg) {
return errMsg;
}
const { path, query } = uniShared.parseUrl(params.url);
return {
url: params.url,
path: normalizeAppRoutePath(path),
query: uniShared.decodedQuery(query),
notFound: false
};
}
const appRouteRuntime = createAppRouteRuntime({ normalizeRewriteRoute });
const pendingProgrammaticRoutes = [];
new Promise((resolve) => {
});
function createAppRouteContext(path, query, openType, notFound = false) {
return appRouteRuntime.createAppRouteContext({
path: normalizeAppRoutePath(path),
query: uniShared.decodedQuery(query),
openType,
notFound
});
}
function resolveAppRoute(url, openType, notFound = false) {
let routeUrl = url;
let routeNotFound = notFound;
let rewriteCount = 0;
while (true) {
const { path, query } = uniShared.parseUrl(routeUrl);
const context = createAppRouteContext(path, query, openType, routeNotFound);
context.rewriteCount = rewriteCount;
const rewrite = appRouteRuntime.dispatchBeforeAppRoute(context);
if (!rewrite) {
return { url: routeUrl, context };
}
routeUrl = rewrite.url;
routeNotFound = rewrite.notFound;
rewriteCount++;
}
}
function createWebAppRouteTransaction(finalFullPath, openType, context) {
return {
finalFullPath,
openType,
context
};
}
function queueWebAppRouteTransaction(transaction) {
pendingProgrammaticRoutes.push(transaction);
}
function discardWebAppRouteTransaction(transaction) {
transaction.cancelled = true;
const index2 = pendingProgrammaticRoutes.indexOf(transaction);
if (index2 !== -1) {
pendingProgrammaticRoutes.splice(index2, 1);
}
}
function isCurrentTabBarPage(url) {
const pages = getCurrentBasePages();
const currentPage = pages[pages.length - 1];
if (!(currentPage == null ? void 0 : currentPage.$.__isTabBar)) {
return false;
}
const path = uniShared.parseUrl(url).path;
const $page = getPage$BasePage(currentPage);
return path === $page.path || path === "/" && $page.meta.isEntry;
}
function findTabBarPageId(url) {
const path = uniShared.parseUrl(url).path;
const pages = getCurrentPagesMap().values();
for (const page of pages) {
const $page = getPage$BasePage(page);
if (path === $page.path || path === "/" && $page.meta.isEntry) {
return $page.id;
}
}
}
function navigate({ type, url, tabBarText, events, isAutomatedTesting }, __id__) {
if (process.env.NODE_ENV !== "production" && !__UNI_FEATURE_PAGES__) {
console.warn(
"当前项目为单页面工程,不能执行页面跳转api。如果需进行页面跳转, 需要在pages.json文件的pages字段中配置多个页面,然后重新运行。"
);
}
let router2;
router2 = getRouterInstance();
return new Promise((resolve, reject) => {
let routeUrl = url;
let transaction;
{
const shouldDispatchAppRoute = type !== "switchTab" || !isCurrentTabBarPage(url);
const appRoute = shouldDispatchAppRoute ? resolveAppRoute(url, type) : void 0;
routeUrl = (appRoute == null ? void 0 : appRoute.url) || url;
const { path: path2, query: query2 } = uniShared.parseUrl(routeUrl);
transaction = createWebAppRouteTransaction(
router2.resolve({ path: path2, query: query2 }).fullPath,
type,
appRoute == null ? void 0 : appRoute.context
);
}
const { path, query } = uniShared.parseUrl(routeUrl);
const tabBarPageId = type === "switchTab" ? findTabBarPageId(routeUrl) : __id__;
const state = createPageState(type, tabBarPageId);
if (transaction) {
transaction.pageId = state.__id__;
queueWebAppRouteTransaction(transaction);
}
const navigation = router2[type === "navigateTo" ? "push" : "replace"]({
path,
query,
state,
force: true
}).then((failure) => {
if (vueRouter.isNavigationFailure(failure)) {
transaction && discardWebAppRouteTransaction(transaction);
return reject(failure.message);
}
if (type === "switchTab") {
const finalTabBarText = routeUrl === url ? tabBarText : router2.resolve({ path, query }).meta.tabBarText;
router2.currentRoute.value.meta.tabBarText = finalTabBarText;
}
if (type === "navigateTo") {
const meta = router2.currentRoute.value.meta;
if (!meta.eventChannel) {
meta.eventChannel = new uniShared.EventChannel(state.__id__, events);
} else if (events) {
Object.keys(events).forEach((eventName) => {
meta.eventChannel._addListener(
eventName,
"on",
events[eventName]
);
});
meta.eventChannel._clearCache();
}
return isAutomatedTesting ? resolve({
__id__: state.__id__
}) : resolve({
eventChannel: meta.eventChannel
});
}
return isAutomatedTesting ? resolve({ __id__: state.__id__ }) : resolve();
});
{
navigation.catch((error) => {
transaction && discardWebAppRouteTransaction(transaction);
reject(error instanceof Error ? error.message : error);
});
}
});
}
function handleBeforeEntryPageRoutes() {
if (entryPageState.handledBeforeEntryPageRoutes) {
return;
}
entryPageState.handledBeforeEntryPageRoutes = true;
const navigateToPages = [...navigateToPagesBeforeEntryPages];
navigateToPagesBeforeEntryPages.length = 0;
navigateToPages.forEach(
({ args, resolve, reject }) => (
// @ts-expect-error
navigate(args).then(resolve).catch(reject)
)
);
const switchTabPages = [...switchTabPagesBeforeEntryPages];
switchTabPagesBeforeEntryPages.length = 0;
switchTabPages.forEach(({ args, resolve, reject }) => {
navigate(args, void 0).then(resolve).catch(reject);
});
const redirectToPages = [...redirectToPagesBeforeEntryPages];
redirectToPagesBeforeEntryPages.length = 0;
redirectToPages.forEach(({ args, resolve, reject }) => {
navigate(args).then(resolve).catch(reject);
});
const reLaunchPages = [...reLaunchPagesBeforeEntryPages];
reLaunchPagesBeforeEntryPages.length = 0;
reLaunchPages.forEach(({ args, resolve, reject }) => {
navigate(args).then(resolve).catch(reject);
});
}
function getTheme() {
if (__uniConfig.darkmode == null || __uniConfig.darkmode === false)
return void 0;
if (__uniConfig.darkmode !== true)
return shared.isString(__uniConfig.darkmode) ? __uniConfig.darkmode : "light";
try {
return window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark";
} catch (error) {
return "light";
}
}
function onThemeChange(callback) {
if (__uniConfig.darkmode) {
UniServiceJSBridge.on(uniShared.ON_THEME_CHANGE, callback);
}
}
function parseTheme(pageStyle) {
let parsedStyle = {};
if (__uniConfig.darkmode) {
parsedStyle = uniShared.normalizeStyles(
pageStyle,
__uniConfig.themeConfig,
getTheme()
);
}
return __uniConfig.darkmode ? parsedStyle : pageStyle;
}
function useTheme(pageStyle, onThemeChangeCallback) {
const isReactivity = Vue.isReactive(pageStyle);
const reactivePageStyle = isReactivity ? Vue.reactive(parseTheme(pageStyle)) : parseTheme(pageStyle);
if (__uniConfig.darkmode && isReactivity) {
Vue.watch(pageStyle, (value) => {
const _pageStyle = parseTheme(value);
for (const key in _pageStyle) {
reactivePageStyle[key] = _pageStyle[key];
}
});
}
onThemeChangeCallback && onThemeChange(onThemeChangeCallback);
return reactivePageStyle;
}
let _tabBar;
let _tabBarStyle;
function updateTabBarStyle() {
const tabBar = _tabBarStyle;
const tabBarConfig = _tabBar;
if (!tabBar || !tabBarConfig) {
return;
}
const tabBarStyle = parseTheme(tabBarConfig);
tabBar.backgroundColor = tabBarStyle.backgroundColor;
tabBar.borderStyle = tabBarStyle.borderStyle;
tabBar.color = tabBarStyle.color;
tabBar.selectedColor = tabBarStyle.selectedColor;
tabBar.blurEffect = tabBarStyle.blurEffect;
tabBar.midButton = tabBarStyle.midButton;
if (tabBarStyle.list && tabBarStyle.list.length) {
tabBarStyle.list.forEach((item, index2) => {
tabBar.list[index2].iconPath = item.iconPath;
tabBar.list[index2].selectedIconPath = item.selectedIconPath;
});
}
}
function useTabBar() {
if (!_tabBarStyle) {
const tabBar = __uniConfig.tabBar;
if (!tabBar) {
return;
}
_tabBar = Vue.reactive(initTabBarI18n(tabBar));
_tabBarStyle = useTheme(_tabBar, updateTabBarStyle);
}
return _tabBarStyle;
}
const envMethod = /* @__PURE__ */ (() => "env")();
function normalizeWindowBottom(windowBottom) {
return envMethod ? `calc(${windowBottom}px + ${envMethod}(safe-area-inset-bottom))` : `${windowBottom}px`;
}
const homeDialogPages = [];
const homeSystemDialogPages = [];
function getPageElement(page) {
{
throw new Error("Not support get page element in non-browser environment");
}
}
class UniPageImpl {
constructor({
route,
options,
vm
}) {
this.getParentPage = () => null;
this.route = (vm == null ? void 0 : vm.route) || route;
this.options = options;
this.vm = vm;
this.$vm = vm;
}
get statusBarHeight() {
return safeAreaInsets$1.top;
}
get width() {
return this.pageBody.width;
}
get height() {
const pageEle = getPageElement();
const pageHead = pageEle.querySelector("uni-page-head");
return this.pageBody.height + (pageHead ? pageHead.clientHeight : 0);
}
get pageBody() {
const pageEle = getPageElement();
const pageBody = pageEle.querySelector("uni-page-wrapper");
const pageWrapperInfo = getPageWrapperInfo(pageBody);
return {
top: pageWrapperInfo.top,
left: pageWrapperInfo.left,
right: pageWrapperInfo.left + pageWrapperInfo.width,
bottom: pageWrapperInfo.top + pageWrapperInfo.height,
width: pageWrapperInfo.width,
height: pageWrapperInfo.height
};
}
get safeAreaInsets() {
const pageEle = getPageElement();
const pageBody = pageEle.querySelector("uni-page-wrapper");
return getSafeAreaInsets(pageBody);
}
getPageStyle() {
var _a, _b, _c, _d, _e;
const pageMeta = ((_a = this.vm) == null ? void 0 : _a.$basePage.meta) ? uniShared.normalizeStyles((_b = this.vm) == null ? void 0 : _b.$basePage.meta, __uniConfig.themeConfig) : void 0;
const scriptLang = (_e = (_d = (_c = this.vm) == null ? void 0 : _c.$) == null ? void 0 : _d.type) == null ? void 0 : _e.__scriptLang;
const pageStyle = pageMeta ? {
navigationBarBackgroundColor: pageMeta.navigationBar.backgroundColor,
navigationBarTextStyle: pageMeta.navigationBar.titleColor,
navigationBarTitleText: pageMeta.navigationBar.titleText,
titleImage: pageMeta.navigationBar.titleImage || "",
navigationStyle: pageMeta.navigationBar.style || "default",
disableScroll: pageMeta.disableScroll || false,
enablePullDownRefresh: pageMeta.enablePullDownRefresh || false,
onReachBottomDistance: pageMeta.onReachBottomDistance || uniShared.ON_REACH_BOTTOM_DISTANCE,
backgroundColorContent: pageMeta.backgroundColorContent
} : {};
if (!scriptLang || scriptLang === "uts") {
return new uniShared.UTSJSONObject(pageStyle);
}
return pageStyle;
}
$getPageStyle() {
return this.getPageStyle();
}
setPageStyle(style) {
var _a;
const pageMeta = (_a = this.vm) == null ? void 0 : _a.$basePage.meta;
if (!pageMeta)
return;
for (const key in style) {
switch (key) {
case "navigationBarBackgroundColor":
pageMeta.navigationBar.backgroundColor = style[key];
break;
case "navigationBarTextStyle":
const textStyle = style[key];
if (textStyle == null) {
continue;
}
pageMeta.navigationBar.titleColor = ["black", "white"].includes(
textStyle
) ? uniShared.normalizeTitleColor(textStyle || "") : textStyle;
break;
case "navigationBarTitleText":
pageMeta.navigationBar.titleText = style[key];
break;
case "titleImage":
pageMeta.navigationBar.titleImage = style[key];
break;
case "navigationStyle":
pageMeta.navigationBar.style = style[key];
break;
default:
pageMeta[key] = style[key];
break;
}
}
}
$setPageStyle(style) {
this.setPageStyle(style);
}
getElementById(id2) {
{
return null;
}
}
querySelector(selector) {
{
return null;
}
}
querySelectorAll(selector) {
const res = [];
{
return res;
}
}
getAndroidView() {
return null;
}
getIOSView() {
return null;
}
getHTMLElement() {
{
return null;
}
}
getDialogPages() {
return [];
}
$getSystemDialogPages() {
var _a, _b, _c;
return ((_c = (_b = (_a = this.vm) == null ? void 0 : _a.$pageLayoutInstance) == null ? void 0 : _b.$systemDialogPages) == null ? void 0 : _c.value) || [];
}
__$$getSystemDialogPages() {
return [];
}
getAndroidActivity() {
return null;
}
exitFullscreen() {
}
createElement() {
return null;
}
onLayoutChange() {
return -1;
}
offLayoutChange() {
}
onRenderChange() {
return -1;
}
offRenderChange() {
}
onTouchStart() {
return -1;
}
offTouchStart() {
}
onTouchEnd() {
return -1;
}
offTouchEnd() {
}
takeSnapshot() {
}
}
class UniNormalPageImpl extends UniPageImpl {
getDialogPages() {
var _a, _b;
return ((_b = (_a = this.vm) == null ? void 0 : _a.$pageLayoutInstance) == null ? void 0 : _b.$dialogPages.value) || [];
}
constructor({
route,
options,
vm
}) {
super({ route, options, vm });
}
}
function initXPage(vm, route, page) {
var _a, _b, _c;
initPageVm(vm, page);
if (!("$pageLayoutInstance" in vm)) {
Object.defineProperty(vm, "$pageLayoutInstance", {
get() {
var _a2, _b2;
let res = (_a2 = vm.$) == null ? void 0 : _a2.parent;
while (res && ((_b2 = res.type) == null ? void 0 : _b2.name) !== "Page") {
res = res.parent;
}
return res;
}
});
}
vm.$.$waitNativeRender = (callback) => {
vm.$nextTick(() => {
callback && callback();
});
};
const pageInstance = vm.$pageLayoutInstance;
if (!isDialogPageInstance(pageInstance)) {
const scriptLang = vm.$.type.__scriptLang;
const isUTS = !scriptLang || scriptLang === "uts";
const uniPage = new UniNormalPageImpl({
route: (route == null ? void 0 : route.path) ? uniShared.removeLeadingSlash(route == null ? void 0 : route.path) : "",
// 忽略类型,不同环境UTSJSONObject表示不同类型
options: isUTS ? new uniShared.UTSJSONObject((route == null ? void 0 : route.query) || {}) : (route == null ? void 0 : route.query) || {},
vm
});
vm.$.page = uniPage;
vm.$dialogPage = (_a = vm.$pageLayoutInstance) == null ? void 0 : _a.$dialogPage;
currentPagesMap.set(normalizeRouteKey(page.path, page.id), vm);
if (currentPagesMap.size === 1) {
setTimeout(() => {
handleBeforeEntryPageRoutes();
}, 0);
if (homeDialogPages.length) {
homeDialogPages.forEach((dialogPage) => {
dialogPage.getParentPage = () => vm.$page;
pageInstance.$dialogPages.value.push(dialogPage);
});
homeDialogPages.length = 0;
}
if (homeSystemDialogPages.length) {
homeSystemDialogPages.forEach((dialogPage) => {
dialogPage.getParentPage = () => vm.$page;
pageInstance.$systemDialogPages.value.push(dialogPage);
});
homeSystemDialogPages.length = 0;
}
}
} else {
vm.$.page = (_b = vm.$pageLayoutInstance) == null ? void 0 : _b.$dialogPage;
pageInstance.$dialogPage.vm = vm;
pageInstance.$dialogPage.$vm = vm;
vm.$basePage.fullPath = vm.$basePage.path;
}
(_c = pageInstance.proxy) == null ? void 0 : _c.$el;
}
const SEP = "$$";
const currentPagesMap = /* @__PURE__ */ new Map();
function getPage$BasePage(page) {
return page.$basePage;
}
const entryPageState = {
handledBeforeEntryPageRoutes: false
};
const navigateToPagesBeforeEntryPages = [];
const switchTabPagesBeforeEntryPages = [];
const redirectToPagesBeforeEntryPages = [];
const reLaunchPagesBeforeEntryPages = [];
function pruneCurrentPages() {
currentPagesMap.forEach((page, id2) => {
if (page.$.isUnmounted) {
currentPagesMap.delete(id2);
}
});
}
function getCurrentPagesMap() {
return currentPagesMap;
}
function getCurrentPages$1() {
const curPages = getCurrentBasePages();
{
return curPages.map((page) => page.$page);
}
}
function getCurrentBasePages() {
const curPages = [];
const pages = currentPagesMap.values();
for (const page of pages) {
if (page.$.__isTabBar) {
if (page.$.__isActive) {
curPages.push(page);
}
} else {
curPages.push(page);
}
}
return curPages;
}
let id = /* @__PURE__ */ getStateId();
function createPageState(type, __id__) {
return {
__id__: __id__ || ++id,
__type__: type
};
}
let dialogPageId = Number.MIN_SAFE_INTEGER;
function createDialogPageId() {
return ++dialogPageId;
}
function initPublicPage(route) {
const meta = usePageMeta();
if (!__UNI_FEATURE_PAGES__) {
return initPageInternalInstance("navigateTo", __uniRoutes[0].path, {}, meta);
}
let fullPath = route.fullPath;
if (route.meta.isEntry && fullPath.indexOf(route.meta.route) === -1) {
fullPath = "/" + route.meta.route + fullPath.replace("/", "");
}
return initPageInternalInstance("navigateTo", fullPath, {}, meta);
}
function initPage(vm) {
let route;
route = usePageRoute();
const page = initPublicPage(route);
const routeMeta = route.meta;
Object.defineProperty(page, "eventChannel", {
configurable: true,
enumerable: true,
get: () => routeMeta.eventChannel,
set: (eventChannel) => routeMeta.eventChannel = eventChannel
});
initPageVm(vm, page);
{
initXPage(vm, route, page);
}
}
function normalizeRouteKey(path, id2) {
return path + SEP + id2;
}
function useKeepAliveRoute() {
const route = vueRouter.useRoute();
const routeKey = Vue.computed(
() => normalizeRouteKey("/" + route.meta.route, getStateId())
);
const isTabBar = Vue.computed(() => route.meta.isTabBar);
return {
routeKey,
isTabBar,
routeCache
};
}
const pageCacheMap = /* @__PURE__ */ new Map();
const routeCache = {
get(key) {
return pageCacheMap.get(key);
},
set(key, value) {
pruneRouteCache(key);
pageCacheMap.set(key, value);
},
delete(key) {
const vnode = pageCacheMap.get(key);
if (!vnode) {
return;
}
pageCacheMap.delete(key);
},
forEach(fn) {
pageCacheMap.forEach(fn);
}
};
function isTabBarCacheEntry(cacheEntry) {
var _a;
return ((_a = cacheEntry.attrs || cacheEntry.props) == null ? void 0 : _a.type) === "tabBar";
}
function pruneRouteCache(key) {
const pageId = parseInt(key.split(SEP)[1]);
if (!pageId) {
return;
}
routeCache.forEach((cacheEntry, key2) => {
const cPageId = parseInt(key2.split(SEP)[1]);
if (cPageId && cPageId > pageId) {
if (__UNI_FEATURE_TABBAR__ && isTabBarCacheEntry(cacheEntry)) {
return;
}
routeCache.delete(key2);
routeCache.pruneCacheEntry(cacheEntry);
Vue.nextTick(() => pruneCurrentPages());
}
});
}
function addBase(filePath) {
const { base: baseUrl } = __uniConfig.router;
if (uniShared.addLeadingSlash(filePath).indexOf(baseUrl) === 0) {
return uniShared.addLeadingSlash(filePath);
}
return baseUrl + filePath;
}
function getRealPath(filePath) {
const { base, assets } = __uniConfig.router;
if (base === "./") {
if (filePath.indexOf("./") === 0 && (filePath.includes("/static/") || filePath.indexOf("./" + (assets || "assets") + "/") === 0)) {
filePath = filePath.slice(1);
}
}
if (filePath.indexOf("/") === 0) {
if (filePath.indexOf("//") === 0) {
filePath = "https:" + filePath;
} else {
return addBase(filePath.slice(1));
}
}
if (uniShared.SCHEME_RE.test(filePath) || uniShared.DATA_RE.test(filePath) || filePath.indexOf("blob:") === 0) {
return filePath;
}
{
if (process.env.NODE_ENV !== "production") {
if (!filePath.includes("/static/")) {
return filePath;
}
}
}
const pages = getCurrentBasePages();
if (pages.length) {
return addBase(
getRealRoute(
getPage$BasePage(pages[pages.length - 1]).route,
filePath
).slice(1)
);
}
return filePath;
}
const t0$w = Vue.template("<img>");
const t1$d = Vue.template("<div class=uni-tabbar__mid>");
const t2$4 = Vue.template("<div class=uni-tabbar__iconfont> ");
const t3$4 = Vue.template("<div>");
const t4$2 = Vue.template("<div class=uni-tabbar__label> ");
const t5$2 = Vue.template("<div> ");
const t6$1 = Vue.template("<div class=uni-tabbar__item><!><div class=uni-tabbar__bd></div>");
const t7$1 = Vue.template("<uni-tabbar><div class=uni-tabbar><div class=uni-tabbar-border></div></div><div class=uni-placeholder>", 1);
const DEFAULT_BG_COLOR = "#f7f7fa";
const BLUR_EFFECT_COLOR_DARK = "rgb(0, 0, 0, 0.8)";
const BLUR_EFFECT_COLOR_LIGHT = "rgb(250, 250, 250, 0.8)";
const _sfc_main$w = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "TabBar",
__reserved: true,
compatConfig: { MODE: 3 }
},
__name: "tabBar",
setup(__props) {
const hasMidButton = __UNI_FEATURE_TABBAR_MIDBUTTON__;
const _middleButton = {
width: "50px",
height: "50px",
iconWidth: "24px"
};
const visibleList = Vue.ref([]);
const tabBar = useTabBar();
useVisibleList(tabBar, visibleList);
useTabBarCssVar(tabBar);
const onSwitchTab = useSwitchTab(vueRouter.useRoute(), tabBar, visibleList);
const { style, borderStyle, placeholderStyle } = useTabBarStyle(tabBar);
function useTabBarCssVar(tabBar2) {
Vue.watch(
() => tabBar2.shown,
(value) => {
updatePageCssVar({
"--window-bottom": normalizeWindowBottom(
value ? parseInt(tabBar2.height) : 0
)
});
}
);
}
function useVisibleList(tabBar2, visibleList2) {
const internalMidButton = Vue.ref(
shared.extend({ type: "midButton" }, tabBar2.midButton)
);
function setVisibleList() {
let tempList = [];
tempList = tabBar2.list.filter((item) => item.visible !== false);
if (hasMidButton && tabBar2.midButton) {
internalMidButton.value = shared.extend(
{},
_middleButton,
internalMidButton.value,
tabBar2.midButton
);
tempList = tempList.filter((item) => !isMidButton(item));
if (tempList.length % 2 === 0) {
tempList.splice(
Math.floor(tempList.length / 2),
0,
internalMidButton.value
);
}
}
visibleList2.value = tempList;
}
Vue.watchEffect(setVisibleList);
}
function useSwitchTab(route, tabBar2, visibleList2) {
Vue.watchEffect(() => {
const meta = route.meta;
if (meta.isTabBar) {
const pagePath = meta.route;
const index2 = visibleList2.value.findIndex(
(item) => item.pagePath === pagePath
);
tabBar2.selectedIndex = index2;
}
});
return (tabBarItem, index2) => {
const { type } = tabBarItem;
if (hasMidButton && type === "midButton") {
return UniServiceJSBridge.invokeOnCallback(
API_ON_TAB_BAR_MID_BUTTON_TAP
);
}
const { pagePath, text } = tabBarItem;
let url = uniShared.addLeadingSlash(pagePath);
if (url === __uniRoutes[0].alias) {
url = "/";
}
if (route.path !== url) {
uni.switchTab({ from: "tabBar", url, tabBarText: text });
} else {
invokeHook("onTabItemTap", {
index: index2,
text,
pagePath
});
}
};
}
const BLUR_EFFECT_COLORS = {
dark: BLUR_EFFECT_COLOR_DARK,
light: BLUR_EFFECT_COLOR_LIGHT,
extralight: BLUR_EFFECT_COLOR_LIGHT
};
const BORDER_COLORS = {
white: "rgba(255, 255, 255, 0.33)",
black: "rgba(0, 0, 0, 0.33)"
};
function useTabBarStyle(tabBar2) {
const style2 = Vue.computed(() => {
let backgroundColor = tabBar2.backgroundColor;
const blurEffect = tabBar2.blurEffect;
if (!backgroundColor) {
if (blurEffect && blurEffect !== "none") {
backgroundColor = BLUR_EFFECT_COLORS[blurEffect];
}
}
return {
backgroundColor: backgroundColor || DEFAULT_BG_COLOR,
backdropFilter: blurEffect !== "none" ? "blur(10px)" : blurEffect
};
});
const borderStyle2 = Vue.computed(() => {
const { borderStyle: borderStyle3, borderColor } = tabBar2;
if (borderColor && shared.isString(borderColor)) {
return {
backgroundColor: borderColor
};
}
return {
backgroundColor: BORDER_COLORS[borderStyle3] || BORDER_COLORS["black"]
};
});
const placeholderStyle2 = Vue.computed(() => {
return {
height: tabBar2.height
};
});
return {
style: style2,
borderStyle: borderStyle2,
placeholderStyle: placeholderStyle2
};
}
function isMidButton(item) {
return item.type === "midButton";
}
function isRenderedMidButton(item) {
return hasMidButton && isMidButton(item);
}
function getMidButton(item) {
return item;
}
function getItemStyle(item) {
if (!isRenderedMidButton(item)) {
return;
}
return {
flex: "0 0 " + item.width,
position: "relative"
};
}
function getMidButtonStyle(item) {
const { width, height, backgroundImage } = getMidButton(item);
return {
width,
height,
backgroundImage: backgroundImage ? "url('" + getRealPath(backgroundImage) + "')" : "none"
};
}
function isSelected(index2) {
return tabBar.selectedIndex === index2;
}
function getTextColor(index2) {
return isSelected(index2) ? tabBar.selectedColor : tabBar.color;
}
function getIconPath(item, index2) {
return (isSelected(index2) ? item.selectedIconPath || item.iconPath : item.iconPath) || "";
}
function getIconfontText(item, index2) {
if (!item.iconfont) {
return;
}
return isSelected(index2) ? item.iconfont.selectedText || item.iconfont.text : item.iconfont.text;
}
function getIconfontColor(item, index2) {
if (!item.iconfont) {
return;
}
return isSelected(index2) ? item.iconfont.selectedColor || item.iconfont.color : item.iconfont.color;
}
function getIconClass(item) {
return "uni-tabbar__icon" + (item.text ? " uni-tabbar__icon__diff" : "");
}
function getIconStyle() {
return { width: tabBar.iconWidth, height: tabBar.iconWidth };
}
function getIconfontStyle(item, index2) {
var _a;
return {
fontSize: ((_a = item.iconfont) == null ? void 0 : _a.fontSize) || tabBar.iconWidth,
color: getIconfontColor(item, index2) || BLUR_EFFECT_COLOR_DARK
};
}
function getLabelStyle(item, index2) {
return {
color: getTextColor(index2),
fontSize: tabBar.fontSize,
lineHeight: !item.iconPath ? 1.8 : "normal",
marginTop: !item.iconPath ? "inherit" : tabBar.spacing
};
}
const n31 = t7$1();
const n29 = Vue.child(n31);
const n0 = Vue.child(n29);
const n30 = Vue.next(n29);
Vue.renderEffect(() => {
Vue.setClass(n31, "uni-tabbar-" + Vue.unref(tabBar).position);
Vue.setStyle(n29, Vue.unref(style));
Vue.setStyle(n0, Vue.unref(borderStyle));
});
Vue.setInsertionState(n29, 1);
Vue.createFor(
() => visibleList.value,
(_for_item0, _for_key0) => {
const n28 = t6$1();
const n27 = Vue.child(n28);
const n26 = Vue.next(n27);
Vue.renderEffect(() => Vue.setStyle(n28, getItemStyle(_for_item0.value)));
Vue.setInsertionState(n28, n27);
Vue.createIf(() => isRenderedMidButton(_for_item0.value), () => {
const n8 = t1$d();
Vue.renderEffect(() => Vue.setStyle(n8, getMidButtonStyle(_for_item0.value)));
Vue.setInsertionState(n8);
Vue.createIf(() => getIconPath(_for_item0.value, _for_key0.value), () => {
const n7 = t0$w();
Vue.renderEffect(() => {
Vue.setStyle(n7, {
width: getMidButton(_for_item0.value).iconWidth,
height: getMidButton(_for_item0.value).iconWidth
});
Vue.setProp(n7, "src", Vue.unref(getRealPath)(getIconPath(_for_item0.value, _for_key0.value)));
});
return n7;
});
return n8;
});
Vue.renderEffect(() => Vue.setStyle(n26, { height: Vue.unref(tabBar).height }));
Vue.setInsertionState(n26);
Vue.createIf(
() => getIconfontText(_for_item0.value, _for_key0.value),
() => {
const n14 = t3$4();
Vue.renderEffect(() => {
Vue.setClass(n14, getIconClass(_for_item0.value));
Vue.setStyle(n14, getIconStyle());
});
Vue.setInsertionState(n14);
Vue.createIf(() => _for_item0.value.type !== "midButton", () => {
const n13 = t2$4();
const x13 = Vue.txt(n13);
Vue.renderEffect(() => {
const _item = _for_item0.value;
const _index = _for_key0.value;
Vue.setStyle(n13, getIconfontStyle(_item, _index));
Vue.setText(x13, Vue.toDisplayString(getIconfontText(_item, _index)));
});
return n13;
});
return n14;
},
() => Vue.createIf(() => getIconPath(_for_item0.value, _for_key0.value), () => {
const n19 = t3$4();
Vue.renderEffect(() => {
Vue.setClass(n19, getIconClass(_for_item0.value));
Vue.setStyle(n19, getIconStyle());
});
Vue.setInsertionState(n19);
Vue.createIf(() => _for_item0.value.type !== "midButton", () => {
const n18 = t0$w();
Vue.renderEffect(() => Vue.setProp(n18, "src", Vue.unref(getRealPath)(getIconPath(_for_item0.value, _for_key0.value))));
return n18;
});
return n19;
}),
1037
/* TRUE_SINGLE_ROOT, FALSE_ELSE_IF, KEYED_INDEX_3 */
);
Vue.setInsertionState(n26, 1);
Vue.createIf(() => _for_item0.value.text, () => {
const n22 = t4$2();
const x22 = Vue.txt(n22);
Vue.renderEffect(() => {
const _item = _for_item0.value;
Vue.setStyle(n22, getLabelStyle(_item, _for_key0.value));
Vue.setText(x22, Vue.toDisplayString(_item.text));
});
return n22;
});
Vue.setInsertionState(n26, 2);
Vue.createIf(() => _for_item0.value.redDot, () => {
const n25 = t5$2();
const x25 = Vue.txt(n25);
Vue.renderEffect(() => {
const _item_badge = _for_item0.value.badge;
Vue.setClass(n25, [
"uni-tabbar__reddot",
_item_badge ? "uni-tabbar__badge" : ""
]);
Vue.setText(x25, Vue.toDisplayString(_item_badge));
});
return n25;
});
Vue.on(n28, "click", () => Vue.unref(onSwitchTab)(_for_item0.value, _for_key0.value));
return n28;
},
(item, index2) => isRenderedMidButton(item) ? "midButton" : index2,
8
/* IS_SINGLE_NODE */
);
Vue.renderEffect(() => Vue.setStyle(n30, Vue.unref(placeholderStyle)));
return n31;
}
});
const t0$v = Vue.template("<uni-top-window><div class=uni-top-window></div><div class=uni-top-window--placeholder>");
const t1$c = Vue.template("<div class=uni-mask>");
const t2$3 = Vue.template("<uni-left-window><!><div class=uni-left-window>");
const t3$3 = Vue.template("<uni-right-window><!><div class=uni-right-window>");
const t4$1 = Vue.template("<uni-layout><!><uni-content><uni-main></uni-main>");
const t5$1 = Vue.template("<uni-app>", 1);
const _sfc_main$v = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "Layout",
__reserved: true,
compatConfig: { MODE: 3 }
},
__name: "index-vapor",
setup(__props) {
const hasPages = __UNI_FEATURE_PAGES__;
const hasResponsive = __UNI_FEATURE_RESPONSIVE__;
const hasTopWindow = __UNI_FEATURE_TOPWINDOW__;
const hasLeftWindow = __UNI_FEATURE_LEFTWINDOW__;
const hasRightWindow = __UNI_FEATURE_RIGHTWINDOW__;
const hasTabBar = __UNI_FEATURE_TABBAR__;
const rootRef = Vue.ref(null);
const firstPageComponent = !hasPages && __uniRoutes[0].component;
const keepAliveRoute = hasPages ? useKeepAliveRoute() : void 0;
const routeKey = keepAliveRoute == null ? void 0 : keepAliveRoute.routeKey;
const isTabBar = keepAliveRoute == null ? void 0 : keepAliveRoute.isTabBar;
const routeCache2 = keepAliveRoute == null ? void 0 : keepAliveRoute.routeCache;
const route = hasPages ? vueRouter.useRoute() : void 0;
const { layoutState, windowState } = useState();
useMaxWidth(layoutState, rootRef);
const topWindow = hasTopWindow && useTopWindow(layoutState);
const leftWindow = hasLeftWindow && useLeftWindow(layoutState);
const rightWindow = hasRightWindow && useRightWindow(layoutState);
const TopWindow = topWindow && topWindow.component;
const LeftWindow = leftWindow && leftWindow.component;
const RightWindow = rightWindow && rightWindow.component;
const topWindowRef = topWindow && topWindow.windowRef;
const leftWindowRef = leftWindow && leftWindow.windowRef;
const rightWindowRef = rightWindow && rightWindow.windowRef;
const showTabBar = hasTabBar && useShowTabBar();
const clazz = useAppClass(showTabBar);
function useAppClass(showTabBar2) {
const showMaxWidth = Vue.ref(false);
return Vue.computed(() => {
return {
"uni-app--showtabbar": showTabBar2 && showTabBar2.value,
"uni-app--maxwidth": showMaxWidth.value
};
});
}
function initMediaQuery(minWidth, callback) {
{
return false;
}
}
function useMaxWidth(layoutState2, rootRef2) {
const route2 = usePageRoute();
function checkMaxWidth() {
const windowWidth = document.body.clientWidth;
const pages = getCurrentBasePages();
let meta = {};
if (pages.length > 0) {
const curPage = pages[pages.length - 1];
meta = getPage$BasePage(curPage).meta;
} else {
const routeOptions = getRouteOptions(route2.path, true);
if (routeOptions) {
meta = routeOptions.meta;
}
}
const maxWidth = parseInt(
String(
(shared.hasOwn(meta, "maxWidth") ? meta.maxWidth : __uniConfig.globalStyle.maxWidth) || Number.MAX_SAFE_INTEGER
)
);
let showMaxWidth = false;
if (windowWidth > maxWidth) {
showMaxWidth = true;
} else {
showMaxWidth = false;
}
if (showMaxWidth && maxWidth) {
layoutState2.marginWidth = (windowWidth - maxWidth) / 2;
Vue.nextTick(() => {
const rootEl = rootRef2.value;
if (rootEl) {
rootEl.setAttribute(
"style",
"max-width:" + maxWidth + "px;margin:0 auto;"
);
}
});
} else {
layoutState2.marginWidth = 0;
Vue.nextTick(() => {
const rootEl = rootRef2.value;
if (rootEl) {
rootEl.removeAttribute("style");
}
});
}
}
Vue.watch([() => route2.path], checkMaxWidth);
}
function useState() {
const route2 = usePageRoute();
if (!hasResponsive) {
const layoutState3 = Vue.reactive({
marginWidth: 0,
leftWindowWidth: 0,
rightWindowWidth: 0
});
Vue.watch(
() => layoutState3.marginWidth,
(value) => updateCssVar({ "--window-margin": value + "px" })
);
Vue.watch(
() => layoutState3.leftWindowWidth + layoutState3.marginWidth,
(value) => {
updateCssVar({ "--window-left": value + "px" });
}
);
Vue.watch(
() => layoutState3.rightWindowWidth + layoutState3.marginWidth,
(value) => {
updateCssVar({ "--window-right": value + "px" });
}
);
return {
layoutState: layoutState3,
windowState: Vue.computed(() => ({}))
};
}
const topWindowMediaQuery = Vue.ref(false);
const leftWindowMediaQuery = Vue.ref(false);
const rightWindowMediaQuery = Vue.ref(false);
const showTopWindow = Vue.computed(
() => hasTopWindow && route2.meta.topWindow !== false && topWindowMediaQuery.value
);
const showLeftWindow = Vue.computed(
() => hasLeftWindow && route2.meta.leftWindow !== false && leftWindowMediaQuery.value
);
const showRightWindow = Vue.computed(
() => hasRightWindow && route2.meta.rightWindow !== false && rightWindowMediaQuery.value
);
const layoutState2 = Vue.reactive({
topWindowMediaQuery,
showTopWindow,
apiShowTopWindow: false,
leftWindowMediaQuery,
showLeftWindow,
apiShowLeftWindow: false,
rightWindowMediaQuery,
showRightWindow,
apiShowRightWindow: false,
topWindowHeight: 0,
marginWidth: 0,
leftWindowWidth: 0,
rightWindowWidth: 0,
navigationBarTitleText: "",
topWindowStyle: {},
leftWindowStyle: {},
rightWindowStyle: {}
});
const props2 = [
"topWindow",
"leftWindow",
"rightWindow"
];
props2.forEach((prop) => {
var _a;
const matchMedia = (_a = __uniConfig[prop]) == null ? void 0 : _a.matchMedia;
if (matchMedia && shared.hasOwn(matchMedia, "minWidth")) {
matchMedia.minWidth;
}
const matches = initMediaQuery();
layoutState2[`${prop}MediaQuery`] = matches;
});
Vue.watch(
() => layoutState2.topWindowHeight,
(value) => updateCssVar({ "--top-window-height": value + "px" })
);
Vue.watch(
() => layoutState2.marginWidth,
(value) => updateCssVar({ "--window-margin": value + "px" })
);
Vue.watch(
() => layoutState2.leftWindowWidth + layoutState2.marginWidth,
(value) => {
updateCssVar({ "--window-left": value + "px" });
}
);
Vue.watch(
() => layoutState2.rightWindowWidth + layoutState2.marginWidth,
(value) => {
updateCssVar({ "--window-right": value + "px" });
}
);
UniServiceJSBridge.on(uniShared.ON_NAVIGATION_BAR_CHANGE, (navigationBar) => {
layoutState2.navigationBarTitleText = navigationBar.titleText;
});
const windowState2 = Vue.computed(() => ({
matchTopWindow: layoutState2.topWindowMediaQuery,
showTopWindow: layoutState2.showTopWindow || layoutState2.apiShowTopWindow,
matchLeftWindow: layoutState2.leftWindowMediaQuery,
showLeftWindow: layoutState2.showLeftWindow || layoutState2.apiShowLeftWindow,
matchRightWindow: layoutState2.rightWindowMediaQuery,
showRightWindow: layoutState2.showRightWindow || layoutState2.apiShowRightWindow
}));
return {
layoutState: layoutState2,
windowState: windowState2
};
}
function useShowTabBar() {
const route2 = usePageRoute();
const tabBar = useTabBar();
const showTabBar2 = Vue.computed(() => route2.meta.isTabBar && tabBar.shown);
return showTabBar2;
}
function useTopWindow(layoutState2) {
const { component, style } = __uniConfig.topWindow;
const windowRef = Vue.ref(null);
function updateWindow() {
const instance = windowRef.value;
if (!instance) {
return;
}
const el = instance.$el;
if (!el) {
return;
}
const uniTopWindowStyleEl = el.parentElement;
if (!uniTopWindowStyleEl) {
return;
}
const height = uniTopWindowStyleEl.getBoundingClientRect().height;
layoutState2.topWindowHeight = height;
}
Vue.watch(
() => windowRef.value,
() => {
updateWindow();
}
);
Vue.watch(
() => layoutState2.showTopWindow || layoutState2.apiShowTopWindow,
() => Vue.nextTick(updateWindow)
);
Vue.watch(
() => layoutState2.topWindowStyle,
() => Vue.nextTick(updateWindow)
);
layoutState2.topWindowStyle = style;
return {
component,
windowRef
};
}
function useLeftWindow(layoutState2) {
const { component, style } = __uniConfig.leftWindow;
const windowRef = Vue.ref(null);
function updateWindow() {
const instance = windowRef.value;
if (!instance) {
return;
}
const el = instance.$el;
if (!el) {
return;
}
const uniLeftWindowStyleEl = el.parentElement && el.parentElement.parentElement;
if (!uniLeftWindowStyleEl) {
return;
}
const width = uniLeftWindowStyleEl.getBoundingClientRect().width;
layoutState2.leftWindowWidth = width;
}
Vue.watch(
() => windowRef.value,
() => {
updateWindow();
}
);
Vue.watch(
() => layoutState2.showLeftWindow || layoutState2.apiShowLeftWindow,
() => Vue.nextTick(updateWindow)
);
Vue.watch(
() => layoutState2.leftWindowStyle,
() => Vue.nextTick(updateWindow)
);
layoutState2.leftWindowStyle = style;
return {
component,
windowRef
};
}
function useRightWindow(layoutState2) {
const { component, style } = __uniConfig.rightWindow;
const windowRef = Vue.ref(null);
function updateWindow() {
const instance = windowRef.value;
if (!instance) {
return;
}
const el = instance.$el;
if (!el) {
return;
}
const uniRightWindowStyleEl = el.parentElement && el.parentElement.parentElement;
if (!uniRightWindowStyleEl) {
return;
}
const width = uniRightWindowStyleEl.getBoundingClientRect().width;
layoutState2.rightWindowWidth = width;
}
Vue.watch(
() => windowRef.value,
() => {
updateWindow();
}
);
Vue.watch(
() => layoutState2.showRightWindow || layoutState2.apiShowRightWindow,
() => Vue.nextTick(updateWindow)
);
Vue.watch(
() => layoutState2.rightWindowStyle,
() => Vue.nextTick(updateWindow)
);
layoutState2.rightWindowStyle = style;
return {
component,
windowRef
};
}
const n49 = t5$1();
Vue.renderEffect(() => Vue.setClass(n49, Vue.unref(clazz)));
Vue.setInsertionState(n49);
Vue.createIf(
() => Vue.unref(hasResponsive),
() => {
const n36 = t4$1();
const n35 = Vue.child(n36);
const n34 = Vue.next(n35);
const n15 = Vue.child(n34);
Vue.renderEffect(() => {
const _layoutState = Vue.unref(layoutState);
Vue.setClassName(n36, (Vue.unref(hasTopWindow) && _layoutState.showTopWindow ? 1 : 0) | (Vue.unref(hasLeftWindow) && _layoutState.showLeftWindow ? 2 : 0) | (Vue.unref(hasRightWindow) && _layoutState.showRightWindow ? 4 : 0), [" uni-app--showtopwindow", " uni-app--showleftwindow", " uni-app--showrightwindow"]);
});
Vue.setInsertionState(n36, n35);
Vue.createIf(() => Vue.unref(hasTopWindow) && Vue.unref(TopWindow), () => {
const n7 = t0$v();
const n5 = Vue.child(n7);
const n6 = Vue.next(n5);
Vue.renderEffect(() => Vue.setStyle(n5, Vue.unref(layoutState).topWindowStyle));
Vue.setInsertionState(n5);
const n4 = Vue.withComponentId("7b5159a7", () => Vue.createDynamicComponent(() => Vue.unref(TopWindow), {
"navigation-bar-title-text": () => Vue.unref(layoutState).navigationBarTitleText,
$: [
() => Vue.unref(windowState)
]
}));
Vue.setStaticTemplateRef(n4, topWindowRef, null, "topWindowRef");
Vue.applyVShow(n7, () => Vue.unref(layoutState).showTopWindow || Vue.unref(layoutState).apiShowTopWindow);
Vue.renderEffect(() => Vue.setStyle(n6, { height: Vue.unref(layoutState).topWindowHeight + "px" }));
return n7;
});
Vue.setInsertionState(n15);
Vue.createIf(
() => {
var _a;
return Vue.unref(hasPages) && ((_a = Vue.unref(route)) == null ? void 0 : _a.meta.route);
},
() => {
const n12 = Vue.withComponentId("2251cd94", () => Vue.createComponent(Vue.unref(vueRouter.VaporRouterView), { type: () => Vue.unref(isTabBar) ? "tabBar" : "" }, (_slotProps0) => {
const n11 = Vue.withComponentId("2251bf54", () => Vue.createComponent(
Vue.VaporKeepAlive,
{
"match-by": "key",
cache: () => Vue.unref(routeCache2)
},
Vue.extend(() => {
const n10 = Vue.withComponentId("2251bdde", () => Vue.createDynamicComponent(() => _slotProps0.Component, null, null, 5, () => Vue.unref(routeKey)));
return n10;
}, {
_: 1
/* NON_STABLE */
}),
2
/* SLOT */
));
return n11;
}));
return n12;
},
() => Vue.createIf(() => !Vue.unref(hasPages), () => {
const n14 = Vue.withComponentId("2251b652", () => Vue.createDynamicComponent(() => Vue.unref(firstPageComponent)));
return n14;
}),
525
/* TRUE_SINGLE_ROOT, FALSE_ELSE_IF, KEYED_INDEX_1 */
);
Vue.setInsertionState(n34, 1);
Vue.createIf(() => Vue.unref(hasLeftWindow) && Vue.unref(LeftWindow), () => {
const n24 = t2$3();
const n23 = Vue.child(n24);
const n22 = Vue.next(n23);
Vue.renderEffect(() => {
const _layoutState = Vue.unref(layoutState);
Vue.setAttr(n24, "data-show", _layoutState.apiShowLeftWindow || void 0);
Vue.setStyle(n24, _layoutState.leftWindowStyle);
});
Vue.setInsertionState(n24, n23);
Vue.createIf(() => Vue.unref(layoutState).apiShowLeftWindow, () => {
const n20 = t1$c();
Vue.on(n20, "click", () => Vue.unref(layoutState).apiShowLeftWindow = false);
return n20;
});
Vue.setInsertionState(n22);
const n21 = Vue.withComponentId("2250de56", () => Vue.createDynamicComponent(() => Vue.unref(LeftWindow), { $: [
() => Vue.unref(windowState)
] }));
Vue.setStaticTemplateRef(n21, leftWindowRef, null, "leftWindowRef");
Vue.applyVShow(n24, () => Vue.unref(layoutState).showLeftWindow || Vue.unref(layoutState).apiShowLeftWindow);
return n24;
});
Vue.setInsertionState(n34, 2);
Vue.createIf(() => Vue.unref(hasRightWindow) && Vue.unref(RightWindow), () => {
const n33 = t3$3();
const n32 = Vue.child(n33);
const n31 = Vue.next(n32);
Vue.renderEffect(() => {
const _layoutState = Vue.unref(layoutState);
Vue.setAttr(n33, "data-show", _layoutState.apiShowRightWindow || void 0);
Vue.setStyle(n33, _layoutState.rightWindowStyle);
});
Vue.setInsertionState(n33, n32);
Vue.createIf(() => Vue.unref(layoutState).apiShowRightWindow, () => {
const n29 = t1$c();
Vue.on(n29, "click", () => Vue.unref(layoutState).apiShowRightWindow = false);
return n29;
});
Vue.setInsertionState(n31);
const n30 = Vue.withComponentId("22500414", () => Vue.createDynamicComponent(() => Vue.unref(RightWindow), { $: [
() => Vue.unref(windowState)
] }));
Vue.setStaticTemplateRef(n30, rightWindowRef, null, "rightWindowRef");
Vue.applyVShow(n33, () => Vue.unref(layoutState).showRightWindow || Vue.unref(layoutState).apiShowRightWindow);
return n33;
});
return n36;
},
() => {
const n38 = Vue.createIf(
() => {
var _a;
return Vue.unref(hasPages) && ((_a = Vue.unref(route)) == null ? void 0 : _a.meta.route);
},
() => {
const n42 = Vue.withComponentId("224ff418", () => Vue.createComponent(Vue.unref(vueRouter.VaporRouterView), { type: () => Vue.unref(isTabBar) ? "tabBar" : "" }, (_slotProps0) => {
const n41 = Vue.withComponentId("224fe654", () => Vue.createComponent(
Vue.VaporKeepAlive,
{
"match-by": "key",
cache: () => Vue.unref(routeCache2)
},
Vue.extend(() => {
const n40 = Vue.withComponentId("224fe510", () => Vue.createDynamicComponent(() => _slotProps0.Component, null, null, 5, () => Vue.unref(routeKey)));
return n40;
}, {
_: 1
/* NON_STABLE */
}),
2
/* SLOT */
));
return n41;
}));
return n42;
},
() => Vue.createIf(() => !Vue.unref(hasPages), () => {
const n44 = Vue.withComponentId("224fdd9c", () => Vue.createDynamicComponent(() => Vue.unref(firstPageComponent)));
return n44;
}),
2317
/* TRUE_SINGLE_ROOT, FALSE_ELSE_IF, KEYED_INDEX_8 */
);
return n38;
},
2057
/* TRUE_SINGLE_ROOT, FALSE_MULTI_ROOT, KEYED_INDEX_7 */
);
Vue.setInsertionState(n49, 1);
Vue.createIf(() => Vue.unref(hasTabBar), () => {
const n48 = Vue.withComponentId("224fd694", () => Vue.createComponent(_sfc_main$w));
Vue.applyVShow(n48, () => Vue.unref(showTabBar));
return n48;
});
Vue.setStaticTemplateRef(n49, rootRef, null, "rootRef");
return n49;
}
});
const t0$u = Vue.template("<div class=uni-async-loading><i class=uni-loading>", 3);
const _sfc_main$u = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "AsyncLoading",
__reserved: true,
compatConfig: { MODE: 3 }
},
__name: "asyncLoading",
setup(__props) {
const n0 = t0$u();
return n0;
}
});
const t0$t = Vue.template("<div class=uni-async-error> ", 1);
const _sfc_main$t = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "AsyncError",
__reserved: true,
compatConfig: { MODE: 3 }
},
__name: "asyncError",
props: ["error"],
setup(__props) {
initI18nAsyncMsgsOnce();
const { t: t12 } = useI18n();
function reload() {
window.location.reload();
}
const n0 = t0$t();
const x0 = Vue.txt(n0);
Vue.on(n0, "click", reload);
Vue.renderEffect(() => Vue.setText(x0, Vue.toDisplayString(Vue.unref(t12)("uni.async.error"))));
return n0;
}
});
let appVm;
let $uniApp;
let uniAppVmMethodNames = /* @__PURE__ */ new Set();
{
class UniAppImpl {
get vm() {
return appVm;
}
get $vm() {
return appVm;
}
get globalData() {
return (appVm == null ? void 0 : appVm.globalData) || {};
}
getAndroidApplication() {
return null;
}
getHarmonyAbility() {
return null;
}
}
const uniApp = new UniAppImpl();
$uniApp = process.env.NODE_ENV !== "production" ? new Proxy(uniApp, {
get(target, key, receiver) {
const value = Reflect.get(target, key, receiver);
if (typeof key === "string" && value === void 0 && uniAppVmMethodNames.has(key)) {
warnUniAppVmMethod(key);
}
return value;
}
}) : uniApp;
}
function getApp$1() {
{
return $uniApp;
}
}
function initApp$1(vm) {
appVm = vm;
if (process.env.NODE_ENV !== "production") {
const initVmMethodWarnings = () => {
uniAppVmMethodNames = initUniAppVmMethodWarnings($uniApp);
};
Vue.onServerPrefetch(initVmMethodWarnings);
}
Object.defineProperty(appVm.$.ctx, "$children", {
get() {
return getCurrentBasePages().map((page) => page.$vm);
}
});
const app = appVm.$.appContext.app;
if (!app.component(_sfc_main$u.name)) {
app.component(_sfc_main$u.name, _sfc_main$u);
}
if (!app.component(_sfc_main$t.name)) {
app.component(_sfc_main$t.name, _sfc_main$t);
}
initAppVm(appVm);
defineGlobalData(appVm);
}
function wrapperComponentSetup(comp, { type, clone, init: init2, setup, before, options }) {
if (clone) {
comp = shared.extend({}, comp);
}
before && before(comp);
const oldSetup = comp.setup;
comp.setup = (props2, ctx) => {
const instance = Vue.getCurrentInstance();
init2(instance.proxy);
setup(instance);
if (oldSetup) {
return oldSetup(props2, ctx);
}
};
if (type === "page" || type === "window") {
const styleIsolation = comp.styleIsolation || (__uniConfig.styleIsolation || {})[comp.__filename];
if (styleIsolation !== "isolated") {
comp.styleIsolation = "app";
}
}
return comp;
}
function setupComponent(comp, options) {
if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
return wrapperComponentSetup(comp.default, options);
}
return wrapperComponentSetup(comp, options);
}
function setupWindow(comp, id2) {
return setupComponent(comp, {
type: "window",
init: (vm) => {
{
vm.$basePage = {
id: id2
};
}
},
setup(instance) {
instance.$pageInstance = instance;
}
});
}
function setupPage(comp, path) {
if (process.env.NODE_ENV !== "production") {
comp.__mpType = "page";
}
if (path) {
comp.__filename = path;
}
return setupComponent(comp, {
type: "page",
clone: true,
// 页面组件可能会被其他地方手动引用,比如 windows 等,需要 clone 一份新的作为页面组件
before(comp2) {
comp2.inheritAttrs = false;
},
init: initPage,
setup(instance) {
instance.$pageInstance = instance;
const route = usePageRoute();
__UNI_FEATURE_PAGES__ ? vueRouter.useRouter() : void 0;
const query = uniShared.decodedQuery(route.query);
instance.__pageQuery = query;
{
const pageInstance = getPageInstanceByChild(instance);
if (isDialogPageInstance(pageInstance)) {
const dialogQuery = uniShared.decodedQuery(
uniShared.parseQuery(
(pageInstance == null ? void 0 : pageInstance.attrs.route).split("?")[1] || ""
)
);
instance.__pageQuery = dialogQuery;
}
}
getPage$BasePage(instance.proxy).options = query;
instance.proxy.options = query;
{
return query;
}
}
});
}
function setupApp(comp) {
if (process.env.NODE_ENV !== "production") {
comp.__mpType = "app";
}
return setupComponent(comp, {
init: initApp$1,
setup(instance) {
const route = usePageRoute();
{
return route.query;
}
},
before(comp2) {
comp2.mpType = "app";
const { setup } = comp2;
const render = () => {
return Vue.createComponent(_sfc_main$v, null, null, true);
};
comp2.setup = (props2, ctx) => {
const res = setup && setup(props2, ctx);
if (shared.isPromise(res)) {
return res.then((value) => value || shared.EMPTY_OBJ);
}
return shared.isFunction(res) ? render : res;
};
comp2.render = render;
}
});
}
function updateDocumentTitle(title) {
{
const ssrContext = getApp$1().$vm.$.appContext.provides[Vue.ssrContextKey];
if (ssrContext) {
ssrContext[uniShared.UNI_SSR_TITLE] = title;
}
}
UniServiceJSBridge.emit(uniShared.ON_NAVIGATION_BAR_CHANGE, { titleText: title });
}
function useDocumentTitle(pageMeta) {
function update() {
updateDocumentTitle(pageMeta.navigationBar.titleText);
}
Vue.watchEffect(update);
}
function updateBackgroundColorContent(backgroundColorContent) {
{
return;
}
}
function useBackgroundColorContent(pageMeta) {
function update() {
if (pageMeta.backgroundColorContent) {
updateBackgroundColorContent(
parseTheme({ backgroundColorContent: pageMeta.backgroundColorContent }).backgroundColorContent
);
}
}
onThemeChange(update);
Vue.watchEffect(update);
}
const _UniLoadingElement = class _UniLoadingElement extends UniViewElement {
};
_UniLoadingElement.__uniElement = {};
let UniLoadingElement = _UniLoadingElement;
function useLoadingStyle(targetElement, bold) {
const loadingSize = Vue.ref("16px");
const loadingBorderWidth = Vue.ref("1px");
Vue.ref("8px");
return {
width: loadingSize,
height: loadingSize,
borderWidth: loadingBorderWidth
// borderRadius: loadingBorderRadius,
};
}
const t0$s = Vue.template('<div uni-loading uni-view data-v-212d40c7 class="default __uni_loading_container__" style="display: flex;"><div uni-view data-v-212d40c7>', 257);
const _uniLoadingElement = { value: "LOADING" };
const _sfc_main$s = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "loading",
styleIsolation: "app-and-page",
// @ts-ignore
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniLoadingElement, "loading")
}
},
__name: "loading",
props: {
paused: { type: Boolean, default: false },
bold: { type: Boolean, default: false },
iosSpinner: { type: Boolean, default: false }
},
setup(__props) {
const props2 = __props;
const LoadingRef = Vue.ref(null);
const loadingStyle = Vue.reactive(useLoadingStyle(LoadingRef, Vue.computed(() => props2.bold)));
const n0 = t0$s();
const n1 = Vue.child(n0);
Vue.initUniElement(n0, _uniLoadingElement);
Vue.setStaticTemplateRef(n0, LoadingRef, null, "LoadingRef");
Vue.renderEffect(() => {
Vue.setClassName(n1, props2.paused ? 1 : 0, " __uni-loading__paused", "__uni-loading__ __loading-4-3__");
Vue.setStyle(n1, loadingStyle);
});
return n0;
}
});
function hexToRgba(hex) {
if (!hex) {
return {
r: 0,
g: 0,
b: 0,
a: 0
};
}
let tmpHex = hex.slice(1);
const tmpHexLen = tmpHex.length;
if (![3, 4, 6, 8].includes(tmpHexLen)) {
return {
r: 0,
g: 0,
b: 0,
a: 0
};
}
if (tmpHexLen === 3 || tmpHexLen === 4) {
tmpHex = tmpHex.replace(/(\w{1})/g, "$1$1");
}
let [sr, sg, sb, sa] = tmpHex.match(/(\w{2})/g);
const r = parseInt(sr, 16), g2 = parseInt(sg, 16), b = parseInt(sb, 16);
if (!sa) {
return { r, g: g2, b, a: 1 };
}
return {
r,
g: g2,
b,
a: (`0x100${sa}` - 65536) / 255
};
}
function usePageHeadTransparentBackgroundColor(backgroundColor) {
const { r, g: g2, b } = hexToRgba(backgroundColor);
return `rgba(${r},${g2},${b},0)`;
}
function usePageHeadTransparent(headRef, {
id: id2,
navigationBar: { titleColor, coverage, backgroundColor }
}) {
Vue.computed(() => hexToRgba(backgroundColor));
}
const t0$r = Vue.template('<div class=uni-page-head-btn><svg width=26 height=26 viewBox="0 0 32 32"><path fill=none stroke-width=2 stroke-linecap=round>');
const t1$b = Vue.template('<svg viewBox="0 0 32 32"><path>', 0, 1);
const t2$2 = Vue.template('<span><i class=uni-btn-icon></i><svg width=14 height=14 viewBox="0 0 32 32"><path fill=none stroke=#000 stroke-width=2 stroke-linecap=round>');
const t3$2 = Vue.template("<i class=uni-btn-icon></i>");
const t4 = Vue.template("<div>");
const t5 = Vue.template("<i class=uni-loading></i>", 2);
const t6 = Vue.template("<img class=uni-page-head__title_image>");
const t7 = Vue.template(" ");
const t8 = Vue.template("<div class=uni-page-head-bd><div class=uni-page-head__title></div>");
const t9 = Vue.template('<div class=uni-page-head-search><div><div class=uni-page-head-search-icon><svg width=20 height=20 viewBox="0 0 32 32"><path></div></div>');
const t10 = Vue.template('<span><i class=uni-btn-icon></i><svg width=14 height=14 viewBox="0 0 32 32"><path fill=#000>');
const t11 = Vue.template("<uni-page-head><div><div class=uni-page-head-hd></div><!><div class=uni-page-head-ft></div></div>", 1);
const _sfc_main$r = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "PageHead",
__reserved: true,
compatConfig: { MODE: 3 }
},
__name: "pageHead",
setup(__props) {
const hasPages = __UNI_FEATURE_PAGES__;
const hasButtons = __UNI_FEATURE_NAVIGATIONBAR_BUTTONS__;
const hasSearchInput = __UNI_FEATURE_NAVIGATIONBAR_SEARCHINPUT__;
const isXVapor = true;
const ICON_PATHS = {
none: "",
forward: "M11 7.844q-0.25-0.219-0.25-0.578t0.25-0.578q0.219-0.25 0.563-0.25t0.563 0.25l9.656 9.125q0.125 0.125 0.188 0.297t0.063 0.328q0 0.188-0.063 0.359t-0.188 0.297l-9.656 9.125q-0.219 0.25-0.563 0.25t-0.563-0.25q-0.25-0.219-0.25-0.578t0.25-0.609l9.063-8.594-9.063-8.594z",
back: ICON_PATH_BACK,
select: ICON_PATH_BACK,
share: "M26.563 24.844q0 0.125-0.109 0.234t-0.234 0.109h-17.938q-0.125 0-0.219-0.109t-0.094-0.234v-13.25q0-0.156 0.094-0.25t0.219-0.094h5.5v-1.531h-6q-0.531 0-0.906 0.391t-0.375 0.922v14.375q0 0.531 0.375 0.922t0.906 0.391h18.969q0.531 0 0.891-0.391t0.359-0.953v-5.156h-1.438v4.625zM29.813 10.969l-5.125-5.375-1.031 1.094 3.438 3.594-3.719 0.031q-2.313 0.188-4.344 1.125t-3.578 2.422-2.5 3.453-1.109 4.188l-0.031 0.25h1.469v-0.219q0.156-1.875 1-3.594t2.25-3.063 3.234-2.125 3.828-0.906l0.188-0.031 3.313-0.031-3.438 3.625 1.031 1.063 5.125-5.375-0.031-0.063 0.031-0.063z",
favorite: "M27.594 13.375q-0.063-0.188-0.219-0.313t-0.344-0.156l-7.094-0.969-3.219-6.406q-0.094-0.188-0.25-0.281t-0.375-0.094q-0.188 0-0.344 0.094t-0.25 0.281l-3.125 6.438-7.094 1.094q-0.188 0.031-0.344 0.156t-0.219 0.313q-0.031 0.188 0.016 0.375t0.172 0.313l5.156 4.969-1.156 7.063q-0.031 0.188 0.047 0.375t0.234 0.313q0.094 0.063 0.188 0.094t0.219 0.031q0.063 0 0.141-0.031t0.172-0.063l6.313-3.375 6.375 3.313q0.063 0.031 0.141 0.047t0.172 0.016q0.188 0 0.344-0.094t0.25-0.281q0.063-0.094 0.078-0.234t-0.016-0.234q0-0.031 0-0.063l-1.25-6.938 5.094-5.031q0.156-0.156 0.203-0.344t-0.016-0.375zM11.469 19.063q0.031-0.188-0.016-0.344t-0.172-0.281l-4.406-4.25 6.063-0.906q0.156-0.031 0.297-0.125t0.203-0.25l2.688-5.531 2.75 5.5q0.063 0.156 0.203 0.25t0.297 0.125l6.094 0.844-4.375 4.281q-0.125 0.125-0.172 0.297t-0.016 0.328l1.063 6.031-5.438-2.813q-0.156-0.094-0.328-0.078t-0.297 0.078l-5.438 2.875 1-6.031z",
home: "M23.719 16.5q-0.313 0-0.531 0.219t-0.219 0.5v7.063q0 0.219-0.172 0.391t-0.391 0.172h-12.344q-0.25 0-0.422-0.172t-0.172-0.391v-7.063q0-0.281-0.219-0.5t-0.531-0.219q-0.281 0-0.516 0.219t-0.234 0.5v7.063q0.031 0.844 0.625 1.453t1.438 0.609h12.375q0.844 0 1.453-0.609t0.609-1.453v-7.063q0-0.125-0.063-0.266t-0.156-0.234q-0.094-0.125-0.234-0.172t-0.297-0.047zM26.5 14.875l-8.813-8.813q-0.313-0.313-0.688-0.453t-0.781-0.141-0.781 0.141-0.656 0.422l-8.813 8.844q-0.188 0.219-0.188 0.516t0.219 0.484q0.094 0.125 0.234 0.172t0.297 0.047q0.125 0 0.25-0.047t0.25-0.141l8.781-8.781q0.156-0.156 0.406-0.156t0.406 0.156l8.813 8.781q0.219 0.188 0.516 0.188t0.516-0.219q0.188-0.188 0.203-0.484t-0.172-0.516z",
menu: "M8.938 18.313q0.875 0 1.484-0.609t0.609-1.453-0.609-1.453-1.484-0.609q-0.844 0-1.453 0.609t-0.609 1.453 0.609 1.453 1.453 0.609zM16.188 18.313q0.875 0 1.484-0.609t0.609-1.453-0.609-1.453-1.484-0.609q-0.844 0-1.453 0.609t-0.609 1.453 0.609 1.453 1.453 0.609zM23.469 18.313q0.844 0 1.453-0.609t0.609-1.453-0.609-1.453-1.453-0.609q-0.875 0-1.484 0.609t-0.609 1.453 0.609 1.453 1.484 0.609z",
close: ICON_PATH_CLOSE
};
const headRef = Vue.ref(null);
const pageMeta = usePageMeta();
const navigationBar = useTheme(pageMeta.navigationBar, () => {
const _navigationBar = parseTheme(pageMeta.navigationBar);
navigationBar.backgroundColor = _navigationBar.backgroundColor;
navigationBar.titleColor = _navigationBar.titleColor;
});
const { clazz, style } = usePageHead(navigationBar);
const buttons = hasButtons && usePageHeadButtons(pageMeta);
const searchInput = hasSearchInput && navigationBar.searchInput && usePageHeadSearchInput(pageMeta);
const searchFocus = searchInput && searchInput.focus;
const searchText = searchInput && searchInput.text;
const searchComposing = searchInput && searchInput.composing;
const searchOnClick = searchInput && searchInput.onClick;
const searchOnFocus = searchInput && searchInput.onFocus;
const searchOnBlur = searchInput && searchInput.onBlur;
const searchOnInput = searchInput && searchInput.onInput;
const searchOnConfirm = searchInput && searchInput.onConfirm;
__UNI_FEATURE_NAVIGATIONBAR_TRANSPARENT__ && navigationBar.type === "transparent" && usePageHeadTransparent(headRef, pageMeta);
function getSvgSize(size) {
return size == null ? 27 : size;
}
function getSvgColor(color) {
return color == null ? "#000" : color;
}
function onPageHeadBackButton() {
if (getCurrentPages().length === 1) {
uni.reLaunch({
url: "/"
});
} else {
uni.navigateBack({
from: "backbutton",
success() {
}
// 传入空方法,避免返回Promise,因为onBackPress可能导致fail
});
}
}
function usePageHead(navigationBar2) {
const clazz2 = Vue.computed(() => {
const { type, titlePenetrate, shadowColorType } = navigationBar2;
const clazz3 = {
"uni-page-head": true,
"uni-page-head-transparent": type === "transparent",
"uni-page-head-titlePenetrate": titlePenetrate === "YES",
"uni-page-head-shadow": !!shadowColorType
};
if (shadowColorType) {
clazz3[`uni-page-head-shadow-${shadowColorType}`] = true;
}
return clazz3;
});
const style2 = Vue.computed(() => {
const backgroundColor = __UNI_FEATURE_NAVIGATIONBAR_TRANSPARENT__ && navigationBar2.type === "transparent" ? usePageHeadTransparentBackgroundColor(navigationBar2.backgroundColor) : navigationBar2.backgroundColor;
return {
backgroundColor,
color: navigationBar2.titleColor,
transitionDuration: navigationBar2.duration,
transitionTimingFunction: navigationBar2.timingFunc
};
});
return { clazz: clazz2, style: style2 };
}
function usePageHeadButtons({ id: id2, navigationBar: navigationBar2 }) {
const left = [];
const right = [];
const { buttons: buttons2 } = navigationBar2;
if (shared.isArray(buttons2)) {
const { type } = navigationBar2;
const isTransparent = type === "transparent";
const fonts = /* @__PURE__ */ Object.create(null);
buttons2.forEach((btn, index2) => {
if (btn.fontSrc && !btn.fontFamily) {
const fontSrc = getRealPath(btn.fontSrc);
let fontFamily = fonts[fontSrc];
if (!fontFamily) {
fontFamily = `font${Date.now()}`;
fonts[fontSrc] = fontFamily;
}
btn.fontFamily = fontFamily;
}
const pageHeadBtn = usePageHeadButton(id2, index2, btn, isTransparent);
if (btn.float === "left") {
left.push(pageHeadBtn);
} else {
right.push(pageHeadBtn);
}
});
}
return { left, right };
}
function usePageHeadButton(pageId, index2, btn, isTransparent) {
const iconStyle = {
color: btn.color,
fontSize: btn.fontSize,
fontWeight: btn.fontWeight
};
if (btn.fontFamily) {
iconStyle.fontFamily = btn.fontFamily;
}
return new Proxy(
{
btnClass: {
"uni-page-head-btn": true,
"uni-page-head-btn-red-dot": !!(btn.redDot || btn.badgeText),
"uni-page-head-btn-select": !!btn.select
},
btnStyle: {
backgroundColor: isTransparent ? btn.background : "transparent",
width: btn.width
},
btnText: "",
btnIconPath: ICON_PATHS[btn.type],
badgeText: btn.badgeText,
iconStyle,
onClick() {
invokeHook(pageId, uniShared.ON_NAVIGATION_BAR_BUTTON_TAP, shared.extend({ index: index2 }, btn));
},
btnSelect: btn.select
},
{
get(target, key, receiver) {
if (["btnText"].includes(key)) {
return btn.fontSrc && btn.fontFamily ? btn.text.replace("\\u", "&#x") : btn.text;
} else {
return Reflect.get(target, key, receiver);
}
}
}
);
}
function usePageHeadSearchInput({
id: id2,
navigationBar: { searchInput: searchInput2 }
}) {
const focus = Vue.ref(false);
const text = Vue.ref("");
const composing = Vue.ref(false);
const { disabled } = searchInput2;
if (disabled) {
const onClick = () => {
invokeHook(id2, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED);
};
return { focus, text, composing, onClick };
}
const onFocus = () => {
focus.value = true;
invokeHook(id2, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, {
focus: true
});
};
const onBlur = () => {
focus.value = false;
invokeHook(id2, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, {
focus: false
});
};
const onInput = (evt) => {
text.value = evt.detail.value;
invokeHook(id2, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, {
text: text.value
});
};
const onConfirm = (evt) => {
invokeHook(id2, uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, {
text: text.value
});
};
return { focus, text, composing, onFocus, onBlur, onInput, onConfirm };
}
const n66 = t11();
const n62 = Vue.child(n66);
const n19 = Vue.child(n62);
const n61 = Vue.next(n19);
const n60 = Vue.next(n61);
Vue.renderEffect(() => {
Vue.setAttr(n66, "uni-page-head-type", Vue.unref(navigationBar).type || "default");
Vue.setClass(n62, Vue.unref(clazz));
Vue.setStyle(n62, Vue.unref(style));
});
Vue.setInsertionState(n19);
Vue.createIf(() => Vue.unref(hasPages) && !Vue.unref(pageMeta).isQuit, () => {
const n3 = t0$r();
const n2 = Vue.child(Vue.child(n3));
Vue.on(n3, "click", onPageHeadBackButton);
Vue.renderEffect(() => {
const _navigationBar = Vue.unref(navigationBar);
Vue.setAttr(n2, "d", Vue.unref(ICON_PATH_BACK), true);
Vue.setAttr(
n2,
"stroke",
_navigationBar.type === "transparent" ? "#fff" : _navigationBar.titleColor,
true
);
});
return n3;
});
Vue.setInsertionState(n19, 1);
Vue.createIf(() => Vue.unref(hasButtons) && Vue.unref(buttons), () => {
const n6 = Vue.createFor(
() => Vue.unref(buttons).left,
(_for_item0, _for_key0) => {
const n18 = t4();
Vue.renderEffect(() => {
const _button = _for_item0.value;
Vue.setClass(n18, _button.btnClass);
Vue.setStyle(n18, _button.btnStyle);
Vue.setAttr(n18, "badge-text", _button.badgeText);
});
Vue.setInsertionState(n18);
Vue.createIf(
() => _for_item0.value.btnIconPath,
() => {
const n11 = t1$b();
const n10 = Vue.child(n11);
Vue.renderEffect(() => {
const _button = _for_item0.value;
const _button_iconStyle = _button.iconStyle;
const _getSvgSize_button_iconStyle_fontSize = getSvgSize(_button_iconStyle.fontSize);
Vue.setAttr(n11, "width", _getSvgSize_button_iconStyle_fontSize, true);
Vue.setAttr(n11, "height", _getSvgSize_button_iconStyle_fontSize, true);
Vue.setAttr(n10, "d", _button.btnIconPath, true);
Vue.setAttr(n10, "fill", getSvgColor(_button_iconStyle.color), true);
});
return n11;
},
() => Vue.createIf(
() => _for_item0.value.btnSelect,
() => {
const n15 = t2$2();
const n13 = Vue.child(n15);
const n14 = Vue.child(Vue.next(n13));
Vue.renderEffect(() => {
const _button = _for_item0.value;
Vue.setStyle(n15, _button.iconStyle);
Vue.setHtml(n13, _button.btnText);
Vue.setAttr(n14, "d", ICON_PATHS.select, true);
});
return n15;
},
() => {
const n17 = t3$2();
Vue.renderEffect(() => {
const _button = _for_item0.value;
Vue.setStyle(n17, _button.iconStyle);
Vue.setHtml(n17, _button.btnText);
});
return n17;
},
773
/* TRUE_SINGLE_ROOT, FALSE_SINGLE_ROOT, KEYED_INDEX_2 */
),
525
/* TRUE_SINGLE_ROOT, FALSE_ELSE_IF, KEYED_INDEX_1 */
);
Vue.on(n18, "click", (e2) => _for_item0.value.onClick(e2));
return n18;
},
(button, index2) => index2,
8
/* IS_SINGLE_NODE */
);
return n6;
});
Vue.setInsertionState(n62, n61);
Vue.createIf(
() => !Vue.unref(hasSearchInput) || !Vue.unref(navigationBar).searchInput,
() => {
const n32 = t8();
const n31 = Vue.child(n32);
Vue.renderEffect(() => {
const _navigationBar = Vue.unref(navigationBar);
Vue.setStyle(n31, {
fontSize: _navigationBar.titleSize,
opacity: _navigationBar.type === "transparent" ? 0 : 1
});
});
Vue.setInsertionState(n31);
Vue.createIf(
() => !Vue.unref(isXVapor) && Vue.unref(navigationBar).loading,
() => {
const n24 = t5();
return n24;
},
() => Vue.createIf(
() => Vue.unref(isXVapor) && Vue.unref(navigationBar).loading,
() => {
const n26 = Vue.withComponentId("96682308", () => Vue.createComponent(Vue.unref(_sfc_main$s), { style: { "display": "inline-block", "width": "20px", "height": "20px", "margin-top": "7px" } }));
return n26;
},
() => Vue.createIf(
() => Vue.unref(navigationBar).titleImage,
() => {
const n28 = t6();
Vue.renderEffect(() => Vue.setProp(n28, "src", Vue.unref(navigationBar).titleImage));
return n28;
},
() => {
const n30 = t7();
Vue.renderEffect(() => Vue.setText(n30, Vue.toDisplayString(Vue.unref(navigationBar).titleText)));
return n30;
},
1801
/* TRUE_SINGLE_ROOT, FALSE_MULTI_ROOT, KEYED_INDEX_6 */
),
1549
/* TRUE_SINGLE_ROOT, FALSE_ELSE_IF, KEYED_INDEX_5 */
),
1293
/* TRUE_SINGLE_ROOT, FALSE_ELSE_IF, KEYED_INDEX_4 */
);
return n32;
},
() => {
const n44 = t9();
const n38 = Vue.child(n44);
const n34 = Vue.child(Vue.child(Vue.child(n38)));
Vue.renderEffect(() => {
const _navigationBar = Vue.unref(navigationBar);
const _navigationBar_searchInput = _navigationBar.searchInput;
Vue.setStyle(n44, {
borderRadius: _navigationBar_searchInput.borderRadius,
backgroundColor: _navigationBar_searchInput.backgroundColor
});
Vue.setStyle(n38, { color: _navigationBar_searchInput.placeholderColor });
Vue.setClass(n38, [
"uni-page-head-search-placeholder",
`uni-page-head-search-placeholder-${Vue.unref(searchFocus) || Vue.unref(searchText) ? "left" : _navigationBar_searchInput.align}`
]);
Vue.setAttr(n34, "d", Vue.unref(ICON_PATH_SEARCH), true);
Vue.setAttr(n34, "fill", _navigationBar_searchInput.placeholderColor, true);
});
Vue.setInsertionState(n38, 1);
Vue.createIf(
() => !(Vue.unref(searchText) || Vue.unref(searchComposing)),
() => {
const n37 = t7();
Vue.renderEffect(() => Vue.setText(n37, Vue.toDisplayString(Vue.unref(navigationBar).searchInput.placeholder)));
return n37;
},
null,
2
/* TRUE_MULTI_ROOT */
);
Vue.setInsertionState(n44, 1);
Vue.createIf(
() => Vue.unref(navigationBar).searchInput.disabled,
() => {
const _on_click = ($event) => Vue.unref(searchOnClick) && Vue.unref(searchOnClick)($event);
const n41 = Vue.withComponentId("96671b3c", () => Vue.createComponent(Vue.unref(Input), {
disabled: true,
style: () => ({ color: Vue.unref(navigationBar).searchInput.color }),
"placeholder-style": () => "color: " + Vue.unref(navigationBar).searchInput.placeholderColor,
class: "uni-page-head-search-input",
"confirm-type": "search",
onClick: () => _on_click
}));
return n41;
},
() => {
const _on_focus = ($event) => Vue.unref(searchOnFocus) && Vue.unref(searchOnFocus)($event);
const _on_blur = ($event) => Vue.unref(searchOnBlur) && Vue.unref(searchOnBlur)($event);
const _on_input = ($event) => Vue.unref(searchOnInput) && Vue.unref(searchOnInput)($event);
const _on_confirm = ($event) => Vue.unref(searchOnConfirm) && Vue.unref(searchOnConfirm)($event);
const n43 = Vue.withComponentId("96665f1e", () => Vue.createComponent(Vue.unref(Input), {
focus: () => Vue.unref(navigationBar).searchInput.autoFocus,
style: () => ({ color: Vue.unref(navigationBar).searchInput.color }),
"placeholder-style": () => "color: " + Vue.unref(navigationBar).searchInput.placeholderColor,
class: "uni-page-head-search-input",
"confirm-type": "search",
onFocus: () => _on_focus,
onBlur: () => _on_blur,
onInput: () => _on_input,
onConfirm: () => _on_confirm
}));
return n43;
},
2565
/* TRUE_SINGLE_ROOT, FALSE_SINGLE_ROOT, KEYED_INDEX_9 */
);
return n44;
},
2053
/* TRUE_SINGLE_ROOT, FALSE_SINGLE_ROOT, KEYED_INDEX_7 */
);
Vue.setInsertionState(n60);
Vue.createIf(() => Vue.unref(hasButtons) && Vue.unref(buttons), () => {
const n47 = Vue.createFor(
() => Vue.unref(buttons).right,
(_for_item0, _for_key0) => {
const n59 = t4();
Vue.renderEffect(() => {
const _button = _for_item0.value;
Vue.setClass(n59, _button.btnClass);
Vue.setStyle(n59, _button.btnStyle);
Vue.setAttr(n59, "badge-text", _button.badgeText);
});
Vue.setInsertionState(n59);
Vue.createIf(
() => _for_item0.value.btnIconPath,
() => {
const n52 = t1$b();
const n51 = Vue.child(n52);
Vue.renderEffect(() => {
const _button = _for_item0.value;
const _button_iconStyle = _button.iconStyle;
const _getSvgSize_button_iconStyle_fontSize = getSvgSize(_button_iconStyle.fontSize);
Vue.setAttr(n52, "width", _getSvgSize_button_iconStyle_fontSize, true);
Vue.setAttr(n52, "height", _getSvgSize_button_iconStyle_fontSize, true);
Vue.setAttr(n51, "d", _button.btnIconPath, true);
Vue.setAttr(n51, "fill", getSvgColor(_button_iconStyle.color), true);
});
return n52;
},
() => Vue.createIf(
() => _for_item0.value.btnSelect,
() => {
const n56 = t10();
const n54 = Vue.child(n56);
const n55 = Vue.child(Vue.next(n54));
Vue.renderEffect(() => {
const _button = _for_item0.value;
Vue.setStyle(n56, _button.iconStyle);
Vue.setHtml(n54, _button.btnText);
Vue.setAttr(n55, "d", ICON_PATHS.select, true);
});
return n56;
},
() => {
const n58 = t3$2();
Vue.renderEffect(() => {
const _button = _for_item0.value;
Vue.setStyle(n58, _button.iconStyle);
Vue.setHtml(n58, _button.btnText);
});
return n58;
},
3077
/* TRUE_SINGLE_ROOT, FALSE_SINGLE_ROOT, KEYED_INDEX_11 */
),
2829
/* TRUE_SINGLE_ROOT, FALSE_ELSE_IF, KEYED_INDEX_10 */
);
Vue.on(n59, "click", (e2) => _for_item0.value.onClick(e2));
return n59;
},
(button, index2) => index2,
8
/* IS_SINGLE_NODE */
);
return n47;
});
Vue.setStaticTemplateRef(n62, headRef, null, "headRef");
Vue.setInsertionState(n66, 1);
Vue.createIf(() => Vue.unref(navigationBar).type !== "transparent" && Vue.unref(navigationBar).type !== "float", () => {
const n65 = t4();
Vue.renderEffect(() => Vue.setClassName(n65, 1 | (Vue.unref(navigationBar).titlePenetrate ? 2 : 0), [" uni-placeholder", " uni-placeholder-titlePenetrate"]));
return n65;
});
return n66;
}
});
const t0$q = Vue.template('<uni-page-refresh><div class=uni-page-refresh><div class=uni-page-refresh-inner><svg class=uni-page-refresh__icon width=24 height=24 viewBox="0 0 24 24"><path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"></path><path d="M0 0h24v24H0z" fill=none></svg><svg class=uni-page-refresh__spinner width=24 height=24 viewBox="25 25 50 50"><circle class=uni-page-refresh__path cx=50 cy=50 r=20 fill=none stroke-width=4 stroke-miterlimit=10>', 1);
const _sfc_main$q = /* @__PURE__ */ Vue.defineVaporComponent({
...{ name: "PageRefresh" },
__name: "component",
setup(__props) {
const { pullToRefresh } = usePageMeta();
const offset = pullToRefresh.offset;
const color = pullToRefresh.color;
const n3 = t0$q();
const n2 = Vue.child(n3);
const n0 = Vue.child(Vue.child(n2));
const n1 = Vue.child(Vue.next(n0));
Vue.renderEffect(() => {
const _color = Vue.unref(color);
Vue.setStyle(n2, { "margin-top": Vue.unref(offset) + "px" });
Vue.setAttr(n0, "fill", _color, true);
Vue.setAttr(n1, "stroke", _color, true);
});
return n3;
}
});
const t0$p = Vue.template("<uni-page-wrapper><uni-page-body>");
const _sfc_main$p = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "PageBody",
__reserved: true,
compatConfig: { MODE: 3 }
},
__name: "pageBody",
__multiRoot: true,
setup(__props) {
const isX = true;
const hasPullDownRefresh = __UNI_FEATURE_PULL_DOWN_REFRESH__;
const pageMeta = hasPullDownRefresh ? usePageMeta() : null;
const refreshRef = Vue.ref(null);
const wrapperRef = Vue.ref(null);
const _pageRefresh = null;
const pageRefresh = Vue.ref(null);
Vue.watch(
() => pageMeta == null ? void 0 : pageMeta.enablePullDownRefresh,
() => {
pageRefresh.value = (pageMeta == null ? void 0 : pageMeta.enablePullDownRefresh) ? _pageRefresh : null;
},
{
immediate: true
}
);
function resize() {
{
return;
}
}
const n0 = Vue.createIf(() => Vue.unref(hasPullDownRefresh) && !!Vue.unref(pageMeta) && (Vue.unref(isX) || !!Vue.unref(pageMeta).enablePullDownRefresh), () => {
const n2 = Vue.withComponentId("2d14e6de", () => Vue.createComponent(_sfc_main$q));
Vue.setStaticTemplateRef(n2, refreshRef, null, "refreshRef");
return n2;
});
const n8 = t0$p();
const n4 = Vue.child(n8);
Vue.renderEffect(() => Vue.setDynamicProps(n8, [pageRefresh.value]));
Vue.setInsertionState(n4);
Vue.createSlot();
Vue.setInsertionState(n8, 1);
Vue.createIf(() => Vue.unref(isX), () => {
const n7 = Vue.withComponentId("3b76aa59", () => Vue.createComponent(Vue.unref(ResizeSensor), { onResize: () => resize }));
return n7;
});
Vue.setStaticTemplateRef(n8, wrapperRef, null, "wrapperRef");
return [n0, n8];
}
});
const t0$o = Vue.template("<uni-page>", 1);
const _sfc_main$o = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "Page",
__reserved: true,
compatConfig: { MODE: 3 }
},
__name: "index-vapor",
setup(__props) {
var _a;
const hasNavigationBar = __UNI_FEATURE_NAVIGATIONBAR__;
const pageStyle = {};
let pageMeta = providePageMeta(getStateId());
const navigationBar = pageMeta.navigationBar;
const currentInstance = Vue.getCurrentInstance();
const attrs2 = currentInstance.attrs;
const routeComponent = currentInstance.type;
const pageComponent = routeComponent.__uniPageComponent;
const pageProps = usePageRoute().query;
useDocumentTitle(pageMeta);
currentInstance.$dialogPages = Vue.ref([]);
currentInstance.$systemDialogPages = Vue.ref([]);
if (isDialogPageInstance(currentInstance)) {
pageMeta.route = attrs2.route;
const routePageMeta = (_a = __uniRoutes.find(
(route) => route.path === pageMeta.route.split("?")[0]
)) == null ? void 0 : _a.meta;
if (routePageMeta) {
routePageMeta.navigationBar = Object.assign(
navigationBar,
routePageMeta.navigationBar
);
pageMeta = Object.assign(pageMeta, routePageMeta);
}
pageMeta.id = createDialogPageId();
if (!(routePageMeta == null ? void 0 : routePageMeta.backgroundColorContent)) {
pageMeta.backgroundColorContent = "transparent";
}
if (!(routePageMeta == null ? void 0 : routePageMeta.navigationBar.style)) {
pageMeta.navigationBar.style = "custom";
}
if (attrs2["data-type"] === SYSTEM_DIALOG_TAG) {
pageMeta.navigationBar.titleText = "";
}
const parentInstance = Vue.inject("parentInstance");
if (currentInstance && parentInstance) {
currentInstance.$parentInstance = parentInstance;
assignDialogPage(currentInstance, parentInstance, currentInstance);
}
} else {
useBackgroundColorContent(pageMeta);
Vue.provide("parentInstance", currentInstance);
}
function getDialogPages() {
const pages = [
...currentInstance.$dialogPages.value.map((page) => ({
page,
type: DIALOG_TAG
})),
...currentInstance.$systemDialogPages.value.map((page) => ({
page,
type: SYSTEM_DIALOG_TAG
}))
];
pages.sort((a, b) => {
var _a2, _b, _c, _d;
const aId = ((_b = (_a2 = a.page.vm) == null ? void 0 : _a2.$basePage) == null ? void 0 : _b.id) || Number.MAX_SAFE_INTEGER;
const bId = ((_d = (_c = b.page.vm) == null ? void 0 : _c.$basePage) == null ? void 0 : _d.id) || Number.MAX_SAFE_INTEGER;
return aId - bId;
});
return pages.map(({ page, type }) => ({
component: page.$component,
type,
route: `${page.route}${uniShared.stringifyQuery(page.options)}`
}));
}
const dialogPageStyle = {
position: "fixed",
zIndex: 999,
top: 0,
right: 0,
bottom: 0,
left: 0
};
function assignDialogPage(ctx, parentInstance, currentInstance2) {
let parentDialogPages = [];
if (isNormalDialogPageInstance(ctx)) {
parentDialogPages = parentInstance.$dialogPages.value;
}
if (isSystemDialogPageInstance(ctx)) {
parentDialogPages = parentInstance.$systemDialogPages.value;
}
if (!parentDialogPages.length)
return;
for (let i = 0; i < parentDialogPages.length; i++) {
const dialogPage = parentDialogPages[i];
if (!dialogPage.$assigned) {
dialogPage.$assigned = true;
currentInstance2.$dialogPage = dialogPage;
break;
}
}
}
const n8 = t0$o();
Vue.renderEffect(() => {
Vue.setAttr(n8, "data-page", Vue.unref(pageMeta).route);
Vue.setStyle(n8, pageStyle);
});
Vue.setInsertionState(n8);
Vue.createIf(() => Vue.unref(hasNavigationBar) && Vue.unref(navigationBar).style !== "custom", () => {
const n2 = Vue.withComponentId("6ae207a0", () => Vue.createComponent(_sfc_main$r));
return n2;
});
Vue.setInsertionState(n8, 1);
Vue.withComponentId("f15f11c4", () => Vue.createComponent(_sfc_main$p, null, Vue.extend(() => {
const n3 = Vue.withComponentId("f15f1178", () => Vue.createDynamicComponent(
() => Vue.unref(pageComponent),
{ $: [
() => Vue.unref(pageProps)
] },
null,
36
/* SLOT_SINGLE_ROOT, SLOT_ROOT */
));
Vue.setStaticTemplateRef(n3, "page");
return n3;
}, {
_: 1
/* NON_STABLE */
})));
Vue.setInsertionState(n8, 2);
Vue.createFor(
() => getDialogPages(),
(_for_item0) => {
const n7 = Vue.withComponentId("f15f0a40-" + _for_item0.value.route, () => Vue.createDynamicComponent(() => _for_item0.value.component, {
style: () => dialogPageStyle,
"data-type": () => _for_item0.value.type,
route: () => _for_item0.value.route
}));
return n7;
},
(dialogPage) => dialogPage.route,
18
/* IS_COMPONENT, IS_FRAGMENT */
);
return n8;
}
});
function createVaporPageRouteComponent(pageComponent) {
return Object.assign({}, _sfc_main$o, {
__uniPageComponent: pageComponent
});
}
var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
var empty = /* @__PURE__ */ makeMap(
"area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"
);
var block = /* @__PURE__ */ makeMap(
"a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video"
);
var inline = /* @__PURE__ */ makeMap(
"abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"
);
var closeSelf = /* @__PURE__ */ makeMap(
"colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"
);
var fillAttrs = /* @__PURE__ */ makeMap(
"checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"
);
var special = /* @__PURE__ */ makeMap("script,style");
function HTMLParser(html, handler) {
var index2;
var chars;
var match;
var stack = [];
var last = html;
stack.last = function() {
return this[this.length - 1];
};
while (html) {
chars = true;
if (!stack.last() || !special[stack.last()]) {
if (html.indexOf("<!--") == 0) {
index2 = html.indexOf("-->");
if (index2 >= 0) {
if (handler.comment) {
handler.comment(html.substring(4, index2));
}
html = html.substring(index2 + 3);
chars = false;
}
} else if (html.indexOf("</") == 0) {
match = html.match(endTag);
if (match) {
html = html.substring(match[0].length);
match[0].replace(endTag, parseEndTag);
chars = false;
}
} else if (html.indexOf("<") == 0) {
match = html.match(startTag);
if (match) {
html = html.substring(match[0].length);
match[0].replace(startTag, parseStartTag);
chars = false;
}
}
if (chars) {
index2 = html.indexOf("<");
var text = index2 < 0 ? html : html.substring(0, index2);
html = index2 < 0 ? "" : html.substring(index2);
if (handler.chars) {
handler.chars(text);
}
}
} else {
html = html.replace(
new RegExp("([\\s\\S]*?)</" + stack.last() + "[^>]*>"),
function(all, text2) {
text2 = text2.replace(
/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g,
"$1$2"
);
if (handler.chars) {
handler.chars(text2);
}
return "";
}
);
parseEndTag("", stack.last());
}
if (html == last) {
throw "Parse Error: " + html;
}
last = html;
}
parseEndTag();
function parseStartTag(tag, tagName, rest, unary) {
tagName = tagName.toLowerCase();
if (block[tagName]) {
while (stack.last() && inline[stack.last()]) {
parseEndTag("", stack.last());
}
}
if (closeSelf[tagName] && stack.last() == tagName) {
parseEndTag("", tagName);
}
unary = empty[tagName] || !!unary;
if (!unary) {
stack.push(tagName);
}
if (handler.start) {
var attrs2 = [];
rest.replace(attr, function(match2, name) {
var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : "";
attrs2.push({
name,
value,
escaped: value.replace(/(^|[^\\])"/g, '$1\\"')
// "
});
});
if (handler.start) {
handler.start(tagName, attrs2, unary);
}
}
}
function parseEndTag(tag, tagName) {
if (!tagName) {
var pos = 0;
} else {
for (var pos = stack.length - 1; pos >= 0; pos--) {
if (stack[pos] == tagName) {
break;
}
}
}
if (pos >= 0) {
for (var i = stack.length - 1; i >= pos; i--) {
if (handler.end) {
handler.end(stack[i]);
}
}
stack.length = pos;
}
}
}
function makeMap(str) {
var obj = {};
var items = str.split(",");
for (var i = 0; i < items.length; i++) {
obj[items[i]] = true;
}
return obj;
}
function useQuill(props2, rootRef, trigger) {
Vue.watch(
() => props2.readOnly,
(value) => {
}
);
Vue.watch(
() => props2.placeholder,
(value) => {
}
);
Vue.watch(
() => props2.type,
(value) => {
}
);
useContextInfo();
useSubscribe();
}
const editorProps = /* @__PURE__ */ shared.extend({}, props$a, {
id: {
type: String,
default: ""
},
readOnly: {
type: [Boolean, String],
default: false
},
type: {
type: String,
default: ""
},
placeholder: {
type: String,
default: ""
},
showImgSize: {
type: [Boolean, String],
default: false
},
showImgToolbar: {
type: [Boolean, String],
default: false
},
showImgResize: {
type: [Boolean, String],
default: false
}
});
const editorEmit = [
"ready",
"focus",
"blur",
"input",
"statuschange",
...emit$1
];
function useEditor(props2, emit2) {
const rootRef = Vue.ref(null);
useQuill(props2);
useKeyboard(props2, rootRef);
return rootRef;
}
const _t0$a = Vue.template("<div uni-editor uni-view class=ql-container>", 1);
class UniEditorElement extends UniViewElement {
static [Symbol.hasInstance](value) {
return this === UniEditorElement && value instanceof UniViewElement && value.hasAttribute("uni-editor") || Function.prototype[Symbol.hasInstance].call(this, value);
}
}
const uniTagName$8 = { value: "EDITOR" };
const indexVapor$8 = /* @__PURE__ */ defineBuiltInComponent({
name: "Editor",
props: editorProps,
emits: editorEmit,
rootElement: {
name: "uni-editor",
class: UniEditorElement
},
setup(props2, { emit: emit2 }) {
const rootRef = useEditor(props2);
const root = (() => {
const _setTemplateRef = Vue.createTemplateRefSetter();
const _n0 = _t0$a();
Vue.renderEffect(() => {
Vue.setProp(_n0, "id", props2.id);
_setTemplateRef(_n0, rootRef);
});
return _n0;
})();
Object.defineProperty(root, "uniTagName", uniTagName$8);
return root;
}
});
const INFO_COLOR = "#10aeff";
const WARN_COLOR = "#f76260";
const GREY_COLOR = "#b2b2b2";
const CANCEL_COLOR = "#f43530";
const ICONS = {
success: {
d: ICON_PATH_SUCCESS,
c: uniShared.PRIMARY_COLOR
},
success_no_circle: {
d: ICON_PATH_SUCCESS_NO_CIRCLE,
c: uniShared.PRIMARY_COLOR
},
info: {
d: ICON_PATH_INFO,
c: INFO_COLOR
},
warn: {
d: ICON_PATH_WARN,
c: WARN_COLOR
},
waiting: {
d: ICON_PATH_WAITING,
c: INFO_COLOR
},
cancel: {
d: ICON_PATH_CANCEL,
c: CANCEL_COLOR
},
download: {
d: ICON_PATH_DOWNLOAD,
c: uniShared.PRIMARY_COLOR
},
search: {
d: ICON_PATH_SEARCH,
c: GREY_COLOR
},
clear: {
d: ICON_PATH_CLEAR,
c: GREY_COLOR
}
};
const iconProps = {
type: {
type: String,
required: true,
default: ""
},
size: {
type: [String, Number],
default: 23
},
color: {
type: String,
default: ""
}
};
function useIcon(props2) {
return Vue.computed(() => ICONS[props2.type]);
}
const _t0$9 = Vue.template("<div uni-icon uni-view> ", 1);
class UniIconElement extends UniViewElement {
static [Symbol.hasInstance](value) {
return this === UniIconElement && value instanceof UniViewElement && value.hasAttribute("uni-icon") || Function.prototype[Symbol.hasInstance].call(this, value);
}
}
const uniTagName$7 = { value: "ICON" };
const indexVapor$7 = /* @__PURE__ */ defineBuiltInComponent({
name: "Icon",
props: iconProps,
rootElement: {
name: "uni-icon",
class: UniIconElement
},
setup(props2) {
const path = useIcon(props2);
const root = (() => {
const _n0 = _t0$9();
const _x0 = Vue.txt(_n0);
setNodes(_x0, () => path.value && path.value.d && createSvgIconVNode(path.value.d, props2.color || path.value.c, rpx2px(props2.size)));
return _n0;
})();
Object.defineProperty(root, "uniTagName", uniTagName$7);
return root;
}
});
const movableAreaProps = {
scaleArea: {
type: Boolean,
default: false
}
};
function useMovableAreaChildren$1(rootRef, slots, setContexts) {
const contexts = [];
setContexts(contexts);
const add = (context) => {
var _a;
if (((_a = context.rootRef.value) == null ? void 0 : _a.parentElement) === rootRef.value) {
contexts.push(Vue.markRaw(context));
}
};
const remove = (context) => {
const index2 = contexts.indexOf(context);
if (index2 >= 0) {
contexts.splice(index2, 1);
}
};
Vue.provide("addMovableViewContext", add);
Vue.provide("removeMovableViewContext", remove);
return () => slots.default && slots.default();
}
const useMovableAreaChildren = useMovableAreaChildren$1;
function useMovableArea(props2, slots) {
const rootRef = Vue.ref(null);
const _isMounted = Vue.ref(false);
let { setContexts, events: movableAreaEvents } = useMovableAreaState(
props2,
rootRef
);
const { $listeners, $attrs, $excludeAttrs } = useAttrs();
const _listeners = $listeners.value;
let events = ["onTouchstart", "onTouchmove", "onTouchend"];
events.forEach((event) => {
let existing = _listeners[event];
let ours = movableAreaEvents[`_${event}`];
_listeners[event] = existing ? [].concat(existing, ours) : ours;
});
const renderChildren = useMovableAreaChildren(rootRef, slots, setContexts);
Vue.provide("_isMounted", _isMounted);
Vue.provide("movableAreaRootRef", rootRef);
return {
rootRef,
renderChildren,
movableAreaEvents,
$attrs,
$excludeAttrs,
_listeners
};
}
function calc(e2) {
return Math.sqrt(e2.x * e2.x + e2.y * e2.y);
}
function useMovableAreaState(props2, rootRef) {
const width = Vue.ref(0);
const height = Vue.ref(0);
const gapV = Vue.reactive({
x: null,
y: null
});
const pinchStartLen = Vue.ref(null);
let _scaleMovableView = null;
let movableViewContexts = [];
function _updateScale(e2) {
if (e2 && e2 !== 1) {
if (props2.scaleArea) {
movableViewContexts.forEach(function(item) {
item._setScale(e2);
});
} else {
if (_scaleMovableView) {
_scaleMovableView._setScale(e2);
}
}
}
}
function _find(target, items = movableViewContexts) {
let root = rootRef.value;
function get(node) {
for (let i = 0; i < items.length; i++) {
const item = items[i];
if (node === item.rootRef.value) {
return item;
}
}
if (node === root || node === document.body || node === document) {
return null;
}
return get(node.parentNode);
}
return get(target);
}
const _onTouchstart = withWebEvent((t12) => {
let i = t12.touches;
if (i) {
if (i.length > 1) {
let r = {
x: i[1].pageX - i[0].pageX,
y: i[1].pageY - i[0].pageY
};
pinchStartLen.value = calc(r);
gapV.x = r.x;
gapV.y = r.y;
if (!props2.scaleArea) {
let touch0 = _find(i[0].target);
let touch1 = _find(i[1].target);
_scaleMovableView = touch0 && touch0 === touch1 ? touch0 : null;
}
}
}
});
const _onTouchmove = withWebEvent((t12) => {
let n = t12.touches;
if (n) {
if (n.length > 1) {
t12.preventDefault();
let i = {
x: n[1].pageX - n[0].pageX,
y: n[1].pageY - n[0].pageY
};
if (gapV.x !== null && pinchStartLen.value && pinchStartLen.value > 0) {
let r = calc(i) / pinchStartLen.value;
_updateScale(r);
}
gapV.x = i.x;
gapV.y = i.y;
}
}
});
const _onTouchend = withWebEvent((e2) => {
let t12 = e2.touches;
if (!(t12 && t12.length)) {
if (e2.changedTouches) {
gapV.x = 0;
gapV.y = 0;
pinchStartLen.value = null;
if (props2.scaleArea) {
movableViewContexts.forEach(function(item) {
item._endScale();
});
} else {
if (_scaleMovableView) {
_scaleMovableView._endScale();
}
}
}
}
});
function _resize() {
_getWH();
movableViewContexts.forEach(function(item, index2) {
item.setParent();
});
}
function _getWH() {
let style = window.getComputedStyle(rootRef.value);
let rect = rootRef.value.getBoundingClientRect();
width.value = rect.width - ["Left", "Right"].reduce(function(all, item) {
const LEFT = "border" + item + "Width";
const RIGHT = "padding" + item;
return all + parseFloat(style[LEFT]) + parseFloat(style[RIGHT]);
}, 0);
height.value = rect.height - ["Top", "Bottom"].reduce(function(all, item) {
const TOP = "border" + item + "Width";
const BOTTOM = "padding" + item;
return all + parseFloat(style[TOP]) + parseFloat(style[BOTTOM]);
}, 0);
}
Vue.provide("movableAreaWidth", width);
Vue.provide("movableAreaHeight", height);
return {
setContexts(contexts) {
movableViewContexts = contexts;
},
events: {
_onTouchstart,
_onTouchmove,
_onTouchend,
_resize
}
};
}
const _t0$8 = Vue.template("<div><!> ", 1);
class UniMovableAreaElement extends UniViewElement {
static [Symbol.hasInstance](value) {
return this === UniMovableAreaElement && value instanceof UniViewElement && value.hasAttribute("uni-movable-area") || Function.prototype[Symbol.hasInstance].call(this, value);
}
}
const uniTagName$6 = { value: "MOVABLE-AREA" };
const indexVapor$6 = /* @__PURE__ */ defineBuiltInComponent({
inheritAttrs: false,
name: "MovableArea",
props: movableAreaProps,
rootElement: {
name: "uni-movable-area",
class: UniMovableAreaElement
},
setup(props2, { slots }) {
const { rootRef, renderChildren, movableAreaEvents, $attrs, $excludeAttrs, _listeners } = useMovableArea(props2, slots);
const movableViewItems = renderChildren();
const root = (() => {
const _setTemplateRef = Vue.createTemplateRefSetter();
const _n3 = _t0$8();
const _n2 = Vue.child(_n3);
const _n1 = Vue.next(_n2, true);
Vue.renderEffect(() => Vue.setDynamicProps(_n3, [
{
"uni-movable-area": "",
"uni-view": ""
},
$attrs.value,
$excludeAttrs.value,
_listeners
]));
Vue.setInsertionState(_n3, _n2);
createComponent(ResizeSensor, { onResize: () => movableAreaEvents._resize });
setNodes(_n1, () => movableViewItems);
Vue.renderEffect(() => _setTemplateRef(_n3, rootRef));
return _n3;
})();
Object.defineProperty(root, "uniTagName", uniTagName$6);
return root;
}
});
function e(e2, t12, n) {
return e2 > t12 - n && e2 < t12 + n;
}
function t(t12, n) {
return e(t12, 0, n);
}
function Friction(e2, t12) {
this._m = e2;
this._f = 1e3 * t12;
this._startTime = 0;
this._v = 0;
}
Friction.prototype.setV = function(x, y) {
const n = Math.pow(Math.pow(x, 2) + Math.pow(y, 2), 0.5);
this._x_v = x;
this._y_v = y;
this._x_a = -this._f * this._x_v / n;
this._y_a = -this._f * this._y_v / n;
this._t = Math.abs(x / this._x_a) || Math.abs(y / this._y_a);
this._lastDt = null;
this._startTime = (/* @__PURE__ */ new Date()).getTime();
};
Friction.prototype.setS = function(x, y) {
this._x_s = x;
this._y_s = y;
};
Friction.prototype.s = function(t12) {
if (void 0 === t12) {
t12 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
if (t12 > this._t) {
t12 = this._t;
this._lastDt = t12;
}
let x = this._x_v * t12 + 0.5 * this._x_a * Math.pow(t12, 2) + this._x_s;
let y = this._y_v * t12 + 0.5 * this._y_a * Math.pow(t12, 2) + this._y_s;
if (this._x_a > 0 && x < this._endPositionX || this._x_a < 0 && x > this._endPositionX) {
x = this._endPositionX;
}
if (this._y_a > 0 && y < this._endPositionY || this._y_a < 0 && y > this._endPositionY) {
y = this._endPositionY;
}
return {
x,
y
};
};
Friction.prototype.ds = function(t12) {
if (void 0 === t12) {
t12 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
if (t12 > this._t) {
t12 = this._t;
}
return {
dx: this._x_v + this._x_a * t12,
dy: this._y_v + this._y_a * t12
};
};
Friction.prototype.delta = function() {
return {
x: -1.5 * Math.pow(this._x_v, 2) / this._x_a || 0,
y: -1.5 * Math.pow(this._y_v, 2) / this._y_a || 0
};
};
Friction.prototype.dt = function() {
return -this._x_v / this._x_a;
};
Friction.prototype.done = function() {
const t12 = e(this.s().x, this._endPositionX) || e(this.s().y, this._endPositionY) || this._lastDt === this._t;
this._lastDt = null;
return t12;
};
Friction.prototype.setEnd = function(x, y) {
this._endPositionX = x;
this._endPositionY = y;
};
Friction.prototype.reconfigure = function(m, f2) {
this._m = m;
this._f = 1e3 * f2;
};
function Spring(m, k, c) {
this._m = m;
this._k = k;
this._c = c;
this._solution = null;
this._endPosition = 0;
this._startTime = 0;
}
Spring.prototype._solve = function(e2, t12) {
const n = this._c;
const i = this._m;
const r = this._k;
const o = n * n - 4 * i * r;
if (o === 0) {
const a = -n / (2 * i);
const s = e2;
const l = t12 / (a * e2);
return {
x: function(e3) {
return (s + l * e3) * Math.pow(Math.E, a * e3);
},
dx: function(e3) {
const t13 = Math.pow(Math.E, a * e3);
return a * (s + l * e3) * t13 + l * t13;
}
};
}
if (o > 0) {
const c = (-n - Math.sqrt(o)) / (2 * i);
const u = (-n + Math.sqrt(o)) / (2 * i);
const d = (t12 - c * e2) / (u - c);
const h = e2 - d;
return {
x: function(e3) {
let t13;
let n2;
if (e3 === this._t) {
t13 = this._powER1T;
n2 = this._powER2T;
}
this._t = e3;
if (!t13) {
t13 = this._powER1T = Math.pow(Math.E, c * e3);
}
if (!n2) {
n2 = this._powER2T = Math.pow(Math.E, u * e3);
}
return h * t13 + d * n2;
},
dx: function(e3) {
let t13;
let n2;
if (e3 === this._t) {
t13 = this._powER1T;
n2 = this._powER2T;
}
this._t = e3;
if (!t13) {
t13 = this._powER1T = Math.pow(Math.E, c * e3);
}
if (!n2) {
n2 = this._powER2T = Math.pow(Math.E, u * e3);
}
return h * c * t13 + d * u * n2;
}
};
}
const p2 = Math.sqrt(4 * i * r - n * n) / (2 * i);
const f2 = -n / 2 * i;
const v2 = e2;
const g2 = (t12 - f2 * e2) / p2;
return {
x: function(e3) {
return Math.pow(Math.E, f2 * e3) * (v2 * Math.cos(p2 * e3) + g2 * Math.sin(p2 * e3));
},
dx: function(e3) {
const t13 = Math.pow(Math.E, f2 * e3);
const n2 = Math.cos(p2 * e3);
const i2 = Math.sin(p2 * e3);
return t13 * (g2 * p2 * n2 - v2 * p2 * i2) + f2 * t13 * (g2 * i2 + v2 * n2);
}
};
};
Spring.prototype.x = function(e2) {
if (void 0 === e2) {
e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
return this._solution ? this._endPosition + this._solution.x(e2) : 0;
};
Spring.prototype.dx = function(e2) {
if (void 0 === e2) {
e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
return this._solution ? this._solution.dx(e2) : 0;
};
Spring.prototype.setEnd = function(e2, n, i) {
if (!i) {
i = (/* @__PURE__ */ new Date()).getTime();
}
if (e2 !== this._endPosition || !t(n, 0.1)) {
n = n || 0;
let r = this._endPosition;
if (this._solution) {
if (t(n, 0.1)) {
n = this._solution.dx((i - this._startTime) / 1e3);
}
r = this._solution.x((i - this._startTime) / 1e3);
if (t(n, 0.1)) {
n = 0;
}
if (t(r, 0.1)) {
r = 0;
}
r += this._endPosition;
}
if (!(this._solution && t(r - e2, 0.1) && t(n, 0.1))) {
this._endPosition = e2;
this._solution = this._solve(r - this._endPosition, n);
this._startTime = i;
}
}
};
Spring.prototype.snap = function(e2) {
this._startTime = (/* @__PURE__ */ new Date()).getTime();
this._endPosition = e2;
this._solution = {
x: function() {
return 0;
},
dx: function() {
return 0;
}
};
};
Spring.prototype.done = function(n) {
if (!n) {
n = (/* @__PURE__ */ new Date()).getTime();
}
return e(this.x(), this._endPosition, 0.1) && t(this.dx(), 0.1);
};
Spring.prototype.reconfigure = function(m, t12, c) {
this._m = m;
this._k = t12;
this._c = c;
if (!this.done()) {
this._solution = this._solve(this.x() - this._endPosition, this.dx());
this._startTime = (/* @__PURE__ */ new Date()).getTime();
}
};
Spring.prototype.springConstant = function() {
return this._k;
};
Spring.prototype.damping = function() {
return this._c;
};
Spring.prototype.configuration = function() {
function e2(e3, t13) {
e3.reconfigure(1, t13, e3.damping());
}
function t12(e3, t13) {
e3.reconfigure(1, e3.springConstant(), t13);
}
return [
{
label: "Spring Constant",
read: this.springConstant.bind(this),
write: e2.bind(this, this),
min: 100,
max: 1e3
},
{
label: "Damping",
read: this.damping.bind(this),
write: t12.bind(this, this),
min: 1,
max: 500
}
];
};
function STD(e2, t12, n) {
this._springX = new Spring(e2, t12, n);
this._springY = new Spring(e2, t12, n);
this._springScale = new Spring(e2, t12, n);
this._startTime = 0;
}
STD.prototype.setEnd = function(e2, t12, n, i) {
const r = (/* @__PURE__ */ new Date()).getTime();
this._springX.setEnd(e2, i, r);
this._springY.setEnd(t12, i, r);
this._springScale.setEnd(n, i, r);
this._startTime = r;
};
STD.prototype.x = function() {
const e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
return {
x: this._springX.x(e2),
y: this._springY.x(e2),
scale: this._springScale.x(e2)
};
};
STD.prototype.done = function() {
const e2 = (/* @__PURE__ */ new Date()).getTime();
return this._springX.done(e2) && this._springY.done(e2) && this._springScale.done(e2);
};
STD.prototype.reconfigure = function(e2, t12, n) {
this._springX.reconfigure(e2, t12, n);
this._springY.reconfigure(e2, t12, n);
this._springScale.reconfigure(e2, t12, n);
};
const movableViewProps = {
direction: {
type: String,
default: "none"
},
inertia: {
type: [Boolean, String],
default: false
},
outOfBounds: {
type: [Boolean, String],
default: false
},
x: {
type: [Number, String],
default: 0
},
y: {
type: [Number, String],
default: 0
},
damping: {
type: [Number, String],
default: 20
},
friction: {
type: [Number, String],
default: 2
},
disabled: {
type: [Boolean, String],
default: false
},
scale: {
type: [Boolean, String],
default: false
},
scaleMin: {
type: [Number, String],
default: 0.1
},
scaleMax: {
type: [Number, String],
default: 10
},
scaleValue: {
type: [Number, String],
default: 1
},
animation: {
type: [Boolean, String],
default: true
}
};
function v(a, b) {
return +((1e3 * a - 1e3 * b) / 1e3).toFixed(1);
}
function useMovableViewFrame() {
let frame;
let pending;
function run() {
const callback = pending;
frame = void 0;
pending = void 0;
callback == null ? void 0 : callback();
}
function cancel() {
if (frame !== void 0)
cancelAnimationFrame(frame);
frame = void 0;
pending = void 0;
}
function flush() {
if (frame !== void 0)
cancelAnimationFrame(frame);
run();
}
return {
request(callback) {
pending = callback;
if (frame === void 0)
frame = requestAnimationFrame(run);
},
flush,
cancel
};
}
function useMovableView(props2, emit2) {
const rootRef = Vue.ref(null);
const trigger = useCustomEvent(rootRef, emit2);
const { setParent } = useMovableViewState(props2, trigger, rootRef);
return { rootRef, setParent };
}
function p(t12, n) {
if (t12 === n) {
return 0;
}
let i = t12.offsetLeft;
return t12.offsetParent ? i += p(t12.offsetParent, n) : 0;
}
function f(t12, n) {
if (t12 === n) {
return 0;
}
let i = t12.offsetTop;
return t12.offsetParent ? i += f(t12.offsetParent, n) : 0;
}
function g(friction, execute, endCallback) {
let record = {
id: 0,
cancelled: false
};
let cancel = function(record2) {
if (record2 && record2.id) {
cancelAnimationFrame(record2.id);
}
if (record2) {
record2.cancelled = true;
}
};
function fn(record2, friction2, execute2, endCallback2) {
if (!record2 || !record2.cancelled) {
execute2(friction2);
let isDone = friction2.done();
if (!isDone) {
if (!record2.cancelled) {
record2.id = requestAnimationFrame(
fn.bind(null, record2, friction2, execute2, endCallback2)
);
}
}
if (isDone && endCallback2) {
endCallback2(friction2);
}
}
}
fn(record, friction, execute, endCallback);
return {
cancel: cancel.bind(null, record),
model: friction
};
}
function _getPx(val) {
if (/\d+[ur]px$/i.test(val)) {
return uni.upx2px(parseFloat(val));
}
return Number(val) || 0;
}
function useMovableViewLayout(rootRef, _scale, _adjustScale) {
const movableAreaWidth = Vue.inject("movableAreaWidth", Vue.ref(0));
const movableAreaHeight = Vue.inject("movableAreaHeight", Vue.ref(0));
const movableAreaRootRef = Vue.inject("movableAreaRootRef");
const _offset = {
x: 0,
y: 0
};
const _scaleOffset = {
x: 0,
y: 0
};
const width = Vue.ref(0);
const height = Vue.ref(0);
const minX = Vue.ref(0);
const minY = Vue.ref(0);
const maxX = Vue.ref(0);
const maxY = Vue.ref(0);
function _updateBoundary() {
let x = 0 - _offset.x + _scaleOffset.x;
let _width = movableAreaWidth.value - width.value - _offset.x - _scaleOffset.x;
minX.value = Math.min(x, _width);
maxX.value = Math.max(x, _width);
let y = 0 - _offset.y + _scaleOffset.y;
let _height = movableAreaHeight.value - height.value - _offset.y - _scaleOffset.y;
minY.value = Math.min(y, _height);
maxY.value = Math.max(y, _height);
}
function _updateOffset() {
_offset.x = p(rootRef.value, movableAreaRootRef.value);
_offset.y = f(rootRef.value, movableAreaRootRef.value);
}
function _updateWH(scale) {
scale = scale || _scale.value;
scale = _adjustScale(scale);
let rect = rootRef.value.getBoundingClientRect();
height.value = rect.height / _scale.value;
width.value = rect.width / _scale.value;
let _height = height.value * scale;
let _width = width.value * scale;
_scaleOffset.x = (_width - width.value) / 2;
_scaleOffset.y = (_height - height.value) / 2;
}
return {
_updateBoundary,
_updateOffset,
_updateWH,
_scaleOffset,
minX,
minY,
maxX,
maxY
};
}
function useMovableViewTransform(rootRef, props2, _scaleOffset, _scale, maxX, maxY, minX, minY, _translateX, _translateY, _SFA, _FA, _adjustScale, trigger) {
const frame = useMovableViewFrame();
const dampingNumber = Vue.computed(() => {
let val = Number(props2.damping);
return isNaN(val) ? 20 : val;
});
const xMove = Vue.computed(
() => props2.direction === "all" || props2.direction === "horizontal"
);
const yMove = Vue.computed(
() => props2.direction === "all" || props2.direction === "vertical"
);
const xSync = Vue.ref(_getPx(props2.x));
const ySync = Vue.ref(_getPx(props2.y));
Vue.watch(
() => props2.x,
(val) => {
xSync.value = _getPx(val);
}
);
Vue.watch(
() => props2.y,
(val) => {
ySync.value = _getPx(val);
}
);
Vue.watch(xSync, (val) => {
_setX(val);
});
Vue.watch(ySync, (val) => {
_setY(val);
});
const _STD = new STD(
1,
9 * Math.pow(dampingNumber.value, 2) / 40,
dampingNumber.value
);
function _getLimitXY(x, y) {
let outOfBounds = false;
if (x > maxX.value) {
x = maxX.value;
outOfBounds = true;
} else {
if (x < minX.value) {
x = minX.value;
outOfBounds = true;
}
}
if (y > maxY.value) {
y = maxY.value;
outOfBounds = true;
} else {
if (y < minY.value) {
y = minY.value;
outOfBounds = true;
}
}
return {
x,
y,
outOfBounds
};
}
function FAandSFACancel() {
frame.cancel();
if (_SFA) {
_SFA.cancel();
}
}
function _animationTo(x, y, scale, source, r, o) {
FAandSFACancel();
if (!xMove.value) {
x = _translateX.value;
}
if (!yMove.value) {
y = _translateY.value;
}
if (!props2.scale) {
scale = _scale.value;
}
let limitXY = _getLimitXY(x, y);
x = limitXY.x;
y = limitXY.y;
if (!props2.animation) {
_setTransform(x, y, scale, source, r, o);
return;
}
_STD._springX._solution = null;
_STD._springY._solution = null;
_STD._springScale._solution = null;
_STD._springX._endPosition = _translateX.value;
_STD._springY._endPosition = _translateY.value;
_STD._springScale._endPosition = _scale.value;
_STD.setEnd(x, y, scale, 1);
_SFA = g(
_STD,
function() {
let data = _STD.x();
let x2 = data.x;
let y2 = data.y;
let scale2 = data.scale;
_setTransform(x2, y2, scale2, source, r, o);
},
function() {
_SFA.cancel();
}
);
}
function _setTransform(x, y, scale, source = "", r, o) {
if (!(x !== null && x.toString() !== "NaN" && typeof x === "number")) {
x = _translateX.value || 0;
}
if (!(y !== null && y.toString() !== "NaN" && typeof y === "number")) {
y = _translateY.value || 0;
}
x = Number(x.toFixed(1));
y = Number(y.toFixed(1));
scale = Number(scale.toFixed(1));
if (!(_translateX.value === x && _translateY.value === y)) {
if (!r) {
trigger("change", {}, {
x: v(x, _scaleOffset.x),
y: v(y, _scaleOffset.y),
source
});
}
}
if (!props2.scale) {
scale = _scale.value;
}
scale = _adjustScale(scale);
scale = +scale.toFixed(3);
if (o && scale !== _scale.value) {
trigger("scale", {}, {
x,
y,
scale
});
}
let transform = "translateX(" + x + "px) translateY(" + y + "px) translateZ(0px) scale(" + scale + ")";
if (rootRef.value) {
rootRef.value.style.transform = transform;
rootRef.value.style.webkitTransform = transform;
_translateX.value = x;
_translateY.value = y;
_scale.value = scale;
}
}
function _revise(source) {
let limitXY = _getLimitXY(_translateX.value, _translateY.value);
let x = limitXY.x;
let y = limitXY.y;
let outOfBounds = limitXY.outOfBounds;
if (outOfBounds) {
_animationTo(x, y, _scale.value, source);
}
return outOfBounds;
}
function _setX(val) {
if (xMove.value) {
if (val + _scaleOffset.x === _translateX.value) {
return _translateX;
} else {
if (_SFA) {
_SFA.cancel();
}
_animationTo(
val + _scaleOffset.x,
ySync.value + _scaleOffset.y,
_scale.value
);
}
}
return val;
}
function _setY(val) {
if (yMove.value) {
if (val + _scaleOffset.y === _translateY.value) {
return _translateY;
} else {
if (_SFA) {
_SFA.cancel();
}
_animationTo(
xSync.value + _scaleOffset.x,
val + _scaleOffset.y,
_scale.value
);
}
}
return val;
}
return {
frame,
FAandSFACancel,
_getLimitXY,
_animationTo,
_setTransform,
_revise,
dampingNumber,
xMove,
yMove,
xSync,
ySync,
_STD
};
}
function useMovableViewInit(props2, rootRef, trigger, _scale, _oldScale, _isScaling, _translateX, _translateY, _SFA, _FA) {
const scaleMinNumber = Vue.computed(() => {
let val = Number(props2.scaleMin);
return isNaN(val) ? 0.1 : val;
});
const scaleMaxNumber = Vue.computed(() => {
let val = Number(props2.scaleMax);
return isNaN(val) ? 10 : val;
});
const scaleValueSync = Vue.ref(Number(props2.scaleValue) || 1);
Vue.watch(scaleValueSync, (val) => {
_setScaleValue(val);
});
Vue.watch(scaleMinNumber, () => {
_setScaleMinOrMax();
});
Vue.watch(scaleMaxNumber, () => {
_setScaleMinOrMax();
});
Vue.watch(
() => props2.scaleValue,
(val) => {
scaleValueSync.value = Number(val) || 0;
}
);
const {
_updateBoundary,
_updateOffset,
_updateWH,
_scaleOffset,
minX,
minY,
maxX,
maxY
} = useMovableViewLayout(rootRef, _scale, _adjustScale);
const {
frame,
FAandSFACancel,
_getLimitXY,
_animationTo,
_setTransform,
_revise,
dampingNumber,
xMove,
yMove,
xSync,
ySync,
_STD
} = useMovableViewTransform(
rootRef,
props2,
_scaleOffset,
_scale,
maxX,
maxY,
minX,
minY,
_translateX,
_translateY,
_SFA,
_FA,
_adjustScale,
trigger
);
const _requestAnimationFrame2 = frame.request;
function _updateScale(scale, animat) {
if (props2.scale) {
scale = _adjustScale(scale);
_updateWH(scale);
_updateBoundary();
const limitXY = _getLimitXY(_translateX.value, _translateY.value);
const x = limitXY.x;
const y = limitXY.y;
if (animat) {
_animationTo(x, y, scale, "", true, true);
} else {
_requestAnimationFrame2(function() {
_setTransform(x, y, scale, "", true, true);
});
}
}
}
function _beginScale() {
_isScaling.value = true;
}
function _updateOldScale(scale) {
_oldScale.value = scale;
}
function _adjustScale(scale) {
scale = Math.max(0.1, scaleMinNumber.value, scale);
scale = Math.min(10, scaleMaxNumber.value, scale);
return scale;
}
function _setScaleMinOrMax() {
if (!props2.scale) {
return false;
}
_updateScale(_scale.value, true);
_updateOldScale(_scale.value);
}
function _setScaleValue(scale) {
if (!props2.scale) {
return false;
}
scale = _adjustScale(scale);
_updateScale(scale, true);
_updateOldScale(scale);
return scale;
}
function _endScale() {
frame.flush();
_isScaling.value = false;
_updateOldScale(_scale.value);
}
function _setScale(scale) {
if (scale) {
scale = _oldScale.value * scale;
_beginScale();
_updateScale(scale);
}
}
return {
// scale
_updateOldScale,
_endScale,
_setScale,
scaleValueSync,
frame,
// layout
_updateBoundary,
_updateOffset,
_updateWH,
_scaleOffset,
minX,
minY,
maxX,
maxY,
// transform
FAandSFACancel,
_getLimitXY,
_animationTo,
_setTransform,
_revise,
dampingNumber,
xMove,
yMove,
xSync,
ySync,
_STD
};
}
function useMovableViewState(props2, trigger, rootRef) {
const _isMounted = Vue.inject("_isMounted", Vue.ref(false));
Vue.inject(
"addMovableViewContext",
() => {
}
);
Vue.inject(
"removeMovableViewContext",
() => {
}
);
let _scale = Vue.ref(1);
let _oldScale = Vue.ref(1);
let _isScaling = Vue.ref(false);
let _translateX = Vue.ref(0);
let _translateY = Vue.ref(0);
let _SFA = null;
let _FA = null;
const frictionNumber = Vue.computed(() => {
let val = Number(props2.friction);
return isNaN(val) || val <= 0 ? 2 : val;
});
new Friction(1, frictionNumber.value);
Vue.watch(
() => props2.disabled,
() => {
__handleTouchStart();
}
);
const {
// scale
_updateOldScale,
_endScale,
_setScale,
scaleValueSync,
frame,
// layout
_updateBoundary,
_updateOffset,
_updateWH,
_scaleOffset,
minX,
minY,
maxX,
maxY,
// transform
FAandSFACancel,
_getLimitXY,
_setTransform,
_revise,
dampingNumber,
xMove,
yMove,
xSync,
ySync,
_STD
} = useMovableViewInit(
props2,
rootRef,
trigger,
_scale,
_oldScale,
_isScaling,
_translateX,
_translateY,
_SFA,
_FA
);
frame.request;
function __handleTouchStart() {
if (!_isScaling.value) {
if (!props2.disabled) {
FAandSFACancel();
if (xMove.value) {
_translateX.value;
}
if (yMove.value) {
_translateY.value;
}
rootRef.value.style.willChange = "transform";
}
}
}
function setParent() {
if (!_isMounted.value) {
return;
}
FAandSFACancel();
let scale = props2.scale ? scaleValueSync.value : 1;
_updateOffset();
_updateWH(scale);
_updateBoundary();
let limitXY = _getLimitXY(
xSync.value + _scaleOffset.x,
ySync.value + _scaleOffset.y
);
let x = limitXY.x;
let y = limitXY.y;
_setTransform(x, y, scale, "", true);
_updateOldScale(scale);
}
return {
setParent
};
}
const _t0$7 = Vue.template("<div uni-movable-view uni-view><!> ", 1);
class UniMovableViewElement extends UniViewElement {
static [Symbol.hasInstance](value) {
return this === UniMovableViewElement && value instanceof UniViewElement && value.hasAttribute("uni-movable-view") || Function.prototype[Symbol.hasInstance].call(this, value);
}
}
const uniTagName$5 = { value: "MOVABLE-VIEW" };
const indexVapor$5 = /* @__PURE__ */ defineBuiltInComponent({
name: "MovableView",
props: movableViewProps,
emits: ["change", "scale"],
rootElement: {
name: "uni-movable-view",
class: UniMovableViewElement
},
setup(props2, { slots, emit: emit2 }) {
const { rootRef, setParent } = useMovableView(props2, emit2);
const root = (() => {
const _setTemplateRef = Vue.createTemplateRefSetter();
const _n3 = _t0$7();
const _n2 = Vue.child(_n3);
const _n1 = Vue.next(_n2, true);
Vue.setInsertionState(_n3, _n2);
createComponent(ResizeSensor, { onResize: () => setParent });
setNodes(_n1, () => slots.default && slots.default());
Vue.renderEffect(() => _setTemplateRef(_n3, rootRef));
return _n3;
})();
Object.defineProperty(root, "uniTagName", uniTagName$5);
return root;
}
});
function removeDOCTYPE(html) {
return html.replace(/<\?xml.*\?>\n/, "").replace(/<!doctype.*>\n/, "").replace(/<!DOCTYPE.*>\n/, "");
}
function parseAttrs(attrs2) {
return attrs2.reduce(function(pre, attr2) {
let value = attr2.value;
const name = attr2.name;
if (value.match(/ /) && ["style", "src"].indexOf(name) === -1) {
value = value.split(" ");
}
if (pre[name]) {
if (Array.isArray(pre[name])) {
pre[name].push(value);
} else {
pre[name] = [pre[name], value];
}
} else {
pre[name] = value;
}
return pre;
}, {});
}
function parseHtml(html) {
html = removeDOCTYPE(html);
const stacks = [];
const results = {
node: "root",
children: []
};
HTMLParser(html, {
start: function(tag, attrs2, unary) {
const node = {
name: tag
};
if (attrs2.length !== 0) {
node.attrs = parseAttrs(attrs2);
}
if (unary) {
const parent = stacks[0] || results;
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
} else {
stacks.unshift(node);
}
},
end: function(tag) {
const node = stacks.shift();
if (node.name !== tag)
console.error("invalid state: mismatch end tag");
if (stacks.length === 0) {
results.children.push(node);
} else {
const parent = stacks[0];
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
}
},
chars: function(text) {
const node = {
type: "text",
text
};
if (stacks.length === 0) {
results.children.push(node);
} else {
const parent = stacks[0];
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
}
},
comment: function(text) {
const node = {
node: "comment",
text
};
const parent = stacks[0];
if (parent) {
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
}
}
});
return results.children;
}
const props$6 = {
nodes: {
type: [Array, String],
default: function() {
return [];
}
},
/** @deprecated 请使用 user-select */
selectable: {
type: [Boolean, String],
default: false
},
userSelect: {
type: [Boolean, String],
default: false
}
};
const CHARS = {
amp: "&",
gt: ">",
lt: "<",
nbsp: " ",
quot: '"',
apos: "'",
ldquo: "“",
rdquo: "”",
yen: "¥",
radic: "√",
lceil: "⌈",
rceil: "⌉",
lfloor: "⌊",
rfloor: "⌋",
hellip: "…"
};
function decodeEntities(htmlString) {
return htmlString.replace(
/&(([a-zA-Z]+)|(#x{0,1}[\da-zA-Z]+));/gi,
function(match, stage) {
if (shared.hasOwn(CHARS, stage) && CHARS[stage]) {
return CHARS[stage];
}
if (/^#[0-9]{1,4}$/.test(stage)) {
return String.fromCharCode(stage.slice(1));
}
if (/^#x[0-9a-f]{1,4}$/i.test(stage)) {
return String.fromCharCode(Number("0" + stage.slice(1)));
}
return match;
}
);
}
function processClickEvent(node, triggerItemClick) {
if (node.name && ["a", "img"].includes(node.name) && triggerItemClick) {
return {
onClickCapture: (e2) => {
if (node.name === "a") {
triggerItemClick(e2, { href: (node.attrs || {}).href });
} else {
triggerItemClick(e2, { src: (node.attrs || {}).src });
}
e2.stopPropagation();
e2.preventDefault();
e2.returnValue = false;
}
};
}
}
function normalizeValue(tagName, name, value) {
if (tagName === "img" && name === "src" && shared.isString(value)) {
return getRealPath(value);
}
return value;
}
function normalizeAttrs(tagName, attrs2) {
if (!shared.isPlainObject(attrs2))
return;
const normalizedAttrs = {};
Object.keys(attrs2).forEach((name) => {
normalizedAttrs[name] = normalizeValue(tagName, name, attrs2[name]);
});
return normalizedAttrs;
}
function nodeType(node) {
if (!shared.isPlainObject(node))
return "";
if ((!shared.hasOwn(node, "type") || node.type === "text") && shared.isString(node.text) && node.text !== "") {
return "#text";
}
return (!shared.hasOwn(node, "type") || node.type === "node") && shared.isString(node.name) && node.name ? node.name : "";
}
function hasContent(attrs2) {
return attrs2 && (attrs2.innerHTML != null || attrs2.textContent != null || attrs2[".innerHTML"] != null || attrs2[".textContent"] != null);
}
function nodeKey(node) {
if (!shared.isPlainObject(node == null ? void 0 : node.attrs))
return;
const key = node.attrs.key;
if (key == null || node.type === "text")
return;
if (!shared.hasOwn(node, "type") && shared.isString(node.text) && node.text !== "")
return;
return key;
}
function nodeList2Block(source, scopeId, triggerItemClick, namespace = () => shared.Namespaces.HTML) {
let previous = [];
let hadUnkeyed = false;
let renderedTypes;
const unkeyedTypes = /* @__PURE__ */ new WeakMap();
function unkeyedType(node) {
if (!shared.isPlainObject(node))
return "";
let type = unkeyedTypes.get(node);
if (!type)
unkeyedTypes.set(node, type = Vue.computed(() => nodeType(node)));
return type.value;
}
const keyedSource = Vue.computed(() => {
var _a;
const nodes = source() || [];
if (!nodes.length) {
previous = [];
hadUnkeyed = false;
renderedTypes = void 0;
return { nodes, keys: [] };
}
let hasUnkeyed = false;
const next = Array.from(nodes, (node) => {
const key = nodeKey(node);
if (key == null)
hasUnkeyed = true;
return {
key,
// 显式 key 的标签更新由节点分支处理,不订阅整个列表。
type: key != null ? hadUnkeyed ? nodeType(Vue.toRaw(node)) : "" : unkeyedType(node),
id: key
};
});
const same = (old, entry) => old.key === entry.key && ((renderedTypes == null ? void 0 : renderedTypes.get(old.id)) ?? old.type) === entry.type;
let start = 0;
let oldEnd = previous.length - 1;
let newEnd = next.length - 1;
while (start <= oldEnd && start <= newEnd && same(previous[start], next[start])) {
next[start].id = previous[start].id;
start++;
}
while (start <= oldEnd && start <= newEnd && same(previous[oldEnd], next[newEnd])) {
next[newEnd--].id = previous[oldEnd--].id;
}
let unkeyed;
for (let i = oldEnd; i >= start; i--) {
const entry = previous[i];
if (entry.key != null)
continue;
const pool = unkeyed || (unkeyed = /* @__PURE__ */ new Map());
let ids = pool.get(entry.type);
if (!ids)
pool.set(entry.type, ids = []);
ids.push(entry.id);
}
for (let i = start; i <= newEnd; i++) {
const entry = next[i];
if (entry.key == null)
entry.id = ((_a = unkeyed == null ? void 0 : unkeyed.get(entry.type)) == null ? void 0 : _a.pop()) ?? Symbol();
}
const keys = [];
let nextRenderedTypes;
for (const entry of next) {
keys.push(entry.id);
if (entry.key != null) {
const types = nextRenderedTypes || (nextRenderedTypes = /* @__PURE__ */ new Map());
types.set(entry.id, (renderedTypes == null ? void 0 : renderedTypes.get(entry.id)) ?? entry.type);
}
}
renderedTypes = nextRenderedTypes;
previous = next;
hadUnkeyed = hasUnkeyed;
return { nodes, keys };
});
return Vue.createFor(
() => keyedSource.value.nodes,
(item) => Vue.createKeyedFragment(
() => {
const type = nodeType(item.value);
const key = nodeKey(item.value);
if (key != null)
renderedTypes.set(key, type);
return type + ":" + namespace();
},
() => {
const name = nodeType(item.value);
if (!name)
return [];
if (name === "#text") {
const text = Vue.createTextNode();
Vue.renderEffect(() => Vue.setText(text, decodeEntities(item.value.text)));
return text;
}
const ns = name === "svg" ? shared.Namespaces.SVG : name === "math" ? shared.Namespaces.MATH_ML : namespace();
const element = Vue.createPlainElement(name, null, null, false, false, ns);
let childScope;
let children;
Vue.renderEffect(() => {
var _a;
const node = item.value;
const attrs2 = normalizeAttrs(name.toLowerCase(), node.attrs);
const content = hasContent(attrs2);
if (content && childScope) {
childScope.stop();
Vue.remove(children, element);
children = void 0;
childScope = void 0;
}
Vue.setDynamicProps(
element,
[
shared.extend(
scopeId ? { [scopeId]: "" } : {},
processClickEvent(node, triggerItemClick),
attrs2
)
],
void 0,
ns === shared.Namespaces.SVG
);
if (!content && !childScope && ((_a = node.children) == null ? void 0 : _a.length)) {
childScope = Vue.effectScope();
children = childScope.run(
() => nodeList2Block(
() => item.value.children || [],
scopeId,
triggerItemClick,
() => {
var _a2, _b;
return ns === shared.Namespaces.SVG && name === "foreignObject" || ns === shared.Namespaces.MATH_ML && name === "annotation-xml" && ((_b = (_a2 = item.value.attrs) == null ? void 0 : _a2.encoding) == null ? void 0 : _b.includes("html")) ? shared.Namespaces.HTML : ns;
}
)
);
Vue.insert(children, element);
}
});
if (element.tagName === "SELECT")
Vue.syncSelectValue(element);
return element;
}
),
(_node, index2) => keyedSource.value.keys[index2]
);
}
function renderRichText(props2, rootRef, triggerItemClick) {
const vm = Vue.getCurrentInstance();
const nodes = Vue.computed(
() => shared.isString(props2.nodes) ? parseHtml(props2.nodes) : props2.nodes
);
const root = Vue.createPlainElement(
"div",
{
selectable: () => props2.userSelect || props2.selectable ? true : null
},
{
default: () => Vue.createPlainElement("div", null, {
default: () => (
// 与 VDOM vnode.scopeId 对应,保留调用方的作用域样式。
nodeList2Block(
() => nodes.value,
vm.scopeId || "",
triggerItemClick
)
)
})
},
true
);
root.setAttribute("uni-rich-text", "");
root.setAttribute("uni-view", "");
rootRef.value = root;
return root;
}
class UniRichTextElement extends UniViewElement {
static [Symbol.hasInstance](value) {
return this === UniRichTextElement && value instanceof UniViewElement && value.hasAttribute("uni-rich-text") || Function.prototype[Symbol.hasInstance].call(this, value);
}
}
const uniTagName$4 = { value: "RICH-TEXT" };
const indexVapor$4 = /* @__PURE__ */ defineBuiltInComponent({
name: "RichText",
compatConfig: { MODE: 3 },
props: props$6,
emits: ["itemclick"],
rootElement: {
name: "uni-rich-text",
class: UniRichTextElement
},
setup(props2, { emit: emit2 }) {
const rootRef = Vue.ref(null);
const trigger = useCustomEvent(rootRef, emit2);
function triggerItemClick(e2, detail = {}) {
trigger("itemclick", e2, detail);
}
const result = renderRichText(props2, rootRef, triggerItemClick);
Object.defineProperty(result, "uniTagName", uniTagName$4);
return result;
}
});
const _UniScrollViewElement = class _UniScrollViewElement extends UniViewElement {
static [Symbol.hasInstance](value) {
return this === _UniScrollViewElement && value instanceof UniViewElement && value.hasAttribute("uni-scroll-view") || Function.prototype[Symbol.hasInstance].call(this, value);
}
};
_UniScrollViewElement.__uniElement = {};
let UniScrollViewElement = _UniScrollViewElement;
const props$5 = {
direction: { type: String, default: "vertical" },
showScrollbar: { type: [Boolean, String], default: true },
upperThreshold: { type: [Number, String], default: 50 },
lowerThreshold: { type: [Number, String], default: 50 },
scrollTop: { type: [Number, String], default: 0 },
scrollLeft: { type: [Number, String], default: 0 },
scrollIntoView: { type: String, default: "" },
scrollWithAnimation: { type: [Boolean, String], default: false }
};
const emits = ["scroll", "scrollend", "scrolltoupper", "scrolltolower"];
function useScrollView(props2, { emit: emit2, expose }) {
const rootRef = Vue.ref(null);
const scrollX = Vue.computed(
() => props2.direction === "horizontal" || props2.direction === "all"
);
const scrollY = Vue.computed(
() => props2.direction === "vertical" || props2.direction === "all"
);
const rootStyle = Vue.computed(
() => `overflow-x:${scrollX.value ? "auto" : "hidden"};overflow-y:${scrollY.value ? "auto" : "hidden"};`
);
const scrollBarClassName = Vue.computed(
() => props2.showScrollbar === false ? "uni-scroll-view-scrollbar-hidden" : ""
);
function scrollTo(options) {
var _a;
(_a = rootRef.value) == null ? void 0 : _a.scrollTo(
Object.assign(options, {
behavior: props2.scrollWithAnimation ? "smooth" : "instant"
})
);
}
function scrollIntoView(id2) {
const root = rootRef.value;
if (!root || !id2)
return;
if (!/^[_a-zA-Z][-_a-zA-Z0-9:]*$/.test(id2)) {
console.error(`id error: scroll-into-view=${id2}`);
return;
}
const element = root.querySelector(`[id="${id2}"]`);
if (!element)
return;
const rootRect = root.getBoundingClientRect();
const rect = element.getBoundingClientRect();
const options = {};
if (scrollX.value) {
options.left = root.scrollLeft + rect.left - rootRect.left - root.clientLeft;
}
if (scrollY.value) {
options.top = root.scrollTop + rect.top - rootRect.top - root.clientTop;
}
if (options.left !== void 0 || options.top !== void 0)
scrollTo(options);
}
Vue.watch(
() => [props2.scrollTop, props2.scrollLeft],
([top, left], [previousTop, previousLeft]) => {
const options = {};
if (scrollY.value && top !== previousTop)
options.top = Number(top) || 0;
if (scrollX.value && left !== previousLeft)
options.left = Number(left) || 0;
if (options.left !== void 0 || options.top !== void 0)
scrollTo(options);
},
{ flush: "post" }
);
Vue.watch(() => props2.scrollIntoView, scrollIntoView, { flush: "post" });
expose({ $getMain: () => rootRef.value });
return { rootRef, rootStyle, scrollBarClassName };
}
const _t0$6 = Vue.template("<div uni-scroll-view uni-view> ", 1);
const __syscom_0 = /* @__PURE__ */ defineBuiltInComponent({
name: "ScrollView",
props: props$5,
emits,
rootElement: {
name: "uni-scroll-view",
class: UniScrollViewElement
},
setup(props2, context) {
const { rootRef, rootStyle, scrollBarClassName } = useScrollView(props2, context);
const { slots } = context;
const root = (() => {
const _setTemplateRef = Vue.createTemplateRefSetter();
const _n0 = _t0$6();
const _x0 = Vue.txt(_n0);
setNodes(_x0, () => slots.default && slots.default());
Vue.renderEffect(() => {
Vue.setStyle(_n0, rootStyle.value);
Vue.setClass(_n0, scrollBarClassName.value);
_setTemplateRef(_n0, rootRef);
});
return _n0;
})();
return root;
}
});
const FORM_KEY = "UNI_FORM_CTX";
const LABEL_KEY = "UNI_LABEL_CTX";
const RADIO_GROUP_KEY = "UNI_RADIO_GROUP_CTX";
const CHECKBOX_GROUP_KEY = "UNI_CHECKBOX_GROUP_CTX";
const PICKER_VIEW_KEY = "UNI_PICKER_VIEW_CTX";
const labelTargets = /* @__PURE__ */ new Map();
function findLabelTarget(id2) {
if (id2.length === 0)
return null;
const targets = labelTargets.get(id2);
if (targets == null || targets.length === 0)
return null;
return targets[targets.length - 1];
}
function toStringOrEmpty(val) {
if (val == null) {
return "";
}
return val + "";
}
function classes(...classList) {
return classList.map((className) => {
if (Array.isArray(className)) {
const classNames = className;
const condition = classNames[0];
const truthy = classNames[1];
const falsy = classNames.length > 2 ? classNames[2] : "";
return (condition ? truthy : falsy) ?? "";
}
return className ?? "";
});
}
function createSpaceKeyHandlers(isDisabled) {
let spacePressed = false;
function handleKeydown(event) {
if (event.key !== " " || event.target !== event.currentTarget || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) {
return;
}
event.preventDefault();
if (!event.repeat) {
spacePressed = !isDisabled();
}
}
function handleKeyup(event) {
var _a;
if (event.key !== " " || event.target !== event.currentTarget) {
return;
}
const shouldActivate = spacePressed;
spacePressed = false;
if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) {
return;
}
event.preventDefault();
if (shouldActivate && !isDisabled()) {
(_a = event.currentTarget) == null ? void 0 : _a.dispatchEvent(new MouseEvent("click", { bubbles: true, cancelable: true }));
}
}
function handleBlur() {
spacePressed = false;
}
return { handleKeydown, handleKeyup, handleBlur };
}
const _UniButtonElement = class _UniButtonElement extends UniTextElement {
constructor() {
super(...arguments);
this.tagName = "BUTTON";
this.nodeName = "BUTTON";
this._value = "";
}
get value() {
var _a, _b;
if ((_a = this.vm) == null ? void 0 : _a.isLoading()) {
return ((_b = this.vm) == null ? void 0 : _b.getValue()) ?? this._value;
}
return super.value ?? this._value;
}
};
_UniButtonElement.__uniElement = { vm: true, init() {
Object.defineProperty(this, "_value", { value: "", writable: true, enumerable: true, configurable: true });
} };
let UniButtonElement = _UniButtonElement;
const t0$n = Vue.template('<div uni-button uni-view style="display: flex;justify-content: center;flex-direction: row;align-items: center" role=button><!><span uni-text>', 1);
const t1$a = Vue.template("<span uni-button uni-text role=button>", 1);
const _uniButtonElement = { value: "BUTTON" };
const DEFAULT_BUTTON_HOVER_CLASS_NAME = "button-hover";
const _sfc_main$n = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "button",
// @ts-ignore
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniButtonElement, "button")
},
externalClasses: ["hover-class", "loading-class", "loading-text-class"]
},
__name: "button",
props: {
disabled: { type: Boolean, default: false },
type: { type: String },
size: { default: "default", type: String },
plain: { type: Boolean, default: false },
loadingClass: { type: null },
loadingTextClass: { type: null },
hoverClass: { type: null },
hoverStartTime: { default: 20, type: Number },
hoverStayTime: { default: 70, type: Number },
hoverStopPropagation: { type: Boolean, default: false },
loading: { type: Boolean, default: false },
formType: { type: String },
openType: { default: "", type: String },
iosLoadingSnow: { type: Boolean, default: false }
},
emits: ["click"],
setup(__props, { expose: __expose, emit: __emit }) {
const emit2 = __emit;
const props2 = __props;
const { handleKeydown: handleSpaceKeydown, handleKeyup, handleBlur } = createSpaceKeyHandlers(() => props2.disabled);
function handleKeydown(event) {
var _a;
if (event.key !== "Enter") {
handleSpaceKeydown(event);
return;
}
if (event.target !== event.currentTarget || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) {
return;
}
event.preventDefault();
if (!props2.disabled && !event.repeat) {
(_a = event.currentTarget) == null ? void 0 : _a.dispatchEvent(new MouseEvent("click", { bubbles: true, cancelable: true }));
}
}
const loadingRootRef = Vue.ref(null);
Vue.watch(() => props2.loading && !props2.disabled, (_loading, wasLoading) => {
const element = wasLoading ? loadingRootRef.value : textRef.value;
if (element == null || document.activeElement !== element) {
return;
}
handleBlur();
Vue.nextTick(() => {
if (!props2.disabled && document.activeElement === document.body) {
const element2 = props2.loading && !props2.disabled ? loadingRootRef.value : textRef.value;
if (element2 instanceof Object) {
element2.focus();
}
}
});
});
const textRef = Vue.ref(null);
const buttonType = Vue.computed(() => {
return props2.type == null ? "default" : props2.type;
});
const loadingTextStyle = Vue.computed(() => {
let style = "font-size:inherit;line-height:inherit;font-weight:inherit;text-align:inherit;";
if (props2.loadingTextClass == null) {
style += "color:inherit;";
}
return style;
});
const formCtx = Vue.inject(FORM_KEY, null);
const enableTransition = Vue.ref(false);
const hoverClasses = Vue.computed(() => {
let isDefaultHoverClass = false;
if (props2.hoverClass != null) {
const hoverClass = `${props2.hoverClass}`.replace(/^\^+/, "");
if (hoverClass == "" || hoverClass == "none") {
return "none";
}
if (hoverClass != DEFAULT_BUTTON_HOVER_CLASS_NAME) {
return `${props2.hoverClass}`;
}
isDefaultHoverClass = true;
}
const classes2 = [];
if (!props2.plain) {
switch (buttonType.value) {
case "default":
classes2.push("uni-button-view_default_hover");
break;
case "primary":
classes2.push("uni-button-view_primary_hover");
break;
case "warn":
classes2.push("uni-button-view_warn_hover");
break;
}
} else {
switch (buttonType.value) {
case "default":
classes2.push("uni-button-view_plain_default_hover");
break;
case "primary":
classes2.push("uni-button-view_plain_primary_hover");
break;
case "warn":
classes2.push("uni-button-view_plain_warn_hover");
break;
}
}
if (isDefaultHoverClass) {
classes2.push(`${props2.hoverClass}`);
}
return classes2.join(" ");
});
const checkFormAndSubmitOrReset = () => {
if (props2.formType != "submit" && props2.formType != "reset") {
return;
}
if (formCtx == null) {
return;
}
if (props2.formType == "submit") {
formCtx.submit();
} else if (props2.formType == "reset") {
formCtx.reset();
}
};
const handleTap = (event) => {
if (props2.disabled) {
return;
}
emit2("click", event);
checkFormAndSubmitOrReset();
};
__expose({
getValue() {
if (textRef.value == null) {
return "";
}
return textRef.value.value;
},
isLoading() {
return props2.loading && !props2.disabled;
}
});
const _component_loading = _sfc_main$s;
const n0 = Vue.createIf(
() => __props.loading && !__props.disabled,
() => {
const n2 = t0$n();
const n6 = Vue.child(n2);
const n5 = Vue.next(n6);
Vue.initUniElement(n2, _uniButtonElement);
Vue.renderEffect(() => {
const _disabled = __props.disabled;
const _buttonType = Vue.unref(buttonType);
const _size = __props.size;
const _plain = __props.plain;
Vue.setHover(n2, _disabled ? "none" : Vue.unref(hoverClasses), __props.hoverStopPropagation, __props.hoverStartTime, __props.hoverStayTime, "");
Vue.setClass(n2, ["uni-button", Vue.unref(classes)(
[_buttonType == "default", "uni-button-type-default_view"],
[_buttonType == "primary", "uni-button-type-primary_view"],
[_buttonType == "warn", "uni-button-type-warn_view"],
[__props.type != null, "uni-button-has-type", "uni-button-no-type"],
[_disabled, "uni-button-disabled"],
[_size == "mini", "uni-button-size-mini"],
[Vue.unref(enableTransition), "transition-enabled"],
[_buttonType == "default", "uni-button-type-default_text"],
[_buttonType == "primary", "uni-button-type-primary_text"],
[_buttonType == "warn", "uni-button-type-warn_text"],
[_plain && __props.loading, "uni-button-text-plain"],
[_plain, "uni-button-view-plain"],
[_size == "mini", "uni-button-text-size-mini"],
[_size == "default", "uni-button-text-size-default"]
)]);
Vue.setProp(n2, "tabindex", _disabled ? -1 : 0);
Vue.setAttr(n2, "aria-disabled", _disabled);
});
Vue.setInsertionState(n2, n6);
Vue.withComponentId("0ed9fc4b", () => Vue.createComponentWithFallback(_component_loading, { class: () => ["uni-button-loading-icon", Vue.unref(classes)(
[Vue.unref(buttonType) == "default", "uni-loading-default"],
[__props.plain && Vue.unref(buttonType) == "primary", "uni-loading-plain-primary"],
[__props.plain && Vue.unref(buttonType) == "warn", "uni-loading-plain-warn"],
__props.loadingClass || "uni-button-loading-color-inherit"
)] }));
Vue.renderEffect(() => {
Vue.setClass(n5, ["uni-button-loading-text", __props.loadingTextClass || ""]);
Vue.setStyle(n5, Vue.unref(loadingTextStyle));
});
Vue.setInsertionState(n5);
Vue.createSlot(
"default",
null,
null,
256
/* TEXT_MODE */
);
Vue.setStaticTemplateRef(n5, textRef, null, "textRef");
Vue.on(n2, "keydown", handleKeydown);
Vue.on(n2, "keyup", (e2) => Vue.unref(handleKeyup)(e2));
Vue.on(n2, "blur", (e2) => Vue.unref(handleBlur)(e2));
Vue.on(n2, "click", handleTap);
Vue.setStaticTemplateRef(n2, loadingRootRef, null, "loadingRootRef");
return n2;
},
() => {
const n8 = t1$a();
Vue.initUniElement(n8, _uniButtonElement);
Vue.renderEffect(() => {
const _disabled = __props.disabled;
const _buttonType = Vue.unref(buttonType);
const _size = __props.size;
const _plain = __props.plain;
Vue.setHover(n8, _disabled ? "none" : Vue.unref(hoverClasses), __props.hoverStopPropagation, __props.hoverStartTime, __props.hoverStayTime, "");
Vue.setClass(n8, ["uni-button uni-button-text", Vue.unref(classes)(
[_buttonType == "default", "uni-button-type-default_view"],
[_buttonType == "primary", "uni-button-type-primary_view"],
[_buttonType == "warn", "uni-button-type-warn_view"],
[__props.type != null, "uni-button-has-type", "uni-button-no-type"],
[_disabled, "uni-button-disabled"],
[_size == "mini", "uni-button-size-mini"],
[Vue.unref(enableTransition), "transition-enabled"],
[_buttonType == "default", "uni-button-type-default_text"],
[_buttonType == "primary", "uni-button-type-primary_text"],
[_buttonType == "warn", "uni-button-type-warn_text"],
[_plain && __props.loading, "uni-button-text-plain"],
[_plain, "uni-button-view-plain"],
[_size == "mini", "uni-button-text-size-mini"],
[_size == "default", "uni-button-text-size-default"]
)]);
Vue.setProp(n8, "tabindex", _disabled ? -1 : 0);
Vue.setAttr(n8, "aria-disabled", _disabled);
});
Vue.setInsertionState(n8);
Vue.createSlot(
"default",
null,
null,
256
/* TEXT_MODE */
);
Vue.on(n8, "keydown", handleKeydown);
Vue.on(n8, "keyup", (e2) => Vue.unref(handleKeyup)(e2));
Vue.on(n8, "blur", (e2) => Vue.unref(handleBlur)(e2));
Vue.on(n8, "click", handleTap);
Vue.setStaticTemplateRef(n8, textRef, null, "textRef");
return n8;
},
261
/* TRUE_SINGLE_ROOT, FALSE_SINGLE_ROOT, KEYED_INDEX_0 */
);
return n0;
}
});
const _UniCheckboxElement = class _UniCheckboxElement extends UniViewElement {
constructor() {
super(...arguments);
this.tagName = "CHECKBOX";
this.nodeName = "CHECKBOX";
this._checked = false;
}
get checked() {
var _a;
return ((_a = this.vm) == null ? void 0 : _a.getCheckboxChecked()) ?? this._checked;
}
set checked(val) {
var _a;
if (this._checked == val) {
return;
}
this._checked = val;
(_a = this.vm) == null ? void 0 : _a.setCheckboxChecked(val);
}
};
_UniCheckboxElement.__uniElement = { vm: true, init() {
Object.defineProperty(this, "_checked", { value: false, writable: true, enumerable: true, configurable: true });
} };
let UniCheckboxElement = _UniCheckboxElement;
const t0$m = Vue.template('<svg class=uni-checkbox-svg viewBox="0 0 32 32"><path fill=currentColor>', 0, 1);
const t1$9 = Vue.template("<div uni-checkbox uni-view role=checkbox>", 1);
const t2$1 = Vue.template("<span uni-text>");
const t3$1 = Vue.template("<div uni-checkbox uni-view class=uni-checkbox role=checkbox><div uni-view></div>", 1);
const _uniCheckboxElement = { value: "CHECKBOX" };
const iconPath$1 = "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 _sfc_main$m = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "checkbox",
// @ts-ignore
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniCheckboxElement, "checkbox")
},
externalClasses: ["icon-class", "checkbox-class", "checkbox-active-class"]
},
__name: "checkbox",
props: {
color: { default: "", type: String },
disabled: { type: Boolean, default: false },
checked: { type: Boolean, default: false },
value: { default: "", type: String },
iconClass: { default: "", type: null },
checkboxClass: { default: "", type: null },
checkboxActiveClass: { default: "", type: null }
},
setup(__props, { expose: __expose }) {
var _a, _b;
const props2 = __props;
const { handleKeydown, handleKeyup, handleBlur } = createSpaceKeyHandlers(() => props2.disabled);
const attrs2 = Vue.useAttrs();
attrs2.id;
const slots = Vue.useSlots();
const isStringSlot = ((_a = slots["default"]) == null ? void 0 : _a["returnType"]) == "string";
const hasDefaultSlot = slots["default"] != null;
(_b = Vue.getCurrentInstance()) == null ? void 0 : _b.proxy;
const isChecked = Vue.ref(props2.checked);
const activeStyle = Vue.computed(() => {
if (isChecked.value && !props2.disabled && props2.color) {
return { color: props2.color };
}
return {};
});
const group = Vue.inject(CHECKBOX_GROUP_KEY, null);
Vue.inject(LABEL_KEY, null);
const setChecked = (checked, syncGroup) => {
if (isChecked.value == checked) {
return;
}
isChecked.value = checked;
if (group != null) {
group.toggle(toStringOrEmpty(props2.value), checked, false);
}
};
Vue.watch(() => props2.checked, (value) => {
setChecked(value);
});
const handleTap = () => {
if (props2.disabled) {
return;
}
isChecked.value = !isChecked.value;
if (group != null) {
group.toggle(toStringOrEmpty(props2.value), isChecked.value, true);
}
};
__expose({
getCheckboxChecked: () => {
return isChecked.value;
},
setCheckboxChecked: (checked) => {
setChecked(checked);
}
});
const n0 = Vue.createIf(
() => !hasDefaultSlot,
() => {
const n2 = t1$9();
Vue.initUniElement(n2, _uniCheckboxElement);
Vue.renderEffect(() => {
const _disabled = __props.disabled;
const _isChecked = Vue.unref(isChecked);
Vue.setClass(n2, ["uni-checkbox-view uni-checkbox-icon", Vue.unref(classes)(
[_disabled, "uni-checkbox-disabled"],
[!_disabled && _isChecked, __props.checkboxActiveClass],
[!_disabled && !_isChecked, __props.checkboxClass],
[!_disabled, __props.iconClass]
)]);
Vue.setStyle(n2, Vue.unref(activeStyle));
Vue.setProp(n2, "tabindex", _disabled ? -1 : 0);
Vue.setAttr(n2, "aria-checked", _isChecked);
Vue.setAttr(n2, "aria-disabled", _disabled);
});
Vue.setInsertionState(n2);
Vue.createIf(() => Vue.unref(isChecked), () => {
const n6 = t0$m();
const n5 = Vue.child(n6);
Vue.setAttr(n5, "d", iconPath$1, true);
return n6;
});
Vue.on(n2, "keydown", (e2) => Vue.unref(handleKeydown)(e2));
Vue.on(n2, "keyup", (e2) => Vue.unref(handleKeyup)(e2));
Vue.on(n2, "blur", (e2) => Vue.unref(handleBlur)(e2));
Vue.on(n2, "click", Vue.withModifiers(handleTap, ["stop"]));
return n2;
},
() => {
const n8 = t3$1();
const n13 = Vue.child(n8);
Vue.initUniElement(n8, _uniCheckboxElement);
Vue.renderEffect(() => {
const _disabled = __props.disabled;
const _isChecked = Vue.unref(isChecked);
Vue.setProp(n8, "tabindex", _disabled ? -1 : 0);
Vue.setAttr(n8, "aria-checked", _isChecked);
Vue.setAttr(n8, "aria-disabled", _disabled);
Vue.setClass(n13, ["uni-checkbox-view uni-checkbox-icon", Vue.unref(classes)(
[_disabled, "uni-checkbox-disabled"],
[!_disabled && _isChecked, __props.checkboxActiveClass],
[!_disabled && !_isChecked, __props.checkboxClass],
[!_disabled, __props.iconClass]
)]);
Vue.setStyle(n13, Vue.unref(activeStyle));
});
Vue.setInsertionState(n13);
Vue.createIf(() => Vue.unref(isChecked), () => {
const n12 = t0$m();
const n11 = Vue.child(n12);
Vue.setAttr(n11, "d", iconPath$1, true);
return n12;
});
Vue.setInsertionState(n8, 1);
Vue.createIf(
() => isStringSlot,
() => {
const n17 = t2$1();
Vue.setInsertionState(n17);
Vue.createSlot(
"default",
null,
null,
256
/* TEXT_MODE */
);
return n17;
},
() => {
const n19 = Vue.createSlot();
return n19;
},
1029
/* TRUE_SINGLE_ROOT, FALSE_SINGLE_ROOT, KEYED_INDEX_3 */
);
Vue.on(n8, "keydown", (e2) => Vue.unref(handleKeydown)(e2));
Vue.on(n8, "keyup", (e2) => Vue.unref(handleKeyup)(e2));
Vue.on(n8, "blur", (e2) => Vue.unref(handleBlur)(e2));
Vue.on(n8, "click", Vue.withModifiers(handleTap, ["stop"]));
return n8;
},
517
/* TRUE_SINGLE_ROOT, FALSE_SINGLE_ROOT, KEYED_INDEX_1 */
);
return n0;
}
});
const _UniCheckboxGroupElement = class _UniCheckboxGroupElement extends UniViewElement {
};
_UniCheckboxGroupElement.__uniElement = {};
let UniCheckboxGroupElement = _UniCheckboxGroupElement;
const t0$l = Vue.template("<div uni-checkbox-group uni-view>", 1);
const _uniCheckboxGroupElement = { value: "CHECKBOX-GROUP" };
const _sfc_main$l = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "checkbox-group",
// @ts-ignore
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniCheckboxGroupElement, "checkbox-group")
}
},
__name: "checkbox-group",
props: {
name: { default: "", type: String }
},
emits: ["change"],
setup(__props, { emit: __emit }) {
const props2 = __props;
class UniCustomEvent3 {
constructor(type, detail) {
this.detail = detail;
}
}
class UniCheckboxGroupChangeEvent extends UniCustomEvent3 {
constructor(value) {
super("change", { value });
}
}
const emit2 = __emit;
const selectedValues = Vue.ref([]);
const initialSelected = Vue.ref([]);
const childSetters = /* @__PURE__ */ new Map();
let elementOrderCounter = 0;
const elementOrderMap = /* @__PURE__ */ new Map();
const ensureIncluded = (value) => {
if (selectedValues.value.indexOf(value) == -1) {
selectedValues.value.push(value);
}
};
const ensureExcluded = (value) => {
const i = selectedValues.value.indexOf(value);
if (i != -1) {
selectedValues.value.splice(i, 1);
}
};
const updateSelection2 = (value, checked) => {
if (checked) {
ensureIncluded(value);
} else {
ensureExcluded(value);
}
};
const dispatchEvent = () => {
const sortedValues = selectedValues.value.slice().sort((a, b) => {
const orderA = elementOrderMap.get(a) ?? 0;
const orderB = elementOrderMap.get(b) ?? 0;
return orderA - orderB;
});
emit2("change", new UniCheckboxGroupChangeEvent(sortedValues));
};
const ctx = {
register: (value, checked, setChecked) => {
childSetters.set(value, setChecked);
elementOrderMap.set(value, elementOrderCounter++);
updateSelection2(value, checked);
if (initialSelected.value.indexOf(value) == -1 && checked) {
initialSelected.value.push(value);
}
},
unregister: (value) => {
ensureExcluded(value);
childSetters.delete(value);
elementOrderMap.delete(value);
},
toggle: (value, checked, emitChange) => {
updateSelection2(value, checked);
if (emitChange) {
dispatchEvent();
}
},
isChecked: (value) => {
return selectedValues.value.indexOf(value) != -1;
},
name: props2.name
};
Vue.provide(CHECKBOX_GROUP_KEY, ctx);
Vue.inject(FORM_KEY, null);
const n0 = t0$l();
Vue.initUniElement(n0, _uniCheckboxGroupElement);
Vue.setInsertionState(n0);
Vue.createSlot();
return n0;
}
});
const _UniFlowItemElement = class _UniFlowItemElement extends UniViewElement {
};
_UniFlowItemElement.__uniElement = {};
let UniFlowItemElement = _UniFlowItemElement;
const _UniWaterflowElement = class _UniWaterflowElement extends UniScrollViewElement {
};
_UniWaterflowElement.__uniElement = {};
let UniWaterflowElement = _UniWaterflowElement;
const t0$k = Vue.template('<div uni-flow-item uni-view class=uni-flow-item style="position: absolute; top: 0; left: 0; width: 0px">', 1);
const _uniFlowItemElement = { value: "FLOW-ITEM" };
const _sfc_main$k = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "flow-item",
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniFlowItemElement, "flow-item")
}
},
__name: "flow-item",
props: {
itemKey: { type: [String, Number], required: true },
itemHeight: { type: Number, default: 0 }
},
setup(__props, { expose: __expose }) {
const props2 = __props;
const waterflow = Vue.inject("__uni_recycle_waterflow");
const element = Vue.ref(null);
const itemKeyRef = Vue.computed(() => String(props2.itemKey));
let registeredKey;
let recycled = false;
const item = {
size: -1,
updateItemOffset(x, y) {
if (element.value)
element.value.style.translate = `${x}px ${y}px`;
},
updateItemCrossAxisSize(width) {
if (element.value)
element.value.style.width = `${width}px`;
}
};
const recycleHooks = /* @__PURE__ */ new Map([
["brc", [recycle]],
["ru", [reuse]]
]);
Vue.provide("__uni_recycle_state_key_ref", itemKeyRef);
Vue.provide("__uni_recycle_hooks", recycleHooks);
const observer = new UniResizeObserver(() => measure());
function unregister() {
if (registeredKey !== void 0 && waterflow.itemInstanceMap.get(registeredKey) === item) {
waterflow.itemInstanceMap.delete(registeredKey);
}
registeredKey = void 0;
}
function measure() {
if (recycled || !element.value || !element.value.isConnected)
return;
const key = String(props2.itemKey);
if (registeredKey !== key) {
unregister();
registeredKey = key;
waterflow.itemInstanceMap.set(key, item);
}
item.updateItemCrossAxisSize(waterflow.getItemCrossAxisSize());
item.updateItemOffset(...waterflow.getItemOffset(key));
const rect = element.value.getBoundingClientRect();
if (rect.width > 0) {
item.size = rect.height;
waterflow.updateItemSize(key, item.size);
}
}
function recycle() {
recycled = true;
observer.disconnect();
unregister();
}
function reuse() {
recycled = false;
Vue.nextTick(() => {
if (recycled || !element.value)
return;
observer.observe(element.value);
measure();
});
}
Vue.watch(
() => props2.itemKey,
() => measure(),
{ flush: "post" }
);
__expose({ recycleHooks });
const n0 = t0$k();
Vue.initUniElement(n0, _uniFlowItemElement);
Vue.setInsertionState(n0);
Vue.createSlot();
Vue.setStaticTemplateRef(n0, element, null, "element");
return n0;
}
});
const _UniFormElement = class _UniFormElement extends UniViewElement {
};
_UniFormElement.__uniElement = {};
let UniFormElement = _UniFormElement;
const t0$j = Vue.template("<div uni-form uni-view class=uni-form>", 1);
const _uniFormElement = { value: "FORM" };
const _sfc_main$j = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "form",
// @ts-ignore
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniFormElement, "form")
}
},
__name: "form",
props: {
disabled: { type: Boolean, default: false }
},
emits: ["submit", "reset"],
setup(__props, { expose: __expose, emit: __emit }) {
const props2 = __props;
class UniCustomEvent3 {
constructor(type, detail) {
this.detail = detail;
}
}
class UniFormSubmitEvent extends UniCustomEvent3 {
constructor(value) {
super("submit", { value });
}
}
class UniFormResetEvent extends UniCustomEvent3 {
constructor() {
super("reset", {});
}
}
const emit2 = __emit;
const fields = /* @__PURE__ */ new Map();
function registerField(field) {
if (!field.name) {
return;
}
fields.set(field.name, field);
}
function unregisterField(name) {
if (!name) {
return;
}
fields.delete(name);
}
function submit() {
if (props2.disabled) {
return;
}
const data = {};
fields.forEach((field, name) => {
data[name] = field.getValue();
});
emit2("submit", new UniFormSubmitEvent(data));
}
function reset() {
if (props2.disabled) {
return;
}
fields.forEach((field) => {
field.reset && field.reset();
});
emit2("reset", new UniFormResetEvent());
}
const ctx = { registerField, unregisterField, submit, reset };
Vue.provide(FORM_KEY, ctx);
__expose({ submit, reset });
const n0 = t0$j();
Vue.initUniElement(n0, _uniFormElement);
Vue.setInsertionState(n0);
Vue.createSlot();
return n0;
}
});
const _UniLabelElement = class _UniLabelElement extends UniViewElement {
};
_UniLabelElement.__uniElement = {};
let UniLabelElement = _UniLabelElement;
const t0$i = Vue.template("<div uni-label uni-view class=uni-label>", 1);
const _uniLabelElement = { value: "LABEL" };
const _sfc_main$i = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "label",
// @ts-ignore
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniLabelElement, "label")
}
},
__name: "label",
props: {
disabled: { type: Boolean, default: false },
for: { default: "", type: String }
},
setup(__props) {
const props2 = __props;
const { handleKeydown, handleKeyup, handleBlur } = createSpaceKeyHandlers(() => props2.disabled);
const children = [];
function register(child) {
if (child.id && child.id.length > 0) {
const idx = children.findIndex((c) => c.id === child.id);
if (idx !== -1) {
children[idx] = child;
return;
}
}
children.push(child);
}
function unregister(id2) {
if (!id2)
return;
const idx = children.findIndex((c) => c.id === id2);
if (idx !== -1) {
children.splice(idx, 1);
}
}
const ctx = { register, unregister };
Vue.provide(LABEL_KEY, ctx);
function findTarget() {
if (props2.for && props2.for.length > 0) {
const byId = children.find((c) => c.id === props2.for);
if (byId)
return byId;
const byScopeId = findLabelTarget(props2.for);
if (byScopeId)
return byScopeId;
}
if (children.length === 0)
return null;
return children[0];
}
const handleTap = (event) => {
var _a;
const eventTarget = event.target;
const element = (eventTarget == null ? void 0 : eventTarget.nodeType) === 1 ? eventTarget : eventTarget == null ? void 0 : eventTarget.parentElement;
if (element == null ? void 0 : element.closest("uni-button, [uni-button], .uni-button")) {
return;
}
const classList = ((_a = event.target) == null ? void 0 : _a.classList) ? event.target.classList : [];
for (let i = 0; i < classList.length; i++) {
if (/^uni-(checkbox|radio|switch)/.test(classList[i])) {
return;
}
}
if (props2.disabled) {
return;
}
const target = findTarget();
if (target == null)
return;
if (target.getDisabled && target.getDisabled())
return;
target.activate(event);
};
const n0 = t0$i();
Vue.initUniElement(n0, _uniLabelElement);
Vue.renderEffect(() => {
const _disabled = __props.disabled;
Vue.setProp(n0, "tabindex", _disabled ? -1 : 0);
Vue.setAttr(n0, "aria-disabled", _disabled);
});
Vue.setInsertionState(n0);
Vue.createSlot();
Vue.on(n0, "keydown", (e2) => Vue.unref(handleKeydown)(e2));
Vue.on(n0, "keyup", (e2) => Vue.unref(handleKeyup)(e2));
Vue.on(n0, "blur", (e2) => Vue.unref(handleBlur)(e2));
Vue.on(n0, "click", handleTap);
return n0;
}
});
const _UniListItemElement = class _UniListItemElement extends UniViewElement {
};
_UniListItemElement.__uniElement = {};
let UniListItemElement = _UniListItemElement;
const _UniStickySectionElement = class _UniStickySectionElement extends UniViewElement {
};
_UniStickySectionElement.__uniElement = {};
let UniStickySectionElement = _UniStickySectionElement;
const _UniStickyHeaderElement = class _UniStickyHeaderElement extends UniViewElement {
};
_UniStickyHeaderElement.__uniElement = {};
let UniStickyHeaderElement = _UniStickyHeaderElement;
const _UniListViewElement = class _UniListViewElement extends UniScrollViewElement {
};
_UniListViewElement.__uniElement = {};
let UniListViewElement = _UniListViewElement;
const t0$h = Vue.template('<div uni-list-item uni-view class=uni-list-item style="position: absolute; top: 0; left: 0; width: 100%">', 1);
const _uniListItemElement = { value: "LIST-ITEM" };
const _sfc_main$h = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "list-item",
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniListItemElement, "list-item")
}
},
__name: "list-item",
props: {
itemKey: { type: [String, Number], required: true }
},
setup(__props, { expose: __expose }) {
const props2 = __props;
const container = Vue.inject("__uni_recycle_container");
const sectionId = Vue.inject("__uni_recycle_section_id", 0);
const element = Vue.ref(null);
const itemKeyRef = Vue.computed(() => `${sectionId}:${props2.itemKey}`);
let registeredKey;
let recycled = false;
const item = {
size: -1,
updateItemOffset(offset) {
if (element.value)
element.value.style.translate = `0 ${offset}px`;
}
};
const recycleHooks = /* @__PURE__ */ new Map([
["brc", [recycle]],
["ru", [reuse]]
]);
Vue.provide("__uni_recycle_state_key_ref", itemKeyRef);
Vue.provide("__uni_recycle_hooks", recycleHooks);
const observer = new ResizeObserver(() => measure());
function unregister() {
if (registeredKey !== void 0 && container.store.itemInstanceMap.get(registeredKey) === item) {
container.store.itemInstanceMap.delete(registeredKey);
}
registeredKey = void 0;
}
function measure() {
if (recycled || !element.value || !element.value.isConnected)
return;
const key = String(props2.itemKey);
if (registeredKey !== key) {
unregister();
registeredKey = key;
container.store.itemInstanceMap.set(key, item);
}
item.updateItemOffset(container.getItemOffset(key));
item.size = element.value.getBoundingClientRect().height;
container.updateItemSize(key, item.size);
}
function recycle() {
recycled = true;
observer.disconnect();
unregister();
}
function reuse() {
recycled = false;
Vue.nextTick(() => {
if (recycled || !element.value)
return;
observer.observe(element.value);
measure();
});
}
Vue.watch(
() => props2.itemKey,
() => measure(),
{ flush: "post" }
);
__expose({ recycleHooks });
const n0 = t0$h();
Vue.initUniElement(n0, _uniListItemElement);
Vue.setInsertionState(n0);
Vue.createSlot();
Vue.setStaticTemplateRef(n0, element, null, "element");
return n0;
}
});
class RecycleListItemDataStore {
constructor() {
this.list = [];
this.keyItemMap = /* @__PURE__ */ new Map();
this.itemInstanceMap = /* @__PURE__ */ new Map();
this.defaultItemSize = 150;
}
realItemSize(item) {
return item.size < 0 ? this.defaultItemSize : item.size;
}
get contentSize() {
const last = this.list[this.list.length - 1];
return last ? last.offset + this.realItemSize(last) : 0;
}
updateKeyList(keys) {
const oldItems = this.keyItemMap;
this.keyItemMap = /* @__PURE__ */ new Map();
this.list = keys.map((key, index2) => {
const instance = this.itemInstanceMap.get(key);
const item = oldItems.get(key) || {
key,
index: index2,
size: instance ? instance.size : -1,
offset: 0
};
item.index = index2;
this.keyItemMap.set(key, item);
return item;
});
this.rebuildItemOffsetsFrom(0);
}
rebuildItemOffsetsFrom(start) {
for (let i = start; i < this.list.length; i++) {
const previous = this.list[i - 1];
this.list[i].offset = previous ? previous.offset + this.realItemSize(previous) : 0;
}
}
updateItemOffset(baseOffset) {
this.itemInstanceMap.forEach((instance, key) => {
const item = this.keyItemMap.get(key);
if (item)
instance.updateItemOffset(item.offset + baseOffset);
});
}
getRenderRange(min, max) {
let low = 0;
let high = this.list.length;
while (low < high) {
const mid = low + high >>> 1;
const item = this.list[mid];
if (item.offset + this.realItemSize(item) < min)
low = mid + 1;
else
high = mid;
}
const start = low;
high = this.list.length;
while (low < high) {
const mid = low + high >>> 1;
if (this.list[mid].offset <= max)
low = mid + 1;
else
high = mid;
}
return [start, low - start];
}
}
const t0$g = Vue.template("<div uni-view></div>");
const t1$8 = Vue.template('<div uni-view style="position: relative; overflow: visible; overflow-anchor: none"><div uni-view style="width: 1px; flex-shrink: 0;"></div></div>');
const _uniListViewElement = { value: "LIST-VIEW" };
const _sfc_main$g = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "list-view",
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniListViewElement, "list-view")
}
},
__name: "list-view",
props: {
scrollIntoView: { type: String, default: "" },
scrollAnchoring: { type: [Boolean, String], default: false },
initialScrollBottom: { type: [Boolean, String], default: false }
},
setup(__props, { expose: __expose }) {
const props2 = __props;
Vue.useAttrs();
const scrollElement = Vue.ref(null);
const headerElement = Vue.ref(null);
const bodyElement = Vue.ref(null);
const placeholderElement = Vue.ref(null);
const renderRange = Vue.ref([0, 0]);
const store = new RecycleListItemDataStore();
const sectionMap = /* @__PURE__ */ new Map();
const idKeyMap = /* @__PURE__ */ new Map();
let keys = [];
let listIds = [];
let size = 0;
let headerSize = 0;
let realScrollOffset = 0;
let scrollOffset = 0;
let fastScrollOffset = 0;
let lastScrollTimestamp = 0;
let lastScrollOffset = 0;
let cachedSizeStart = 200;
let cachedSizeEnd = 200;
let scrolling = false;
let scrollEndTimer;
let queued = false;
let destroyed = false;
let listDataStatus = 0;
let maintainInitialScrollBottom = true;
let anchorKey;
let anchorOffset = 0;
let scrollTarget;
let pendingScrollId = props2.scrollIntoView;
let targetOffset = -1;
let itemSizeChangedCompensation = 0;
let sizeChangeAnchorKey;
let sizeChangeAnchorOffset = 0;
Vue.provide("__uni_recycle_view_instance", Vue.getCurrentInstance());
Vue.provide("__uni_recycle_state_map", /* @__PURE__ */ new Map());
Vue.provide("__uni_recycle_list", {
sectionMap,
queueLayout,
syncDefaultItemSize
});
Vue.provide("__uni_recycle_container", {
store,
updateItemSize,
getItemOffset
});
function updateIdKeyMap() {
if (listIds.length !== keys.length)
return;
idKeyMap.clear();
listIds.forEach((id2, index2) => {
if (id2 && keys[index2])
idKeyMap.set(id2, keys[index2]);
});
}
function updateList(newList) {
if (listDataStatus === 0 && newList.length)
listDataStatus = 1;
else if (listDataStatus === 1)
listDataStatus = 2;
keys = newList;
store.updateKeyList(newList);
updateIdKeyMap();
queueLayout();
}
function updateListIds(ids) {
listIds = ids;
updateIdKeyMap();
queueLayout();
}
function updateRenderInfo(start, length) {
if (renderRange.value[0] !== start || renderRange.value[1] !== length) {
renderRange.value = [start, length];
}
}
function getItemOffset(key) {
const item = store.keyItemMap.get(key);
return item ? item.offset + fastScrollOffset - itemSizeChangedCompensation : -1;
}
function updateItemSize(key, height) {
const item = store.keyItemMap.get(key);
if (!item || item.size === height)
return;
item.size = height;
store.rebuildItemOffsetsFrom(item.index + 1);
if (scrolling && !scrollTarget && sizeChangeAnchorKey) {
const anchor = store.keyItemMap.get(sizeChangeAnchorKey);
if (anchor)
itemSizeChangedCompensation = anchor.offset - sizeChangeAnchorOffset;
}
queueLayout();
}
function syncDefaultItemSize(height) {
if (height > 0)
sectionMap.forEach((section) => section.applyDefaultItemSize(height));
}
function queueLayout() {
if (queued || destroyed)
return;
queued = true;
Vue.nextTick(() => {
queued = false;
if (scrollElement.value)
updateRenderList();
});
}
function linkSection() {
const sections = Array.from(sectionMap.values()).filter(
(section) => section.element && section.element.isConnected
);
sections.sort(
(a, b) => a.element.compareDocumentPosition(b.element) & 4 ? -1 : 1
);
let offsetTop = 0;
sections.forEach((section) => {
section.offsetTop = offsetTop;
offsetTop += section.placeholderSize;
});
return sections;
}
function resolveScrollTarget(sections) {
if (!pendingScrollId)
return;
const key = idKeyMap.get(pendingScrollId);
if (key !== void 0)
scrollTarget = { key };
else {
for (const section of sections) {
const sectionKey = section.resolveKeyById(pendingScrollId);
if (sectionKey !== void 0) {
scrollTarget = { key: sectionKey, section };
break;
}
if (section.element.id === pendingScrollId || section.headerElement && section.headerElement.id === pendingScrollId) {
scrollTarget = { key: "", section };
break;
}
}
}
if (scrollTarget) {
pendingScrollId = "";
maintainInitialScrollBottom = false;
cachedSizeStart = 0;
targetOffset = -1;
}
}
function scrollToOffset(offset) {
const element = scrollElement.value;
element.scrollTo(0, offset);
realScrollOffset = element.scrollTop;
scrollOffset = realScrollOffset;
fastScrollOffset = 0;
}
function updateRenderList() {
const element = scrollElement.value;
const sections = linkSection();
if (placeholderElement.value)
placeholderElement.value.style.height = `${sections.length ? 0 : store.contentSize}px`;
resolveScrollTarget(sections);
if (scrollTarget) {
const { key, section } = scrollTarget;
const item = store.keyItemMap.get(key);
const offset = section ? section.offsetTop + (key ? section.getItemOffset(key) : 0) : item ? item.offset : -1;
if (offset >= 0 && targetOffset !== offset + headerSize) {
targetOffset = offset + headerSize;
scrollToOffset(
targetOffset
);
}
} else if (!sections.length && !scrolling) {
if (props2.initialScrollBottom && maintainInitialScrollBottom && listDataStatus === 1) {
scrollToOffset(
Math.max(element.scrollHeight, headerSize + store.contentSize) - size
);
} else if (props2.scrollAnchoring && anchorKey) {
const anchor = store.keyItemMap.get(anchorKey);
if (anchor) {
scrollToOffset(realScrollOffset + anchor.offset - anchorOffset);
anchorOffset = anchor.offset;
} else
anchorKey = void 0;
}
}
const min = Math.max(
0,
scrollOffset - headerSize - cachedSizeStart + itemSizeChangedCompensation + 0.2
);
const max = scrollOffset - headerSize + size + cachedSizeEnd + itemSizeChangedCompensation - 0.2;
store.updateItemOffset(fastScrollOffset - itemSizeChangedCompensation);
updateRenderInfo(...store.getRenderRange(min, max));
for (const section of sections) {
section.onScrollContextUpdate({
containerSize: size,
headerSize,
renderStartOffset: min + headerSize,
renderEndOffset: max + headerSize
});
}
if (!scrolling)
updateScrollAnchorItem();
}
function updateScrollAnchorItem() {
anchorKey = void 0;
if (!props2.scrollAnchoring || realScrollOffset <= 0 || sectionMap.size)
return;
const offset = realScrollOffset - headerSize;
const [index2] = store.getRenderRange(offset, offset);
const item = store.list[index2];
if (item) {
anchorKey = item.key;
anchorOffset = item.offset;
}
}
function onScroll(e2) {
const element = scrollElement.value;
const offset = Math.max(0, e2.detail.scrollTop);
if (offset < element.scrollHeight - size - 0.2 && Math.abs(offset - realScrollOffset) > 0.2)
maintainInitialScrollBottom = false;
if (!scrolling) {
scrolling = true;
anchorKey = void 0;
const item = store.list[renderRange.value[0] + renderRange.value[1] - 1];
sizeChangeAnchorKey = item && item.key;
sizeChangeAnchorOffset = item ? item.offset : 0;
}
if (offset === 0 || offset >= store.contentSize - size)
itemSizeChangedCompensation = 0;
if (offset + itemSizeChangedCompensation < 0) {
itemSizeChangedCompensation = 0;
scrollToOffset(0);
return;
}
const timestamp = Date.now();
const elapsed = timestamp - lastScrollTimestamp;
const delta = offset - lastScrollOffset;
realScrollOffset = offset;
cachedSizeStart = scrollTarget ? 0 : 200;
cachedSizeEnd = 200;
const fast = sectionMap.size === 0 && !scrollTarget && lastScrollTimestamp > 0 && elapsed > 0 && Math.abs(delta / elapsed) > 15 && offset > 1 && offset < element.scrollHeight - size - 1;
if (fast) {
if (delta > 0)
cachedSizeStart = 0;
else
cachedSizeEnd = 0;
scrollOffset += Math.sign(delta) * Math.min(Math.abs(delta), 120);
fastScrollOffset = offset - scrollOffset;
} else {
scrollOffset = offset;
fastScrollOffset = 0;
}
lastScrollOffset = offset;
lastScrollTimestamp = timestamp;
updateRenderList();
clearTimeout(scrollEndTimer);
scrollEndTimer = setTimeout(onScrollEnd, 150);
}
function onScrollEnd() {
clearTimeout(scrollEndTimer);
if (!scrolling)
return;
scrolling = false;
if (itemSizeChangedCompensation)
scrollToOffset(realScrollOffset + itemSizeChangedCompensation);
itemSizeChangedCompensation = 0;
sizeChangeAnchorKey = void 0;
scrollOffset = realScrollOffset;
fastScrollOffset = 0;
lastScrollTimestamp = 0;
updateRenderList();
scrollTarget = void 0;
cachedSizeStart = 200;
cachedSizeEnd = 200;
updateScrollAnchorItem();
}
new ResizeObserver((entries2) => {
for (const entry of entries2) {
if (entry.target === scrollElement.value)
size = entry.contentRect.height;
else if (entry.target === headerElement.value)
headerSize = entry.borderBoxSize[0].blockSize;
}
queueLayout();
});
new MutationObserver(queueLayout);
Vue.watch(
() => props2.scrollIntoView,
(id2) => {
pendingScrollId = id2;
scrollTarget = void 0;
queueLayout();
}
);
Vue.watch(() => props2.scrollAnchoring, updateScrollAnchorItem);
Vue.watch(() => props2.initialScrollBottom, queueLayout);
__expose({ renderRange, updateList, updateListIds, updateRenderInfo });
const n9 = Vue.withComponentId("34459316", () => Vue.createComponent(__syscom_0, { onScroll: () => onScroll }, {
"refresher": Vue.extend(() => {
const n7 = Vue.createSlot(
"refresher",
null,
null,
4
/* FORWARDED */
);
return n7;
}, {
_: 1
/* NON_STABLE */
}),
"default": () => {
const n1 = t0$g();
Vue.setInsertionState(n1);
Vue.createSlot("header");
const n4 = t1$8();
const n2 = Vue.child(n4);
Vue.setStaticTemplateRef(n1, headerElement, null, "headerElement");
Vue.setStaticTemplateRef(n2, placeholderElement, null, "placeholderElement");
Vue.setInsertionState(n4, 1);
Vue.createSlot();
const n6 = t0$g();
Vue.setStaticTemplateRef(n4, bodyElement, null, "bodyElement");
Vue.setInsertionState(n6);
Vue.createSlot("footer");
return [n1, n4, n6];
}
}, true));
Vue.setStaticTemplateRef(n9, scrollElement, null, "scrollElement");
const _uniListViewRoot = Vue.getBlockFirstNode(n9);
if (_uniListViewRoot && _uniListViewRoot.nodeType === 1) {
_uniListViewRoot.setAttribute("uni-list-view", "");
Vue.initUniElement(_uniListViewRoot, _uniListViewElement);
}
return n9;
}
});
const _UniMatchMediaElement = class _UniMatchMediaElement extends UniViewElement {
};
_UniMatchMediaElement.__uniElement = {};
let UniMatchMediaElement = _UniMatchMediaElement;
const createLifeCycleHook = (lifecycle, flag = 0) => (hook, target = Vue.getCurrentInstance()) => {
if (Vue.isInSSRComponentSetup)
return;
Vue.injectHook(lifecycle, hook, target);
};
const onResize = /* @__PURE__ */ createLifeCycleHook(
uniShared.ON_RESIZE,
2
/* HookFlags.PAGE */
);
const t0$f = Vue.template("<div uni-match-media uni-view>", 1);
const _uniMatchMediaElement = { value: "MATCH-MEDIA" };
const _sfc_main$f = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "match-media",
// @ts-ignore
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniMatchMediaElement, "match-media")
}
},
__name: "match-media",
props: {
orientation: { type: String },
width: { default: "", type: [String, Number] },
minWidth: { default: "", type: [String, Number] },
maxWidth: { default: "", type: [String, Number] },
height: { default: "", type: [String, Number] },
minHeight: { default: "", type: [String, Number] },
maxHeight: { default: "", type: [String, Number] }
},
setup(__props) {
const RE_MQ_FEATURE = /^(min|max)?([A-Z]?[a-z]+)(?:([A-Z])([a-z]+))?$/;
const props2 = __props;
const show = Vue.ref(false);
show.value = isValid(getExpressions(), {
width: uni.getWindowInfo().windowWidth,
height: uni.getWindowInfo().windowHeight,
orientation: uni.getDeviceInfo().deviceOrientation
});
onResize((res) => {
const expressions = getExpressions();
show.value = isValid(expressions, {
width: res.size.windowWidth,
height: res.size.windowHeight,
orientation: res.deviceOrientation
});
});
Vue.watch(props2, () => {
const expressions = getExpressions();
const { windowWidth, windowHeight } = uni.getWindowInfo();
show.value = isValid(expressions, {
width: windowWidth,
height: windowHeight,
orientation: uni.getDeviceInfo().deviceOrientation
});
});
function getExpressions() {
const expressions = [];
Object.keys(props2).forEach((key) => {
const value = props2[key];
const feature = key.match(RE_MQ_FEATURE);
if (value != null && feature != null && feature.length > 0) {
expressions.push({
modifier: feature[1] != null ? feature[1] : "",
feature: feature[2] != null ? feature[2].toLowerCase() : "",
value
});
}
});
return expressions;
}
function isValid(expressions, values) {
return expressions.every((expression) => {
switch (expression.feature) {
case "orientation":
return props2.orientation != null ? values.orientation === props2.orientation : true;
}
if (expression.value === "") {
return true;
}
const expressionValue = values[expression.feature];
switch (expression.modifier) {
case "min":
return parseFloat(expression.value) <= expressionValue;
case "max":
return parseFloat(expression.value) >= expressionValue;
default:
return parseFloat(expression.value) === expressionValue;
}
});
}
const n0 = t0$f();
Vue.initUniElement(n0, _uniMatchMediaElement);
Vue.setInsertionState(n0);
Vue.createSlot();
Vue.applyVShow(n0, () => Vue.unref(show));
return n0;
}
});
const _UniNavigatorElement = class _UniNavigatorElement extends UniViewElement {
};
_UniNavigatorElement.__uniElement = {};
let UniNavigatorElement = _UniNavigatorElement;
const t0$e = Vue.template("<span uni-navigator uni-text>", 1);
const t1$7 = Vue.template("<div uni-navigator uni-view>", 1);
const _uniNavigatorElement = { value: "NAVIGATOR" };
const _sfc_main$e = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "navigator",
// @ts-ignore
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniNavigatorElement, "navigator")
}
},
__name: "navigator",
props: {
openType: { default: "navigate", type: String },
url: { default: "", type: String },
animationType: { default: "", type: String },
animationDuration: { default: 300, type: Number },
delta: { default: 1, type: Number }
},
setup(__props) {
var _a;
const props2 = __props;
const slots = Vue.useSlots();
const isStringSlot = ((_a = slots["default"]) == null ? void 0 : _a["returnType"]) === "string";
const handleTap = () => {
const url = props2.url;
const openType = props2.openType;
const onFail = (res) => {
console.error(res.errMsg);
};
switch (openType) {
case "navigate":
uni.navigateTo({
url,
animationType: props2.animationType || "pop-in",
animationDuration: props2.animationDuration,
fail: onFail
});
break;
case "navigateBack":
uni.navigateBack({
delta: props2.delta,
animationType: props2.animationType || "pop-out",
animationDuration: props2.animationDuration,
fail: onFail
});
break;
case "redirect":
uni.redirectTo({
url,
fail: onFail
});
break;
case "reLaunch":
uni.reLaunch({
url,
fail: onFail
});
break;
case "switchTab":
uni.switchTab({
url,
fail: onFail
});
break;
default:
console.log("<navigator/> openType attribute invalid");
break;
}
};
const n0 = Vue.createIf(
() => isStringSlot,
() => {
const n2 = t0$e();
Vue.initUniElement(n2, _uniNavigatorElement);
Vue.setInsertionState(n2);
Vue.createSlot(
"default",
null,
null,
256
/* TEXT_MODE */
);
Vue.on(n2, "click", handleTap);
return n2;
},
() => {
const n5 = t1$7();
Vue.initUniElement(n5, _uniNavigatorElement);
Vue.setInsertionState(n5);
Vue.createSlot();
Vue.on(n5, "click", handleTap);
return n5;
},
261
/* TRUE_SINGLE_ROOT, FALSE_SINGLE_ROOT, KEYED_INDEX_0 */
);
return n0;
}
});
class UniVueElement extends Object {
}
const _UniPageContainerElement = class _UniPageContainerElement extends UniVueElement {
};
_UniPageContainerElement.__uniElement = {};
let UniPageContainerElement = _UniPageContainerElement;
const t0$d = Vue.template("<div uni-view class=uni-page-container-overlay>");
const t1$6 = Vue.template("<div uni-view>");
const MAX_SLIDER_DISTANCE = 100;
const MIN_SLIDER_VELOCITY = 0.3;
const _sfc_main$d = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "page-container",
rootElement: {
class: UniPageContainerElement
}
},
__name: "page-container",
props: {
show: { type: Boolean, default: false },
duration: { default: 300, type: Number },
zIndex: { default: 100, type: Number },
overlay: { type: Boolean, default: true },
round: { type: Boolean, default: false },
position: { default: "bottom", type: String },
customStyle: { default: "", type: String },
overlayStyle: { default: "", type: String },
closeOnSlideDown: { type: Boolean, default: false }
},
emits: ["beforeenter", "enter", "afterenter", "beforeleave", "leave", "afterleave", "clickoverlay"],
__multiRoot: true,
setup(__props, { emit: __emit }) {
const props2 = __props;
const emits2 = __emit;
const showPageContainer = Vue.ref(false);
const isAnimating = Vue.ref(false);
const transitionTimer = Vue.ref(null);
const isEntered = Vue.ref(false);
const transitionType = Vue.ref(null);
let transitionVersion = 0;
let touchStartX = 0;
let touchStartY = 0;
let touchStartTime = 0;
let isDragging = false;
const translateValue = Vue.ref(0);
const isSlideClosing = Vue.ref(false);
const isSlideLeaving = Vue.ref(false);
const overlayStyleMap = Vue.computed(() => {
const styleMap = {
"z-index": props2.zIndex,
"transition-duration": props2.duration + "ms"
};
if (isEntered.value) {
styleMap["opacity"] = "1";
styleMap["pointer-events"] = "auto";
}
return styleMap;
});
const innerStyleMap = Vue.computed(() => {
const styleMap = {
"z-index": props2.zIndex + 1,
"transition-duration": props2.duration + "ms"
};
if (translateValue.value != 0 && (isDragging || isSlideClosing.value)) {
let transformValue = "";
if (isSlideLeaving.value) {
switch (props2.position) {
case "bottom":
transformValue = "translateY(100%)";
break;
case "top":
transformValue = "translateY(-100%)";
break;
case "left":
transformValue = "translateX(-100%)";
break;
case "right":
transformValue = "translateX(100%)";
break;
}
} else {
switch (props2.position) {
case "bottom":
case "top":
transformValue = `translateY(${translateValue.value}px)`;
break;
case "left":
case "right":
transformValue = `translateX(${translateValue.value}px)`;
break;
}
}
if (transformValue != "") {
styleMap["transform"] = transformValue;
styleMap["transition"] = isDragging ? "none" : `transform ${props2.duration}ms ease`;
}
} else if (translateValue.value != 0 && !isDragging) {
styleMap["transition"] = `transform ${props2.duration}ms ease`;
}
return styleMap;
});
const popupClasses = Vue.computed(() => {
const classes2 = [];
if (props2.position != null) {
classes2.push(`uni-page-container-popup-${props2.position}`);
}
if (props2.round) {
classes2.push("uni-page-container-popup-round");
}
if (isEntered.value) {
classes2.push("uni-page-container-popup-enter");
}
return classes2;
});
function resetDragState() {
isDragging = false;
isSlideClosing.value = false;
isSlideLeaving.value = false;
translateValue.value = 0;
}
function clearTransitionTimer() {
if (transitionTimer.value != null) {
clearTimeout(transitionTimer.value);
transitionTimer.value = null;
}
}
function cancelTransition() {
transitionVersion++;
clearTransitionTimer();
isAnimating.value = false;
transitionType.value = null;
}
function onAnimationEnd(type, version) {
if (version != transitionVersion || transitionType.value != type) {
return;
}
isAnimating.value = false;
clearTransitionTimer();
transitionType.value = null;
if (type == "enter") {
emits2("afterenter");
} else if (type == "leave") {
showPageContainer.value = false;
isEntered.value = false;
resetDragState();
emits2("afterleave");
}
}
function listenTransitionEnd(type, version) {
clearTransitionTimer();
transitionTimer.value = setTimeout(() => {
onAnimationEnd(type, version);
}, props2.duration);
}
function closeContainer() {
if (!showPageContainer.value || transitionType.value == "leave") {
return;
}
if (transitionType.value == "enter") {
cancelTransition();
}
emits2("beforeleave");
isAnimating.value = true;
transitionType.value = "leave";
transitionVersion++;
const version = transitionVersion;
Vue.nextTick(() => {
if (version != transitionVersion || transitionType.value != "leave") {
return;
}
isEntered.value = false;
emits2("leave");
listenTransitionEnd("leave", version);
});
}
function openContainer() {
if (transitionType.value == "enter" && showPageContainer.value) {
return;
}
if (transitionType.value == "leave") {
cancelTransition();
}
emits2("beforeenter");
showPageContainer.value = true;
isEntered.value = false;
isAnimating.value = true;
transitionType.value = "enter";
transitionVersion++;
const version = transitionVersion;
resetDragState();
Vue.nextTick(() => {
if (version != transitionVersion || transitionType.value != "enter") {
return;
}
emits2("enter");
requestAnimationFrame(() => {
if (version != transitionVersion || transitionType.value != "enter") {
return;
}
requestAnimationFrame(() => {
if (version != transitionVersion || transitionType.value != "enter") {
return;
}
if (!props2.show) {
closeContainer();
return;
}
isEntered.value = true;
listenTransitionEnd("enter", version);
});
});
});
}
Vue.watch(() => props2.show, (newVal) => {
if (newVal && (!showPageContainer.value || transitionType.value == "leave")) {
openContainer();
} else if (!newVal && showPageContainer.value && transitionType.value != "leave") {
closeContainer();
}
});
function onClickOverlay(event) {
if (isAnimating.value) {
return;
}
emits2("clickoverlay", event);
Vue.nextTick(() => {
closeContainer();
});
}
function onTouchStart(e2) {
if (!props2.closeOnSlideDown) {
return;
}
if (e2.touches.length > 0) {
const { clientX, clientY } = e2.touches[0];
touchStartX = clientX;
touchStartY = clientY;
touchStartTime = Date.now();
isDragging = false;
}
}
function onTouchMove(e2) {
if (!props2.closeOnSlideDown) {
e2.preventDefault();
e2.stopPropagation();
return;
}
if (e2.touches.length > 0) {
const { clientX, clientY } = e2.touches[0];
const deltaX = clientX - touchStartX;
const deltaY = clientY - touchStartY;
let shouldDrag = false;
let dragValue = 0;
switch (props2.position) {
case "bottom":
if (deltaY > 0) {
shouldDrag = true;
dragValue = deltaY;
}
break;
case "top":
if (deltaY < 0) {
shouldDrag = true;
dragValue = deltaY;
}
break;
case "left":
if (deltaX < 0) {
shouldDrag = true;
dragValue = deltaX;
}
break;
case "right":
if (deltaX > 0) {
shouldDrag = true;
dragValue = deltaX;
}
break;
}
if (shouldDrag) {
isDragging = true;
translateValue.value = dragValue;
e2.preventDefault();
e2.stopPropagation();
}
}
}
function onTouchEnd() {
if (!props2.closeOnSlideDown) {
return;
}
if (isDragging) {
const deltaTime = Date.now() - touchStartTime;
const velocity = Math.abs(translateValue.value) / deltaTime;
const shouldClose = Math.abs(translateValue.value) > MAX_SLIDER_DISTANCE || velocity > MIN_SLIDER_VELOCITY;
if (shouldClose) {
resetDragState();
closeContainer();
} else {
resetDragState();
}
}
}
function onTouchCancel() {
if (!props2.closeOnSlideDown) {
return;
}
if (isDragging) {
resetDragState();
}
}
const n0 = Vue.createIf(() => __props.overlay && Vue.unref(showPageContainer), () => {
const n2 = t0$d();
Vue.on(n2, "click", onClickOverlay);
Vue.on(n2, "touchmove", Vue.withModifiers(() => {
}, ["prevent", "stop"]));
Vue.renderEffect(() => Vue.setStyle(n2, [Vue.unref(overlayStyleMap), __props.overlayStyle]));
return n2;
});
const n3 = Vue.createIf(() => Vue.unref(showPageContainer), () => {
const n6 = t1$6();
Vue.renderEffect(() => {
Vue.setClass(n6, ["uni-page-container-popup", Vue.unref(popupClasses)]);
Vue.setStyle(n6, [Vue.unref(innerStyleMap), __props.customStyle]);
});
Vue.setInsertionState(n6);
Vue.createSlot();
Vue.on(n6, "touchstart", onTouchStart);
Vue.on(n6, "touchmove", onTouchMove);
Vue.on(n6, "touchend", onTouchEnd);
Vue.on(n6, "touchcancel", onTouchCancel);
return n6;
});
return [n0, n3];
}
});
const _UniPickerElement = class _UniPickerElement extends UniViewElement {
constructor() {
super(...arguments);
this.tagName = "PICKER";
this.nodeName = "PICKER";
this._value = "";
}
get value() {
var _a;
return ((_a = this.vm) == null ? void 0 : _a.getPickerValue()) ?? this._value;
}
set value(val) {
var _a;
this._value = val;
(_a = this.vm) == null ? void 0 : _a.setPickerValue(val);
}
};
_UniPickerElement.__uniElement = { vm: true, init() {
Object.defineProperty(this, "_value", { value: "", writable: true, enumerable: true, configurable: true });
} };
let UniPickerElement = _UniPickerElement;
const t0$c = Vue.template("<div uni-picker uni-view>", 1);
const _uniPickerElement = { value: "PICKER" };
const OPEN_LOCK_DURATION = 300;
const _sfc_main$c = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "picker",
// @ts-ignore
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniPickerElement, "picker")
}
},
__name: "picker",
props: {
disabled: { type: Boolean, default: false },
mode: { default: "selector", type: String },
selectorType: { default: "", type: String },
range: { default: [], type: Array },
rangeKey: { default: "", type: String },
value: { default: "", type: [Number, String, Array] },
start: { default: "", type: String },
end: { default: "", type: String },
fields: { default: "day", type: String },
name: { default: "", type: String }
},
emits: ["change", "columnchange", "cancel"],
setup(__props, { expose: __expose, emit: __emit }) {
var _a;
const uuid = `${Date.now()}${Math.floor(Math.random() * 1e7)}`;
const baseEventName = `uni_picker_${uuid}`;
const readyEventName = `${baseEventName}_ready`;
const optionsEventName = `${baseEventName}_options`;
const selectorChangeEventName = `${baseEventName}_selector_change`;
const cancelEventName = `${baseEventName}_cancel_change`;
const multiSelectorChangeEventName = `${baseEventName}_multiSelector_change`;
const timeChangeEventName = `${baseEventName}_time_change`;
const columnChangeEventName = `${baseEventName}_column_change`;
const props2 = __props;
Vue.inject(FORM_KEY, null);
Vue.inject(LABEL_KEY, null);
const attrs2 = Vue.useAttrs();
attrs2.id;
(_a = Vue.getCurrentInstance()) == null ? void 0 : _a.proxy;
const innerValue = Vue.ref(props2.value);
Vue.ref("");
const isOpening = Vue.ref(false);
Vue.watch(() => props2.value, (value) => {
innerValue.value = value;
if (props2.mode == "multiSelector") {
uni.$emit(optionsEventName, {
range: props2.range,
rangeKey: props2.rangeKey,
multiSelectorValue: value ?? []
});
}
}, { deep: true });
function handleClick() {
if (props2.disabled) {
return;
}
if (isOpening.value) {
return;
}
isOpening.value = true;
uni.openDialogPage({
url: `uni:picker?readyEventName=${readyEventName}&optionsEventName=${optionsEventName}&cancelEventName=${cancelEventName}&selectorChangeEventName=${selectorChangeEventName}&multiSelectorChangeEventName=${multiSelectorChangeEventName}&timeChangeEventName=${timeChangeEventName}&columnChangeEventName=${columnChangeEventName}`,
success() {
setTimeout(() => {
isOpening.value = false;
}, OPEN_LOCK_DURATION);
},
fail() {
isOpening.value = false;
uni.$off(readyEventName);
uni.$off(optionsEventName);
}
});
}
__expose({
getPickerValue: () => {
return innerValue.value;
},
setPickerValue: (value) => {
innerValue.value = value;
}
});
const n0 = t0$c();
Vue.initUniElement(n0, _uniPickerElement);
Vue.setInsertionState(n0);
Vue.createSlot();
Vue.on(n0, "click", handleClick);
return n0;
}
});
const _UniPickerViewElement = class _UniPickerViewElement extends UniViewElement {
};
_UniPickerViewElement.__uniElement = {};
let UniPickerViewElement = _UniPickerViewElement;
const t0$b = Vue.template("<div uni-picker-view uni-view class=uni-picker-view>", 1);
const _uniPickerViewElement = { value: "PICKER-VIEW" };
const _sfc_main$b = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "picker-view",
// @ts-ignore
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniPickerViewElement, "picker-view")
},
externalClasses: ["mask-class", "indicator-class"]
},
__name: "picker-view",
props: {
indicatorStyle: { default: "", type: String },
indicatorClass: { default: "", type: null },
maskClass: { default: "", type: null },
maskTopStyle: { default: "", type: String },
maskBottomStyle: { default: "", type: String },
name: { default: "", type: String },
value: { default: () => [], type: Array }
},
emits: ["change"],
setup(__props, { emit: __emit }) {
const props2 = __props;
class UniCustomEvent3 {
constructor(type, detail) {
this.detail = detail;
}
}
class UniPickerViewChangeEvent extends UniCustomEvent3 {
constructor(value) {
super("change", { value });
}
}
const emit2 = __emit;
function parseIndicatorHeight(styleStr) {
const re = /height\s*:\s*(\d+)px/i;
const m = re.exec(styleStr);
if (m && m.length > 1) {
const n = parseInt(m[1]);
if (!isNaN(n) && n > 0)
return n;
}
return 50;
}
const itemHeight = Vue.computed(() => parseIndicatorHeight(props2.indicatorStyle));
const pickViewRef = Vue.ref(null);
const offsetHeight = Vue.ref(100);
const containerPaddingPx = Vue.computed(() => (offsetHeight.value - itemHeight.value) / 2 + "px");
const maskTopInlineStyle = Vue.computed(() => props2.maskTopStyle ? props2.maskTopStyle : {});
const maskBottomInlineStyle = Vue.computed(() => props2.maskBottomStyle ? props2.maskBottomStyle : {});
const indicatorInlineStyle = Vue.computed(() => props2.indicatorStyle ? props2.indicatorStyle : {});
const innerValue = Vue.ref([]);
const columns = [];
function normalizeValue2(value) {
return columns.map((_, i) => value[i] ?? 0);
}
function syncFromProp(indexes) {
innerValue.value = indexes;
setTimeout(() => {
for (let i = 0; i < columns.length; i++) {
const api2 = columns[i];
const index2 = indexes[i];
api2.setScrollTop(index2);
}
}, 30);
}
Vue.watch(() => props2.value, (newValue) => {
syncFromProp(normalizeValue2(newValue));
}, { deep: true });
function registerColumn(api2) {
columns.push(api2);
const idx = columns.length - 1;
return idx;
}
function unregisterColumn(api2) {
const i = columns.indexOf(api2);
if (i >= 0) {
columns.splice(i, 1);
}
}
function onColumnIndexChange(col, index2) {
const curr = innerValue.value.slice();
if (curr[col] !== index2) {
curr[col] = index2;
innerValue.value = curr;
emit2("change", new UniPickerViewChangeEvent(curr));
}
}
Vue.provide(PICKER_VIEW_KEY, {
itemHeight: () => itemHeight.value,
containerPaddingPx: () => containerPaddingPx.value,
maskClass: () => props2.maskClass,
indicatorClass: () => props2.indicatorClass,
maskTopStyle: () => maskTopInlineStyle.value,
maskBottomStyle: () => maskBottomInlineStyle.value,
indicatorStyle: () => indicatorInlineStyle.value,
registerColumn,
unregisterColumn,
onColumnIndexChange
});
Vue.inject(FORM_KEY, null);
const n0 = t0$b();
Vue.initUniElement(n0, _uniPickerViewElement);
Vue.setInsertionState(n0);
Vue.createSlot();
Vue.setStaticTemplateRef(n0, pickViewRef, null, "pickViewRef");
return n0;
}
});
const _UniPickerViewColumnElement = class _UniPickerViewColumnElement extends UniViewElement {
};
_UniPickerViewColumnElement.__uniElement = {};
let UniPickerViewColumnElement = _UniPickerViewColumnElement;
const t0$a = Vue.template("<div uni-view>");
const t1$5 = Vue.template("<div uni-picker-view-column uni-view class=picker-view-column tabindex=0><!><div uni-view></div><div uni-view></div><div uni-view>", 1);
const _uniPickerViewColumnElement = { value: "PICKER-VIEW-COLUMN" };
const EPSILON = 1;
const _sfc_main$a = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "picker-view-column",
// @ts-ignore
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniPickerViewColumnElement, "picker-view-column")
}
},
__name: "picker-view-column",
setup(__props) {
const ctx = Vue.inject(PICKER_VIEW_KEY);
const itemHeight = Vue.computed(() => ctx ? ctx.itemHeight() : 50);
const containerPaddingPx = Vue.computed(() => ctx ? ctx.containerPaddingPx() : "50%");
const maskClass = Vue.computed(() => ctx ? ctx.maskClass() : "");
const indicatorClass = Vue.computed(() => ctx ? ctx.indicatorClass() : "");
const maskTopInlineStyle = Vue.computed(() => ctx ? ctx.maskTopStyle() : {});
const maskBottomInlineStyle = Vue.computed(() => ctx ? ctx.maskBottomStyle() : {});
const indicatorInlineStyle = Vue.computed(() => ctx ? ctx.indicatorStyle() : {});
const selectedIndex = Vue.ref(0);
const isScrolling = Vue.ref(false);
const scrollViewRef = Vue.ref(null);
const rootRef = Vue.ref(null);
const contentRef = Vue.ref(null);
const scrollWithAnimation = Vue.ref(false);
let keyboardTargetIndex = null;
function clearKeyboardTarget() {
keyboardTargetIndex = null;
}
function handleKeydown(event) {
var _a;
if (event.target !== event.currentTarget || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || event.key !== "ArrowUp" && event.key !== "ArrowDown") {
return;
}
event.preventDefault();
const itemCount = ((_a = contentRef.value) == null ? void 0 : _a.children.length) ?? 0;
if (itemCount === 0 || scrollViewRef.value == null) {
return;
}
const step = event.key === "ArrowUp" ? -1 : 1;
const targetIndex = Math.max(0, Math.min(itemCount - 1, selectedIndex.value + step));
if (targetIndex === selectedIndex.value) {
return;
}
keyboardTargetIndex = targetIndex;
setScrollTop(targetIndex);
ctx == null ? void 0 : ctx.onColumnIndexChange(columnIndex, targetIndex);
}
let isAdjusting = false;
let columnIndex = -1;
function setScrollTop(idx) {
var _a;
if (idx < 0) {
idx = 0;
}
if (keyboardTargetIndex != null && keyboardTargetIndex !== idx) {
clearKeyboardTarget();
}
selectedIndex.value = idx;
const scrollTop = Math.max(0, idx * itemHeight.value);
(_a = scrollViewRef.value) == null ? void 0 : _a.scrollTo(0, scrollTop);
}
function onScroll() {
if (!isScrolling.value) {
isScrolling.value = true;
}
}
function onScrollEnd(e2) {
var _a;
isScrolling.value = false;
if (isAdjusting) {
return;
}
const top = Math.max(e2.detail.scrollTop, 0);
if (keyboardTargetIndex != null) {
const itemCount = ((_a = contentRef.value) == null ? void 0 : _a.children.length) ?? 0;
if (keyboardTargetIndex < itemCount) {
if (Math.abs(top - keyboardTargetIndex * itemHeight.value) > EPSILON) {
setScrollTop(keyboardTargetIndex);
} else {
clearKeyboardTarget();
}
return;
}
clearKeyboardTarget();
}
const idx = Math.round(top / itemHeight.value);
const valueChanged = selectedIndex.value !== idx;
if (Math.abs(top - idx * itemHeight.value) > EPSILON) {
isAdjusting = true;
setScrollTop(idx);
setTimeout(() => {
isAdjusting = false;
}, 0);
} else {
selectedIndex.value = idx;
}
if (valueChanged) {
ctx == null ? void 0 : ctx.onColumnIndexChange(columnIndex, idx);
}
}
function handleClick(e2) {
var _a, _b;
if (!rootRef.value || !scrollViewRef.value || isScrolling.value) {
return;
}
const { top, height } = rootRef.value.getBoundingClientRect();
const y = e2.clientY - top;
let containerPadding = 0;
const paddingStr = containerPaddingPx.value;
if (paddingStr.includes("%")) {
containerPadding = parseFloat(paddingStr) / 100 * height;
} else {
containerPadding = parseFloat(paddingStr);
}
const currentScrollTop = scrollViewRef.value.scrollTop;
const actualY = y + currentScrollTop - containerPadding;
const targetIndex = Math.floor(actualY / itemHeight.value);
const itemCount = (_b = (_a = contentRef.value) == null ? void 0 : _a.children) == null ? void 0 : _b.length;
const isIndexValid = targetIndex >= 0 && (itemCount ? targetIndex < itemCount : true);
if (isIndexValid && targetIndex !== selectedIndex.value) {
setScrollTop(targetIndex);
ctx == null ? void 0 : ctx.onColumnIndexChange(columnIndex, targetIndex);
}
}
const n0 = t1$5();
const n7 = Vue.child(n0);
const n4 = Vue.next(n7);
const n5 = Vue.next(n4);
const n6 = Vue.next(n5);
Vue.initUniElement(n0, _uniPickerViewColumnElement);
Vue.setInsertionState(n0, n7);
const n3 = Vue.withComponentId("8e57cce2", () => Vue.createComponent(__syscom_0, {
class: "picker-view-scroll",
direction: "vertical",
"show-scrollbar": false,
"scroll-with-animation": () => Vue.unref(scrollWithAnimation),
onScrollend: () => onScrollEnd,
onScroll: () => onScroll
}, () => {
const n2 = t0$a();
Vue.renderEffect(() => {
const _containerPaddingPx = Vue.unref(containerPaddingPx);
Vue.setStyle(n2, { "padding-top": _containerPaddingPx, "padding-bottom": _containerPaddingPx });
});
Vue.setInsertionState(n2);
Vue.createSlot();
Vue.setStaticTemplateRef(n2, contentRef, null, "contentRef");
return n2;
}));
Vue.setStaticTemplateRef(n3, scrollViewRef, null, "scrollViewRef");
Vue.on(n0, "keydown", handleKeydown);
Vue.on(n0, "mousedown", clearKeyboardTarget);
Vue.on(n0, "touchstart", clearKeyboardTarget);
Vue.on(n0, "wheel", clearKeyboardTarget);
Vue.on(n0, "click", handleClick);
Vue.setStaticTemplateRef(n0, rootRef, null, "rootRef");
Vue.renderEffect(() => {
const _maskClass = Vue.unref(maskClass);
Vue.setClass(n4, ["uni-picker-view-mask uni-picker-view-mask-top", _maskClass]);
Vue.setStyle(n4, Vue.unref(maskTopInlineStyle));
Vue.setClass(n5, ["uni-picker-view-indicator", Vue.unref(indicatorClass)]);
Vue.setStyle(n5, Vue.unref(indicatorInlineStyle));
Vue.setClass(n6, ["uni-picker-view-mask uni-picker-view-mask-bottom", _maskClass]);
Vue.setStyle(n6, Vue.unref(maskBottomInlineStyle));
});
return n0;
}
});
const _UniProgressElement = class _UniProgressElement extends UniViewElement {
};
_UniProgressElement.__uniElement = {};
let UniProgressElement = _UniProgressElement;
const t0$9 = Vue.template("<span uni-text class=uni-progress-value> ");
const t1$4 = Vue.template("<div uni-progress uni-view class=uni-progress><div uni-view class=uni-progress-background><div uni-view class=uni-progress-fill></div></div>", 1);
const _uniProgressElement = { value: "PROGRESS" };
const _sfc_main$9 = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "progress",
// @ts-ignore
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniProgressElement, "progress")
}
},
__name: "progress",
props: {
duration: { default: 30, type: Number },
percent: { default: 0, type: Number },
active: { type: Boolean, default: false },
activeMode: { default: "backwards", type: String },
backgroundColor: { default: "#ebebeb", type: String },
strokeWidth: { default: 3, type: Number },
activeColor: { default: "#007aff", type: String },
showInfo: { type: Boolean, default: false },
borderRadius: { default: 0, type: Number },
fontSize: { default: 12, type: Number }
},
emits: ["activeend"],
setup(__props, { emit: __emit }) {
const props2 = __props;
class UniCustomEvent3 {
constructor(type, detail) {
this.detail = detail;
}
}
class UniProgressActiveendEvent extends UniCustomEvent3 {
constructor(type, curPercent) {
super(type, { curPercent });
}
}
const emit2 = __emit;
const fillRef = Vue.ref(null);
let _timerId = 0;
let _rafId = 0;
let _lastPercent = 0;
let _startPercent = 0;
let _targetPercent = 0;
let _startTime = 0;
const percentText = Vue.ref("0%");
const backgroundStyle = Vue.computed(() => {
return {
"background-color": props2.backgroundColor,
"height": props2.strokeWidth + "px",
"border-radius": props2.borderRadius + "px"
};
});
const foregroundStyle = Vue.computed(() => {
return {
"background-color": props2.activeColor
};
});
const fontStyle = Vue.computed(() => {
return {
"font-size": props2.fontSize + "px"
};
});
Vue.watch(() => props2.percent, () => {
_animate();
});
function renderVisuals(percent) {
percentText.value = Math.round(percent) + "%";
let scale = percent / 100;
if (scale > 0 && scale < 1e-3) {
scale = 1e-3;
}
const fillEl = fillRef.value;
if (fillEl != null) {
fillEl.style.setProperty("transform", `scaleX(${scale})`);
}
}
function _animate() {
const final_percent = Math.max(0, Math.min(100, props2.percent));
if (!props2.active) {
renderVisuals(final_percent);
return;
}
clearTimer();
_startPercent = props2.activeMode == "forwards" ? _lastPercent : 0;
_targetPercent = final_percent;
_startTime = Date.now();
renderVisuals(_startPercent);
function animateFrame() {
const currentTime = Date.now();
const elapsed = currentTime - _startTime;
const totalDuration = props2.duration * Math.abs(_targetPercent - _startPercent);
if (elapsed >= totalDuration) {
renderVisuals(_targetPercent);
emit2("activeend", new UniProgressActiveendEvent("activeend", _targetPercent));
_lastPercent = _targetPercent;
_rafId = 0;
} else {
const progress = elapsed / totalDuration;
const currentPercent = _startPercent + (_targetPercent - _startPercent) * progress;
renderVisuals(currentPercent);
_rafId = requestAnimationFrame(animateFrame);
}
}
_rafId = requestAnimationFrame(animateFrame);
}
function clearTimer() {
clearInterval(_timerId);
if (_rafId != 0) {
cancelAnimationFrame(_rafId);
_rafId = 0;
}
}
const n0 = t1$4();
const n2 = Vue.child(n0);
const n1 = Vue.child(n2);
Vue.initUniElement(n0, _uniProgressElement);
Vue.setStaticTemplateRef(n1, fillRef, null, "fillRef");
Vue.renderEffect(() => {
Vue.setStyle(n2, Vue.unref(backgroundStyle));
Vue.setStyle(n1, Vue.unref(foregroundStyle));
});
Vue.setInsertionState(n0, 1);
Vue.createIf(() => __props.showInfo, () => {
const n5 = t0$9();
const x5 = Vue.txt(n5);
Vue.renderEffect(() => {
Vue.setStyle(n5, Vue.unref(fontStyle));
Vue.setText(x5, Vue.normalizeUniText(Vue.toDisplayString(Vue.unref(percentText))));
});
return n5;
});
return n0;
}
});
const _UniRadioElement = class _UniRadioElement extends UniViewElement {
constructor() {
super(...arguments);
this.tagName = "RADIO";
this.nodeName = "RADIO";
this._checked = false;
}
get checked() {
var _a;
return ((_a = this.vm) == null ? void 0 : _a.getRadioChecked()) ?? this._checked;
}
set checked(val) {
var _a;
this._checked = val;
(_a = this.vm) == null ? void 0 : _a.setRadioChecked(val);
}
};
_UniRadioElement.__uniElement = { vm: true, init() {
Object.defineProperty(this, "_checked", { value: false, writable: true, enumerable: true, configurable: true });
} };
let UniRadioElement = _UniRadioElement;
const t0$8 = Vue.template('<svg class=uni-radio-svg viewBox="0 0 32 32"><path fill=currentColor>', 0, 1);
const t1$3 = Vue.template("<div uni-radio uni-view role=radio>", 1);
const t2 = Vue.template("<span uni-text>");
const t3 = Vue.template("<div uni-radio uni-view class=uni-radio role=radio><div uni-view></div>", 1);
const _uniRadioElement = { value: "RADIO" };
const iconPath = "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 _sfc_main$8 = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "radio",
// @ts-ignore
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniRadioElement, "radio")
},
externalClasses: ["icon-class", "radio-class", "radio-active-class"]
},
__name: "radio",
props: {
color: { default: "", type: String },
disabled: { type: Boolean, default: false },
checked: { type: Boolean, default: false },
value: { default: "", type: String },
iconClass: { default: "", type: null },
radioClass: { default: "", type: null },
radioActiveClass: { default: "", type: null }
},
setup(__props, { expose: __expose }) {
var _a, _b;
const props2 = __props;
const { handleKeydown, handleKeyup, handleBlur } = createSpaceKeyHandlers(() => props2.disabled);
const attrs2 = Vue.useAttrs();
attrs2.id;
const slots = Vue.useSlots();
const isStringSlot = ((_a = slots["default"]) == null ? void 0 : _a["returnType"]) == "string";
const hasDefaultSlot = slots["default"] != null;
(_b = Vue.getCurrentInstance()) == null ? void 0 : _b.proxy;
const isChecked = Vue.ref(false);
const activeStyle = Vue.computed(() => {
if (isChecked.value && !props2.disabled && props2.color) {
return {
"background-color": props2.color,
"border-color": props2.color
};
}
return {};
});
const groupCtx = Vue.inject(RADIO_GROUP_KEY, null);
Vue.inject(LABEL_KEY, null);
const setChecked = (checked, syncGroup) => {
if (syncGroup && groupCtx != null) {
const value = toStringOrEmpty(props2.value);
if (checked) {
groupCtx.setSelectedValue(value);
} else if (groupCtx.selectedValue.value == value) {
groupCtx.setSelectedValue(null);
}
return;
}
isChecked.value = checked;
};
if (groupCtx != null) {
Vue.watch(() => groupCtx.selectedValue.value, (val) => {
setChecked(val == toStringOrEmpty(props2.value), false);
}, { immediate: true });
Vue.watch(() => props2.checked, (value) => {
setChecked(value, true);
});
} else {
Vue.watch(() => props2.checked, (value) => {
setChecked(value, false);
}, { immediate: true });
}
const handleTap = () => {
if (props2.disabled || isChecked.value) {
return;
}
if (groupCtx != null) {
groupCtx.change(toStringOrEmpty(props2.value));
} else {
setChecked(true, false);
}
};
__expose({
getRadioChecked: () => {
return isChecked.value;
},
setRadioChecked: (checked) => {
setChecked(checked, true);
}
});
const n0 = Vue.createIf(
() => !hasDefaultSlot,
() => {
const n2 = t1$3();
Vue.initUniElement(n2, _uniRadioElement);
Vue.renderEffect(() => {
const _disabled = __props.disabled;
const _isChecked = Vue.unref(isChecked);
Vue.setClass(n2, ["uni-radio-view uni-radio-icon", Vue.unref(classes)(
[_disabled, "uni-radio-disabled"],
[!_disabled && _isChecked, "uni-radio-active"],
[!_disabled && _isChecked, __props.radioActiveClass],
[!_disabled && !_isChecked, __props.radioClass],
[!_disabled, __props.iconClass]
)]);
Vue.setStyle(n2, Vue.unref(activeStyle));
Vue.setProp(n2, "tabindex", _disabled ? -1 : 0);
Vue.setAttr(n2, "aria-checked", _isChecked);
Vue.setAttr(n2, "aria-disabled", _disabled);
});
Vue.setInsertionState(n2);
Vue.createIf(() => Vue.unref(isChecked), () => {
const n6 = t0$8();
const n5 = Vue.child(n6);
Vue.setAttr(n5, "d", iconPath, true);
return n6;
});
Vue.on(n2, "keydown", (e2) => Vue.unref(handleKeydown)(e2));
Vue.on(n2, "keyup", (e2) => Vue.unref(handleKeyup)(e2));
Vue.on(n2, "blur", (e2) => Vue.unref(handleBlur)(e2));
Vue.on(n2, "click", Vue.withModifiers(handleTap, ["stop"]));
return n2;
},
() => {
const n8 = t3();
const n13 = Vue.child(n8);
Vue.initUniElement(n8, _uniRadioElement);
Vue.renderEffect(() => {
const _disabled = __props.disabled;
const _isChecked = Vue.unref(isChecked);
Vue.setProp(n8, "tabindex", _disabled ? -1 : 0);
Vue.setAttr(n8, "aria-checked", _isChecked);
Vue.setAttr(n8, "aria-disabled", _disabled);
Vue.setClass(n13, ["uni-radio-view uni-radio-icon", Vue.unref(classes)(
[_disabled, "uni-radio-disabled"],
[!_disabled && _isChecked, "uni-radio-active"],
[!_disabled && _isChecked, __props.radioActiveClass],
[!_disabled && !_isChecked, __props.radioClass],
[!_disabled, __props.iconClass]
)]);
Vue.setStyle(n13, Vue.unref(activeStyle));
});
Vue.setInsertionState(n13);
Vue.createIf(() => Vue.unref(isChecked), () => {
const n12 = t0$8();
const n11 = Vue.child(n12);
Vue.setAttr(n11, "d", iconPath, true);
return n12;
});
Vue.setInsertionState(n8, 1);
Vue.createIf(
() => isStringSlot,
() => {
const n17 = t2();
Vue.setInsertionState(n17);
Vue.createSlot(
"default",
null,
null,
256
/* TEXT_MODE */
);
return n17;
},
() => {
const n19 = Vue.createSlot();
return n19;
},
1029
/* TRUE_SINGLE_ROOT, FALSE_SINGLE_ROOT, KEYED_INDEX_3 */
);
Vue.on(n8, "keydown", (e2) => Vue.unref(handleKeydown)(e2));
Vue.on(n8, "keyup", (e2) => Vue.unref(handleKeyup)(e2));
Vue.on(n8, "blur", (e2) => Vue.unref(handleBlur)(e2));
Vue.on(n8, "click", Vue.withModifiers(handleTap, ["stop"]));
return n8;
},
517
/* TRUE_SINGLE_ROOT, FALSE_SINGLE_ROOT, KEYED_INDEX_1 */
);
return n0;
}
});
const _UniRadioGroupElement = class _UniRadioGroupElement extends UniViewElement {
};
_UniRadioGroupElement.__uniElement = {};
let UniRadioGroupElement = _UniRadioGroupElement;
const t0$7 = Vue.template("<div uni-radio-group uni-view role=radiogroup>", 1);
const _uniRadioGroupElement = { value: "RADIO-GROUP" };
const _sfc_main$7 = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "radio-group",
// @ts-ignore
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniRadioGroupElement, "radio-group")
}
},
__name: "radio-group",
props: {
name: { default: "", type: String }
},
emits: ["change"],
setup(__props, { emit: __emit }) {
class UniCustomEvent3 {
constructor(type, detail) {
this.detail = detail;
}
}
class UniRadioGroupChangeEvent extends UniCustomEvent3 {
constructor(value) {
super("change", { value });
}
}
const emit2 = __emit;
const selectedValue = Vue.ref(null);
Vue.ref(null);
function setSelectedValue(val) {
if (selectedValue.value == val) {
return;
}
selectedValue.value = val;
}
function change(val) {
setSelectedValue(val);
emit2("change", new UniRadioGroupChangeEvent(val));
}
function handleKeydown(event) {
const direction = event.key === "ArrowUp" || event.key === "ArrowLeft" ? -1 : event.key === "ArrowDown" || event.key === "ArrowRight" ? 1 : 0;
if (direction === 0 || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) {
return;
}
const target = event.target;
const group = event.currentTarget;
if (!(target instanceof Object) || !(group instanceof Object) || !target.matches('[role="radio"]') || target.closest('[role="radiogroup"]') !== group) {
return;
}
const radios = Array.from(group.querySelectorAll('[role="radio"]')).filter(
(radio) => radio.getAttribute("aria-disabled") !== "true" && radio.closest('[role="radiogroup"]') === group
);
const index2 = radios.indexOf(target);
if (index2 < 0) {
return;
}
event.preventDefault();
const next = radios[(index2 + direction + radios.length) % radios.length];
if (next !== target) {
next.focus();
next.dispatchEvent(new MouseEvent("click", { bubbles: true, cancelable: true }));
}
}
const ctx = {
selectedValue,
change,
setSelectedValue
};
Vue.provide(RADIO_GROUP_KEY, ctx);
Vue.inject(FORM_KEY, null);
const n0 = t0$7();
Vue.initUniElement(n0, _uniRadioGroupElement);
Vue.setInsertionState(n0);
Vue.createSlot();
Vue.on(n0, "keydown", handleKeydown);
return n0;
}
});
let UniCustomEvent$1 = class UniCustomEvent {
constructor(type, detail) {
this.detail = detail;
}
};
class UniSliderChangeEvent extends UniCustomEvent$1 {
constructor(value) {
super("change", { value });
}
}
const _UniSliderElement = class _UniSliderElement extends UniViewElement {
constructor() {
super(...arguments);
this.tagName = "SLIDER";
this.nodeName = "SLIDER";
}
get value() {
var _a;
return (_a = this.vm) == null ? void 0 : _a.getCurrentValue();
}
set value(val) {
var _a;
if (this.value === val) {
return;
}
(_a = this.vm) == null ? void 0 : _a.renderVisuals(val);
}
};
_UniSliderElement.__uniElement = { vm: true };
let UniSliderElement = _UniSliderElement;
const t0$6 = Vue.template('<span uni-text style="width: 35px;color: #888;font-size: 14px;align-self: center;margin-left: 5px;white-space: nowrap;"> ');
const t1$2 = Vue.template("<div uni-slider uni-view class=container><div uni-view class=slider-track><div uni-view><div uni-view></div></div><div uni-view><div uni-view role=slider aria-orientation=horizontal></div></div></div>", 1);
const _uniSliderElement = { value: "SLIDER" };
const TOUCH_THRESHOLD = 4;
const _sfc_main$6 = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "slider",
externalClasses: ["track-class", "track-active-class", "thumb-class"],
rootElement: {
name: "uni-slider-element",
class: /* @__PURE__ */ Vue.initUniElementType(UniSliderElement, "slider")
}
},
__name: "slider",
props: {
name: { default: "", type: String },
min: { default: 0, type: Number },
max: { default: 100, type: Number },
step: { default: 1, type: Number },
value: { default: 0, type: Number },
disabled: { type: Boolean, default: false },
showValue: { type: Boolean, default: false },
activeColor: { default: "", type: null },
activeBackgroundColor: { default: "", type: null },
backgroundColor: { default: "", type: null },
blockSize: { default: null, type: [Number, null] },
blockColor: { default: "", type: null },
foreColor: { default: "", type: null },
trackClass: { default: "", type: null },
trackActiveClass: { default: "", type: null },
thumbClass: { default: "", type: null }
},
emits: ["change", "changing"],
setup(__props, { expose: __expose, emit: __emit }) {
const emit2 = __emit;
const attrs2 = Vue.useAttrs();
attrs2.id ?? "";
const props2 = __props;
const containerRef = Vue.ref(null);
const backgroundRef = Vue.ref(null);
const fillRef = Vue.ref(null);
const handleRef = Vue.ref(null);
const thumbRef = Vue.ref(null);
function setColor(element, color) {
if (element == null)
return;
if (color.length > 0) {
element.style.setProperty("background-color", color);
} else {
element.style.removeProperty("background-color");
}
}
Vue.watchEffect(() => {
setColor(backgroundRef.value, props2.backgroundColor);
setColor(fillRef.value, props2.activeBackgroundColor.length > 0 ? props2.activeBackgroundColor : props2.activeColor);
setColor(thumbRef.value, props2.foreColor.length > 0 ? props2.foreColor : props2.blockColor);
const blockSize = props2.blockSize;
const thumbEl = thumbRef.value;
if (thumbEl != null) {
if (blockSize != null && !isNaN(blockSize)) {
const size = Math.min(Math.max(blockSize, 12), 28);
thumbEl.style.setProperty("width", size + "px");
thumbEl.style.setProperty("height", size + "px");
thumbEl.style.setProperty("border-radius", size / 2 + "px");
} else {
thumbEl.style.removeProperty("width");
thumbEl.style.removeProperty("height");
thumbEl.style.removeProperty("border-radius");
}
}
});
props2.value;
const currentValue = Vue.ref(props2.value);
const isDragging = Vue.ref(false);
let trackWidth = 0;
let trackLeft = 0;
let rafId = 0;
let ticking = false;
let cachedDecimalPlaces = -1;
let cachedStep = props2.step;
let lastValue = 0;
const thumbTranslateX = Vue.ref(0);
const trackActiveScaleX = Vue.ref(0);
const effectiveMax = Vue.computed(() => {
const min = Number.isFinite(props2.min) ? props2.min : 0;
const max = Number.isFinite(props2.max) ? props2.max : min;
const step = props2.step;
const range = max - min;
if (!Number.isFinite(step) || step <= 0 || range <= 0)
return min;
return min + Math.floor(range / step) * step;
});
let _activeStatus = 0;
let touchStartX = 0;
let touchStartY = 0;
let activePointerId = -1;
let pointerTarget = null;
let pointerClientX = 0;
let pointerStartFocus = null;
function releasePointerCapture() {
const target = pointerTarget;
const pointerId = activePointerId;
activePointerId = -1;
pointerTarget = null;
pointerStartFocus = null;
if (target != null && target.hasPointerCapture(pointerId)) {
target.releasePointerCapture(pointerId);
}
}
function resetInteractionState() {
if (rafId != 0) {
cancelAnimationFrame(rafId);
rafId = 0;
}
ticking = false;
isDragging.value = false;
lastValue = currentValue.value;
releasePointerCapture();
}
function lerp(start, end, t12) {
const clampedT = Math.max(0, Math.min(1, t12));
return start * (1 - clampedT) + end * clampedT;
}
function getDecimalPlaces(num) {
if (num == 0)
return 0;
if (cachedStep !== num || cachedDecimalPlaces == -1) {
const str = num.toString();
const decimalIndex = str.indexOf(".");
if (decimalIndex == -1)
cachedDecimalPlaces = 0;
cachedDecimalPlaces = str.length - decimalIndex - 1;
}
return cachedDecimalPlaces;
}
function applyStepPrecision(value) {
let result = value;
if (props2.step > 0) {
result = Math.round(result / props2.step) * props2.step;
const decimalPlaces = getDecimalPlaces(props2.step);
if (decimalPlaces > 0) {
result = parseFloat(result.toFixed(decimalPlaces));
}
}
return result;
}
function applyVisualPosition(percentage, fillScale) {
thumbTranslateX.value = percentage * 100;
trackActiveScaleX.value = fillScale;
}
function renderVisuals(newValue) {
const min = Number.isFinite(props2.min) ? props2.min : 0;
const max = Number.isFinite(effectiveMax.value) ? effectiveMax.value : min;
const clampedValue = Number.isFinite(newValue) ? Math.max(min, Math.min(newValue, max)) : min;
currentValue.value = clampedValue;
const range = max - min;
const percentage = range > 0 ? (clampedValue - min) / range : 0;
const fillScale = percentage - 1e-3;
applyVisualPosition(percentage, fillScale);
}
function calculateValue(clientX) {
if (trackWidth <= 0) {
return currentValue.value;
}
const containerWidth = trackWidth;
const containerLeft = trackLeft;
const min = Number.isFinite(props2.min) ? props2.min : 0;
const max = Number.isFinite(props2.max) ? props2.max : min;
if (max <= min)
return min;
let currentX = clientX - containerLeft;
currentX = Math.max(0, Math.min(currentX, containerWidth));
const ratio = currentX / containerWidth;
let newValue = lerp(min, max, ratio);
newValue = applyStepPrecision(newValue);
newValue = Math.max(min, Math.min(newValue, effectiveMax.value));
return newValue;
}
function focusThumb() {
if (props2.disabled)
return;
const element = thumbRef.value;
if (element != null && element.ownerDocument.activeElement !== element)
element.focus({ preventScroll: true });
}
function handleThumbClick(e2) {
if (e2.detail == 0)
focusThumb();
}
function finishPointerInteraction(clientX) {
if (props2.disabled) {
resetInteractionState();
return;
}
if (_activeStatus != -1) {
const element = thumbRef.value;
if (element != null && element.ownerDocument.activeElement === pointerStartFocus)
focusThumb();
renderVisuals(calculateValue(clientX));
}
const value = currentValue.value;
const changed = lastValue !== value;
resetInteractionState();
if (changed)
emit2("change", new UniSliderChangeEvent(value));
}
function handlePointerMove(e2) {
if (e2.pointerId != activePointerId || props2.disabled == true) {
return;
}
if (e2.pointerType == "mouse" && (e2.buttons & 1) == 0) {
finishPointerInteraction(e2.clientX);
return;
}
if (_activeStatus == 0) {
const deltaX = Math.abs(e2.clientX - touchStartX);
const deltaY = Math.abs(e2.clientY - touchStartY);
if (deltaX <= TOUCH_THRESHOLD && deltaY <= TOUCH_THRESHOLD)
return;
_activeStatus = deltaX > deltaY ? 1 : -1;
}
if (_activeStatus != 1)
return;
if (e2.cancelable) {
e2.preventDefault();
}
e2.stopPropagation();
pointerClientX = e2.clientX;
if (ticking == false) {
ticking = true;
const pointerId = activePointerId;
const frameId = requestAnimationFrame(() => {
if (rafId != frameId)
return;
rafId = 0;
ticking = false;
if (activePointerId != pointerId || props2.disabled)
return;
const newValue = calculateValue(pointerClientX);
if (newValue === currentValue.value)
return;
renderVisuals(newValue);
emit2("changing", new UniSliderChangeEvent(currentValue.value));
});
rafId = frameId;
}
}
function handlePointerDown(e2) {
if (props2.disabled == true || activePointerId != -1 || !e2.isPrimary || e2.button != 0) {
return;
}
lastValue = currentValue.value;
isDragging.value = true;
touchStartX = e2.clientX;
touchStartY = e2.clientY;
_activeStatus = e2.pointerType == "mouse" ? 1 : 0;
activePointerId = e2.pointerId;
const thumbEl = thumbRef.value;
pointerStartFocus = (thumbEl == null ? void 0 : thumbEl.ownerDocument.activeElement) ?? null;
pointerTarget = e2.currentTarget;
pointerTarget.setPointerCapture(e2.pointerId);
const containerEl = containerRef.value;
if (containerEl != null) {
const rect = containerEl.getBoundingClientRect();
trackLeft = rect.left;
trackWidth = rect.width;
}
if (e2.pointerType == "mouse") {
e2.preventDefault();
focusThumb();
renderVisuals(calculateValue(e2.clientX));
}
}
function handlePointerUp(e2) {
if (e2.pointerId != activePointerId || e2.button != 0) {
return;
}
finishPointerInteraction(e2.clientX);
}
function handlePointerCancel(e2) {
if (e2.pointerId == activePointerId)
resetInteractionState();
}
const sliderKeys = ["ArrowLeft", "ArrowDown", "ArrowRight", "ArrowUp", "Home", "End", "PageUp", "PageDown"];
const pressedSliderKeys = /* @__PURE__ */ new Set();
function handleThumbBlur() {
pressedSliderKeys.clear();
resetInteractionState();
}
function getKeyboardDecimalPlaces(value) {
const parts = value.toString().split("e");
const fraction = parts[0].split(".")[1] ?? "";
return Math.max(0, fraction.length - Number(parts[1] ?? "0"));
}
function ownsKeyboardEvent(e2) {
const element = thumbRef.value;
return !props2.disabled && element != null && e2.target === element && e2.currentTarget === element && element.ownerDocument.activeElement === element && !e2.defaultPrevented && !e2.isComposing && !e2.altKey && !e2.ctrlKey && !e2.metaKey && sliderKeys.includes(e2.key);
}
function handleKeyUp(e2) {
const handled = pressedSliderKeys.delete(e2.key);
const element = thumbRef.value;
if (handled && element != null && e2.target === element && e2.currentTarget === element)
e2.stopPropagation();
}
function handleKeyDown(e2) {
if (!ownsKeyboardEvent(e2))
return;
pressedSliderKeys.add(e2.key);
e2.preventDefault();
e2.stopPropagation();
if (isDragging.value || !Number.isFinite(props2.step) || props2.step <= 0)
return;
const min = Number.isFinite(props2.min) ? props2.min : 0;
let newValue = currentValue.value;
if (e2.key == "ArrowLeft" || e2.key == "ArrowDown") {
newValue -= props2.step;
} else if (e2.key == "ArrowRight" || e2.key == "ArrowUp") {
newValue += props2.step;
} else if (e2.key == "PageUp") {
newValue += props2.step * 10;
} else if (e2.key == "PageDown") {
newValue -= props2.step * 10;
} else if (e2.key == "Home") {
newValue = min;
} else if (e2.key == "End") {
newValue = effectiveMax.value;
}
newValue = min + Math.round((newValue - min) / props2.step) * props2.step;
const precision = Math.min(100, Math.max(getKeyboardDecimalPlaces(min), getKeyboardDecimalPlaces(props2.step)));
newValue = parseFloat(newValue.toFixed(precision));
newValue = Math.max(min, Math.min(newValue, effectiveMax.value));
if (newValue === currentValue.value)
return;
renderVisuals(newValue);
emit2("change", new UniSliderChangeEvent(currentValue.value));
}
renderVisuals(currentValue.value);
__expose({
renderVisuals,
getCurrentValue: () => currentValue.value
});
const n0 = t1$2();
const n5 = Vue.child(n0);
const n2 = Vue.child(n5);
const n1 = Vue.child(n2);
const n4 = Vue.next(n2);
const n3 = Vue.child(n4);
Vue.initUniElement(n0, _uniSliderElement);
Vue.setStaticTemplateRef(n1, fillRef, null, "fillRef");
Vue.setStaticTemplateRef(n2, backgroundRef, null, "backgroundRef");
Vue.on(n3, "keydown", handleKeyDown);
Vue.on(n3, "keyup", handleKeyUp);
Vue.on(n3, "blur", handleThumbBlur);
Vue.on(n3, "click", handleThumbClick);
Vue.setStaticTemplateRef(n3, thumbRef, null, "thumbRef");
Vue.setStaticTemplateRef(n4, handleRef, null, "handleRef");
Vue.on(n5, "pointerdown", handlePointerDown);
Vue.on(n5, "pointermove", handlePointerMove);
Vue.on(n5, "pointerup", handlePointerUp);
Vue.on(n5, "pointercancel", handlePointerCancel);
Vue.on(n5, "lostpointercapture", handlePointerCancel);
Vue.setStaticTemplateRef(n5, containerRef, null, "containerRef");
Vue.renderEffect(() => {
const _props = props2;
const _thumbTranslateX = Vue.unref(thumbTranslateX);
const _props_disabled = _props.disabled;
Vue.setClass(n2, ["slider-track-bg", _props.trackClass]);
Vue.setClass(n1, ["slider-track-fill", _props.trackActiveClass]);
Vue.setStyle(n1, { transform: `scaleX(${Vue.unref(trackActiveScaleX)})` });
Vue.setStyle(n4, ["overflow: visible; align-self: flex-start;z-index: 2;", { width: "100%", transform: `translateX(${_thumbTranslateX}%)` }]);
Vue.setProp(n3, "tabindex", _props_disabled ? -1 : 0);
Vue.setAttr(n3, "aria-disabled", _props_disabled);
Vue.setAttr(n3, "aria-valuenow", Vue.unref(currentValue));
Vue.setAttr(n3, "aria-valuemin", Number.isFinite(_props.min) ? _props.min : 0);
Vue.setAttr(n3, "aria-valuemax", Vue.unref(effectiveMax));
Vue.setClass(n3, ["slider-handle", _props.thumbClass]);
Vue.setStyle(n3, { transform: `translateX(-${_thumbTranslateX}%)` });
});
Vue.setInsertionState(n0, 1);
Vue.createIf(() => props2.showValue, () => {
const n8 = t0$6();
const x8 = Vue.txt(n8);
Vue.renderEffect(() => Vue.setText(x8, Vue.normalizeUniText(Vue.toDisplayString(Vue.unref(currentValue)))));
return n8;
});
return n0;
}
});
const t0$5 = Vue.template('<div uni-sticky-header uni-view class=uni-sticky-header style="position: sticky; top: 0; width: 100%; z-index: 1">', 1);
const _uniStickyHeaderElement = { value: "STICKY-HEADER" };
const _sfc_main$5 = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "sticky-header",
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniStickyHeaderElement, "sticky-header")
}
},
__name: "sticky-header",
setup(__props) {
const element = Vue.ref(null);
const { section, updateHeaderSize } = Vue.inject("__uni_recycle_section");
new UniResizeObserver((entries2) => {
if (element.value && element.value.isConnected) {
updateHeaderSize(entries2[entries2.length - 1].borderBoxSize[0].blockSize);
}
});
const n0 = t0$5();
Vue.initUniElement(n0, _uniStickyHeaderElement);
Vue.setInsertionState(n0);
Vue.createSlot();
Vue.setStaticTemplateRef(n0, element, null, "element");
return n0;
}
});
const t0$4 = Vue.template('<div uni-sticky-section uni-view class=uni-sticky-section style="position: relative; overflow: visible"><!><div uni-view style="width: 1px; flex-shrink: 0;">', 1);
const _uniStickySectionElement = { value: "STICKY-SECTION" };
const _sfc_main$4 = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "sticky-section",
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniStickySectionElement, "sticky-section")
}
},
__name: "sticky-section",
props: {
preload: { type: Boolean, default: false }
},
setup(__props, { expose: __expose }) {
const props2 = __props;
const instance = Vue.getCurrentInstance();
const sectionId = instance.uid;
const listView = Vue.inject("__uni_recycle_list");
const element = Vue.ref(null);
const placeholderElement = Vue.ref(null);
const renderRange = Vue.ref([0, 0]);
const store = new RecycleListItemDataStore();
const idKeyMap = /* @__PURE__ */ new Map();
let keys = [];
let listIds = [];
let hasSyncedDefaultItemSize = false;
const section = {
element: null,
headerElement: null,
headerSize: 0,
placeholderSize: 0,
offsetTop: 0,
resolveKeyById: (id2) => idKeyMap.get(id2),
getItemOffset,
onScrollContextUpdate,
applyDefaultItemSize
};
listView.sectionMap.set(sectionId, section);
Vue.provide("__uni_recycle_view_instance", instance);
Vue.provide("__uni_recycle_section_id", sectionId);
Vue.provide("__uni_recycle_section", { section, updateHeaderSize });
Vue.provide("__uni_recycle_container", {
store,
updateItemSize,
getItemOffset
});
function updateIdKeyMap() {
if (listIds.length !== keys.length)
return;
idKeyMap.clear();
listIds.forEach((id2, index2) => {
if (id2 && keys[index2])
idKeyMap.set(id2, keys[index2]);
});
}
function updateList(newList) {
keys = newList;
store.updateKeyList(newList);
updateIdKeyMap();
updatePlaceholderSize();
}
function updateListIds(ids) {
listIds = ids;
updateIdKeyMap();
listView.queueLayout();
}
function updateRenderInfo(start, length) {
store.updateItemOffset(section.headerSize);
if (renderRange.value[0] !== start || renderRange.value[1] !== length) {
renderRange.value = [start, length];
}
}
function updatePlaceholderSize() {
section.placeholderSize = section.headerSize + store.contentSize;
if (placeholderElement.value)
placeholderElement.value.style.height = `${store.contentSize}px`;
listView.queueLayout();
}
function updateHeaderSize(height) {
if (section.headerSize === height)
return;
section.headerSize = height;
updatePlaceholderSize();
}
function applyDefaultItemSize(height) {
hasSyncedDefaultItemSize = true;
store.defaultItemSize = height;
store.rebuildItemOffsetsFrom(0);
updatePlaceholderSize();
}
function updateItemSize(key, height) {
const item = store.keyItemMap.get(key);
if (!item || item.size === height)
return;
const wasUnknown = item.size < 0;
item.size = height;
if (!hasSyncedDefaultItemSize && wasUnknown && height > 0) {
listView.syncDefaultItemSize(height);
} else {
store.rebuildItemOffsetsFrom(item.index + 1);
updatePlaceholderSize();
}
}
function getItemOffset(key) {
const item = store.keyItemMap.get(key);
return item ? item.offset + section.headerSize : -1;
}
function onScrollContextUpdate(context) {
if (!section.element || context.containerSize === 0)
return;
const top = context.headerSize + section.offsetTop;
const bottom = top + section.placeholderSize;
if (!keys.length || !props2.preload && (bottom < context.renderStartOffset || top > context.renderEndOffset)) {
updateRenderInfo(0, 0);
return;
}
let min = Math.max(0, context.renderStartOffset - top - section.headerSize);
let max = Math.max(0, context.renderEndOffset - top - section.headerSize);
if (props2.preload) {
const contentHeight = store.contentSize;
min = Math.min(min, contentHeight);
max = Math.min(max, contentHeight);
let remaining = Math.min(contentHeight, context.containerSize) - (max - min);
if (remaining > 0) {
const prepend = Math.min(remaining, min);
min -= prepend;
remaining -= prepend;
max = Math.min(contentHeight, max + remaining);
}
}
if (max <= min)
updateRenderInfo(0, 0);
else
updateRenderInfo(...store.getRenderRange(min, max));
}
Vue.watch(
() => props2.preload,
() => listView.queueLayout()
);
__expose({ renderRange, updateList, updateListIds, updateRenderInfo });
const n0 = t0$4();
const n3 = Vue.child(n0);
const n2 = Vue.next(n3);
Vue.initUniElement(n0, _uniStickySectionElement);
Vue.setInsertionState(n0, n3);
Vue.createSlot();
Vue.setStaticTemplateRef(n2, placeholderElement, null, "placeholderElement");
Vue.setStaticTemplateRef(n0, element, null, "element");
return n0;
}
});
class UniCustomEvent2 {
constructor(type, detail) {
this.type = type;
this.detail = detail;
}
}
class UniSwiperChangeEvent extends UniCustomEvent2 {
constructor(current, source, currentItemId) {
const detail = { current, source };
if (currentItemId != null) {
detail.currentItemId = currentItemId;
}
super("change", detail);
}
}
class UniSwiperTransitionEvent extends UniCustomEvent2 {
constructor(dx, dy) {
super("transition", { dx, dy });
}
}
class UniSwiperAnimationFinishEvent extends UniCustomEvent2 {
constructor(current, source, currentItemId) {
const detail = { current, source };
if (currentItemId != null) {
detail.currentItemId = currentItemId;
}
super("animationfinish", detail);
}
}
function parsePxRpx(margin) {
if (margin.length == 0) {
return 0;
}
if (margin.endsWith("px")) {
return parseFloat(margin);
}
if (margin.endsWith("rpx")) {
return parseFloat(margin) * (750 / uni.getWindowInfo().windowWidth);
}
return 0;
}
const _UniSwiperElement = class _UniSwiperElement extends UniViewElement {
};
_UniSwiperElement.__uniElement = {};
let UniSwiperElement = _UniSwiperElement;
const t0$3 = Vue.template("<div uni-view>");
const t1$1 = Vue.template("<div uni-swiper uni-view class=uni-swiper-wrapper><div uni-view></div><div uni-view>", 1);
const _uniSwiperElement = { value: "SWIPER" };
const DIRECTION_LOCK_THRESHOLD = 5;
const _sfc_main$3 = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "swiper",
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniSwiperElement, "swiper")
},
externalClasses: ["indicator-class", "indicator-active-class"]
},
__name: "swiper",
props: {
vertical: { type: [Boolean, String], default: false },
current: { type: Number },
circular: { type: [Boolean, String], default: false },
autoplay: { type: [Boolean, String], default: false },
interval: { default: 3e3, type: Number },
duration: { default: 500, type: Number },
easingFunction: { default: "default", type: String },
previousMargin: { default: "0px", type: String },
nextMargin: { default: "0px", type: String },
disableTouch: { type: [Boolean, String], default: false },
disableBounce: { type: [Boolean, String], default: false },
indicatorDots: { type: [Boolean, String], default: false },
indicatorClass: { default: "", type: null },
indicatorActiveClass: { default: "", type: null },
indicatorStyle: { default: "", type: String },
indicatorActiveStyle: { default: "", type: String },
autoHeight: { type: [Boolean, String], default: false },
currentItemId: { type: String }
},
emits: ["change", "transition", "animationfinish"],
setup(__props, { emit: __emit }) {
const props2 = __props;
const emit2 = __emit;
const wrapper = Vue.ref(null);
const currentIndex = Vue.ref(0);
const sliderCount = Vue.ref(0);
const animating = Vue.ref(false);
const autoPlayTimer = Vue.ref(0);
let translate_value = 0;
let touchStartX = 0, touchStartY = 0, touchStartTime = 0, dragging = false, touchMoving = false, activeTouchId = -1, touchStartTranslate = 0, gestureStartTranslate = 0, prevMargin = parsePxRpx(props2.previousMargin), nextMargin = parsePxRpx(props2.nextMargin), sliderItemSize = 0, firstSliderPosition = "start", lastSliderPosition = "end", maxTranslate = 0, minTranslate = 0, animationFrameId = 0, animationStartTranslate = 0, animationTargetTranslate = 0, lastAnimationTranslate = 0, animationStartTime = 0, animationSource = "", sequenceStartTranslate = 0, touchDirectionLocked = false, touchDirection = "", touchInterruptedAnimation = false;
const slots = Vue.useSlots();
const hasCustomIndicator = Vue.computed(() => {
return slots["indicator"] != null;
});
Vue.computed(() => {
return (prevMargin > 0 || nextMargin > 0) && sliderCount.value > 2;
});
const mergeStyle = (isActive) => {
let style = props2.indicatorStyle;
if (isActive && props2.indicatorActiveStyle.length > 0) {
style = style.length > 0 ? style + "; " + props2.indicatorActiveStyle : props2.indicatorActiveStyle;
}
return style;
};
function findTouchByIdentifier(touches, identifier) {
for (let i = 0; i < touches.length; i++) {
const touch = touches[i];
if (touch.identifier == identifier) {
return touch;
}
}
return null;
}
function getStartTouch(e2) {
if (e2.changedTouches.length > 0) {
return e2.changedTouches[0];
}
if (e2.touches.length > 0) {
return e2.touches[0];
}
return null;
}
function getActiveTouch(e2) {
if (activeTouchId < 0) {
return null;
}
let touch = findTouchByIdentifier(e2.changedTouches, activeTouchId);
if (touch != null) {
return touch;
}
return findTouchByIdentifier(e2.touches, activeTouchId);
}
function handoffActiveTouch(touch) {
activeTouchId = touch.identifier;
touchStartX = touch.pageX;
touchStartY = touch.pageY;
touchStartTranslate = translate_value;
}
function stopAnimationFrame() {
if (animationFrameId > 0) {
cancelAnimationFrame(animationFrameId);
animationFrameId = 0;
}
}
function getEasingProgress(progress) {
if (props2.easingFunction === "linear") {
return progress;
}
return 1 - Math.pow(1 - progress, 2);
}
function dispatchTransitionEvent(offset) {
const accumulatedDx = props2.vertical ? 0 : -offset;
const accumulatedDy = props2.vertical ? -offset : 0;
emit2("transition", new UniSwiperTransitionEvent(accumulatedDx, accumulatedDy));
}
function getInterruptedTranslate() {
if (!isSupportCircular()) {
return lastAnimationTranslate;
}
const stableMinTranslate = -(sliderCount.value - 1) * sliderItemSize;
if (lastAnimationTranslate <= 0 && lastAnimationTranslate >= stableMinTranslate) {
return lastAnimationTranslate;
}
return -(currentIndex.value * sliderItemSize);
}
function animateSlide() {
if (!animating.value) {
stopAnimationFrame();
return;
}
const now = Date.now();
const elapsed = now - animationStartTime;
let timeProgress = elapsed / props2.duration;
if (timeProgress >= 1) {
timeProgress = 1;
translate_value = animationTargetTranslate;
lastAnimationTranslate = animationTargetTranslate;
dispatchTransitionEvent(animationTargetTranslate - sequenceStartTranslate);
emit2("animationfinish", new UniSwiperAnimationFinishEvent(currentIndex.value, animationSource, getItemIdByIndex(currentIndex.value)));
animating.value = false;
stopAnimationFrame();
resetSlidersPosition();
Vue.nextTick(() => {
});
sequenceStartTranslate = translate_value;
animationSource = "";
return;
}
const easedProgress = getEasingProgress(timeProgress);
const currentAnimationTranslate = animationStartTranslate + (animationTargetTranslate - animationStartTranslate) * easedProgress;
translate_value = currentAnimationTranslate;
lastAnimationTranslate = currentAnimationTranslate;
const totalTranslateChange = currentAnimationTranslate - sequenceStartTranslate;
dispatchTransitionEvent(totalTranslateChange);
animationFrameId = requestAnimationFrame(animateSlide);
}
function isStartToEndSlide(targetIndex, direction) {
return currentIndex.value == 0 && targetIndex == sliderCount.value - 1 && direction == -1;
}
function isEndToStartSlide(targetIndex, direction) {
return currentIndex.value == sliderCount.value - 1 && targetIndex == 0 && direction == 1;
}
function isSupportCircular() {
return props2.circular && (sliderCount.value > 2 || sliderCount.value == 2 && prevMargin == 0 && nextMargin == 0);
}
let resetSlidersPosition = () => {
};
function adjustSliderPosition(targetIndex, direction) {
if (!isSupportCircular())
return;
return;
}
resetSlidersPosition = () => {
return;
};
function getItemIdByIndex(index2) {
return null;
}
function slideTo(targetIndex, source, direction) {
if (targetIndex < 0 || targetIndex >= sliderCount.value)
return;
if (animating.value || dragging) {
animating.value = false;
stopAnimationFrame();
dragging = false;
touchMoving = false;
touchDirectionLocked = false;
touchDirection = "";
touchInterruptedAnimation = false;
if (isSupportCircular()) {
firstSliderPosition = "start";
lastSliderPosition = "end";
}
translate_value = getInterruptedTranslate();
}
stopAnimationFrame();
const oldTranslate = translate_value;
adjustSliderPosition();
const translateDelta = translate_value - oldTranslate;
sequenceStartTranslate += translateDelta;
animationStartTranslate = translate_value;
lastAnimationTranslate = animationStartTranslate;
animationStartTime = Date.now();
animationSource = source;
if (props2.circular && isStartToEndSlide(targetIndex, direction)) {
animationTargetTranslate = 1 * sliderItemSize;
} else if (props2.circular && isEndToStartSlide(targetIndex, direction)) {
animationTargetTranslate = sliderCount.value * sliderItemSize * -1;
} else {
animationTargetTranslate = targetIndex * sliderItemSize * -1;
}
if (targetIndex != currentIndex.value) {
currentIndex.value = targetIndex;
emit2("change", new UniSwiperChangeEvent(targetIndex, source, getItemIdByIndex()));
}
animating.value = true;
animationFrameId = requestAnimationFrame(animateSlide);
}
function startAutoPlay() {
if (!props2.autoplay || sliderCount.value <= 1)
return;
autoPlayTimer.value = setInterval(() => {
const next = currentIndex.value == sliderCount.value - 1 ? 0 : currentIndex.value + 1;
slideTo(next, "autoplay", 1);
}, props2.interval);
}
function stopAutoPlay() {
if (autoPlayTimer.value > 0) {
clearInterval(autoPlayTimer.value);
autoPlayTimer.value = 0;
}
}
const handleIndicatorClick = (index2) => {
const direction = getSlideDirection(index2);
slideTo(index2, "click", direction);
};
function getTouchMoveMaxTranslate() {
if (isSupportCircular() && lastSliderPosition == "start") {
return sliderItemSize;
}
return maxTranslate;
}
function getTouchMoveMinTranslate() {
if (isSupportCircular() && firstSliderPosition == "end") {
return -(sliderCount.value * sliderItemSize);
}
return minTranslate;
}
function fixIndex(index2) {
if (index2 < 0) {
return props2.circular ? sliderCount.value - 1 : 0;
} else if (index2 >= sliderCount.value) {
return props2.circular ? 0 : sliderCount.value - 1;
}
return index2;
}
function getSlideDirection(targetIndex) {
const count = sliderCount.value;
const current = currentIndex.value;
if (count <= 1 || targetIndex == current) {
return 1;
}
if (!props2.circular) {
return targetIndex > current ? 1 : -1;
}
const forward = (targetIndex - current + count) % count;
const backward = (current - targetIndex + count) % count;
return forward <= backward ? 1 : -1;
}
const onTouchStart = (e2) => {
if (props2.disableTouch)
return;
e2.stopPropagation();
const startTouch = getStartTouch(e2);
if (startTouch == null)
return;
if (dragging && activeTouchId >= 0 && findTouchByIdentifier(e2.touches, activeTouchId) != null) {
return;
}
stopAutoPlay();
const wasAnimating = animating.value;
touchInterruptedAnimation = wasAnimating;
if (animating.value) {
animating.value = false;
stopAnimationFrame();
if (isSupportCircular()) {
firstSliderPosition = "start";
lastSliderPosition = "end";
}
translate_value = getInterruptedTranslate();
}
const oldTranslate = translate_value;
resetSlidersPosition();
const translateDelta = translate_value - oldTranslate;
handoffActiveTouch(startTouch);
touchStartTime = Date.now();
gestureStartTranslate = translate_value;
dragging = true;
touchMoving = false;
touchDirectionLocked = false;
touchDirection = "";
if (!wasAnimating) {
sequenceStartTranslate = translate_value;
startTouch.pageX;
startTouch.pageY;
} else {
sequenceStartTranslate += translateDelta;
}
};
const onTouchMove = (e2) => {
if (props2.disableTouch)
return;
e2.stopPropagation();
if (!dragging)
return;
const t12 = getActiveTouch(e2);
if (t12 == null)
return;
touchMoving = true;
const dx = t12.pageX - touchStartX;
const dy = t12.pageY - touchStartY;
const delta = props2.vertical ? dy : dx;
const currentTranslate = touchStartTranslate + delta;
const overallDelta = currentTranslate - touchStartTranslate;
const overallDirection = overallDelta > 0 ? -1 : 1;
const absDx = Math.abs(dx);
const absDy = Math.abs(dy);
if (!touchDirectionLocked) {
const totalDistance = Math.sqrt(dx * dx + dy * dy);
if (totalDistance >= DIRECTION_LOCK_THRESHOLD) {
const angle = Math.atan2(absDy, absDx) * 180 / Math.PI;
if (!props2.vertical) {
if (angle < 30) {
touchDirection = "horizontal";
} else if (angle > 45) {
touchDirection = "vertical";
} else {
touchDirection = "vertical";
}
} else {
if (angle > 60) {
touchDirection = "vertical";
} else if (angle < 45) {
touchDirection = "horizontal";
} else {
touchDirection = "horizontal";
}
}
touchDirectionLocked = true;
}
}
if (touchDirectionLocked) {
if (!props2.vertical) {
if (touchDirection === "horizontal") {
e2.preventDefault();
} else {
return;
}
} else {
if (touchDirection === "vertical") {
const canSwipe = isSupportCircular() || delta > 0 && currentIndex.value > 0 || delta < 0 && currentIndex.value < sliderCount.value - 1;
if (!canSwipe) {
return;
}
} else {
return;
}
}
} else {
return;
}
if (isSupportCircular()) {
const visualIndex = Math.round(-touchStartTranslate / sliderItemSize);
fixIndex(visualIndex + overallDirection);
adjustSliderPosition();
}
const touchMoveMaxTranslate = getTouchMoveMaxTranslate();
const touchMoveMinTranslate = getTouchMoveMinTranslate();
const atBoundary = !props2.circular && props2.disableBounce && sliderCount.value > 0 && (currentTranslate > maxTranslate && delta > 0 || currentTranslate < minTranslate && delta < 0);
if (!atBoundary) {
e2.preventDefault();
}
if (delta != 0) {
const totalTranslateChange = currentTranslate - sequenceStartTranslate;
dispatchTransitionEvent(totalTranslateChange);
}
if (props2.disableBounce) {
if (currentTranslate > touchMoveMaxTranslate) {
translate_value = touchMoveMaxTranslate;
return;
}
if (currentTranslate < touchMoveMinTranslate) {
translate_value = touchMoveMinTranslate;
return;
}
} else {
if (currentTranslate > touchMoveMaxTranslate) {
const overScroll = currentTranslate - touchMoveMaxTranslate;
translate_value = touchMoveMaxTranslate + overScroll * 0.3;
return;
}
if (currentTranslate < touchMoveMinTranslate) {
const overScroll = currentTranslate - touchMoveMinTranslate;
translate_value = touchMoveMinTranslate + overScroll * 0.3;
return;
}
}
translate_value = currentTranslate;
};
const onTouchEnd = (e2) => {
if (props2.disableTouch)
return;
e2.stopPropagation();
if (!dragging)
return;
const activeChangedTouch = activeTouchId >= 0 ? findTouchByIdentifier(e2.changedTouches, activeTouchId) : null;
if (activeChangedTouch == null) {
return;
}
if (e2.touches.length > 0) {
handoffActiveTouch(e2.touches[0]);
return;
}
dragging = false;
activeTouchId = -1;
if (!touchMoving) {
if (touchInterruptedAnimation) {
slideTo(currentIndex.value, "touch", 0);
}
touchMoving = false;
startAutoPlay();
return;
}
touchMoving = false;
if (!touchDirectionLocked) {
if (touchInterruptedAnimation) {
slideTo(currentIndex.value, "touch", 0);
}
startAutoPlay();
return;
}
const isDirectionMatched = !props2.vertical && touchDirection === "horizontal" || props2.vertical && touchDirection === "vertical";
if (!isDirectionMatched) {
if (touchInterruptedAnimation) {
slideTo(currentIndex.value, "touch", 0);
}
startAutoPlay();
return;
}
const dt = Date.now() - touchStartTime;
const totalDelta = translate_value - gestureStartTranslate;
const abs = Math.abs(totalDelta);
const source = "touch";
const direction = totalDelta < 0 ? 1 : totalDelta > 0 ? -1 : 0;
const shouldChange = dt < 300 && abs > 30 || abs > 100;
if (!shouldChange) {
slideTo(currentIndex.value, source, direction);
return;
}
let nextIndex = currentIndex.value;
if (isSupportCircular()) {
if (totalDelta > 0) {
nextIndex = (currentIndex.value - 1 + sliderCount.value) % sliderCount.value;
} else if (totalDelta < 0) {
nextIndex = (currentIndex.value + 1) % sliderCount.value;
}
} else {
if (!props2.disableBounce && (translate_value > maxTranslate || translate_value < minTranslate)) {
if (translate_value > maxTranslate) {
nextIndex = 0;
} else if (translate_value < minTranslate) {
nextIndex = sliderCount.value - 1;
}
} else {
if (totalDelta > 0 && currentIndex.value > 0) {
nextIndex = currentIndex.value - 1;
} else if (totalDelta < 0 && currentIndex.value < sliderCount.value - 1) {
nextIndex = currentIndex.value + 1;
}
}
}
slideTo(nextIndex, source, direction);
startAutoPlay();
};
const handleSwiperItemMounted = () => {
Vue.nextTick(() => {
});
};
const handleSwiperItemUnMounted = () => {
Vue.nextTick(() => {
});
};
Vue.provide("handleSwiperItemMounted", handleSwiperItemMounted);
Vue.provide("handleSwiperItemUnMounted", handleSwiperItemUnMounted);
Vue.provide("autoHeight", props2.autoHeight);
const n0 = t1$1();
const n2 = Vue.child(n0);
const n9 = Vue.next(n2);
Vue.initUniElement(n0, _uniSwiperElement);
Vue.renderEffect(() => Vue.setClass(n2, ["uni-swiper-container", __props.vertical ? "uni-swiper-container_vertical" : "uni-swiper-container_horizontal"]));
Vue.setInsertionState(n2);
Vue.createSlot();
Vue.renderEffect(() => Vue.setClass(n9, [
"uni-swiper-indicator",
__props.vertical ? "uni-swiper-indicator_vertical" : "uni-swiper-indicator_horizontal"
]));
Vue.setInsertionState(n9);
Vue.createSlot("indicator");
Vue.setInsertionState(n9, 1);
Vue.createIf(() => __props.indicatorDots && !Vue.unref(hasCustomIndicator), () => {
const n6 = Vue.createFor(
() => Vue.unref(sliderCount),
(_for_item0) => {
const n8 = t0$3();
Vue.on(n8, "touchstart", (e2) => {
e2.stopPropagation();
});
Vue.on(n8, "touchmove", (e2) => {
e2.stopPropagation();
e2.preventDefault();
});
Vue.on(n8, "touchend", (e2) => {
e2.stopPropagation();
});
Vue.on(n8, "touchcancel", (e2) => {
e2.stopPropagation();
});
Vue.on(n8, "click", () => handleIndicatorClick(_for_item0.value - 1));
Vue.renderEffect(() => {
const _currentIndex = Vue.unref(currentIndex);
const _i = _for_item0.value;
Vue.setClass(n8, ["uni-swiper-indicator-item", [
__props.indicatorClass,
{ active: _currentIndex == _i - 1 },
{ [__props.indicatorActiveClass]: _currentIndex == _i - 1 }
]]);
Vue.setStyle(n8, mergeStyle(_currentIndex == _i - 1));
});
return n8;
},
(i) => i,
8
/* IS_SINGLE_NODE */
);
return n6;
});
Vue.on(n0, "touchstart", onTouchStart);
Vue.on(n0, "touchmove", onTouchMove);
Vue.on(n0, "touchend", onTouchEnd);
Vue.on(n0, "touchcancel", onTouchEnd);
Vue.setStaticTemplateRef(n0, wrapper, null, "wrapper");
return n0;
}
});
const _UniSwiperItemElement = class _UniSwiperItemElement extends UniViewElement {
constructor() {
super(...arguments);
this.itemId = null;
}
};
_UniSwiperItemElement.__uniElement = { init() {
Object.defineProperty(this, "itemId", { value: null, writable: true, enumerable: true, configurable: true });
} };
let UniSwiperItemElement = _UniSwiperItemElement;
const t0$2 = Vue.template("<div uni-view class=uni-swiper-item-content>");
const t1 = Vue.template('<div uni-swiper-item uni-view class=uni-swiper-item style="position: absolute; visibility: hidden;">', 1);
const _uniSwiperItemElement = { value: "SWIPER-ITEM" };
const _sfc_main$2 = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "swiper-item",
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniSwiperItemElement, "swiper-item")
}
},
__name: "swiper-item",
props: {
itemId: { default: null, type: String }
},
setup(__props) {
const swiperItem = Vue.ref(null);
const autoHeight = Vue.inject("autoHeight", false);
Vue.inject("handleSwiperItemMounted");
Vue.inject("handleSwiperItemUnMounted");
const n0 = t1();
Vue.initUniElement(n0, _uniSwiperItemElement);
Vue.setInsertionState(n0);
Vue.createIf(
() => Vue.unref(autoHeight),
() => {
const n4 = t0$2();
Vue.setInsertionState(n4);
Vue.createSlot();
return n4;
},
() => {
const n6 = Vue.createSlot();
return n6;
},
261
/* TRUE_SINGLE_ROOT, FALSE_SINGLE_ROOT, KEYED_INDEX_0 */
);
Vue.setStaticTemplateRef(n0, swiperItem, null, "swiperItem");
return n0;
}
});
const _UniSwitchElement = class _UniSwitchElement extends UniViewElement {
constructor() {
super(...arguments);
this.tagName = "SWITCH";
this.nodeName = "SWITCH";
this._checked = false;
}
get checked() {
var _a;
return ((_a = this.vm) == null ? void 0 : _a.getSwitchChecked()) ?? this._checked;
}
set checked(val) {
var _a;
this._checked = val;
(_a = this.vm) == null ? void 0 : _a.setSwitchChecked(val);
}
};
_UniSwitchElement.__uniElement = { vm: true, init() {
Object.defineProperty(this, "_checked", { value: false, writable: true, enumerable: true, configurable: true });
} };
let UniSwitchElement = _UniSwitchElement;
const t0$1 = Vue.template("<div uni-switch uni-view role=switch><div uni-view>", 1);
const _uniSwitchElement = { value: "SWITCH" };
const _sfc_main$1 = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "switch",
// @ts-ignore
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniSwitchElement, "switch")
},
externalClasses: ["thumb-class", "thumb-active-class", "switch-active-class"]
},
__name: "switch",
props: {
color: { default: "", type: String },
disabled: { type: Boolean, default: false },
checked: { type: Boolean, default: false },
name: { default: "", type: String },
thumbClass: { default: "", type: null },
thumbActiveClass: { default: "", type: null },
switchActiveClass: { default: "", type: null }
},
emits: ["change"],
setup(__props, { expose: __expose, emit: __emit }) {
var _a;
const props2 = __props;
const { handleKeydown, handleKeyup, handleBlur } = createSpaceKeyHandlers(() => props2.disabled);
const attrs2 = Vue.useAttrs();
attrs2.id;
(_a = Vue.getCurrentInstance()) == null ? void 0 : _a.proxy;
class UniCustomEvent3 {
constructor(type, detail) {
this.detail = detail;
}
}
class UniSwitchChangeEvent extends UniCustomEvent3 {
constructor(value) {
super("change", { value });
}
}
const emit2 = __emit;
Vue.inject(FORM_KEY, null);
Vue.inject(LABEL_KEY, null);
const isChecked = Vue.ref(props2.checked);
const activeStyle = Vue.computed(() => {
if (isChecked.value && props2.color) {
return { "background-color": props2.color };
}
return {};
});
Vue.ref(false);
const enableTransition = Vue.ref(false);
const setChecked = (checked) => {
isChecked.value = checked;
};
Vue.watch(() => props2.checked, (value) => {
setChecked(value);
});
const handleTap = () => {
if (props2.disabled) {
return;
}
setChecked(!isChecked.value);
emit2("change", new UniSwitchChangeEvent(isChecked.value));
};
__expose({
getSwitchChecked: () => {
return isChecked.value;
},
setSwitchChecked: (checked) => {
setChecked(checked);
}
});
const n0 = t0$1();
const n1 = Vue.child(n0);
Vue.initUniElement(n0, _uniSwitchElement);
Vue.on(n0, "keydown", (e2) => Vue.unref(handleKeydown)(e2));
Vue.on(n0, "keyup", (e2) => Vue.unref(handleKeyup)(e2));
Vue.on(n0, "blur", (e2) => Vue.unref(handleBlur)(e2));
Vue.on(n0, "click", Vue.withModifiers(handleTap, ["stop"]));
Vue.renderEffect(() => {
const _classes = Vue.unref(classes);
const _enableTransition = Vue.unref(enableTransition);
const _disabled = __props.disabled;
const _isChecked = Vue.unref(isChecked);
Vue.setClass(n0, ["uni-switch", _classes(
[_enableTransition, "transition-enabled"],
[_disabled, "uni-switch-disabled"],
[_isChecked, "uni-switch-active"],
[_isChecked, __props.switchActiveClass]
)]);
Vue.setStyle(n0, Vue.unref(activeStyle));
Vue.setProp(n0, "tabindex", _disabled ? -1 : 0);
Vue.setAttr(n0, "aria-checked", _isChecked);
Vue.setAttr(n0, "aria-disabled", _disabled);
Vue.setClass(n1, ["uni-switch-thumb", _classes(
[_enableTransition, "thumb-transition-enabled"],
[_isChecked, "uni-switch-active-thumb"],
[_isChecked, __props.thumbActiveClass, __props.thumbClass]
)]);
});
return n0;
}
});
const t0 = Vue.template('<div uni-view style="position: relative; overflow-anchor: none"><!><div uni-view style="width: 1px; flex-shrink: 0;"></div></div>');
const _uniWaterflowElement = { value: "WATERFLOW" };
const _sfc_main = /* @__PURE__ */ Vue.defineVaporComponent({
...{
name: "waterflow",
rootElement: {
class: /* @__PURE__ */ Vue.initUniElementType(UniWaterflowElement, "waterflow")
}
},
__name: "waterflow",
props: {
crossAxisCount: { type: [Number, String], default: 2 },
mainAxisGap: { type: [Number, String], default: 0 },
crossAxisGap: { type: [Number, String], default: 0 },
maxCrossAxisExtent: { type: [Number, String], default: 0 },
scrollIntoView: { type: String, default: "" }
},
setup(__props, { expose: __expose }) {
const props2 = __props;
const attrs2 = Vue.useAttrs();
const realCrossAxisCount = Vue.computed(
() => parseInt(String(props2.crossAxisCount))
);
const realMainAxisGap = Vue.computed(() => parseFloat(String(props2.mainAxisGap)));
const realCrossAxisGap = Vue.computed(() => parseFloat(String(props2.crossAxisGap)));
const realMaxCrossAxisExtent = Vue.computed(
() => parseFloat(String(props2.maxCrossAxisExtent))
);
const scrollElement = Vue.ref(null);
const placeholderElement = Vue.ref(null);
const renderRange = Vue.ref([0, 0]);
let list = [];
let keyItemMap = /* @__PURE__ */ new Map();
const itemInstanceMap = /* @__PURE__ */ new Map();
const idKeyMap = /* @__PURE__ */ new Map();
let listIds = [];
let size = 0;
let containerCrossAxisSize = 0;
let itemCrossAxisSize = 0;
let layoutCrossAxisCount = 2;
let placeholderSize = 0;
let scrollOffset = 0;
let cachedSizeStart = 200;
let queued = false;
let destroyed = false;
let pendingScrollId = props2.scrollIntoView;
let scrollingToItemKey;
let scrollingToItemOffset = -1;
let scrollingToItemTimestamp = 0;
let scrollEndTimer;
Vue.provide("__uni_recycle_view_instance", Vue.getCurrentInstance());
Vue.provide("__uni_recycle_state_map", /* @__PURE__ */ new Map());
Vue.provide("__uni_recycle_waterflow", {
itemInstanceMap,
updateItemSize,
getItemOffset,
getItemCrossAxisSize: () => itemCrossAxisSize
});
function updateIdKeyMap() {
if (listIds.length !== list.length)
return;
idKeyMap.clear();
listIds.forEach((id2, index2) => {
if (id2 && list[index2].key)
idKeyMap.set(id2, list[index2].key);
});
}
function updateList(keys) {
const oldItems = keyItemMap;
keyItemMap = /* @__PURE__ */ new Map();
list = keys.map((key, index2) => {
const instance = itemInstanceMap.get(key);
const item = oldItems.get(key) || {
key,
index: index2,
size: instance ? instance.size : -1,
offsetX: 0,
offsetY: 0,
maxEndOffset: 0
};
item.index = index2;
keyItemMap.set(key, item);
return item;
});
rebuildItemOffsetsFrom(0);
updateIdKeyMap();
queueLayout();
}
function updateListIds(ids) {
listIds = ids;
updateIdKeyMap();
queueLayout();
}
function updateRenderInfo(start, length) {
if (renderRange.value[0] !== start || renderRange.value[1] !== length) {
renderRange.value = [start, length];
}
}
function realItemSize(item) {
return item.size < 0 ? 150 : item.size;
}
function rebuildItemOffsetsFrom(start) {
const columns = new Array(layoutCrossAxisCount).fill(0);
const mainGap = realMainAxisGap.value;
const crossGap = realCrossAxisGap.value;
for (let i = 0; i < start; i++) {
const item = list[i];
const column = itemCrossAxisSize + crossGap > 0 ? Math.min(
layoutCrossAxisCount - 1,
Math.round(item.offsetX / (itemCrossAxisSize + crossGap))
) : 0;
columns[column] = Math.max(
columns[column],
item.offsetY + realItemSize(item) + mainGap
);
}
let maxEnd = start > 0 ? list[start - 1].maxEndOffset : 0;
for (let i = start; i < list.length; i++) {
const item = list[i];
let column = 0;
for (let c = 1; c < columns.length; c++) {
if (columns[c] < columns[column])
column = c;
}
item.offsetX = column * (itemCrossAxisSize + crossGap);
item.offsetY = columns[column];
const end = item.offsetY + realItemSize(item);
item.maxEndOffset = maxEnd = Math.max(maxEnd, end);
columns[column] = end + mainGap;
}
placeholderSize = Math.max(0, Math.max(...columns) - mainGap);
}
function updateCrossAxisMetrics() {
const gap = realCrossAxisGap.value;
const extent = realMaxCrossAxisExtent.value;
layoutCrossAxisCount = extent > 0 && containerCrossAxisSize > 0 ? Math.max(1, Math.ceil(containerCrossAxisSize / (extent + gap))) : Math.max(1, realCrossAxisCount.value);
const width = Math.max(
0,
(containerCrossAxisSize - gap * (layoutCrossAxisCount - 1)) / layoutCrossAxisCount
);
if (width !== itemCrossAxisSize) {
itemCrossAxisSize = width;
list.forEach((item) => {
item.size = -1;
});
itemInstanceMap.forEach((item) => item.updateItemCrossAxisSize(width));
}
rebuildItemOffsetsFrom(0);
queueLayout();
}
function updateItemSize(key, height) {
const item = keyItemMap.get(key);
if (!item || item.size === height)
return;
item.size = height;
rebuildItemOffsetsFrom(item.index);
queueLayout();
}
function getItemOffset(key) {
const item = keyItemMap.get(key);
return item ? [item.offsetX, item.offsetY] : [-1, -1];
}
function queueLayout() {
if (queued || destroyed)
return;
queued = true;
Vue.nextTick(() => {
queued = false;
if (scrollElement.value)
updateRenderList();
});
}
function updateRenderList() {
if (placeholderElement.value)
placeholderElement.value.style.height = `${placeholderSize}px`;
if (pendingScrollId) {
const key = idKeyMap.get(pendingScrollId);
if (key !== void 0) {
pendingScrollId = "";
scrollingToItemKey = key;
scrollingToItemOffset = -1;
scrollingToItemTimestamp = Date.now();
cachedSizeStart = 0;
}
}
if (scrollingToItemKey !== void 0) {
const item = keyItemMap.get(scrollingToItemKey);
if (item && item.offsetY !== scrollingToItemOffset) {
scrollingToItemOffset = item.offsetY;
const animation2 = attrs2["scroll-with-animation"];
const animated = (animation2 === "" || animation2 === true || animation2 === "true") && Date.now() - scrollingToItemTimestamp < 300;
scrollElement.value.scrollTo({
top: item.offsetY,
behavior: animated ? "smooth" : "instant"
});
if (!animated)
scrollOffset = scrollElement.value.scrollTop;
}
}
itemInstanceMap.forEach((instance, key) => {
const item = keyItemMap.get(key);
if (item)
instance.updateItemOffset(item.offsetX, item.offsetY);
});
const min = Math.max(0, scrollOffset - cachedSizeStart + 0.2);
const max = scrollOffset + size + 200 - 0.2;
let low = 0;
let high = list.length;
while (low < high) {
const mid = low + high >>> 1;
if (list[mid].maxEndOffset < min)
low = mid + 1;
else
high = mid;
}
const start = low;
high = list.length;
while (low < high) {
const mid = low + high >>> 1;
if (list[mid].offsetY <= max)
low = mid + 1;
else
high = mid;
}
updateRenderInfo(start, low - start);
}
function onScroll() {
scrollOffset = Math.max(0, scrollElement.value.scrollTop);
updateRenderList();
clearTimeout(scrollEndTimer);
scrollEndTimer = setTimeout(onScrollEnd, 150);
}
function onScrollEnd() {
clearTimeout(scrollEndTimer);
updateRenderList();
scrollingToItemKey = void 0;
cachedSizeStart = 200;
}
new ResizeObserver((entries2) => {
const entry = entries2[entries2.length - 1];
size = entry.contentRect.height;
if (containerCrossAxisSize !== entry.contentRect.width) {
containerCrossAxisSize = entry.contentRect.width;
updateCrossAxisMetrics();
} else
queueLayout();
});
Vue.watch(
[
realCrossAxisCount,
realMainAxisGap,
realCrossAxisGap,
realMaxCrossAxisExtent
],
updateCrossAxisMetrics
);
Vue.watch(
() => props2.scrollIntoView,
(id2) => {
pendingScrollId = id2;
scrollingToItemKey = void 0;
queueLayout();
}
);
__expose({ renderRange, updateList, updateListIds, updateRenderInfo });
const n7 = Vue.withComponentId("2edab972", () => Vue.createComponent(__syscom_0, {
onScroll: () => onScroll,
onScrollend: () => onScrollEnd
}, {
"refresher": Vue.extend(() => {
const n4 = Vue.createSlot(
"refresher",
null,
null,
4
/* FORWARDED */
);
return n4;
}, {
_: 1
/* NON_STABLE */
}),
"default": () => {
const n3 = t0();
const n2 = Vue.child(n3);
const n1 = Vue.next(n2);
Vue.setInsertionState(n3, n2);
Vue.createSlot();
Vue.setStaticTemplateRef(n1, placeholderElement, null, "placeholderElement");
const n6 = Vue.createSlot("load-more");
return [n3, n6];
}
}, true));
Vue.setStaticTemplateRef(n7, scrollElement, null, "scrollElement");
const _uniWaterflowRoot = Vue.getBlockFirstNode(n7);
if (_uniWaterflowRoot && _uniWaterflowRoot.nodeType === 1) {
_uniWaterflowRoot.setAttribute("uni-waterflow", "");
Vue.initUniElement(_uniWaterflowRoot, _uniWaterflowElement);
}
return n7;
}
});
const _t0$5 = Vue.template('<text class="uni-video-icon uni-video-toast-icon">', false, 1);
const _t1$1 = Vue.template("<div><!><div class=uni-video-toast-draw></div>");
const _t2 = Vue.template('<div class=uni-video-container><video></video><div class="uni-video-bar uni-video-bar-full"><div class=uni-video-controls><div></div><div class=uni-video-current-time> </div><div class=uni-video-progress-container><div><div class=uni-video-progress-buffered></div><div class=uni-video-progress-played></div><div><div class=uni-video-inner></div></div></div></div><div class=uni-video-duration> </div></div><div></div><div></div></div><div style="z-index: 0;" class=uni-video-danmu></div> <div class=uni-video-loading></div><div><div class=uni-video-toast-title><span class=uni-video-toast-title-current-time> </span> </div></div><div class=uni-video-slots> ', 1);
const _t3 = Vue.template('<div class=uni-video-cover><div class="uni-video-cover-play-button uni-video-icon"></div>', 1);
const _t4 = Vue.template('<text class="uni-video-icon uni-video-toast-icon">', 1, 1);
function formatTime(val) {
val = val > 0 && val < Infinity ? val : 0;
const h = Math.floor(val / 3600);
const m = Math.floor(val % 3600 / 60);
const s = Math.floor(val % 3600 % 60);
const hStr = (h < 10 ? "0" : "") + h;
const mStr = (m < 10 ? "0" : "") + m;
const sStr = (s < 10 ? "0" : "") + s;
let str = mStr + ":" + sStr;
if (hStr !== "00") {
str = hStr + ":" + str;
}
return str;
}
function useGesture(props2, videoState, videoRef, fullscreenState) {
const state = Vue.reactive({
seeking: false,
gestureType: "none",
volumeOld: 0,
volumeNew: 0,
currentTimeOld: 0,
currentTimeNew: 0,
toastThin: false
});
const touchStartOrigin = {
x: 0,
y: 0
};
let changeToastThinTimer = null;
const changeToastThin = () => {
if (state.gestureType !== "none" && changeToastThinTimer != null)
return;
changeToastThinTimer = setTimeout(() => {
state.toastThin = true;
}, 500);
};
let showToastTimer = void 0;
function changeShowToast() {
if (showToastTimer != void 0)
return;
showToastTimer = setTimeout(() => {
state.toastThin = false;
showToastTimer = void 0;
}, 1e3);
}
function clearChangeShowToast() {
clearTimeout(showToastTimer);
showToastTimer = void 0;
}
function onTouchstart(event) {
const toucher = event.targetTouches[0];
touchStartOrigin.x = toucher.pageX;
touchStartOrigin.y = toucher.pageY;
state.gestureType = "none";
state.volumeOld = 0;
if (fullscreenState.fullscreen) {
event.stopPropagation();
}
}
function onTouchmove(event) {
function stop() {
if (fullscreenState.fullscreen) {
event.stopPropagation();
}
event.preventDefault();
}
if (fullscreenState.fullscreen) {
stop();
}
const gestureType = state.gestureType;
if (gestureType === "stop") {
return;
}
const toucher = event.targetTouches[0];
const pageX = toucher.pageX;
const pageY = toucher.pageY;
const origin = touchStartOrigin;
const video = videoRef.value;
if (gestureType === "progress") {
changeProgress(pageX - origin.x);
state.seeking = true;
} else if (gestureType === "volume") {
changeVolume(pageY - origin.y);
}
if (gestureType !== "none") {
stop();
return;
}
if (Math.abs(pageX - origin.x) > Math.abs(pageY - origin.y)) {
if (!props2.enableProgressGesture) {
state.gestureType = "stop";
return;
}
state.gestureType = "progress";
state.currentTimeOld = state.currentTimeNew = video.currentTime;
if (!fullscreenState.fullscreen) {
stop();
}
} else {
if (!props2.pageGesture && !props2.vslideGesture) {
state.gestureType = "stop";
return;
}
changeToastThin();
state.gestureType = "volume";
state.volumeOld = video.volume;
if (!fullscreenState.fullscreen) {
stop();
}
}
}
function onTouchend(event) {
const video = videoRef.value;
if (state.gestureType !== "none" && state.gestureType !== "stop") {
if (fullscreenState.fullscreen) {
event.stopPropagation();
}
event.preventDefault();
}
if (state.gestureType === "progress" && state.currentTimeOld !== state.currentTimeNew) {
video.currentTime = state.currentTimeNew;
}
state.gestureType = "none";
}
function changeProgress(x) {
const duration = videoState.currentDuration;
let currentTimeNew = x / 600 * duration + state.currentTimeOld;
if (currentTimeNew < 0) {
currentTimeNew = 0;
} else if (currentTimeNew > duration) {
currentTimeNew = duration;
}
state.currentTimeNew = currentTimeNew;
}
function changeVolume(y) {
const video = videoRef.value;
const valueOld = state.volumeOld;
let value;
if (typeof valueOld === "number") {
value = valueOld - y / 200;
if (value < 0) {
value = 0;
} else if (value > 1) {
value = 1;
}
clearChangeShowToast();
changeShowToast();
video.volume = value;
state.volumeNew = value;
}
}
return {
state,
onTouchstart,
onTouchmove,
onTouchend
};
}
function useFullscreen(trigger, containerRef, videoRef, userActionState, rootRef) {
const state = Vue.reactive({ fullscreen: false });
const isSafari = /^Apple/.test(navigator.vendor);
function onFullscreenChange($event, webkit) {
if (webkit && document.fullscreenEnabled) {
return;
}
emitFullscreenChange(!!(document.fullscreenElement || document.webkitFullscreenElement));
}
function emitFullscreenChange(val) {
state.fullscreen = val;
trigger("fullscreenchange", {}, {
fullScreen: val,
direction: "vertical"
});
}
function toggleFullscreen(val) {
const root = rootRef.value;
const container = containerRef.value;
const video = videoRef.value;
let mockFullScreen;
if (val) {
if ((document.fullscreenEnabled || document.webkitFullscreenEnabled) && (!isSafari || userActionState.userAction)) {
container[document.fullscreenEnabled ? "requestFullscreen" : "webkitRequestFullscreen"]();
} else if (video.webkitEnterFullScreen) {
video.webkitEnterFullScreen();
} else {
mockFullScreen = true;
container.remove();
container.classList.add("uni-video-type-fullscreen");
document.body.appendChild(container);
}
} else {
if (document.fullscreenEnabled || document.webkitFullscreenEnabled) {
if (document.fullscreenElement) {
document.exitFullscreen();
} else if (document.webkitFullscreenElement) {
document.webkitExitFullscreen();
}
} else if (video.webkitExitFullScreen) {
video.webkitExitFullScreen();
} else {
mockFullScreen = true;
container.remove();
container.classList.remove("uni-video-type-fullscreen");
root.appendChild(container);
}
}
if (mockFullScreen) {
emitFullscreenChange(val);
}
}
function requestFullScreen() {
toggleFullscreen(true);
}
function exitFullScreen() {
toggleFullscreen(false);
}
return {
state,
onFullscreenChange,
emitFullscreenChange,
toggleFullscreen,
requestFullScreen,
exitFullScreen
};
}
function useVideo(props2, attrs2, trigger) {
const videoRef = Vue.ref(null);
const src = Vue.computed(() => getRealPath(props2.src));
const muted = Vue.computed(() => props2.muted === "true" || props2.muted === true);
const state = Vue.reactive({
start: false,
src,
playing: false,
currentTime: 0,
duration: 0,
currentDuration: 0,
progress: 0,
buffered: 0,
muted,
pauseUpdatingCurrentTime: false
});
Vue.watch(() => src.value, () => {
state.playing = false;
state.currentTime = 0;
});
Vue.watch(() => state.buffered, (buffered) => {
trigger("progress", {}, { buffered });
});
Vue.watch(() => muted.value, (muted2) => {
const video = videoRef.value;
video.muted = muted2;
});
Vue.watch([() => state.duration, () => props2.duration], () => {
let _duration = Number(props2.duration);
isNaN(_duration) && (_duration = 0);
state.currentDuration = _duration > 0 ? _duration : state.duration;
});
function onDurationChange({ target }) {
state.duration = target.duration;
}
function onLoadedMetadata($event) {
const initialTime = Number(props2.initialTime) || 0;
const video = $event.target;
if (initialTime > 0) {
video.currentTime = initialTime;
}
trigger("loadedmetadata", $event, {
width: video.videoWidth,
height: video.videoHeight,
duration: video.duration
});
onProgress($event);
}
function onProgress($event) {
const video = $event.target;
const buffered = video.buffered;
if (buffered.length) {
state.buffered = buffered.end(buffered.length - 1) / video.duration * 100;
}
}
function onWaiting($event) {
trigger("waiting", $event, {});
}
function onVideoError($event) {
state.playing = false;
trigger("error", $event, {});
}
function onPlay($event) {
state.start = true;
state.playing = true;
trigger("play", $event, {});
}
function onPause($event) {
state.playing = false;
trigger("pause", $event, {});
}
function onEnded($event) {
state.playing = false;
trigger("ended", $event, {});
}
function onTimeUpdate($event) {
const video = $event.target;
if (!state.pauseUpdatingCurrentTime) {
state.currentTime = video.currentTime;
}
const currentTime = video.currentTime;
trigger("timeupdate", $event, {
currentTime,
duration: video.duration
});
}
function toggle() {
const video = videoRef.value;
if (state.playing) {
video.pause();
} else {
video.play();
}
}
function play() {
const video = videoRef.value;
state.start = true;
video.play();
}
function pause() {
const video = videoRef.value;
video.pause();
}
function seek(position) {
const video = videoRef.value;
position = Number(position);
if (typeof position === "number" && !isNaN(position)) {
video.currentTime = position;
}
}
function stop() {
seek(0);
pause();
}
function playbackRate(rate) {
const video = videoRef.value;
video.playbackRate = rate;
}
return {
videoRef,
state,
play,
pause,
stop,
seek,
playbackRate,
toggle,
onDurationChange,
onLoadedMetadata,
onProgress,
onWaiting,
onVideoError,
onPlay,
onPause,
onEnded,
onTimeUpdate
};
}
function useControls(props2, videoState, seek, seeking) {
const progressRef = Vue.ref(null);
const ballRef = Vue.ref(null);
const centerPlayBtnShow = Vue.computed(() => props2.showCenterPlayBtn && !videoState.start);
const controlsVisible = Vue.ref(true);
const controlsShow = Vue.computed(() => !centerPlayBtnShow.value && props2.controls && controlsVisible.value);
const state = Vue.reactive({
seeking: false,
touching: false,
controlsTouching: false,
centerPlayBtnShow,
controlsShow,
controlsVisible
});
function clickProgress(event) {
const $progress = progressRef.value;
let element = event.target;
let x = event.offsetX;
while (element && element !== $progress) {
x += element.offsetLeft;
element = element.parentNode;
}
const w = $progress.offsetWidth;
let progress = 0;
if (x >= 0 && x <= w) {
progress = x / w;
seek(videoState.currentDuration * progress);
}
}
function toggleControls() {
state.controlsVisible = !state.controlsVisible;
}
let hideTiming;
function autoHideStart() {
hideTiming = setTimeout(() => {
state.controlsVisible = false;
}, 3e3);
}
function autoHideEnd() {
if (hideTiming) {
clearTimeout(hideTiming);
hideTiming = null;
}
}
Vue.watch(() => state.controlsShow && videoState.playing && !state.controlsTouching, (val) => {
if (val) {
autoHideStart();
} else {
autoHideEnd();
}
});
return {
state,
progressRef,
ballRef,
clickProgress,
toggleControls,
autoHideStart,
autoHideEnd
};
}
function useDanmu(props2, videoState) {
const danmuRef = Vue.ref(null);
const state = Vue.reactive({ enable: Boolean(props2.enableDanmu) });
let danmuIndex = {
time: 0,
index: -1
};
const danmuList = shared.isArray(props2.danmuList) ? JSON.parse(JSON.stringify(props2.danmuList)) : [];
danmuList.sort(function(a, b) {
return (a.time || 0) - (b.time || 0);
});
function toggleDanmu() {
state.enable = !state.enable;
}
function updateDanmu(event) {
const video = event.target;
const currentTime = video.currentTime;
const oldDanmuIndex = danmuIndex;
const newDanmuIndex = {
time: currentTime,
index: oldDanmuIndex.index
};
if (currentTime > oldDanmuIndex.time) {
for (let index2 = oldDanmuIndex.index + 1; index2 < danmuList.length; index2++) {
const element = danmuList[index2];
if (currentTime >= (element.time || 0)) {
newDanmuIndex.index = index2;
if (videoState.playing && state.enable) {
playDanmu(element);
}
} else {
break;
}
}
} else if (currentTime < oldDanmuIndex.time) {
for (let index2 = oldDanmuIndex.index - 1; index2 > -1; index2--) {
const element = danmuList[index2];
if (currentTime <= (element.time || 0)) {
newDanmuIndex.index = index2 - 1;
} else {
break;
}
}
}
danmuIndex = newDanmuIndex;
}
function playDanmu(danmu) {
const p2 = document.createElement("p");
p2.className = "uni-video-danmu-item";
p2.innerText = danmu.text;
let style = `bottom: ${Math.random() * 100}%;color: ${danmu.color};`;
p2.setAttribute("style", style);
const danmuEl = danmuRef.value;
danmuEl.appendChild(p2);
setTimeout(function() {
style += "left: 0;-webkit-transform: translateX(-100%);transform: translateX(-100%);";
p2.setAttribute("style", style);
setTimeout(function() {
p2.remove();
}, 4e3);
}, 17);
}
function sendDanmu(danmu) {
danmuList.splice(danmuIndex.index + 1, 0, {
text: String(danmu.text),
color: danmu.color,
time: videoState.currentTime || 0
});
}
return {
state,
danmuRef,
updateDanmu,
toggleDanmu,
sendDanmu
};
}
function useContext(play, pause, stop, seek, sendDanmu, playbackRate, requestFullScreen, exitFullScreen) {
useContextInfo();
useSubscribe();
}
function useProgressing(videoState, gestureState, controlsState, autoHideEnd, autoHideStart) {
const progressing = Vue.computed(() => gestureState.gestureType === "progress" || controlsState.touching);
Vue.watch(progressing, (val) => {
videoState.pauseUpdatingCurrentTime = val;
controlsState.controlsTouching = val;
if (gestureState.gestureType === "progress" && val) {
controlsState.controlsVisible = val;
}
});
Vue.watch([() => videoState.currentTime, () => videoState.currentDuration], () => {
if (videoState.currentDuration > 0) {
videoState.progress = videoState.currentTime / videoState.currentDuration * 100;
} else {
videoState.progress = 0;
}
videoState.progress > 100 && (videoState.progress = 100);
}, { immediate: true });
Vue.watch(() => gestureState.currentTimeNew, (currentTimeNew) => {
videoState.currentTime = currentTimeNew;
});
return progressing;
}
const videoProps = {
id: {
type: String,
default: ""
},
src: {
type: String,
default: ""
},
duration: {
type: [Number, String],
default: ""
},
controls: {
type: [Boolean, String],
default: true
},
danmuList: {
type: Array,
default() {
return [];
}
},
danmuBtn: {
type: [Boolean, String],
default: false
},
enableDanmu: {
type: [Boolean, String],
default: false
},
autoplay: {
type: [Boolean, String],
default: false
},
loop: {
type: [Boolean, String],
default: false
},
muted: {
type: [Boolean, String],
default: false
},
objectFit: {
type: String,
default: "contain"
},
poster: {
type: String,
default: ""
},
direction: {
type: [String, Number],
default: ""
},
showProgress: {
type: Boolean,
default: true
},
initialTime: {
type: [String, Number],
default: 0
},
showFullscreenBtn: {
type: [Boolean, String],
default: true
},
pageGesture: {
type: [Boolean, String],
default: false
},
vslideGesture: {
type: [Boolean, String],
default: false
},
enableProgressGesture: {
type: [Boolean, String],
default: true
},
showPlayBtn: {
type: [Boolean, String],
default: true
},
showCenterPlayBtn: {
type: [Boolean, String],
default: true
}
};
const videoEmits = [
"fullscreenchange",
"progress",
"loadedmetadata",
"waiting",
"error",
"play",
"pause",
"ended",
"timeupdate"
];
function useVideoComponent(props2, { emit: emit2, attrs: attrs2, slots }) {
const rootRef = Vue.ref(null);
const containerRef = Vue.ref(null);
const trigger = useCustomEvent(rootRef, emit2);
const { state: userActionState } = useUserAction();
const { $attrs: videoAttrs } = useAttrs({ excludeListeners: true });
initI18nVideoMsgsOnce();
const { videoRef, state: videoState, play, pause, stop, seek, playbackRate, toggle, onDurationChange, onLoadedMetadata, onProgress, onWaiting, onVideoError, onPlay, onPause, onEnded, onTimeUpdate } = useVideo(props2, attrs2, trigger);
const { state: danmuState, danmuRef, updateDanmu, toggleDanmu, sendDanmu } = useDanmu(props2, videoState);
const { state: fullscreenState, onFullscreenChange, emitFullscreenChange, toggleFullscreen, requestFullScreen, exitFullScreen } = useFullscreen(trigger, containerRef, videoRef, userActionState, rootRef);
const { state: gestureState, onTouchstart, onTouchend, onTouchmove } = useGesture(props2, videoState, videoRef, fullscreenState);
const { state: controlsState, progressRef, ballRef, clickProgress, toggleControls, autoHideEnd, autoHideStart } = useControls(props2, videoState, seek);
useContext();
const progressing = useProgressing(videoState, gestureState, controlsState);
return {
rootRef,
toggleControls,
methods: {
play,
pause,
stop,
seek,
sendDanmu,
playbackRate,
requestFullScreen,
exitFullScreen
},
render: () => {
return (() => {
const _setTemplateRef = Vue.createTemplateRefSetter();
const _n0 = _t2();
const _n1 = Vue.child(_n0);
const _n2 = Vue.next(_n1);
let _p0 = Vue.child(_n2);
const _n3 = Vue.child(_p0);
const _n4 = Vue.next(_n3);
const _n5 = Vue.next(_n4);
const _n9 = Vue.child(_n5);
const _n6 = Vue.child(_n9);
const _n7 = Vue.next(_n6);
const _n8 = Vue.next(_n7);
const _n10 = Vue.next(_n5);
const _n11 = Vue.next(_p0);
const _n12 = Vue.next(_n11);
const _n13 = Vue.next(_n2);
const _n14 = Vue.next(_n13, true);
const _n27 = Vue.next(_n14);
const _n30 = Vue.next(_n27);
const _n28 = Vue.child(Vue.child(_n30));
const _n29 = Vue.next(_n28, true);
const _n31 = Vue.next(_n30);
Vue.on(_n0, "touchstart", onTouchstart);
Vue.on(_n0, "touchend", onTouchend);
Vue.on(_n0, "touchmove", onTouchmove);
Vue.on(
_n0,
// @ts-expect-error
"fullscreenchange",
Vue.withModifiers(onFullscreenChange, ["stop"])
);
Vue.on(_n0, "webkitfullscreenchange", Vue.withModifiers(($event) => onFullscreenChange($event, true), ["stop"]));
Vue.on(_n1, "durationchange", onDurationChange);
Vue.on(_n1, "loadedmetadata", onLoadedMetadata);
Vue.on(_n1, "progress", onProgress);
Vue.on(_n1, "waiting", onWaiting);
Vue.on(_n1, "error", onVideoError);
Vue.on(_n1, "play", onPlay);
Vue.on(_n1, "pause", onPause);
Vue.on(_n1, "ended", onEnded);
Vue.on(_n1, "timeupdate", (event) => {
onTimeUpdate(event);
updateDanmu(event);
});
Vue.on(_n1, "webkitbeginfullscreen", () => emitFullscreenChange(true));
Vue.on(_n1, "x5videoenterfullscreen", () => emitFullscreenChange(true));
Vue.on(_n1, "webkitendfullscreen", () => emitFullscreenChange(false));
Vue.on(_n1, "x5videoexitfullscreen", () => emitFullscreenChange(false));
Vue.applyVShow(_n2, () => controlsState.controlsShow);
Vue.on(_n2, "click", Vue.withModifiers(() => {
}, ["stop"]));
Vue.applyVShow(_n3, () => props2.showPlayBtn);
Vue.on(_n3, "click", Vue.withModifiers(toggle, ["stop"]));
Vue.applyVShow(_n4, () => props2.showProgress);
const _x4 = Vue.txt(_n4);
setNodes(_x4, () => formatTime(videoState.currentTime));
Vue.on(_n5, "click", Vue.withModifiers(clickProgress, ["stop"]));
Vue.applyVShow(_n5, () => props2.showProgress);
Vue.applyVShow(_n10, () => props2.showProgress);
const _x10 = Vue.txt(_n10);
setNodes(_x10, () => formatTime(videoState.currentDuration));
Vue.applyVShow(_n11, () => props2.danmuBtn);
Vue.on(_n11, "click", Vue.withModifiers(toggleDanmu, ["stop"]));
Vue.applyVShow(_n12, () => props2.showFullscreenBtn);
Vue.on(_n12, "click", Vue.withModifiers(() => toggleFullscreen(!fullscreenState.fullscreen), ["stop"]));
Vue.applyVShow(_n13, () => videoState.start && danmuState.enable);
setNodes(_n14, () => controlsState.centerPlayBtnShow && (() => {
const _n02 = _t3();
const _n16 = Vue.child(_n02);
Vue.on(_n02, "click", Vue.withModifiers(() => {
}, ["stop"]));
Vue.on(_n16, "click", Vue.withModifiers(play, ["stop"]));
return _n02;
})());
Vue.renderEffect(() => {
Vue.setDynamicProps(_n1, [
{
style: { "object-fit": props2.objectFit },
muted: !!props2.muted,
loop: !!props2.loop,
src: videoState.src,
poster: props2.poster,
autoplay: !!props2.autoplay
},
videoAttrs.value,
{
class: {
"uni-video-video": true,
"uni-video-video-fullscreen": fullscreenState.fullscreen
},
"webkit-playsinline": true,
playsinline: true
}
]);
_setTemplateRef(_n1, videoRef);
Vue.setClassName(_n3, 1 | 2 | (!videoState.playing ? 4 : 0) | (videoState.playing ? 8 : 0), [
" uni-video-icon",
" uni-video-control-button",
" uni-video-control-button-play",
" uni-video-control-button-pause"
]);
Vue.setClassName(_n9, 1 | (progressing.value ? 2 : 0), [" uni-video-progress", " uni-video-progress-progressing"]);
Vue.setStyle(_n6, {
width: videoState.buffered - videoState.progress + "%",
left: videoState.progress + "%"
});
Vue.setStyle(_n7, { width: videoState.progress + "%" });
Vue.setStyle(_n8, { left: videoState.progress + "%" });
Vue.setClassName(_n8, 1 | (progressing.value ? 2 : 0), [" uni-video-ball", " uni-video-ball-progressing"]);
_setTemplateRef(_n8, ballRef);
_setTemplateRef(_n5, progressRef);
Vue.setClassName(_n11, 1 | 2 | (danmuState.enable ? 4 : 0), [
" uni-video-icon",
" uni-video-danmu-button",
" uni-video-danmu-button-active"
]);
Vue.setClassName(_n12, 1 | 2 | (fullscreenState.fullscreen ? 4 : 0), [
" uni-video-icon",
" uni-video-fullscreen",
" uni-video-type-fullscreen"
]);
_setTemplateRef(_n13, danmuRef);
});
Vue.setInsertionState(_n27);
Vue.createIf(() => gestureState.gestureType === "volume", () => {
const _n24 = _t1$1();
const _n23 = Vue.child(_n24);
const _n22 = Vue.next(_n23);
Vue.renderEffect(() => Vue.setClassName(_n24, 1 | (gestureState.toastThin ? 2 : 0), [" uni-video-toast-container", " uni-video-toast-container-thin"]));
Vue.setInsertionState(_n24, _n23);
Vue.createIf(() => !gestureState.toastThin && gestureState.volumeNew > 0 && gestureState.gestureType === "volume", () => {
const _n19 = _t0$5();
return _n19;
}, () => {
const _n21 = createNodes(() => !gestureState.toastThin && (() => {
const _n02 = _t4();
return _n02;
})());
return _n21;
}, 265);
Vue.setStyle(_n24, { marginTop: `5px` });
Vue.renderEffect(() => Vue.setStyle(_n22, { width: `${gestureState.volumeNew * 100}%` }));
return _n24;
}, () => {
const _n26 = createNodes(null);
return _n26;
}, 521);
const _x28 = Vue.txt(_n28);
setNodes(_x28, () => formatTime(gestureState.currentTimeNew));
setNodes(_n29, " / ", () => formatTime(videoState.currentDuration));
const _x31 = Vue.txt(_n31);
setNodes(_x31, () => slots.default && slots.default());
Vue.renderEffect(() => {
Vue.setClassName(_n30, 1 | (progressing.value ? 2 : 0), [" uni-video-toast", " uni-video-toast-progress"]);
_setTemplateRef(_n0, containerRef);
});
return _n0;
})();
}
};
}
const _t0$4 = Vue.template("<div uni-video uni-view> ", 1);
class UniVideoElement extends UniViewElement {
static [Symbol.hasInstance](value) {
return this === UniVideoElement && value instanceof UniViewElement && value.hasAttribute("uni-video") || Function.prototype[Symbol.hasInstance].call(this, value);
}
}
const uniTagName$3 = { value: "VIDEO" };
const indexVapor$3 = /* @__PURE__ */ defineBuiltInComponent({
name: "Video",
props: videoProps,
emits: videoEmits,
rootElement: {
name: "uni-video",
class: UniVideoElement
},
setup(props2, context) {
const { rootRef, toggleControls, methods, render } = useVideoComponent(props2, context);
const root = (() => {
const _setTemplateRef = Vue.createTemplateRefSetter();
const _n0 = _t0$4();
Vue.on(_n0, "click", toggleControls);
const _x0 = Vue.txt(_n0);
setNodes(_x0, () => render());
Vue.renderEffect(() => {
Vue.setProp(_n0, "id", props2.id);
_setTemplateRef(_n0, rootRef);
});
return _n0;
})();
Object.assign(root, methods);
Object.defineProperty(root, "uniTagName", uniTagName$3);
return root;
}
});
const onWebInvokeAppService = ({ name, arg }) => {
if (name === "postMessage")
;
else {
switch (name) {
case "navigateTo":
uni.navigateTo(arg);
break;
case "navigateBack":
uni.navigateBack(arg);
break;
case "switchTab":
uni.switchTab(arg);
break;
case "reLaunch":
uni.reLaunch(arg);
break;
case "redirectTo":
uni.redirectTo(arg);
break;
}
}
};
const Invoke = /* @__PURE__ */ uniShared.once(
() => UniServiceJSBridge.on(uniShared.ON_WEB_INVOKE_APP_SERVICE, onWebInvokeAppService)
);
const webViewProps = {
src: {
type: String,
default: ""
}
};
function useWebView(props2, emit2) {
Invoke();
const rootRef = Vue.ref(null);
Vue.ref(null);
const { $attrs, $excludeAttrs, $listeners } = useAttrs({
excludeListeners: true
});
return { rootRef, $listeners, $excludeAttrs };
}
const _t0$3 = Vue.template("<div>", 1);
class UniWebViewElement extends UniViewElement {
static [Symbol.hasInstance](value) {
return this === UniWebViewElement && value instanceof UniViewElement && value.hasAttribute("uni-web-view") || Function.prototype[Symbol.hasInstance].call(this, value);
}
}
const uniTagName$2 = { value: "WEB-VIEW" };
const indexVapor$2 = /* @__PURE__ */ defineBuiltInComponent({
inheritAttrs: false,
name: "WebView",
props: webViewProps,
emits: ["load"],
rootElement: {
name: "uni-web-view",
class: UniWebViewElement
},
setup(props2, { emit: emit2 }) {
const { rootRef, $listeners, $excludeAttrs } = useWebView();
const root = (() => {
const _setTemplateRef = Vue.createTemplateRefSetter();
const _n0 = _t0$3();
Vue.renderEffect(() => {
Vue.setDynamicProps(_n0, [
{
"uni-web-view": "",
"uni-view": "",
class: "uni-webview"
},
$listeners.value,
$excludeAttrs.value
]);
_setTemplateRef(_n0, rootRef);
});
return _n0;
})();
Object.defineProperty(root, "uniTagName", uniTagName$2);
return root;
}
});
const ICON_PATH_ORIGIN = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAACECAMAAABmmnOVAAAC01BMVEUAAAAAef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef96quGStdqStdpbnujMzMzCyM7Gyc7Ky83MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMwAef8GfP0yjfNWnOp0qOKKsdyYt9mju9aZt9mMstx1qeJYnekyjvIIfP0qivVmouaWttnMzMyat9lppOUujPQKffxhoOfNzc3Y2Njh4eHp6enu7u7y8vL19fXv7+/i4uLZ2dnOzs6auNgOf/sKff15quHR0dHx8fH9/f3////j4+N6quFdn+iywdPb29vw8PD+/v7c3NyywtLa2tr29vbS0tLd3d38/Pzf39/o6Ojc7f+q0v+HwP9rsf9dqv9Hnv9Vpv/q6urj8P+Vx/9Am/8Pgf8Iff/z8/OAvP95uf/n5+c5l//V6f+52v+y1//7+/vt7e0rkP/09PTQ0NDq9P8Whf+cy//W1tbe3t7A3v/m5ubs7OxOov/r6+vk5OQiaPjKAAAAknRSTlMACBZ9oB71/jiqywJBZATT6hBukRXv+zDCAVrkDIf4JbQsTb7eVeJLbwfa8Rh4G/OlPS/6/kxQ9/xdmZudoJxNVhng7B6wtWdzAtQOipcF1329wS44doK/BAkyP1pvgZOsrbnGXArAg34G2IsD1eMRe7bi7k5YnqFT9V0csyPedQyYD3p/Fje+hDpskq/MwpRBC6yKp2MAAAQdSURBVHja7Zn1exMxGIAPHbrhDsPdneHuNtzd3d3dIbjLh93o2o4i7TpgG1Jk0g0mMNwd/gTa5rq129reHnK5e/bk/TFNk/dJ7r5894XjGAwGg8GgTZasCpDIll1+hxw5vXLJLpEboTx5ZXbIhyzkl9fB28cqUaCgrBKFkI3CcjoUKYolihWXUSI7EihRUjaHXF52CVRKLoe8eZIdUOkyMknkRw6UlcehYAFHiXK+skgURk6Ul8OhQjFnCVRRBolKqRxQ5SzUHaqgNGSj7VCmalqJnDkoS5RF6ZCbroNvufQkUD6qEuXTdUA+3hQdqiEXVKfnUKOmK4latalJ1EEuoZZ6162HJ9x/4OChw0eOHj12/MTJU6dxG7XUu751tjNnz4ET5y9ctLZTSr0beKFLl89bpuUDrqgC1RqNWqsKuqqzNFw7e51S6u3tc+OmZUJ9kCHY6ECwOkRvab51iUrqXej2HYDQsHBjWgx3Ae7dppB6N2wEcF9jdMGDUIDGTaR2aNoM9FqjG7QmaN5CWgc/gIePjG559BigpZQOrYB/4jBfRGRUtDkmJjY6KjLCofkpD62lc2gDfMpWPIuLdwyV8XEpHgaddBZ+wBuSFcwJqSN2ovmZ/dfnOvCTxqGtwzq8SEjv4EhISn48eWgnhUP7DvDSvgzxrs6vV6+FLiro2EkCic4QKkzwJsH1KYreCp0eQhfyDl1B/w4P/xa5JVJ4U03QjbRD9x7wXlgH5IE3wmMBHXoSlugFAcI6f/AkkSi8q6HQm6xDn77wEQ8djTwSj3tqAMguRTe4ikeOQyJ4YV+KfkQl+oNW5GbY4gWOWgbwJ+kwAD6Fi90MK2ZsrIeBBCUGwRXbqJ+/iJMQliIEBhOU6AJhtlG/IpHE2bqrYQg5h6HA4yQiRqwEfkGCdTCMmMRw+IbPDCQaHCsCYAQxiZHw3TbmD/ESOHgHwShiEqPhp/gggYkSztIxxCRawy/bmEniJaJtfwiEscQkxkFgRqJESqQwwHhiEuMBp3Vm8RK/cZoHEzKXhCK2QxEPpiJe0YlKCFaKCNv/cYBNUsBRPlkJSc0U+dM7E9H0ThGJbgZT/iR7yj+VqMS06Qr4+OFm2JdCxIa8lugzkJs5K6MfxAaYPUcBpYG5khZJEkUUSb7DPCnKRfPBXj6M8FwuegoLpCgXcQszVjhbJFUJUee2hBhLoYTIcYtB57KY+opSMdVqwatSlZVj05aV//CwJLMX2DluaUcwhXm4ali2XOoLjxUrPV26zFtF4f5p0Gp310+z13BUWNvbehEXona6iAtX/zVZmtfN4WixfsNky4S6gCCVVq3RPLdfSfpv3MRRZfPoLc6Xs/5bt3EyMGzE9h07/Xft2t15z6i9+zgGg8FgMBgMBoPBYDAYDAYj8/APG67Rie8pUDsAAAAASUVORK5CYII=";
var MapType = /* @__PURE__ */ ((MapType2) => {
MapType2["QQ"] = "qq";
MapType2["GOOGLE"] = "google";
MapType2["AMAP"] = "AMap";
MapType2["BMAP"] = "BMapGL";
MapType2["UNKNOWN"] = "";
return MapType2;
})(MapType || {});
function getMapInfo() {
if (__uniConfig.bMapKey) {
return {
type: "BMapGL",
key: __uniConfig.bMapKey
};
}
if (__uniConfig.qqMapKey) {
return {
type: "qq",
key: __uniConfig.qqMapKey
};
}
if (__uniConfig.googleMapKey) {
return {
type: "google",
key: __uniConfig.googleMapKey
};
}
if (__uniConfig.aMapKey) {
return {
type: "AMap",
key: __uniConfig.aMapKey,
securityJsCode: __uniConfig.aMapSecurityJsCode,
serviceHost: __uniConfig.aMapServiceHost
};
}
return {
type: "",
key: ""
};
}
let IS_AMAP = false;
let hasGetIsAMap = false;
const getIsAMap = () => {
if (hasGetIsAMap) {
return IS_AMAP;
} else {
hasGetIsAMap = true;
return IS_AMAP = getMapInfo().type === "AMap";
}
};
const getIsBMap = () => {
return getMapInfo().type === "BMapGL";
};
const props$4 = {
id: {
type: [Number, String],
default: ""
},
latitude: {
type: [Number, String],
require: true
},
longitude: {
type: [Number, String],
require: true
},
title: {
type: String,
default: ""
},
iconPath: {
type: String,
require: true
},
rotate: {
type: [Number, String],
default: 0
},
alpha: {
type: [Number, String],
default: 1
},
width: {
type: [Number, String],
default: ""
},
height: {
type: [Number, String],
default: ""
},
callout: {
type: Object,
default: null
},
label: {
type: Object,
default: null
},
anchor: {
type: Object,
default: null
},
clusterId: {
type: [Number, String],
default: ""
},
customCallout: {
type: Object,
default: null
},
ariaLabel: {
type: String,
default: ""
}
};
function useMarkerLabelStyle(id2) {
const className = "uni-map-marker-label-" + id2;
const styleEl = document.createElement("style");
styleEl.id = className;
document.head.appendChild(styleEl);
return function updateMarkerLabelStyle(style) {
const newStyle = Object.assign({}, style, {
position: "absolute",
top: "70px",
borderStyle: "solid"
});
const div = document.createElement("div");
Object.keys(newStyle).forEach((key) => {
div.style[key] = newStyle[key] || "";
});
styleEl.innerText = `.${className}{${div.getAttribute("style")}}`;
return className;
};
}
const MapMarker = /* @__PURE__ */ defineSystemComponent({
name: "MapMarker",
props: props$4,
setup(props2) {
const id2 = String(!isNaN(Number(props2.id)) ? props2.id : "");
const onMapReady = Vue.inject("onMapReady");
const updateMarkerLabelStyle = useMarkerLabelStyle(id2);
let marker;
function removeMarkerCallout(callout) {
if (getIsAMap()) {
callout.removeAMapText();
} else {
callout.setMap(null);
}
}
onMapReady((map, maps, trigger) => {
function updateMarker(option) {
const title = option.title;
let position;
if (getIsAMap()) {
position = new maps.LngLat(option.longitude, option.latitude);
} else if (getIsBMap()) {
position = new maps.Point(option.longitude, option.latitude);
} else {
position = new maps.LatLng(option.latitude, option.longitude);
}
const img = new Image();
let imgHeight = 0;
img.onload = () => {
const anchor = option.anchor || {};
let icon;
let w;
let h;
let top;
let x = typeof anchor.x === "number" ? anchor.x : 0.5;
let y = typeof anchor.y === "number" ? anchor.y : 1;
if (option.iconPath && (option.width || option.height)) {
w = option.width || img.width / img.height * option.height;
h = option.height || img.height / img.width * option.width;
} else {
w = img.width / 2;
h = img.height / 2;
}
imgHeight = h;
top = h - (h - y * h);
if ("MarkerImage" in maps) {
icon = new maps.MarkerImage(img.src, null, null, new maps.Point(x * w, y * h), new maps.Size(w, h));
} else if ("Icon" in maps) {
icon = new maps.Icon({
image: img.src,
size: new maps.Size(w, h),
imageSize: new maps.Size(w, h),
imageOffset: new maps.Pixel(x * w, y * h)
});
} else {
icon = {
url: img.src,
anchor: new maps.Point(x, y),
size: new maps.Size(w, h)
};
}
if (getIsBMap()) {
marker = new maps.Marker(new maps.Point(position.lng, position.lat));
map.addOverlay(marker);
} else {
marker.setPosition(position);
marker.setIcon(icon);
}
if ("setRotation" in marker) {
marker.setRotation(option.rotate || 0);
}
const labelOpt = option.label || {};
if ("label" in marker) {
marker.label.setMap(null);
delete marker.label;
}
let label;
if (labelOpt.content) {
const labelStyle = {
borderColor: labelOpt.borderColor,
borderWidth: (Number(labelOpt.borderWidth) || 0) + "px",
padding: (Number(labelOpt.padding) || 0) + "px",
borderRadius: (Number(labelOpt.borderRadius) || 0) + "px",
backgroundColor: labelOpt.bgColor,
color: labelOpt.color,
fontSize: (labelOpt.fontSize || 14) + "px",
lineHeight: (labelOpt.fontSize || 14) + "px",
marginLeft: (Number(labelOpt.anchorX || labelOpt.x) || 0) + "px",
marginTop: (Number(labelOpt.anchorY || labelOpt.y) || 0) + "px"
};
if ("Label" in maps) {
label = new maps.Label({
position,
map,
clickable: false,
content: labelOpt.content,
style: labelStyle
});
marker.label = label;
} else if ("setLabel" in marker) {
if (getIsAMap()) {
const content = `<div style="
margin-left:${labelStyle.marginLeft};
margin-top:${labelStyle.marginTop};
padding:${labelStyle.padding};
background-color:${labelStyle.backgroundColor};
border-radius:${labelStyle.borderRadius};
line-height:${labelStyle.lineHeight};
color:${labelStyle.color};
font-size:${labelStyle.fontSize};
">
${labelOpt.content}
<div>`;
marker.setLabel({
content,
direction: "bottom-right"
});
} else {
const className = updateMarkerLabelStyle(labelStyle);
marker.setLabel({
text: labelOpt.content,
color: labelStyle.color,
fontSize: labelStyle.fontSize,
className
});
}
}
}
const calloutOpt = option.callout || {};
let callout = marker.callout;
let calloutStyle;
if (calloutOpt.content || title) {
if (getIsAMap() && calloutOpt.content) {
calloutOpt.content = calloutOpt.content.replaceAll("\n", "<br/>");
}
const boxShadow = "0px 0px 3px 1px rgba(0,0,0,0.5)";
let offsetY = -imgHeight / 2;
if (option.width || option.height) {
offsetY += 14 - imgHeight / 2;
}
calloutStyle = calloutOpt.content ? {
position,
map,
top,
// handle AMap callout offset
offsetY,
content: calloutOpt.content,
color: calloutOpt.color,
fontSize: calloutOpt.fontSize,
borderRadius: calloutOpt.borderRadius,
bgColor: calloutOpt.bgColor,
padding: calloutOpt.padding,
boxShadow: calloutOpt.boxShadow || boxShadow,
display: calloutOpt.display
} : {
position,
map,
top,
// handle AMap callout offset
offsetY,
content: title,
boxShadow
};
if (callout) {
callout.setOption(calloutStyle);
} else {
if (getIsAMap()) {
const callback = () => {
if (id2 !== "") {
trigger("callouttap", {}, { markerId: Number(id2) });
}
};
callout = marker.callout = new maps.Callout(calloutStyle, callback);
} else {
callout = marker.callout = new maps.Callout(calloutStyle);
callout.div.onclick = function($event) {
if (id2 !== "") {
trigger("callouttap", $event, { markerId: Number(id2) });
}
$event.stopPropagation();
$event.preventDefault();
};
if (getMapInfo().type === MapType.GOOGLE) {
callout.div.ontouchstart = function($event) {
$event.stopPropagation();
};
callout.div.onpointerdown = function($event) {
$event.stopPropagation();
};
}
}
}
} else {
if (callout) {
removeMarkerCallout(callout);
delete marker.callout;
}
}
};
if (option.iconPath) {
img.src = getRealPath(option.iconPath);
} else {
console.error("Marker.iconPath is required.");
}
}
function addMarker(props3) {
if (!getIsBMap()) {
marker = new maps.Marker({
map,
flat: true,
autoRotation: false
});
}
updateMarker(props3);
const MapsEvent = maps.event || maps.Event;
if (getIsBMap())
;
else {
MapsEvent.addListener(marker, "click", () => {
const callout = marker.callout;
if (callout && !callout.alwaysVisible) {
if (getIsAMap()) {
callout.visible = !callout.visible;
if (callout.visible) {
marker.callout.createAMapText();
} else {
marker.callout.removeAMapText();
}
} else {
callout.set("visible", !callout.visible);
if (callout.visible) {
const div = callout.div;
const parent = div.parentNode;
parent.removeChild(div);
parent.appendChild(div);
}
}
}
if (id2) {
trigger("markertap", {}, {
markerId: Number(id2),
latitude: props3.latitude,
longitude: props3.longitude
});
}
});
}
}
addMarker(props2);
Vue.watch(props2, updateMarker);
});
if (id2) {
const addMapChidlContext = Vue.inject("addMapChidlContext");
Vue.inject("removeMapChidlContext");
const context = {
id: id2,
translate(data) {
onMapReady((map, maps, trigger) => {
const destination = data.destination;
const duration = data.duration;
const autoRotate = !!data.autoRotate;
let rotate = Number(data.rotate) || 0;
let rotation = 0;
if ("getRotation" in marker) {
rotation = marker.getRotation();
}
const a = marker.getPosition();
const b = new maps.LatLng(destination.latitude, destination.longitude);
const distance = maps.geometry.spherical.computeDistanceBetween(a, b) / 1e3;
const time = (typeof duration === "number" ? duration : 1e3) / (1e3 * 60 * 60);
const speed = distance / time;
const MapsEvent = maps.event || maps.Event;
const movingEvent = MapsEvent.addListener(marker, "moving", (e2) => {
const latLng = e2.latLng;
const label = marker.label;
if (label) {
label.setPosition(latLng);
}
const callout = marker.callout;
if (callout) {
callout.setPosition(latLng);
}
});
const event = MapsEvent.addListener(marker, "moveend", () => {
event.remove();
movingEvent.remove();
marker.lastPosition = a;
marker.setPosition(b);
const label = marker.label;
if (label) {
label.setPosition(b);
}
const callout = marker.callout;
if (callout) {
callout.setPosition(b);
}
const cb = data.animationEnd;
if (shared.isFunction(cb)) {
cb();
}
});
let lastRtate = 0;
if (autoRotate) {
if (marker.lastPosition) {
lastRtate = maps.geometry.spherical.computeHeading(marker.lastPosition, a);
}
rotate = maps.geometry.spherical.computeHeading(a, b) - lastRtate;
}
if ("setRotation" in marker) {
marker.setRotation(rotation + rotate);
}
if ("moveTo" in marker) {
marker.moveTo(b, speed);
} else {
marker.setPosition(b);
MapsEvent.trigger(marker, "moveend", {});
}
});
}
};
addMapChidlContext(context);
}
return [];
}
});
const props$3 = {
points: {
type: Array,
require: true
},
color: {
type: String,
default: "#000000"
},
width: {
type: [Number, String],
default: ""
},
dottedLine: {
type: [Boolean, String],
default: false
},
arrowLine: {
type: [Boolean, String],
default: false
},
arrowIconPath: {
type: String,
default: ""
},
borderColor: {
type: String,
default: "#000000"
},
borderWidth: {
type: [Number, String],
default: ""
},
colorList: {
type: Array,
default() {
return [];
}
},
level: {
type: String,
default: ""
}
};
const MapPolyline = /* @__PURE__ */ defineSystemComponent({
name: "MapPolyline",
props: props$3,
setup(props2) {
const onMapReady = Vue.inject("onMapReady");
let polyline;
let polylineBorder;
function removePolyline() {
if (polyline) {
polyline.setMap(null);
}
if (polylineBorder) {
polylineBorder.setMap(null);
}
}
onMapReady((map, maps) => {
function updatePolyline(option) {
removePolyline();
addPolyline(option);
}
function addPolyline(option) {
const path = [];
option.points.forEach((point) => {
let pointPosition;
if (getIsAMap()) {
pointPosition = [point.longitude, point.latitude];
} else if (getIsBMap()) {
pointPosition = new maps.Point(point.longitude, point.latitude);
} else {
pointPosition = new maps.LatLng(point.latitude, point.longitude);
}
path.push(pointPosition);
});
const strokeWeight = Number(option.width) || 1;
const { r: sr, g: sg, b: sb, a: sa } = hexToRgba(option.color);
const { r: br, g: bg, b: bb, a: ba } = hexToRgba(option.borderColor);
const polylineOptions = {
map,
clickable: false,
path,
strokeWeight,
strokeColor: option.color || void 0,
strokeDashStyle: option.dottedLine ? "dash" : "solid"
};
const borderWidth = Number(option.borderWidth) || 0;
const polylineBorderOptions = {
map,
clickable: false,
path,
strokeWeight: strokeWeight + borderWidth * 2,
strokeColor: option.borderColor || void 0,
strokeDashStyle: option.dottedLine ? "dash" : "solid"
};
if ("Color" in maps) {
polylineOptions.strokeColor = new maps.Color(sr, sg, sb, sa);
polylineBorderOptions.strokeColor = new maps.Color(br, bg, bb, ba);
} else {
polylineOptions.strokeColor = `rgb(${sr}, ${sg}, ${sb})`;
polylineOptions.strokeOpacity = sa;
polylineBorderOptions.strokeColor = `rgb(${br}, ${bg}, ${bb})`;
polylineBorderOptions.strokeOpacity = ba;
}
if (borderWidth) {
polylineBorder = new maps.Polyline(polylineBorderOptions);
}
if (getIsBMap()) {
polyline = new maps.Polyline(polylineOptions.path, polylineOptions);
map.addOverlay(polyline);
} else {
polyline = new maps.Polyline(polylineOptions);
}
}
addPolyline(props2);
Vue.watch(props2, updatePolyline);
});
return [];
}
});
const props$2 = {
latitude: {
type: [Number, String],
require: true
},
longitude: {
type: [Number, String],
require: true
},
color: {
type: String,
default: "#000000"
},
fillColor: {
type: String,
default: "#00000000"
},
radius: {
type: [Number, String],
require: true
},
strokeWidth: {
type: [Number, String],
default: ""
},
level: {
type: String,
default: ""
}
};
const MapCircle = /* @__PURE__ */ defineSystemComponent({
name: "MapCircle",
props: props$2,
setup(props2) {
const onMapReady = Vue.inject("onMapReady");
let circle;
function removeCircle() {
if (circle) {
circle.setMap(null);
}
}
onMapReady((map, maps) => {
function updateCircle(option) {
removeCircle();
addCircle(option);
}
function addCircle(option) {
const center = getIsAMap() || getIsBMap() ? [option.longitude, option.latitude] : new maps.LatLng(option.latitude, option.longitude);
const circleOptions = {
map,
center,
clickable: false,
radius: option.radius,
strokeWeight: Number(option.strokeWidth) || 1,
strokeDashStyle: "solid"
};
if (getIsBMap()) {
circleOptions.strokeColor = option.color;
circleOptions.fillColor = option.fillColor || "#000";
circleOptions.fillOpacity = 1;
} else {
const { r: fr, g: fg, b: fb, a: fa } = hexToRgba(option.fillColor);
const { r: sr, g: sg, b: sb, a: sa } = hexToRgba(option.color);
if ("Color" in maps) {
circleOptions.fillColor = new maps.Color(fr, fg, fb, fa);
circleOptions.strokeColor = new maps.Color(sr, sg, sb, sa);
} else {
circleOptions.fillColor = `rgb(${fr}, ${fg}, ${fb})`;
circleOptions.fillOpacity = fa;
circleOptions.strokeColor = `rgb(${sr}, ${sg}, ${sb})`;
circleOptions.strokeOpacity = sa;
}
}
if (getIsBMap()) {
let pt = new maps.Point(
// @ts-expect-error
circleOptions.center[0],
// @ts-expect-error
circleOptions.center[1]
);
circle = new maps.Circle(pt, circleOptions.radius, circleOptions);
map.addOverlay(circle);
} else {
circle = new maps.Circle(circleOptions);
if (getIsAMap()) {
map.add(circle);
}
}
}
addCircle(props2);
Vue.watch(props2, updateCircle);
});
return [];
}
});
const _t0$2 = Vue.template("<div class=uni-map-control><img class=uni-map-control-icon>", 1);
const props$1 = {
id: {
type: [Number, String],
default: ""
},
position: {
type: Object,
required: true
},
iconPath: {
type: String,
required: true
},
clickable: {
type: [Boolean, String],
default: ""
},
trigger: {
type: Function,
required: true
}
};
const MapControl = /* @__PURE__ */ defineSystemComponent({
name: "MapControl",
props: props$1,
setup(props2) {
const imgPath = Vue.computed(() => getRealPath(props2.iconPath));
const positionStyle = Vue.computed(() => {
let positionStyle2 = `top:${props2.position.top || 0}px;left:${props2.position.left || 0}px;`;
if (props2.position.width) {
positionStyle2 += `width:${props2.position.width}px;`;
}
if (props2.position.height) {
positionStyle2 += `height:${props2.position.height}px;`;
}
return positionStyle2;
});
const handleClick = ($event) => {
if (props2.clickable) {
props2.trigger("controltap", $event, { controlId: props2.id });
}
};
return () => {
return (() => {
const _n1 = _t0$2();
const _n0 = Vue.child(_n1);
Vue.on(_n0, "click", handleClick);
Vue.renderEffect(() => {
Vue.setProp(_n0, "src", imgPath.value);
Vue.setStyle(_n0, positionStyle.value);
});
return _n1;
})();
};
}
});
const CONTEXT_ID = "MAP_LOCATION";
const MapLocation = /* @__PURE__ */ defineSystemComponent({
name: "MapLocation",
setup() {
const state = Vue.reactive({
latitude: 0,
longitude: 0,
rotate: 0
});
return () => {
return state.latitude ? (() => {
const _n0 = createComponent(MapMarker, {
anchor: {
x: 0.5,
y: 0.5
},
width: "44",
height: "44",
iconPath: () => ICON_PATH_ORIGIN,
$: [() => state]
}, null, true);
return _n0;
})() : null;
};
}
});
const props = {
// 边框虚线,腾讯地图支持,google 高德 地图不支持,默认值为[0, 0] 为实线,非 [0, 0] 为虚线,H5 端无法像微信小程序一样控制虚线的间隔像素大小
dashArray: {
type: Array,
default: () => [0, 0]
},
// 经纬度数组,[{latitude: 0, longitude: 0}]
points: {
type: Array,
required: true
},
// 描边的宽度
strokeWidth: {
type: Number,
default: 1
},
// 描边的颜色,十六进制
strokeColor: {
type: String,
default: "#000000"
},
// 填充颜色,十六进制
fillColor: {
type: String,
default: "#00000000"
},
// 设置多边形 Z 轴数值
zIndex: {
type: Number,
default: 0
}
};
const MapPolygon = /* @__PURE__ */ defineSystemComponent({
name: "MapPolygon",
props,
setup(props2) {
let polygonIns;
const onMapReady = Vue.inject("onMapReady");
onMapReady((map, maps, trigger) => {
function drawPolygon() {
const { points, strokeWidth, strokeColor, dashArray, fillColor, zIndex } = props2;
const path = points.map((item) => {
const { latitude, longitude } = item;
if (getIsAMap()) {
return [longitude, latitude];
} else if (getIsBMap()) {
return new maps.Point(longitude, latitude);
} else {
return new maps.LatLng(latitude, longitude);
}
});
const { r: fcR, g: fcG, b: fcB, a: fcA } = hexToRgba(fillColor);
const { r: scR, g: scG, b: scB, a: scA } = hexToRgba(strokeColor);
const polygonOptions = {
//多边形是否可点击。
clickable: true,
//鼠标在多边形内的光标样式。
cursor: "crosshair",
//多边形是否可编辑。
editable: false,
// 地图实例,即要显示多边形的地图
// @ts-expect-error
map,
// 区域填充色
fillColor: "",
//多边形的路径,以经纬度坐标数组构成。
path,
// 区域边框
strokeColor: "",
//多边形的边框样式。实线是solid,虚线是dash。
strokeDashStyle: dashArray.some((item) => item > 0) ? "dash" : "solid",
//多边形的边框线宽。
strokeWeight: strokeWidth,
//多边形是否可见。
visible: true,
//多边形的zIndex值。
zIndex
};
if (maps.Color) {
polygonOptions.fillColor = new maps.Color(fcR, fcG, fcB, fcA);
polygonOptions.strokeColor = new maps.Color(scR, scG, scB, scA);
} else {
polygonOptions.fillColor = `rgb(${fcR}, ${fcG}, ${fcB})`;
polygonOptions.fillOpacity = fcA;
polygonOptions.strokeColor = `rgb(${scR}, ${scG}, ${scB})`;
polygonOptions.strokeOpacity = scA;
}
if (polygonIns) {
polygonIns.setOptions(polygonOptions);
return;
}
if (getIsBMap()) {
polygonIns = new maps.Polygon(polygonOptions.path, polygonOptions);
map.addOverlay(polygonIns);
} else {
polygonIns = new maps.Polygon(polygonOptions);
}
}
drawPolygon();
Vue.watch(props2, drawPolygon);
});
return [];
}
});
const mapProps = {
id: {
type: String,
default: ""
},
latitude: {
type: [String, Number],
default: 0
},
longitude: {
type: [String, Number],
default: 0
},
scale: {
type: [String, Number],
default: 16
},
markers: {
type: Array,
default() {
return [];
}
},
includePoints: {
type: Array,
default() {
return [];
}
},
polyline: {
type: Array,
default() {
return [];
}
},
circles: {
type: Array,
default() {
return [];
}
},
controls: {
type: Array,
default() {
return [];
}
},
showLocation: {
type: [Boolean, String],
default: false
},
libraries: {
type: Array,
default() {
return [];
}
},
polygons: {
type: Array,
default: () => []
}
};
function getPoints(points) {
const newPoints = [];
if (shared.isArray(points)) {
points.forEach((point) => {
if (point && point.latitude && point.longitude) {
newPoints.push({
latitude: point.latitude,
longitude: point.longitude
});
}
});
}
return newPoints;
}
function getAMapPosition(maps, latitude, longitude) {
return new maps.LngLat(longitude, latitude);
}
function getBMapPosition(maps, latitude, longitude) {
return new maps.Point(longitude, latitude);
}
function getGoogleOrQQMapPosition(maps, latitude, longitude) {
return new maps.LatLng(latitude, longitude);
}
function getMapPosition(maps, latitude, longitude) {
if (getIsBMap()) {
return getBMapPosition(maps, latitude, longitude);
} else if (getIsAMap()) {
return getAMapPosition(maps, latitude, longitude);
} else {
return getGoogleOrQQMapPosition(
maps,
latitude,
longitude
);
}
}
function getLat(latLng) {
if ("getLat" in latLng) {
return latLng.getLat();
} else {
if (getIsBMap()) {
return latLng.lat;
}
return latLng.lat();
}
}
function getLng(latLng) {
if ("getLng" in latLng) {
return latLng.getLng();
} else {
if (getIsBMap()) {
return latLng.lng;
}
return latLng.lng();
}
}
function useMap(props2, rootRef, emit2) {
const trigger = useCustomEvent(rootRef, emit2);
const mapRef = Vue.ref(null);
let maps;
let map;
const state = Vue.reactive({
latitude: Number(props2.latitude),
longitude: Number(props2.longitude),
includePoints: getPoints(props2.includePoints)
});
function onMapReady(callback) {
}
let isBoundsReady;
function onBoundsReady(callback) {
}
const contexts = {};
function addMapChidlContext(context) {
contexts[context.id] = context;
}
function removeMapChidlContext(context) {
delete contexts[context.id];
}
Vue.watch(
[() => props2.latitude, () => props2.longitude],
([latitudeVlaue, longitudeVlaue]) => {
const latitude = Number(latitudeVlaue);
const longitude = Number(longitudeVlaue);
if (latitude !== state.latitude || longitude !== state.longitude) {
state.latitude = latitude;
state.longitude = longitude;
}
}
);
Vue.watch(
() => props2.includePoints,
(points) => {
state.includePoints = getPoints(points);
},
{
deep: true
}
);
function updateBounds() {
if (getIsAMap()) {
const points = [];
state.includePoints.forEach((point) => {
points.push([point.longitude, point.latitude]);
});
const bounds = new maps.Bounds(...points);
map.setBounds(bounds);
} else if (getIsBMap())
;
else {
const bounds = new maps.LatLngBounds();
state.includePoints.forEach(({ latitude, longitude }) => {
const latLng = new maps.LatLng(
latitude,
longitude
);
bounds.extend(latLng);
});
map.fitBounds(bounds);
}
}
try {
const id2 = useContextInfo();
useSubscribe(
(type, data = {}) => {
switch (type) {
case "getCenterLocation":
onMapReady(() => {
const center = map.getCenter();
uniShared.callOptions(data, {
latitude: getLat(center),
longitude: getLng(center),
errMsg: `${type}:ok`
});
});
break;
case "moveToLocation":
{
let latitude = Number(data.latitude);
let longitude = Number(data.longitude);
if (!latitude || !longitude) {
const context = contexts[CONTEXT_ID];
if (context) {
latitude = context.state.latitude;
longitude = context.state.longitude;
}
}
if (latitude && longitude) {
state.latitude = latitude;
state.longitude = longitude;
if (map)
;
onMapReady(() => {
uniShared.callOptions(data, `${type}:ok`);
});
} else {
uniShared.callOptions(data, `${type}:fail`);
}
}
break;
case "translateMarker":
onMapReady(() => {
const context = contexts[data.markerId];
if (context) {
try {
context.translate(data);
} catch (error) {
uniShared.callOptions(data, `${type}:fail ${error.message}`);
}
uniShared.callOptions(data, `${type}:ok`);
} else {
uniShared.callOptions(data, `${type}:fail not found`);
}
});
break;
case "includePoints":
state.includePoints = getPoints(data.includePoints);
if (isBoundsReady || getIsAMap()) {
updateBounds();
}
onBoundsReady(() => {
uniShared.callOptions(data, `${type}:ok`);
});
break;
case "getRegion":
onBoundsReady(() => {
const latLngBounds = map.getBounds();
const southwest = latLngBounds.getSouthWest();
const northeast = latLngBounds.getNorthEast();
uniShared.callOptions(data, {
southwest: {
latitude: getLat(southwest),
longitude: getLng(southwest)
},
northeast: {
latitude: getLat(northeast),
longitude: getLng(northeast)
},
errMsg: `${type}:ok`
});
});
break;
case "getScale":
onMapReady(() => {
uniShared.callOptions(data, {
scale: map.getZoom(),
errMsg: `${type}:ok`
});
});
break;
}
},
id2,
true
);
} catch (error) {
}
Vue.provide("onMapReady", onMapReady);
Vue.provide("addMapChidlContext", addMapChidlContext);
Vue.provide("removeMapChidlContext", removeMapChidlContext);
return {
state,
mapRef,
trigger
};
}
const mapEmits = [
"markertap",
"labeltap",
"callouttap",
"controltap",
"regionchange",
"tap",
"click",
"updated",
"update:scale",
"update:latitude",
"update:longitude"
];
const _t0$1 = Vue.template('<div uni-map uni-view><div style="width: 100%; height: 100%; position: relative; overflow: hidden"></div> <div style="position: absolute;top: 0;width: 100%;height: 100%;overflow: hidden;pointer-events: none;"> ', 1);
class UniMapElement extends UniViewElement {
static [Symbol.hasInstance](value) {
return this === UniMapElement && value instanceof UniViewElement && value.hasAttribute("uni-map") || Function.prototype[Symbol.hasInstance].call(this, value);
}
}
const uniTagName$1 = { value: "MAP" };
const indexVapor$1 = /* @__PURE__ */ defineBuiltInComponent({
name: "Map",
props: mapProps,
emits: mapEmits,
rootElement: {
name: "uni-map",
class: UniMapElement
},
setup(props2, { emit: emit2, slots }) {
const rootRef = Vue.ref(null);
const { mapRef, trigger } = useMap(props2, rootRef, emit2);
const root = (() => {
const _setTemplateRef = Vue.createTemplateRefSetter();
const _n3 = _t0$1();
const _n0 = Vue.child(_n3);
const _n1 = Vue.next(_n0, true);
const _n2 = Vue.next(_n1);
setNodes(_n1, () => props2.markers.map((item) => (() => {
const _n02 = Vue.createKeyedFragment(() => item.id, () => {
const _n22 = createComponent(MapMarker, { $: [() => item] }, null, true);
return _n22;
});
return _n02;
})()), () => props2.polyline.map((item) => (() => {
const _n02 = createComponent(MapPolyline, { $: [() => item] }, null, true);
return _n02;
})()), () => props2.circles.map((item) => (() => {
const _n02 = createComponent(MapCircle, { $: [() => item] }, null, true);
return _n02;
})()), () => props2.controls.map((item) => (() => {
const _n02 = createComponent(MapControl, { $: [() => item, { trigger: () => trigger }] }, null, true);
return _n02;
})()), () => props2.showLocation && (() => {
const _n02 = createComponent(MapLocation, null, null, true);
return _n02;
})(), () => props2.polygons.map((item) => (() => {
const _n02 = createComponent(MapPolygon, { $: [() => item] }, null, true);
return _n02;
})()));
const _x2 = Vue.txt(_n2);
setNodes(_x2, () => slots.default && slots.default());
Vue.renderEffect(() => {
Vue.setProp(_n3, "id", props2.id);
_setTemplateRef(_n0, mapRef);
_setTemplateRef(_n3, rootRef);
});
return _n3;
})();
Object.defineProperty(root, "uniTagName", uniTagName$1);
return root;
}
});
const _AdConfig = class _AdConfig {
constructor() {
this._adConfig = null;
this._isLoading = false;
this._callbacks = [];
this._configLast = 0;
}
static get instance() {
if (!_AdConfig._instance) {
_AdConfig._instance = new _AdConfig();
_AdConfig._instance._init();
}
return _AdConfig._instance;
}
get adConfig() {
return this._adConfig;
}
get isExpired() {
if (this._adConfig == null) {
return true;
}
if (!this._configLast) {
return true;
}
return Math.abs(Date.now() - this._configLast) > _AdConfig.CACHE_TIME;
}
_init() {
var config = this._getConfig();
if (config === null || !config.last) {
return;
}
if (Math.abs(Date.now() - config.last) <= _AdConfig.CACHE_TIME) {
this._adConfig = config.data;
this._configLast = config.last;
}
}
get(adpid, success, fail) {
_AdConfig.IC++;
if (this._adConfig != null) {
this._doCallback(adpid, success, fail);
if (this.isExpired) {
this._loadAdConfig(adpid);
}
return;
}
this._callbacks.push({
adpid,
success,
fail
});
this._loadAdConfig(adpid);
}
_doCallback(adpid, success, fail) {
_AdConfig.IS++;
var { a, b } = this._adConfig;
const adData = a[adpid];
if (adData) {
success(b, Array.isArray(adData) ? adData : [adData]);
} else {
fail(_AdConfig.ERROR_INVALID_ADPID);
}
}
_loadAdConfig(adpid) {
if (this._isLoading === true) {
return;
}
this._isLoading = true;
const appid = typeof __uniConfig !== "undefined" ? __uniConfig.appId ?? "" : "";
uni.request({
url: _AdConfig.URL,
method: "GET",
timeout: 8e3,
data: {
d: location.hostname,
a: adpid,
appid
},
dataType: "json",
success: (res) => {
const rd = res.data;
if (rd.ret === 0) {
const data = rd.data;
this._adConfig = data;
this._configLast = Date.now();
this._setConfig(data);
this._callbacks.forEach(({ adpid: adpid2, success, fail }) => {
this._doCallback(adpid2, success, fail);
});
} else {
this._callbacks.forEach((i) => {
i.fail({ errCode: rd.ret, errMsg: rd.msg });
});
}
this._callbacks = [];
},
fail: (err) => {
this._callbacks.forEach((i) => {
i.fail(err);
});
this._callbacks = [];
},
complete: (c) => {
this._isLoading = false;
}
});
}
_getConfig() {
if (!navigator.cookieEnabled || !window.localStorage) {
return null;
}
var data = localStorage.getItem(_AdConfig.KEY);
return data ? JSON.parse(data) : null;
}
_setConfig(data) {
if (!navigator.cookieEnabled || !window.localStorage) {
return null;
}
localStorage.setItem(
_AdConfig.KEY,
JSON.stringify({
last: Date.now(),
data
})
);
}
};
_AdConfig.IC = 0;
_AdConfig.IS = 0;
_AdConfig.URL = "https://hac1.dcloud.net.cn/ah5v2";
_AdConfig.KEY = "uni_app_ad_config";
_AdConfig.CACHE_TIME = 1e3 * 60 * 10;
_AdConfig.ERROR_INVALID_ADPID = {
"-5002": "invalid adpid"
};
let AdConfig = _AdConfig;
const _AdReport = class _AdReport {
static get instance() {
if (!_AdReport._instance) {
_AdReport._instance = new _AdReport();
}
return _AdReport._instance;
}
constructor() {
var config = this._getConfig();
if (config && config.guid) {
this._guid = config.guid;
return;
}
this._guid = this._newGUID();
this._setConfig(this._guid);
}
get(data) {
this._process(
Object.assign(data, {
d: location.hostname,
i: this._guid
})
);
}
_process(data) {
uni.request({
url: _AdReport.URL,
method: "GET",
data,
dataType: "json",
success: () => {
}
});
}
_newGUID() {
let guid = "";
const format = "xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx";
for (let i = 0; i < format.length; i++) {
if (format[i] === "x") {
guid += (Math.random() * 16 | 0).toString(16);
} else {
guid += format[i];
}
}
return guid.toUpperCase();
}
_getConfig() {
if (!navigator.cookieEnabled || !window.localStorage) {
return null;
}
var data = localStorage.getItem(_AdReport.KEY);
return data ? JSON.parse(data) : null;
}
_setConfig(guid) {
if (!navigator.cookieEnabled || !window.localStorage) {
return null;
}
localStorage.setItem(
_AdReport.KEY,
JSON.stringify({
last: Date.now(),
guid
})
);
}
};
_AdReport.URL = "https://has1.dcloud.net.cn/ahl";
_AdReport.KEY = "uni_app_ad_guid";
let AdReport = _AdReport;
class AdScript {
static get instance() {
if (!AdScript._instance) {
AdScript._instance = new AdScript();
}
return AdScript._instance;
}
constructor() {
this._callback = {};
this._cache = {};
}
load(data, success, fail) {
const provider = data.provider;
if (this._cache[provider] === void 0) {
this.loadScript(data);
}
if (this._cache[provider] === 1) {
success();
} else {
if (!this._callback[provider]) {
this._callback[provider] = [];
}
this._callback[provider].push({
success,
fail
});
}
}
loadScript(data) {
const provider = data.provider;
this._cache[provider] = 0;
const domid = "uniad_provider" + provider;
const adScriptDom = document.getElementById(domid);
const src = adScriptDom && adScriptDom.getAttribute("src");
if (src) {
this._cache[provider] = 1;
return;
}
var ads = document.createElement("script");
ads.setAttribute("id", domid);
const script = data.script;
for (const var1 in script) {
ads.setAttribute(var1, script[var1]);
}
ads.onload = () => {
this._cache[provider] = 1;
this._callback[provider].forEach(({ success }) => {
success();
});
this._callback[provider].length = 0;
};
ads.onerror = (err) => {
this._cache[provider] = void 0;
this._callback[provider].forEach(({ fail }) => {
fail(err);
});
this._callback[provider].length = 0;
};
document.body.append(ads);
}
}
const CHECK_RENDER_DELAY = 1e3;
const CHECK_RENDER_RETRY = 5;
const AD_PROVIDER = {
GDT: "2",
TUIA: "10035"
};
class AdRender {
constructor(props2, trigger, rootRef, options) {
this._pi = 0;
this._pl = [];
this._b = {};
this._checkTimerCount = 0;
this._currentChannel = null;
this._tuiaData = null;
this._checkTimer = null;
this._adpid = props2.adpid;
this._adpidWidescreen = props2.adpidWidescreen;
this._widescreenWidth = props2.widescreenWidth;
this._trigger = trigger;
this._rootRef = rootRef;
this._currentAdpid = this._adpid;
this._hasCustomTuiaMaterial = options.hasCustomTuiaMaterial;
this._setCustomTuiaVisible = options.setCustomTuiaVisible;
}
renderTuiaFromCustomMaterial() {
if (!this._tuiaData) {
return;
}
this._renderTuia(this._tuiaData);
}
get isWidescreen() {
return this._rootRef.value && this._rootRef.value.clientWidth > this._widescreenWidth;
}
load(adpid) {
this._currentAdpid = adpid || (this.isWidescreen ? this._adpidWidescreen : this._adpid);
this._reset();
AdConfig.instance.get(
this._currentAdpid,
(b, a) => {
this._b = b;
this._pl = a;
this._renderAd();
},
(err) => {
this._trigger("error", {}, err);
}
);
}
dispose() {
this._clearCheckTimer();
if (this._rootRef.value) {
this._rootRef.value.innerHTML = "";
}
}
_renderAd() {
if (this._pi > this._pl.length - 1) {
return;
}
const data = this._pl[this._pi];
if (!data) {
this._renderNext();
return;
}
const providerId = String(data.a1);
const providerConfig = this._b[providerId];
if (!providerConfig) {
this._renderNext();
return;
}
const script = providerConfig.script || providerConfig.s;
this._currentChannel = providerId;
const id2 = this._randomId();
this._createView(id2);
if (providerId === AD_PROVIDER.GDT) {
window.TencentGDT = window.TencentGDT || [];
AdScript.instance.load(
{ provider: providerId, script },
() => {
this._renderGdt(id2, data);
},
(err) => {
this._trigger("error", {}, err);
this._renderNext();
}
);
return;
}
if (providerId === AD_PROVIDER.TUIA) {
AdScript.instance.load(
{ provider: providerId, script },
() => {
this._renderTuiaMaterial(id2, data);
},
(err) => {
this._trigger("error", {}, err);
this._renderNext();
}
);
return;
}
this._renderNext();
}
_createView(id2) {
if (!this._rootRef.value) {
return null;
}
var adView = document.createElement("div");
adView.setAttribute("id", id2);
adView.setAttribute("class", id2);
this._rootRef.value.innerHTML = "";
this._rootRef.value.append(adView);
return adView;
}
_renderGdt(id2, data) {
window.TencentGDT.push({
placement_id: data.a3,
app_id: data.a2,
type: "native",
count: 1,
onComplete: (res) => {
if (res && res.constructor === Array && res.length > 0) {
window.TencentGDT.NATIVE.renderAd(res[0], id2);
this._trigger("load", {}, {});
} else {
this._trigger(
"error",
{},
res || { errMsg: "No advertisement" }
);
this._renderNext();
}
}
});
this._startCheckTimer();
}
_renderTuiaMaterial(id2, data) {
const adView = document.getElementById(id2);
if (!adView) {
this._trigger("error", {}, { errMsg: "Invalid ad container" });
this._renderNext();
return;
}
this._tuiaData = data;
if (this._hasCustomTuiaMaterial()) {
adView.innerHTML = "";
let resolved = false;
this._setCustomTuiaVisible(true, (hasContent2) => {
if (resolved)
return;
resolved = true;
if (hasContent2) {
this.report(40, this._currentChannel || void 0);
this._trigger("load", {}, {});
} else {
this._renderTuiaDefaultMaterial(adView, data);
}
});
return;
}
this._renderTuiaDefaultMaterial(adView, data);
}
_renderTuiaDefaultMaterial(adView, data) {
this._setCustomTuiaVisible(false);
const materialSrc = this._getRandomTuiaMaterial(data == null ? void 0 : data.imgs, data == null ? void 0 : data.img);
if (!materialSrc) {
this._trigger("error", {}, {
errMsg: "Invalid tuia material imgs/img"
});
this._renderNext();
return;
}
const img = document.createElement("img");
img.src = materialSrc;
img.onerror = () => {
this._trigger("error", {}, { errMsg: "Tuia material load fail" });
this._renderNext();
};
img.alt = "ad";
img.setAttribute("draggable", "false");
img.style.width = "100%";
img.style.height = "auto";
img.style.display = "block";
img.style.cursor = "pointer";
img.onclick = () => {
this._renderTuia(data);
};
adView.innerHTML = "";
adView.append(img);
this.report(40, this._currentChannel || void 0);
this._trigger("load", {}, {});
}
_getRandomTuiaMaterial(imgs, img) {
if (Array.isArray(imgs)) {
const list = imgs.filter((item) => typeof item === "string" && item);
if (list.length) {
const index2 = Math.floor(Math.random() * list.length);
return list[index2];
}
}
if (typeof img === "string") {
return img;
}
return "";
}
_renderTuia(data) {
this._setCustomTuiaVisible(false);
const tuia = window.TuiaSDKLite;
if (!tuia || typeof tuia.execute !== "function") {
this._trigger("error", {}, { errMsg: "Invalid TuiaSDKLite" });
this._renderNext();
return;
}
tuia.execute({
data: {
pid: data.a3,
fail_message: "ad load fail",
product_name: document.title || location.hostname
},
success: (res) => {
this._trigger("load", {}, res || {});
},
fail: (err) => {
this._trigger(
"error",
{},
err || { errMsg: "TuiaSDKLite execute fail" }
);
this._renderNext();
}
});
}
_renderAdView(provider, data) {
var randomId = this._randomId();
var adView = document.createElement("div");
adView.setAttribute("class", randomId);
this._rootRef.value.innerHTML = "";
this._rootRef.value.append(adView);
const scriptPath = provider.s || provider.script;
if (!scriptPath || typeof scriptPath !== "string") {
this._trigger("error", {}, { errMsg: "Invalid provider script" });
this._renderNext();
return;
}
try {
let bindThis = window;
const fn = scriptPath.split(".").reduce((total, currentValue) => {
bindThis = total;
return total[currentValue];
}, window);
fn.bind(bindThis)(data.a2, randomId, 2);
} catch (err) {
this._trigger("error", {}, err);
this._renderNext();
return;
}
this._startCheckTimer();
}
_renderNext() {
if (this._pi >= this._pl.length - 1) {
return;
}
this._pi++;
this._renderAd();
}
_checkRender() {
if (!this._rootRef.value) {
return false;
}
var hasContent2 = this._rootRef.value.children.length > 0 && this._rootRef.value.clientHeight > 40;
if (hasContent2) {
this.report(40, this._currentChannel || void 0);
}
return hasContent2;
}
_startCheckTimer() {
this._clearCheckTimer();
this._checkTimer = setInterval(() => {
this._checkTimerCount++;
if (this._checkTimerCount >= CHECK_RENDER_RETRY) {
this._clearCheckTimer();
this._renderNext();
return;
}
if (this._checkRender()) {
this._clearCheckTimer();
}
}, CHECK_RENDER_DELAY);
}
_clearCheckTimer() {
this._checkTimerCount = 0;
if (this._checkTimer != null) {
window.clearInterval(this._checkTimer);
this._checkTimer = null;
}
}
report(type, currentChannel) {
const compilerVersion = typeof __uniConfig !== "undefined" ? __uniConfig.compilerVersion ?? "" : "";
const reportData = {
h: compilerVersion,
a: this._currentAdpid,
at: type
};
if (currentChannel) {
reportData.t = currentChannel;
}
AdReport.instance.get(reportData);
}
_randomId() {
var result = "";
for (let i = 0; i < 4; i++) {
result += (65536 * (1 + Math.random()) | 0).toString(16).substring(1);
}
return "_u" + result;
}
_reset() {
this._b = {};
this._pl = [];
this._pi = 0;
this._tuiaData = null;
this._setCustomTuiaVisible(false);
this._clearCheckTimer();
if (this._rootRef.value) {
this._rootRef.value.innerHTML = "";
}
}
}
const DEFAULT_WIDESCREEN_WIDTH = 750;
const adProps = {
adpid: {
type: String,
default: ""
},
adpidWidescreen: {
type: String,
default: ""
},
widescreenWidth: {
type: Number,
default: DEFAULT_WIDESCREEN_WIDTH
}
};
function useAd(props2, emit2, hasCustomTuiaMaterial) {
const rootRef = Vue.ref(null);
const customTuiaVisible = Vue.ref(
false
);
const { $excludeAttrs, $listeners } = useAttrs({
excludeListeners: true
});
const trigger = useCustomEvent(rootRef, emit2);
const ad = new AdRender(props2, trigger, rootRef, {
hasCustomTuiaMaterial,
setCustomTuiaVisible: (visible, onRendered) => {
customTuiaVisible.value = visible ? onRendered : false;
}
});
Vue.watch(
() => props2.adpid,
(val) => {
ad.load(val);
}
);
Vue.watch(
() => props2.adpidWidescreen,
(val) => {
ad.load(val);
}
);
return { rootRef, customTuiaVisible, $excludeAttrs, $listeners, ad };
}
const _t0 = Vue.template("<div class=uni-ad-custom-material> ");
const _t1 = Vue.template("<div><div class=uni-ad-container></div>", 1);
const uniTagName = { value: "AD" };
const indexVapor = /* @__PURE__ */ defineBuiltInComponent({
inheritAttrs: false,
name: "Ad",
props: adProps,
setup(props2, { emit: emit2, slots }) {
const { rootRef, customTuiaVisible, $excludeAttrs, $listeners, ad } = useAd(
props2,
emit2,
// Vapor 插槽会直接创建节点,只判断是否声明,不为探测而提前执行插槽。
() => Boolean(slots.default)
);
let pendingMaterial;
const confirmMaterial = () => {
const pending = pendingMaterial;
pendingMaterial = void 0;
if (pending && rootRef.value && customTuiaVisible.value === pending.onRendered) {
pending.onRendered(pending.hasContent);
}
};
const renderCustomMaterial = () => {
var _a;
const onRendered = customTuiaVisible.value;
if (typeof onRendered !== "function")
return null;
const content = (_a = slots.default) == null ? void 0 : _a.call(slots);
pendingMaterial = {
onRendered,
hasContent: Boolean(content) && (!Array.isArray(content) || content.length > 0)
};
Vue.queuePostFlushCb(confirmMaterial);
return content;
};
const root = (() => {
const _setTemplateRef = Vue.createTemplateRefSetter();
const _n6 = _t1();
const _n0 = Vue.child(_n6);
Vue.on(_n0, "click", () => ad.report(41));
Vue.renderEffect(() => {
Vue.setDynamicProps(_n6, [
{
"uni-ad": "",
"uni-view": ""
},
$listeners.value,
$excludeAttrs.value,
{
adpid: props2.adpid,
adpidWidescreen: props2.adpidWidescreen,
widescreenWidth: props2.widescreenWidth
}
]);
_setTemplateRef(_n0, rootRef);
});
Vue.setInsertionState(_n6, 1);
Vue.createIf(() => customTuiaVisible.value, () => {
const _n3 = _t0();
Vue.on(_n3, "click", () => ad.renderTuiaFromCustomMaterial());
const _x3 = Vue.txt(_n3);
setNodes(_x3, () => renderCustomMaterial());
return _n3;
}, () => {
const _n5 = createNodes(null);
return _n5;
}, 265);
return _n6;
})();
Object.defineProperty(root, "uniTagName", uniTagName);
return root;
}
});
const index$5 = /* @__PURE__ */ defineUnsupportedComponent("ad-content-page");
const index$4 = /* @__PURE__ */ defineUnsupportedComponent("ad-draw");
const index$3 = /* @__PURE__ */ defineUnsupportedComponent("camera");
const index$2 = /* @__PURE__ */ defineUnsupportedComponent("live-player");
const index$1 = /* @__PURE__ */ defineUnsupportedComponent("live-pusher");
function set(target, key, val) {
return target[key] = val;
}
function $callMethod(method, ...args) {
const fn = this[method];
if (fn) {
return fn(...args);
}
console.error(`method ${method} not found`);
return null;
}
function createErrorHandler(app) {
const userErrorHandler = app.config.errorHandler;
return function errorHandler(err, instance, info) {
if (userErrorHandler) {
userErrorHandler(err, instance, info);
}
const appInstance = app._instance;
if (!appInstance || !appInstance.proxy) {
throw err;
}
if (appInstance[uniShared.ON_ERROR]) {
{
invokeHook(appInstance.proxy, uniShared.ON_ERROR, err);
}
} else {
Vue.logError(err, info, instance == null ? void 0 : instance.$, false);
}
};
}
function mergeAsArray(to, from) {
return to ? [...new Set([].concat(to, from))] : from;
}
function initOptionMergeStrategies(optionMergeStrategies) {
uniShared.UniLifecycleHooks.forEach((name) => {
optionMergeStrategies[name] = mergeAsArray;
});
}
let realAtob;
const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
if (typeof atob !== "function") {
realAtob = function(str) {
str = String(str).replace(/[\t\n\f\r ]+/g, "");
if (!b64re.test(str)) {
throw new Error(
"Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded."
);
}
str += "==".slice(2 - (str.length & 3));
var bitmap;
var result = "";
var r1;
var r2;
var i = 0;
for (; i < str.length; ) {
bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : String.fromCharCode(
bitmap >> 16 & 255,
bitmap >> 8 & 255,
bitmap & 255
);
}
return result;
};
} else {
realAtob = atob;
}
function b64DecodeUnicode(str) {
return decodeURIComponent(
realAtob(str).split("").map(function(c) {
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
}).join("")
);
}
function getCurrentUserInfo() {
const token = uni.getStorageSync("uni_id_token") || "";
const tokenArr = token.split(".");
if (!token || tokenArr.length !== 3) {
return {
uid: null,
role: [],
permission: [],
tokenExpired: 0
};
}
let userInfo;
try {
userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
} catch (error) {
throw new Error("获取当前用户信息出错,详细错误信息为:" + error.message);
}
userInfo.tokenExpired = userInfo.exp * 1e3;
delete userInfo.exp;
delete userInfo.iat;
return userInfo;
}
function uniIdMixin(globalProperties) {
globalProperties.uniIDHasRole = function(roleId) {
const { role } = getCurrentUserInfo();
return role.indexOf(roleId) > -1;
};
globalProperties.uniIDHasPermission = function(permissionId) {
const { permission } = getCurrentUserInfo();
return this.uniIDHasRole("admin") || permission.indexOf(permissionId) > -1;
};
globalProperties.uniIDTokenValid = function() {
const { tokenExpired } = getCurrentUserInfo();
return tokenExpired > Date.now();
};
}
function initApp(app) {
const appConfig = app.config;
appConfig.errorHandler = uniShared.invokeCreateErrorHandler(app, createErrorHandler);
initOptionMergeStrategies(appConfig.optionMergeStrategies);
const globalProperties = appConfig.globalProperties;
{
if (__UNI_FEATURE_UNI_CLOUD__) {
uniIdMixin(globalProperties);
}
}
{
globalProperties.$set = set;
globalProperties.$callMethod = $callMethod;
}
{
uniShared.invokeCreateVueAppHook(app);
}
}
function initRouter(app) {
const router2 = vueRouter.createRouter(createRouterOptions());
setRouterInstance(router2);
router2.beforeEach((to, from) => {
if (to && from && to.meta.isTabBar && from.meta.isTabBar) {
saveTabBarScrollPosition(from.meta.tabBarIndex);
}
});
app.router = router2;
app.use(router2);
}
let positionStore = /* @__PURE__ */ Object.create(null);
function getTabBarScrollPosition(id2) {
return positionStore[id2];
}
function saveTabBarScrollPosition(id2) {
if (typeof window !== "undefined") {
positionStore[id2] = {
left: window.pageXOffset,
top: window.pageYOffset
};
}
}
const scrollBehavior = (to, from, savedPosition) => {
if (savedPosition) {
return savedPosition;
} else {
if (to && from && to.meta.isTabBar && from.meta.isTabBar) {
const position = getTabBarScrollPosition(to.meta.tabBarIndex);
if (position) {
return position;
}
}
return {
left: 0,
top: 0
};
}
};
function createRouterOptions() {
return {
history: initHistory(),
strict: !!__uniConfig.router.strict,
routes: __uniRoutes,
scrollBehavior
};
}
function initHistory() {
let { routerBase } = __uniConfig.router;
if (routerBase === "/") {
routerBase = "";
}
{
return vueRouter.createMemoryHistory(routerBase);
}
}
const index = {
install(app) {
initApp(app);
if (!app.config.warnHandler) {
app.config.warnHandler = warnHandler;
}
if (__UNI_FEATURE_PAGES__) {
initRouter(app);
}
}
};
function warnHandler(msg, instance, trace) {
if (instance) {
const internalInstance = "$" in instance ? instance.$ : instance;
const name = internalInstance.type.name;
if ("PageMetaHead" === name) {
return;
}
const parent = internalInstance.parent;
if (parent && parent.type.name === "PageMeta") {
return;
}
}
const warnArgs = [`[Vue warn]: ${msg}`];
if (trace.length) {
warnArgs.push(`
`, trace);
}
console.warn(...warnArgs);
}
const UniViewJSBridge$1 = /* @__PURE__ */ shared.extend(ViewJSBridge, {
publishHandler(event, args, pageId) {
UniServiceJSBridge.subscribeHandler(event, args, pageId);
}
});
const request = /* @__PURE__ */ defineTaskApi(
API_REQUEST,
({
url,
data,
header = {},
method,
dataType: dataType2,
responseType,
enableChunked,
withCredentials,
timeout = __uniConfig.networkTimeout.request,
// @ts-expect-error 内部isUTS参数
isUTS
}, { resolve, reject }) => {
{
timeout = timeout == null ? __uniConfig.networkTimeout.request : timeout;
}
let body = null;
const contentType = normalizeContentType(header);
if (method !== "GET") {
if (shared.isString(data) || data instanceof ArrayBuffer) {
body = data;
} else {
if (contentType === "json") {
try {
body = JSON.stringify(data);
} catch (error) {
body = data.toString();
}
} else if (contentType === "urlencoded") {
const bodyArray = [];
for (const key in data) {
if (shared.hasOwn(data, key)) {
bodyArray.push(
encodeURIComponent(key) + "=" + encodeURIComponent(data[key])
);
}
}
body = bodyArray.join("&");
} else {
body = data.toString();
}
}
}
let requestTask;
if (!enableChunked) {
const xhr = new XMLHttpRequest();
requestTask = new RequestTask(xhr);
xhr.open(method, url);
for (const key in header) {
if (shared.hasOwn(header, key)) {
xhr.setRequestHeader(key, header[key]);
}
}
const timer = setTimeout(function() {
xhr.onload = xhr.onabort = xhr.onerror = null;
requestTask.abort();
reject("timeout", { errCode: 5 });
}, timeout);
xhr.responseType = responseType;
xhr.onload = function() {
clearTimeout(timer);
const statusCode = xhr.status;
let res = responseType === "text" ? xhr.responseText : xhr.response;
if (responseType === "text") {
res = parseResponseText(res, responseType, dataType2, isUTS);
}
resolve({
data: res,
statusCode,
header: parseHeaders(xhr.getAllResponseHeaders()),
cookies: []
});
};
xhr.onabort = function() {
clearTimeout(timer);
reject("abort", { errCode: 600003 });
};
xhr.onerror = function() {
clearTimeout(timer);
reject(void 0, { errCode: 5 });
};
xhr.withCredentials = withCredentials;
xhr.send(body);
} else {
if (typeof window.fetch === void 0 || typeof window.AbortController === void 0) {
throw new Error(
"fetch or AbortController is not supported in this environment"
);
}
const controller = new AbortController();
const signal = controller.signal;
requestTask = new RequestTask(controller);
const fetchOptions = {
method,
headers: header,
body,
signal,
credentials: withCredentials ? "include" : "same-origin"
};
const timer = setTimeout(function() {
requestTask.abort();
reject("timeout", { errCode: 5 });
}, timeout);
fetchOptions.signal.addEventListener("abort", function() {
clearTimeout(timer);
reject("abort", { errCode: 600003 });
});
window.fetch(url, fetchOptions).then(
(response) => {
const statusCode = response.status;
const header2 = response.headers;
const body2 = response.body;
const headerObj = {};
header2.forEach((value, key) => {
headerObj[key] = value;
});
const cookies = cookiesParse(headerObj);
requestTask._emitter.emit("headersReceived", {
header: headerObj,
statusCode,
cookies
});
if (!body2) {
resolve({
data: "",
statusCode,
header: headerObj,
cookies
});
return;
}
const reader = body2.getReader();
const bodyBuffers = [];
const streamReaderRead = () => {
reader.read().then(({ done, value }) => {
if (done) {
const result = concatArrayBuffers(bodyBuffers);
let res = responseType === "text" ? new TextDecoder().decode(result) : result;
if (responseType === "text") {
res = parseResponseText(res, responseType, dataType2, isUTS);
}
resolve({
data: res,
statusCode,
header: headerObj,
cookies
});
return;
}
const chunk = value;
bodyBuffers.push(chunk);
requestTask._emitter.emit("chunkReceived", {
data: chunk
});
streamReaderRead();
});
};
streamReaderRead();
},
(error) => {
reject(error, { errCode: 5 });
}
);
}
return requestTask;
},
RequestProtocol,
RequestOptions
);
const cookiesParse = (header) => {
let cookiesStr = header["Set-Cookie"] || header["set-cookie"];
let cookiesArr = [];
if (!cookiesStr) {
return [];
}
if (cookiesStr[0] === "[" && cookiesStr[cookiesStr.length - 1] === "]") {
cookiesStr = cookiesStr.slice(1, -1);
}
const handleCookiesArr = cookiesStr.split(";");
for (let i = 0; i < handleCookiesArr.length; i++) {
if (handleCookiesArr[i].indexOf("Expires=") !== -1 || handleCookiesArr[i].indexOf("expires=") !== -1) {
cookiesArr.push(handleCookiesArr[i].replace(",", ""));
} else {
cookiesArr.push(handleCookiesArr[i]);
}
}
cookiesArr = cookiesArr.join(";").split(",");
return cookiesArr;
};
function concatArrayBuffers(buffers) {
const totalLength = buffers.reduce((acc, buf) => acc + buf.byteLength, 0);
const result = new Uint8Array(totalLength);
let offset = 0;
for (const buffer of buffers) {
result.set(new Uint8Array(buffer), offset);
offset += buffer.byteLength;
}
return result.buffer;
}
function normalizeContentType(header) {
const name = Object.keys(header).find(
(name2) => name2.toLowerCase() === "content-type"
);
if (!name) {
return;
}
const contentType = header[name];
if (name !== "Content-Type") {
header["Content-Type"] = header[name];
delete header[name];
}
if (!contentType) {
return "string";
}
if (contentType.indexOf("application/json") === 0) {
return "json";
} else if (contentType.indexOf("application/x-www-form-urlencoded") === 0) {
return "urlencoded";
}
return "string";
}
class RequestTask {
constructor(controller) {
this._requestOnChunkReceiveCallbackId = 0;
this._requestOnChunkReceiveCallbacks = /* @__PURE__ */ new Map();
this._requestOnHeadersReceiveCallbackId = 0;
this._requestOnHeadersReceiveCallbacks = /* @__PURE__ */ new Map();
this._emitter = new uniShared.Emitter();
this._controller = controller;
}
abort() {
if (this._controller) {
this._controller.abort();
delete this._controller;
}
}
onHeadersReceived(callback) {
this._emitter.on("headersReceived", callback);
this._requestOnHeadersReceiveCallbackId++;
this._requestOnHeadersReceiveCallbacks.set(
this._requestOnHeadersReceiveCallbackId,
callback
);
return this._requestOnHeadersReceiveCallbackId;
}
offHeadersReceived(callback) {
if (callback == null) {
this._emitter.off("headersReceived");
return;
}
if (typeof callback === "function") {
this._requestOnHeadersReceiveCallbacks.forEach((cb, id2) => {
if (cb === callback) {
this._requestOnHeadersReceiveCallbacks.delete(id2);
this._emitter.off("headersReceived", callback);
}
});
return;
}
const callbackFn = this._requestOnHeadersReceiveCallbacks.get(callback);
if (!callbackFn) {
return;
}
this._requestOnHeadersReceiveCallbacks.delete(callback);
this._emitter.off("headersReceived", callbackFn);
}
onChunkReceived(callback) {
this._emitter.on("chunkReceived", callback);
this._requestOnChunkReceiveCallbackId++;
this._requestOnChunkReceiveCallbacks.set(
this._requestOnChunkReceiveCallbackId,
callback
);
return this._requestOnChunkReceiveCallbackId;
}
offChunkReceived(callback) {
if (callback == null) {
this._emitter.off("chunkReceived");
return;
}
if (typeof callback === "function") {
this._requestOnChunkReceiveCallbacks.forEach((cb, id2) => {
if (cb === callback) {
this._requestOnChunkReceiveCallbacks.delete(id2);
this._emitter.off("chunkReceived", callback);
}
});
return;
}
const callbackFn = this._requestOnChunkReceiveCallbacks.get(callback);
if (!callbackFn) {
return;
}
this._requestOnChunkReceiveCallbacks.delete(callback);
this._emitter.off("chunkReceived", callbackFn);
}
}
function parseHeaders(headers) {
const headersObject = {};
headers.split(uniShared.LINEFEED).forEach((header) => {
const find = header.match(/(\S+\s*):\s*(.*)/);
if (!find || find.length !== 3) {
return;
}
headersObject[find[1]] = find[2];
});
return headersObject;
}
function parseResponseText(responseText, responseType, dataType2, isUTS) {
let res = responseText;
if (responseType === "text" && dataType2 === "json") {
try {
if (isUTS) {
res = UTS.JSON.parse(res) || res;
} else {
res = JSON.parse(res);
}
} catch (error) {
}
}
return res;
}
const STORAGE_KEYS = "uni-storage-keys";
function parseValue(value, isUTS) {
const types = ["object", "string", "number", "boolean", "undefined"];
try {
const object = shared.isString(value) ? JSON.parse(value) : value;
const type = object.type;
if (types.indexOf(type) >= 0) {
const keys = Object.keys(object);
if (keys.length === 2 && "data" in object) {
if (typeof object.data === type) {
if (type === "object" && isUTS) {
return UTS.JSON.parse(JSON.stringify(object.data));
}
return object.data;
}
if (type === "object" && /^\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}\.\d{3}Z$/.test(object.data)) {
return new Date(object.data);
}
} else if (keys.length === 1) {
return "";
}
}
} catch (error) {
}
}
const setStorageSync = /* @__PURE__ */ defineSyncApi(
API_SET_STORAGE_SYNC,
(key, data) => {
const type = typeof data;
const value = type === "string" ? data : JSON.stringify({
type,
data
});
localStorage.setItem(key, value);
},
SetStorageSyncProtocol
);
const setStorage = /* @__PURE__ */ defineAsyncApi(
API_SET_STORAGE,
({ key, data }, { resolve, reject }) => {
try {
setStorageSync(key, data);
resolve();
} catch (error) {
reject(error.message);
}
},
SetStorageProtocol
);
function getStorageOrigin(key, isUTS) {
const value = localStorage && localStorage.getItem(key);
if (!shared.isString(value)) {
throw new Error("data not found");
}
let data = value;
try {
const object = JSON.parse(value);
const result = parseValue(object, isUTS);
if (result !== void 0) {
data = result;
}
} catch (error) {
}
return data;
}
const getStorageSync = /* @__PURE__ */ defineSyncApi(
API_GET_STORAGE_SYNC,
// @ts-expect-error 内部isUTS参数
(key, isUTS) => {
try {
return getStorageOrigin(key, isUTS);
} catch (error) {
return "";
}
},
GetStorageSyncProtocol
);
const getStorage = /* @__PURE__ */ defineAsyncApi(
API_GET_STORAGE,
// @ts-expect-error 内部isUTS参数
({ key, isUTS }, { resolve, reject }) => {
try {
const data = getStorageOrigin(key, isUTS);
resolve({
data
});
} catch (error) {
reject(error.message);
}
},
GetStorageProtocol
);
const removeStorageSync = /* @__PURE__ */ defineSyncApi(
API_REMOVE_STORAGE,
(key) => {
if (localStorage) {
localStorage.removeItem(key);
}
},
RemoveStorageSyncProtocol
);
const removeStorage = /* @__PURE__ */ defineAsyncApi(
API_REMOVE_STORAGE,
({ key }, { resolve }) => {
removeStorageSync(key);
resolve();
},
RemoveStorageProtocol
);
const clearStorageSync = /* @__PURE__ */ defineSyncApi(
"clearStorageSync",
() => {
if (localStorage) {
localStorage.clear();
}
}
);
const clearStorage = /* @__PURE__ */ defineAsyncApi(
"clearStorage",
(_, { resolve }) => {
clearStorageSync();
resolve();
}
);
const getStorageInfoSync = /* @__PURE__ */ defineSyncApi(
"getStorageInfoSync",
() => {
const length = localStorage && localStorage.length || 0;
const keys = [];
let currentSize = 0;
for (let index2 = 0; index2 < length; index2++) {
const key = localStorage.key(index2);
const value = localStorage.getItem(key) || "";
currentSize += key.length + value.length;
if (key !== STORAGE_KEYS) {
keys.push(key);
}
}
return {
keys,
currentSize: Math.ceil(currentSize * 2 / 1024),
limitSize: Number.MAX_VALUE
};
}
);
const getStorageInfo = /* @__PURE__ */ defineAsyncApi(
"getStorageInfo",
(_, { resolve }) => {
resolve(getStorageInfoSync());
}
);
let browserInfo;
function initBrowserInfo() {
{
return browserInfo = {};
}
}
const getDeviceInfo = /* @__PURE__ */ defineSyncApi(
"getDeviceInfo",
() => {
initBrowserInfo();
const {
deviceBrand,
deviceModel,
brand,
model,
platform,
system,
deviceOrientation,
deviceType,
osname,
osversion
} = browserInfo;
return shared.extend({
brand,
deviceBrand,
deviceModel,
devicePixelRatio: 1,
deviceId: Date.now() + "" + Math.floor(Math.random() * 1e7),
deviceOrientation,
deviceType,
model,
osName: osname ? osname.toLowerCase() : void 0,
osVersion: osversion,
platform,
system
});
}
);
const getAppBaseInfo = /* @__PURE__ */ defineSyncApi(
"getAppBaseInfo",
() => {
initBrowserInfo();
const { theme, language, browserName, browserVersion } = browserInfo;
return shared.extend(
{
appId: __uniConfig.appId,
appName: __uniConfig.appName,
appVersion: __uniConfig.appVersion,
appVersionCode: __uniConfig.appVersionCode,
appLanguage: getLocale ? getLocale() : language,
enableDebug: false,
hostSDKVersion: void 0,
hostPackageName: void 0,
hostFontSizeSetting: void 0,
hostName: browserName,
hostVersion: browserVersion,
hostTheme: theme,
hostLanguage: language,
isUniAppX: true,
language,
SDKVersion: "",
theme,
uniPlatform: "web",
uniCompileVersion: __uniConfig.compilerVersion,
uniCompilerVersion: __uniConfig.compilerVersion,
uniRuntimeVersion: __uniConfig.compilerVersion,
version: ""
},
{
uniCompilerVersionCode: parseFloat(__uniConfig.compilerVersion),
uniRuntimeVersionCode: parseFloat(__uniConfig.compilerVersion),
uniRuntimeVersion: __uniConfig.compilerVersion
}
);
}
);
const getSystemInfoSync = /* @__PURE__ */ defineSyncApi(
"getSystemInfoSync",
() => {
{
return {
deviceId: Date.now() + "" + Math.floor(Math.random() * 1e7),
platform: "nodejs"
};
}
}
);
function setNavigationBar(pageMeta, type, args, resolve, reject) {
if (!pageMeta) {
return reject("page not found");
}
const { navigationBar } = pageMeta;
switch (type) {
case API_SET_NAVIGATION_BAR_COLOR:
const { frontColor, backgroundColor, animation: animation2 } = args;
const { duration, timingFunc } = animation2;
if (frontColor) {
navigationBar.titleColor = frontColor === "#000000" ? "#000000" : "#ffffff";
}
if (backgroundColor) {
navigationBar.backgroundColor = backgroundColor;
}
navigationBar.duration = duration + "ms";
navigationBar.timingFunc = timingFunc;
break;
case API_SHOW_NAVIGATION_BAR_LOADING:
navigationBar.loading = true;
break;
case API_HIDE_NAVIGATION_BAR_LOADING:
navigationBar.loading = false;
break;
case API_SET_NAVIGATION_BAR_TITLE:
const { title } = args;
navigationBar.titleText = title;
{
updateDocumentTitle(args.title);
}
break;
}
resolve();
}
const setNavigationBarTitle = /* @__PURE__ */ defineAsyncApi(
API_SET_NAVIGATION_BAR_TITLE,
(args, { resolve, reject }) => {
setNavigationBar(
getCurrentPageMeta(),
API_SET_NAVIGATION_BAR_TITLE,
args,
resolve,
reject
);
},
SetNavigationBarTitleProtocol
);
require("localstorage-polyfill");
global.XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
const api = /* @__PURE__ */ Object.defineProperty({
__proto__: null,
clearStorage,
clearStorageSync,
getAppBaseInfo,
getDeviceInfo,
getStorage,
getStorageInfo,
getStorageInfoSync,
getStorageSync,
getSystemInfoSync,
removeStorage,
removeStorageSync,
request,
setNavigationBarTitle,
setStorage,
setStorageSync
}, Symbol.toStringTag, { value: "Module" });
const uni$1 = api;
const UniServiceJSBridge$1 = /* @__PURE__ */ shared.extend(ServiceJSBridge, {
publishHandler(event, args, pageId) {
UniViewJSBridge.subscribeHandler(event, args, pageId);
}
});
Object.defineProperty(exports, "UTS", {
enumerable: true,
get: () => uniShared.UTS
});
Object.defineProperty(exports, "UTSJSONObject", {
enumerable: true,
get: () => uniShared.UTSJSONObject
});
Object.defineProperty(exports, "UTSValueIterable", {
enumerable: true,
get: () => uniShared.UTSValueIterable
});
Object.defineProperty(exports, "UniError", {
enumerable: true,
get: () => uniShared.UniError
});
exports.Ad = indexVapor;
exports.AdContentPage = index$5;
exports.AdDraw = index$4;
exports.AsyncErrorComponent = _sfc_main$t;
exports.AsyncLoadingComponent = _sfc_main$u;
exports.Button = _sfc_main$n;
exports.Camera = index$3;
exports.Canvas = indexVapor$a;
exports.Checkbox = _sfc_main$m;
exports.CheckboxGroup = _sfc_main$l;
exports.Editor = indexVapor$8;
exports.FlowItem = _sfc_main$k;
exports.Form = _sfc_main$j;
exports.Icon = indexVapor$7;
exports.Input = Input;
exports.Label = _sfc_main$i;
exports.LayoutComponent = _sfc_main$v;
exports.ListItem = _sfc_main$h;
exports.ListView = _sfc_main$g;
exports.LivePlayer = index$2;
exports.LivePusher = index$1;
exports.Loading = _sfc_main$s;
exports.Map = indexVapor$1;
exports.MatchMedia = _sfc_main$f;
exports.MovableArea = indexVapor$6;
exports.MovableView = indexVapor$5;
exports.Navigator = _sfc_main$e;
exports.PageComponent = _sfc_main$o;
exports.PageContainer = _sfc_main$d;
exports.Picker = _sfc_main$c;
exports.PickerView = _sfc_main$b;
exports.PickerViewColumn = _sfc_main$a;
exports.Progress = _sfc_main$9;
exports.Radio = _sfc_main$8;
exports.RadioGroup = _sfc_main$7;
exports.ResizeSensor = ResizeSensor;
exports.RichText = indexVapor$4;
exports.ScrollView = __syscom_0;
exports.Slider = _sfc_main$6;
exports.StickyHeader = _sfc_main$5;
exports.StickySection = _sfc_main$4;
exports.Swiper = _sfc_main$3;
exports.SwiperItem = _sfc_main$2;
exports.Switch = _sfc_main$1;
exports.Textarea = indexVapor$9;
exports.UniButtonElement = UniButtonElement;
exports.UniButtonElementImpl = UniButtonElement;
exports.UniCanvasElement = UniCanvasElement;
exports.UniCanvasElementImpl = UniCanvasElement;
exports.UniCheckboxElement = UniCheckboxElement;
exports.UniCheckboxElementImpl = UniCheckboxElement;
exports.UniCheckboxGroupElement = UniCheckboxGroupElement;
exports.UniCheckboxGroupElementImpl = UniCheckboxGroupElement;
exports.UniEditorElement = UniEditorElement;
exports.UniEditorElementImpl = UniEditorElement;
exports.UniElement = UniElement2;
exports.UniElementImpl = UniElement2;
exports.UniFormElement = UniFormElement;
exports.UniFormElementImpl = UniFormElement;
exports.UniIconElement = UniIconElement;
exports.UniIconElementImpl = UniIconElement;
exports.UniImageElement = UniImageElement;
exports.UniImageElementImpl = UniImageElement;
exports.UniInputElement = UniInputElement;
exports.UniInputElementImpl = UniInputElement;
exports.UniLabelElement = UniLabelElement;
exports.UniLabelElementImpl = UniLabelElement;
exports.UniLoadingElement = UniLoadingElement;
exports.UniLoadingElementImpl = UniLoadingElement;
exports.UniMatchMediaElement = UniMatchMediaElement;
exports.UniMatchMediaElementImpl = UniMatchMediaElement;
exports.UniMovableAreaElement = UniMovableAreaElement;
exports.UniMovableAreaElementImpl = UniMovableAreaElement;
exports.UniMovableViewElement = UniMovableViewElement;
exports.UniMovableViewElementImpl = UniMovableViewElement;
exports.UniNavigatorElement = UniNavigatorElement;
exports.UniNavigatorElementImpl = UniNavigatorElement;
exports.UniPageContainerElement = UniPageContainerElement;
exports.UniPageContainerElementImpl = UniPageContainerElement;
exports.UniPickerElement = UniPickerElement;
exports.UniPickerElementImpl = UniPickerElement;
exports.UniPickerViewColumnElement = UniPickerViewColumnElement;
exports.UniPickerViewColumnElementImpl = UniPickerViewColumnElement;
exports.UniPickerViewElement = UniPickerViewElement;
exports.UniPickerViewElementImpl = UniPickerViewElement;
exports.UniProgressElement = UniProgressElement;
exports.UniProgressElementImpl = UniProgressElement;
exports.UniRadioElement = UniRadioElement;
exports.UniRadioElementImpl = UniRadioElement;
exports.UniRadioGroupElement = UniRadioGroupElement;
exports.UniRadioGroupElementImpl = UniRadioGroupElement;
exports.UniRichTextElement = UniRichTextElement;
exports.UniRichTextElementImpl = UniRichTextElement;
exports.UniScrollViewElement = UniScrollViewElement;
exports.UniScrollViewElementImpl = UniScrollViewElement;
exports.UniServiceJSBridge = UniServiceJSBridge$1;
exports.UniSliderElement = UniSliderElement;
exports.UniSliderElementImpl = UniSliderElement;
exports.UniSwiperElement = UniSwiperElement;
exports.UniSwiperElementImpl = UniSwiperElement;
exports.UniSwiperItemElement = UniSwiperItemElement;
exports.UniSwiperItemElementImpl = UniSwiperItemElement;
exports.UniSwitchElement = UniSwitchElement;
exports.UniSwitchElementImpl = UniSwitchElement;
exports.UniTextElement = UniTextElement;
exports.UniTextElementImpl = UniTextElement;
exports.UniTextareaElement = UniTextareaElement;
exports.UniTextareaElementImpl = UniTextareaElement;
exports.UniViewElement = UniViewElement;
exports.UniViewElementImpl = UniViewElement;
exports.UniViewJSBridge = UniViewJSBridge$1;
exports.Video = indexVapor$3;
exports.Waterflow = _sfc_main;
exports.WebView = indexVapor$2;
exports.clearStorage = clearStorage;
exports.clearStorageSync = clearStorageSync;
exports.createVaporPageRouteComponent = createVaporPageRouteComponent;
exports.getApp = getApp$1;
exports.getAppBaseInfo = getAppBaseInfo;
exports.getCurrentPages = getCurrentPages$1;
exports.getDeviceInfo = getDeviceInfo;
exports.getRealPath = getRealPath;
exports.getStorage = getStorage;
exports.getStorageInfo = getStorageInfo;
exports.getStorageInfoSync = getStorageInfoSync;
exports.getStorageSync = getStorageSync;
exports.getSystemInfoSync = getSystemInfoSync;
exports.plugin = index;
exports.removeStorage = removeStorage;
exports.removeStorageSync = removeStorageSync;
exports.request = request;
exports.setNavigationBarTitle = setNavigationBarTitle;
exports.setStorage = setStorage;
exports.setStorageSync = setStorageSync;
exports.setupApp = setupApp;
exports.setupPage = setupPage;
exports.setupWindow = setupWindow;
exports.uni = uni$1;
exports.useI18n = useI18n;
exports.useTabBar = useTabBar;