import { createVNode, defineComponent, ref, unref, withCtx, createBlock, createCommentVNode, openBlock, computed, reactive, watch, withAsyncContext, resolveDirective, toDisplayString, mergeProps, customRef, toValue, nextTick, createTextVNode, Fragment, renderList, renderSlot, provide, inject, watchEffect, withDirectives, vShow, Transition, shallowRef, Teleport, useSSRContext, getCurrentInstance, onActivated } from 'vue'; import { ssrRenderComponent, ssrRenderAttrs, ssrRenderAttr, ssrInterpolate, ssrRenderList, ssrGetDirectiveProps, ssrRenderSlot, ssrRenderClass } from 'vue/server-renderer'; import { b1 as Icon$1, u as useRouter$1, a as useConfigStore, e as loading, bj as watchDebounced, x as getSupabaseStorageUrl, b as useUserStore, aE as useRoute, aD as useRouter, bk as tryOnScopeDispose, bl as getCustomerList, w as useElementSize, Y as withInstall$1, s as supabase, R as myAxios, Q as Button, T as initDefaultProps, G as useConfigInject, H as genComponentStyleHook, I as classNames, bm as getDataAndAriaProps, C as functionType, E as booleanType, D as stringType, P as PropTypes, ay as someType, J as merge, ae as flattenChildren, a3 as objectType, K as useInjectDisabled, M as resetComponent, bd as resetIcon, bn as isEmptyElement, a1 as cloneElement, a5 as getSlot, az as devWarning, F as arrayType, Z as isValidElement, a9 as hasProp, as as KeyCode, N as Keyframe, O as genFocusOutline, aL as withUndefined } from './server.mjs'; import { B as BasicIconOld, u as usePrefix } from './BasicIconOld-93vAWohq.mjs'; import { l as loadGray, S as SquarePostSkeleton } from './gray-motiQBEt.mjs'; import { g as getStoreSearchPosts } from './media-DD0HTZbK.mjs'; import { cloneDeep } from 'lodash-es'; import { defineStore } from 'pinia'; import { u as usePrice } from './usePrice-B-5-jXKQ.mjs'; import { B as BasicButton } from './BasicButton-QGDeiwgb.mjs'; import { M as Menu, _ as __nuxt_component_1 } from './index-Depu8Jil.mjs'; import _objectSpread$1 from '@babel/runtime/helpers/esm/objectSpread2'; import _extends from '@babel/runtime/helpers/esm/extends'; import { f as firstNotUndefined, B as BaseMixin, d as addEventListenerWrap, e as tooltipProps, _ as __nuxt_component_2$1, w as wrapperRaf, s as supportsPassive } from './index-C9wXCwkF.mjs'; import { g as genCollapseMotion, c as collapseMotion } from './collapseMotion-cQ2SGjCA.mjs'; import { I as Input } from './index-B8JfwQ3c.mjs'; import { V as VcCheckbox } from './Checkbox-DGyocinC.mjs'; import { u as useInjectFormItemContext, F as FormItemInputContext } from './FormItemContext-eb0AodWH.mjs'; import { TinyColor } from '@ctrl/tinycolor'; import { u as useAsyncData } from './asyncData-DMpxHWuQ.mjs'; import { p as previewImg$1 } from './logo_preview-CJTcB_Eg.mjs'; import { ContentLoader } from 'vue-content-loader'; import { T as Tag } from './index-CzRefuj3.mjs'; import { C as CustomerCard, a as CustomerCardSkeleton } from './CustomerCardSkeleton-Bqbpqnlr.mjs'; import { T as Tabs, _ as __nuxt_component_2 } from './index-CgaWfZsh.mjs'; import '../_/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:url'; import 'consola'; import 'ipx'; import 'node:path'; import 'node:crypto'; import '@supabase/supabase-js'; import '@ant-design/colors'; import 'stylis'; import 'vue-types'; import 'axios'; import '@ant-design/icons-vue'; import '../routes/renderer.mjs'; import 'vue-bundle-renderer/runtime'; import 'unhead/server'; import 'devalue'; import 'unhead/utils'; import './_plugin-vue_export-helper-1tPrXgE0.mjs'; import './index-CRte5P_X.mjs'; import 'throttle-debounce'; import './shallowequal-BCwuz4ga.mjs'; import 'lodash-es/uniq.js'; import 'dom-align'; import './index-C8EZBqzI.mjs'; import 'lodash-es/isPlainObject.js'; import 'resize-observer-polyfill'; import './UserProfilePic-BwsIUO56.mjs'; import './empty_user-BaUNCdgf.mjs'; import './useRefs-BHKrVg4I.mjs'; import 'lodash-es/pick.js'; import './useMergedState-BZEfJ8Fl.mjs'; // This icon file is generated automatically. var RightOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" } }] }, "name": "right", "theme": "outlined" }; function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var RightOutlined = function RightOutlined(props, context) { var p = _objectSpread({}, props, context.attrs); return createVNode(Icon$1, _objectSpread({}, p, { "icon": RightOutlined$1 }), null); }; RightOutlined.displayName = 'RightOutlined'; RightOutlined.inheritAttrs = false; const collapseProps = () => ({ prefixCls: String, activeKey: someType([Array, Number, String]), defaultActiveKey: someType([Array, Number, String]), accordion: booleanType(), destroyInactivePanel: booleanType(), bordered: booleanType(), expandIcon: functionType(), openAnimation: PropTypes.object, expandIconPosition: stringType(), collapsible: stringType(), ghost: booleanType(), onChange: functionType(), "onUpdate:activeKey": functionType() }); const collapsePanelProps = () => ({ openAnimation: PropTypes.object, prefixCls: String, header: PropTypes.any, headerClass: String, showArrow: booleanType(), isActive: booleanType(), destroyInactivePanel: booleanType(), /** @deprecated Use `collapsible="disabled"` instead */ disabled: booleanType(), accordion: booleanType(), forceRender: booleanType(), expandIcon: functionType(), extra: PropTypes.any, panelKey: someType(), collapsible: stringType(), role: String, onItemClick: functionType() }); const genBaseStyle$1 = (token) => { const { componentCls, collapseContentBg, padding, collapseContentPaddingHorizontal, collapseHeaderBg, collapseHeaderPadding, collapsePanelBorderRadius, lineWidth, lineType, colorBorder, colorText, colorTextHeading, colorTextDisabled, fontSize, lineHeight, marginSM, paddingSM, motionDurationSlow, fontSizeIcon } = token; const borderBase = `${lineWidth}px ${lineType} ${colorBorder}`; return { [componentCls]: _extends(_extends({}, resetComponent(token)), { backgroundColor: collapseHeaderBg, border: borderBase, borderBottom: 0, borderRadius: `${collapsePanelBorderRadius}px`, [`&-rtl`]: { direction: "rtl" }, [`& > ${componentCls}-item`]: { borderBottom: borderBase, [`&:last-child`]: { [` &, & > ${componentCls}-header`]: { borderRadius: `0 0 ${collapsePanelBorderRadius}px ${collapsePanelBorderRadius}px` } }, [`> ${componentCls}-header`]: { position: "relative", display: "flex", flexWrap: "nowrap", alignItems: "flex-start", padding: collapseHeaderPadding, color: colorTextHeading, lineHeight, cursor: "pointer", transition: `all ${motionDurationSlow}, visibility 0s`, [`> ${componentCls}-header-text`]: { flex: "auto" }, "&:focus": { outline: "none" }, // >>>>> Arrow [`${componentCls}-expand-icon`]: { height: fontSize * lineHeight, display: "flex", alignItems: "center", paddingInlineEnd: marginSM }, [`${componentCls}-arrow`]: _extends(_extends({}, resetIcon()), { fontSize: fontSizeIcon, svg: { transition: `transform ${motionDurationSlow}` } }), // >>>>> Text [`${componentCls}-header-text`]: { marginInlineEnd: "auto" } }, [`${componentCls}-header-collapsible-only`]: { cursor: "default", [`${componentCls}-header-text`]: { flex: "none", cursor: "pointer" }, [`${componentCls}-expand-icon`]: { cursor: "pointer" } }, [`${componentCls}-icon-collapsible-only`]: { cursor: "default", [`${componentCls}-expand-icon`]: { cursor: "pointer" } }, [`&${componentCls}-no-arrow`]: { [`> ${componentCls}-header`]: { paddingInlineStart: paddingSM } } }, [`${componentCls}-content`]: { color: colorText, backgroundColor: collapseContentBg, borderTop: borderBase, [`& > ${componentCls}-content-box`]: { padding: `${padding}px ${collapseContentPaddingHorizontal}px` }, [`&-hidden`]: { display: "none" } }, [`${componentCls}-item:last-child`]: { [`> ${componentCls}-content`]: { borderRadius: `0 0 ${collapsePanelBorderRadius}px ${collapsePanelBorderRadius}px` } }, [`& ${componentCls}-item-disabled > ${componentCls}-header`]: { [` &, & > .arrow `]: { color: colorTextDisabled, cursor: "not-allowed" } }, // ========================== Icon Position ========================== [`&${componentCls}-icon-position-end`]: { [`& > ${componentCls}-item`]: { [`> ${componentCls}-header`]: { [`${componentCls}-expand-icon`]: { order: 1, paddingInlineEnd: 0, paddingInlineStart: marginSM } } } } }) }; }; const genArrowStyle = (token) => { const { componentCls } = token; const fixedSelector = `> ${componentCls}-item > ${componentCls}-header ${componentCls}-arrow svg`; return { [`${componentCls}-rtl`]: { [fixedSelector]: { transform: `rotate(180deg)` } } }; }; const genBorderlessStyle = (token) => { const { componentCls, collapseHeaderBg, paddingXXS, colorBorder } = token; return { [`${componentCls}-borderless`]: { backgroundColor: collapseHeaderBg, border: 0, [`> ${componentCls}-item`]: { borderBottom: `1px solid ${colorBorder}` }, [` > ${componentCls}-item:last-child, > ${componentCls}-item:last-child ${componentCls}-header `]: { borderRadius: 0 }, [`> ${componentCls}-item:last-child`]: { borderBottom: 0 }, [`> ${componentCls}-item > ${componentCls}-content`]: { backgroundColor: "transparent", borderTop: 0 }, [`> ${componentCls}-item > ${componentCls}-content > ${componentCls}-content-box`]: { paddingTop: paddingXXS } } }; }; const genGhostStyle = (token) => { const { componentCls, paddingSM } = token; return { [`${componentCls}-ghost`]: { backgroundColor: "transparent", border: 0, [`> ${componentCls}-item`]: { borderBottom: 0, [`> ${componentCls}-content`]: { backgroundColor: "transparent", border: 0, [`> ${componentCls}-content-box`]: { paddingBlock: paddingSM } } } } }; }; const useStyle$2 = genComponentStyleHook("Collapse", (token) => { const collapseToken = merge(token, { collapseContentBg: token.colorBgContainer, collapseHeaderBg: token.colorFillAlter, collapseHeaderPadding: `${token.paddingSM}px ${token.padding}px`, collapsePanelBorderRadius: token.borderRadiusLG, collapseContentPaddingHorizontal: 16 // Fixed value }); return [genBaseStyle$1(collapseToken), genBorderlessStyle(collapseToken), genGhostStyle(collapseToken), genArrowStyle(collapseToken), genCollapseMotion(collapseToken)]; }); function getActiveKeysArray(activeKey) { let currentActiveKey = activeKey; if (!Array.isArray(currentActiveKey)) { const activeKeyType = typeof currentActiveKey; currentActiveKey = activeKeyType === "number" || activeKeyType === "string" ? [currentActiveKey] : []; } return currentActiveKey.map((key) => String(key)); } const Collapse = defineComponent({ compatConfig: { MODE: 3 }, name: "ACollapse", inheritAttrs: false, props: initDefaultProps(collapseProps(), { accordion: false, destroyInactivePanel: false, bordered: true, expandIconPosition: "start" }), slots: Object, setup(props, _ref) { let { attrs, slots, emit } = _ref; const stateActiveKey = ref(getActiveKeysArray(firstNotUndefined([props.activeKey, props.defaultActiveKey]))); watch(() => props.activeKey, () => { stateActiveKey.value = getActiveKeysArray(props.activeKey); }, { deep: true }); const { prefixCls, direction, rootPrefixCls } = useConfigInject("collapse", props); const [wrapSSR, hashId] = useStyle$2(prefixCls); const iconPosition = computed(() => { const { expandIconPosition } = props; if (expandIconPosition !== void 0) { return expandIconPosition; } return direction.value === "rtl" ? "end" : "start"; }); const renderExpandIcon = (panelProps) => { const { expandIcon = slots.expandIcon } = props; const icon = expandIcon ? expandIcon(panelProps) : createVNode(RightOutlined, { "rotate": panelProps.isActive ? 90 : void 0 }, null); return createVNode("div", { "class": [`${prefixCls.value}-expand-icon`, hashId.value], "onClick": () => ["header", "icon"].includes(props.collapsible) && onClickItem(panelProps.panelKey) }, [isValidElement(Array.isArray(expandIcon) ? icon[0] : icon) ? cloneElement(icon, { class: `${prefixCls.value}-arrow` }, false) : icon]); }; const setActiveKey = (activeKey) => { if (props.activeKey === void 0) { stateActiveKey.value = activeKey; } const newKey = props.accordion ? activeKey[0] : activeKey; emit("update:activeKey", newKey); emit("change", newKey); }; const onClickItem = (key) => { let activeKey = stateActiveKey.value; if (props.accordion) { activeKey = activeKey[0] === key ? [] : [key]; } else { activeKey = [...activeKey]; const index = activeKey.indexOf(key); const isActive = index > -1; if (isActive) { activeKey.splice(index, 1); } else { activeKey.push(key); } } setActiveKey(activeKey); }; const getNewChild = (child, index) => { var _a, _b, _c; if (isEmptyElement(child)) return; const activeKey = stateActiveKey.value; const { accordion, destroyInactivePanel, collapsible, openAnimation } = props; const animation = openAnimation || collapseMotion(`${rootPrefixCls.value}-motion-collapse`); const key = String((_a = child.key) !== null && _a !== void 0 ? _a : index); const { header = (_c = (_b = child.children) === null || _b === void 0 ? void 0 : _b.header) === null || _c === void 0 ? void 0 : _c.call(_b), headerClass, collapsible: childCollapsible, disabled } = child.props || {}; let isActive = false; if (accordion) { isActive = activeKey[0] === key; } else { isActive = activeKey.indexOf(key) > -1; } let mergeCollapsible = childCollapsible !== null && childCollapsible !== void 0 ? childCollapsible : collapsible; if (disabled || disabled === "") { mergeCollapsible = "disabled"; } const newProps = { key, panelKey: key, header, headerClass, isActive, prefixCls: prefixCls.value, destroyInactivePanel, openAnimation: animation, accordion, onItemClick: mergeCollapsible === "disabled" ? null : onClickItem, expandIcon: renderExpandIcon, collapsible: mergeCollapsible }; return cloneElement(child, newProps); }; const getItems = () => { var _a; return flattenChildren((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)).map(getNewChild); }; return () => { const { accordion, bordered, ghost } = props; const collapseClassName = classNames(prefixCls.value, { [`${prefixCls.value}-borderless`]: !bordered, [`${prefixCls.value}-icon-position-${iconPosition.value}`]: true, [`${prefixCls.value}-rtl`]: direction.value === "rtl", [`${prefixCls.value}-ghost`]: !!ghost, [attrs.class]: !!attrs.class }, hashId.value); return wrapSSR(createVNode("div", _objectSpread$1(_objectSpread$1({ "class": collapseClassName }, getDataAndAriaProps(attrs)), {}, { "style": attrs.style, "role": accordion ? "tablist" : null }), [getItems()])); }; } }); const PanelContent = defineComponent({ compatConfig: { MODE: 3 }, name: "PanelContent", props: collapsePanelProps(), setup(props, _ref) { let { slots } = _ref; const rendered = shallowRef(false); watchEffect(() => { if (props.isActive || props.forceRender) { rendered.value = true; } }); return () => { var _a; if (!rendered.value) return null; const { prefixCls, isActive, role } = props; return createVNode("div", { "class": classNames(`${prefixCls}-content`, { [`${prefixCls}-content-active`]: isActive, [`${prefixCls}-content-inactive`]: !isActive }), "role": role }, [createVNode("div", { "class": `${prefixCls}-content-box` }, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)])]); }; } }); const CollapsePanel = defineComponent({ compatConfig: { MODE: 3 }, name: "ACollapsePanel", inheritAttrs: false, props: initDefaultProps(collapsePanelProps(), { showArrow: true, isActive: false, onItemClick() { }, headerClass: "", forceRender: false }), slots: Object, // emits: ['itemClick'], setup(props, _ref) { let { slots, emit, attrs } = _ref; devWarning(props.disabled === void 0, "Collapse.Panel", '`disabled` is deprecated. Please use `collapsible="disabled"` instead.'); const { prefixCls } = useConfigInject("collapse", props); const handleItemClick = () => { emit("itemClick", props.panelKey); }; const handleKeyPress = (e) => { if (e.key === "Enter" || e.keyCode === 13 || e.which === 13) { handleItemClick(); } }; return () => { var _a, _b; const { header = (_a = slots.header) === null || _a === void 0 ? void 0 : _a.call(slots), headerClass, isActive, showArrow, destroyInactivePanel, accordion, forceRender, openAnimation, expandIcon = slots.expandIcon, extra = (_b = slots.extra) === null || _b === void 0 ? void 0 : _b.call(slots), collapsible } = props; const disabled = collapsible === "disabled"; const prefixClsValue = prefixCls.value; const headerCls = classNames(`${prefixClsValue}-header`, { [headerClass]: headerClass, [`${prefixClsValue}-header-collapsible-only`]: collapsible === "header", [`${prefixClsValue}-icon-collapsible-only`]: collapsible === "icon" }); const itemCls = classNames({ [`${prefixClsValue}-item`]: true, [`${prefixClsValue}-item-active`]: isActive, [`${prefixClsValue}-item-disabled`]: disabled, [`${prefixClsValue}-no-arrow`]: !showArrow, [`${attrs.class}`]: !!attrs.class }); let icon = createVNode("i", { "class": "arrow" }, null); if (showArrow && typeof expandIcon === "function") { icon = expandIcon(props); } const panelContent = withDirectives(createVNode(PanelContent, { "prefixCls": prefixClsValue, "isActive": isActive, "forceRender": forceRender, "role": accordion ? "tabpanel" : null }, { default: slots.default }), [[vShow, isActive]]); const transitionProps = _extends({ appear: false, css: false }, openAnimation); return createVNode("div", _objectSpread$1(_objectSpread$1({}, attrs), {}, { "class": itemCls }), [createVNode("div", { "class": headerCls, "onClick": () => !["header", "icon"].includes(collapsible) && handleItemClick(), "role": accordion ? "tab" : "button", "tabindex": disabled ? -1 : 0, "aria-expanded": isActive, "onKeypress": handleKeyPress }, [showArrow && icon, createVNode("span", { "onClick": () => collapsible === "header" && handleItemClick(), "class": `${prefixClsValue}-header-text` }, [header]), extra && createVNode("div", { "class": `${prefixClsValue}-extra` }, [extra])]), createVNode(Transition, transitionProps, { default: () => [!destroyInactivePanel || isActive ? panelContent : null] })]); }; } }); Collapse.Panel = CollapsePanel; Collapse.install = function(app) { app.component(Collapse.name, Collapse); app.component(CollapsePanel.name, CollapsePanel); return app; }; const antCheckboxEffect = new Keyframe("antCheckboxEffect", { "0%": { transform: "scale(1)", opacity: 0.5 }, "100%": { transform: "scale(1.6)", opacity: 0 } }); const genCheckboxStyle = (token) => { const { checkboxCls } = token; const wrapperCls = `${checkboxCls}-wrapper`; return [ // ===================== Basic ===================== { // Group [`${checkboxCls}-group`]: _extends(_extends({}, resetComponent(token)), { display: "inline-flex", flexWrap: "wrap", columnGap: token.marginXS, // Group > Grid [`> ${token.antCls}-row`]: { flex: 1 } }), // Wrapper [wrapperCls]: _extends(_extends({}, resetComponent(token)), { display: "inline-flex", alignItems: "baseline", cursor: "pointer", // Fix checkbox & radio in flex align #30260 "&:after": { display: "inline-block", width: 0, overflow: "hidden", content: "'\\a0'" }, // Checkbox near checkbox [`& + ${wrapperCls}`]: { marginInlineStart: 0 }, [`&${wrapperCls}-in-form-item`]: { 'input[type="checkbox"]': { width: 14, height: 14 // FIXME: magic } } }), // Wrapper > Checkbox [checkboxCls]: _extends(_extends({}, resetComponent(token)), { position: "relative", whiteSpace: "nowrap", lineHeight: 1, cursor: "pointer", // To make alignment right when `controlHeight` is changed // Ref: https://github.com/ant-design/ant-design/issues/41564 alignSelf: "center", // Wrapper > Checkbox > input [`${checkboxCls}-input`]: { position: "absolute", // Since baseline align will get additional space offset, // we need to move input to top to make it align with text. // Ref: https://github.com/ant-design/ant-design/issues/38926#issuecomment-1486137799 inset: 0, zIndex: 1, cursor: "pointer", opacity: 0, margin: 0, [`&:focus-visible + ${checkboxCls}-inner`]: _extends({}, genFocusOutline(token)) }, // Wrapper > Checkbox > inner [`${checkboxCls}-inner`]: { boxSizing: "border-box", position: "relative", top: 0, insetInlineStart: 0, display: "block", width: token.checkboxSize, height: token.checkboxSize, direction: "ltr", backgroundColor: token.colorBgContainer, border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`, borderRadius: token.borderRadiusSM, borderCollapse: "separate", transition: `all ${token.motionDurationSlow}`, "&:after": { boxSizing: "border-box", position: "absolute", top: "50%", insetInlineStart: "21.5%", display: "table", width: token.checkboxSize / 14 * 5, height: token.checkboxSize / 14 * 8, border: `${token.lineWidthBold}px solid ${token.colorWhite}`, borderTop: 0, borderInlineStart: 0, transform: "rotate(45deg) scale(0) translate(-50%,-50%)", opacity: 0, content: '""', transition: `all ${token.motionDurationFast} ${token.motionEaseInBack}, opacity ${token.motionDurationFast}` } }, // Wrapper > Checkbox + Text "& + span": { paddingInlineStart: token.paddingXS, paddingInlineEnd: token.paddingXS } }) }, // ================= Indeterminate ================= { [checkboxCls]: { "&-indeterminate": { // Wrapper > Checkbox > inner [`${checkboxCls}-inner`]: { "&:after": { top: "50%", insetInlineStart: "50%", width: token.fontSizeLG / 2, height: token.fontSizeLG / 2, backgroundColor: token.colorPrimary, border: 0, transform: "translate(-50%, -50%) scale(1)", opacity: 1, content: '""' } } } } }, // ===================== Hover ===================== { // Wrapper [`${wrapperCls}:hover ${checkboxCls}:after`]: { visibility: "visible" }, // Wrapper & Wrapper > Checkbox [` ${wrapperCls}:not(${wrapperCls}-disabled), ${checkboxCls}:not(${checkboxCls}-disabled) `]: { [`&:hover ${checkboxCls}-inner`]: { borderColor: token.colorPrimary } }, [`${wrapperCls}:not(${wrapperCls}-disabled)`]: { [`&:hover ${checkboxCls}-checked:not(${checkboxCls}-disabled) ${checkboxCls}-inner`]: { backgroundColor: token.colorPrimaryHover, borderColor: "transparent" }, [`&:hover ${checkboxCls}-checked:not(${checkboxCls}-disabled):after`]: { borderColor: token.colorPrimaryHover } } }, // ==================== Checked ==================== { // Wrapper > Checkbox [`${checkboxCls}-checked`]: { [`${checkboxCls}-inner`]: { backgroundColor: token.colorPrimary, borderColor: token.colorPrimary, "&:after": { opacity: 1, transform: "rotate(45deg) scale(1) translate(-50%,-50%)", transition: `all ${token.motionDurationMid} ${token.motionEaseOutBack} ${token.motionDurationFast}` } }, // Checked Effect "&:after": { position: "absolute", top: 0, insetInlineStart: 0, width: "100%", height: "100%", borderRadius: token.borderRadiusSM, visibility: "hidden", border: `${token.lineWidthBold}px solid ${token.colorPrimary}`, animationName: antCheckboxEffect, animationDuration: token.motionDurationSlow, animationTimingFunction: "ease-in-out", animationFillMode: "backwards", content: '""', transition: `all ${token.motionDurationSlow}` } }, [` ${wrapperCls}-checked:not(${wrapperCls}-disabled), ${checkboxCls}-checked:not(${checkboxCls}-disabled) `]: { [`&:hover ${checkboxCls}-inner`]: { backgroundColor: token.colorPrimaryHover, borderColor: "transparent" }, [`&:hover ${checkboxCls}:after`]: { borderColor: token.colorPrimaryHover } } }, // ==================== Disable ==================== { // Wrapper [`${wrapperCls}-disabled`]: { cursor: "not-allowed" }, // Wrapper > Checkbox [`${checkboxCls}-disabled`]: { // Wrapper > Checkbox > input [`&, ${checkboxCls}-input`]: { cursor: "not-allowed", // Disabled for native input to enable Tooltip event handler // ref: https://github.com/ant-design/ant-design/issues/39822#issuecomment-1365075901 pointerEvents: "none" }, // Wrapper > Checkbox > inner [`${checkboxCls}-inner`]: { background: token.colorBgContainerDisabled, borderColor: token.colorBorder, "&:after": { borderColor: token.colorTextDisabled } }, "&:after": { display: "none" }, "& + span": { color: token.colorTextDisabled }, [`&${checkboxCls}-indeterminate ${checkboxCls}-inner::after`]: { background: token.colorTextDisabled } } } ]; }; function getStyle(prefixCls, token) { const checkboxToken = merge(token, { checkboxCls: `.${prefixCls}`, checkboxSize: token.controlInteractiveSize }); return [genCheckboxStyle(checkboxToken)]; } const useStyle$1 = genComponentStyleHook("Checkbox", (token, _ref) => { let { prefixCls } = _ref; return [getStyle(prefixCls, token)]; }); const abstractCheckboxGroupProps = () => { return { name: String, prefixCls: String, options: arrayType([]), disabled: Boolean, id: String }; }; const checkboxGroupProps = () => { return _extends(_extends({}, abstractCheckboxGroupProps()), { defaultValue: arrayType(), value: arrayType(), onChange: functionType(), "onUpdate:value": functionType() }); }; const abstractCheckboxProps = () => { return { prefixCls: String, defaultChecked: booleanType(), checked: booleanType(), disabled: booleanType(), isGroup: booleanType(), value: PropTypes.any, name: String, id: String, indeterminate: booleanType(), type: stringType("checkbox"), autofocus: booleanType(), onChange: functionType(), "onUpdate:checked": functionType(), onClick: functionType(), skipGroup: booleanType(false) }; }; const checkboxProps = () => { return _extends(_extends({}, abstractCheckboxProps()), { indeterminate: booleanType(false) }); }; const CheckboxGroupContextKey = Symbol("CheckboxGroupContext"); var __rest$2 = function(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; const Checkbox = defineComponent({ compatConfig: { MODE: 3 }, name: "ACheckbox", inheritAttrs: false, __ANT_CHECKBOX: true, props: checkboxProps(), // emits: ['change', 'update:checked'], setup(props, _ref) { let { emit, attrs, slots, expose } = _ref; const formItemContext = useInjectFormItemContext(); const formItemInputContext = FormItemInputContext.useInject(); const { prefixCls, direction, disabled } = useConfigInject("checkbox", props); const contextDisabled = useInjectDisabled(); const [wrapSSR, hashId] = useStyle$1(prefixCls); const checkboxGroup = inject(CheckboxGroupContextKey, void 0); const uniId = Symbol("checkboxUniId"); const mergedDisabled = computed(() => { return (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.disabled.value) || disabled.value; }); watchEffect(() => { if (!props.skipGroup && checkboxGroup) { checkboxGroup.registerValue(uniId, props.value); } }); const handleChange = (event) => { const targetChecked = event.target.checked; emit("update:checked", targetChecked); emit("change", event); formItemContext.onFieldChange(); }; const checkboxRef = ref(); const focus = () => { var _a; (_a = checkboxRef.value) === null || _a === void 0 ? void 0 : _a.focus(); }; const blur = () => { var _a; (_a = checkboxRef.value) === null || _a === void 0 ? void 0 : _a.blur(); }; expose({ focus, blur }); return () => { var _a; const children = flattenChildren((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)); const { indeterminate, skipGroup, id = formItemContext.id.value } = props, restProps = __rest$2(props, ["indeterminate", "skipGroup", "id"]); const { onMouseenter, onMouseleave, onInput, class: className, style } = attrs, restAttrs = __rest$2(attrs, ["onMouseenter", "onMouseleave", "onInput", "class", "style"]); const checkboxProps2 = _extends(_extends(_extends(_extends({}, restProps), { id, prefixCls: prefixCls.value }), restAttrs), { disabled: mergedDisabled.value }); if (checkboxGroup && !skipGroup) { checkboxProps2.onChange = function() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } emit("change", ...args); checkboxGroup.toggleOption({ label: children, value: props.value }); }; checkboxProps2.name = checkboxGroup.name.value; checkboxProps2.checked = checkboxGroup.mergedValue.value.includes(props.value); checkboxProps2.disabled = mergedDisabled.value || contextDisabled.value; checkboxProps2.indeterminate = indeterminate; } else { checkboxProps2.onChange = handleChange; } const classString = classNames({ [`${prefixCls.value}-wrapper`]: true, [`${prefixCls.value}-rtl`]: direction.value === "rtl", [`${prefixCls.value}-wrapper-checked`]: checkboxProps2.checked, [`${prefixCls.value}-wrapper-disabled`]: checkboxProps2.disabled, [`${prefixCls.value}-wrapper-in-form-item`]: formItemInputContext.isFormItemInput }, className, hashId.value); const checkboxClass = classNames({ [`${prefixCls.value}-indeterminate`]: indeterminate }, hashId.value); const ariaChecked = indeterminate ? "mixed" : void 0; return wrapSSR(createVNode("label", { "class": classString, "style": style, "onMouseenter": onMouseenter, "onMouseleave": onMouseleave }, [createVNode(VcCheckbox, _objectSpread$1(_objectSpread$1({ "aria-checked": ariaChecked }, checkboxProps2), {}, { "class": checkboxClass, "ref": checkboxRef }), null), children.length ? createVNode("span", null, [children]) : null])); }; } }); const CheckboxGroup = defineComponent({ compatConfig: { MODE: 3 }, name: "ACheckboxGroup", inheritAttrs: false, props: checkboxGroupProps(), // emits: ['change', 'update:value'], setup(props, _ref) { let { slots, attrs, emit, expose } = _ref; const formItemContext = useInjectFormItemContext(); const { prefixCls, direction } = useConfigInject("checkbox", props); const groupPrefixCls = computed(() => `${prefixCls.value}-group`); const [wrapSSR, hashId] = useStyle$1(groupPrefixCls); const mergedValue = ref((props.value === void 0 ? props.defaultValue : props.value) || []); watch(() => props.value, () => { mergedValue.value = props.value || []; }); const options = computed(() => { return props.options.map((option) => { if (typeof option === "string" || typeof option === "number") { return { label: option, value: option }; } return option; }); }); const triggerUpdate = ref(Symbol()); const registeredValuesMap = ref(/* @__PURE__ */ new Map()); const cancelValue = (id) => { registeredValuesMap.value.delete(id); triggerUpdate.value = Symbol(); }; const registerValue = (id, value) => { registeredValuesMap.value.set(id, value); triggerUpdate.value = Symbol(); }; const registeredValues = ref(/* @__PURE__ */ new Map()); watch(triggerUpdate, () => { const valuseMap = /* @__PURE__ */ new Map(); for (const value of registeredValuesMap.value.values()) { valuseMap.set(value, true); } registeredValues.value = valuseMap; }); const toggleOption = (option) => { const optionIndex = mergedValue.value.indexOf(option.value); const value = [...mergedValue.value]; if (optionIndex === -1) { value.push(option.value); } else { value.splice(optionIndex, 1); } if (props.value === void 0) { mergedValue.value = value; } const val = value.filter((val2) => registeredValues.value.has(val2)).sort((a, b) => { const indexA = options.value.findIndex((opt) => opt.value === a); const indexB = options.value.findIndex((opt) => opt.value === b); return indexA - indexB; }); emit("update:value", val); emit("change", val); formItemContext.onFieldChange(); }; provide(CheckboxGroupContextKey, { cancelValue, registerValue, toggleOption, mergedValue, name: computed(() => props.name), disabled: computed(() => props.disabled) }); expose({ mergedValue }); return () => { var _a; const { id = formItemContext.id.value } = props; let children = null; if (options.value && options.value.length > 0) { children = options.value.map((option) => { var _a2; return createVNode(Checkbox, { "prefixCls": prefixCls.value, "key": option.value.toString(), "disabled": "disabled" in option ? option.disabled : props.disabled, "indeterminate": option.indeterminate, "value": option.value, "checked": mergedValue.value.indexOf(option.value) !== -1, "onChange": option.onChange, "class": `${groupPrefixCls.value}-item` }, { default: () => [slots.label !== void 0 ? (_a2 = slots.label) === null || _a2 === void 0 ? void 0 : _a2.call(slots, option) : option.label] }); }); } return wrapSSR(createVNode("div", _objectSpread$1(_objectSpread$1({}, attrs), {}, { "class": [groupPrefixCls.value, { [`${groupPrefixCls.value}-rtl`]: direction.value === "rtl" }, attrs.class, hashId.value], "id": id }), [children || ((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots))])); }; } }); Checkbox.Group = CheckboxGroup; Checkbox.install = function(app) { app.component(Checkbox.name, Checkbox); app.component(CheckboxGroup.name, CheckboxGroup); return app; }; const Track = (_, _ref) => { let { attrs } = _ref; const { included, vertical, style, class: className } = attrs; let { length, offset, reverse } = attrs; if (length < 0) { reverse = !reverse; length = Math.abs(length); offset = 100 - offset; } const positionStyle = vertical ? { [reverse ? "top" : "bottom"]: `${offset}%`, [reverse ? "bottom" : "top"]: "auto", height: `${length}%` } : { [reverse ? "right" : "left"]: `${offset}%`, [reverse ? "left" : "right"]: "auto", width: `${length}%` }; const elStyle = _extends(_extends({}, style), positionStyle); return included ? createVNode("div", { "class": className, "style": elStyle }, null) : null; }; Track.inheritAttrs = false; const calcPoints = (_vertical, marks, dots, step, min, max) => { const points = Object.keys(marks).map(parseFloat).sort((a, b) => a - b); if (dots && step) { for (let i = min; i <= max; i += step) { if (points.indexOf(i) === -1) { points.push(i); } } } return points; }; const Steps = (_, _ref) => { let { attrs } = _ref; const { prefixCls, vertical, reverse, marks, dots, step, included, lowerBound, upperBound, max, min, dotStyle, activeDotStyle } = attrs; const range = max - min; const elements = calcPoints(vertical, marks, dots, step, min, max).map((point) => { const offset = `${Math.abs(point - min) / range * 100}%`; const isActived = !included && point === upperBound || included && point <= upperBound && point >= lowerBound; let style = vertical ? _extends(_extends({}, dotStyle), { [reverse ? "top" : "bottom"]: offset }) : _extends(_extends({}, dotStyle), { [reverse ? "right" : "left"]: offset }); if (isActived) { style = _extends(_extends({}, style), activeDotStyle); } const pointClassName = classNames({ [`${prefixCls}-dot`]: true, [`${prefixCls}-dot-active`]: isActived, [`${prefixCls}-dot-reverse`]: reverse }); return createVNode("span", { "class": pointClassName, "style": style, "key": point }, null); }); return createVNode("div", { "class": `${prefixCls}-step` }, [elements]); }; Steps.inheritAttrs = false; const Marks = (_, _ref) => { let { attrs, slots } = _ref; const { class: className, vertical, reverse, marks, included, upperBound, lowerBound, max, min, onClickLabel } = attrs; const marksKeys = Object.keys(marks); const customMark = slots.mark; const range = max - min; const elements = marksKeys.map(parseFloat).sort((a, b) => a - b).map((point) => { const markPoint = typeof marks[point] === "function" ? marks[point]() : marks[point]; const markPointIsObject = typeof markPoint === "object" && !isValidElement(markPoint); let markLabel = markPointIsObject ? markPoint.label : markPoint; if (!markLabel && markLabel !== 0) { return null; } if (customMark) { markLabel = customMark({ point, label: markLabel }); } const isActive = !included && point === upperBound || included && point <= upperBound && point >= lowerBound; const markClassName = classNames({ [`${className}-text`]: true, [`${className}-text-active`]: isActive }); const bottomStyle = { marginBottom: "-50%", [reverse ? "top" : "bottom"]: `${(point - min) / range * 100}%` }; const leftStyle = { transform: `translateX(${reverse ? `50%` : `-50%`})`, msTransform: `translateX(${reverse ? `50%` : `-50%`})`, [reverse ? "right" : "left"]: `${(point - min) / range * 100}%` }; const style = vertical ? bottomStyle : leftStyle; const markStyle = markPointIsObject ? _extends(_extends({}, style), markPoint.style) : style; const touchEvents = { [supportsPassive ? "onTouchstartPassive" : "onTouchstart"]: (e) => onClickLabel(e, point) }; return createVNode("span", _objectSpread$1({ "class": markClassName, "style": markStyle, "key": point, "onMousedown": (e) => onClickLabel(e, point) }, touchEvents), [markLabel]); }); return createVNode("div", { "class": className }, [elements]); }; Marks.inheritAttrs = false; const VcHandle = defineComponent({ compatConfig: { MODE: 3 }, name: "Handle", inheritAttrs: false, props: { prefixCls: String, vertical: { type: Boolean, default: void 0 }, offset: Number, disabled: { type: Boolean, default: void 0 }, min: Number, max: Number, value: Number, tabindex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), reverse: { type: Boolean, default: void 0 }, ariaLabel: String, ariaLabelledBy: String, ariaValueTextFormatter: Function, onMouseenter: { type: Function }, onMouseleave: { type: Function }, onMousedown: { type: Function } }, setup(props, _ref) { let { attrs, emit, expose } = _ref; const clickFocused = shallowRef(false); const handle = shallowRef(); const handleBlur = (e) => { clickFocused.value = false; emit("blur", e); }; const handleKeyDown = () => { clickFocused.value = false; }; const focus = () => { var _a; (_a = handle.value) === null || _a === void 0 ? void 0 : _a.focus(); }; const blur = () => { var _a; (_a = handle.value) === null || _a === void 0 ? void 0 : _a.blur(); }; const clickFocus = () => { clickFocused.value = true; focus(); }; const handleMousedown = (e) => { e.preventDefault(); focus(); emit("mousedown", e); }; expose({ focus, blur, clickFocus, ref: handle }); const positionStyle = computed(() => { const { vertical, offset, reverse } = props; return vertical ? { [reverse ? "top" : "bottom"]: `${offset}%`, [reverse ? "bottom" : "top"]: "auto", transform: reverse ? null : `translateY(+50%)` } : { [reverse ? "right" : "left"]: `${offset}%`, [reverse ? "left" : "right"]: "auto", transform: `translateX(${reverse ? "+" : "-"}50%)` }; }); return () => { const { prefixCls, disabled, min, max, value, tabindex, ariaLabel, ariaLabelledBy, ariaValueTextFormatter, onMouseenter, onMouseleave } = props; const className = classNames(attrs.class, { [`${prefixCls}-handle-click-focused`]: clickFocused.value }); const ariaProps = { "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value, "aria-disabled": !!disabled }; const elStyle = [attrs.style, positionStyle.value]; let mergedTabIndex = tabindex || 0; if (disabled || tabindex === null) { mergedTabIndex = null; } let ariaValueText; if (ariaValueTextFormatter) { ariaValueText = ariaValueTextFormatter(value); } const handleProps = _extends(_extends(_extends(_extends({}, attrs), { role: "slider", tabindex: mergedTabIndex }), ariaProps), { class: className, onBlur: handleBlur, onKeydown: handleKeyDown, onMousedown: handleMousedown, onMouseenter, onMouseleave, ref: handle, style: elStyle }); return createVNode("div", _objectSpread$1(_objectSpread$1({}, handleProps), {}, { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-valuetext": ariaValueText }), null); }; } }); function isEventFromHandle(e, handles) { try { return Object.keys(handles).some((key) => e.target === handles[key].ref); } catch (error) { return false; } } function isValueOutOfRange(value, _ref) { let { min, max } = _ref; return value < min || value > max; } function isNotTouchEvent(e) { return e.touches.length > 1 || e.type.toLowerCase() === "touchend" && e.touches.length > 0; } function getClosestPoint(val, _ref2) { let { marks, step, min, max } = _ref2; const points = Object.keys(marks).map(parseFloat); if (step !== null) { const baseNum = Math.pow(10, getPrecision(step)); const maxSteps = Math.floor((max * baseNum - min * baseNum) / (step * baseNum)); const steps = Math.min((val - min) / step, maxSteps); const closestStep = Math.round(steps) * step + min; points.push(closestStep); } const diffs = points.map((point) => Math.abs(val - point)); return points[diffs.indexOf(Math.min(...diffs))]; } function getPrecision(step) { const stepString = step.toString(); let precision = 0; if (stepString.indexOf(".") >= 0) { precision = stepString.length - stepString.indexOf(".") - 1; } return precision; } function getMousePosition(vertical, e) { let zoom = 1; if ((void 0).visualViewport) { zoom = +((void 0).visualViewport.width / (void 0).body.getBoundingClientRect().width).toFixed(2); } return (vertical ? e.clientY : e.pageX) / zoom; } function getTouchPosition(vertical, e) { let zoom = 1; if ((void 0).visualViewport) { zoom = +((void 0).visualViewport.width / (void 0).body.getBoundingClientRect().width).toFixed(2); } return (vertical ? e.touches[0].clientY : e.touches[0].pageX) / zoom; } function getHandleCenterPosition(vertical, handle) { const coords = handle.getBoundingClientRect(); return vertical ? coords.top + coords.height * 0.5 : (void 0).scrollX + coords.left + coords.width * 0.5; } function ensureValueInRange(val, _ref3) { let { max, min } = _ref3; if (val <= min) { return min; } if (val >= max) { return max; } return val; } function ensureValuePrecision(val, props) { const { step } = props; const closestPoint = isFinite(getClosestPoint(val, props)) ? getClosestPoint(val, props) : 0; return step === null ? closestPoint : parseFloat(closestPoint.toFixed(getPrecision(step))); } function pauseEvent(e) { e.stopPropagation(); e.preventDefault(); } function calculateNextValue(func, value, props) { const operations = { increase: (a, b) => a + b, decrease: (a, b) => a - b }; const indexToGet = operations[func](Object.keys(props.marks).indexOf(JSON.stringify(value)), 1); const keyToGet = Object.keys(props.marks)[indexToGet]; if (props.step) { return operations[func](value, props.step); } if (!!Object.keys(props.marks).length && !!props.marks[keyToGet]) { return props.marks[keyToGet]; } return value; } function getKeyboardValueMutator(e, vertical, reverse) { const increase = "increase"; const decrease = "decrease"; let method = increase; switch (e.keyCode) { case KeyCode.UP: method = vertical && reverse ? decrease : increase; break; case KeyCode.RIGHT: method = !vertical && reverse ? decrease : increase; break; case KeyCode.DOWN: method = vertical && reverse ? increase : decrease; break; case KeyCode.LEFT: method = !vertical && reverse ? increase : decrease; break; case KeyCode.END: return (_value, props) => props.max; case KeyCode.HOME: return (_value, props) => props.min; case KeyCode.PAGE_UP: return (value, props) => value + props.step * 2; case KeyCode.PAGE_DOWN: return (value, props) => value - props.step * 2; default: return void 0; } return (value, props) => calculateNextValue(method, value, props); } var __rest$1 = function(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; function noop$1() { } function createSlider(Component) { const propTypes = { id: String, min: Number, max: Number, step: Number, marks: PropTypes.object, included: { type: Boolean, default: void 0 }, prefixCls: String, disabled: { type: Boolean, default: void 0 }, handle: Function, dots: { type: Boolean, default: void 0 }, vertical: { type: Boolean, default: void 0 }, reverse: { type: Boolean, default: void 0 }, minimumTrackStyle: PropTypes.object, maximumTrackStyle: PropTypes.object, handleStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.arrayOf(PropTypes.object)]), trackStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.arrayOf(PropTypes.object)]), railStyle: PropTypes.object, dotStyle: PropTypes.object, activeDotStyle: PropTypes.object, autofocus: { type: Boolean, default: void 0 }, draggableTrack: { type: Boolean, default: void 0 } }; return defineComponent({ compatConfig: { MODE: 3 }, name: "CreateSlider", mixins: [BaseMixin, Component], inheritAttrs: false, props: initDefaultProps(propTypes, { prefixCls: "rc-slider", min: 0, max: 100, step: 1, marks: {}, included: true, disabled: false, dots: false, vertical: false, reverse: false, trackStyle: [{}], handleStyle: [{}], railStyle: {}, dotStyle: {}, activeDotStyle: {} }), emits: ["change", "blur", "focus"], data() { const { step, max, min } = this; this.handlesRefs = {}; return {}; }, mounted() { this.$nextTick(() => { this.document = this.sliderRef && this.sliderRef.ownerDocument; const { autofocus, disabled } = this; if (autofocus && !disabled) { this.focus(); } }); }, beforeUnmount() { this.$nextTick(() => { this.removeDocumentEvents(); }); }, methods: { defaultHandle(_a) { var { index, directives, className, style } = _a, restProps = __rest$1(_a, ["index", "directives", "className", "style"]); delete restProps.dragging; if (restProps.value === null) { return null; } const handleProps = _extends(_extends({}, restProps), { class: className, style, key: index }); return createVNode(VcHandle, handleProps, null); }, onDown(e, position) { let p = position; const { draggableTrack, vertical: isVertical } = this.$props; const { bounds } = this.$data; const value = draggableTrack && this.positionGetValue ? this.positionGetValue(p) || [] : []; const inPoint = isEventFromHandle(e, this.handlesRefs); this.dragTrack = draggableTrack && bounds.length >= 2 && !inPoint && !value.map((n, i) => { const v = !i ? n >= bounds[i] : true; return i === value.length - 1 ? n <= bounds[i] : v; }).some((c) => !c); if (this.dragTrack) { this.dragOffset = p; this.startBounds = [...bounds]; } else { if (!inPoint) { this.dragOffset = 0; } else { const handlePosition = getHandleCenterPosition(isVertical, e.target); this.dragOffset = p - handlePosition; p = handlePosition; } this.onStart(p); } }, onMouseDown(e) { if (e.button !== 0) { return; } this.removeDocumentEvents(); const isVertical = this.$props.vertical; const position = getMousePosition(isVertical, e); this.onDown(e, position); this.addDocumentMouseEvents(); }, onTouchStart(e) { if (isNotTouchEvent(e)) return; const isVertical = this.vertical; const position = getTouchPosition(isVertical, e); this.onDown(e, position); this.addDocumentTouchEvents(); pauseEvent(e); }, onFocus(e) { const { vertical } = this; if (isEventFromHandle(e, this.handlesRefs) && !this.dragTrack) { const handlePosition = getHandleCenterPosition(vertical, e.target); this.dragOffset = 0; this.onStart(handlePosition); pauseEvent(e); this.$emit("focus", e); } }, onBlur(e) { if (!this.dragTrack) { this.onEnd(); } this.$emit("blur", e); }, onMouseUp() { if (this.handlesRefs[this.prevMovedHandleIndex]) { this.handlesRefs[this.prevMovedHandleIndex].clickFocus(); } }, onMouseMove(e) { if (!this.sliderRef) { this.onEnd(); return; } const position = getMousePosition(this.vertical, e); this.onMove(e, position - this.dragOffset, this.dragTrack, this.startBounds); }, onTouchMove(e) { if (isNotTouchEvent(e) || !this.sliderRef) { this.onEnd(); return; } const position = getTouchPosition(this.vertical, e); this.onMove(e, position - this.dragOffset, this.dragTrack, this.startBounds); }, onKeyDown(e) { if (this.sliderRef && isEventFromHandle(e, this.handlesRefs)) { this.onKeyboard(e); } }, onClickMarkLabel(e, value) { e.stopPropagation(); this.onChange({ sValue: value }); this.setState({ sValue: value }, () => this.onEnd(true)); }, getSliderStart() { const slider = this.sliderRef; const { vertical, reverse } = this; const rect = slider.getBoundingClientRect(); if (vertical) { return reverse ? rect.bottom : rect.top; } return (void 0).scrollX + (reverse ? rect.right : rect.left); }, getSliderLength() { const slider = this.sliderRef; if (!slider) { return 0; } const coords = slider.getBoundingClientRect(); return this.vertical ? coords.height : coords.width; }, addDocumentTouchEvents() { this.onTouchMoveListener = addEventListenerWrap(this.document, "touchmove", this.onTouchMove); this.onTouchUpListener = addEventListenerWrap(this.document, "touchend", this.onEnd); }, addDocumentMouseEvents() { this.onMouseMoveListener = addEventListenerWrap(this.document, "mousemove", this.onMouseMove); this.onMouseUpListener = addEventListenerWrap(this.document, "mouseup", this.onEnd); }, removeDocumentEvents() { this.onTouchMoveListener && this.onTouchMoveListener.remove(); this.onTouchUpListener && this.onTouchUpListener.remove(); this.onMouseMoveListener && this.onMouseMoveListener.remove(); this.onMouseUpListener && this.onMouseUpListener.remove(); }, focus() { var _a; if (this.$props.disabled) { return; } (_a = this.handlesRefs[0]) === null || _a === void 0 ? void 0 : _a.focus(); }, blur() { if (this.$props.disabled) { return; } Object.keys(this.handlesRefs).forEach((key) => { var _a, _b; (_b = (_a = this.handlesRefs[key]) === null || _a === void 0 ? void 0 : _a.blur) === null || _b === void 0 ? void 0 : _b.call(_a); }); }, calcValue(offset) { const { vertical, min, max } = this; const ratio = Math.abs(Math.max(offset, 0) / this.getSliderLength()); const value = vertical ? (1 - ratio) * (max - min) + min : ratio * (max - min) + min; return value; }, calcValueByPos(position) { const sign = this.reverse ? -1 : 1; const pixelOffset = sign * (position - this.getSliderStart()); const nextValue = this.trimAlignValue(this.calcValue(pixelOffset)); return nextValue; }, calcOffset(value) { const { min, max } = this; const ratio = (value - min) / (max - min); return Math.max(0, ratio * 100); }, saveSlider(slider) { this.sliderRef = slider; }, saveHandle(index, handle) { this.handlesRefs[index] = handle; } }, render() { const { prefixCls, marks, dots, step, included, disabled, vertical, reverse, min, max, maximumTrackStyle, railStyle, dotStyle, activeDotStyle, id } = this; const { class: className, style } = this.$attrs; const { tracks, handles } = this.renderSlider(); const sliderClassName = classNames(prefixCls, className, { [`${prefixCls}-with-marks`]: Object.keys(marks).length, [`${prefixCls}-disabled`]: disabled, [`${prefixCls}-vertical`]: vertical, [`${prefixCls}-horizontal`]: !vertical }); const markProps = { vertical, marks, included, lowerBound: this.getLowerBound(), upperBound: this.getUpperBound(), max, min, reverse, class: `${prefixCls}-mark`, onClickLabel: disabled ? noop$1 : this.onClickMarkLabel }; const touchEvents = { [supportsPassive ? "onTouchstartPassive" : "onTouchstart"]: disabled ? noop$1 : this.onTouchStart }; return createVNode("div", _objectSpread$1(_objectSpread$1({ "id": id, "ref": this.saveSlider, "tabindex": "-1", "class": sliderClassName }, touchEvents), {}, { "onMousedown": disabled ? noop$1 : this.onMouseDown, "onMouseup": disabled ? noop$1 : this.onMouseUp, "onKeydown": disabled ? noop$1 : this.onKeyDown, "onFocus": disabled ? noop$1 : this.onFocus, "onBlur": disabled ? noop$1 : this.onBlur, "style": style }), [createVNode("div", { "class": `${prefixCls}-rail`, "style": _extends(_extends({}, maximumTrackStyle), railStyle) }, null), tracks, createVNode(Steps, { "prefixCls": prefixCls, "vertical": vertical, "reverse": reverse, "marks": marks, "dots": dots, "step": step, "included": included, "lowerBound": this.getLowerBound(), "upperBound": this.getUpperBound(), "max": max, "min": min, "dotStyle": dotStyle, "activeDotStyle": activeDotStyle }, null), handles, createVNode(Marks, markProps, { mark: this.$slots.mark }), getSlot(this)]); } }); } const Slider$2 = defineComponent({ compatConfig: { MODE: 3 }, name: "Slider", mixins: [BaseMixin], inheritAttrs: false, props: { defaultValue: Number, value: Number, disabled: { type: Boolean, default: void 0 }, autofocus: { type: Boolean, default: void 0 }, tabindex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), reverse: { type: Boolean, default: void 0 }, min: Number, max: Number, ariaLabelForHandle: String, ariaLabelledByForHandle: String, ariaValueTextFormatterForHandle: String, startPoint: Number }, emits: ["beforeChange", "afterChange", "change"], data() { const defaultValue = this.defaultValue !== void 0 ? this.defaultValue : this.min; const value = this.value !== void 0 ? this.value : defaultValue; return { sValue: this.trimAlignValue(value), dragging: false }; }, watch: { value: { handler(val) { this.setChangeValue(val); }, deep: true }, min() { const { sValue } = this; this.setChangeValue(sValue); }, max() { const { sValue } = this; this.setChangeValue(sValue); } }, methods: { setChangeValue(value) { const newValue = value !== void 0 ? value : this.sValue; const nextValue = this.trimAlignValue(newValue, this.$props); if (nextValue === this.sValue) return; this.setState({ sValue: nextValue }); if (isValueOutOfRange(newValue, this.$props)) { this.$emit("change", nextValue); } }, onChange(state) { const isNotControlled = !hasProp(this, "value"); const nextState = state.sValue > this.max ? _extends(_extends({}, state), { sValue: this.max }) : state; if (isNotControlled) { this.setState(nextState); } const changedValue = nextState.sValue; this.$emit("change", changedValue); }, onStart(position) { this.setState({ dragging: true }); const { sValue } = this; this.$emit("beforeChange", sValue); const value = this.calcValueByPos(position); this.startValue = value; this.startPosition = position; if (value === sValue) return; this.prevMovedHandleIndex = 0; this.onChange({ sValue: value }); }, onEnd(force) { const { dragging } = this; this.removeDocumentEvents(); if (dragging || force) { this.$emit("afterChange", this.sValue); } this.setState({ dragging: false }); }, onMove(e, position) { pauseEvent(e); const { sValue } = this; const value = this.calcValueByPos(position); if (value === sValue) return; this.onChange({ sValue: value }); }, onKeyboard(e) { const { reverse, vertical } = this.$props; const valueMutator = getKeyboardValueMutator(e, vertical, reverse); if (valueMutator) { pauseEvent(e); const { sValue } = this; const mutatedValue = valueMutator(sValue, this.$props); const value = this.trimAlignValue(mutatedValue); if (value === sValue) return; this.onChange({ sValue: value }); this.$emit("afterChange", value); this.onEnd(); } }, getLowerBound() { const minPoint = this.$props.startPoint || this.$props.min; return this.$data.sValue > minPoint ? minPoint : this.$data.sValue; }, getUpperBound() { if (this.$data.sValue < this.$props.startPoint) { return this.$props.startPoint; } return this.$data.sValue; }, trimAlignValue(v) { let nextProps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; if (v === null) { return null; } const mergedProps = _extends(_extends({}, this.$props), nextProps); const val = ensureValueInRange(v, mergedProps); return ensureValuePrecision(val, mergedProps); }, getTrack(_ref) { let { prefixCls, reverse, vertical, included, minimumTrackStyle, mergedTrackStyle, length, offset } = _ref; return createVNode(Track, { "class": `${prefixCls}-track`, "vertical": vertical, "included": included, "offset": offset, "reverse": reverse, "length": length, "style": _extends(_extends({}, minimumTrackStyle), mergedTrackStyle) }, null); }, renderSlider() { const { prefixCls, vertical, included, disabled, minimumTrackStyle, trackStyle, handleStyle, tabindex, ariaLabelForHandle, ariaLabelledByForHandle, ariaValueTextFormatterForHandle, min, max, startPoint, reverse, handle, defaultHandle } = this; const handleGenerator = handle || defaultHandle; const { sValue, dragging } = this; const offset = this.calcOffset(sValue); const handles = handleGenerator({ class: `${prefixCls}-handle`, prefixCls, vertical, offset, value: sValue, dragging, disabled, min, max, reverse, index: 0, tabindex, ariaLabel: ariaLabelForHandle, ariaLabelledBy: ariaLabelledByForHandle, ariaValueTextFormatter: ariaValueTextFormatterForHandle, style: handleStyle[0] || handleStyle, ref: (h) => this.saveHandle(0, h), onFocus: this.onFocus, onBlur: this.onBlur }); const trackOffset = startPoint !== void 0 ? this.calcOffset(startPoint) : 0; const mergedTrackStyle = trackStyle[0] || trackStyle; return { tracks: this.getTrack({ prefixCls, reverse, vertical, included, offset: trackOffset, minimumTrackStyle, mergedTrackStyle, length: offset - trackOffset }), handles }; } } }); const VcSlider = createSlider(Slider$2); const trimAlignValue = (_ref) => { let { value, handle, bounds, props } = _ref; const { allowCross, pushable } = props; const thershold = Number(pushable); const valInRange = ensureValueInRange(value, props); let valNotConflict = valInRange; if (!allowCross && handle != null && bounds !== void 0) { if (handle > 0 && valInRange <= bounds[handle - 1] + thershold) { valNotConflict = bounds[handle - 1] + thershold; } if (handle < bounds.length - 1 && valInRange >= bounds[handle + 1] - thershold) { valNotConflict = bounds[handle + 1] - thershold; } } return ensureValuePrecision(valNotConflict, props); }; const rangeProps = { defaultValue: PropTypes.arrayOf(PropTypes.number), value: PropTypes.arrayOf(PropTypes.number), count: Number, pushable: withUndefined(PropTypes.oneOfType([PropTypes.looseBool, PropTypes.number])), allowCross: { type: Boolean, default: void 0 }, disabled: { type: Boolean, default: void 0 }, reverse: { type: Boolean, default: void 0 }, tabindex: PropTypes.arrayOf(PropTypes.number), prefixCls: String, min: Number, max: Number, autofocus: { type: Boolean, default: void 0 }, ariaLabelGroupForHandles: Array, ariaLabelledByGroupForHandles: Array, ariaValueTextFormatterGroupForHandles: Array, draggableTrack: { type: Boolean, default: void 0 } }; const Range = defineComponent({ compatConfig: { MODE: 3 }, name: "Range", mixins: [BaseMixin], inheritAttrs: false, props: initDefaultProps(rangeProps, { count: 1, allowCross: true, pushable: false, tabindex: [], draggableTrack: false, ariaLabelGroupForHandles: [], ariaLabelledByGroupForHandles: [], ariaValueTextFormatterGroupForHandles: [] }), emits: ["beforeChange", "afterChange", "change"], displayName: "Range", data() { const { count, min, max } = this; const initialValue = Array(...Array(count + 1)).map(() => min); const defaultValue = hasProp(this, "defaultValue") ? this.defaultValue : initialValue; let { value } = this; if (value === void 0) { value = defaultValue; } const bounds = value.map((v, i) => trimAlignValue({ value: v, handle: i, props: this.$props })); const recent = bounds[0] === max ? 0 : bounds.length - 1; return { sHandle: null, recent, bounds }; }, watch: { value: { handler(val) { const { bounds } = this; this.setChangeValue(val || bounds); }, deep: true }, min() { const { value } = this; this.setChangeValue(value || this.bounds); }, max() { const { value } = this; this.setChangeValue(value || this.bounds); } }, methods: { setChangeValue(value) { const { bounds } = this; let nextBounds = value.map((v, i) => trimAlignValue({ value: v, handle: i, bounds, props: this.$props })); if (bounds.length === nextBounds.length) { if (nextBounds.every((v, i) => v === bounds[i])) { return null; } } else { nextBounds = value.map((v, i) => trimAlignValue({ value: v, handle: i, props: this.$props })); } this.setState({ bounds: nextBounds }); if (value.some((v) => isValueOutOfRange(v, this.$props))) { const newValues = value.map((v) => { return ensureValueInRange(v, this.$props); }); this.$emit("change", newValues); } }, onChange(state) { const isNotControlled = !hasProp(this, "value"); if (isNotControlled) { this.setState(state); } else { const controlledState = {}; ["sHandle", "recent"].forEach((item) => { if (state[item] !== void 0) { controlledState[item] = state[item]; } }); if (Object.keys(controlledState).length) { this.setState(controlledState); } } const data = _extends(_extends({}, this.$data), state); const changedValue = data.bounds; this.$emit("change", changedValue); }, positionGetValue(position) { const bounds = this.getValue(); const value = this.calcValueByPos(position); const closestBound = this.getClosestBound(value); const index = this.getBoundNeedMoving(value, closestBound); const prevValue = bounds[index]; if (value === prevValue) return null; const nextBounds = [...bounds]; nextBounds[index] = value; return nextBounds; }, onStart(position) { const { bounds } = this; this.$emit("beforeChange", bounds); const value = this.calcValueByPos(position); this.startValue = value; this.startPosition = position; const closestBound = this.getClosestBound(value); this.prevMovedHandleIndex = this.getBoundNeedMoving(value, closestBound); this.setState({ sHandle: this.prevMovedHandleIndex, recent: this.prevMovedHandleIndex }); const prevValue = bounds[this.prevMovedHandleIndex]; if (value === prevValue) return; const nextBounds = [...bounds]; nextBounds[this.prevMovedHandleIndex] = value; this.onChange({ bounds: nextBounds }); }, onEnd(force) { const { sHandle } = this; this.removeDocumentEvents(); if (!sHandle) { this.dragTrack = false; } if (sHandle !== null || force) { this.$emit("afterChange", this.bounds); } this.setState({ sHandle: null }); }, onMove(e, position, dragTrack, startBounds) { pauseEvent(e); const { $data: state, $props: props } = this; const maxValue = props.max || 100; const minValue = props.min || 0; if (dragTrack) { let pos = props.vertical ? -position : position; pos = props.reverse ? -pos : pos; const max = maxValue - Math.max(...startBounds); const min = minValue - Math.min(...startBounds); const ratio = Math.min(Math.max(pos / (this.getSliderLength() / 100), min), max); const nextBounds = startBounds.map((v) => Math.floor(Math.max(Math.min(v + ratio, maxValue), minValue))); if (state.bounds.map((c, i) => c === nextBounds[i]).some((c) => !c)) { this.onChange({ bounds: nextBounds }); } return; } const { bounds, sHandle } = this; const value = this.calcValueByPos(position); const oldValue = bounds[sHandle]; if (value === oldValue) return; this.moveTo(value); }, onKeyboard(e) { const { reverse, vertical } = this.$props; const valueMutator = getKeyboardValueMutator(e, vertical, reverse); if (valueMutator) { pauseEvent(e); const { bounds, sHandle } = this; const oldValue = bounds[sHandle === null ? this.recent : sHandle]; const mutatedValue = valueMutator(oldValue, this.$props); const value = trimAlignValue({ value: mutatedValue, handle: sHandle, bounds, props: this.$props }); if (value === oldValue) return; const isFromKeyboardEvent = true; this.moveTo(value, isFromKeyboardEvent); } }, getClosestBound(value) { const { bounds } = this; let closestBound = 0; for (let i = 1; i < bounds.length - 1; i += 1) { if (value >= bounds[i]) { closestBound = i; } } if (Math.abs(bounds[closestBound + 1] - value) < Math.abs(bounds[closestBound] - value)) { closestBound += 1; } return closestBound; }, getBoundNeedMoving(value, closestBound) { const { bounds, recent } = this; let boundNeedMoving = closestBound; const isAtTheSamePoint = bounds[closestBound + 1] === bounds[closestBound]; if (isAtTheSamePoint && bounds[recent] === bounds[closestBound]) { boundNeedMoving = recent; } if (isAtTheSamePoint && value !== bounds[closestBound + 1]) { boundNeedMoving = value < bounds[closestBound + 1] ? closestBound : closestBound + 1; } return boundNeedMoving; }, getLowerBound() { return this.bounds[0]; }, getUpperBound() { const { bounds } = this; return bounds[bounds.length - 1]; }, /** * Returns an array of possible slider points, taking into account both * `marks` and `step`. The result is cached. */ getPoints() { const { marks, step, min, max } = this; const cache = this.internalPointsCache; if (!cache || cache.marks !== marks || cache.step !== step) { const pointsObject = _extends({}, marks); if (step !== null) { for (let point = min; point <= max; point += step) { pointsObject[point] = point; } } const points = Object.keys(pointsObject).map(parseFloat); points.sort((a, b) => a - b); this.internalPointsCache = { marks, step, points }; } return this.internalPointsCache.points; }, moveTo(value, isFromKeyboardEvent) { const nextBounds = [...this.bounds]; const { sHandle, recent } = this; const handle = sHandle === null ? recent : sHandle; nextBounds[handle] = value; let nextHandle = handle; if (this.$props.pushable !== false) { this.pushSurroundingHandles(nextBounds, nextHandle); } else if (this.$props.allowCross) { nextBounds.sort((a, b) => a - b); nextHandle = nextBounds.indexOf(value); } this.onChange({ recent: nextHandle, sHandle: nextHandle, bounds: nextBounds }); if (isFromKeyboardEvent) { this.$emit("afterChange", nextBounds); this.setState({}, () => { this.handlesRefs[nextHandle].focus(); }); this.onEnd(); } }, pushSurroundingHandles(bounds, handle) { const value = bounds[handle]; const { pushable } = this; const threshold = Number(pushable); let direction = 0; if (bounds[handle + 1] - value < threshold) { direction = 1; } if (value - bounds[handle - 1] < threshold) { direction = -1; } if (direction === 0) { return; } const nextHandle = handle + direction; const diffToNext = direction * (bounds[nextHandle] - value); if (!this.pushHandle(bounds, nextHandle, direction, threshold - diffToNext)) { bounds[handle] = bounds[nextHandle] - direction * threshold; } }, pushHandle(bounds, handle, direction, amount) { const originalValue = bounds[handle]; let currentValue = bounds[handle]; while (direction * (currentValue - originalValue) < amount) { if (!this.pushHandleOnePoint(bounds, handle, direction)) { bounds[handle] = originalValue; return false; } currentValue = bounds[handle]; } return true; }, pushHandleOnePoint(bounds, handle, direction) { const points = this.getPoints(); const pointIndex = points.indexOf(bounds[handle]); const nextPointIndex = pointIndex + direction; if (nextPointIndex >= points.length || nextPointIndex < 0) { return false; } const nextHandle = handle + direction; const nextValue = points[nextPointIndex]; const { pushable } = this; const threshold = Number(pushable); const diffToNext = direction * (bounds[nextHandle] - nextValue); if (!this.pushHandle(bounds, nextHandle, direction, threshold - diffToNext)) { return false; } bounds[handle] = nextValue; return true; }, trimAlignValue(value) { const { sHandle, bounds } = this; return trimAlignValue({ value, handle: sHandle, bounds, props: this.$props }); }, ensureValueNotConflict(handle, val, _ref2) { let { allowCross, pushable: thershold } = _ref2; const state = this.$data || {}; const { bounds } = state; handle = handle === void 0 ? state.sHandle : handle; thershold = Number(thershold); if (!allowCross && handle != null && bounds !== void 0) { if (handle > 0 && val <= bounds[handle - 1] + thershold) { return bounds[handle - 1] + thershold; } if (handle < bounds.length - 1 && val >= bounds[handle + 1] - thershold) { return bounds[handle + 1] - thershold; } } return val; }, getTrack(_ref3) { let { bounds, prefixCls, reverse, vertical, included, offsets, trackStyle } = _ref3; return bounds.slice(0, -1).map((_, index) => { const i = index + 1; const trackClassName = classNames({ [`${prefixCls}-track`]: true, [`${prefixCls}-track-${i}`]: true }); return createVNode(Track, { "class": trackClassName, "vertical": vertical, "reverse": reverse, "included": included, "offset": offsets[i - 1], "length": offsets[i] - offsets[i - 1], "style": trackStyle[index], "key": i }, null); }); }, renderSlider() { const { sHandle, bounds, prefixCls, vertical, included, disabled, min, max, reverse, handle, defaultHandle, trackStyle, handleStyle, tabindex, ariaLabelGroupForHandles, ariaLabelledByGroupForHandles, ariaValueTextFormatterGroupForHandles } = this; const handleGenerator = handle || defaultHandle; const offsets = bounds.map((v) => this.calcOffset(v)); const handleClassName = `${prefixCls}-handle`; const handles = bounds.map((v, i) => { let mergedTabIndex = tabindex[i] || 0; if (disabled || tabindex[i] === null) { mergedTabIndex = null; } const dragging = sHandle === i; return handleGenerator({ class: classNames({ [handleClassName]: true, [`${handleClassName}-${i + 1}`]: true, [`${handleClassName}-dragging`]: dragging }), prefixCls, vertical, dragging, offset: offsets[i], value: v, index: i, tabindex: mergedTabIndex, min, max, reverse, disabled, style: handleStyle[i], ref: (h) => this.saveHandle(i, h), onFocus: this.onFocus, onBlur: this.onBlur, ariaLabel: ariaLabelGroupForHandles[i], ariaLabelledBy: ariaLabelledByGroupForHandles[i], ariaValueTextFormatter: ariaValueTextFormatterGroupForHandles[i] }); }); return { tracks: this.getTrack({ bounds, prefixCls, reverse, vertical, included, offsets, trackStyle }), handles }; } } }); const VcRange = createSlider(Range); const SliderTooltip = defineComponent({ compatConfig: { MODE: 3 }, name: "SliderTooltip", inheritAttrs: false, props: tooltipProps(), setup(props, _ref) { let { attrs, slots } = _ref; const innerRef = ref(null); const rafRef = ref(null); function cancelKeepAlign() { wrapperRaf.cancel(rafRef.value); rafRef.value = null; } function keepAlign() { rafRef.value = wrapperRaf(() => { var _a; (_a = innerRef.value) === null || _a === void 0 ? void 0 : _a.forcePopupAlign(); rafRef.value = null; }); } const align = () => { cancelKeepAlign(); if (props.open) { keepAlign(); } }; watch([() => props.open, () => props.title], () => { align(); }, { flush: "post", immediate: true }); return () => { return createVNode(__nuxt_component_2$1, _objectSpread$1(_objectSpread$1({ "ref": innerRef }, props), attrs), slots); }; } }); const genBaseStyle = (token) => { const { componentCls, controlSize, dotSize, marginFull, marginPart, colorFillContentHover } = token; return { [componentCls]: _extends(_extends({}, resetComponent(token)), { position: "relative", height: controlSize, margin: `${marginPart}px ${marginFull}px`, padding: 0, cursor: "pointer", touchAction: "none", [`&-vertical`]: { margin: `${marginFull}px ${marginPart}px` }, [`${componentCls}-rail`]: { position: "absolute", backgroundColor: token.colorFillTertiary, borderRadius: token.borderRadiusXS, transition: `background-color ${token.motionDurationMid}` }, [`${componentCls}-track`]: { position: "absolute", backgroundColor: token.colorPrimaryBorder, borderRadius: token.borderRadiusXS, transition: `background-color ${token.motionDurationMid}` }, "&:hover": { [`${componentCls}-rail`]: { backgroundColor: token.colorFillSecondary }, [`${componentCls}-track`]: { backgroundColor: token.colorPrimaryBorderHover }, [`${componentCls}-dot`]: { borderColor: colorFillContentHover }, [`${componentCls}-handle::after`]: { boxShadow: `0 0 0 ${token.handleLineWidth}px ${token.colorPrimaryBorderHover}` }, [`${componentCls}-dot-active`]: { borderColor: token.colorPrimary } }, [`${componentCls}-handle`]: { position: "absolute", width: token.handleSize, height: token.handleSize, outline: "none", [`${componentCls}-dragging`]: { zIndex: 1 }, // 扩大选区 "&::before": { content: '""', position: "absolute", insetInlineStart: -token.handleLineWidth, insetBlockStart: -token.handleLineWidth, width: token.handleSize + token.handleLineWidth * 2, height: token.handleSize + token.handleLineWidth * 2, backgroundColor: "transparent" }, "&::after": { content: '""', position: "absolute", insetBlockStart: 0, insetInlineStart: 0, width: token.handleSize, height: token.handleSize, backgroundColor: token.colorBgElevated, boxShadow: `0 0 0 ${token.handleLineWidth}px ${token.colorPrimaryBorder}`, borderRadius: "50%", cursor: "pointer", transition: ` inset-inline-start ${token.motionDurationMid}, inset-block-start ${token.motionDurationMid}, width ${token.motionDurationMid}, height ${token.motionDurationMid}, box-shadow ${token.motionDurationMid} ` }, "&:hover, &:active, &:focus": { "&::before": { insetInlineStart: -((token.handleSizeHover - token.handleSize) / 2 + token.handleLineWidthHover), insetBlockStart: -((token.handleSizeHover - token.handleSize) / 2 + token.handleLineWidthHover), width: token.handleSizeHover + token.handleLineWidthHover * 2, height: token.handleSizeHover + token.handleLineWidthHover * 2 }, "&::after": { boxShadow: `0 0 0 ${token.handleLineWidthHover}px ${token.colorPrimary}`, width: token.handleSizeHover, height: token.handleSizeHover, insetInlineStart: (token.handleSize - token.handleSizeHover) / 2, insetBlockStart: (token.handleSize - token.handleSizeHover) / 2 } } }, [`${componentCls}-mark`]: { position: "absolute", fontSize: token.fontSize }, [`${componentCls}-mark-text`]: { position: "absolute", display: "inline-block", color: token.colorTextDescription, textAlign: "center", wordBreak: "keep-all", cursor: "pointer", userSelect: "none", "&-active": { color: token.colorText } }, [`${componentCls}-step`]: { position: "absolute", background: "transparent", pointerEvents: "none" }, [`${componentCls}-dot`]: { position: "absolute", width: dotSize, height: dotSize, backgroundColor: token.colorBgElevated, border: `${token.handleLineWidth}px solid ${token.colorBorderSecondary}`, borderRadius: "50%", cursor: "pointer", transition: `border-color ${token.motionDurationSlow}`, "&-active": { borderColor: token.colorPrimaryBorder } }, [`&${componentCls}-disabled`]: { cursor: "not-allowed", [`${componentCls}-rail`]: { backgroundColor: `${token.colorFillSecondary} !important` }, [`${componentCls}-track`]: { backgroundColor: `${token.colorTextDisabled} !important` }, [` ${componentCls}-dot `]: { backgroundColor: token.colorBgElevated, borderColor: token.colorTextDisabled, boxShadow: "none", cursor: "not-allowed" }, [`${componentCls}-handle::after`]: { backgroundColor: token.colorBgElevated, cursor: "not-allowed", width: token.handleSize, height: token.handleSize, boxShadow: `0 0 0 ${token.handleLineWidth}px ${new TinyColor(token.colorTextDisabled).onBackground(token.colorBgContainer).toHexString()}`, insetInlineStart: 0, insetBlockStart: 0 }, [` ${componentCls}-mark-text, ${componentCls}-dot `]: { cursor: `not-allowed !important` } } }) }; }; const genDirectionStyle = (token, horizontal) => { const { componentCls, railSize, handleSize, dotSize } = token; const railPadding = horizontal ? "paddingBlock" : "paddingInline"; const full = horizontal ? "width" : "height"; const part = horizontal ? "height" : "width"; const handlePos = horizontal ? "insetBlockStart" : "insetInlineStart"; const markInset = horizontal ? "top" : "insetInlineStart"; return { [railPadding]: railSize, [part]: railSize * 3, [`${componentCls}-rail`]: { [full]: "100%", [part]: railSize }, [`${componentCls}-track`]: { [part]: railSize }, [`${componentCls}-handle`]: { [handlePos]: (railSize * 3 - handleSize) / 2 }, [`${componentCls}-mark`]: { // Reset all insetInlineStart: 0, top: 0, [markInset]: handleSize, [full]: "100%" }, [`${componentCls}-step`]: { // Reset all insetInlineStart: 0, top: 0, [markInset]: railSize, [full]: "100%", [part]: railSize }, [`${componentCls}-dot`]: { position: "absolute", [handlePos]: (railSize - dotSize) / 2 } }; }; const genHorizontalStyle = (token) => { const { componentCls, marginPartWithMark } = token; return { [`${componentCls}-horizontal`]: _extends(_extends({}, genDirectionStyle(token, true)), { [`&${componentCls}-with-marks`]: { marginBottom: marginPartWithMark } }) }; }; const genVerticalStyle = (token) => { const { componentCls } = token; return { [`${componentCls}-vertical`]: _extends(_extends({}, genDirectionStyle(token, false)), { height: "100%" }) }; }; const useStyle = genComponentStyleHook("Slider", (token) => { const sliderToken = merge(token, { marginPart: (token.controlHeight - token.controlSize) / 2, marginFull: token.controlSize / 2, marginPartWithMark: token.controlHeightLG - token.controlSize }); return [genBaseStyle(sliderToken), genHorizontalStyle(sliderToken), genVerticalStyle(sliderToken)]; }, (token) => { const increaseHandleWidth = 1; const controlSize = token.controlHeightLG / 4; const controlSizeHover = token.controlHeightSM / 2; const handleLineWidth = token.lineWidth + increaseHandleWidth; const handleLineWidthHover = token.lineWidth + increaseHandleWidth * 3; return { controlSize, railSize: 4, handleSize: controlSize, handleSizeHover: controlSizeHover, dotSize: 8, handleLineWidth, handleLineWidthHover }; }); var __rest = function(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; const defaultTipFormatter = (value) => typeof value === "number" ? value.toString() : ""; const sliderProps = () => ({ id: String, prefixCls: String, tooltipPrefixCls: String, range: someType([Boolean, Object]), reverse: booleanType(), min: Number, max: Number, step: someType([Object, Number]), marks: objectType(), dots: booleanType(), value: someType([Array, Number]), defaultValue: someType([Array, Number]), included: booleanType(), disabled: booleanType(), vertical: booleanType(), tipFormatter: someType([Function, Object], () => defaultTipFormatter), tooltipOpen: booleanType(), /** @deprecated `tooltipVisible` is deprecated. Please use `tooltipOpen` instead. */ tooltipVisible: booleanType(), tooltipPlacement: stringType(), getTooltipPopupContainer: functionType(), autofocus: booleanType(), handleStyle: someType([Array, Object]), trackStyle: someType([Array, Object]), onChange: functionType(), onAfterChange: functionType(), onFocus: functionType(), onBlur: functionType(), "onUpdate:value": functionType() }); const Slider = defineComponent({ compatConfig: { MODE: 3 }, name: "ASlider", inheritAttrs: false, props: sliderProps(), // emits: ['update:value', 'change', 'afterChange', 'blur'], slots: Object, setup(props, _ref) { let { attrs, slots, emit, expose } = _ref; const { prefixCls, rootPrefixCls, direction, getPopupContainer, configProvider } = useConfigInject("slider", props); const [wrapSSR, hashId] = useStyle(prefixCls); const formItemContext = useInjectFormItemContext(); const sliderRef = ref(); const visibles = ref({}); const toggleTooltipOpen = (index, visible) => { visibles.value[index] = visible; }; const tooltipPlacement = computed(() => { if (props.tooltipPlacement) { return props.tooltipPlacement; } if (!props.vertical) { return "top"; } return direction.value === "rtl" ? "left" : "right"; }); const focus = () => { var _a; (_a = sliderRef.value) === null || _a === void 0 ? void 0 : _a.focus(); }; const blur = () => { var _a; (_a = sliderRef.value) === null || _a === void 0 ? void 0 : _a.blur(); }; const handleChange = (val) => { emit("update:value", val); emit("change", val); formItemContext.onFieldChange(); }; const handleBlur = (e) => { emit("blur", e); }; expose({ focus, blur }); const handleWithTooltip = (_a) => { var { tooltipPrefixCls } = _a, _b = _a.info, { value, dragging, index } = _b, restProps = __rest(_b, ["value", "dragging", "index"]); const { tipFormatter, tooltipOpen = props.tooltipVisible, getTooltipPopupContainer } = props; const isTipFormatter = tipFormatter ? visibles.value[index] || dragging : false; const open = tooltipOpen || tooltipOpen === void 0 && isTipFormatter; return createVNode(SliderTooltip, { "prefixCls": tooltipPrefixCls, "title": tipFormatter ? tipFormatter(value) : "", "open": open, "placement": tooltipPlacement.value, "transitionName": `${rootPrefixCls.value}-zoom-down`, "key": index, "overlayClassName": `${prefixCls.value}-tooltip`, "getPopupContainer": getTooltipPopupContainer || (getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.value) }, { default: () => [createVNode(VcHandle, _objectSpread$1(_objectSpread$1({}, restProps), {}, { "value": value, "onMouseenter": () => toggleTooltipOpen(index, true), "onMouseleave": () => toggleTooltipOpen(index, false) }), null)] }); }; return () => { const { tooltipPrefixCls: customizeTooltipPrefixCls, range, id = formItemContext.id.value } = props, restProps = __rest(props, ["tooltipPrefixCls", "range", "id"]); const tooltipPrefixCls = configProvider.getPrefixCls("tooltip", customizeTooltipPrefixCls); const cls = classNames(attrs.class, { [`${prefixCls.value}-rtl`]: direction.value === "rtl" }, hashId.value); if (direction.value === "rtl" && !restProps.vertical) { restProps.reverse = !restProps.reverse; } let draggableTrack; if (typeof range === "object") { draggableTrack = range.draggableTrack; } if (range) { return wrapSSR(createVNode(VcRange, _objectSpread$1(_objectSpread$1(_objectSpread$1({}, attrs), restProps), {}, { "step": restProps.step, "draggableTrack": draggableTrack, "class": cls, "ref": sliderRef, "handle": (info) => handleWithTooltip({ tooltipPrefixCls, prefixCls: prefixCls.value, info }), "prefixCls": prefixCls.value, "onChange": handleChange, "onBlur": handleBlur }), { mark: slots.mark })); } return wrapSSR(createVNode(VcSlider, _objectSpread$1(_objectSpread$1(_objectSpread$1({}, attrs), restProps), {}, { "id": id, "step": restProps.step, "class": cls, "ref": sliderRef, "handle": (info) => handleWithTooltip({ tooltipPrefixCls, prefixCls: prefixCls.value, info }), "prefixCls": prefixCls.value, "onChange": handleChange, "onBlur": handleBlur }), { mark: slots.mark })); }; } }); const Slider$1 = withInstall$1(Slider); const _imports_0 = "data:image/svg+xml,%3csvg%20width='25'%20height='25'%20viewBox='0%200%2025%2025'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='12.0208'%20cy='12.5208'%20r='8.5'%20transform='rotate(-45%2012.0208%2012.5208)'%20stroke='%23C1C8D2FF'%20stroke-width='2'/%3e%3cpath%20d='M22.7929%2024.7071C23.1834%2025.0976%2023.8166%2025.0976%2024.2071%2024.7071C24.5976%2024.3166%2024.5976%2023.6834%2024.2071%2023.2929L22.7929%2024.7071ZM17.3241%2019.2384L22.7929%2024.7071L24.2071%2023.2929L18.7384%2017.8241L17.3241%2019.2384Z'%20fill='%23C1C8D2FF'/%3e%3c/svg%3e"; const _queue = /* @__PURE__ */ new WeakMap(); function useRouteQuery(name2, defaultValue, options = {}) { const { mode = "replace", route = useRoute(), router = useRouter(), transform } = options; let transformGet = (value) => value; let transformSet = (value) => value; if (typeof transform === "function") { transformGet = transform; } else if (transform) { if (transform.get) transformGet = transform.get; if (transform.set) transformSet = transform.set; } if (!_queue.has(router)) _queue.set(router, /* @__PURE__ */ new Map()); const _queriesQueue = _queue.get(router); let query = route.query[name2]; tryOnScopeDispose(() => { query = void 0; }); let _trigger; const proxy = customRef((track, trigger) => { _trigger = trigger; return { get() { track(); return transformGet(query !== void 0 ? query : toValue(defaultValue)); }, set(v) { v = transformSet(v); if (query === v) return; query = v === toValue(defaultValue) ? void 0 : v; _queriesQueue.set(name2, v === toValue(defaultValue) ? void 0 : v); trigger(); nextTick(() => { if (_queriesQueue.size === 0) return; const newQueries = Object.fromEntries(_queriesQueue.entries()); _queriesQueue.clear(); const { params, query: query2, hash } = route; router[toValue(mode)]({ params, query: { ...query2, ...newQueries }, hash }); }); } }; }); watch( () => route.query[name2], (v) => { if (query === transformGet(v)) return; query = v; _trigger(); }, { flush: "sync" } ); return proxy; } async function getCollection() { return await myAxios.get("/site/collection/menu"); } const useCategoryStore = defineStore("category", () => { const _category = ref([]); const category = computed(() => { return _category.value.sort((a, b) => { return a.position - b.position; }); }); async function getCategory() { _category.value = await getCollection(); } const getCategorySubs = (ids) => { return category.value.filter((x) => ids.includes(x.parent_id)); }; const categoryWithoutSub = computed(() => { return category.value.filter((x) => !x.parent_id); }); return { _category, category, getCategory, getCategorySubs, categoryWithoutSub }; }); function noop() { } const extend = Object.assign; const isObject = (val) => val !== null && typeof val === "object"; const isDef = (val) => val !== void 0 && val !== null; const isFunction = (val) => typeof val === "function"; const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch); const isNumeric = (val) => typeof val === "number" || /^\d+(\.\d+)?$/.test(val); function get(object, path) { const keys = path.split("."); let result = object; keys.forEach((key) => { var _a; result = isObject(result) ? (_a = result[key]) != null ? _a : "" : ""; }); return result; } function pick(obj, keys, ignoreUndefined) { return keys.reduce( (ret, key) => { { ret[key] = obj[key]; } return ret; }, {} ); } const unknownProp = null; const numericProp = [Number, String]; const truthProp = { type: Boolean, default: true }; const makeArrayProp = () => ({ type: Array, default: () => [] }); const makeStringProp = (defaultVal) => ({ type: String, default: defaultVal }); function onMountedOrActivated(hook) { onActivated(() => { }); } var width; var height; function useWindowSize() { if (!width) { width = ref(0); height = ref(0); } return { width, height }; } var overflowScrollReg = /scroll|auto|overlay/i; var defaultRoot = void 0; function isElement(node) { const ELEMENT_NODE_TYPE = 1; return node.tagName !== "HTML" && node.tagName !== "BODY" && node.nodeType === ELEMENT_NODE_TYPE; } function getScrollParent(el, root = defaultRoot) { let node = el; while (node && node !== root && isElement(node)) { const { overflowY } = (void 0).getComputedStyle(node); if (overflowScrollReg.test(overflowY)) { return node; } node = node.parentNode; } return root; } const stopPropagation = (event) => event.stopPropagation(); function preventDefault(event, isStopPropagation) { if (typeof event.cancelable !== "boolean" || event.cancelable) { event.preventDefault(); } { stopPropagation(event); } } useWindowSize(); function addUnit(value) { if (isDef(value)) { return isNumeric(value) ? `${value}px` : String(value); } return void 0; } function getSizeStyle(originSize) { if (isDef(originSize)) { if (Array.isArray(originSize)) { return { width: addUnit(originSize[0]), height: addUnit(originSize[1]) }; } const size = addUnit(originSize); return { width: size, height: size }; } } function getZIndexStyle(zIndex) { const style = {}; if (zIndex !== void 0) { style.zIndex = +zIndex; } return style; } const camelizeRE = /-(\w)/g; const camelize = (str) => str.replace(camelizeRE, (_, c) => c.toUpperCase()); const kebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase().replace(/^-/, ""); const { hasOwnProperty } = Object.prototype; function assignKey(to, from, key) { const val = from[key]; if (!isDef(val)) { return; } if (!hasOwnProperty.call(to, key) || !isObject(val)) { to[key] = val; } else { to[key] = deepAssign(Object(to[key]), val); } } function deepAssign(to, from) { Object.keys(from).forEach((key) => { assignKey(to, from, key); }); return to; } var stdin_default$7 = { name: "姓名", tel: "电话", save: "保存", clear: "清空", cancel: "取消", confirm: "确认", delete: "删除", loading: "加载中...", noCoupon: "暂无优惠券", nameEmpty: "请填写姓名", addContact: "添加联系人", telInvalid: "请填写正确的电话", vanCalendar: { end: "结束", start: "开始", title: "日期选择", weekdays: ["日", "一", "二", "三", "四", "五", "六"], monthTitle: (year, month) => `${year}年${month}月`, rangePrompt: (maxRange) => `最多选择 ${maxRange} 天` }, vanCascader: { select: "请选择" }, vanPagination: { prev: "上一页", next: "下一页" }, vanPullRefresh: { pulling: "下拉即可刷新...", loosing: "释放即可刷新..." }, vanSubmitBar: { label: "合计:" }, vanCoupon: { unlimited: "无门槛", discount: (discount) => `${discount}折`, condition: (condition) => `满${condition}元可用` }, vanCouponCell: { title: "优惠券", count: (count) => `${count}张可用` }, vanCouponList: { exchange: "兑换", close: "不使用", enable: "可用", disabled: "不可用", placeholder: "输入优惠码" }, vanAddressEdit: { area: "地区", areaEmpty: "请选择地区", addressEmpty: "请填写详细地址", addressDetail: "详细地址", defaultAddress: "设为默认收货地址" }, vanAddressList: { add: "新增地址" } }; const lang = ref("zh-CN"); const messages = reactive({ "zh-CN": stdin_default$7 }); const Locale = { messages() { return messages[lang.value]; }, use(newLang, newMessages) { lang.value = newLang; this.add({ [newLang]: newMessages }); }, add(newMessages = {}) { deepAssign(messages, newMessages); } }; var stdin_default$6 = Locale; function createTranslate(name2) { const prefix = camelize(name2) + "."; return (path, ...args) => { const messages2 = stdin_default$6.messages(); const message = get(messages2, prefix + path) || get(messages2, path); return isFunction(message) ? message(...args) : message; }; } function genBem(name2, mods) { if (!mods) { return ""; } if (typeof mods === "string") { return ` ${name2}--${mods}`; } if (Array.isArray(mods)) { return mods.reduce( (ret, item) => ret + genBem(name2, item), "" ); } return Object.keys(mods).reduce( (ret, key) => ret + (mods[key] ? genBem(name2, key) : ""), "" ); } function createBEM(name2) { return (el, mods) => { if (el && typeof el !== "string") { mods = el; el = ""; } el = el ? `${name2}__${el}` : name2; return `${el}${genBem(el, mods)}`; }; } function createNamespace(name2) { const prefixedName = `van-${name2}`; return [ prefixedName, createBEM(prefixedName), createTranslate(prefixedName) ]; } const HAPTICS_FEEDBACK = "van-haptics-feedback"; const TAP_OFFSET = 5; function callInterceptor(interceptor, { args = [], done, canceled, error }) { if (interceptor) { const returnVal = interceptor.apply(null, args); if (isPromise(returnVal)) { returnVal.then((value) => { if (value) { done(); } else if (canceled) { canceled(); } }).catch(error || noop); } else if (returnVal) { done(); } else if (canceled) { canceled(); } } else { done(); } } function withInstall(options) { options.install = (app) => { const { name: name2 } = options; if (name2) { app.component(name2, options); app.component(camelize(`-${name2}`), options); } }; return options; } const [name$6, bem$6] = createNamespace("badge"); const badgeProps = { dot: Boolean, max: numericProp, tag: makeStringProp("div"), color: String, offset: Array, content: numericProp, showZero: truthProp, position: makeStringProp("top-right") }; var stdin_default$5 = defineComponent({ name: name$6, props: badgeProps, setup(props, { slots }) { const hasContent = () => { if (slots.content) { return true; } const { content, showZero } = props; return isDef(content) && content !== "" && (showZero || content !== 0 && content !== "0"); }; const renderContent = () => { const { dot, max, content } = props; if (!dot && hasContent()) { if (slots.content) { return slots.content(); } if (isDef(max) && isNumeric(content) && +content > +max) { return `${max}+`; } return content; } }; const getOffsetWithMinusString = (val) => val.startsWith("-") ? val.replace("-", "") : `-${val}`; const style = computed(() => { const style2 = { background: props.color }; if (props.offset) { const [x, y] = props.offset; const { position } = props; const [offsetY, offsetX] = position.split("-"); if (slots.default) { if (typeof y === "number") { style2[offsetY] = addUnit(offsetY === "top" ? y : -y); } else { style2[offsetY] = offsetY === "top" ? addUnit(y) : getOffsetWithMinusString(y); } if (typeof x === "number") { style2[offsetX] = addUnit(offsetX === "left" ? x : -x); } else { style2[offsetX] = offsetX === "left" ? addUnit(x) : getOffsetWithMinusString(x); } } else { style2.marginTop = addUnit(y); style2.marginLeft = addUnit(x); } } return style2; }); const renderBadge = () => { if (hasContent() || props.dot) { return createVNode("div", { "class": bem$6([props.position, { dot: props.dot, fixed: !!slots.default }]), "style": style.value }, [renderContent()]); } }; return () => { if (slots.default) { const { tag } = props; return createVNode(tag, { "class": bem$6("wrapper") }, { default: () => [slots.default(), renderBadge()] }); } return renderBadge(); }; } }); const Badge = withInstall(stdin_default$5); let globalZIndex = 2e3; const useGlobalZIndex = () => ++globalZIndex; const setGlobalZIndex = (val) => { globalZIndex = val; }; const [name$5, bem$5] = createNamespace("config-provider"); const CONFIG_PROVIDER_KEY = Symbol(name$5); const configProviderProps = { tag: makeStringProp("div"), theme: makeStringProp("light"), zIndex: Number, themeVars: Object, themeVarsDark: Object, themeVarsLight: Object, themeVarsScope: makeStringProp("local"), iconPrefix: String }; function insertDash(str) { return str.replace(/([a-zA-Z])(\d)/g, "$1-$2"); } function mapThemeVarsToCSSVars(themeVars) { const cssVars = {}; Object.keys(themeVars).forEach((key) => { const formattedKey = insertDash(kebabCase(key)); cssVars[`--van-${formattedKey}`] = themeVars[key]; }); return cssVars; } defineComponent({ name: name$5, props: configProviderProps, setup(props, { slots }) { const style = computed(() => mapThemeVarsToCSSVars(extend({}, props.themeVars, props.theme === "dark" ? props.themeVarsDark : props.themeVarsLight))); provide(CONFIG_PROVIDER_KEY, props); watchEffect(() => { if (props.zIndex !== void 0) { setGlobalZIndex(props.zIndex); } }); return () => createVNode(props.tag, { "class": bem$5(), "style": props.themeVarsScope === "local" ? style.value : void 0 }, { default: () => { var _a; return [(_a = slots.default) == null ? void 0 : _a.call(slots)]; } }); } }); const [name$4, bem$4] = createNamespace("icon"); const isImage = (name2) => name2 == null ? void 0 : name2.includes("/"); const iconProps = { dot: Boolean, tag: makeStringProp("i"), name: String, size: numericProp, badge: numericProp, color: String, badgeProps: Object, classPrefix: String }; var stdin_default$4 = defineComponent({ name: name$4, props: iconProps, setup(props, { slots }) { const config = inject(CONFIG_PROVIDER_KEY, null); const classPrefix = computed(() => props.classPrefix || (config == null ? void 0 : config.iconPrefix) || bem$4()); return () => { const { tag, dot, name: name2, size, badge, color } = props; const isImageIcon = isImage(name2); return createVNode(Badge, mergeProps({ "dot": dot, "tag": tag, "class": [classPrefix.value, isImageIcon ? "" : `${classPrefix.value}-${name2}`], "style": { color, fontSize: addUnit(size) }, "content": badge }, props.badgeProps), { default: () => { var _a; return [(_a = slots.default) == null ? void 0 : _a.call(slots), isImageIcon && createVNode("img", { "class": bem$4("image"), "src": name2 }, null)]; } }); }; } }); const Icon = withInstall(stdin_default$4); const popupSharedProps = { // whether to show popup show: Boolean, // z-index zIndex: numericProp, // whether to show overlay overlay: truthProp, // transition duration duration: numericProp, // teleport teleport: [String, Object], // prevent body scroll lockScroll: truthProp, // whether to lazy render lazyRender: truthProp, // callback function before close beforeClose: Function, // overlay props overlayProps: Object, // overlay custom style overlayStyle: Object, // overlay custom class name overlayClass: unknownProp, // Initial rendering animation transitionAppear: Boolean, // whether to close popup when overlay is clicked closeOnClickOverlay: truthProp }; const popupSharedPropKeys = Object.keys( popupSharedProps ); function useExpose(apis) { const instance = getCurrentInstance(); if (instance) { extend(instance.proxy, apis); } } function getDirection(x, y) { if (x > y) { return "horizontal"; } if (y > x) { return "vertical"; } return ""; } function useTouch() { const startX = ref(0); const startY = ref(0); const deltaX = ref(0); const deltaY = ref(0); const offsetX = ref(0); const offsetY = ref(0); const direction = ref(""); const isTap = ref(true); const isVertical = () => direction.value === "vertical"; const isHorizontal = () => direction.value === "horizontal"; const reset = () => { deltaX.value = 0; deltaY.value = 0; offsetX.value = 0; offsetY.value = 0; direction.value = ""; isTap.value = true; }; const start = (event) => { reset(); startX.value = event.touches[0].clientX; startY.value = event.touches[0].clientY; }; const move = (event) => { const touch = event.touches[0]; deltaX.value = (touch.clientX < 0 ? 0 : touch.clientX) - startX.value; deltaY.value = touch.clientY - startY.value; offsetX.value = Math.abs(deltaX.value); offsetY.value = Math.abs(deltaY.value); const LOCK_DIRECTION_DISTANCE = 10; if (!direction.value || offsetX.value < LOCK_DIRECTION_DISTANCE && offsetY.value < LOCK_DIRECTION_DISTANCE) { direction.value = getDirection(offsetX.value, offsetY.value); } if (isTap.value && (offsetX.value > TAP_OFFSET || offsetY.value > TAP_OFFSET)) { isTap.value = false; } }; return { move, start, reset, startX, startY, deltaX, deltaY, offsetX, offsetY, direction, isVertical, isHorizontal, isTap }; } let totalLockCount = 0; const BODY_LOCK_CLASS = "van-overflow-hidden"; function useLockScroll(rootRef, shouldLock) { const touch = useTouch(); const DIRECTION_UP = "01"; const DIRECTION_DOWN = "10"; const onTouchMove = (event) => { touch.move(event); const direction = touch.deltaY.value > 0 ? DIRECTION_DOWN : DIRECTION_UP; const el = getScrollParent( event.target, rootRef.value ); const { scrollHeight, offsetHeight, scrollTop } = el; let status = "11"; if (scrollTop === 0) { status = offsetHeight >= scrollHeight ? "00" : "01"; } else if (scrollTop + offsetHeight >= scrollHeight) { status = "10"; } if (status !== "11" && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) { preventDefault(event); } }; const lock = () => { (void 0).addEventListener("touchstart", touch.start); (void 0).addEventListener("touchmove", onTouchMove, { passive: false }); if (!totalLockCount) { (void 0).body.classList.add(BODY_LOCK_CLASS); } totalLockCount++; }; const unlock = () => { if (totalLockCount) { (void 0).removeEventListener("touchstart", touch.start); (void 0).removeEventListener("touchmove", onTouchMove); totalLockCount--; if (!totalLockCount) { (void 0).body.classList.remove(BODY_LOCK_CLASS); } } }; onMountedOrActivated(); watch(shouldLock, (value) => { value ? lock() : unlock(); }); } function useLazyRender(show) { const inited = ref(false); watch( show, (value) => { if (value) { inited.value = value; } }, { immediate: true } ); return (render) => () => inited.value ? render() : null; } const POPUP_TOGGLE_KEY = Symbol(); const useScopeId = () => { var _a; const { scopeId } = ((_a = getCurrentInstance()) == null ? void 0 : _a.vnode) || {}; return scopeId ? { [scopeId]: "" } : null; }; const [name$3, bem$3] = createNamespace("overlay"); const overlayProps = { show: Boolean, zIndex: numericProp, duration: numericProp, className: unknownProp, lockScroll: truthProp, lazyRender: truthProp, customStyle: Object, teleport: [String, Object] }; var stdin_default$3 = defineComponent({ name: name$3, inheritAttrs: false, props: overlayProps, setup(props, { attrs, slots }) { const root = ref(); const lazyRender = useLazyRender(() => props.show || !props.lazyRender); const renderOverlay = lazyRender(() => { var _a; const style = extend(getZIndexStyle(props.zIndex), props.customStyle); if (isDef(props.duration)) { style.animationDuration = `${props.duration}s`; } return withDirectives(createVNode("div", mergeProps({ "ref": root, "style": style, "class": [bem$3(), props.className] }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[vShow, props.show]]); }); return () => { const Content = createVNode(Transition, { "name": "van-fade", "appear": true }, { default: renderOverlay }); if (props.teleport) { return createVNode(Teleport, { "to": props.teleport }, { default: () => [Content] }); } return Content; }; } }); const Overlay = withInstall(stdin_default$3); const popupProps = extend({}, popupSharedProps, { round: Boolean, position: makeStringProp("center"), closeIcon: makeStringProp("cross"), closeable: Boolean, transition: String, iconPrefix: String, closeOnPopstate: Boolean, closeIconPosition: makeStringProp("top-right"), destroyOnClose: Boolean, safeAreaInsetTop: Boolean, safeAreaInsetBottom: Boolean }); const [name$2, bem$2] = createNamespace("popup"); var stdin_default$2 = defineComponent({ name: name$2, inheritAttrs: false, props: popupProps, emits: ["open", "close", "opened", "closed", "keydown", "update:show", "clickOverlay", "clickCloseIcon"], setup(props, { emit, attrs, slots }) { let opened; const zIndex = ref(); const popupRef = ref(); const lazyRender = useLazyRender(() => props.show || !props.lazyRender); const style = computed(() => { const style2 = { zIndex: zIndex.value }; if (isDef(props.duration)) { const key = props.position === "center" ? "animationDuration" : "transitionDuration"; style2[key] = `${props.duration}s`; } return style2; }); const open = () => { if (!opened) { opened = true; zIndex.value = props.zIndex !== void 0 ? +props.zIndex : useGlobalZIndex(); emit("open"); } }; const close = () => { if (opened) { callInterceptor(props.beforeClose, { done() { opened = false; emit("close"); emit("update:show", false); } }); } }; const onClickOverlay = (event) => { emit("clickOverlay", event); if (props.closeOnClickOverlay) { close(); } }; const renderOverlay = () => { if (props.overlay) { const overlayProps2 = extend({ show: props.show, class: props.overlayClass, zIndex: zIndex.value, duration: props.duration, customStyle: props.overlayStyle, role: props.closeOnClickOverlay ? "button" : void 0, tabindex: props.closeOnClickOverlay ? 0 : void 0 }, props.overlayProps); return createVNode(Overlay, mergeProps(overlayProps2, useScopeId(), { "onClick": onClickOverlay }), { default: slots["overlay-content"] }); } }; const onClickCloseIcon = (event) => { emit("clickCloseIcon", event); close(); }; const renderCloseIcon = () => { if (props.closeable) { return createVNode(Icon, { "role": "button", "tabindex": 0, "name": props.closeIcon, "class": [bem$2("close-icon", props.closeIconPosition), HAPTICS_FEEDBACK], "classPrefix": props.iconPrefix, "onClick": onClickCloseIcon }, null); } }; let timer; const onOpened = () => { if (timer) clearTimeout(timer); timer = setTimeout(() => { emit("opened"); }); }; const onClosed = () => emit("closed"); const onKeydown = (event) => emit("keydown", event); const renderPopup = lazyRender(() => { var _a; const { destroyOnClose, round, position, safeAreaInsetTop, safeAreaInsetBottom, show } = props; if (!show && destroyOnClose) { return; } return withDirectives(createVNode("div", mergeProps({ "ref": popupRef, "style": style.value, "role": "dialog", "tabindex": 0, "class": [bem$2({ round, [position]: position }), { "van-safe-area-top": safeAreaInsetTop, "van-safe-area-bottom": safeAreaInsetBottom }], "onKeydown": onKeydown }, attrs, useScopeId()), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[vShow, show]]); }); const renderTransition = () => { const { position, transition, transitionAppear } = props; const name2 = position === "center" ? "van-fade" : `van-popup-slide-${position}`; return createVNode(Transition, { "name": transition || name2, "appear": transitionAppear, "onAfterEnter": onOpened, "onAfterLeave": onClosed }, { default: renderPopup }); }; watch(() => props.show, (show) => { if (show && !opened) { open(); if (attrs.tabindex === 0) { nextTick(() => { var _a; (_a = popupRef.value) == null ? void 0 : _a.focus(); }); } } if (!show && opened) { opened = false; emit("close"); } }); useExpose({ popupRef }); useLockScroll(popupRef, () => props.show && props.lockScroll); provide(POPUP_TOGGLE_KEY, () => props.show); return () => { if (props.teleport) { return createVNode(Teleport, { "to": props.teleport }, { default: () => [renderOverlay(), renderTransition()] }); } return createVNode(Fragment, null, [renderOverlay(), renderTransition()]); }; } }); const Popup = withInstall(stdin_default$2); const [name$1, bem$1] = createNamespace("loading"); const SpinIcon = Array(12).fill(null).map((_, index) => createVNode("i", { "class": bem$1("line", String(index + 1)) }, null)); const CircularIcon = createVNode("svg", { "class": bem$1("circular"), "viewBox": "25 25 50 50" }, [createVNode("circle", { "cx": "50", "cy": "50", "r": "20", "fill": "none" }, null)]); const loadingProps = { size: numericProp, type: makeStringProp("circular"), color: String, vertical: Boolean, textSize: numericProp, textColor: String }; var stdin_default$1 = defineComponent({ name: name$1, props: loadingProps, setup(props, { slots }) { const spinnerStyle = computed(() => extend({ color: props.color }, getSizeStyle(props.size))); const renderIcon = () => { const DefaultIcon = props.type === "spinner" ? SpinIcon : CircularIcon; return createVNode("span", { "class": bem$1("spinner", props.type), "style": spinnerStyle.value }, [slots.icon ? slots.icon() : DefaultIcon]); }; const renderText = () => { var _a; if (slots.default) { return createVNode("span", { "class": bem$1("text"), "style": { fontSize: addUnit(props.textSize), color: (_a = props.textColor) != null ? _a : props.color } }, [slots.default()]); } }; return () => { const { type, vertical } = props; return createVNode("div", { "class": bem$1([type, { vertical }]), "aria-live": "polite", "aria-busy": true }, [renderIcon(), renderText()]); }; } }); const Loading = withInstall(stdin_default$1); const [name, bem] = createNamespace("action-sheet"); const actionSheetProps = extend({}, popupSharedProps, { title: String, round: truthProp, actions: makeArrayProp(), closeIcon: makeStringProp("cross"), closeable: truthProp, cancelText: String, description: String, closeOnPopstate: truthProp, closeOnClickAction: Boolean, safeAreaInsetBottom: truthProp }); const popupInheritKeys = [...popupSharedPropKeys, "round", "closeOnPopstate", "safeAreaInsetBottom"]; var stdin_default = defineComponent({ name, props: actionSheetProps, emits: ["select", "cancel", "update:show"], setup(props, { slots, emit }) { const updateShow = (show) => emit("update:show", show); const onCancel = () => { updateShow(false); emit("cancel"); }; const renderHeader = () => { if (props.title) { return createVNode("div", { "class": bem("header") }, [props.title, props.closeable && createVNode(Icon, { "name": props.closeIcon, "class": [bem("close"), HAPTICS_FEEDBACK], "onClick": onCancel }, null)]); } }; const renderCancel = () => { if (slots.cancel || props.cancelText) { return [createVNode("div", { "class": bem("gap") }, null), createVNode("button", { "type": "button", "class": bem("cancel"), "onClick": onCancel }, [slots.cancel ? slots.cancel() : props.cancelText])]; } }; const renderIcon = (action) => { if (action.icon) { return createVNode(Icon, { "class": bem("item-icon"), "name": action.icon }, null); } }; const renderActionContent = (action, index) => { if (action.loading) { return createVNode(Loading, { "class": bem("loading-icon") }, null); } if (slots.action) { return slots.action({ action, index }); } return [createVNode("span", { "class": bem("name") }, [action.name]), action.subname && createVNode("div", { "class": bem("subname") }, [action.subname])]; }; const renderAction = (action, index) => { const { color, loading: loading2, callback, disabled, className } = action; const onClick = () => { if (disabled || loading2) { return; } if (callback) { callback(action); } if (props.closeOnClickAction) { updateShow(false); } nextTick(() => emit("select", action, index)); }; return createVNode("button", { "type": "button", "style": { color }, "class": [bem("item", { loading: loading2, disabled }), className], "onClick": onClick }, [renderIcon(action), renderActionContent(action, index)]); }; const renderDescription = () => { if (props.description || slots.description) { const content = slots.description ? slots.description() : props.description; return createVNode("div", { "class": bem("description") }, [content]); } }; return () => createVNode(Popup, mergeProps({ "class": bem(), "position": "bottom", "onUpdate:show": updateShow }, pick(props, popupInheritKeys)), { default: () => { var _a; return [renderHeader(), renderDescription(), createVNode("div", { "class": bem("content") }, [props.actions.map(renderAction), (_a = slots.default) == null ? void 0 : _a.call(slots)]), renderCancel()]; } }); } }); const _sfc_main$f = /* @__PURE__ */ defineComponent({ __name: "BasicActionSheet", __ssrInlineRender: true, props: { cancelText: { default: "بازگشت" }, showButton: { type: Boolean, default: false }, showCancel: { type: Boolean, default: true }, showOk: { type: Boolean, default: true }, okText: { default: "ثبت" } }, setup(__props) { const props = __props; return (_ctx, _push, _parent, _attrs) => { const _component_VanActionSheet = stdin_default; const _component_AButton = Button; _push(ssrRenderComponent(_component_VanActionSheet, mergeProps({ teleport: "body", dir: "ltr", "close-on-click-overlay": true }, _attrs), { default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(`