2 lines
27 KiB
JavaScript
2 lines
27 KiB
JavaScript
var e=Object.defineProperty,s=(s,r,t)=>(((s,r,t)=>{r in s?e(s,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[r]=t})(s,"symbol"!=typeof r?r+"":r,t),t);import{j as r,Q as t,_ as a,a as i,R as l}from"./vendor-query-a3e439f2.js";import{a as n,r as o,R as d,N as c,O as m,B as x,b as h,d as g,e as p}from"./vendor-react-ac1483bd.js";import{V as u,O as y}from"./vendor-toast-598db4db.js";import{c as j,A as f,R as b,H as _,L as v,X as N,a as k,P as w,F as E,S as P,b as O,d as L,U as I,K as T,C as S,e as R,M as A,f as C,g as D,B as z,h as V}from"./vendor-ui-8a3c5c7d.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))s(e);new MutationObserver(e=>{for(const r of e)if("childList"===r.type)for(const e of r.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&s(e)}).observe(document,{childList:!0,subtree:!0})}function s(e){if(e.ep)return;e.ep=!0;const s=function(e){const s={};return e.integrity&&(s.integrity=e.integrity),e.referrerPolicy&&(s.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?s.credentials="include":"anonymous"===e.crossOrigin?s.credentials="omit":s.credentials="same-origin",s}(e);fetch(e.href,s)}}();var $={},F=n;$.createRoot=F.createRoot,$.hydrateRoot=F.hydrateRoot;const G=o.createContext(void 0),M=(e,s)=>{switch(s.type){case"LOGIN":case"RESTORE_SESSION":return{...e,isAuthenticated:!0,isLoading:!1,user:s.payload.user,permissions:s.payload.permissions,allPermissions:s.payload.allPermissions,token:s.payload.token,refreshToken:s.payload.refreshToken};case"LOGOUT":return{...e,isAuthenticated:!1,isLoading:!1,user:null,permissions:[],allPermissions:[],token:null,refreshToken:null};case"SET_LOADING":return{...e,isLoading:s.payload};default:return e}},U={isAuthenticated:!1,isLoading:!0,user:null,permissions:[],allPermissions:[],token:null,refreshToken:null},B=({children:e})=>{const[s,t]=o.useReducer(M,U),a=()=>{t({type:"SET_LOADING",payload:!0});const e=localStorage.getItem("admin_token"),s=localStorage.getItem("admin_refresh_token"),r=localStorage.getItem("admin_user"),a=localStorage.getItem("admin_permissions");if(e&&r&&a)try{const i=JSON.parse(r),l=JSON.parse(a);t({type:"RESTORE_SESSION",payload:{user:i,permissions:l,allPermissions:l,token:e,refreshToken:s||""}})}catch(i){localStorage.removeItem("admin_token"),localStorage.removeItem("admin_refresh_token"),localStorage.removeItem("admin_user"),localStorage.removeItem("admin_permissions"),t({type:"SET_LOADING",payload:!1})}else t({type:"SET_LOADING",payload:!1})};o.useEffect(()=>{a()},[]);return r.jsx(G.Provider,{value:{...s,logout:()=>{localStorage.removeItem("admin_token"),localStorage.removeItem("admin_refresh_token"),localStorage.removeItem("admin_user"),localStorage.removeItem("admin_permissions"),t({type:"LOGOUT"}),u.success("خروج موفقیتآمیز بود")},restoreSession:a,hasPermission:e=>!!s.permissions.some(e=>1===e.id)||s.permissions.some(s=>s.id===e),hasPermissionByTitle:e=>!!s.permissions.some(e=>"AdminAll"===e.title)||s.permissions.some(s=>s.title===e)},children:e})},q=()=>{const e=o.useContext(G);if(void 0===e)throw new Error("useAuth must be used within an AuthProvider");return e},H=o.createContext(void 0),W=({children:e})=>{const[s,t]=o.useState("light");o.useEffect(()=>{const e=localStorage.getItem("admin_theme"),s=window.matchMedia("(prefers-color-scheme: dark)").matches,r=e||(s?"dark":"light");t(r),"dark"===r&&document.documentElement.classList.add("dark")},[]);return r.jsx(H.Provider,{value:{mode:s,toggleTheme:()=>{const e="light"===s?"dark":"light";t(e),localStorage.setItem("admin_theme",e),"dark"===e?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}},children:e})},J=o.createContext(void 0),K={duration:4e3,position:"top-center",style:{fontFamily:"inherit",direction:"rtl"}},Q=({children:e})=>r.jsxs(J.Provider,{value:{success:(e,s)=>{u.success(e,{...K,...s})},error:(e,s)=>{u.error(e,{...K,...s})},warning:(e,s)=>{u(e,{...K,icon:"⚠️",style:{...K.style,backgroundColor:"#fef3c7",color:"#92400e"},...s})},info:(e,s)=>{u(e,{...K,icon:"ℹ️",style:{...K.style,backgroundColor:"#dbeafe",color:"#1e40af"},...s})},loading:(e,s)=>u.loading(e,{...K,...s}),dismiss:e=>{u.dismiss(e)},promise:(e,s,r)=>u.promise(e,s,{...K,...r})},children:[e,r.jsx(y,{position:"top-center",reverseOrder:!1,gutter:8,containerStyle:{direction:"rtl"},toastOptions:{duration:4e3,style:{background:"var(--toast-bg)",color:"var(--toast-color)",fontFamily:"inherit",direction:"rtl"},success:{iconTheme:{primary:"#10b981",secondary:"#ffffff"}},error:{iconTheme:{primary:"#ef4444",secondary:"#ffffff"}}}})]}),X=()=>{const e=o.useContext(J);if(void 0===e)throw new Error("useToast must be used within a ToastProvider");return e},Y=({children:e,variant:s="primary",size:t="md",disabled:a=!1,loading:i=!1,onClick:l,type:n="button",className:o=""})=>{const d=a||i?"opacity-50 cursor-not-allowed pointer-events-none":"";return r.jsxs("button",{type:n,onClick:l,disabled:a||i,className:j("inline-flex items-center justify-center rounded-lg font-medium transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2",{primary:"bg-primary-600 hover:bg-primary-700 text-white focus:ring-primary-500",secondary:"bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-900 dark:text-gray-100 focus:ring-gray-500",danger:"bg-red-600 hover:bg-red-700 text-white focus:ring-red-500",success:"bg-green-600 hover:bg-green-700 text-white focus:ring-green-500"}[s],{sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"}[t],d,o),children:[i&&r.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),e]})};class Z extends o.Component{constructor(e){super(e),s(this,"logErrorToService",(e,s)=>{}),s(this,"handleRetry",()=>{this.setState({hasError:!1,error:void 0,errorInfo:void 0})}),s(this,"handleGoHome",()=>{window.location.href="/"}),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,s){this.setState({error:e,errorInfo:s}),this.logErrorToService(e,s)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:r.jsx("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 flex items-center justify-center p-4",children:r.jsxs("div",{className:"max-w-md w-full bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6 text-center",children:[r.jsx("div",{className:"mb-4",children:r.jsx(f,{className:"h-16 w-16 text-red-500 mx-auto"})}),r.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-gray-100 mb-2",children:"خطایی رخ داده است"}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:"متأسفانه مشکلی در برنامه رخ داده است. لطفاً دوباره تلاش کنید یا با پشتیبانی تماس بگیرید."}),!1,r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Y,{onClick:this.handleRetry,className:"flex-1",variant:"primary",children:[r.jsx(b,{className:"h-4 w-4 ml-2"}),"تلاش دوباره"]}),r.jsxs(Y,{onClick:this.handleGoHome,className:"flex-1",variant:"secondary",children:[r.jsx(_,{className:"h-4 w-4 ml-2"}),"بازگشت به خانه"]})]})]})}):this.props.children}}const ee=({size:e="md",text:s="در حال بارگذاری...",fullScreen:t=!1})=>{const a=r.jsxs("div",{className:"flex flex-col items-center justify-center "+(t?"min-h-screen":"p-8"),children:[r.jsx(v,{className:`${{sm:"h-4 w-4",md:"h-8 w-8",lg:"h-12 w-12"}[e]} animate-spin text-primary-600 dark:text-primary-400`}),s&&r.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:s})]});return t?r.jsx("div",{className:"fixed inset-0 bg-white dark:bg-gray-900 z-50",children:a}):a},se=new t({defaultOptions:{queries:{gcTime:0,staleTime:0,refetchOnMount:!0,refetchOnReconnect:!0,refetchOnWindowFocus:!0,retry:1},mutations:{retry:1}}}),re=({permission:e,children:s,fallback:r=null})=>{const{hasPermission:t}=q();return t(e)?s:r},te=({children:e,className:s=""})=>r.jsx("h1",{className:`text-xl sm:text-2xl lg:text-3xl font-bold text-gray-900 dark:text-gray-100 ${s}`,children:e}),ae=({children:e,className:s=""})=>r.jsx("p",{className:`text-sm sm:text-base text-gray-600 dark:text-gray-400 mt-1 ${s}`,children:e}),ie=({children:e,className:s=""})=>r.jsx("h2",{className:`text-lg sm:text-xl font-semibold text-gray-900 dark:text-gray-100 ${s}`,children:e}),le=({children:e,className:s=""})=>r.jsx("h3",{className:`text-base sm:text-lg font-medium text-gray-900 dark:text-gray-100 ${s}`,children:e}),ne=({children:e,className:s=""})=>r.jsx("h3",{className:`text-base sm:text-lg font-semibold text-gray-900 dark:text-gray-100 ${s}`,children:e}),oe=({children:e,className:s=""})=>r.jsx("div",{className:`text-lg sm:text-xl lg:text-2xl font-semibold text-gray-900 dark:text-gray-100 ${s}`,children:e}),de=({children:e,className:s=""})=>r.jsx("dt",{className:`text-xs sm:text-sm font-medium text-gray-500 dark:text-gray-400 truncate ${s}`,children:e}),ce=({children:e,className:s=""})=>r.jsx("p",{className:`text-sm sm:text-base text-gray-700 dark:text-gray-300 ${s}`,children:e}),me=({children:e,className:s=""})=>r.jsx("p",{className:`text-xs sm:text-sm text-gray-600 dark:text-gray-400 ${s}`,children:e}),xe=({children:e,htmlFor:s,className:t=""})=>r.jsx("label",{htmlFor:s,className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 ${t}`,children:e}),he=({title:e,subtitle:s,backButton:t,actions:a,className:i=""})=>r.jsx("div",{className:`space-y-3 sm:space-y-4 ${i}`,children:r.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:items-center sm:gap-4 sm:space-y-0",children:[t&&r.jsx("div",{className:"flex-shrink-0",children:t}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(te,{className:"break-words",children:e}),s&&r.jsx(ae,{className:"break-words",children:s})]})]})}),ge=({children:e,className:s=""})=>r.jsx("div",{className:`p-4 sm:p-6 lg:p-8 space-y-4 sm:space-y-6 max-w-none ${s}`,children:e}),pe=[{title:"داشبورد",icon:_,path:"/"},{title:"مدیریت محصولات",icon:w,children:[{title:"محصولات",icon:w,path:"/products"},{title:"دستهبندیها",icon:E,path:"/categories"},{title:"گزینههای محصول",icon:P,path:"/product-options"}]},{title:"مدیریت سیستم",icon:O,children:[{title:"نقشها",icon:L,path:"/roles",permission:22},{title:"کاربران ادمین",icon:I,path:"/admin-users",permission:22},{title:"دسترسیها",icon:T,path:"/permissions",permission:22}]}],ue=({isOpen:e,onClose:s})=>{var t,a;const{user:i,logout:l}=q(),[n,o]=d.useState([]),m=(e,t=0)=>{const a=e.children&&e.children.length>0,i=n.includes(e.title),l=16*t;if(a)return r.jsxs("div",{className:"space-y-1",children:[r.jsxs("button",{onClick:()=>{return s=e.title,void o(e=>e.includes(s)?e.filter(e=>e!==s):[...e,s]);var s},className:"w-full flex items-center px-4 py-3 text-sm font-medium rounded-lg transition-colors\n text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",style:{paddingLeft:`${l+16}px`},children:[r.jsx(e.icon,{className:"ml-3 h-5 w-5"}),r.jsx("span",{className:"flex-1 text-right",children:e.title}),i?r.jsx(S,{className:"h-4 w-4"}):r.jsx(R,{className:"h-4 w-4"})]}),i&&e.children&&r.jsx("div",{className:"space-y-1",children:e.children.map(e=>m(e,t+1))})]},e.title);const d=r.jsxs(c,{to:e.path,onClick:()=>{window.innerWidth<1024&&s()},className:({isActive:e})=>"w-full flex items-center px-4 py-3 text-sm font-medium rounded-lg transition-colors "+(e?"bg-primary-50 dark:bg-primary-900 text-primary-600 dark:text-primary-400":"text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-white"),style:{paddingLeft:`${l+16}px`},children:[r.jsx(e.icon,{className:"ml-3 h-5 w-5"}),e.title]});return e.permission?r.jsx(re,{permission:e.permission,children:d},e.title):r.jsx("div",{children:d},e.title)};return r.jsxs(r.Fragment,{children:[e&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-40 lg:hidden",onClick:s}),r.jsxs("div",{className:`\n fixed lg:static inset-y-0 right-0 z-50 \n w-64 transform transition-transform duration-300 ease-in-out\n lg:translate-x-0 lg:block\n ${e?"translate-x-0":"translate-x-full lg:translate-x-0"}\n flex flex-col bg-white dark:bg-gray-800 border-l border-gray-200 dark:border-gray-700\n `,children:[r.jsxs("div",{className:"lg:hidden flex justify-between items-center p-4 border-b border-gray-200 dark:border-gray-700",children:[r.jsx(ie,{children:"پنل مدیریت"}),r.jsx("button",{onClick:s,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700",children:r.jsx(N,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})})]}),r.jsx("div",{className:"hidden lg:flex h-16 items-center justify-center border-b border-gray-200 dark:border-gray-700",children:r.jsx(ie,{children:"پنل مدیریت"})}),r.jsx("nav",{className:"flex-1 space-y-1 px-4 py-6 overflow-y-auto",children:pe.map(e=>m(e))}),r.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4",children:r.jsxs("div",{className:"flex items-center space-x-3 space-x-reverse",children:[r.jsx("div",{className:"h-8 w-8 rounded-full bg-primary-600 flex items-center justify-center",children:r.jsxs("span",{className:"text-sm font-medium text-white",children:[null==(t=null==i?void 0:i.first_name)?void 0:t[0],null==(a=null==i?void 0:i.last_name)?void 0:a[0]]})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs(me,{children:[null==i?void 0:i.first_name," ",null==i?void 0:i.last_name]}),r.jsx(me,{children:null==i?void 0:i.username})]}),r.jsx("button",{onClick:l,className:"text-gray-500 hover:text-red-600 dark:text-gray-400 dark:hover:text-red-400",children:r.jsx(k,{className:"h-5 w-5"})})]})})]})]})},ye=({onMenuClick:e})=>{var s;const{user:t,logout:a}=q(),{mode:i,toggleTheme:l}=(()=>{const e=o.useContext(H);if(void 0===e)throw new Error("useTheme must be used within a ThemeProvider");return e})(),[n,d]=o.useState(!1);return r.jsx("header",{className:"bg-white dark:bg-gray-800 shadow-sm border-b border-gray-200 dark:border-gray-700",children:r.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[r.jsxs("div",{className:"flex items-center space-x-4 space-x-reverse",children:[r.jsx("button",{onClick:e,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 lg:hidden",children:r.jsx(A,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})}),r.jsx(ie,{children:"خوش آمدید"})]}),r.jsxs("div",{className:"flex items-center space-x-2 space-x-reverse",children:[r.jsx("button",{onClick:l,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:"dark"===i?r.jsx(C,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):r.jsx(D,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})}),r.jsxs("button",{className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors relative",children:[r.jsx(z,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),r.jsx("span",{className:"absolute top-0 left-0 w-2 h-2 bg-red-500 rounded-full"})]}),r.jsxs("div",{className:"relative",children:[r.jsxs("button",{onClick:()=>d(!n),className:"flex items-center space-x-2 space-x-reverse p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[r.jsx("div",{className:"w-8 h-8 bg-primary-600 rounded-full flex items-center justify-center",children:r.jsx("span",{className:"text-white text-sm font-medium",children:(null==(s=null==t?void 0:t.first_name)?void 0:s.charAt(0))||"A"})}),r.jsxs("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 hidden sm:block",children:[null==t?void 0:t.first_name," ",null==t?void 0:t.last_name]})]}),n&&r.jsx("div",{className:"absolute left-0 mt-2 w-48 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-50",children:r.jsxs("div",{className:"py-1",children:[r.jsxs("div",{className:"px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:[null==t?void 0:t.first_name," ",null==t?void 0:t.last_name]}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:null==t?void 0:t.username})]}),r.jsxs("button",{className:"w-full text-right px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center",children:[r.jsx(V,{className:"h-4 w-4 ml-2"}),"پروفایل"]}),r.jsxs("button",{onClick:()=>{a(),d(!1)},className:"w-full text-right px-4 py-2 text-sm text-red-600 dark:text-red-400 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center",children:[r.jsx(k,{className:"h-4 w-4 ml-2"}),"خروج"]})]})})]})]})]})})},je=()=>{const[e,s]=o.useState(!1);return r.jsxs("div",{className:"flex h-screen bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[r.jsx(ue,{isOpen:e,onClose:()=>s(!1)}),r.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[r.jsx(ye,{onMenuClick:()=>s(!0)}),r.jsx("main",{className:"flex-1 overflow-y-auto bg-gray-50 dark:bg-gray-900",children:r.jsx("div",{className:"min-h-full",children:r.jsx(m,{})})})]})]})},fe=o.lazy(()=>a(()=>import("./Login-5c346228.js"),["assets/Login-5c346228.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/vendor-forms-f89aa741.js","assets/yup-bff05cf1.js","assets/Input-dc2009a3.js","assets/vendor-ui-8a3c5c7d.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js"]).then(e=>({default:e.Login}))),be=o.lazy(()=>a(()=>import("./Dashboard-e64113c9.js"),["assets/Dashboard-e64113c9.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/vendor-ui-8a3c5c7d.js","assets/BarChart-2cf7731f.js","assets/vendor-charts-4c310516.js","assets/Table-2d8d22e8.js","assets/vendor-toast-598db4db.js"]).then(e=>({default:e.Dashboard}))),_e=o.lazy(()=>a(()=>import("./Users-222cded8.js"),["assets/Users-222cded8.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/Table-2d8d22e8.js","assets/vendor-ui-8a3c5c7d.js","assets/Modal-8110908d.js","assets/Pagination-ce6b4a1c.js","assets/vendor-forms-f89aa741.js","assets/yup-bff05cf1.js","assets/Input-dc2009a3.js","assets/vendor-toast-598db4db.js"]).then(e=>({default:e.Users}))),ve=o.lazy(()=>a(()=>import("./Orders-03d2b26a.js"),["assets/Orders-03d2b26a.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/Table-2d8d22e8.js","assets/vendor-ui-8a3c5c7d.js","assets/Pagination-ce6b4a1c.js","assets/vendor-toast-598db4db.js"]).then(e=>({default:e.Orders}))),Ne=o.lazy(()=>a(()=>import("./Reports-66b51ed4.js"),["assets/Reports-66b51ed4.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/BarChart-2cf7731f.js","assets/vendor-charts-4c310516.js","assets/vendor-ui-8a3c5c7d.js","assets/vendor-toast-598db4db.js"]).then(e=>({default:e.Reports}))),ke=o.lazy(()=>a(()=>import("./Notifications-62a27ebc.js"),["assets/Notifications-62a27ebc.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/Pagination-ce6b4a1c.js","assets/vendor-ui-8a3c5c7d.js","assets/vendor-toast-598db4db.js"]).then(e=>({default:e.Notifications}))),we=o.lazy(()=>a(()=>import("./RolesListPage-ead5d22a.js"),["assets/RolesListPage-ead5d22a.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/_hooks-653fd77f.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js","assets/Modal-8110908d.js","assets/vendor-ui-8a3c5c7d.js"])),Ee=o.lazy(()=>a(()=>import("./RoleFormPage-57d635b2.js"),["assets/RoleFormPage-57d635b2.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/vendor-forms-f89aa741.js","assets/yup-bff05cf1.js","assets/_hooks-653fd77f.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js","assets/Input-dc2009a3.js","assets/vendor-ui-8a3c5c7d.js"])),Pe=o.lazy(()=>a(()=>import("./RoleDetailPage-00a65d21.js"),["assets/RoleDetailPage-00a65d21.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/_hooks-653fd77f.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js","assets/vendor-ui-8a3c5c7d.js"])),Oe=o.lazy(()=>a(()=>import("./RolePermissionsPage-7d18a97b.js"),["assets/RolePermissionsPage-7d18a97b.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/_hooks-653fd77f.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js","assets/Modal-8110908d.js","assets/vendor-ui-8a3c5c7d.js"])),Le=o.lazy(()=>a(()=>import("./AdminUsersListPage-71f01ef3.js"),["assets/AdminUsersListPage-71f01ef3.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/_hooks-e1033fd2.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js","assets/Modal-8110908d.js","assets/vendor-ui-8a3c5c7d.js"])),Ie=o.lazy(()=>a(()=>import("./AdminUserFormPage-cda21843.js"),["assets/AdminUserFormPage-cda21843.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/vendor-forms-f89aa741.js","assets/yup-bff05cf1.js","assets/_hooks-e1033fd2.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js","assets/_hooks-69d4323f.js","assets/_hooks-653fd77f.js","assets/Input-dc2009a3.js","assets/vendor-ui-8a3c5c7d.js","assets/MultiSelectAutocomplete-a5a00ba6.js"])),Te=o.lazy(()=>a(()=>import("./AdminUserDetailPage-bc73b8e3.js"),["assets/AdminUserDetailPage-bc73b8e3.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/_hooks-e1033fd2.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js","assets/vendor-ui-8a3c5c7d.js"])),Se=o.lazy(()=>a(()=>import("./PermissionsListPage-d4b2ae32.js"),["assets/PermissionsListPage-d4b2ae32.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/_hooks-69d4323f.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js","assets/vendor-ui-8a3c5c7d.js"])),Re=o.lazy(()=>a(()=>import("./PermissionFormPage-f910c22b.js"),["assets/PermissionFormPage-f910c22b.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/vendor-forms-f89aa741.js","assets/yup-bff05cf1.js","assets/_hooks-69d4323f.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js","assets/Input-dc2009a3.js","assets/vendor-ui-8a3c5c7d.js"])),Ae=o.lazy(()=>a(()=>import("./ProductOptionsListPage-9794930d.js"),["assets/ProductOptionsListPage-9794930d.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/_hooks-8b9f7cf5.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js","assets/Modal-8110908d.js","assets/vendor-ui-8a3c5c7d.js"])),Ce=o.lazy(()=>a(()=>import("./ProductOptionFormPage-dba7dda7.js"),["assets/ProductOptionFormPage-dba7dda7.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/vendor-forms-f89aa741.js","assets/yup-bff05cf1.js","assets/_hooks-8b9f7cf5.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js","assets/Input-dc2009a3.js","assets/vendor-ui-8a3c5c7d.js"])),De=o.lazy(()=>a(()=>import("./CategoriesListPage-e9d7e6e2.js"),["assets/CategoriesListPage-e9d7e6e2.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/_hooks-9d916060.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js","assets/Modal-8110908d.js","assets/vendor-ui-8a3c5c7d.js"])),ze=o.lazy(()=>a(()=>import("./CategoryFormPage-da5b0c87.js"),["assets/CategoryFormPage-da5b0c87.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/Input-dc2009a3.js","assets/vendor-ui-8a3c5c7d.js","assets/_hooks-9d916060.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js"])),Ve=o.lazy(()=>a(()=>import("./ProductsListPage-1040bc50.js"),["assets/ProductsListPage-1040bc50.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/_hooks-05707864.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js","assets/_hooks-9d916060.js","assets/Modal-8110908d.js","assets/vendor-ui-8a3c5c7d.js"])),$e=o.lazy(()=>a(()=>import("./ProductFormPage-70905032.js"),["assets/ProductFormPage-70905032.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/vendor-forms-f89aa741.js","assets/yup-bff05cf1.js","assets/_hooks-05707864.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js","assets/_hooks-9d916060.js","assets/_hooks-8b9f7cf5.js","assets/_models-0008c1da.js","assets/MultiSelectAutocomplete-a5a00ba6.js","assets/vendor-ui-8a3c5c7d.js","assets/Input-dc2009a3.js"])),Fe=o.lazy(()=>a(()=>import("./ProductDetailPage-efc71a33.js"),["assets/ProductDetailPage-efc71a33.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/_hooks-05707864.js","assets/_requests-35c9d4c3.js","assets/vendor-toast-598db4db.js","assets/_models-0008c1da.js","assets/vendor-ui-8a3c5c7d.js"])),Ge=({children:e})=>{const{user:s,isLoading:t}=q();return t?r.jsx("div",{className:"min-h-screen flex items-center justify-center",children:r.jsx(ee,{})}):s?e:r.jsx(p,{to:"/login",replace:!0})},Me=()=>r.jsxs(h,{children:[r.jsx(g,{path:"/login",element:r.jsx(fe,{})}),r.jsxs(g,{path:"/",element:r.jsx(Ge,{children:r.jsx(je,{})}),children:[r.jsx(g,{index:!0,element:r.jsx(be,{})}),r.jsx(g,{path:"users",element:r.jsx(_e,{})}),r.jsx(g,{path:"products",element:r.jsx(Ve,{})}),r.jsx(g,{path:"orders",element:r.jsx(ve,{})}),r.jsx(g,{path:"reports",element:r.jsx(Ne,{})}),r.jsx(g,{path:"notifications",element:r.jsx(ke,{})}),r.jsx(g,{path:"roles",element:r.jsx(we,{})}),r.jsx(g,{path:"roles/create",element:r.jsx(Ee,{})}),r.jsx(g,{path:"roles/:id",element:r.jsx(Pe,{})}),r.jsx(g,{path:"roles/:id/edit",element:r.jsx(Ee,{})}),r.jsx(g,{path:"roles/:id/permissions",element:r.jsx(Oe,{})}),r.jsx(g,{path:"admin-users",element:r.jsx(Le,{})}),r.jsx(g,{path:"admin-users/create",element:r.jsx(Ie,{})}),r.jsx(g,{path:"admin-users/:id",element:r.jsx(Te,{})}),r.jsx(g,{path:"admin-users/:id/edit",element:r.jsx(Ie,{})}),r.jsx(g,{path:"permissions",element:r.jsx(Se,{})}),r.jsx(g,{path:"permissions/create",element:r.jsx(Re,{})}),r.jsx(g,{path:"permissions/:id/edit",element:r.jsx(Re,{})}),r.jsx(g,{path:"product-options",element:r.jsx(Ae,{})}),r.jsx(g,{path:"product-options/create",element:r.jsx(Ce,{})}),r.jsx(g,{path:"product-options/:id/edit",element:r.jsx(Ce,{})}),r.jsx(g,{path:"categories",element:r.jsx(De,{})}),r.jsx(g,{path:"categories/create",element:r.jsx(ze,{})}),r.jsx(g,{path:"categories/:id/edit",element:r.jsx(ze,{})}),r.jsx(g,{path:"products/create",element:r.jsx($e,{})}),r.jsx(g,{path:"products/:id",element:r.jsx(Fe,{})}),r.jsx(g,{path:"products/:id/edit",element:r.jsx($e,{})})]})]}),Ue=()=>r.jsx(Z,{children:r.jsxs(i,{client:se,children:[r.jsx(W,{children:r.jsx(Q,{children:r.jsx(B,{children:r.jsx(x,{children:r.jsx(o.Suspense,{fallback:r.jsx("div",{className:"min-h-screen flex items-center justify-center",children:r.jsx(ee,{})}),children:r.jsx(Me,{})})})})})}),r.jsx(l,{initialIsOpen:!1})]})});$.createRoot(document.getElementById("root")).render(r.jsx(d.StrictMode,{children:r.jsx(Ue,{})}));export{Y as B,ne as C,he as F,ee as L,ge as P,de as S,oe as a,te as b,re as c,xe as d,le as e,ie as f,ce as g,X as h,q as u};
|