UNPKG

501 kBJavaScriptView Raw
1"use strict";
2Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3const vue = require("vue");
4const use = require("@vant/use");
5const shared = require("@vue/shared");
6const popperjs = require("@vant/popperjs");
7function noop() {
8}
9const extend = Object.assign;
10const inBrowser = typeof window !== "undefined";
11const isObject = (val) => val !== null && typeof val === "object";
12const isDef = (val) => val !== void 0 && val !== null;
13const isFunction = (val) => typeof val === "function";
14const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch);
15const isDate = (val) => Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
16function isMobile(value) {
17 value = value.replace(/[^-|\d]/g, "");
18 return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value);
19}
20const isNumeric = (val) => typeof val === "number" || /^\d+(\.\d+)?$/.test(val);
21const isIOS$1 = () => inBrowser ? /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()) : false;
22function get(object, path) {
23 const keys = path.split(".");
24 let result = object;
25 keys.forEach((key) => {
26 var _a;
27 result = isObject(result) ? (_a = result[key]) != null ? _a : "" : "";
28 });
29 return result;
30}
31function pick(obj, keys, ignoreUndefined) {
32 return keys.reduce(
33 (ret, key) => {
34 if (!ignoreUndefined || obj[key] !== void 0) {
35 ret[key] = obj[key];
36 }
37 return ret;
38 },
39 {}
40 );
41}
42const isSameValue = (newValue, oldValue) => JSON.stringify(newValue) === JSON.stringify(oldValue);
43const toArray = (item) => Array.isArray(item) ? item : [item];
44const unknownProp = null;
45const numericProp = [Number, String];
46const truthProp = {
47 type: Boolean,
48 default: true
49};
50const makeRequiredProp = (type) => ({
51 type,
52 required: true
53});
54const makeArrayProp = () => ({
55 type: Array,
56 default: () => []
57});
58const makeNumberProp = (defaultVal) => ({
59 type: Number,
60 default: defaultVal
61});
62const makeNumericProp = (defaultVal) => ({
63 type: numericProp,
64 default: defaultVal
65});
66const makeStringProp = (defaultVal) => ({
67 type: String,
68 default: defaultVal
69});
70function getScrollTop(el) {
71 const top = "scrollTop" in el ? el.scrollTop : el.pageYOffset;
72 return Math.max(top, 0);
73}
74function setScrollTop(el, value) {
75 if ("scrollTop" in el) {
76 el.scrollTop = value;
77 } else {
78 el.scrollTo(el.scrollX, value);
79 }
80}
81function getRootScrollTop() {
82 return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
83}
84function setRootScrollTop(value) {
85 setScrollTop(window, value);
86 setScrollTop(document.body, value);
87}
88function getElementTop(el, scroller) {
89 if (el === window) {
90 return 0;
91 }
92 const scrollTop = scroller ? getScrollTop(scroller) : getRootScrollTop();
93 return use.useRect(el).top + scrollTop;
94}
95const isIOS = isIOS$1();
96function resetScroll() {
97 if (isIOS) {
98 setRootScrollTop(getRootScrollTop());
99 }
100}
101const stopPropagation = (event) => event.stopPropagation();
102function preventDefault(event, isStopPropagation) {
103 if (typeof event.cancelable !== "boolean" || event.cancelable) {
104 event.preventDefault();
105 }
106 if (isStopPropagation) {
107 stopPropagation(event);
108 }
109}
110function isHidden(elementRef) {
111 const el = vue.unref(elementRef);
112 if (!el) {
113 return false;
114 }
115 const style = window.getComputedStyle(el);
116 const hidden = style.display === "none";
117 const parentHidden = el.offsetParent === null && style.position !== "fixed";
118 return hidden || parentHidden;
119}
120const { width: windowWidth, height: windowHeight } = use.useWindowSize();
121function isContainingBlock(el) {
122 const css = window.getComputedStyle(el);
123 return css.transform !== "none" || css.perspective !== "none" || ["transform", "perspective", "filter"].some(
124 (value) => (css.willChange || "").includes(value)
125 );
126}
127function getContainingBlock(el) {
128 let node = el.parentElement;
129 while (node) {
130 if (node && node.tagName !== "HTML" && node.tagName !== "BODY" && isContainingBlock(node)) {
131 return node;
132 }
133 node = node.parentElement;
134 }
135 return null;
136}
137function addUnit(value) {
138 if (isDef(value)) {
139 return isNumeric(value) ? `${value}px` : String(value);
140 }
141 return void 0;
142}
143function getSizeStyle(originSize) {
144 if (isDef(originSize)) {
145 if (Array.isArray(originSize)) {
146 return {
147 width: addUnit(originSize[0]),
148 height: addUnit(originSize[1])
149 };
150 }
151 const size = addUnit(originSize);
152 return {
153 width: size,
154 height: size
155 };
156 }
157}
158function getZIndexStyle(zIndex) {
159 const style = {};
160 if (zIndex !== void 0) {
161 style.zIndex = +zIndex;
162 }
163 return style;
164}
165let rootFontSize;
166function getRootFontSize() {
167 if (!rootFontSize) {
168 const doc = document.documentElement;
169 const fontSize = doc.style.fontSize || window.getComputedStyle(doc).fontSize;
170 rootFontSize = parseFloat(fontSize);
171 }
172 return rootFontSize;
173}
174function convertRem(value) {
175 value = value.replace(/rem/g, "");
176 return +value * getRootFontSize();
177}
178function convertVw(value) {
179 value = value.replace(/vw/g, "");
180 return +value * windowWidth.value / 100;
181}
182function convertVh(value) {
183 value = value.replace(/vh/g, "");
184 return +value * windowHeight.value / 100;
185}
186function unitToPx(value) {
187 if (typeof value === "number") {
188 return value;
189 }
190 if (inBrowser) {
191 if (value.includes("rem")) {
192 return convertRem(value);
193 }
194 if (value.includes("vw")) {
195 return convertVw(value);
196 }
197 if (value.includes("vh")) {
198 return convertVh(value);
199 }
200 }
201 return parseFloat(value);
202}
203const camelizeRE = /-(\w)/g;
204const camelize = (str) => str.replace(camelizeRE, (_, c) => c.toUpperCase());
205const kebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase().replace(/^-/, "");
206function padZero(num, targetLength = 2) {
207 let str = num + "";
208 while (str.length < targetLength) {
209 str = "0" + str;
210 }
211 return str;
212}
213const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
214function trimExtraChar(value, char, regExp) {
215 const index = value.indexOf(char);
216 if (index === -1) {
217 return value;
218 }
219 if (char === "-" && index !== 0) {
220 return value.slice(0, index);
221 }
222 return value.slice(0, index + 1) + value.slice(index).replace(regExp, "");
223}
224function formatNumber(value, allowDot = true, allowMinus = true) {
225 if (allowDot) {
226 value = trimExtraChar(value, ".", /\./g);
227 } else {
228 value = value.split(".")[0];
229 }
230 if (allowMinus) {
231 value = trimExtraChar(value, "-", /-/g);
232 } else {
233 value = value.replace(/-/, "");
234 }
235 const regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g;
236 return value.replace(regExp, "");
237}
238function addNumber(num1, num2) {
239 const cardinal = 10 ** 10;
240 return Math.round((num1 + num2) * cardinal) / cardinal;
241}
242const { hasOwnProperty } = Object.prototype;
243function assignKey(to, from, key) {
244 const val = from[key];
245 if (!isDef(val)) {
246 return;
247 }
248 if (!hasOwnProperty.call(to, key) || !isObject(val)) {
249 to[key] = val;
250 } else {
251 to[key] = deepAssign(Object(to[key]), val);
252 }
253}
254function deepAssign(to, from) {
255 Object.keys(from).forEach((key) => {
256 assignKey(to, from, key);
257 });
258 return to;
259}
260var stdin_default$1W = {
261 name: "姓名",
262 tel: "电话",
263 save: "保存",
264 clear: "清空",
265 cancel: "取消",
266 confirm: "确认",
267 delete: "删除",
268 loading: "加载中...",
269 noCoupon: "暂无优惠券",
270 nameEmpty: "请填写姓名",
271 addContact: "添加联系人",
272 telInvalid: "请填写正确的电话",
273 vanCalendar: {
274 end: "结束",
275 start: "开始",
276 title: "日期选择",
277 weekdays: ["日", "一", "二", "三", "四", "五", "六"],
278 monthTitle: (year, month) => `${year}${month}月`,
279 rangePrompt: (maxRange) => `最多选择 ${maxRange} 天`
280 },
281 vanCascader: {
282 select: "请选择"
283 },
284 vanPagination: {
285 prev: "上一页",
286 next: "下一页"
287 },
288 vanPullRefresh: {
289 pulling: "下拉即可刷新...",
290 loosing: "释放即可刷新..."
291 },
292 vanSubmitBar: {
293 label: "合计:"
294 },
295 vanCoupon: {
296 unlimited: "无门槛",
297 discount: (discount) => `${discount}折`,
298 condition: (condition) => `满${condition}元可用`
299 },
300 vanCouponCell: {
301 title: "优惠券",
302 count: (count) => `${count}张可用`
303 },
304 vanCouponList: {
305 exchange: "兑换",
306 close: "不使用",
307 enable: "可用",
308 disabled: "不可用",
309 placeholder: "输入优惠码"
310 },
311 vanAddressEdit: {
312 area: "地区",
313 areaEmpty: "请选择地区",
314 addressEmpty: "请填写详细地址",
315 addressDetail: "详细地址",
316 defaultAddress: "设为默认收货地址"
317 },
318 vanAddressList: {
319 add: "新增地址"
320 }
321};
322const lang = vue.ref("zh-CN");
323const messages = vue.reactive({
324 "zh-CN": stdin_default$1W
325});
326const Locale = {
327 messages() {
328 return messages[lang.value];
329 },
330 use(newLang, newMessages) {
331 lang.value = newLang;
332 this.add({ [newLang]: newMessages });
333 },
334 add(newMessages = {}) {
335 deepAssign(messages, newMessages);
336 }
337};
338const useCurrentLang = () => lang;
339var stdin_default$1V = Locale;
340function createTranslate(name2) {
341 const prefix = camelize(name2) + ".";
342 return (path, ...args) => {
343 const messages2 = stdin_default$1V.messages();
344 const message = get(messages2, prefix + path) || get(messages2, path);
345 return isFunction(message) ? message(...args) : message;
346 };
347}
348function genBem(name2, mods) {
349 if (!mods) {
350 return "";
351 }
352 if (typeof mods === "string") {
353 return ` ${name2}--${mods}`;
354 }
355 if (Array.isArray(mods)) {
356 return mods.reduce(
357 (ret, item) => ret + genBem(name2, item),
358 ""
359 );
360 }
361 return Object.keys(mods).reduce(
362 (ret, key) => ret + (mods[key] ? genBem(name2, key) : ""),
363 ""
364 );
365}
366function createBEM(name2) {
367 return (el, mods) => {
368 if (el && typeof el !== "string") {
369 mods = el;
370 el = "";
371 }
372 el = el ? `${name2}__${el}` : name2;
373 return `${el}${genBem(el, mods)}`;
374 };
375}
376function createNamespace(name2) {
377 const prefixedName = `van-${name2}`;
378 return [
379 prefixedName,
380 createBEM(prefixedName),
381 createTranslate(prefixedName)
382 ];
383}
384const BORDER = "van-hairline";
385const BORDER_TOP = `${BORDER}--top`;
386const BORDER_LEFT = `${BORDER}--left`;
387const BORDER_RIGHT = `${BORDER}--right`;
388const BORDER_BOTTOM = `${BORDER}--bottom`;
389const BORDER_SURROUND = `${BORDER}--surround`;
390const BORDER_TOP_BOTTOM = `${BORDER}--top-bottom`;
391const BORDER_UNSET_TOP_BOTTOM = `${BORDER}-unset--top-bottom`;
392const HAPTICS_FEEDBACK = "van-haptics-feedback";
393const FORM_KEY = Symbol("van-form");
394const LONG_PRESS_START_TIME = 500;
395const TAP_OFFSET = 5;
396function callInterceptor(interceptor, {
397 args = [],
398 done,
399 canceled,
400 error
401}) {
402 if (interceptor) {
403 const returnVal = interceptor.apply(null, args);
404 if (isPromise(returnVal)) {
405 returnVal.then((value) => {
406 if (value) {
407 done();
408 } else if (canceled) {
409 canceled();
410 }
411 }).catch(error || noop);
412 } else if (returnVal) {
413 done();
414 } else if (canceled) {
415 canceled();
416 }
417 } else {
418 done();
419 }
420}
421function withInstall(options) {
422 options.install = (app) => {
423 const { name: name2 } = options;
424 if (name2) {
425 app.component(name2, options);
426 app.component(camelize(`-${name2}`), options);
427 }
428 };
429 return options;
430}
431function closest(arr, target) {
432 return arr.reduce(
433 (pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur
434 );
435}
436const POPUP_TOGGLE_KEY = Symbol();
437function onPopupReopen(callback) {
438 const popupToggleStatus = vue.inject(POPUP_TOGGLE_KEY, null);
439 if (popupToggleStatus) {
440 vue.watch(popupToggleStatus, (show) => {
441 if (show) {
442 callback();
443 }
444 });
445 }
446}
447const useHeight = (element, withSafeArea) => {
448 const height = vue.ref();
449 const setHeight = () => {
450 height.value = use.useRect(element).height;
451 };
452 vue.onMounted(() => {
453 vue.nextTick(setHeight);
454 if (withSafeArea) {
455 for (let i = 1; i <= 3; i++) {
456 setTimeout(setHeight, 100 * i);
457 }
458 }
459 });
460 onPopupReopen(() => vue.nextTick(setHeight));
461 vue.watch([windowWidth, windowHeight], setHeight);
462 return height;
463};
464function usePlaceholder(contentRef, bem2) {
465 const height = useHeight(contentRef, true);
466 return (renderContent) => vue.createVNode("div", {
467 "class": bem2("placeholder"),
468 "style": {
469 height: height.value ? `${height.value}px` : void 0
470 }
471 }, [renderContent()]);
472}
473const [name$1K, bem$1F] = createNamespace("action-bar");
474const ACTION_BAR_KEY = Symbol(name$1K);
475const actionBarProps = {
476 placeholder: Boolean,
477 safeAreaInsetBottom: truthProp
478};
479var stdin_default$1U = vue.defineComponent({
480 name: name$1K,
481 props: actionBarProps,
482 setup(props2, {
483 slots
484 }) {
485 const root = vue.ref();
486 const renderPlaceholder = usePlaceholder(root, bem$1F);
487 const {
488 linkChildren
489 } = use.useChildren(ACTION_BAR_KEY);
490 linkChildren();
491 const renderActionBar = () => {
492 var _a;
493 return vue.createVNode("div", {
494 "ref": root,
495 "class": [bem$1F(), {
496 "van-safe-area-bottom": props2.safeAreaInsetBottom
497 }]
498 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
499 };
500 return () => {
501 if (props2.placeholder) {
502 return renderPlaceholder(renderActionBar);
503 }
504 return renderActionBar();
505 };
506 }
507});
508const ActionBar = withInstall(stdin_default$1U);
509function useExpose(apis) {
510 const instance2 = vue.getCurrentInstance();
511 if (instance2) {
512 extend(instance2.proxy, apis);
513 }
514}
515const routeProps = {
516 to: [String, Object],
517 url: String,
518 replace: Boolean
519};
520function route({
521 to,
522 url,
523 replace,
524 $router: router
525}) {
526 if (to && router) {
527 router[replace ? "replace" : "push"](to);
528 } else if (url) {
529 replace ? location.replace(url) : location.href = url;
530 }
531}
532function useRoute() {
533 const vm = vue.getCurrentInstance().proxy;
534 return () => route(vm);
535}
536const [name$1J, bem$1E] = createNamespace("badge");
537const badgeProps = {
538 dot: Boolean,
539 max: numericProp,
540 tag: makeStringProp("div"),
541 color: String,
542 offset: Array,
543 content: numericProp,
544 showZero: truthProp,
545 position: makeStringProp("top-right")
546};
547var stdin_default$1T = vue.defineComponent({
548 name: name$1J,
549 props: badgeProps,
550 setup(props2, {
551 slots
552 }) {
553 const hasContent = () => {
554 if (slots.content) {
555 return true;
556 }
557 const {
558 content,
559 showZero
560 } = props2;
561 return isDef(content) && content !== "" && (showZero || content !== 0 && content !== "0");
562 };
563 const renderContent = () => {
564 const {
565 dot,
566 max,
567 content
568 } = props2;
569 if (!dot && hasContent()) {
570 if (slots.content) {
571 return slots.content();
572 }
573 if (isDef(max) && isNumeric(content) && +content > +max) {
574 return `${max}+`;
575 }
576 return content;
577 }
578 };
579 const getOffsetWithMinusString = (val) => val.startsWith("-") ? val.replace("-", "") : `-${val}`;
580 const style = vue.computed(() => {
581 const style2 = {
582 background: props2.color
583 };
584 if (props2.offset) {
585 const [x, y] = props2.offset;
586 const {
587 position
588 } = props2;
589 const [offsetY, offsetX] = position.split("-");
590 if (slots.default) {
591 if (typeof y === "number") {
592 style2[offsetY] = addUnit(offsetY === "top" ? y : -y);
593 } else {
594 style2[offsetY] = offsetY === "top" ? addUnit(y) : getOffsetWithMinusString(y);
595 }
596 if (typeof x === "number") {
597 style2[offsetX] = addUnit(offsetX === "left" ? x : -x);
598 } else {
599 style2[offsetX] = offsetX === "left" ? addUnit(x) : getOffsetWithMinusString(x);
600 }
601 } else {
602 style2.marginTop = addUnit(y);
603 style2.marginLeft = addUnit(x);
604 }
605 }
606 return style2;
607 });
608 const renderBadge = () => {
609 if (hasContent() || props2.dot) {
610 return vue.createVNode("div", {
611 "class": bem$1E([props2.position, {
612 dot: props2.dot,
613 fixed: !!slots.default
614 }]),
615 "style": style.value
616 }, [renderContent()]);
617 }
618 };
619 return () => {
620 if (slots.default) {
621 const {
622 tag
623 } = props2;
624 return vue.createVNode(tag, {
625 "class": bem$1E("wrapper")
626 }, {
627 default: () => [slots.default(), renderBadge()]
628 });
629 }
630 return renderBadge();
631 };
632 }
633});
634const Badge = withInstall(stdin_default$1T);
635let globalZIndex = 2e3;
636const useGlobalZIndex = () => ++globalZIndex;
637const setGlobalZIndex = (val) => {
638 globalZIndex = val;
639};
640const [name$1I, bem$1D] = createNamespace("config-provider");
641const CONFIG_PROVIDER_KEY = Symbol(name$1I);
642const configProviderProps = {
643 tag: makeStringProp("div"),
644 theme: makeStringProp("light"),
645 zIndex: Number,
646 themeVars: Object,
647 themeVarsDark: Object,
648 themeVarsLight: Object,
649 themeVarsScope: makeStringProp("local"),
650 iconPrefix: String
651};
652function insertDash(str) {
653 return str.replace(/([a-zA-Z])(\d)/g, "$1-$2");
654}
655function mapThemeVarsToCSSVars(themeVars) {
656 const cssVars = {};
657 Object.keys(themeVars).forEach((key) => {
658 const formattedKey = insertDash(kebabCase(key));
659 cssVars[`--van-${formattedKey}`] = themeVars[key];
660 });
661 return cssVars;
662}
663function syncThemeVarsOnRoot(newStyle = {}, oldStyle = {}) {
664 Object.keys(newStyle).forEach((key) => {
665 if (newStyle[key] !== oldStyle[key]) {
666 document.documentElement.style.setProperty(key, newStyle[key]);
667 }
668 });
669 Object.keys(oldStyle).forEach((key) => {
670 if (!newStyle[key]) {
671 document.documentElement.style.removeProperty(key);
672 }
673 });
674}
675var stdin_default$1S = vue.defineComponent({
676 name: name$1I,
677 props: configProviderProps,
678 setup(props2, {
679 slots
680 }) {
681 const style = vue.computed(() => mapThemeVarsToCSSVars(extend({}, props2.themeVars, props2.theme === "dark" ? props2.themeVarsDark : props2.themeVarsLight)));
682 if (inBrowser) {
683 const addTheme = () => {
684 document.documentElement.classList.add(`van-theme-${props2.theme}`);
685 };
686 const removeTheme = (theme = props2.theme) => {
687 document.documentElement.classList.remove(`van-theme-${theme}`);
688 };
689 vue.watch(() => props2.theme, (newVal, oldVal) => {
690 if (oldVal) {
691 removeTheme(oldVal);
692 }
693 addTheme();
694 }, {
695 immediate: true
696 });
697 vue.onActivated(addTheme);
698 vue.onDeactivated(removeTheme);
699 vue.onBeforeUnmount(removeTheme);
700 vue.watch(style, (newStyle, oldStyle) => {
701 if (props2.themeVarsScope === "global") {
702 syncThemeVarsOnRoot(newStyle, oldStyle);
703 }
704 });
705 vue.watch(() => props2.themeVarsScope, (newScope, oldScope) => {
706 if (oldScope === "global") {
707 syncThemeVarsOnRoot({}, style.value);
708 }
709 if (newScope === "global") {
710 syncThemeVarsOnRoot(style.value, {});
711 }
712 });
713 if (props2.themeVarsScope === "global") {
714 syncThemeVarsOnRoot(style.value, {});
715 }
716 }
717 vue.provide(CONFIG_PROVIDER_KEY, props2);
718 vue.watchEffect(() => {
719 if (props2.zIndex !== void 0) {
720 setGlobalZIndex(props2.zIndex);
721 }
722 });
723 return () => vue.createVNode(props2.tag, {
724 "class": bem$1D(),
725 "style": props2.themeVarsScope === "local" ? style.value : void 0
726 }, {
727 default: () => {
728 var _a;
729 return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
730 }
731 });
732 }
733});
734const [name$1H, bem$1C] = createNamespace("icon");
735const isImage$1 = (name2) => name2 == null ? void 0 : name2.includes("/");
736const iconProps = {
737 dot: Boolean,
738 tag: makeStringProp("i"),
739 name: String,
740 size: numericProp,
741 badge: numericProp,
742 color: String,
743 badgeProps: Object,
744 classPrefix: String
745};
746var stdin_default$1R = vue.defineComponent({
747 name: name$1H,
748 props: iconProps,
749 setup(props2, {
750 slots
751 }) {
752 const config = vue.inject(CONFIG_PROVIDER_KEY, null);
753 const classPrefix = vue.computed(() => props2.classPrefix || (config == null ? void 0 : config.iconPrefix) || bem$1C());
754 return () => {
755 const {
756 tag,
757 dot,
758 name: name2,
759 size,
760 badge,
761 color
762 } = props2;
763 const isImageIcon = isImage$1(name2);
764 return vue.createVNode(Badge, vue.mergeProps({
765 "dot": dot,
766 "tag": tag,
767 "class": [classPrefix.value, isImageIcon ? "" : `${classPrefix.value}-${name2}`],
768 "style": {
769 color,
770 fontSize: addUnit(size)
771 },
772 "content": badge
773 }, props2.badgeProps), {
774 default: () => {
775 var _a;
776 return [(_a = slots.default) == null ? void 0 : _a.call(slots), isImageIcon && vue.createVNode("img", {
777 "class": bem$1C("image"),
778 "src": name2
779 }, null)];
780 }
781 });
782 };
783 }
784});
785const Icon = withInstall(stdin_default$1R);
786var stdin_default$1Q = Icon;
787const [name$1G, bem$1B] = createNamespace("loading");
788const SpinIcon = Array(12).fill(null).map((_, index) => vue.createVNode("i", {
789 "class": bem$1B("line", String(index + 1))
790}, null));
791const CircularIcon = vue.createVNode("svg", {
792 "class": bem$1B("circular"),
793 "viewBox": "25 25 50 50"
794}, [vue.createVNode("circle", {
795 "cx": "50",
796 "cy": "50",
797 "r": "20",
798 "fill": "none"
799}, null)]);
800const loadingProps = {
801 size: numericProp,
802 type: makeStringProp("circular"),
803 color: String,
804 vertical: Boolean,
805 textSize: numericProp,
806 textColor: String
807};
808var stdin_default$1P = vue.defineComponent({
809 name: name$1G,
810 props: loadingProps,
811 setup(props2, {
812 slots
813 }) {
814 const spinnerStyle = vue.computed(() => extend({
815 color: props2.color
816 }, getSizeStyle(props2.size)));
817 const renderIcon = () => {
818 const DefaultIcon = props2.type === "spinner" ? SpinIcon : CircularIcon;
819 return vue.createVNode("span", {
820 "class": bem$1B("spinner", props2.type),
821 "style": spinnerStyle.value
822 }, [slots.icon ? slots.icon() : DefaultIcon]);
823 };
824 const renderText = () => {
825 var _a;
826 if (slots.default) {
827 return vue.createVNode("span", {
828 "class": bem$1B("text"),
829 "style": {
830 fontSize: addUnit(props2.textSize),
831 color: (_a = props2.textColor) != null ? _a : props2.color
832 }
833 }, [slots.default()]);
834 }
835 };
836 return () => {
837 const {
838 type,
839 vertical
840 } = props2;
841 return vue.createVNode("div", {
842 "class": bem$1B([type, {
843 vertical
844 }]),
845 "aria-live": "polite",
846 "aria-busy": true
847 }, [renderIcon(), renderText()]);
848 };
849 }
850});
851const Loading = withInstall(stdin_default$1P);
852const [name$1F, bem$1A] = createNamespace("button");
853const buttonProps = extend({}, routeProps, {
854 tag: makeStringProp("button"),
855 text: String,
856 icon: String,
857 type: makeStringProp("default"),
858 size: makeStringProp("normal"),
859 color: String,
860 block: Boolean,
861 plain: Boolean,
862 round: Boolean,
863 square: Boolean,
864 loading: Boolean,
865 hairline: Boolean,
866 disabled: Boolean,
867 iconPrefix: String,
868 nativeType: makeStringProp("button"),
869 loadingSize: numericProp,
870 loadingText: String,
871 loadingType: String,
872 iconPosition: makeStringProp("left")
873});
874var stdin_default$1O = vue.defineComponent({
875 name: name$1F,
876 props: buttonProps,
877 emits: ["click"],
878 setup(props2, {
879 emit,
880 slots
881 }) {
882 const route2 = useRoute();
883 const renderLoadingIcon = () => {
884 if (slots.loading) {
885 return slots.loading();
886 }
887 return vue.createVNode(Loading, {
888 "size": props2.loadingSize,
889 "type": props2.loadingType,
890 "class": bem$1A("loading")
891 }, null);
892 };
893 const renderIcon = () => {
894 if (props2.loading) {
895 return renderLoadingIcon();
896 }
897 if (slots.icon) {
898 return vue.createVNode("div", {
899 "class": bem$1A("icon")
900 }, [slots.icon()]);
901 }
902 if (props2.icon) {
903 return vue.createVNode(Icon, {
904 "name": props2.icon,
905 "class": bem$1A("icon"),
906 "classPrefix": props2.iconPrefix
907 }, null);
908 }
909 };
910 const renderText = () => {
911 let text;
912 if (props2.loading) {
913 text = props2.loadingText;
914 } else {
915 text = slots.default ? slots.default() : props2.text;
916 }
917 if (text) {
918 return vue.createVNode("span", {
919 "class": bem$1A("text")
920 }, [text]);
921 }
922 };
923 const getStyle = () => {
924 const {
925 color,
926 plain
927 } = props2;
928 if (color) {
929 const style = {
930 color: plain ? color : "white"
931 };
932 if (!plain) {
933 style.background = color;
934 }
935 if (color.includes("gradient")) {
936 style.border = 0;
937 } else {
938 style.borderColor = color;
939 }
940 return style;
941 }
942 };
943 const onClick = (event) => {
944 if (props2.loading) {
945 preventDefault(event);
946 } else if (!props2.disabled) {
947 emit("click", event);
948 route2();
949 }
950 };
951 return () => {
952 const {
953 tag,
954 type,
955 size,
956 block,
957 round,
958 plain,
959 square,
960 loading,
961 disabled,
962 hairline,
963 nativeType,
964 iconPosition
965 } = props2;
966 const classes = [bem$1A([type, size, {
967 plain,
968 block,
969 round,
970 square,
971 loading,
972 disabled,
973 hairline
974 }]), {
975 [BORDER_SURROUND]: hairline
976 }];
977 return vue.createVNode(tag, {
978 "type": nativeType,
979 "class": classes,
980 "style": getStyle(),
981 "disabled": disabled,
982 "onClick": onClick
983 }, {
984 default: () => [vue.createVNode("div", {
985 "class": bem$1A("content")
986 }, [iconPosition === "left" && renderIcon(), renderText(), iconPosition === "right" && renderIcon()])]
987 });
988 };
989 }
990});
991const Button = withInstall(stdin_default$1O);
992const [name$1E, bem$1z] = createNamespace("action-bar-button");
993const actionBarButtonProps = extend({}, routeProps, {
994 type: String,
995 text: String,
996 icon: String,
997 color: String,
998 loading: Boolean,
999 disabled: Boolean
1000});
1001var stdin_default$1N = vue.defineComponent({
1002 name: name$1E,
1003 props: actionBarButtonProps,
1004 setup(props2, {
1005 slots
1006 }) {
1007 const route2 = useRoute();
1008 const {
1009 parent,
1010 index
1011 } = use.useParent(ACTION_BAR_KEY);
1012 const isFirst = vue.computed(() => {
1013 if (parent) {
1014 const prev = parent.children[index.value - 1];
1015 return !(prev && "isButton" in prev);
1016 }
1017 });
1018 const isLast = vue.computed(() => {
1019 if (parent) {
1020 const next = parent.children[index.value + 1];
1021 return !(next && "isButton" in next);
1022 }
1023 });
1024 useExpose({
1025 isButton: true
1026 });
1027 return () => {
1028 const {
1029 type,
1030 icon,
1031 text,
1032 color,
1033 loading,
1034 disabled
1035 } = props2;
1036 return vue.createVNode(Button, {
1037 "class": bem$1z([type, {
1038 last: isLast.value,
1039 first: isFirst.value
1040 }]),
1041 "size": "large",
1042 "type": type,
1043 "icon": icon,
1044 "color": color,
1045 "loading": loading,
1046 "disabled": disabled,
1047 "onClick": route2
1048 }, {
1049 default: () => [slots.default ? slots.default() : text]
1050 });
1051 };
1052 }
1053});
1054const ActionBarButton = withInstall(stdin_default$1N);
1055const [name$1D, bem$1y] = createNamespace("action-bar-icon");
1056const actionBarIconProps = extend({}, routeProps, {
1057 dot: Boolean,
1058 text: String,
1059 icon: String,
1060 color: String,
1061 badge: numericProp,
1062 iconClass: unknownProp,
1063 badgeProps: Object,
1064 iconPrefix: String
1065});
1066var stdin_default$1M = vue.defineComponent({
1067 name: name$1D,
1068 props: actionBarIconProps,
1069 setup(props2, {
1070 slots
1071 }) {
1072 const route2 = useRoute();
1073 use.useParent(ACTION_BAR_KEY);
1074 const renderIcon = () => {
1075 const {
1076 dot,
1077 badge,
1078 icon,
1079 color,
1080 iconClass,
1081 badgeProps: badgeProps2,
1082 iconPrefix
1083 } = props2;
1084 if (slots.icon) {
1085 return vue.createVNode(Badge, vue.mergeProps({
1086 "dot": dot,
1087 "class": bem$1y("icon"),
1088 "content": badge
1089 }, badgeProps2), {
1090 default: slots.icon
1091 });
1092 }
1093 return vue.createVNode(Icon, {
1094 "tag": "div",
1095 "dot": dot,
1096 "name": icon,
1097 "badge": badge,
1098 "color": color,
1099 "class": [bem$1y("icon"), iconClass],
1100 "badgeProps": badgeProps2,
1101 "classPrefix": iconPrefix
1102 }, null);
1103 };
1104 return () => vue.createVNode("div", {
1105 "role": "button",
1106 "class": bem$1y(),
1107 "tabindex": 0,
1108 "onClick": route2
1109 }, [renderIcon(), slots.default ? slots.default() : props2.text]);
1110 }
1111});
1112const ActionBarIcon = withInstall(stdin_default$1M);
1113const popupSharedProps = {
1114 // whether to show popup
1115 show: Boolean,
1116 // z-index
1117 zIndex: numericProp,
1118 // whether to show overlay
1119 overlay: truthProp,
1120 // transition duration
1121 duration: numericProp,
1122 // teleport
1123 teleport: [String, Object],
1124 // prevent body scroll
1125 lockScroll: truthProp,
1126 // whether to lazy render
1127 lazyRender: truthProp,
1128 // callback function before close
1129 beforeClose: Function,
1130 // overlay custom style
1131 overlayStyle: Object,
1132 // overlay custom class name
1133 overlayClass: unknownProp,
1134 // Initial rendering animation
1135 transitionAppear: Boolean,
1136 // whether to close popup when overlay is clicked
1137 closeOnClickOverlay: truthProp
1138};
1139const popupSharedPropKeys = Object.keys(
1140 popupSharedProps
1141);
1142function getDirection(x, y) {
1143 if (x > y) {
1144 return "horizontal";
1145 }
1146 if (y > x) {
1147 return "vertical";
1148 }
1149 return "";
1150}
1151function useTouch() {
1152 const startX = vue.ref(0);
1153 const startY = vue.ref(0);
1154 const deltaX = vue.ref(0);
1155 const deltaY = vue.ref(0);
1156 const offsetX = vue.ref(0);
1157 const offsetY = vue.ref(0);
1158 const direction = vue.ref("");
1159 const isTap = vue.ref(true);
1160 const isVertical = () => direction.value === "vertical";
1161 const isHorizontal = () => direction.value === "horizontal";
1162 const reset = () => {
1163 deltaX.value = 0;
1164 deltaY.value = 0;
1165 offsetX.value = 0;
1166 offsetY.value = 0;
1167 direction.value = "";
1168 isTap.value = true;
1169 };
1170 const start = (event) => {
1171 reset();
1172 startX.value = event.touches[0].clientX;
1173 startY.value = event.touches[0].clientY;
1174 };
1175 const move = (event) => {
1176 const touch = event.touches[0];
1177 deltaX.value = (touch.clientX < 0 ? 0 : touch.clientX) - startX.value;
1178 deltaY.value = touch.clientY - startY.value;
1179 offsetX.value = Math.abs(deltaX.value);
1180 offsetY.value = Math.abs(deltaY.value);
1181 const LOCK_DIRECTION_DISTANCE = 10;
1182 if (!direction.value || offsetX.value < LOCK_DIRECTION_DISTANCE && offsetY.value < LOCK_DIRECTION_DISTANCE) {
1183 direction.value = getDirection(offsetX.value, offsetY.value);
1184 }
1185 if (isTap.value && (offsetX.value > TAP_OFFSET || offsetY.value > TAP_OFFSET)) {
1186 isTap.value = false;
1187 }
1188 };
1189 return {
1190 move,
1191 start,
1192 reset,
1193 startX,
1194 startY,
1195 deltaX,
1196 deltaY,
1197 offsetX,
1198 offsetY,
1199 direction,
1200 isVertical,
1201 isHorizontal,
1202 isTap
1203 };
1204}
1205let totalLockCount = 0;
1206const BODY_LOCK_CLASS = "van-overflow-hidden";
1207function useLockScroll(rootRef, shouldLock) {
1208 const touch = useTouch();
1209 const DIRECTION_UP = "01";
1210 const DIRECTION_DOWN = "10";
1211 const onTouchMove = (event) => {
1212 touch.move(event);
1213 const direction = touch.deltaY.value > 0 ? DIRECTION_DOWN : DIRECTION_UP;
1214 const el = use.getScrollParent(
1215 event.target,
1216 rootRef.value
1217 );
1218 const { scrollHeight, offsetHeight, scrollTop } = el;
1219 let status = "11";
1220 if (scrollTop === 0) {
1221 status = offsetHeight >= scrollHeight ? "00" : "01";
1222 } else if (scrollTop + offsetHeight >= scrollHeight) {
1223 status = "10";
1224 }
1225 if (status !== "11" && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) {
1226 preventDefault(event, true);
1227 }
1228 };
1229 const lock = () => {
1230 document.addEventListener("touchstart", touch.start);
1231 document.addEventListener("touchmove", onTouchMove, { passive: false });
1232 if (!totalLockCount) {
1233 document.body.classList.add(BODY_LOCK_CLASS);
1234 }
1235 totalLockCount++;
1236 };
1237 const unlock = () => {
1238 if (totalLockCount) {
1239 document.removeEventListener("touchstart", touch.start);
1240 document.removeEventListener("touchmove", onTouchMove);
1241 totalLockCount--;
1242 if (!totalLockCount) {
1243 document.body.classList.remove(BODY_LOCK_CLASS);
1244 }
1245 }
1246 };
1247 const init = () => shouldLock() && lock();
1248 const destroy = () => shouldLock() && unlock();
1249 use.onMountedOrActivated(init);
1250 vue.onDeactivated(destroy);
1251 vue.onBeforeUnmount(destroy);
1252 vue.watch(shouldLock, (value) => {
1253 value ? lock() : unlock();
1254 });
1255}
1256function useLazyRender(show) {
1257 const inited = vue.ref(false);
1258 vue.watch(
1259 show,
1260 (value) => {
1261 if (value) {
1262 inited.value = value;
1263 }
1264 },
1265 { immediate: true }
1266 );
1267 return (render) => () => inited.value ? render() : null;
1268}
1269const useScopeId = () => {
1270 var _a;
1271 const { scopeId } = ((_a = vue.getCurrentInstance()) == null ? void 0 : _a.vnode) || {};
1272 return scopeId ? { [scopeId]: "" } : null;
1273};
1274const [name$1C, bem$1x] = createNamespace("overlay");
1275const overlayProps = {
1276 show: Boolean,
1277 zIndex: numericProp,
1278 duration: numericProp,
1279 className: unknownProp,
1280 lockScroll: truthProp,
1281 lazyRender: truthProp,
1282 customStyle: Object
1283};
1284var stdin_default$1L = vue.defineComponent({
1285 name: name$1C,
1286 props: overlayProps,
1287 setup(props2, {
1288 slots
1289 }) {
1290 const root = vue.ref();
1291 const lazyRender = useLazyRender(() => props2.show || !props2.lazyRender);
1292 const onTouchMove = (event) => {
1293 if (props2.lockScroll) {
1294 preventDefault(event, true);
1295 }
1296 };
1297 const renderOverlay = lazyRender(() => {
1298 var _a;
1299 const style = extend(getZIndexStyle(props2.zIndex), props2.customStyle);
1300 if (isDef(props2.duration)) {
1301 style.animationDuration = `${props2.duration}s`;
1302 }
1303 return vue.withDirectives(vue.createVNode("div", {
1304 "ref": root,
1305 "style": style,
1306 "class": [bem$1x(), props2.className]
1307 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[vue.vShow, props2.show]]);
1308 });
1309 use.useEventListener("touchmove", onTouchMove, {
1310 target: root
1311 });
1312 return () => vue.createVNode(vue.Transition, {
1313 "name": "van-fade",
1314 "appear": true
1315 }, {
1316 default: renderOverlay
1317 });
1318 }
1319});
1320const Overlay = withInstall(stdin_default$1L);
1321const popupProps$2 = extend({}, popupSharedProps, {
1322 round: Boolean,
1323 position: makeStringProp("center"),
1324 closeIcon: makeStringProp("cross"),
1325 closeable: Boolean,
1326 transition: String,
1327 iconPrefix: String,
1328 closeOnPopstate: Boolean,
1329 closeIconPosition: makeStringProp("top-right"),
1330 safeAreaInsetTop: Boolean,
1331 safeAreaInsetBottom: Boolean
1332});
1333const [name$1B, bem$1w] = createNamespace("popup");
1334var stdin_default$1K = vue.defineComponent({
1335 name: name$1B,
1336 inheritAttrs: false,
1337 props: popupProps$2,
1338 emits: ["open", "close", "opened", "closed", "keydown", "update:show", "clickOverlay", "clickCloseIcon"],
1339 setup(props2, {
1340 emit,
1341 attrs,
1342 slots
1343 }) {
1344 let opened;
1345 let shouldReopen;
1346 const zIndex = vue.ref();
1347 const popupRef = vue.ref();
1348 const lazyRender = useLazyRender(() => props2.show || !props2.lazyRender);
1349 const style = vue.computed(() => {
1350 const style2 = {
1351 zIndex: zIndex.value
1352 };
1353 if (isDef(props2.duration)) {
1354 const key = props2.position === "center" ? "animationDuration" : "transitionDuration";
1355 style2[key] = `${props2.duration}s`;
1356 }
1357 return style2;
1358 });
1359 const open = () => {
1360 if (!opened) {
1361 opened = true;
1362 zIndex.value = props2.zIndex !== void 0 ? +props2.zIndex : useGlobalZIndex();
1363 emit("open");
1364 }
1365 };
1366 const close = () => {
1367 if (opened) {
1368 callInterceptor(props2.beforeClose, {
1369 done() {
1370 opened = false;
1371 emit("close");
1372 emit("update:show", false);
1373 }
1374 });
1375 }
1376 };
1377 const onClickOverlay = (event) => {
1378 emit("clickOverlay", event);
1379 if (props2.closeOnClickOverlay) {
1380 close();
1381 }
1382 };
1383 const renderOverlay = () => {
1384 if (props2.overlay) {
1385 return vue.createVNode(Overlay, vue.mergeProps({
1386 "show": props2.show,
1387 "class": props2.overlayClass,
1388 "zIndex": zIndex.value,
1389 "duration": props2.duration,
1390 "customStyle": props2.overlayStyle,
1391 "role": props2.closeOnClickOverlay ? "button" : void 0,
1392 "tabindex": props2.closeOnClickOverlay ? 0 : void 0
1393 }, useScopeId(), {
1394 "onClick": onClickOverlay
1395 }), {
1396 default: slots["overlay-content"]
1397 });
1398 }
1399 };
1400 const onClickCloseIcon = (event) => {
1401 emit("clickCloseIcon", event);
1402 close();
1403 };
1404 const renderCloseIcon = () => {
1405 if (props2.closeable) {
1406 return vue.createVNode(Icon, {
1407 "role": "button",
1408 "tabindex": 0,
1409 "name": props2.closeIcon,
1410 "class": [bem$1w("close-icon", props2.closeIconPosition), HAPTICS_FEEDBACK],
1411 "classPrefix": props2.iconPrefix,
1412 "onClick": onClickCloseIcon
1413 }, null);
1414 }
1415 };
1416 let timer2;
1417 const onOpened = () => {
1418 if (timer2)
1419 clearTimeout(timer2);
1420 timer2 = setTimeout(() => {
1421 emit("opened");
1422 });
1423 };
1424 const onClosed = () => emit("closed");
1425 const onKeydown = (event) => emit("keydown", event);
1426 const renderPopup = lazyRender(() => {
1427 var _a;
1428 const {
1429 round,
1430 position,
1431 safeAreaInsetTop,
1432 safeAreaInsetBottom
1433 } = props2;
1434 return vue.withDirectives(vue.createVNode("div", vue.mergeProps({
1435 "ref": popupRef,
1436 "style": style.value,
1437 "role": "dialog",
1438 "tabindex": 0,
1439 "class": [bem$1w({
1440 round,
1441 [position]: position
1442 }), {
1443 "van-safe-area-top": safeAreaInsetTop,
1444 "van-safe-area-bottom": safeAreaInsetBottom
1445 }],
1446 "onKeydown": onKeydown
1447 }, attrs, useScopeId()), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[vue.vShow, props2.show]]);
1448 });
1449 const renderTransition = () => {
1450 const {
1451 position,
1452 transition,
1453 transitionAppear
1454 } = props2;
1455 const name2 = position === "center" ? "van-fade" : `van-popup-slide-${position}`;
1456 return vue.createVNode(vue.Transition, {
1457 "name": transition || name2,
1458 "appear": transitionAppear,
1459 "onAfterEnter": onOpened,
1460 "onAfterLeave": onClosed
1461 }, {
1462 default: renderPopup
1463 });
1464 };
1465 vue.watch(() => props2.show, (show) => {
1466 if (show && !opened) {
1467 open();
1468 if (attrs.tabindex === 0) {
1469 vue.nextTick(() => {
1470 var _a;
1471 (_a = popupRef.value) == null ? void 0 : _a.focus();
1472 });
1473 }
1474 }
1475 if (!show && opened) {
1476 opened = false;
1477 emit("close");
1478 }
1479 });
1480 useExpose({
1481 popupRef
1482 });
1483 useLockScroll(popupRef, () => props2.show && props2.lockScroll);
1484 use.useEventListener("popstate", () => {
1485 if (props2.closeOnPopstate) {
1486 close();
1487 shouldReopen = false;
1488 }
1489 });
1490 vue.onMounted(() => {
1491 if (props2.show) {
1492 open();
1493 }
1494 });
1495 vue.onActivated(() => {
1496 if (shouldReopen) {
1497 emit("update:show", true);
1498 shouldReopen = false;
1499 }
1500 });
1501 vue.onDeactivated(() => {
1502 if (props2.show && props2.teleport) {
1503 close();
1504 shouldReopen = true;
1505 }
1506 });
1507 vue.provide(POPUP_TOGGLE_KEY, () => props2.show);
1508 return () => {
1509 if (props2.teleport) {
1510 return vue.createVNode(vue.Teleport, {
1511 "to": props2.teleport
1512 }, {
1513 default: () => [renderOverlay(), renderTransition()]
1514 });
1515 }
1516 return vue.createVNode(vue.Fragment, null, [renderOverlay(), renderTransition()]);
1517 };
1518 }
1519});
1520const Popup = withInstall(stdin_default$1K);
1521const [name$1A, bem$1v] = createNamespace("action-sheet");
1522const actionSheetProps = extend({}, popupSharedProps, {
1523 title: String,
1524 round: truthProp,
1525 actions: makeArrayProp(),
1526 closeIcon: makeStringProp("cross"),
1527 closeable: truthProp,
1528 cancelText: String,
1529 description: String,
1530 closeOnPopstate: truthProp,
1531 closeOnClickAction: Boolean,
1532 safeAreaInsetBottom: truthProp
1533});
1534const popupInheritKeys$2 = [...popupSharedPropKeys, "round", "closeOnPopstate", "safeAreaInsetBottom"];
1535var stdin_default$1J = vue.defineComponent({
1536 name: name$1A,
1537 props: actionSheetProps,
1538 emits: ["select", "cancel", "update:show"],
1539 setup(props2, {
1540 slots,
1541 emit
1542 }) {
1543 const updateShow = (show) => emit("update:show", show);
1544 const onCancel = () => {
1545 updateShow(false);
1546 emit("cancel");
1547 };
1548 const renderHeader = () => {
1549 if (props2.title) {
1550 return vue.createVNode("div", {
1551 "class": bem$1v("header")
1552 }, [props2.title, props2.closeable && vue.createVNode(Icon, {
1553 "name": props2.closeIcon,
1554 "class": [bem$1v("close"), HAPTICS_FEEDBACK],
1555 "onClick": onCancel
1556 }, null)]);
1557 }
1558 };
1559 const renderCancel = () => {
1560 if (slots.cancel || props2.cancelText) {
1561 return [vue.createVNode("div", {
1562 "class": bem$1v("gap")
1563 }, null), vue.createVNode("button", {
1564 "type": "button",
1565 "class": bem$1v("cancel"),
1566 "onClick": onCancel
1567 }, [slots.cancel ? slots.cancel() : props2.cancelText])];
1568 }
1569 };
1570 const renderIcon = (action) => {
1571 if (action.icon) {
1572 return vue.createVNode(Icon, {
1573 "class": bem$1v("item-icon"),
1574 "name": action.icon
1575 }, null);
1576 }
1577 };
1578 const renderActionContent = (action, index) => {
1579 if (action.loading) {
1580 return vue.createVNode(Loading, {
1581 "class": bem$1v("loading-icon")
1582 }, null);
1583 }
1584 if (slots.action) {
1585 return slots.action({
1586 action,
1587 index
1588 });
1589 }
1590 return [vue.createVNode("span", {
1591 "class": bem$1v("name")
1592 }, [action.name]), action.subname && vue.createVNode("div", {
1593 "class": bem$1v("subname")
1594 }, [action.subname])];
1595 };
1596 const renderAction = (action, index) => {
1597 const {
1598 color,
1599 loading,
1600 callback,
1601 disabled,
1602 className
1603 } = action;
1604 const onClick = () => {
1605 if (disabled || loading) {
1606 return;
1607 }
1608 if (callback) {
1609 callback(action);
1610 }
1611 if (props2.closeOnClickAction) {
1612 updateShow(false);
1613 }
1614 vue.nextTick(() => emit("select", action, index));
1615 };
1616 return vue.createVNode("button", {
1617 "type": "button",
1618 "style": {
1619 color
1620 },
1621 "class": [bem$1v("item", {
1622 loading,
1623 disabled
1624 }), className],
1625 "onClick": onClick
1626 }, [renderIcon(action), renderActionContent(action, index)]);
1627 };
1628 const renderDescription = () => {
1629 if (props2.description || slots.description) {
1630 const content = slots.description ? slots.description() : props2.description;
1631 return vue.createVNode("div", {
1632 "class": bem$1v("description")
1633 }, [content]);
1634 }
1635 };
1636 return () => vue.createVNode(Popup, vue.mergeProps({
1637 "class": bem$1v(),
1638 "position": "bottom",
1639 "onUpdate:show": updateShow
1640 }, pick(props2, popupInheritKeys$2)), {
1641 default: () => {
1642 var _a;
1643 return [renderHeader(), renderDescription(), vue.createVNode("div", {
1644 "class": bem$1v("content")
1645 }, [props2.actions.map(renderAction), (_a = slots.default) == null ? void 0 : _a.call(slots)]), renderCancel()];
1646 }
1647 });
1648 }
1649});
1650const ActionSheet = withInstall(stdin_default$1J);
1651const [name$1z, bem$1u, t$k] = createNamespace("picker");
1652const getFirstEnabledOption = (options) => options.find((option) => !option.disabled) || options[0];
1653function getColumnsType(columns, fields) {
1654 const firstColumn = columns[0];
1655 if (firstColumn) {
1656 if (Array.isArray(firstColumn)) {
1657 return "multiple";
1658 }
1659 if (fields.children in firstColumn) {
1660 return "cascade";
1661 }
1662 }
1663 return "default";
1664}
1665function findIndexOfEnabledOption(options, index) {
1666 index = clamp(index, 0, options.length);
1667 for (let i = index; i < options.length; i++) {
1668 if (!options[i].disabled)
1669 return i;
1670 }
1671 for (let i = index - 1; i >= 0; i--) {
1672 if (!options[i].disabled)
1673 return i;
1674 }
1675 return 0;
1676}
1677const isOptionExist = (options, value, fields) => value !== void 0 && !!options.find((option) => option[fields.value] === value);
1678function findOptionByValue(options, value, fields) {
1679 const index = options.findIndex((option) => option[fields.value] === value);
1680 const enabledIndex = findIndexOfEnabledOption(options, index);
1681 return options[enabledIndex];
1682}
1683function formatCascadeColumns(columns, fields, selectedValues) {
1684 const formatted = [];
1685 let cursor = {
1686 [fields.children]: columns
1687 };
1688 let columnIndex = 0;
1689 while (cursor && cursor[fields.children]) {
1690 const options = cursor[fields.children];
1691 const value = selectedValues.value[columnIndex];
1692 cursor = isDef(value) ? findOptionByValue(options, value, fields) : void 0;
1693 if (!cursor && options.length) {
1694 const firstValue = getFirstEnabledOption(options)[fields.value];
1695 cursor = findOptionByValue(options, firstValue, fields);
1696 }
1697 columnIndex++;
1698 formatted.push(options);
1699 }
1700 return formatted;
1701}
1702function getElementTranslateY(element) {
1703 const { transform } = window.getComputedStyle(element);
1704 const translateY = transform.slice(7, transform.length - 1).split(", ")[5];
1705 return Number(translateY);
1706}
1707function assignDefaultFields(fields) {
1708 return extend(
1709 {
1710 text: "text",
1711 value: "value",
1712 children: "children"
1713 },
1714 fields
1715 );
1716}
1717const DEFAULT_DURATION = 200;
1718const MOMENTUM_TIME = 300;
1719const MOMENTUM_DISTANCE = 15;
1720const [name$1y, bem$1t] = createNamespace("picker-column");
1721const PICKER_KEY = Symbol(name$1y);
1722var stdin_default$1I = vue.defineComponent({
1723 name: name$1y,
1724 props: {
1725 value: numericProp,
1726 fields: makeRequiredProp(Object),
1727 options: makeArrayProp(),
1728 readonly: Boolean,
1729 allowHtml: Boolean,
1730 optionHeight: makeRequiredProp(Number),
1731 swipeDuration: makeRequiredProp(numericProp),
1732 visibleOptionNum: makeRequiredProp(numericProp)
1733 },
1734 emits: ["change", "clickOption", "scrollInto"],
1735 setup(props2, {
1736 emit,
1737 slots
1738 }) {
1739 let moving;
1740 let startOffset;
1741 let touchStartTime;
1742 let momentumOffset;
1743 let transitionEndTrigger;
1744 const root = vue.ref();
1745 const wrapper = vue.ref();
1746 const currentOffset = vue.ref(0);
1747 const currentDuration = vue.ref(0);
1748 const touch = useTouch();
1749 const count = () => props2.options.length;
1750 const baseOffset = () => props2.optionHeight * (+props2.visibleOptionNum - 1) / 2;
1751 const updateValueByIndex = (index) => {
1752 let enabledIndex = findIndexOfEnabledOption(props2.options, index);
1753 const offset = -enabledIndex * props2.optionHeight;
1754 const trigger = () => {
1755 if (enabledIndex > count() - 1) {
1756 enabledIndex = findIndexOfEnabledOption(props2.options, index);
1757 }
1758 const value = props2.options[enabledIndex][props2.fields.value];
1759 if (value !== props2.value) {
1760 emit("change", value);
1761 }
1762 };
1763 if (moving && offset !== currentOffset.value) {
1764 transitionEndTrigger = trigger;
1765 } else {
1766 trigger();
1767 }
1768 currentOffset.value = offset;
1769 };
1770 const isReadonly = () => props2.readonly || !props2.options.length;
1771 const onClickOption = (index) => {
1772 if (moving || isReadonly()) {
1773 return;
1774 }
1775 transitionEndTrigger = null;
1776 currentDuration.value = DEFAULT_DURATION;
1777 updateValueByIndex(index);
1778 emit("clickOption", props2.options[index]);
1779 };
1780 const getIndexByOffset = (offset) => clamp(Math.round(-offset / props2.optionHeight), 0, count() - 1);
1781 const currentIndex = vue.computed(() => getIndexByOffset(currentOffset.value));
1782 const momentum = (distance, duration) => {
1783 const speed = Math.abs(distance / duration);
1784 distance = currentOffset.value + speed / 3e-3 * (distance < 0 ? -1 : 1);
1785 const index = getIndexByOffset(distance);
1786 currentDuration.value = +props2.swipeDuration;
1787 updateValueByIndex(index);
1788 };
1789 const stopMomentum = () => {
1790 moving = false;
1791 currentDuration.value = 0;
1792 if (transitionEndTrigger) {
1793 transitionEndTrigger();
1794 transitionEndTrigger = null;
1795 }
1796 };
1797 const onTouchStart = (event) => {
1798 if (isReadonly()) {
1799 return;
1800 }
1801 touch.start(event);
1802 if (moving) {
1803 const translateY = getElementTranslateY(wrapper.value);
1804 currentOffset.value = Math.min(0, translateY - baseOffset());
1805 }
1806 currentDuration.value = 0;
1807 startOffset = currentOffset.value;
1808 touchStartTime = Date.now();
1809 momentumOffset = startOffset;
1810 transitionEndTrigger = null;
1811 };
1812 const onTouchMove = (event) => {
1813 if (isReadonly()) {
1814 return;
1815 }
1816 touch.move(event);
1817 if (touch.isVertical()) {
1818 moving = true;
1819 preventDefault(event, true);
1820 }
1821 const newOffset = clamp(startOffset + touch.deltaY.value, -(count() * props2.optionHeight), props2.optionHeight);
1822 const newIndex = getIndexByOffset(newOffset);
1823 if (newIndex !== currentIndex.value) {
1824 emit("scrollInto", props2.options[newIndex]);
1825 }
1826 currentOffset.value = newOffset;
1827 const now = Date.now();
1828 if (now - touchStartTime > MOMENTUM_TIME) {
1829 touchStartTime = now;
1830 momentumOffset = newOffset;
1831 }
1832 };
1833 const onTouchEnd = () => {
1834 if (isReadonly()) {
1835 return;
1836 }
1837 const distance = currentOffset.value - momentumOffset;
1838 const duration = Date.now() - touchStartTime;
1839 const startMomentum = duration < MOMENTUM_TIME && Math.abs(distance) > MOMENTUM_DISTANCE;
1840 if (startMomentum) {
1841 momentum(distance, duration);
1842 return;
1843 }
1844 const index = getIndexByOffset(currentOffset.value);
1845 currentDuration.value = DEFAULT_DURATION;
1846 updateValueByIndex(index);
1847 setTimeout(() => {
1848 moving = false;
1849 }, 0);
1850 };
1851 const renderOptions = () => {
1852 const optionStyle = {
1853 height: `${props2.optionHeight}px`
1854 };
1855 return props2.options.map((option, index) => {
1856 const text = option[props2.fields.text];
1857 const {
1858 disabled
1859 } = option;
1860 const value = option[props2.fields.value];
1861 const data = {
1862 role: "button",
1863 style: optionStyle,
1864 tabindex: disabled ? -1 : 0,
1865 class: [bem$1t("item", {
1866 disabled,
1867 selected: value === props2.value
1868 }), option.className],
1869 onClick: () => onClickOption(index)
1870 };
1871 const childData = {
1872 class: "van-ellipsis",
1873 [props2.allowHtml ? "innerHTML" : "textContent"]: text
1874 };
1875 return vue.createVNode("li", data, [slots.option ? slots.option(option, index) : vue.createVNode("div", childData, null)]);
1876 });
1877 };
1878 use.useParent(PICKER_KEY);
1879 useExpose({
1880 stopMomentum
1881 });
1882 vue.watchEffect(() => {
1883 const index = moving ? Math.floor(-currentOffset.value / props2.optionHeight) : props2.options.findIndex((option) => option[props2.fields.value] === props2.value);
1884 const enabledIndex = findIndexOfEnabledOption(props2.options, index);
1885 const offset = -enabledIndex * props2.optionHeight;
1886 if (moving && enabledIndex < index)
1887 stopMomentum();
1888 currentOffset.value = offset;
1889 });
1890 use.useEventListener("touchmove", onTouchMove, {
1891 target: root
1892 });
1893 return () => vue.createVNode("div", {
1894 "ref": root,
1895 "class": bem$1t(),
1896 "onTouchstartPassive": onTouchStart,
1897 "onTouchend": onTouchEnd,
1898 "onTouchcancel": onTouchEnd
1899 }, [vue.createVNode("ul", {
1900 "ref": wrapper,
1901 "style": {
1902 transform: `translate3d(0, ${currentOffset.value + baseOffset()}px, 0)`,
1903 transitionDuration: `${currentDuration.value}ms`,
1904 transitionProperty: currentDuration.value ? "all" : "none"
1905 },
1906 "class": bem$1t("wrapper"),
1907 "onTransitionend": stopMomentum
1908 }, [renderOptions()])]);
1909 }
1910});
1911const [name$1x] = createNamespace("picker-toolbar");
1912const pickerToolbarProps = {
1913 title: String,
1914 cancelButtonText: String,
1915 confirmButtonText: String
1916};
1917const pickerToolbarSlots = ["cancel", "confirm", "title", "toolbar"];
1918const pickerToolbarPropKeys = Object.keys(pickerToolbarProps);
1919var stdin_default$1H = vue.defineComponent({
1920 name: name$1x,
1921 props: pickerToolbarProps,
1922 emits: ["confirm", "cancel"],
1923 setup(props2, {
1924 emit,
1925 slots
1926 }) {
1927 const renderTitle = () => {
1928 if (slots.title) {
1929 return slots.title();
1930 }
1931 if (props2.title) {
1932 return vue.createVNode("div", {
1933 "class": [bem$1u("title"), "van-ellipsis"]
1934 }, [props2.title]);
1935 }
1936 };
1937 const onCancel = () => emit("cancel");
1938 const onConfirm = () => emit("confirm");
1939 const renderCancel = () => {
1940 var _a;
1941 const text = (_a = props2.cancelButtonText) != null ? _a : t$k("cancel");
1942 if (!slots.cancel && !text) {
1943 return;
1944 }
1945 return vue.createVNode("button", {
1946 "type": "button",
1947 "class": [bem$1u("cancel"), HAPTICS_FEEDBACK],
1948 "onClick": onCancel
1949 }, [slots.cancel ? slots.cancel() : text]);
1950 };
1951 const renderConfirm = () => {
1952 var _a;
1953 const text = (_a = props2.confirmButtonText) != null ? _a : t$k("confirm");
1954 if (!slots.confirm && !text) {
1955 return;
1956 }
1957 return vue.createVNode("button", {
1958 "type": "button",
1959 "class": [bem$1u("confirm"), HAPTICS_FEEDBACK],
1960 "onClick": onConfirm
1961 }, [slots.confirm ? slots.confirm() : text]);
1962 };
1963 return () => vue.createVNode("div", {
1964 "class": bem$1u("toolbar")
1965 }, [slots.toolbar ? slots.toolbar() : [renderCancel(), renderTitle(), renderConfirm()]]);
1966 }
1967});
1968const useSyncPropRef = (getProp, setProp) => {
1969 const propRef = vue.ref(getProp());
1970 vue.watch(getProp, (value) => {
1971 if (value !== propRef.value) {
1972 propRef.value = value;
1973 }
1974 });
1975 vue.watch(propRef, (value) => {
1976 if (value !== getProp()) {
1977 setProp(value);
1978 }
1979 });
1980 return propRef;
1981};
1982function scrollLeftTo(scroller, to, duration) {
1983 let rafId;
1984 let count = 0;
1985 const from = scroller.scrollLeft;
1986 const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
1987 function cancel() {
1988 use.cancelRaf(rafId);
1989 }
1990 function animate() {
1991 scroller.scrollLeft += (to - from) / frames;
1992 if (++count < frames) {
1993 rafId = use.raf(animate);
1994 }
1995 }
1996 animate();
1997 return cancel;
1998}
1999function scrollTopTo(scroller, to, duration, callback) {
2000 let rafId;
2001 let current2 = getScrollTop(scroller);
2002 const isDown = current2 < to;
2003 const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
2004 const step = (to - current2) / frames;
2005 function cancel() {
2006 use.cancelRaf(rafId);
2007 }
2008 function animate() {
2009 current2 += step;
2010 if (isDown && current2 > to || !isDown && current2 < to) {
2011 current2 = to;
2012 }
2013 setScrollTop(scroller, current2);
2014 if (isDown && current2 < to || !isDown && current2 > to) {
2015 rafId = use.raf(animate);
2016 } else if (callback) {
2017 rafId = use.raf(callback);
2018 }
2019 }
2020 animate();
2021 return cancel;
2022}
2023let current = 0;
2024function useId() {
2025 const vm = vue.getCurrentInstance();
2026 const { name: name2 = "unknown" } = (vm == null ? void 0 : vm.type) || {};
2027 if (process.env.NODE_ENV === "test") {
2028 return name2;
2029 }
2030 return `${name2}-${++current}`;
2031}
2032function useRefs() {
2033 const refs = vue.ref([]);
2034 const cache = [];
2035 vue.onBeforeUpdate(() => {
2036 refs.value = [];
2037 });
2038 const setRefs = (index) => {
2039 if (!cache[index]) {
2040 cache[index] = (el) => {
2041 refs.value[index] = el;
2042 };
2043 }
2044 return cache[index];
2045 };
2046 return [refs, setRefs];
2047}
2048function useVisibilityChange(target, onChange) {
2049 if (!inBrowser || !window.IntersectionObserver) {
2050 return;
2051 }
2052 const observer = new IntersectionObserver(
2053 (entries) => {
2054 onChange(entries[0].intersectionRatio > 0);
2055 },
2056 { root: document.body }
2057 );
2058 const observe = () => {
2059 if (target.value) {
2060 observer.observe(target.value);
2061 }
2062 };
2063 const unobserve = () => {
2064 if (target.value) {
2065 observer.unobserve(target.value);
2066 }
2067 };
2068 vue.onDeactivated(unobserve);
2069 vue.onBeforeUnmount(unobserve);
2070 use.onMountedOrActivated(observe);
2071}
2072const [name$1w, bem$1s] = createNamespace("sticky");
2073const stickyProps = {
2074 zIndex: numericProp,
2075 position: makeStringProp("top"),
2076 container: Object,
2077 offsetTop: makeNumericProp(0),
2078 offsetBottom: makeNumericProp(0)
2079};
2080var stdin_default$1G = vue.defineComponent({
2081 name: name$1w,
2082 props: stickyProps,
2083 emits: ["scroll", "change"],
2084 setup(props2, {
2085 emit,
2086 slots
2087 }) {
2088 const root = vue.ref();
2089 const scrollParent = use.useScrollParent(root);
2090 const state = vue.reactive({
2091 fixed: false,
2092 width: 0,
2093 // root width
2094 height: 0,
2095 // root height
2096 transform: 0
2097 });
2098 const isReset = vue.ref(false);
2099 const offset = vue.computed(() => unitToPx(props2.position === "top" ? props2.offsetTop : props2.offsetBottom));
2100 const rootStyle = vue.computed(() => {
2101 if (isReset.value) {
2102 return;
2103 }
2104 const {
2105 fixed,
2106 height,
2107 width
2108 } = state;
2109 if (fixed) {
2110 return {
2111 width: `${width}px`,
2112 height: `${height}px`
2113 };
2114 }
2115 });
2116 const stickyStyle = vue.computed(() => {
2117 if (!state.fixed || isReset.value) {
2118 return;
2119 }
2120 const style = extend(getZIndexStyle(props2.zIndex), {
2121 width: `${state.width}px`,
2122 height: `${state.height}px`,
2123 [props2.position]: `${offset.value}px`
2124 });
2125 if (state.transform) {
2126 style.transform = `translate3d(0, ${state.transform}px, 0)`;
2127 }
2128 return style;
2129 });
2130 const emitScroll = (scrollTop) => emit("scroll", {
2131 scrollTop,
2132 isFixed: state.fixed
2133 });
2134 const onScroll = () => {
2135 if (!root.value || isHidden(root)) {
2136 return;
2137 }
2138 const {
2139 container,
2140 position
2141 } = props2;
2142 const rootRect = use.useRect(root);
2143 const scrollTop = getScrollTop(window);
2144 state.width = rootRect.width;
2145 state.height = rootRect.height;
2146 if (position === "top") {
2147 if (container) {
2148 const containerRect = use.useRect(container);
2149 const difference = containerRect.bottom - offset.value - state.height;
2150 state.fixed = offset.value > rootRect.top && containerRect.bottom > 0;
2151 state.transform = difference < 0 ? difference : 0;
2152 } else {
2153 state.fixed = offset.value > rootRect.top;
2154 }
2155 } else {
2156 const {
2157 clientHeight
2158 } = document.documentElement;
2159 if (container) {
2160 const containerRect = use.useRect(container);
2161 const difference = clientHeight - containerRect.top - offset.value - state.height;
2162 state.fixed = clientHeight - offset.value < rootRect.bottom && clientHeight > containerRect.top;
2163 state.transform = difference < 0 ? -difference : 0;
2164 } else {
2165 state.fixed = clientHeight - offset.value < rootRect.bottom;
2166 }
2167 }
2168 emitScroll(scrollTop);
2169 };
2170 vue.watch(() => state.fixed, (value) => emit("change", value));
2171 use.useEventListener("scroll", onScroll, {
2172 target: scrollParent,
2173 passive: true
2174 });
2175 useVisibilityChange(root, onScroll);
2176 vue.watch([windowWidth, windowHeight], () => {
2177 if (!root.value || isHidden(root) || !state.fixed) {
2178 return;
2179 }
2180 isReset.value = true;
2181 vue.nextTick(() => {
2182 const rootRect = use.useRect(root);
2183 state.width = rootRect.width;
2184 state.height = rootRect.height;
2185 isReset.value = false;
2186 });
2187 });
2188 return () => {
2189 var _a;
2190 return vue.createVNode("div", {
2191 "ref": root,
2192 "style": rootStyle.value
2193 }, [vue.createVNode("div", {
2194 "class": bem$1s({
2195 fixed: state.fixed && !isReset.value
2196 }),
2197 "style": stickyStyle.value
2198 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
2199 };
2200 }
2201});
2202const Sticky = withInstall(stdin_default$1G);
2203const [name$1v, bem$1r] = createNamespace("swipe");
2204const swipeProps = {
2205 loop: truthProp,
2206 width: numericProp,
2207 height: numericProp,
2208 vertical: Boolean,
2209 autoplay: makeNumericProp(0),
2210 duration: makeNumericProp(500),
2211 touchable: truthProp,
2212 lazyRender: Boolean,
2213 initialSwipe: makeNumericProp(0),
2214 indicatorColor: String,
2215 showIndicators: truthProp,
2216 stopPropagation: truthProp
2217};
2218const SWIPE_KEY = Symbol(name$1v);
2219var stdin_default$1F = vue.defineComponent({
2220 name: name$1v,
2221 props: swipeProps,
2222 emits: ["change", "dragStart", "dragEnd"],
2223 setup(props2, {
2224 emit,
2225 slots
2226 }) {
2227 const root = vue.ref();
2228 const track = vue.ref();
2229 const state = vue.reactive({
2230 rect: null,
2231 width: 0,
2232 height: 0,
2233 offset: 0,
2234 active: 0,
2235 swiping: false
2236 });
2237 let dragging = false;
2238 const touch = useTouch();
2239 const {
2240 children,
2241 linkChildren
2242 } = use.useChildren(SWIPE_KEY);
2243 const count = vue.computed(() => children.length);
2244 const size = vue.computed(() => state[props2.vertical ? "height" : "width"]);
2245 const delta = vue.computed(() => props2.vertical ? touch.deltaY.value : touch.deltaX.value);
2246 const minOffset = vue.computed(() => {
2247 if (state.rect) {
2248 const base = props2.vertical ? state.rect.height : state.rect.width;
2249 return base - size.value * count.value;
2250 }
2251 return 0;
2252 });
2253 const maxCount = vue.computed(() => size.value ? Math.ceil(Math.abs(minOffset.value) / size.value) : count.value);
2254 const trackSize = vue.computed(() => count.value * size.value);
2255 const activeIndicator = vue.computed(() => (state.active + count.value) % count.value);
2256 const isCorrectDirection = vue.computed(() => {
2257 const expect = props2.vertical ? "vertical" : "horizontal";
2258 return touch.direction.value === expect;
2259 });
2260 const trackStyle = vue.computed(() => {
2261 const style = {
2262 transitionDuration: `${state.swiping ? 0 : props2.duration}ms`,
2263 transform: `translate${props2.vertical ? "Y" : "X"}(${+state.offset.toFixed(2)}px)`
2264 };
2265 if (size.value) {
2266 const mainAxis = props2.vertical ? "height" : "width";
2267 const crossAxis = props2.vertical ? "width" : "height";
2268 style[mainAxis] = `${trackSize.value}px`;
2269 style[crossAxis] = props2[crossAxis] ? `${props2[crossAxis]}px` : "";
2270 }
2271 return style;
2272 });
2273 const getTargetActive = (pace) => {
2274 const {
2275 active
2276 } = state;
2277 if (pace) {
2278 if (props2.loop) {
2279 return clamp(active + pace, -1, count.value);
2280 }
2281 return clamp(active + pace, 0, maxCount.value);
2282 }
2283 return active;
2284 };
2285 const getTargetOffset = (targetActive, offset = 0) => {
2286 let currentPosition = targetActive * size.value;
2287 if (!props2.loop) {
2288 currentPosition = Math.min(currentPosition, -minOffset.value);
2289 }
2290 let targetOffset = offset - currentPosition;
2291 if (!props2.loop) {
2292 targetOffset = clamp(targetOffset, minOffset.value, 0);
2293 }
2294 return targetOffset;
2295 };
2296 const move = ({
2297 pace = 0,
2298 offset = 0,
2299 emitChange
2300 }) => {
2301 if (count.value <= 1) {
2302 return;
2303 }
2304 const {
2305 active
2306 } = state;
2307 const targetActive = getTargetActive(pace);
2308 const targetOffset = getTargetOffset(targetActive, offset);
2309 if (props2.loop) {
2310 if (children[0] && targetOffset !== minOffset.value) {
2311 const outRightBound = targetOffset < minOffset.value;
2312 children[0].setOffset(outRightBound ? trackSize.value : 0);
2313 }
2314 if (children[count.value - 1] && targetOffset !== 0) {
2315 const outLeftBound = targetOffset > 0;
2316 children[count.value - 1].setOffset(outLeftBound ? -trackSize.value : 0);
2317 }
2318 }
2319 state.active = targetActive;
2320 state.offset = targetOffset;
2321 if (emitChange && targetActive !== active) {
2322 emit("change", activeIndicator.value);
2323 }
2324 };
2325 const correctPosition = () => {
2326 state.swiping = true;
2327 if (state.active <= -1) {
2328 move({
2329 pace: count.value
2330 });
2331 } else if (state.active >= count.value) {
2332 move({
2333 pace: -count.value
2334 });
2335 }
2336 };
2337 const prev = () => {
2338 correctPosition();
2339 touch.reset();
2340 use.doubleRaf(() => {
2341 state.swiping = false;
2342 move({
2343 pace: -1,
2344 emitChange: true
2345 });
2346 });
2347 };
2348 const next = () => {
2349 correctPosition();
2350 touch.reset();
2351 use.doubleRaf(() => {
2352 state.swiping = false;
2353 move({
2354 pace: 1,
2355 emitChange: true
2356 });
2357 });
2358 };
2359 let autoplayTimer;
2360 const stopAutoplay = () => clearTimeout(autoplayTimer);
2361 const autoplay = () => {
2362 stopAutoplay();
2363 if (+props2.autoplay > 0 && count.value > 1) {
2364 autoplayTimer = setTimeout(() => {
2365 next();
2366 autoplay();
2367 }, +props2.autoplay);
2368 }
2369 };
2370 const initialize = (active = +props2.initialSwipe) => {
2371 if (!root.value) {
2372 return;
2373 }
2374 const cb = () => {
2375 var _a, _b;
2376 if (!isHidden(root)) {
2377 const rect = {
2378 width: root.value.offsetWidth,
2379 height: root.value.offsetHeight
2380 };
2381 state.rect = rect;
2382 state.width = +((_a = props2.width) != null ? _a : rect.width);
2383 state.height = +((_b = props2.height) != null ? _b : rect.height);
2384 }
2385 if (count.value) {
2386 active = Math.min(count.value - 1, active);
2387 if (active === -1) {
2388 active = count.value - 1;
2389 }
2390 }
2391 state.active = active;
2392 state.swiping = true;
2393 state.offset = getTargetOffset(active);
2394 children.forEach((swipe) => {
2395 swipe.setOffset(0);
2396 });
2397 autoplay();
2398 };
2399 if (isHidden(root)) {
2400 vue.nextTick().then(cb);
2401 } else {
2402 cb();
2403 }
2404 };
2405 const resize = () => initialize(state.active);
2406 let touchStartTime;
2407 const onTouchStart = (event) => {
2408 if (!props2.touchable || // avoid resetting position on multi-finger touch
2409 event.touches.length > 1)
2410 return;
2411 touch.start(event);
2412 dragging = false;
2413 touchStartTime = Date.now();
2414 stopAutoplay();
2415 correctPosition();
2416 };
2417 const onTouchMove = (event) => {
2418 if (props2.touchable && state.swiping) {
2419 touch.move(event);
2420 if (isCorrectDirection.value) {
2421 const isEdgeTouch = !props2.loop && (state.active === 0 && delta.value > 0 || state.active === count.value - 1 && delta.value < 0);
2422 if (!isEdgeTouch) {
2423 preventDefault(event, props2.stopPropagation);
2424 move({
2425 offset: delta.value
2426 });
2427 if (!dragging) {
2428 emit("dragStart", {
2429 index: activeIndicator.value
2430 });
2431 dragging = true;
2432 }
2433 }
2434 }
2435 }
2436 };
2437 const onTouchEnd = () => {
2438 if (!props2.touchable || !state.swiping) {
2439 return;
2440 }
2441 const duration = Date.now() - touchStartTime;
2442 const speed = delta.value / duration;
2443 const shouldSwipe = Math.abs(speed) > 0.25 || Math.abs(delta.value) > size.value / 2;
2444 if (shouldSwipe && isCorrectDirection.value) {
2445 const offset = props2.vertical ? touch.offsetY.value : touch.offsetX.value;
2446 let pace = 0;
2447 if (props2.loop) {
2448 pace = offset > 0 ? delta.value > 0 ? -1 : 1 : 0;
2449 } else {
2450 pace = -Math[delta.value > 0 ? "ceil" : "floor"](delta.value / size.value);
2451 }
2452 move({
2453 pace,
2454 emitChange: true
2455 });
2456 } else if (delta.value) {
2457 move({
2458 pace: 0
2459 });
2460 }
2461 dragging = false;
2462 state.swiping = false;
2463 emit("dragEnd", {
2464 index: activeIndicator.value
2465 });
2466 autoplay();
2467 };
2468 const swipeTo = (index, options = {}) => {
2469 correctPosition();
2470 touch.reset();
2471 use.doubleRaf(() => {
2472 let targetIndex;
2473 if (props2.loop && index === count.value) {
2474 targetIndex = state.active === 0 ? 0 : index;
2475 } else {
2476 targetIndex = index % count.value;
2477 }
2478 if (options.immediate) {
2479 use.doubleRaf(() => {
2480 state.swiping = false;
2481 });
2482 } else {
2483 state.swiping = false;
2484 }
2485 move({
2486 pace: targetIndex - state.active,
2487 emitChange: true
2488 });
2489 });
2490 };
2491 const renderDot = (_, index) => {
2492 const active = index === activeIndicator.value;
2493 const style = active ? {
2494 backgroundColor: props2.indicatorColor
2495 } : void 0;
2496 return vue.createVNode("i", {
2497 "style": style,
2498 "class": bem$1r("indicator", {
2499 active
2500 })
2501 }, null);
2502 };
2503 const renderIndicator = () => {
2504 if (slots.indicator) {
2505 return slots.indicator({
2506 active: activeIndicator.value,
2507 total: count.value
2508 });
2509 }
2510 if (props2.showIndicators && count.value > 1) {
2511 return vue.createVNode("div", {
2512 "class": bem$1r("indicators", {
2513 vertical: props2.vertical
2514 })
2515 }, [Array(count.value).fill("").map(renderDot)]);
2516 }
2517 };
2518 useExpose({
2519 prev,
2520 next,
2521 state,
2522 resize,
2523 swipeTo
2524 });
2525 linkChildren({
2526 size,
2527 props: props2,
2528 count,
2529 activeIndicator
2530 });
2531 vue.watch(() => props2.initialSwipe, (value) => initialize(+value));
2532 vue.watch(count, () => initialize(state.active));
2533 vue.watch(() => props2.autoplay, autoplay);
2534 vue.watch([windowWidth, windowHeight, () => props2.width, () => props2.height], resize);
2535 vue.watch(use.usePageVisibility(), (visible) => {
2536 if (visible === "visible") {
2537 autoplay();
2538 } else {
2539 stopAutoplay();
2540 }
2541 });
2542 vue.onMounted(initialize);
2543 vue.onActivated(() => initialize(state.active));
2544 onPopupReopen(() => initialize(state.active));
2545 vue.onDeactivated(stopAutoplay);
2546 vue.onBeforeUnmount(stopAutoplay);
2547 use.useEventListener("touchmove", onTouchMove, {
2548 target: track
2549 });
2550 return () => {
2551 var _a;
2552 return vue.createVNode("div", {
2553 "ref": root,
2554 "class": bem$1r()
2555 }, [vue.createVNode("div", {
2556 "ref": track,
2557 "style": trackStyle.value,
2558 "class": bem$1r("track", {
2559 vertical: props2.vertical
2560 }),
2561 "onTouchstartPassive": onTouchStart,
2562 "onTouchend": onTouchEnd,
2563 "onTouchcancel": onTouchEnd
2564 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), renderIndicator()]);
2565 };
2566 }
2567});
2568const Swipe = withInstall(stdin_default$1F);
2569const [name$1u, bem$1q] = createNamespace("tabs");
2570var stdin_default$1E = vue.defineComponent({
2571 name: name$1u,
2572 props: {
2573 count: makeRequiredProp(Number),
2574 inited: Boolean,
2575 animated: Boolean,
2576 duration: makeRequiredProp(numericProp),
2577 swipeable: Boolean,
2578 lazyRender: Boolean,
2579 currentIndex: makeRequiredProp(Number)
2580 },
2581 emits: ["change"],
2582 setup(props2, {
2583 emit,
2584 slots
2585 }) {
2586 const swipeRef = vue.ref();
2587 const onChange = (index) => emit("change", index);
2588 const renderChildren = () => {
2589 var _a;
2590 const Content = (_a = slots.default) == null ? void 0 : _a.call(slots);
2591 if (props2.animated || props2.swipeable) {
2592 return vue.createVNode(Swipe, {
2593 "ref": swipeRef,
2594 "loop": false,
2595 "class": bem$1q("track"),
2596 "duration": +props2.duration * 1e3,
2597 "touchable": props2.swipeable,
2598 "lazyRender": props2.lazyRender,
2599 "showIndicators": false,
2600 "onChange": onChange
2601 }, {
2602 default: () => [Content]
2603 });
2604 }
2605 return Content;
2606 };
2607 const swipeToCurrentTab = (index) => {
2608 const swipe = swipeRef.value;
2609 if (swipe && swipe.state.active !== index) {
2610 swipe.swipeTo(index, {
2611 immediate: !props2.inited
2612 });
2613 }
2614 };
2615 vue.watch(() => props2.currentIndex, swipeToCurrentTab);
2616 vue.onMounted(() => {
2617 swipeToCurrentTab(props2.currentIndex);
2618 });
2619 useExpose({
2620 swipeRef
2621 });
2622 return () => vue.createVNode("div", {
2623 "class": bem$1q("content", {
2624 animated: props2.animated || props2.swipeable
2625 })
2626 }, [renderChildren()]);
2627 }
2628});
2629const [name$1t, bem$1p] = createNamespace("tabs");
2630const tabsProps = {
2631 type: makeStringProp("line"),
2632 color: String,
2633 border: Boolean,
2634 sticky: Boolean,
2635 shrink: Boolean,
2636 active: makeNumericProp(0),
2637 duration: makeNumericProp(0.3),
2638 animated: Boolean,
2639 ellipsis: truthProp,
2640 swipeable: Boolean,
2641 scrollspy: Boolean,
2642 offsetTop: makeNumericProp(0),
2643 background: String,
2644 lazyRender: truthProp,
2645 showHeader: truthProp,
2646 lineWidth: numericProp,
2647 lineHeight: numericProp,
2648 beforeChange: Function,
2649 swipeThreshold: makeNumericProp(5),
2650 titleActiveColor: String,
2651 titleInactiveColor: String
2652};
2653const TABS_KEY = Symbol(name$1t);
2654var stdin_default$1D = vue.defineComponent({
2655 name: name$1t,
2656 props: tabsProps,
2657 emits: ["change", "scroll", "rendered", "clickTab", "update:active"],
2658 setup(props2, {
2659 emit,
2660 slots
2661 }) {
2662 let tabHeight;
2663 let lockScroll;
2664 let stickyFixed;
2665 let cancelScrollLeftToRaf;
2666 let cancelScrollTopToRaf;
2667 const root = vue.ref();
2668 const navRef = vue.ref();
2669 const wrapRef = vue.ref();
2670 const contentRef = vue.ref();
2671 const id = useId();
2672 const scroller = use.useScrollParent(root);
2673 const [titleRefs, setTitleRefs] = useRefs();
2674 const {
2675 children,
2676 linkChildren
2677 } = use.useChildren(TABS_KEY);
2678 const state = vue.reactive({
2679 inited: false,
2680 position: "",
2681 lineStyle: {},
2682 currentIndex: -1
2683 });
2684 const scrollable = vue.computed(() => children.length > +props2.swipeThreshold || !props2.ellipsis || props2.shrink);
2685 const navStyle = vue.computed(() => ({
2686 borderColor: props2.color,
2687 background: props2.background
2688 }));
2689 const getTabName = (tab, index) => {
2690 var _a;
2691 return (_a = tab.name) != null ? _a : index;
2692 };
2693 const currentName = vue.computed(() => {
2694 const activeTab = children[state.currentIndex];
2695 if (activeTab) {
2696 return getTabName(activeTab, state.currentIndex);
2697 }
2698 });
2699 const offsetTopPx = vue.computed(() => unitToPx(props2.offsetTop));
2700 const scrollOffset = vue.computed(() => {
2701 if (props2.sticky) {
2702 return offsetTopPx.value + tabHeight;
2703 }
2704 return 0;
2705 });
2706 const scrollIntoView = (immediate) => {
2707 const nav = navRef.value;
2708 const titles = titleRefs.value;
2709 if (!scrollable.value || !nav || !titles || !titles[state.currentIndex]) {
2710 return;
2711 }
2712 const title = titles[state.currentIndex].$el;
2713 const to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
2714 if (cancelScrollLeftToRaf)
2715 cancelScrollLeftToRaf();
2716 cancelScrollLeftToRaf = scrollLeftTo(nav, to, immediate ? 0 : +props2.duration);
2717 };
2718 const setLine = () => {
2719 const shouldAnimate = state.inited;
2720 vue.nextTick(() => {
2721 const titles = titleRefs.value;
2722 if (!titles || !titles[state.currentIndex] || props2.type !== "line" || isHidden(root.value)) {
2723 return;
2724 }
2725 const title = titles[state.currentIndex].$el;
2726 const {
2727 lineWidth,
2728 lineHeight
2729 } = props2;
2730 const left = title.offsetLeft + title.offsetWidth / 2;
2731 const lineStyle = {
2732 width: addUnit(lineWidth),
2733 backgroundColor: props2.color,
2734 transform: `translateX(${left}px) translateX(-50%)`
2735 };
2736 if (shouldAnimate) {
2737 lineStyle.transitionDuration = `${props2.duration}s`;
2738 }
2739 if (isDef(lineHeight)) {
2740 const height = addUnit(lineHeight);
2741 lineStyle.height = height;
2742 lineStyle.borderRadius = height;
2743 }
2744 state.lineStyle = lineStyle;
2745 });
2746 };
2747 const findAvailableTab = (index) => {
2748 const diff = index < state.currentIndex ? -1 : 1;
2749 while (index >= 0 && index < children.length) {
2750 if (!children[index].disabled) {
2751 return index;
2752 }
2753 index += diff;
2754 }
2755 };
2756 const setCurrentIndex = (currentIndex, skipScrollIntoView) => {
2757 const newIndex = findAvailableTab(currentIndex);
2758 if (!isDef(newIndex)) {
2759 return;
2760 }
2761 const newTab = children[newIndex];
2762 const newName = getTabName(newTab, newIndex);
2763 const shouldEmitChange = state.currentIndex !== null;
2764 if (state.currentIndex !== newIndex) {
2765 state.currentIndex = newIndex;
2766 if (!skipScrollIntoView) {
2767 scrollIntoView();
2768 }
2769 setLine();
2770 }
2771 if (newName !== props2.active) {
2772 emit("update:active", newName);
2773 if (shouldEmitChange) {
2774 emit("change", newName, newTab.title);
2775 }
2776 }
2777 if (stickyFixed && !props2.scrollspy) {
2778 setRootScrollTop(Math.ceil(getElementTop(root.value) - offsetTopPx.value));
2779 }
2780 };
2781 const setCurrentIndexByName = (name2, skipScrollIntoView) => {
2782 const matched = children.find((tab, index2) => getTabName(tab, index2) === name2);
2783 const index = matched ? children.indexOf(matched) : 0;
2784 setCurrentIndex(index, skipScrollIntoView);
2785 };
2786 const scrollToCurrentContent = (immediate = false) => {
2787 if (props2.scrollspy) {
2788 const target = children[state.currentIndex].$el;
2789 if (target && scroller.value) {
2790 const to = getElementTop(target, scroller.value) - scrollOffset.value;
2791 lockScroll = true;
2792 if (cancelScrollTopToRaf)
2793 cancelScrollTopToRaf();
2794 cancelScrollTopToRaf = scrollTopTo(scroller.value, to, immediate ? 0 : +props2.duration, () => {
2795 lockScroll = false;
2796 });
2797 }
2798 }
2799 };
2800 const onClickTab = (item, index, event) => {
2801 const {
2802 title,
2803 disabled
2804 } = children[index];
2805 const name2 = getTabName(children[index], index);
2806 if (!disabled) {
2807 callInterceptor(props2.beforeChange, {
2808 args: [name2],
2809 done: () => {
2810 setCurrentIndex(index);
2811 scrollToCurrentContent();
2812 }
2813 });
2814 route(item);
2815 }
2816 emit("clickTab", {
2817 name: name2,
2818 title,
2819 event,
2820 disabled
2821 });
2822 };
2823 const onStickyScroll = (params) => {
2824 stickyFixed = params.isFixed;
2825 emit("scroll", params);
2826 };
2827 const scrollTo = (name2) => {
2828 vue.nextTick(() => {
2829 setCurrentIndexByName(name2);
2830 scrollToCurrentContent(true);
2831 });
2832 };
2833 const getCurrentIndexOnScroll = () => {
2834 for (let index = 0; index < children.length; index++) {
2835 const {
2836 top
2837 } = use.useRect(children[index].$el);
2838 if (top > scrollOffset.value) {
2839 return index === 0 ? 0 : index - 1;
2840 }
2841 }
2842 return children.length - 1;
2843 };
2844 const onScroll = () => {
2845 if (props2.scrollspy && !lockScroll) {
2846 const index = getCurrentIndexOnScroll();
2847 setCurrentIndex(index);
2848 }
2849 };
2850 const renderLine = () => {
2851 if (props2.type === "line" && children.length) {
2852 return vue.createVNode("div", {
2853 "class": bem$1p("line"),
2854 "style": state.lineStyle
2855 }, null);
2856 }
2857 };
2858 const renderHeader = () => {
2859 var _a, _b, _c;
2860 const {
2861 type,
2862 border,
2863 sticky
2864 } = props2;
2865 const Header = [vue.createVNode("div", {
2866 "ref": sticky ? void 0 : wrapRef,
2867 "class": [bem$1p("wrap"), {
2868 [BORDER_TOP_BOTTOM]: type === "line" && border
2869 }]
2870 }, [vue.createVNode("div", {
2871 "ref": navRef,
2872 "role": "tablist",
2873 "class": bem$1p("nav", [type, {
2874 shrink: props2.shrink,
2875 complete: scrollable.value
2876 }]),
2877 "style": navStyle.value,
2878 "aria-orientation": "horizontal"
2879 }, [(_a = slots["nav-left"]) == null ? void 0 : _a.call(slots), children.map((item) => item.renderTitle(onClickTab)), renderLine(), (_b = slots["nav-right"]) == null ? void 0 : _b.call(slots)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots)];
2880 if (sticky) {
2881 return vue.createVNode("div", {
2882 "ref": wrapRef
2883 }, [Header]);
2884 }
2885 return Header;
2886 };
2887 const resize = () => {
2888 setLine();
2889 vue.nextTick(() => {
2890 var _a, _b;
2891 scrollIntoView(true);
2892 (_b = (_a = contentRef.value) == null ? void 0 : _a.swipeRef.value) == null ? void 0 : _b.resize();
2893 });
2894 };
2895 vue.watch(() => [props2.color, props2.duration, props2.lineWidth, props2.lineHeight], setLine);
2896 vue.watch(windowWidth, resize);
2897 vue.watch(() => props2.active, (value) => {
2898 if (value !== currentName.value) {
2899 setCurrentIndexByName(value);
2900 }
2901 });
2902 vue.watch(() => children.length, () => {
2903 if (state.inited) {
2904 setCurrentIndexByName(props2.active);
2905 setLine();
2906 vue.nextTick(() => {
2907 scrollIntoView(true);
2908 });
2909 }
2910 });
2911 const init = () => {
2912 setCurrentIndexByName(props2.active, true);
2913 vue.nextTick(() => {
2914 state.inited = true;
2915 if (wrapRef.value) {
2916 tabHeight = use.useRect(wrapRef.value).height;
2917 }
2918 scrollIntoView(true);
2919 });
2920 };
2921 const onRendered = (name2, title) => emit("rendered", name2, title);
2922 useExpose({
2923 resize,
2924 scrollTo
2925 });
2926 vue.onActivated(setLine);
2927 onPopupReopen(setLine);
2928 use.onMountedOrActivated(init);
2929 useVisibilityChange(root, setLine);
2930 use.useEventListener("scroll", onScroll, {
2931 target: scroller,
2932 passive: true
2933 });
2934 linkChildren({
2935 id,
2936 props: props2,
2937 setLine,
2938 scrollable,
2939 onRendered,
2940 currentName,
2941 setTitleRefs,
2942 scrollIntoView
2943 });
2944 return () => vue.createVNode("div", {
2945 "ref": root,
2946 "class": bem$1p([props2.type])
2947 }, [props2.showHeader ? props2.sticky ? vue.createVNode(Sticky, {
2948 "container": root.value,
2949 "offsetTop": offsetTopPx.value,
2950 "onScroll": onStickyScroll
2951 }, {
2952 default: () => [renderHeader()]
2953 }) : renderHeader() : null, vue.createVNode(stdin_default$1E, {
2954 "ref": contentRef,
2955 "count": children.length,
2956 "inited": state.inited,
2957 "animated": props2.animated,
2958 "duration": props2.duration,
2959 "swipeable": props2.swipeable,
2960 "lazyRender": props2.lazyRender,
2961 "currentIndex": state.currentIndex,
2962 "onChange": setCurrentIndex
2963 }, {
2964 default: () => {
2965 var _a;
2966 return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
2967 }
2968 })]);
2969 }
2970});
2971const TAB_STATUS_KEY = Symbol();
2972const useTabStatus = () => vue.inject(TAB_STATUS_KEY, null);
2973const [name$1s, bem$1o] = createNamespace("tab");
2974const TabTitle = vue.defineComponent({
2975 name: name$1s,
2976 props: {
2977 id: String,
2978 dot: Boolean,
2979 type: String,
2980 color: String,
2981 title: String,
2982 badge: numericProp,
2983 shrink: Boolean,
2984 isActive: Boolean,
2985 disabled: Boolean,
2986 controls: String,
2987 scrollable: Boolean,
2988 activeColor: String,
2989 inactiveColor: String,
2990 showZeroBadge: truthProp
2991 },
2992 setup(props2, {
2993 slots
2994 }) {
2995 const style = vue.computed(() => {
2996 const style2 = {};
2997 const {
2998 type,
2999 color,
3000 disabled,
3001 isActive,
3002 activeColor,
3003 inactiveColor
3004 } = props2;
3005 const isCard = type === "card";
3006 if (color && isCard) {
3007 style2.borderColor = color;
3008 if (!disabled) {
3009 if (isActive) {
3010 style2.backgroundColor = color;
3011 } else {
3012 style2.color = color;
3013 }
3014 }
3015 }
3016 const titleColor = isActive ? activeColor : inactiveColor;
3017 if (titleColor) {
3018 style2.color = titleColor;
3019 }
3020 return style2;
3021 });
3022 const renderText = () => {
3023 const Text = vue.createVNode("span", {
3024 "class": bem$1o("text", {
3025 ellipsis: !props2.scrollable
3026 })
3027 }, [slots.title ? slots.title() : props2.title]);
3028 if (props2.dot || isDef(props2.badge) && props2.badge !== "") {
3029 return vue.createVNode(Badge, {
3030 "dot": props2.dot,
3031 "content": props2.badge,
3032 "showZero": props2.showZeroBadge
3033 }, {
3034 default: () => [Text]
3035 });
3036 }
3037 return Text;
3038 };
3039 return () => vue.createVNode("div", {
3040 "id": props2.id,
3041 "role": "tab",
3042 "class": [bem$1o([props2.type, {
3043 grow: props2.scrollable && !props2.shrink,
3044 shrink: props2.shrink,
3045 active: props2.isActive,
3046 disabled: props2.disabled
3047 }])],
3048 "style": style.value,
3049 "tabindex": props2.disabled ? void 0 : props2.isActive ? 0 : -1,
3050 "aria-selected": props2.isActive,
3051 "aria-disabled": props2.disabled || void 0,
3052 "aria-controls": props2.controls
3053 }, [renderText()]);
3054 }
3055});
3056const [name$1r, bem$1n] = createNamespace("swipe-item");
3057var stdin_default$1C = vue.defineComponent({
3058 name: name$1r,
3059 setup(props2, {
3060 slots
3061 }) {
3062 let rendered;
3063 const state = vue.reactive({
3064 offset: 0,
3065 inited: false,
3066 mounted: false
3067 });
3068 const {
3069 parent,
3070 index
3071 } = use.useParent(SWIPE_KEY);
3072 if (!parent) {
3073 if (process.env.NODE_ENV !== "production") {
3074 console.error("[Vant] <SwipeItem> must be a child component of <Swipe>.");
3075 }
3076 return;
3077 }
3078 const style = vue.computed(() => {
3079 const style2 = {};
3080 const {
3081 vertical
3082 } = parent.props;
3083 if (parent.size.value) {
3084 style2[vertical ? "height" : "width"] = `${parent.size.value}px`;
3085 }
3086 if (state.offset) {
3087 style2.transform = `translate${vertical ? "Y" : "X"}(${state.offset}px)`;
3088 }
3089 return style2;
3090 });
3091 const shouldRender = vue.computed(() => {
3092 const {
3093 loop,
3094 lazyRender
3095 } = parent.props;
3096 if (!lazyRender || rendered) {
3097 return true;
3098 }
3099 if (!state.mounted) {
3100 return false;
3101 }
3102 const active = parent.activeIndicator.value;
3103 const maxActive = parent.count.value - 1;
3104 const prevActive = active === 0 && loop ? maxActive : active - 1;
3105 const nextActive = active === maxActive && loop ? 0 : active + 1;
3106 rendered = index.value === active || index.value === prevActive || index.value === nextActive;
3107 return rendered;
3108 });
3109 const setOffset = (offset) => {
3110 state.offset = offset;
3111 };
3112 vue.onMounted(() => {
3113 vue.nextTick(() => {
3114 state.mounted = true;
3115 });
3116 });
3117 useExpose({
3118 setOffset
3119 });
3120 return () => {
3121 var _a;
3122 return vue.createVNode("div", {
3123 "class": bem$1n(),
3124 "style": style.value
3125 }, [shouldRender.value ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null]);
3126 };
3127 }
3128});
3129const SwipeItem = withInstall(stdin_default$1C);
3130const [name$1q, bem$1m] = createNamespace("tab");
3131const tabProps = extend({}, routeProps, {
3132 dot: Boolean,
3133 name: numericProp,
3134 badge: numericProp,
3135 title: String,
3136 disabled: Boolean,
3137 titleClass: unknownProp,
3138 titleStyle: [String, Object],
3139 showZeroBadge: truthProp
3140});
3141var stdin_default$1B = vue.defineComponent({
3142 name: name$1q,
3143 props: tabProps,
3144 setup(props2, {
3145 slots
3146 }) {
3147 const id = useId();
3148 const inited = vue.ref(false);
3149 const instance2 = vue.getCurrentInstance();
3150 const {
3151 parent,
3152 index
3153 } = use.useParent(TABS_KEY);
3154 if (!parent) {
3155 if (process.env.NODE_ENV !== "production") {
3156 console.error("[Vant] <Tab> must be a child component of <Tabs>.");
3157 }
3158 return;
3159 }
3160 const getName = () => {
3161 var _a;
3162 return (_a = props2.name) != null ? _a : index.value;
3163 };
3164 const init = () => {
3165 inited.value = true;
3166 if (parent.props.lazyRender) {
3167 vue.nextTick(() => {
3168 parent.onRendered(getName(), props2.title);
3169 });
3170 }
3171 };
3172 const active = vue.computed(() => {
3173 const isActive = getName() === parent.currentName.value;
3174 if (isActive && !inited.value) {
3175 init();
3176 }
3177 return isActive;
3178 });
3179 const parsedClass = vue.ref("");
3180 const parsedStyle = vue.ref("");
3181 vue.watchEffect(() => {
3182 const {
3183 titleClass,
3184 titleStyle
3185 } = props2;
3186 parsedClass.value = titleClass ? shared.normalizeClass(titleClass) : "";
3187 parsedStyle.value = titleStyle && typeof titleStyle !== "string" ? shared.stringifyStyle(shared.normalizeStyle(titleStyle)) : titleStyle;
3188 });
3189 const renderTitle = (onClickTab) => vue.createVNode(TabTitle, vue.mergeProps({
3190 "key": id,
3191 "id": `${parent.id}-${index.value}`,
3192 "ref": parent.setTitleRefs(index.value),
3193 "style": parsedStyle.value,
3194 "class": parsedClass.value,
3195 "isActive": active.value,
3196 "controls": id,
3197 "scrollable": parent.scrollable.value,
3198 "activeColor": parent.props.titleActiveColor,
3199 "inactiveColor": parent.props.titleInactiveColor,
3200 "onClick": (event) => onClickTab(instance2.proxy, index.value, event)
3201 }, pick(parent.props, ["type", "color", "shrink"]), pick(props2, ["dot", "badge", "title", "disabled", "showZeroBadge"])), {
3202 title: slots.title
3203 });
3204 const hasInactiveClass = vue.ref(!active.value);
3205 vue.watch(active, (val) => {
3206 if (val) {
3207 hasInactiveClass.value = false;
3208 } else {
3209 use.doubleRaf(() => {
3210 hasInactiveClass.value = true;
3211 });
3212 }
3213 });
3214 vue.watch(() => props2.title, () => {
3215 parent.setLine();
3216 parent.scrollIntoView();
3217 });
3218 vue.provide(TAB_STATUS_KEY, active);
3219 useExpose({
3220 id,
3221 renderTitle
3222 });
3223 return () => {
3224 var _a;
3225 const label = `${parent.id}-${index.value}`;
3226 const {
3227 animated,
3228 swipeable,
3229 scrollspy,
3230 lazyRender
3231 } = parent.props;
3232 if (!slots.default && !animated) {
3233 return;
3234 }
3235 const show = scrollspy || active.value;
3236 if (animated || swipeable) {
3237 return vue.createVNode(SwipeItem, {
3238 "id": id,
3239 "role": "tabpanel",
3240 "class": bem$1m("panel-wrapper", {
3241 inactive: hasInactiveClass.value
3242 }),
3243 "tabindex": active.value ? 0 : -1,
3244 "aria-hidden": !active.value,
3245 "aria-labelledby": label
3246 }, {
3247 default: () => {
3248 var _a2;
3249 return [vue.createVNode("div", {
3250 "class": bem$1m("panel")
3251 }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])];
3252 }
3253 });
3254 }
3255 const shouldRender = inited.value || scrollspy || !lazyRender;
3256 const Content = shouldRender ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null;
3257 return vue.withDirectives(vue.createVNode("div", {
3258 "id": id,
3259 "role": "tabpanel",
3260 "class": bem$1m("panel"),
3261 "tabindex": show ? 0 : -1,
3262 "aria-labelledby": label
3263 }, [Content]), [[vue.vShow, show]]);
3264 };
3265 }
3266});
3267const Tab = withInstall(stdin_default$1B);
3268const Tabs = withInstall(stdin_default$1D);
3269const [name$1p, bem$1l] = createNamespace("picker-group");
3270const PICKER_GROUP_KEY = Symbol(name$1p);
3271const pickerGroupProps = extend({
3272 tabs: makeArrayProp(),
3273 activeTab: makeNumericProp(0),
3274 nextStepText: String
3275}, pickerToolbarProps);
3276var stdin_default$1A = vue.defineComponent({
3277 name: name$1p,
3278 props: pickerGroupProps,
3279 emits: ["confirm", "cancel", "update:activeTab"],
3280 setup(props2, {
3281 emit,
3282 slots
3283 }) {
3284 const activeTab = useSyncPropRef(() => props2.activeTab, (value) => emit("update:activeTab", value));
3285 const {
3286 children,
3287 linkChildren
3288 } = use.useChildren(PICKER_GROUP_KEY);
3289 linkChildren();
3290 const showNextButton = () => +activeTab.value < props2.tabs.length - 1 && props2.nextStepText;
3291 const onConfirm = () => {
3292 if (showNextButton()) {
3293 activeTab.value = +activeTab.value + 1;
3294 } else {
3295 emit("confirm", children.map((item) => item.confirm()));
3296 }
3297 };
3298 const onCancel = () => emit("cancel");
3299 return () => {
3300 var _a, _b;
3301 const childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== vue.Comment);
3302 const confirmButtonText = showNextButton() ? props2.nextStepText : props2.confirmButtonText;
3303 return vue.createVNode("div", {
3304 "class": bem$1l()
3305 }, [vue.createVNode(stdin_default$1H, {
3306 "title": props2.title,
3307 "cancelButtonText": props2.cancelButtonText,
3308 "confirmButtonText": confirmButtonText,
3309 "onConfirm": onConfirm,
3310 "onCancel": onCancel
3311 }, pick(slots, pickerToolbarSlots)), vue.createVNode(Tabs, {
3312 "active": activeTab.value,
3313 "onUpdate:active": ($event) => activeTab.value = $event,
3314 "class": bem$1l("tabs"),
3315 "shrink": true,
3316 "animated": true,
3317 "lazyRender": false
3318 }, {
3319 default: () => [props2.tabs.map((title, index) => vue.createVNode(Tab, {
3320 "title": title,
3321 "titleClass": bem$1l("tab-title")
3322 }, {
3323 default: () => [childNodes == null ? void 0 : childNodes[index]]
3324 }))]
3325 })]);
3326 };
3327 }
3328});
3329const pickerSharedProps = extend({
3330 loading: Boolean,
3331 readonly: Boolean,
3332 allowHtml: Boolean,
3333 optionHeight: makeNumericProp(44),
3334 showToolbar: truthProp,
3335 swipeDuration: makeNumericProp(1e3),
3336 visibleOptionNum: makeNumericProp(6)
3337}, pickerToolbarProps);
3338const pickerProps = extend({}, pickerSharedProps, {
3339 columns: makeArrayProp(),
3340 modelValue: makeArrayProp(),
3341 toolbarPosition: makeStringProp("top"),
3342 columnsFieldNames: Object
3343});
3344var stdin_default$1z = vue.defineComponent({
3345 name: name$1z,
3346 props: pickerProps,
3347 emits: ["confirm", "cancel", "change", "scrollInto", "clickOption", "update:modelValue"],
3348 setup(props2, {
3349 emit,
3350 slots
3351 }) {
3352 const columnsRef = vue.ref();
3353 const selectedValues = vue.ref(props2.modelValue.slice(0));
3354 const {
3355 parent
3356 } = use.useParent(PICKER_GROUP_KEY);
3357 const {
3358 children,
3359 linkChildren
3360 } = use.useChildren(PICKER_KEY);
3361 linkChildren();
3362 const fields = vue.computed(() => assignDefaultFields(props2.columnsFieldNames));
3363 const optionHeight = vue.computed(() => unitToPx(props2.optionHeight));
3364 const columnsType = vue.computed(() => getColumnsType(props2.columns, fields.value));
3365 const currentColumns = vue.computed(() => {
3366 const {
3367 columns
3368 } = props2;
3369 switch (columnsType.value) {
3370 case "multiple":
3371 return columns;
3372 case "cascade":
3373 return formatCascadeColumns(columns, fields.value, selectedValues);
3374 default:
3375 return [columns];
3376 }
3377 });
3378 const hasOptions = vue.computed(() => currentColumns.value.some((options) => options.length));
3379 const selectedOptions = vue.computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
3380 const selectedIndexes = vue.computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
3381 const setValue = (index, value) => {
3382 if (selectedValues.value[index] !== value) {
3383 const newValues = selectedValues.value.slice(0);
3384 newValues[index] = value;
3385 selectedValues.value = newValues;
3386 }
3387 };
3388 const getEventParams = () => ({
3389 selectedValues: selectedValues.value.slice(0),
3390 selectedOptions: selectedOptions.value,
3391 selectedIndexes: selectedIndexes.value
3392 });
3393 const onChange = (value, columnIndex) => {
3394 setValue(columnIndex, value);
3395 if (columnsType.value === "cascade") {
3396 selectedValues.value.forEach((value2, index) => {
3397 const options = currentColumns.value[index];
3398 if (!isOptionExist(options, value2, fields.value)) {
3399 setValue(index, options.length ? options[0][fields.value.value] : void 0);
3400 }
3401 });
3402 }
3403 vue.nextTick(() => {
3404 emit("change", extend({
3405 columnIndex
3406 }, getEventParams()));
3407 });
3408 };
3409 const onClickOption = (currentOption, columnIndex) => {
3410 const params = {
3411 columnIndex,
3412 currentOption
3413 };
3414 emit("clickOption", extend(getEventParams(), params));
3415 emit("scrollInto", params);
3416 };
3417 const confirm = () => {
3418 children.forEach((child) => child.stopMomentum());
3419 const params = getEventParams();
3420 vue.nextTick(() => {
3421 emit("confirm", params);
3422 });
3423 return params;
3424 };
3425 const cancel = () => emit("cancel", getEventParams());
3426 const renderColumnItems = () => currentColumns.value.map((options, columnIndex) => vue.createVNode(stdin_default$1I, {
3427 "value": selectedValues.value[columnIndex],
3428 "fields": fields.value,
3429 "options": options,
3430 "readonly": props2.readonly,
3431 "allowHtml": props2.allowHtml,
3432 "optionHeight": optionHeight.value,
3433 "swipeDuration": props2.swipeDuration,
3434 "visibleOptionNum": props2.visibleOptionNum,
3435 "onChange": (value) => onChange(value, columnIndex),
3436 "onClickOption": (option) => onClickOption(option, columnIndex),
3437 "onScrollInto": (option) => {
3438 emit("scrollInto", {
3439 currentOption: option,
3440 columnIndex
3441 });
3442 }
3443 }, {
3444 option: slots.option
3445 }));
3446 const renderMask = (wrapHeight) => {
3447 if (hasOptions.value) {
3448 const frameStyle = {
3449 height: `${optionHeight.value}px`
3450 };
3451 const maskStyle = {
3452 backgroundSize: `100% ${(wrapHeight - optionHeight.value) / 2}px`
3453 };
3454 return [vue.createVNode("div", {
3455 "class": bem$1u("mask"),
3456 "style": maskStyle
3457 }, null), vue.createVNode("div", {
3458 "class": [BORDER_UNSET_TOP_BOTTOM, bem$1u("frame")],
3459 "style": frameStyle
3460 }, null)];
3461 }
3462 };
3463 const renderColumns = () => {
3464 const wrapHeight = optionHeight.value * +props2.visibleOptionNum;
3465 const columnsStyle = {
3466 height: `${wrapHeight}px`
3467 };
3468 return vue.createVNode("div", {
3469 "ref": columnsRef,
3470 "class": bem$1u("columns"),
3471 "style": columnsStyle
3472 }, [renderColumnItems(), renderMask(wrapHeight)]);
3473 };
3474 const renderToolbar = () => {
3475 if (props2.showToolbar && !parent) {
3476 return vue.createVNode(stdin_default$1H, vue.mergeProps(pick(props2, pickerToolbarPropKeys), {
3477 "onConfirm": confirm,
3478 "onCancel": cancel
3479 }), pick(slots, pickerToolbarSlots));
3480 }
3481 };
3482 vue.watch(currentColumns, (columns) => {
3483 columns.forEach((options, index) => {
3484 if (options.length && !isOptionExist(options, selectedValues.value[index], fields.value)) {
3485 setValue(index, getFirstEnabledOption(options)[fields.value.value]);
3486 }
3487 });
3488 }, {
3489 immediate: true
3490 });
3491 let lastEmittedModelValue;
3492 vue.watch(() => props2.modelValue, (newValues) => {
3493 if (!isSameValue(newValues, selectedValues.value) && !isSameValue(newValues, lastEmittedModelValue)) {
3494 selectedValues.value = newValues.slice(0);
3495 lastEmittedModelValue = newValues.slice(0);
3496 }
3497 }, {
3498 deep: true
3499 });
3500 vue.watch(selectedValues, (newValues) => {
3501 if (!isSameValue(newValues, props2.modelValue)) {
3502 lastEmittedModelValue = newValues.slice(0);
3503 emit("update:modelValue", lastEmittedModelValue);
3504 }
3505 }, {
3506 immediate: true
3507 });
3508 use.useEventListener("touchmove", preventDefault, {
3509 target: columnsRef
3510 });
3511 const getSelectedOptions = () => selectedOptions.value;
3512 useExpose({
3513 confirm,
3514 getSelectedOptions
3515 });
3516 return () => {
3517 var _a, _b;
3518 return vue.createVNode("div", {
3519 "class": bem$1u()
3520 }, [props2.toolbarPosition === "top" ? renderToolbar() : null, props2.loading ? vue.createVNode(Loading, {
3521 "class": bem$1u("loading")
3522 }, null) : null, (_a = slots["columns-top"]) == null ? void 0 : _a.call(slots), renderColumns(), (_b = slots["columns-bottom"]) == null ? void 0 : _b.call(slots), props2.toolbarPosition === "bottom" ? renderToolbar() : null]);
3523 };
3524 }
3525});
3526const AREA_EMPTY_CODE = "000000";
3527const INHERIT_SLOTS = [
3528 "title",
3529 "cancel",
3530 "confirm",
3531 "toolbar",
3532 "columns-top",
3533 "columns-bottom"
3534];
3535const INHERIT_PROPS = [
3536 "title",
3537 "loading",
3538 "readonly",
3539 "optionHeight",
3540 "swipeDuration",
3541 "visibleOptionNum",
3542 "cancelButtonText",
3543 "confirmButtonText"
3544];
3545const makeOption = (text = "", value = AREA_EMPTY_CODE, children = void 0) => ({
3546 text,
3547 value,
3548 children
3549});
3550function formatDataForCascade({
3551 areaList,
3552 columnsNum,
3553 columnsPlaceholder: placeholder
3554}) {
3555 const {
3556 city_list: city = {},
3557 county_list: county = {},
3558 province_list: province = {}
3559 } = areaList;
3560 const showCity = +columnsNum > 1;
3561 const showCounty = +columnsNum > 2;
3562 const getProvinceChildren = () => {
3563 if (showCity) {
3564 return placeholder.length ? [
3565 makeOption(
3566 placeholder[0],
3567 AREA_EMPTY_CODE,
3568 showCounty ? [] : void 0
3569 )
3570 ] : [];
3571 }
3572 };
3573 const provinceMap = /* @__PURE__ */ new Map();
3574 Object.keys(province).forEach((code) => {
3575 provinceMap.set(
3576 code.slice(0, 2),
3577 makeOption(province[code], code, getProvinceChildren())
3578 );
3579 });
3580 const cityMap = /* @__PURE__ */ new Map();
3581 if (showCity) {
3582 const getCityChildren = () => {
3583 if (showCounty) {
3584 return placeholder.length ? [makeOption(placeholder[1])] : [];
3585 }
3586 };
3587 Object.keys(city).forEach((code) => {
3588 const option = makeOption(city[code], code, getCityChildren());
3589 cityMap.set(code.slice(0, 4), option);
3590 const province2 = provinceMap.get(code.slice(0, 2));
3591 if (province2) {
3592 province2.children.push(option);
3593 }
3594 });
3595 }
3596 if (showCounty) {
3597 Object.keys(county).forEach((code) => {
3598 const city2 = cityMap.get(code.slice(0, 4));
3599 if (city2) {
3600 city2.children.push(makeOption(county[code], code));
3601 }
3602 });
3603 }
3604 const options = Array.from(provinceMap.values());
3605 if (placeholder.length) {
3606 const county2 = showCounty ? [makeOption(placeholder[2])] : void 0;
3607 const city2 = showCity ? [makeOption(placeholder[1], AREA_EMPTY_CODE, county2)] : void 0;
3608 options.unshift(makeOption(placeholder[0], AREA_EMPTY_CODE, city2));
3609 }
3610 return options;
3611}
3612const Picker = withInstall(stdin_default$1z);
3613const [name$1o, bem$1k] = createNamespace("area");
3614const areaProps = extend({}, pick(pickerSharedProps, INHERIT_PROPS), {
3615 modelValue: String,
3616 columnsNum: makeNumericProp(3),
3617 columnsPlaceholder: makeArrayProp(),
3618 areaList: {
3619 type: Object,
3620 default: () => ({})
3621 }
3622});
3623var stdin_default$1y = vue.defineComponent({
3624 name: name$1o,
3625 props: areaProps,
3626 emits: ["change", "confirm", "cancel", "update:modelValue"],
3627 setup(props2, {
3628 emit,
3629 slots
3630 }) {
3631 const codes = vue.ref([]);
3632 const picker = vue.ref();
3633 const columns = vue.computed(() => formatDataForCascade(props2));
3634 const onChange = (...args) => emit("change", ...args);
3635 const onCancel = (...args) => emit("cancel", ...args);
3636 const onConfirm = (...args) => emit("confirm", ...args);
3637 vue.watch(codes, (newCodes) => {
3638 const lastCode = newCodes.length ? newCodes[newCodes.length - 1] : "";
3639 if (lastCode && lastCode !== props2.modelValue) {
3640 emit("update:modelValue", lastCode);
3641 }
3642 }, {
3643 deep: true
3644 });
3645 vue.watch(() => props2.modelValue, (newCode) => {
3646 if (newCode) {
3647 const lastCode = codes.value.length ? codes.value[codes.value.length - 1] : "";
3648 if (newCode !== lastCode) {
3649 codes.value = [`${newCode.slice(0, 2)}0000`, `${newCode.slice(0, 4)}00`, newCode].slice(0, +props2.columnsNum);
3650 }
3651 } else {
3652 codes.value = [];
3653 }
3654 }, {
3655 immediate: true
3656 });
3657 useExpose({
3658 confirm: () => {
3659 var _a;
3660 return (_a = picker.value) == null ? void 0 : _a.confirm();
3661 },
3662 getSelectedOptions: () => {
3663 var _a;
3664 return ((_a = picker.value) == null ? void 0 : _a.getSelectedOptions()) || [];
3665 }
3666 });
3667 return () => vue.createVNode(Picker, vue.mergeProps({
3668 "ref": picker,
3669 "modelValue": codes.value,
3670 "onUpdate:modelValue": ($event) => codes.value = $event,
3671 "class": bem$1k(),
3672 "columns": columns.value,
3673 "onChange": onChange,
3674 "onCancel": onCancel,
3675 "onConfirm": onConfirm
3676 }, pick(props2, INHERIT_PROPS)), pick(slots, INHERIT_SLOTS));
3677 }
3678});
3679const Area = withInstall(stdin_default$1y);
3680const [name$1n, bem$1j] = createNamespace("cell");
3681const cellSharedProps = {
3682 tag: makeStringProp("div"),
3683 icon: String,
3684 size: String,
3685 title: numericProp,
3686 value: numericProp,
3687 label: numericProp,
3688 center: Boolean,
3689 isLink: Boolean,
3690 border: truthProp,
3691 iconPrefix: String,
3692 valueClass: unknownProp,
3693 labelClass: unknownProp,
3694 titleClass: unknownProp,
3695 titleStyle: null,
3696 arrowDirection: String,
3697 required: {
3698 type: [Boolean, String],
3699 default: null
3700 },
3701 clickable: {
3702 type: Boolean,
3703 default: null
3704 }
3705};
3706const cellProps = extend({}, cellSharedProps, routeProps);
3707var stdin_default$1x = vue.defineComponent({
3708 name: name$1n,
3709 props: cellProps,
3710 setup(props2, {
3711 slots
3712 }) {
3713 const route2 = useRoute();
3714 const renderLabel = () => {
3715 const showLabel = slots.label || isDef(props2.label);
3716 if (showLabel) {
3717 return vue.createVNode("div", {
3718 "class": [bem$1j("label"), props2.labelClass]
3719 }, [slots.label ? slots.label() : props2.label]);
3720 }
3721 };
3722 const renderTitle = () => {
3723 var _a;
3724 if (slots.title || isDef(props2.title)) {
3725 const titleSlot = (_a = slots.title) == null ? void 0 : _a.call(slots);
3726 if (Array.isArray(titleSlot) && titleSlot.length === 0) {
3727 return;
3728 }
3729 return vue.createVNode("div", {
3730 "class": [bem$1j("title"), props2.titleClass],
3731 "style": props2.titleStyle
3732 }, [titleSlot || vue.createVNode("span", null, [props2.title]), renderLabel()]);
3733 }
3734 };
3735 const renderValue = () => {
3736 const slot = slots.value || slots.default;
3737 const hasValue = slot || isDef(props2.value);
3738 if (hasValue) {
3739 return vue.createVNode("div", {
3740 "class": [bem$1j("value"), props2.valueClass]
3741 }, [slot ? slot() : vue.createVNode("span", null, [props2.value])]);
3742 }
3743 };
3744 const renderLeftIcon = () => {
3745 if (slots.icon) {
3746 return slots.icon();
3747 }
3748 if (props2.icon) {
3749 return vue.createVNode(Icon, {
3750 "name": props2.icon,
3751 "class": bem$1j("left-icon"),
3752 "classPrefix": props2.iconPrefix
3753 }, null);
3754 }
3755 };
3756 const renderRightIcon = () => {
3757 if (slots["right-icon"]) {
3758 return slots["right-icon"]();
3759 }
3760 if (props2.isLink) {
3761 const name2 = props2.arrowDirection && props2.arrowDirection !== "right" ? `arrow-${props2.arrowDirection}` : "arrow";
3762 return vue.createVNode(Icon, {
3763 "name": name2,
3764 "class": bem$1j("right-icon")
3765 }, null);
3766 }
3767 };
3768 return () => {
3769 var _a;
3770 const {
3771 tag,
3772 size,
3773 center,
3774 border,
3775 isLink,
3776 required
3777 } = props2;
3778 const clickable = (_a = props2.clickable) != null ? _a : isLink;
3779 const classes = {
3780 center,
3781 required: !!required,
3782 clickable,
3783 borderless: !border
3784 };
3785 if (size) {
3786 classes[size] = !!size;
3787 }
3788 return vue.createVNode(tag, {
3789 "class": bem$1j(classes),
3790 "role": clickable ? "button" : void 0,
3791 "tabindex": clickable ? 0 : void 0,
3792 "onClick": route2
3793 }, {
3794 default: () => {
3795 var _a2;
3796 return [renderLeftIcon(), renderTitle(), renderValue(), renderRightIcon(), (_a2 = slots.extra) == null ? void 0 : _a2.call(slots)];
3797 }
3798 });
3799 };
3800 }
3801});
3802const Cell = withInstall(stdin_default$1x);
3803const [name$1m, bem$1i] = createNamespace("form");
3804const formProps = {
3805 colon: Boolean,
3806 disabled: Boolean,
3807 readonly: Boolean,
3808 required: [Boolean, String],
3809 showError: Boolean,
3810 labelWidth: numericProp,
3811 labelAlign: String,
3812 inputAlign: String,
3813 scrollToError: Boolean,
3814 validateFirst: Boolean,
3815 submitOnEnter: truthProp,
3816 showErrorMessage: truthProp,
3817 errorMessageAlign: String,
3818 validateTrigger: {
3819 type: [String, Array],
3820 default: "onBlur"
3821 }
3822};
3823var stdin_default$1w = vue.defineComponent({
3824 name: name$1m,
3825 props: formProps,
3826 emits: ["submit", "failed"],
3827 setup(props2, {
3828 emit,
3829 slots
3830 }) {
3831 const {
3832 children,
3833 linkChildren
3834 } = use.useChildren(FORM_KEY);
3835 const getFieldsByNames = (names) => {
3836 if (names) {
3837 return children.filter((field) => names.includes(field.name));
3838 }
3839 return children;
3840 };
3841 const validateSeq = (names) => new Promise((resolve, reject) => {
3842 const errors = [];
3843 const fields = getFieldsByNames(names);
3844 fields.reduce((promise, field) => promise.then(() => {
3845 if (!errors.length) {
3846 return field.validate().then((error) => {
3847 if (error) {
3848 errors.push(error);
3849 }
3850 });
3851 }
3852 }), Promise.resolve()).then(() => {
3853 if (errors.length) {
3854 reject(errors);
3855 } else {
3856 resolve();
3857 }
3858 });
3859 });
3860 const validateAll = (names) => new Promise((resolve, reject) => {
3861 const fields = getFieldsByNames(names);
3862 Promise.all(fields.map((item) => item.validate())).then((errors) => {
3863 errors = errors.filter(Boolean);
3864 if (errors.length) {
3865 reject(errors);
3866 } else {
3867 resolve();
3868 }
3869 });
3870 });
3871 const validateField = (name2) => {
3872 const matched = children.find((item) => item.name === name2);
3873 if (matched) {
3874 return new Promise((resolve, reject) => {
3875 matched.validate().then((error) => {
3876 if (error) {
3877 reject(error);
3878 } else {
3879 resolve();
3880 }
3881 });
3882 });
3883 }
3884 return Promise.reject();
3885 };
3886 const validate = (name2) => {
3887 if (typeof name2 === "string") {
3888 return validateField(name2);
3889 }
3890 return props2.validateFirst ? validateSeq(name2) : validateAll(name2);
3891 };
3892 const resetValidation = (name2) => {
3893 if (typeof name2 === "string") {
3894 name2 = [name2];
3895 }
3896 const fields = getFieldsByNames(name2);
3897 fields.forEach((item) => {
3898 item.resetValidation();
3899 });
3900 };
3901 const getValidationStatus = () => children.reduce((form, field) => {
3902 form[field.name] = field.getValidationStatus();
3903 return form;
3904 }, {});
3905 const scrollToField = (name2, options) => {
3906 children.some((item) => {
3907 if (item.name === name2) {
3908 item.$el.scrollIntoView(options);
3909 return true;
3910 }
3911 return false;
3912 });
3913 };
3914 const getValues = () => children.reduce((form, field) => {
3915 if (field.name !== void 0) {
3916 form[field.name] = field.formValue.value;
3917 }
3918 return form;
3919 }, {});
3920 const submit = () => {
3921 const values = getValues();
3922 validate().then(() => emit("submit", values)).catch((errors) => {
3923 emit("failed", {
3924 values,
3925 errors
3926 });
3927 if (props2.scrollToError && errors[0].name) {
3928 scrollToField(errors[0].name);
3929 }
3930 });
3931 };
3932 const onSubmit = (event) => {
3933 preventDefault(event);
3934 submit();
3935 };
3936 linkChildren({
3937 props: props2
3938 });
3939 useExpose({
3940 submit,
3941 validate,
3942 getValues,
3943 scrollToField,
3944 resetValidation,
3945 getValidationStatus
3946 });
3947 return () => {
3948 var _a;
3949 return vue.createVNode("form", {
3950 "class": bem$1i(),
3951 "onSubmit": onSubmit
3952 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
3953 };
3954 }
3955});
3956const Form = withInstall(stdin_default$1w);
3957function isEmptyValue(value) {
3958 if (Array.isArray(value)) {
3959 return !value.length;
3960 }
3961 if (value === 0) {
3962 return false;
3963 }
3964 return !value;
3965}
3966function runSyncRule(value, rule) {
3967 if (isEmptyValue(value)) {
3968 if (rule.required) {
3969 return false;
3970 }
3971 if (rule.validateEmpty === false) {
3972 return true;
3973 }
3974 }
3975 if (rule.pattern && !rule.pattern.test(String(value))) {
3976 return false;
3977 }
3978 return true;
3979}
3980function runRuleValidator(value, rule) {
3981 return new Promise((resolve) => {
3982 const returnVal = rule.validator(value, rule);
3983 if (isPromise(returnVal)) {
3984 returnVal.then(resolve);
3985 return;
3986 }
3987 resolve(returnVal);
3988 });
3989}
3990function getRuleMessage(value, rule) {
3991 const { message } = rule;
3992 if (isFunction(message)) {
3993 return message(value, rule);
3994 }
3995 return message || "";
3996}
3997function startComposing({ target }) {
3998 target.composing = true;
3999}
4000function endComposing({ target }) {
4001 if (target.composing) {
4002 target.composing = false;
4003 target.dispatchEvent(new Event("input"));
4004 }
4005}
4006function resizeTextarea(input, autosize) {
4007 const scrollTop = getRootScrollTop();
4008 input.style.height = "auto";
4009 let height = input.scrollHeight;
4010 if (isObject(autosize)) {
4011 const { maxHeight, minHeight } = autosize;
4012 if (maxHeight !== void 0) {
4013 height = Math.min(height, maxHeight);
4014 }
4015 if (minHeight !== void 0) {
4016 height = Math.max(height, minHeight);
4017 }
4018 }
4019 if (height) {
4020 input.style.height = `${height}px`;
4021 setRootScrollTop(scrollTop);
4022 }
4023}
4024function mapInputType(type) {
4025 if (type === "number") {
4026 return {
4027 type: "text",
4028 inputmode: "decimal"
4029 };
4030 }
4031 if (type === "digit") {
4032 return {
4033 type: "tel",
4034 inputmode: "numeric"
4035 };
4036 }
4037 return { type };
4038}
4039function getStringLength(str) {
4040 return [...str].length;
4041}
4042function cutString(str, maxlength) {
4043 return [...str].slice(0, maxlength).join("");
4044}
4045const [name$1l, bem$1h] = createNamespace("field");
4046const fieldSharedProps = {
4047 id: String,
4048 name: String,
4049 leftIcon: String,
4050 rightIcon: String,
4051 autofocus: Boolean,
4052 clearable: Boolean,
4053 maxlength: numericProp,
4054 formatter: Function,
4055 clearIcon: makeStringProp("clear"),
4056 modelValue: makeNumericProp(""),
4057 inputAlign: String,
4058 placeholder: String,
4059 autocomplete: String,
4060 autocapitalize: String,
4061 autocorrect: String,
4062 errorMessage: String,
4063 enterkeyhint: String,
4064 clearTrigger: makeStringProp("focus"),
4065 formatTrigger: makeStringProp("onChange"),
4066 spellcheck: {
4067 type: Boolean,
4068 default: null
4069 },
4070 error: {
4071 type: Boolean,
4072 default: null
4073 },
4074 disabled: {
4075 type: Boolean,
4076 default: null
4077 },
4078 readonly: {
4079 type: Boolean,
4080 default: null
4081 }
4082};
4083const fieldProps = extend({}, cellSharedProps, fieldSharedProps, {
4084 rows: numericProp,
4085 type: makeStringProp("text"),
4086 rules: Array,
4087 autosize: [Boolean, Object],
4088 labelWidth: numericProp,
4089 labelClass: unknownProp,
4090 labelAlign: String,
4091 showWordLimit: Boolean,
4092 errorMessageAlign: String,
4093 colon: {
4094 type: Boolean,
4095 default: null
4096 }
4097});
4098var stdin_default$1v = vue.defineComponent({
4099 name: name$1l,
4100 props: fieldProps,
4101 emits: ["blur", "focus", "clear", "keypress", "clickInput", "endValidate", "startValidate", "clickLeftIcon", "clickRightIcon", "update:modelValue"],
4102 setup(props2, {
4103 emit,
4104 slots
4105 }) {
4106 const id = useId();
4107 const state = vue.reactive({
4108 status: "unvalidated",
4109 focused: false,
4110 validateMessage: ""
4111 });
4112 const inputRef = vue.ref();
4113 const clearIconRef = vue.ref();
4114 const customValue = vue.ref();
4115 const {
4116 parent: form
4117 } = use.useParent(FORM_KEY);
4118 const getModelValue = () => {
4119 var _a;
4120 return String((_a = props2.modelValue) != null ? _a : "");
4121 };
4122 const getProp = (key) => {
4123 if (isDef(props2[key])) {
4124 return props2[key];
4125 }
4126 if (form && isDef(form.props[key])) {
4127 return form.props[key];
4128 }
4129 };
4130 const showClear = vue.computed(() => {
4131 const readonly = getProp("readonly");
4132 if (props2.clearable && !readonly) {
4133 const hasValue = getModelValue() !== "";
4134 const trigger = props2.clearTrigger === "always" || props2.clearTrigger === "focus" && state.focused;
4135 return hasValue && trigger;
4136 }
4137 return false;
4138 });
4139 const formValue = vue.computed(() => {
4140 if (customValue.value && slots.input) {
4141 return customValue.value();
4142 }
4143 return props2.modelValue;
4144 });
4145 const showRequiredMark = vue.computed(() => {
4146 var _a;
4147 const required = getProp("required");
4148 if (required === "auto") {
4149 return (_a = props2.rules) == null ? void 0 : _a.some((rule) => rule.required);
4150 }
4151 return required;
4152 });
4153 const runRules = (rules) => rules.reduce((promise, rule) => promise.then(() => {
4154 if (state.status === "failed") {
4155 return;
4156 }
4157 let {
4158 value
4159 } = formValue;
4160 if (rule.formatter) {
4161 value = rule.formatter(value, rule);
4162 }
4163 if (!runSyncRule(value, rule)) {
4164 state.status = "failed";
4165 state.validateMessage = getRuleMessage(value, rule);
4166 return;
4167 }
4168 if (rule.validator) {
4169 if (isEmptyValue(value) && rule.validateEmpty === false) {
4170 return;
4171 }
4172 return runRuleValidator(value, rule).then((result) => {
4173 if (result && typeof result === "string") {
4174 state.status = "failed";
4175 state.validateMessage = result;
4176 } else if (result === false) {
4177 state.status = "failed";
4178 state.validateMessage = getRuleMessage(value, rule);
4179 }
4180 });
4181 }
4182 }), Promise.resolve());
4183 const resetValidation = () => {
4184 state.status = "unvalidated";
4185 state.validateMessage = "";
4186 };
4187 const endValidate = () => emit("endValidate", {
4188 status: state.status,
4189 message: state.validateMessage
4190 });
4191 const validate = (rules = props2.rules) => new Promise((resolve) => {
4192 resetValidation();
4193 if (rules) {
4194 emit("startValidate");
4195 runRules(rules).then(() => {
4196 if (state.status === "failed") {
4197 resolve({
4198 name: props2.name,
4199 message: state.validateMessage
4200 });
4201 endValidate();
4202 } else {
4203 state.status = "passed";
4204 resolve();
4205 endValidate();
4206 }
4207 });
4208 } else {
4209 resolve();
4210 }
4211 });
4212 const validateWithTrigger = (trigger) => {
4213 if (form && props2.rules) {
4214 const {
4215 validateTrigger
4216 } = form.props;
4217 const defaultTrigger = toArray(validateTrigger).includes(trigger);
4218 const rules = props2.rules.filter((rule) => {
4219 if (rule.trigger) {
4220 return toArray(rule.trigger).includes(trigger);
4221 }
4222 return defaultTrigger;
4223 });
4224 if (rules.length) {
4225 validate(rules);
4226 }
4227 }
4228 };
4229 const limitValueLength = (value) => {
4230 var _a;
4231 const {
4232 maxlength
4233 } = props2;
4234 if (isDef(maxlength) && getStringLength(value) > +maxlength) {
4235 const modelValue = getModelValue();
4236 if (modelValue && getStringLength(modelValue) === +maxlength) {
4237 return modelValue;
4238 }
4239 const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
4240 if (state.focused && selectionEnd) {
4241 const valueArr = [...value];
4242 const exceededLength = valueArr.length - +maxlength;
4243 valueArr.splice(selectionEnd - exceededLength, exceededLength);
4244 return valueArr.join("");
4245 }
4246 return cutString(value, +maxlength);
4247 }
4248 return value;
4249 };
4250 const updateValue = (value, trigger = "onChange") => {
4251 const originalValue = value;
4252 value = limitValueLength(value);
4253 const limitDiffLen = getStringLength(originalValue) - getStringLength(value);
4254 if (props2.type === "number" || props2.type === "digit") {
4255 const isNumber = props2.type === "number";
4256 value = formatNumber(value, isNumber, isNumber);
4257 }
4258 let formatterDiffLen = 0;
4259 if (props2.formatter && trigger === props2.formatTrigger) {
4260 const {
4261 formatter,
4262 maxlength
4263 } = props2;
4264 value = formatter(value);
4265 if (isDef(maxlength) && getStringLength(value) > +maxlength) {
4266 value = cutString(value, +maxlength);
4267 }
4268 if (inputRef.value && state.focused) {
4269 const {
4270 selectionEnd
4271 } = inputRef.value;
4272 const bcoVal = cutString(originalValue, selectionEnd);
4273 formatterDiffLen = getStringLength(formatter(bcoVal)) - getStringLength(bcoVal);
4274 }
4275 }
4276 if (inputRef.value && inputRef.value.value !== value) {
4277 if (state.focused) {
4278 let {
4279 selectionStart,
4280 selectionEnd
4281 } = inputRef.value;
4282 inputRef.value.value = value;
4283 if (isDef(selectionStart) && isDef(selectionEnd)) {
4284 const valueLen = getStringLength(value);
4285 if (limitDiffLen) {
4286 selectionStart -= limitDiffLen;
4287 selectionEnd -= limitDiffLen;
4288 } else if (formatterDiffLen) {
4289 selectionStart += formatterDiffLen;
4290 selectionEnd += formatterDiffLen;
4291 }
4292 inputRef.value.setSelectionRange(Math.min(selectionStart, valueLen), Math.min(selectionEnd, valueLen));
4293 }
4294 } else {
4295 inputRef.value.value = value;
4296 }
4297 }
4298 if (value !== props2.modelValue) {
4299 emit("update:modelValue", value);
4300 }
4301 };
4302 const onInput = (event) => {
4303 if (!event.target.composing) {
4304 updateValue(event.target.value);
4305 }
4306 };
4307 const blur = () => {
4308 var _a;
4309 return (_a = inputRef.value) == null ? void 0 : _a.blur();
4310 };
4311 const focus = () => {
4312 var _a;
4313 return (_a = inputRef.value) == null ? void 0 : _a.focus();
4314 };
4315 const adjustTextareaSize = () => {
4316 const input = inputRef.value;
4317 if (props2.type === "textarea" && props2.autosize && input) {
4318 resizeTextarea(input, props2.autosize);
4319 }
4320 };
4321 const onFocus = (event) => {
4322 state.focused = true;
4323 emit("focus", event);
4324 vue.nextTick(adjustTextareaSize);
4325 if (getProp("readonly")) {
4326 blur();
4327 }
4328 };
4329 const onBlur = (event) => {
4330 state.focused = false;
4331 updateValue(getModelValue(), "onBlur");
4332 emit("blur", event);
4333 if (getProp("readonly")) {
4334 return;
4335 }
4336 validateWithTrigger("onBlur");
4337 vue.nextTick(adjustTextareaSize);
4338 resetScroll();
4339 };
4340 const onClickInput = (event) => emit("clickInput", event);
4341 const onClickLeftIcon = (event) => emit("clickLeftIcon", event);
4342 const onClickRightIcon = (event) => emit("clickRightIcon", event);
4343 const onClear = (event) => {
4344 preventDefault(event);
4345 emit("update:modelValue", "");
4346 emit("clear", event);
4347 };
4348 const showError = vue.computed(() => {
4349 if (typeof props2.error === "boolean") {
4350 return props2.error;
4351 }
4352 if (form && form.props.showError && state.status === "failed") {
4353 return true;
4354 }
4355 });
4356 const labelStyle = vue.computed(() => {
4357 const labelWidth = getProp("labelWidth");
4358 const labelAlign = getProp("labelAlign");
4359 if (labelWidth && labelAlign !== "top") {
4360 return {
4361 width: addUnit(labelWidth)
4362 };
4363 }
4364 });
4365 const onKeypress = (event) => {
4366 const ENTER_CODE = 13;
4367 if (event.keyCode === ENTER_CODE) {
4368 const submitOnEnter = form && form.props.submitOnEnter;
4369 if (!submitOnEnter && props2.type !== "textarea") {
4370 preventDefault(event);
4371 }
4372 if (props2.type === "search") {
4373 blur();
4374 }
4375 }
4376 emit("keypress", event);
4377 };
4378 const getInputId = () => props2.id || `${id}-input`;
4379 const getValidationStatus = () => state.status;
4380 const renderInput = () => {
4381 const controlClass = bem$1h("control", [getProp("inputAlign"), {
4382 error: showError.value,
4383 custom: !!slots.input,
4384 "min-height": props2.type === "textarea" && !props2.autosize
4385 }]);
4386 if (slots.input) {
4387 return vue.createVNode("div", {
4388 "class": controlClass,
4389 "onClick": onClickInput
4390 }, [slots.input()]);
4391 }
4392 const inputAttrs = {
4393 id: getInputId(),
4394 ref: inputRef,
4395 name: props2.name,
4396 rows: props2.rows !== void 0 ? +props2.rows : void 0,
4397 class: controlClass,
4398 disabled: getProp("disabled"),
4399 readonly: getProp("readonly"),
4400 autofocus: props2.autofocus,
4401 placeholder: props2.placeholder,
4402 autocomplete: props2.autocomplete,
4403 autocapitalize: props2.autocapitalize,
4404 autocorrect: props2.autocorrect,
4405 enterkeyhint: props2.enterkeyhint,
4406 spellcheck: props2.spellcheck,
4407 "aria-labelledby": props2.label ? `${id}-label` : void 0,
4408 onBlur,
4409 onFocus,
4410 onInput,
4411 onClick: onClickInput,
4412 onChange: endComposing,
4413 onKeypress,
4414 onCompositionend: endComposing,
4415 onCompositionstart: startComposing
4416 };
4417 if (props2.type === "textarea") {
4418 return vue.createVNode("textarea", inputAttrs, null);
4419 }
4420 return vue.createVNode("input", vue.mergeProps(mapInputType(props2.type), inputAttrs), null);
4421 };
4422 const renderLeftIcon = () => {
4423 const leftIconSlot = slots["left-icon"];
4424 if (props2.leftIcon || leftIconSlot) {
4425 return vue.createVNode("div", {
4426 "class": bem$1h("left-icon"),
4427 "onClick": onClickLeftIcon
4428 }, [leftIconSlot ? leftIconSlot() : vue.createVNode(Icon, {
4429 "name": props2.leftIcon,
4430 "classPrefix": props2.iconPrefix
4431 }, null)]);
4432 }
4433 };
4434 const renderRightIcon = () => {
4435 const rightIconSlot = slots["right-icon"];
4436 if (props2.rightIcon || rightIconSlot) {
4437 return vue.createVNode("div", {
4438 "class": bem$1h("right-icon"),
4439 "onClick": onClickRightIcon
4440 }, [rightIconSlot ? rightIconSlot() : vue.createVNode(Icon, {
4441 "name": props2.rightIcon,
4442 "classPrefix": props2.iconPrefix
4443 }, null)]);
4444 }
4445 };
4446 const renderWordLimit = () => {
4447 if (props2.showWordLimit && props2.maxlength) {
4448 const count = getStringLength(getModelValue());
4449 return vue.createVNode("div", {
4450 "class": bem$1h("word-limit")
4451 }, [vue.createVNode("span", {
4452 "class": bem$1h("word-num")
4453 }, [count]), vue.createTextVNode("/"), props2.maxlength]);
4454 }
4455 };
4456 const renderMessage = () => {
4457 if (form && form.props.showErrorMessage === false) {
4458 return;
4459 }
4460 const message = props2.errorMessage || state.validateMessage;
4461 if (message) {
4462 const slot = slots["error-message"];
4463 const errorMessageAlign = getProp("errorMessageAlign");
4464 return vue.createVNode("div", {
4465 "class": bem$1h("error-message", errorMessageAlign)
4466 }, [slot ? slot({
4467 message
4468 }) : message]);
4469 }
4470 };
4471 const renderLabel = () => {
4472 const labelWidth = getProp("labelWidth");
4473 const labelAlign = getProp("labelAlign");
4474 const colon = getProp("colon") ? ":" : "";
4475 if (slots.label) {
4476 return [slots.label(), colon];
4477 }
4478 if (props2.label) {
4479 return vue.createVNode("label", {
4480 "id": `${id}-label`,
4481 "for": slots.input ? void 0 : getInputId(),
4482 "onClick": (event) => {
4483 preventDefault(event);
4484 focus();
4485 },
4486 "style": labelAlign === "top" && labelWidth ? {
4487 width: addUnit(labelWidth)
4488 } : void 0
4489 }, [props2.label + colon]);
4490 }
4491 };
4492 const renderFieldBody = () => [vue.createVNode("div", {
4493 "class": bem$1h("body")
4494 }, [renderInput(), showClear.value && vue.createVNode(Icon, {
4495 "ref": clearIconRef,
4496 "name": props2.clearIcon,
4497 "class": bem$1h("clear")
4498 }, null), renderRightIcon(), slots.button && vue.createVNode("div", {
4499 "class": bem$1h("button")
4500 }, [slots.button()])]), renderWordLimit(), renderMessage()];
4501 useExpose({
4502 blur,
4503 focus,
4504 validate,
4505 formValue,
4506 resetValidation,
4507 getValidationStatus
4508 });
4509 vue.provide(use.CUSTOM_FIELD_INJECTION_KEY, {
4510 customValue,
4511 resetValidation,
4512 validateWithTrigger
4513 });
4514 vue.watch(() => props2.modelValue, () => {
4515 updateValue(getModelValue());
4516 resetValidation();
4517 validateWithTrigger("onChange");
4518 vue.nextTick(adjustTextareaSize);
4519 });
4520 vue.onMounted(() => {
4521 updateValue(getModelValue(), props2.formatTrigger);
4522 vue.nextTick(adjustTextareaSize);
4523 });
4524 use.useEventListener("touchstart", onClear, {
4525 target: vue.computed(() => {
4526 var _a;
4527 return (_a = clearIconRef.value) == null ? void 0 : _a.$el;
4528 })
4529 });
4530 return () => {
4531 const disabled = getProp("disabled");
4532 const labelAlign = getProp("labelAlign");
4533 const LeftIcon = renderLeftIcon();
4534 const renderTitle = () => {
4535 const Label = renderLabel();
4536 if (labelAlign === "top") {
4537 return [LeftIcon, Label].filter(Boolean);
4538 }
4539 return Label || [];
4540 };
4541 return vue.createVNode(Cell, {
4542 "size": props2.size,
4543 "class": bem$1h({
4544 error: showError.value,
4545 disabled,
4546 [`label-${labelAlign}`]: labelAlign
4547 }),
4548 "center": props2.center,
4549 "border": props2.border,
4550 "isLink": props2.isLink,
4551 "clickable": props2.clickable,
4552 "titleStyle": labelStyle.value,
4553 "valueClass": bem$1h("value"),
4554 "titleClass": [bem$1h("label", [labelAlign, {
4555 required: showRequiredMark.value
4556 }]), props2.labelClass],
4557 "arrowDirection": props2.arrowDirection
4558 }, {
4559 icon: LeftIcon && labelAlign !== "top" ? () => LeftIcon : null,
4560 title: renderTitle,
4561 value: renderFieldBody,
4562 extra: slots.extra
4563 });
4564 };
4565 }
4566});
4567const Field = withInstall(stdin_default$1v);
4568let lockCount = 0;
4569function lockClick(lock) {
4570 if (lock) {
4571 if (!lockCount) {
4572 document.body.classList.add("van-toast--unclickable");
4573 }
4574 lockCount++;
4575 } else if (lockCount) {
4576 lockCount--;
4577 if (!lockCount) {
4578 document.body.classList.remove("van-toast--unclickable");
4579 }
4580 }
4581}
4582const [name$1k, bem$1g] = createNamespace("toast");
4583const popupInheritProps$1 = ["show", "overlay", "teleport", "transition", "overlayClass", "overlayStyle", "closeOnClickOverlay", "zIndex"];
4584const toastProps = {
4585 icon: String,
4586 show: Boolean,
4587 type: makeStringProp("text"),
4588 overlay: Boolean,
4589 message: numericProp,
4590 iconSize: numericProp,
4591 duration: makeNumberProp(2e3),
4592 position: makeStringProp("middle"),
4593 teleport: [String, Object],
4594 wordBreak: String,
4595 className: unknownProp,
4596 iconPrefix: String,
4597 transition: makeStringProp("van-fade"),
4598 loadingType: String,
4599 forbidClick: Boolean,
4600 overlayClass: unknownProp,
4601 overlayStyle: Object,
4602 closeOnClick: Boolean,
4603 closeOnClickOverlay: Boolean,
4604 zIndex: numericProp
4605};
4606var stdin_default$1u = vue.defineComponent({
4607 name: name$1k,
4608 props: toastProps,
4609 emits: ["update:show"],
4610 setup(props2, {
4611 emit,
4612 slots
4613 }) {
4614 let timer2;
4615 let clickable = false;
4616 const toggleClickable = () => {
4617 const newValue = props2.show && props2.forbidClick;
4618 if (clickable !== newValue) {
4619 clickable = newValue;
4620 lockClick(clickable);
4621 }
4622 };
4623 const updateShow = (show) => emit("update:show", show);
4624 const onClick = () => {
4625 if (props2.closeOnClick) {
4626 updateShow(false);
4627 }
4628 };
4629 const clearTimer = () => clearTimeout(timer2);
4630 const renderIcon = () => {
4631 const {
4632 icon,
4633 type,
4634 iconSize,
4635 iconPrefix,
4636 loadingType
4637 } = props2;
4638 const hasIcon = icon || type === "success" || type === "fail";
4639 if (hasIcon) {
4640 return vue.createVNode(Icon, {
4641 "name": icon || type,
4642 "size": iconSize,
4643 "class": bem$1g("icon"),
4644 "classPrefix": iconPrefix
4645 }, null);
4646 }
4647 if (type === "loading") {
4648 return vue.createVNode(Loading, {
4649 "class": bem$1g("loading"),
4650 "size": iconSize,
4651 "type": loadingType
4652 }, null);
4653 }
4654 };
4655 const renderMessage = () => {
4656 const {
4657 type,
4658 message
4659 } = props2;
4660 if (slots.message) {
4661 return vue.createVNode("div", {
4662 "class": bem$1g("text")
4663 }, [slots.message()]);
4664 }
4665 if (isDef(message) && message !== "") {
4666 return type === "html" ? vue.createVNode("div", {
4667 "key": 0,
4668 "class": bem$1g("text"),
4669 "innerHTML": String(message)
4670 }, null) : vue.createVNode("div", {
4671 "class": bem$1g("text")
4672 }, [message]);
4673 }
4674 };
4675 vue.watch(() => [props2.show, props2.forbidClick], toggleClickable);
4676 vue.watch(() => [props2.show, props2.type, props2.message, props2.duration], () => {
4677 clearTimer();
4678 if (props2.show && props2.duration > 0) {
4679 timer2 = setTimeout(() => {
4680 updateShow(false);
4681 }, props2.duration);
4682 }
4683 });
4684 vue.onMounted(toggleClickable);
4685 vue.onUnmounted(toggleClickable);
4686 return () => vue.createVNode(Popup, vue.mergeProps({
4687 "class": [bem$1g([props2.position, props2.wordBreak === "normal" ? "break-normal" : props2.wordBreak, {
4688 [props2.type]: !props2.icon
4689 }]), props2.className],
4690 "lockScroll": false,
4691 "onClick": onClick,
4692 "onClosed": clearTimer,
4693 "onUpdate:show": updateShow
4694 }, pick(props2, popupInheritProps$1)), {
4695 default: () => [renderIcon(), renderMessage()]
4696 });
4697 }
4698});
4699function usePopupState() {
4700 const state = vue.reactive({
4701 show: false
4702 });
4703 const toggle = (show) => {
4704 state.show = show;
4705 };
4706 const open = (props2) => {
4707 extend(state, props2, { transitionAppear: true });
4708 toggle(true);
4709 };
4710 const close = () => toggle(false);
4711 useExpose({ open, close, toggle });
4712 return {
4713 open,
4714 close,
4715 state,
4716 toggle
4717 };
4718}
4719function mountComponent(RootComponent) {
4720 const app = vue.createApp(RootComponent);
4721 const root = document.createElement("div");
4722 document.body.appendChild(root);
4723 return {
4724 instance: app.mount(root),
4725 unmount() {
4726 app.unmount();
4727 document.body.removeChild(root);
4728 }
4729 };
4730}
4731const defaultOptions$1 = {
4732 icon: "",
4733 type: "text",
4734 message: "",
4735 className: "",
4736 overlay: false,
4737 onClose: void 0,
4738 onOpened: void 0,
4739 duration: 2e3,
4740 teleport: "body",
4741 iconSize: void 0,
4742 iconPrefix: void 0,
4743 position: "middle",
4744 transition: "van-fade",
4745 forbidClick: false,
4746 loadingType: void 0,
4747 overlayClass: "",
4748 overlayStyle: void 0,
4749 closeOnClick: false,
4750 closeOnClickOverlay: false
4751};
4752let queue = [];
4753let allowMultiple = false;
4754let currentOptions$2 = extend({}, defaultOptions$1);
4755const defaultOptionsMap = /* @__PURE__ */ new Map();
4756function parseOptions$1(message) {
4757 if (isObject(message)) {
4758 return message;
4759 }
4760 return {
4761 message
4762 };
4763}
4764function createInstance() {
4765 const {
4766 instance: instance2,
4767 unmount
4768 } = mountComponent({
4769 setup() {
4770 const message = vue.ref("");
4771 const {
4772 open,
4773 state,
4774 close,
4775 toggle
4776 } = usePopupState();
4777 const onClosed = () => {
4778 if (allowMultiple) {
4779 queue = queue.filter((item) => item !== instance2);
4780 unmount();
4781 }
4782 };
4783 const render = () => {
4784 const attrs = {
4785 onClosed,
4786 "onUpdate:show": toggle
4787 };
4788 return vue.createVNode(stdin_default$1u, vue.mergeProps(state, attrs), null);
4789 };
4790 vue.watch(message, (val) => {
4791 state.message = val;
4792 });
4793 vue.getCurrentInstance().render = render;
4794 return {
4795 open,
4796 close,
4797 message
4798 };
4799 }
4800 });
4801 return instance2;
4802}
4803function getInstance() {
4804 if (!queue.length || allowMultiple) {
4805 const instance2 = createInstance();
4806 queue.push(instance2);
4807 }
4808 return queue[queue.length - 1];
4809}
4810function showToast(options = {}) {
4811 if (!inBrowser) {
4812 return {};
4813 }
4814 const toast = getInstance();
4815 const parsedOptions = parseOptions$1(options);
4816 toast.open(extend({}, currentOptions$2, defaultOptionsMap.get(parsedOptions.type || currentOptions$2.type), parsedOptions));
4817 return toast;
4818}
4819const createMethod = (type) => (options) => showToast(extend({
4820 type
4821}, parseOptions$1(options)));
4822const showLoadingToast = createMethod("loading");
4823const showSuccessToast = createMethod("success");
4824const showFailToast = createMethod("fail");
4825const closeToast = (all) => {
4826 var _a;
4827 if (queue.length) {
4828 if (all) {
4829 queue.forEach((toast) => {
4830 toast.close();
4831 });
4832 queue = [];
4833 } else if (!allowMultiple) {
4834 queue[0].close();
4835 } else {
4836 (_a = queue.shift()) == null ? void 0 : _a.close();
4837 }
4838 }
4839};
4840function setToastDefaultOptions(type, options) {
4841 if (typeof type === "string") {
4842 defaultOptionsMap.set(type, options);
4843 } else {
4844 extend(currentOptions$2, type);
4845 }
4846}
4847const resetToastDefaultOptions = (type) => {
4848 if (typeof type === "string") {
4849 defaultOptionsMap.delete(type);
4850 } else {
4851 currentOptions$2 = extend({}, defaultOptions$1);
4852 defaultOptionsMap.clear();
4853 }
4854};
4855const allowMultipleToast = (value = true) => {
4856 allowMultiple = value;
4857};
4858const Toast = withInstall(stdin_default$1u);
4859const [name$1j, bem$1f] = createNamespace("switch");
4860const switchProps = {
4861 size: numericProp,
4862 loading: Boolean,
4863 disabled: Boolean,
4864 modelValue: unknownProp,
4865 activeColor: String,
4866 inactiveColor: String,
4867 activeValue: {
4868 type: unknownProp,
4869 default: true
4870 },
4871 inactiveValue: {
4872 type: unknownProp,
4873 default: false
4874 }
4875};
4876var stdin_default$1t = vue.defineComponent({
4877 name: name$1j,
4878 props: switchProps,
4879 emits: ["change", "update:modelValue"],
4880 setup(props2, {
4881 emit,
4882 slots
4883 }) {
4884 const isChecked = () => props2.modelValue === props2.activeValue;
4885 const onClick = () => {
4886 if (!props2.disabled && !props2.loading) {
4887 const newValue = isChecked() ? props2.inactiveValue : props2.activeValue;
4888 emit("update:modelValue", newValue);
4889 emit("change", newValue);
4890 }
4891 };
4892 const renderLoading = () => {
4893 if (props2.loading) {
4894 const color = isChecked() ? props2.activeColor : props2.inactiveColor;
4895 return vue.createVNode(Loading, {
4896 "class": bem$1f("loading"),
4897 "color": color
4898 }, null);
4899 }
4900 if (slots.node) {
4901 return slots.node();
4902 }
4903 };
4904 use.useCustomFieldValue(() => props2.modelValue);
4905 return () => {
4906 var _a;
4907 const {
4908 size,
4909 loading,
4910 disabled,
4911 activeColor,
4912 inactiveColor
4913 } = props2;
4914 const checked = isChecked();
4915 const style = {
4916 fontSize: addUnit(size),
4917 backgroundColor: checked ? activeColor : inactiveColor
4918 };
4919 return vue.createVNode("div", {
4920 "role": "switch",
4921 "class": bem$1f({
4922 on: checked,
4923 loading,
4924 disabled
4925 }),
4926 "style": style,
4927 "tabindex": disabled ? void 0 : 0,
4928 "aria-checked": checked,
4929 "onClick": onClick
4930 }, [vue.createVNode("div", {
4931 "class": bem$1f("node")
4932 }, [renderLoading()]), (_a = slots.background) == null ? void 0 : _a.call(slots)]);
4933 };
4934 }
4935});
4936const Switch = withInstall(stdin_default$1t);
4937const [name$1i, bem$1e] = createNamespace("address-edit-detail");
4938const t$j = createNamespace("address-edit")[2];
4939var stdin_default$1s = vue.defineComponent({
4940 name: name$1i,
4941 props: {
4942 show: Boolean,
4943 rows: numericProp,
4944 value: String,
4945 rules: Array,
4946 focused: Boolean,
4947 maxlength: numericProp,
4948 searchResult: Array,
4949 showSearchResult: Boolean
4950 },
4951 emits: ["blur", "focus", "input", "selectSearch"],
4952 setup(props2, {
4953 emit
4954 }) {
4955 const field = vue.ref();
4956 const showSearchResult = () => props2.focused && props2.searchResult && props2.showSearchResult;
4957 const onSelect = (express) => {
4958 emit("selectSearch", express);
4959 emit("input", `${express.address || ""} ${express.name || ""}`.trim());
4960 };
4961 const renderSearchResult = () => {
4962 if (!showSearchResult()) {
4963 return;
4964 }
4965 const {
4966 searchResult
4967 } = props2;
4968 return searchResult.map((express) => vue.createVNode(Cell, {
4969 "clickable": true,
4970 "key": (express.name || "") + (express.address || ""),
4971 "icon": "location-o",
4972 "title": express.name,
4973 "label": express.address,
4974 "class": bem$1e("search-item"),
4975 "border": false,
4976 "onClick": () => onSelect(express)
4977 }, null));
4978 };
4979 const onBlur = (event) => emit("blur", event);
4980 const onFocus = (event) => emit("focus", event);
4981 const onInput = (value) => emit("input", value);
4982 return () => {
4983 if (props2.show) {
4984 return vue.createVNode(vue.Fragment, null, [vue.createVNode(Field, {
4985 "autosize": true,
4986 "clearable": true,
4987 "ref": field,
4988 "class": bem$1e(),
4989 "rows": props2.rows,
4990 "type": "textarea",
4991 "rules": props2.rules,
4992 "label": t$j("addressDetail"),
4993 "border": !showSearchResult(),
4994 "maxlength": props2.maxlength,
4995 "modelValue": props2.value,
4996 "placeholder": t$j("addressDetail"),
4997 "onBlur": onBlur,
4998 "onFocus": onFocus,
4999 "onUpdate:modelValue": onInput
5000 }, null), renderSearchResult()]);
5001 }
5002 };
5003 }
5004});
5005const [name$1h, bem$1d, t$i] = createNamespace("address-edit");
5006const DEFAULT_DATA = {
5007 name: "",
5008 tel: "",
5009 city: "",
5010 county: "",
5011 country: "",
5012 province: "",
5013 areaCode: "",
5014 isDefault: false,
5015 addressDetail: ""
5016};
5017const addressEditProps = {
5018 areaList: Object,
5019 isSaving: Boolean,
5020 isDeleting: Boolean,
5021 validator: Function,
5022 showArea: truthProp,
5023 showDetail: truthProp,
5024 showDelete: Boolean,
5025 disableArea: Boolean,
5026 searchResult: Array,
5027 telMaxlength: numericProp,
5028 showSetDefault: Boolean,
5029 saveButtonText: String,
5030 areaPlaceholder: String,
5031 deleteButtonText: String,
5032 showSearchResult: Boolean,
5033 detailRows: makeNumericProp(1),
5034 detailMaxlength: makeNumericProp(200),
5035 areaColumnsPlaceholder: makeArrayProp(),
5036 addressInfo: {
5037 type: Object,
5038 default: () => extend({}, DEFAULT_DATA)
5039 },
5040 telValidator: {
5041 type: Function,
5042 default: isMobile
5043 }
5044};
5045var stdin_default$1r = vue.defineComponent({
5046 name: name$1h,
5047 props: addressEditProps,
5048 emits: ["save", "focus", "change", "delete", "clickArea", "changeArea", "changeDetail", "selectSearch", "changeDefault"],
5049 setup(props2, {
5050 emit,
5051 slots
5052 }) {
5053 const areaRef = vue.ref();
5054 const data = vue.reactive({});
5055 const showAreaPopup = vue.ref(false);
5056 const detailFocused = vue.ref(false);
5057 const areaListLoaded = vue.computed(() => isObject(props2.areaList) && Object.keys(props2.areaList).length);
5058 const areaText = vue.computed(() => {
5059 const {
5060 province,
5061 city,
5062 county,
5063 areaCode
5064 } = data;
5065 if (areaCode) {
5066 const arr = [province, city, county];
5067 if (province && province === city) {
5068 arr.splice(1, 1);
5069 }
5070 return arr.filter(Boolean).join("/");
5071 }
5072 return "";
5073 });
5074 const hideBottomFields = vue.computed(() => {
5075 var _a;
5076 return ((_a = props2.searchResult) == null ? void 0 : _a.length) && detailFocused.value;
5077 });
5078 const onFocus = (key) => {
5079 detailFocused.value = key === "addressDetail";
5080 emit("focus", key);
5081 };
5082 const onChange = (key, value) => {
5083 emit("change", {
5084 key,
5085 value
5086 });
5087 };
5088 const rules = vue.computed(() => {
5089 const {
5090 validator,
5091 telValidator
5092 } = props2;
5093 const makeRule = (name2, emptyMessage) => ({
5094 validator: (value) => {
5095 if (validator) {
5096 const message = validator(name2, value);
5097 if (message) {
5098 return message;
5099 }
5100 }
5101 if (!value) {
5102 return emptyMessage;
5103 }
5104 return true;
5105 }
5106 });
5107 return {
5108 name: [makeRule("name", t$i("nameEmpty"))],
5109 tel: [makeRule("tel", t$i("telInvalid")), {
5110 validator: telValidator,
5111 message: t$i("telInvalid")
5112 }],
5113 areaCode: [makeRule("areaCode", t$i("areaEmpty"))],
5114 addressDetail: [makeRule("addressDetail", t$i("addressEmpty"))]
5115 };
5116 });
5117 const onSave = () => emit("save", data);
5118 const onChangeDetail = (val) => {
5119 data.addressDetail = val;
5120 emit("changeDetail", val);
5121 };
5122 const assignAreaText = (options) => {
5123 data.province = options[0].text;
5124 data.city = options[1].text;
5125 data.county = options[2].text;
5126 };
5127 const onAreaConfirm = ({
5128 selectedValues,
5129 selectedOptions
5130 }) => {
5131 if (selectedValues.some((value) => value === AREA_EMPTY_CODE)) {
5132 showToast(t$i("areaEmpty"));
5133 } else {
5134 showAreaPopup.value = false;
5135 assignAreaText(selectedOptions);
5136 emit("changeArea", selectedOptions);
5137 }
5138 };
5139 const onDelete = () => emit("delete", data);
5140 const setAreaCode = (code) => {
5141 data.areaCode = code || "";
5142 };
5143 const onDetailBlur = () => {
5144 setTimeout(() => {
5145 detailFocused.value = false;
5146 });
5147 };
5148 const setAddressDetail = (value) => {
5149 data.addressDetail = value;
5150 };
5151 const renderSetDefaultCell = () => {
5152 if (props2.showSetDefault) {
5153 const slots2 = {
5154 "right-icon": () => vue.createVNode(Switch, {
5155 "modelValue": data.isDefault,
5156 "onUpdate:modelValue": ($event) => data.isDefault = $event,
5157 "onChange": (event) => emit("changeDefault", event)
5158 }, null)
5159 };
5160 return vue.withDirectives(vue.createVNode(Cell, {
5161 "center": true,
5162 "border": false,
5163 "title": t$i("defaultAddress"),
5164 "class": bem$1d("default")
5165 }, slots2), [[vue.vShow, !hideBottomFields.value]]);
5166 }
5167 };
5168 useExpose({
5169 setAreaCode,
5170 setAddressDetail
5171 });
5172 vue.watch(() => props2.addressInfo, (value) => {
5173 extend(data, DEFAULT_DATA, value);
5174 vue.nextTick(() => {
5175 var _a;
5176 const options = (_a = areaRef.value) == null ? void 0 : _a.getSelectedOptions();
5177 if (options && options.every((option) => option && option.value !== AREA_EMPTY_CODE)) {
5178 assignAreaText(options);
5179 }
5180 });
5181 }, {
5182 deep: true,
5183 immediate: true
5184 });
5185 return () => {
5186 const {
5187 disableArea
5188 } = props2;
5189 return vue.createVNode(Form, {
5190 "class": bem$1d(),
5191 "onSubmit": onSave
5192 }, {
5193 default: () => {
5194 var _a;
5195 return [vue.createVNode("div", {
5196 "class": bem$1d("fields")
5197 }, [vue.createVNode(Field, {
5198 "modelValue": data.name,
5199 "onUpdate:modelValue": [($event) => data.name = $event, (val) => onChange("name", val)],
5200 "clearable": true,
5201 "label": t$i("name"),
5202 "rules": rules.value.name,
5203 "placeholder": t$i("name"),
5204 "onFocus": () => onFocus("name")
5205 }, null), vue.createVNode(Field, {
5206 "modelValue": data.tel,
5207 "onUpdate:modelValue": [($event) => data.tel = $event, (val) => onChange("tel", val)],
5208 "clearable": true,
5209 "type": "tel",
5210 "label": t$i("tel"),
5211 "rules": rules.value.tel,
5212 "maxlength": props2.telMaxlength,
5213 "placeholder": t$i("tel"),
5214 "onFocus": () => onFocus("tel")
5215 }, null), vue.withDirectives(vue.createVNode(Field, {
5216 "readonly": true,
5217 "label": t$i("area"),
5218 "is-link": !disableArea,
5219 "modelValue": areaText.value,
5220 "rules": props2.showArea ? rules.value.areaCode : void 0,
5221 "placeholder": props2.areaPlaceholder || t$i("area"),
5222 "onFocus": () => onFocus("areaCode"),
5223 "onClick": () => {
5224 emit("clickArea");
5225 showAreaPopup.value = !disableArea;
5226 }
5227 }, null), [[vue.vShow, props2.showArea]]), vue.createVNode(stdin_default$1s, {
5228 "show": props2.showDetail,
5229 "rows": props2.detailRows,
5230 "rules": rules.value.addressDetail,
5231 "value": data.addressDetail,
5232 "focused": detailFocused.value,
5233 "maxlength": props2.detailMaxlength,
5234 "searchResult": props2.searchResult,
5235 "showSearchResult": props2.showSearchResult,
5236 "onBlur": onDetailBlur,
5237 "onFocus": () => onFocus("addressDetail"),
5238 "onInput": onChangeDetail,
5239 "onSelectSearch": (event) => emit("selectSearch", event)
5240 }, null), (_a = slots.default) == null ? void 0 : _a.call(slots)]), renderSetDefaultCell(), vue.withDirectives(vue.createVNode("div", {
5241 "class": bem$1d("buttons")
5242 }, [vue.createVNode(Button, {
5243 "block": true,
5244 "round": true,
5245 "type": "primary",
5246 "text": props2.saveButtonText || t$i("save"),
5247 "class": bem$1d("button"),
5248 "loading": props2.isSaving,
5249 "nativeType": "submit"
5250 }, null), props2.showDelete && vue.createVNode(Button, {
5251 "block": true,
5252 "round": true,
5253 "class": bem$1d("button"),
5254 "loading": props2.isDeleting,
5255 "text": props2.deleteButtonText || t$i("delete"),
5256 "onClick": onDelete
5257 }, null)]), [[vue.vShow, !hideBottomFields.value]]), vue.createVNode(Popup, {
5258 "show": showAreaPopup.value,
5259 "onUpdate:show": ($event) => showAreaPopup.value = $event,
5260 "round": true,
5261 "teleport": "body",
5262 "position": "bottom",
5263 "lazyRender": false
5264 }, {
5265 default: () => [vue.createVNode(Area, {
5266 "modelValue": data.areaCode,
5267 "onUpdate:modelValue": ($event) => data.areaCode = $event,
5268 "ref": areaRef,
5269 "loading": !areaListLoaded.value,
5270 "areaList": props2.areaList,
5271 "columnsPlaceholder": props2.areaColumnsPlaceholder,
5272 "onConfirm": onAreaConfirm,
5273 "onCancel": () => {
5274 showAreaPopup.value = false;
5275 }
5276 }, null)]
5277 })];
5278 }
5279 });
5280 };
5281 }
5282});
5283const AddressEdit = withInstall(stdin_default$1r);
5284const [name$1g, bem$1c] = createNamespace("radio-group");
5285const radioGroupProps = {
5286 shape: String,
5287 disabled: Boolean,
5288 iconSize: numericProp,
5289 direction: String,
5290 modelValue: unknownProp,
5291 checkedColor: String
5292};
5293const RADIO_KEY = Symbol(name$1g);
5294var stdin_default$1q = vue.defineComponent({
5295 name: name$1g,
5296 props: radioGroupProps,
5297 emits: ["change", "update:modelValue"],
5298 setup(props2, {
5299 emit,
5300 slots
5301 }) {
5302 const {
5303 linkChildren
5304 } = use.useChildren(RADIO_KEY);
5305 const updateValue = (value) => emit("update:modelValue", value);
5306 vue.watch(() => props2.modelValue, (value) => emit("change", value));
5307 linkChildren({
5308 props: props2,
5309 updateValue
5310 });
5311 use.useCustomFieldValue(() => props2.modelValue);
5312 return () => {
5313 var _a;
5314 return vue.createVNode("div", {
5315 "class": bem$1c([props2.direction]),
5316 "role": "radiogroup"
5317 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
5318 };
5319 }
5320});
5321const RadioGroup = withInstall(stdin_default$1q);
5322const [name$1f, bem$1b] = createNamespace("tag");
5323const tagProps = {
5324 size: String,
5325 mark: Boolean,
5326 show: truthProp,
5327 type: makeStringProp("default"),
5328 color: String,
5329 plain: Boolean,
5330 round: Boolean,
5331 textColor: String,
5332 closeable: Boolean
5333};
5334var stdin_default$1p = vue.defineComponent({
5335 name: name$1f,
5336 props: tagProps,
5337 emits: ["close"],
5338 setup(props2, {
5339 slots,
5340 emit
5341 }) {
5342 const onClose = (event) => {
5343 event.stopPropagation();
5344 emit("close", event);
5345 };
5346 const getStyle = () => {
5347 if (props2.plain) {
5348 return {
5349 color: props2.textColor || props2.color,
5350 borderColor: props2.color
5351 };
5352 }
5353 return {
5354 color: props2.textColor,
5355 background: props2.color
5356 };
5357 };
5358 const renderTag = () => {
5359 var _a;
5360 const {
5361 type,
5362 mark,
5363 plain,
5364 round,
5365 size,
5366 closeable
5367 } = props2;
5368 const classes = {
5369 mark,
5370 plain,
5371 round
5372 };
5373 if (size) {
5374 classes[size] = size;
5375 }
5376 const CloseIcon = closeable && vue.createVNode(Icon, {
5377 "name": "cross",
5378 "class": [bem$1b("close"), HAPTICS_FEEDBACK],
5379 "onClick": onClose
5380 }, null);
5381 return vue.createVNode("span", {
5382 "style": getStyle(),
5383 "class": bem$1b([classes, type])
5384 }, [(_a = slots.default) == null ? void 0 : _a.call(slots), CloseIcon]);
5385 };
5386 return () => vue.createVNode(vue.Transition, {
5387 "name": props2.closeable ? "van-fade" : void 0
5388 }, {
5389 default: () => [props2.show ? renderTag() : null]
5390 });
5391 }
5392});
5393const Tag = withInstall(stdin_default$1p);
5394const checkerProps = {
5395 name: unknownProp,
5396 disabled: Boolean,
5397 iconSize: numericProp,
5398 modelValue: unknownProp,
5399 checkedColor: String,
5400 labelPosition: String,
5401 labelDisabled: Boolean
5402};
5403var stdin_default$1o = vue.defineComponent({
5404 props: extend({}, checkerProps, {
5405 bem: makeRequiredProp(Function),
5406 role: String,
5407 shape: String,
5408 parent: Object,
5409 checked: Boolean,
5410 bindGroup: truthProp,
5411 indeterminate: {
5412 type: Boolean,
5413 default: null
5414 }
5415 }),
5416 emits: ["click", "toggle"],
5417 setup(props2, {
5418 emit,
5419 slots
5420 }) {
5421 const iconRef = vue.ref();
5422 const getParentProp = (name2) => {
5423 if (props2.parent && props2.bindGroup) {
5424 return props2.parent.props[name2];
5425 }
5426 };
5427 const disabled = vue.computed(() => {
5428 if (props2.parent && props2.bindGroup) {
5429 const disabled2 = getParentProp("disabled") || props2.disabled;
5430 if (props2.role === "checkbox") {
5431 const checkedCount = getParentProp("modelValue").length;
5432 const max = getParentProp("max");
5433 const overlimit = max && checkedCount >= +max;
5434 return disabled2 || overlimit && !props2.checked;
5435 }
5436 return disabled2;
5437 }
5438 return props2.disabled;
5439 });
5440 const direction = vue.computed(() => getParentProp("direction"));
5441 const iconStyle = vue.computed(() => {
5442 const checkedColor = props2.checkedColor || getParentProp("checkedColor");
5443 if (checkedColor && props2.checked && !disabled.value) {
5444 return {
5445 borderColor: checkedColor,
5446 backgroundColor: checkedColor
5447 };
5448 }
5449 });
5450 const shape = vue.computed(() => {
5451 return props2.shape || getParentProp("shape") || "round";
5452 });
5453 const onClick = (event) => {
5454 const {
5455 target
5456 } = event;
5457 const icon = iconRef.value;
5458 const iconClicked = icon === target || (icon == null ? void 0 : icon.contains(target));
5459 if (!disabled.value && (iconClicked || !props2.labelDisabled)) {
5460 emit("toggle");
5461 }
5462 emit("click", event);
5463 };
5464 const renderIcon = () => {
5465 var _a, _b;
5466 const {
5467 bem: bem2,
5468 checked,
5469 indeterminate
5470 } = props2;
5471 const iconSize = props2.iconSize || getParentProp("iconSize");
5472 return vue.createVNode("div", {
5473 "ref": iconRef,
5474 "class": bem2("icon", [shape.value, {
5475 disabled: disabled.value,
5476 checked,
5477 indeterminate
5478 }]),
5479 "style": shape.value !== "dot" ? {
5480 fontSize: addUnit(iconSize)
5481 } : {
5482 width: addUnit(iconSize),
5483 height: addUnit(iconSize),
5484 borderColor: (_a = iconStyle.value) == null ? void 0 : _a.borderColor
5485 }
5486 }, [slots.icon ? slots.icon({
5487 checked,
5488 disabled: disabled.value
5489 }) : shape.value !== "dot" ? vue.createVNode(Icon, {
5490 "name": indeterminate ? "minus" : "success",
5491 "style": iconStyle.value
5492 }, null) : vue.createVNode("div", {
5493 "class": bem2("icon--dot__icon"),
5494 "style": {
5495 backgroundColor: (_b = iconStyle.value) == null ? void 0 : _b.backgroundColor
5496 }
5497 }, null)]);
5498 };
5499 const renderLabel = () => {
5500 const {
5501 checked
5502 } = props2;
5503 if (slots.default) {
5504 return vue.createVNode("span", {
5505 "class": props2.bem("label", [props2.labelPosition, {
5506 disabled: disabled.value
5507 }])
5508 }, [slots.default({
5509 checked,
5510 disabled: disabled.value
5511 })]);
5512 }
5513 };
5514 return () => {
5515 const nodes = props2.labelPosition === "left" ? [renderLabel(), renderIcon()] : [renderIcon(), renderLabel()];
5516 return vue.createVNode("div", {
5517 "role": props2.role,
5518 "class": props2.bem([{
5519 disabled: disabled.value,
5520 "label-disabled": props2.labelDisabled
5521 }, direction.value]),
5522 "tabindex": disabled.value ? void 0 : 0,
5523 "aria-checked": props2.checked,
5524 "onClick": onClick
5525 }, [nodes]);
5526 };
5527 }
5528});
5529const radioProps = extend({}, checkerProps, {
5530 shape: String
5531});
5532const [name$1e, bem$1a] = createNamespace("radio");
5533var stdin_default$1n = vue.defineComponent({
5534 name: name$1e,
5535 props: radioProps,
5536 emits: ["update:modelValue"],
5537 setup(props2, {
5538 emit,
5539 slots
5540 }) {
5541 const {
5542 parent
5543 } = use.useParent(RADIO_KEY);
5544 const checked = () => {
5545 const value = parent ? parent.props.modelValue : props2.modelValue;
5546 return value === props2.name;
5547 };
5548 const toggle = () => {
5549 if (parent) {
5550 parent.updateValue(props2.name);
5551 } else {
5552 emit("update:modelValue", props2.name);
5553 }
5554 };
5555 return () => vue.createVNode(stdin_default$1o, vue.mergeProps({
5556 "bem": bem$1a,
5557 "role": "radio",
5558 "parent": parent,
5559 "checked": checked(),
5560 "onToggle": toggle
5561 }, props2), pick(slots, ["default", "icon"]));
5562 }
5563});
5564const Radio = withInstall(stdin_default$1n);
5565const [name$1d, bem$19] = createNamespace("address-item");
5566var stdin_default$1m = vue.defineComponent({
5567 name: name$1d,
5568 props: {
5569 address: makeRequiredProp(Object),
5570 disabled: Boolean,
5571 switchable: Boolean,
5572 defaultTagText: String,
5573 rightIcon: makeStringProp("edit")
5574 },
5575 emits: ["edit", "click", "select"],
5576 setup(props2, {
5577 slots,
5578 emit
5579 }) {
5580 const onClick = () => {
5581 if (props2.switchable) {
5582 emit("select");
5583 }
5584 emit("click");
5585 };
5586 const renderRightIcon = () => vue.createVNode(Icon, {
5587 "name": props2.rightIcon,
5588 "class": bem$19("edit"),
5589 "onClick": (event) => {
5590 event.stopPropagation();
5591 emit("edit");
5592 emit("click");
5593 }
5594 }, null);
5595 const renderTag = () => {
5596 if (slots.tag) {
5597 return slots.tag(props2.address);
5598 }
5599 if (props2.address.isDefault && props2.defaultTagText) {
5600 return vue.createVNode(Tag, {
5601 "type": "primary",
5602 "round": true,
5603 "class": bem$19("tag")
5604 }, {
5605 default: () => [props2.defaultTagText]
5606 });
5607 }
5608 };
5609 const renderContent = () => {
5610 const {
5611 address,
5612 disabled,
5613 switchable
5614 } = props2;
5615 const Info = [vue.createVNode("div", {
5616 "class": bem$19("name")
5617 }, [`${address.name} ${address.tel}`, renderTag()]), vue.createVNode("div", {
5618 "class": bem$19("address")
5619 }, [address.address])];
5620 if (switchable && !disabled) {
5621 return vue.createVNode(Radio, {
5622 "name": address.id,
5623 "iconSize": 18
5624 }, {
5625 default: () => [Info]
5626 });
5627 }
5628 return Info;
5629 };
5630 return () => {
5631 var _a;
5632 const {
5633 disabled
5634 } = props2;
5635 return vue.createVNode("div", {
5636 "class": bem$19({
5637 disabled
5638 }),
5639 "onClick": onClick
5640 }, [vue.createVNode(Cell, {
5641 "border": false,
5642 "titleClass": bem$19("title")
5643 }, {
5644 title: renderContent,
5645 "right-icon": renderRightIcon
5646 }), (_a = slots.bottom) == null ? void 0 : _a.call(slots, extend({}, props2.address, {
5647 disabled
5648 }))]);
5649 };
5650 }
5651});
5652const [name$1c, bem$18, t$h] = createNamespace("address-list");
5653const addressListProps = {
5654 list: makeArrayProp(),
5655 modelValue: numericProp,
5656 switchable: truthProp,
5657 disabledText: String,
5658 disabledList: makeArrayProp(),
5659 showAddButton: truthProp,
5660 addButtonText: String,
5661 defaultTagText: String,
5662 rightIcon: makeStringProp("edit")
5663};
5664var stdin_default$1l = vue.defineComponent({
5665 name: name$1c,
5666 props: addressListProps,
5667 emits: ["add", "edit", "select", "clickItem", "editDisabled", "selectDisabled", "update:modelValue"],
5668 setup(props2, {
5669 slots,
5670 emit
5671 }) {
5672 const renderItem = (item, index, disabled) => {
5673 const onEdit = () => emit(disabled ? "editDisabled" : "edit", item, index);
5674 const onClick = () => emit("clickItem", item, index);
5675 const onSelect = () => {
5676 emit(disabled ? "selectDisabled" : "select", item, index);
5677 if (!disabled) {
5678 emit("update:modelValue", item.id);
5679 }
5680 };
5681 return vue.createVNode(stdin_default$1m, {
5682 "key": item.id,
5683 "address": item,
5684 "disabled": disabled,
5685 "switchable": props2.switchable,
5686 "defaultTagText": props2.defaultTagText,
5687 "rightIcon": props2.rightIcon,
5688 "onEdit": onEdit,
5689 "onClick": onClick,
5690 "onSelect": onSelect
5691 }, {
5692 bottom: slots["item-bottom"],
5693 tag: slots.tag
5694 });
5695 };
5696 const renderList = (list, disabled) => {
5697 if (list) {
5698 return list.map((item, index) => renderItem(item, index, disabled));
5699 }
5700 };
5701 const renderBottom = () => props2.showAddButton ? vue.createVNode("div", {
5702 "class": [bem$18("bottom"), "van-safe-area-bottom"]
5703 }, [vue.createVNode(Button, {
5704 "round": true,
5705 "block": true,
5706 "type": "primary",
5707 "text": props2.addButtonText || t$h("add"),
5708 "class": bem$18("add"),
5709 "onClick": () => emit("add")
5710 }, null)]) : void 0;
5711 return () => {
5712 var _a, _b;
5713 const List2 = renderList(props2.list);
5714 const DisabledList = renderList(props2.disabledList, true);
5715 const DisabledText = props2.disabledText && vue.createVNode("div", {
5716 "class": bem$18("disabled-text")
5717 }, [props2.disabledText]);
5718 return vue.createVNode("div", {
5719 "class": bem$18()
5720 }, [(_a = slots.top) == null ? void 0 : _a.call(slots), vue.createVNode(RadioGroup, {
5721 "modelValue": props2.modelValue
5722 }, {
5723 default: () => [List2]
5724 }), DisabledText, DisabledList, (_b = slots.default) == null ? void 0 : _b.call(slots), renderBottom()]);
5725 };
5726 }
5727});
5728const AddressList = withInstall(stdin_default$1l);
5729const hasIntersectionObserver = use.inBrowser && "IntersectionObserver" in window && "IntersectionObserverEntry" in window && "intersectionRatio" in window.IntersectionObserverEntry.prototype;
5730const modeType = {
5731 event: "event",
5732 observer: "observer"
5733};
5734function remove(arr, item) {
5735 if (!arr.length)
5736 return;
5737 const index = arr.indexOf(item);
5738 if (index > -1)
5739 return arr.splice(index, 1);
5740}
5741function getBestSelectionFromSrcset(el, scale) {
5742 if (el.tagName !== "IMG" || !el.getAttribute("data-srcset"))
5743 return;
5744 let options = el.getAttribute("data-srcset");
5745 const container = el.parentNode;
5746 const containerWidth = container.offsetWidth * scale;
5747 let spaceIndex;
5748 let tmpSrc;
5749 let tmpWidth;
5750 options = options.trim().split(",");
5751 const result = options.map((item) => {
5752 item = item.trim();
5753 spaceIndex = item.lastIndexOf(" ");
5754 if (spaceIndex === -1) {
5755 tmpSrc = item;
5756 tmpWidth = 999998;
5757 } else {
5758 tmpSrc = item.substr(0, spaceIndex);
5759 tmpWidth = parseInt(
5760 item.substr(spaceIndex + 1, item.length - spaceIndex - 2),
5761 10
5762 );
5763 }
5764 return [tmpWidth, tmpSrc];
5765 });
5766 result.sort((a, b) => {
5767 if (a[0] < b[0]) {
5768 return 1;
5769 }
5770 if (a[0] > b[0]) {
5771 return -1;
5772 }
5773 if (a[0] === b[0]) {
5774 if (b[1].indexOf(".webp", b[1].length - 5) !== -1) {
5775 return 1;
5776 }
5777 if (a[1].indexOf(".webp", a[1].length - 5) !== -1) {
5778 return -1;
5779 }
5780 }
5781 return 0;
5782 });
5783 let bestSelectedSrc = "";
5784 let tmpOption;
5785 for (let i = 0; i < result.length; i++) {
5786 tmpOption = result[i];
5787 bestSelectedSrc = tmpOption[1];
5788 const next = result[i + 1];
5789 if (next && next[0] < containerWidth) {
5790 bestSelectedSrc = tmpOption[1];
5791 break;
5792 } else if (!next) {
5793 bestSelectedSrc = tmpOption[1];
5794 break;
5795 }
5796 }
5797 return bestSelectedSrc;
5798}
5799const getDPR = (scale = 1) => use.inBrowser ? window.devicePixelRatio || scale : scale;
5800function supportWebp() {
5801 if (!use.inBrowser)
5802 return false;
5803 let support = true;
5804 try {
5805 const elem = document.createElement("canvas");
5806 if (elem.getContext && elem.getContext("2d")) {
5807 support = elem.toDataURL("image/webp").indexOf("data:image/webp") === 0;
5808 }
5809 } catch (err) {
5810 support = false;
5811 }
5812 return support;
5813}
5814function throttle(action, delay) {
5815 let timeout = null;
5816 let lastRun = 0;
5817 return function(...args) {
5818 if (timeout) {
5819 return;
5820 }
5821 const elapsed = Date.now() - lastRun;
5822 const runCallback = () => {
5823 lastRun = Date.now();
5824 timeout = false;
5825 action.apply(this, args);
5826 };
5827 if (elapsed >= delay) {
5828 runCallback();
5829 } else {
5830 timeout = setTimeout(runCallback, delay);
5831 }
5832 };
5833}
5834function on(el, type, func) {
5835 el.addEventListener(type, func, {
5836 capture: false,
5837 passive: true
5838 });
5839}
5840function off(el, type, func) {
5841 el.removeEventListener(type, func, false);
5842}
5843const loadImageAsync = (item, resolve, reject) => {
5844 const image = new Image();
5845 if (!item || !item.src) {
5846 return reject(new Error("image src is required"));
5847 }
5848 image.src = item.src;
5849 if (item.cors) {
5850 image.crossOrigin = item.cors;
5851 }
5852 image.onload = () => resolve({
5853 naturalHeight: image.naturalHeight,
5854 naturalWidth: image.naturalWidth,
5855 src: image.src
5856 });
5857 image.onerror = (e) => reject(e);
5858};
5859class ImageCache {
5860 constructor({ max }) {
5861 this.options = {
5862 max: max || 100
5863 };
5864 this.caches = [];
5865 }
5866 has(key) {
5867 return this.caches.indexOf(key) > -1;
5868 }
5869 add(key) {
5870 if (this.has(key))
5871 return;
5872 this.caches.push(key);
5873 if (this.caches.length > this.options.max) {
5874 this.free();
5875 }
5876 }
5877 free() {
5878 this.caches.shift();
5879 }
5880}
5881const [name$1b, bem$17] = createNamespace("back-top");
5882const backTopProps = {
5883 right: numericProp,
5884 bottom: numericProp,
5885 zIndex: numericProp,
5886 target: [String, Object],
5887 offset: makeNumericProp(200),
5888 immediate: Boolean,
5889 teleport: {
5890 type: [String, Object],
5891 default: "body"
5892 }
5893};
5894var stdin_default$1k = vue.defineComponent({
5895 name: name$1b,
5896 inheritAttrs: false,
5897 props: backTopProps,
5898 emits: ["click"],
5899 setup(props2, {
5900 emit,
5901 slots,
5902 attrs
5903 }) {
5904 let shouldReshow = false;
5905 const show = vue.ref(false);
5906 const root = vue.ref();
5907 const scrollParent = vue.ref();
5908 const style = vue.computed(() => extend(getZIndexStyle(props2.zIndex), {
5909 right: addUnit(props2.right),
5910 bottom: addUnit(props2.bottom)
5911 }));
5912 const onClick = (event) => {
5913 var _a;
5914 emit("click", event);
5915 (_a = scrollParent.value) == null ? void 0 : _a.scrollTo({
5916 top: 0,
5917 behavior: props2.immediate ? "auto" : "smooth"
5918 });
5919 };
5920 const scroll = () => {
5921 show.value = scrollParent.value ? getScrollTop(scrollParent.value) >= +props2.offset : false;
5922 };
5923 const getTarget = () => {
5924 const {
5925 target
5926 } = props2;
5927 if (typeof target === "string") {
5928 const el = document.querySelector(target);
5929 if (el) {
5930 return el;
5931 }
5932 if (process.env.NODE_ENV !== "production") {
5933 console.error(`[Vant] BackTop: target element "${target}" was not found, the BackTop component will not be rendered.`);
5934 }
5935 } else {
5936 return target;
5937 }
5938 };
5939 const updateTarget = () => {
5940 if (inBrowser) {
5941 vue.nextTick(() => {
5942 scrollParent.value = props2.target ? getTarget() : use.getScrollParent(root.value);
5943 scroll();
5944 });
5945 }
5946 };
5947 use.useEventListener("scroll", throttle(scroll, 100), {
5948 target: scrollParent
5949 });
5950 vue.onMounted(updateTarget);
5951 vue.onActivated(() => {
5952 if (shouldReshow) {
5953 show.value = true;
5954 shouldReshow = false;
5955 }
5956 });
5957 vue.onDeactivated(() => {
5958 if (show.value && props2.teleport) {
5959 show.value = false;
5960 shouldReshow = true;
5961 }
5962 });
5963 vue.watch(() => props2.target, updateTarget);
5964 return () => {
5965 const Content = vue.createVNode("div", vue.mergeProps({
5966 "ref": !props2.teleport ? root : void 0,
5967 "class": bem$17({
5968 active: show.value
5969 }),
5970 "style": style.value,
5971 "onClick": onClick
5972 }, attrs), [slots.default ? slots.default() : vue.createVNode(Icon, {
5973 "name": "back-top",
5974 "class": bem$17("icon")
5975 }, null)]);
5976 if (props2.teleport) {
5977 return [vue.createVNode("div", {
5978 "ref": root,
5979 "class": bem$17("placeholder")
5980 }, null), vue.createVNode(vue.Teleport, {
5981 "to": props2.teleport
5982 }, {
5983 default: () => [Content]
5984 })];
5985 }
5986 return Content;
5987 };
5988 }
5989});
5990const BackTop = withInstall(stdin_default$1k);
5991var __async = (__this, __arguments, generator) => {
5992 return new Promise((resolve, reject) => {
5993 var fulfilled = (value) => {
5994 try {
5995 step(generator.next(value));
5996 } catch (e) {
5997 reject(e);
5998 }
5999 };
6000 var rejected = (value) => {
6001 try {
6002 step(generator.throw(value));
6003 } catch (e) {
6004 reject(e);
6005 }
6006 };
6007 var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
6008 step((generator = generator.apply(__this, __arguments)).next());
6009 });
6010};
6011const barrageProps = {
6012 top: makeNumericProp(10),
6013 rows: makeNumericProp(4),
6014 duration: makeNumericProp(4e3),
6015 autoPlay: truthProp,
6016 delay: makeNumberProp(300),
6017 modelValue: makeArrayProp()
6018};
6019const [name$1a, bem$16] = createNamespace("barrage");
6020var stdin_default$1j = vue.defineComponent({
6021 name: name$1a,
6022 props: barrageProps,
6023 emits: ["update:modelValue"],
6024 setup(props2, {
6025 emit,
6026 slots
6027 }) {
6028 const barrageWrapper = vue.ref();
6029 const className = bem$16("item");
6030 const total = vue.ref(0);
6031 const barrageItems = [];
6032 const createBarrageItem = (text, delay = props2.delay) => {
6033 const item = document.createElement("span");
6034 item.className = className;
6035 item.innerText = String(text);
6036 item.style.animationDuration = `${props2.duration}ms`;
6037 item.style.animationDelay = `${delay}ms`;
6038 item.style.animationName = "van-barrage";
6039 item.style.animationTimingFunction = "linear";
6040 return item;
6041 };
6042 const isInitBarrage = vue.ref(true);
6043 const isPlay = vue.ref(props2.autoPlay);
6044 const appendBarrageItem = ({
6045 id,
6046 text
6047 }, i) => {
6048 var _a;
6049 const item = createBarrageItem(text, isInitBarrage.value ? i * props2.delay : void 0);
6050 if (!props2.autoPlay && isPlay.value === false) {
6051 item.style.animationPlayState = "paused";
6052 }
6053 (_a = barrageWrapper.value) == null ? void 0 : _a.append(item);
6054 total.value++;
6055 const top = (total.value - 1) % +props2.rows * item.offsetHeight + +props2.top;
6056 item.style.top = `${top}px`;
6057 item.dataset.id = String(id);
6058 barrageItems.push(item);
6059 item.addEventListener("animationend", () => {
6060 emit("update:modelValue", [...props2.modelValue].filter((v) => String(v.id) !== item.dataset.id));
6061 });
6062 };
6063 const updateBarrages = (newValue, oldValue) => {
6064 const map = new Map(oldValue.map((item) => [item.id, item]));
6065 newValue.forEach((item, i) => {
6066 if (map.has(item.id)) {
6067 map.delete(item.id);
6068 } else {
6069 appendBarrageItem(item, i);
6070 }
6071 });
6072 map.forEach((item) => {
6073 const index = barrageItems.findIndex((span) => span.dataset.id === String(item.id));
6074 if (index > -1) {
6075 barrageItems[index].remove();
6076 barrageItems.splice(index, 1);
6077 }
6078 });
6079 isInitBarrage.value = false;
6080 };
6081 vue.watch(() => props2.modelValue.slice(), (newValue, oldValue) => updateBarrages(newValue != null ? newValue : [], oldValue != null ? oldValue : []), {
6082 deep: true
6083 });
6084 const rootStyle = vue.ref({});
6085 vue.onMounted(() => __async(this, null, function* () {
6086 var _a;
6087 rootStyle.value["--move-distance"] = `-${(_a = barrageWrapper.value) == null ? void 0 : _a.offsetWidth}px`;
6088 yield vue.nextTick();
6089 updateBarrages(props2.modelValue, []);
6090 }));
6091 const play = () => {
6092 isPlay.value = true;
6093 barrageItems.forEach((item) => {
6094 item.style.animationPlayState = "running";
6095 });
6096 };
6097 const pause = () => {
6098 isPlay.value = false;
6099 barrageItems.forEach((item) => {
6100 item.style.animationPlayState = "paused";
6101 });
6102 };
6103 useExpose({
6104 play,
6105 pause
6106 });
6107 return () => {
6108 var _a;
6109 return vue.createVNode("div", {
6110 "class": bem$16(),
6111 "ref": barrageWrapper,
6112 "style": rootStyle.value
6113 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
6114 };
6115 }
6116});
6117const Barrage = withInstall(stdin_default$1j);
6118const [name$19, bem$15, t$g] = createNamespace("calendar");
6119const formatMonthTitle = (date) => t$g("monthTitle", date.getFullYear(), date.getMonth() + 1);
6120function compareMonth(date1, date2) {
6121 const year1 = date1.getFullYear();
6122 const year2 = date2.getFullYear();
6123 if (year1 === year2) {
6124 const month1 = date1.getMonth();
6125 const month2 = date2.getMonth();
6126 return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
6127 }
6128 return year1 > year2 ? 1 : -1;
6129}
6130function compareDay(day1, day2) {
6131 const compareMonthResult = compareMonth(day1, day2);
6132 if (compareMonthResult === 0) {
6133 const date1 = day1.getDate();
6134 const date2 = day2.getDate();
6135 return date1 === date2 ? 0 : date1 > date2 ? 1 : -1;
6136 }
6137 return compareMonthResult;
6138}
6139const cloneDate = (date) => new Date(date);
6140const cloneDates = (dates) => Array.isArray(dates) ? dates.map(cloneDate) : cloneDate(dates);
6141function getDayByOffset(date, offset) {
6142 const cloned = cloneDate(date);
6143 cloned.setDate(cloned.getDate() + offset);
6144 return cloned;
6145}
6146const getPrevDay = (date) => getDayByOffset(date, -1);
6147const getNextDay = (date) => getDayByOffset(date, 1);
6148const getToday = () => {
6149 const today = /* @__PURE__ */ new Date();
6150 today.setHours(0, 0, 0, 0);
6151 return today;
6152};
6153function calcDateNum(date) {
6154 const day1 = date[0].getTime();
6155 const day2 = date[1].getTime();
6156 return (day2 - day1) / (1e3 * 60 * 60 * 24) + 1;
6157}
6158const sharedProps = extend({}, pickerSharedProps, {
6159 modelValue: makeArrayProp(),
6160 filter: Function,
6161 formatter: {
6162 type: Function,
6163 default: (type, option) => option
6164 }
6165});
6166const pickerInheritKeys = Object.keys(pickerSharedProps);
6167function times(n, iteratee) {
6168 if (n < 0) {
6169 return [];
6170 }
6171 const result = Array(n);
6172 let index = -1;
6173 while (++index < n) {
6174 result[index] = iteratee(index);
6175 }
6176 return result;
6177}
6178const getMonthEndDay = (year, month) => 32 - new Date(year, month - 1, 32).getDate();
6179const genOptions = (min, max, type, formatter, filter, values) => {
6180 const options = times(max - min + 1, (index) => {
6181 const value = padZero(min + index);
6182 return formatter(type, {
6183 text: value,
6184 value
6185 });
6186 });
6187 return filter ? filter(type, options, values) : options;
6188};
6189const formatValueRange = (values, columns) => values.map((value, index) => {
6190 const column = columns[index];
6191 if (column.length) {
6192 const minValue = +column[0].value;
6193 const maxValue = +column[column.length - 1].value;
6194 return padZero(clamp(+value, minValue, maxValue));
6195 }
6196 return value;
6197});
6198const [name$18] = createNamespace("calendar-day");
6199var stdin_default$1i = vue.defineComponent({
6200 name: name$18,
6201 props: {
6202 item: makeRequiredProp(Object),
6203 color: String,
6204 index: Number,
6205 offset: makeNumberProp(0),
6206 rowHeight: String
6207 },
6208 emits: ["click", "clickDisabledDate"],
6209 setup(props2, {
6210 emit,
6211 slots
6212 }) {
6213 const style = vue.computed(() => {
6214 var _a;
6215 const {
6216 item,
6217 index,
6218 color,
6219 offset,
6220 rowHeight
6221 } = props2;
6222 const style2 = {
6223 height: rowHeight
6224 };
6225 if (item.type === "placeholder") {
6226 style2.width = "100%";
6227 return style2;
6228 }
6229 if (index === 0) {
6230 style2.marginLeft = `${100 * offset / 7}%`;
6231 }
6232 if (color) {
6233 switch (item.type) {
6234 case "end":
6235 case "start":
6236 case "start-end":
6237 case "multiple-middle":
6238 case "multiple-selected":
6239 style2.background = color;
6240 break;
6241 case "middle":
6242 style2.color = color;
6243 break;
6244 }
6245 }
6246 if (offset + (((_a = item.date) == null ? void 0 : _a.getDate()) || 1) > 28) {
6247 style2.marginBottom = 0;
6248 }
6249 return style2;
6250 });
6251 const onClick = () => {
6252 if (props2.item.type !== "disabled") {
6253 emit("click", props2.item);
6254 } else {
6255 emit("clickDisabledDate", props2.item);
6256 }
6257 };
6258 const renderTopInfo = () => {
6259 const {
6260 topInfo
6261 } = props2.item;
6262 if (topInfo || slots["top-info"]) {
6263 return vue.createVNode("div", {
6264 "class": bem$15("top-info")
6265 }, [slots["top-info"] ? slots["top-info"](props2.item) : topInfo]);
6266 }
6267 };
6268 const renderBottomInfo = () => {
6269 const {
6270 bottomInfo
6271 } = props2.item;
6272 if (bottomInfo || slots["bottom-info"]) {
6273 return vue.createVNode("div", {
6274 "class": bem$15("bottom-info")
6275 }, [slots["bottom-info"] ? slots["bottom-info"](props2.item) : bottomInfo]);
6276 }
6277 };
6278 const renderContent = () => {
6279 const {
6280 item,
6281 color,
6282 rowHeight
6283 } = props2;
6284 const {
6285 type,
6286 text
6287 } = item;
6288 const Nodes = [renderTopInfo(), text, renderBottomInfo()];
6289 if (type === "selected") {
6290 return vue.createVNode("div", {
6291 "class": bem$15("selected-day"),
6292 "style": {
6293 width: rowHeight,
6294 height: rowHeight,
6295 background: color
6296 }
6297 }, [Nodes]);
6298 }
6299 return Nodes;
6300 };
6301 return () => {
6302 const {
6303 type,
6304 className
6305 } = props2.item;
6306 if (type === "placeholder") {
6307 return vue.createVNode("div", {
6308 "class": bem$15("day"),
6309 "style": style.value
6310 }, null);
6311 }
6312 return vue.createVNode("div", {
6313 "role": "gridcell",
6314 "style": style.value,
6315 "class": [bem$15("day", type), className],
6316 "tabindex": type === "disabled" ? void 0 : -1,
6317 "onClick": onClick
6318 }, [renderContent()]);
6319 };
6320 }
6321});
6322const [name$17] = createNamespace("calendar-month");
6323const calendarMonthProps = {
6324 date: makeRequiredProp(Date),
6325 type: String,
6326 color: String,
6327 minDate: makeRequiredProp(Date),
6328 maxDate: makeRequiredProp(Date),
6329 showMark: Boolean,
6330 rowHeight: numericProp,
6331 formatter: Function,
6332 lazyRender: Boolean,
6333 currentDate: [Date, Array],
6334 allowSameDay: Boolean,
6335 showSubtitle: Boolean,
6336 showMonthTitle: Boolean,
6337 firstDayOfWeek: Number
6338};
6339var stdin_default$1h = vue.defineComponent({
6340 name: name$17,
6341 props: calendarMonthProps,
6342 emits: ["click", "clickDisabledDate"],
6343 setup(props2, {
6344 emit,
6345 slots
6346 }) {
6347 const [visible, setVisible] = use.useToggle();
6348 const daysRef = vue.ref();
6349 const monthRef = vue.ref();
6350 const height = useHeight(monthRef);
6351 const title = vue.computed(() => formatMonthTitle(props2.date));
6352 const rowHeight = vue.computed(() => addUnit(props2.rowHeight));
6353 const offset = vue.computed(() => {
6354 const realDay = props2.date.getDay();
6355 if (props2.firstDayOfWeek) {
6356 return (realDay + 7 - props2.firstDayOfWeek) % 7;
6357 }
6358 return realDay;
6359 });
6360 const totalDay = vue.computed(() => getMonthEndDay(props2.date.getFullYear(), props2.date.getMonth() + 1));
6361 const shouldRender = vue.computed(() => visible.value || !props2.lazyRender);
6362 const getTitle = () => title.value;
6363 const getMultipleDayType = (day) => {
6364 const isSelected = (date) => props2.currentDate.some((item) => compareDay(item, date) === 0);
6365 if (isSelected(day)) {
6366 const prevDay = getPrevDay(day);
6367 const nextDay = getNextDay(day);
6368 const prevSelected = isSelected(prevDay);
6369 const nextSelected = isSelected(nextDay);
6370 if (prevSelected && nextSelected) {
6371 return "multiple-middle";
6372 }
6373 if (prevSelected) {
6374 return "end";
6375 }
6376 if (nextSelected) {
6377 return "start";
6378 }
6379 return "multiple-selected";
6380 }
6381 return "";
6382 };
6383 const getRangeDayType = (day) => {
6384 const [startDay, endDay] = props2.currentDate;
6385 if (!startDay) {
6386 return "";
6387 }
6388 const compareToStart = compareDay(day, startDay);
6389 if (!endDay) {
6390 return compareToStart === 0 ? "start" : "";
6391 }
6392 const compareToEnd = compareDay(day, endDay);
6393 if (props2.allowSameDay && compareToStart === 0 && compareToEnd === 0) {
6394 return "start-end";
6395 }
6396 if (compareToStart === 0) {
6397 return "start";
6398 }
6399 if (compareToEnd === 0) {
6400 return "end";
6401 }
6402 if (compareToStart > 0 && compareToEnd < 0) {
6403 return "middle";
6404 }
6405 return "";
6406 };
6407 const getDayType = (day) => {
6408 const {
6409 type,
6410 minDate,
6411 maxDate,
6412 currentDate
6413 } = props2;
6414 if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) {
6415 return "disabled";
6416 }
6417 if (currentDate === null) {
6418 return "";
6419 }
6420 if (Array.isArray(currentDate)) {
6421 if (type === "multiple") {
6422 return getMultipleDayType(day);
6423 }
6424 if (type === "range") {
6425 return getRangeDayType(day);
6426 }
6427 } else if (type === "single") {
6428 return compareDay(day, currentDate) === 0 ? "selected" : "";
6429 }
6430 return "";
6431 };
6432 const getBottomInfo = (dayType) => {
6433 if (props2.type === "range") {
6434 if (dayType === "start" || dayType === "end") {
6435 return t$g(dayType);
6436 }
6437 if (dayType === "start-end") {
6438 return `${t$g("start")}/${t$g("end")}`;
6439 }
6440 }
6441 };
6442 const renderTitle = () => {
6443 if (props2.showMonthTitle) {
6444 return vue.createVNode("div", {
6445 "class": bem$15("month-title")
6446 }, [slots["month-title"] ? slots["month-title"]({
6447 date: props2.date,
6448 text: title.value
6449 }) : title.value]);
6450 }
6451 };
6452 const renderMark = () => {
6453 if (props2.showMark && shouldRender.value) {
6454 return vue.createVNode("div", {
6455 "class": bem$15("month-mark")
6456 }, [props2.date.getMonth() + 1]);
6457 }
6458 };
6459 const placeholders = vue.computed(() => {
6460 const count = Math.ceil((totalDay.value + offset.value) / 7);
6461 return Array(count).fill({
6462 type: "placeholder"
6463 });
6464 });
6465 const days = vue.computed(() => {
6466 const days2 = [];
6467 const year = props2.date.getFullYear();
6468 const month = props2.date.getMonth();
6469 for (let day = 1; day <= totalDay.value; day++) {
6470 const date = new Date(year, month, day);
6471 const type = getDayType(date);
6472 let config = {
6473 date,
6474 type,
6475 text: day,
6476 bottomInfo: getBottomInfo(type)
6477 };
6478 if (props2.formatter) {
6479 config = props2.formatter(config);
6480 }
6481 days2.push(config);
6482 }
6483 return days2;
6484 });
6485 const disabledDays = vue.computed(() => days.value.filter((day) => day.type === "disabled"));
6486 const scrollToDate = (body, targetDate) => {
6487 if (daysRef.value) {
6488 const daysRect = use.useRect(daysRef.value);
6489 const totalRows = placeholders.value.length;
6490 const currentRow = Math.ceil((targetDate.getDate() + offset.value) / 7);
6491 const rowOffset = (currentRow - 1) * daysRect.height / totalRows;
6492 setScrollTop(body, daysRect.top + rowOffset + body.scrollTop - use.useRect(body).top);
6493 }
6494 };
6495 const renderDay = (item, index) => vue.createVNode(stdin_default$1i, {
6496 "item": item,
6497 "index": index,
6498 "color": props2.color,
6499 "offset": offset.value,
6500 "rowHeight": rowHeight.value,
6501 "onClick": (item2) => emit("click", item2),
6502 "onClickDisabledDate": (item2) => emit("clickDisabledDate", item2)
6503 }, pick(slots, ["top-info", "bottom-info"]));
6504 const renderDays = () => vue.createVNode("div", {
6505 "ref": daysRef,
6506 "role": "grid",
6507 "class": bem$15("days")
6508 }, [renderMark(), (shouldRender.value ? days : placeholders).value.map(renderDay)]);
6509 useExpose({
6510 getTitle,
6511 getHeight: () => height.value,
6512 setVisible,
6513 scrollToDate,
6514 disabledDays
6515 });
6516 return () => vue.createVNode("div", {
6517 "class": bem$15("month"),
6518 "ref": monthRef
6519 }, [renderTitle(), renderDays()]);
6520 }
6521});
6522const [name$16] = createNamespace("calendar-header");
6523var stdin_default$1g = vue.defineComponent({
6524 name: name$16,
6525 props: {
6526 date: Date,
6527 title: String,
6528 subtitle: String,
6529 showTitle: Boolean,
6530 showSubtitle: Boolean,
6531 firstDayOfWeek: Number
6532 },
6533 emits: ["clickSubtitle"],
6534 setup(props2, {
6535 slots,
6536 emit
6537 }) {
6538 const renderTitle = () => {
6539 if (props2.showTitle) {
6540 const text = props2.title || t$g("title");
6541 const title = slots.title ? slots.title() : text;
6542 return vue.createVNode("div", {
6543 "class": bem$15("header-title")
6544 }, [title]);
6545 }
6546 };
6547 const onClickSubtitle = (event) => emit("clickSubtitle", event);
6548 const renderSubtitle = () => {
6549 if (props2.showSubtitle) {
6550 const title = slots.subtitle ? slots.subtitle({
6551 date: props2.date,
6552 text: props2.subtitle
6553 }) : props2.subtitle;
6554 return vue.createVNode("div", {
6555 "class": bem$15("header-subtitle"),
6556 "onClick": onClickSubtitle
6557 }, [title]);
6558 }
6559 };
6560 const renderWeekDays = () => {
6561 const {
6562 firstDayOfWeek
6563 } = props2;
6564 const weekdays = t$g("weekdays");
6565 const renderWeekDays2 = [...weekdays.slice(firstDayOfWeek, 7), ...weekdays.slice(0, firstDayOfWeek)];
6566 return vue.createVNode("div", {
6567 "class": bem$15("weekdays")
6568 }, [renderWeekDays2.map((text) => vue.createVNode("span", {
6569 "class": bem$15("weekday")
6570 }, [text]))]);
6571 };
6572 return () => vue.createVNode("div", {
6573 "class": bem$15("header")
6574 }, [renderTitle(), renderSubtitle(), renderWeekDays()]);
6575 }
6576});
6577const calendarProps = {
6578 show: Boolean,
6579 type: makeStringProp("single"),
6580 title: String,
6581 color: String,
6582 round: truthProp,
6583 readonly: Boolean,
6584 poppable: truthProp,
6585 maxRange: makeNumericProp(null),
6586 position: makeStringProp("bottom"),
6587 teleport: [String, Object],
6588 showMark: truthProp,
6589 showTitle: truthProp,
6590 formatter: Function,
6591 rowHeight: numericProp,
6592 confirmText: String,
6593 rangePrompt: String,
6594 lazyRender: truthProp,
6595 showConfirm: truthProp,
6596 defaultDate: [Date, Array],
6597 allowSameDay: Boolean,
6598 showSubtitle: truthProp,
6599 closeOnPopstate: truthProp,
6600 showRangePrompt: truthProp,
6601 confirmDisabledText: String,
6602 closeOnClickOverlay: truthProp,
6603 safeAreaInsetTop: Boolean,
6604 safeAreaInsetBottom: truthProp,
6605 minDate: {
6606 type: Date,
6607 validator: isDate,
6608 default: getToday
6609 },
6610 maxDate: {
6611 type: Date,
6612 validator: isDate,
6613 default: () => {
6614 const now = getToday();
6615 return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate());
6616 }
6617 },
6618 firstDayOfWeek: {
6619 type: numericProp,
6620 default: 0,
6621 validator: (val) => val >= 0 && val <= 6
6622 }
6623};
6624var stdin_default$1f = vue.defineComponent({
6625 name: name$19,
6626 props: calendarProps,
6627 emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle", "clickDisabledDate"],
6628 setup(props2, {
6629 emit,
6630 slots
6631 }) {
6632 const limitDateRange = (date, minDate = props2.minDate, maxDate = props2.maxDate) => {
6633 if (compareDay(date, minDate) === -1) {
6634 return minDate;
6635 }
6636 if (compareDay(date, maxDate) === 1) {
6637 return maxDate;
6638 }
6639 return date;
6640 };
6641 const getInitialDate = (defaultDate = props2.defaultDate) => {
6642 const {
6643 type,
6644 minDate,
6645 maxDate,
6646 allowSameDay
6647 } = props2;
6648 if (defaultDate === null) {
6649 return defaultDate;
6650 }
6651 const now = getToday();
6652 if (type === "range") {
6653 if (!Array.isArray(defaultDate)) {
6654 defaultDate = [];
6655 }
6656 const start = limitDateRange(defaultDate[0] || now, minDate, allowSameDay ? maxDate : getPrevDay(maxDate));
6657 const end = limitDateRange(defaultDate[1] || now, allowSameDay ? minDate : getNextDay(minDate));
6658 return [start, end];
6659 }
6660 if (type === "multiple") {
6661 if (Array.isArray(defaultDate)) {
6662 return defaultDate.map((date) => limitDateRange(date));
6663 }
6664 return [limitDateRange(now)];
6665 }
6666 if (!defaultDate || Array.isArray(defaultDate)) {
6667 defaultDate = now;
6668 }
6669 return limitDateRange(defaultDate);
6670 };
6671 let bodyHeight;
6672 const bodyRef = vue.ref();
6673 const subtitle = vue.ref({
6674 textFn: () => "",
6675 date: void 0
6676 });
6677 const currentDate = vue.ref(getInitialDate());
6678 const [monthRefs, setMonthRefs] = useRefs();
6679 const dayOffset = vue.computed(() => props2.firstDayOfWeek ? +props2.firstDayOfWeek % 7 : 0);
6680 const months = vue.computed(() => {
6681 const months2 = [];
6682 const cursor = new Date(props2.minDate);
6683 cursor.setDate(1);
6684 do {
6685 months2.push(new Date(cursor));
6686 cursor.setMonth(cursor.getMonth() + 1);
6687 } while (compareMonth(cursor, props2.maxDate) !== 1);
6688 return months2;
6689 });
6690 const buttonDisabled = vue.computed(() => {
6691 if (currentDate.value) {
6692 if (props2.type === "range") {
6693 return !currentDate.value[0] || !currentDate.value[1];
6694 }
6695 if (props2.type === "multiple") {
6696 return !currentDate.value.length;
6697 }
6698 }
6699 return !currentDate.value;
6700 });
6701 const getSelectedDate = () => currentDate.value;
6702 const onScroll = () => {
6703 const top = getScrollTop(bodyRef.value);
6704 const bottom = top + bodyHeight;
6705 const heights = months.value.map((item, index) => monthRefs.value[index].getHeight());
6706 const heightSum = heights.reduce((a, b) => a + b, 0);
6707 if (bottom > heightSum && top > 0) {
6708 return;
6709 }
6710 let height = 0;
6711 let currentMonth;
6712 const visibleRange = [-1, -1];
6713 for (let i = 0; i < months.value.length; i++) {
6714 const month = monthRefs.value[i];
6715 const visible = height <= bottom && height + heights[i] >= top;
6716 if (visible) {
6717 visibleRange[1] = i;
6718 if (!currentMonth) {
6719 currentMonth = month;
6720 visibleRange[0] = i;
6721 }
6722 if (!monthRefs.value[i].showed) {
6723 monthRefs.value[i].showed = true;
6724 emit("monthShow", {
6725 date: month.date,
6726 title: month.getTitle()
6727 });
6728 }
6729 }
6730 height += heights[i];
6731 }
6732 months.value.forEach((month, index) => {
6733 const visible = index >= visibleRange[0] - 1 && index <= visibleRange[1] + 1;
6734 monthRefs.value[index].setVisible(visible);
6735 });
6736 if (currentMonth) {
6737 subtitle.value = {
6738 textFn: currentMonth.getTitle,
6739 date: currentMonth.date
6740 };
6741 }
6742 };
6743 const scrollToDate = (targetDate) => {
6744 use.raf(() => {
6745 months.value.some((month, index) => {
6746 if (compareMonth(month, targetDate) === 0) {
6747 if (bodyRef.value) {
6748 monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
6749 }
6750 return true;
6751 }
6752 return false;
6753 });
6754 onScroll();
6755 });
6756 };
6757 const scrollToCurrentDate = () => {
6758 if (props2.poppable && !props2.show) {
6759 return;
6760 }
6761 if (currentDate.value) {
6762 const targetDate = props2.type === "single" ? currentDate.value : currentDate.value[0];
6763 if (isDate(targetDate)) {
6764 scrollToDate(targetDate);
6765 }
6766 } else {
6767 use.raf(onScroll);
6768 }
6769 };
6770 const init = () => {
6771 if (props2.poppable && !props2.show) {
6772 return;
6773 }
6774 use.raf(() => {
6775 bodyHeight = Math.floor(use.useRect(bodyRef).height);
6776 });
6777 scrollToCurrentDate();
6778 };
6779 const reset = (date = getInitialDate()) => {
6780 currentDate.value = date;
6781 scrollToCurrentDate();
6782 };
6783 const checkRange = (date) => {
6784 const {
6785 maxRange,
6786 rangePrompt,
6787 showRangePrompt
6788 } = props2;
6789 if (maxRange && calcDateNum(date) > +maxRange) {
6790 if (showRangePrompt) {
6791 showToast(rangePrompt || t$g("rangePrompt", maxRange));
6792 }
6793 emit("overRange");
6794 return false;
6795 }
6796 return true;
6797 };
6798 const onConfirm = () => {
6799 var _a;
6800 return emit("confirm", (_a = currentDate.value) != null ? _a : cloneDates(currentDate.value));
6801 };
6802 const select = (date, complete) => {
6803 const setCurrentDate = (date2) => {
6804 currentDate.value = date2;
6805 emit("select", cloneDates(date2));
6806 };
6807 if (complete && props2.type === "range") {
6808 const valid = checkRange(date);
6809 if (!valid) {
6810 setCurrentDate([date[0], getDayByOffset(date[0], +props2.maxRange - 1)]);
6811 return;
6812 }
6813 }
6814 setCurrentDate(date);
6815 if (complete && !props2.showConfirm) {
6816 onConfirm();
6817 }
6818 };
6819 const getDisabledDate = (disabledDays2, startDay, date) => {
6820 var _a;
6821 return (_a = disabledDays2.find((day) => compareDay(startDay, day.date) === -1 && compareDay(day.date, date) === -1)) == null ? void 0 : _a.date;
6822 };
6823 const disabledDays = vue.computed(() => monthRefs.value.reduce((arr, ref2) => {
6824 var _a, _b;
6825 arr.push(...(_b = (_a = ref2.disabledDays) == null ? void 0 : _a.value) != null ? _b : []);
6826 return arr;
6827 }, []));
6828 const onClickDay = (item) => {
6829 if (props2.readonly || !item.date) {
6830 return;
6831 }
6832 const {
6833 date
6834 } = item;
6835 const {
6836 type
6837 } = props2;
6838 if (type === "range") {
6839 if (!currentDate.value) {
6840 select([date]);
6841 return;
6842 }
6843 const [startDay, endDay] = currentDate.value;
6844 if (startDay && !endDay) {
6845 const compareToStart = compareDay(date, startDay);
6846 if (compareToStart === 1) {
6847 const disabledDay = getDisabledDate(disabledDays.value, startDay, date);
6848 if (disabledDay) {
6849 const endDay2 = getPrevDay(disabledDay);
6850 if (compareDay(startDay, endDay2) === -1) {
6851 select([startDay, endDay2]);
6852 } else {
6853 select([date]);
6854 }
6855 } else {
6856 select([startDay, date], true);
6857 }
6858 } else if (compareToStart === -1) {
6859 select([date]);
6860 } else if (props2.allowSameDay) {
6861 select([date, date], true);
6862 }
6863 } else {
6864 select([date]);
6865 }
6866 } else if (type === "multiple") {
6867 if (!currentDate.value) {
6868 select([date]);
6869 return;
6870 }
6871 const dates = currentDate.value;
6872 const selectedIndex = dates.findIndex((dateItem) => compareDay(dateItem, date) === 0);
6873 if (selectedIndex !== -1) {
6874 const [unselectedDate] = dates.splice(selectedIndex, 1);
6875 emit("unselect", cloneDate(unselectedDate));
6876 } else if (props2.maxRange && dates.length >= +props2.maxRange) {
6877 showToast(props2.rangePrompt || t$g("rangePrompt", props2.maxRange));
6878 } else {
6879 select([...dates, date]);
6880 }
6881 } else {
6882 select(date, true);
6883 }
6884 };
6885 const updateShow = (value) => emit("update:show", value);
6886 const renderMonth = (date, index) => {
6887 const showMonthTitle = index !== 0 || !props2.showSubtitle;
6888 return vue.createVNode(stdin_default$1h, vue.mergeProps({
6889 "ref": setMonthRefs(index),
6890 "date": date,
6891 "currentDate": currentDate.value,
6892 "showMonthTitle": showMonthTitle,
6893 "firstDayOfWeek": dayOffset.value
6894 }, pick(props2, ["type", "color", "minDate", "maxDate", "showMark", "formatter", "rowHeight", "lazyRender", "showSubtitle", "allowSameDay"]), {
6895 "onClick": onClickDay,
6896 "onClickDisabledDate": (item) => emit("clickDisabledDate", item)
6897 }), pick(slots, ["top-info", "bottom-info", "month-title"]));
6898 };
6899 const renderFooterButton = () => {
6900 if (slots.footer) {
6901 return slots.footer();
6902 }
6903 if (props2.showConfirm) {
6904 const slot = slots["confirm-text"];
6905 const disabled = buttonDisabled.value;
6906 const text = disabled ? props2.confirmDisabledText : props2.confirmText;
6907 return vue.createVNode(Button, {
6908 "round": true,
6909 "block": true,
6910 "type": "primary",
6911 "color": props2.color,
6912 "class": bem$15("confirm"),
6913 "disabled": disabled,
6914 "nativeType": "button",
6915 "onClick": onConfirm
6916 }, {
6917 default: () => [slot ? slot({
6918 disabled
6919 }) : text || t$g("confirm")]
6920 });
6921 }
6922 };
6923 const renderFooter = () => vue.createVNode("div", {
6924 "class": [bem$15("footer"), {
6925 "van-safe-area-bottom": props2.safeAreaInsetBottom
6926 }]
6927 }, [renderFooterButton()]);
6928 const renderCalendar = () => {
6929 const subTitle = subtitle.value.textFn();
6930 return vue.createVNode("div", {
6931 "class": bem$15()
6932 }, [vue.createVNode(stdin_default$1g, {
6933 "date": subtitle.value.date,
6934 "title": props2.title,
6935 "subtitle": subTitle,
6936 "showTitle": props2.showTitle,
6937 "showSubtitle": props2.showSubtitle,
6938 "firstDayOfWeek": dayOffset.value,
6939 "onClickSubtitle": (event) => emit("clickSubtitle", event)
6940 }, pick(slots, ["title", "subtitle"])), vue.createVNode("div", {
6941 "ref": bodyRef,
6942 "class": bem$15("body"),
6943 "onScroll": onScroll
6944 }, [months.value.map(renderMonth)]), renderFooter()]);
6945 };
6946 vue.watch(() => props2.show, init);
6947 vue.watch(() => [props2.type, props2.minDate, props2.maxDate], () => reset(getInitialDate(currentDate.value)));
6948 vue.watch(() => props2.defaultDate, (value = null) => {
6949 currentDate.value = value;
6950 scrollToCurrentDate();
6951 });
6952 useExpose({
6953 reset,
6954 scrollToDate,
6955 getSelectedDate
6956 });
6957 use.onMountedOrActivated(init);
6958 return () => {
6959 if (props2.poppable) {
6960 return vue.createVNode(Popup, {
6961 "show": props2.show,
6962 "class": bem$15("popup"),
6963 "round": props2.round,
6964 "position": props2.position,
6965 "closeable": props2.showTitle || props2.showSubtitle,
6966 "teleport": props2.teleport,
6967 "closeOnPopstate": props2.closeOnPopstate,
6968 "safeAreaInsetTop": props2.safeAreaInsetTop,
6969 "closeOnClickOverlay": props2.closeOnClickOverlay,
6970 "onUpdate:show": updateShow
6971 }, {
6972 default: renderCalendar
6973 });
6974 }
6975 return renderCalendar();
6976 };
6977 }
6978});
6979const Calendar = withInstall(stdin_default$1f);
6980const [name$15, bem$14] = createNamespace("image");
6981const imageProps = {
6982 src: String,
6983 alt: String,
6984 fit: String,
6985 position: String,
6986 round: Boolean,
6987 block: Boolean,
6988 width: numericProp,
6989 height: numericProp,
6990 radius: numericProp,
6991 lazyLoad: Boolean,
6992 iconSize: numericProp,
6993 showError: truthProp,
6994 errorIcon: makeStringProp("photo-fail"),
6995 iconPrefix: String,
6996 showLoading: truthProp,
6997 loadingIcon: makeStringProp("photo"),
6998 crossorigin: String,
6999 referrerpolicy: String
7000};
7001var stdin_default$1e = vue.defineComponent({
7002 name: name$15,
7003 props: imageProps,
7004 emits: ["load", "error"],
7005 setup(props2, {
7006 emit,
7007 slots
7008 }) {
7009 const error = vue.ref(false);
7010 const loading = vue.ref(true);
7011 const imageRef = vue.ref();
7012 const {
7013 $Lazyload
7014 } = vue.getCurrentInstance().proxy;
7015 const style = vue.computed(() => {
7016 const style2 = {
7017 width: addUnit(props2.width),
7018 height: addUnit(props2.height)
7019 };
7020 if (isDef(props2.radius)) {
7021 style2.overflow = "hidden";
7022 style2.borderRadius = addUnit(props2.radius);
7023 }
7024 return style2;
7025 });
7026 vue.watch(() => props2.src, () => {
7027 error.value = false;
7028 loading.value = true;
7029 });
7030 const onLoad = (event) => {
7031 if (loading.value) {
7032 loading.value = false;
7033 emit("load", event);
7034 }
7035 };
7036 const triggerLoad = () => {
7037 const loadEvent = new Event("load");
7038 Object.defineProperty(loadEvent, "target", {
7039 value: imageRef.value,
7040 enumerable: true
7041 });
7042 onLoad(loadEvent);
7043 };
7044 const onError = (event) => {
7045 error.value = true;
7046 loading.value = false;
7047 emit("error", event);
7048 };
7049 const renderIcon = (name2, className, slot) => {
7050 if (slot) {
7051 return slot();
7052 }
7053 return vue.createVNode(Icon, {
7054 "name": name2,
7055 "size": props2.iconSize,
7056 "class": className,
7057 "classPrefix": props2.iconPrefix
7058 }, null);
7059 };
7060 const renderPlaceholder = () => {
7061 if (loading.value && props2.showLoading) {
7062 return vue.createVNode("div", {
7063 "class": bem$14("loading")
7064 }, [renderIcon(props2.loadingIcon, bem$14("loading-icon"), slots.loading)]);
7065 }
7066 if (error.value && props2.showError) {
7067 return vue.createVNode("div", {
7068 "class": bem$14("error")
7069 }, [renderIcon(props2.errorIcon, bem$14("error-icon"), slots.error)]);
7070 }
7071 };
7072 const renderImage = () => {
7073 if (error.value || !props2.src) {
7074 return;
7075 }
7076 const attrs = {
7077 alt: props2.alt,
7078 class: bem$14("img"),
7079 style: {
7080 objectFit: props2.fit,
7081 objectPosition: props2.position
7082 },
7083 crossorigin: props2.crossorigin,
7084 referrerpolicy: props2.referrerpolicy
7085 };
7086 if (props2.lazyLoad) {
7087 return vue.withDirectives(vue.createVNode("img", vue.mergeProps({
7088 "ref": imageRef
7089 }, attrs), null), [[vue.resolveDirective("lazy"), props2.src]]);
7090 }
7091 return vue.createVNode("img", vue.mergeProps({
7092 "ref": imageRef,
7093 "src": props2.src,
7094 "onLoad": onLoad,
7095 "onError": onError
7096 }, attrs), null);
7097 };
7098 const onLazyLoaded = ({
7099 el
7100 }) => {
7101 const check = () => {
7102 if (el === imageRef.value && loading.value) {
7103 triggerLoad();
7104 }
7105 };
7106 if (imageRef.value) {
7107 check();
7108 } else {
7109 vue.nextTick(check);
7110 }
7111 };
7112 const onLazyLoadError = ({
7113 el
7114 }) => {
7115 if (el === imageRef.value && !error.value) {
7116 onError();
7117 }
7118 };
7119 if ($Lazyload && inBrowser) {
7120 $Lazyload.$on("loaded", onLazyLoaded);
7121 $Lazyload.$on("error", onLazyLoadError);
7122 vue.onBeforeUnmount(() => {
7123 $Lazyload.$off("loaded", onLazyLoaded);
7124 $Lazyload.$off("error", onLazyLoadError);
7125 });
7126 }
7127 vue.onMounted(() => {
7128 vue.nextTick(() => {
7129 var _a;
7130 if (((_a = imageRef.value) == null ? void 0 : _a.complete) && !props2.lazyLoad) {
7131 triggerLoad();
7132 }
7133 });
7134 });
7135 return () => {
7136 var _a;
7137 return vue.createVNode("div", {
7138 "class": bem$14({
7139 round: props2.round,
7140 block: props2.block
7141 }),
7142 "style": style.value
7143 }, [renderImage(), renderPlaceholder(), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
7144 };
7145 }
7146});
7147const Image$1 = withInstall(stdin_default$1e);
7148const [name$14, bem$13] = createNamespace("card");
7149const cardProps = {
7150 tag: String,
7151 num: numericProp,
7152 desc: String,
7153 thumb: String,
7154 title: String,
7155 price: numericProp,
7156 centered: Boolean,
7157 lazyLoad: Boolean,
7158 currency: makeStringProp("¥"),
7159 thumbLink: String,
7160 originPrice: numericProp
7161};
7162var stdin_default$1d = vue.defineComponent({
7163 name: name$14,
7164 props: cardProps,
7165 emits: ["clickThumb"],
7166 setup(props2, {
7167 slots,
7168 emit
7169 }) {
7170 const renderTitle = () => {
7171 if (slots.title) {
7172 return slots.title();
7173 }
7174 if (props2.title) {
7175 return vue.createVNode("div", {
7176 "class": [bem$13("title"), "van-multi-ellipsis--l2"]
7177 }, [props2.title]);
7178 }
7179 };
7180 const renderThumbTag = () => {
7181 if (slots.tag || props2.tag) {
7182 return vue.createVNode("div", {
7183 "class": bem$13("tag")
7184 }, [slots.tag ? slots.tag() : vue.createVNode(Tag, {
7185 "mark": true,
7186 "type": "primary"
7187 }, {
7188 default: () => [props2.tag]
7189 })]);
7190 }
7191 };
7192 const renderThumbImage = () => {
7193 if (slots.thumb) {
7194 return slots.thumb();
7195 }
7196 return vue.createVNode(Image$1, {
7197 "src": props2.thumb,
7198 "fit": "cover",
7199 "width": "100%",
7200 "height": "100%",
7201 "lazyLoad": props2.lazyLoad
7202 }, null);
7203 };
7204 const renderThumb = () => {
7205 if (slots.thumb || props2.thumb) {
7206 return vue.createVNode("a", {
7207 "href": props2.thumbLink,
7208 "class": bem$13("thumb"),
7209 "onClick": (event) => emit("clickThumb", event)
7210 }, [renderThumbImage(), renderThumbTag()]);
7211 }
7212 };
7213 const renderDesc = () => {
7214 if (slots.desc) {
7215 return slots.desc();
7216 }
7217 if (props2.desc) {
7218 return vue.createVNode("div", {
7219 "class": [bem$13("desc"), "van-ellipsis"]
7220 }, [props2.desc]);
7221 }
7222 };
7223 const renderPriceText = () => {
7224 const priceArr = props2.price.toString().split(".");
7225 return vue.createVNode("div", null, [vue.createVNode("span", {
7226 "class": bem$13("price-currency")
7227 }, [props2.currency]), vue.createVNode("span", {
7228 "class": bem$13("price-integer")
7229 }, [priceArr[0]]), vue.createTextVNode("."), vue.createVNode("span", {
7230 "class": bem$13("price-decimal")
7231 }, [priceArr[1]])]);
7232 };
7233 return () => {
7234 var _a, _b, _c;
7235 const showNum = slots.num || isDef(props2.num);
7236 const showPrice = slots.price || isDef(props2.price);
7237 const showOriginPrice = slots["origin-price"] || isDef(props2.originPrice);
7238 const showBottom = showNum || showPrice || showOriginPrice || slots.bottom;
7239 const Price = showPrice && vue.createVNode("div", {
7240 "class": bem$13("price")
7241 }, [slots.price ? slots.price() : renderPriceText()]);
7242 const OriginPrice = showOriginPrice && vue.createVNode("div", {
7243 "class": bem$13("origin-price")
7244 }, [slots["origin-price"] ? slots["origin-price"]() : `${props2.currency} ${props2.originPrice}`]);
7245 const Num = showNum && vue.createVNode("div", {
7246 "class": bem$13("num")
7247 }, [slots.num ? slots.num() : `x${props2.num}`]);
7248 const Footer = slots.footer && vue.createVNode("div", {
7249 "class": bem$13("footer")
7250 }, [slots.footer()]);
7251 const Bottom = showBottom && vue.createVNode("div", {
7252 "class": bem$13("bottom")
7253 }, [(_a = slots["price-top"]) == null ? void 0 : _a.call(slots), Price, OriginPrice, Num, (_b = slots.bottom) == null ? void 0 : _b.call(slots)]);
7254 return vue.createVNode("div", {
7255 "class": bem$13()
7256 }, [vue.createVNode("div", {
7257 "class": bem$13("header")
7258 }, [renderThumb(), vue.createVNode("div", {
7259 "class": bem$13("content", {
7260 centered: props2.centered
7261 })
7262 }, [vue.createVNode("div", null, [renderTitle(), renderDesc(), (_c = slots.tags) == null ? void 0 : _c.call(slots)]), Bottom])]), Footer]);
7263 };
7264 }
7265});
7266const Card = withInstall(stdin_default$1d);
7267const [name$13, bem$12, t$f] = createNamespace("cascader");
7268const cascaderProps = {
7269 title: String,
7270 options: makeArrayProp(),
7271 closeable: truthProp,
7272 swipeable: truthProp,
7273 closeIcon: makeStringProp("cross"),
7274 showHeader: truthProp,
7275 modelValue: numericProp,
7276 fieldNames: Object,
7277 placeholder: String,
7278 activeColor: String
7279};
7280var stdin_default$1c = vue.defineComponent({
7281 name: name$13,
7282 props: cascaderProps,
7283 emits: ["close", "change", "finish", "clickTab", "update:modelValue"],
7284 setup(props2, {
7285 slots,
7286 emit
7287 }) {
7288 const tabs = vue.ref([]);
7289 const activeTab = vue.ref(0);
7290 const [selectedElementRefs, setSelectedElementRefs] = useRefs();
7291 const {
7292 text: textKey,
7293 value: valueKey,
7294 children: childrenKey
7295 } = extend({
7296 text: "text",
7297 value: "value",
7298 children: "children"
7299 }, props2.fieldNames);
7300 const getSelectedOptionsByValue = (options, value) => {
7301 for (const option of options) {
7302 if (option[valueKey] === value) {
7303 return [option];
7304 }
7305 if (option[childrenKey]) {
7306 const selectedOptions = getSelectedOptionsByValue(option[childrenKey], value);
7307 if (selectedOptions) {
7308 return [option, ...selectedOptions];
7309 }
7310 }
7311 }
7312 };
7313 const updateTabs = () => {
7314 const {
7315 options,
7316 modelValue
7317 } = props2;
7318 if (modelValue !== void 0) {
7319 const selectedOptions = getSelectedOptionsByValue(options, modelValue);
7320 if (selectedOptions) {
7321 let optionsCursor = options;
7322 tabs.value = selectedOptions.map((option) => {
7323 const tab = {
7324 options: optionsCursor,
7325 selected: option
7326 };
7327 const next = optionsCursor.find((item) => item[valueKey] === option[valueKey]);
7328 if (next) {
7329 optionsCursor = next[childrenKey];
7330 }
7331 return tab;
7332 });
7333 if (optionsCursor) {
7334 tabs.value.push({
7335 options: optionsCursor,
7336 selected: null
7337 });
7338 }
7339 vue.nextTick(() => {
7340 activeTab.value = tabs.value.length - 1;
7341 });
7342 return;
7343 }
7344 }
7345 tabs.value = [{
7346 options,
7347 selected: null
7348 }];
7349 };
7350 const onSelect = (option, tabIndex) => {
7351 if (option.disabled) {
7352 return;
7353 }
7354 tabs.value[tabIndex].selected = option;
7355 if (tabs.value.length > tabIndex + 1) {
7356 tabs.value = tabs.value.slice(0, tabIndex + 1);
7357 }
7358 if (option[childrenKey]) {
7359 const nextTab = {
7360 options: option[childrenKey],
7361 selected: null
7362 };
7363 if (tabs.value[tabIndex + 1]) {
7364 tabs.value[tabIndex + 1] = nextTab;
7365 } else {
7366 tabs.value.push(nextTab);
7367 }
7368 vue.nextTick(() => {
7369 activeTab.value++;
7370 });
7371 }
7372 const selectedOptions = tabs.value.map((tab) => tab.selected).filter(Boolean);
7373 emit("update:modelValue", option[valueKey]);
7374 const params = {
7375 value: option[valueKey],
7376 tabIndex,
7377 selectedOptions
7378 };
7379 emit("change", params);
7380 if (!option[childrenKey]) {
7381 emit("finish", params);
7382 }
7383 };
7384 const onClose = () => emit("close");
7385 const onClickTab = ({
7386 name: name2,
7387 title
7388 }) => emit("clickTab", name2, title);
7389 const renderHeader = () => props2.showHeader ? vue.createVNode("div", {
7390 "class": bem$12("header")
7391 }, [vue.createVNode("h2", {
7392 "class": bem$12("title")
7393 }, [slots.title ? slots.title() : props2.title]), props2.closeable ? vue.createVNode(Icon, {
7394 "name": props2.closeIcon,
7395 "class": [bem$12("close-icon"), HAPTICS_FEEDBACK],
7396 "onClick": onClose
7397 }, null) : null]) : null;
7398 const renderOption = (option, selectedOption, tabIndex) => {
7399 const {
7400 disabled
7401 } = option;
7402 const selected = !!(selectedOption && option[valueKey] === selectedOption[valueKey]);
7403 const color = option.color || (selected ? props2.activeColor : void 0);
7404 const Text = slots.option ? slots.option({
7405 option,
7406 selected
7407 }) : vue.createVNode("span", null, [option[textKey]]);
7408 return vue.createVNode("li", {
7409 "ref": selected ? setSelectedElementRefs(tabIndex) : void 0,
7410 "role": "menuitemradio",
7411 "class": [bem$12("option", {
7412 selected,
7413 disabled
7414 }), option.className],
7415 "style": {
7416 color
7417 },
7418 "tabindex": disabled ? void 0 : selected ? 0 : -1,
7419 "aria-checked": selected,
7420 "aria-disabled": disabled || void 0,
7421 "onClick": () => onSelect(option, tabIndex)
7422 }, [Text, selected ? vue.createVNode(Icon, {
7423 "name": "success",
7424 "class": bem$12("selected-icon")
7425 }, null) : null]);
7426 };
7427 const renderOptions = (options, selectedOption, tabIndex) => vue.createVNode("ul", {
7428 "role": "menu",
7429 "class": bem$12("options")
7430 }, [options.map((option) => renderOption(option, selectedOption, tabIndex))]);
7431 const renderTab = (tab, tabIndex) => {
7432 const {
7433 options,
7434 selected
7435 } = tab;
7436 const placeholder = props2.placeholder || t$f("select");
7437 const title = selected ? selected[textKey] : placeholder;
7438 return vue.createVNode(Tab, {
7439 "title": title,
7440 "titleClass": bem$12("tab", {
7441 unselected: !selected
7442 })
7443 }, {
7444 default: () => {
7445 var _a, _b;
7446 return [(_a = slots["options-top"]) == null ? void 0 : _a.call(slots, {
7447 tabIndex
7448 }), renderOptions(options, selected, tabIndex), (_b = slots["options-bottom"]) == null ? void 0 : _b.call(slots, {
7449 tabIndex
7450 })];
7451 }
7452 });
7453 };
7454 const renderTabs = () => vue.createVNode(Tabs, {
7455 "active": activeTab.value,
7456 "onUpdate:active": ($event) => activeTab.value = $event,
7457 "shrink": true,
7458 "animated": true,
7459 "class": bem$12("tabs"),
7460 "color": props2.activeColor,
7461 "swipeable": props2.swipeable,
7462 "onClickTab": onClickTab
7463 }, {
7464 default: () => [tabs.value.map(renderTab)]
7465 });
7466 const scrollIntoView = (el) => {
7467 const scrollParent = el.parentElement;
7468 if (scrollParent) {
7469 scrollParent.scrollTop = el.offsetTop - (scrollParent.offsetHeight - el.offsetHeight) / 2;
7470 }
7471 };
7472 updateTabs();
7473 vue.watch(activeTab, (value) => {
7474 const el = selectedElementRefs.value[value];
7475 if (el)
7476 scrollIntoView(el);
7477 });
7478 vue.watch(() => props2.options, updateTabs, {
7479 deep: true
7480 });
7481 vue.watch(() => props2.modelValue, (value) => {
7482 if (value !== void 0) {
7483 const values = tabs.value.map((tab) => {
7484 var _a;
7485 return (_a = tab.selected) == null ? void 0 : _a[valueKey];
7486 });
7487 if (values.includes(value)) {
7488 return;
7489 }
7490 }
7491 updateTabs();
7492 });
7493 return () => vue.createVNode("div", {
7494 "class": bem$12()
7495 }, [renderHeader(), renderTabs()]);
7496 }
7497});
7498const Cascader = withInstall(stdin_default$1c);
7499const [name$12, bem$11] = createNamespace("cell-group");
7500const cellGroupProps = {
7501 title: String,
7502 inset: Boolean,
7503 border: truthProp
7504};
7505var stdin_default$1b = vue.defineComponent({
7506 name: name$12,
7507 inheritAttrs: false,
7508 props: cellGroupProps,
7509 setup(props2, {
7510 slots,
7511 attrs
7512 }) {
7513 const renderGroup = () => {
7514 var _a;
7515 return vue.createVNode("div", vue.mergeProps({
7516 "class": [bem$11({
7517 inset: props2.inset
7518 }), {
7519 [BORDER_TOP_BOTTOM]: props2.border && !props2.inset
7520 }]
7521 }, attrs, useScopeId()), [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
7522 };
7523 const renderTitle = () => vue.createVNode("div", {
7524 "class": bem$11("title", {
7525 inset: props2.inset
7526 })
7527 }, [slots.title ? slots.title() : props2.title]);
7528 return () => {
7529 if (props2.title || slots.title) {
7530 return vue.createVNode(vue.Fragment, null, [renderTitle(), renderGroup()]);
7531 }
7532 return renderGroup();
7533 };
7534 }
7535});
7536const CellGroup = withInstall(stdin_default$1b);
7537const [name$11, bem$10] = createNamespace("checkbox-group");
7538const checkboxGroupProps = {
7539 max: numericProp,
7540 shape: makeStringProp("round"),
7541 disabled: Boolean,
7542 iconSize: numericProp,
7543 direction: String,
7544 modelValue: makeArrayProp(),
7545 checkedColor: String
7546};
7547const CHECKBOX_GROUP_KEY = Symbol(name$11);
7548var stdin_default$1a = vue.defineComponent({
7549 name: name$11,
7550 props: checkboxGroupProps,
7551 emits: ["change", "update:modelValue"],
7552 setup(props2, {
7553 emit,
7554 slots
7555 }) {
7556 const {
7557 children,
7558 linkChildren
7559 } = use.useChildren(CHECKBOX_GROUP_KEY);
7560 const updateValue = (value) => emit("update:modelValue", value);
7561 const toggleAll = (options = {}) => {
7562 if (typeof options === "boolean") {
7563 options = {
7564 checked: options
7565 };
7566 }
7567 const {
7568 checked,
7569 skipDisabled
7570 } = options;
7571 const checkedChildren = children.filter((item) => {
7572 if (!item.props.bindGroup) {
7573 return false;
7574 }
7575 if (item.props.disabled && skipDisabled) {
7576 return item.checked.value;
7577 }
7578 return checked != null ? checked : !item.checked.value;
7579 });
7580 const names = checkedChildren.map((item) => item.name);
7581 updateValue(names);
7582 };
7583 vue.watch(() => props2.modelValue, (value) => emit("change", value));
7584 useExpose({
7585 toggleAll
7586 });
7587 use.useCustomFieldValue(() => props2.modelValue);
7588 linkChildren({
7589 props: props2,
7590 updateValue
7591 });
7592 return () => {
7593 var _a;
7594 return vue.createVNode("div", {
7595 "class": bem$10([props2.direction])
7596 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
7597 };
7598 }
7599});
7600const [name$10, bem$$] = createNamespace("checkbox");
7601const checkboxProps = extend({}, checkerProps, {
7602 shape: String,
7603 bindGroup: truthProp,
7604 indeterminate: {
7605 type: Boolean,
7606 default: null
7607 }
7608});
7609var stdin_default$19 = vue.defineComponent({
7610 name: name$10,
7611 props: checkboxProps,
7612 emits: ["change", "update:modelValue"],
7613 setup(props2, {
7614 emit,
7615 slots
7616 }) {
7617 const {
7618 parent
7619 } = use.useParent(CHECKBOX_GROUP_KEY);
7620 const setParentValue = (checked2) => {
7621 const {
7622 name: name2
7623 } = props2;
7624 const {
7625 max,
7626 modelValue
7627 } = parent.props;
7628 const value = modelValue.slice();
7629 if (checked2) {
7630 const overlimit = max && value.length >= +max;
7631 if (!overlimit && !value.includes(name2)) {
7632 value.push(name2);
7633 if (props2.bindGroup) {
7634 parent.updateValue(value);
7635 }
7636 }
7637 } else {
7638 const index = value.indexOf(name2);
7639 if (index !== -1) {
7640 value.splice(index, 1);
7641 if (props2.bindGroup) {
7642 parent.updateValue(value);
7643 }
7644 }
7645 }
7646 };
7647 const checked = vue.computed(() => {
7648 if (parent && props2.bindGroup) {
7649 return parent.props.modelValue.indexOf(props2.name) !== -1;
7650 }
7651 return !!props2.modelValue;
7652 });
7653 const toggle = (newValue = !checked.value) => {
7654 if (parent && props2.bindGroup) {
7655 setParentValue(newValue);
7656 } else {
7657 emit("update:modelValue", newValue);
7658 }
7659 if (props2.indeterminate !== null)
7660 emit("change", newValue);
7661 };
7662 vue.watch(() => props2.modelValue, (value) => {
7663 if (props2.indeterminate === null)
7664 emit("change", value);
7665 });
7666 useExpose({
7667 toggle,
7668 props: props2,
7669 checked
7670 });
7671 use.useCustomFieldValue(() => props2.modelValue);
7672 return () => vue.createVNode(stdin_default$1o, vue.mergeProps({
7673 "bem": bem$$,
7674 "role": "checkbox",
7675 "parent": parent,
7676 "checked": checked.value,
7677 "onToggle": toggle
7678 }, props2), pick(slots, ["default", "icon"]));
7679 }
7680});
7681const Checkbox = withInstall(stdin_default$19);
7682const CheckboxGroup = withInstall(stdin_default$1a);
7683const [name$$, bem$_] = createNamespace("circle");
7684let uid = 0;
7685const format = (rate) => Math.min(Math.max(+rate, 0), 100);
7686function getPath(clockwise, viewBoxSize) {
7687 const sweepFlag = clockwise ? 1 : 0;
7688 return `M ${viewBoxSize / 2} ${viewBoxSize / 2} m 0, -500 a 500, 500 0 1, ${sweepFlag} 0, 1000 a 500, 500 0 1, ${sweepFlag} 0, -1000`;
7689}
7690const circleProps = {
7691 text: String,
7692 size: numericProp,
7693 fill: makeStringProp("none"),
7694 rate: makeNumericProp(100),
7695 speed: makeNumericProp(0),
7696 color: [String, Object],
7697 clockwise: truthProp,
7698 layerColor: String,
7699 currentRate: makeNumberProp(0),
7700 strokeWidth: makeNumericProp(40),
7701 strokeLinecap: String,
7702 startPosition: makeStringProp("top")
7703};
7704var stdin_default$18 = vue.defineComponent({
7705 name: name$$,
7706 props: circleProps,
7707 emits: ["update:currentRate"],
7708 setup(props2, {
7709 emit,
7710 slots
7711 }) {
7712 const id = `van-circle-${uid++}`;
7713 const viewBoxSize = vue.computed(() => +props2.strokeWidth + 1e3);
7714 const path = vue.computed(() => getPath(props2.clockwise, viewBoxSize.value));
7715 const svgStyle = vue.computed(() => {
7716 const ROTATE_ANGLE_MAP = {
7717 top: 0,
7718 right: 90,
7719 bottom: 180,
7720 left: 270
7721 };
7722 const angleValue = ROTATE_ANGLE_MAP[props2.startPosition];
7723 if (angleValue) {
7724 return {
7725 transform: `rotate(${angleValue}deg)`
7726 };
7727 }
7728 });
7729 vue.watch(() => props2.rate, (rate) => {
7730 let rafId;
7731 const startTime = Date.now();
7732 const startRate = props2.currentRate;
7733 const endRate = format(rate);
7734 const duration = Math.abs((startRate - endRate) * 1e3 / +props2.speed);
7735 const animate = () => {
7736 const now = Date.now();
7737 const progress = Math.min((now - startTime) / duration, 1);
7738 const rate2 = progress * (endRate - startRate) + startRate;
7739 emit("update:currentRate", format(parseFloat(rate2.toFixed(1))));
7740 if (endRate > startRate ? rate2 < endRate : rate2 > endRate) {
7741 rafId = use.raf(animate);
7742 }
7743 };
7744 if (props2.speed) {
7745 if (rafId) {
7746 use.cancelRaf(rafId);
7747 }
7748 rafId = use.raf(animate);
7749 } else {
7750 emit("update:currentRate", endRate);
7751 }
7752 }, {
7753 immediate: true
7754 });
7755 const renderHover = () => {
7756 const PERIMETER = 3140;
7757 const {
7758 strokeWidth,
7759 currentRate,
7760 strokeLinecap
7761 } = props2;
7762 const offset = PERIMETER * currentRate / 100;
7763 const color = isObject(props2.color) ? `url(#${id})` : props2.color;
7764 const style = {
7765 stroke: color,
7766 strokeWidth: `${+strokeWidth + 1}px`,
7767 strokeLinecap,
7768 strokeDasharray: `${offset}px ${PERIMETER}px`
7769 };
7770 return vue.createVNode("path", {
7771 "d": path.value,
7772 "style": style,
7773 "class": bem$_("hover"),
7774 "stroke": color
7775 }, null);
7776 };
7777 const renderLayer = () => {
7778 const style = {
7779 fill: props2.fill,
7780 stroke: props2.layerColor,
7781 strokeWidth: `${props2.strokeWidth}px`
7782 };
7783 return vue.createVNode("path", {
7784 "class": bem$_("layer"),
7785 "style": style,
7786 "d": path.value
7787 }, null);
7788 };
7789 const renderGradient = () => {
7790 const {
7791 color
7792 } = props2;
7793 if (!isObject(color)) {
7794 return;
7795 }
7796 const Stops = Object.keys(color).sort((a, b) => parseFloat(a) - parseFloat(b)).map((key, index) => vue.createVNode("stop", {
7797 "key": index,
7798 "offset": key,
7799 "stop-color": color[key]
7800 }, null));
7801 return vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
7802 "id": id,
7803 "x1": "100%",
7804 "y1": "0%",
7805 "x2": "0%",
7806 "y2": "0%"
7807 }, [Stops])]);
7808 };
7809 const renderText = () => {
7810 if (slots.default) {
7811 return slots.default();
7812 }
7813 if (props2.text) {
7814 return vue.createVNode("div", {
7815 "class": bem$_("text")
7816 }, [props2.text]);
7817 }
7818 };
7819 return () => vue.createVNode("div", {
7820 "class": bem$_(),
7821 "style": getSizeStyle(props2.size)
7822 }, [vue.createVNode("svg", {
7823 "viewBox": `0 0 ${viewBoxSize.value} ${viewBoxSize.value}`,
7824 "style": svgStyle.value
7825 }, [renderGradient(), renderLayer(), renderHover()]), renderText()]);
7826 }
7827});
7828const Circle = withInstall(stdin_default$18);
7829const [name$_, bem$Z] = createNamespace("row");
7830const ROW_KEY = Symbol(name$_);
7831const rowProps = {
7832 tag: makeStringProp("div"),
7833 wrap: truthProp,
7834 align: String,
7835 gutter: {
7836 type: [String, Number, Array],
7837 default: 0
7838 },
7839 justify: String
7840};
7841var stdin_default$17 = vue.defineComponent({
7842 name: name$_,
7843 props: rowProps,
7844 setup(props2, {
7845 slots
7846 }) {
7847 const {
7848 children,
7849 linkChildren
7850 } = use.useChildren(ROW_KEY);
7851 const groups = vue.computed(() => {
7852 const groups2 = [[]];
7853 let totalSpan = 0;
7854 children.forEach((child, index) => {
7855 totalSpan += Number(child.span);
7856 if (totalSpan > 24) {
7857 groups2.push([index]);
7858 totalSpan -= 24;
7859 } else {
7860 groups2[groups2.length - 1].push(index);
7861 }
7862 });
7863 return groups2;
7864 });
7865 const spaces = vue.computed(() => {
7866 let gutter = 0;
7867 if (Array.isArray(props2.gutter)) {
7868 gutter = Number(props2.gutter[0]) || 0;
7869 } else {
7870 gutter = Number(props2.gutter);
7871 }
7872 const spaces2 = [];
7873 if (!gutter) {
7874 return spaces2;
7875 }
7876 groups.value.forEach((group) => {
7877 const averagePadding = gutter * (group.length - 1) / group.length;
7878 group.forEach((item, index) => {
7879 if (index === 0) {
7880 spaces2.push({
7881 right: averagePadding
7882 });
7883 } else {
7884 const left = gutter - spaces2[item - 1].right;
7885 const right = averagePadding - left;
7886 spaces2.push({
7887 left,
7888 right
7889 });
7890 }
7891 });
7892 });
7893 return spaces2;
7894 });
7895 const verticalSpaces = vue.computed(() => {
7896 const {
7897 gutter
7898 } = props2;
7899 const spaces2 = [];
7900 if (Array.isArray(gutter) && gutter.length > 1) {
7901 const bottom = Number(gutter[1]) || 0;
7902 if (bottom <= 0) {
7903 return spaces2;
7904 }
7905 groups.value.forEach((group, index) => {
7906 if (index === groups.value.length - 1)
7907 return;
7908 group.forEach(() => {
7909 spaces2.push({
7910 bottom
7911 });
7912 });
7913 });
7914 }
7915 return spaces2;
7916 });
7917 linkChildren({
7918 spaces,
7919 verticalSpaces
7920 });
7921 return () => {
7922 const {
7923 tag,
7924 wrap,
7925 align,
7926 justify
7927 } = props2;
7928 return vue.createVNode(tag, {
7929 "class": bem$Z({
7930 [`align-${align}`]: align,
7931 [`justify-${justify}`]: justify,
7932 nowrap: !wrap
7933 })
7934 }, {
7935 default: () => {
7936 var _a;
7937 return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
7938 }
7939 });
7940 };
7941 }
7942});
7943const [name$Z, bem$Y] = createNamespace("col");
7944const colProps = {
7945 tag: makeStringProp("div"),
7946 span: makeNumericProp(0),
7947 offset: numericProp
7948};
7949var stdin_default$16 = vue.defineComponent({
7950 name: name$Z,
7951 props: colProps,
7952 setup(props2, {
7953 slots
7954 }) {
7955 const {
7956 parent,
7957 index
7958 } = use.useParent(ROW_KEY);
7959 const style = vue.computed(() => {
7960 if (!parent) {
7961 return;
7962 }
7963 const {
7964 spaces,
7965 verticalSpaces
7966 } = parent;
7967 let styles = {};
7968 if (spaces && spaces.value && spaces.value[index.value]) {
7969 const {
7970 left,
7971 right
7972 } = spaces.value[index.value];
7973 styles = {
7974 paddingLeft: left ? `${left}px` : null,
7975 paddingRight: right ? `${right}px` : null
7976 };
7977 }
7978 const {
7979 bottom
7980 } = verticalSpaces.value[index.value] || {};
7981 return extend(styles, {
7982 marginBottom: bottom ? `${bottom}px` : null
7983 });
7984 });
7985 return () => {
7986 const {
7987 tag,
7988 span,
7989 offset
7990 } = props2;
7991 return vue.createVNode(tag, {
7992 "style": style.value,
7993 "class": bem$Y({
7994 [span]: span,
7995 [`offset-${offset}`]: offset
7996 })
7997 }, {
7998 default: () => {
7999 var _a;
8000 return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
8001 }
8002 });
8003 };
8004 }
8005});
8006const Col = withInstall(stdin_default$16);
8007const [name$Y, bem$X] = createNamespace("collapse");
8008const COLLAPSE_KEY = Symbol(name$Y);
8009const collapseProps = {
8010 border: truthProp,
8011 accordion: Boolean,
8012 modelValue: {
8013 type: [String, Number, Array],
8014 default: ""
8015 }
8016};
8017function validateModelValue(modelValue, accordion) {
8018 if (accordion && Array.isArray(modelValue)) {
8019 console.error('[Vant] Collapse: "v-model" should not be Array in accordion mode');
8020 return false;
8021 }
8022 if (!accordion && !Array.isArray(modelValue)) {
8023 console.error('[Vant] Collapse: "v-model" should be Array in non-accordion mode');
8024 return false;
8025 }
8026 return true;
8027}
8028var stdin_default$15 = vue.defineComponent({
8029 name: name$Y,
8030 props: collapseProps,
8031 emits: ["change", "update:modelValue"],
8032 setup(props2, {
8033 emit,
8034 slots
8035 }) {
8036 const {
8037 linkChildren,
8038 children
8039 } = use.useChildren(COLLAPSE_KEY);
8040 const updateName = (name2) => {
8041 emit("change", name2);
8042 emit("update:modelValue", name2);
8043 };
8044 const toggle = (name2, expanded) => {
8045 const {
8046 accordion,
8047 modelValue
8048 } = props2;
8049 if (accordion) {
8050 updateName(name2 === modelValue ? "" : name2);
8051 } else if (expanded) {
8052 updateName(modelValue.concat(name2));
8053 } else {
8054 updateName(modelValue.filter((activeName) => activeName !== name2));
8055 }
8056 };
8057 const toggleAll = (options = {}) => {
8058 if (props2.accordion) {
8059 return;
8060 }
8061 if (typeof options === "boolean") {
8062 options = {
8063 expanded: options
8064 };
8065 }
8066 const {
8067 expanded,
8068 skipDisabled
8069 } = options;
8070 const expandedChildren = children.filter((item) => {
8071 if (item.disabled && skipDisabled) {
8072 return item.expanded.value;
8073 }
8074 return expanded != null ? expanded : !item.expanded.value;
8075 });
8076 const names = expandedChildren.map((item) => item.itemName.value);
8077 updateName(names);
8078 };
8079 const isExpanded = (name2) => {
8080 const {
8081 accordion,
8082 modelValue
8083 } = props2;
8084 if (process.env.NODE_ENV !== "production" && !validateModelValue(modelValue, accordion)) {
8085 return false;
8086 }
8087 return accordion ? modelValue === name2 : modelValue.includes(name2);
8088 };
8089 useExpose({
8090 toggleAll
8091 });
8092 linkChildren({
8093 toggle,
8094 isExpanded
8095 });
8096 return () => {
8097 var _a;
8098 return vue.createVNode("div", {
8099 "class": [bem$X(), {
8100 [BORDER_TOP_BOTTOM]: props2.border
8101 }]
8102 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
8103 };
8104 }
8105});
8106const Collapse = withInstall(stdin_default$15);
8107const [name$X, bem$W] = createNamespace("collapse-item");
8108const CELL_SLOTS = ["icon", "title", "value", "label", "right-icon"];
8109const collapseItemProps = extend({}, cellSharedProps, {
8110 name: numericProp,
8111 isLink: truthProp,
8112 disabled: Boolean,
8113 readonly: Boolean,
8114 lazyRender: truthProp
8115});
8116var stdin_default$14 = vue.defineComponent({
8117 name: name$X,
8118 props: collapseItemProps,
8119 setup(props2, {
8120 slots
8121 }) {
8122 const wrapperRef = vue.ref();
8123 const contentRef = vue.ref();
8124 const {
8125 parent,
8126 index
8127 } = use.useParent(COLLAPSE_KEY);
8128 if (!parent) {
8129 if (process.env.NODE_ENV !== "production") {
8130 console.error("[Vant] <CollapseItem> must be a child component of <Collapse>.");
8131 }
8132 return;
8133 }
8134 const name2 = vue.computed(() => {
8135 var _a;
8136 return (_a = props2.name) != null ? _a : index.value;
8137 });
8138 const expanded = vue.computed(() => parent.isExpanded(name2.value));
8139 const show = vue.ref(expanded.value);
8140 const lazyRender = useLazyRender(() => show.value || !props2.lazyRender);
8141 const onTransitionEnd = () => {
8142 if (!expanded.value) {
8143 show.value = false;
8144 } else if (wrapperRef.value) {
8145 wrapperRef.value.style.height = "";
8146 }
8147 };
8148 vue.watch(expanded, (value, oldValue) => {
8149 if (oldValue === null) {
8150 return;
8151 }
8152 if (value) {
8153 show.value = true;
8154 }
8155 const tick = value ? vue.nextTick : use.raf;
8156 tick(() => {
8157 if (!contentRef.value || !wrapperRef.value) {
8158 return;
8159 }
8160 const {
8161 offsetHeight
8162 } = contentRef.value;
8163 if (offsetHeight) {
8164 const contentHeight = `${offsetHeight}px`;
8165 wrapperRef.value.style.height = value ? "0" : contentHeight;
8166 use.doubleRaf(() => {
8167 if (wrapperRef.value) {
8168 wrapperRef.value.style.height = value ? contentHeight : "0";
8169 }
8170 });
8171 } else {
8172 onTransitionEnd();
8173 }
8174 });
8175 });
8176 const toggle = (newValue = !expanded.value) => {
8177 parent.toggle(name2.value, newValue);
8178 };
8179 const onClickTitle = () => {
8180 if (!props2.disabled && !props2.readonly) {
8181 toggle();
8182 }
8183 };
8184 const renderTitle = () => {
8185 const {
8186 border,
8187 disabled,
8188 readonly
8189 } = props2;
8190 const attrs = pick(props2, Object.keys(cellSharedProps));
8191 if (readonly) {
8192 attrs.isLink = false;
8193 }
8194 if (disabled || readonly) {
8195 attrs.clickable = false;
8196 }
8197 return vue.createVNode(Cell, vue.mergeProps({
8198 "role": "button",
8199 "class": bem$W("title", {
8200 disabled,
8201 expanded: expanded.value,
8202 borderless: !border
8203 }),
8204 "aria-expanded": String(expanded.value),
8205 "onClick": onClickTitle
8206 }, attrs), pick(slots, CELL_SLOTS));
8207 };
8208 const renderContent = lazyRender(() => {
8209 var _a;
8210 return vue.withDirectives(vue.createVNode("div", {
8211 "ref": wrapperRef,
8212 "class": bem$W("wrapper"),
8213 "onTransitionend": onTransitionEnd
8214 }, [vue.createVNode("div", {
8215 "ref": contentRef,
8216 "class": bem$W("content")
8217 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]), [[vue.vShow, show.value]]);
8218 });
8219 useExpose({
8220 toggle,
8221 expanded,
8222 itemName: name2
8223 });
8224 return () => vue.createVNode("div", {
8225 "class": [bem$W({
8226 border: index.value && props2.border
8227 })]
8228 }, [renderTitle(), renderContent()]);
8229 }
8230});
8231const CollapseItem = withInstall(stdin_default$14);
8232const ConfigProvider = withInstall(stdin_default$1S);
8233const [name$W, bem$V, t$e] = createNamespace("contact-card");
8234const contactCardProps = {
8235 tel: String,
8236 name: String,
8237 type: makeStringProp("add"),
8238 addText: String,
8239 editable: truthProp
8240};
8241var stdin_default$13 = vue.defineComponent({
8242 name: name$W,
8243 props: contactCardProps,
8244 emits: ["click"],
8245 setup(props2, {
8246 emit
8247 }) {
8248 const onClick = (event) => {
8249 if (props2.editable) {
8250 emit("click", event);
8251 }
8252 };
8253 const renderContent = () => {
8254 if (props2.type === "add") {
8255 return props2.addText || t$e("addContact");
8256 }
8257 return [vue.createVNode("div", null, [`${t$e("name")}${props2.name}`]), vue.createVNode("div", null, [`${t$e("tel")}${props2.tel}`])];
8258 };
8259 return () => vue.createVNode(Cell, {
8260 "center": true,
8261 "icon": props2.type === "edit" ? "contact" : "add-square",
8262 "class": bem$V([props2.type]),
8263 "border": false,
8264 "isLink": props2.editable,
8265 "titleClass": bem$V("title"),
8266 "onClick": onClick
8267 }, {
8268 title: renderContent
8269 });
8270 }
8271});
8272const ContactCard = withInstall(stdin_default$13);
8273const [name$V, bem$U, t$d] = createNamespace("contact-edit");
8274const DEFAULT_CONTACT = {
8275 tel: "",
8276 name: ""
8277};
8278const contactEditProps = {
8279 isEdit: Boolean,
8280 isSaving: Boolean,
8281 isDeleting: Boolean,
8282 showSetDefault: Boolean,
8283 setDefaultLabel: String,
8284 contactInfo: {
8285 type: Object,
8286 default: () => extend({}, DEFAULT_CONTACT)
8287 },
8288 telValidator: {
8289 type: Function,
8290 default: isMobile
8291 }
8292};
8293var stdin_default$12 = vue.defineComponent({
8294 name: name$V,
8295 props: contactEditProps,
8296 emits: ["save", "delete", "changeDefault"],
8297 setup(props2, {
8298 emit
8299 }) {
8300 const contact = vue.reactive(extend({}, DEFAULT_CONTACT, props2.contactInfo));
8301 const onSave = () => {
8302 if (!props2.isSaving) {
8303 emit("save", contact);
8304 }
8305 };
8306 const onDelete = () => emit("delete", contact);
8307 const renderButtons = () => vue.createVNode("div", {
8308 "class": bem$U("buttons")
8309 }, [vue.createVNode(Button, {
8310 "block": true,
8311 "round": true,
8312 "type": "primary",
8313 "text": t$d("save"),
8314 "class": bem$U("button"),
8315 "loading": props2.isSaving,
8316 "nativeType": "submit"
8317 }, null), props2.isEdit && vue.createVNode(Button, {
8318 "block": true,
8319 "round": true,
8320 "text": t$d("delete"),
8321 "class": bem$U("button"),
8322 "loading": props2.isDeleting,
8323 "onClick": onDelete
8324 }, null)]);
8325 const renderSwitch = () => vue.createVNode(Switch, {
8326 "modelValue": contact.isDefault,
8327 "onUpdate:modelValue": ($event) => contact.isDefault = $event,
8328 "onChange": (checked) => emit("changeDefault", checked)
8329 }, null);
8330 const renderSetDefault = () => {
8331 if (props2.showSetDefault) {
8332 return vue.createVNode(Cell, {
8333 "title": props2.setDefaultLabel,
8334 "class": bem$U("switch-cell"),
8335 "border": false
8336 }, {
8337 "right-icon": renderSwitch
8338 });
8339 }
8340 };
8341 vue.watch(() => props2.contactInfo, (value) => extend(contact, DEFAULT_CONTACT, value));
8342 return () => vue.createVNode(Form, {
8343 "class": bem$U(),
8344 "onSubmit": onSave
8345 }, {
8346 default: () => [vue.createVNode("div", {
8347 "class": bem$U("fields")
8348 }, [vue.createVNode(Field, {
8349 "modelValue": contact.name,
8350 "onUpdate:modelValue": ($event) => contact.name = $event,
8351 "clearable": true,
8352 "label": t$d("name"),
8353 "rules": [{
8354 required: true,
8355 message: t$d("nameEmpty")
8356 }],
8357 "maxlength": "30",
8358 "placeholder": t$d("name")
8359 }, null), vue.createVNode(Field, {
8360 "modelValue": contact.tel,
8361 "onUpdate:modelValue": ($event) => contact.tel = $event,
8362 "clearable": true,
8363 "type": "tel",
8364 "label": t$d("tel"),
8365 "rules": [{
8366 validator: props2.telValidator,
8367 message: t$d("telInvalid")
8368 }],
8369 "placeholder": t$d("tel")
8370 }, null)]), renderSetDefault(), renderButtons()]
8371 });
8372 }
8373});
8374const ContactEdit = withInstall(stdin_default$12);
8375const [name$U, bem$T, t$c] = createNamespace("contact-list");
8376const contactListProps = {
8377 list: Array,
8378 addText: String,
8379 modelValue: unknownProp,
8380 defaultTagText: String
8381};
8382var stdin_default$11 = vue.defineComponent({
8383 name: name$U,
8384 props: contactListProps,
8385 emits: ["add", "edit", "select", "update:modelValue"],
8386 setup(props2, {
8387 emit
8388 }) {
8389 const renderItem = (item, index) => {
8390 const onClick = () => {
8391 emit("update:modelValue", item.id);
8392 emit("select", item, index);
8393 };
8394 const renderRightIcon = () => vue.createVNode(Radio, {
8395 "class": bem$T("radio"),
8396 "name": item.id,
8397 "iconSize": 18
8398 }, null);
8399 const renderEditIcon = () => vue.createVNode(Icon, {
8400 "name": "edit",
8401 "class": bem$T("edit"),
8402 "onClick": (event) => {
8403 event.stopPropagation();
8404 emit("edit", item, index);
8405 }
8406 }, null);
8407 const renderContent = () => {
8408 const nodes = [`${item.name}${item.tel}`];
8409 if (item.isDefault && props2.defaultTagText) {
8410 nodes.push(vue.createVNode(Tag, {
8411 "type": "primary",
8412 "round": true,
8413 "class": bem$T("item-tag")
8414 }, {
8415 default: () => [props2.defaultTagText]
8416 }));
8417 }
8418 return nodes;
8419 };
8420 return vue.createVNode(Cell, {
8421 "key": item.id,
8422 "isLink": true,
8423 "center": true,
8424 "class": bem$T("item"),
8425 "titleClass": bem$T("item-title"),
8426 "onClick": onClick
8427 }, {
8428 icon: renderEditIcon,
8429 title: renderContent,
8430 "right-icon": renderRightIcon
8431 });
8432 };
8433 return () => vue.createVNode("div", {
8434 "class": bem$T()
8435 }, [vue.createVNode(RadioGroup, {
8436 "modelValue": props2.modelValue,
8437 "class": bem$T("group")
8438 }, {
8439 default: () => [props2.list && props2.list.map(renderItem)]
8440 }), vue.createVNode("div", {
8441 "class": [bem$T("bottom"), "van-safe-area-bottom"]
8442 }, [vue.createVNode(Button, {
8443 "round": true,
8444 "block": true,
8445 "type": "primary",
8446 "class": bem$T("add"),
8447 "text": props2.addText || t$c("addContact"),
8448 "onClick": () => emit("add")
8449 }, null)])]);
8450 }
8451});
8452const ContactList = withInstall(stdin_default$11);
8453function parseFormat(format2, currentTime) {
8454 const { days } = currentTime;
8455 let { hours, minutes, seconds, milliseconds } = currentTime;
8456 if (format2.includes("DD")) {
8457 format2 = format2.replace("DD", padZero(days));
8458 } else {
8459 hours += days * 24;
8460 }
8461 if (format2.includes("HH")) {
8462 format2 = format2.replace("HH", padZero(hours));
8463 } else {
8464 minutes += hours * 60;
8465 }
8466 if (format2.includes("mm")) {
8467 format2 = format2.replace("mm", padZero(minutes));
8468 } else {
8469 seconds += minutes * 60;
8470 }
8471 if (format2.includes("ss")) {
8472 format2 = format2.replace("ss", padZero(seconds));
8473 } else {
8474 milliseconds += seconds * 1e3;
8475 }
8476 if (format2.includes("S")) {
8477 const ms = padZero(milliseconds, 3);
8478 if (format2.includes("SSS")) {
8479 format2 = format2.replace("SSS", ms);
8480 } else if (format2.includes("SS")) {
8481 format2 = format2.replace("SS", ms.slice(0, 2));
8482 } else {
8483 format2 = format2.replace("S", ms.charAt(0));
8484 }
8485 }
8486 return format2;
8487}
8488const [name$T, bem$S] = createNamespace("count-down");
8489const countDownProps = {
8490 time: makeNumericProp(0),
8491 format: makeStringProp("HH:mm:ss"),
8492 autoStart: truthProp,
8493 millisecond: Boolean
8494};
8495var stdin_default$10 = vue.defineComponent({
8496 name: name$T,
8497 props: countDownProps,
8498 emits: ["change", "finish"],
8499 setup(props2, {
8500 emit,
8501 slots
8502 }) {
8503 const {
8504 start,
8505 pause,
8506 reset,
8507 current: current2
8508 } = use.useCountDown({
8509 time: +props2.time,
8510 millisecond: props2.millisecond,
8511 onChange: (current22) => emit("change", current22),
8512 onFinish: () => emit("finish")
8513 });
8514 const timeText = vue.computed(() => parseFormat(props2.format, current2.value));
8515 const resetTime = () => {
8516 reset(+props2.time);
8517 if (props2.autoStart) {
8518 start();
8519 }
8520 };
8521 vue.watch(() => props2.time, resetTime, {
8522 immediate: true
8523 });
8524 useExpose({
8525 start,
8526 pause,
8527 reset: resetTime
8528 });
8529 return () => vue.createVNode("div", {
8530 "role": "timer",
8531 "class": bem$S()
8532 }, [slots.default ? slots.default(current2.value) : timeText.value]);
8533 }
8534});
8535const CountDown = withInstall(stdin_default$10);
8536function getDate(timeStamp) {
8537 const date = new Date(timeStamp * 1e3);
8538 return `${date.getFullYear()}.${padZero(date.getMonth() + 1)}.${padZero(
8539 date.getDate()
8540 )}`;
8541}
8542const formatDiscount = (discount) => (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);
8543const formatAmount = (amount) => (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);
8544const [name$S, bem$R, t$b] = createNamespace("coupon");
8545var stdin_default$$ = vue.defineComponent({
8546 name: name$S,
8547 props: {
8548 chosen: Boolean,
8549 coupon: makeRequiredProp(Object),
8550 disabled: Boolean,
8551 currency: makeStringProp("¥")
8552 },
8553 setup(props2) {
8554 const validPeriod = vue.computed(() => {
8555 const {
8556 startAt,
8557 endAt
8558 } = props2.coupon;
8559 return `${getDate(startAt)} - ${getDate(endAt)}`;
8560 });
8561 const faceAmount = vue.computed(() => {
8562 const {
8563 coupon,
8564 currency
8565 } = props2;
8566 if (coupon.valueDesc) {
8567 return [coupon.valueDesc, vue.createVNode("span", null, [coupon.unitDesc || ""])];
8568 }
8569 if (coupon.denominations) {
8570 const denominations = formatAmount(coupon.denominations);
8571 return [vue.createVNode("span", null, [currency]), ` ${denominations}`];
8572 }
8573 if (coupon.discount) {
8574 return t$b("discount", formatDiscount(coupon.discount));
8575 }
8576 return "";
8577 });
8578 const conditionMessage = vue.computed(() => {
8579 const condition = formatAmount(props2.coupon.originCondition || 0);
8580 return condition === "0" ? t$b("unlimited") : t$b("condition", condition);
8581 });
8582 return () => {
8583 const {
8584 chosen,
8585 coupon,
8586 disabled
8587 } = props2;
8588 const description = disabled && coupon.reason || coupon.description;
8589 return vue.createVNode("div", {
8590 "class": bem$R({
8591 disabled
8592 })
8593 }, [vue.createVNode("div", {
8594 "class": bem$R("content")
8595 }, [vue.createVNode("div", {
8596 "class": bem$R("head")
8597 }, [vue.createVNode("h2", {
8598 "class": bem$R("amount")
8599 }, [faceAmount.value]), vue.createVNode("p", {
8600 "class": bem$R("condition")
8601 }, [coupon.condition || conditionMessage.value])]), vue.createVNode("div", {
8602 "class": bem$R("body")
8603 }, [vue.createVNode("p", {
8604 "class": bem$R("name")
8605 }, [coupon.name]), vue.createVNode("p", {
8606 "class": bem$R("valid")
8607 }, [validPeriod.value]), !disabled && vue.createVNode(Checkbox, {
8608 "class": bem$R("corner"),
8609 "modelValue": chosen
8610 }, null)])]), description && vue.createVNode("p", {
8611 "class": bem$R("description")
8612 }, [description])]);
8613 };
8614 }
8615});
8616const Coupon = withInstall(stdin_default$$);
8617const [name$R, bem$Q, t$a] = createNamespace("coupon-cell");
8618const couponCellProps = {
8619 title: String,
8620 border: truthProp,
8621 editable: truthProp,
8622 coupons: makeArrayProp(),
8623 currency: makeStringProp("¥"),
8624 chosenCoupon: makeNumericProp(-1)
8625};
8626function formatValue({
8627 coupons,
8628 chosenCoupon,
8629 currency
8630}) {
8631 const coupon = coupons[+chosenCoupon];
8632 if (coupon) {
8633 let value = 0;
8634 if (isDef(coupon.value)) {
8635 ({
8636 value
8637 } = coupon);
8638 } else if (isDef(coupon.denominations)) {
8639 value = coupon.denominations;
8640 }
8641 return `-${currency} ${(value / 100).toFixed(2)}`;
8642 }
8643 return coupons.length === 0 ? t$a("noCoupon") : t$a("count", coupons.length);
8644}
8645var stdin_default$_ = vue.defineComponent({
8646 name: name$R,
8647 props: couponCellProps,
8648 setup(props2) {
8649 return () => {
8650 const selected = props2.coupons[+props2.chosenCoupon];
8651 return vue.createVNode(Cell, {
8652 "class": bem$Q(),
8653 "value": formatValue(props2),
8654 "title": props2.title || t$a("title"),
8655 "border": props2.border,
8656 "isLink": props2.editable,
8657 "valueClass": bem$Q("value", {
8658 selected
8659 })
8660 }, null);
8661 };
8662 }
8663});
8664const CouponCell = withInstall(stdin_default$_);
8665const [name$Q, bem$P] = createNamespace("empty");
8666const emptyProps = {
8667 image: makeStringProp("default"),
8668 imageSize: [Number, String, Array],
8669 description: String
8670};
8671var stdin_default$Z = vue.defineComponent({
8672 name: name$Q,
8673 props: emptyProps,
8674 setup(props2, {
8675 slots
8676 }) {
8677 const renderDescription = () => {
8678 const description = slots.description ? slots.description() : props2.description;
8679 if (description) {
8680 return vue.createVNode("p", {
8681 "class": bem$P("description")
8682 }, [description]);
8683 }
8684 };
8685 const renderBottom = () => {
8686 if (slots.default) {
8687 return vue.createVNode("div", {
8688 "class": bem$P("bottom")
8689 }, [slots.default()]);
8690 }
8691 };
8692 const baseId = useId();
8693 const getId = (num) => `${baseId}-${num}`;
8694 const getUrlById = (num) => `url(#${getId(num)})`;
8695 const renderStop = (color, offset, opacity) => vue.createVNode("stop", {
8696 "stop-color": color,
8697 "offset": `${offset}%`,
8698 "stop-opacity": opacity
8699 }, null);
8700 const renderStops = (fromColor, toColor) => [renderStop(fromColor, 0), renderStop(toColor, 100)];
8701 const renderShadow = (id) => [vue.createVNode("defs", null, [vue.createVNode("radialGradient", {
8702 "id": getId(id),
8703 "cx": "50%",
8704 "cy": "54%",
8705 "fx": "50%",
8706 "fy": "54%",
8707 "r": "297%",
8708 "gradientTransform": "matrix(-.16 0 0 -.33 .58 .72)"
8709 }, [renderStop("#EBEDF0", 0), renderStop("#F2F3F5", 100, 0.3)])]), vue.createVNode("ellipse", {
8710 "fill": getUrlById(id),
8711 "opacity": ".8",
8712 "cx": "80",
8713 "cy": "140",
8714 "rx": "46",
8715 "ry": "8"
8716 }, null)];
8717 const renderBuilding = () => [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
8718 "id": getId("a"),
8719 "x1": "64%",
8720 "y1": "100%",
8721 "x2": "64%"
8722 }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)])]), vue.createVNode("g", {
8723 "opacity": ".8"
8724 }, [vue.createVNode("path", {
8725 "d": "M36 131V53H16v20H2v58h34z",
8726 "fill": getUrlById("a")
8727 }, null), vue.createVNode("path", {
8728 "d": "M123 15h22v14h9v77h-31V15z",
8729 "fill": getUrlById("a")
8730 }, null)])];
8731 const renderCloud = () => [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
8732 "id": getId("b"),
8733 "x1": "64%",
8734 "y1": "97%",
8735 "x2": "64%",
8736 "y2": "0%"
8737 }, [renderStop("#F2F3F5", 0, 0.3), renderStop("#F2F3F5", 100)])]), vue.createVNode("g", {
8738 "opacity": ".8"
8739 }, [vue.createVNode("path", {
8740 "d": "M87 6c3 0 7 3 8 6a8 8 0 1 1-1 16H80a7 7 0 0 1-8-6c0-4 3-7 6-7 0-5 4-9 9-9Z",
8741 "fill": getUrlById("b")
8742 }, null), vue.createVNode("path", {
8743 "d": "M19 23c2 0 3 1 4 3 2 0 4 2 4 4a4 4 0 0 1-4 3v1h-7v-1l-1 1c-2 0-3-2-3-4 0-1 1-3 3-3 0-2 2-4 4-4Z",
8744 "fill": getUrlById("b")
8745 }, null)])];
8746 const renderNetwork = () => vue.createVNode("svg", {
8747 "viewBox": "0 0 160 160"
8748 }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
8749 "id": getId(1),
8750 "x1": "64%",
8751 "y1": "100%",
8752 "x2": "64%"
8753 }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)]), vue.createVNode("linearGradient", {
8754 "id": getId(2),
8755 "x1": "50%",
8756 "x2": "50%",
8757 "y2": "84%"
8758 }, [renderStop("#EBEDF0", 0), renderStop("#DCDEE0", 100, 0)]), vue.createVNode("linearGradient", {
8759 "id": getId(3),
8760 "x1": "100%",
8761 "x2": "100%",
8762 "y2": "100%"
8763 }, [renderStops("#EAEDF0", "#DCDEE0")]), vue.createVNode("radialGradient", {
8764 "id": getId(4),
8765 "cx": "50%",
8766 "cy": "0%",
8767 "fx": "50%",
8768 "fy": "0%",
8769 "r": "100%",
8770 "gradientTransform": "matrix(0 1 -.54 0 .5 -.5)"
8771 }, [renderStop("#EBEDF0", 0), renderStop("#FFF", 100, 0)])]), vue.createVNode("g", {
8772 "fill": "none"
8773 }, [renderBuilding(), vue.createVNode("path", {
8774 "fill": getUrlById(4),
8775 "d": "M0 139h160v21H0z"
8776 }, null), vue.createVNode("path", {
8777 "d": "M80 54a7 7 0 0 1 3 13v27l-2 2h-2a2 2 0 0 1-2-2V67a7 7 0 0 1 3-13z",
8778 "fill": getUrlById(2)
8779 }, null), vue.createVNode("g", {
8780 "opacity": ".6",
8781 "stroke-linecap": "round",
8782 "stroke-width": "7"
8783 }, [vue.createVNode("path", {
8784 "d": "M64 47a19 19 0 0 0-5 13c0 5 2 10 5 13",
8785 "stroke": getUrlById(3)
8786 }, null), vue.createVNode("path", {
8787 "d": "M53 36a34 34 0 0 0 0 48",
8788 "stroke": getUrlById(3)
8789 }, null), vue.createVNode("path", {
8790 "d": "M95 73a19 19 0 0 0 6-13c0-5-2-9-6-13",
8791 "stroke": getUrlById(3)
8792 }, null), vue.createVNode("path", {
8793 "d": "M106 84a34 34 0 0 0 0-48",
8794 "stroke": getUrlById(3)
8795 }, null)]), vue.createVNode("g", {
8796 "transform": "translate(31 105)"
8797 }, [vue.createVNode("rect", {
8798 "fill": "#EBEDF0",
8799 "width": "98",
8800 "height": "34",
8801 "rx": "2"
8802 }, null), vue.createVNode("rect", {
8803 "fill": "#FFF",
8804 "x": "9",
8805 "y": "8",
8806 "width": "80",
8807 "height": "18",
8808 "rx": "1.1"
8809 }, null), vue.createVNode("rect", {
8810 "fill": "#EBEDF0",
8811 "x": "15",
8812 "y": "12",
8813 "width": "18",
8814 "height": "6",
8815 "rx": "1.1"
8816 }, null)])])]);
8817 const renderMaterial = () => vue.createVNode("svg", {
8818 "viewBox": "0 0 160 160"
8819 }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
8820 "x1": "50%",
8821 "x2": "50%",
8822 "y2": "100%",
8823 "id": getId(5)
8824 }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
8825 "x1": "95%",
8826 "y1": "48%",
8827 "x2": "5.5%",
8828 "y2": "51%",
8829 "id": getId(6)
8830 }, [renderStops("#EAEDF1", "#DCDEE0")]), vue.createVNode("linearGradient", {
8831 "y1": "45%",
8832 "x2": "100%",
8833 "y2": "54%",
8834 "id": getId(7)
8835 }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), vue.createVNode("g", {
8836 "transform": "translate(36 50)",
8837 "fill": "none"
8838 }, [vue.createVNode("g", {
8839 "transform": "translate(8)"
8840 }, [vue.createVNode("rect", {
8841 "fill": "#EBEDF0",
8842 "opacity": ".6",
8843 "x": "38",
8844 "y": "13",
8845 "width": "36",
8846 "height": "53",
8847 "rx": "2"
8848 }, null), vue.createVNode("rect", {
8849 "fill": getUrlById(5),
8850 "width": "64",
8851 "height": "66",
8852 "rx": "2"
8853 }, null), vue.createVNode("rect", {
8854 "fill": "#FFF",
8855 "x": "6",
8856 "y": "6",
8857 "width": "52",
8858 "height": "55",
8859 "rx": "1"
8860 }, null), vue.createVNode("g", {
8861 "transform": "translate(15 17)",
8862 "fill": getUrlById(6)
8863 }, [vue.createVNode("rect", {
8864 "width": "34",
8865 "height": "6",
8866 "rx": "1"
8867 }, null), vue.createVNode("path", {
8868 "d": "M0 14h34v6H0z"
8869 }, null), vue.createVNode("rect", {
8870 "y": "28",
8871 "width": "34",
8872 "height": "6",
8873 "rx": "1"
8874 }, null)])]), vue.createVNode("rect", {
8875 "fill": getUrlById(7),
8876 "y": "61",
8877 "width": "88",
8878 "height": "28",
8879 "rx": "1"
8880 }, null), vue.createVNode("rect", {
8881 "fill": "#F7F8FA",
8882 "x": "29",
8883 "y": "72",
8884 "width": "30",
8885 "height": "6",
8886 "rx": "1"
8887 }, null)])]);
8888 const renderError = () => vue.createVNode("svg", {
8889 "viewBox": "0 0 160 160"
8890 }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
8891 "x1": "50%",
8892 "x2": "50%",
8893 "y2": "100%",
8894 "id": getId(8)
8895 }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), renderShadow("c"), vue.createVNode("path", {
8896 "d": "m59 60 21 21 21-21h3l9 9v3L92 93l21 21v3l-9 9h-3l-21-21-21 21h-3l-9-9v-3l21-21-21-21v-3l9-9h3Z",
8897 "fill": getUrlById(8)
8898 }, null)]);
8899 const renderSearch = () => vue.createVNode("svg", {
8900 "viewBox": "0 0 160 160"
8901 }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
8902 "x1": "50%",
8903 "y1": "100%",
8904 "x2": "50%",
8905 "id": getId(9)
8906 }, [renderStops("#EEE", "#D8D8D8")]), vue.createVNode("linearGradient", {
8907 "x1": "100%",
8908 "y1": "50%",
8909 "y2": "50%",
8910 "id": getId(10)
8911 }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
8912 "x1": "50%",
8913 "x2": "50%",
8914 "y2": "100%",
8915 "id": getId(11)
8916 }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
8917 "x1": "50%",
8918 "x2": "50%",
8919 "y2": "100%",
8920 "id": getId(12)
8921 }, [renderStops("#FFF", "#F7F8FA")])]), renderBuilding(), renderCloud(), renderShadow("d"), vue.createVNode("g", {
8922 "transform": "rotate(-45 113 -4)",
8923 "fill": "none"
8924 }, [vue.createVNode("rect", {
8925 "fill": getUrlById(9),
8926 "x": "24",
8927 "y": "52.8",
8928 "width": "5.8",
8929 "height": "19",
8930 "rx": "1"
8931 }, null), vue.createVNode("rect", {
8932 "fill": getUrlById(10),
8933 "x": "22.1",
8934 "y": "67.3",
8935 "width": "9.9",
8936 "height": "28",
8937 "rx": "1"
8938 }, null), vue.createVNode("circle", {
8939 "stroke": getUrlById(11),
8940 "stroke-width": "8",
8941 "cx": "27",
8942 "cy": "27",
8943 "r": "27"
8944 }, null), vue.createVNode("circle", {
8945 "fill": getUrlById(12),
8946 "cx": "27",
8947 "cy": "27",
8948 "r": "16"
8949 }, null), vue.createVNode("path", {
8950 "d": "M37 7c-8 0-15 5-16 12",
8951 "stroke": getUrlById(11),
8952 "stroke-width": "3",
8953 "opacity": ".5",
8954 "stroke-linecap": "round",
8955 "transform": "rotate(45 29 13)"
8956 }, null)])]);
8957 const renderImage = () => {
8958 var _a;
8959 if (slots.image) {
8960 return slots.image();
8961 }
8962 const PRESET_IMAGES = {
8963 error: renderError,
8964 search: renderSearch,
8965 network: renderNetwork,
8966 default: renderMaterial
8967 };
8968 return ((_a = PRESET_IMAGES[props2.image]) == null ? void 0 : _a.call(PRESET_IMAGES)) || vue.createVNode("img", {
8969 "src": props2.image
8970 }, null);
8971 };
8972 return () => vue.createVNode("div", {
8973 "class": bem$P()
8974 }, [vue.createVNode("div", {
8975 "class": bem$P("image"),
8976 "style": getSizeStyle(props2.imageSize)
8977 }, [renderImage()]), renderDescription(), renderBottom()]);
8978 }
8979});
8980const Empty = withInstall(stdin_default$Z);
8981const [name$P, bem$O, t$9] = createNamespace("coupon-list");
8982const couponListProps = {
8983 code: makeStringProp(""),
8984 coupons: makeArrayProp(),
8985 currency: makeStringProp("¥"),
8986 showCount: truthProp,
8987 emptyImage: String,
8988 chosenCoupon: makeNumberProp(-1),
8989 enabledTitle: String,
8990 disabledTitle: String,
8991 disabledCoupons: makeArrayProp(),
8992 showExchangeBar: truthProp,
8993 showCloseButton: truthProp,
8994 closeButtonText: String,
8995 inputPlaceholder: String,
8996 exchangeMinLength: makeNumberProp(1),
8997 exchangeButtonText: String,
8998 displayedCouponIndex: makeNumberProp(-1),
8999 exchangeButtonLoading: Boolean,
9000 exchangeButtonDisabled: Boolean
9001};
9002var stdin_default$Y = vue.defineComponent({
9003 name: name$P,
9004 props: couponListProps,
9005 emits: ["change", "exchange", "update:code"],
9006 setup(props2, {
9007 emit,
9008 slots
9009 }) {
9010 const [couponRefs, setCouponRefs] = useRefs();
9011 const root = vue.ref();
9012 const barRef = vue.ref();
9013 const activeTab = vue.ref(0);
9014 const listHeight = vue.ref(0);
9015 const currentCode = vue.ref(props2.code);
9016 const buttonDisabled = vue.computed(() => !props2.exchangeButtonLoading && (props2.exchangeButtonDisabled || !currentCode.value || currentCode.value.length < props2.exchangeMinLength));
9017 const updateListHeight = () => {
9018 const TABS_HEIGHT = 44;
9019 const rootHeight = use.useRect(root).height;
9020 const headerHeight = use.useRect(barRef).height + TABS_HEIGHT;
9021 listHeight.value = (rootHeight > headerHeight ? rootHeight : windowHeight.value) - headerHeight;
9022 };
9023 const onExchange = () => {
9024 emit("exchange", currentCode.value);
9025 if (!props2.code) {
9026 currentCode.value = "";
9027 }
9028 };
9029 const scrollToCoupon = (index) => {
9030 vue.nextTick(() => {
9031 var _a;
9032 return (_a = couponRefs.value[index]) == null ? void 0 : _a.scrollIntoView();
9033 });
9034 };
9035 const renderEmpty = () => vue.createVNode(Empty, {
9036 "image": props2.emptyImage
9037 }, {
9038 default: () => [vue.createVNode("p", {
9039 "class": bem$O("empty-tip")
9040 }, [t$9("noCoupon")])]
9041 });
9042 const renderExchangeBar = () => {
9043 if (props2.showExchangeBar) {
9044 return vue.createVNode("div", {
9045 "ref": barRef,
9046 "class": bem$O("exchange-bar")
9047 }, [vue.createVNode(Field, {
9048 "modelValue": currentCode.value,
9049 "onUpdate:modelValue": ($event) => currentCode.value = $event,
9050 "clearable": true,
9051 "border": false,
9052 "class": bem$O("field"),
9053 "placeholder": props2.inputPlaceholder || t$9("placeholder"),
9054 "maxlength": "20"
9055 }, null), vue.createVNode(Button, {
9056 "plain": true,
9057 "type": "primary",
9058 "class": bem$O("exchange"),
9059 "text": props2.exchangeButtonText || t$9("exchange"),
9060 "loading": props2.exchangeButtonLoading,
9061 "disabled": buttonDisabled.value,
9062 "onClick": onExchange
9063 }, null)]);
9064 }
9065 };
9066 const renderCouponTab = () => {
9067 const {
9068 coupons
9069 } = props2;
9070 const count = props2.showCount ? ` (${coupons.length})` : "";
9071 const title = (props2.enabledTitle || t$9("enable")) + count;
9072 return vue.createVNode(Tab, {
9073 "title": title
9074 }, {
9075 default: () => {
9076 var _a;
9077 return [vue.createVNode("div", {
9078 "class": bem$O("list", {
9079 "with-bottom": props2.showCloseButton
9080 }),
9081 "style": {
9082 height: `${listHeight.value}px`
9083 }
9084 }, [coupons.map((coupon, index) => vue.createVNode(Coupon, {
9085 "key": coupon.id,
9086 "ref": setCouponRefs(index),
9087 "coupon": coupon,
9088 "chosen": index === props2.chosenCoupon,
9089 "currency": props2.currency,
9090 "onClick": () => emit("change", index)
9091 }, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
9092 }
9093 });
9094 };
9095 const renderDisabledTab = () => {
9096 const {
9097 disabledCoupons
9098 } = props2;
9099 const count = props2.showCount ? ` (${disabledCoupons.length})` : "";
9100 const title = (props2.disabledTitle || t$9("disabled")) + count;
9101 return vue.createVNode(Tab, {
9102 "title": title
9103 }, {
9104 default: () => {
9105 var _a;
9106 return [vue.createVNode("div", {
9107 "class": bem$O("list", {
9108 "with-bottom": props2.showCloseButton
9109 }),
9110 "style": {
9111 height: `${listHeight.value}px`
9112 }
9113 }, [disabledCoupons.map((coupon) => vue.createVNode(Coupon, {
9114 "disabled": true,
9115 "key": coupon.id,
9116 "coupon": coupon,
9117 "currency": props2.currency
9118 }, null)), !disabledCoupons.length && renderEmpty(), (_a = slots["disabled-list-footer"]) == null ? void 0 : _a.call(slots)])];
9119 }
9120 });
9121 };
9122 vue.watch(() => props2.code, (value) => {
9123 currentCode.value = value;
9124 });
9125 vue.watch(windowHeight, updateListHeight);
9126 vue.watch(currentCode, (value) => emit("update:code", value));
9127 vue.watch(() => props2.displayedCouponIndex, scrollToCoupon);
9128 vue.onMounted(() => {
9129 updateListHeight();
9130 scrollToCoupon(props2.displayedCouponIndex);
9131 });
9132 return () => vue.createVNode("div", {
9133 "ref": root,
9134 "class": bem$O()
9135 }, [renderExchangeBar(), vue.createVNode(Tabs, {
9136 "active": activeTab.value,
9137 "onUpdate:active": ($event) => activeTab.value = $event,
9138 "class": bem$O("tab")
9139 }, {
9140 default: () => [renderCouponTab(), renderDisabledTab()]
9141 }), vue.createVNode("div", {
9142 "class": bem$O("bottom")
9143 }, [vue.withDirectives(vue.createVNode(Button, {
9144 "round": true,
9145 "block": true,
9146 "type": "primary",
9147 "class": bem$O("close"),
9148 "text": props2.closeButtonText || t$9("close"),
9149 "onClick": () => emit("change", -1)
9150 }, null), [[vue.vShow, props2.showCloseButton]])])]);
9151 }
9152});
9153const CouponList = withInstall(stdin_default$Y);
9154const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
9155const [name$O] = createNamespace("date-picker");
9156const datePickerProps = extend({}, sharedProps, {
9157 columnsType: {
9158 type: Array,
9159 default: () => ["year", "month", "day"]
9160 },
9161 minDate: {
9162 type: Date,
9163 default: () => new Date(currentYear - 10, 0, 1),
9164 validator: isDate
9165 },
9166 maxDate: {
9167 type: Date,
9168 default: () => new Date(currentYear + 10, 11, 31),
9169 validator: isDate
9170 }
9171});
9172var stdin_default$X = vue.defineComponent({
9173 name: name$O,
9174 props: datePickerProps,
9175 emits: ["confirm", "cancel", "change", "update:modelValue"],
9176 setup(props2, {
9177 emit,
9178 slots
9179 }) {
9180 const currentValues = vue.ref(props2.modelValue);
9181 const updatedByExternalSources = vue.ref(false);
9182 const genYearOptions = () => {
9183 const minYear = props2.minDate.getFullYear();
9184 const maxYear = props2.maxDate.getFullYear();
9185 return genOptions(minYear, maxYear, "year", props2.formatter, props2.filter);
9186 };
9187 const isMinYear = (year) => year === props2.minDate.getFullYear();
9188 const isMaxYear = (year) => year === props2.maxDate.getFullYear();
9189 const isMinMonth = (month) => month === props2.minDate.getMonth() + 1;
9190 const isMaxMonth = (month) => month === props2.maxDate.getMonth() + 1;
9191 const getValue = (type) => {
9192 const {
9193 minDate,
9194 columnsType
9195 } = props2;
9196 const index = columnsType.indexOf(type);
9197 const value = updatedByExternalSources.value ? props2.modelValue[index] : currentValues.value[index];
9198 if (value) {
9199 return +value;
9200 }
9201 switch (type) {
9202 case "year":
9203 return minDate.getFullYear();
9204 case "month":
9205 return minDate.getMonth() + 1;
9206 case "day":
9207 return minDate.getDate();
9208 }
9209 };
9210 const genMonthOptions = () => {
9211 const year = getValue("year");
9212 const minMonth = isMinYear(year) ? props2.minDate.getMonth() + 1 : 1;
9213 const maxMonth = isMaxYear(year) ? props2.maxDate.getMonth() + 1 : 12;
9214 return genOptions(minMonth, maxMonth, "month", props2.formatter, props2.filter);
9215 };
9216 const genDayOptions = () => {
9217 const year = getValue("year");
9218 const month = getValue("month");
9219 const minDate = isMinYear(year) && isMinMonth(month) ? props2.minDate.getDate() : 1;
9220 const maxDate = isMaxYear(year) && isMaxMonth(month) ? props2.maxDate.getDate() : getMonthEndDay(year, month);
9221 return genOptions(minDate, maxDate, "day", props2.formatter, props2.filter);
9222 };
9223 const columns = vue.computed(() => props2.columnsType.map((type) => {
9224 switch (type) {
9225 case "year":
9226 return genYearOptions();
9227 case "month":
9228 return genMonthOptions();
9229 case "day":
9230 return genDayOptions();
9231 default:
9232 if (process.env.NODE_ENV !== "production") {
9233 throw new Error(`[Vant] DatePicker: unsupported columns type: ${type}`);
9234 }
9235 return [];
9236 }
9237 }));
9238 vue.watch(currentValues, (newValues) => {
9239 if (!isSameValue(newValues, props2.modelValue)) {
9240 emit("update:modelValue", newValues);
9241 }
9242 });
9243 vue.watch(() => props2.modelValue, (newValues, oldValues) => {
9244 updatedByExternalSources.value = isSameValue(oldValues, currentValues.value);
9245 newValues = formatValueRange(newValues, columns.value);
9246 if (!isSameValue(newValues, currentValues.value)) {
9247 currentValues.value = newValues;
9248 }
9249 updatedByExternalSources.value = false;
9250 }, {
9251 immediate: true
9252 });
9253 const onChange = (...args) => emit("change", ...args);
9254 const onCancel = (...args) => emit("cancel", ...args);
9255 const onConfirm = (...args) => emit("confirm", ...args);
9256 return () => vue.createVNode(Picker, vue.mergeProps({
9257 "modelValue": currentValues.value,
9258 "onUpdate:modelValue": ($event) => currentValues.value = $event,
9259 "columns": columns.value,
9260 "onChange": onChange,
9261 "onCancel": onCancel,
9262 "onConfirm": onConfirm
9263 }, pick(props2, pickerInheritKeys)), slots);
9264 }
9265});
9266const DatePicker = withInstall(stdin_default$X);
9267const [name$N, bem$N, t$8] = createNamespace("dialog");
9268const dialogProps = extend({}, popupSharedProps, {
9269 title: String,
9270 theme: String,
9271 width: numericProp,
9272 message: [String, Function],
9273 callback: Function,
9274 allowHtml: Boolean,
9275 className: unknownProp,
9276 transition: makeStringProp("van-dialog-bounce"),
9277 messageAlign: String,
9278 closeOnPopstate: truthProp,
9279 showCancelButton: Boolean,
9280 cancelButtonText: String,
9281 cancelButtonColor: String,
9282 cancelButtonDisabled: Boolean,
9283 confirmButtonText: String,
9284 confirmButtonColor: String,
9285 confirmButtonDisabled: Boolean,
9286 showConfirmButton: truthProp,
9287 closeOnClickOverlay: Boolean
9288});
9289const popupInheritKeys$1 = [...popupSharedPropKeys, "transition", "closeOnPopstate"];
9290var stdin_default$W = vue.defineComponent({
9291 name: name$N,
9292 props: dialogProps,
9293 emits: ["confirm", "cancel", "keydown", "update:show"],
9294 setup(props2, {
9295 emit,
9296 slots
9297 }) {
9298 const root = vue.ref();
9299 const loading = vue.reactive({
9300 confirm: false,
9301 cancel: false
9302 });
9303 const updateShow = (value) => emit("update:show", value);
9304 const close = (action) => {
9305 var _a;
9306 updateShow(false);
9307 (_a = props2.callback) == null ? void 0 : _a.call(props2, action);
9308 };
9309 const getActionHandler = (action) => () => {
9310 if (!props2.show) {
9311 return;
9312 }
9313 emit(action);
9314 if (props2.beforeClose) {
9315 loading[action] = true;
9316 callInterceptor(props2.beforeClose, {
9317 args: [action],
9318 done() {
9319 close(action);
9320 loading[action] = false;
9321 },
9322 canceled() {
9323 loading[action] = false;
9324 }
9325 });
9326 } else {
9327 close(action);
9328 }
9329 };
9330 const onCancel = getActionHandler("cancel");
9331 const onConfirm = getActionHandler("confirm");
9332 const onKeydown = vue.withKeys((event) => {
9333 var _a, _b;
9334 if (event.target !== ((_b = (_a = root.value) == null ? void 0 : _a.popupRef) == null ? void 0 : _b.value)) {
9335 return;
9336 }
9337 const onEventType = {
9338 Enter: props2.showConfirmButton ? onConfirm : noop,
9339 Escape: props2.showCancelButton ? onCancel : noop
9340 };
9341 onEventType[event.key]();
9342 emit("keydown", event);
9343 }, ["enter", "esc"]);
9344 const renderTitle = () => {
9345 const title = slots.title ? slots.title() : props2.title;
9346 if (title) {
9347 return vue.createVNode("div", {
9348 "class": bem$N("header", {
9349 isolated: !props2.message && !slots.default
9350 })
9351 }, [title]);
9352 }
9353 };
9354 const renderMessage = (hasTitle) => {
9355 const {
9356 message,
9357 allowHtml,
9358 messageAlign
9359 } = props2;
9360 const classNames = bem$N("message", {
9361 "has-title": hasTitle,
9362 [messageAlign]: messageAlign
9363 });
9364 const content = isFunction(message) ? message() : message;
9365 if (allowHtml && typeof content === "string") {
9366 return vue.createVNode("div", {
9367 "class": classNames,
9368 "innerHTML": content
9369 }, null);
9370 }
9371 return vue.createVNode("div", {
9372 "class": classNames
9373 }, [content]);
9374 };
9375 const renderContent = () => {
9376 if (slots.default) {
9377 return vue.createVNode("div", {
9378 "class": bem$N("content")
9379 }, [slots.default()]);
9380 }
9381 const {
9382 title,
9383 message,
9384 allowHtml
9385 } = props2;
9386 if (message) {
9387 const hasTitle = !!(title || slots.title);
9388 return vue.createVNode("div", {
9389 "key": allowHtml ? 1 : 0,
9390 "class": bem$N("content", {
9391 isolated: !hasTitle
9392 })
9393 }, [renderMessage(hasTitle)]);
9394 }
9395 };
9396 const renderButtons = () => vue.createVNode("div", {
9397 "class": [BORDER_TOP, bem$N("footer")]
9398 }, [props2.showCancelButton && vue.createVNode(Button, {
9399 "size": "large",
9400 "text": props2.cancelButtonText || t$8("cancel"),
9401 "class": bem$N("cancel"),
9402 "style": {
9403 color: props2.cancelButtonColor
9404 },
9405 "loading": loading.cancel,
9406 "disabled": props2.cancelButtonDisabled,
9407 "onClick": onCancel
9408 }, null), props2.showConfirmButton && vue.createVNode(Button, {
9409 "size": "large",
9410 "text": props2.confirmButtonText || t$8("confirm"),
9411 "class": [bem$N("confirm"), {
9412 [BORDER_LEFT]: props2.showCancelButton
9413 }],
9414 "style": {
9415 color: props2.confirmButtonColor
9416 },
9417 "loading": loading.confirm,
9418 "disabled": props2.confirmButtonDisabled,
9419 "onClick": onConfirm
9420 }, null)]);
9421 const renderRoundButtons = () => vue.createVNode(ActionBar, {
9422 "class": bem$N("footer")
9423 }, {
9424 default: () => [props2.showCancelButton && vue.createVNode(ActionBarButton, {
9425 "type": "warning",
9426 "text": props2.cancelButtonText || t$8("cancel"),
9427 "class": bem$N("cancel"),
9428 "color": props2.cancelButtonColor,
9429 "loading": loading.cancel,
9430 "disabled": props2.cancelButtonDisabled,
9431 "onClick": onCancel
9432 }, null), props2.showConfirmButton && vue.createVNode(ActionBarButton, {
9433 "type": "danger",
9434 "text": props2.confirmButtonText || t$8("confirm"),
9435 "class": bem$N("confirm"),
9436 "color": props2.confirmButtonColor,
9437 "loading": loading.confirm,
9438 "disabled": props2.confirmButtonDisabled,
9439 "onClick": onConfirm
9440 }, null)]
9441 });
9442 const renderFooter = () => {
9443 if (slots.footer) {
9444 return slots.footer();
9445 }
9446 return props2.theme === "round-button" ? renderRoundButtons() : renderButtons();
9447 };
9448 return () => {
9449 const {
9450 width,
9451 title,
9452 theme,
9453 message,
9454 className
9455 } = props2;
9456 return vue.createVNode(Popup, vue.mergeProps({
9457 "ref": root,
9458 "role": "dialog",
9459 "class": [bem$N([theme]), className],
9460 "style": {
9461 width: addUnit(width)
9462 },
9463 "tabindex": 0,
9464 "aria-labelledby": title || message,
9465 "onKeydown": onKeydown,
9466 "onUpdate:show": updateShow
9467 }, pick(props2, popupInheritKeys$1)), {
9468 default: () => [renderTitle(), renderContent(), renderFooter()]
9469 });
9470 };
9471 }
9472});
9473let instance$2;
9474const DEFAULT_OPTIONS = {
9475 title: "",
9476 width: "",
9477 theme: null,
9478 message: "",
9479 overlay: true,
9480 callback: null,
9481 teleport: "body",
9482 className: "",
9483 allowHtml: false,
9484 lockScroll: true,
9485 transition: void 0,
9486 beforeClose: null,
9487 overlayClass: "",
9488 overlayStyle: void 0,
9489 messageAlign: "",
9490 cancelButtonText: "",
9491 cancelButtonColor: null,
9492 cancelButtonDisabled: false,
9493 confirmButtonText: "",
9494 confirmButtonColor: null,
9495 confirmButtonDisabled: false,
9496 showConfirmButton: true,
9497 showCancelButton: false,
9498 closeOnPopstate: true,
9499 closeOnClickOverlay: false
9500};
9501let currentOptions$1 = extend({}, DEFAULT_OPTIONS);
9502function initInstance$2() {
9503 const Wrapper = {
9504 setup() {
9505 const {
9506 state,
9507 toggle
9508 } = usePopupState();
9509 return () => vue.createVNode(stdin_default$W, vue.mergeProps(state, {
9510 "onUpdate:show": toggle
9511 }), null);
9512 }
9513 };
9514 ({
9515 instance: instance$2
9516 } = mountComponent(Wrapper));
9517}
9518function showDialog(options) {
9519 if (!inBrowser) {
9520 return Promise.resolve(void 0);
9521 }
9522 return new Promise((resolve, reject) => {
9523 if (!instance$2) {
9524 initInstance$2();
9525 }
9526 instance$2.open(extend({}, currentOptions$1, options, {
9527 callback: (action) => {
9528 (action === "confirm" ? resolve : reject)(action);
9529 }
9530 }));
9531 });
9532}
9533const setDialogDefaultOptions = (options) => {
9534 extend(currentOptions$1, options);
9535};
9536const resetDialogDefaultOptions = () => {
9537 currentOptions$1 = extend({}, DEFAULT_OPTIONS);
9538};
9539const showConfirmDialog = (options) => showDialog(extend({
9540 showCancelButton: true
9541}, options));
9542const closeDialog = () => {
9543 if (instance$2) {
9544 instance$2.toggle(false);
9545 }
9546};
9547const Dialog = withInstall(stdin_default$W);
9548const [name$M, bem$M] = createNamespace("divider");
9549const dividerProps = {
9550 dashed: Boolean,
9551 hairline: truthProp,
9552 vertical: Boolean,
9553 contentPosition: makeStringProp("center")
9554};
9555var stdin_default$V = vue.defineComponent({
9556 name: name$M,
9557 props: dividerProps,
9558 setup(props2, {
9559 slots
9560 }) {
9561 return () => {
9562 var _a;
9563 return vue.createVNode("div", {
9564 "role": "separator",
9565 "class": bem$M({
9566 dashed: props2.dashed,
9567 hairline: props2.hairline,
9568 vertical: props2.vertical,
9569 [`content-${props2.contentPosition}`]: !!slots.default && !props2.vertical
9570 })
9571 }, [!props2.vertical && ((_a = slots.default) == null ? void 0 : _a.call(slots))]);
9572 };
9573 }
9574});
9575const Divider = withInstall(stdin_default$V);
9576const [name$L, bem$L] = createNamespace("dropdown-menu");
9577const dropdownMenuProps = {
9578 overlay: truthProp,
9579 zIndex: numericProp,
9580 duration: makeNumericProp(0.2),
9581 direction: makeStringProp("down"),
9582 activeColor: String,
9583 autoLocate: Boolean,
9584 closeOnClickOutside: truthProp,
9585 closeOnClickOverlay: truthProp,
9586 swipeThreshold: numericProp
9587};
9588const DROPDOWN_KEY = Symbol(name$L);
9589var stdin_default$U = vue.defineComponent({
9590 name: name$L,
9591 props: dropdownMenuProps,
9592 setup(props2, {
9593 slots
9594 }) {
9595 const id = useId();
9596 const root = vue.ref();
9597 const barRef = vue.ref();
9598 const offset = vue.ref(0);
9599 const {
9600 children,
9601 linkChildren
9602 } = use.useChildren(DROPDOWN_KEY);
9603 const scrollParent = use.useScrollParent(root);
9604 const opened = vue.computed(() => children.some((item) => item.state.showWrapper));
9605 const scrollable = vue.computed(() => props2.swipeThreshold && children.length > +props2.swipeThreshold);
9606 const barStyle = vue.computed(() => {
9607 if (opened.value && isDef(props2.zIndex)) {
9608 return {
9609 zIndex: +props2.zIndex + 1
9610 };
9611 }
9612 });
9613 const close = () => {
9614 children.forEach((item) => {
9615 item.toggle(false);
9616 });
9617 };
9618 const onClickAway = () => {
9619 if (props2.closeOnClickOutside) {
9620 close();
9621 }
9622 };
9623 const updateOffset = () => {
9624 if (barRef.value) {
9625 const rect = use.useRect(barRef);
9626 if (props2.direction === "down") {
9627 offset.value = rect.bottom;
9628 } else {
9629 offset.value = windowHeight.value - rect.top;
9630 }
9631 }
9632 };
9633 const onScroll = () => {
9634 if (opened.value) {
9635 updateOffset();
9636 }
9637 };
9638 const toggleItem = (active) => {
9639 children.forEach((item, index) => {
9640 if (index === active) {
9641 item.toggle();
9642 } else if (item.state.showPopup) {
9643 item.toggle(false, {
9644 immediate: true
9645 });
9646 }
9647 });
9648 };
9649 const renderTitle = (item, index) => {
9650 const {
9651 showPopup
9652 } = item.state;
9653 const {
9654 disabled,
9655 titleClass
9656 } = item;
9657 return vue.createVNode("div", {
9658 "id": `${id}-${index}`,
9659 "role": "button",
9660 "tabindex": disabled ? void 0 : 0,
9661 "class": [bem$L("item", {
9662 disabled,
9663 grow: scrollable.value
9664 }), {
9665 [HAPTICS_FEEDBACK]: !disabled
9666 }],
9667 "onClick": () => {
9668 if (!disabled) {
9669 toggleItem(index);
9670 }
9671 }
9672 }, [vue.createVNode("span", {
9673 "class": [bem$L("title", {
9674 down: showPopup === (props2.direction === "down"),
9675 active: showPopup
9676 }), titleClass],
9677 "style": {
9678 color: showPopup ? props2.activeColor : ""
9679 }
9680 }, [vue.createVNode("div", {
9681 "class": "van-ellipsis"
9682 }, [item.renderTitle()])])]);
9683 };
9684 useExpose({
9685 close
9686 });
9687 linkChildren({
9688 id,
9689 props: props2,
9690 offset,
9691 updateOffset
9692 });
9693 use.useClickAway(root, onClickAway);
9694 use.useEventListener("scroll", onScroll, {
9695 target: scrollParent,
9696 passive: true
9697 });
9698 return () => {
9699 var _a;
9700 return vue.createVNode("div", {
9701 "ref": root,
9702 "class": bem$L()
9703 }, [vue.createVNode("div", {
9704 "ref": barRef,
9705 "style": barStyle.value,
9706 "class": bem$L("bar", {
9707 opened: opened.value,
9708 scrollable: scrollable.value
9709 })
9710 }, [children.map(renderTitle)]), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
9711 };
9712 }
9713});
9714const [name$K, bem$K] = createNamespace("dropdown-item");
9715const dropdownItemProps = {
9716 title: String,
9717 options: makeArrayProp(),
9718 disabled: Boolean,
9719 teleport: [String, Object],
9720 lazyRender: truthProp,
9721 modelValue: unknownProp,
9722 titleClass: unknownProp
9723};
9724var stdin_default$T = vue.defineComponent({
9725 name: name$K,
9726 inheritAttrs: false,
9727 props: dropdownItemProps,
9728 emits: ["open", "opened", "close", "closed", "change", "update:modelValue"],
9729 setup(props2, {
9730 emit,
9731 slots,
9732 attrs
9733 }) {
9734 const state = vue.reactive({
9735 showPopup: false,
9736 transition: true,
9737 showWrapper: false
9738 });
9739 const wrapperRef = vue.ref();
9740 const {
9741 parent,
9742 index
9743 } = use.useParent(DROPDOWN_KEY);
9744 if (!parent) {
9745 if (process.env.NODE_ENV !== "production") {
9746 console.error("[Vant] <DropdownItem> must be a child component of <DropdownMenu>.");
9747 }
9748 return;
9749 }
9750 const getEmitter = (name2) => () => emit(name2);
9751 const onOpen = getEmitter("open");
9752 const onClose = getEmitter("close");
9753 const onOpened = getEmitter("opened");
9754 const onClosed = () => {
9755 state.showWrapper = false;
9756 emit("closed");
9757 };
9758 const onClickWrapper = (event) => {
9759 if (props2.teleport) {
9760 event.stopPropagation();
9761 }
9762 };
9763 const toggle = (show = !state.showPopup, options = {}) => {
9764 if (show === state.showPopup) {
9765 return;
9766 }
9767 state.showPopup = show;
9768 state.transition = !options.immediate;
9769 if (show) {
9770 parent.updateOffset();
9771 state.showWrapper = true;
9772 }
9773 };
9774 const renderTitle = () => {
9775 if (slots.title) {
9776 return slots.title();
9777 }
9778 if (props2.title) {
9779 return props2.title;
9780 }
9781 const match = props2.options.find((option) => option.value === props2.modelValue);
9782 return match ? match.text : "";
9783 };
9784 const renderOption = (option) => {
9785 const {
9786 activeColor
9787 } = parent.props;
9788 const active = option.value === props2.modelValue;
9789 const onClick = () => {
9790 state.showPopup = false;
9791 if (option.value !== props2.modelValue) {
9792 emit("update:modelValue", option.value);
9793 emit("change", option.value);
9794 }
9795 };
9796 const renderIcon = () => {
9797 if (active) {
9798 return vue.createVNode(Icon, {
9799 "class": bem$K("icon"),
9800 "color": activeColor,
9801 "name": "success"
9802 }, null);
9803 }
9804 };
9805 return vue.createVNode(Cell, {
9806 "role": "menuitem",
9807 "key": String(option.value),
9808 "icon": option.icon,
9809 "title": option.text,
9810 "class": bem$K("option", {
9811 active
9812 }),
9813 "style": {
9814 color: active ? activeColor : ""
9815 },
9816 "tabindex": active ? 0 : -1,
9817 "clickable": true,
9818 "onClick": onClick
9819 }, {
9820 value: renderIcon
9821 });
9822 };
9823 const renderContent = () => {
9824 const {
9825 offset
9826 } = parent;
9827 const {
9828 autoLocate,
9829 zIndex,
9830 overlay,
9831 duration,
9832 direction,
9833 closeOnClickOverlay
9834 } = parent.props;
9835 const style = getZIndexStyle(zIndex);
9836 let offsetValue = offset.value;
9837 if (autoLocate && wrapperRef.value) {
9838 const offsetParent = getContainingBlock(wrapperRef.value);
9839 if (offsetParent) {
9840 offsetValue -= use.useRect(offsetParent).top;
9841 }
9842 }
9843 if (direction === "down") {
9844 style.top = `${offsetValue}px`;
9845 } else {
9846 style.bottom = `${offsetValue}px`;
9847 }
9848 return vue.withDirectives(vue.createVNode("div", vue.mergeProps({
9849 "ref": wrapperRef,
9850 "style": style,
9851 "class": bem$K([direction]),
9852 "onClick": onClickWrapper
9853 }, attrs), [vue.createVNode(Popup, {
9854 "show": state.showPopup,
9855 "onUpdate:show": ($event) => state.showPopup = $event,
9856 "role": "menu",
9857 "class": bem$K("content"),
9858 "overlay": overlay,
9859 "position": direction === "down" ? "top" : "bottom",
9860 "duration": state.transition ? duration : 0,
9861 "lazyRender": props2.lazyRender,
9862 "overlayStyle": {
9863 position: "absolute"
9864 },
9865 "aria-labelledby": `${parent.id}-${index.value}`,
9866 "closeOnClickOverlay": closeOnClickOverlay,
9867 "onOpen": onOpen,
9868 "onClose": onClose,
9869 "onOpened": onOpened,
9870 "onClosed": onClosed
9871 }, {
9872 default: () => {
9873 var _a;
9874 return [props2.options.map(renderOption), (_a = slots.default) == null ? void 0 : _a.call(slots)];
9875 }
9876 })]), [[vue.vShow, state.showWrapper]]);
9877 };
9878 useExpose({
9879 state,
9880 toggle,
9881 renderTitle
9882 });
9883 return () => {
9884 if (props2.teleport) {
9885 return vue.createVNode(vue.Teleport, {
9886 "to": props2.teleport
9887 }, {
9888 default: () => [renderContent()]
9889 });
9890 }
9891 return renderContent();
9892 };
9893 }
9894});
9895const DropdownItem = withInstall(stdin_default$T);
9896const DropdownMenu = withInstall(stdin_default$U);
9897const floatingBubbleProps = {
9898 gap: makeNumberProp(24),
9899 icon: String,
9900 axis: makeStringProp("y"),
9901 magnetic: String,
9902 offset: {
9903 type: Object,
9904 default: () => ({
9905 x: -1,
9906 y: -1
9907 })
9908 },
9909 teleport: {
9910 type: [String, Object],
9911 default: "body"
9912 }
9913};
9914const [name$J, bem$J] = createNamespace("floating-bubble");
9915var stdin_default$S = vue.defineComponent({
9916 name: name$J,
9917 inheritAttrs: false,
9918 props: floatingBubbleProps,
9919 emits: ["click", "update:offset", "offsetChange"],
9920 setup(props2, {
9921 slots,
9922 emit,
9923 attrs
9924 }) {
9925 const rootRef = vue.ref();
9926 const state = vue.ref({
9927 x: 0,
9928 y: 0,
9929 width: 0,
9930 height: 0
9931 });
9932 const boundary = vue.computed(() => ({
9933 top: props2.gap,
9934 right: windowWidth.value - state.value.width - props2.gap,
9935 bottom: windowHeight.value - state.value.height - props2.gap,
9936 left: props2.gap
9937 }));
9938 const dragging = vue.ref(false);
9939 let initialized = false;
9940 const rootStyle = vue.computed(() => {
9941 const style = {};
9942 const x = addUnit(state.value.x);
9943 const y = addUnit(state.value.y);
9944 style.transform = `translate3d(${x}, ${y}, 0)`;
9945 if (dragging.value || !initialized) {
9946 style.transition = "none";
9947 }
9948 return style;
9949 });
9950 const updateState = () => {
9951 if (!show.value)
9952 return;
9953 const {
9954 width,
9955 height
9956 } = use.useRect(rootRef.value);
9957 const {
9958 offset
9959 } = props2;
9960 state.value = {
9961 x: offset.x > -1 ? offset.x : windowWidth.value - width - props2.gap,
9962 y: offset.y > -1 ? offset.y : windowHeight.value - height - props2.gap,
9963 width,
9964 height
9965 };
9966 };
9967 const touch = useTouch();
9968 let prevX = 0;
9969 let prevY = 0;
9970 const onTouchStart = (e) => {
9971 touch.start(e);
9972 dragging.value = true;
9973 prevX = state.value.x;
9974 prevY = state.value.y;
9975 };
9976 const onTouchMove = (e) => {
9977 e.preventDefault();
9978 touch.move(e);
9979 if (props2.axis === "lock")
9980 return;
9981 if (!touch.isTap.value) {
9982 if (props2.axis === "x" || props2.axis === "xy") {
9983 let nextX = prevX + touch.deltaX.value;
9984 if (nextX < boundary.value.left)
9985 nextX = boundary.value.left;
9986 if (nextX > boundary.value.right)
9987 nextX = boundary.value.right;
9988 state.value.x = nextX;
9989 }
9990 if (props2.axis === "y" || props2.axis === "xy") {
9991 let nextY = prevY + touch.deltaY.value;
9992 if (nextY < boundary.value.top)
9993 nextY = boundary.value.top;
9994 if (nextY > boundary.value.bottom)
9995 nextY = boundary.value.bottom;
9996 state.value.y = nextY;
9997 }
9998 const offset = pick(state.value, ["x", "y"]);
9999 emit("update:offset", offset);
10000 }
10001 };
10002 use.useEventListener("touchmove", onTouchMove, {
10003 target: rootRef
10004 });
10005 const onTouchEnd = () => {
10006 dragging.value = false;
10007 vue.nextTick(() => {
10008 if (props2.magnetic === "x") {
10009 const nextX = closest([boundary.value.left, boundary.value.right], state.value.x);
10010 state.value.x = nextX;
10011 }
10012 if (props2.magnetic === "y") {
10013 const nextY = closest([boundary.value.top, boundary.value.bottom], state.value.y);
10014 state.value.y = nextY;
10015 }
10016 if (!touch.isTap.value) {
10017 const offset = pick(state.value, ["x", "y"]);
10018 emit("update:offset", offset);
10019 if (prevX !== offset.x || prevY !== offset.y) {
10020 emit("offsetChange", offset);
10021 }
10022 }
10023 });
10024 };
10025 const onClick = (e) => {
10026 if (touch.isTap.value)
10027 emit("click", e);
10028 else
10029 e.stopPropagation();
10030 };
10031 vue.onMounted(() => {
10032 updateState();
10033 vue.nextTick(() => {
10034 initialized = true;
10035 });
10036 });
10037 vue.watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState);
10038 const show = vue.ref(true);
10039 vue.onActivated(() => {
10040 show.value = true;
10041 });
10042 vue.onDeactivated(() => {
10043 if (props2.teleport) {
10044 show.value = false;
10045 }
10046 });
10047 return () => {
10048 const Content = vue.withDirectives(vue.createVNode("div", vue.mergeProps({
10049 "class": bem$J(),
10050 "ref": rootRef,
10051 "onTouchstartPassive": onTouchStart,
10052 "onTouchend": onTouchEnd,
10053 "onTouchcancel": onTouchEnd,
10054 "onClickCapture": onClick,
10055 "style": rootStyle.value
10056 }, attrs), [slots.default ? slots.default() : vue.createVNode(stdin_default$1Q, {
10057 "name": props2.icon,
10058 "class": bem$J("icon")
10059 }, null)]), [[vue.vShow, show.value]]);
10060 return props2.teleport ? vue.createVNode(vue.Teleport, {
10061 "to": props2.teleport
10062 }, {
10063 default: () => [Content]
10064 }) : Content;
10065 };
10066 }
10067});
10068const FloatingBubble = withInstall(stdin_default$S);
10069const floatingPanelProps = {
10070 height: makeNumericProp(0),
10071 anchors: makeArrayProp(),
10072 duration: makeNumericProp(0.3),
10073 contentDraggable: truthProp,
10074 lockScroll: Boolean,
10075 safeAreaInsetBottom: truthProp
10076};
10077const [name$I, bem$I] = createNamespace("floating-panel");
10078var stdin_default$R = vue.defineComponent({
10079 name: name$I,
10080 props: floatingPanelProps,
10081 emits: ["heightChange", "update:height"],
10082 setup(props2, {
10083 emit,
10084 slots
10085 }) {
10086 const DAMP = 0.2;
10087 const rootRef = vue.ref();
10088 const contentRef = vue.ref();
10089 const height = useSyncPropRef(() => +props2.height, (value) => emit("update:height", value));
10090 const boundary = vue.computed(() => {
10091 var _a, _b;
10092 return {
10093 min: (_a = props2.anchors[0]) != null ? _a : 100,
10094 max: (_b = props2.anchors[props2.anchors.length - 1]) != null ? _b : Math.round(windowHeight.value * 0.6)
10095 };
10096 });
10097 const anchors = vue.computed(() => props2.anchors.length >= 2 ? props2.anchors : [boundary.value.min, boundary.value.max]);
10098 const dragging = vue.ref(false);
10099 const rootStyle = vue.computed(() => ({
10100 height: addUnit(boundary.value.max),
10101 transform: `translateY(calc(100% + ${addUnit(-height.value)}))`,
10102 transition: !dragging.value ? `transform ${props2.duration}s cubic-bezier(0.18, 0.89, 0.32, 1.28)` : "none"
10103 }));
10104 const ease = (moveY) => {
10105 const absDistance = Math.abs(moveY);
10106 const {
10107 min,
10108 max
10109 } = boundary.value;
10110 if (absDistance > max) {
10111 return -(max + (absDistance - max) * DAMP);
10112 }
10113 if (absDistance < min) {
10114 return -(min - (min - absDistance) * DAMP);
10115 }
10116 return moveY;
10117 };
10118 let startY;
10119 let maxScroll = -1;
10120 const touch = useTouch();
10121 const onTouchstart = (e) => {
10122 touch.start(e);
10123 dragging.value = true;
10124 startY = -height.value;
10125 maxScroll = -1;
10126 };
10127 const onTouchmove = (e) => {
10128 var _a;
10129 touch.move(e);
10130 const target = e.target;
10131 if (contentRef.value === target || ((_a = contentRef.value) == null ? void 0 : _a.contains(target))) {
10132 const {
10133 scrollTop
10134 } = contentRef.value;
10135 maxScroll = Math.max(maxScroll, scrollTop);
10136 if (!props2.contentDraggable)
10137 return;
10138 if (-startY < boundary.value.max) {
10139 preventDefault(e, true);
10140 } else if (!(scrollTop <= 0 && touch.deltaY.value > 0) || maxScroll > 0) {
10141 return;
10142 }
10143 }
10144 const moveY = touch.deltaY.value + startY;
10145 height.value = -ease(moveY);
10146 };
10147 const onTouchend = () => {
10148 maxScroll = -1;
10149 dragging.value = false;
10150 height.value = closest(anchors.value, height.value);
10151 if (height.value !== -startY) {
10152 emit("heightChange", {
10153 height: height.value
10154 });
10155 }
10156 };
10157 vue.watch(boundary, () => {
10158 height.value = closest(anchors.value, height.value);
10159 }, {
10160 immediate: true
10161 });
10162 useLockScroll(rootRef, () => props2.lockScroll || dragging.value);
10163 use.useEventListener("touchmove", onTouchmove, {
10164 target: rootRef
10165 });
10166 return () => {
10167 var _a;
10168 return vue.createVNode("div", {
10169 "class": [bem$I(), {
10170 "van-safe-area-bottom": props2.safeAreaInsetBottom
10171 }],
10172 "ref": rootRef,
10173 "style": rootStyle.value,
10174 "onTouchstartPassive": onTouchstart,
10175 "onTouchend": onTouchend,
10176 "onTouchcancel": onTouchend
10177 }, [vue.createVNode("div", {
10178 "class": bem$I("header")
10179 }, [vue.createVNode("div", {
10180 "class": bem$I("header-bar")
10181 }, null)]), vue.createVNode("div", {
10182 "class": bem$I("content"),
10183 "ref": contentRef
10184 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
10185 };
10186 }
10187});
10188const FloatingPanel = withInstall(stdin_default$R);
10189const [name$H, bem$H] = createNamespace("grid");
10190const gridProps = {
10191 square: Boolean,
10192 center: truthProp,
10193 border: truthProp,
10194 gutter: numericProp,
10195 reverse: Boolean,
10196 iconSize: numericProp,
10197 direction: String,
10198 clickable: Boolean,
10199 columnNum: makeNumericProp(4)
10200};
10201const GRID_KEY = Symbol(name$H);
10202var stdin_default$Q = vue.defineComponent({
10203 name: name$H,
10204 props: gridProps,
10205 setup(props2, {
10206 slots
10207 }) {
10208 const {
10209 linkChildren
10210 } = use.useChildren(GRID_KEY);
10211 linkChildren({
10212 props: props2
10213 });
10214 return () => {
10215 var _a;
10216 return vue.createVNode("div", {
10217 "style": {
10218 paddingLeft: addUnit(props2.gutter)
10219 },
10220 "class": [bem$H(), {
10221 [BORDER_TOP]: props2.border && !props2.gutter
10222 }]
10223 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
10224 };
10225 }
10226});
10227const Grid = withInstall(stdin_default$Q);
10228const [name$G, bem$G] = createNamespace("grid-item");
10229const gridItemProps = extend({}, routeProps, {
10230 dot: Boolean,
10231 text: String,
10232 icon: String,
10233 badge: numericProp,
10234 iconColor: String,
10235 iconPrefix: String,
10236 badgeProps: Object
10237});
10238var stdin_default$P = vue.defineComponent({
10239 name: name$G,
10240 props: gridItemProps,
10241 setup(props2, {
10242 slots
10243 }) {
10244 const {
10245 parent,
10246 index
10247 } = use.useParent(GRID_KEY);
10248 const route2 = useRoute();
10249 if (!parent) {
10250 if (process.env.NODE_ENV !== "production") {
10251 console.error("[Vant] <GridItem> must be a child component of <Grid>.");
10252 }
10253 return;
10254 }
10255 const rootStyle = vue.computed(() => {
10256 const {
10257 square,
10258 gutter,
10259 columnNum
10260 } = parent.props;
10261 const percent = `${100 / +columnNum}%`;
10262 const style = {
10263 flexBasis: percent
10264 };
10265 if (square) {
10266 style.paddingTop = percent;
10267 } else if (gutter) {
10268 const gutterValue = addUnit(gutter);
10269 style.paddingRight = gutterValue;
10270 if (index.value >= +columnNum) {
10271 style.marginTop = gutterValue;
10272 }
10273 }
10274 return style;
10275 });
10276 const contentStyle = vue.computed(() => {
10277 const {
10278 square,
10279 gutter
10280 } = parent.props;
10281 if (square && gutter) {
10282 const gutterValue = addUnit(gutter);
10283 return {
10284 right: gutterValue,
10285 bottom: gutterValue,
10286 height: "auto"
10287 };
10288 }
10289 });
10290 const renderIcon = () => {
10291 if (slots.icon) {
10292 return vue.createVNode(Badge, vue.mergeProps({
10293 "dot": props2.dot,
10294 "content": props2.badge
10295 }, props2.badgeProps), {
10296 default: slots.icon
10297 });
10298 }
10299 if (props2.icon) {
10300 return vue.createVNode(Icon, {
10301 "dot": props2.dot,
10302 "name": props2.icon,
10303 "size": parent.props.iconSize,
10304 "badge": props2.badge,
10305 "class": bem$G("icon"),
10306 "color": props2.iconColor,
10307 "badgeProps": props2.badgeProps,
10308 "classPrefix": props2.iconPrefix
10309 }, null);
10310 }
10311 };
10312 const renderText = () => {
10313 if (slots.text) {
10314 return slots.text();
10315 }
10316 if (props2.text) {
10317 return vue.createVNode("span", {
10318 "class": bem$G("text")
10319 }, [props2.text]);
10320 }
10321 };
10322 const renderContent = () => {
10323 if (slots.default) {
10324 return slots.default();
10325 }
10326 return [renderIcon(), renderText()];
10327 };
10328 return () => {
10329 const {
10330 center,
10331 border,
10332 square,
10333 gutter,
10334 reverse,
10335 direction,
10336 clickable
10337 } = parent.props;
10338 const classes = [bem$G("content", [direction, {
10339 center,
10340 square,
10341 reverse,
10342 clickable,
10343 surround: border && gutter
10344 }]), {
10345 [BORDER]: border
10346 }];
10347 return vue.createVNode("div", {
10348 "class": [bem$G({
10349 square
10350 })],
10351 "style": rootStyle.value
10352 }, [vue.createVNode("div", {
10353 "role": clickable ? "button" : void 0,
10354 "class": classes,
10355 "style": contentStyle.value,
10356 "tabindex": clickable ? 0 : void 0,
10357 "onClick": route2
10358 }, [renderContent()])]);
10359 };
10360 }
10361});
10362const GridItem = withInstall(stdin_default$P);
10363const [name$F, bem$F] = createNamespace("highlight");
10364const highlightProps = {
10365 autoEscape: truthProp,
10366 caseSensitive: Boolean,
10367 highlightClass: String,
10368 highlightTag: makeStringProp("span"),
10369 keywords: makeRequiredProp([String, Array]),
10370 sourceString: makeStringProp(""),
10371 tag: makeStringProp("div"),
10372 unhighlightClass: String,
10373 unhighlightTag: makeStringProp("span")
10374};
10375var stdin_default$O = vue.defineComponent({
10376 name: name$F,
10377 props: highlightProps,
10378 setup(props2) {
10379 const highlightChunks = vue.computed(() => {
10380 const {
10381 autoEscape,
10382 caseSensitive,
10383 keywords,
10384 sourceString
10385 } = props2;
10386 const flags = caseSensitive ? "g" : "gi";
10387 const _keywords = Array.isArray(keywords) ? keywords : [keywords];
10388 let chunks = _keywords.filter((keyword) => keyword).reduce((chunks2, keyword) => {
10389 if (autoEscape) {
10390 keyword = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
10391 }
10392 const regex = new RegExp(keyword, flags);
10393 let match;
10394 while (match = regex.exec(sourceString)) {
10395 const start = match.index;
10396 const end = regex.lastIndex;
10397 if (start >= end) {
10398 regex.lastIndex++;
10399 continue;
10400 }
10401 chunks2.push({
10402 start,
10403 end,
10404 highlight: true
10405 });
10406 }
10407 return chunks2;
10408 }, []);
10409 chunks = chunks.sort((a, b) => a.start - b.start).reduce((chunks2, currentChunk) => {
10410 const prevChunk = chunks2[chunks2.length - 1];
10411 if (!prevChunk || currentChunk.start > prevChunk.end) {
10412 const unhighlightStart = prevChunk ? prevChunk.end : 0;
10413 const unhighlightEnd = currentChunk.start;
10414 if (unhighlightStart !== unhighlightEnd) {
10415 chunks2.push({
10416 start: unhighlightStart,
10417 end: unhighlightEnd,
10418 highlight: false
10419 });
10420 }
10421 chunks2.push(currentChunk);
10422 } else {
10423 prevChunk.end = Math.max(prevChunk.end, currentChunk.end);
10424 }
10425 return chunks2;
10426 }, []);
10427 const lastChunk = chunks[chunks.length - 1];
10428 if (lastChunk && lastChunk.end < sourceString.length) {
10429 chunks.push({
10430 start: lastChunk.end,
10431 end: sourceString.length,
10432 highlight: false
10433 });
10434 }
10435 return chunks;
10436 });
10437 const renderContent = () => {
10438 const {
10439 sourceString,
10440 highlightClass,
10441 unhighlightClass,
10442 highlightTag,
10443 unhighlightTag
10444 } = props2;
10445 return highlightChunks.value.map((chunk) => {
10446 const {
10447 start,
10448 end,
10449 highlight
10450 } = chunk;
10451 const text = sourceString.slice(start, end);
10452 if (highlight) {
10453 return vue.createVNode(highlightTag, {
10454 "class": [bem$F("tag"), highlightClass]
10455 }, {
10456 default: () => [text]
10457 });
10458 }
10459 return vue.createVNode(unhighlightTag, {
10460 "class": unhighlightClass
10461 }, {
10462 default: () => [text]
10463 });
10464 });
10465 };
10466 return () => {
10467 const {
10468 tag
10469 } = props2;
10470 return vue.createVNode(tag, {
10471 "class": bem$F()
10472 }, {
10473 default: () => [renderContent()]
10474 });
10475 };
10476 }
10477});
10478const Highlight = withInstall(stdin_default$O);
10479const getDistance = (touches) => Math.sqrt((touches[0].clientX - touches[1].clientX) ** 2 + (touches[0].clientY - touches[1].clientY) ** 2);
10480const getCenter = (touches) => ({
10481 x: (touches[0].clientX + touches[1].clientX) / 2,
10482 y: (touches[0].clientY + touches[1].clientY) / 2
10483});
10484const bem$E = createNamespace("image-preview")[1];
10485const longImageRatio = 2.6;
10486const imagePreviewItemProps = {
10487 src: String,
10488 show: Boolean,
10489 active: Number,
10490 minZoom: makeRequiredProp(numericProp),
10491 maxZoom: makeRequiredProp(numericProp),
10492 rootWidth: makeRequiredProp(Number),
10493 rootHeight: makeRequiredProp(Number),
10494 disableZoom: Boolean,
10495 doubleScale: Boolean,
10496 closeOnClickImage: Boolean,
10497 closeOnClickOverlay: Boolean,
10498 vertical: Boolean
10499};
10500var stdin_default$N = vue.defineComponent({
10501 props: imagePreviewItemProps,
10502 emits: ["scale", "close", "longPress"],
10503 setup(props2, {
10504 emit,
10505 slots
10506 }) {
10507 const state = vue.reactive({
10508 scale: 1,
10509 moveX: 0,
10510 moveY: 0,
10511 moving: false,
10512 zooming: false,
10513 initializing: false,
10514 imageRatio: 0
10515 });
10516 const touch = useTouch();
10517 const imageRef = vue.ref();
10518 const swipeItem = vue.ref();
10519 const vertical = vue.ref(false);
10520 const isLongImage = vue.ref(false);
10521 let initialMoveY = 0;
10522 const imageStyle = vue.computed(() => {
10523 const {
10524 scale,
10525 moveX,
10526 moveY,
10527 moving,
10528 zooming,
10529 initializing
10530 } = state;
10531 const style = {
10532 transitionDuration: zooming || moving || initializing ? "0s" : ".3s"
10533 };
10534 if (scale !== 1 || isLongImage.value) {
10535 style.transform = `matrix(${scale}, 0, 0, ${scale}, ${moveX}, ${moveY})`;
10536 }
10537 return style;
10538 });
10539 const maxMoveX = vue.computed(() => {
10540 if (state.imageRatio) {
10541 const {
10542 rootWidth,
10543 rootHeight
10544 } = props2;
10545 const displayWidth = vertical.value ? rootHeight / state.imageRatio : rootWidth;
10546 return Math.max(0, (state.scale * displayWidth - rootWidth) / 2);
10547 }
10548 return 0;
10549 });
10550 const maxMoveY = vue.computed(() => {
10551 if (state.imageRatio) {
10552 const {
10553 rootWidth,
10554 rootHeight
10555 } = props2;
10556 const displayHeight = vertical.value ? rootHeight : rootWidth * state.imageRatio;
10557 return Math.max(0, (state.scale * displayHeight - rootHeight) / 2);
10558 }
10559 return 0;
10560 });
10561 const setScale = (scale, center) => {
10562 var _a;
10563 scale = clamp(scale, +props2.minZoom, +props2.maxZoom + 1);
10564 if (scale !== state.scale) {
10565 const ratio = scale / state.scale;
10566 state.scale = scale;
10567 if (center) {
10568 const imageRect = use.useRect((_a = imageRef.value) == null ? void 0 : _a.$el);
10569 const origin = {
10570 x: imageRect.width * 0.5,
10571 y: imageRect.height * 0.5
10572 };
10573 const moveX = state.moveX - (center.x - imageRect.left - origin.x) * (ratio - 1);
10574 const moveY = state.moveY - (center.y - imageRect.top - origin.y) * (ratio - 1);
10575 state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
10576 state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
10577 } else {
10578 state.moveX = 0;
10579 state.moveY = isLongImage.value ? initialMoveY : 0;
10580 }
10581 emit("scale", {
10582 scale,
10583 index: props2.active
10584 });
10585 }
10586 };
10587 const resetScale = () => {
10588 setScale(1);
10589 };
10590 const toggleScale = () => {
10591 const scale = state.scale > 1 ? 1 : 2;
10592 setScale(scale, scale === 2 || isLongImage.value ? {
10593 x: touch.startX.value,
10594 y: touch.startY.value
10595 } : void 0);
10596 };
10597 let fingerNum;
10598 let startMoveX;
10599 let startMoveY;
10600 let startScale;
10601 let startDistance;
10602 let lastCenter;
10603 let doubleTapTimer;
10604 let touchStartTime;
10605 let isImageMoved = false;
10606 const onTouchStart = (event) => {
10607 const {
10608 touches
10609 } = event;
10610 fingerNum = touches.length;
10611 if (fingerNum === 2 && props2.disableZoom) {
10612 return;
10613 }
10614 const {
10615 offsetX
10616 } = touch;
10617 touch.start(event);
10618 startMoveX = state.moveX;
10619 startMoveY = state.moveY;
10620 touchStartTime = Date.now();
10621 isImageMoved = false;
10622 state.moving = fingerNum === 1 && (state.scale !== 1 || isLongImage.value);
10623 state.zooming = fingerNum === 2 && !offsetX.value;
10624 if (state.zooming) {
10625 startScale = state.scale;
10626 startDistance = getDistance(touches);
10627 }
10628 };
10629 const onTouchMove = (event) => {
10630 const {
10631 touches
10632 } = event;
10633 touch.move(event);
10634 if (state.moving) {
10635 const {
10636 deltaX,
10637 deltaY
10638 } = touch;
10639 const moveX = deltaX.value + startMoveX;
10640 const moveY = deltaY.value + startMoveY;
10641 if ((props2.vertical ? touch.isVertical() && Math.abs(moveY) > maxMoveY.value : touch.isHorizontal() && Math.abs(moveX) > maxMoveX.value) && !isImageMoved) {
10642 state.moving = false;
10643 return;
10644 }
10645 isImageMoved = true;
10646 preventDefault(event, true);
10647 state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
10648 state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
10649 }
10650 if (state.zooming) {
10651 preventDefault(event, true);
10652 if (touches.length === 2) {
10653 const distance = getDistance(touches);
10654 const scale = startScale * distance / startDistance;
10655 lastCenter = getCenter(touches);
10656 setScale(scale, lastCenter);
10657 }
10658 }
10659 };
10660 const checkClose = (event) => {
10661 var _a;
10662 const swipeItemEl = (_a = swipeItem.value) == null ? void 0 : _a.$el;
10663 const imageEl = swipeItemEl.firstElementChild;
10664 const isClickOverlay = event.target === swipeItemEl;
10665 const isClickImage = imageEl == null ? void 0 : imageEl.contains(event.target);
10666 if (!props2.closeOnClickImage && isClickImage)
10667 return;
10668 if (!props2.closeOnClickOverlay && isClickOverlay)
10669 return;
10670 emit("close");
10671 };
10672 const checkTap = (event) => {
10673 if (fingerNum > 1) {
10674 return;
10675 }
10676 const deltaTime = Date.now() - touchStartTime;
10677 const TAP_TIME = 250;
10678 if (touch.isTap.value) {
10679 if (deltaTime < TAP_TIME) {
10680 if (props2.doubleScale) {
10681 if (doubleTapTimer) {
10682 clearTimeout(doubleTapTimer);
10683 doubleTapTimer = null;
10684 toggleScale();
10685 } else {
10686 doubleTapTimer = setTimeout(() => {
10687 checkClose(event);
10688 doubleTapTimer = null;
10689 }, TAP_TIME);
10690 }
10691 } else {
10692 checkClose(event);
10693 }
10694 } else if (deltaTime > LONG_PRESS_START_TIME) {
10695 emit("longPress");
10696 }
10697 }
10698 };
10699 const onTouchEnd = (event) => {
10700 let stopPropagation2 = false;
10701 if (state.moving || state.zooming) {
10702 stopPropagation2 = true;
10703 if (state.moving && startMoveX === state.moveX && startMoveY === state.moveY) {
10704 stopPropagation2 = false;
10705 }
10706 if (!event.touches.length) {
10707 if (state.zooming) {
10708 state.moveX = clamp(state.moveX, -maxMoveX.value, maxMoveX.value);
10709 state.moveY = clamp(state.moveY, -maxMoveY.value, maxMoveY.value);
10710 state.zooming = false;
10711 }
10712 state.moving = false;
10713 startMoveX = 0;
10714 startMoveY = 0;
10715 startScale = 1;
10716 if (state.scale < 1) {
10717 resetScale();
10718 }
10719 const maxZoom = +props2.maxZoom;
10720 if (state.scale > maxZoom) {
10721 setScale(maxZoom, lastCenter);
10722 }
10723 }
10724 }
10725 preventDefault(event, stopPropagation2);
10726 checkTap(event);
10727 touch.reset();
10728 };
10729 const resize = () => {
10730 const {
10731 rootWidth,
10732 rootHeight
10733 } = props2;
10734 const rootRatio = rootHeight / rootWidth;
10735 const {
10736 imageRatio
10737 } = state;
10738 vertical.value = state.imageRatio > rootRatio && imageRatio < longImageRatio;
10739 isLongImage.value = state.imageRatio > rootRatio && imageRatio >= longImageRatio;
10740 if (isLongImage.value) {
10741 initialMoveY = (imageRatio * rootWidth - rootHeight) / 2;
10742 state.moveY = initialMoveY;
10743 state.initializing = true;
10744 use.raf(() => {
10745 state.initializing = false;
10746 });
10747 }
10748 resetScale();
10749 };
10750 const onLoad = (event) => {
10751 const {
10752 naturalWidth,
10753 naturalHeight
10754 } = event.target;
10755 state.imageRatio = naturalHeight / naturalWidth;
10756 resize();
10757 };
10758 vue.watch(() => props2.active, resetScale);
10759 vue.watch(() => props2.show, (value) => {
10760 if (!value) {
10761 resetScale();
10762 }
10763 });
10764 vue.watch(() => [props2.rootWidth, props2.rootHeight], resize);
10765 use.useEventListener("touchmove", onTouchMove, {
10766 target: vue.computed(() => {
10767 var _a;
10768 return (_a = swipeItem.value) == null ? void 0 : _a.$el;
10769 })
10770 });
10771 useExpose({
10772 resetScale
10773 });
10774 return () => {
10775 const imageSlots = {
10776 loading: () => vue.createVNode(Loading, {
10777 "type": "spinner"
10778 }, null)
10779 };
10780 return vue.createVNode(SwipeItem, {
10781 "ref": swipeItem,
10782 "class": bem$E("swipe-item"),
10783 "onTouchstartPassive": onTouchStart,
10784 "onTouchend": onTouchEnd,
10785 "onTouchcancel": onTouchEnd
10786 }, {
10787 default: () => [slots.image ? vue.createVNode("div", {
10788 "class": bem$E("image-wrap")
10789 }, [slots.image({
10790 src: props2.src
10791 })]) : vue.createVNode(Image$1, {
10792 "ref": imageRef,
10793 "src": props2.src,
10794 "fit": "contain",
10795 "class": bem$E("image", {
10796 vertical: vertical.value
10797 }),
10798 "style": imageStyle.value,
10799 "onLoad": onLoad
10800 }, imageSlots)]
10801 });
10802 };
10803 }
10804});
10805const [name$E, bem$D] = createNamespace("image-preview");
10806const popupProps$1 = ["show", "teleport", "transition", "overlayStyle", "closeOnPopstate"];
10807const imagePreviewProps = {
10808 show: Boolean,
10809 loop: truthProp,
10810 images: makeArrayProp(),
10811 minZoom: makeNumericProp(1 / 3),
10812 maxZoom: makeNumericProp(3),
10813 overlay: truthProp,
10814 vertical: Boolean,
10815 closeable: Boolean,
10816 showIndex: truthProp,
10817 className: unknownProp,
10818 closeIcon: makeStringProp("clear"),
10819 transition: String,
10820 beforeClose: Function,
10821 doubleScale: truthProp,
10822 overlayClass: unknownProp,
10823 overlayStyle: Object,
10824 swipeDuration: makeNumericProp(300),
10825 startPosition: makeNumericProp(0),
10826 showIndicators: Boolean,
10827 closeOnPopstate: truthProp,
10828 closeOnClickImage: truthProp,
10829 closeOnClickOverlay: truthProp,
10830 closeIconPosition: makeStringProp("top-right"),
10831 teleport: [String, Object]
10832};
10833var stdin_default$M = vue.defineComponent({
10834 name: name$E,
10835 props: imagePreviewProps,
10836 emits: ["scale", "close", "closed", "change", "longPress", "update:show"],
10837 setup(props2, {
10838 emit,
10839 slots
10840 }) {
10841 const swipeRef = vue.ref();
10842 const activedPreviewItemRef = vue.ref();
10843 const state = vue.reactive({
10844 active: 0,
10845 rootWidth: 0,
10846 rootHeight: 0,
10847 disableZoom: false
10848 });
10849 const resize = () => {
10850 if (swipeRef.value) {
10851 const rect = use.useRect(swipeRef.value.$el);
10852 state.rootWidth = rect.width;
10853 state.rootHeight = rect.height;
10854 swipeRef.value.resize();
10855 }
10856 };
10857 const emitScale = (args) => emit("scale", args);
10858 const updateShow = (show) => emit("update:show", show);
10859 const emitClose = () => {
10860 callInterceptor(props2.beforeClose, {
10861 args: [state.active],
10862 done: () => updateShow(false)
10863 });
10864 };
10865 const setActive = (active) => {
10866 if (active !== state.active) {
10867 state.active = active;
10868 emit("change", active);
10869 }
10870 };
10871 const renderIndex = () => {
10872 if (props2.showIndex) {
10873 return vue.createVNode("div", {
10874 "class": bem$D("index")
10875 }, [slots.index ? slots.index({
10876 index: state.active
10877 }) : `${state.active + 1} / ${props2.images.length}`]);
10878 }
10879 };
10880 const renderCover = () => {
10881 if (slots.cover) {
10882 return vue.createVNode("div", {
10883 "class": bem$D("cover")
10884 }, [slots.cover()]);
10885 }
10886 };
10887 const onDragStart = () => {
10888 state.disableZoom = true;
10889 };
10890 const onDragEnd = () => {
10891 state.disableZoom = false;
10892 };
10893 const renderImages = () => vue.createVNode(Swipe, {
10894 "ref": swipeRef,
10895 "lazyRender": true,
10896 "loop": props2.loop,
10897 "class": bem$D("swipe"),
10898 "vertical": props2.vertical,
10899 "duration": props2.swipeDuration,
10900 "initialSwipe": props2.startPosition,
10901 "showIndicators": props2.showIndicators,
10902 "indicatorColor": "white",
10903 "onChange": setActive,
10904 "onDragEnd": onDragEnd,
10905 "onDragStart": onDragStart
10906 }, {
10907 default: () => [props2.images.map((image, index) => vue.createVNode(stdin_default$N, {
10908 "ref": (item) => {
10909 if (index === state.active) {
10910 activedPreviewItemRef.value = item;
10911 }
10912 },
10913 "src": image,
10914 "show": props2.show,
10915 "active": state.active,
10916 "maxZoom": props2.maxZoom,
10917 "minZoom": props2.minZoom,
10918 "rootWidth": state.rootWidth,
10919 "rootHeight": state.rootHeight,
10920 "disableZoom": state.disableZoom,
10921 "doubleScale": props2.doubleScale,
10922 "closeOnClickImage": props2.closeOnClickImage,
10923 "closeOnClickOverlay": props2.closeOnClickOverlay,
10924 "vertical": props2.vertical,
10925 "onScale": emitScale,
10926 "onClose": emitClose,
10927 "onLongPress": () => emit("longPress", {
10928 index
10929 })
10930 }, {
10931 image: slots.image
10932 }))]
10933 });
10934 const renderClose = () => {
10935 if (props2.closeable) {
10936 return vue.createVNode(Icon, {
10937 "role": "button",
10938 "name": props2.closeIcon,
10939 "class": [bem$D("close-icon", props2.closeIconPosition), HAPTICS_FEEDBACK],
10940 "onClick": emitClose
10941 }, null);
10942 }
10943 };
10944 const onClosed = () => emit("closed");
10945 const swipeTo = (index, options) => {
10946 var _a;
10947 return (_a = swipeRef.value) == null ? void 0 : _a.swipeTo(index, options);
10948 };
10949 useExpose({
10950 resetScale: () => {
10951 var _a;
10952 (_a = activedPreviewItemRef.value) == null ? void 0 : _a.resetScale();
10953 },
10954 swipeTo
10955 });
10956 vue.onMounted(resize);
10957 vue.watch([windowWidth, windowHeight], resize);
10958 vue.watch(() => props2.startPosition, (value) => setActive(+value));
10959 vue.watch(() => props2.show, (value) => {
10960 const {
10961 images,
10962 startPosition
10963 } = props2;
10964 if (value) {
10965 setActive(+startPosition);
10966 vue.nextTick(() => {
10967 resize();
10968 swipeTo(+startPosition, {
10969 immediate: true
10970 });
10971 });
10972 } else {
10973 emit("close", {
10974 index: state.active,
10975 url: images[state.active]
10976 });
10977 }
10978 });
10979 return () => vue.createVNode(Popup, vue.mergeProps({
10980 "class": [bem$D(), props2.className],
10981 "overlayClass": [bem$D("overlay"), props2.overlayClass],
10982 "onClosed": onClosed,
10983 "onUpdate:show": updateShow
10984 }, pick(props2, popupProps$1)), {
10985 default: () => [renderClose(), renderImages(), renderIndex(), renderCover()]
10986 });
10987 }
10988});
10989let instance$1;
10990const defaultConfig = {
10991 loop: true,
10992 images: [],
10993 maxZoom: 3,
10994 minZoom: 1 / 3,
10995 onScale: void 0,
10996 onClose: void 0,
10997 onChange: void 0,
10998 vertical: false,
10999 teleport: "body",
11000 className: "",
11001 showIndex: true,
11002 closeable: false,
11003 closeIcon: "clear",
11004 transition: void 0,
11005 beforeClose: void 0,
11006 doubleScale: true,
11007 overlayStyle: void 0,
11008 overlayClass: void 0,
11009 startPosition: 0,
11010 swipeDuration: 300,
11011 showIndicators: false,
11012 closeOnPopstate: true,
11013 closeOnClickOverlay: true,
11014 closeIconPosition: "top-right"
11015};
11016function initInstance$1() {
11017 ({
11018 instance: instance$1
11019 } = mountComponent({
11020 setup() {
11021 const {
11022 state,
11023 toggle
11024 } = usePopupState();
11025 const onClosed = () => {
11026 state.images = [];
11027 };
11028 return () => vue.createVNode(stdin_default$M, vue.mergeProps(state, {
11029 "onClosed": onClosed,
11030 "onUpdate:show": toggle
11031 }), null);
11032 }
11033 }));
11034}
11035const showImagePreview = (options, startPosition = 0) => {
11036 if (!inBrowser) {
11037 return;
11038 }
11039 if (!instance$1) {
11040 initInstance$1();
11041 }
11042 options = Array.isArray(options) ? {
11043 images: options,
11044 startPosition
11045 } : options;
11046 instance$1.open(extend({}, defaultConfig, options));
11047 return instance$1;
11048};
11049const ImagePreview = withInstall(stdin_default$M);
11050function genAlphabet() {
11051 const charCodeOfA = "A".charCodeAt(0);
11052 const indexList = Array(26).fill("").map((_, i) => String.fromCharCode(charCodeOfA + i));
11053 return indexList;
11054}
11055const [name$D, bem$C] = createNamespace("index-bar");
11056const indexBarProps = {
11057 sticky: truthProp,
11058 zIndex: numericProp,
11059 teleport: [String, Object],
11060 highlightColor: String,
11061 stickyOffsetTop: makeNumberProp(0),
11062 indexList: {
11063 type: Array,
11064 default: genAlphabet
11065 }
11066};
11067const INDEX_BAR_KEY = Symbol(name$D);
11068var stdin_default$L = vue.defineComponent({
11069 name: name$D,
11070 props: indexBarProps,
11071 emits: ["select", "change"],
11072 setup(props2, {
11073 emit,
11074 slots
11075 }) {
11076 const root = vue.ref();
11077 const sidebar = vue.ref();
11078 const activeAnchor = vue.ref("");
11079 const touch = useTouch();
11080 const scrollParent = use.useScrollParent(root);
11081 const {
11082 children,
11083 linkChildren
11084 } = use.useChildren(INDEX_BAR_KEY);
11085 let selectActiveIndex;
11086 linkChildren({
11087 props: props2
11088 });
11089 const sidebarStyle = vue.computed(() => {
11090 if (isDef(props2.zIndex)) {
11091 return {
11092 zIndex: +props2.zIndex + 1
11093 };
11094 }
11095 });
11096 const highlightStyle = vue.computed(() => {
11097 if (props2.highlightColor) {
11098 return {
11099 color: props2.highlightColor
11100 };
11101 }
11102 });
11103 const getActiveAnchor = (scrollTop, rects) => {
11104 for (let i = children.length - 1; i >= 0; i--) {
11105 const prevHeight = i > 0 ? rects[i - 1].height : 0;
11106 const reachTop = props2.sticky ? prevHeight + props2.stickyOffsetTop : 0;
11107 if (scrollTop + reachTop >= rects[i].top) {
11108 return i;
11109 }
11110 }
11111 return -1;
11112 };
11113 const getMatchAnchor = (index) => children.find((item) => String(item.index) === index);
11114 const onScroll = () => {
11115 if (isHidden(root)) {
11116 return;
11117 }
11118 const {
11119 sticky,
11120 indexList
11121 } = props2;
11122 const scrollTop = getScrollTop(scrollParent.value);
11123 const scrollParentRect = use.useRect(scrollParent);
11124 const rects = children.map((item) => item.getRect(scrollParent.value, scrollParentRect));
11125 let active = -1;
11126 if (selectActiveIndex) {
11127 const match = getMatchAnchor(selectActiveIndex);
11128 if (match) {
11129 const rect = match.getRect(scrollParent.value, scrollParentRect);
11130 active = getActiveAnchor(rect.top, rects);
11131 }
11132 } else {
11133 active = getActiveAnchor(scrollTop, rects);
11134 }
11135 activeAnchor.value = indexList[active];
11136 if (sticky) {
11137 children.forEach((item, index) => {
11138 const {
11139 state,
11140 $el
11141 } = item;
11142 if (index === active || index === active - 1) {
11143 const rect = $el.getBoundingClientRect();
11144 state.left = rect.left;
11145 state.width = rect.width;
11146 } else {
11147 state.left = null;
11148 state.width = null;
11149 }
11150 if (index === active) {
11151 state.active = true;
11152 state.top = Math.max(props2.stickyOffsetTop, rects[index].top - scrollTop) + scrollParentRect.top;
11153 } else if (index === active - 1 && selectActiveIndex === "") {
11154 const activeItemTop = rects[active].top - scrollTop;
11155 state.active = activeItemTop > 0;
11156 state.top = activeItemTop + scrollParentRect.top - rects[index].height;
11157 } else {
11158 state.active = false;
11159 }
11160 });
11161 }
11162 selectActiveIndex = "";
11163 };
11164 const init = () => {
11165 vue.nextTick(onScroll);
11166 };
11167 use.useEventListener("scroll", onScroll, {
11168 target: scrollParent,
11169 passive: true
11170 });
11171 vue.onMounted(init);
11172 vue.watch(() => props2.indexList, init);
11173 vue.watch(activeAnchor, (value) => {
11174 if (value) {
11175 emit("change", value);
11176 }
11177 });
11178 const renderIndexes = () => props2.indexList.map((index) => {
11179 const active = index === activeAnchor.value;
11180 return vue.createVNode("span", {
11181 "class": bem$C("index", {
11182 active
11183 }),
11184 "style": active ? highlightStyle.value : void 0,
11185 "data-index": index
11186 }, [index]);
11187 });
11188 const scrollTo = (index) => {
11189 selectActiveIndex = String(index);
11190 const match = getMatchAnchor(selectActiveIndex);
11191 if (match) {
11192 const scrollTop = getScrollTop(scrollParent.value);
11193 const scrollParentRect = use.useRect(scrollParent);
11194 const {
11195 offsetHeight
11196 } = document.documentElement;
11197 match.$el.scrollIntoView();
11198 if (scrollTop === offsetHeight - scrollParentRect.height) {
11199 onScroll();
11200 return;
11201 }
11202 if (props2.sticky && props2.stickyOffsetTop) {
11203 setRootScrollTop(getRootScrollTop() - props2.stickyOffsetTop);
11204 }
11205 emit("select", match.index);
11206 }
11207 };
11208 const scrollToElement = (element) => {
11209 const {
11210 index
11211 } = element.dataset;
11212 if (index) {
11213 scrollTo(index);
11214 }
11215 };
11216 const onClickSidebar = (event) => {
11217 scrollToElement(event.target);
11218 };
11219 let touchActiveIndex;
11220 const onTouchMove = (event) => {
11221 touch.move(event);
11222 if (touch.isVertical()) {
11223 preventDefault(event);
11224 const {
11225 clientX,
11226 clientY
11227 } = event.touches[0];
11228 const target = document.elementFromPoint(clientX, clientY);
11229 if (target) {
11230 const {
11231 index
11232 } = target.dataset;
11233 if (index && touchActiveIndex !== index) {
11234 touchActiveIndex = index;
11235 scrollToElement(target);
11236 }
11237 }
11238 }
11239 };
11240 const renderSidebar = () => vue.createVNode("div", {
11241 "ref": sidebar,
11242 "class": bem$C("sidebar"),
11243 "style": sidebarStyle.value,
11244 "onClick": onClickSidebar,
11245 "onTouchstartPassive": touch.start
11246 }, [renderIndexes()]);
11247 useExpose({
11248 scrollTo
11249 });
11250 use.useEventListener("touchmove", onTouchMove, {
11251 target: sidebar
11252 });
11253 return () => {
11254 var _a;
11255 return vue.createVNode("div", {
11256 "ref": root,
11257 "class": bem$C()
11258 }, [props2.teleport ? vue.createVNode(vue.Teleport, {
11259 "to": props2.teleport
11260 }, {
11261 default: () => [renderSidebar()]
11262 }) : renderSidebar(), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
11263 };
11264 }
11265});
11266const [name$C, bem$B] = createNamespace("index-anchor");
11267const indexAnchorProps = {
11268 index: numericProp
11269};
11270var stdin_default$K = vue.defineComponent({
11271 name: name$C,
11272 props: indexAnchorProps,
11273 setup(props2, {
11274 slots
11275 }) {
11276 const state = vue.reactive({
11277 top: 0,
11278 left: null,
11279 rect: {
11280 top: 0,
11281 height: 0
11282 },
11283 width: null,
11284 active: false
11285 });
11286 const root = vue.ref();
11287 const {
11288 parent
11289 } = use.useParent(INDEX_BAR_KEY);
11290 if (!parent) {
11291 if (process.env.NODE_ENV !== "production") {
11292 console.error("[Vant] <IndexAnchor> must be a child component of <IndexBar>.");
11293 }
11294 return;
11295 }
11296 const isSticky = () => state.active && parent.props.sticky;
11297 const anchorStyle = vue.computed(() => {
11298 const {
11299 zIndex,
11300 highlightColor
11301 } = parent.props;
11302 if (isSticky()) {
11303 return extend(getZIndexStyle(zIndex), {
11304 left: state.left ? `${state.left}px` : void 0,
11305 width: state.width ? `${state.width}px` : void 0,
11306 transform: state.top ? `translate3d(0, ${state.top}px, 0)` : void 0,
11307 color: highlightColor
11308 });
11309 }
11310 });
11311 const getRect = (scrollParent, scrollParentRect) => {
11312 const rootRect = use.useRect(root);
11313 state.rect.height = rootRect.height;
11314 if (scrollParent === window || scrollParent === document.body) {
11315 state.rect.top = rootRect.top + getRootScrollTop();
11316 } else {
11317 state.rect.top = rootRect.top + getScrollTop(scrollParent) - scrollParentRect.top;
11318 }
11319 return state.rect;
11320 };
11321 useExpose({
11322 state,
11323 getRect
11324 });
11325 return () => {
11326 const sticky = isSticky();
11327 return vue.createVNode("div", {
11328 "ref": root,
11329 "style": {
11330 height: sticky ? `${state.rect.height}px` : void 0
11331 }
11332 }, [vue.createVNode("div", {
11333 "style": anchorStyle.value,
11334 "class": [bem$B({
11335 sticky
11336 }), {
11337 [BORDER_BOTTOM]: sticky
11338 }]
11339 }, [slots.default ? slots.default() : props2.index])]);
11340 };
11341 }
11342});
11343const IndexAnchor = withInstall(stdin_default$K);
11344const IndexBar = withInstall(stdin_default$L);
11345const [name$B, bem$A, t$7] = createNamespace("list");
11346const listProps = {
11347 error: Boolean,
11348 offset: makeNumericProp(300),
11349 loading: Boolean,
11350 disabled: Boolean,
11351 finished: Boolean,
11352 scroller: Object,
11353 errorText: String,
11354 direction: makeStringProp("down"),
11355 loadingText: String,
11356 finishedText: String,
11357 immediateCheck: truthProp
11358};
11359var stdin_default$J = vue.defineComponent({
11360 name: name$B,
11361 props: listProps,
11362 emits: ["load", "update:error", "update:loading"],
11363 setup(props2, {
11364 emit,
11365 slots
11366 }) {
11367 const loading = vue.ref(props2.loading);
11368 const root = vue.ref();
11369 const placeholder = vue.ref();
11370 const tabStatus = useTabStatus();
11371 const scrollParent = use.useScrollParent(root);
11372 const scroller = vue.computed(() => props2.scroller || scrollParent.value);
11373 const check = () => {
11374 vue.nextTick(() => {
11375 if (loading.value || props2.finished || props2.disabled || props2.error || // skip check when inside an inactive tab
11376 (tabStatus == null ? void 0 : tabStatus.value) === false) {
11377 return;
11378 }
11379 const {
11380 direction
11381 } = props2;
11382 const offset = +props2.offset;
11383 const scrollParentRect = use.useRect(scroller);
11384 if (!scrollParentRect.height || isHidden(root)) {
11385 return;
11386 }
11387 let isReachEdge = false;
11388 const placeholderRect = use.useRect(placeholder);
11389 if (direction === "up") {
11390 isReachEdge = scrollParentRect.top - placeholderRect.top <= offset;
11391 } else {
11392 isReachEdge = placeholderRect.bottom - scrollParentRect.bottom <= offset;
11393 }
11394 if (isReachEdge) {
11395 loading.value = true;
11396 emit("update:loading", true);
11397 emit("load");
11398 }
11399 });
11400 };
11401 const renderFinishedText = () => {
11402 if (props2.finished) {
11403 const text = slots.finished ? slots.finished() : props2.finishedText;
11404 if (text) {
11405 return vue.createVNode("div", {
11406 "class": bem$A("finished-text")
11407 }, [text]);
11408 }
11409 }
11410 };
11411 const clickErrorText = () => {
11412 emit("update:error", false);
11413 check();
11414 };
11415 const renderErrorText = () => {
11416 if (props2.error) {
11417 const text = slots.error ? slots.error() : props2.errorText;
11418 if (text) {
11419 return vue.createVNode("div", {
11420 "role": "button",
11421 "class": bem$A("error-text"),
11422 "tabindex": 0,
11423 "onClick": clickErrorText
11424 }, [text]);
11425 }
11426 }
11427 };
11428 const renderLoading = () => {
11429 if (loading.value && !props2.finished && !props2.disabled) {
11430 return vue.createVNode("div", {
11431 "class": bem$A("loading")
11432 }, [slots.loading ? slots.loading() : vue.createVNode(Loading, {
11433 "class": bem$A("loading-icon")
11434 }, {
11435 default: () => [props2.loadingText || t$7("loading")]
11436 })]);
11437 }
11438 };
11439 vue.watch(() => [props2.loading, props2.finished, props2.error], check);
11440 if (tabStatus) {
11441 vue.watch(tabStatus, (tabActive) => {
11442 if (tabActive) {
11443 check();
11444 }
11445 });
11446 }
11447 vue.onUpdated(() => {
11448 loading.value = props2.loading;
11449 });
11450 vue.onMounted(() => {
11451 if (props2.immediateCheck) {
11452 check();
11453 }
11454 });
11455 useExpose({
11456 check
11457 });
11458 use.useEventListener("scroll", check, {
11459 target: scroller,
11460 passive: true
11461 });
11462 return () => {
11463 var _a;
11464 const Content = (_a = slots.default) == null ? void 0 : _a.call(slots);
11465 const Placeholder = vue.createVNode("div", {
11466 "ref": placeholder,
11467 "class": bem$A("placeholder")
11468 }, null);
11469 return vue.createVNode("div", {
11470 "ref": root,
11471 "role": "feed",
11472 "class": bem$A(),
11473 "aria-busy": loading.value
11474 }, [props2.direction === "down" ? Content : Placeholder, renderLoading(), renderFinishedText(), renderErrorText(), props2.direction === "up" ? Content : Placeholder]);
11475 };
11476 }
11477});
11478const List = withInstall(stdin_default$J);
11479const [name$A, bem$z] = createNamespace("nav-bar");
11480const navBarProps = {
11481 title: String,
11482 fixed: Boolean,
11483 zIndex: numericProp,
11484 border: truthProp,
11485 leftText: String,
11486 rightText: String,
11487 leftDisabled: Boolean,
11488 rightDisabled: Boolean,
11489 leftArrow: Boolean,
11490 placeholder: Boolean,
11491 safeAreaInsetTop: Boolean,
11492 clickable: truthProp
11493};
11494var stdin_default$I = vue.defineComponent({
11495 name: name$A,
11496 props: navBarProps,
11497 emits: ["clickLeft", "clickRight"],
11498 setup(props2, {
11499 emit,
11500 slots
11501 }) {
11502 const navBarRef = vue.ref();
11503 const renderPlaceholder = usePlaceholder(navBarRef, bem$z);
11504 const onClickLeft = (event) => {
11505 if (!props2.leftDisabled) {
11506 emit("clickLeft", event);
11507 }
11508 };
11509 const onClickRight = (event) => {
11510 if (!props2.rightDisabled) {
11511 emit("clickRight", event);
11512 }
11513 };
11514 const renderLeft = () => {
11515 if (slots.left) {
11516 return slots.left();
11517 }
11518 return [props2.leftArrow && vue.createVNode(Icon, {
11519 "class": bem$z("arrow"),
11520 "name": "arrow-left"
11521 }, null), props2.leftText && vue.createVNode("span", {
11522 "class": bem$z("text")
11523 }, [props2.leftText])];
11524 };
11525 const renderRight = () => {
11526 if (slots.right) {
11527 return slots.right();
11528 }
11529 return vue.createVNode("span", {
11530 "class": bem$z("text")
11531 }, [props2.rightText]);
11532 };
11533 const renderNavBar = () => {
11534 const {
11535 title,
11536 fixed,
11537 border,
11538 zIndex
11539 } = props2;
11540 const style = getZIndexStyle(zIndex);
11541 const hasLeft = props2.leftArrow || props2.leftText || slots.left;
11542 const hasRight = props2.rightText || slots.right;
11543 return vue.createVNode("div", {
11544 "ref": navBarRef,
11545 "style": style,
11546 "class": [bem$z({
11547 fixed
11548 }), {
11549 [BORDER_BOTTOM]: border,
11550 "van-safe-area-top": props2.safeAreaInsetTop
11551 }]
11552 }, [vue.createVNode("div", {
11553 "class": bem$z("content")
11554 }, [hasLeft && vue.createVNode("div", {
11555 "class": [bem$z("left", {
11556 disabled: props2.leftDisabled
11557 }), props2.clickable && !props2.leftDisabled ? HAPTICS_FEEDBACK : ""],
11558 "onClick": onClickLeft
11559 }, [renderLeft()]), vue.createVNode("div", {
11560 "class": [bem$z("title"), "van-ellipsis"]
11561 }, [slots.title ? slots.title() : title]), hasRight && vue.createVNode("div", {
11562 "class": [bem$z("right", {
11563 disabled: props2.rightDisabled
11564 }), props2.clickable && !props2.rightDisabled ? HAPTICS_FEEDBACK : ""],
11565 "onClick": onClickRight
11566 }, [renderRight()])])]);
11567 };
11568 return () => {
11569 if (props2.fixed && props2.placeholder) {
11570 return renderPlaceholder(renderNavBar);
11571 }
11572 return renderNavBar();
11573 };
11574 }
11575});
11576const NavBar = withInstall(stdin_default$I);
11577const [name$z, bem$y] = createNamespace("notice-bar");
11578const noticeBarProps = {
11579 text: String,
11580 mode: String,
11581 color: String,
11582 delay: makeNumericProp(1),
11583 speed: makeNumericProp(60),
11584 leftIcon: String,
11585 wrapable: Boolean,
11586 background: String,
11587 scrollable: {
11588 type: Boolean,
11589 default: null
11590 }
11591};
11592var stdin_default$H = vue.defineComponent({
11593 name: name$z,
11594 props: noticeBarProps,
11595 emits: ["close", "replay"],
11596 setup(props2, {
11597 emit,
11598 slots
11599 }) {
11600 let wrapWidth = 0;
11601 let contentWidth = 0;
11602 let startTimer;
11603 const wrapRef = vue.ref();
11604 const contentRef = vue.ref();
11605 const state = vue.reactive({
11606 show: true,
11607 offset: 0,
11608 duration: 0
11609 });
11610 const renderLeftIcon = () => {
11611 if (slots["left-icon"]) {
11612 return slots["left-icon"]();
11613 }
11614 if (props2.leftIcon) {
11615 return vue.createVNode(Icon, {
11616 "class": bem$y("left-icon"),
11617 "name": props2.leftIcon
11618 }, null);
11619 }
11620 };
11621 const getRightIconName = () => {
11622 if (props2.mode === "closeable") {
11623 return "cross";
11624 }
11625 if (props2.mode === "link") {
11626 return "arrow";
11627 }
11628 };
11629 const onClickRightIcon = (event) => {
11630 if (props2.mode === "closeable") {
11631 state.show = false;
11632 emit("close", event);
11633 }
11634 };
11635 const renderRightIcon = () => {
11636 if (slots["right-icon"]) {
11637 return slots["right-icon"]();
11638 }
11639 const name2 = getRightIconName();
11640 if (name2) {
11641 return vue.createVNode(Icon, {
11642 "name": name2,
11643 "class": bem$y("right-icon"),
11644 "onClick": onClickRightIcon
11645 }, null);
11646 }
11647 };
11648 const onTransitionEnd = () => {
11649 state.offset = wrapWidth;
11650 state.duration = 0;
11651 use.raf(() => {
11652 use.doubleRaf(() => {
11653 state.offset = -contentWidth;
11654 state.duration = (contentWidth + wrapWidth) / +props2.speed;
11655 emit("replay");
11656 });
11657 });
11658 };
11659 const renderMarquee = () => {
11660 const ellipsis = props2.scrollable === false && !props2.wrapable;
11661 const style = {
11662 transform: state.offset ? `translateX(${state.offset}px)` : "",
11663 transitionDuration: `${state.duration}s`
11664 };
11665 return vue.createVNode("div", {
11666 "ref": wrapRef,
11667 "role": "marquee",
11668 "class": bem$y("wrap")
11669 }, [vue.createVNode("div", {
11670 "ref": contentRef,
11671 "style": style,
11672 "class": [bem$y("content"), {
11673 "van-ellipsis": ellipsis
11674 }],
11675 "onTransitionend": onTransitionEnd
11676 }, [slots.default ? slots.default() : props2.text])]);
11677 };
11678 const reset = () => {
11679 const {
11680 delay,
11681 speed,
11682 scrollable
11683 } = props2;
11684 const ms = isDef(delay) ? +delay * 1e3 : 0;
11685 wrapWidth = 0;
11686 contentWidth = 0;
11687 state.offset = 0;
11688 state.duration = 0;
11689 clearTimeout(startTimer);
11690 startTimer = setTimeout(() => {
11691 if (!wrapRef.value || !contentRef.value || scrollable === false) {
11692 return;
11693 }
11694 const wrapRefWidth = use.useRect(wrapRef).width;
11695 const contentRefWidth = use.useRect(contentRef).width;
11696 if (scrollable || contentRefWidth > wrapRefWidth) {
11697 use.doubleRaf(() => {
11698 wrapWidth = wrapRefWidth;
11699 contentWidth = contentRefWidth;
11700 state.offset = -contentWidth;
11701 state.duration = contentWidth / +speed;
11702 });
11703 }
11704 }, ms);
11705 };
11706 onPopupReopen(reset);
11707 use.onMountedOrActivated(reset);
11708 use.useEventListener("pageshow", reset);
11709 useExpose({
11710 reset
11711 });
11712 vue.watch(() => [props2.text, props2.scrollable], reset);
11713 return () => {
11714 const {
11715 color,
11716 wrapable,
11717 background
11718 } = props2;
11719 return vue.withDirectives(vue.createVNode("div", {
11720 "role": "alert",
11721 "class": bem$y({
11722 wrapable
11723 }),
11724 "style": {
11725 color,
11726 background
11727 }
11728 }, [renderLeftIcon(), renderMarquee(), renderRightIcon()]), [[vue.vShow, state.show]]);
11729 };
11730 }
11731});
11732const NoticeBar = withInstall(stdin_default$H);
11733const [name$y, bem$x] = createNamespace("notify");
11734const popupInheritProps = ["lockScroll", "position", "show", "teleport", "zIndex"];
11735const notifyProps = extend({}, popupSharedProps, {
11736 type: makeStringProp("danger"),
11737 color: String,
11738 message: numericProp,
11739 position: makeStringProp("top"),
11740 className: unknownProp,
11741 background: String,
11742 lockScroll: Boolean
11743});
11744var stdin_default$G = vue.defineComponent({
11745 name: name$y,
11746 props: notifyProps,
11747 emits: ["update:show"],
11748 setup(props2, {
11749 emit,
11750 slots
11751 }) {
11752 const updateShow = (show) => emit("update:show", show);
11753 return () => vue.createVNode(Popup, vue.mergeProps({
11754 "class": [bem$x([props2.type]), props2.className],
11755 "style": {
11756 color: props2.color,
11757 background: props2.background
11758 },
11759 "overlay": false,
11760 "duration": 0.2,
11761 "onUpdate:show": updateShow
11762 }, pick(props2, popupInheritProps)), {
11763 default: () => [slots.default ? slots.default() : props2.message]
11764 });
11765 }
11766});
11767let timer;
11768let instance;
11769const parseOptions = (message) => isObject(message) ? message : {
11770 message
11771};
11772function initInstance() {
11773 ({
11774 instance
11775 } = mountComponent({
11776 setup() {
11777 const {
11778 state,
11779 toggle
11780 } = usePopupState();
11781 return () => vue.createVNode(stdin_default$G, vue.mergeProps(state, {
11782 "onUpdate:show": toggle
11783 }), null);
11784 }
11785 }));
11786}
11787const getDefaultOptions = () => ({
11788 type: "danger",
11789 color: void 0,
11790 message: "",
11791 onClose: void 0,
11792 onClick: void 0,
11793 onOpened: void 0,
11794 duration: 3e3,
11795 position: void 0,
11796 className: "",
11797 lockScroll: false,
11798 background: void 0
11799});
11800let currentOptions = getDefaultOptions();
11801const closeNotify = () => {
11802 if (instance) {
11803 instance.toggle(false);
11804 }
11805};
11806function showNotify(options) {
11807 if (!inBrowser) {
11808 return;
11809 }
11810 if (!instance) {
11811 initInstance();
11812 }
11813 options = extend({}, currentOptions, parseOptions(options));
11814 instance.open(options);
11815 clearTimeout(timer);
11816 if (options.duration > 0) {
11817 timer = setTimeout(closeNotify, options.duration);
11818 }
11819 return instance;
11820}
11821const setNotifyDefaultOptions = (options) => extend(currentOptions, options);
11822const resetNotifyDefaultOptions = () => {
11823 currentOptions = getDefaultOptions();
11824};
11825const Notify = withInstall(stdin_default$G);
11826const [name$x, bem$w] = createNamespace("key");
11827const CollapseIcon = vue.createVNode("svg", {
11828 "class": bem$w("collapse-icon"),
11829 "viewBox": "0 0 30 24"
11830}, [vue.createVNode("path", {
11831 "d": "M26 13h-2v2h2v-2zm-8-3h2V8h-2v2zm2-4h2V4h-2v2zm2 4h4V4h-2v4h-2v2zm-7 14 3-3h-6l3 3zM6 13H4v2h2v-2zm16 0H8v2h14v-2zm-12-3h2V8h-2v2zM28 0l1 1 1 1v15l-1 2H1l-1-2V2l1-1 1-1zm0 2H2v15h26V2zM6 4v2H4V4zm10 2h2V4h-2v2zM8 9v1H4V8zm8 0v1h-2V8zm-6-5v2H8V4zm4 0v2h-2V4z",
11832 "fill": "currentColor"
11833}, null)]);
11834const DeleteIcon = vue.createVNode("svg", {
11835 "class": bem$w("delete-icon"),
11836 "viewBox": "0 0 32 22"
11837}, [vue.createVNode("path", {
11838 "d": "M28 0a4 4 0 0 1 4 4v14a4 4 0 0 1-4 4H10.4a2 2 0 0 1-1.4-.6L1 13.1c-.6-.5-.9-1.3-.9-2 0-1 .3-1.7.9-2.2L9 .6a2 2 0 0 1 1.4-.6zm0 2H10.4l-8.2 8.3a1 1 0 0 0-.3.7c0 .3.1.5.3.7l8.2 8.4H28a2 2 0 0 0 2-2V4c0-1.1-.9-2-2-2zm-5 4a1 1 0 0 1 .7.3 1 1 0 0 1 0 1.4L20.4 11l3.3 3.3c.2.2.3.5.3.7 0 .3-.1.5-.3.7a1 1 0 0 1-.7.3 1 1 0 0 1-.7-.3L19 12.4l-3.4 3.3a1 1 0 0 1-.6.3 1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7c0-.2.1-.5.3-.7l3.3-3.3-3.3-3.3A1 1 0 0 1 14 7c0-.3.1-.5.3-.7A1 1 0 0 1 15 6a1 1 0 0 1 .6.3L19 9.6l3.3-3.3A1 1 0 0 1 23 6z",
11839 "fill": "currentColor"
11840}, null)]);
11841var stdin_default$F = vue.defineComponent({
11842 name: name$x,
11843 props: {
11844 type: String,
11845 text: numericProp,
11846 color: String,
11847 wider: Boolean,
11848 large: Boolean,
11849 loading: Boolean
11850 },
11851 emits: ["press"],
11852 setup(props2, {
11853 emit,
11854 slots
11855 }) {
11856 const active = vue.ref(false);
11857 const touch = useTouch();
11858 const onTouchStart = (event) => {
11859 touch.start(event);
11860 active.value = true;
11861 };
11862 const onTouchMove = (event) => {
11863 touch.move(event);
11864 if (touch.direction.value) {
11865 active.value = false;
11866 }
11867 };
11868 const onTouchEnd = (event) => {
11869 if (active.value) {
11870 if (!slots.default) {
11871 preventDefault(event);
11872 }
11873 active.value = false;
11874 emit("press", props2.text, props2.type);
11875 }
11876 };
11877 const renderContent = () => {
11878 if (props2.loading) {
11879 return vue.createVNode(Loading, {
11880 "class": bem$w("loading-icon")
11881 }, null);
11882 }
11883 const text = slots.default ? slots.default() : props2.text;
11884 switch (props2.type) {
11885 case "delete":
11886 return text || DeleteIcon;
11887 case "extra":
11888 return text || CollapseIcon;
11889 default:
11890 return text;
11891 }
11892 };
11893 return () => vue.createVNode("div", {
11894 "class": bem$w("wrapper", {
11895 wider: props2.wider
11896 }),
11897 "onTouchstartPassive": onTouchStart,
11898 "onTouchmovePassive": onTouchMove,
11899 "onTouchend": onTouchEnd,
11900 "onTouchcancel": onTouchEnd
11901 }, [vue.createVNode("div", {
11902 "role": "button",
11903 "tabindex": 0,
11904 "class": bem$w([props2.color, {
11905 large: props2.large,
11906 active: active.value,
11907 delete: props2.type === "delete"
11908 }])
11909 }, [renderContent()])]);
11910 }
11911});
11912const [name$w, bem$v] = createNamespace("number-keyboard");
11913const numberKeyboardProps = {
11914 show: Boolean,
11915 title: String,
11916 theme: makeStringProp("default"),
11917 zIndex: numericProp,
11918 teleport: [String, Object],
11919 maxlength: makeNumericProp(Infinity),
11920 modelValue: makeStringProp(""),
11921 transition: truthProp,
11922 blurOnClose: truthProp,
11923 showDeleteKey: truthProp,
11924 randomKeyOrder: Boolean,
11925 closeButtonText: String,
11926 deleteButtonText: String,
11927 closeButtonLoading: Boolean,
11928 hideOnClickOutside: truthProp,
11929 safeAreaInsetBottom: truthProp,
11930 extraKey: {
11931 type: [String, Array],
11932 default: ""
11933 }
11934};
11935function shuffle(array) {
11936 for (let i = array.length - 1; i > 0; i--) {
11937 const j = Math.floor(Math.random() * (i + 1));
11938 const temp = array[i];
11939 array[i] = array[j];
11940 array[j] = temp;
11941 }
11942 return array;
11943}
11944var stdin_default$E = vue.defineComponent({
11945 name: name$w,
11946 inheritAttrs: false,
11947 props: numberKeyboardProps,
11948 emits: ["show", "hide", "blur", "input", "close", "delete", "update:modelValue"],
11949 setup(props2, {
11950 emit,
11951 slots,
11952 attrs
11953 }) {
11954 const root = vue.ref();
11955 const genBasicKeys = () => {
11956 const keys2 = Array(9).fill("").map((_, i) => ({
11957 text: i + 1
11958 }));
11959 if (props2.randomKeyOrder) {
11960 shuffle(keys2);
11961 }
11962 return keys2;
11963 };
11964 const genDefaultKeys = () => [...genBasicKeys(), {
11965 text: props2.extraKey,
11966 type: "extra"
11967 }, {
11968 text: 0
11969 }, {
11970 text: props2.showDeleteKey ? props2.deleteButtonText : "",
11971 type: props2.showDeleteKey ? "delete" : ""
11972 }];
11973 const genCustomKeys = () => {
11974 const keys2 = genBasicKeys();
11975 const {
11976 extraKey
11977 } = props2;
11978 const extraKeys = Array.isArray(extraKey) ? extraKey : [extraKey];
11979 if (extraKeys.length === 1) {
11980 keys2.push({
11981 text: 0,
11982 wider: true
11983 }, {
11984 text: extraKeys[0],
11985 type: "extra"
11986 });
11987 } else if (extraKeys.length === 2) {
11988 keys2.push({
11989 text: extraKeys[0],
11990 type: "extra"
11991 }, {
11992 text: 0
11993 }, {
11994 text: extraKeys[1],
11995 type: "extra"
11996 });
11997 }
11998 return keys2;
11999 };
12000 const keys = vue.computed(() => props2.theme === "custom" ? genCustomKeys() : genDefaultKeys());
12001 const onBlur = () => {
12002 if (props2.show) {
12003 emit("blur");
12004 }
12005 };
12006 const onClose = () => {
12007 emit("close");
12008 if (props2.blurOnClose) {
12009 onBlur();
12010 }
12011 };
12012 const onAnimationEnd = () => emit(props2.show ? "show" : "hide");
12013 const onPress = (text, type) => {
12014 if (text === "") {
12015 if (type === "extra") {
12016 onBlur();
12017 }
12018 return;
12019 }
12020 const value = props2.modelValue;
12021 if (type === "delete") {
12022 emit("delete");
12023 emit("update:modelValue", value.slice(0, value.length - 1));
12024 } else if (type === "close") {
12025 onClose();
12026 } else if (value.length < +props2.maxlength) {
12027 emit("input", text);
12028 emit("update:modelValue", value + text);
12029 }
12030 };
12031 const renderTitle = () => {
12032 const {
12033 title,
12034 theme,
12035 closeButtonText
12036 } = props2;
12037 const leftSlot = slots["title-left"];
12038 const showClose = closeButtonText && theme === "default";
12039 const showTitle = title || showClose || leftSlot;
12040 if (!showTitle) {
12041 return;
12042 }
12043 return vue.createVNode("div", {
12044 "class": bem$v("header")
12045 }, [leftSlot && vue.createVNode("span", {
12046 "class": bem$v("title-left")
12047 }, [leftSlot()]), title && vue.createVNode("h2", {
12048 "class": bem$v("title")
12049 }, [title]), showClose && vue.createVNode("button", {
12050 "type": "button",
12051 "class": [bem$v("close"), HAPTICS_FEEDBACK],
12052 "onClick": onClose
12053 }, [closeButtonText])]);
12054 };
12055 const renderKeys = () => keys.value.map((key) => {
12056 const keySlots = {};
12057 if (key.type === "delete") {
12058 keySlots.default = slots.delete;
12059 }
12060 if (key.type === "extra") {
12061 keySlots.default = slots["extra-key"];
12062 }
12063 return vue.createVNode(stdin_default$F, {
12064 "key": key.text,
12065 "text": key.text,
12066 "type": key.type,
12067 "wider": key.wider,
12068 "color": key.color,
12069 "onPress": onPress
12070 }, keySlots);
12071 });
12072 const renderSidebar = () => {
12073 if (props2.theme === "custom") {
12074 return vue.createVNode("div", {
12075 "class": bem$v("sidebar")
12076 }, [props2.showDeleteKey && vue.createVNode(stdin_default$F, {
12077 "large": true,
12078 "text": props2.deleteButtonText,
12079 "type": "delete",
12080 "onPress": onPress
12081 }, {
12082 default: slots.delete
12083 }), vue.createVNode(stdin_default$F, {
12084 "large": true,
12085 "text": props2.closeButtonText,
12086 "type": "close",
12087 "color": "blue",
12088 "loading": props2.closeButtonLoading,
12089 "onPress": onPress
12090 }, null)]);
12091 }
12092 };
12093 vue.watch(() => props2.show, (value) => {
12094 if (!props2.transition) {
12095 emit(value ? "show" : "hide");
12096 }
12097 });
12098 if (props2.hideOnClickOutside) {
12099 use.useClickAway(root, onBlur, {
12100 eventName: "touchstart"
12101 });
12102 }
12103 return () => {
12104 const Title = renderTitle();
12105 const Content = vue.createVNode(vue.Transition, {
12106 "name": props2.transition ? "van-slide-up" : ""
12107 }, {
12108 default: () => [vue.withDirectives(vue.createVNode("div", vue.mergeProps({
12109 "ref": root,
12110 "style": getZIndexStyle(props2.zIndex),
12111 "class": bem$v({
12112 unfit: !props2.safeAreaInsetBottom,
12113 "with-title": !!Title
12114 }),
12115 "onAnimationend": onAnimationEnd,
12116 "onTouchstartPassive": stopPropagation
12117 }, attrs), [Title, vue.createVNode("div", {
12118 "class": bem$v("body")
12119 }, [vue.createVNode("div", {
12120 "class": bem$v("keys")
12121 }, [renderKeys()]), renderSidebar()])]), [[vue.vShow, props2.show]])]
12122 });
12123 if (props2.teleport) {
12124 return vue.createVNode(vue.Teleport, {
12125 "to": props2.teleport
12126 }, {
12127 default: () => [Content]
12128 });
12129 }
12130 return Content;
12131 };
12132 }
12133});
12134const NumberKeyboard = withInstall(stdin_default$E);
12135const [name$v, bem$u, t$6] = createNamespace("pagination");
12136const makePage = (number, text, active) => ({
12137 number,
12138 text,
12139 active
12140});
12141const paginationProps = {
12142 mode: makeStringProp("multi"),
12143 prevText: String,
12144 nextText: String,
12145 pageCount: makeNumericProp(0),
12146 modelValue: makeNumberProp(0),
12147 totalItems: makeNumericProp(0),
12148 showPageSize: makeNumericProp(5),
12149 itemsPerPage: makeNumericProp(10),
12150 forceEllipses: Boolean,
12151 showPrevButton: truthProp,
12152 showNextButton: truthProp
12153};
12154var stdin_default$D = vue.defineComponent({
12155 name: name$v,
12156 props: paginationProps,
12157 emits: ["change", "update:modelValue"],
12158 setup(props2, {
12159 emit,
12160 slots
12161 }) {
12162 const count = vue.computed(() => {
12163 const {
12164 pageCount,
12165 totalItems,
12166 itemsPerPage
12167 } = props2;
12168 const count2 = +pageCount || Math.ceil(+totalItems / +itemsPerPage);
12169 return Math.max(1, count2);
12170 });
12171 const pages = vue.computed(() => {
12172 const items = [];
12173 const pageCount = count.value;
12174 const showPageSize = +props2.showPageSize;
12175 const {
12176 modelValue,
12177 forceEllipses
12178 } = props2;
12179 let startPage = 1;
12180 let endPage = pageCount;
12181 const isMaxSized = showPageSize < pageCount;
12182 if (isMaxSized) {
12183 startPage = Math.max(modelValue - Math.floor(showPageSize / 2), 1);
12184 endPage = startPage + showPageSize - 1;
12185 if (endPage > pageCount) {
12186 endPage = pageCount;
12187 startPage = endPage - showPageSize + 1;
12188 }
12189 }
12190 for (let number = startPage; number <= endPage; number++) {
12191 const page = makePage(number, number, number === modelValue);
12192 items.push(page);
12193 }
12194 if (isMaxSized && showPageSize > 0 && forceEllipses) {
12195 if (startPage > 1) {
12196 const prevPages = makePage(startPage - 1, "...");
12197 items.unshift(prevPages);
12198 }
12199 if (endPage < pageCount) {
12200 const nextPages = makePage(endPage + 1, "...");
12201 items.push(nextPages);
12202 }
12203 }
12204 return items;
12205 });
12206 const updateModelValue = (value, emitChange) => {
12207 value = clamp(value, 1, count.value);
12208 if (props2.modelValue !== value) {
12209 emit("update:modelValue", value);
12210 if (emitChange) {
12211 emit("change", value);
12212 }
12213 }
12214 };
12215 vue.watchEffect(() => updateModelValue(props2.modelValue));
12216 const renderDesc = () => vue.createVNode("li", {
12217 "class": bem$u("page-desc")
12218 }, [slots.pageDesc ? slots.pageDesc() : `${props2.modelValue}/${count.value}`]);
12219 const renderPrevButton = () => {
12220 const {
12221 mode,
12222 modelValue,
12223 showPrevButton
12224 } = props2;
12225 if (!showPrevButton) {
12226 return;
12227 }
12228 const slot = slots["prev-text"];
12229 const disabled = modelValue === 1;
12230 return vue.createVNode("li", {
12231 "class": [bem$u("item", {
12232 disabled,
12233 border: mode === "simple",
12234 prev: true
12235 }), BORDER_SURROUND]
12236 }, [vue.createVNode("button", {
12237 "type": "button",
12238 "disabled": disabled,
12239 "onClick": () => updateModelValue(modelValue - 1, true)
12240 }, [slot ? slot() : props2.prevText || t$6("prev")])]);
12241 };
12242 const renderNextButton = () => {
12243 const {
12244 mode,
12245 modelValue,
12246 showNextButton
12247 } = props2;
12248 if (!showNextButton) {
12249 return;
12250 }
12251 const slot = slots["next-text"];
12252 const disabled = modelValue === count.value;
12253 return vue.createVNode("li", {
12254 "class": [bem$u("item", {
12255 disabled,
12256 border: mode === "simple",
12257 next: true
12258 }), BORDER_SURROUND]
12259 }, [vue.createVNode("button", {
12260 "type": "button",
12261 "disabled": disabled,
12262 "onClick": () => updateModelValue(modelValue + 1, true)
12263 }, [slot ? slot() : props2.nextText || t$6("next")])]);
12264 };
12265 const renderPages = () => pages.value.map((page) => vue.createVNode("li", {
12266 "class": [bem$u("item", {
12267 active: page.active,
12268 page: true
12269 }), BORDER_SURROUND]
12270 }, [vue.createVNode("button", {
12271 "type": "button",
12272 "aria-current": page.active || void 0,
12273 "onClick": () => updateModelValue(page.number, true)
12274 }, [slots.page ? slots.page(page) : page.text])]));
12275 return () => vue.createVNode("nav", {
12276 "role": "navigation",
12277 "class": bem$u()
12278 }, [vue.createVNode("ul", {
12279 "class": bem$u("items")
12280 }, [renderPrevButton(), props2.mode === "simple" ? renderDesc() : renderPages(), renderNextButton()])]);
12281 }
12282});
12283const Pagination = withInstall(stdin_default$D);
12284const [name$u, bem$t] = createNamespace("password-input");
12285const passwordInputProps = {
12286 info: String,
12287 mask: truthProp,
12288 value: makeStringProp(""),
12289 gutter: numericProp,
12290 length: makeNumericProp(6),
12291 focused: Boolean,
12292 errorInfo: String
12293};
12294var stdin_default$C = vue.defineComponent({
12295 name: name$u,
12296 props: passwordInputProps,
12297 emits: ["focus"],
12298 setup(props2, {
12299 emit
12300 }) {
12301 const onTouchStart = (event) => {
12302 event.stopPropagation();
12303 emit("focus", event);
12304 };
12305 const renderPoints = () => {
12306 const Points = [];
12307 const {
12308 mask,
12309 value,
12310 gutter,
12311 focused
12312 } = props2;
12313 const length = +props2.length;
12314 for (let i = 0; i < length; i++) {
12315 const char = value[i];
12316 const showBorder = i !== 0 && !gutter;
12317 const showCursor = focused && i === value.length;
12318 let style;
12319 if (i !== 0 && gutter) {
12320 style = {
12321 marginLeft: addUnit(gutter)
12322 };
12323 }
12324 Points.push(vue.createVNode("li", {
12325 "class": [{
12326 [BORDER_LEFT]: showBorder
12327 }, bem$t("item", {
12328 focus: showCursor
12329 })],
12330 "style": style
12331 }, [mask ? vue.createVNode("i", {
12332 "style": {
12333 visibility: char ? "visible" : "hidden"
12334 }
12335 }, null) : char, showCursor && vue.createVNode("div", {
12336 "class": bem$t("cursor")
12337 }, null)]));
12338 }
12339 return Points;
12340 };
12341 return () => {
12342 const info = props2.errorInfo || props2.info;
12343 return vue.createVNode("div", {
12344 "class": bem$t()
12345 }, [vue.createVNode("ul", {
12346 "class": [bem$t("security"), {
12347 [BORDER_SURROUND]: !props2.gutter
12348 }],
12349 "onTouchstartPassive": onTouchStart
12350 }, [renderPoints()]), info && vue.createVNode("div", {
12351 "class": bem$t(props2.errorInfo ? "error-info" : "info")
12352 }, [info])]);
12353 };
12354 }
12355});
12356const PasswordInput = withInstall(stdin_default$C);
12357const PickerGroup = withInstall(stdin_default$1A);
12358const [name$t, bem$s] = createNamespace("popover");
12359const popupProps = ["overlay", "duration", "teleport", "overlayStyle", "overlayClass", "closeOnClickOverlay"];
12360const popoverProps = {
12361 show: Boolean,
12362 theme: makeStringProp("light"),
12363 overlay: Boolean,
12364 actions: makeArrayProp(),
12365 actionsDirection: makeStringProp("vertical"),
12366 trigger: makeStringProp("click"),
12367 duration: numericProp,
12368 showArrow: truthProp,
12369 placement: makeStringProp("bottom"),
12370 iconPrefix: String,
12371 overlayClass: unknownProp,
12372 overlayStyle: Object,
12373 closeOnClickAction: truthProp,
12374 closeOnClickOverlay: truthProp,
12375 closeOnClickOutside: truthProp,
12376 offset: {
12377 type: Array,
12378 default: () => [0, 8]
12379 },
12380 teleport: {
12381 type: [String, Object],
12382 default: "body"
12383 }
12384};
12385var stdin_default$B = vue.defineComponent({
12386 name: name$t,
12387 props: popoverProps,
12388 emits: ["select", "touchstart", "update:show"],
12389 setup(props2, {
12390 emit,
12391 slots,
12392 attrs
12393 }) {
12394 let popper;
12395 const popupRef = vue.ref();
12396 const wrapperRef = vue.ref();
12397 const popoverRef = vue.ref();
12398 const show = useSyncPropRef(() => props2.show, (value) => emit("update:show", value));
12399 const getPopoverOptions = () => ({
12400 placement: props2.placement,
12401 modifiers: [{
12402 name: "computeStyles",
12403 options: {
12404 adaptive: false,
12405 gpuAcceleration: false
12406 }
12407 }, extend({}, popperjs.offsetModifier, {
12408 options: {
12409 offset: props2.offset
12410 }
12411 })]
12412 });
12413 const createPopperInstance = () => {
12414 if (wrapperRef.value && popoverRef.value) {
12415 return popperjs.createPopper(wrapperRef.value, popoverRef.value.popupRef.value, getPopoverOptions());
12416 }
12417 return null;
12418 };
12419 const updateLocation = () => {
12420 vue.nextTick(() => {
12421 if (!show.value) {
12422 return;
12423 }
12424 if (!popper) {
12425 popper = createPopperInstance();
12426 if (inBrowser) {
12427 window.addEventListener("animationend", updateLocation);
12428 window.addEventListener("transitionend", updateLocation);
12429 }
12430 } else {
12431 popper.setOptions(getPopoverOptions());
12432 }
12433 });
12434 };
12435 const updateShow = (value) => {
12436 show.value = value;
12437 };
12438 const onClickWrapper = () => {
12439 if (props2.trigger === "click") {
12440 show.value = !show.value;
12441 }
12442 };
12443 const onClickAction = (action, index) => {
12444 if (action.disabled) {
12445 return;
12446 }
12447 emit("select", action, index);
12448 if (props2.closeOnClickAction) {
12449 show.value = false;
12450 }
12451 };
12452 const onClickAway = () => {
12453 if (show.value && props2.closeOnClickOutside && (!props2.overlay || props2.closeOnClickOverlay)) {
12454 show.value = false;
12455 }
12456 };
12457 const renderActionContent = (action, index) => {
12458 if (slots.action) {
12459 return slots.action({
12460 action,
12461 index
12462 });
12463 }
12464 return [action.icon && vue.createVNode(Icon, {
12465 "name": action.icon,
12466 "classPrefix": props2.iconPrefix,
12467 "class": bem$s("action-icon")
12468 }, null), vue.createVNode("div", {
12469 "class": [bem$s("action-text"), {
12470 [BORDER_BOTTOM]: props2.actionsDirection === "vertical"
12471 }]
12472 }, [action.text])];
12473 };
12474 const renderAction = (action, index) => {
12475 const {
12476 icon,
12477 color,
12478 disabled,
12479 className
12480 } = action;
12481 return vue.createVNode("div", {
12482 "role": "menuitem",
12483 "class": [bem$s("action", {
12484 disabled,
12485 "with-icon": icon
12486 }), {
12487 [BORDER_RIGHT]: props2.actionsDirection === "horizontal"
12488 }, className],
12489 "style": {
12490 color
12491 },
12492 "tabindex": disabled ? void 0 : 0,
12493 "aria-disabled": disabled || void 0,
12494 "onClick": () => onClickAction(action, index)
12495 }, [renderActionContent(action, index)]);
12496 };
12497 vue.onMounted(() => {
12498 updateLocation();
12499 vue.watchEffect(() => {
12500 var _a;
12501 popupRef.value = (_a = popoverRef.value) == null ? void 0 : _a.popupRef.value;
12502 });
12503 });
12504 vue.onBeforeUnmount(() => {
12505 if (popper) {
12506 if (inBrowser) {
12507 window.removeEventListener("animationend", updateLocation);
12508 window.removeEventListener("transitionend", updateLocation);
12509 }
12510 popper.destroy();
12511 popper = null;
12512 }
12513 });
12514 vue.watch(() => [show.value, props2.offset, props2.placement], updateLocation);
12515 use.useClickAway([wrapperRef, popupRef], onClickAway, {
12516 eventName: "touchstart"
12517 });
12518 return () => {
12519 var _a;
12520 return vue.createVNode(vue.Fragment, null, [vue.createVNode("span", {
12521 "ref": wrapperRef,
12522 "class": bem$s("wrapper"),
12523 "onClick": onClickWrapper
12524 }, [(_a = slots.reference) == null ? void 0 : _a.call(slots)]), vue.createVNode(Popup, vue.mergeProps({
12525 "ref": popoverRef,
12526 "show": show.value,
12527 "class": bem$s([props2.theme]),
12528 "position": "",
12529 "transition": "van-popover-zoom",
12530 "lockScroll": false,
12531 "onUpdate:show": updateShow
12532 }, attrs, useScopeId(), pick(props2, popupProps)), {
12533 default: () => [props2.showArrow && vue.createVNode("div", {
12534 "class": bem$s("arrow")
12535 }, null), vue.createVNode("div", {
12536 "role": "menu",
12537 "class": bem$s("content", props2.actionsDirection)
12538 }, [slots.default ? slots.default() : props2.actions.map(renderAction)])]
12539 })]);
12540 };
12541 }
12542});
12543const Popover = withInstall(stdin_default$B);
12544const [name$s, bem$r] = createNamespace("progress");
12545const progressProps = {
12546 color: String,
12547 inactive: Boolean,
12548 pivotText: String,
12549 textColor: String,
12550 showPivot: truthProp,
12551 pivotColor: String,
12552 trackColor: String,
12553 strokeWidth: numericProp,
12554 percentage: {
12555 type: numericProp,
12556 default: 0,
12557 validator: (value) => +value >= 0 && +value <= 100
12558 }
12559};
12560var stdin_default$A = vue.defineComponent({
12561 name: name$s,
12562 props: progressProps,
12563 setup(props2) {
12564 const background = vue.computed(() => props2.inactive ? void 0 : props2.color);
12565 const renderPivot = () => {
12566 const {
12567 textColor,
12568 pivotText,
12569 pivotColor,
12570 percentage
12571 } = props2;
12572 const text = pivotText != null ? pivotText : `${percentage}%`;
12573 if (props2.showPivot && text) {
12574 const style = {
12575 color: textColor,
12576 left: `${+percentage}%`,
12577 transform: `translate(-${+percentage}%,-50%)`,
12578 background: pivotColor || background.value
12579 };
12580 return vue.createVNode("span", {
12581 "style": style,
12582 "class": bem$r("pivot", {
12583 inactive: props2.inactive
12584 })
12585 }, [text]);
12586 }
12587 };
12588 return () => {
12589 const {
12590 trackColor,
12591 percentage,
12592 strokeWidth
12593 } = props2;
12594 const rootStyle = {
12595 background: trackColor,
12596 height: addUnit(strokeWidth)
12597 };
12598 const portionStyle = {
12599 width: `${percentage}%`,
12600 background: background.value
12601 };
12602 return vue.createVNode("div", {
12603 "class": bem$r(),
12604 "style": rootStyle
12605 }, [vue.createVNode("span", {
12606 "class": bem$r("portion", {
12607 inactive: props2.inactive
12608 }),
12609 "style": portionStyle
12610 }, null), renderPivot()]);
12611 };
12612 }
12613});
12614const Progress = withInstall(stdin_default$A);
12615const [name$r, bem$q, t$5] = createNamespace("pull-refresh");
12616const DEFAULT_HEAD_HEIGHT = 50;
12617const TEXT_STATUS = ["pulling", "loosing", "success"];
12618const pullRefreshProps = {
12619 disabled: Boolean,
12620 modelValue: Boolean,
12621 headHeight: makeNumericProp(DEFAULT_HEAD_HEIGHT),
12622 successText: String,
12623 pullingText: String,
12624 loosingText: String,
12625 loadingText: String,
12626 pullDistance: numericProp,
12627 successDuration: makeNumericProp(500),
12628 animationDuration: makeNumericProp(300)
12629};
12630var stdin_default$z = vue.defineComponent({
12631 name: name$r,
12632 props: pullRefreshProps,
12633 emits: ["change", "refresh", "update:modelValue"],
12634 setup(props2, {
12635 emit,
12636 slots
12637 }) {
12638 let reachTop;
12639 const root = vue.ref();
12640 const track = vue.ref();
12641 const scrollParent = use.useScrollParent(root);
12642 const state = vue.reactive({
12643 status: "normal",
12644 distance: 0,
12645 duration: 0
12646 });
12647 const touch = useTouch();
12648 const getHeadStyle = () => {
12649 if (props2.headHeight !== DEFAULT_HEAD_HEIGHT) {
12650 return {
12651 height: `${props2.headHeight}px`
12652 };
12653 }
12654 };
12655 const isTouchable = () => state.status !== "loading" && state.status !== "success" && !props2.disabled;
12656 const ease = (distance) => {
12657 const pullDistance = +(props2.pullDistance || props2.headHeight);
12658 if (distance > pullDistance) {
12659 if (distance < pullDistance * 2) {
12660 distance = pullDistance + (distance - pullDistance) / 2;
12661 } else {
12662 distance = pullDistance * 1.5 + (distance - pullDistance * 2) / 4;
12663 }
12664 }
12665 return Math.round(distance);
12666 };
12667 const setStatus = (distance, isLoading) => {
12668 const pullDistance = +(props2.pullDistance || props2.headHeight);
12669 state.distance = distance;
12670 if (isLoading) {
12671 state.status = "loading";
12672 } else if (distance === 0) {
12673 state.status = "normal";
12674 } else if (distance < pullDistance) {
12675 state.status = "pulling";
12676 } else {
12677 state.status = "loosing";
12678 }
12679 emit("change", {
12680 status: state.status,
12681 distance
12682 });
12683 };
12684 const getStatusText = () => {
12685 const {
12686 status
12687 } = state;
12688 if (status === "normal") {
12689 return "";
12690 }
12691 return props2[`${status}Text`] || t$5(status);
12692 };
12693 const renderStatus = () => {
12694 const {
12695 status,
12696 distance
12697 } = state;
12698 if (slots[status]) {
12699 return slots[status]({
12700 distance
12701 });
12702 }
12703 const nodes = [];
12704 if (TEXT_STATUS.includes(status)) {
12705 nodes.push(vue.createVNode("div", {
12706 "class": bem$q("text")
12707 }, [getStatusText()]));
12708 }
12709 if (status === "loading") {
12710 nodes.push(vue.createVNode(Loading, {
12711 "class": bem$q("loading")
12712 }, {
12713 default: getStatusText
12714 }));
12715 }
12716 return nodes;
12717 };
12718 const showSuccessTip = () => {
12719 state.status = "success";
12720 setTimeout(() => {
12721 setStatus(0);
12722 }, +props2.successDuration);
12723 };
12724 const checkPosition = (event) => {
12725 reachTop = getScrollTop(scrollParent.value) === 0;
12726 if (reachTop) {
12727 state.duration = 0;
12728 touch.start(event);
12729 }
12730 };
12731 const onTouchStart = (event) => {
12732 if (isTouchable()) {
12733 checkPosition(event);
12734 }
12735 };
12736 const onTouchMove = (event) => {
12737 if (isTouchable()) {
12738 if (!reachTop) {
12739 checkPosition(event);
12740 }
12741 const {
12742 deltaY
12743 } = touch;
12744 touch.move(event);
12745 if (reachTop && deltaY.value >= 0 && touch.isVertical()) {
12746 preventDefault(event);
12747 setStatus(ease(deltaY.value));
12748 }
12749 }
12750 };
12751 const onTouchEnd = () => {
12752 if (reachTop && touch.deltaY.value && isTouchable()) {
12753 state.duration = +props2.animationDuration;
12754 if (state.status === "loosing") {
12755 setStatus(+props2.headHeight, true);
12756 emit("update:modelValue", true);
12757 vue.nextTick(() => emit("refresh"));
12758 } else {
12759 setStatus(0);
12760 }
12761 }
12762 };
12763 vue.watch(() => props2.modelValue, (value) => {
12764 state.duration = +props2.animationDuration;
12765 if (value) {
12766 setStatus(+props2.headHeight, true);
12767 } else if (slots.success || props2.successText) {
12768 showSuccessTip();
12769 } else {
12770 setStatus(0, false);
12771 }
12772 });
12773 use.useEventListener("touchmove", onTouchMove, {
12774 target: track
12775 });
12776 return () => {
12777 var _a;
12778 const trackStyle = {
12779 transitionDuration: `${state.duration}ms`,
12780 transform: state.distance ? `translate3d(0,${state.distance}px, 0)` : ""
12781 };
12782 return vue.createVNode("div", {
12783 "ref": root,
12784 "class": bem$q()
12785 }, [vue.createVNode("div", {
12786 "ref": track,
12787 "class": bem$q("track"),
12788 "style": trackStyle,
12789 "onTouchstartPassive": onTouchStart,
12790 "onTouchend": onTouchEnd,
12791 "onTouchcancel": onTouchEnd
12792 }, [vue.createVNode("div", {
12793 "class": bem$q("head"),
12794 "style": getHeadStyle()
12795 }, [renderStatus()]), (_a = slots.default) == null ? void 0 : _a.call(slots)])]);
12796 };
12797 }
12798});
12799const PullRefresh = withInstall(stdin_default$z);
12800const [name$q, bem$p] = createNamespace("rate");
12801function getRateStatus(value, index, allowHalf, readonly) {
12802 if (value >= index) {
12803 return {
12804 status: "full",
12805 value: 1
12806 };
12807 }
12808 if (value + 0.5 >= index && allowHalf && !readonly) {
12809 return {
12810 status: "half",
12811 value: 0.5
12812 };
12813 }
12814 if (value + 1 >= index && allowHalf && readonly) {
12815 const cardinal = 10 ** 10;
12816 return {
12817 status: "half",
12818 value: Math.round((value - index + 1) * cardinal) / cardinal
12819 };
12820 }
12821 return {
12822 status: "void",
12823 value: 0
12824 };
12825}
12826const rateProps = {
12827 size: numericProp,
12828 icon: makeStringProp("star"),
12829 color: String,
12830 count: makeNumericProp(5),
12831 gutter: numericProp,
12832 clearable: Boolean,
12833 readonly: Boolean,
12834 disabled: Boolean,
12835 voidIcon: makeStringProp("star-o"),
12836 allowHalf: Boolean,
12837 voidColor: String,
12838 touchable: truthProp,
12839 iconPrefix: String,
12840 modelValue: makeNumberProp(0),
12841 disabledColor: String
12842};
12843var stdin_default$y = vue.defineComponent({
12844 name: name$q,
12845 props: rateProps,
12846 emits: ["change", "update:modelValue"],
12847 setup(props2, {
12848 emit
12849 }) {
12850 const touch = useTouch();
12851 const [itemRefs, setItemRefs] = useRefs();
12852 const groupRef = vue.ref();
12853 const unselectable = vue.computed(() => props2.readonly || props2.disabled);
12854 const untouchable = vue.computed(() => unselectable.value || !props2.touchable);
12855 const list = vue.computed(() => Array(+props2.count).fill("").map((_, i) => getRateStatus(props2.modelValue, i + 1, props2.allowHalf, props2.readonly)));
12856 let ranges;
12857 let groupRefRect;
12858 let minRectTop = Number.MAX_SAFE_INTEGER;
12859 let maxRectTop = Number.MIN_SAFE_INTEGER;
12860 const updateRanges = () => {
12861 groupRefRect = use.useRect(groupRef);
12862 const rects = itemRefs.value.map(use.useRect);
12863 ranges = [];
12864 rects.forEach((rect, index) => {
12865 minRectTop = Math.min(rect.top, minRectTop);
12866 maxRectTop = Math.max(rect.top, maxRectTop);
12867 if (props2.allowHalf) {
12868 ranges.push({
12869 score: index + 0.5,
12870 left: rect.left,
12871 top: rect.top,
12872 height: rect.height
12873 }, {
12874 score: index + 1,
12875 left: rect.left + rect.width / 2,
12876 top: rect.top,
12877 height: rect.height
12878 });
12879 } else {
12880 ranges.push({
12881 score: index + 1,
12882 left: rect.left,
12883 top: rect.top,
12884 height: rect.height
12885 });
12886 }
12887 });
12888 };
12889 const getScoreByPosition = (x, y) => {
12890 for (let i = ranges.length - 1; i > 0; i--) {
12891 if (y >= groupRefRect.top && y <= groupRefRect.bottom) {
12892 if (x > ranges[i].left && y >= ranges[i].top && y <= ranges[i].top + ranges[i].height) {
12893 return ranges[i].score;
12894 }
12895 } else {
12896 const curTop = y < groupRefRect.top ? minRectTop : maxRectTop;
12897 if (x > ranges[i].left && ranges[i].top === curTop) {
12898 return ranges[i].score;
12899 }
12900 }
12901 }
12902 return props2.allowHalf ? 0.5 : 1;
12903 };
12904 const select = (value) => {
12905 if (unselectable.value || value === props2.modelValue)
12906 return;
12907 emit("update:modelValue", value);
12908 emit("change", value);
12909 };
12910 const onTouchStart = (event) => {
12911 if (untouchable.value) {
12912 return;
12913 }
12914 touch.start(event);
12915 updateRanges();
12916 };
12917 const onTouchMove = (event) => {
12918 if (untouchable.value) {
12919 return;
12920 }
12921 touch.move(event);
12922 if (touch.isHorizontal() && !touch.isTap.value) {
12923 const {
12924 clientX,
12925 clientY
12926 } = event.touches[0];
12927 preventDefault(event);
12928 select(getScoreByPosition(clientX, clientY));
12929 }
12930 };
12931 const renderStar = (item, index) => {
12932 const {
12933 icon,
12934 size,
12935 color,
12936 count,
12937 gutter,
12938 voidIcon,
12939 disabled,
12940 voidColor,
12941 allowHalf,
12942 iconPrefix,
12943 disabledColor
12944 } = props2;
12945 const score = index + 1;
12946 const isFull = item.status === "full";
12947 const isVoid = item.status === "void";
12948 const renderHalf = allowHalf && item.value > 0 && item.value < 1;
12949 let style;
12950 if (gutter && score !== +count) {
12951 style = {
12952 paddingRight: addUnit(gutter)
12953 };
12954 }
12955 const onClickItem = (event) => {
12956 updateRanges();
12957 let value = allowHalf ? getScoreByPosition(event.clientX, event.clientY) : score;
12958 if (props2.clearable && touch.isTap.value && value === props2.modelValue) {
12959 value = 0;
12960 }
12961 select(value);
12962 };
12963 return vue.createVNode("div", {
12964 "key": index,
12965 "ref": setItemRefs(index),
12966 "role": "radio",
12967 "style": style,
12968 "class": bem$p("item"),
12969 "tabindex": disabled ? void 0 : 0,
12970 "aria-setsize": count,
12971 "aria-posinset": score,
12972 "aria-checked": !isVoid,
12973 "onClick": onClickItem
12974 }, [vue.createVNode(Icon, {
12975 "size": size,
12976 "name": isFull ? icon : voidIcon,
12977 "class": bem$p("icon", {
12978 disabled,
12979 full: isFull
12980 }),
12981 "color": disabled ? disabledColor : isFull ? color : voidColor,
12982 "classPrefix": iconPrefix
12983 }, null), renderHalf && vue.createVNode(Icon, {
12984 "size": size,
12985 "style": {
12986 width: item.value + "em"
12987 },
12988 "name": isVoid ? voidIcon : icon,
12989 "class": bem$p("icon", ["half", {
12990 disabled,
12991 full: !isVoid
12992 }]),
12993 "color": disabled ? disabledColor : isVoid ? voidColor : color,
12994 "classPrefix": iconPrefix
12995 }, null)]);
12996 };
12997 use.useCustomFieldValue(() => props2.modelValue);
12998 use.useEventListener("touchmove", onTouchMove, {
12999 target: groupRef
13000 });
13001 return () => vue.createVNode("div", {
13002 "ref": groupRef,
13003 "role": "radiogroup",
13004 "class": bem$p({
13005 readonly: props2.readonly,
13006 disabled: props2.disabled
13007 }),
13008 "tabindex": props2.disabled ? void 0 : 0,
13009 "aria-disabled": props2.disabled,
13010 "aria-readonly": props2.readonly,
13011 "onTouchstartPassive": onTouchStart
13012 }, [list.value.map(renderStar)]);
13013 }
13014});
13015const Rate = withInstall(stdin_default$y);
13016const props = {
13017 figureArr: makeArrayProp(),
13018 delay: Number,
13019 duration: makeNumberProp(2),
13020 isStart: Boolean,
13021 direction: makeStringProp("down"),
13022 height: makeNumberProp(40)
13023};
13024const [name$p, bem$o] = createNamespace("rolling-text-item");
13025var stdin_default$x = vue.defineComponent({
13026 name: name$p,
13027 props,
13028 setup(props2) {
13029 const newFigureArr = vue.computed(() => props2.direction === "down" ? props2.figureArr.slice().reverse() : props2.figureArr);
13030 const translatePx = vue.computed(() => {
13031 const totalHeight = props2.height * (props2.figureArr.length - 1);
13032 return `-${totalHeight}px`;
13033 });
13034 const itemStyle = vue.computed(() => ({
13035 lineHeight: addUnit(props2.height)
13036 }));
13037 const rootStyle = vue.computed(() => ({
13038 height: addUnit(props2.height),
13039 "--van-translate": translatePx.value,
13040 "--van-duration": props2.duration + "s",
13041 "--van-delay": props2.delay + "s"
13042 }));
13043 return () => vue.createVNode("div", {
13044 "class": bem$o([props2.direction]),
13045 "style": rootStyle.value
13046 }, [vue.createVNode("div", {
13047 "class": bem$o("box", {
13048 animate: props2.isStart
13049 })
13050 }, [Array.isArray(newFigureArr.value) && newFigureArr.value.map((figure) => vue.createVNode("div", {
13051 "class": bem$o("item"),
13052 "style": itemStyle.value
13053 }, [figure]))])]);
13054 }
13055});
13056const [name$o, bem$n] = createNamespace("rolling-text");
13057const rollingTextProps = {
13058 startNum: makeNumberProp(0),
13059 targetNum: Number,
13060 textList: makeArrayProp(),
13061 duration: makeNumberProp(2),
13062 autoStart: truthProp,
13063 direction: makeStringProp("down"),
13064 stopOrder: makeStringProp("ltr"),
13065 height: makeNumberProp(40)
13066};
13067const CIRCLE_NUM = 2;
13068var stdin_default$w = vue.defineComponent({
13069 name: name$o,
13070 props: rollingTextProps,
13071 setup(props2) {
13072 const isCustomType = vue.computed(() => Array.isArray(props2.textList) && props2.textList.length);
13073 const itemLength = vue.computed(() => {
13074 if (isCustomType.value)
13075 return props2.textList[0].length;
13076 return `${Math.max(props2.startNum, props2.targetNum)}`.length;
13077 });
13078 const getTextArrByIdx = (idx) => {
13079 const result = [];
13080 for (let i = 0; i < props2.textList.length; i++) {
13081 result.push(props2.textList[i][idx]);
13082 }
13083 return result;
13084 };
13085 const targetNumArr = vue.computed(() => {
13086 if (isCustomType.value)
13087 return new Array(itemLength.value).fill("");
13088 return padZero(props2.targetNum, itemLength.value).split("");
13089 });
13090 const startNumArr = vue.computed(() => padZero(props2.startNum, itemLength.value).split(""));
13091 const getFigureArr = (i) => {
13092 const start2 = +startNumArr.value[i];
13093 const target = +targetNumArr.value[i];
13094 const result = [];
13095 for (let i2 = start2; i2 <= 9; i2++) {
13096 result.push(i2);
13097 }
13098 for (let i2 = 0; i2 <= CIRCLE_NUM; i2++) {
13099 for (let j = 0; j <= 9; j++) {
13100 result.push(j);
13101 }
13102 }
13103 for (let i2 = 0; i2 <= target; i2++) {
13104 result.push(i2);
13105 }
13106 return result;
13107 };
13108 const getDelay = (i, len) => {
13109 if (props2.stopOrder === "ltr")
13110 return 0.2 * i;
13111 return 0.2 * (len - 1 - i);
13112 };
13113 const rolling = vue.ref(props2.autoStart);
13114 const start = () => {
13115 rolling.value = true;
13116 };
13117 const reset = () => {
13118 rolling.value = false;
13119 if (props2.autoStart) {
13120 use.raf(() => start());
13121 }
13122 };
13123 vue.watch(() => props2.autoStart, (value) => {
13124 if (value) {
13125 start();
13126 }
13127 });
13128 useExpose({
13129 start,
13130 reset
13131 });
13132 return () => vue.createVNode("div", {
13133 "class": bem$n()
13134 }, [targetNumArr.value.map((_, i) => vue.createVNode(stdin_default$x, {
13135 "figureArr": isCustomType.value ? getTextArrByIdx(i) : getFigureArr(i),
13136 "duration": props2.duration,
13137 "direction": props2.direction,
13138 "isStart": rolling.value,
13139 "height": props2.height,
13140 "delay": getDelay(i, itemLength.value)
13141 }, null))]);
13142 }
13143});
13144const RollingText = withInstall(stdin_default$w);
13145const Row = withInstall(stdin_default$17);
13146const [name$n, bem$m, t$4] = createNamespace("search");
13147const searchProps = extend({}, fieldSharedProps, {
13148 label: String,
13149 shape: makeStringProp("square"),
13150 leftIcon: makeStringProp("search"),
13151 clearable: truthProp,
13152 actionText: String,
13153 background: String,
13154 showAction: Boolean
13155});
13156var stdin_default$v = vue.defineComponent({
13157 name: name$n,
13158 props: searchProps,
13159 emits: ["blur", "focus", "clear", "search", "cancel", "clickInput", "clickLeftIcon", "clickRightIcon", "update:modelValue"],
13160 setup(props2, {
13161 emit,
13162 slots,
13163 attrs
13164 }) {
13165 const id = useId();
13166 const fieldRef = vue.ref();
13167 const onCancel = () => {
13168 if (!slots.action) {
13169 emit("update:modelValue", "");
13170 emit("cancel");
13171 }
13172 };
13173 const onKeypress = (event) => {
13174 const ENTER_CODE = 13;
13175 if (event.keyCode === ENTER_CODE) {
13176 preventDefault(event);
13177 emit("search", props2.modelValue);
13178 }
13179 };
13180 const getInputId = () => props2.id || `${id}-input`;
13181 const renderLabel = () => {
13182 if (slots.label || props2.label) {
13183 return vue.createVNode("label", {
13184 "class": bem$m("label"),
13185 "for": getInputId()
13186 }, [slots.label ? slots.label() : props2.label]);
13187 }
13188 };
13189 const renderAction = () => {
13190 if (props2.showAction) {
13191 const text = props2.actionText || t$4("cancel");
13192 return vue.createVNode("div", {
13193 "class": bem$m("action"),
13194 "role": "button",
13195 "tabindex": 0,
13196 "onClick": onCancel
13197 }, [slots.action ? slots.action() : text]);
13198 }
13199 };
13200 const blur = () => {
13201 var _a;
13202 return (_a = fieldRef.value) == null ? void 0 : _a.blur();
13203 };
13204 const focus = () => {
13205 var _a;
13206 return (_a = fieldRef.value) == null ? void 0 : _a.focus();
13207 };
13208 const onBlur = (event) => emit("blur", event);
13209 const onFocus = (event) => emit("focus", event);
13210 const onClear = (event) => emit("clear", event);
13211 const onClickInput = (event) => emit("clickInput", event);
13212 const onClickLeftIcon = (event) => emit("clickLeftIcon", event);
13213 const onClickRightIcon = (event) => emit("clickRightIcon", event);
13214 const fieldPropNames = Object.keys(fieldSharedProps);
13215 const renderField = () => {
13216 const fieldAttrs = extend({}, attrs, pick(props2, fieldPropNames), {
13217 id: getInputId()
13218 });
13219 const onInput = (value) => emit("update:modelValue", value);
13220 return vue.createVNode(Field, vue.mergeProps({
13221 "ref": fieldRef,
13222 "type": "search",
13223 "class": bem$m("field", {
13224 "with-message": fieldAttrs.errorMessage
13225 }),
13226 "border": false,
13227 "onBlur": onBlur,
13228 "onFocus": onFocus,
13229 "onClear": onClear,
13230 "onKeypress": onKeypress,
13231 "onClickInput": onClickInput,
13232 "onClickLeftIcon": onClickLeftIcon,
13233 "onClickRightIcon": onClickRightIcon,
13234 "onUpdate:modelValue": onInput
13235 }, fieldAttrs), pick(slots, ["left-icon", "right-icon"]));
13236 };
13237 useExpose({
13238 focus,
13239 blur
13240 });
13241 return () => {
13242 var _a;
13243 return vue.createVNode("div", {
13244 "class": bem$m({
13245 "show-action": props2.showAction
13246 }),
13247 "style": {
13248 background: props2.background
13249 }
13250 }, [(_a = slots.left) == null ? void 0 : _a.call(slots), vue.createVNode("div", {
13251 "class": bem$m("content", props2.shape)
13252 }, [renderLabel(), renderField()]), renderAction()]);
13253 };
13254 }
13255});
13256const Search = withInstall(stdin_default$v);
13257const isImage = (name2) => name2 == null ? void 0 : name2.includes("/");
13258const popupInheritKeys = [...popupSharedPropKeys, "round", "closeOnPopstate", "safeAreaInsetBottom"];
13259const iconMap = {
13260 qq: "qq",
13261 link: "link-o",
13262 weibo: "weibo",
13263 qrcode: "qr",
13264 poster: "photo-o",
13265 wechat: "wechat",
13266 "weapp-qrcode": "miniprogram-o",
13267 "wechat-moments": "wechat-moments"
13268};
13269const [name$m, bem$l, t$3] = createNamespace("share-sheet");
13270const shareSheetProps = extend({}, popupSharedProps, {
13271 title: String,
13272 round: truthProp,
13273 options: makeArrayProp(),
13274 cancelText: String,
13275 description: String,
13276 closeOnPopstate: truthProp,
13277 safeAreaInsetBottom: truthProp
13278});
13279var stdin_default$u = vue.defineComponent({
13280 name: name$m,
13281 props: shareSheetProps,
13282 emits: ["cancel", "select", "update:show"],
13283 setup(props2, {
13284 emit,
13285 slots
13286 }) {
13287 const updateShow = (value) => emit("update:show", value);
13288 const onCancel = () => {
13289 updateShow(false);
13290 emit("cancel");
13291 };
13292 const onSelect = (option, index) => emit("select", option, index);
13293 const renderHeader = () => {
13294 const title = slots.title ? slots.title() : props2.title;
13295 const description = slots.description ? slots.description() : props2.description;
13296 if (title || description) {
13297 return vue.createVNode("div", {
13298 "class": bem$l("header")
13299 }, [title && vue.createVNode("h2", {
13300 "class": bem$l("title")
13301 }, [title]), description && vue.createVNode("span", {
13302 "class": bem$l("description")
13303 }, [description])]);
13304 }
13305 };
13306 const renderIcon = (icon) => {
13307 if (isImage(icon)) {
13308 return vue.createVNode("img", {
13309 "src": icon,
13310 "class": bem$l("image-icon")
13311 }, null);
13312 }
13313 return vue.createVNode("div", {
13314 "class": bem$l("icon", [icon])
13315 }, [vue.createVNode(Icon, {
13316 "name": iconMap[icon] || icon
13317 }, null)]);
13318 };
13319 const renderOption = (option, index) => {
13320 const {
13321 name: name2,
13322 icon,
13323 className,
13324 description
13325 } = option;
13326 return vue.createVNode("div", {
13327 "role": "button",
13328 "tabindex": 0,
13329 "class": [bem$l("option"), className, HAPTICS_FEEDBACK],
13330 "onClick": () => onSelect(option, index)
13331 }, [renderIcon(icon), name2 && vue.createVNode("span", {
13332 "class": bem$l("name")
13333 }, [name2]), description && vue.createVNode("span", {
13334 "class": bem$l("option-description")
13335 }, [description])]);
13336 };
13337 const renderOptions = (options, border) => vue.createVNode("div", {
13338 "class": bem$l("options", {
13339 border
13340 })
13341 }, [options.map(renderOption)]);
13342 const renderRows = () => {
13343 const {
13344 options
13345 } = props2;
13346 if (Array.isArray(options[0])) {
13347 return options.map((item, index) => renderOptions(item, index !== 0));
13348 }
13349 return renderOptions(options);
13350 };
13351 const renderCancelButton = () => {
13352 var _a;
13353 const cancelText = (_a = props2.cancelText) != null ? _a : t$3("cancel");
13354 if (slots.cancel || cancelText) {
13355 return vue.createVNode("button", {
13356 "type": "button",
13357 "class": bem$l("cancel"),
13358 "onClick": onCancel
13359 }, [slots.cancel ? slots.cancel() : cancelText]);
13360 }
13361 };
13362 return () => vue.createVNode(Popup, vue.mergeProps({
13363 "class": bem$l(),
13364 "position": "bottom",
13365 "onUpdate:show": updateShow
13366 }, pick(props2, popupInheritKeys)), {
13367 default: () => [renderHeader(), renderRows(), renderCancelButton()]
13368 });
13369 }
13370});
13371const ShareSheet = withInstall(stdin_default$u);
13372const [name$l, bem$k] = createNamespace("sidebar");
13373const SIDEBAR_KEY = Symbol(name$l);
13374const sidebarProps = {
13375 modelValue: makeNumericProp(0)
13376};
13377var stdin_default$t = vue.defineComponent({
13378 name: name$l,
13379 props: sidebarProps,
13380 emits: ["change", "update:modelValue"],
13381 setup(props2, {
13382 emit,
13383 slots
13384 }) {
13385 const {
13386 linkChildren
13387 } = use.useChildren(SIDEBAR_KEY);
13388 const getActive = () => +props2.modelValue;
13389 const setActive = (value) => {
13390 if (value !== getActive()) {
13391 emit("update:modelValue", value);
13392 emit("change", value);
13393 }
13394 };
13395 linkChildren({
13396 getActive,
13397 setActive
13398 });
13399 return () => {
13400 var _a;
13401 return vue.createVNode("div", {
13402 "role": "tablist",
13403 "class": bem$k()
13404 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
13405 };
13406 }
13407});
13408const Sidebar = withInstall(stdin_default$t);
13409const [name$k, bem$j] = createNamespace("sidebar-item");
13410const sidebarItemProps = extend({}, routeProps, {
13411 dot: Boolean,
13412 title: String,
13413 badge: numericProp,
13414 disabled: Boolean,
13415 badgeProps: Object
13416});
13417var stdin_default$s = vue.defineComponent({
13418 name: name$k,
13419 props: sidebarItemProps,
13420 emits: ["click"],
13421 setup(props2, {
13422 emit,
13423 slots
13424 }) {
13425 const route2 = useRoute();
13426 const {
13427 parent,
13428 index
13429 } = use.useParent(SIDEBAR_KEY);
13430 if (!parent) {
13431 if (process.env.NODE_ENV !== "production") {
13432 console.error("[Vant] <SidebarItem> must be a child component of <Sidebar>.");
13433 }
13434 return;
13435 }
13436 const onClick = () => {
13437 if (props2.disabled) {
13438 return;
13439 }
13440 emit("click", index.value);
13441 parent.setActive(index.value);
13442 route2();
13443 };
13444 return () => {
13445 const {
13446 dot,
13447 badge,
13448 title,
13449 disabled
13450 } = props2;
13451 const selected = index.value === parent.getActive();
13452 return vue.createVNode("div", {
13453 "role": "tab",
13454 "class": bem$j({
13455 select: selected,
13456 disabled
13457 }),
13458 "tabindex": disabled ? void 0 : 0,
13459 "aria-selected": selected,
13460 "onClick": onClick
13461 }, [vue.createVNode(Badge, vue.mergeProps({
13462 "dot": dot,
13463 "class": bem$j("text"),
13464 "content": badge
13465 }, props2.badgeProps), {
13466 default: () => [slots.title ? slots.title() : title]
13467 })]);
13468 };
13469 }
13470});
13471const SidebarItem = withInstall(stdin_default$s);
13472const [name$j, bem$i, t$2] = createNamespace("signature");
13473const signatureProps = {
13474 tips: String,
13475 type: makeStringProp("png"),
13476 penColor: makeStringProp("#000"),
13477 lineWidth: makeNumberProp(3),
13478 clearButtonText: String,
13479 backgroundColor: makeStringProp(""),
13480 confirmButtonText: String
13481};
13482const hasCanvasSupport = () => {
13483 var _a;
13484 const canvas = document.createElement("canvas");
13485 return !!((_a = canvas.getContext) == null ? void 0 : _a.call(canvas, "2d"));
13486};
13487var stdin_default$r = vue.defineComponent({
13488 name: name$j,
13489 props: signatureProps,
13490 emits: ["submit", "clear", "start", "end", "signing"],
13491 setup(props2, {
13492 emit
13493 }) {
13494 const canvasRef = vue.ref();
13495 const wrapRef = vue.ref();
13496 const ctx = vue.computed(() => {
13497 if (!canvasRef.value)
13498 return null;
13499 return canvasRef.value.getContext("2d");
13500 });
13501 const isRenderCanvas = inBrowser ? hasCanvasSupport() : true;
13502 let canvasWidth = 0;
13503 let canvasHeight = 0;
13504 let canvasRect;
13505 const touchStart = () => {
13506 if (!ctx.value) {
13507 return false;
13508 }
13509 ctx.value.beginPath();
13510 ctx.value.lineWidth = props2.lineWidth;
13511 ctx.value.strokeStyle = props2.penColor;
13512 canvasRect = use.useRect(canvasRef);
13513 emit("start");
13514 };
13515 const touchMove = (event) => {
13516 if (!ctx.value) {
13517 return false;
13518 }
13519 preventDefault(event);
13520 const touch = event.touches[0];
13521 const mouseX = touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0);
13522 const mouseY = touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0);
13523 ctx.value.lineCap = "round";
13524 ctx.value.lineJoin = "round";
13525 ctx.value.lineTo(mouseX, mouseY);
13526 ctx.value.stroke();
13527 emit("signing", event);
13528 };
13529 const touchEnd = (event) => {
13530 preventDefault(event);
13531 emit("end");
13532 };
13533 const isCanvasEmpty = (canvas) => {
13534 const empty = document.createElement("canvas");
13535 empty.width = canvas.width;
13536 empty.height = canvas.height;
13537 if (props2.backgroundColor) {
13538 const emptyCtx = empty.getContext("2d");
13539 setCanvasBgColor(emptyCtx);
13540 }
13541 return canvas.toDataURL() === empty.toDataURL();
13542 };
13543 const setCanvasBgColor = (ctx2) => {
13544 if (ctx2 && props2.backgroundColor) {
13545 ctx2.fillStyle = props2.backgroundColor;
13546 ctx2.fillRect(0, 0, canvasWidth, canvasHeight);
13547 }
13548 };
13549 const submit = () => {
13550 var _a, _b;
13551 const canvas = canvasRef.value;
13552 if (!canvas) {
13553 return;
13554 }
13555 const isEmpty = isCanvasEmpty(canvas);
13556 const image = isEmpty ? "" : ((_b = (_a = {
13557 jpg: () => canvas.toDataURL("image/jpeg", 0.8),
13558 jpeg: () => canvas.toDataURL("image/jpeg", 0.8)
13559 })[props2.type]) == null ? void 0 : _b.call(_a)) || canvas.toDataURL(`image/${props2.type}`);
13560 emit("submit", {
13561 image,
13562 canvas
13563 });
13564 };
13565 const clear = () => {
13566 if (ctx.value) {
13567 ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
13568 ctx.value.closePath();
13569 setCanvasBgColor(ctx.value);
13570 }
13571 emit("clear");
13572 };
13573 const initialize = () => {
13574 var _a, _b, _c;
13575 if (isRenderCanvas && canvasRef.value) {
13576 const canvas = canvasRef.value;
13577 const dpr = inBrowser ? window.devicePixelRatio : 1;
13578 canvasWidth = canvas.width = (((_a = wrapRef.value) == null ? void 0 : _a.offsetWidth) || 0) * dpr;
13579 canvasHeight = canvas.height = (((_b = wrapRef.value) == null ? void 0 : _b.offsetHeight) || 0) * dpr;
13580 (_c = ctx.value) == null ? void 0 : _c.scale(dpr, dpr);
13581 setCanvasBgColor(ctx.value);
13582 }
13583 };
13584 const resize = () => {
13585 if (ctx.value) {
13586 const data = ctx.value.getImageData(0, 0, canvasWidth, canvasHeight);
13587 initialize();
13588 ctx.value.putImageData(data, 0, 0);
13589 }
13590 };
13591 vue.watch(windowWidth, resize);
13592 vue.onMounted(initialize);
13593 useExpose({
13594 resize,
13595 clear,
13596 submit
13597 });
13598 return () => vue.createVNode("div", {
13599 "class": bem$i()
13600 }, [vue.createVNode("div", {
13601 "class": bem$i("content"),
13602 "ref": wrapRef
13603 }, [isRenderCanvas ? vue.createVNode("canvas", {
13604 "ref": canvasRef,
13605 "onTouchstartPassive": touchStart,
13606 "onTouchmove": touchMove,
13607 "onTouchend": touchEnd
13608 }, null) : vue.createVNode("p", null, [props2.tips])]), vue.createVNode("div", {
13609 "class": bem$i("footer")
13610 }, [vue.createVNode(Button, {
13611 "size": "small",
13612 "onClick": clear
13613 }, {
13614 default: () => [props2.clearButtonText || t$2("clear")]
13615 }), vue.createVNode(Button, {
13616 "type": "primary",
13617 "size": "small",
13618 "onClick": submit
13619 }, {
13620 default: () => [props2.confirmButtonText || t$2("confirm")]
13621 })])]);
13622 }
13623});
13624const Signature = withInstall(stdin_default$r);
13625const [name$i, bem$h] = createNamespace("skeleton-title");
13626const skeletonTitleProps = {
13627 round: Boolean,
13628 titleWidth: numericProp
13629};
13630var stdin_default$q = vue.defineComponent({
13631 name: name$i,
13632 props: skeletonTitleProps,
13633 setup(props2) {
13634 return () => vue.createVNode("h3", {
13635 "class": bem$h([{
13636 round: props2.round
13637 }]),
13638 "style": {
13639 width: addUnit(props2.titleWidth)
13640 }
13641 }, null);
13642 }
13643});
13644const SkeletonTitle = withInstall(stdin_default$q);
13645var stdin_default$p = SkeletonTitle;
13646const [name$h, bem$g] = createNamespace("skeleton-avatar");
13647const skeletonAvatarProps = {
13648 avatarSize: numericProp,
13649 avatarShape: makeStringProp("round")
13650};
13651var stdin_default$o = vue.defineComponent({
13652 name: name$h,
13653 props: skeletonAvatarProps,
13654 setup(props2) {
13655 return () => vue.createVNode("div", {
13656 "class": bem$g([props2.avatarShape]),
13657 "style": getSizeStyle(props2.avatarSize)
13658 }, null);
13659 }
13660});
13661const SkeletonAvatar = withInstall(stdin_default$o);
13662var stdin_default$n = SkeletonAvatar;
13663const DEFAULT_ROW_WIDTH = "100%";
13664const skeletonParagraphProps = {
13665 round: Boolean,
13666 rowWidth: {
13667 type: numericProp,
13668 default: DEFAULT_ROW_WIDTH
13669 }
13670};
13671const [name$g, bem$f] = createNamespace("skeleton-paragraph");
13672var stdin_default$m = vue.defineComponent({
13673 name: name$g,
13674 props: skeletonParagraphProps,
13675 setup(props2) {
13676 return () => vue.createVNode("div", {
13677 "class": bem$f([{
13678 round: props2.round
13679 }]),
13680 "style": {
13681 width: props2.rowWidth
13682 }
13683 }, null);
13684 }
13685});
13686const SkeletonParagraph = withInstall(stdin_default$m);
13687var stdin_default$l = SkeletonParagraph;
13688const [name$f, bem$e] = createNamespace("skeleton");
13689const DEFAULT_LAST_ROW_WIDTH = "60%";
13690const skeletonProps = {
13691 row: makeNumericProp(0),
13692 round: Boolean,
13693 title: Boolean,
13694 titleWidth: numericProp,
13695 avatar: Boolean,
13696 avatarSize: numericProp,
13697 avatarShape: makeStringProp("round"),
13698 loading: truthProp,
13699 animate: truthProp,
13700 rowWidth: {
13701 type: [Number, String, Array],
13702 default: DEFAULT_ROW_WIDTH
13703 }
13704};
13705var stdin_default$k = vue.defineComponent({
13706 name: name$f,
13707 inheritAttrs: false,
13708 props: skeletonProps,
13709 setup(props2, {
13710 slots,
13711 attrs
13712 }) {
13713 const renderAvatar = () => {
13714 if (props2.avatar) {
13715 return vue.createVNode(stdin_default$n, {
13716 "avatarShape": props2.avatarShape,
13717 "avatarSize": props2.avatarSize
13718 }, null);
13719 }
13720 };
13721 const renderTitle = () => {
13722 if (props2.title) {
13723 return vue.createVNode(stdin_default$p, {
13724 "round": props2.round,
13725 "titleWidth": props2.titleWidth
13726 }, null);
13727 }
13728 };
13729 const getRowWidth = (index) => {
13730 const {
13731 rowWidth
13732 } = props2;
13733 if (rowWidth === DEFAULT_ROW_WIDTH && index === +props2.row - 1) {
13734 return DEFAULT_LAST_ROW_WIDTH;
13735 }
13736 if (Array.isArray(rowWidth)) {
13737 return rowWidth[index];
13738 }
13739 return rowWidth;
13740 };
13741 const renderRows = () => Array(+props2.row).fill("").map((_, i) => vue.createVNode(stdin_default$l, {
13742 "key": i,
13743 "round": props2.round,
13744 "rowWidth": addUnit(getRowWidth(i))
13745 }, null));
13746 const renderContents = () => {
13747 if (slots.template) {
13748 return slots.template();
13749 }
13750 return vue.createVNode(vue.Fragment, null, [renderAvatar(), vue.createVNode("div", {
13751 "class": bem$e("content")
13752 }, [renderTitle(), renderRows()])]);
13753 };
13754 return () => {
13755 var _a;
13756 if (!props2.loading) {
13757 return (_a = slots.default) == null ? void 0 : _a.call(slots);
13758 }
13759 return vue.createVNode("div", vue.mergeProps({
13760 "class": bem$e({
13761 animate: props2.animate,
13762 round: props2.round
13763 })
13764 }, attrs), [renderContents()]);
13765 };
13766 }
13767});
13768const Skeleton = withInstall(stdin_default$k);
13769const [name$e, bem$d] = createNamespace("skeleton-image");
13770const skeletonImageProps = {
13771 imageSize: numericProp,
13772 imageShape: makeStringProp("square")
13773};
13774var stdin_default$j = vue.defineComponent({
13775 name: name$e,
13776 props: skeletonImageProps,
13777 setup(props2) {
13778 return () => vue.createVNode("div", {
13779 "class": bem$d([props2.imageShape]),
13780 "style": getSizeStyle(props2.imageSize)
13781 }, [vue.createVNode(Icon, {
13782 "name": "photo",
13783 "class": bem$d("icon")
13784 }, null)]);
13785 }
13786});
13787const SkeletonImage = withInstall(stdin_default$j);
13788const [name$d, bem$c] = createNamespace("slider");
13789const sliderProps = {
13790 min: makeNumericProp(0),
13791 max: makeNumericProp(100),
13792 step: makeNumericProp(1),
13793 range: Boolean,
13794 reverse: Boolean,
13795 disabled: Boolean,
13796 readonly: Boolean,
13797 vertical: Boolean,
13798 barHeight: numericProp,
13799 buttonSize: numericProp,
13800 activeColor: String,
13801 inactiveColor: String,
13802 modelValue: {
13803 type: [Number, Array],
13804 default: 0
13805 }
13806};
13807var stdin_default$i = vue.defineComponent({
13808 name: name$d,
13809 props: sliderProps,
13810 emits: ["change", "dragEnd", "dragStart", "update:modelValue"],
13811 setup(props2, {
13812 emit,
13813 slots
13814 }) {
13815 let buttonIndex;
13816 let current2;
13817 let startValue;
13818 const root = vue.ref();
13819 const slider = [vue.ref(), vue.ref()];
13820 const dragStatus = vue.ref();
13821 const touch = useTouch();
13822 const scope = vue.computed(() => Number(props2.max) - Number(props2.min));
13823 const wrapperStyle = vue.computed(() => {
13824 const crossAxis = props2.vertical ? "width" : "height";
13825 return {
13826 background: props2.inactiveColor,
13827 [crossAxis]: addUnit(props2.barHeight)
13828 };
13829 });
13830 const isRange = (val) => props2.range && Array.isArray(val);
13831 const calcMainAxis = () => {
13832 const {
13833 modelValue,
13834 min
13835 } = props2;
13836 if (isRange(modelValue)) {
13837 return `${(modelValue[1] - modelValue[0]) * 100 / scope.value}%`;
13838 }
13839 return `${(modelValue - Number(min)) * 100 / scope.value}%`;
13840 };
13841 const calcOffset = () => {
13842 const {
13843 modelValue,
13844 min
13845 } = props2;
13846 if (isRange(modelValue)) {
13847 return `${(modelValue[0] - Number(min)) * 100 / scope.value}%`;
13848 }
13849 return "0%";
13850 };
13851 const barStyle = vue.computed(() => {
13852 const mainAxis = props2.vertical ? "height" : "width";
13853 const style = {
13854 [mainAxis]: calcMainAxis(),
13855 background: props2.activeColor
13856 };
13857 if (dragStatus.value) {
13858 style.transition = "none";
13859 }
13860 const getPositionKey = () => {
13861 if (props2.vertical) {
13862 return props2.reverse ? "bottom" : "top";
13863 }
13864 return props2.reverse ? "right" : "left";
13865 };
13866 style[getPositionKey()] = calcOffset();
13867 return style;
13868 });
13869 const format2 = (value) => {
13870 const min = +props2.min;
13871 const max = +props2.max;
13872 const step = +props2.step;
13873 value = clamp(value, min, max);
13874 const diff = Math.round((value - min) / step) * step;
13875 return addNumber(min, diff);
13876 };
13877 const updateStartValue = () => {
13878 const current22 = props2.modelValue;
13879 if (isRange(current22)) {
13880 startValue = current22.map(format2);
13881 } else {
13882 startValue = format2(current22);
13883 }
13884 };
13885 const handleRangeValue = (value) => {
13886 var _a, _b;
13887 const left = (_a = value[0]) != null ? _a : Number(props2.min);
13888 const right = (_b = value[1]) != null ? _b : Number(props2.max);
13889 return left > right ? [right, left] : [left, right];
13890 };
13891 const updateValue = (value, end) => {
13892 if (isRange(value)) {
13893 value = handleRangeValue(value).map(format2);
13894 } else {
13895 value = format2(value);
13896 }
13897 if (!isSameValue(value, props2.modelValue)) {
13898 emit("update:modelValue", value);
13899 }
13900 if (end && !isSameValue(value, startValue)) {
13901 emit("change", value);
13902 }
13903 };
13904 const onClick = (event) => {
13905 event.stopPropagation();
13906 if (props2.disabled || props2.readonly) {
13907 return;
13908 }
13909 updateStartValue();
13910 const {
13911 min,
13912 reverse,
13913 vertical,
13914 modelValue
13915 } = props2;
13916 const rect = use.useRect(root);
13917 const getDelta = () => {
13918 if (vertical) {
13919 if (reverse) {
13920 return rect.bottom - event.clientY;
13921 }
13922 return event.clientY - rect.top;
13923 }
13924 if (reverse) {
13925 return rect.right - event.clientX;
13926 }
13927 return event.clientX - rect.left;
13928 };
13929 const total = vertical ? rect.height : rect.width;
13930 const value = Number(min) + getDelta() / total * scope.value;
13931 if (isRange(modelValue)) {
13932 const [left, right] = modelValue;
13933 const middle = (left + right) / 2;
13934 if (value <= middle) {
13935 updateValue([value, right], true);
13936 } else {
13937 updateValue([left, value], true);
13938 }
13939 } else {
13940 updateValue(value, true);
13941 }
13942 };
13943 const onTouchStart = (event) => {
13944 if (props2.disabled || props2.readonly) {
13945 return;
13946 }
13947 touch.start(event);
13948 current2 = props2.modelValue;
13949 updateStartValue();
13950 dragStatus.value = "start";
13951 };
13952 const onTouchMove = (event) => {
13953 if (props2.disabled || props2.readonly) {
13954 return;
13955 }
13956 if (dragStatus.value === "start") {
13957 emit("dragStart", event);
13958 }
13959 preventDefault(event, true);
13960 touch.move(event);
13961 dragStatus.value = "dragging";
13962 const rect = use.useRect(root);
13963 const delta = props2.vertical ? touch.deltaY.value : touch.deltaX.value;
13964 const total = props2.vertical ? rect.height : rect.width;
13965 let diff = delta / total * scope.value;
13966 if (props2.reverse) {
13967 diff = -diff;
13968 }
13969 if (isRange(startValue)) {
13970 const index = props2.reverse ? 1 - buttonIndex : buttonIndex;
13971 current2[index] = startValue[index] + diff;
13972 } else {
13973 current2 = startValue + diff;
13974 }
13975 updateValue(current2);
13976 };
13977 const onTouchEnd = (event) => {
13978 if (props2.disabled || props2.readonly) {
13979 return;
13980 }
13981 if (dragStatus.value === "dragging") {
13982 updateValue(current2, true);
13983 emit("dragEnd", event);
13984 }
13985 dragStatus.value = "";
13986 };
13987 const getButtonClassName = (index) => {
13988 if (typeof index === "number") {
13989 const position = ["left", "right"];
13990 return bem$c(`button-wrapper`, position[index]);
13991 }
13992 return bem$c("button-wrapper", props2.reverse ? "left" : "right");
13993 };
13994 const renderButtonContent = (value, index) => {
13995 const dragging = dragStatus.value === "dragging";
13996 if (typeof index === "number") {
13997 const slot = slots[index === 0 ? "left-button" : "right-button"];
13998 let dragIndex;
13999 if (dragging && Array.isArray(current2)) {
14000 dragIndex = current2[0] > current2[1] ? buttonIndex ^ 1 : buttonIndex;
14001 }
14002 if (slot) {
14003 return slot({
14004 value,
14005 dragging,
14006 dragIndex
14007 });
14008 }
14009 }
14010 if (slots.button) {
14011 return slots.button({
14012 value,
14013 dragging
14014 });
14015 }
14016 return vue.createVNode("div", {
14017 "class": bem$c("button"),
14018 "style": getSizeStyle(props2.buttonSize)
14019 }, null);
14020 };
14021 const renderButton = (index) => {
14022 const current22 = typeof index === "number" ? props2.modelValue[index] : props2.modelValue;
14023 return vue.createVNode("div", {
14024 "ref": slider[index != null ? index : 0],
14025 "role": "slider",
14026 "class": getButtonClassName(index),
14027 "tabindex": props2.disabled ? void 0 : 0,
14028 "aria-valuemin": props2.min,
14029 "aria-valuenow": current22,
14030 "aria-valuemax": props2.max,
14031 "aria-disabled": props2.disabled || void 0,
14032 "aria-readonly": props2.readonly || void 0,
14033 "aria-orientation": props2.vertical ? "vertical" : "horizontal",
14034 "onTouchstartPassive": (event) => {
14035 if (typeof index === "number") {
14036 buttonIndex = index;
14037 }
14038 onTouchStart(event);
14039 },
14040 "onTouchend": onTouchEnd,
14041 "onTouchcancel": onTouchEnd,
14042 "onClick": stopPropagation
14043 }, [renderButtonContent(current22, index)]);
14044 };
14045 updateValue(props2.modelValue);
14046 use.useCustomFieldValue(() => props2.modelValue);
14047 slider.forEach((item) => {
14048 use.useEventListener("touchmove", onTouchMove, {
14049 target: item
14050 });
14051 });
14052 return () => vue.createVNode("div", {
14053 "ref": root,
14054 "style": wrapperStyle.value,
14055 "class": bem$c({
14056 vertical: props2.vertical,
14057 disabled: props2.disabled
14058 }),
14059 "onClick": onClick
14060 }, [vue.createVNode("div", {
14061 "class": bem$c("bar"),
14062 "style": barStyle.value
14063 }, [props2.range ? [renderButton(0), renderButton(1)] : renderButton()])]);
14064 }
14065});
14066const Slider = withInstall(stdin_default$i);
14067const [name$c, bem$b] = createNamespace("space");
14068const spaceProps = {
14069 align: String,
14070 direction: {
14071 type: String,
14072 default: "horizontal"
14073 },
14074 size: {
14075 type: [Number, String, Array],
14076 default: 8
14077 },
14078 wrap: Boolean,
14079 fill: Boolean
14080};
14081function filterEmpty(children = []) {
14082 const nodes = [];
14083 children.forEach((child) => {
14084 if (Array.isArray(child)) {
14085 nodes.push(...child);
14086 } else if (child.type === vue.Fragment) {
14087 nodes.push(...filterEmpty(child.children));
14088 } else {
14089 nodes.push(child);
14090 }
14091 });
14092 return nodes.filter((c) => {
14093 var _a;
14094 return !(c && (c.type === vue.Comment || c.type === vue.Fragment && ((_a = c.children) == null ? void 0 : _a.length) === 0 || c.type === vue.Text && c.children.trim() === ""));
14095 });
14096}
14097var stdin_default$h = vue.defineComponent({
14098 name: name$c,
14099 props: spaceProps,
14100 setup(props2, {
14101 slots
14102 }) {
14103 const mergedAlign = vue.computed(() => {
14104 var _a;
14105 return (_a = props2.align) != null ? _a : props2.direction === "horizontal" ? "center" : "";
14106 });
14107 const getMargin = (size) => {
14108 if (typeof size === "number") {
14109 return size + "px";
14110 }
14111 return size;
14112 };
14113 const getMarginStyle = (isLast) => {
14114 const style = {};
14115 const marginRight = `${getMargin(Array.isArray(props2.size) ? props2.size[0] : props2.size)}`;
14116 const marginBottom = `${getMargin(Array.isArray(props2.size) ? props2.size[1] : props2.size)}`;
14117 if (isLast) {
14118 return props2.wrap ? {
14119 marginBottom
14120 } : {};
14121 }
14122 if (props2.direction === "horizontal") {
14123 style.marginRight = marginRight;
14124 }
14125 if (props2.direction === "vertical" || props2.wrap) {
14126 style.marginBottom = marginBottom;
14127 }
14128 return style;
14129 };
14130 return () => {
14131 var _a;
14132 const children = filterEmpty((_a = slots.default) == null ? void 0 : _a.call(slots));
14133 return vue.createVNode("div", {
14134 "class": [bem$b({
14135 [props2.direction]: props2.direction,
14136 [`align-${mergedAlign.value}`]: mergedAlign.value,
14137 wrap: props2.wrap,
14138 fill: props2.fill
14139 })]
14140 }, [children.map((c, i) => vue.createVNode("div", {
14141 "key": `item-${i}`,
14142 "class": `${name$c}-item`,
14143 "style": getMarginStyle(i === children.length - 1)
14144 }, [c]))]);
14145 };
14146 }
14147});
14148const Space = withInstall(stdin_default$h);
14149const [name$b, bem$a] = createNamespace("steps");
14150const stepsProps = {
14151 active: makeNumericProp(0),
14152 direction: makeStringProp("horizontal"),
14153 activeIcon: makeStringProp("checked"),
14154 iconPrefix: String,
14155 finishIcon: String,
14156 activeColor: String,
14157 inactiveIcon: String,
14158 inactiveColor: String
14159};
14160const STEPS_KEY = Symbol(name$b);
14161var stdin_default$g = vue.defineComponent({
14162 name: name$b,
14163 props: stepsProps,
14164 emits: ["clickStep"],
14165 setup(props2, {
14166 emit,
14167 slots
14168 }) {
14169 const {
14170 linkChildren
14171 } = use.useChildren(STEPS_KEY);
14172 const onClickStep = (index) => emit("clickStep", index);
14173 linkChildren({
14174 props: props2,
14175 onClickStep
14176 });
14177 return () => {
14178 var _a;
14179 return vue.createVNode("div", {
14180 "class": bem$a([props2.direction])
14181 }, [vue.createVNode("div", {
14182 "class": bem$a("items")
14183 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
14184 };
14185 }
14186});
14187const [name$a, bem$9] = createNamespace("step");
14188var stdin_default$f = vue.defineComponent({
14189 name: name$a,
14190 setup(props2, {
14191 slots
14192 }) {
14193 const {
14194 parent,
14195 index
14196 } = use.useParent(STEPS_KEY);
14197 if (!parent) {
14198 if (process.env.NODE_ENV !== "production") {
14199 console.error("[Vant] <Step> must be a child component of <Steps>.");
14200 }
14201 return;
14202 }
14203 const parentProps = parent.props;
14204 const getStatus = () => {
14205 const active = +parentProps.active;
14206 if (index.value < active) {
14207 return "finish";
14208 }
14209 return index.value === active ? "process" : "waiting";
14210 };
14211 const isActive = () => getStatus() === "process";
14212 const lineStyle = vue.computed(() => ({
14213 background: getStatus() === "finish" ? parentProps.activeColor : parentProps.inactiveColor
14214 }));
14215 const titleStyle = vue.computed(() => {
14216 if (isActive()) {
14217 return {
14218 color: parentProps.activeColor
14219 };
14220 }
14221 if (getStatus() === "waiting") {
14222 return {
14223 color: parentProps.inactiveColor
14224 };
14225 }
14226 });
14227 const onClickStep = () => parent.onClickStep(index.value);
14228 const renderCircle = () => {
14229 const {
14230 iconPrefix,
14231 finishIcon,
14232 activeIcon,
14233 activeColor,
14234 inactiveIcon
14235 } = parentProps;
14236 if (isActive()) {
14237 if (slots["active-icon"]) {
14238 return slots["active-icon"]();
14239 }
14240 return vue.createVNode(Icon, {
14241 "class": bem$9("icon", "active"),
14242 "name": activeIcon,
14243 "color": activeColor,
14244 "classPrefix": iconPrefix
14245 }, null);
14246 }
14247 if (getStatus() === "finish" && (finishIcon || slots["finish-icon"])) {
14248 if (slots["finish-icon"]) {
14249 return slots["finish-icon"]();
14250 }
14251 return vue.createVNode(Icon, {
14252 "class": bem$9("icon", "finish"),
14253 "name": finishIcon,
14254 "color": activeColor,
14255 "classPrefix": iconPrefix
14256 }, null);
14257 }
14258 if (slots["inactive-icon"]) {
14259 return slots["inactive-icon"]();
14260 }
14261 if (inactiveIcon) {
14262 return vue.createVNode(Icon, {
14263 "class": bem$9("icon"),
14264 "name": inactiveIcon,
14265 "classPrefix": iconPrefix
14266 }, null);
14267 }
14268 return vue.createVNode("i", {
14269 "class": bem$9("circle"),
14270 "style": lineStyle.value
14271 }, null);
14272 };
14273 return () => {
14274 var _a;
14275 const status = getStatus();
14276 return vue.createVNode("div", {
14277 "class": [BORDER, bem$9([parentProps.direction, {
14278 [status]: status
14279 }])]
14280 }, [vue.createVNode("div", {
14281 "class": bem$9("title", {
14282 active: isActive()
14283 }),
14284 "style": titleStyle.value,
14285 "onClick": onClickStep
14286 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), vue.createVNode("div", {
14287 "class": bem$9("circle-container"),
14288 "onClick": onClickStep
14289 }, [renderCircle()]), vue.createVNode("div", {
14290 "class": bem$9("line"),
14291 "style": lineStyle.value
14292 }, null)]);
14293 };
14294 }
14295});
14296const Step = withInstall(stdin_default$f);
14297const [name$9, bem$8] = createNamespace("stepper");
14298const LONG_PRESS_INTERVAL = 200;
14299const isEqual = (value1, value2) => String(value1) === String(value2);
14300const stepperProps = {
14301 min: makeNumericProp(1),
14302 max: makeNumericProp(Infinity),
14303 name: makeNumericProp(""),
14304 step: makeNumericProp(1),
14305 theme: String,
14306 integer: Boolean,
14307 disabled: Boolean,
14308 showPlus: truthProp,
14309 showMinus: truthProp,
14310 showInput: truthProp,
14311 longPress: truthProp,
14312 autoFixed: truthProp,
14313 allowEmpty: Boolean,
14314 modelValue: numericProp,
14315 inputWidth: numericProp,
14316 buttonSize: numericProp,
14317 placeholder: String,
14318 disablePlus: Boolean,
14319 disableMinus: Boolean,
14320 disableInput: Boolean,
14321 beforeChange: Function,
14322 defaultValue: makeNumericProp(1),
14323 decimalLength: numericProp
14324};
14325var stdin_default$e = vue.defineComponent({
14326 name: name$9,
14327 props: stepperProps,
14328 emits: ["plus", "blur", "minus", "focus", "change", "overlimit", "update:modelValue"],
14329 setup(props2, {
14330 emit
14331 }) {
14332 const format2 = (value, autoFixed = true) => {
14333 const {
14334 min,
14335 max,
14336 allowEmpty,
14337 decimalLength
14338 } = props2;
14339 if (allowEmpty && value === "") {
14340 return value;
14341 }
14342 value = formatNumber(String(value), !props2.integer);
14343 value = value === "" ? 0 : +value;
14344 value = Number.isNaN(value) ? +min : value;
14345 value = autoFixed ? Math.max(Math.min(+max, value), +min) : value;
14346 if (isDef(decimalLength)) {
14347 value = value.toFixed(+decimalLength);
14348 }
14349 return value;
14350 };
14351 const getInitialValue = () => {
14352 var _a;
14353 const defaultValue = (_a = props2.modelValue) != null ? _a : props2.defaultValue;
14354 const value = format2(defaultValue);
14355 if (!isEqual(value, props2.modelValue)) {
14356 emit("update:modelValue", value);
14357 }
14358 return value;
14359 };
14360 let actionType;
14361 const inputRef = vue.ref();
14362 const current2 = vue.ref(getInitialValue());
14363 const minusDisabled = vue.computed(() => props2.disabled || props2.disableMinus || +current2.value <= +props2.min);
14364 const plusDisabled = vue.computed(() => props2.disabled || props2.disablePlus || +current2.value >= +props2.max);
14365 const inputStyle = vue.computed(() => ({
14366 width: addUnit(props2.inputWidth),
14367 height: addUnit(props2.buttonSize)
14368 }));
14369 const buttonStyle = vue.computed(() => getSizeStyle(props2.buttonSize));
14370 const check = () => {
14371 const value = format2(current2.value);
14372 if (!isEqual(value, current2.value)) {
14373 current2.value = value;
14374 }
14375 };
14376 const setValue = (value) => {
14377 if (props2.beforeChange) {
14378 callInterceptor(props2.beforeChange, {
14379 args: [value],
14380 done() {
14381 current2.value = value;
14382 }
14383 });
14384 } else {
14385 current2.value = value;
14386 }
14387 };
14388 const onChange = () => {
14389 if (actionType === "plus" && plusDisabled.value || actionType === "minus" && minusDisabled.value) {
14390 emit("overlimit", actionType);
14391 return;
14392 }
14393 const diff = actionType === "minus" ? -props2.step : +props2.step;
14394 const value = format2(addNumber(+current2.value, diff));
14395 setValue(value);
14396 emit(actionType);
14397 };
14398 const onInput = (event) => {
14399 const input = event.target;
14400 const {
14401 value
14402 } = input;
14403 const {
14404 decimalLength
14405 } = props2;
14406 let formatted = formatNumber(String(value), !props2.integer);
14407 if (isDef(decimalLength) && formatted.includes(".")) {
14408 const pair = formatted.split(".");
14409 formatted = `${pair[0]}.${pair[1].slice(0, +decimalLength)}`;
14410 }
14411 if (props2.beforeChange) {
14412 input.value = String(current2.value);
14413 } else if (!isEqual(value, formatted)) {
14414 input.value = formatted;
14415 }
14416 const isNumeric2 = formatted === String(+formatted);
14417 setValue(isNumeric2 ? +formatted : formatted);
14418 };
14419 const onFocus = (event) => {
14420 var _a;
14421 if (props2.disableInput) {
14422 (_a = inputRef.value) == null ? void 0 : _a.blur();
14423 } else {
14424 emit("focus", event);
14425 }
14426 };
14427 const onBlur = (event) => {
14428 const input = event.target;
14429 const value = format2(input.value, props2.autoFixed);
14430 input.value = String(value);
14431 current2.value = value;
14432 vue.nextTick(() => {
14433 emit("blur", event);
14434 resetScroll();
14435 });
14436 };
14437 let isLongPress;
14438 let longPressTimer;
14439 const longPressStep = () => {
14440 longPressTimer = setTimeout(() => {
14441 onChange();
14442 longPressStep();
14443 }, LONG_PRESS_INTERVAL);
14444 };
14445 const onTouchStart = () => {
14446 if (props2.longPress) {
14447 isLongPress = false;
14448 clearTimeout(longPressTimer);
14449 longPressTimer = setTimeout(() => {
14450 isLongPress = true;
14451 onChange();
14452 longPressStep();
14453 }, LONG_PRESS_START_TIME);
14454 }
14455 };
14456 const onTouchEnd = (event) => {
14457 if (props2.longPress) {
14458 clearTimeout(longPressTimer);
14459 if (isLongPress) {
14460 preventDefault(event);
14461 }
14462 }
14463 };
14464 const onMousedown = (event) => {
14465 if (props2.disableInput) {
14466 preventDefault(event);
14467 }
14468 };
14469 const createListeners = (type) => ({
14470 onClick: (event) => {
14471 preventDefault(event);
14472 actionType = type;
14473 onChange();
14474 },
14475 onTouchstartPassive: () => {
14476 actionType = type;
14477 onTouchStart();
14478 },
14479 onTouchend: onTouchEnd,
14480 onTouchcancel: onTouchEnd
14481 });
14482 vue.watch(() => [props2.max, props2.min, props2.integer, props2.decimalLength], check);
14483 vue.watch(() => props2.modelValue, (value) => {
14484 if (!isEqual(value, current2.value)) {
14485 current2.value = format2(value);
14486 }
14487 });
14488 vue.watch(current2, (value) => {
14489 emit("update:modelValue", value);
14490 emit("change", value, {
14491 name: props2.name
14492 });
14493 });
14494 use.useCustomFieldValue(() => props2.modelValue);
14495 return () => vue.createVNode("div", {
14496 "role": "group",
14497 "class": bem$8([props2.theme])
14498 }, [vue.withDirectives(vue.createVNode("button", vue.mergeProps({
14499 "type": "button",
14500 "style": buttonStyle.value,
14501 "class": [bem$8("minus", {
14502 disabled: minusDisabled.value
14503 }), {
14504 [HAPTICS_FEEDBACK]: !minusDisabled.value
14505 }],
14506 "aria-disabled": minusDisabled.value || void 0
14507 }, createListeners("minus")), null), [[vue.vShow, props2.showMinus]]), vue.withDirectives(vue.createVNode("input", {
14508 "ref": inputRef,
14509 "type": props2.integer ? "tel" : "text",
14510 "role": "spinbutton",
14511 "class": bem$8("input"),
14512 "value": current2.value,
14513 "style": inputStyle.value,
14514 "disabled": props2.disabled,
14515 "readonly": props2.disableInput,
14516 "inputmode": props2.integer ? "numeric" : "decimal",
14517 "placeholder": props2.placeholder,
14518 "aria-valuemax": props2.max,
14519 "aria-valuemin": props2.min,
14520 "aria-valuenow": current2.value,
14521 "onBlur": onBlur,
14522 "onInput": onInput,
14523 "onFocus": onFocus,
14524 "onMousedown": onMousedown
14525 }, null), [[vue.vShow, props2.showInput]]), vue.withDirectives(vue.createVNode("button", vue.mergeProps({
14526 "type": "button",
14527 "style": buttonStyle.value,
14528 "class": [bem$8("plus", {
14529 disabled: plusDisabled.value
14530 }), {
14531 [HAPTICS_FEEDBACK]: !plusDisabled.value
14532 }],
14533 "aria-disabled": plusDisabled.value || void 0
14534 }, createListeners("plus")), null), [[vue.vShow, props2.showPlus]])]);
14535 }
14536});
14537const Stepper = withInstall(stdin_default$e);
14538const Steps = withInstall(stdin_default$g);
14539const [name$8, bem$7, t$1] = createNamespace("submit-bar");
14540const submitBarProps = {
14541 tip: String,
14542 label: String,
14543 price: Number,
14544 tipIcon: String,
14545 loading: Boolean,
14546 currency: makeStringProp("¥"),
14547 disabled: Boolean,
14548 textAlign: String,
14549 buttonText: String,
14550 buttonType: makeStringProp("danger"),
14551 buttonColor: String,
14552 suffixLabel: String,
14553 placeholder: Boolean,
14554 decimalLength: makeNumericProp(2),
14555 safeAreaInsetBottom: truthProp
14556};
14557var stdin_default$d = vue.defineComponent({
14558 name: name$8,
14559 props: submitBarProps,
14560 emits: ["submit"],
14561 setup(props2, {
14562 emit,
14563 slots
14564 }) {
14565 const root = vue.ref();
14566 const renderPlaceholder = usePlaceholder(root, bem$7);
14567 const renderText = () => {
14568 const {
14569 price,
14570 label,
14571 currency,
14572 textAlign,
14573 suffixLabel,
14574 decimalLength
14575 } = props2;
14576 if (typeof price === "number") {
14577 const pricePair = (price / 100).toFixed(+decimalLength).split(".");
14578 const decimal = decimalLength ? `.${pricePair[1]}` : "";
14579 return vue.createVNode("div", {
14580 "class": bem$7("text"),
14581 "style": {
14582 textAlign
14583 }
14584 }, [vue.createVNode("span", null, [label || t$1("label")]), vue.createVNode("span", {
14585 "class": bem$7("price")
14586 }, [currency, vue.createVNode("span", {
14587 "class": bem$7("price-integer")
14588 }, [pricePair[0]]), decimal]), suffixLabel && vue.createVNode("span", {
14589 "class": bem$7("suffix-label")
14590 }, [suffixLabel])]);
14591 }
14592 };
14593 const renderTip = () => {
14594 var _a;
14595 const {
14596 tip,
14597 tipIcon
14598 } = props2;
14599 if (slots.tip || tip) {
14600 return vue.createVNode("div", {
14601 "class": bem$7("tip")
14602 }, [tipIcon && vue.createVNode(Icon, {
14603 "class": bem$7("tip-icon"),
14604 "name": tipIcon
14605 }, null), tip && vue.createVNode("span", {
14606 "class": bem$7("tip-text")
14607 }, [tip]), (_a = slots.tip) == null ? void 0 : _a.call(slots)]);
14608 }
14609 };
14610 const onClickButton = () => emit("submit");
14611 const renderButton = () => {
14612 if (slots.button) {
14613 return slots.button();
14614 }
14615 return vue.createVNode(Button, {
14616 "round": true,
14617 "type": props2.buttonType,
14618 "text": props2.buttonText,
14619 "class": bem$7("button", props2.buttonType),
14620 "color": props2.buttonColor,
14621 "loading": props2.loading,
14622 "disabled": props2.disabled,
14623 "onClick": onClickButton
14624 }, null);
14625 };
14626 const renderSubmitBar = () => {
14627 var _a, _b;
14628 return vue.createVNode("div", {
14629 "ref": root,
14630 "class": [bem$7(), {
14631 "van-safe-area-bottom": props2.safeAreaInsetBottom
14632 }]
14633 }, [(_a = slots.top) == null ? void 0 : _a.call(slots), renderTip(), vue.createVNode("div", {
14634 "class": bem$7("bar")
14635 }, [(_b = slots.default) == null ? void 0 : _b.call(slots), renderText(), renderButton()])]);
14636 };
14637 return () => {
14638 if (props2.placeholder) {
14639 return renderPlaceholder(renderSubmitBar);
14640 }
14641 return renderSubmitBar();
14642 };
14643 }
14644});
14645const SubmitBar = withInstall(stdin_default$d);
14646const [name$7, bem$6] = createNamespace("swipe-cell");
14647const swipeCellProps = {
14648 name: makeNumericProp(""),
14649 disabled: Boolean,
14650 leftWidth: numericProp,
14651 rightWidth: numericProp,
14652 beforeClose: Function,
14653 stopPropagation: Boolean
14654};
14655var stdin_default$c = vue.defineComponent({
14656 name: name$7,
14657 props: swipeCellProps,
14658 emits: ["open", "close", "click"],
14659 setup(props2, {
14660 emit,
14661 slots
14662 }) {
14663 let opened;
14664 let lockClick2;
14665 let startOffset;
14666 let isInBeforeClosing;
14667 const root = vue.ref();
14668 const leftRef = vue.ref();
14669 const rightRef = vue.ref();
14670 const state = vue.reactive({
14671 offset: 0,
14672 dragging: false
14673 });
14674 const touch = useTouch();
14675 const getWidthByRef = (ref2) => ref2.value ? use.useRect(ref2).width : 0;
14676 const leftWidth = vue.computed(() => isDef(props2.leftWidth) ? +props2.leftWidth : getWidthByRef(leftRef));
14677 const rightWidth = vue.computed(() => isDef(props2.rightWidth) ? +props2.rightWidth : getWidthByRef(rightRef));
14678 const open = (side) => {
14679 state.offset = side === "left" ? leftWidth.value : -rightWidth.value;
14680 if (!opened) {
14681 opened = true;
14682 emit("open", {
14683 name: props2.name,
14684 position: side
14685 });
14686 }
14687 };
14688 const close = (position) => {
14689 state.offset = 0;
14690 if (opened) {
14691 opened = false;
14692 emit("close", {
14693 name: props2.name,
14694 position
14695 });
14696 }
14697 };
14698 const toggle = (side) => {
14699 const offset = Math.abs(state.offset);
14700 const THRESHOLD = 0.15;
14701 const threshold = opened ? 1 - THRESHOLD : THRESHOLD;
14702 const width = side === "left" ? leftWidth.value : rightWidth.value;
14703 if (width && offset > width * threshold) {
14704 open(side);
14705 } else {
14706 close(side);
14707 }
14708 };
14709 const onTouchStart = (event) => {
14710 if (!props2.disabled) {
14711 startOffset = state.offset;
14712 touch.start(event);
14713 }
14714 };
14715 const onTouchMove = (event) => {
14716 if (props2.disabled) {
14717 return;
14718 }
14719 const {
14720 deltaX
14721 } = touch;
14722 touch.move(event);
14723 if (touch.isHorizontal()) {
14724 lockClick2 = true;
14725 state.dragging = true;
14726 const isEdge = !opened || deltaX.value * startOffset < 0;
14727 if (isEdge) {
14728 preventDefault(event, props2.stopPropagation);
14729 }
14730 state.offset = clamp(deltaX.value + startOffset, -rightWidth.value, leftWidth.value);
14731 }
14732 };
14733 const onTouchEnd = () => {
14734 if (state.dragging) {
14735 state.dragging = false;
14736 toggle(state.offset > 0 ? "left" : "right");
14737 setTimeout(() => {
14738 lockClick2 = false;
14739 }, 0);
14740 }
14741 };
14742 const onClick = (position = "outside") => {
14743 if (isInBeforeClosing)
14744 return;
14745 emit("click", position);
14746 if (opened && !lockClick2) {
14747 isInBeforeClosing = true;
14748 callInterceptor(props2.beforeClose, {
14749 args: [{
14750 name: props2.name,
14751 position
14752 }],
14753 done: () => {
14754 isInBeforeClosing = false;
14755 close(position);
14756 },
14757 canceled: () => isInBeforeClosing = false,
14758 error: () => isInBeforeClosing = false
14759 });
14760 }
14761 };
14762 const getClickHandler = (position, stop) => (event) => {
14763 if (stop) {
14764 event.stopPropagation();
14765 }
14766 onClick(position);
14767 };
14768 const renderSideContent = (side, ref2) => {
14769 const contentSlot = slots[side];
14770 if (contentSlot) {
14771 return vue.createVNode("div", {
14772 "ref": ref2,
14773 "class": bem$6(side),
14774 "onClick": getClickHandler(side, true)
14775 }, [contentSlot()]);
14776 }
14777 };
14778 useExpose({
14779 open,
14780 close
14781 });
14782 use.useClickAway(root, () => onClick("outside"), {
14783 eventName: "touchstart"
14784 });
14785 use.useEventListener("touchmove", onTouchMove, {
14786 target: root
14787 });
14788 return () => {
14789 var _a;
14790 const wrapperStyle = {
14791 transform: `translate3d(${state.offset}px, 0, 0)`,
14792 transitionDuration: state.dragging ? "0s" : ".6s"
14793 };
14794 return vue.createVNode("div", {
14795 "ref": root,
14796 "class": bem$6(),
14797 "onClick": getClickHandler("cell", lockClick2),
14798 "onTouchstartPassive": onTouchStart,
14799 "onTouchend": onTouchEnd,
14800 "onTouchcancel": onTouchEnd
14801 }, [vue.createVNode("div", {
14802 "class": bem$6("wrapper"),
14803 "style": wrapperStyle
14804 }, [renderSideContent("left", leftRef), (_a = slots.default) == null ? void 0 : _a.call(slots), renderSideContent("right", rightRef)])]);
14805 };
14806 }
14807});
14808const SwipeCell = withInstall(stdin_default$c);
14809const [name$6, bem$5] = createNamespace("tabbar");
14810const tabbarProps = {
14811 route: Boolean,
14812 fixed: truthProp,
14813 border: truthProp,
14814 zIndex: numericProp,
14815 placeholder: Boolean,
14816 activeColor: String,
14817 beforeChange: Function,
14818 inactiveColor: String,
14819 modelValue: makeNumericProp(0),
14820 safeAreaInsetBottom: {
14821 type: Boolean,
14822 default: null
14823 }
14824};
14825const TABBAR_KEY = Symbol(name$6);
14826var stdin_default$b = vue.defineComponent({
14827 name: name$6,
14828 props: tabbarProps,
14829 emits: ["change", "update:modelValue"],
14830 setup(props2, {
14831 emit,
14832 slots
14833 }) {
14834 const root = vue.ref();
14835 const {
14836 linkChildren
14837 } = use.useChildren(TABBAR_KEY);
14838 const renderPlaceholder = usePlaceholder(root, bem$5);
14839 const enableSafeArea = () => {
14840 var _a;
14841 return (_a = props2.safeAreaInsetBottom) != null ? _a : props2.fixed;
14842 };
14843 const renderTabbar = () => {
14844 var _a;
14845 const {
14846 fixed,
14847 zIndex,
14848 border
14849 } = props2;
14850 return vue.createVNode("div", {
14851 "ref": root,
14852 "role": "tablist",
14853 "style": getZIndexStyle(zIndex),
14854 "class": [bem$5({
14855 fixed
14856 }), {
14857 [BORDER_TOP_BOTTOM]: border,
14858 "van-safe-area-bottom": enableSafeArea()
14859 }]
14860 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
14861 };
14862 const setActive = (active, afterChange) => {
14863 callInterceptor(props2.beforeChange, {
14864 args: [active],
14865 done() {
14866 emit("update:modelValue", active);
14867 emit("change", active);
14868 afterChange();
14869 }
14870 });
14871 };
14872 linkChildren({
14873 props: props2,
14874 setActive
14875 });
14876 return () => {
14877 if (props2.fixed && props2.placeholder) {
14878 return renderPlaceholder(renderTabbar);
14879 }
14880 return renderTabbar();
14881 };
14882 }
14883});
14884const Tabbar = withInstall(stdin_default$b);
14885const [name$5, bem$4] = createNamespace("tabbar-item");
14886const tabbarItemProps = extend({}, routeProps, {
14887 dot: Boolean,
14888 icon: String,
14889 name: numericProp,
14890 badge: numericProp,
14891 badgeProps: Object,
14892 iconPrefix: String
14893});
14894var stdin_default$a = vue.defineComponent({
14895 name: name$5,
14896 props: tabbarItemProps,
14897 emits: ["click"],
14898 setup(props2, {
14899 emit,
14900 slots
14901 }) {
14902 const route2 = useRoute();
14903 const vm = vue.getCurrentInstance().proxy;
14904 const {
14905 parent,
14906 index
14907 } = use.useParent(TABBAR_KEY);
14908 if (!parent) {
14909 if (process.env.NODE_ENV !== "production") {
14910 console.error("[Vant] <TabbarItem> must be a child component of <Tabbar>.");
14911 }
14912 return;
14913 }
14914 const active = vue.computed(() => {
14915 var _a;
14916 const {
14917 route: route22,
14918 modelValue
14919 } = parent.props;
14920 if (route22 && "$route" in vm) {
14921 const {
14922 $route
14923 } = vm;
14924 const {
14925 to
14926 } = props2;
14927 const config = isObject(to) ? to : {
14928 path: to
14929 };
14930 return !!$route.matched.find((val) => {
14931 const pathMatched = "path" in config && config.path === val.path;
14932 const nameMatched = "name" in config && config.name === val.name;
14933 return pathMatched || nameMatched;
14934 });
14935 }
14936 return ((_a = props2.name) != null ? _a : index.value) === modelValue;
14937 });
14938 const onClick = (event) => {
14939 var _a;
14940 if (!active.value) {
14941 parent.setActive((_a = props2.name) != null ? _a : index.value, route2);
14942 }
14943 emit("click", event);
14944 };
14945 const renderIcon = () => {
14946 if (slots.icon) {
14947 return slots.icon({
14948 active: active.value
14949 });
14950 }
14951 if (props2.icon) {
14952 return vue.createVNode(Icon, {
14953 "name": props2.icon,
14954 "classPrefix": props2.iconPrefix
14955 }, null);
14956 }
14957 };
14958 return () => {
14959 var _a;
14960 const {
14961 dot,
14962 badge
14963 } = props2;
14964 const {
14965 activeColor,
14966 inactiveColor
14967 } = parent.props;
14968 const color = active.value ? activeColor : inactiveColor;
14969 return vue.createVNode("div", {
14970 "role": "tab",
14971 "class": bem$4({
14972 active: active.value
14973 }),
14974 "style": {
14975 color
14976 },
14977 "tabindex": 0,
14978 "aria-selected": active.value,
14979 "onClick": onClick
14980 }, [vue.createVNode(Badge, vue.mergeProps({
14981 "dot": dot,
14982 "class": bem$4("icon"),
14983 "content": badge
14984 }, props2.badgeProps), {
14985 default: renderIcon
14986 }), vue.createVNode("div", {
14987 "class": bem$4("text")
14988 }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
14989 active: active.value
14990 })])]);
14991 };
14992 }
14993});
14994const TabbarItem = withInstall(stdin_default$a);
14995const [name$4, bem$3] = createNamespace("text-ellipsis");
14996const textEllipsisProps = {
14997 rows: makeNumericProp(1),
14998 dots: makeStringProp("..."),
14999 content: makeStringProp(""),
15000 expandText: makeStringProp(""),
15001 collapseText: makeStringProp(""),
15002 position: makeStringProp("end")
15003};
15004var stdin_default$9 = vue.defineComponent({
15005 name: name$4,
15006 props: textEllipsisProps,
15007 emits: ["clickAction"],
15008 setup(props2, {
15009 emit,
15010 slots
15011 }) {
15012 const text = vue.ref("");
15013 const expanded = vue.ref(false);
15014 const hasAction = vue.ref(false);
15015 const root = vue.ref();
15016 const actionText = vue.computed(() => expanded.value ? props2.collapseText : props2.expandText);
15017 const pxToNum = (value) => {
15018 if (!value)
15019 return 0;
15020 const match = value.match(/^\d*(\.\d*)?/);
15021 return match ? Number(match[0]) : 0;
15022 };
15023 const calcEllipsised = () => {
15024 const cloneContainer = () => {
15025 if (!root.value)
15026 return;
15027 const originStyle = window.getComputedStyle(root.value);
15028 const container2 = document.createElement("div");
15029 const styleNames = Array.prototype.slice.apply(originStyle);
15030 styleNames.forEach((name2) => {
15031 container2.style.setProperty(name2, originStyle.getPropertyValue(name2));
15032 });
15033 container2.style.position = "fixed";
15034 container2.style.zIndex = "-9999";
15035 container2.style.top = "-9999px";
15036 container2.style.height = "auto";
15037 container2.style.minHeight = "auto";
15038 container2.style.maxHeight = "auto";
15039 container2.innerText = props2.content;
15040 document.body.appendChild(container2);
15041 return container2;
15042 };
15043 const calcEllipsisText = (container2, maxHeight2) => {
15044 const {
15045 content,
15046 position,
15047 dots
15048 } = props2;
15049 const end = content.length;
15050 const calcEllipse = () => {
15051 const tail = (left, right) => {
15052 if (right - left <= 1) {
15053 if (position === "end") {
15054 return content.slice(0, left) + dots;
15055 }
15056 return dots + content.slice(right, end);
15057 }
15058 const middle2 = Math.round((left + right) / 2);
15059 if (position === "end") {
15060 container2.innerText = content.slice(0, middle2) + dots + actionText.value;
15061 } else {
15062 container2.innerText = dots + content.slice(middle2, end) + actionText.value;
15063 }
15064 if (container2.offsetHeight > maxHeight2) {
15065 if (position === "end") {
15066 return tail(left, middle2);
15067 }
15068 return tail(middle2, right);
15069 }
15070 if (position === "end") {
15071 return tail(middle2, right);
15072 }
15073 return tail(left, middle2);
15074 };
15075 container2.innerText = tail(0, end);
15076 };
15077 const middleTail = (leftPart, rightPart) => {
15078 if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
15079 return content.slice(0, leftPart[0]) + dots + content.slice(rightPart[1], end);
15080 }
15081 const leftMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
15082 const rightMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
15083 container2.innerText = props2.content.slice(0, leftMiddle) + props2.dots + props2.content.slice(rightMiddle, end) + props2.expandText;
15084 if (container2.offsetHeight >= maxHeight2) {
15085 return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
15086 }
15087 return middleTail([leftMiddle, leftPart[1]], [rightPart[0], rightMiddle]);
15088 };
15089 const middle = 0 + end >> 1;
15090 props2.position === "middle" ? container2.innerText = middleTail([0, middle], [middle, end]) : calcEllipse();
15091 return container2.innerText;
15092 };
15093 const container = cloneContainer();
15094 if (!container)
15095 return;
15096 const {
15097 paddingBottom,
15098 paddingTop,
15099 lineHeight
15100 } = container.style;
15101 const maxHeight = Math.ceil((Number(props2.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom));
15102 if (maxHeight < container.offsetHeight) {
15103 hasAction.value = true;
15104 text.value = calcEllipsisText(container, maxHeight);
15105 } else {
15106 hasAction.value = false;
15107 text.value = props2.content;
15108 }
15109 document.body.removeChild(container);
15110 };
15111 const toggle = (isExpanded = !expanded.value) => {
15112 expanded.value = isExpanded;
15113 };
15114 const onClickAction = (event) => {
15115 toggle();
15116 emit("clickAction", event);
15117 };
15118 const renderAction = () => {
15119 const action = slots.action ? slots.action({
15120 expanded: expanded.value
15121 }) : actionText.value;
15122 return vue.createVNode("span", {
15123 "class": bem$3("action"),
15124 "onClick": onClickAction
15125 }, [action]);
15126 };
15127 vue.onMounted(calcEllipsised);
15128 vue.watch([windowWidth, () => [props2.content, props2.rows, props2.position]], calcEllipsised);
15129 useExpose({
15130 toggle
15131 });
15132 return () => vue.createVNode("div", {
15133 "ref": root,
15134 "class": bem$3()
15135 }, [expanded.value ? props2.content : text.value, hasAction.value ? renderAction() : null]);
15136 }
15137});
15138const TextEllipsis = withInstall(stdin_default$9);
15139const [name$3] = createNamespace("time-picker");
15140const validateTime = (val) => /^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$/.test(val);
15141const fullColumns = ["hour", "minute", "second"];
15142const timePickerProps = extend({}, sharedProps, {
15143 minHour: makeNumericProp(0),
15144 maxHour: makeNumericProp(23),
15145 minMinute: makeNumericProp(0),
15146 maxMinute: makeNumericProp(59),
15147 minSecond: makeNumericProp(0),
15148 maxSecond: makeNumericProp(59),
15149 minTime: {
15150 type: String,
15151 validator: validateTime
15152 },
15153 maxTime: {
15154 type: String,
15155 validator: validateTime
15156 },
15157 columnsType: {
15158 type: Array,
15159 default: () => ["hour", "minute"]
15160 },
15161 filter: Function
15162});
15163var stdin_default$8 = vue.defineComponent({
15164 name: name$3,
15165 props: timePickerProps,
15166 emits: ["confirm", "cancel", "change", "update:modelValue"],
15167 setup(props2, {
15168 emit,
15169 slots
15170 }) {
15171 const currentValues = vue.ref(props2.modelValue);
15172 const getValidTime = (time) => {
15173 const timeLimitArr = time.split(":");
15174 return fullColumns.map((col, i) => props2.columnsType.includes(col) ? timeLimitArr[i] : "00");
15175 };
15176 const columns = vue.computed(() => {
15177 let {
15178 minHour,
15179 maxHour,
15180 minMinute,
15181 maxMinute,
15182 minSecond,
15183 maxSecond
15184 } = props2;
15185 if (props2.minTime || props2.maxTime) {
15186 const fullTime = {
15187 hour: 0,
15188 minute: 0,
15189 second: 0
15190 };
15191 props2.columnsType.forEach((col, i) => {
15192 var _a;
15193 fullTime[col] = (_a = currentValues.value[i]) != null ? _a : 0;
15194 });
15195 const {
15196 hour,
15197 minute
15198 } = fullTime;
15199 if (props2.minTime) {
15200 const [minH, minM, minS] = getValidTime(props2.minTime);
15201 minHour = minH;
15202 minMinute = +hour <= +minHour ? minM : "00";
15203 minSecond = +hour <= +minHour && +minute <= +minMinute ? minS : "00";
15204 }
15205 if (props2.maxTime) {
15206 const [maxH, maxM, maxS] = getValidTime(props2.maxTime);
15207 maxHour = maxH;
15208 maxMinute = +hour >= +maxHour ? maxM : "59";
15209 maxSecond = +hour >= +maxHour && +minute >= +maxMinute ? maxS : "59";
15210 }
15211 }
15212 return props2.columnsType.map((type) => {
15213 const {
15214 filter,
15215 formatter
15216 } = props2;
15217 switch (type) {
15218 case "hour":
15219 return genOptions(+minHour, +maxHour, type, formatter, filter, currentValues.value);
15220 case "minute":
15221 return genOptions(+minMinute, +maxMinute, type, formatter, filter, currentValues.value);
15222 case "second":
15223 return genOptions(+minSecond, +maxSecond, type, formatter, filter, currentValues.value);
15224 default:
15225 if (process.env.NODE_ENV !== "production") {
15226 throw new Error(`[Vant] DatePicker: unsupported columns type: ${type}`);
15227 }
15228 return [];
15229 }
15230 });
15231 });
15232 vue.watch(currentValues, (newValues) => {
15233 if (!isSameValue(newValues, props2.modelValue)) {
15234 emit("update:modelValue", newValues);
15235 }
15236 });
15237 vue.watch(() => props2.modelValue, (newValues) => {
15238 newValues = formatValueRange(newValues, columns.value);
15239 if (!isSameValue(newValues, currentValues.value)) {
15240 currentValues.value = newValues;
15241 }
15242 }, {
15243 immediate: true
15244 });
15245 const onChange = (...args) => emit("change", ...args);
15246 const onCancel = (...args) => emit("cancel", ...args);
15247 const onConfirm = (...args) => emit("confirm", ...args);
15248 return () => vue.createVNode(Picker, vue.mergeProps({
15249 "modelValue": currentValues.value,
15250 "onUpdate:modelValue": ($event) => currentValues.value = $event,
15251 "columns": columns.value,
15252 "onChange": onChange,
15253 "onCancel": onCancel,
15254 "onConfirm": onConfirm
15255 }, pick(props2, pickerInheritKeys)), slots);
15256 }
15257});
15258const TimePicker = withInstall(stdin_default$8);
15259const [name$2, bem$2] = createNamespace("tree-select");
15260const treeSelectProps = {
15261 max: makeNumericProp(Infinity),
15262 items: makeArrayProp(),
15263 height: makeNumericProp(300),
15264 selectedIcon: makeStringProp("success"),
15265 mainActiveIndex: makeNumericProp(0),
15266 activeId: {
15267 type: [Number, String, Array],
15268 default: 0
15269 }
15270};
15271var stdin_default$7 = vue.defineComponent({
15272 name: name$2,
15273 props: treeSelectProps,
15274 emits: ["clickNav", "clickItem", "update:activeId", "update:mainActiveIndex"],
15275 setup(props2, {
15276 emit,
15277 slots
15278 }) {
15279 const isActiveItem = (id) => Array.isArray(props2.activeId) ? props2.activeId.includes(id) : props2.activeId === id;
15280 const renderSubItem = (item) => {
15281 const onClick = () => {
15282 if (item.disabled) {
15283 return;
15284 }
15285 let activeId;
15286 if (Array.isArray(props2.activeId)) {
15287 activeId = props2.activeId.slice();
15288 const index = activeId.indexOf(item.id);
15289 if (index !== -1) {
15290 activeId.splice(index, 1);
15291 } else if (activeId.length < +props2.max) {
15292 activeId.push(item.id);
15293 }
15294 } else {
15295 activeId = item.id;
15296 }
15297 emit("update:activeId", activeId);
15298 emit("clickItem", item);
15299 };
15300 return vue.createVNode("div", {
15301 "key": item.id,
15302 "class": ["van-ellipsis", bem$2("item", {
15303 active: isActiveItem(item.id),
15304 disabled: item.disabled
15305 })],
15306 "onClick": onClick
15307 }, [item.text, isActiveItem(item.id) && vue.createVNode(Icon, {
15308 "name": props2.selectedIcon,
15309 "class": bem$2("selected")
15310 }, null)]);
15311 };
15312 const onSidebarChange = (index) => {
15313 emit("update:mainActiveIndex", index);
15314 };
15315 const onClickSidebarItem = (index) => emit("clickNav", index);
15316 const renderSidebar = () => {
15317 const Items = props2.items.map((item) => vue.createVNode(SidebarItem, {
15318 "dot": item.dot,
15319 "badge": item.badge,
15320 "class": [bem$2("nav-item"), item.className],
15321 "disabled": item.disabled,
15322 "onClick": onClickSidebarItem
15323 }, {
15324 title: () => slots["nav-text"] ? slots["nav-text"](item) : item.text
15325 }));
15326 return vue.createVNode(Sidebar, {
15327 "class": bem$2("nav"),
15328 "modelValue": props2.mainActiveIndex,
15329 "onChange": onSidebarChange
15330 }, {
15331 default: () => [Items]
15332 });
15333 };
15334 const renderContent = () => {
15335 if (slots.content) {
15336 return slots.content();
15337 }
15338 const selected = props2.items[+props2.mainActiveIndex] || {};
15339 if (selected.children) {
15340 return selected.children.map(renderSubItem);
15341 }
15342 };
15343 return () => vue.createVNode("div", {
15344 "class": bem$2(),
15345 "style": {
15346 height: addUnit(props2.height)
15347 }
15348 }, [renderSidebar(), vue.createVNode("div", {
15349 "class": bem$2("content")
15350 }, [renderContent()])]);
15351 }
15352});
15353const TreeSelect = withInstall(stdin_default$7);
15354const [name$1, bem$1, t] = createNamespace("uploader");
15355function readFileContent(file, resultType) {
15356 return new Promise((resolve) => {
15357 if (resultType === "file") {
15358 resolve();
15359 return;
15360 }
15361 const reader = new FileReader();
15362 reader.onload = (event) => {
15363 resolve(event.target.result);
15364 };
15365 if (resultType === "dataUrl") {
15366 reader.readAsDataURL(file);
15367 } else if (resultType === "text") {
15368 reader.readAsText(file);
15369 }
15370 });
15371}
15372function isOversize(items, maxSize) {
15373 return toArray(items).some((item) => {
15374 if (item.file) {
15375 if (isFunction(maxSize)) {
15376 return maxSize(item.file);
15377 }
15378 return item.file.size > +maxSize;
15379 }
15380 return false;
15381 });
15382}
15383function filterFiles(items, maxSize) {
15384 const valid = [];
15385 const invalid = [];
15386 items.forEach((item) => {
15387 if (isOversize(item, maxSize)) {
15388 invalid.push(item);
15389 } else {
15390 valid.push(item);
15391 }
15392 });
15393 return { valid, invalid };
15394}
15395const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg|avif)/i;
15396const isImageUrl = (url) => IMAGE_REGEXP.test(url);
15397function isImageFile(item) {
15398 if (item.isImage) {
15399 return true;
15400 }
15401 if (item.file && item.file.type) {
15402 return item.file.type.indexOf("image") === 0;
15403 }
15404 if (item.url) {
15405 return isImageUrl(item.url);
15406 }
15407 if (typeof item.content === "string") {
15408 return item.content.indexOf("data:image") === 0;
15409 }
15410 return false;
15411}
15412var stdin_default$6 = vue.defineComponent({
15413 props: {
15414 name: numericProp,
15415 item: makeRequiredProp(Object),
15416 index: Number,
15417 imageFit: String,
15418 lazyLoad: Boolean,
15419 deletable: Boolean,
15420 reupload: Boolean,
15421 previewSize: [Number, String, Array],
15422 beforeDelete: Function
15423 },
15424 emits: ["delete", "preview", "reupload"],
15425 setup(props2, {
15426 emit,
15427 slots
15428 }) {
15429 const renderMask = () => {
15430 const {
15431 status,
15432 message
15433 } = props2.item;
15434 if (status === "uploading" || status === "failed") {
15435 const MaskIcon = status === "failed" ? vue.createVNode(Icon, {
15436 "name": "close",
15437 "class": bem$1("mask-icon")
15438 }, null) : vue.createVNode(Loading, {
15439 "class": bem$1("loading")
15440 }, null);
15441 const showMessage = isDef(message) && message !== "";
15442 return vue.createVNode("div", {
15443 "class": bem$1("mask")
15444 }, [MaskIcon, showMessage && vue.createVNode("div", {
15445 "class": bem$1("mask-message")
15446 }, [message])]);
15447 }
15448 };
15449 const onDelete = (event) => {
15450 const {
15451 name: name2,
15452 item,
15453 index,
15454 beforeDelete
15455 } = props2;
15456 event.stopPropagation();
15457 callInterceptor(beforeDelete, {
15458 args: [item, {
15459 name: name2,
15460 index
15461 }],
15462 done: () => emit("delete")
15463 });
15464 };
15465 const onPreview = () => emit("preview");
15466 const onReupload = () => emit("reupload");
15467 const renderDeleteIcon = () => {
15468 if (props2.deletable && props2.item.status !== "uploading") {
15469 const slot = slots["preview-delete"];
15470 return vue.createVNode("div", {
15471 "role": "button",
15472 "class": bem$1("preview-delete", {
15473 shadow: !slot
15474 }),
15475 "tabindex": 0,
15476 "aria-label": t("delete"),
15477 "onClick": onDelete
15478 }, [slot ? slot() : vue.createVNode(Icon, {
15479 "name": "cross",
15480 "class": bem$1("preview-delete-icon")
15481 }, null)]);
15482 }
15483 };
15484 const renderCover = () => {
15485 if (slots["preview-cover"]) {
15486 const {
15487 index,
15488 item
15489 } = props2;
15490 return vue.createVNode("div", {
15491 "class": bem$1("preview-cover")
15492 }, [slots["preview-cover"](extend({
15493 index
15494 }, item))]);
15495 }
15496 };
15497 const renderPreview = () => {
15498 const {
15499 item,
15500 lazyLoad,
15501 imageFit,
15502 previewSize,
15503 reupload
15504 } = props2;
15505 if (isImageFile(item)) {
15506 return vue.createVNode(Image$1, {
15507 "fit": imageFit,
15508 "src": item.objectUrl || item.content || item.url,
15509 "class": bem$1("preview-image"),
15510 "width": Array.isArray(previewSize) ? previewSize[0] : previewSize,
15511 "height": Array.isArray(previewSize) ? previewSize[1] : previewSize,
15512 "lazyLoad": lazyLoad,
15513 "onClick": reupload ? onReupload : onPreview
15514 }, {
15515 default: renderCover
15516 });
15517 }
15518 return vue.createVNode("div", {
15519 "class": bem$1("file"),
15520 "style": getSizeStyle(props2.previewSize)
15521 }, [vue.createVNode(Icon, {
15522 "class": bem$1("file-icon"),
15523 "name": "description"
15524 }, null), vue.createVNode("div", {
15525 "class": [bem$1("file-name"), "van-ellipsis"]
15526 }, [item.file ? item.file.name : item.url]), renderCover()]);
15527 };
15528 return () => vue.createVNode("div", {
15529 "class": bem$1("preview")
15530 }, [renderPreview(), renderMask(), renderDeleteIcon()]);
15531 }
15532});
15533const uploaderProps = {
15534 name: makeNumericProp(""),
15535 accept: makeStringProp("image/*"),
15536 capture: String,
15537 multiple: Boolean,
15538 disabled: Boolean,
15539 readonly: Boolean,
15540 lazyLoad: Boolean,
15541 maxCount: makeNumericProp(Infinity),
15542 imageFit: makeStringProp("cover"),
15543 resultType: makeStringProp("dataUrl"),
15544 uploadIcon: makeStringProp("photograph"),
15545 uploadText: String,
15546 deletable: truthProp,
15547 reupload: Boolean,
15548 afterRead: Function,
15549 showUpload: truthProp,
15550 modelValue: makeArrayProp(),
15551 beforeRead: Function,
15552 beforeDelete: Function,
15553 previewSize: [Number, String, Array],
15554 previewImage: truthProp,
15555 previewOptions: Object,
15556 previewFullImage: truthProp,
15557 maxSize: {
15558 type: [Number, String, Function],
15559 default: Infinity
15560 }
15561};
15562var stdin_default$5 = vue.defineComponent({
15563 name: name$1,
15564 props: uploaderProps,
15565 emits: ["delete", "oversize", "clickUpload", "closePreview", "clickPreview", "clickReupload", "update:modelValue"],
15566 setup(props2, {
15567 emit,
15568 slots
15569 }) {
15570 const inputRef = vue.ref();
15571 const urls = [];
15572 const reuploadIndex = vue.ref(-1);
15573 const isReuploading = vue.ref(false);
15574 const getDetail = (index = props2.modelValue.length) => ({
15575 name: props2.name,
15576 index
15577 });
15578 const resetInput = () => {
15579 if (inputRef.value) {
15580 inputRef.value.value = "";
15581 }
15582 };
15583 const onAfterRead = (items) => {
15584 resetInput();
15585 if (isOversize(items, props2.maxSize)) {
15586 if (Array.isArray(items)) {
15587 const result = filterFiles(items, props2.maxSize);
15588 items = result.valid;
15589 emit("oversize", result.invalid, getDetail());
15590 if (!items.length) {
15591 return;
15592 }
15593 } else {
15594 emit("oversize", items, getDetail());
15595 return;
15596 }
15597 }
15598 items = vue.reactive(items);
15599 if (reuploadIndex.value > -1) {
15600 const arr = [...props2.modelValue];
15601 arr.splice(reuploadIndex.value, 1, items);
15602 emit("update:modelValue", arr);
15603 reuploadIndex.value = -1;
15604 } else {
15605 emit("update:modelValue", [...props2.modelValue, ...toArray(items)]);
15606 }
15607 if (props2.afterRead) {
15608 props2.afterRead(items, getDetail());
15609 }
15610 };
15611 const readFile = (files) => {
15612 const {
15613 maxCount,
15614 modelValue,
15615 resultType
15616 } = props2;
15617 if (Array.isArray(files)) {
15618 const remainCount = +maxCount - modelValue.length;
15619 if (files.length > remainCount) {
15620 files = files.slice(0, remainCount);
15621 }
15622 Promise.all(files.map((file) => readFileContent(file, resultType))).then((contents) => {
15623 const fileList = files.map((file, index) => {
15624 const result = {
15625 file,
15626 status: "",
15627 message: "",
15628 objectUrl: URL.createObjectURL(file)
15629 };
15630 if (contents[index]) {
15631 result.content = contents[index];
15632 }
15633 return result;
15634 });
15635 onAfterRead(fileList);
15636 });
15637 } else {
15638 readFileContent(files, resultType).then((content) => {
15639 const result = {
15640 file: files,
15641 status: "",
15642 message: "",
15643 objectUrl: URL.createObjectURL(files)
15644 };
15645 if (content) {
15646 result.content = content;
15647 }
15648 onAfterRead(result);
15649 });
15650 }
15651 };
15652 const onChange = (event) => {
15653 const {
15654 files
15655 } = event.target;
15656 if (props2.disabled || !files || !files.length) {
15657 return;
15658 }
15659 const file = files.length === 1 ? files[0] : [].slice.call(files);
15660 if (props2.beforeRead) {
15661 const response = props2.beforeRead(file, getDetail());
15662 if (!response) {
15663 resetInput();
15664 return;
15665 }
15666 if (isPromise(response)) {
15667 response.then((data) => {
15668 if (data) {
15669 readFile(data);
15670 } else {
15671 readFile(file);
15672 }
15673 }).catch(resetInput);
15674 return;
15675 }
15676 }
15677 readFile(file);
15678 };
15679 let imagePreview;
15680 const onClosePreview = () => emit("closePreview");
15681 const previewImage = (item) => {
15682 if (props2.previewFullImage) {
15683 const imageFiles = props2.modelValue.filter(isImageFile);
15684 const images = imageFiles.map((item2) => {
15685 if (item2.objectUrl && !item2.url && item2.status !== "failed") {
15686 item2.url = item2.objectUrl;
15687 urls.push(item2.url);
15688 }
15689 return item2.url;
15690 }).filter(Boolean);
15691 imagePreview = showImagePreview(extend({
15692 images,
15693 startPosition: imageFiles.indexOf(item),
15694 onClose: onClosePreview
15695 }, props2.previewOptions));
15696 }
15697 };
15698 const closeImagePreview = () => {
15699 if (imagePreview) {
15700 imagePreview.close();
15701 }
15702 };
15703 const deleteFile = (item, index) => {
15704 const fileList = props2.modelValue.slice(0);
15705 fileList.splice(index, 1);
15706 emit("update:modelValue", fileList);
15707 emit("delete", item, getDetail(index));
15708 };
15709 const reuploadImage = (index) => {
15710 isReuploading.value = true;
15711 reuploadIndex.value = index;
15712 vue.nextTick(() => chooseFile());
15713 };
15714 const onInputClick = () => {
15715 if (!isReuploading.value) {
15716 reuploadIndex.value = -1;
15717 }
15718 isReuploading.value = false;
15719 };
15720 const renderPreviewItem = (item, index) => {
15721 const needPickData = ["imageFit", "deletable", "reupload", "previewSize", "beforeDelete"];
15722 const previewData = extend(pick(props2, needPickData), pick(item, needPickData, true));
15723 return vue.createVNode(stdin_default$6, vue.mergeProps({
15724 "item": item,
15725 "index": index,
15726 "onClick": () => emit(props2.reupload ? "clickReupload" : "clickPreview", item, getDetail(index)),
15727 "onDelete": () => deleteFile(item, index),
15728 "onPreview": () => previewImage(item),
15729 "onReupload": () => reuploadImage(index)
15730 }, pick(props2, ["name", "lazyLoad"]), previewData), pick(slots, ["preview-cover", "preview-delete"]));
15731 };
15732 const renderPreviewList = () => {
15733 if (props2.previewImage) {
15734 return props2.modelValue.map(renderPreviewItem);
15735 }
15736 };
15737 const onClickUpload = (event) => emit("clickUpload", event);
15738 const renderUpload = () => {
15739 if (props2.modelValue.length >= +props2.maxCount && !props2.reupload) {
15740 return;
15741 }
15742 const hideUploader = props2.modelValue.length >= +props2.maxCount && props2.reupload;
15743 const Input = props2.readonly ? null : vue.createVNode("input", {
15744 "ref": inputRef,
15745 "type": "file",
15746 "class": bem$1("input"),
15747 "accept": props2.accept,
15748 "capture": props2.capture,
15749 "multiple": props2.multiple && reuploadIndex.value === -1,
15750 "disabled": props2.disabled,
15751 "onChange": onChange,
15752 "onClick": onInputClick
15753 }, null);
15754 if (slots.default) {
15755 return vue.withDirectives(vue.createVNode("div", {
15756 "class": bem$1("input-wrapper"),
15757 "onClick": onClickUpload
15758 }, [slots.default(), Input]), [[vue.vShow, !hideUploader]]);
15759 }
15760 return vue.withDirectives(vue.createVNode("div", {
15761 "class": bem$1("upload", {
15762 readonly: props2.readonly
15763 }),
15764 "style": getSizeStyle(props2.previewSize),
15765 "onClick": onClickUpload
15766 }, [vue.createVNode(Icon, {
15767 "name": props2.uploadIcon,
15768 "class": bem$1("upload-icon")
15769 }, null), props2.uploadText && vue.createVNode("span", {
15770 "class": bem$1("upload-text")
15771 }, [props2.uploadText]), Input]), [[vue.vShow, props2.showUpload && !hideUploader]]);
15772 };
15773 const chooseFile = () => {
15774 if (inputRef.value && !props2.disabled) {
15775 inputRef.value.click();
15776 }
15777 };
15778 vue.onBeforeUnmount(() => {
15779 urls.forEach((url) => URL.revokeObjectURL(url));
15780 });
15781 useExpose({
15782 chooseFile,
15783 closeImagePreview
15784 });
15785 use.useCustomFieldValue(() => props2.modelValue);
15786 return () => vue.createVNode("div", {
15787 "class": bem$1()
15788 }, [vue.createVNode("div", {
15789 "class": bem$1("wrapper", {
15790 disabled: props2.disabled
15791 })
15792 }, [renderPreviewList(), renderUpload()])]);
15793 }
15794});
15795const Uploader = withInstall(stdin_default$5);
15796const [name, bem] = createNamespace("watermark");
15797const watermarkProps = {
15798 gapX: makeNumberProp(0),
15799 gapY: makeNumberProp(0),
15800 image: String,
15801 width: makeNumberProp(100),
15802 height: makeNumberProp(100),
15803 rotate: makeNumericProp(-22),
15804 zIndex: numericProp,
15805 content: String,
15806 opacity: numericProp,
15807 fullPage: truthProp,
15808 textColor: makeStringProp("#dcdee0")
15809};
15810var stdin_default$4 = vue.defineComponent({
15811 name,
15812 props: watermarkProps,
15813 setup(props2, {
15814 slots
15815 }) {
15816 const svgElRef = vue.ref();
15817 const watermarkUrl = vue.ref("");
15818 const imageBase64 = vue.ref("");
15819 const renderWatermark = () => {
15820 const rotateStyle = {
15821 transformOrigin: "center",
15822 transform: `rotate(${props2.rotate}deg)`
15823 };
15824 const svgInner = () => {
15825 if (props2.image && !slots.content) {
15826 return vue.createVNode("image", {
15827 "href": imageBase64.value,
15828 "xlink:href": imageBase64.value,
15829 "x": "0",
15830 "y": "0",
15831 "width": props2.width,
15832 "height": props2.height,
15833 "style": rotateStyle
15834 }, null);
15835 }
15836 return vue.createVNode("foreignObject", {
15837 "x": "0",
15838 "y": "0",
15839 "width": props2.width,
15840 "height": props2.height
15841 }, [vue.createVNode("div", {
15842 "xmlns": "http://www.w3.org/1999/xhtml",
15843 "style": rotateStyle
15844 }, [slots.content ? slots.content() : vue.createVNode("span", {
15845 "style": {
15846 color: props2.textColor
15847 }
15848 }, [props2.content])])]);
15849 };
15850 const svgWidth = props2.width + props2.gapX;
15851 const svgHeight = props2.height + props2.gapY;
15852 return vue.createVNode("svg", {
15853 "viewBox": `0 0 ${svgWidth} ${svgHeight}`,
15854 "width": svgWidth,
15855 "height": svgHeight,
15856 "xmlns": "http://www.w3.org/2000/svg",
15857 "xmlns:xlink": "http://www.w3.org/1999/xlink",
15858 "style": {
15859 padding: `0 ${props2.gapX}px ${props2.gapY}px 0`,
15860 opacity: props2.opacity
15861 }
15862 }, [svgInner()]);
15863 };
15864 const makeImageToBase64 = (url) => {
15865 const canvas = document.createElement("canvas");
15866 const image = new Image();
15867 image.crossOrigin = "anonymous";
15868 image.referrerPolicy = "no-referrer";
15869 image.onload = () => {
15870 canvas.width = image.naturalWidth;
15871 canvas.height = image.naturalHeight;
15872 const ctx = canvas.getContext("2d");
15873 ctx == null ? void 0 : ctx.drawImage(image, 0, 0);
15874 imageBase64.value = canvas.toDataURL();
15875 };
15876 image.src = url;
15877 };
15878 const makeSvgToBlobUrl = (svgStr) => {
15879 const svgBlob = new Blob([svgStr], {
15880 type: "image/svg+xml"
15881 });
15882 return URL.createObjectURL(svgBlob);
15883 };
15884 vue.watchEffect(() => {
15885 if (props2.image) {
15886 makeImageToBase64(props2.image);
15887 }
15888 });
15889 vue.watch(() => [imageBase64.value, props2.content, props2.textColor, props2.height, props2.width, props2.rotate, props2.gapX, props2.gapY], () => {
15890 vue.nextTick(() => {
15891 if (svgElRef.value) {
15892 if (watermarkUrl.value) {
15893 URL.revokeObjectURL(watermarkUrl.value);
15894 }
15895 watermarkUrl.value = makeSvgToBlobUrl(svgElRef.value.innerHTML);
15896 }
15897 });
15898 }, {
15899 immediate: true
15900 });
15901 vue.onUnmounted(() => {
15902 if (watermarkUrl.value) {
15903 URL.revokeObjectURL(watermarkUrl.value);
15904 }
15905 });
15906 return () => {
15907 const style = extend({
15908 backgroundImage: `url(${watermarkUrl.value})`
15909 }, getZIndexStyle(props2.zIndex));
15910 return vue.createVNode("div", {
15911 "class": bem({
15912 full: props2.fullPage
15913 }),
15914 "style": style
15915 }, [vue.createVNode("div", {
15916 "class": bem("wrapper"),
15917 "ref": svgElRef
15918 }, [renderWatermark()])]);
15919 };
15920 }
15921});
15922const Watermark = withInstall(stdin_default$4);
15923class ReactiveListener {
15924 constructor({
15925 el,
15926 src,
15927 error,
15928 loading,
15929 bindType,
15930 $parent,
15931 options,
15932 cors,
15933 elRenderer,
15934 imageCache
15935 }) {
15936 this.el = el;
15937 this.src = src;
15938 this.error = error;
15939 this.loading = loading;
15940 this.bindType = bindType;
15941 this.attempt = 0;
15942 this.cors = cors;
15943 this.naturalHeight = 0;
15944 this.naturalWidth = 0;
15945 this.options = options;
15946 this.$parent = $parent;
15947 this.elRenderer = elRenderer;
15948 this.imageCache = imageCache;
15949 this.performanceData = {
15950 loadStart: 0,
15951 loadEnd: 0
15952 };
15953 this.filter();
15954 this.initState();
15955 this.render("loading", false);
15956 }
15957 /*
15958 * init listener state
15959 * @return
15960 */
15961 initState() {
15962 if ("dataset" in this.el) {
15963 this.el.dataset.src = this.src;
15964 } else {
15965 this.el.setAttribute("data-src", this.src);
15966 }
15967 this.state = {
15968 loading: false,
15969 error: false,
15970 loaded: false,
15971 rendered: false
15972 };
15973 }
15974 /*
15975 * record performance
15976 * @return
15977 */
15978 record(event) {
15979 this.performanceData[event] = Date.now();
15980 }
15981 /*
15982 * update image listener data
15983 * @param {String} image uri
15984 * @param {String} loading image uri
15985 * @param {String} error image uri
15986 * @return
15987 */
15988 update({ src, loading, error }) {
15989 const oldSrc = this.src;
15990 this.src = src;
15991 this.loading = loading;
15992 this.error = error;
15993 this.filter();
15994 if (oldSrc !== this.src) {
15995 this.attempt = 0;
15996 this.initState();
15997 }
15998 }
15999 /*
16000 * check el is in view
16001 * @return {Boolean} el is in view
16002 */
16003 checkInView() {
16004 const rect = use.useRect(this.el);
16005 return rect.top < window.innerHeight * this.options.preLoad && rect.bottom > this.options.preLoadTop && rect.left < window.innerWidth * this.options.preLoad && rect.right > 0;
16006 }
16007 /*
16008 * listener filter
16009 */
16010 filter() {
16011 Object.keys(this.options.filter).forEach((key) => {
16012 this.options.filter[key](this, this.options);
16013 });
16014 }
16015 /*
16016 * render loading first
16017 * @params cb:Function
16018 * @return
16019 */
16020 renderLoading(cb) {
16021 this.state.loading = true;
16022 loadImageAsync(
16023 {
16024 src: this.loading,
16025 cors: this.cors
16026 },
16027 () => {
16028 this.render("loading", false);
16029 this.state.loading = false;
16030 cb();
16031 },
16032 () => {
16033 cb();
16034 this.state.loading = false;
16035 if (process.env.NODE_ENV !== "production" && !this.options.silent)
16036 console.warn(
16037 `[@vant/lazyload] load failed with loading image(${this.loading})`
16038 );
16039 }
16040 );
16041 }
16042 /*
16043 * try load image and render it
16044 * @return
16045 */
16046 load(onFinish = noop) {
16047 if (this.attempt > this.options.attempt - 1 && this.state.error) {
16048 if (process.env.NODE_ENV !== "production" && !this.options.silent) {
16049 console.log(
16050 `[@vant/lazyload] ${this.src} tried too more than ${this.options.attempt} times`
16051 );
16052 }
16053 onFinish();
16054 return;
16055 }
16056 if (this.state.rendered && this.state.loaded)
16057 return;
16058 if (this.imageCache.has(this.src)) {
16059 this.state.loaded = true;
16060 this.render("loaded", true);
16061 this.state.rendered = true;
16062 return onFinish();
16063 }
16064 this.renderLoading(() => {
16065 var _a, _b;
16066 this.attempt++;
16067 (_b = (_a = this.options.adapter).beforeLoad) == null ? void 0 : _b.call(_a, this, this.options);
16068 this.record("loadStart");
16069 loadImageAsync(
16070 {
16071 src: this.src,
16072 cors: this.cors
16073 },
16074 (data) => {
16075 this.naturalHeight = data.naturalHeight;
16076 this.naturalWidth = data.naturalWidth;
16077 this.state.loaded = true;
16078 this.state.error = false;
16079 this.record("loadEnd");
16080 this.render("loaded", false);
16081 this.state.rendered = true;
16082 this.imageCache.add(this.src);
16083 onFinish();
16084 },
16085 (err) => {
16086 !this.options.silent && console.error(err);
16087 this.state.error = true;
16088 this.state.loaded = false;
16089 this.render("error", false);
16090 }
16091 );
16092 });
16093 }
16094 /*
16095 * render image
16096 * @param {String} state to render // ['loading', 'src', 'error']
16097 * @param {String} is form cache
16098 * @return
16099 */
16100 render(state, cache) {
16101 this.elRenderer(this, state, cache);
16102 }
16103 /*
16104 * output performance data
16105 * @return {Object} performance data
16106 */
16107 performance() {
16108 let state = "loading";
16109 let time = 0;
16110 if (this.state.loaded) {
16111 state = "loaded";
16112 time = (this.performanceData.loadEnd - this.performanceData.loadStart) / 1e3;
16113 }
16114 if (this.state.error)
16115 state = "error";
16116 return {
16117 src: this.src,
16118 state,
16119 time
16120 };
16121 }
16122 /*
16123 * $destroy
16124 * @return
16125 */
16126 $destroy() {
16127 this.el = null;
16128 this.src = null;
16129 this.error = null;
16130 this.loading = null;
16131 this.bindType = null;
16132 this.attempt = 0;
16133 }
16134}
16135const DEFAULT_URL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
16136const DEFAULT_EVENTS = [
16137 "scroll",
16138 "wheel",
16139 "mousewheel",
16140 "resize",
16141 "animationend",
16142 "transitionend",
16143 "touchmove"
16144];
16145const DEFAULT_OBSERVER_OPTIONS = {
16146 rootMargin: "0px",
16147 threshold: 0
16148};
16149function stdin_default$3() {
16150 return class Lazy {
16151 constructor({
16152 preLoad,
16153 error,
16154 throttleWait,
16155 preLoadTop,
16156 dispatchEvent,
16157 loading,
16158 attempt,
16159 silent = true,
16160 scale,
16161 listenEvents,
16162 filter,
16163 adapter,
16164 observer,
16165 observerOptions
16166 }) {
16167 this.mode = modeType.event;
16168 this.listeners = [];
16169 this.targetIndex = 0;
16170 this.targets = [];
16171 this.options = {
16172 silent,
16173 dispatchEvent: !!dispatchEvent,
16174 throttleWait: throttleWait || 200,
16175 preLoad: preLoad || 1.3,
16176 preLoadTop: preLoadTop || 0,
16177 error: error || DEFAULT_URL,
16178 loading: loading || DEFAULT_URL,
16179 attempt: attempt || 3,
16180 scale: scale || getDPR(scale),
16181 ListenEvents: listenEvents || DEFAULT_EVENTS,
16182 supportWebp: supportWebp(),
16183 filter: filter || {},
16184 adapter: adapter || {},
16185 observer: !!observer,
16186 observerOptions: observerOptions || DEFAULT_OBSERVER_OPTIONS
16187 };
16188 this.initEvent();
16189 this.imageCache = new ImageCache({ max: 200 });
16190 this.lazyLoadHandler = throttle(
16191 this.lazyLoadHandler.bind(this),
16192 this.options.throttleWait
16193 );
16194 this.setMode(this.options.observer ? modeType.observer : modeType.event);
16195 }
16196 /**
16197 * update config
16198 * @param {Object} config params
16199 * @return
16200 */
16201 config(options = {}) {
16202 Object.assign(this.options, options);
16203 }
16204 /**
16205 * output listener's load performance
16206 * @return {Array}
16207 */
16208 performance() {
16209 return this.listeners.map((item) => item.performance());
16210 }
16211 /*
16212 * add lazy component to queue
16213 * @param {Vue} vm lazy component instance
16214 * @return
16215 */
16216 addLazyBox(vm) {
16217 this.listeners.push(vm);
16218 if (use.inBrowser) {
16219 this.addListenerTarget(window);
16220 this.observer && this.observer.observe(vm.el);
16221 if (vm.$el && vm.$el.parentNode) {
16222 this.addListenerTarget(vm.$el.parentNode);
16223 }
16224 }
16225 }
16226 /*
16227 * add image listener to queue
16228 * @param {DOM} el
16229 * @param {object} binding vue directive binding
16230 * @param {vnode} vnode vue directive vnode
16231 * @return
16232 */
16233 add(el, binding, vnode) {
16234 if (this.listeners.some((item) => item.el === el)) {
16235 this.update(el, binding);
16236 return vue.nextTick(this.lazyLoadHandler);
16237 }
16238 const value = this.valueFormatter(binding.value);
16239 let { src } = value;
16240 vue.nextTick(() => {
16241 src = getBestSelectionFromSrcset(el, this.options.scale) || src;
16242 this.observer && this.observer.observe(el);
16243 const container = Object.keys(binding.modifiers)[0];
16244 let $parent;
16245 if (container) {
16246 $parent = vnode.context.$refs[container];
16247 $parent = $parent ? $parent.$el || $parent : document.getElementById(container);
16248 }
16249 if (!$parent) {
16250 $parent = use.getScrollParent(el);
16251 }
16252 const newListener = new ReactiveListener({
16253 bindType: binding.arg,
16254 $parent,
16255 el,
16256 src,
16257 loading: value.loading,
16258 error: value.error,
16259 cors: value.cors,
16260 elRenderer: this.elRenderer.bind(this),
16261 options: this.options,
16262 imageCache: this.imageCache
16263 });
16264 this.listeners.push(newListener);
16265 if (use.inBrowser) {
16266 this.addListenerTarget(window);
16267 this.addListenerTarget($parent);
16268 }
16269 this.lazyLoadHandler();
16270 vue.nextTick(() => this.lazyLoadHandler());
16271 });
16272 }
16273 /**
16274 * update image src
16275 * @param {DOM} el
16276 * @param {object} vue directive binding
16277 * @return
16278 */
16279 update(el, binding, vnode) {
16280 const value = this.valueFormatter(binding.value);
16281 let { src } = value;
16282 src = getBestSelectionFromSrcset(el, this.options.scale) || src;
16283 const exist = this.listeners.find((item) => item.el === el);
16284 if (!exist) {
16285 this.add(el, binding, vnode);
16286 } else {
16287 exist.update({
16288 src,
16289 error: value.error,
16290 loading: value.loading
16291 });
16292 }
16293 if (this.observer) {
16294 this.observer.unobserve(el);
16295 this.observer.observe(el);
16296 }
16297 this.lazyLoadHandler();
16298 vue.nextTick(() => this.lazyLoadHandler());
16299 }
16300 /**
16301 * remove listener form list
16302 * @param {DOM} el
16303 * @return
16304 */
16305 remove(el) {
16306 if (!el)
16307 return;
16308 this.observer && this.observer.unobserve(el);
16309 const existItem = this.listeners.find((item) => item.el === el);
16310 if (existItem) {
16311 this.removeListenerTarget(existItem.$parent);
16312 this.removeListenerTarget(window);
16313 remove(this.listeners, existItem);
16314 existItem.$destroy();
16315 }
16316 }
16317 /*
16318 * remove lazy components form list
16319 * @param {Vue} vm Vue instance
16320 * @return
16321 */
16322 removeComponent(vm) {
16323 if (!vm)
16324 return;
16325 remove(this.listeners, vm);
16326 this.observer && this.observer.unobserve(vm.el);
16327 if (vm.$parent && vm.$el.parentNode) {
16328 this.removeListenerTarget(vm.$el.parentNode);
16329 }
16330 this.removeListenerTarget(window);
16331 }
16332 setMode(mode) {
16333 if (!hasIntersectionObserver && mode === modeType.observer) {
16334 mode = modeType.event;
16335 }
16336 this.mode = mode;
16337 if (mode === modeType.event) {
16338 if (this.observer) {
16339 this.listeners.forEach((listener) => {
16340 this.observer.unobserve(listener.el);
16341 });
16342 this.observer = null;
16343 }
16344 this.targets.forEach((target) => {
16345 this.initListen(target.el, true);
16346 });
16347 } else {
16348 this.targets.forEach((target) => {
16349 this.initListen(target.el, false);
16350 });
16351 this.initIntersectionObserver();
16352 }
16353 }
16354 /*
16355 *** Private functions ***
16356 */
16357 /*
16358 * add listener target
16359 * @param {DOM} el listener target
16360 * @return
16361 */
16362 addListenerTarget(el) {
16363 if (!el)
16364 return;
16365 let target = this.targets.find((target2) => target2.el === el);
16366 if (!target) {
16367 target = {
16368 el,
16369 id: ++this.targetIndex,
16370 childrenCount: 1,
16371 listened: true
16372 };
16373 this.mode === modeType.event && this.initListen(target.el, true);
16374 this.targets.push(target);
16375 } else {
16376 target.childrenCount++;
16377 }
16378 return this.targetIndex;
16379 }
16380 /*
16381 * remove listener target or reduce target childrenCount
16382 * @param {DOM} el or window
16383 * @return
16384 */
16385 removeListenerTarget(el) {
16386 this.targets.forEach((target, index) => {
16387 if (target.el === el) {
16388 target.childrenCount--;
16389 if (!target.childrenCount) {
16390 this.initListen(target.el, false);
16391 this.targets.splice(index, 1);
16392 target = null;
16393 }
16394 }
16395 });
16396 }
16397 /*
16398 * add or remove eventlistener
16399 * @param {DOM} el DOM or Window
16400 * @param {boolean} start flag
16401 * @return
16402 */
16403 initListen(el, start) {
16404 this.options.ListenEvents.forEach(
16405 (evt) => (start ? on : off)(el, evt, this.lazyLoadHandler)
16406 );
16407 }
16408 initEvent() {
16409 this.Event = {
16410 listeners: {
16411 loading: [],
16412 loaded: [],
16413 error: []
16414 }
16415 };
16416 this.$on = (event, func) => {
16417 if (!this.Event.listeners[event])
16418 this.Event.listeners[event] = [];
16419 this.Event.listeners[event].push(func);
16420 };
16421 this.$once = (event, func) => {
16422 const on2 = (...args) => {
16423 this.$off(event, on2);
16424 func.apply(this, args);
16425 };
16426 this.$on(event, on2);
16427 };
16428 this.$off = (event, func) => {
16429 if (!func) {
16430 if (!this.Event.listeners[event])
16431 return;
16432 this.Event.listeners[event].length = 0;
16433 return;
16434 }
16435 remove(this.Event.listeners[event], func);
16436 };
16437 this.$emit = (event, context, inCache) => {
16438 if (!this.Event.listeners[event])
16439 return;
16440 this.Event.listeners[event].forEach((func) => func(context, inCache));
16441 };
16442 }
16443 /**
16444 * find nodes which in viewport and trigger load
16445 * @return
16446 */
16447 lazyLoadHandler() {
16448 const freeList = [];
16449 this.listeners.forEach((listener) => {
16450 if (!listener.el || !listener.el.parentNode) {
16451 freeList.push(listener);
16452 }
16453 const catIn = listener.checkInView();
16454 if (!catIn)
16455 return;
16456 listener.load();
16457 });
16458 freeList.forEach((item) => {
16459 remove(this.listeners, item);
16460 item.$destroy();
16461 });
16462 }
16463 /**
16464 * init IntersectionObserver
16465 * set mode to observer
16466 * @return
16467 */
16468 initIntersectionObserver() {
16469 if (!hasIntersectionObserver) {
16470 return;
16471 }
16472 this.observer = new IntersectionObserver(
16473 this.observerHandler.bind(this),
16474 this.options.observerOptions
16475 );
16476 if (this.listeners.length) {
16477 this.listeners.forEach((listener) => {
16478 this.observer.observe(listener.el);
16479 });
16480 }
16481 }
16482 /**
16483 * init IntersectionObserver
16484 * @return
16485 */
16486 observerHandler(entries) {
16487 entries.forEach((entry) => {
16488 if (entry.isIntersecting) {
16489 this.listeners.forEach((listener) => {
16490 if (listener.el === entry.target) {
16491 if (listener.state.loaded)
16492 return this.observer.unobserve(listener.el);
16493 listener.load();
16494 }
16495 });
16496 }
16497 });
16498 }
16499 /**
16500 * set element attribute with image'url and state
16501 * @param {object} lazyload listener object
16502 * @param {string} state will be rendered
16503 * @param {bool} inCache is rendered from cache
16504 * @return
16505 */
16506 elRenderer(listener, state, cache) {
16507 if (!listener.el)
16508 return;
16509 const { el, bindType } = listener;
16510 let src;
16511 switch (state) {
16512 case "loading":
16513 src = listener.loading;
16514 break;
16515 case "error":
16516 src = listener.error;
16517 break;
16518 default:
16519 ({ src } = listener);
16520 break;
16521 }
16522 if (bindType) {
16523 el.style[bindType] = 'url("' + src + '")';
16524 } else if (el.getAttribute("src") !== src) {
16525 el.setAttribute("src", src);
16526 }
16527 el.setAttribute("lazy", state);
16528 this.$emit(state, listener, cache);
16529 this.options.adapter[state] && this.options.adapter[state](listener, this.options);
16530 if (this.options.dispatchEvent) {
16531 const event = new CustomEvent(state, {
16532 detail: listener
16533 });
16534 el.dispatchEvent(event);
16535 }
16536 }
16537 /**
16538 * generate loading loaded error image url
16539 * @param {string} image's src
16540 * @return {object} image's loading, loaded, error url
16541 */
16542 valueFormatter(value) {
16543 let src = value;
16544 let { loading, error } = this.options;
16545 if (isObject(value)) {
16546 if (process.env.NODE_ENV !== "production" && !value.src && !this.options.silent) {
16547 console.error("[@vant/lazyload] miss src with " + value);
16548 }
16549 ({ src } = value);
16550 loading = value.loading || this.options.loading;
16551 error = value.error || this.options.error;
16552 }
16553 return {
16554 src,
16555 loading,
16556 error
16557 };
16558 }
16559 };
16560}
16561var stdin_default$2 = (lazy) => ({
16562 props: {
16563 tag: {
16564 type: String,
16565 default: "div"
16566 }
16567 },
16568 emits: ["show"],
16569 render() {
16570 return vue.h(
16571 this.tag,
16572 this.show && this.$slots.default ? this.$slots.default() : null
16573 );
16574 },
16575 data() {
16576 return {
16577 el: null,
16578 state: {
16579 loaded: false
16580 },
16581 show: false
16582 };
16583 },
16584 mounted() {
16585 this.el = this.$el;
16586 lazy.addLazyBox(this);
16587 lazy.lazyLoadHandler();
16588 },
16589 beforeUnmount() {
16590 lazy.removeComponent(this);
16591 },
16592 methods: {
16593 checkInView() {
16594 const rect = use.useRect(this.$el);
16595 return use.inBrowser && rect.top < window.innerHeight * lazy.options.preLoad && rect.bottom > 0 && rect.left < window.innerWidth * lazy.options.preLoad && rect.right > 0;
16596 },
16597 load() {
16598 this.show = true;
16599 this.state.loaded = true;
16600 this.$emit("show", this);
16601 },
16602 destroy() {
16603 return this.$destroy;
16604 }
16605 }
16606});
16607const defaultOptions = {
16608 selector: "img"
16609};
16610class LazyContainer {
16611 constructor({ el, binding, vnode, lazy }) {
16612 this.el = null;
16613 this.vnode = vnode;
16614 this.binding = binding;
16615 this.options = {};
16616 this.lazy = lazy;
16617 this.queue = [];
16618 this.update({ el, binding });
16619 }
16620 update({ el, binding }) {
16621 this.el = el;
16622 this.options = Object.assign({}, defaultOptions, binding.value);
16623 const imgs = this.getImgs();
16624 imgs.forEach((el2) => {
16625 this.lazy.add(
16626 el2,
16627 Object.assign({}, this.binding, {
16628 value: {
16629 src: "dataset" in el2 ? el2.dataset.src : el2.getAttribute("data-src"),
16630 error: ("dataset" in el2 ? el2.dataset.error : el2.getAttribute("data-error")) || this.options.error,
16631 loading: ("dataset" in el2 ? el2.dataset.loading : el2.getAttribute("data-loading")) || this.options.loading
16632 }
16633 }),
16634 this.vnode
16635 );
16636 });
16637 }
16638 getImgs() {
16639 return Array.from(this.el.querySelectorAll(this.options.selector));
16640 }
16641 clear() {
16642 const imgs = this.getImgs();
16643 imgs.forEach((el) => this.lazy.remove(el));
16644 this.vnode = null;
16645 this.binding = null;
16646 this.lazy = null;
16647 }
16648}
16649class LazyContainerManager {
16650 constructor({ lazy }) {
16651 this.lazy = lazy;
16652 this.queue = [];
16653 }
16654 bind(el, binding, vnode) {
16655 const container = new LazyContainer({
16656 el,
16657 binding,
16658 vnode,
16659 lazy: this.lazy
16660 });
16661 this.queue.push(container);
16662 }
16663 update(el, binding, vnode) {
16664 const container = this.queue.find((item) => item.el === el);
16665 if (!container)
16666 return;
16667 container.update({ el, binding, vnode });
16668 }
16669 unbind(el) {
16670 const container = this.queue.find((item) => item.el === el);
16671 if (!container)
16672 return;
16673 container.clear();
16674 remove(this.queue, container);
16675 }
16676}
16677var stdin_default$1 = (lazyManager) => ({
16678 props: {
16679 src: [String, Object],
16680 tag: {
16681 type: String,
16682 default: "img"
16683 }
16684 },
16685 render() {
16686 var _a, _b;
16687 return vue.h(
16688 this.tag,
16689 {
16690 src: this.renderSrc
16691 },
16692 (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
16693 );
16694 },
16695 data() {
16696 return {
16697 el: null,
16698 options: {
16699 src: "",
16700 error: "",
16701 loading: "",
16702 attempt: lazyManager.options.attempt
16703 },
16704 state: {
16705 loaded: false,
16706 error: false,
16707 attempt: 0
16708 },
16709 renderSrc: ""
16710 };
16711 },
16712 watch: {
16713 src() {
16714 this.init();
16715 lazyManager.addLazyBox(this);
16716 lazyManager.lazyLoadHandler();
16717 }
16718 },
16719 created() {
16720 this.init();
16721 },
16722 mounted() {
16723 this.el = this.$el;
16724 lazyManager.addLazyBox(this);
16725 lazyManager.lazyLoadHandler();
16726 },
16727 beforeUnmount() {
16728 lazyManager.removeComponent(this);
16729 },
16730 methods: {
16731 init() {
16732 const { src, loading, error } = lazyManager.valueFormatter(this.src);
16733 this.state.loaded = false;
16734 this.options.src = src;
16735 this.options.error = error;
16736 this.options.loading = loading;
16737 this.renderSrc = this.options.loading;
16738 },
16739 checkInView() {
16740 const rect = use.useRect(this.$el);
16741 return rect.top < window.innerHeight * lazyManager.options.preLoad && rect.bottom > 0 && rect.left < window.innerWidth * lazyManager.options.preLoad && rect.right > 0;
16742 },
16743 load(onFinish = noop) {
16744 if (this.state.attempt > this.options.attempt - 1 && this.state.error) {
16745 if (process.env.NODE_ENV !== "production" && !lazyManager.options.silent) {
16746 console.log(
16747 `[@vant/lazyload] ${this.options.src} tried too more than ${this.options.attempt} times`
16748 );
16749 }
16750 onFinish();
16751 return;
16752 }
16753 const { src } = this.options;
16754 loadImageAsync(
16755 { src },
16756 ({ src: src2 }) => {
16757 this.renderSrc = src2;
16758 this.state.loaded = true;
16759 },
16760 () => {
16761 this.state.attempt++;
16762 this.renderSrc = this.options.error;
16763 this.state.error = true;
16764 }
16765 );
16766 }
16767 }
16768});
16769const Lazyload = {
16770 /*
16771 * install function
16772 * @param {App} app
16773 * @param {object} options lazyload options
16774 */
16775 install(app, options = {}) {
16776 const LazyClass = stdin_default$3();
16777 const lazy = new LazyClass(options);
16778 const lazyContainer = new LazyContainerManager({ lazy });
16779 app.config.globalProperties.$Lazyload = lazy;
16780 if (options.lazyComponent) {
16781 app.component("LazyComponent", stdin_default$2(lazy));
16782 }
16783 if (options.lazyImage) {
16784 app.component("LazyImage", stdin_default$1(lazy));
16785 }
16786 app.directive("lazy", {
16787 beforeMount: lazy.add.bind(lazy),
16788 updated: lazy.update.bind(lazy),
16789 unmounted: lazy.remove.bind(lazy)
16790 });
16791 app.directive("lazy-container", {
16792 beforeMount: lazyContainer.bind.bind(lazyContainer),
16793 updated: lazyContainer.update.bind(lazyContainer),
16794 unmounted: lazyContainer.unbind.bind(lazyContainer)
16795 });
16796 }
16797};
16798const version = "4.8.7";
16799function install(app) {
16800 const components = [
16801 ActionBar,
16802 ActionBarButton,
16803 ActionBarIcon,
16804 ActionSheet,
16805 AddressEdit,
16806 AddressList,
16807 Area,
16808 BackTop,
16809 Badge,
16810 Barrage,
16811 Button,
16812 Calendar,
16813 Card,
16814 Cascader,
16815 Cell,
16816 CellGroup,
16817 Checkbox,
16818 CheckboxGroup,
16819 Circle,
16820 Col,
16821 Collapse,
16822 CollapseItem,
16823 ConfigProvider,
16824 ContactCard,
16825 ContactEdit,
16826 ContactList,
16827 CountDown,
16828 Coupon,
16829 CouponCell,
16830 CouponList,
16831 DatePicker,
16832 Dialog,
16833 Divider,
16834 DropdownItem,
16835 DropdownMenu,
16836 Empty,
16837 Field,
16838 FloatingBubble,
16839 FloatingPanel,
16840 Form,
16841 Grid,
16842 GridItem,
16843 Highlight,
16844 Icon,
16845 Image$1,
16846 ImagePreview,
16847 IndexAnchor,
16848 IndexBar,
16849 List,
16850 Loading,
16851 Locale,
16852 NavBar,
16853 NoticeBar,
16854 Notify,
16855 NumberKeyboard,
16856 Overlay,
16857 Pagination,
16858 PasswordInput,
16859 Picker,
16860 PickerGroup,
16861 Popover,
16862 Popup,
16863 Progress,
16864 PullRefresh,
16865 Radio,
16866 RadioGroup,
16867 Rate,
16868 RollingText,
16869 Row,
16870 Search,
16871 ShareSheet,
16872 Sidebar,
16873 SidebarItem,
16874 Signature,
16875 Skeleton,
16876 SkeletonAvatar,
16877 SkeletonImage,
16878 SkeletonParagraph,
16879 SkeletonTitle,
16880 Slider,
16881 Space,
16882 Step,
16883 Stepper,
16884 Steps,
16885 Sticky,
16886 SubmitBar,
16887 Swipe,
16888 SwipeCell,
16889 SwipeItem,
16890 Switch,
16891 Tab,
16892 Tabbar,
16893 TabbarItem,
16894 Tabs,
16895 Tag,
16896 TextEllipsis,
16897 TimePicker,
16898 Toast,
16899 TreeSelect,
16900 Uploader,
16901 Watermark
16902 ];
16903 components.forEach((item) => {
16904 if (item.install) {
16905 app.use(item);
16906 } else if (item.name) {
16907 app.component(item.name, item);
16908 }
16909 });
16910}
16911var stdin_default = {
16912 install,
16913 version
16914};
16915exports.ActionBar = ActionBar;
16916exports.ActionBarButton = ActionBarButton;
16917exports.ActionBarIcon = ActionBarIcon;
16918exports.ActionSheet = ActionSheet;
16919exports.AddressEdit = AddressEdit;
16920exports.AddressList = AddressList;
16921exports.Area = Area;
16922exports.BackTop = BackTop;
16923exports.Badge = Badge;
16924exports.Barrage = Barrage;
16925exports.Button = Button;
16926exports.Calendar = Calendar;
16927exports.Card = Card;
16928exports.Cascader = Cascader;
16929exports.Cell = Cell;
16930exports.CellGroup = CellGroup;
16931exports.Checkbox = Checkbox;
16932exports.CheckboxGroup = CheckboxGroup;
16933exports.Circle = Circle;
16934exports.Col = Col;
16935exports.Collapse = Collapse;
16936exports.CollapseItem = CollapseItem;
16937exports.ConfigProvider = ConfigProvider;
16938exports.ContactCard = ContactCard;
16939exports.ContactEdit = ContactEdit;
16940exports.ContactList = ContactList;
16941exports.CountDown = CountDown;
16942exports.Coupon = Coupon;
16943exports.CouponCell = CouponCell;
16944exports.CouponList = CouponList;
16945exports.DEFAULT_ROW_WIDTH = DEFAULT_ROW_WIDTH;
16946exports.DatePicker = DatePicker;
16947exports.Dialog = Dialog;
16948exports.Divider = Divider;
16949exports.DropdownItem = DropdownItem;
16950exports.DropdownMenu = DropdownMenu;
16951exports.Empty = Empty;
16952exports.Field = Field;
16953exports.FloatingBubble = FloatingBubble;
16954exports.FloatingPanel = FloatingPanel;
16955exports.Form = Form;
16956exports.Grid = Grid;
16957exports.GridItem = GridItem;
16958exports.Highlight = Highlight;
16959exports.Icon = Icon;
16960exports.Image = Image$1;
16961exports.ImagePreview = ImagePreview;
16962exports.IndexAnchor = IndexAnchor;
16963exports.IndexBar = IndexBar;
16964exports.Lazyload = Lazyload;
16965exports.List = List;
16966exports.Loading = Loading;
16967exports.Locale = Locale;
16968exports.NavBar = NavBar;
16969exports.NoticeBar = NoticeBar;
16970exports.Notify = Notify;
16971exports.NumberKeyboard = NumberKeyboard;
16972exports.Overlay = Overlay;
16973exports.Pagination = Pagination;
16974exports.PasswordInput = PasswordInput;
16975exports.Picker = Picker;
16976exports.PickerGroup = PickerGroup;
16977exports.Popover = Popover;
16978exports.Popup = Popup;
16979exports.Progress = Progress;
16980exports.PullRefresh = PullRefresh;
16981exports.Radio = Radio;
16982exports.RadioGroup = RadioGroup;
16983exports.Rate = Rate;
16984exports.RollingText = RollingText;
16985exports.Row = Row;
16986exports.Search = Search;
16987exports.ShareSheet = ShareSheet;
16988exports.Sidebar = Sidebar;
16989exports.SidebarItem = SidebarItem;
16990exports.Signature = Signature;
16991exports.Skeleton = Skeleton;
16992exports.SkeletonAvatar = SkeletonAvatar;
16993exports.SkeletonImage = SkeletonImage;
16994exports.SkeletonParagraph = SkeletonParagraph;
16995exports.SkeletonTitle = SkeletonTitle;
16996exports.Slider = Slider;
16997exports.Space = Space;
16998exports.Step = Step;
16999exports.Stepper = Stepper;
17000exports.Steps = Steps;
17001exports.Sticky = Sticky;
17002exports.SubmitBar = SubmitBar;
17003exports.Swipe = Swipe;
17004exports.SwipeCell = SwipeCell;
17005exports.SwipeItem = SwipeItem;
17006exports.Switch = Switch;
17007exports.Tab = Tab;
17008exports.Tabbar = Tabbar;
17009exports.TabbarItem = TabbarItem;
17010exports.Tabs = Tabs;
17011exports.Tag = Tag;
17012exports.TextEllipsis = TextEllipsis;
17013exports.TimePicker = TimePicker;
17014exports.Toast = Toast;
17015exports.TreeSelect = TreeSelect;
17016exports.Uploader = Uploader;
17017exports.Watermark = Watermark;
17018exports.actionBarButtonProps = actionBarButtonProps;
17019exports.actionBarIconProps = actionBarIconProps;
17020exports.actionBarProps = actionBarProps;
17021exports.actionSheetProps = actionSheetProps;
17022exports.addressEditProps = addressEditProps;
17023exports.addressListProps = addressListProps;
17024exports.allowMultipleToast = allowMultipleToast;
17025exports.areaProps = areaProps;
17026exports.backTopProps = backTopProps;
17027exports.badgeProps = badgeProps;
17028exports.barrageProps = barrageProps;
17029exports.buttonProps = buttonProps;
17030exports.calendarProps = calendarProps;
17031exports.cardProps = cardProps;
17032exports.cascaderProps = cascaderProps;
17033exports.cellGroupProps = cellGroupProps;
17034exports.cellProps = cellProps;
17035exports.checkboxGroupProps = checkboxGroupProps;
17036exports.checkboxProps = checkboxProps;
17037exports.circleProps = circleProps;
17038exports.closeDialog = closeDialog;
17039exports.closeNotify = closeNotify;
17040exports.closeToast = closeToast;
17041exports.colProps = colProps;
17042exports.collapseItemProps = collapseItemProps;
17043exports.collapseProps = collapseProps;
17044exports.configProviderProps = configProviderProps;
17045exports.contactCardProps = contactCardProps;
17046exports.contactEditProps = contactEditProps;
17047exports.contactListProps = contactListProps;
17048exports.countDownProps = countDownProps;
17049exports.couponCellProps = couponCellProps;
17050exports.couponListProps = couponListProps;
17051exports.datePickerProps = datePickerProps;
17052exports.default = stdin_default;
17053exports.dialogProps = dialogProps;
17054exports.dividerProps = dividerProps;
17055exports.dropdownItemProps = dropdownItemProps;
17056exports.dropdownMenuProps = dropdownMenuProps;
17057exports.emptyProps = emptyProps;
17058exports.fieldProps = fieldProps;
17059exports.floatingBubbleProps = floatingBubbleProps;
17060exports.floatingPanelProps = floatingPanelProps;
17061exports.formProps = formProps;
17062exports.gridItemProps = gridItemProps;
17063exports.gridProps = gridProps;
17064exports.highlightProps = highlightProps;
17065exports.iconProps = iconProps;
17066exports.imagePreviewProps = imagePreviewProps;
17067exports.imageProps = imageProps;
17068exports.indexAnchorProps = indexAnchorProps;
17069exports.indexBarProps = indexBarProps;
17070exports.install = install;
17071exports.listProps = listProps;
17072exports.loadingProps = loadingProps;
17073exports.navBarProps = navBarProps;
17074exports.noticeBarProps = noticeBarProps;
17075exports.notifyProps = notifyProps;
17076exports.numberKeyboardProps = numberKeyboardProps;
17077exports.overlayProps = overlayProps;
17078exports.paginationProps = paginationProps;
17079exports.passwordInputProps = passwordInputProps;
17080exports.pickerGroupProps = pickerGroupProps;
17081exports.pickerProps = pickerProps;
17082exports.popoverProps = popoverProps;
17083exports.popupProps = popupProps$2;
17084exports.progressProps = progressProps;
17085exports.pullRefreshProps = pullRefreshProps;
17086exports.radioGroupProps = radioGroupProps;
17087exports.radioProps = radioProps;
17088exports.rateProps = rateProps;
17089exports.resetDialogDefaultOptions = resetDialogDefaultOptions;
17090exports.resetNotifyDefaultOptions = resetNotifyDefaultOptions;
17091exports.resetToastDefaultOptions = resetToastDefaultOptions;
17092exports.rollingTextProps = rollingTextProps;
17093exports.rowProps = rowProps;
17094exports.searchProps = searchProps;
17095exports.setDialogDefaultOptions = setDialogDefaultOptions;
17096exports.setNotifyDefaultOptions = setNotifyDefaultOptions;
17097exports.setToastDefaultOptions = setToastDefaultOptions;
17098exports.shareSheetProps = shareSheetProps;
17099exports.showConfirmDialog = showConfirmDialog;
17100exports.showDialog = showDialog;
17101exports.showFailToast = showFailToast;
17102exports.showImagePreview = showImagePreview;
17103exports.showLoadingToast = showLoadingToast;
17104exports.showNotify = showNotify;
17105exports.showSuccessToast = showSuccessToast;
17106exports.showToast = showToast;
17107exports.sidebarItemProps = sidebarItemProps;
17108exports.sidebarProps = sidebarProps;
17109exports.skeletonAvatarProps = skeletonAvatarProps;
17110exports.skeletonImageProps = skeletonImageProps;
17111exports.skeletonParagraphProps = skeletonParagraphProps;
17112exports.skeletonProps = skeletonProps;
17113exports.skeletonTitleProps = skeletonTitleProps;
17114exports.sliderProps = sliderProps;
17115exports.spaceProps = spaceProps;
17116exports.stepperProps = stepperProps;
17117exports.stepsProps = stepsProps;
17118exports.stickyProps = stickyProps;
17119exports.submitBarProps = submitBarProps;
17120exports.swipeCellProps = swipeCellProps;
17121exports.swipeProps = swipeProps;
17122exports.switchProps = switchProps;
17123exports.tabProps = tabProps;
17124exports.tabbarItemProps = tabbarItemProps;
17125exports.tabbarProps = tabbarProps;
17126exports.tabsProps = tabsProps;
17127exports.tagProps = tagProps;
17128exports.textEllipsisProps = textEllipsisProps;
17129exports.timePickerProps = timePickerProps;
17130exports.toastProps = toastProps;
17131exports.treeSelectProps = treeSelectProps;
17132exports.uploaderProps = uploaderProps;
17133exports.useCurrentLang = useCurrentLang;
17134exports.version = version;
17135exports.watermarkProps = watermarkProps;