import { defineComponent, ref, mergeProps, withCtx, openBlock, createBlock, Fragment, renderList, withModifiers, createVNode, unref, resolveDirective, reactive, toDisplayString, useSSRContext } from 'vue'; import { ssrRenderComponent, ssrRenderAttrs, ssrRenderList, ssrGetDirectiveProps, ssrInterpolate, ssrRenderAttr } from 'vue/server-renderer'; import { u as useRouter$1, a as useConfigStore, _ as __nuxt_component_0, b as useUserStore, aT as watchDebounced, e as loading, aU as getCustomerList, q as useElementSize, s as supabase } from './server.mjs'; import { _ as _sfc_main$9, C as Collapse, a as __nuxt_component_1, g as getCategoriesTree } from './ProductSearchList-vRKe3377.mjs'; import { B as BasicIconOld } from './BasicIconOld-Booq7UXp.mjs'; import { p as previewImg$1 } from './logo_preview-CJTcB_Eg.mjs'; import { ContentLoader } from 'vue-content-loader'; import { T as Tag } from './index-CnnQbQCE.mjs'; import { C as CustomerCard, a as CustomerCardSkeleton } from './CustomerCardSkeleton-XNgH7g6C.mjs'; import '../nitro/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:path'; import 'node:crypto'; import 'node:url'; import 'consola'; import 'fast-xml-parser'; import 'ipx'; import 'pinia'; import '@supabase/supabase-js'; import 'axios'; import 'lodash-es'; import '@babel/runtime/helpers/esm/extends'; import '@babel/runtime/helpers/esm/objectSpread2'; import '@ant-design/colors'; import '@ctrl/tinycolor'; import 'stylis'; import 'vue-types'; import '@ant-design/icons-vue'; import 'unhead/utils'; import './gray-wOBznZcb.mjs'; import './media-CiMHc-Ka.mjs'; import './usePrice-CFcNV1RQ.mjs'; import './BasicButton-7YIRCRg8.mjs'; import './_plugin-vue_export-helper-1tPrXgE0.mjs'; import './index-CO_xVqO1.mjs'; import 'throttle-debounce'; import './index-CQMiaHEh.mjs'; import './shallowequal-CJsWvZb3.mjs'; import 'lodash-es/uniq.js'; import './index-D4HrLPqa.mjs'; import './FormItemContext-DTpHAXaY.mjs'; import './index-BTlbWWOl.mjs'; import 'lodash-es/isPlainObject.js'; import 'resize-observer-polyfill'; import './index-DN2Eqyc3.mjs'; import 'dom-align'; import './Checkbox-BqbMrYFp.mjs'; import './asyncData-DVPmuEBB.mjs'; import 'perfect-debounce'; import './UserProfilePic-CSSFM-Xe.mjs'; import './empty_user-DSxcM_ac.mjs'; const getBrandsList = async (search) => { let queryBuilder = supabase.from("brands").select("*"); if (search?.length) queryBuilder.like("title", `%${search}%`); return (await queryBuilder.select("*").order("created_at", { ascending: false })).data; }; const _sfc_main$8 = /* @__PURE__ */ defineComponent({ __name: "BrandCard", __ssrInlineRender: true, props: { item: {}, hasFunction: { type: Boolean, default: true } }, emits: ["edit", "delete"], setup(__props, { emit: __emit }) { const config = useConfigStore(); const emit = __emit; return (_ctx, _push, _parent, _attrs) => { const _directive_lazy = resolveDirective("lazy"); let _temp0; _push(`
${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}
${ssrInterpolate(_ctx.item.title)}
`); if (_ctx.hasFunction) { _push(`
`); _push(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:edit", color: "blue", onClick: ($event) => emit("edit", _ctx.item) }, null, _parent)); _push(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:trash", color: "red", onClick: ($event) => emit("delete", _ctx.item.id) }, null, _parent)); _push(`
`); } else { _push(``); } _push(``); }; } }); const _sfc_setup$8 = _sfc_main$8.setup; _sfc_main$8.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/user/userMain/brands/components/BrandCard.vue"); return _sfc_setup$8 ? _sfc_setup$8(props, ctx) : void 0; }; const _sfc_main$7 = /* @__PURE__ */ defineComponent({ __name: "BrandCardSkeleton", __ssrInlineRender: true, setup(__props) { const skeletonRatio = ref(null); const skeletonSize = reactive( useElementSize(skeletonRatio, { width: 0, height: 0 }, { box: "border-box" }) ); return (_ctx, _push, _parent, _attrs) => { _push(``); _push(ssrRenderComponent(unref(ContentLoader), { width: skeletonSize.width, height: "60" }, { default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(``); } else { return [ createVNode("rect", { height: "50", rx: "3", ry: "3", width: skeletonSize.width, x: "0", y: "8" }, null, 8, ["width"]) ]; } }), _: 1 }, _parent)); _push(``); }; } }); const _sfc_setup$7 = _sfc_main$7.setup; _sfc_main$7.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/user/userMain/brands/components/BrandCardSkeleton.vue"); return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0; }; const _sfc_main$6 = /* @__PURE__ */ defineComponent({ __name: "BrandSearchList", __ssrInlineRender: true, props: { search: {} }, emits: ["selected"], setup(__props, { emit: __emit }) { const props = __props; const emits = __emit; const records = ref([]); async function reload() { loading.value = true; records.value = await getBrandsList(props.search); loading.value = false; } watchDebounced(() => props.search, () => { reload(); }, { debounce: 300 }); return (_ctx, _push, _parent, _attrs) => { _push(`
`); ssrRenderList(records.value, (item, key) => { _push(ssrRenderComponent(_sfc_main$8, { key, item, "has-function": false, onClick: ($event) => emits("selected", item.id) }, null, _parent)); }); _push(``); if (unref(loading)) { _push(`
`); ssrRenderList(10, (i) => { _push(ssrRenderComponent(_sfc_main$7, null, null, _parent)); }); _push(`
`); } else { _push(``); } _push(`
`); }; } }); const _sfc_setup$6 = _sfc_main$6.setup; _sfc_main$6.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/search/mainSearch/components/BrandSearchList.vue"); return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0; }; const previewImg = "" + __buildAssetsURL("logo_preview.B3D6jfxw.png"); const _sfc_main$5 = /* @__PURE__ */ defineComponent({ __name: "CategoryCard", __ssrInlineRender: true, props: { item: {}, hasFunction: { type: Boolean, default: true }, showChildren: { type: Boolean, default: false } }, emits: ["edit", "delete"], setup(__props, { emit: __emit }) { const config = useConfigStore(); const emit = __emit; return (_ctx, _push, _parent, _attrs) => { const _component_a_tag = Tag; const _directive_lazy = resolveDirective("lazy"); let _temp0; _push(`
${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}
${ssrInterpolate(_ctx.item.title)}
`); if (_ctx.item.children?.length !== 0 && _ctx.showChildren) { _push(``); ssrRenderList(_ctx.item.children, (val) => { _push(ssrRenderComponent(_component_a_tag, { color: "blue" }, { default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(`${ssrInterpolate(val.title)}`); } else { return [ createVNode("span", null, toDisplayString(val.title), 1) ]; } }), _: 2 }, _parent)); }); _push(``); } else { _push(``); } _push(`
`); if (_ctx.hasFunction) { _push(`
`); _push(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:edit", color: "blue", onClick: ($event) => emit("edit", _ctx.item) }, null, _parent)); _push(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:trash", color: "red", onClick: ($event) => emit("delete", _ctx.item.id) }, null, _parent)); _push(`
`); } else { _push(``); } _push(``); }; } }); const _sfc_setup$5 = _sfc_main$5.setup; _sfc_main$5.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/Cards/CategoryCard.vue"); return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0; }; const CategoryCard = Object.assign(_sfc_main$5, { __name: "CardsCategoryCard" }); const _sfc_main$4 = /* @__PURE__ */ defineComponent({ __name: "CategoryCardSkeleton", __ssrInlineRender: true, setup(__props) { const skeletonRatio = ref(null); const skeletonSize = reactive( useElementSize(skeletonRatio, { width: 0, height: 0 }, { box: "border-box" }) ); return (_ctx, _push, _parent, _attrs) => { _push(``); _push(ssrRenderComponent(unref(ContentLoader), { width: skeletonSize.width, height: "60" }, { default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(``); } else { return [ createVNode("rect", { height: "50", rx: "3", ry: "3", width: skeletonSize.width, x: "0", y: "8" }, null, 8, ["width"]) ]; } }), _: 1 }, _parent)); _push(``); }; } }); const _sfc_setup$4 = _sfc_main$4.setup; _sfc_main$4.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/Cards/CategoryCardSkeleton.vue"); return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0; }; const CategoryCardSkeleton = Object.assign(_sfc_main$4, { __name: "CardsCategoryCardSkeleton" }); const _sfc_main$3 = /* @__PURE__ */ defineComponent({ __name: "CategorySearchList", __ssrInlineRender: true, props: { search: {} }, emits: ["selected"], setup(__props, { emit: __emit }) { const config = useConfigStore(); const props = __props; const emits = __emit; const records = ref([]); const activeKey = ref(); async function reload() { loading.value = true; records.value = await getCategoriesTree(props.search); loading.value = false; } watchDebounced(() => props.search, () => { reload(); }, { debounce: 300 }); return (_ctx, _push, _parent, _attrs) => { const _component_a_collapse = Collapse; const _component_a_collapse_panel = __nuxt_component_1; _push(``); _push(ssrRenderComponent(_component_a_collapse, { activeKey: activeKey.value, "onUpdate:activeKey": ($event) => activeKey.value = $event, bordered: false, "expand-icon-position": "end", class: "cat_collapse", collapsible: "icon", accordion: "" }, { expandIcon: withCtx(({ isActive }, _push2, _parent2, _scopeId) => { if (_push2) { _push2(`
`); if (unref(config).isRTL) { _push2(ssrRenderComponent(BasicIconOld, { class: "transition-all w-5", icon: "vuesax-linear:arrow-right-1", rotate: isActive ? 90 : 0 }, null, _parent2, _scopeId)); } else { _push2(ssrRenderComponent(BasicIconOld, { class: "transition-all w-5", icon: "vuesax-linear:arrow-left-1", rotate: isActive ? -90 : 0 }, null, _parent2, _scopeId)); } _push2(`
`); } else { return [ createVNode("div", { class: "w-20 flex justify-center" }, [ unref(config).isRTL ? (openBlock(), createBlock(BasicIconOld, { key: 0, class: "transition-all w-5", icon: "vuesax-linear:arrow-right-1", rotate: isActive ? 90 : 0 }, null, 8, ["rotate"])) : (openBlock(), createBlock(BasicIconOld, { key: 1, class: "transition-all w-5", icon: "vuesax-linear:arrow-left-1", rotate: isActive ? -90 : 0 }, null, 8, ["rotate"])) ]) ]; } }), default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(``); ssrRenderList(records.value, (item, key) => { _push2(ssrRenderComponent(_component_a_collapse_panel, { key: item.id, "show-arrow": item?.children.length != 0 }, { header: withCtx((_2, _push3, _parent3, _scopeId2) => { if (_push3) { _push3(``); _push3(ssrRenderComponent(CategoryCard, { key, item, hasFunction: false }, null, _parent3, _scopeId2)); _push3(``); } else { return [ createVNode("div", { onClick: withModifiers(($event) => emits("selected", item.id), ["stop"]) }, [ (openBlock(), createBlock(CategoryCard, { key, item, hasFunction: false }, null, 8, ["item"])) ], 8, ["onClick"]) ]; } }), default: withCtx((_2, _push3, _parent3, _scopeId2) => { if (_push3) { _push3(``); ssrRenderList(item.children, (child, key2) => { _push3(`
`); _push3(ssrRenderComponent(CategoryCard, { key: key2, item: child, hasFunction: false }, null, _parent3, _scopeId2)); _push3(`
`); }); _push3(``); } else { return [ (openBlock(true), createBlock(Fragment, null, renderList(item.children, (child, key2) => { return openBlock(), createBlock("div", { class: "mx-3", onClick: withModifiers(($event) => emits("selected", child.id), ["stop"]) }, [ (openBlock(), createBlock(CategoryCard, { key: key2, item: child, hasFunction: false }, null, 8, ["item"])) ], 8, ["onClick"]); }), 256)) ]; } }), _: 2 }, _parent2, _scopeId)); }); _push2(``); } else { return [ (openBlock(true), createBlock(Fragment, null, renderList(records.value, (item, key) => { return openBlock(), createBlock(_component_a_collapse_panel, { key: item.id, "show-arrow": item?.children.length != 0 }, { header: withCtx(() => [ createVNode("div", { onClick: withModifiers(($event) => emits("selected", item.id), ["stop"]) }, [ (openBlock(), createBlock(CategoryCard, { key, item, hasFunction: false }, null, 8, ["item"])) ], 8, ["onClick"]) ]), default: withCtx(() => [ (openBlock(true), createBlock(Fragment, null, renderList(item.children, (child, key2) => { return openBlock(), createBlock("div", { class: "mx-3", onClick: withModifiers(($event) => emits("selected", child.id), ["stop"]) }, [ (openBlock(), createBlock(CategoryCard, { key: key2, item: child, hasFunction: false }, null, 8, ["item"])) ], 8, ["onClick"]); }), 256)) ]), _: 2 }, 1032, ["show-arrow"]); }), 128)) ]; } }), _: 1 }, _parent)); _push(`
`); if (unref(loading)) { _push(`
`); ssrRenderList(10, (i) => { _push(ssrRenderComponent(CategoryCardSkeleton, null, null, _parent)); }); _push(`
`); } else { _push(``); } _push(`
`); }; } }); const _sfc_setup$3 = _sfc_main$3.setup; _sfc_main$3.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/search/mainSearch/components/CategorySearchList.vue"); return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0; }; const _sfc_main$2 = /* @__PURE__ */ defineComponent({ __name: "CustomerSearchList", __ssrInlineRender: true, props: { search: {} }, setup(__props) { const router = useRouter$1(); const props = __props; const userStore = useUserStore(); const loading2 = ref(false); const endPage = ref(false); const currentPage = ref(0); const limit = ref(10); const users = ref([]); const request = async () => { try { if (!endPage.value) { loading2.value = true; const userId = router.currentRoute.value.query?.user_id ?? userStore.user.id; const res = await getCustomerList(userId, ++currentPage.value, limit.value, props.search); if (res?.length <= limit.value) endPage.value = true; users.value.push(...res); } } catch (e) { console.log("e ===>", e); } finally { loading2.value = false; } }; const reset = () => { endPage.value = false; users.value = []; currentPage.value = 0; }; watchDebounced(() => props.search, () => { reset(); request(); }, { debounce: 300 }); return (_ctx, _push, _parent, _attrs) => { _push(``); if (!loading2.value) { _push(``); ssrRenderList(users.value, (user) => { _push(ssrRenderComponent(CustomerCard, { user }, null, _parent)); }); _push(``); } else { _push(``); ssrRenderList(8, (i) => { _push(ssrRenderComponent(CustomerCardSkeleton, null, null, _parent)); }); _push(``); } _push(``); }; } }); const _sfc_setup$2 = _sfc_main$2.setup; _sfc_main$2.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/search/mainSearch/components/CustomerSearchList.vue"); return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0; }; const _sfc_main$1 = /* @__PURE__ */ defineComponent({ __name: "index", __ssrInlineRender: true, setup(__props) { const router = useRouter$1(); useConfigStore(); const activeKey = ref("products"); const searchValue = ref(""); function SelectCategory(id) { router.replace({ name: "search-main", query: { category: id } // Directly use the value instead of an array }); setTimeout(() => { activeKey.value = "products"; }, 50); } function selectBrand(id) { router.replace({ name: "search-main", query: { brand: id } // Directly use the value instead of an array }); setTimeout(() => { activeKey.value = "products"; }, 50); } return (_ctx, _push, _parent, _attrs) => { const _component_ClientOnly = __nuxt_component_0; _push(``); _push(ssrRenderComponent(_component_ClientOnly, null, {}, _parent)); _push(`
`); if (activeKey.value === "products") { _push(ssrRenderComponent(_sfc_main$9, { search: searchValue.value }, null, _parent)); } else { _push(``); } if (activeKey.value === "customers") { _push(ssrRenderComponent(_sfc_main$2, { search: searchValue.value }, null, _parent)); } else { _push(``); } if (activeKey.value === "categories") { _push(ssrRenderComponent(_sfc_main$3, { search: searchValue.value, onSelected: SelectCategory }, null, _parent)); } else { _push(``); } if (activeKey.value === "brands") { _push(ssrRenderComponent(_sfc_main$6, { search: searchValue.value, onSelected: selectBrand }, null, _parent)); } else { _push(``); } _push(`
`); }; } }); const _sfc_setup$1 = _sfc_main$1.setup; _sfc_main$1.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/search/mainSearch/index.vue"); return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0; }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "index", __ssrInlineRender: true, setup(__props) { return (_ctx, _push, _parent, _attrs) => { _push(ssrRenderComponent(_sfc_main$1, _attrs, null, _parent)); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/search/main/index.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; export { _sfc_main as default };