From a6e59b7c85b980a0aeed07602a3f682606a1f952 Mon Sep 17 00:00:00 2001 From: hosseintaromi Date: Tue, 29 Jul 2025 09:58:41 +0330 Subject: [PATCH] perf: optimize bundle size with code splitting and lazy loading Bundle Size Optimization: - Add lazy loading for all page components - Implement Suspense wrapper with loading fallbacks - Configure manual chunks for vendor libraries - Separate chart library (recharts) into vendor-charts chunk Results: - Split single 950KB bundle into multiple optimized chunks - Main vendor chunks: React (162KB), Forms (65KB), Charts (402KB) - Each page loads independently with lazy loading - Improved initial load time and caching efficiency - Install terser for better minification Chunks created: - vendor-react: React dependencies - vendor-forms: Form validation libraries - vendor-query: React Query - vendor-toast: Toast notifications - vendor-charts: Chart library (lazy loaded) This resolves the bundle size warning and improves performance --- dist/assets/AdminUserDetailPage-bc73b8e3.js | 1 + dist/assets/AdminUserFormPage-cda21843.js | 1 + dist/assets/AdminUsersListPage-71f01ef3.js | 1 + dist/assets/BarChart-2cf7731f.js | 1 + dist/assets/CategoriesListPage-e9d7e6e2.js | 1 + dist/assets/CategoryFormPage-da5b0c87.js | 1 + dist/assets/Dashboard-e64113c9.js | 1 + dist/assets/Input-dc2009a3.js | 1 + dist/assets/LineChart-c9934470.js | 1 + dist/assets/Login-5c346228.js | 1 + dist/assets/Modal-8110908d.js | 1 + .../MultiSelectAutocomplete-a5a00ba6.js | 1 + dist/assets/Notifications-62a27ebc.js | 1 + dist/assets/Orders-03d2b26a.js | 1 + dist/assets/Pagination-ce6b4a1c.js | 1 + dist/assets/PermissionFormPage-f910c22b.js | 1 + dist/assets/PermissionsListPage-d4b2ae32.js | 1 + dist/assets/ProductDetailPage-efc71a33.js | 1 + dist/assets/ProductFormPage-70905032.js | 1 + dist/assets/ProductOptionFormPage-dba7dda7.js | 1 + .../assets/ProductOptionsListPage-9794930d.js | 1 + dist/assets/ProductsListPage-1040bc50.js | 1 + dist/assets/Reports-66b51ed4.js | 1 + dist/assets/RoleDetailPage-00a65d21.js | 1 + dist/assets/RoleFormPage-57d635b2.js | 1 + dist/assets/RolePermissionsPage-7d18a97b.js | 1 + dist/assets/RolesListPage-ead5d22a.js | 1 + dist/assets/Table-2d8d22e8.js | 1 + dist/assets/Users-222cded8.js | 1 + dist/assets/_hooks-05707864.js | 1 + dist/assets/_hooks-653fd77f.js | 1 + dist/assets/_hooks-69d4323f.js | 1 + dist/assets/_hooks-8b9f7cf5.js | 1 + dist/assets/_hooks-9d916060.js | 1 + dist/assets/_hooks-e1033fd2.js | 1 + dist/assets/_models-0008c1da.js | 1 + dist/assets/_requests-35c9d4c3.js | 3 + dist/assets/index-13d37b48.js | 350 ------------------ dist/assets/index-590deac5.js | 1 + dist/assets/vendor-charts-4c310516.js | 1 + dist/assets/vendor-forms-f89aa741.js | 1 + dist/assets/vendor-query-a3e439f2.js | 1 + dist/assets/vendor-react-ac1483bd.js | 51 +++ dist/assets/vendor-toast-598db4db.js | 171 +++++++++ dist/assets/vendor-ui-8a3c5c7d.js | 1 + dist/assets/yup-bff05cf1.js | 1 + dist/index.html | 6 +- package-lock.json | 66 ++++ package.json | 1 + src/App.tsx | 57 +-- src/pages/Dashboard.tsx | 16 +- src/pages/Reports.tsx | 8 +- vite.config.ts | 30 ++ 53 files changed, 418 insertions(+), 383 deletions(-) create mode 100644 dist/assets/AdminUserDetailPage-bc73b8e3.js create mode 100644 dist/assets/AdminUserFormPage-cda21843.js create mode 100644 dist/assets/AdminUsersListPage-71f01ef3.js create mode 100644 dist/assets/BarChart-2cf7731f.js create mode 100644 dist/assets/CategoriesListPage-e9d7e6e2.js create mode 100644 dist/assets/CategoryFormPage-da5b0c87.js create mode 100644 dist/assets/Dashboard-e64113c9.js create mode 100644 dist/assets/Input-dc2009a3.js create mode 100644 dist/assets/LineChart-c9934470.js create mode 100644 dist/assets/Login-5c346228.js create mode 100644 dist/assets/Modal-8110908d.js create mode 100644 dist/assets/MultiSelectAutocomplete-a5a00ba6.js create mode 100644 dist/assets/Notifications-62a27ebc.js create mode 100644 dist/assets/Orders-03d2b26a.js create mode 100644 dist/assets/Pagination-ce6b4a1c.js create mode 100644 dist/assets/PermissionFormPage-f910c22b.js create mode 100644 dist/assets/PermissionsListPage-d4b2ae32.js create mode 100644 dist/assets/ProductDetailPage-efc71a33.js create mode 100644 dist/assets/ProductFormPage-70905032.js create mode 100644 dist/assets/ProductOptionFormPage-dba7dda7.js create mode 100644 dist/assets/ProductOptionsListPage-9794930d.js create mode 100644 dist/assets/ProductsListPage-1040bc50.js create mode 100644 dist/assets/Reports-66b51ed4.js create mode 100644 dist/assets/RoleDetailPage-00a65d21.js create mode 100644 dist/assets/RoleFormPage-57d635b2.js create mode 100644 dist/assets/RolePermissionsPage-7d18a97b.js create mode 100644 dist/assets/RolesListPage-ead5d22a.js create mode 100644 dist/assets/Table-2d8d22e8.js create mode 100644 dist/assets/Users-222cded8.js create mode 100644 dist/assets/_hooks-05707864.js create mode 100644 dist/assets/_hooks-653fd77f.js create mode 100644 dist/assets/_hooks-69d4323f.js create mode 100644 dist/assets/_hooks-8b9f7cf5.js create mode 100644 dist/assets/_hooks-9d916060.js create mode 100644 dist/assets/_hooks-e1033fd2.js create mode 100644 dist/assets/_models-0008c1da.js create mode 100644 dist/assets/_requests-35c9d4c3.js delete mode 100644 dist/assets/index-13d37b48.js create mode 100644 dist/assets/index-590deac5.js create mode 100644 dist/assets/vendor-charts-4c310516.js create mode 100644 dist/assets/vendor-forms-f89aa741.js create mode 100644 dist/assets/vendor-query-a3e439f2.js create mode 100644 dist/assets/vendor-react-ac1483bd.js create mode 100644 dist/assets/vendor-toast-598db4db.js create mode 100644 dist/assets/vendor-ui-8a3c5c7d.js create mode 100644 dist/assets/yup-bff05cf1.js diff --git a/dist/assets/AdminUserDetailPage-bc73b8e3.js b/dist/assets/AdminUserDetailPage-bc73b8e3.js new file mode 100644 index 0000000..d72214f --- /dev/null +++ b/dist/assets/AdminUserDetailPage-bc73b8e3.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{L as s,P as r,b as a,c as d,B as t,f as l,g as i,e as c}from"./index-590deac5.js";import{b as n}from"./_hooks-e1033fd2.js";import{u as m,f as x}from"./vendor-react-ac1483bd.js";import{z as g,G as o,h,d as j,K as b,I as y,t as p}from"./vendor-ui-8a3c5c7d.js";import"./vendor-toast-598db4db.js";import"./_requests-35c9d4c3.js";const N=()=>{const N=m(),{id:u=""}=x(),{data:f,isLoading:k,error:v}=n(u);if(k)return e.jsx(s,{});if(v)return e.jsx("div",{className:"text-red-600",children:"خطا در بارگذاری اطلاعات کاربر"});if(!f)return e.jsx("div",{children:"کاربر یافت نشد"});const w=e=>new Date(e).toLocaleDateString("fa-IR");return e.jsxs(r,{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>N("/admin-users"),className:"flex items-center justify-center w-10 h-10 rounded-lg bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 transition-colors",children:e.jsx(g,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx(a,{children:"جزئیات کاربر ادمین"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"نمایش اطلاعات کامل کاربر ادمین"})]})]}),e.jsx("div",{className:"flex gap-3",children:e.jsx(d,{permission:23,children:e.jsxs(t,{onClick:()=>N(`/admin-users/${u}/edit`),className:"flex items-center gap-2",children:[e.jsx(o,{className:"h-4 w-4"}),"ویرایش"]})})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[e.jsxs(l,{className:"flex items-center gap-2 mb-4",children:[e.jsx(h,{className:"h-5 w-5"}),"اطلاعات اصلی"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"نام"}),e.jsx(i,{children:f.first_name||"تعریف نشده"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"نام خانوادگی"}),e.jsx(i,{children:f.last_name||"تعریف نشده"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"نام کاربری"}),e.jsx(i,{children:f.username})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"وضعیت"}),(s=>{const r="active"===s;return e.jsx("span",{className:"px-3 py-1 rounded-full text-sm font-medium "+(r?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"),children:r?"فعال":"غیرفعال"})})(f.status)]})]})]}),f.roles&&f.roles.length>0&&e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[e.jsxs(l,{className:"flex items-center gap-2 mb-4",children:[e.jsx(j,{className:"h-5 w-5"}),"نقش‌ها"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:f.roles.map(s=>e.jsx("span",{className:"px-3 py-1 bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200 rounded-full text-sm font-medium",children:s.title},s.id))})]}),f.permissions&&f.permissions.length>0&&e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[e.jsxs(l,{className:"flex items-center gap-2 mb-4",children:[e.jsx(b,{className:"h-5 w-5"}),"دسترسی‌های مستقیم"]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:f.permissions.map(s=>e.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:s.title}),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:s.description})]},s.id))})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[e.jsxs(l,{className:"flex items-center gap-2 mb-4",children:[e.jsx(y,{className:"h-5 w-5"}),"اطلاعات زمانی"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(c,{className:"text-sm text-gray-600 dark:text-gray-400 mb-1",children:"تاریخ ایجاد"}),e.jsx(i,{children:f.created_at?w(f.created_at):"تعریف نشده"})]}),e.jsxs("div",{children:[e.jsx(c,{className:"text-sm text-gray-600 dark:text-gray-400 mb-1",children:"آخرین بروزرسانی"}),e.jsx(i,{children:f.updated_at?w(f.updated_at):"تعریف نشده"})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[e.jsxs(l,{className:"flex items-center gap-2 mb-4",children:[e.jsx(p,{className:"h-5 w-5"}),"آمار سریع"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تعداد نقش‌ها"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:f.roles?f.roles.length:0})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تعداد دسترسی‌ها"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:f.permissions?f.permissions.length:0})]})]})]})]})]})]})};export{N as default}; diff --git a/dist/assets/AdminUserFormPage-cda21843.js b/dist/assets/AdminUserFormPage-cda21843.js new file mode 100644 index 0000000..8de1c74 --- /dev/null +++ b/dist/assets/AdminUserFormPage-cda21843.js @@ -0,0 +1 @@ +import{j as s}from"./vendor-query-a3e439f2.js";import{u as e,f as a,r}from"./vendor-react-ac1483bd.js";import{c as i,a as t,b as o,d,e as l,u as n}from"./vendor-forms-f89aa741.js";import{o as m}from"./yup-bff05cf1.js";import{b as u,c,d as p}from"./_hooks-e1033fd2.js";import{u as f}from"./_hooks-69d4323f.js";import{u as h}from"./_hooks-653fd77f.js";import{L as x,P as g,F as j,B as v}from"./index-590deac5.js";import{I as b}from"./Input-dc2009a3.js";import{M as _}from"./MultiSelectAutocomplete-a5a00ba6.js";import{z as y}from"./vendor-ui-8a3c5c7d.js";import"./_requests-35c9d4c3.js";import"./vendor-toast-598db4db.js";const w=i({first_name:t().required("نام الزامی است").min(2,"نام باید حداقل 2 کاراکتر باشد"),last_name:t().required("نام خانوادگی الزامی است").min(2,"نام خانوادگی باید حداقل 2 کاراکتر باشد"),username:t().required("نام کاربری الزامی است").min(3,"نام کاربری باید حداقل 3 کاراکتر باشد"),password:t().when("isEdit",{is:!1,then:s=>s.required("رمز عبور الزامی است").min(8,"رمز عبور باید حداقل 8 کاراکتر باشد"),otherwise:s=>s.notRequired().test("min-length","رمز عبور باید حداقل 8 کاراکتر باشد",function(s){return!s||s.length>=8})}),status:t().required("وضعیت الزامی است").oneOf(["active","deactive"],"وضعیت نامعتبر است"),permissions:o().of(d()).default([]),roles:o().of(d()).default([]),isEdit:l().default(!1)}),V=()=>{var i,t,o,d,l,V;const k=e(),{id:N}=a(),q=!!N,{data:E,isLoading:C}=u(N||"",q),{mutate:L,isPending:S}=c(),{mutate:D,isPending:I}=p(),{data:P,isLoading:B}=f(),{data:F,isLoading:M}=h(),z=S||I,{register:A,handleSubmit:O,formState:{errors:R,isValid:G,isDirty:H},setValue:J,watch:K}=n({resolver:m(w),mode:"onChange",defaultValues:{first_name:"",last_name:"",username:"",password:"",status:"active",permissions:[],roles:[],isEdit:q}});K();r.useEffect(()=>{var s,e;q&&E&&(J("first_name",E.first_name,{shouldValidate:!0}),J("last_name",E.last_name,{shouldValidate:!0}),J("username",E.username,{shouldValidate:!0}),J("status",E.status,{shouldValidate:!0}),J("permissions",(null==(s=E.permissions)?void 0:s.map(s=>s.id))||[],{shouldValidate:!0}),J("roles",(null==(e=E.roles)?void 0:e.map(s=>s.id))||[],{shouldValidate:!0}),J("isEdit",!0,{shouldValidate:!0}))},[q,E,J]);const Q=()=>{k("/admin-users")};if(q&&C)return s.jsx("div",{className:"flex justify-center items-center h-64",children:s.jsx(x,{})});const T=s.jsxs(v,{variant:"secondary",onClick:Q,className:"flex items-center gap-2",children:[s.jsx(y,{className:"h-4 w-4"}),"بازگشت"]});return s.jsxs(g,{className:"max-w-2xl mx-auto",children:[s.jsx(j,{title:q?"ویرایش کاربر ادمین":"ایجاد کاربر ادمین جدید",subtitle:q?"ویرایش اطلاعات کاربر ادمین":"اطلاعات کاربر ادمین جدید را وارد کنید",backButton:T}),s.jsx("div",{className:"card p-4 sm:p-6",children:s.jsxs("form",{onSubmit:O(s=>{q&&N?D({id:N,userData:{id:parseInt(N),first_name:s.first_name,last_name:s.last_name,username:s.username,password:s.password&&s.password.trim()?s.password:void 0,status:s.status,permissions:s.permissions,roles:s.roles}},{onSuccess:()=>{k("/admin-users")}}):L({first_name:s.first_name,last_name:s.last_name,username:s.username,password:s.password||"",status:s.status,permissions:s.permissions,roles:s.roles},{onSuccess:s=>{k("/admin-users")},onError:s=>{}})}),className:"space-y-4 sm:space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsx(b,{label:"نام",...A("first_name"),error:null==(i=R.first_name)?void 0:i.message,placeholder:"نام کاربر"}),s.jsx(b,{label:"نام خانوادگی",...A("last_name"),error:null==(t=R.last_name)?void 0:t.message,placeholder:"نام خانوادگی کاربر"})]}),s.jsx(b,{label:"نام کاربری",...A("username"),error:null==(o=R.username)?void 0:o.message,placeholder:"نام کاربری"}),s.jsx(b,{label:q?"رمز عبور (اختیاری)":"رمز عبور",type:"password",...A("password"),error:null==(d=R.password)?void 0:d.message,placeholder:q?"رمز عبور جدید (در صورت تمایل به تغییر)":"رمز عبور"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsx(_,{label:"دسترسی‌ها",options:(P||[]).map(s=>({id:s.id,title:s.title,description:s.description})),selectedValues:K("permissions")||[],onChange:s=>J("permissions",s,{shouldValidate:!0}),placeholder:"انتخاب دسترسی‌ها...",isLoading:B,error:null==(l=R.permissions)?void 0:l.message}),s.jsx(_,{label:"نقش‌ها",options:(F||[]).map(s=>({id:s.id,title:s.title,description:s.description})),selectedValues:K("roles")||[],onChange:s=>J("roles",s,{shouldValidate:!0}),placeholder:"انتخاب نقش‌ها...",isLoading:M,error:null==(V=R.roles)?void 0:V.message})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"وضعیت"}),s.jsxs("select",{...A("status"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",children:[s.jsx("option",{value:"active",children:"فعال"}),s.jsx("option",{value:"deactive",children:"غیرفعال"})]}),R.status&&s.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.status.message})]}),s.jsxs("div",{className:"flex justify-end space-x-4 space-x-reverse pt-6 border-t border-gray-200 dark:border-gray-600",children:[s.jsx(v,{type:"button",variant:"secondary",onClick:Q,disabled:z,children:"انصراف"}),s.jsx(v,{type:"submit",loading:z,disabled:!G||z,children:q?"به‌روزرسانی":"ایجاد"})]})]})})]})};export{V as default}; diff --git a/dist/assets/AdminUsersListPage-71f01ef3.js b/dist/assets/AdminUsersListPage-71f01ef3.js new file mode 100644 index 0000000..78f5d2a --- /dev/null +++ b/dist/assets/AdminUsersListPage-71f01ef3.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{u as a,r}from"./vendor-react-ac1483bd.js";import{u as s,a as t}from"./_hooks-e1033fd2.js";import{P as d,b as i,e as l,B as x}from"./index-590deac5.js";import{M as c}from"./Modal-8110908d.js";import{n,m as g,J as m,j as o,x as h,y}from"./vendor-ui-8a3c5c7d.js";import"./_requests-35c9d4c3.js";import"./vendor-toast-598db4db.js";const p=()=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[e.jsx("div",{className:"hidden md:block",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام و نام خانوادگی"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام کاربری"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"وضعیت"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:[...Array(5)].map((a,r)=>e.jsxs("tr",{className:"animate-pulse",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-32"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-24"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-6 bg-gray-300 dark:bg-gray-600 rounded-full w-16"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-20"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"})]})})]},r))})]})})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:[...Array(3)].map((a,r)=>e.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 animate-pulse",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-5 bg-gray-300 dark:bg-gray-600 rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-1/2"}),e.jsx("div",{className:"h-6 bg-gray-300 dark:bg-gray-600 rounded-full w-16"}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"})]})]})},r))})]}),j=()=>{const j=a(),[u,b]=r.useState(null),[k,N]=r.useState({search:"",status:""}),{data:v,isLoading:w,error:f}=s(k),{mutate:C,isPending:_}=t(),S=()=>{j("/admin-users/create")},D=e=>{j(`/admin-users/${e}`)},A=e=>{j(`/admin-users/${e}/edit`)};return f?e.jsx("div",{className:"p-6",children:e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-red-600 dark:text-red-400",children:"خطا در بارگذاری کاربران ادمین"})})}):e.jsxs(d,{children:[e.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:items-center sm:justify-between sm:space-y-0",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(n,{className:"h-6 w-6"}),e.jsx(i,{children:"مدیریت کاربران ادمین"})]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"مدیریت کاربران دسترسی به پنل ادمین"})]}),e.jsx("button",{onClick:S,className:"flex items-center justify-center w-12 h-12 bg-primary-600 hover:bg-primary-700 rounded-full transition-colors duration-200 text-white shadow-lg hover:shadow-xl",title:"کاربر ادمین جدید",children:e.jsx(g,{className:"h-5 w-5"})})]}),e.jsx(l,{children:"فیلترها"}),e.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"جستجو"}),e.jsx("input",{type:"text",placeholder:"جستجو در نام، نام خانوادگی یا نام کاربری...",value:k.search,onChange:e=>{N(a=>({...a,search:e.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"وضعیت"}),e.jsxs("select",{value:k.status,onChange:e=>{N(a=>({...a,status:e.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",children:[e.jsx("option",{value:"",children:"همه"}),e.jsx("option",{value:"active",children:"فعال"}),e.jsx("option",{value:"deactive",children:"غیرفعال"})]})]})]})}),w?e.jsx(p,{}):0===(v||[]).length?e.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg",children:e.jsxs("div",{className:"text-center py-12",children:[e.jsx(n,{className:"h-12 w-12 text-gray-400 dark:text-gray-500 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-2",children:"هیچ کاربر ادمین یافت نشد"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:k.search||k.status?"نتیجه‌ای برای جستجوی شما یافت نشد":"شما هنوز هیچ کاربر ادمین ایجاد نکرده‌اید"}),e.jsxs(x,{onClick:S,children:[e.jsx(m,{className:"h-4 w-4 ml-2"}),"اولین کاربر ادمین را ایجاد کنید"]})]})}):e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[e.jsx("div",{className:"hidden md:block",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام و نام خانوادگی"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام کاربری"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"وضعیت"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:(v||[]).map(a=>e.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[e.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:[a.first_name," ",a.last_name]}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:a.username}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium "+("active"===a.status?"bg-green-100 text-green-800 dark:bg-green-800 dark:text-green-100":"bg-red-100 text-red-800 dark:bg-red-800 dark:text-red-100"),children:"active"===a.status?"فعال":"غیرفعال"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:new Date(a.created_at).toLocaleDateString("fa-IR")}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>D(a.id),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",title:"مشاهده",children:e.jsx(o,{className:"h-4 w-4"})}),e.jsx("button",{onClick:()=>A(a.id),className:"text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",title:"ویرایش",children:e.jsx(h,{className:"h-4 w-4"})}),e.jsx("button",{onClick:()=>b(a.id.toString()),className:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",title:"حذف",children:e.jsx(y,{className:"h-4 w-4"})})]})})]},a.id))})]})})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:(v||[]).map(a=>e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:[a.first_name," ",a.last_name]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:a.username})]}),e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium "+("active"===a.status?"bg-green-100 text-green-800 dark:bg-green-800 dark:text-green-100":"bg-red-100 text-red-800 dark:bg-red-800 dark:text-red-100"),children:"active"===a.status?"فعال":"غیرفعال"})]}),e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:["تاریخ ایجاد: ",new Date(a.created_at).toLocaleDateString("fa-IR")]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>D(a.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",children:[e.jsx(o,{className:"h-3 w-3"}),"مشاهده"]}),e.jsxs("button",{onClick:()=>A(a.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",children:[e.jsx(h,{className:"h-3 w-3"}),"ویرایش"]}),e.jsxs("button",{onClick:()=>b(a.id.toString()),className:"flex items-center gap-1 px-2 py-1 text-xs text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",children:[e.jsx(y,{className:"h-3 w-3"}),"حذف"]})]})]},a.id))})]}),e.jsx(c,{isOpen:!!u,onClose:()=>b(null),title:"حذف کاربر ادمین",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"آیا از حذف این کاربر ادمین اطمینان دارید؟ این عمل قابل بازگشت نیست."}),e.jsxs("div",{className:"flex justify-end space-x-2 space-x-reverse",children:[e.jsx(x,{variant:"secondary",onClick:()=>b(null),disabled:_,children:"انصراف"}),e.jsx(x,{variant:"danger",onClick:()=>{u&&C(u,{onSuccess:()=>{b(null)}})},loading:_,children:"حذف"})]})]})})]})};export{j as default}; diff --git a/dist/assets/BarChart-2cf7731f.js b/dist/assets/BarChart-2cf7731f.js new file mode 100644 index 0000000..2702124 --- /dev/null +++ b/dist/assets/BarChart-2cf7731f.js @@ -0,0 +1 @@ +import{j as a}from"./vendor-query-a3e439f2.js";import{C as s}from"./index-590deac5.js";import{R as r,B as t,b as e,X as o,Y as i,T as d,c as l}from"./vendor-charts-4c310516.js";const n=({data:n,title:c,color:x="#3b82f6"})=>a.jsxs("div",{className:"card p-3 sm:p-4 lg:p-6",children:[c&&a.jsx(s,{className:"mb-3 sm:mb-4",children:c}),a.jsx("div",{className:"w-full",children:a.jsx(r,{width:"100%",height:250,minHeight:200,children:a.jsxs(t,{data:n,margin:{top:5,right:5,left:5,bottom:5},children:[a.jsx(e,{strokeDasharray:"3 3",className:"stroke-gray-300 dark:stroke-gray-600"}),a.jsx(o,{dataKey:"name",className:"text-gray-600 dark:text-gray-400",tick:{fontSize:10},interval:0,angle:-45,textAnchor:"end",height:60}),a.jsx(i,{className:"text-gray-600 dark:text-gray-400",tick:{fontSize:10},width:40}),a.jsx(d,{contentStyle:{backgroundColor:"var(--toast-bg)",color:"var(--toast-color)",border:"none",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",fontSize:"12px"}}),a.jsx(l,{dataKey:"value",fill:x,radius:[2,2,0,0]})]})})})]});export{n as B}; diff --git a/dist/assets/CategoriesListPage-e9d7e6e2.js b/dist/assets/CategoriesListPage-e9d7e6e2.js new file mode 100644 index 0000000..0c73209 --- /dev/null +++ b/dist/assets/CategoriesListPage-e9d7e6e2.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{u as a,r as s}from"./vendor-react-ac1483bd.js";import{u as r,a as t}from"./_hooks-9d916060.js";import{P as d,b as i,B as x}from"./index-590deac5.js";import{M as l}from"./Modal-8110908d.js";import{F as c,m as n,O as m,x as g,y as o}from"./vendor-ui-8a3c5c7d.js";import"./_requests-35c9d4c3.js";import"./vendor-toast-598db4db.js";const h=()=>e.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:e.jsx("div",{className:"hidden md:block",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام دسته‌بندی"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"توضیحات"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:[...Array(5)].map((a,s)=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"h-8 w-8 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"}),e.jsx("div",{className:"h-8 w-8 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})]})})]},s))})]})})})}),y=()=>{const y=a(),[p,j]=s.useState(null),[N,u]=s.useState({search:""}),{data:k,isLoading:v,error:b}=r(N),{mutate:w,isPending:f}=t(),C=()=>{y("/categories/create")},S=e=>{y(`/categories/${e}/edit`)};return b?e.jsx("div",{className:"p-6",children:e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-red-600 dark:text-red-400",children:"خطا در بارگذاری دسته‌بندی‌ها"})})}):e.jsxs(d,{children:[e.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:items-center sm:justify-between sm:space-y-0",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(c,{className:"h-6 w-6"}),e.jsx(i,{children:"مدیریت دسته‌بندی‌ها"})]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"مدیریت دسته‌بندی‌های محصولات"})]}),e.jsx("button",{onClick:C,className:"flex items-center justify-center w-12 h-12 bg-primary-600 hover:bg-primary-700 rounded-full transition-colors duration-200 text-white shadow-lg hover:shadow-xl",title:"دسته‌بندی جدید",children:e.jsx(n,{className:"h-5 w-5"})})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"جستجو"}),e.jsx("input",{type:"text",placeholder:"جستجو در نام دسته‌بندی...",value:N.search,onChange:e=>{u(a=>({...a,search:e.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"})]})})}),v?e.jsx(h,{}):e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[e.jsx("div",{className:"hidden md:block",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام دسته‌بندی"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"توضیحات"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:(k||[]).map(a=>e.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-100",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{className:"h-4 w-4 text-amber-500"}),a.name]})}),e.jsx("td",{className:"px-6 py-4 text-sm text-gray-900 dark:text-gray-100",children:e.jsx("div",{className:"max-w-xs truncate",children:a.description||"بدون توضیحات"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:new Date(a.created_at).toLocaleDateString("fa-IR")}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>S(a.id),className:"text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",title:"ویرایش",children:e.jsx(g,{className:"h-4 w-4"})}),e.jsx("button",{onClick:()=>j(a.id.toString()),className:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",title:"حذف",children:e.jsx(o,{className:"h-4 w-4"})})]})})]},a.id))})]})})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:(k||[]).map(a=>e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("div",{className:"flex justify-between items-start mb-3",children:e.jsxs("div",{className:"flex-1",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[e.jsx(m,{className:"h-4 w-4 text-amber-500"}),a.name]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:a.description||"بدون توضیحات"})]})}),e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:["تاریخ ایجاد: ",new Date(a.created_at).toLocaleDateString("fa-IR")]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>S(a.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",children:[e.jsx(g,{className:"h-3 w-3"}),"ویرایش"]}),e.jsxs("button",{onClick:()=>j(a.id.toString()),className:"flex items-center gap-1 px-2 py-1 text-xs text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",children:[e.jsx(o,{className:"h-3 w-3"}),"حذف"]})]})]},a.id))}),(!k||0===k.length)&&!v&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(c,{className:"mx-auto h-12 w-12 text-gray-400"}),e.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900 dark:text-gray-100",children:"دسته‌بندی‌ای موجود نیست"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"برای شروع، اولین دسته‌بندی محصولات خود را ایجاد کنید."}),e.jsx("div",{className:"mt-6",children:e.jsxs(x,{onClick:C,className:"flex items-center gap-2 mx-auto",children:[e.jsx(n,{className:"h-4 w-4"}),"ایجاد دسته‌بندی جدید"]})})]})]}),e.jsx(l,{isOpen:!!p,onClose:()=>j(null),title:"حذف دسته‌بندی",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"آیا از حذف این دسته‌بندی اطمینان دارید؟ این عمل قابل بازگشت نیست و ممکن است بر محصولاتی که در این دسته‌بندی قرار دارند تأثیر بگذارد."}),e.jsxs("div",{className:"flex justify-end space-x-2 space-x-reverse",children:[e.jsx(x,{variant:"secondary",onClick:()=>j(null),disabled:f,children:"انصراف"}),e.jsx(x,{variant:"danger",onClick:()=>{p&&w(p,{onSuccess:()=>{j(null)}})},loading:f,children:"حذف"})]})]})})]})};export{y as default}; diff --git a/dist/assets/CategoryFormPage-da5b0c87.js b/dist/assets/CategoryFormPage-da5b0c87.js new file mode 100644 index 0000000..65c8b96 --- /dev/null +++ b/dist/assets/CategoryFormPage-da5b0c87.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{u as s,f as a,r as t}from"./vendor-react-ac1483bd.js";import{h as r,L as n,P as i,F as o,d as c,B as d}from"./index-590deac5.js";import{I as l}from"./Input-dc2009a3.js";import{b as m,c as p,d as u}from"./_hooks-9d916060.js";import{z as x}from"./vendor-ui-8a3c5c7d.js";import"./vendor-toast-598db4db.js";import"./_requests-35c9d4c3.js";const j=()=>{const j=s(),{id:h}=a();r();const f=Boolean(h),[v,y]=t.useState({name:"",description:"",parent_id:null}),{data:g,isLoading:w}=m(h||"0",f),N=p(),b=u();t.useEffect(()=>{g&&f&&y({name:g.name||"",description:g.description||"",parent_id:g.parent_id||null})},[g,f]);const k=(e,s)=>{y(a=>({...a,[e]:s}))},_=()=>{j("/categories")};if(f&&w)return e.jsx("div",{className:"flex justify-center items-center h-64",children:e.jsx(n,{})});const C=e.jsxs(d,{variant:"secondary",onClick:_,className:"flex items-center gap-2",children:[e.jsx(x,{className:"h-4 w-4"}),"بازگشت"]});return e.jsxs(i,{className:"max-w-2xl mx-auto",children:[e.jsx(o,{title:f?"ویرایش دسته‌بندی":"ایجاد دسته‌بندی جدید",subtitle:f?"ویرایش اطلاعات دسته‌بندی":"اطلاعات دسته‌بندی جدید را وارد کنید",backButton:C}),e.jsx("div",{className:"card p-4 sm:p-6",children:e.jsxs("form",{onSubmit:async e=>{e.preventDefault();try{f?await b.mutateAsync({id:parseInt(h),...v}):await N.mutateAsync(v)}catch(s){}},className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{children:[e.jsx(c,{htmlFor:"name",children:"نام دسته‌بندی"}),e.jsx(l,{id:"name",type:"text",value:v.name,onChange:e=>k("name",e.target.value),placeholder:"نام دسته‌بندی را وارد کنید",required:!0})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"description",children:"توضیحات"}),e.jsx("textarea",{id:"description",value:v.description,onChange:e=>k("description",e.target.value),placeholder:"توضیحات دسته‌بندی",rows:4,className:"input resize-none"})]}),e.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:justify-end sm:space-y-0 sm:space-x-3 sm:space-x-reverse pt-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx(d,{type:"button",variant:"secondary",onClick:_,className:"w-full sm:w-auto",children:"انصراف"}),e.jsx(d,{type:"submit",loading:N.isPending||b.isPending,className:"w-full sm:w-auto",children:f?"ویرایش":"ایجاد"})]})]})})]})};export{j as default}; diff --git a/dist/assets/Dashboard-e64113c9.js b/dist/assets/Dashboard-e64113c9.js new file mode 100644 index 0000000..281ef12 --- /dev/null +++ b/dist/assets/Dashboard-e64113c9.js @@ -0,0 +1 @@ +import{j as e,_ as s}from"./vendor-query-a3e439f2.js";import{S as a,a as l,C as r,P as t,b as i,c as n,B as c}from"./index-590deac5.js";import{T as d,k as m,l as o,m as x,n as h,D as g,o as p}from"./vendor-ui-8a3c5c7d.js";import{B as j}from"./BarChart-2cf7731f.js";import{r as u}from"./vendor-react-ac1483bd.js";import{R as b,P as f,a as v,C as y,T as N,L as w}from"./vendor-charts-4c310516.js";import{T as k}from"./Table-2d8d22e8.js";import"./vendor-toast-598db4db.js";const C=({title:s,value:r,change:t,icon:i,color:n="blue"})=>{const c={blue:"bg-blue-500",green:"bg-green-500",yellow:"bg-yellow-500",red:"bg-red-500",purple:"bg-purple-500"},o=t&&t>0,x=t&&t<0;return e.jsx("div",{className:"card p-3 sm:p-4 lg:p-6 animate-fade-in",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("div",{className:`p-2 sm:p-3 rounded-lg ${c[n]||c.blue}`,children:e.jsx(i,{className:"h-5 w-5 sm:h-6 sm:w-6 text-white"})})}),e.jsx("div",{className:"mr-3 sm:mr-5 w-0 flex-1 min-w-0",children:e.jsxs("dl",{children:[e.jsx(a,{className:"truncate",children:s}),e.jsxs("dd",{className:"flex items-baseline",children:[e.jsx(l,{className:"truncate",children:"number"==typeof r?r.toLocaleString():r}),void 0!==t&&e.jsxs("div",{className:"mr-1 sm:mr-2 flex items-baseline text-xs sm:text-sm font-semibold "+(o?"text-green-600":x?"text-red-600":"text-gray-500"),children:[o&&e.jsx(d,{className:"h-3 w-3 sm:h-4 sm:w-4 flex-shrink-0 self-center ml-1"}),x&&e.jsx(m,{className:"h-3 w-3 sm:h-4 sm:w-4 flex-shrink-0 self-center ml-1"}),e.jsx("span",{className:"sr-only",children:o?"افزایش":"کاهش"}),e.jsxs("span",{className:"truncate",children:[Math.abs(t),"%"]})]})]})]})})]})})},S=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6"],z=({data:s,title:a,colors:l=S})=>{const t=s=>{const{payload:a}=s;return e.jsx("div",{className:"flex flex-wrap justify-center gap-2 mt-3",children:a.map((s,a)=>e.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm",children:[e.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:s.color}}),e.jsxs("span",{className:"text-gray-700 dark:text-gray-300 whitespace-nowrap",children:[s.value,": ",s.payload.value]})]},a))})};return e.jsxs("div",{className:"card p-3 sm:p-4 lg:p-6",children:[a&&e.jsx(r,{className:"mb-3 sm:mb-4 text-center",children:a}),e.jsx("div",{className:"w-full",children:e.jsx(b,{width:"100%",height:280,minHeight:220,children:e.jsxs(f,{children:[e.jsx(v,{data:s,cx:"50%",cy:"45%",labelLine:!1,label:!1,outerRadius:"65%",fill:"#8884d8",dataKey:"value",children:s.map((s,a)=>e.jsx(y,{fill:l[a%l.length]},`cell-${a}`))}),e.jsx(N,{contentStyle:{backgroundColor:"var(--toast-bg)",color:"var(--toast-color)",border:"none",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",fontSize:"14px"},formatter:(e,s)=>[`${e}`,s]}),e.jsx(w,{content:e.jsx(t,{}),wrapperStyle:{paddingTop:"10px"}})]})})})]})},A=u.lazy(()=>s(()=>import("./LineChart-c9934470.js"),["assets/LineChart-c9934470.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/index-590deac5.js","assets/vendor-toast-598db4db.js","assets/vendor-ui-8a3c5c7d.js","assets/index-268bb46f.css","assets/vendor-charts-4c310516.js"]).then(e=>({default:e.LineChart}))),L=[{title:"کل کاربران",value:1247,change:12,icon:h,color:"blue"},{title:"فروش ماهانه",value:"۲۴,۵۶۷,۰۰۰",change:8.5,icon:g,color:"green"},{title:"کل سفارشات",value:356,change:-2.3,icon:p,color:"yellow"},{title:"رشد فروش",value:"۲۳.۵%",change:15.2,icon:d,color:"purple"}],T=[{name:"فروردین",value:4e3},{name:"اردیبهشت",value:3e3},{name:"خرداد",value:5e3},{name:"تیر",value:4500},{name:"مرداد",value:6e3},{name:"شهریور",value:5500}],_=[{name:"دسکتاپ",value:45},{name:"موبایل",value:35},{name:"تبلت",value:20}],R=[{id:1,name:"علی احمدی",email:"ali@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۵"},{id:2,name:"فاطمه حسینی",email:"fateme@example.com",role:"مدیر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۴"},{id:3,name:"محمد رضایی",email:"mohammad@example.com",role:"کاربر",status:"غیرفعال",createdAt:"۱۴۰۲/۰۸/۱۳"},{id:4,name:"زهرا کریمی",email:"zahra@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۲"}],B=[{key:"name",label:"نام",sortable:!0},{key:"email",label:"ایمیل"},{key:"role",label:"نقش"},{key:"status",label:"وضعیت",render:s=>e.jsx("span",{className:"px-2 py-1 rounded-full text-xs font-medium "+("فعال"===s?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"),children:s})},{key:"createdAt",label:"تاریخ عضویت"},{key:"actions",label:"عملیات",render:()=>e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(c,{size:"sm",variant:"secondary",children:"ویرایش"}),e.jsx(n,{permission:22,children:e.jsx(c,{size:"sm",variant:"danger",children:"حذف"})})]})}],P=()=>e.jsxs(t,{children:[e.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:items-center sm:justify-between sm:space-y-0",children:[e.jsx(i,{children:"داشبورد"}),e.jsxs("div",{className:"flex justify-start gap-3",children:[e.jsx("button",{className:"flex items-center justify-center w-12 h-12 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 rounded-full transition-colors duration-200 text-gray-600 dark:text-gray-300",title:"گزارش‌گیری",children:e.jsx(o,{className:"h-5 w-5"})}),e.jsx(n,{permission:25,children:e.jsx("button",{className:"flex items-center justify-center w-12 h-12 bg-primary-600 hover:bg-primary-700 rounded-full transition-colors duration-200 text-white shadow-lg hover:shadow-xl",title:"اضافه کردن",children:e.jsx(x,{className:"h-5 w-5"})})})]})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4 lg:gap-6",children:L.map((s,a)=>e.jsx(C,{...s},a))}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4 sm:gap-6",children:[e.jsx("div",{className:"min-w-0",children:e.jsx(j,{data:T,title:"فروش ماهانه",color:"#3b82f6"})}),e.jsx("div",{className:"min-w-0",children:e.jsx(u.Suspense,{fallback:e.jsx("div",{className:"card p-6 animate-pulse bg-gray-100 dark:bg-gray-800 h-64"}),children:e.jsx(A,{data:T,title:"روند رشد",color:"#10b981"})})})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-4 sm:gap-6",children:[e.jsx("div",{className:"xl:col-span-2 min-w-0",children:e.jsxs("div",{className:"card p-3 sm:p-4 lg:p-6",children:[e.jsx(r,{className:"mb-3 sm:mb-4",children:"کاربران اخیر"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx(k,{columns:B,data:R})})]})}),e.jsx("div",{className:"min-w-0",children:e.jsx(z,{data:_,title:"دستگاه‌های کاربری",colors:["#3b82f6","#10b981","#f59e0b"]})})]})]});export{P as Dashboard}; diff --git a/dist/assets/Input-dc2009a3.js b/dist/assets/Input-dc2009a3.js new file mode 100644 index 0000000..f84c447 --- /dev/null +++ b/dist/assets/Input-dc2009a3.js @@ -0,0 +1 @@ +import{j as r}from"./vendor-query-a3e439f2.js";import{R as e}from"./vendor-react-ac1483bd.js";import{c as a}from"./vendor-ui-8a3c5c7d.js";import{d as s}from"./index-590deac5.js";const t=e.forwardRef(({label:e,error:t,helperText:d,inputSize:o="md",className:i,id:l,...x},n)=>{const c=a("w-full border rounded-lg transition-all duration-200 focus:outline-none focus:ring-2",{sm:"px-3 py-2 text-sm",md:"px-3 py-3 text-base",lg:"px-4 py-4 text-lg"}[o],t?"border-red-300 focus:border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:border-primary-500 focus:ring-primary-500","bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100","placeholder-gray-500 dark:placeholder-gray-400",i);return r.jsxs("div",{className:"space-y-1",children:[e&&r.jsx(s,{htmlFor:l,children:e}),r.jsx("input",{ref:n,id:l,className:c,...x}),d&&!t&&r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:d}),t&&r.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:t})]})});export{t as I}; diff --git a/dist/assets/LineChart-c9934470.js b/dist/assets/LineChart-c9934470.js new file mode 100644 index 0000000..7053afd --- /dev/null +++ b/dist/assets/LineChart-c9934470.js @@ -0,0 +1 @@ +import{j as t}from"./vendor-query-a3e439f2.js";import{C as a}from"./index-590deac5.js";import{R as r,d as e,b as s,X as o,Y as i,T as d,e as n}from"./vendor-charts-4c310516.js";import"./vendor-react-ac1483bd.js";import"./vendor-toast-598db4db.js";import"./vendor-ui-8a3c5c7d.js";const c=({data:c,title:l,color:m="#10b981"})=>t.jsxs("div",{className:"card p-3 sm:p-4 lg:p-6",children:[l&&t.jsx(a,{className:"mb-3 sm:mb-4",children:l}),t.jsx("div",{className:"w-full",children:t.jsx(r,{width:"100%",height:250,minHeight:200,children:t.jsxs(e,{data:c,margin:{top:5,right:5,left:5,bottom:5},children:[t.jsx(s,{strokeDasharray:"3 3",className:"stroke-gray-300 dark:stroke-gray-600"}),t.jsx(o,{dataKey:"name",className:"text-gray-600 dark:text-gray-400",tick:{fontSize:10},interval:0,angle:-45,textAnchor:"end",height:60}),t.jsx(i,{className:"text-gray-600 dark:text-gray-400",tick:{fontSize:10},width:40}),t.jsx(d,{contentStyle:{backgroundColor:"var(--toast-bg)",color:"var(--toast-color)",border:"none",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",fontSize:"12px"}}),t.jsx(n,{type:"monotone",dataKey:"value",stroke:m,strokeWidth:2,dot:{r:3,strokeWidth:2},activeDot:{r:5}})]})})})]});export{c as LineChart}; diff --git a/dist/assets/Login-5c346228.js b/dist/assets/Login-5c346228.js new file mode 100644 index 0000000..49bd88b --- /dev/null +++ b/dist/assets/Login-5c346228.js @@ -0,0 +1 @@ +import{u as e,j as s}from"./vendor-query-a3e439f2.js";import{u as r,r as t,e as a}from"./vendor-react-ac1483bd.js";import{c as i,a as n,u as d}from"./vendor-forms-f89aa741.js";import{o}from"./yup-bff05cf1.js";import{u as m,B as l}from"./index-590deac5.js";import{I as c}from"./Input-dc2009a3.js";import{Q as x,p as u}from"./_requests-35c9d4c3.js";import{V as p}from"./vendor-toast-598db4db.js";import{i as g,h,E as j,j as y}from"./vendor-ui-8a3c5c7d.js";const f=i({username:n().required("نام کاربری الزامی است").min(3,"نام کاربری باید حداقل ۳ کاراکتر باشد"),password:n().required("رمز عبور الزامی است").min(6,"رمز عبور باید حداقل ۶ کاراکتر باشد")});i({name:n().required("نام الزامی است").min(2,"نام باید حداقل ۲ کاراکتر باشد"),email:n().required("ایمیل الزامی است").email("فرمت ایمیل صحیح نیست"),phone:n().required("شماره تلفن الزامی است").matches(/^09\d{9}$/,"شماره تلفن صحیح نیست"),role:n().required("نقش الزامی است"),password:n().optional().min(6,"رمز عبور باید حداقل ۶ کاراکتر باشد")}),i({siteName:n().required("نام سایت الزامی است"),siteDescription:n().required("توضیحات سایت الزامی است"),adminEmail:n().required("ایمیل مدیر الزامی است").email("فرمت ایمیل صحیح نیست"),language:n().required("زبان الزامی است")});const N=()=>{var i;const{isAuthenticated:n,isLoading:N,restoreSession:b}=m(),v=r(),[k,w]=t.useState(!1),[S,q]=t.useState(""),{mutate:_,isPending:I}=e({mutationKey:[x.ADMIN_LOGIN],mutationFn:e=>u(e),onSuccess:e=>{localStorage.setItem("admin_token",e.tokens.access_token),localStorage.setItem("admin_refresh_token",e.tokens.refresh_token),localStorage.setItem("admin_user",JSON.stringify(e.admin_user)),localStorage.setItem("admin_permissions",JSON.stringify(e.permissions)),p.success("ورود موفقیت‌آمیز بود")},onError:e=>{p.error((null==e?void 0:e.message)||"خطا در ورود")}}),{register:E,handleSubmit:O,formState:{errors:A,isValid:C}}=d({resolver:o(f),mode:"onChange"});if(N)return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary-600 mx-auto"}),s.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"در حال بارگذاری..."})]})});if(n)return s.jsx(a,{to:"/",replace:!0});return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900 py-12 px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"max-w-md w-full space-y-8",children:[s.jsxs("div",{children:[s.jsx("div",{className:"mx-auto h-12 w-12 bg-primary-600 rounded-lg flex items-center justify-center",children:s.jsx(g,{className:"h-6 w-6 text-white"})}),s.jsx("h2",{className:"mt-6 text-center text-3xl font-extrabold text-gray-900 dark:text-gray-100",children:"ورود به پنل مدیریت"}),s.jsx("p",{className:"mt-2 text-center text-sm text-gray-600 dark:text-gray-400",children:"لطفا اطلاعات خود را وارد کنید"})]}),s.jsxs("form",{className:"mt-8 space-y-6",onSubmit:O(async e=>{q(""),_(e,{onSuccess:()=>{b(),v("/")},onError:()=>{q("نام کاربری یا رمز عبور اشتباه است")}})}),children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx(c,{label:"نام کاربری",type:"text",placeholder:"نام کاربری خود را وارد کنید",icon:h,error:null==(i=A.username)?void 0:i.message,...E("username")}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"رمز عبور"}),s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none",children:s.jsx(g,{className:"h-5 w-5 text-gray-400"})}),s.jsx("input",{type:k?"text":"password",placeholder:"رمز عبور خود را وارد کنید",className:"input pr-10 pl-10 "+(A.password?"border-red-500 dark:border-red-500 focus:ring-red-500":""),...E("password")}),s.jsx("button",{type:"button",className:"absolute inset-y-0 left-0 pl-3 flex items-center",onClick:()=>w(!k),children:k?s.jsx(j,{className:"h-5 w-5 text-gray-400 hover:text-gray-600"}):s.jsx(y,{className:"h-5 w-5 text-gray-400 hover:text-gray-600"})})]}),A.password&&s.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:A.password.message})]})]}),S&&s.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-600 dark:text-red-400 px-4 py-3 rounded-lg text-sm",children:S}),s.jsx(l,{type:"submit",loading:I,disabled:!C,className:"w-full",children:"ورود"})]})]})})};export{N as Login}; diff --git a/dist/assets/Modal-8110908d.js b/dist/assets/Modal-8110908d.js new file mode 100644 index 0000000..3914645 --- /dev/null +++ b/dist/assets/Modal-8110908d.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{r as s}from"./vendor-react-ac1483bd.js";import{e as r}from"./index-590deac5.js";import{X as t}from"./vendor-ui-8a3c5c7d.js";const n=({isOpen:n,onClose:o,title:a,children:i,size:d="md",showCloseButton:l=!0,actions:c})=>{if(s.useEffect(()=>{const e=e=>{"Escape"===e.key&&o()};return n&&(document.addEventListener("keydown",e),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",e),document.body.style.overflow="unset"}},[n,o]),!n)return null;return e.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto",children:e.jsxs("div",{className:"flex min-h-screen items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 transition-opacity",onClick:o}),e.jsxs("div",{className:`\n relative w-full ${{sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"}[d]} \n bg-white dark:bg-gray-800 rounded-lg shadow-xl \n transform transition-all\n `,children:[e.jsxs("div",{className:"flex items-center justify-between p-4 sm:p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsx(r,{children:a}),l&&e.jsx("button",{onClick:o,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",children:e.jsx(t,{className:"h-5 w-5"})})]}),e.jsx("div",{className:"p-4 sm:p-6",children:i}),c&&e.jsx("div",{className:"flex flex-col space-y-2 sm:flex-row sm:justify-end sm:space-y-0 sm:space-x-3 sm:space-x-reverse p-4 sm:p-6 border-t border-gray-200 dark:border-gray-700",children:c})]})]})})};export{n as M}; diff --git a/dist/assets/MultiSelectAutocomplete-a5a00ba6.js b/dist/assets/MultiSelectAutocomplete-a5a00ba6.js new file mode 100644 index 0000000..c04c91c --- /dev/null +++ b/dist/assets/MultiSelectAutocomplete-a5a00ba6.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{r}from"./vendor-react-ac1483bd.js";import{X as t,C as a}from"./vendor-ui-8a3c5c7d.js";const s=({options:s,selectedValues:n,onChange:i,placeholder:d="انتخاب کنید...",label:l,error:o,isLoading:c=!1,disabled:m=!1})=>{const[x,u]=r.useState(!1),[g,p]=r.useState(""),h=r.useRef(null),y=r.useRef(null),f=s.filter(e=>e.title.toLowerCase().includes(g.toLowerCase())||e.description&&e.description.toLowerCase().includes(g.toLowerCase())),v=s.filter(e=>n.includes(e.id));r.useEffect(()=>{const e=e=>{h.current&&!h.current.contains(e.target)&&(u(!1),p(""))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);return e.jsxs("div",{className:"relative",ref:h,children:[l&&e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:l}),e.jsx("div",{className:`\n \n w-full min-h-[42px] px-3 py-2 border rounded-md \n focus-within:outline-none focus-within:ring-1 focus-within:ring-primary-500 \n cursor-pointer\n ${o?"border-red-500":"border-gray-300 dark:border-gray-600"}\n ${m?"bg-gray-100 cursor-not-allowed":"bg-white dark:bg-gray-700"}\n dark:text-gray-100\n `,onClick:()=>{m||(u(!x),x||setTimeout(()=>{var e;return null==(e=y.current)?void 0:e.focus()},100))},children:e.jsxs("div",{className:"flex flex-wrap gap-1 items-center",children:[v.length>0?v.map(r=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-primary-100 text-primary-800 text-xs rounded-md",children:[r.title,e.jsx("button",{type:"button",onClick:e=>{var t;e.stopPropagation(),t=r.id,i(n.filter(e=>e!==t))},className:"hover:bg-primary-200 rounded-full p-0.5",disabled:m,children:e.jsx(t,{className:"h-3 w-3"})})]},r.id)):e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:d}),e.jsx("div",{className:"flex-1 min-w-[60px]",children:x&&!m&&e.jsx("input",{ref:y,type:"text",value:g,onChange:e=>p(e.target.value),className:"w-full border-none outline-none bg-transparent text-sm",placeholder:"جستجو..."})}),e.jsx(a,{className:"h-4 w-4 transition-transform "+(x?"rotate-180":"")})]})}),x&&!m&&e.jsx("div",{className:"absolute z-50 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-md shadow-lg max-h-60 overflow-auto",children:c?e.jsx("div",{className:"p-3 text-center text-gray-500 dark:text-gray-400",children:"در حال بارگذاری..."}):f.length>0?f.map(r=>e.jsx("div",{className:`\n px-3 py-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700\n ${n.includes(r.id)?"bg-primary-50 dark:bg-primary-900/80":""}\n `,onClick:()=>{return e=r.id,void(n.includes(e)?i(n.filter(r=>r!==e)):i([...n,e]));var e},children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:r.title}),r.description&&e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:r.description})]}),n.includes(r.id)&&e.jsx("div",{className:"text-primary-600 dark:text-primary-400",children:"✓"})]})},r.id)):e.jsx("div",{className:"p-3 text-center text-gray-500 dark:text-gray-400",children:"موردی یافت نشد"})}),o&&e.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400",children:o})]})};export{s as M}; diff --git a/dist/assets/Notifications-62a27ebc.js b/dist/assets/Notifications-62a27ebc.js new file mode 100644 index 0000000..c22f1e2 --- /dev/null +++ b/dist/assets/Notifications-62a27ebc.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{r as s}from"./vendor-react-ac1483bd.js";import{P as a,b as r,a as t,B as i}from"./index-590deac5.js";import{P as d}from"./Pagination-ce6b4a1c.js";import{v as l,m as n,B as c,q as x,j as m}from"./vendor-ui-8a3c5c7d.js";import"./vendor-toast-598db4db.js";const o=[{id:1,title:"سفارش جدید دریافت شد",message:"سفارش شماره ۱۰۰۱ از طرف علی احمدی ثبت شد",type:"order",priority:"high",isRead:!1,date:"۱۴۰۲/۰۸/۱۵ - ۱۴:۳۰",sender:"سیستم فروش"},{id:2,title:"محصول در حال اتمام",message:"موجودی لپ‌تاپ ایسوس به کمتر از ۵ عدد رسیده است",type:"warning",priority:"medium",isRead:!1,date:"۱۴۰۲/۰۸/۱۵ - ۱۲:۱۵",sender:"سیستم انبار"},{id:3,title:"کاربر جدید عضو شد",message:"فاطمه حسینی با موفقیت در سیستم ثبت نام کرد",type:"info",priority:"low",isRead:!0,date:"۱۴۰۲/۰۸/۱۴ - ۱۶:۴۵",sender:"سیستم کاربری"},{id:4,title:"پرداخت انجام شد",message:"پرداخت سفارش ۱۰۰۲ با موفقیت تایید شد",type:"success",priority:"medium",isRead:!0,date:"۱۴۰۲/۰۸/۱۴ - ۱۰:۲۰",sender:"سیستم پرداخت"},{id:5,title:"خطا در سیستم",message:"خطا در اتصال به درگاه پرداخت - نیاز به بررسی فوری",type:"error",priority:"high",isRead:!1,date:"۱۴۰۲/۰۸/۱۴ - ۰۹:۱۰",sender:"سیستم مانیتورینگ"},{id:6,title:"بک‌آپ تکمیل شد",message:"بک‌آپ روزانه اطلاعات با موفقیت انجام شد",type:"success",priority:"low",isRead:!0,date:"۱۴۰۲/۰۸/۱۳ - ۲۳:۰۰",sender:"سیستم بک‌آپ"},{id:7,title:"بروزرسانی سیستم",message:"نسخه جدید سیستم منتشر شد - بروزرسانی در دسترس است",type:"info",priority:"medium",isRead:!1,date:"۱۴۰۲/۰۸/۱۳ - ۱۱:۳۰",sender:"تیم توسعه"},{id:8,title:"گزارش فروش آماده شد",message:"گزارش فروش ماهانه تولید و آماده دانلود است",type:"info",priority:"low",isRead:!0,date:"۱۴۰۲/۰۸/۱۲ - ۰۸:۰۰",sender:"سیستم گزارش‌گیری"}],h=()=>{const[h,g]=s.useState(o),[j,p]=s.useState(""),[u,y]=s.useState("all"),[v,N]=s.useState(1),w=s=>{switch(s){case"error":return e.jsx(l,{className:"h-5 w-5 text-red-600"});case"warning":return e.jsx(c,{className:"h-5 w-5 text-yellow-600"});case"success":return e.jsx(c,{className:"h-5 w-5 text-green-600"});case"info":return e.jsx(m,{className:"h-5 w-5 text-blue-600"});default:return e.jsx(c,{className:"h-5 w-5 text-gray-600"})}},f=e=>{switch(e){case"high":return"border-r-red-500";case"medium":return"border-r-yellow-500";case"low":return"border-r-green-500";default:return"border-r-gray-300"}},b=h.filter(e=>{const s=e.title.toLowerCase().includes(j.toLowerCase())||e.message.toLowerCase().includes(j.toLowerCase()),a="all"===u||"unread"===u&&!e.isRead||"read"===u&&e.isRead||e.type===u;return s&&a}),k=Math.ceil(b.length/6),R=6*(v-1),C=b.slice(R,R+6),P=h.filter(e=>!e.isRead).length;return e.jsxs(a,{children:[e.jsx(r,{children:"اعلانات"}),e.jsxs(t,{children:[P," اعلان خوانده نشده از ",h.length," اعلان"]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs(i,{variant:"secondary",onClick:()=>{g(e=>e.map(e=>({...e,isRead:!0})))},disabled:0===P,children:[e.jsx(l,{className:"h-4 w-4 ml-2"}),"همه را خوانده شده علامت بزن"]}),e.jsxs(i,{children:[e.jsx(n,{className:"h-4 w-4 ml-2"}),"اعلان جدید"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6",children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(c,{className:"h-8 w-8 text-blue-600"}),e.jsxs("div",{className:"mr-3",children:[e.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"کل اعلانات"}),e.jsx(t,{children:h.length})]})]})}),e.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(l,{className:"h-8 w-8 text-red-600"}),e.jsxs("div",{className:"mr-3",children:[e.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"خوانده نشده"}),e.jsx(t,{children:P})]})]})}),e.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(l,{className:"h-8 w-8 text-red-600"}),e.jsxs("div",{className:"mr-3",children:[e.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"خطا"}),e.jsx(t,{children:h.filter(e=>"error"===e.type).length})]})]})}),e.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(c,{className:"h-8 w-8 text-yellow-600"}),e.jsxs("div",{className:"mr-3",children:[e.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"هشدار"}),e.jsx(t,{children:h.filter(e=>"warning"===e.type).length})]})]})})]}),e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none",children:e.jsx(x,{className:"h-5 w-5 text-gray-400"})}),e.jsx("input",{type:"text",placeholder:"جستجو در اعلانات...",value:j,onChange:e=>p(e.target.value),className:"input pr-10"})]}),e.jsxs("select",{value:u,onChange:e=>y(e.target.value),className:"input min-w-[150px]",children:[e.jsx("option",{value:"all",children:"همه اعلانات"}),e.jsx("option",{value:"unread",children:"خوانده نشده"}),e.jsx("option",{value:"read",children:"خوانده شده"}),e.jsx("option",{value:"error",children:"خطا"}),e.jsx("option",{value:"warning",children:"هشدار"}),e.jsx("option",{value:"success",children:"موفق"}),e.jsx("option",{value:"info",children:"اطلاعات"})]})]}),e.jsx("div",{className:"space-y-4",children:C.map(s=>e.jsx("div",{className:`p-4 border-r-4 ${f(s.priority)} ${s.isRead?"bg-gray-50 dark:bg-gray-700":"bg-white dark:bg-gray-800"} border border-gray-200 dark:border-gray-600 rounded-lg shadow-sm hover:shadow-md transition-shadow`,children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start space-x-3",children:[e.jsx("div",{className:"flex-shrink-0 mt-1",children:w(s.type)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h3",{className:"text-sm font-medium "+(s.isRead?"text-gray-600 dark:text-gray-400":"text-gray-900 dark:text-gray-100"),children:s.title}),!s.isRead&&e.jsx("div",{className:"w-2 h-2 bg-blue-600 rounded-full"})]}),e.jsx("p",{className:"mt-1 text-sm "+(s.isRead?"text-gray-500 dark:text-gray-500":"text-gray-700 dark:text-gray-300"),children:s.message}),e.jsxs("div",{className:"mt-2 flex items-center text-xs text-gray-500 dark:text-gray-500 space-x-4",children:[e.jsx("span",{children:s.date}),e.jsxs("span",{children:["از: ",s.sender]})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[!s.isRead&&e.jsx(i,{size:"sm",variant:"secondary",onClick:()=>{return e=s.id,void g(s=>s.map(s=>s.id===e?{...s,isRead:!0}:s));var e},children:e.jsx(l,{className:"h-4 w-4"})}),e.jsx(i,{size:"sm",variant:"danger",onClick:()=>{return e=s.id,void g(s=>s.filter(s=>s.id!==e));var e},children:e.jsx(l,{className:"h-4 w-4"})})]})]})},s.id))}),0===C.length&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(c,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"هیچ اعلانی یافت نشد"})]}),e.jsx(d,{currentPage:v,totalPages:k,onPageChange:N,itemsPerPage:6,totalItems:b.length})]})]})};export{h as Notifications}; diff --git a/dist/assets/Orders-03d2b26a.js b/dist/assets/Orders-03d2b26a.js new file mode 100644 index 0000000..1965e36 --- /dev/null +++ b/dist/assets/Orders-03d2b26a.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{r as s}from"./vendor-react-ac1483bd.js";import{T as t}from"./Table-2d8d22e8.js";import{P as a,b as r,a as d,B as l}from"./index-590deac5.js";import{P as i}from"./Pagination-ce6b4a1c.js";import{r as c,P as n,D as o,q as m}from"./vendor-ui-8a3c5c7d.js";import"./vendor-toast-598db4db.js";const x=[{id:1001,customer:"علی احمدی",products:"۳ محصول",amount:"۴۵,۰۰۰,۰۰۰",status:"تحویل شده",date:"۱۴۰۲/۰۸/۱۵"},{id:1002,customer:"فاطمه حسینی",products:"۱ محصول",amount:"۲۵,۰۰۰,۰۰۰",status:"در حال پردازش",date:"۱۴۰۲/۰۸/۱۴"},{id:1003,customer:"محمد رضایی",products:"۲ محصول",amount:"۳۲,۰۰۰,۰۰۰",status:"ارسال شده",date:"۱۴۰۲/۰۸/۱۳"},{id:1004,customer:"زهرا کریمی",products:"۵ محصول",amount:"۱۲۰,۰۰۰,۰۰۰",status:"تحویل شده",date:"۱۴۰۲/۰۸/۱۲"},{id:1005,customer:"حسن نوری",products:"۱ محصول",amount:"۱۸,۰۰۰,۰۰۰",status:"لغو شده",date:"۱۴۰۲/۰۸/۱۱"},{id:1006,customer:"مریم صادقی",products:"۴ محصول",amount:"۸۵,۰۰۰,۰۰۰",status:"در حال پردازش",date:"۱۴۰۲/۰۸/۱۰"},{id:1007,customer:"احمد قاسمی",products:"۲ محصول",amount:"۳۸,۰۰۰,۰۰۰",status:"ارسال شده",date:"۱۴۰۲/۰۸/۰۹"},{id:1008,customer:"سارا محمدی",products:"۳ محصول",amount:"۶۲,۰۰۰,۰۰۰",status:"تحویل شده",date:"۱۴۰۲/۰۸/۰۸"},{id:1009,customer:"رضا کریمی",products:"۱ محصول",amount:"۱۵,۰۰۰,۰۰۰",status:"در حال پردازش",date:"۱۴۰۲/۰۸/۰۷"},{id:1010,customer:"نرگس احمدی",products:"۶ محصول",amount:"۱۴۵,۰۰۰,۰۰۰",status:"تحویل شده",date:"۱۴۰۲/۰۸/۰۶"}],u=()=>{const[u,g]=s.useState(""),[h,j]=s.useState(1),p=[{key:"id",label:"شماره سفارش",sortable:!0},{key:"customer",label:"مشتری",sortable:!0},{key:"products",label:"محصولات"},{key:"amount",label:"مبلغ",render:s=>e.jsxs("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:[s," تومان"]})},{key:"status",label:"وضعیت",render:s=>e.jsx("span",{className:"px-2 py-1 rounded-full text-xs font-medium "+("تحویل شده"===s?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"ارسال شده"===s?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":"در حال پردازش"===s?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"),children:s})},{key:"date",label:"تاریخ سفارش",sortable:!0},{key:"actions",label:"عملیات",render:(s,t)=>e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(l,{size:"sm",variant:"secondary",onClick:()=>v(t),children:"مشاهده"}),e.jsx(l,{size:"sm",variant:"primary",onClick:()=>f(t),children:"ویرایش"})]})}],b=x.filter(e=>e.customer.toLowerCase().includes(u.toLowerCase())||e.id.toString().includes(u)),y=Math.ceil(b.length/6),N=6*(h-1),k=b.slice(N,N+6),v=e=>{},f=e=>{},w=x.reduce((e,s)=>e+parseInt(s.amount.replace(/[,]/g,"")),0);return e.jsxs(a,{children:[e.jsx(r,{children:"مدیریت سفارشات"}),e.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:[b.length," سفارش یافت شد"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6 mb-6",children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(c,{className:"h-8 w-8 text-blue-600"}),e.jsxs("div",{className:"mr-3",children:[e.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"کل سفارشات"}),e.jsx(d,{children:x.length})]})]})}),e.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(n,{className:"h-8 w-8 text-green-600"}),e.jsxs("div",{className:"mr-3",children:[e.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"تحویل شده"}),e.jsx(d,{children:x.filter(e=>"تحویل شده"===e.status).length})]})]})}),e.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(c,{className:"h-8 w-8 text-yellow-600"}),e.jsxs("div",{className:"mr-3",children:[e.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"در انتظار"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:x.filter(e=>"در حال پردازش"===e.status).length})]})]})}),e.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(o,{className:"h-8 w-8 text-purple-600"}),e.jsxs("div",{className:"mr-3",children:[e.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"کل فروش"}),e.jsxs("p",{className:"text-xl font-bold text-gray-900 dark:text-gray-100",children:[w.toLocaleString()," تومان"]})]})]})})]}),e.jsxs("div",{className:"card p-6",children:[e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none",children:e.jsx(m,{className:"h-5 w-5 text-gray-400"})}),e.jsx("input",{type:"text",placeholder:"جستجو در سفارشات...",value:u,onChange:e=>g(e.target.value),className:"input pr-10 max-w-md"})]})}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg overflow-hidden",children:[e.jsx(t,{columns:p,data:k,loading:!1}),e.jsx(i,{currentPage:h,totalPages:y,onPageChange:j,itemsPerPage:6,totalItems:b.length})]})]})]})};export{u as Orders}; diff --git a/dist/assets/Pagination-ce6b4a1c.js b/dist/assets/Pagination-ce6b4a1c.js new file mode 100644 index 0000000..625de15 --- /dev/null +++ b/dist/assets/Pagination-ce6b4a1c.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{B as r}from"./index-590deac5.js";import{w as a,e as s}from"./vendor-ui-8a3c5c7d.js";const t=({currentPage:t,totalPages:d,onPageChange:i,itemsPerPage:n,totalItems:l})=>{const o=(t-1)*n+1,m=Math.min(t*n,l);return d<=1?null:e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 bg-white dark:bg-gray-800 border-t border-gray-200 dark:border-gray-700 sm:px-6",children:[e.jsxs("div",{className:"flex flex-1 justify-between sm:hidden",children:[e.jsx(r,{variant:"secondary",size:"sm",onClick:()=>i(t-1),disabled:1===t,children:"قبلی"}),e.jsx(r,{variant:"secondary",size:"sm",onClick:()=>i(t+1),disabled:t===d,children:"بعدی"})]}),e.jsxs("div",{className:"hidden sm:flex sm:flex-1 sm:items-center sm:justify-between",children:[e.jsx("div",{children:e.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:["نمایش ",e.jsx("span",{className:"font-medium",children:o})," تا"," ",e.jsx("span",{className:"font-medium",children:m})," از"," ",e.jsx("span",{className:"font-medium",children:l})," نتیجه"]})}),e.jsx("div",{children:e.jsxs("nav",{className:"relative z-0 inline-flex rounded-md shadow-sm -space-x-px",children:[e.jsx("button",{onClick:()=>i(t-1),disabled:1===t,className:"relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-sm font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(a,{className:"h-5 w-5"})}),(()=>{const e=[];if(d<=5)for(let r=1;r<=d;r++)e.push(r);else{const r=Math.max(1,t-2),a=Math.min(d,r+5-1);for(let s=r;s<=a;s++)e.push(s);r>1&&(e.unshift("..."),e.unshift(1)),ae.jsx("button",{onClick:()=>"number"==typeof r&&i(r),disabled:"..."===r,className:"relative inline-flex items-center px-4 py-2 border text-sm font-medium "+(r===t?"z-10 bg-primary-50 dark:bg-primary-900 border-primary-500 text-primary-600 dark:text-primary-400":"..."===r?"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300 cursor-default":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-600"),children:r},a)),e.jsx("button",{onClick:()=>i(t+1),disabled:t===d,className:"relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-sm font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(s,{className:"h-5 w-5"})})]})})]})]})};export{t as P}; diff --git a/dist/assets/PermissionFormPage-f910c22b.js b/dist/assets/PermissionFormPage-f910c22b.js new file mode 100644 index 0000000..8b1899a --- /dev/null +++ b/dist/assets/PermissionFormPage-f910c22b.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{u as s,f as r,r as i}from"./vendor-react-ac1483bd.js";import{c as t,a,u as o}from"./vendor-forms-f89aa741.js";import{o as d}from"./yup-bff05cf1.js";import{a as n,b as l,c}from"./_hooks-69d4323f.js";import{L as m,P as p,F as u,B as j,d as x}from"./index-590deac5.js";import{I as f}from"./Input-dc2009a3.js";import{z as g}from"./vendor-ui-8a3c5c7d.js";import"./_requests-35c9d4c3.js";import"./vendor-toast-598db4db.js";const b=t({title:a().required("عنوان الزامی است").min(3,"عنوان باید حداقل 3 کاراکتر باشد"),description:a().required("توضیحات الزامی است").min(10,"توضیحات باید حداقل 10 کاراکتر باشد")}),h=()=>{var t;const a=s(),{id:h}=r(),y=!!h,{data:v,isLoading:k}=n(h||"",y),{mutate:N,isPending:E}=l(),{mutate:S,isPending:w}=c(),_=E||w,{register:q,handleSubmit:A,formState:{errors:C,isValid:I},setValue:P}=o({resolver:d(b),mode:"onChange",defaultValues:{title:"",description:""}});i.useEffect(()=>{y&&v&&(P("title",v.title),P("description",v.description))},[y,v,P]);const D=()=>{a("/permissions")};return y&&k?e.jsx("div",{className:"flex justify-center items-center h-64",children:e.jsx(m,{})}):e.jsxs(p,{children:[e.jsx(u,{title:y?"ویرایش دسترسی":"ایجاد دسترسی جدید",subtitle:y?"ویرایش اطلاعات دسترسی":"اطلاعات دسترسی جدید را وارد کنید",backButton:e.jsxs(j,{variant:"secondary",onClick:D,className:"flex items-center gap-2",children:[e.jsx(g,{className:"h-4 w-4"}),"بازگشت"]})}),e.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:e.jsxs("form",{onSubmit:A(e=>{y&&h?S({id:h,permissionData:{id:parseInt(h),title:e.title,description:e.description}},{onSuccess:()=>{a("/permissions")}}):N({title:e.title,description:e.description},{onSuccess:()=>{a("/permissions")}})}),className:"space-y-6",children:[e.jsx(f,{label:"عنوان دسترسی",...q("title"),error:null==(t=C.title)?void 0:t.message,placeholder:"مثال: CREATE_USER, DELETE_POST, MANAGE_ADMIN"}),e.jsxs("div",{children:[e.jsx(x,{htmlFor:"description",children:"توضیحات"}),e.jsx("textarea",{...q("description"),rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",placeholder:"توضیح کاملی از این دسترسی ارائه دهید..."}),C.description&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:C.description.message})]}),e.jsxs("div",{className:"flex justify-end space-x-4 space-x-reverse pt-6 border-t border-gray-200 dark:border-gray-600",children:[e.jsx(j,{type:"button",variant:"secondary",onClick:D,disabled:_,children:"انصراف"}),e.jsx(j,{type:"submit",loading:_,disabled:!I,children:y?"به‌روزرسانی":"ایجاد"})]})]})})]})};export{h as default}; diff --git a/dist/assets/PermissionsListPage-d4b2ae32.js b/dist/assets/PermissionsListPage-d4b2ae32.js new file mode 100644 index 0000000..e9740e9 --- /dev/null +++ b/dist/assets/PermissionsListPage-d4b2ae32.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{r as a}from"./vendor-react-ac1483bd.js";import{u as r}from"./_hooks-69d4323f.js";import{d as s}from"./vendor-ui-8a3c5c7d.js";import"./_requests-35c9d4c3.js";import"./vendor-toast-598db4db.js";const d=()=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[e.jsx("div",{className:"hidden md:block",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عنوان"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"توضیحات"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:[...Array(5)].map((a,r)=>e.jsxs("tr",{className:"animate-pulse",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-32"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-48"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-20"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"})]})})]},r))})]})})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:[...Array(3)].map((a,r)=>e.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 animate-pulse",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-5 bg-gray-300 dark:bg-gray-600 rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-full"}),e.jsx("div",{className:"h-3 bg-gray-300 dark:bg-gray-600 rounded w-1/3"}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"})]})]})},r))})]}),t=()=>{const[t,i]=a.useState({search:""}),{data:c,isLoading:l,error:x}=r(t);return x?e.jsx("div",{className:"p-6",children:e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-red-600 dark:text-red-400",children:"خطا در بارگذاری دسترسی‌ها"})})}):e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[e.jsx(s,{className:"h-6 w-6"}),"لیست دسترسی‌ها"]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"نمایش دسترسی‌های سیستم"})]})}),e.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"جستجو"}),e.jsx("input",{type:"text",placeholder:"جستجو در عنوان یا توضیحات...",value:t.search,onChange:e=>{i(a=>({...a,search:e.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"})]})})}),l?e.jsx(d,{}):0===(c||[]).length?e.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg",children:e.jsxs("div",{className:"text-center py-12",children:[e.jsx(s,{className:"h-12 w-12 text-gray-400 dark:text-gray-500 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-2",children:"هیچ دسترسی یافت نشد"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:t.search?"نتیجه‌ای برای جستجوی شما یافت نشد":"دسترسی‌های سیستم در اینجا نمایش داده می‌شوند"})]})}):e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[e.jsx("div",{className:"hidden md:block",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عنوان"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"توضیحات"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:(c||[]).map(a=>e.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:a.title}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:a.description}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:new Date(a.created_at).toLocaleDateString("fa-IR")})]},a.id))})]})})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:(c||[]).map(a=>e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("div",{className:"flex justify-between items-start mb-2",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:a.title}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:a.description})]})}),e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["تاریخ ایجاد: ",new Date(a.created_at).toLocaleDateString("fa-IR")]})]},a.id))})]})]})};export{t as default}; diff --git a/dist/assets/ProductDetailPage-efc71a33.js b/dist/assets/ProductDetailPage-efc71a33.js new file mode 100644 index 0000000..361247b --- /dev/null +++ b/dist/assets/ProductDetailPage-efc71a33.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{L as s,B as a}from"./index-590deac5.js";import{b as r}from"./_hooks-05707864.js";import{P as t}from"./_models-0008c1da.js";import{u as d,f as l}from"./vendor-react-ac1483bd.js";import{z as i,G as c,j as x,D as n,P as m,Q as g,N as o,I as h,t as j}from"./vendor-ui-8a3c5c7d.js";import"./vendor-toast-598db4db.js";import"./_requests-35c9d4c3.js";const y=()=>{const y=d(),{id:b=""}=l(),{data:p,isLoading:N,error:k}=r(b);return N?e.jsx(s,{}):k?e.jsx("div",{className:"text-red-600",children:"خطا در بارگذاری اطلاعات محصول"}):p?e.jsxs("div",{className:"p-6",children:[e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(a,{variant:"secondary",onClick:()=>y("/products"),className:"flex items-center gap-2",children:[e.jsx(i,{className:"h-4 w-4"}),"بازگشت"]}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"جزئیات محصول"})]}),e.jsx("div",{className:"flex gap-3",children:e.jsxs(a,{variant:"secondary",onClick:()=>y(`/products/${b}/edit`),className:"flex items-center gap-2",children:[e.jsx(c,{className:"h-4 w-4"}),"ویرایش"]})})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 mb-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-6",children:"اطلاعات محصول"}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"نام محصول"}),e.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:e.jsx("p",{className:"text-gray-900 dark:text-gray-100 font-medium",children:p.name})})]}),p.description&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"توضیحات"}),e.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:e.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:p.description})})]}),p.design_style&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"سبک طراحی"}),e.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:e.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:p.design_style})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"نوع محصول"}),e.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:e.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:t[p.type]||"نامشخص"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"وضعیت"}),e.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:e.jsx("span",{className:"inline-flex px-2 py-1 text-xs font-semibold rounded-full "+(p.enabled?"bg-green-100 text-green-800 dark:bg-green-800 dark:text-green-100":"bg-red-100 text-red-800 dark:bg-red-800 dark:text-red-100"),children:p.enabled?"فعال":"غیرفعال"})})]})]})]})]}),p.images&&p.images.length>0&&e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 mb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"تصاویر محصول"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:p.images.map((s,a)=>e.jsxs("div",{className:"relative group",children:[e.jsx("img",{src:s.url,alt:s.alt||`تصویر ${a+1}`,className:"w-full h-32 object-cover rounded-lg border border-gray-200 dark:border-gray-600"}),e.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-50 opacity-0 group-hover:opacity-100 transition-opacity rounded-lg flex items-center justify-center",children:e.jsx(x,{className:"h-6 w-6 text-white"})})]},s.id||a))})]}),p.variants&&p.variants.length>0&&e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"نسخه‌های محصول"}),e.jsx("div",{className:"space-y-4",children:p.variants.map((s,a)=>e.jsx("div",{className:"p-4 border border-gray-200 dark:border-gray-600 rounded-lg",children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"وضعیت:"}),e.jsx("span",{className:"ml-2 px-2 py-1 text-xs rounded-full "+(s.enabled?"bg-green-100 text-green-800 dark:bg-green-800 dark:text-green-100":"bg-red-100 text-red-800 dark:bg-red-800 dark:text-red-100"),children:s.enabled?"فعال":"غیرفعال"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"موجودی:"}),e.jsx("span",{className:"ml-2 font-medium text-gray-900 dark:text-gray-100",children:s.stock_number})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"وزن:"}),e.jsxs("span",{className:"ml-2 font-medium text-gray-900 dark:text-gray-100",children:[s.weight," گرم"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"درصد سود:"}),e.jsxs("span",{className:"ml-2 font-medium text-gray-900 dark:text-gray-100",children:[s.profit_percentage,"%"]})]})]})},s.id||a))})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"آمار"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تعداد فروش"})]}),e.jsx("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:p.total_sold||0})]}),p.variants&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تعداد نسخه‌ها"})]}),e.jsx("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:p.variants.length})]}),p.images&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(g,{className:"h-4 w-4 text-purple-500"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تعداد تصاویر"})]}),e.jsx("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:p.images.length})]})]})]}),p.categories&&p.categories.length>0&&e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"دسته‌بندی‌ها"}),e.jsx("div",{className:"space-y-2",children:p.categories.map(s=>e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[e.jsx(o,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"text-blue-900 dark:text-blue-100 font-medium",children:s.name})]},s.id))})]}),p.product_option&&e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"گزینه محصول"}),e.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[e.jsx("p",{className:"text-gray-900 dark:text-gray-100 font-medium",children:p.product_option.name}),p.product_option.description&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:p.product_option.description})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"اطلاعات زمانی"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(h,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تاریخ ایجاد"})]}),e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:new Date(p.created_at).toLocaleDateString("fa-IR")})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(j,{className:"h-4 w-4 text-orange-500"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"آخرین به‌روزرسانی"})]}),e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:new Date(p.updated_at).toLocaleDateString("fa-IR")})]})]})]})]})]})]}):e.jsx("div",{children:"محصول یافت نشد"})};export{y as default}; diff --git a/dist/assets/ProductFormPage-70905032.js b/dist/assets/ProductFormPage-70905032.js new file mode 100644 index 0000000..99c0fb9 --- /dev/null +++ b/dist/assets/ProductFormPage-70905032.js @@ -0,0 +1 @@ +import{u as e,j as a}from"./vendor-query-a3e439f2.js";import{r,u as t,f as s}from"./vendor-react-ac1483bd.js";import{c as d,a as i,e as l,d as n,b as c,u as o}from"./vendor-forms-f89aa741.js";import{o as m}from"./yup-bff05cf1.js";import{b as g,c as x,d as u}from"./_hooks-05707864.js";import{u as p}from"./_hooks-9d916060.js";import{u as h}from"./_hooks-8b9f7cf5.js";import{c as y}from"./vendor-toast-598db4db.js";import{h as b,A as j,b as f,d as v}from"./_requests-35c9d4c3.js";import{P as k}from"./_models-0008c1da.js";import{M as N}from"./MultiSelectAutocomplete-a5a00ba6.js";import{B as _,L as w,P as C,F as S}from"./index-590deac5.js";import{I as V}from"./Input-dc2009a3.js";import{V as F,W as D,Q as O,Y as E,Z as I,X as M,m as $,x as z,y as L,P,z as A}from"./vendor-ui-8a3c5c7d.js";const B=()=>e({mutationFn:async e=>{var a;const r=new FormData;r.append("file",e),r.append("name","uploaded-file");const t=await b(j(v.UPLOAD_FILE),r,{headers:{"Content-Type":"multipart/form-data"}});if(!(null==(a=t.data)?void 0:a.file))throw new Error("Invalid upload response");return{id:t.data.file.id.toString(),url:t.data.file.url}},onError:e=>{y.error((null==e?void 0:e.message)||"خطا در آپلود فایل")}}),R=()=>e({mutationFn:async e=>(await f(j(v.DELETE_FILE(e)))).data,onSuccess:()=>{y.success("فایل با موفقیت حذف شد")},onError:e=>{y.error((null==e?void 0:e.message)||"خطا در حذف فایل")}}),T=({onUpload:e,onRemove:t,acceptedTypes:s=["image/*","video/*"],maxFileSize:d=10485760,maxFiles:i=10,label:l="فایل‌ها",description:n="تصاویر و ویدیوها را اینجا بکشید یا کلیک کنید",error:c,disabled:o=!1,className:m=""})=>{const[g,x]=r.useState([]),[u,p]=r.useState(!1),h=r.useRef(null),y=e=>e.startsWith("image/"),b=e=>{if(0===e)return"0 Bytes";const a=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,a)).toFixed(2))+" "+["Bytes","KB","MB","GB"][a]},j=r.useCallback(async a=>{const r=(e=>{if(d&&e.size>d)return`حجم فایل نباید بیشتر از ${b(d)} باشد`;if(s.length>0&&!s.some(a=>"image/*"===a?e.type.startsWith("image/"):"video/*"===a?e.type.startsWith("video/"):e.type===a))return"نوع فایل پشتیبانی نمی‌شود";return i&&g.length>=i?`حداکثر ${i} فایل مجاز است`:null})(a);if(r){const e={id:Math.random().toString(36).substr(2,9),name:a.name,size:a.size,type:a.type,progress:0,status:"error",error:r};return void x(a=>[...a,e])}const t=Math.random().toString(36).substr(2,9),l=await(e=>new Promise(a=>{if(y(e.type)){const r=new FileReader;r.onload=e=>{var r;return a(null==(r=e.target)?void 0:r.result)},r.readAsDataURL(e)}else a("")}))(a),n={id:t,name:a.name,size:a.size,type:a.type,preview:l,progress:0,status:"uploading"};x(e=>[...e,n]);try{const r=setInterval(()=>{x(e=>e.map(e=>e.id===t&&e.progress<90?{...e,progress:e.progress+10}:e))},200),s=await e(a);clearInterval(r),x(e=>e.map(e=>e.id===t?{...e,progress:100,status:"completed",url:s.url,id:s.id}:e))}catch(c){x(e=>e.map(e=>e.id===t?{...e,status:"error",error:c.message||"خطا در آپلود فایل"}:e))}},[e,i,d,s]),f=r.useCallback(e=>{Array.from(e).forEach(e=>{j(e)})},[j]),v=r.useCallback(e=>{if(e.preventDefault(),p(!1),o)return;const a=e.dataTransfer.files;f(a)},[o,f]),k=r.useCallback(e=>{e.preventDefault(),o||p(!0)},[o]),N=r.useCallback(e=>{e.preventDefault(),p(!1)},[]);return a.jsxs("div",{className:`space-y-4 ${m}`,children:[l&&a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l}),a.jsxs("div",{className:`\n relative border-2 border-dashed rounded-lg p-6 transition-colors cursor-pointer\n ${u?"border-primary-400 bg-primary-50 dark:bg-primary-900/20":"border-gray-300 dark:border-gray-600"}\n ${o?"opacity-50 cursor-not-allowed":"hover:border-primary-400 hover:bg-gray-50 dark:hover:bg-gray-700"}\n ${c?"border-red-300 bg-red-50 dark:bg-red-900/20":""}\n `,onDrop:v,onDragOver:k,onDragLeave:N,onClick:()=>{var e;o||null==(e=h.current)||e.click()},children:[a.jsx("input",{ref:h,type:"file",multiple:!0,accept:s.join(","),className:"hidden",onChange:e=>e.target.files&&f(e.target.files),disabled:o}),a.jsxs("div",{className:"text-center",children:[a.jsx(F,{className:"mx-auto h-12 w-12 text-gray-400"}),a.jsxs("div",{className:"mt-4",children:[a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:n}),a.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-500 mt-1",children:["حداکثر ",b(d)," • ",s.join(", ")]})]})]})]}),c&&a.jsxs("p",{className:"text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[a.jsx(D,{className:"h-4 w-4"}),c]}),g.length>0&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:["فایل‌های آپلود شده (",g.length,")"]}),a.jsx("div",{className:"space-y-2",children:g.map(e=>a.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[a.jsx("div",{className:"flex-shrink-0",children:e.preview?a.jsx("img",{src:e.preview,alt:e.name,className:"w-10 h-10 object-cover rounded"}):a.jsx("div",{className:"w-10 h-10 bg-gray-200 dark:bg-gray-600 rounded flex items-center justify-center",children:y(e.type)?a.jsx(O,{className:"h-5 w-5 text-gray-500"}):a.jsx(E,{className:"h-5 w-5 text-gray-500"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e.name}),a.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:b(e.size)}),"uploading"===e.status&&a.jsxs("div",{className:"mt-1",children:[a.jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-600 rounded-full h-1.5",children:a.jsx("div",{className:"bg-primary-600 h-1.5 rounded-full transition-all duration-300",style:{width:`${e.progress}%`}})}),a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[e.progress,"%"]})]}),"error"===e.status&&e.error&&a.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1 flex items-center gap-1",children:[a.jsx(D,{className:"h-3 w-3"}),e.error]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:["completed"===e.status&&a.jsx(I,{className:"h-5 w-5 text-green-500"}),"error"===e.status&&a.jsx(D,{className:"h-5 w-5 text-red-500"}),a.jsx(_,{variant:"secondary",size:"sm",onClick:a=>{var r;null==a||a.stopPropagation(),r=e.id,x(e=>e.filter(e=>e.id!==r)),null==t||t(r)},className:"p-1 h-8 w-8",children:a.jsx(M,{className:"h-4 w-4"})})]})]},e.id))})]})]})},U=({variant:e,onSave:t,onCancel:s,isEdit:d=!1})=>{const[i,l]=r.useState(e||{enabled:!0,fee_percentage:0,profit_percentage:0,stock_limit:0,stock_managed:!0,stock_number:0,weight:0,attributes:{},meta:{},images:[]}),[n,c]=r.useState((null==e?void 0:e.images)||[]),[o,m]=r.useState((null==e?void 0:e.attributes)||{}),[g,x]=r.useState((null==e?void 0:e.meta)||{}),[u,p]=r.useState(""),[h,y]=r.useState(""),[b,j]=r.useState(""),[f,v]=r.useState(""),{mutateAsync:k}=B(),{mutate:N}=R(),w=(e,a)=>{l(r=>({...r,[e]:a}))},C=e=>{const a=n.filter(a=>a.id!==e);c(a),N(e)};return a.jsxs("div",{className:"space-y-6 bg-gray-50 dark:bg-gray-700 p-6 rounded-lg border",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h4",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:d?"ویرایش Variant":"افزودن Variant جدید"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(_,{variant:"secondary",onClick:s,children:"انصراف"}),a.jsx(_,{onClick:()=>{const e={...i,images:n,attributes:o,meta:g};t(e)},children:d?"به‌روزرسانی":"افزودن"})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"درصد کارمزد"}),a.jsx("input",{type:"number",value:i.fee_percentage,onChange:e=>w("fee_percentage",parseFloat(e.target.value)||0),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",placeholder:"0",min:"0",max:"100",step:"0.1"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"درصد سود"}),a.jsx("input",{type:"number",value:i.profit_percentage,onChange:e=>w("profit_percentage",parseFloat(e.target.value)||0),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",placeholder:"0",min:"0",max:"100",step:"0.1"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"وزن (گرم)"}),a.jsx("input",{type:"number",value:i.weight,onChange:e=>w("weight",parseFloat(e.target.value)||0),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",placeholder:"0",min:"0",step:"0.1"})]})]}),a.jsxs("div",{children:[a.jsx("h5",{className:"text-md font-medium text-gray-900 dark:text-gray-100 mb-3",children:"مدیریت موجودی"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-3 space-x-reverse",children:[a.jsx("input",{type:"checkbox",checked:i.stock_managed,onChange:e=>w("stock_managed",e.target.checked),className:"w-4 h-4 text-primary-600 bg-gray-100 border-gray-300 rounded focus:ring-primary-500"}),a.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"مدیریت موجودی فعال باشد"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"تعداد موجودی"}),a.jsx("input",{type:"number",value:i.stock_number,onChange:e=>w("stock_number",parseInt(e.target.value)||0),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",placeholder:"0",min:"0",disabled:!i.stock_managed})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"حد کمینه موجودی"}),a.jsx("input",{type:"number",value:i.stock_limit,onChange:e=>w("stock_limit",parseInt(e.target.value)||0),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",placeholder:"0",min:"0",disabled:!i.stock_managed})]})]})]}),a.jsxs("div",{children:[a.jsx("h5",{className:"text-md font-medium text-gray-900 dark:text-gray-100 mb-3",children:"تصاویر Variant"}),a.jsx(T,{onUpload:async e=>{try{const a=await k(e),r={id:a.id,url:a.url,alt:e.name,order:n.length},t=[...n,r];return c(t),a}catch(a){throw a}},onRemove:C,acceptedTypes:["image/*"],maxFileSize:5242880,maxFiles:5,label:"",description:"تصاویر مخصوص این variant را آپلود کنید"}),n.length>0&&a.jsx("div",{className:"mt-4",children:a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:n.map((e,r)=>a.jsxs("div",{className:"relative group",children:[a.jsx("img",{src:e.url,alt:e.alt||`تصویر ${r+1}`,className:"w-full h-20 object-cover rounded-lg border"}),a.jsx("button",{type:"button",onClick:()=>C(e.id),className:"absolute -top-1 -right-1 w-5 h-5 bg-red-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]},e.id))})})]}),a.jsxs("div",{children:[a.jsx("h5",{className:"text-md font-medium text-gray-900 dark:text-gray-100 mb-3",children:"ویژگی‌های Variant"}),a.jsxs("div",{className:"flex gap-3 mb-3",children:[a.jsx("input",{type:"text",value:u,onChange:e=>p(e.target.value),placeholder:"نام ویژگی (مثل: رنگ، سایز)",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"}),a.jsx("input",{type:"text",value:h,onChange:e=>y(e.target.value),placeholder:"مقدار (مثل: قرمز، بزرگ)",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"}),a.jsxs(_,{type:"button",variant:"secondary",onClick:()=>{if(u.trim()&&h.trim()){const e={...o,[u.trim()]:h.trim()};m(e),p(""),y("")}},className:"flex items-center gap-2",children:[a.jsx($,{className:"h-4 w-4"}),"افزودن"]})]}),Object.keys(o).length>0&&a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:Object.entries(o).map(([e,r])=>a.jsxs("div",{className:"flex items-center justify-between bg-white dark:bg-gray-600 px-3 py-2 rounded-md border",children:[a.jsxs("span",{className:"text-sm",children:[a.jsxs("strong",{children:[e,":"]})," ",String(r)]}),a.jsx("button",{type:"button",onClick:()=>(e=>{const a={...o};delete a[e],m(a)})(e),className:"text-red-500 hover:text-red-700",children:a.jsx(L,{className:"h-3 w-3"})})]},e))})]}),a.jsxs("div",{children:[a.jsx("h5",{className:"text-md font-medium text-gray-900 dark:text-gray-100 mb-3",children:"Meta Data"}),a.jsxs("div",{className:"flex gap-3 mb-3",children:[a.jsx("input",{type:"text",value:b,onChange:e=>j(e.target.value),placeholder:"کلید Meta",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"}),a.jsx("input",{type:"text",value:f,onChange:e=>v(e.target.value),placeholder:"مقدار Meta",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"}),a.jsxs(_,{type:"button",variant:"secondary",onClick:()=>{if(b.trim()&&f.trim()){const e={...g,[b.trim()]:f.trim()};x(e),j(""),v("")}},className:"flex items-center gap-2",children:[a.jsx($,{className:"h-4 w-4"}),"افزودن"]})]}),Object.keys(g).length>0&&a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:Object.entries(g).map(([e,r])=>a.jsxs("div",{className:"flex items-center justify-between bg-white dark:bg-gray-600 px-3 py-2 rounded-md border",children:[a.jsxs("span",{className:"text-sm",children:[a.jsxs("strong",{children:[e,":"]})," ",String(r)]}),a.jsx("button",{type:"button",onClick:()=>(e=>{const a={...g};delete a[e],x(a)})(e),className:"text-red-500 hover:text-red-700",children:a.jsx(L,{className:"h-3 w-3"})})]},e))})]}),a.jsxs("div",{className:"flex items-center space-x-3 space-x-reverse",children:[a.jsx("input",{type:"checkbox",checked:i.enabled,onChange:e=>w("enabled",e.target.checked),className:"w-4 h-4 text-primary-600 bg-gray-100 border-gray-300 rounded focus:ring-primary-500"}),a.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Variant فعال باشد"})]})]})},W=({variants:e,onChange:t,disabled:s=!1})=>{const[d,i]=r.useState(!1),[l,n]=r.useState(null),c=()=>{n(null),i(!0)};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:["Variants محصول (",e.length,")"]}),!s&&!d&&a.jsxs(_,{onClick:c,className:"flex items-center gap-2",children:[a.jsx($,{className:"h-4 w-4"}),"افزودن Variant"]})]}),d&&a.jsx(U,{variant:null!==l?e[l]:void 0,onSave:a=>{if(null!==l){const r=[...e];r[l]=a,t(r)}else t([...e,a]);i(!1),n(null)},onCancel:()=>{i(!1),n(null)},isEdit:null!==l}),e.length>0&&a.jsx("div",{className:"space-y-3",children:e.map((r,d)=>a.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[a.jsxs("h4",{className:"font-medium text-gray-900 dark:text-gray-100",children:["Variant ",d+1]}),a.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium "+(r.enabled?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:r.enabled?"فعال":"غیرفعال"})]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm text-gray-600 dark:text-gray-400",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"درصد کارمزد:"})," ",r.fee_percentage,"%"]}),a.jsxs("div",{children:[a.jsx("strong",{children:"درصد سود:"})," ",r.profit_percentage,"%"]}),a.jsxs("div",{children:[a.jsx("strong",{children:"موجودی:"})," ",r.stock_managed?`${r.stock_number} عدد`:"بدون محدودیت"]}),a.jsxs("div",{children:[a.jsx("strong",{children:"وزن:"})," ",r.weight," گرم"]})]}),r.images&&r.images.length>0&&a.jsxs("div",{className:"flex gap-2 mt-3",children:[r.images.slice(0,3).map((e,r)=>a.jsx("img",{src:e.url,alt:e.alt||`تصویر ${r+1}`,className:"w-12 h-12 object-cover rounded border"},e.id)),r.images.length>3&&a.jsxs("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-600 rounded border flex items-center justify-center text-xs",children:["+",r.images.length-3]})]}),Object.keys(r.attributes).length>0&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"ویژگی‌ها:"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:Object.entries(r.attributes).map(([e,r])=>a.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs bg-blue-100 text-blue-800",children:[e,": ",String(r)]},e))})]})]}),!s&&a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>(e=>{n(e),i(!0)})(d),className:"p-2 text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-md",title:"ویرایش",children:a.jsx(z,{className:"h-4 w-4"})}),a.jsx("button",{onClick:()=>(a=>{const r=e.filter((e,r)=>r!==a);t(r)})(d),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-md",title:"حذف",children:a.jsx(L,{className:"h-4 w-4"})})]})]})},d))}),0===e.length&&!d&&a.jsxs("div",{className:"text-center py-8 bg-gray-50 dark:bg-gray-700 rounded-lg border-2 border-dashed border-gray-300 dark:border-gray-600",children:[a.jsx(P,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),a.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:"هنوز هیچ Variant ای اضافه نشده"}),!s&&a.jsxs(_,{onClick:c,className:"flex items-center gap-2 mx-auto",children:[a.jsx($,{className:"h-4 w-4"}),"افزودن اولین Variant"]})]})]})},q=d({name:i().required("نام محصول الزامی است").min(2,"نام محصول باید حداقل 2 کاراکتر باشد"),description:i().default(""),design_style:i().default(""),enabled:l().default(!0),total_sold:n().min(0).default(0),type:n().oneOf([0,1,2,3]).default(0),category_ids:c().of(n()).default([]),product_option_id:n().optional().nullable(),attributes:d().default({}),images:c().of(d()).default([]),variants:c().default([])}),G=()=>{var e,d,i;const l=t(),{id:n}=s(),c=!!n,[y,b]=r.useState([]),[j,f]=r.useState({}),[v,F]=r.useState(""),[D,O]=r.useState(""),{data:E,isLoading:I}=g(n||"",c),{data:z,isLoading:P}=p(),{data:U,isLoading:G}=h(),{mutate:H,isPending:J}=x(),{mutate:K,isPending:Q}=u(),{mutateAsync:Y}=B(),{mutate:Z}=R(),X=J||Q,{register:ee,handleSubmit:ae,formState:{errors:re,isValid:te,isDirty:se},setValue:de,watch:ie,reset:le,control:ne}=o({resolver:m(q),mode:"onChange",defaultValues:{name:"",description:"",design_style:"",enabled:!0,total_sold:0,type:1,category_ids:[],product_option_id:void 0,attributes:{},images:[],variants:[]}}),ce=ie();r.useEffect(()=>{var e;if(c&&E){const a=(null==(e=E.variants)?void 0:e.map(e=>({id:e.id,enabled:e.enabled,fee_percentage:e.fee_percentage,profit_percentage:e.profit_percentage,stock_limit:e.stock_limit,stock_managed:e.stock_managed,stock_number:e.stock_number,weight:e.weight,attributes:e.attributes||{},meta:e.meta||{},images:e.images||[]})))||[];le({name:E.name,description:E.description||"",design_style:E.design_style||"",enabled:E.enabled,total_sold:E.total_sold||0,type:1,category_ids:E.category_ids||[],product_option_id:E.product_option_id||void 0,attributes:E.attributes||{},images:E.images||[],variants:a}),b(E.images||[]),f(E.attributes||{})}},[c,E,le]);const oe=e=>{const a=y.filter(a=>a.id!==e);b(a),de("images",a,{shouldValidate:!0,shouldDirty:!0}),Z(e)},me=()=>{l("/products")};if(c&&I)return a.jsx("div",{className:"flex justify-center items-center h-64",children:a.jsx(w,{})});const ge=(z||[]).map(e=>({id:e.id,title:e.name,description:e.description}));(U||[]).map(e=>({id:e.id,title:e.title,description:`تعداد گزینه‌ها: ${(e.options||[]).length}`}));const xe=a.jsxs(_,{variant:"secondary",onClick:me,className:"flex items-center gap-2",children:[a.jsx(A,{className:"h-4 w-4"}),"بازگشت"]});return a.jsxs(C,{className:"max-w-6xl mx-auto",children:[a.jsx(S,{title:c?"ویرایش محصول":"ایجاد محصول جدید",subtitle:c?"ویرایش اطلاعات محصول":"اطلاعات محصول جدید را وارد کنید",backButton:xe}),a.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:a.jsxs("form",{onSubmit:ae(e=>{var a,r;const t={name:e.name,description:e.description,design_style:e.design_style,enabled:e.enabled,total_sold:e.total_sold,type:1,attributes:j,category_ids:e.category_ids.length>0?e.category_ids:[],product_option_id:e.product_option_id||void 0,images:y.map(e=>parseInt(e.id))};if(c&&n){const r=(null==(a=e.variants)?void 0:a.map(e=>({id:e.id||0,enabled:e.enabled,fee_percentage:e.fee_percentage,profit_percentage:e.profit_percentage,stock_limit:e.stock_limit,stock_managed:e.stock_managed,stock_number:e.stock_number,weight:e.weight,attributes:e.attributes&&Object.keys(e.attributes).length>0?e.attributes:{},meta:e.meta&&Object.keys(e.meta).length>0?e.meta:{}})))||[];K({id:parseInt(n),...t,variants:r},{onSuccess:()=>{l("/products")}})}else{const a=(null==(r=e.variants)?void 0:r.map(e=>({enabled:e.enabled,fee_percentage:e.fee_percentage,profit_percentage:e.profit_percentage,stock_limit:e.stock_limit,stock_managed:e.stock_managed,stock_number:e.stock_number,weight:e.weight,attributes:e.attributes&&Object.keys(e.attributes).length>0?e.attributes:{},meta:e.meta&&Object.keys(e.meta).length>0?e.meta:{}})))||[];H({...t,variants:a},{onSuccess:()=>{l("/products")}})}}),className:"space-y-8",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:"اطلاعات پایه"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[a.jsx("div",{className:"md:col-span-2",children:a.jsx(V,{label:"نام محصول",...ee("name"),error:null==(e=re.name)?void 0:e.message,placeholder:"نام محصول را وارد کنید"})}),a.jsxs("div",{className:"flex items-center space-x-3 space-x-reverse",children:[a.jsx("input",{type:"checkbox",...ee("enabled"),className:"w-4 h-4 text-primary-600 bg-gray-100 border-gray-300 rounded focus:ring-primary-500 dark:focus:ring-primary-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"}),a.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"محصول فعال باشد"})]}),a.jsx(V,{label:"تعداد فروخته شده",type:"number",...ee("total_sold"),error:null==(d=re.total_sold)?void 0:d.message,placeholder:"0",min:"0"}),a.jsx(V,{label:"استایل طراحی",...ee("design_style"),error:null==(i=re.design_style)?void 0:i.message,placeholder:"مدرن، کلاسیک، مینیمال..."}),a.jsxs("div",{className:"md:col-span-2",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"توضیحات"}),a.jsx("textarea",{...ee("description"),rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",placeholder:"توضیحات کامل محصول را وارد کنید..."}),re.description&&a.jsx("p",{className:"text-red-500 text-sm mt-1",children:re.description.message})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:"دسته‌بندی و گزینه‌ها"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(N,{label:"دسته‌بندی‌ها",options:ge,selectedValues:ie("category_ids")||[],onChange:e=>de("category_ids",e,{shouldValidate:!0,shouldDirty:!0}),placeholder:"دسته‌بندی‌ها را انتخاب کنید...",isLoading:P}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"گزینه محصول"}),a.jsxs("select",{...ee("product_option_id"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",children:[a.jsx("option",{value:"",children:"بدون گزینه"}),(U||[]).map(e=>a.jsxs("option",{value:e.id,children:[e.title," (",(e.options||[]).length," گزینه)"]},e.id))]}),re.product_option_id&&a.jsx("p",{className:"text-red-500 text-sm mt-1",children:re.product_option_id.message})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:"تصاویر محصول"}),a.jsx(T,{onUpload:async e=>{try{const a=await Y(e),r={id:a.id,url:a.url,alt:e.name,order:y.length},t=[...y,r];return b(t),de("images",t,{shouldValidate:!0,shouldDirty:!0}),a}catch(a){throw a}},onRemove:oe,acceptedTypes:["image/*"],maxFileSize:5242880,maxFiles:10,label:"",description:"تصاویر محصول را اینجا بکشید یا کلیک کنید"}),y.length>0&&a.jsxs("div",{className:"mt-6",children:[a.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["تصاویر آپلود شده (",y.length,")"]}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:y.map((e,r)=>a.jsxs("div",{className:"relative group",children:[a.jsx("img",{src:e.url,alt:e.alt||`تصویر ${r+1}`,className:"w-full h-24 object-cover rounded-lg border border-gray-200 dark:border-gray-600"}),a.jsx("button",{type:"button",onClick:()=>oe(e.id),className:"absolute -top-2 -right-2 w-6 h-6 bg-red-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:a.jsx(M,{className:"h-3 w-3"})}),0===r&&a.jsx("div",{className:"absolute bottom-1 left-1 bg-primary-500 text-white text-xs px-1 py-0.5 rounded",children:"اصلی"})]},e.id))})]})]}),a.jsx("div",{children:a.jsx(W,{variants:ie("variants")||[],onChange:e=>de("variants",e,{shouldValidate:!0,shouldDirty:!0})})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:"ویژگی‌های سفارشی"}),a.jsxs("div",{className:"flex gap-3 mb-4",children:[a.jsx("input",{type:"text",value:v,onChange:e=>F(e.target.value),placeholder:"نام ویژگی (مثل: رنگ، سایز)",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"}),a.jsx("input",{type:"text",value:D,onChange:e=>O(e.target.value),placeholder:"مقدار (مثل: قرمز، بزرگ)",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"}),a.jsxs(_,{type:"button",variant:"secondary",onClick:()=>{if(v.trim()&&D.trim()){const e={...j,[v.trim()]:D.trim()};f(e),de("attributes",e,{shouldValidate:!0,shouldDirty:!0}),F(""),O("")}},className:"flex items-center gap-2",children:[a.jsx($,{className:"h-4 w-4"}),"افزودن"]})]}),Object.keys(j).length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"ویژگی‌های فعلی:"}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Object.entries(j).map(([e,r])=>a.jsxs("div",{className:"flex items-center justify-between bg-gray-50 dark:bg-gray-700 px-3 py-2 rounded-md",children:[a.jsxs("span",{className:"text-sm",children:[a.jsxs("strong",{children:[e,":"]})," ",String(r)]}),a.jsx("button",{type:"button",onClick:()=>(e=>{const a={...j};delete a[e],f(a),de("attributes",a,{shouldValidate:!0,shouldDirty:!0})})(e),className:"text-red-500 hover:text-red-700",children:a.jsx(L,{className:"h-4 w-4"})})]},e))})]})]}),ce.name&&a.jsxs("div",{className:"border border-gray-200 dark:border-gray-600 rounded-lg p-4 bg-gray-50 dark:bg-gray-700",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-3",children:"پیش‌نمایش محصول"}),a.jsxs("div",{className:"flex gap-4",children:[y.length>0&&a.jsx("img",{src:y[0].url,alt:ce.name,className:"w-20 h-20 object-cover rounded-lg border"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[a.jsx("strong",{children:"نام:"})," ",ce.name]}),a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[a.jsx("strong",{children:"نوع:"})," ",k[ce.type]]}),a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[a.jsx("strong",{children:"تعداد فروخته شده:"})," ",ce.total_sold]}),ce.design_style&&a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[a.jsx("strong",{children:"استایل:"})," ",ce.design_style]}),ce.category_ids&&ce.category_ids.length>0&&a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[a.jsx("strong",{children:"دسته‌بندی‌ها:"})," ",null==z?void 0:z.filter(e=>ce.category_ids.includes(e.id)).map(e=>e.name).join(", ")]}),ce.variants&&ce.variants.length>0&&a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[a.jsx("strong",{children:"تعداد Variants:"})," ",ce.variants.length," نوع"]}),Object.keys(j).length>0&&a.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[a.jsx("strong",{children:"ویژگی‌ها:"})," ",Object.keys(j).length," مورد"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[ce.enabled&&a.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800",children:"فعال"}),!ce.enabled&&a.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-red-100 text-red-800",children:"غیرفعال"})]})]})]})]}),a.jsxs("div",{className:"flex justify-end space-x-4 space-x-reverse pt-6 border-t border-gray-200 dark:border-gray-600",children:[a.jsx(_,{type:"button",variant:"secondary",onClick:me,disabled:X,children:"انصراف"}),a.jsx(_,{type:"submit",loading:X,disabled:!te||X,children:c?"به‌روزرسانی":"ایجاد محصول"})]})]})}),a.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[a.jsx("h3",{className:"text-sm font-medium text-blue-900 dark:text-blue-100 mb-2",children:"راهنما"}),a.jsxs("ul",{className:"text-sm text-blue-700 dark:text-blue-300 space-y-1",children:[a.jsx("li",{children:"• نام محصول باید واضح و جذاب باشد"}),a.jsx("li",{children:"• میتوانید چندین دسته‌بندی برای محصول انتخاب کنید"}),a.jsx("li",{children:"• گزینه محصول برای محصولات متغیر (با رنگ، سایز و...) استفاده میشود"}),a.jsx("li",{children:"• ویژگی‌های سفارشی برای اطلاعات اضافی محصول مفید هستند"}),a.jsx("li",{children:"• Variants برای انواع مختلف محصول استفاده میشود"}),a.jsx("li",{children:"• اولین تصویر به عنوان تصویر اصلی محصول استفاده می‌شود"})]})]})]})};export{G as default}; diff --git a/dist/assets/ProductOptionFormPage-dba7dda7.js b/dist/assets/ProductOptionFormPage-dba7dda7.js new file mode 100644 index 0000000..e45caa7 --- /dev/null +++ b/dist/assets/ProductOptionFormPage-dba7dda7.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{u as s,f as r,r as i}from"./vendor-react-ac1483bd.js";import{c as a,a as t,b as l,u as n,f as d}from"./vendor-forms-f89aa741.js";import{o}from"./yup-bff05cf1.js";import{b as c,c as m,d as p}from"./_hooks-8b9f7cf5.js";import{L as u,P as x,F as j,f as g,B as h}from"./index-590deac5.js";import{I as v}from"./Input-dc2009a3.js";import{m as b,y as f,z as y}from"./vendor-ui-8a3c5c7d.js";import"./_requests-35c9d4c3.js";import"./vendor-toast-598db4db.js";const N=a({title:t().required("عنوان نگهداری الزامی است"),description:t().required("توضیحات نگهداری الزامی است"),content:t().required("محتوای نگهداری الزامی است"),image:t().required("تصویر نگهداری الزامی است")}),q=a({title:t().required("عنوان گزینه الزامی است"),description:t().required("توضیحات گزینه الزامی است"),meta_title:t().required("متا تایتل الزامی است")}),k=a({title:t().required("عنوان الزامی است").min(2,"عنوان باید حداقل 2 کاراکتر باشد"),description:t().required("توضیحات الزامی است"),maintenance:N.required("اطلاعات نگهداری الزامی است"),options:l().of(q).min(1,"حداقل یک گزینه باید وارد شود").required("گزینه‌ها الزامی است")}),w=()=>{var a,t,l,N,q,w,V,_,C,S;const I=s(),{id:P}=r(),$=!!P,{data:B,isLoading:L}=c(P||"",$),{mutate:z,isPending:E}=m(),{mutate:F,isPending:G}=p(),A=E||G,{register:D,handleSubmit:H,formState:{errors:J,isValid:K},setValue:M,watch:O,control:Q}=n({resolver:o(k),mode:"onChange",defaultValues:{title:"",description:"",maintenance:{title:"",description:"",content:"",image:""},options:[]}}),{fields:R,append:T,remove:U}=d({control:Q,name:"options"});O(),i.useEffect(()=>{$&&B&&(M("title",B.title,{shouldValidate:!0}),M("description",B.description,{shouldValidate:!0}),M("maintenance",B.maintenance,{shouldValidate:!0}),M("options",B.options,{shouldValidate:!0}))},[$,B,M]);if(L)return e.jsx("div",{className:"flex items-center justify-center min-h-screen",children:e.jsx(u,{})});const W=e.jsxs(h,{variant:"secondary",onClick:()=>I("/product-options"),className:"flex items-center gap-2",children:[e.jsx(y,{className:"h-4 w-4"}),"برگشت"]});return e.jsxs(x,{className:"max-w-4xl mx-auto",children:[e.jsx(j,{title:$?"ویرایش گزینه محصول":"ایجاد گزینه محصول جدید",subtitle:"اطلاعات گزینه محصول را وارد کنید",backButton:W}),e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"p-4 sm:p-6 border-b border-gray-200 dark:border-gray-700",children:e.jsx(g,{children:"اطلاعات اصلی"})}),e.jsxs("form",{onSubmit:H(e=>{$&&P?F({id:parseInt(P),...e},{onSuccess:()=>{I("/product-options")}}):z(e,{onSuccess:()=>{I("/product-options")}})}),className:"p-6 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsx("div",{children:e.jsx(v,{label:"عنوان",...D("title"),error:null==(a=J.title)?void 0:a.message,placeholder:"عنوان گزینه محصول را وارد کنید"})}),e.jsx("div",{children:e.jsx(v,{label:"توضیحات",...D("description"),error:null==(t=J.description)?void 0:t.message,placeholder:"توضیحات گزینه محصول را وارد کنید"})})]}),e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx(g,{className:"mb-4",children:"اطلاعات نگهداری"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(v,{label:"عنوان نگهداری",...D("maintenance.title"),error:null==(N=null==(l=J.maintenance)?void 0:l.title)?void 0:N.message,placeholder:"عنوان نگهداری را وارد کنید"}),e.jsx(v,{label:"توضیحات نگهداری",...D("maintenance.description"),error:null==(w=null==(q=J.maintenance)?void 0:q.description)?void 0:w.message,placeholder:"توضیحات نگهداری را وارد کنید"}),e.jsx(v,{label:"محتوای نگهداری",...D("maintenance.content"),error:null==(_=null==(V=J.maintenance)?void 0:V.content)?void 0:_.message,placeholder:"محتوای نگهداری را وارد کنید"}),e.jsx(v,{label:"تصویر نگهداری",...D("maintenance.image"),error:null==(S=null==(C=J.maintenance)?void 0:C.image)?void 0:S.message,placeholder:"آدرس تصویر نگهداری را وارد کنید"})]})]}),e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx(g,{children:"گزینه‌ها"}),e.jsxs(h,{type:"button",variant:"primary",onClick:()=>{T({title:"",description:"",meta_title:""})},className:"flex items-center gap-2",children:[e.jsx(b,{className:"h-4 w-4"}),"افزودن گزینه"]})]}),R.map((s,r)=>{var i,a,t,l,n,d,o,c,m;return e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h4",{className:"text-md font-medium text-gray-900 dark:text-gray-100",children:["گزینه ",r+1]}),e.jsxs(h,{type:"button",variant:"danger",onClick:()=>U(r),className:"flex items-center gap-2",children:[e.jsx(f,{className:"h-4 w-4"}),"حذف"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(v,{label:"عنوان",...D(`options.${r}.title`),error:null==(t=null==(a=null==(i=J.options)?void 0:i[r])?void 0:a.title)?void 0:t.message,placeholder:"عنوان گزینه را وارد کنید"}),e.jsx(v,{label:"توضیحات",...D(`options.${r}.description`),error:null==(d=null==(n=null==(l=J.options)?void 0:l[r])?void 0:n.description)?void 0:d.message,placeholder:"توضیحات گزینه را وارد کنید"}),e.jsx(v,{label:"متا تایتل",...D(`options.${r}.meta_title`),error:null==(m=null==(c=null==(o=J.options)?void 0:o[r])?void 0:c.meta_title)?void 0:m.message,placeholder:"متا تایتل را وارد کنید"})]})]},s.id)}),0===R.length&&e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"هیچ گزینه‌ای تعریف نشده است. برای شروع گزینه‌ای اضافه کنید."})]}),e.jsxs("div",{className:"flex justify-end gap-4 pt-6",children:[e.jsx(h,{type:"button",variant:"secondary",onClick:()=>I("/product-options"),disabled:A,children:"لغو"}),e.jsx(h,{type:"submit",variant:"primary",disabled:!K||A,loading:A,children:$?"ویرایش گزینه محصول":"ایجاد گزینه محصول"})]})]})]})]})};export{w as default}; diff --git a/dist/assets/ProductOptionsListPage-9794930d.js b/dist/assets/ProductOptionsListPage-9794930d.js new file mode 100644 index 0000000..833b5f8 --- /dev/null +++ b/dist/assets/ProductOptionsListPage-9794930d.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{u as a,r}from"./vendor-react-ac1483bd.js";import{u as s,a as t}from"./_hooks-8b9f7cf5.js";import{B as d}from"./index-590deac5.js";import{M as i}from"./Modal-8110908d.js";import{b as x,m as l,N as c,x as n,y as m}from"./vendor-ui-8a3c5c7d.js";import"./_requests-35c9d4c3.js";import"./vendor-toast-598db4db.js";const g=()=>e.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:e.jsx("div",{className:"hidden md:block",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام گزینه"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"مقادیر"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:[...Array(5)].map((a,r)=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"h-8 w-8 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"}),e.jsx("div",{className:"h-8 w-8 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})]})})]},r))})]})})})}),o=()=>{const o=a(),[h,p]=r.useState(null),[y,j]=r.useState({search:""}),{data:N,isLoading:u,error:k}=s(y),{mutate:b,isPending:v}=t(),w=()=>{o("/product-options/create")},f=e=>{o(`/product-options/${e}/edit`)};return k?e.jsx("div",{className:"p-6",children:e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-red-600 dark:text-red-400",children:"خطا در بارگذاری گزینه‌های محصول"})})}):e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:items-center sm:justify-between sm:space-y-0",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[e.jsx(x,{className:"h-6 w-6"}),"مدیریت گزینه‌های محصول"]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"تنظیمات گزینه‌های قابل انتخاب برای محصولات"})]}),e.jsx("button",{onClick:w,className:"flex items-center justify-center w-12 h-12 bg-primary-600 hover:bg-primary-700 rounded-full transition-colors duration-200 text-white shadow-lg hover:shadow-xl",title:"گزینه محصول جدید",children:e.jsx(l,{className:"h-5 w-5"})})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"جستجو"}),e.jsx("input",{type:"text",placeholder:"جستجو در نام گزینه...",value:y.search,onChange:e=>{j(a=>({...a,search:e.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"})]})})}),u?e.jsx(g,{}):e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[e.jsx("div",{className:"hidden md:block",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام گزینه"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"مقادیر"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:(N||[]).map(a=>e.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-100",children:a.title}),e.jsx("td",{className:"px-6 py-4 text-sm text-gray-900 dark:text-gray-100",children:e.jsxs("div",{className:"flex flex-wrap gap-1 max-w-xs",children:[(a.options||[]).slice(0,3).map((a,r)=>e.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs bg-gray-100 dark:bg-gray-600 text-gray-800 dark:text-gray-200",children:[e.jsx(c,{className:"h-3 w-3 mr-1"}),a.title]},r)),(a.options||[]).length>3&&e.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs bg-primary-100 dark:bg-primary-900 text-primary-800 dark:text-primary-200",children:["+",(a.options||[]).length-3," بیشتر"]})]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:new Date(a.created_at).toLocaleDateString("fa-IR")}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>f(a.id),className:"text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",title:"ویرایش",children:e.jsx(n,{className:"h-4 w-4"})}),e.jsx("button",{onClick:()=>p(a.id.toString()),className:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",title:"حذف",children:e.jsx(m,{className:"h-4 w-4"})})]})})]},a.id))})]})})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:(N||[]).map(a=>e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("div",{className:"flex justify-between items-start mb-3",children:e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:a.title}),e.jsxs("div",{className:"flex flex-wrap gap-1 mt-2",children:[(a.options||[]).slice(0,3).map((a,r)=>e.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs bg-gray-100 dark:bg-gray-600 text-gray-800 dark:text-gray-200",children:[e.jsx(c,{className:"h-3 w-3 mr-1"}),a.title]},r)),(a.options||[]).length>3&&e.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs bg-primary-100 dark:bg-primary-900 text-primary-800 dark:text-primary-200",children:["+",(a.options||[]).length-3," بیشتر"]})]})]})}),e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:["تاریخ ایجاد: ",new Date(a.created_at).toLocaleDateString("fa-IR")]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>f(a.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",children:[e.jsx(n,{className:"h-3 w-3"}),"ویرایش"]}),e.jsxs("button",{onClick:()=>p(a.id.toString()),className:"flex items-center gap-1 px-2 py-1 text-xs text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",children:[e.jsx(m,{className:"h-3 w-3"}),"حذف"]})]})]},a.id))}),(!N||0===N.length)&&!u&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(x,{className:"mx-auto h-12 w-12 text-gray-400"}),e.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900 dark:text-gray-100",children:"گزینه‌ای موجود نیست"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"برای شروع، اولین گزینه محصول خود را ایجاد کنید."}),e.jsx("div",{className:"mt-6",children:e.jsxs(d,{onClick:w,className:"flex items-center gap-2 mx-auto",children:[e.jsx(l,{className:"h-4 w-4"}),"ایجاد گزینه جدید"]})})]})]}),e.jsx(i,{isOpen:!!h,onClose:()=>p(null),title:"حذف گزینه محصول",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"آیا از حذف این گزینه محصول اطمینان دارید؟ این عمل قابل بازگشت نیست و ممکن است بر محصولاتی که از این گزینه استفاده می‌کنند تأثیر بگذارد."}),e.jsxs("div",{className:"flex justify-end space-x-2 space-x-reverse",children:[e.jsx(d,{variant:"secondary",onClick:()=>p(null),disabled:v,children:"انصراف"}),e.jsx(d,{variant:"danger",onClick:()=>{h&&b(h,{onSuccess:()=>{p(null)}})},loading:v,children:"حذف"})]})]})})]})};export{o as default}; diff --git a/dist/assets/ProductsListPage-1040bc50.js b/dist/assets/ProductsListPage-1040bc50.js new file mode 100644 index 0000000..3707f99 --- /dev/null +++ b/dist/assets/ProductsListPage-1040bc50.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{u as a,r}from"./vendor-react-ac1483bd.js";import{u as s,a as t}from"./_hooks-05707864.js";import{u as d}from"./_hooks-9d916060.js";import{B as i}from"./index-590deac5.js";import{M as l}from"./Modal-8110908d.js";import{P as c,m as x,Q as n,j as m,x as g,y as o}from"./vendor-ui-8a3c5c7d.js";import"./_requests-35c9d4c3.js";import"./vendor-toast-598db4db.js";const h=()=>e.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:e.jsx("div",{className:"hidden md:block",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"محصول"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"قیمت"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"دسته‌بندی"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"وضعیت"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:[...Array(5)].map((a,r)=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"h-8 w-8 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"}),e.jsx("div",{className:"h-8 w-8 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})]})})]},r))})]})})})}),p=()=>{const p=a(),[y,u]=r.useState(null),[j,b]=r.useState({search:"",category_id:"",status:"",min_price:"",max_price:""}),{data:k,isLoading:N,error:v}=s({...j,category_id:j.category_id?Number(j.category_id):void 0,min_price:j.min_price?Number(j.min_price):void 0,max_price:j.max_price?Number(j.max_price):void 0}),{data:f}=d(),{mutate:w,isPending:_}=t(),C=(null==k?void 0:k.products)||[],S=()=>{p("/products/create")},I=e=>{p(`/products/${e}/edit`)},q=e=>{p(`/products/${e}`)},A=e=>new Intl.NumberFormat("fa-IR").format(e)+" تومان",M=a=>{switch(a){case"active":return e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:"فعال"});case"inactive":return e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",children:"غیرفعال"});case"draft":return e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200",children:"پیش‌نویس"});default:return e.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200",children:a})}};return v?e.jsx("div",{className:"p-6",children:e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-red-600 dark:text-red-400",children:"خطا در بارگذاری محصولات"})})}):e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:items-center sm:justify-between sm:space-y-0",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[e.jsx(c,{className:"h-6 w-6"}),"مدیریت محصولات"]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"مدیریت محصولات، قیمت‌ها و موجودی"})]}),e.jsx("button",{onClick:S,className:"flex items-center justify-center w-12 h-12 bg-primary-600 hover:bg-primary-700 rounded-full transition-colors duration-200 text-white shadow-lg hover:shadow-xl",title:"محصول جدید",children:e.jsx(x,{className:"h-5 w-5"})})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"جستجو"}),e.jsx("input",{type:"text",placeholder:"جستجو در نام محصول...",value:j.search,onChange:e=>{b(a=>({...a,search:e.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"دسته‌بندی"}),e.jsxs("select",{value:j.category_id,onChange:e=>{b(a=>({...a,category_id:e.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",children:[e.jsx("option",{value:"",children:"همه دسته‌بندی‌ها"}),(f||[]).map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"وضعیت"}),e.jsxs("select",{value:j.status,onChange:e=>{b(a=>({...a,status:e.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",children:[e.jsx("option",{value:"",children:"همه وضعیت‌ها"}),e.jsx("option",{value:"active",children:"فعال"}),e.jsx("option",{value:"inactive",children:"غیرفعال"}),e.jsx("option",{value:"draft",children:"پیش‌نویس"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"محدوده قیمت"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"number",placeholder:"حداقل",value:j.min_price,onChange:e=>b(a=>({...a,min_price:e.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"}),e.jsx("input",{type:"number",placeholder:"حداکثر",value:j.max_price,onChange:e=>b(a=>({...a,max_price:e.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"})]})]})]})}),N?e.jsx(h,{}):e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[e.jsx("div",{className:"hidden md:block",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"محصول"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"قیمت"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"دسته‌بندی"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"وضعیت"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:C.map(a=>{var r;return e.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-shrink-0",children:a.images&&a.images.length>0?e.jsx("img",{src:a.images[0].url,alt:a.name,className:"w-10 h-10 object-cover rounded"}):e.jsx("div",{className:"w-10 h-10 bg-gray-200 dark:bg-gray-600 rounded flex items-center justify-center",children:e.jsx(n,{className:"h-5 w-5 text-gray-500"})})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:a.name}),a.sku&&e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["SKU: ",a.sku]})]})]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:A(a.price||0)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:(null==(r=a.category)?void 0:r.name)||"بدون دسته‌بندی"}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:M(a.status||"")}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>q(a.id),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",title:"مشاهده",children:e.jsx(m,{className:"h-4 w-4"})}),e.jsx("button",{onClick:()=>I(a.id),className:"text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",title:"ویرایش",children:e.jsx(g,{className:"h-4 w-4"})}),e.jsx("button",{onClick:()=>u(a.id.toString()),className:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",title:"حذف",children:e.jsx(o,{className:"h-4 w-4"})})]})})]},a.id)})})]})})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:C.map(a=>e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex gap-3 mb-3",children:[e.jsx("div",{className:"flex-shrink-0",children:a.images&&a.images.length>0?e.jsx("img",{src:a.images[0].url,alt:a.name,className:"w-12 h-12 object-cover rounded"}):e.jsx("div",{className:"w-12 h-12 bg-gray-200 dark:bg-gray-600 rounded flex items-center justify-center",children:e.jsx(n,{className:"h-6 w-6 text-gray-500"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:a.name}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:A(a.price||0)}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[M(a.status||""),a.category&&e.jsx("span",{className:"text-xs text-gray-500",children:a.category.name})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>q(a.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",children:[e.jsx(m,{className:"h-3 w-3"}),"مشاهده"]}),e.jsxs("button",{onClick:()=>I(a.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",children:[e.jsx(g,{className:"h-3 w-3"}),"ویرایش"]}),e.jsxs("button",{onClick:()=>u(a.id.toString()),className:"flex items-center gap-1 px-2 py-1 text-xs text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",children:[e.jsx(o,{className:"h-3 w-3"}),"حذف"]})]})]},a.id))}),(!C||0===C.length)&&!N&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(c,{className:"mx-auto h-12 w-12 text-gray-400"}),e.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900 dark:text-gray-100",children:"محصولی موجود نیست"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"برای شروع، اولین محصول خود را ایجاد کنید."}),e.jsx("div",{className:"mt-6",children:e.jsxs(i,{onClick:S,className:"flex items-center gap-2 mx-auto",children:[e.jsx(x,{className:"h-4 w-4"}),"ایجاد محصول جدید"]})})]})]}),e.jsx(l,{isOpen:!!y,onClose:()=>u(null),title:"حذف محصول",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"آیا از حذف این محصول اطمینان دارید؟ این عمل قابل بازگشت نیست و تمام اطلاعات مربوط به محصول از جمله نسخه‌ها و تصاویر حذف خواهد شد."}),e.jsxs("div",{className:"flex justify-end space-x-2 space-x-reverse",children:[e.jsx(i,{variant:"secondary",onClick:()=>u(null),disabled:_,children:"انصراف"}),e.jsx(i,{variant:"danger",onClick:()=>{y&&w(y,{onSuccess:()=>{u(null)}})},loading:_,children:"حذف"})]})]})})]})};export{p as default}; diff --git a/dist/assets/Reports-66b51ed4.js b/dist/assets/Reports-66b51ed4.js new file mode 100644 index 0000000..9d8cadc --- /dev/null +++ b/dist/assets/Reports-66b51ed4.js @@ -0,0 +1 @@ +import{_ as e,j as a}from"./vendor-query-a3e439f2.js";import{r as s}from"./vendor-react-ac1483bd.js";import{B as r}from"./index-590deac5.js";import{B as t}from"./BarChart-2cf7731f.js";import{t as l,D as d,n as x,o as i,T as n,u as c}from"./vendor-ui-8a3c5c7d.js";import"./vendor-toast-598db4db.js";import"./vendor-charts-4c310516.js";const m=s.lazy(()=>e(()=>import("./LineChart-c9934470.js"),["assets/LineChart-c9934470.js","assets/vendor-query-a3e439f2.js","assets/vendor-react-ac1483bd.js","assets/index-590deac5.js","assets/vendor-toast-598db4db.js","assets/vendor-ui-8a3c5c7d.js","assets/index-268bb46f.css","assets/vendor-charts-4c310516.js"]).then(e=>({default:e.LineChart}))),g=()=>{const[e,g]=s.useState("month");return a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"گزارش‌ها و آمار"}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"مشاهده و دانلود گزارش‌های مختلف سیستم"})]}),a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs("select",{value:e,onChange:e=>g(e.target.value),className:"input max-w-xs",children:[a.jsx("option",{value:"week",children:"هفته گذشته"}),a.jsx("option",{value:"month",children:"ماه گذشته"}),a.jsx("option",{value:"quarter",children:"سه ماه گذشته"}),a.jsx("option",{value:"year",children:"سال گذشته"})]}),a.jsxs(r,{onClick:()=>{},children:[a.jsx(l,{className:"h-4 w-4 ml-2"}),"تولید گزارش جدید"]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6",children:[a.jsx("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"p-3 rounded-full bg-blue-100 dark:bg-blue-900",children:a.jsx(d,{className:"h-6 w-6 text-blue-600 dark:text-blue-400"})}),a.jsxs("div",{className:"mr-4",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"کل فروش"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"۱۱۱ میلیون"}),a.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"+۱۲% از ماه قبل"})]})]})}),a.jsx("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"p-3 rounded-full bg-green-100 dark:bg-green-900",children:a.jsx(x,{className:"h-6 w-6 text-green-600 dark:text-green-400"})}),a.jsxs("div",{className:"mr-4",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"کاربران جدید"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"۳۲۰"}),a.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"+۸% از ماه قبل"})]})]})}),a.jsx("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"p-3 rounded-full bg-purple-100 dark:bg-purple-900",children:a.jsx(i,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),a.jsxs("div",{className:"mr-4",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"کل سفارشات"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"۱,۲۵۴"}),a.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"+۱۵% از ماه قبل"})]})]})}),a.jsx("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"p-3 rounded-full bg-yellow-100 dark:bg-yellow-900",children:a.jsx(n,{className:"h-6 w-6 text-yellow-600 dark:text-yellow-400"})}),a.jsxs("div",{className:"mr-4",children:[a.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"نرخ رشد"}),a.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"+۲۳%"}),a.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"بهبود یافته"})]})]})})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"روند فروش"}),a.jsx(t,{data:[{name:"فروردین",value:12e6},{name:"اردیبهشت",value:19e6},{name:"خرداد",value:15e6},{name:"تیر",value:22e6},{name:"مرداد",value:18e6},{name:"شهریور",value:25e6}]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"رشد کاربران"}),a.jsx(s.Suspense,{fallback:a.jsx("div",{className:"card p-6 animate-pulse bg-gray-100 dark:bg-gray-800 h-64"}),children:a.jsx(m,{data:[{name:"فروردین",value:150},{name:"اردیبهشت",value:230},{name:"خرداد",value:180},{name:"تیر",value:280},{name:"مرداد",value:200},{name:"شهریور",value:320}]})})]})]}),a.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow",children:[a.jsx("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:a.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:"گزارش‌های اخیر"})}),a.jsx("div",{className:"p-6",children:a.jsx("div",{className:"space-y-4",children:[{id:1,title:"گزارش فروش ماهانه",description:"گزارش کامل فروش محصولات در ماه گذشته",type:"فروش",date:"۱۴۰۲/۰۸/۳۰",format:"PDF"},{id:2,title:"گزارش کاربران جدید",description:"آمار کاربران جدید عضو شده در سیستم",type:"کاربران",date:"۱۴۰۲/۰۸/۲۹",format:"Excel"},{id:3,title:"گزارش موجودی انبار",description:"وضعیت موجودی محصولات در انبار",type:"انبار",date:"۱۴۰۲/۰۸/۲۸",format:"PDF"},{id:4,title:"گزارش درآمد روزانه",description:"جزئیات درآمد حاصل از فروش در ۳۰ روز گذشته",type:"مالی",date:"۱۴۰۲/۰۸/۲۷",format:"Excel"}].map(e=>a.jsxs("div",{className:"flex items-center justify-between p-4 border border-gray-200 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-900 rounded-lg ml-4",children:a.jsx(l,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-gray-900 dark:text-gray-100",children:e.title}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:e.description}),a.jsxs("div",{className:"flex items-center mt-1 space-x-4",children:[a.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-500",children:["نوع: ",e.type]}),a.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-500",children:["تاریخ: ",e.date]}),a.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-500",children:["فرمت: ",e.format]})]})]})]}),a.jsxs(r,{size:"sm",variant:"secondary",onClick:()=>{e.id},children:[a.jsx(c,{className:"h-4 w-4 ml-2"}),"دانلود"]})]},e.id))})})]})]})};export{g as Reports}; diff --git a/dist/assets/RoleDetailPage-00a65d21.js b/dist/assets/RoleDetailPage-00a65d21.js new file mode 100644 index 0000000..5c82d6e --- /dev/null +++ b/dist/assets/RoleDetailPage-00a65d21.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{L as s,B as a}from"./index-590deac5.js";import{b as r}from"./_hooks-653fd77f.js";import{u as t,f as d}from"./vendor-react-ac1483bd.js";import{z as l,n as i,G as c,I as m,t as x}from"./vendor-ui-8a3c5c7d.js";import"./vendor-toast-598db4db.js";import"./_requests-35c9d4c3.js";const n=()=>{var n;const g=t(),{id:o=""}=d(),{data:h,isLoading:j,error:N}=r(o);return j?e.jsx(s,{}):N?e.jsx("div",{className:"text-red-600",children:"خطا در بارگذاری اطلاعات نقش"}):h?e.jsxs("div",{className:"p-6",children:[e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(a,{variant:"secondary",onClick:()=>g("/roles"),className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-4 w-4"}),"بازگشت"]}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"جزئیات نقش"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(a,{variant:"primary",onClick:()=>g(`/roles/${o}/permissions`),className:"flex items-center gap-2",children:[e.jsx(i,{className:"h-4 w-4"}),"مدیریت دسترسی‌ها"]}),e.jsxs(a,{variant:"secondary",onClick:()=>g(`/roles/${o}/edit`),className:"flex items-center gap-2",children:[e.jsx(c,{className:"h-4 w-4"}),"ویرایش"]})]})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-2",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-6",children:"اطلاعات نقش"}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"نام نقش"}),e.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:e.jsx("p",{className:"text-gray-900 dark:text-gray-100 font-medium",children:h.title})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"توضیحات"}),e.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:e.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:h.description})})]})]})]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"آمار"}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(i,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تعداد دسترسی‌ها"})]}),e.jsx("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:(null==(n=h.permissions)?void 0:n.length)||0})]})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"اطلاعات زمانی"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(m,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تاریخ ایجاد"})]}),e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:new Date(h.created_at).toLocaleDateString("fa-IR")})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(x,{className:"h-4 w-4 text-orange-500"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"آخرین به‌روزرسانی"})]}),e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:new Date(h.updated_at).toLocaleDateString("fa-IR")})]})]})]})]})]}),h.permissions&&h.permissions.length>0&&e.jsx("div",{className:"mt-6",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"دسترسی‌های تخصیص یافته"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:h.permissions.map(s=>e.jsxs("div",{className:"p-3 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[e.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:s.title}),e.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:s.description})]},s.id))})]})})]}):e.jsx("div",{children:"نقش یافت نشد"})};export{n as default}; diff --git a/dist/assets/RoleFormPage-57d635b2.js b/dist/assets/RoleFormPage-57d635b2.js new file mode 100644 index 0000000..9e52b32 --- /dev/null +++ b/dist/assets/RoleFormPage-57d635b2.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{u as r,f as s,r as i}from"./vendor-react-ac1483bd.js";import{c as a,a as t,u as o}from"./vendor-forms-f89aa741.js";import{o as d}from"./yup-bff05cf1.js";import{b as n,c,d as l}from"./_hooks-653fd77f.js";import{L as m,P as p,F as u,B as x,d as j}from"./index-590deac5.js";import{I as f}from"./Input-dc2009a3.js";import{z as g}from"./vendor-ui-8a3c5c7d.js";import"./_requests-35c9d4c3.js";import"./vendor-toast-598db4db.js";const h=a({title:t().required("نام نقش الزامی است").min(2,"نام نقش باید حداقل ۲ کاراکتر باشد"),description:t().required("توضیحات الزامی است").min(5,"توضیحات باید حداقل ۵ کاراکتر باشد")}),y=()=>{var a;const t=r(),{id:y}=s(),b=!!y,{data:v,isLoading:N}=n(y||""),{mutate:k,isPending:w}=c(),{mutate:S,isPending:q}=l(),{register:C,handleSubmit:I,formState:{errors:P,isValid:z},reset:F}=o({resolver:d(h),mode:"onChange"});i.useEffect(()=>{b&&v&&F({title:v.title,description:v.description})},[b,v,F]);if(b&&N)return e.jsx(m,{});const L=w||q;return e.jsxs(p,{children:[e.jsx(u,{title:b?"ویرایش نقش":"ایجاد نقش جدید",actions:e.jsxs(x,{variant:"secondary",onClick:()=>t("/roles"),className:"flex items-center gap-2",children:[e.jsx(g,{className:"h-4 w-4"}),"بازگشت"]})}),e.jsx("div",{className:"max-w-2xl",children:e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:e.jsxs("form",{onSubmit:I(e=>{b&&y?S({id:parseInt(y),...e},{onSuccess:()=>{t("/roles")}}):k(e,{onSuccess:()=>{t("/roles")}})}),className:"space-y-6",children:[e.jsx(f,{label:"نام نقش",type:"text",placeholder:"نام نقش را وارد کنید",error:null==(a=P.title)?void 0:a.message,...C("title")}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(j,{htmlFor:"description",children:"توضیحات"}),e.jsx("textarea",{id:"description",placeholder:"توضیحات نقش را وارد کنید",className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 resize-none h-24 ${P.description?"border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600"} dark:bg-gray-700 dark:text-gray-100`,...C("description")}),P.description&&e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:P.description.message})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(x,{type:"button",variant:"secondary",onClick:()=>t("/roles"),children:"انصراف"}),e.jsx(x,{type:"submit",variant:"primary",loading:L,disabled:!z,children:b?"به‌روزرسانی":"ایجاد"})]})]})})})]})};export{y as default}; diff --git a/dist/assets/RolePermissionsPage-7d18a97b.js b/dist/assets/RolePermissionsPage-7d18a97b.js new file mode 100644 index 0000000..71db99c --- /dev/null +++ b/dist/assets/RolePermissionsPage-7d18a97b.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{u as s,f as r,r as a}from"./vendor-react-ac1483bd.js";import{b as d,e as i,f as t,g as l,h as n}from"./_hooks-653fd77f.js";import{L as c,B as x}from"./index-590deac5.js";import{M as m}from"./Modal-8110908d.js";import{z as o,y as g,m as j}from"./vendor-ui-8a3c5c7d.js";import"./_requests-35c9d4c3.js";import"./vendor-toast-598db4db.js";const h=()=>{const h=s(),{id:p=""}=r();a.useState(!1);const[y,v]=a.useState(null),{data:N,isLoading:f}=d(p),{data:u,isLoading:b}=i(p),{data:k,isLoading:w}=t(),C=(u||[]).map(e=>e.id),S=(Array.isArray(null==k?void 0:k.permissions)?k.permissions:[]).filter(e=>!C.includes(e.id)),{mutate:I,isPending:L}=l(),{mutate:z,isPending:A}=n();return f||b?e.jsx(c,{}):N?e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(x,{variant:"secondary",onClick:()=>h("/roles"),className:"flex items-center gap-2",children:[e.jsx(o,{className:"h-4 w-4"}),"بازگشت"]}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:["مدیریت دسترسی‌های نقش: ",null==N?void 0:N.title]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"تخصیص و حذف دسترسی‌ها برای این نقش"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md",children:[e.jsx("div",{className:"p-6 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:["دسترسی‌های تخصیص یافته (",(u||[]).length,")"]})}),e.jsx("div",{className:"p-6",children:b?e.jsx("div",{className:"flex justify-center",children:e.jsx(c,{})}):e.jsx("div",{className:"space-y-3",children:(u||[]).length>0?(u||[]).map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-green-900 dark:text-green-100",children:s.title}),e.jsx("p",{className:"text-sm text-green-700 dark:text-green-300",children:s.description})]}),e.jsxs(x,{size:"sm",variant:"danger",onClick:()=>{return e=s.id,void v(e.toString());var e},className:"flex items-center gap-1 ml-3",children:[e.jsx(g,{className:"h-3 w-3"}),"حذف"]})]},s.id)):e.jsx("p",{className:"text-center text-gray-500 dark:text-gray-400 py-8",children:"هیچ دسترسی تخصیص داده نشده است"})})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md",children:[e.jsx("div",{className:"p-6 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:["دسترسی‌های قابل تخصیص (",S.length,")"]})}),e.jsx("div",{className:"p-6",children:w?e.jsx("div",{className:"flex justify-center",children:e.jsx(c,{})}):e.jsx("div",{className:"space-y-3",children:S.length>0?S.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-gray-100",children:s.title}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:s.description})]}),e.jsxs(x,{size:"sm",variant:"primary",onClick:()=>{return e=s.id,void I({roleId:p,permissionId:e.toString()});var e},className:"flex items-center gap-1 ml-3",loading:L,children:[e.jsx(j,{className:"h-3 w-3"}),"اختصاص"]})]},s.id)):e.jsx("p",{className:"text-center text-gray-500 dark:text-gray-400 py-8",children:"تمام دسترسی‌ها به این نقش تخصیص داده شده است"})})})]})]}),e.jsx(m,{isOpen:!!y,onClose:()=>v(null),title:"حذف دسترسی",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"آیا از حذف این دسترسی از نقش اطمینان دارید؟"}),e.jsxs("div",{className:"flex justify-end space-x-2 space-x-reverse",children:[e.jsx(x,{variant:"secondary",onClick:()=>v(null),disabled:A,children:"انصراف"}),e.jsx(x,{variant:"danger",onClick:()=>{y&&z({roleId:p,permissionId:y},{onSuccess:()=>{v(null)}})},loading:A,children:"حذف"})]})]})})]})}):e.jsx("div",{className:"text-red-600",children:"نقش یافت نشد"})};export{h as default}; diff --git a/dist/assets/RolesListPage-ead5d22a.js b/dist/assets/RolesListPage-ead5d22a.js new file mode 100644 index 0000000..e145991 --- /dev/null +++ b/dist/assets/RolesListPage-ead5d22a.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{u as a,r}from"./vendor-react-ac1483bd.js";import{u as s,a as t}from"./_hooks-653fd77f.js";import{P as d,b as i,B as l}from"./index-590deac5.js";import{M as x}from"./Modal-8110908d.js";import{U as c,m as n,j as g,x as o,b as m,y as h}from"./vendor-ui-8a3c5c7d.js";import"./_requests-35c9d4c3.js";import"./vendor-toast-598db4db.js";const y=()=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[e.jsx("div",{className:"hidden md:block",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام نقش"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"توضیحات"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:[...Array(5)].map((a,r)=>e.jsxs("tr",{className:"animate-pulse",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-32"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-48"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-20"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"})]})})]},r))})]})})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:[...Array(3)].map((a,r)=>e.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 animate-pulse",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-5 bg-gray-300 dark:bg-gray-600 rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-full"}),e.jsx("div",{className:"h-3 bg-gray-300 dark:bg-gray-600 rounded w-1/3"}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),e.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"})]})]})},r))})]}),p=()=>{const p=a(),[j,b]=r.useState(null),[k,N]=r.useState({search:""}),{data:u,isLoading:v,error:w}=s(k),{mutate:f,isPending:C}=t(),S=()=>{p("/roles/create")},D=e=>{p(`/roles/${e}`)},_=e=>{p(`/roles/${e}/edit`)},A=e=>{p(`/roles/${e}/permissions`)},L=()=>{b(null)};return w?e.jsx("div",{className:"p-6",children:e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-red-600 dark:text-red-400",children:"خطا در بارگذاری نقش‌ها"})})}):e.jsxs(d,{children:[e.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:items-center sm:justify-between sm:space-y-0",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(c,{className:"h-6 w-6"}),e.jsx(i,{children:"مدیریت نقش‌ها"})]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"مدیریت نقش‌ها و دسترسی‌های سیستم"})]}),e.jsx("button",{onClick:S,className:"flex items-center justify-center w-12 h-12 bg-primary-600 hover:bg-primary-700 rounded-full transition-colors duration-200 text-white shadow-lg hover:shadow-xl",title:"نقش جدید",children:e.jsx(n,{className:"h-5 w-5"})})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"جستجو"}),e.jsx("input",{type:"text",placeholder:"جستجو در نام یا توضیحات نقش...",value:k.search,onChange:e=>{N(a=>({...a,search:e.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"})]})})}),v?e.jsx(y,{}):0===(u||[]).length?e.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg",children:e.jsxs("div",{className:"text-center py-12",children:[e.jsx(c,{className:"h-12 w-12 text-gray-400 dark:text-gray-500 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-2",children:"هیچ نقش یافت نشد"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:k.search?"نتیجه‌ای برای جستجوی شما یافت نشد":"شما هنوز هیچ نقش ایجاد نکرده‌اید"}),e.jsxs(l,{onClick:S,className:"flex items-center gap-2",children:[e.jsx(n,{className:"h-4 w-4 ml-2"}),"اولین نقش را ایجاد کنید"]})]})}):e.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[e.jsx("div",{className:"hidden md:block",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام نقش"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"توضیحات"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:(u||[]).map(a=>e.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:a.title}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:a.description}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:new Date(a.created_at).toLocaleDateString("fa-IR")}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>D(a.id),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",title:"مشاهده",children:e.jsx(g,{className:"h-4 w-4"})}),e.jsx("button",{onClick:()=>_(a.id),className:"text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",title:"ویرایش",children:e.jsx(o,{className:"h-4 w-4"})}),e.jsx("button",{onClick:()=>A(a.id),className:"text-green-600 hover:text-green-900 dark:text-green-400 dark:hover:text-green-300",title:"مدیریت دسترسی‌ها",children:e.jsx(m,{className:"h-4 w-4"})}),e.jsx("button",{onClick:()=>b(a.id.toString()),className:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",title:"حذف",children:e.jsx(h,{className:"h-4 w-4"})})]})})]},a.id))})]})})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:(u||[]).map(a=>e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("div",{className:"flex justify-between items-start mb-2",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:a.title}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:a.description})]})}),e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:["تاریخ ایجاد: ",new Date(a.created_at).toLocaleDateString("fa-IR")]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>D(a.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",children:[e.jsx(g,{className:"h-3 w-3"}),"مشاهده"]}),e.jsxs("button",{onClick:()=>_(a.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",children:[e.jsx(o,{className:"h-3 w-3"}),"ویرایش"]}),e.jsxs("button",{onClick:()=>A(a.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-green-600 hover:text-green-900 dark:text-green-400 dark:hover:text-green-300",children:[e.jsx(m,{className:"h-3 w-3"}),"دسترسی‌ها"]}),e.jsxs("button",{onClick:()=>b(a.id.toString()),className:"flex items-center gap-1 px-2 py-1 text-xs text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",children:[e.jsx(h,{className:"h-3 w-3"}),"حذف"]})]})]},a.id))})]}),e.jsx(x,{isOpen:!!j,onClose:L,title:"تأیید حذف",size:"sm",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"آیا از حذف این نقش اطمینان دارید؟ این عمل قابل بازگشت نیست."}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx(l,{variant:"secondary",onClick:L,children:"انصراف"}),e.jsx(l,{variant:"danger",onClick:()=>{j&&f(j,{onSuccess:()=>{b(null)}})},loading:C,children:"حذف"})]})]})})]})};export{p as default}; diff --git a/dist/assets/Table-2d8d22e8.js b/dist/assets/Table-2d8d22e8.js new file mode 100644 index 0000000..5611bf3 --- /dev/null +++ b/dist/assets/Table-2d8d22e8.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{r as a}from"./vendor-react-ac1483bd.js";import{c as s,s as r,C as d}from"./vendor-ui-8a3c5c7d.js";const c=({columns:c,data:i,loading:t=!1})=>{const[l,x]=a.useState(""),[n,m]=a.useState("asc"),y=[...i].sort((e,a)=>{if(!l)return 0;const s=e[l],r=a[l];return sr?"asc"===n?1:-1:0});return t?e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs("div",{className:"card overflow-hidden",children:[e.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 px-6 py-3",children:e.jsx("div",{className:"flex space-x-4",children:c.map((a,s)=>e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded flex-1"},s))})}),[...Array(5)].map((a,s)=>e.jsx("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:e.jsx("div",{className:"flex space-x-4",children:c.map((a,s)=>e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded flex-1"},s))})},s))]})}),e.jsx("div",{className:"md:hidden space-y-4",children:[...Array(3)].map((a,s)=>e.jsx("div",{className:"card p-4 space-y-3",children:c.map((a,s)=>e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"h-3 bg-gray-300 dark:bg-gray-600 rounded w-1/3"}),e.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-2/3"})]},s))},s))})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block card overflow-hidden",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:e.jsx("tr",{children:c.map(a=>e.jsx("th",{className:s("px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",a.sortable&&"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-600"),onClick:()=>{return a.sortable&&(e=a.key,void(l===e?m("asc"===n?"desc":"asc"):(x(e),m("asc"))));var e},children:e.jsxs("div",{className:"flex items-center justify-end space-x-1",children:[e.jsx("span",{children:a.label}),a.sortable&&e.jsxs("div",{className:"flex flex-col",children:[e.jsx(r,{className:s("h-3 w-3",l===a.key&&"asc"===n?"text-primary-600":"text-gray-400")}),e.jsx(d,{className:s("h-3 w-3 -mt-1",l===a.key&&"desc"===n?"text-primary-600":"text-gray-400")})]})]})},a.key))})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:y.map((a,s)=>e.jsx("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:c.map(s=>e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100 text-right",children:s.render?s.render(a[s.key],a):a[s.key]},s.key))},s))})]})}),e.jsx("div",{className:"md:hidden space-y-4",children:y.map((a,s)=>e.jsx("div",{className:"card p-4 space-y-3",children:c.map(s=>e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("span",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:[s.label,":"]}),e.jsx("span",{className:"text-sm text-gray-900 dark:text-gray-100 text-right",children:s.render?s.render(a[s.key],a):a[s.key]})]},s.key))},s))})]})};export{c as T}; diff --git a/dist/assets/Users-222cded8.js b/dist/assets/Users-222cded8.js new file mode 100644 index 0000000..91ab3eb --- /dev/null +++ b/dist/assets/Users-222cded8.js @@ -0,0 +1 @@ +import{j as e}from"./vendor-query-a3e439f2.js";import{r as a}from"./vendor-react-ac1483bd.js";import{T as s}from"./Table-2d8d22e8.js";import{B as r,P as l,b as t,c as i}from"./index-590deac5.js";import{M as n}from"./Modal-8110908d.js";import{P as m}from"./Pagination-ce6b4a1c.js";import{c as o,a as d,u as c}from"./vendor-forms-f89aa741.js";import{o as x}from"./yup-bff05cf1.js";import{I as p}from"./Input-dc2009a3.js";import{p as h,m as u,q as j}from"./vendor-ui-8a3c5c7d.js";import"./vendor-toast-598db4db.js";const g=o({name:d().required("نام الزامی است"),email:d().email("ایمیل معتبر نیست").required("ایمیل الزامی است"),phone:d().required("شماره تلفن الزامی است"),role:d().required("نقش الزامی است"),password:d().notRequired()}),b=({onSubmit:a,defaultValues:s,initialData:l,onCancel:t,loading:i,isEdit:n,isLoading:m})=>{var o,d,h;const{register:u,handleSubmit:j,formState:{errors:b,isValid:v}}=c({resolver:x(g),defaultValues:s||l,mode:"onChange"});return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-gray-100",children:"اطلاعات کاربر"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"لطفا اطلاعات کاربر را کامل کنید"})]}),e.jsxs("form",{onSubmit:j(a),className:"space-y-4",children:[e.jsx(p,{label:"نام",...u("name"),error:null==(o=b.name)?void 0:o.message,placeholder:"نام کاربر"}),e.jsx(p,{label:"ایمیل",type:"email",...u("email"),error:null==(d=b.email)?void 0:d.message,placeholder:"example@email.com"}),e.jsx(p,{label:"تلفن",type:"tel",...u("phone"),error:null==(h=b.phone)?void 0:h.message,placeholder:"09xxxxxxxxx"}),e.jsx("div",{className:"pt-4",children:e.jsx(r,{type:"submit",disabled:!v||m,className:"w-full",children:m?"در حال ذخیره...":"ذخیره"})})]})]})},v=[{id:1,name:"علی احمدی",email:"ali@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۵",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:2,name:"فاطمه حسینی",email:"fateme@example.com",role:"مدیر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۴",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:3,name:"محمد رضایی",email:"mohammad@example.com",role:"کاربر",status:"غیرفعال",createdAt:"۱۴۰۲/۰۸/۱۳",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:4,name:"زهرا کریمی",email:"zahra@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۲",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:5,name:"حسن نوری",email:"hassan@example.com",role:"مدیر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۱",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:6,name:"مریم صادقی",email:"maryam@example.com",role:"کاربر",status:"غیرفعال",createdAt:"۱۴۰۲/۰۸/۱۰",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:7,name:"احمد قاسمی",email:"ahmad@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۰۹",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:8,name:"سارا محمدی",email:"sara@example.com",role:"مدیر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۰۸",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:9,name:"رضا کریمی",email:"reza@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۰۷",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:10,name:"نرگس احمدی",email:"narges@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۰۶",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:11,name:"امیر حسینی",email:"amir@example.com",role:"مدیر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۰۵",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:12,name:"مینا رضایی",email:"mina@example.com",role:"کاربر",status:"غیرفعال",createdAt:"۱۴۰۲/۰۸/۰۴",phone:"۰۹۱۲۳۴۵۶۷۸۹"}],f=()=>{const[o,d]=a.useState(""),[c,x]=a.useState(!1),[p,g]=a.useState(null),[f,y]=a.useState(1),N=[{key:"name",label:"نام",sortable:!0},{key:"email",label:"ایمیل",sortable:!0},{key:"phone",label:"تلفن"},{key:"role",label:"نقش"},{key:"status",label:"وضعیت",render:a=>e.jsx("span",{className:"px-2 py-1 rounded-full text-xs font-medium "+("فعال"===a?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"),children:a})},{key:"createdAt",label:"تاریخ عضویت",sortable:!0},{key:"actions",label:"عملیات",render:(a,s)=>e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(r,{size:"sm",variant:"secondary",onClick:()=>S(s),children:"ویرایش"}),e.jsx(i,{permission:22,children:e.jsx(r,{size:"sm",variant:"danger",onClick:()=>P(s.id),children:"حذف"})})]})}],k=v.filter(e=>e.name.toLowerCase().includes(o.toLowerCase())||e.email.toLowerCase().includes(o.toLowerCase())),w=Math.ceil(k.length/5),A=5*(f-1),C=k.slice(A,A+5),S=e=>{g(e),x(!0)},P=e=>{confirm("آیا از حذف این کاربر اطمینان دارید؟")},q=()=>{x(!1),g(null)};return e.jsxs(l,{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(t,{children:"مدیریت کاربران"}),e.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:[k.length," کاربر یافت شد"]})]}),e.jsxs("div",{className:"flex items-center space-x-3 space-x-reverse",children:[e.jsxs(r,{variant:"secondary",children:[e.jsx(h,{className:"h-4 w-4 ml-2"}),"فیلتر"]}),e.jsx(i,{permission:25,children:e.jsx("button",{onClick:()=>{g(null),x(!0)},className:"flex items-center justify-center w-12 h-12 bg-primary-600 hover:bg-primary-700 rounded-full transition-colors duration-200 text-white shadow-lg hover:shadow-xl",title:"افزودن کاربر",children:e.jsx(u,{className:"h-5 w-5"})})})]})]}),e.jsxs("div",{className:"card p-6",children:[e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none",children:e.jsx(j,{className:"h-5 w-5 text-gray-400"})}),e.jsx("input",{type:"text",placeholder:"جستجو در کاربران...",value:o,onChange:e=>d(e.target.value),className:"input pr-10 max-w-md"})]})}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg overflow-hidden",children:[e.jsx(s,{columns:N,data:C,loading:!1}),e.jsx(m,{currentPage:f,totalPages:w,onPageChange:y,itemsPerPage:5,totalItems:k.length})]})]}),e.jsx(n,{title:p?"ویرایش کاربر":"افزودن کاربر",isOpen:c,onClose:q,size:"lg",children:e.jsx(b,{initialData:p,onSubmit:e=>{x(!1)},onCancel:q,loading:!1,isEdit:!!p})})]})};export{f as Users}; diff --git a/dist/assets/_hooks-05707864.js b/dist/assets/_hooks-05707864.js new file mode 100644 index 0000000..83b602d --- /dev/null +++ b/dist/assets/_hooks-05707864.js @@ -0,0 +1 @@ +import{h as a,A as t,a as e,d as r,b as s,c as o,Q as i}from"./_requests-35c9d4c3.js";import{b as n,c as u,u as c}from"./vendor-query-a3e439f2.js";import{V as d}from"./vendor-toast-598db4db.js";const p=a=>n({queryKey:[i.GET_PRODUCTS,a],queryFn:()=>(async a=>{try{const e={};(null==a?void 0:a.search)&&(e.search=a.search),(null==a?void 0:a.category_id)&&(e.category_id=a.category_id),(null==a?void 0:a.status)&&(e.status=a.status),(null==a?void 0:a.min_price)&&(e.min_price=a.min_price),(null==a?void 0:a.max_price)&&(e.max_price=a.max_price),(null==a?void 0:a.page)&&(e.page=a.page),(null==a?void 0:a.limit)&&(e.limit=a.limit);const s=await o(t(r.GET_PRODUCTS,e));return s.data&&s.data.products&&Array.isArray(s.data.products)?{products:s.data.products,total:s.data.total,page:s.data.page,per_page:s.data.per_page}:{products:[],total:0,page:1,per_page:10}}catch(e){return{products:[],total:0,page:1,per_page:10}}})(a)}),l=(a,e=!0)=>n({queryKey:[i.GET_PRODUCT,a],queryFn:()=>(async a=>(await o(t(r.GET_PRODUCT(a)))).data.product)(a),enabled:e&&!!a}),y=()=>{const e=u();return c({mutationKey:[i.CREATE_PRODUCT],mutationFn:e=>(async e=>(await a(t(r.CREATE_PRODUCT),e)).data.product)(e),onSuccess:()=>{e.invalidateQueries({queryKey:[i.GET_PRODUCTS]}),d.success("محصول با موفقیت ایجاد شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در ایجاد محصول")}})},T=()=>{const a=u();return c({mutationKey:[i.UPDATE_PRODUCT],mutationFn:a=>(async a=>(await e(t(r.UPDATE_PRODUCT(a.id.toString())),a)).data.product)(a),onSuccess:(t,e)=>{a.invalidateQueries({queryKey:[i.GET_PRODUCTS]}),a.invalidateQueries({queryKey:[i.GET_PRODUCT,e.id.toString()]}),d.success("محصول با موفقیت ویرایش شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در ویرایش محصول")}})},_=()=>{const a=u();return c({mutationKey:[i.DELETE_PRODUCT],mutationFn:a=>(async a=>(await s(t(r.DELETE_PRODUCT(a)))).data)(a),onSuccess:()=>{a.invalidateQueries({queryKey:[i.GET_PRODUCTS]}),d.success("محصول با موفقیت حذف شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در حذف محصول")}})};export{_ as a,l as b,y as c,T as d,p as u}; diff --git a/dist/assets/_hooks-653fd77f.js b/dist/assets/_hooks-653fd77f.js new file mode 100644 index 0000000..cd31db0 --- /dev/null +++ b/dist/assets/_hooks-653fd77f.js @@ -0,0 +1 @@ +import{h as a,A as r,a as e,b as s,c as t,d as n,Q as o}from"./_requests-35c9d4c3.js";import{b as i,c as u,u as E}from"./vendor-query-a3e439f2.js";import{V as d}from"./vendor-toast-598db4db.js";const c=a=>i({queryKey:[o.GET_ROLES,a],queryFn:()=>(async a=>{try{const e={};(null==a?void 0:a.search)&&(e.search=a.search),(null==a?void 0:a.page)&&(e.page=a.page),(null==a?void 0:a.limit)&&(e.limit=a.limit);const s=await t(r(n.GET_ROLES,e));return s.data&&s.data.roles&&Array.isArray(s.data.roles)?s.data.roles:[]}catch(e){return[]}})(a)}),y=a=>i({queryKey:[o.GET_ROLE,a],queryFn:()=>(async a=>{try{const e=await t(r(n.GET_ROLE(a)));if(e.data&&e.data.role)return e.data.role;if(e.data)return e.data;throw new Error("No role data found in response")}catch(e){throw e}})(a),enabled:!!a}),l=()=>{const e=u();return E({mutationFn:e=>(async e=>(await a(r(n.CREATE_ROLE),e)).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:[o.GET_ROLES]}),d.success("نقش با موفقیت ایجاد شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در ایجاد نقش")}})},S=()=>{const a=u();return E({mutationFn:a=>(async(a,s)=>(await e(r(n.UPDATE_ROLE(a)),s)).data)(a.id.toString(),a),onSuccess:r=>{a.invalidateQueries({queryKey:[o.GET_ROLES]}),a.invalidateQueries({queryKey:[o.GET_ROLE,r.id.toString()]}),d.success("نقش با موفقیت به‌روزرسانی شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در به‌روزرسانی نقش")}})},R=()=>{const a=u();return E({mutationFn:a=>(async a=>(await s(r(n.DELETE_ROLE(a)))).data)(a),onSuccess:()=>{a.invalidateQueries({queryKey:[o.GET_ROLES]}),d.success("نقش با موفقیت حذف شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در حذف نقش")}})},O=a=>i({queryKey:[o.GET_ROLE_PERMISSIONS,a],queryFn:()=>(async a=>{try{const e=await t(r(n.GET_ROLE_PERMISSIONS(a)));return e.data&&e.data.permissions&&Array.isArray(e.data.permissions)?e.data.permissions:[]}catch(e){return[]}})(a),enabled:!!a}),_=()=>{const e=u();return E({mutationFn:({roleId:e,permissionId:s})=>(async(e,s)=>(await a(r(n.ASSIGN_ROLE_PERMISSION(e,s)),{})).data)(e,s),onSuccess:(a,r)=>{e.invalidateQueries({queryKey:[o.GET_ROLE_PERMISSIONS,r.roleId]}),e.invalidateQueries({queryKey:[o.GET_ROLE,r.roleId]}),d.success("دسترسی با موفقیت اختصاص داده شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در اختصاص دسترسی")}})},I=()=>{const a=u();return E({mutationFn:({roleId:a,permissionId:e})=>(async(a,e)=>(await s(r(n.REMOVE_ROLE_PERMISSION(a,e)))).data)(a,e),onSuccess:(r,e)=>{a.invalidateQueries({queryKey:[o.GET_ROLE_PERMISSIONS,e.roleId]}),a.invalidateQueries({queryKey:[o.GET_ROLE,e.roleId]}),d.success("دسترسی با موفقیت حذف شد")},onError:a=>{d.error((null==a?void 0:a.message)||"خطا در حذف دسترسی")}})},m=()=>i({queryKey:[o.GET_PERMISSIONS],queryFn:()=>(async()=>(await t(r(n.GET_PERMISSIONS))).data)()});export{R as a,y as b,l as c,S as d,O as e,m as f,_ as g,I as h,c as u}; diff --git a/dist/assets/_hooks-69d4323f.js b/dist/assets/_hooks-69d4323f.js new file mode 100644 index 0000000..02757a2 --- /dev/null +++ b/dist/assets/_hooks-69d4323f.js @@ -0,0 +1 @@ +import{h as r,A as a,d as e,a as s,c as t,Q as i}from"./_requests-35c9d4c3.js";import{b as n,c as o,u}from"./vendor-query-a3e439f2.js";import{V as c}from"./vendor-toast-598db4db.js";const E=r=>n({queryKey:[i.GET_PERMISSIONS,r],queryFn:()=>(async r=>{try{const s={};(null==r?void 0:r.search)&&(s.search=r.search),(null==r?void 0:r.page)&&(s.page=r.page),(null==r?void 0:r.limit)&&(s.limit=r.limit);const i=await t(a(e.GET_PERMISSIONS,s));return i.data&&i.data.permissions&&Array.isArray(i.data.permissions)?i.data.permissions:[]}catch(s){return[]}})(r)}),S=(r,s=!0)=>n({queryKey:[i.GET_PERMISSION,r],queryFn:()=>(async r=>{try{const s=await t(a(e.GET_PERMISSION(r)));if(s.data&&s.data.permission)return s.data.permission;throw new Error("Permission not found")}catch(s){throw s}})(r),enabled:s&&!!r}),d=()=>{const s=o();return u({mutationKey:[i.CREATE_PERMISSION],mutationFn:s=>(async s=>{try{const t=await r(a(e.CREATE_PERMISSION),s);if(t.data&&t.data.permission)return t.data.permission;throw new Error("Failed to create permission")}catch(t){throw t}})(s),onSuccess:r=>{s.invalidateQueries({queryKey:[i.GET_PERMISSIONS]}),s.invalidateQueries({queryKey:[i.GET_ROLE_PERMISSIONS]}),c.success("دسترسی با موفقیت ایجاد شد")},onError:r=>{c.error((null==r?void 0:r.message)||"خطا در ایجاد دسترسی")}})},y=()=>{const r=o();return u({mutationKey:[i.UPDATE_PERMISSION],mutationFn:({id:r,permissionData:t})=>(async(r,t)=>{try{const i=await s(a(e.UPDATE_PERMISSION(r)),t);if(i.data&&i.data.permission)return i.data.permission;throw new Error("Failed to update permission")}catch(i){throw i}})(r,t),onSuccess:(a,e)=>{r.invalidateQueries({queryKey:[i.GET_PERMISSIONS]}),r.invalidateQueries({queryKey:[i.GET_PERMISSION,e.id]}),r.invalidateQueries({queryKey:[i.GET_ROLE_PERMISSIONS]}),c.success("دسترسی با موفقیت به‌روزرسانی شد")},onError:r=>{c.error((null==r?void 0:r.message)||"خطا در به‌روزرسانی دسترسی")}})};export{S as a,d as b,y as c,E as u}; diff --git a/dist/assets/_hooks-8b9f7cf5.js b/dist/assets/_hooks-8b9f7cf5.js new file mode 100644 index 0000000..f456447 --- /dev/null +++ b/dist/assets/_hooks-8b9f7cf5.js @@ -0,0 +1 @@ +import{h as a,A as t,a as r,d as s,b as e,c as o,Q as n}from"./_requests-35c9d4c3.js";import{b as i,c as u,u as O}from"./vendor-query-a3e439f2.js";import{V as T}from"./vendor-toast-598db4db.js";const c=a=>i({queryKey:[n.GET_PRODUCT_OPTIONS,a],queryFn:()=>(async a=>{try{const r={};(null==a?void 0:a.search)&&(r.search=a.search),(null==a?void 0:a.page)&&(r.page=a.page),(null==a?void 0:a.limit)&&(r.limit=a.limit);const e=await o(t(s.GET_PRODUCT_OPTIONS,r));return e.data&&e.data.product_options&&Array.isArray(e.data.product_options)?e.data.product_options:[]}catch(r){return[]}})(a)}),_=(a,r=!0)=>i({queryKey:[n.GET_PRODUCT_OPTION,a],queryFn:()=>(async a=>(await o(t(s.GET_PRODUCT_OPTION(a)))).data.product_option)(a),enabled:r&&!!a}),d=()=>{const r=u();return O({mutationKey:[n.CREATE_PRODUCT_OPTION],mutationFn:r=>(async r=>(await a(t(s.CREATE_PRODUCT_OPTION),r)).data.product_option)(r),onSuccess:()=>{r.invalidateQueries({queryKey:[n.GET_PRODUCT_OPTIONS]}),T.success("گزینه محصول با موفقیت ایجاد شد")},onError:a=>{T.error((null==a?void 0:a.message)||"خطا در ایجاد گزینه محصول")}})},P=()=>{const a=u();return O({mutationKey:[n.UPDATE_PRODUCT_OPTION],mutationFn:a=>(async a=>(await r(t(s.UPDATE_PRODUCT_OPTION(a.id.toString())),a)).data.product_option)(a),onSuccess:(t,r)=>{a.invalidateQueries({queryKey:[n.GET_PRODUCT_OPTIONS]}),a.invalidateQueries({queryKey:[n.GET_PRODUCT_OPTION,r.id.toString()]}),T.success("گزینه محصول با موفقیت ویرایش شد")},onError:a=>{T.error((null==a?void 0:a.message)||"خطا در ویرایش گزینه محصول")}})},y=()=>{const a=u();return O({mutationKey:[n.DELETE_PRODUCT_OPTION],mutationFn:a=>(async a=>(await e(t(s.DELETE_PRODUCT_OPTION(a)))).data)(a),onSuccess:()=>{a.invalidateQueries({queryKey:[n.GET_PRODUCT_OPTIONS]}),T.success("گزینه محصول با موفقیت حذف شد")},onError:a=>{T.error((null==a?void 0:a.message)||"خطا در حذف گزینه محصول")}})};export{y as a,_ as b,d as c,P as d,c as u}; diff --git a/dist/assets/_hooks-9d916060.js b/dist/assets/_hooks-9d916060.js new file mode 100644 index 0000000..6a02b32 --- /dev/null +++ b/dist/assets/_hooks-9d916060.js @@ -0,0 +1 @@ +import{h as a,A as e,a as r,d as s,b as t,c as o,Q as i}from"./_requests-35c9d4c3.js";import{b as n,c as E,u as c}from"./vendor-query-a3e439f2.js";import{V as u}from"./vendor-toast-598db4db.js";import{u as y}from"./vendor-react-ac1483bd.js";const T=a=>n({queryKey:[i.GET_CATEGORIES,a],queryFn:()=>(async a=>{try{const r={};(null==a?void 0:a.search)&&(r.search=a.search),(null==a?void 0:a.page)&&(r.page=a.page),(null==a?void 0:a.limit)&&(r.limit=a.limit);const t=await o(e(s.GET_CATEGORIES,r));return t.data&&t.data.categories&&Array.isArray(t.data.categories)?t.data.categories:[]}catch(r){return[]}})(a)}),d=(a,r=!0)=>n({queryKey:[i.GET_CATEGORY,a],queryFn:()=>(async a=>(await o(e(s.GET_CATEGORY(a)))).data.category)(a),enabled:r&&!!a}),G=()=>{const r=E(),t=y();return c({mutationKey:[i.CREATE_CATEGORY],mutationFn:r=>(async r=>(await a(e(s.CREATE_CATEGORY),r)).data.category)(r),onSuccess:()=>{r.invalidateQueries({queryKey:[i.GET_CATEGORIES]}),u.success("دسته‌بندی با موفقیت ایجاد شد"),t("/categories")},onError:a=>{u.error((null==a?void 0:a.message)||"خطا در ایجاد دسته‌بندی")}})},A=()=>{const a=E(),t=y();return c({mutationKey:[i.UPDATE_CATEGORY],mutationFn:a=>(async a=>(await r(e(s.UPDATE_CATEGORY(a.id.toString())),a)).data.category)(a),onSuccess:(e,r)=>{a.invalidateQueries({queryKey:[i.GET_CATEGORIES]}),a.invalidateQueries({queryKey:[i.GET_CATEGORY,r.id.toString()]}),u.success("دسته‌بندی با موفقیت ویرایش شد"),t("/categories")},onError:a=>{u.error((null==a?void 0:a.message)||"خطا در ویرایش دسته‌بندی")}})},l=()=>{const a=E();return c({mutationKey:[i.DELETE_CATEGORY],mutationFn:a=>(async a=>(await t(e(s.DELETE_CATEGORY(a)))).data)(a),onSuccess:()=>{a.invalidateQueries({queryKey:[i.GET_CATEGORIES]}),u.success("دسته‌بندی با موفقیت حذف شد")},onError:a=>{u.error((null==a?void 0:a.message)||"خطا در حذف دسته‌بندی")}})};export{l as a,d as b,G as c,A as d,T as u}; diff --git a/dist/assets/_hooks-e1033fd2.js b/dist/assets/_hooks-e1033fd2.js new file mode 100644 index 0000000..233f805 --- /dev/null +++ b/dist/assets/_hooks-e1033fd2.js @@ -0,0 +1 @@ +import{h as a,A as r,d as t,a as e,b as s,c as u,Q as n}from"./_requests-35c9d4c3.js";import{b as i,c as d,u as o}from"./vendor-query-a3e439f2.js";import{V as c}from"./vendor-toast-598db4db.js";const E=a=>i({queryKey:[n.GET_ADMIN_USERS,a],queryFn:()=>(async a=>{try{const e={};(null==a?void 0:a.search)&&(e.search=a.search),(null==a?void 0:a.status)&&(e.status=a.status),(null==a?void 0:a.page)&&(e.page=a.page),(null==a?void 0:a.limit)&&(e.limit=a.limit);const s=r(t.GET_ADMIN_USERS,e),n=await u(s);return n.data&&n.data.admin_users?Array.isArray(n.data.admin_users)?n.data.admin_users:[]:n.data&&n.data.users?Array.isArray(n.data.users)?n.data.users:[]:n.data&&Array.isArray(n.data)?n.data:[]}catch(e){return[]}})(a)}),_=(a,e=!0)=>i({queryKey:[n.GET_ADMIN_USER,a],queryFn:()=>(async a=>{try{const e=await u(r(t.GET_ADMIN_USER(a)));if(e.data&&e.data.admin_user)return e.data.admin_user;if(e.data&&e.data.user)return e.data.user;throw new Error("Failed to get admin user")}catch(e){throw e}})(a),enabled:e&&!!a}),y=()=>{const e=d();return o({mutationKey:[n.CREATE_ADMIN_USER],mutationFn:e=>(async e=>{try{const s=await a(r(t.CREATE_ADMIN_USER),e);if(s.data&&s.data.admin_user)return s.data.admin_user;if(s.data&&s.data.user)return s.data.user;throw new Error("Failed to create admin user")}catch(s){throw s}})(e),onSuccess:a=>{e.invalidateQueries({queryKey:[n.GET_ADMIN_USERS]}),c.success("کاربر ادمین با موفقیت ایجاد شد")},onError:a=>{c.error((null==a?void 0:a.message)||"خطا در ایجاد کاربر ادمین")}})},m=()=>{const a=d();return o({mutationKey:[n.UPDATE_ADMIN_USER],mutationFn:({id:a,userData:s})=>(async(a,s)=>{try{const u=await e(r(t.UPDATE_ADMIN_USER(a)),s);if(u.data&&u.data.admin_user)return u.data.admin_user;if(u.data&&u.data.user)return u.data.user;throw new Error("Failed to update admin user")}catch(u){throw u}})(a,s),onSuccess:(r,t)=>{a.invalidateQueries({queryKey:[n.GET_ADMIN_USERS]}),a.invalidateQueries({queryKey:[n.GET_ADMIN_USER,t.id]}),c.success("کاربر ادمین با موفقیت به‌روزرسانی شد")},onError:a=>{c.error((null==a?void 0:a.message)||"خطا در به‌روزرسانی کاربر ادمین")}})},l=()=>{const a=d();return o({mutationKey:[n.DELETE_ADMIN_USER],mutationFn:a=>(async a=>{try{return(await s(r(t.DELETE_ADMIN_USER(a)))).data}catch(e){throw e}})(a),onSuccess:()=>{a.invalidateQueries({queryKey:[n.GET_ADMIN_USERS]}),c.success("کاربر ادمین با موفقیت حذف شد")},onError:a=>{c.error((null==a?void 0:a.message)||"خطا در حذف کاربر ادمین")}})};export{l as a,_ as b,y as c,m as d,E as u}; diff --git a/dist/assets/_models-0008c1da.js b/dist/assets/_models-0008c1da.js new file mode 100644 index 0000000..998ff50 --- /dev/null +++ b/dist/assets/_models-0008c1da.js @@ -0,0 +1 @@ +const o=0,s=1,t=2,a=3,c={[o]:"محصول ساده",[s]:"محصول متغیر",[t]:"محصول گروهی",[a]:"محصول خارجی"};export{c as P}; diff --git a/dist/assets/_requests-35c9d4c3.js b/dist/assets/_requests-35c9d4c3.js new file mode 100644 index 0000000..65bf833 --- /dev/null +++ b/dist/assets/_requests-35c9d4c3.js @@ -0,0 +1,3 @@ +const e={ADMIN_LOGIN:"admin_login",GET_DISCOUNT_DETAIL:"get_discount_detail",GET_DRAFT_DETAIL:"get_draft_detail",GET_ADMIN_USERS:"get_admin_users",GET_ADMIN_USER:"get_admin_user",CREATE_ADMIN_USER:"create_admin_user",UPDATE_ADMIN_USER:"update_admin_user",DELETE_ADMIN_USER:"delete_admin_user",GET_ROLES:"get_roles",GET_ROLE:"get_role",CREATE_ROLE:"create_role",UPDATE_ROLE:"update_role",DELETE_ROLE:"delete_role",GET_ROLE_PERMISSIONS:"get_role_permissions",ASSIGN_ROLE_PERMISSION:"assign_role_permission",REMOVE_ROLE_PERMISSION:"remove_role_permission",GET_PERMISSIONS:"get_permissions",GET_PERMISSION:"get_permission",CREATE_PERMISSION:"create_permission",UPDATE_PERMISSION:"update_permission",DELETE_PERMISSION:"delete_permission",GET_PRODUCT_OPTIONS:"get_product_options",GET_PRODUCT_OPTION:"get_product_option",CREATE_PRODUCT_OPTION:"create_product_option",UPDATE_PRODUCT_OPTION:"update_product_option",DELETE_PRODUCT_OPTION:"delete_product_option",GET_CATEGORIES:"get_categories",GET_CATEGORY:"get_category",CREATE_CATEGORY:"create_category",UPDATE_CATEGORY:"update_category",DELETE_CATEGORY:"delete_category",GET_PRODUCTS:"get_products",GET_PRODUCT:"get_product",CREATE_PRODUCT:"create_product",UPDATE_PRODUCT:"update_product",DELETE_PRODUCT:"delete_product",GET_PRODUCT_VARIANTS:"get_product_variants",CREATE_PRODUCT_VARIANT:"create_product_variant",UPDATE_PRODUCT_VARIANT:"update_product_variant",DELETE_PRODUCT_VARIANT:"delete_product_variant",GET_FILES:"get_files",UPLOAD_FILE:"upload_file",GET_FILE:"get_file",UPDATE_FILE:"update_file",DELETE_FILE:"delete_file",GET_IMAGES:"get_images",CREATE_IMAGE:"create_image",UPDATE_IMAGE:"update_image",DELETE_IMAGE:"delete_image"};function t(e,t){return function(){return e.apply(t,arguments)}}const{toString:n}=Object.prototype,{getPrototypeOf:r}=Object,{iterator:o,toStringTag:s}=Symbol,i=(a=Object.create(null),e=>{const t=n.call(e);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())});var a;const c=e=>(e=e.toLowerCase(),t=>i(t)===e),u=e=>t=>typeof t===e,{isArray:l}=Array,d=u("undefined");const f=c("ArrayBuffer");const p=u("string"),h=u("function"),m=u("number"),E=e=>null!==e&&"object"==typeof e,g=e=>{if("object"!==i(e))return!1;const t=r(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||s in e||o in e)},_=c("Date"),T=c("File"),R=c("Blob"),y=c("FileList"),O=c("URLSearchParams"),[b,S,w,A]=["ReadableStream","Request","Response","Headers"].map(c);function v(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),l(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const P="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,D=e=>!d(e)&&e!==P;const U=(N="undefined"!=typeof Uint8Array&&r(Uint8Array),e=>N&&e instanceof N);var N;const I=c("HTMLFormElement"),L=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),x=c("RegExp"),j=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};v(n,(n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)}),Object.defineProperties(e,r)};const F=c("AsyncFunction"),k=(B="function"==typeof setImmediate,M=h(P.postMessage),B?setImmediate:M?(G=`axios@${Math.random()}`,$=[],P.addEventListener("message",({source:e,data:t})=>{e===P&&t===G&&$.length&&$.shift()()},!1),e=>{$.push(e),P.postMessage(G,"*")}):e=>setTimeout(e));var B,M,G,$;const q="undefined"!=typeof queueMicrotask?queueMicrotask.bind(P):"undefined"!=typeof process&&process.nextTick||k,z={isArray:l,isArrayBuffer:f,isBuffer:function(e){return null!==e&&!d(e)&&null!==e.constructor&&!d(e.constructor)&&h(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||h(e.append)&&("formdata"===(t=i(e))||"object"===t&&h(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&f(e.buffer),t},isString:p,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:E,isPlainObject:g,isReadableStream:b,isRequest:S,isResponse:w,isHeaders:A,isUndefined:d,isDate:_,isFile:T,isBlob:R,isRegExp:x,isFunction:h,isStream:e=>E(e)&&h(e.pipe),isURLSearchParams:O,isTypedArray:U,isFileList:y,forEach:v,merge:function e(){const{caseless:t}=D(this)&&this||{},n={},r=(r,o)=>{const s=t&&C(n,o)||o;g(n[s])&&g(r)?n[s]=e(n[s],r):g(r)?n[s]=e({},r):l(r)?n[s]=r.slice():n[s]=r};for(let o=0,s=arguments.length;o(v(n,(n,o)=>{r&&h(n)?e[o]=t(n,r):e[o]=n},{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,o)=>{let s,i,a;const c={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)a=s[i],o&&!o(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&r(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:i,kindOfTest:c,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!m(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[o]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:I,hasOwnProperty:L,hasOwnProp:L,reduceDescriptors:j,freezeMethods:e=>{j(e,(t,n)=>{if(h(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];h(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return l(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:C,global:P,isContextDefined:D,isSpecCompliantForm:function(e){return!!(e&&h(e.append)&&"FormData"===e[s]&&e[o])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(E(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=l(e)?[]:{};return v(e,(e,t)=>{const s=n(e,r+1);!d(s)&&(o[t]=s)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:F,isThenable:e=>e&&(E(e)||h(e))&&h(e.then)&&h(e.catch),setImmediate:k,asap:q,isIterable:e=>null!=e&&h(e[o])};function V(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}z.inherits(V,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:z.toJSONObject(this.config),code:this.code,status:this.status}}});const J=V.prototype,H={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{H[e]={value:e}}),Object.defineProperties(V,H),Object.defineProperty(J,"isAxiosError",{value:!0}),V.from=(e,t,n,r,o,s)=>{const i=Object.create(J);return z.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),V.call(i,e.message,t,n,r,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};function W(e){return z.isPlainObject(e)||z.isArray(e)}function K(e){return z.endsWith(e,"[]")?e.slice(0,-2):e}function X(e,t,n){return e?e.concat(t).map(function(e,t){return e=K(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Y=z.toFlatObject(z,{},null,function(e){return/^is[A-Z]/.test(e)});function Q(e,t,n){if(!z.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=z.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!z.isUndefined(t[e])})).metaTokens,o=n.visitor||u,s=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&z.isSpecCompliantForm(t);if(!z.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(z.isDate(e))return e.toISOString();if(!a&&z.isBlob(e))throw new V("Blob is not supported. Use a Buffer instead.");return z.isArrayBuffer(e)||z.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(z.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(z.isArray(e)&&function(e){return z.isArray(e)&&!e.some(W)}(e)||(z.isFileList(e)||z.endsWith(n,"[]"))&&(a=z.toArray(e)))return n=K(n),a.forEach(function(e,r){!z.isUndefined(e)&&null!==e&&t.append(!0===i?X([n],r,s):null===i?n:n+"[]",c(e))}),!1;return!!W(e)||(t.append(X(o,n,s),c(e)),!1)}const l=[],d=Object.assign(Y,{defaultVisitor:u,convertValue:c,isVisitable:W});if(!z.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!z.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),z.forEach(n,function(n,s){!0===(!(z.isUndefined(n)||null===n)&&o.call(t,n,z.isString(s)?s.trim():s,r,d))&&e(n,r?r.concat(s):[s])}),l.pop()}}(e),t}function Z(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ee(e,t){this._pairs=[],e&&Q(e,this,t)}const te=ee.prototype;function ne(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function re(e,t,n){if(!t)return e;const r=n&&n.encode||ne;z.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let s;if(s=o?o(t,n):z.isURLSearchParams(t)?t.toString():new ee(t,n).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}te.append=function(e,t){this._pairs.push([e,t])},te.toString=function(e){const t=e?function(t){return e.call(this,t,Z)}:Z;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const oe=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){z.forEach(this.handlers,function(t){null!==t&&e(t)})}},se={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ie={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ee,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ae="undefined"!=typeof window&&"undefined"!=typeof document,ce="object"==typeof navigator&&navigator||void 0,ue=ae&&(!ce||["ReactNative","NativeScript","NS"].indexOf(ce.product)<0),le="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,de=ae&&window.location.href||"http://localhost",fe={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ae,hasStandardBrowserEnv:ue,hasStandardBrowserWebWorkerEnv:le,navigator:ce,origin:de},Symbol.toStringTag,{value:"Module"})),...ie};function pe(e){function t(e,n,r,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&z.isArray(r)?r.length:s,a)return z.hasOwnProp(r,s)?r[s]=[r[s],n]:r[s]=n,!i;r[s]&&z.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],o)&&z.isArray(r[s])&&(r[s]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r{t(function(e){return z.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const he={transitional:se,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=z.isObject(e);o&&z.isHTMLForm(e)&&(e=new FormData(e));if(z.isFormData(e))return r?JSON.stringify(pe(e)):e;if(z.isArrayBuffer(e)||z.isBuffer(e)||z.isStream(e)||z.isFile(e)||z.isBlob(e)||z.isReadableStream(e))return e;if(z.isArrayBufferView(e))return e.buffer;if(z.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Q(e,new fe.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return fe.isNode&&z.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((s=z.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Q(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(z.isString(e))try{return(t||JSON.parse)(e),z.trim(e)}catch(r){if("SyntaxError"!==r.name)throw r}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||he.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(z.isResponse(e)||z.isReadableStream(e))return e;if(e&&z.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(o){if(n){if("SyntaxError"===o.name)throw V.from(o,V.ERR_BAD_RESPONSE,this,null,this.response);throw o}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:fe.classes.FormData,Blob:fe.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};z.forEach(["delete","get","head","post","put","patch"],e=>{he.headers[e]={}});const me=he,Ee=z.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ge=Symbol("internals");function _e(e){return e&&String(e).trim().toLowerCase()}function Te(e){return!1===e||null==e?e:z.isArray(e)?e.map(Te):String(e)}function Re(e,t,n,r,o){return z.isFunction(r)?r.call(this,t,n):(o&&(t=n),z.isString(t)?z.isString(r)?-1!==t.indexOf(r):z.isRegExp(r)?r.test(t):void 0:void 0)}class ye{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=_e(t);if(!o)throw new Error("header name must be a non-empty string");const s=z.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=Te(e))}const s=(e,t)=>z.forEach(e,(e,n)=>o(e,n,t));if(z.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(z.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&Ee[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(z.isObject(e)&&z.isIterable(e)){let n,r,o={};for(const t of e){if(!z.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?z.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}s(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=_e(e)){const n=z.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(z.isFunction(t))return t.call(this,e,n);if(z.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=_e(e)){const n=z.findKey(this,e);return!(!n||void 0===this[n]||t&&!Re(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=_e(e)){const o=z.findKey(n,e);!o||t&&!Re(0,n[o],o,t)||(delete n[o],r=!0)}}return z.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!Re(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return z.forEach(this,(r,o)=>{const s=z.findKey(n,o);if(s)return t[s]=Te(r),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();i!==o&&delete t[o],t[i]=Te(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return z.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&z.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ge]=this[ge]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=_e(e);t[r]||(!function(e,t){const n=z.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return z.isArray(e)?e.forEach(r):r(e),this}}ye.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),z.reduceDescriptors(ye.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),z.freezeMethods(ye);const Oe=ye;function be(e,t){const n=this||me,r=t||n,o=Oe.from(r.headers);let s=r.data;return z.forEach(e,function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function Se(e){return!(!e||!e.__CANCEL__)}function we(e,t,n){V.call(this,null==e?"canceled":e,V.ERR_CANCELED,t,n),this.name="CanceledError"}function Ae(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new V("Request failed with status code "+n.status,[V.ERR_BAD_REQUEST,V.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}z.inherits(we,V,{__CANCEL__:!0});const ve=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[i];o||(o=c),n[s]=a,r[s]=c;let l=i,d=0;for(;l!==s;)d+=n[l++],l%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o{o=s,n=null,r&&(clearTimeout(r),r=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=s?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},s-a)))},()=>n&&i(n)]}(n=>{const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=s-r,c=o(a);r=s;e({loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},Ce=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Pe=e=>(...t)=>z.asap(()=>e(...t)),De=fe.hasStandardBrowserEnv?(Ue=new URL(fe.origin),Ne=fe.navigator&&/(msie|trident)/i.test(fe.navigator.userAgent),e=>(e=new URL(e,fe.origin),Ue.protocol===e.protocol&&Ue.host===e.host&&(Ne||Ue.port===e.port))):()=>!0;var Ue,Ne;const Ie=fe.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const i=[e+"="+encodeURIComponent(t)];z.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),z.isString(r)&&i.push("path="+r),z.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Le(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const xe=e=>e instanceof Oe?{...e}:e;function je(e,t){t=t||{};const n={};function r(e,t,n,r){return z.isPlainObject(e)&&z.isPlainObject(t)?z.merge.call({caseless:r},e,t):z.isPlainObject(t)?z.merge({},t):z.isArray(t)?t.slice():t}function o(e,t,n,o){return z.isUndefined(t)?z.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function s(e,t){if(!z.isUndefined(t))return r(void 0,t)}function i(e,t){return z.isUndefined(t)?z.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return s in t?r(n,o):s in e?r(void 0,n):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>o(xe(e),xe(t),0,!0)};return z.forEach(Object.keys(Object.assign({},e,t)),function(r){const s=c[r]||o,i=s(e[r],t[r],r);z.isUndefined(i)&&s!==a||(n[r]=i)}),n}const Fe=e=>{const t=je({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:c}=t;if(t.headers=a=Oe.from(a),t.url=re(Le(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),z.isFormData(r))if(fe.hasStandardBrowserEnv||fe.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[e,...t]=n?n.split(";").map(e=>e.trim()).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(fe.hasStandardBrowserEnv&&(o&&z.isFunction(o)&&(o=o(t)),o||!1!==o&&De(t.url))){const e=s&&i&&Ie.read(i);e&&a.set(s,e)}return t},ke="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Fe(e);let o=r.data;const s=Oe.from(r.headers).normalize();let i,a,c,u,l,{responseType:d,onUploadProgress:f,onDownloadProgress:p}=r;function h(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function E(){if(!m)return;const r=Oe.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Ae(function(e){t(e),h()},function(e){n(e),h()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=E:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(E)},m.onabort=function(){m&&(n(new V("Request aborted",V.ECONNABORTED,e,m)),m=null)},m.onerror=function(){n(new V("Network Error",V.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||se;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new V(t,o.clarifyTimeoutError?V.ETIMEDOUT:V.ECONNABORTED,e,m)),m=null},void 0===o&&s.setContentType(null),"setRequestHeader"in m&&z.forEach(s.toJSON(),function(e,t){m.setRequestHeader(t,e)}),z.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=ve(p,!0),m.addEventListener("progress",c)),f&&m.upload&&([a,u]=ve(f),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new we(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);g&&-1===fe.protocols.indexOf(g)?n(new V("Unsupported protocol "+g+":",V.ERR_BAD_REQUEST,e)):m.send(o||null)})},Be=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof V?t:new we(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,o(new V(`timeout ${t} of ms exceeded`,V.ETIMEDOUT))},t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:a}=r;return a.unsubscribe=()=>z.asap(i),a}},Me=function*(e,t){let n=e.byteLength;if(!t||n{const o=async function*(e,t){for await(const n of Ge(e))yield*Me(n,t)}(e,t);let s,i=0,a=e=>{s||(s=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let s=r.byteLength;if(n){let e=i+=s;n(e)}e.enqueue(new Uint8Array(r))}catch(t){throw a(t),t}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},qe="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,ze=qe&&"function"==typeof ReadableStream,Ve=qe&&("function"==typeof TextEncoder?(Je=new TextEncoder,e=>Je.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Je;const He=(e,...t)=>{try{return!!e(...t)}catch(n){return!1}},We=ze&&He(()=>{let e=!1;const t=new Request(fe.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Ke=ze&&He(()=>z.isReadableStream(new Response("").body)),Xe={stream:Ke&&(e=>e.body)};var Ye;qe&&(Ye=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Xe[e]&&(Xe[e]=z.isFunction(Ye[e])?t=>t[e]():(t,n)=>{throw new V(`Response type '${e}' is not supported`,V.ERR_NOT_SUPPORT,n)})}));const Qe=async(e,t)=>{const n=z.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(z.isBlob(e))return e.size;if(z.isSpecCompliantForm(e)){const t=new Request(fe.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return z.isArrayBufferView(e)||z.isArrayBuffer(e)?e.byteLength:(z.isURLSearchParams(e)&&(e+=""),z.isString(e)?(await Ve(e)).byteLength:void 0)})(t):n},Ze={http:null,xhr:ke,fetch:qe&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:s,timeout:i,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:d="same-origin",fetchOptions:f}=Fe(e);u=u?(u+"").toLowerCase():"text";let p,h=Be([o,s&&s.toAbortSignal()],i);const m=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let E;try{if(c&&We&&"get"!==n&&"head"!==n&&0!==(E=await Qe(l,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(z.isFormData(r)&&(e=n.headers.get("content-type"))&&l.setContentType(e),n.body){const[e,t]=Ce(E,ve(Pe(c)));r=$e(n.body,65536,e,t)}}z.isString(d)||(d=d?"include":"omit");const o="credentials"in Request.prototype;p=new Request(t,{...f,signal:h,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:o?d:void 0});let s=await fetch(p);const i=Ke&&("stream"===u||"response"===u);if(Ke&&(a||i&&m)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=s[t]});const t=z.toFiniteNumber(s.headers.get("content-length")),[n,r]=a&&Ce(t,ve(Pe(a),!0))||[];s=new Response($e(s.body,65536,n,()=>{r&&r(),m&&m()}),e)}u=u||"text";let g=await Xe[z.findKey(Xe,u)||"text"](s,e);return!i&&m&&m(),await new Promise((t,n)=>{Ae(t,n,{data:g,headers:Oe.from(s.headers),status:s.status,statusText:s.statusText,config:e,request:p})})}catch(g){if(m&&m(),g&&"TypeError"===g.name&&/Load failed|fetch/i.test(g.message))throw Object.assign(new V("Network Error",V.ERR_NETWORK,e,p),{cause:g.cause||g});throw V.from(g,g&&g.code,e,p)}})};z.forEach(Ze,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(n){}Object.defineProperty(e,"adapterName",{value:t})}});const et=e=>`- ${e}`,tt=e=>z.isFunction(e)||null===e||!1===e,nt=e=>{e=z.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let s=0;s`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new V("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(et).join("\n"):" "+et(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function rt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new we(null,e)}function ot(e){rt(e),e.headers=Oe.from(e.headers),e.data=be.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return nt(e.adapter||me.adapter)(e).then(function(t){return rt(e),t.data=be.call(e,e.transformResponse,t),t.headers=Oe.from(t.headers),t},function(t){return Se(t)||(rt(e),t&&t.response&&(t.response.data=be.call(e,e.transformResponse,t.response),t.response.headers=Oe.from(t.response.headers))),Promise.reject(t)})}const st="1.9.0",it={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{it[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const at={};it.transitional=function(e,t,n){return(r,o,s)=>{if(!1===e)throw new V(function(e,t){return"[Axios v1.9.0] Transitional option '"+e+"'"+t+(n?". "+n:"")}(o," has been removed"+(t?" in "+t:"")),V.ERR_DEPRECATED);return t&&!at[o]&&(at[o]=!0),!e||e(r,o,s)}},it.spelling=function(e){return(e,t)=>!0};const ct={assertOptions:function(e,t,n){if("object"!=typeof e)throw new V("options must be an object",V.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=t[s];if(i){const t=e[s],n=void 0===t||i(t,s,e);if(!0!==n)throw new V("option "+s+" must be "+n,V.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new V("Unknown option "+s,V.ERR_BAD_OPTION)}},validators:it},ut=ct.validators;class lt{constructor(e){this.defaults=e||{},this.interceptors={request:new oe,response:new oe}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{n.stack?t&&!String(n.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(n.stack+="\n"+t):n.stack=t}catch(r){}}throw n}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=je(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&ct.assertOptions(n,{silentJSONParsing:ut.transitional(ut.boolean),forcedJSONParsing:ut.transitional(ut.boolean),clarifyTimeoutError:ut.transitional(ut.boolean)},!1),null!=r&&(z.isFunction(r)?t.paramsSerializer={serialize:r}:ct.assertOptions(r,{encode:ut.function,serialize:ut.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ct.assertOptions(t,{baseUrl:ut.spelling("baseURL"),withXsrfToken:ut.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&z.merge(o.common,o[t.method]);o&&z.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=Oe.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,d=0;if(!a){const e=[ot.bind(this),void 0];for(e.unshift.apply(e,i),e.push.apply(e,c),l=e.length,u=Promise.resolve(t);d{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new we(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new ft(function(t){e=t}),cancel:e}}}const pt=ft;const ht={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ht).forEach(([e,t])=>{ht[t]=e});const mt=ht;const Et=function e(n){const r=new dt(n),o=t(dt.prototype.request,r);return z.extend(o,dt.prototype,r,{allOwnKeys:!0}),z.extend(o,r,null,{allOwnKeys:!0}),o.create=function(t){return e(je(n,t))},o}(me);Et.Axios=dt,Et.CanceledError=we,Et.CancelToken=pt,Et.isCancel=Se,Et.VERSION=st,Et.toFormData=Q,Et.AxiosError=V,Et.Cancel=Et.CanceledError,Et.all=function(e){return Promise.all(e)},Et.spread=function(e){return function(t){return e.apply(null,t)}},Et.isAxiosError=function(e){return z.isObject(e)&&!0===e.isAxiosError},Et.mergeConfig=je,Et.AxiosHeaders=Oe,Et.formToJSON=e=>pe(z.isHTMLForm(e)?new FormData(e):e),Et.getAdapter=nt,Et.HttpStatusCode=mt,Et.default=Et;const gt=Et,_t="https://apimznstg.aireview.ir",Tt={ADMIN_LOGIN:"api/v1/admin/auth/login",GET_DISCOUNT_DETAIL:e=>`api/v1/discount-drafts/${e}`,GET_DRAFT_DETAIL:e=>`api/v1/drafts/${e}`,GET_ADMIN_USERS:"api/v1/admin/admin-users",GET_ADMIN_USER:e=>`api/v1/admin/admin-users/${e}`,CREATE_ADMIN_USER:"api/v1/admin/admin-users",UPDATE_ADMIN_USER:e=>`api/v1/admin/admin-users/${e}`,DELETE_ADMIN_USER:e=>`api/v1/admin/admin-users/${e}`,GET_ROLES:"api/v1/admin/roles",GET_ROLE:e=>`api/v1/admin/roles/${e}`,CREATE_ROLE:"api/v1/admin/roles",UPDATE_ROLE:e=>`api/v1/admin/roles/${e}`,DELETE_ROLE:e=>`api/v1/admin/roles/${e}`,GET_ROLE_PERMISSIONS:e=>`api/v1/admin/roles/${e}/permissions`,ASSIGN_ROLE_PERMISSION:(e,t)=>`api/v1/admin/roles/${e}/permissions/${t}`,REMOVE_ROLE_PERMISSION:(e,t)=>`api/v1/admin/roles/${e}/permissions/${t}`,GET_PERMISSIONS:"api/v1/admin/permissions",GET_PERMISSION:e=>`api/v1/admin/permissions/${e}`,CREATE_PERMISSION:"api/v1/admin/permissions",UPDATE_PERMISSION:e=>`api/v1/admin/permissions/${e}`,DELETE_PERMISSION:e=>`api/v1/admin/permissions/${e}`,GET_PRODUCT_OPTIONS:"api/v1/product-options",GET_PRODUCT_OPTION:e=>`api/v1/product-options/${e}`,CREATE_PRODUCT_OPTION:"api/v1/product-options",UPDATE_PRODUCT_OPTION:e=>`api/v1/product-options/${e}`,DELETE_PRODUCT_OPTION:e=>`api/v1/product-options/${e}`,GET_CATEGORIES:"api/v1/products/categories",GET_CATEGORY:e=>`api/v1/products/categories/${e}`,CREATE_CATEGORY:"api/v1/products/categories",UPDATE_CATEGORY:e=>`api/v1/products/categories/${e}`,DELETE_CATEGORY:e=>`api/v1/products/categories/${e}`,GET_PRODUCTS:"api/v1/products",GET_PRODUCT:e=>`api/v1/products/${e}`,CREATE_PRODUCT:"api/v1/products",UPDATE_PRODUCT:e=>`api/v1/products/${e}`,DELETE_PRODUCT:e=>`api/v1/products/${e}`,GET_PRODUCT_VARIANTS:e=>`api/v1/products/${e}/variants`,CREATE_PRODUCT_VARIANT:e=>`api/v1/products/${e}/variants`,UPDATE_PRODUCT_VARIANT:e=>`api/v1/products/variants/${e}`,DELETE_PRODUCT_VARIANT:e=>`api/v1/products/variants/${e}`,GET_FILES:"api/v1/admin/files",UPLOAD_FILE:"api/v1/admin/files",GET_FILE:e=>`api/v1/admin/files/${e}`,UPDATE_FILE:e=>`api/v1/admin/files/${e}`,DELETE_FILE:e=>`api/v1/admin/files/${e}`,DOWNLOAD_FILE:e=>`api/v1/files/${e}`,GET_IMAGES:"api/v1/images",CREATE_IMAGE:"api/v1/images",UPDATE_IMAGE:e=>`api/v1/products/images/${e}`,DELETE_IMAGE:e=>`api/v1/products/images/${e}`}; +/*! js-cookie v3.0.5 | MIT */ +function Rt(e){for(var t=1;tbt({method:"get",url:e,...t}),wt=(e,t,n)=>bt({method:"post",url:e,data:t,...n}),At=(e,t,n)=>bt({method:"put",url:e,data:t,...n}),vt=(e,t)=>bt({method:"delete",url:e,...t});function Ct(e,t,n){const r=t||{},o=Object.keys(r);let s=`${n||_t}/${e}`;return o.forEach((e,t)=>{0===t&&(s+="?"),null!==r[e]&&void 0!==r[e]&&""!==r[e]&&(s+=`${e}=${r[e]}${t{const t=await(async()=>{const e=localStorage.getItem("admin_token"),t=localStorage.getItem("admin_user");if(e&&t)try{return{token:e,user:JSON.parse(t)}}catch(n){return localStorage.removeItem("admin_token"),localStorage.removeItem("admin_refresh_token"),localStorage.removeItem("admin_user"),localStorage.removeItem("admin_permissions"),null}return null})();return(null==t?void 0:t.token)&&(e.headers.Authorization=`Bearer ${t.token}`),e}),bt.interceptors.response.use(e=>e,e=>{const t=e.response.status;if(yt.remove("jwtToken"),401!==t&&403!==t||"/auth"===location.pathname)throw{...e,message:e.response.data.title};Dt(),window.location.replace({}.VITE_APP_BASE_URL+"auth")});const Pt=async e=>(await wt(Ct(Tt.ADMIN_LOGIN),e)).data,Dt=()=>{localStorage.removeItem("admin_token"),localStorage.removeItem("admin_refresh_token"),localStorage.removeItem("admin_user"),localStorage.removeItem("admin_permissions")};export{Ct as A,e as Q,At as a,vt as b,St as c,Tt as d,wt as h,Pt as p}; diff --git a/dist/assets/index-13d37b48.js b/dist/assets/index-13d37b48.js deleted file mode 100644 index 757e764..0000000 --- a/dist/assets/index-13d37b48.js +++ /dev/null @@ -1,350 +0,0 @@ -var FI=Object.defineProperty;var UI=(e,t,r)=>t in e?FI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ad=(e,t,r)=>(UI(e,typeof t!="symbol"?t+"":t,r),r),ay=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var C=(e,t,r)=>(ay(e,t,"read from private field"),r?r.call(e):t.get(e)),ce=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},ae=(e,t,r,n)=>(ay(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var Pd=(e,t,r,n)=>({set _(a){ae(e,t,a,r)},get _(){return C(e,t,n)}}),je=(e,t,r)=>(ay(e,t,"access private method"),r);function BI(e,t){for(var r=0;rn[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();var Td=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Me(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var QN={exports:{}},Ep={},XN={exports:{}},_e={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var od=Symbol.for("react.element"),zI=Symbol.for("react.portal"),VI=Symbol.for("react.fragment"),qI=Symbol.for("react.strict_mode"),WI=Symbol.for("react.profiler"),GI=Symbol.for("react.provider"),HI=Symbol.for("react.context"),KI=Symbol.for("react.forward_ref"),QI=Symbol.for("react.suspense"),XI=Symbol.for("react.memo"),YI=Symbol.for("react.lazy"),uw=Symbol.iterator;function ZI(e){return e===null||typeof e!="object"?null:(e=uw&&e[uw]||e["@@iterator"],typeof e=="function"?e:null)}var YN={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ZN=Object.assign,JN={};function _l(e,t,r){this.props=e,this.context=t,this.refs=JN,this.updater=r||YN}_l.prototype.isReactComponent={};_l.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};_l.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function eE(){}eE.prototype=_l.prototype;function Ox(e,t,r){this.props=e,this.context=t,this.refs=JN,this.updater=r||YN}var Nx=Ox.prototype=new eE;Nx.constructor=Ox;ZN(Nx,_l.prototype);Nx.isPureReactComponent=!0;var dw=Array.isArray,tE=Object.prototype.hasOwnProperty,Ex={current:null},rE={key:!0,ref:!0,__self:!0,__source:!0};function nE(e,t,r){var n,a={},i=null,s=null;if(t!=null)for(n in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)tE.call(t,n)&&!rE.hasOwnProperty(n)&&(a[n]=t[n]);var o=arguments.length-2;if(o===1)a.children=r;else if(1>>1,K=D[Z];if(0>>1;Za(Ae,H))Dea(st,Ae)?(D[Z]=st,D[De]=H,Z=De):(D[Z]=Ae,D[we]=H,Z=we);else if(Dea(st,H))D[Z]=st,D[De]=H,Z=De;else break e}}return V}function a(D,V){var H=D.sortIndex-V.sortIndex;return H!==0?H:D.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,o=s.now();e.unstable_now=function(){return s.now()-o}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,y=!1,g=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(D){for(var V=r(u);V!==null;){if(V.callback===null)n(u);else if(V.startTime<=D)n(u),V.sortIndex=V.expirationTime,t(c,V);else break;V=r(u)}}function S(D){if(y=!1,v(D),!m)if(r(c)!==null)m=!0,F(w);else{var V=r(u);V!==null&&U(S,V.startTime-D)}}function w(D,V){m=!1,y&&(y=!1,b(_),_=-1),p=!0;var H=h;try{for(v(V),f=r(c);f!==null&&(!(f.expirationTime>V)||D&&!P());){var Z=f.callback;if(typeof Z=="function"){f.callback=null,h=f.priorityLevel;var K=Z(f.expirationTime<=V);V=e.unstable_now(),typeof K=="function"?f.callback=K:f===r(c)&&n(c),v(V)}else n(c);f=r(c)}if(f!==null)var le=!0;else{var we=r(u);we!==null&&U(S,we.startTime-V),le=!1}return le}finally{f=null,h=H,p=!1}}var j=!1,k=null,_=-1,E=5,O=-1;function P(){return!(e.unstable_now()-OD||125Z?(D.sortIndex=H,t(u,D),r(c)===null&&D===r(u)&&(y?(b(_),_=-1):y=!0,U(S,H-Z))):(D.sortIndex=K,t(c,D),m||p||(m=!0,F(w))),D},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(D){var V=h;return function(){var H=h;h=V;try{return D.apply(this,arguments)}finally{h=H}}}})(lE);oE.exports=lE;var uR=oE.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var dR=N,Fr=uR;function Q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),kg=Object.prototype.hasOwnProperty,fR=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,hw={},pw={};function hR(e){return kg.call(pw,e)?!0:kg.call(hw,e)?!1:fR.test(e)?pw[e]=!0:(hw[e]=!0,!1)}function pR(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function mR(e,t,r,n){if(t===null||typeof t>"u"||pR(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function ur(e,t,r,n,a,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=a,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var Bt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Bt[e]=new ur(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Bt[t]=new ur(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Bt[e]=new ur(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Bt[e]=new ur(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Bt[e]=new ur(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Bt[e]=new ur(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Bt[e]=new ur(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Bt[e]=new ur(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Bt[e]=new ur(e,5,!1,e.toLowerCase(),null,!1,!1)});var Px=/[\-:]([a-z])/g;function Tx(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Px,Tx);Bt[t]=new ur(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Px,Tx);Bt[t]=new ur(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Px,Tx);Bt[t]=new ur(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Bt[e]=new ur(e,1,!1,e.toLowerCase(),null,!1,!1)});Bt.xlinkHref=new ur("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Bt[e]=new ur(e,1,!1,e.toLowerCase(),null,!0,!0)});function Cx(e,t,r,n){var a=Bt.hasOwnProperty(t)?Bt[t]:null;(a!==null?a.type!==0:n||!(2o||a[s]!==i[o]){var c=` -`+a[s].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=s&&0<=o);break}}}finally{oy=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?wc(e):""}function yR(e){switch(e.tag){case 5:return wc(e.type);case 16:return wc("Lazy");case 13:return wc("Suspense");case 19:return wc("SuspenseList");case 0:case 2:case 15:return e=ly(e.type,!1),e;case 11:return e=ly(e.type.render,!1),e;case 1:return e=ly(e.type,!0),e;default:return""}}function Eg(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case to:return"Fragment";case eo:return"Portal";case _g:return"Profiler";case $x:return"StrictMode";case Og:return"Suspense";case Ng:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case dE:return(e.displayName||"Context")+".Consumer";case uE:return(e._context.displayName||"Context")+".Provider";case Ix:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Rx:return t=e.displayName||null,t!==null?t:Eg(e.type)||"Memo";case Va:t=e._payload,e=e._init;try{return Eg(e(t))}catch{}}return null}function gR(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Eg(t);case 8:return t===$x?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Si(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function hE(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function vR(e){var t=hE(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var a=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(s){n=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Id(e){e._valueTracker||(e._valueTracker=vR(e))}function pE(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=hE(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Lf(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ag(e,t){var r=t.checked;return it({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function yw(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Si(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function mE(e,t){t=t.checked,t!=null&&Cx(e,"checked",t,!1)}function Pg(e,t){mE(e,t);var r=Si(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Tg(e,t.type,r):t.hasOwnProperty("defaultValue")&&Tg(e,t.type,Si(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function gw(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Tg(e,t,r){(t!=="number"||Lf(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var jc=Array.isArray;function bo(e,t,r,n){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=Rd.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Wc(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Nc={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},xR=["Webkit","ms","Moz","O"];Object.keys(Nc).forEach(function(e){xR.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Nc[t]=Nc[e]})});function xE(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Nc.hasOwnProperty(e)&&Nc[e]?(""+t).trim():t+"px"}function bE(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,a=xE(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,a):e[r]=a}}var bR=it({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ig(e,t){if(t){if(bR[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function Rg(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Mg=null;function Mx(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Dg=null,wo=null,jo=null;function bw(e){if(e=ud(e)){if(typeof Dg!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=$p(t),Dg(e.stateNode,e.type,t))}}function wE(e){wo?jo?jo.push(e):jo=[e]:wo=e}function jE(){if(wo){var e=wo,t=jo;if(jo=wo=null,bw(e),t)for(e=0;e>>=0,e===0?32:31-(TR(e)/CR|0)|0}var Md=64,Dd=4194304;function Sc(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function zf(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,a=e.suspendedLanes,i=e.pingedLanes,s=r&268435455;if(s!==0){var o=s&~a;o!==0?n=Sc(o):(i&=s,i!==0&&(n=Sc(i)))}else s=r&~a,s!==0?n=Sc(s):i!==0&&(n=Sc(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&a)&&(a=n&-n,i=t&-t,a>=i||a===16&&(i&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function ld(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-jn(t),e[t]=r}function MR(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0=Ac),Aw=String.fromCharCode(32),Pw=!1;function zE(e,t){switch(e){case"keyup":return u3.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function VE(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ro=!1;function f3(e,t){switch(e){case"compositionend":return VE(t);case"keypress":return t.which!==32?null:(Pw=!0,Aw);case"textInput":return e=t.data,e===Aw&&Pw?null:e;default:return null}}function h3(e,t){if(ro)return e==="compositionend"||!qx&&zE(e,t)?(e=UE(),vf=Bx=li=null,ro=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Iw(r)}}function HE(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?HE(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function KE(){for(var e=window,t=Lf();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Lf(e.document)}return t}function Wx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function j3(e){var t=KE(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&HE(r.ownerDocument.documentElement,r)){if(n!==null&&Wx(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=r.textContent.length,i=Math.min(n.start,a);n=n.end===void 0?i:Math.min(n.end,a),!e.extend&&i>n&&(a=n,n=i,i=a),a=Rw(r,i);var s=Rw(r,n);a&&s&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),i>n?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,no=null,Vg=null,Tc=null,qg=!1;function Mw(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;qg||no==null||no!==Lf(n)||(n=no,"selectionStart"in n&&Wx(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Tc&&Yc(Tc,n)||(Tc=n,n=Wf(Vg,"onSelect"),0so||(e.current=Xg[so],Xg[so]=null,so--)}function Ge(e,t){so++,Xg[so]=e.current,e.current=t}var ki={},Xt=Oi(ki),xr=Oi(!1),ys=ki;function Wo(e,t){var r=e.type.contextTypes;if(!r)return ki;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in r)a[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function br(e){return e=e.childContextTypes,e!=null}function Hf(){Ye(xr),Ye(Xt)}function Vw(e,t,r){if(Xt.current!==ki)throw Error(Q(168));Ge(Xt,t),Ge(xr,r)}function n2(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var a in n)if(!(a in t))throw Error(Q(108,gR(e)||"Unknown",a));return it({},r,n)}function Kf(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ki,ys=Xt.current,Ge(Xt,e),Ge(xr,xr.current),!0}function qw(e,t,r){var n=e.stateNode;if(!n)throw Error(Q(169));r?(e=n2(e,t,ys),n.__reactInternalMemoizedMergedChildContext=e,Ye(xr),Ye(Xt),Ge(Xt,e)):Ye(xr),Ge(xr,r)}var oa=null,Ip=!1,jy=!1;function a2(e){oa===null?oa=[e]:oa.push(e)}function I3(e){Ip=!0,a2(e)}function Ni(){if(!jy&&oa!==null){jy=!0;var e=0,t=Fe;try{var r=oa;for(Fe=1;e>=s,a-=s,ua=1<<32-jn(t)+a|r<_?(E=k,k=null):E=k.sibling;var O=h(b,k,v[_],S);if(O===null){k===null&&(k=E);break}e&&k&&O.alternate===null&&t(b,k),x=i(O,x,_),j===null?w=O:j.sibling=O,j=O,k=E}if(_===v.length)return r(b,k),Je&&Mi(b,_),w;if(k===null){for(;__?(E=k,k=null):E=k.sibling;var P=h(b,k,O.value,S);if(P===null){k===null&&(k=E);break}e&&k&&P.alternate===null&&t(b,k),x=i(P,x,_),j===null?w=P:j.sibling=P,j=P,k=E}if(O.done)return r(b,k),Je&&Mi(b,_),w;if(k===null){for(;!O.done;_++,O=v.next())O=f(b,O.value,S),O!==null&&(x=i(O,x,_),j===null?w=O:j.sibling=O,j=O);return Je&&Mi(b,_),w}for(k=n(b,k);!O.done;_++,O=v.next())O=p(k,b,_,O.value,S),O!==null&&(e&&O.alternate!==null&&k.delete(O.key===null?_:O.key),x=i(O,x,_),j===null?w=O:j.sibling=O,j=O);return e&&k.forEach(function(T){return t(b,T)}),Je&&Mi(b,_),w}function g(b,x,v,S){if(typeof v=="object"&&v!==null&&v.type===to&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case $d:e:{for(var w=v.key,j=x;j!==null;){if(j.key===w){if(w=v.type,w===to){if(j.tag===7){r(b,j.sibling),x=a(j,v.props.children),x.return=b,b=x;break e}}else if(j.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===Va&&Hw(w)===j.type){r(b,j.sibling),x=a(j,v.props),x.ref=nc(b,j,v),x.return=b,b=x;break e}r(b,j);break}else t(b,j);j=j.sibling}v.type===to?(x=us(v.props.children,b.mode,S,v.key),x.return=b,b=x):(S=Of(v.type,v.key,v.props,null,b.mode,S),S.ref=nc(b,x,v),S.return=b,b=S)}return s(b);case eo:e:{for(j=v.key;x!==null;){if(x.key===j)if(x.tag===4&&x.stateNode.containerInfo===v.containerInfo&&x.stateNode.implementation===v.implementation){r(b,x.sibling),x=a(x,v.children||[]),x.return=b,b=x;break e}else{r(b,x);break}else t(b,x);x=x.sibling}x=Py(v,b.mode,S),x.return=b,b=x}return s(b);case Va:return j=v._init,g(b,x,j(v._payload),S)}if(jc(v))return m(b,x,v,S);if(Zl(v))return y(b,x,v,S);qd(b,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,x!==null&&x.tag===6?(r(b,x.sibling),x=a(x,v),x.return=b,b=x):(r(b,x),x=Ay(v,b.mode,S),x.return=b,b=x),s(b)):r(b,x)}return g}var Ho=l2(!0),c2=l2(!1),Yf=Oi(null),Zf=null,co=null,Qx=null;function Xx(){Qx=co=Zf=null}function Yx(e){var t=Yf.current;Ye(Yf),e._currentValue=t}function Jg(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function ko(e,t){Zf=e,Qx=co=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(yr=!0),e.firstContext=null)}function rn(e){var t=e._currentValue;if(Qx!==e)if(e={context:e,memoizedValue:t,next:null},co===null){if(Zf===null)throw Error(Q(308));co=e,Zf.dependencies={lanes:0,firstContext:e}}else co=co.next=e;return t}var qi=null;function Zx(e){qi===null?qi=[e]:qi.push(e)}function u2(e,t,r,n){var a=t.interleaved;return a===null?(r.next=r,Zx(t)):(r.next=a.next,a.next=r),t.interleaved=r,ja(e,n)}function ja(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var qa=!1;function Jx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function d2(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ma(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function yi(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Ee&2){var a=n.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),n.pending=t,ja(e,r)}return a=n.interleaved,a===null?(t.next=t,Zx(n)):(t.next=a.next,a.next=t),n.interleaved=t,ja(e,r)}function bf(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Lx(e,r)}}function Kw(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var a=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var s={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?a=i=s:i=i.next=s,r=r.next}while(r!==null);i===null?a=i=t:i=i.next=t}else a=i=t;r={baseState:n.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Jf(e,t,r,n){var a=e.updateQueue;qa=!1;var i=a.firstBaseUpdate,s=a.lastBaseUpdate,o=a.shared.pending;if(o!==null){a.shared.pending=null;var c=o,u=c.next;c.next=null,s===null?i=u:s.next=u,s=c;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==s&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=a.baseState;s=0,d=u=c=null,o=i;do{var h=o.lane,p=o.eventTime;if((n&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var m=e,y=o;switch(h=t,p=r,y.tag){case 1:if(m=y.payload,typeof m=="function"){f=m.call(p,f,h);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=y.payload,h=typeof m=="function"?m.call(p,f,h):m,h==null)break e;f=it({},f,h);break e;case 2:qa=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=a.effects,h===null?a.effects=[o]:h.push(o))}else p={eventTime:p,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,s|=h;if(o=o.next,o===null){if(o=a.shared.pending,o===null)break;h=o,o=h.next,h.next=null,a.lastBaseUpdate=h,a.shared.pending=null}}while(1);if(d===null&&(c=f),a.baseState=c,a.firstBaseUpdate=u,a.lastBaseUpdate=d,t=a.shared.interleaved,t!==null){a=t;do s|=a.lane,a=a.next;while(a!==t)}else i===null&&(a.shared.lanes=0);xs|=s,e.lanes=s,e.memoizedState=f}}function Qw(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var n=ky.transition;ky.transition={};try{e(!1),t()}finally{Fe=r,ky.transition=n}}function E2(){return nn().memoizedState}function L3(e,t,r){var n=vi(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},A2(e))P2(t,r);else if(r=u2(e,t,r,n),r!==null){var a=lr();Sn(r,e,n,a),T2(r,t,n)}}function F3(e,t,r){var n=vi(e),a={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(A2(e))P2(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,o=i(s,r);if(a.hasEagerState=!0,a.eagerState=o,On(o,s)){var c=t.interleaved;c===null?(a.next=a,Zx(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}r=u2(e,t,a,n),r!==null&&(a=lr(),Sn(r,e,n,a),T2(r,t,n))}}function A2(e){var t=e.alternate;return e===nt||t!==null&&t===nt}function P2(e,t){Cc=th=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function T2(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Lx(e,r)}}var rh={readContext:rn,useCallback:Vt,useContext:Vt,useEffect:Vt,useImperativeHandle:Vt,useInsertionEffect:Vt,useLayoutEffect:Vt,useMemo:Vt,useReducer:Vt,useRef:Vt,useState:Vt,useDebugValue:Vt,useDeferredValue:Vt,useTransition:Vt,useMutableSource:Vt,useSyncExternalStore:Vt,useId:Vt,unstable_isNewReconciler:!1},U3={readContext:rn,useCallback:function(e,t){return Cn().memoizedState=[e,t===void 0?null:t],e},useContext:rn,useEffect:Yw,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,jf(4194308,4,S2.bind(null,t,e),r)},useLayoutEffect:function(e,t){return jf(4194308,4,e,t)},useInsertionEffect:function(e,t){return jf(4,2,e,t)},useMemo:function(e,t){var r=Cn();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=Cn();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=L3.bind(null,nt,e),[n.memoizedState,e]},useRef:function(e){var t=Cn();return e={current:e},t.memoizedState=e},useState:Xw,useDebugValue:ob,useDeferredValue:function(e){return Cn().memoizedState=e},useTransition:function(){var e=Xw(!1),t=e[0];return e=D3.bind(null,e[1]),Cn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=nt,a=Cn();if(Je){if(r===void 0)throw Error(Q(407));r=r()}else{if(r=t(),Mt===null)throw Error(Q(349));vs&30||m2(n,t,r)}a.memoizedState=r;var i={value:r,getSnapshot:t};return a.queue=i,Yw(g2.bind(null,n,i,e),[e]),n.flags|=2048,iu(9,y2.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=Cn(),t=Mt.identifierPrefix;if(Je){var r=da,n=ua;r=(n&~(1<<32-jn(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=nu++,0<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=s.createElement(r,{is:n.is}):(e=s.createElement(r),r==="select"&&(s=e,n.multiple?s.multiple=!0:n.size&&(s.size=n.size))):e=s.createElementNS(e,r),e[Ln]=t,e[eu]=n,B2(e,t,!1,!1),t.stateNode=e;e:{switch(s=Rg(r,n),r){case"dialog":Ke("cancel",e),Ke("close",e),a=n;break;case"iframe":case"object":case"embed":Ke("load",e),a=n;break;case"video":case"audio":for(a=0;aXo&&(t.flags|=128,n=!0,ac(i,!1),t.lanes=4194304)}else{if(!n)if(e=eh(s),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),ac(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Je)return qt(t),null}else 2*pt()-i.renderingStartTime>Xo&&r!==1073741824&&(t.flags|=128,n=!0,ac(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(r=i.last,r!==null?r.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=pt(),t.sibling=null,r=rt.current,Ge(rt,n?r&1|2:r&1),t):(qt(t),null);case 22:case 23:return hb(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Pr&1073741824&&(qt(t),t.subtreeFlags&6&&(t.flags|=8192)):qt(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function K3(e,t){switch(Hx(t),t.tag){case 1:return br(t.type)&&Hf(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ko(),Ye(xr),Ye(Xt),rb(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return tb(t),null;case 13:if(Ye(rt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));Go()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ye(rt),null;case 4:return Ko(),null;case 10:return Yx(t.type._context),null;case 22:case 23:return hb(),null;case 24:return null;default:return null}}var Gd=!1,Ht=!1,Q3=typeof WeakSet=="function"?WeakSet:Set,ie=null;function uo(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ut(e,t,n)}else r.current=null}function l0(e,t,r){try{r()}catch(n){ut(e,t,n)}}var lj=!1;function X3(e,t){if(Wg=Vf,e=KE(),Wx(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var a=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var s=0,o=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==r||a!==0&&f.nodeType!==3||(o=s+a),f!==i||n!==0&&f.nodeType!==3||(c=s+n),f.nodeType===3&&(s+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===r&&++u===a&&(o=s),h===i&&++d===n&&(c=s),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}r=o===-1||c===-1?null:{start:o,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(Gg={focusedElem:e,selectionRange:r},Vf=!1,ie=t;ie!==null;)if(t=ie,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ie=e;else for(;ie!==null;){t=ie;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,g=m.memoizedState,b=t.stateNode,x=b.getSnapshotBeforeUpdate(t.elementType===t.type?y:un(t.type,y),g);b.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(S){ut(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,ie=e;break}ie=t.return}return m=lj,lj=!1,m}function $c(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var a=n=n.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&l0(t,r,i)}a=a.next}while(a!==n)}}function Dp(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function c0(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function q2(e){var t=e.alternate;t!==null&&(e.alternate=null,q2(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ln],delete t[eu],delete t[Qg],delete t[C3],delete t[$3])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function W2(e){return e.tag===5||e.tag===3||e.tag===4}function cj(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||W2(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function u0(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Gf));else if(n!==4&&(e=e.child,e!==null))for(u0(e,t,r),e=e.sibling;e!==null;)u0(e,t,r),e=e.sibling}function d0(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(d0(e,t,r),e=e.sibling;e!==null;)d0(e,t,r),e=e.sibling}var Ft=null,hn=!1;function La(e,t,r){for(r=r.child;r!==null;)G2(e,t,r),r=r.sibling}function G2(e,t,r){if(Bn&&typeof Bn.onCommitFiberUnmount=="function")try{Bn.onCommitFiberUnmount(Ap,r)}catch{}switch(r.tag){case 5:Ht||uo(r,t);case 6:var n=Ft,a=hn;Ft=null,La(e,t,r),Ft=n,hn=a,Ft!==null&&(hn?(e=Ft,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Ft.removeChild(r.stateNode));break;case 18:Ft!==null&&(hn?(e=Ft,r=r.stateNode,e.nodeType===8?wy(e.parentNode,r):e.nodeType===1&&wy(e,r),Qc(e)):wy(Ft,r.stateNode));break;case 4:n=Ft,a=hn,Ft=r.stateNode.containerInfo,hn=!0,La(e,t,r),Ft=n,hn=a;break;case 0:case 11:case 14:case 15:if(!Ht&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){a=n=n.next;do{var i=a,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&l0(r,t,s),a=a.next}while(a!==n)}La(e,t,r);break;case 1:if(!Ht&&(uo(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(o){ut(r,t,o)}La(e,t,r);break;case 21:La(e,t,r);break;case 22:r.mode&1?(Ht=(n=Ht)||r.memoizedState!==null,La(e,t,r),Ht=n):La(e,t,r);break;default:La(e,t,r)}}function uj(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Q3),t.forEach(function(n){var a=iM.bind(null,e,n);r.has(n)||(r.add(n),n.then(a,a))})}}function ln(e,t){var r=t.deletions;if(r!==null)for(var n=0;na&&(a=s),n&=~i}if(n=a,n=pt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Z3(n/1960))-n,10e?16:e,ci===null)var n=!1;else{if(e=ci,ci=null,ih=0,Ee&6)throw Error(Q(331));var a=Ee;for(Ee|=4,ie=e.current;ie!==null;){var i=ie,s=i.child;if(ie.flags&16){var o=i.deletions;if(o!==null){for(var c=0;cpt()-db?cs(e,0):ub|=r),wr(e,t)}function eA(e,t){t===0&&(e.mode&1?(t=Dd,Dd<<=1,!(Dd&130023424)&&(Dd=4194304)):t=1);var r=lr();e=ja(e,t),e!==null&&(ld(e,t,r),wr(e,r))}function aM(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),eA(e,r)}function iM(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,a=e.memoizedState;a!==null&&(r=a.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(Q(314))}n!==null&&n.delete(t),eA(e,r)}var tA;tA=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||xr.current)yr=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return yr=!1,G3(e,t,r);yr=!!(e.flags&131072)}else yr=!1,Je&&t.flags&1048576&&i2(t,Xf,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Sf(e,t),e=t.pendingProps;var a=Wo(t,Xt.current);ko(t,r),a=ab(null,t,n,e,a,r);var i=ib();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,br(n)?(i=!0,Kf(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Jx(t),a.updater=Mp,t.stateNode=a,a._reactInternals=t,t0(t,n,e,r),t=a0(null,t,n,!0,i,r)):(t.tag=0,Je&&i&&Gx(t),rr(null,t,a,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Sf(e,t),e=t.pendingProps,a=n._init,n=a(n._payload),t.type=n,a=t.tag=oM(n),e=un(n,e),a){case 0:t=n0(null,t,n,e,r);break e;case 1:t=ij(null,t,n,e,r);break e;case 11:t=nj(null,t,n,e,r);break e;case 14:t=aj(null,t,n,un(n.type,e),r);break e}throw Error(Q(306,n,""))}return t;case 0:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:un(n,a),n0(e,t,n,a,r);case 1:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:un(n,a),ij(e,t,n,a,r);case 3:e:{if(L2(t),e===null)throw Error(Q(387));n=t.pendingProps,i=t.memoizedState,a=i.element,d2(e,t),Jf(t,n,null,r);var s=t.memoizedState;if(n=s.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=Qo(Error(Q(423)),t),t=sj(e,t,n,r,a);break e}else if(n!==a){a=Qo(Error(Q(424)),t),t=sj(e,t,n,r,a);break e}else for(Ir=mi(t.stateNode.containerInfo.firstChild),Rr=t,Je=!0,yn=null,r=c2(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Go(),n===a){t=Sa(e,t,r);break e}rr(e,t,n,r)}t=t.child}return t;case 5:return f2(t),e===null&&Zg(t),n=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,s=a.children,Hg(n,a)?s=null:i!==null&&Hg(n,i)&&(t.flags|=32),D2(e,t),rr(e,t,s,r),t.child;case 6:return e===null&&Zg(t),null;case 13:return F2(e,t,r);case 4:return eb(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Ho(t,null,n,r):rr(e,t,n,r),t.child;case 11:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:un(n,a),nj(e,t,n,a,r);case 7:return rr(e,t,t.pendingProps,r),t.child;case 8:return rr(e,t,t.pendingProps.children,r),t.child;case 12:return rr(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,a=t.pendingProps,i=t.memoizedProps,s=a.value,Ge(Yf,n._currentValue),n._currentValue=s,i!==null)if(On(i.value,s)){if(i.children===a.children&&!xr.current){t=Sa(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var o=i.dependencies;if(o!==null){s=i.child;for(var c=o.firstContext;c!==null;){if(c.context===n){if(i.tag===1){c=ma(-1,r&-r),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=r,c=i.alternate,c!==null&&(c.lanes|=r),Jg(i.return,r,t),o.lanes|=r;break}c=c.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(Q(341));s.lanes|=r,o=s.alternate,o!==null&&(o.lanes|=r),Jg(s,r,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}rr(e,t,a.children,r),t=t.child}return t;case 9:return a=t.type,n=t.pendingProps.children,ko(t,r),a=rn(a),n=n(a),t.flags|=1,rr(e,t,n,r),t.child;case 14:return n=t.type,a=un(n,t.pendingProps),a=un(n.type,a),aj(e,t,n,a,r);case 15:return R2(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:un(n,a),Sf(e,t),t.tag=1,br(n)?(e=!0,Kf(t)):e=!1,ko(t,r),C2(t,n,a),t0(t,n,a,r),a0(null,t,n,!0,e,r);case 19:return U2(e,t,r);case 22:return M2(e,t,r)}throw Error(Q(156,t.tag))};function rA(e,t){return AE(e,t)}function sM(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Jr(e,t,r,n){return new sM(e,t,r,n)}function mb(e){return e=e.prototype,!(!e||!e.isReactComponent)}function oM(e){if(typeof e=="function")return mb(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ix)return 11;if(e===Rx)return 14}return 2}function xi(e,t){var r=e.alternate;return r===null?(r=Jr(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Of(e,t,r,n,a,i){var s=2;if(n=e,typeof e=="function")mb(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case to:return us(r.children,a,i,t);case $x:s=8,a|=8;break;case _g:return e=Jr(12,r,t,a|2),e.elementType=_g,e.lanes=i,e;case Og:return e=Jr(13,r,t,a),e.elementType=Og,e.lanes=i,e;case Ng:return e=Jr(19,r,t,a),e.elementType=Ng,e.lanes=i,e;case fE:return Fp(r,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case uE:s=10;break e;case dE:s=9;break e;case Ix:s=11;break e;case Rx:s=14;break e;case Va:s=16,n=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=Jr(s,r,t,a),t.elementType=e,t.type=n,t.lanes=i,t}function us(e,t,r,n){return e=Jr(7,e,n,t),e.lanes=r,e}function Fp(e,t,r,n){return e=Jr(22,e,n,t),e.elementType=fE,e.lanes=r,e.stateNode={isHidden:!1},e}function Ay(e,t,r){return e=Jr(6,e,null,t),e.lanes=r,e}function Py(e,t,r){return t=Jr(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function lM(e,t,r,n,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=uy(0),this.expirationTimes=uy(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=uy(0),this.identifierPrefix=n,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function yb(e,t,r,n,a,i,s,o,c){return e=new lM(e,t,r,o,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Jr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Jx(i),e}function cM(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(sA)}catch(e){console.error(e)}}sA(),sE.exports=Br;var pM=sE.exports,vj=pM;Sg.createRoot=vj.createRoot,Sg.hydrateRoot=vj.hydrateRoot;/** - * @remix-run/router v1.23.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function ou(){return ou=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function oA(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function yM(){return Math.random().toString(36).substr(2,8)}function bj(e,t){return{usr:e.state,key:e.key,idx:t}}function y0(e,t,r,n){return r===void 0&&(r=null),ou({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?El(t):t,{state:r,key:t&&t.key||n||yM()})}function lh(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function El(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function gM(e,t,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:i=!1}=n,s=a.history,o=ui.Pop,c=null,u=d();u==null&&(u=0,s.replaceState(ou({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function f(){o=ui.Pop;let g=d(),b=g==null?null:g-u;u=g,c&&c({action:o,location:y.location,delta:b})}function h(g,b){o=ui.Push;let x=y0(y.location,g,b);r&&r(x,g),u=d()+1;let v=bj(x,u),S=y.createHref(x);try{s.pushState(v,"",S)}catch(w){if(w instanceof DOMException&&w.name==="DataCloneError")throw w;a.location.assign(S)}i&&c&&c({action:o,location:y.location,delta:1})}function p(g,b){o=ui.Replace;let x=y0(y.location,g,b);r&&r(x,g),u=d();let v=bj(x,u),S=y.createHref(x);s.replaceState(v,"",S),i&&c&&c({action:o,location:y.location,delta:0})}function m(g){let b=a.location.origin!=="null"?a.location.origin:a.location.href,x=typeof g=="string"?g:lh(g);return x=x.replace(/ $/,"%20"),at(b,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,b)}let y={get action(){return o},get location(){return e(a,s)},listen(g){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(xj,f),c=g,()=>{a.removeEventListener(xj,f),c=null}},createHref(g){return t(a,g)},createURL:m,encodeLocation(g){let b=m(g);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:h,replace:p,go(g){return s.go(g)}};return y}var wj;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(wj||(wj={}));function vM(e,t,r){return r===void 0&&(r="/"),xM(e,t,r,!1)}function xM(e,t,r,n){let a=typeof t=="string"?El(t):t,i=Yo(a.pathname||"/",r);if(i==null)return null;let s=lA(e);bM(s);let o=null;for(let c=0;o==null&&c{let c={relativePath:o===void 0?i.path||"":o,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};c.relativePath.startsWith("/")&&(at(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let u=bi([n,c.relativePath]),d=r.concat(c);i.children&&i.children.length>0&&(at(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),lA(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:NM(u,i.index),routesMeta:d})};return e.forEach((i,s)=>{var o;if(i.path===""||!((o=i.path)!=null&&o.includes("?")))a(i,s);else for(let c of cA(i.path))a(i,s,c)}),t}function cA(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return a?[i,""]:[i];let s=cA(n.join("/")),o=[];return o.push(...s.map(c=>c===""?i:[i,c].join("/"))),a&&o.push(...s),o.map(c=>e.startsWith("/")&&c===""?"/":c)}function bM(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:EM(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const wM=/^:[\w-]+$/,jM=3,SM=2,kM=1,_M=10,OM=-2,jj=e=>e==="*";function NM(e,t){let r=e.split("/"),n=r.length;return r.some(jj)&&(n+=OM),t&&(n+=SM),r.filter(a=>!jj(a)).reduce((a,i)=>a+(wM.test(i)?jM:i===""?kM:_M),n)}function EM(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function AM(e,t,r){r===void 0&&(r=!1);let{routesMeta:n}=e,a={},i="/",s=[];for(let o=0;o{let{paramName:h,isOptional:p}=d;if(h==="*"){let y=o[f]||"";s=i.slice(0,i.length-y.length).replace(/(.)\/+$/,"$1")}const m=o[f];return p&&!m?u[h]=void 0:u[h]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:s,pattern:e}}function PM(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),oA(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,o,c)=>(n.push({paramName:o,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function TM(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return oA(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Yo(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}function CM(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?El(e):e;return{pathname:r?r.startsWith("/")?r:$M(r,t):t,search:MM(n),hash:DM(a)}}function $M(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function Ty(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function IM(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function bb(e,t){let r=IM(e);return t?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function wb(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=El(e):(a=ou({},e),at(!a.pathname||!a.pathname.includes("?"),Ty("?","pathname","search",a)),at(!a.pathname||!a.pathname.includes("#"),Ty("#","pathname","hash",a)),at(!a.search||!a.search.includes("#"),Ty("#","search","hash",a)));let i=e===""||a.pathname==="",s=i?"/":a.pathname,o;if(s==null)o=r;else{let f=t.length-1;if(!n&&s.startsWith("..")){let h=s.split("/");for(;h[0]==="..";)h.shift(),f-=1;a.pathname=h.join("/")}o=f>=0?t[f]:"/"}let c=CM(a,o),u=s&&s!=="/"&&s.endsWith("/"),d=(i||s===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const bi=e=>e.join("/").replace(/\/\/+/g,"/"),RM=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),MM=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,DM=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function LM(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const uA=["post","put","patch","delete"];new Set(uA);const FM=["get",...uA];new Set(FM);/** - * React Router v6.30.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function lu(){return lu=Object.assign?Object.assign.bind():function(e){for(var t=1;t{o.current=!0}),N.useCallback(function(u,d){if(d===void 0&&(d={}),!o.current)return;if(typeof u=="number"){n.go(u);return}let f=wb(u,JSON.parse(s),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:bi([t,f.pathname])),(d.replace?n.replace:n.push)(f,d.state,d)},[t,n,s,i,e])}const zM=N.createContext(null);function VM(e){let t=N.useContext(Hn).outlet;return t&&N.createElement(zM.Provider,{value:e},t)}function Kn(){let{matches:e}=N.useContext(Hn),t=e[e.length-1];return t?t.params:{}}function Gp(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=N.useContext(Pa),{matches:a}=N.useContext(Hn),{pathname:i}=Pl(),s=JSON.stringify(bb(a,n.v7_relativeSplatPath));return N.useMemo(()=>wb(e,JSON.parse(s),i,r==="path"),[e,s,i,r])}function qM(e,t){return WM(e,t)}function WM(e,t,r,n){Al()||at(!1);let{navigator:a}=N.useContext(Pa),{matches:i}=N.useContext(Hn),s=i[i.length-1],o=s?s.params:{};s&&s.pathname;let c=s?s.pathnameBase:"/";s&&s.route;let u=Pl(),d;if(t){var f;let g=typeof t=="string"?El(t):t;c==="/"||(f=g.pathname)!=null&&f.startsWith(c)||at(!1),d=g}else d=u;let h=d.pathname||"/",p=h;if(c!=="/"){let g=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(g.length).join("/")}let m=vM(e,{pathname:p}),y=XM(m&&m.map(g=>Object.assign({},g,{params:Object.assign({},o,g.params),pathname:bi([c,a.encodeLocation?a.encodeLocation(g.pathname).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?c:bi([c,a.encodeLocation?a.encodeLocation(g.pathnameBase).pathname:g.pathnameBase])})),i,r,n);return t&&y?N.createElement(Wp.Provider,{value:{location:lu({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:ui.Pop}},y):y}function GM(){let e=e4(),t=LM(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},i=null;return N.createElement(N.Fragment,null,N.createElement("h2",null,"Unexpected Application Error!"),N.createElement("h3",{style:{fontStyle:"italic"}},t),r?N.createElement("pre",{style:a},r):null,i)}const HM=N.createElement(GM,null);class KM extends N.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?N.createElement(Hn.Provider,{value:this.props.routeContext},N.createElement(fA.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function QM(e){let{routeContext:t,match:r,children:n}=e,a=N.useContext(qp);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),N.createElement(Hn.Provider,{value:t},n)}function XM(e,t,r,n){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var i;if(!r)return null;if(r.errors)e=r.matches;else if((i=n)!=null&&i.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,o=(a=r)==null?void 0:a.errors;if(o!=null){let d=s.findIndex(f=>f.route.id&&(o==null?void 0:o[f.route.id])!==void 0);d>=0||at(!1),s=s.slice(0,Math.min(s.length,d+1))}let c=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((d,f,h)=>{let p,m=!1,y=null,g=null;r&&(p=o&&f.route.id?o[f.route.id]:void 0,y=f.route.errorElement||HM,c&&(u<0&&h===0?(r4("route-fallback",!1),m=!0,g=null):u===h&&(m=!0,g=f.route.hydrateFallbackElement||null)));let b=t.concat(s.slice(0,h+1)),x=()=>{let v;return p?v=y:m?v=g:f.route.Component?v=N.createElement(f.route.Component,null):f.route.element?v=f.route.element:v=d,N.createElement(QM,{match:f,routeContext:{outlet:d,matches:b,isDataRoute:r!=null},children:v})};return r&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?N.createElement(KM,{location:r.location,revalidation:r.revalidation,component:y,error:p,children:x(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):x()},null)}var pA=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(pA||{}),uh=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(uh||{});function YM(e){let t=N.useContext(qp);return t||at(!1),t}function ZM(e){let t=N.useContext(dA);return t||at(!1),t}function JM(e){let t=N.useContext(Hn);return t||at(!1),t}function mA(e){let t=JM(),r=t.matches[t.matches.length-1];return r.route.id||at(!1),r.route.id}function e4(){var e;let t=N.useContext(fA),r=ZM(uh.UseRouteError),n=mA(uh.UseRouteError);return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function t4(){let{router:e}=YM(pA.UseNavigateStable),t=mA(uh.UseNavigateStable),r=N.useRef(!1);return hA(()=>{r.current=!0}),N.useCallback(function(a,i){i===void 0&&(i={}),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,lu({fromRouteId:t},i)))},[e,t])}const Sj={};function r4(e,t,r){!t&&!Sj[e]&&(Sj[e]=!0)}function n4(e,t){e==null||e.v7_startTransition,(e==null?void 0:e.v7_relativeSplatPath)===void 0&&(!t||t.v7_relativeSplatPath),t&&(t.v7_fetcherPersist,t.v7_normalizeFormMethod,t.v7_partialHydration,t.v7_skipActionErrorRevalidation)}function yA(e){let{to:t,replace:r,state:n,relative:a}=e;Al()||at(!1);let{future:i,static:s}=N.useContext(Pa),{matches:o}=N.useContext(Hn),{pathname:c}=Pl(),u=St(),d=wb(t,bb(o,i.v7_relativeSplatPath),c,a==="path"),f=JSON.stringify(d);return N.useEffect(()=>u(JSON.parse(f),{replace:r,state:n,relative:a}),[u,f,a,r,n]),null}function a4(e){return VM(e.context)}function Ie(e){at(!1)}function i4(e){let{basename:t="/",children:r=null,location:n,navigationType:a=ui.Pop,navigator:i,static:s=!1,future:o}=e;Al()&&at(!1);let c=t.replace(/^\/*/,"/"),u=N.useMemo(()=>({basename:c,navigator:i,static:s,future:lu({v7_relativeSplatPath:!1},o)}),[c,o,i,s]);typeof n=="string"&&(n=El(n));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:m="default"}=n,y=N.useMemo(()=>{let g=Yo(d,c);return g==null?null:{location:{pathname:g,search:f,hash:h,state:p,key:m},navigationType:a}},[c,d,f,h,p,m,a]);return y==null?null:N.createElement(Pa.Provider,{value:u},N.createElement(Wp.Provider,{children:r,value:y}))}function s4(e){let{children:t,location:r}=e;return qM(g0(t),r)}new Promise(()=>{});function g0(e,t){t===void 0&&(t=[]);let r=[];return N.Children.forEach(e,(n,a)=>{if(!N.isValidElement(n))return;let i=[...t,a];if(n.type===N.Fragment){r.push.apply(r,g0(n.props.children,i));return}n.type!==Ie&&at(!1),!n.props.index||!n.props.children||at(!1);let s={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=g0(n.props.children,i)),r.push(s)}),r}/** - * React Router DOM v6.30.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function dh(){return dh=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(r[a]=e[a]);return r}function o4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function l4(e,t){return e.button===0&&(!t||t==="_self")&&!o4(e)}const c4=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],u4=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],d4="6";try{window.__reactRouterVersion=d4}catch{}const f4=N.createContext({isTransitioning:!1}),h4="startTransition",kj=nR[h4];function p4(e){let{basename:t,children:r,future:n,window:a}=e,i=N.useRef();i.current==null&&(i.current=mM({window:a,v5Compat:!0}));let s=i.current,[o,c]=N.useState({action:s.action,location:s.location}),{v7_startTransition:u}=n||{},d=N.useCallback(f=>{u&&kj?kj(()=>c(f)):c(f)},[c,u]);return N.useLayoutEffect(()=>s.listen(d),[s,d]),N.useEffect(()=>n4(n),[n]),N.createElement(i4,{basename:t,children:r,location:o.location,navigationType:o.action,navigator:s,future:n})}const m4=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",y4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,g4=N.forwardRef(function(t,r){let{onClick:n,relative:a,reloadDocument:i,replace:s,state:o,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,h=gA(t,c4),{basename:p}=N.useContext(Pa),m,y=!1;if(typeof u=="string"&&y4.test(u)&&(m=u,m4))try{let v=new URL(window.location.href),S=u.startsWith("//")?new URL(v.protocol+u):new URL(u),w=Yo(S.pathname,p);S.origin===v.origin&&w!=null?u=w+S.search+S.hash:y=!0}catch{}let g=UM(u,{relative:a}),b=b4(u,{replace:s,state:o,target:c,preventScrollReset:d,relative:a,viewTransition:f});function x(v){n&&n(v),v.defaultPrevented||b(v)}return N.createElement("a",dh({},h,{href:m||g,onClick:y||i?n:x,ref:r,target:c}))}),v4=N.forwardRef(function(t,r){let{"aria-current":n="page",caseSensitive:a=!1,className:i="",end:s=!1,style:o,to:c,viewTransition:u,children:d}=t,f=gA(t,u4),h=Gp(c,{relative:f.relative}),p=Pl(),m=N.useContext(dA),{navigator:y,basename:g}=N.useContext(Pa),b=m!=null&&w4(h)&&u===!0,x=y.encodeLocation?y.encodeLocation(h).pathname:h.pathname,v=p.pathname,S=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;a||(v=v.toLowerCase(),S=S?S.toLowerCase():null,x=x.toLowerCase()),S&&g&&(S=Yo(S,g)||S);const w=x!=="/"&&x.endsWith("/")?x.length-1:x.length;let j=v===x||!s&&v.startsWith(x)&&v.charAt(w)==="/",k=S!=null&&(S===x||!s&&S.startsWith(x)&&S.charAt(x.length)==="/"),_={isActive:j,isPending:k,isTransitioning:b},E=j?n:void 0,O;typeof i=="function"?O=i(_):O=[i,j?"active":null,k?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let P=typeof o=="function"?o(_):o;return N.createElement(g4,dh({},f,{"aria-current":E,className:O,ref:r,style:P,to:c,viewTransition:u}),typeof d=="function"?d(_):d)});var v0;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(v0||(v0={}));var _j;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(_j||(_j={}));function x4(e){let t=N.useContext(qp);return t||at(!1),t}function b4(e,t){let{target:r,replace:n,state:a,preventScrollReset:i,relative:s,viewTransition:o}=t===void 0?{}:t,c=St(),u=Pl(),d=Gp(e,{relative:s});return N.useCallback(f=>{if(l4(f,r)){f.preventDefault();let h=n!==void 0?n:lh(u)===lh(d);c(e,{replace:h,state:a,preventScrollReset:i,relative:s,viewTransition:o})}},[u,c,d,n,a,r,e,i,s,o])}function w4(e,t){t===void 0&&(t={});let r=N.useContext(f4);r==null&&at(!1);let{basename:n}=x4(v0.useViewTransitionState),a=Gp(e,{relative:t.relative});if(!r.isTransitioning)return!1;let i=Yo(r.currentLocation.pathname,n)||r.currentLocation.pathname,s=Yo(r.nextLocation.pathname,n)||r.nextLocation.pathname;return ch(a.pathname,s)!=null||ch(a.pathname,i)!=null}var Tl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ws=typeof window>"u"||"Deno"in globalThis;function nr(){}function j4(e,t){return typeof e=="function"?e(t):e}function x0(e){return typeof e=="number"&&e>=0&&e!==1/0}function vA(e,t){return Math.max(e+(t||0)-Date.now(),0)}function wi(e,t){return typeof e=="function"?e(t):e}function gn(e,t){return typeof e=="function"?e(t):e}function Oj(e,t){const{type:r="all",exact:n,fetchStatus:a,predicate:i,queryKey:s,stale:o}=e;if(s){if(n){if(t.queryHash!==jb(s,t.options))return!1}else if(!cu(t.queryKey,s))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||a&&a!==t.state.fetchStatus||i&&!i(t))}function Nj(e,t){const{exact:r,status:n,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(js(t.options.mutationKey)!==js(i))return!1}else if(!cu(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||a&&!a(t))}function jb(e,t){return((t==null?void 0:t.queryKeyHashFn)||js)(e)}function js(e){return JSON.stringify(e,(t,r)=>b0(r)?Object.keys(r).sort().reduce((n,a)=>(n[a]=r[a],n),{}):r)}function cu(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>cu(e[r],t[r])):!1}function xA(e,t){if(e===t)return e;const r=Ej(e)&&Ej(t);if(r||b0(e)&&b0(t)){const n=r?e:Object.keys(e),a=n.length,i=r?t:Object.keys(t),s=i.length,o=r?[]:{},c=new Set(n);let u=0;for(let d=0;d{setTimeout(t,e)})}function w0(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?xA(e,t):t}function k4(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function _4(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Sb=Symbol();function bA(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Sb?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function wA(e,t){return typeof e=="function"?e(...t):!!e}var es,Za,Po,FN,O4=(FN=class extends Tl{constructor(){super();ce(this,es,void 0);ce(this,Za,void 0);ce(this,Po,void 0);ae(this,Po,t=>{if(!ws&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){C(this,Za)||this.setEventListener(C(this,Po))}onUnsubscribe(){var t;this.hasListeners()||((t=C(this,Za))==null||t.call(this),ae(this,Za,void 0))}setEventListener(t){var r;ae(this,Po,t),(r=C(this,Za))==null||r.call(this),ae(this,Za,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){C(this,es)!==t&&(ae(this,es,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof C(this,es)=="boolean"?C(this,es):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},es=new WeakMap,Za=new WeakMap,Po=new WeakMap,FN),kb=new O4,To,Ja,Co,UN,N4=(UN=class extends Tl{constructor(){super();ce(this,To,!0);ce(this,Ja,void 0);ce(this,Co,void 0);ae(this,Co,t=>{if(!ws&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){C(this,Ja)||this.setEventListener(C(this,Co))}onUnsubscribe(){var t;this.hasListeners()||((t=C(this,Ja))==null||t.call(this),ae(this,Ja,void 0))}setEventListener(t){var r;ae(this,Co,t),(r=C(this,Ja))==null||r.call(this),ae(this,Ja,t(this.setOnline.bind(this)))}setOnline(t){C(this,To)!==t&&(ae(this,To,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return C(this,To)}},To=new WeakMap,Ja=new WeakMap,Co=new WeakMap,UN),hh=new N4;function j0(){let e,t;const r=new Promise((a,i)=>{e=a,t=i});r.status="pending",r.catch(()=>{});function n(a){Object.assign(r,a),delete r.resolve,delete r.reject}return r.resolve=a=>{n({status:"fulfilled",value:a}),e(a)},r.reject=a=>{n({status:"rejected",reason:a}),t(a)},r}function E4(e){return Math.min(1e3*2**e,3e4)}function jA(e){return(e??"online")==="online"?hh.isOnline():!0}var SA=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Cy(e){return e instanceof SA}function kA(e){let t=!1,r=0,n=!1,a;const i=j0(),s=y=>{var g;n||(h(new SA(y)),(g=e.abort)==null||g.call(e))},o=()=>{t=!0},c=()=>{t=!1},u=()=>kb.isFocused()&&(e.networkMode==="always"||hh.isOnline())&&e.canRun(),d=()=>jA(e.networkMode)&&e.canRun(),f=y=>{var g;n||(n=!0,(g=e.onSuccess)==null||g.call(e,y),a==null||a(),i.resolve(y))},h=y=>{var g;n||(n=!0,(g=e.onError)==null||g.call(e,y),a==null||a(),i.reject(y))},p=()=>new Promise(y=>{var g;a=b=>{(n||u())&&y(b)},(g=e.onPause)==null||g.call(e)}).then(()=>{var y;a=void 0,n||(y=e.onContinue)==null||y.call(e)}),m=()=>{if(n)return;let y;const g=r===0?e.initialPromise:void 0;try{y=g??e.fn()}catch(b){y=Promise.reject(b)}Promise.resolve(y).then(f).catch(b=>{var j;if(n)return;const x=e.retry??(ws?0:3),v=e.retryDelay??E4,S=typeof v=="function"?v(r,b):v,w=x===!0||typeof x=="number"&&ru()?void 0:p()).then(()=>{t?h(b):m()})})};return{promise:i,cancel:s,continue:()=>(a==null||a(),i),cancelRetry:o,continueRetry:c,canStart:d,start:()=>(d()?m():p().then(m),i)}}var A4=e=>setTimeout(e,0);function P4(){let e=[],t=0,r=o=>{o()},n=o=>{o()},a=A4;const i=o=>{t?e.push(o):a(()=>{r(o)})},s=()=>{const o=e;e=[],o.length&&a(()=>{n(()=>{o.forEach(c=>{r(c)})})})};return{batch:o=>{let c;t++;try{c=o()}finally{t--,t||s()}return c},batchCalls:o=>(...c)=>{i(()=>{o(...c)})},schedule:i,setNotifyFunction:o=>{r=o},setBatchNotifyFunction:o=>{n=o},setScheduler:o=>{a=o}}}var Ot=P4(),ts,BN,_A=(BN=class{constructor(){ce(this,ts,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),x0(this.gcTime)&&ae(this,ts,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ws?1/0:5*60*1e3))}clearGcTimeout(){C(this,ts)&&(clearTimeout(C(this,ts)),ae(this,ts,void 0))}},ts=new WeakMap,BN),$o,Io,Hr,rs,Wt,Qu,ns,dn,aa,zN,T4=(zN=class extends _A{constructor(t){super();ce(this,dn);ce(this,$o,void 0);ce(this,Io,void 0);ce(this,Hr,void 0);ce(this,rs,void 0);ce(this,Wt,void 0);ce(this,Qu,void 0);ce(this,ns,void 0);ae(this,ns,!1),ae(this,Qu,t.defaultOptions),this.setOptions(t.options),this.observers=[],ae(this,rs,t.client),ae(this,Hr,C(this,rs).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ae(this,$o,C4(this.options)),this.state=t.state??C(this,$o),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=C(this,Wt))==null?void 0:t.promise}setOptions(t){this.options={...C(this,Qu),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&C(this,Hr).remove(this)}setData(t,r){const n=w0(this.state.data,t,this.options);return je(this,dn,aa).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){je(this,dn,aa).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,a;const r=(n=C(this,Wt))==null?void 0:n.promise;return(a=C(this,Wt))==null||a.cancel(t),r?r.then(nr).catch(nr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(C(this,$o))}isActive(){return this.observers.some(t=>gn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Sb||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>wi(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!vA(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=C(this,Wt))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=C(this,Wt))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),C(this,Hr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(C(this,Wt)&&(C(this,ns)?C(this,Wt).cancel({revert:!0}):C(this,Wt).cancelRetry()),this.scheduleGc()),C(this,Hr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||je(this,dn,aa).call(this,{type:"invalidate"})}fetch(t,r){var u,d,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(C(this,Wt))return C(this,Wt).continueRetry(),C(this,Wt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const h=this.observers.find(p=>p.options.queryFn);h&&this.setOptions(h.options)}const n=new AbortController,a=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(ae(this,ns,!0),n.signal)})},i=()=>{const h=bA(this.options,r),m=(()=>{const y={client:C(this,rs),queryKey:this.queryKey,meta:this.meta};return a(y),y})();return ae(this,ns,!1),this.options.persister?this.options.persister(h,m,this):h(m)},o=(()=>{const h={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:C(this,rs),state:this.state,fetchFn:i};return a(h),h})();(u=this.options.behavior)==null||u.onFetch(o,this),ae(this,Io,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&je(this,dn,aa).call(this,{type:"fetch",meta:(f=o.fetchOptions)==null?void 0:f.meta});const c=h=>{var p,m,y,g;Cy(h)&&h.silent||je(this,dn,aa).call(this,{type:"error",error:h}),Cy(h)||((m=(p=C(this,Hr).config).onError)==null||m.call(p,h,this),(g=(y=C(this,Hr).config).onSettled)==null||g.call(y,this.state.data,h,this)),this.scheduleGc()};return ae(this,Wt,kA({initialPromise:r==null?void 0:r.initialPromise,fn:o.fetchFn,abort:n.abort.bind(n),onSuccess:h=>{var p,m,y,g;if(h===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(h)}catch(b){c(b);return}(m=(p=C(this,Hr).config).onSuccess)==null||m.call(p,h,this),(g=(y=C(this,Hr).config).onSettled)==null||g.call(y,h,this.state.error,this),this.scheduleGc()},onError:c,onFail:(h,p)=>{je(this,dn,aa).call(this,{type:"failed",failureCount:h,error:p})},onPause:()=>{je(this,dn,aa).call(this,{type:"pause"})},onContinue:()=>{je(this,dn,aa).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),C(this,Wt).start()}},$o=new WeakMap,Io=new WeakMap,Hr=new WeakMap,rs=new WeakMap,Wt=new WeakMap,Qu=new WeakMap,ns=new WeakMap,dn=new WeakSet,aa=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...OA(n.data,this.options),fetchMeta:t.meta??null};case"success":return{...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const a=t.error;return Cy(a)&&a.revert&&C(this,Io)?{...C(this,Io),fetchStatus:"idle"}:{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),Ot.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),C(this,Hr).notify({query:this,type:"updated",action:t})})},zN);function OA(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:jA(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function C4(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Rn,VN,$4=(VN=class extends Tl{constructor(t={}){super();ce(this,Rn,void 0);this.config=t,ae(this,Rn,new Map)}build(t,r,n){const a=r.queryKey,i=r.queryHash??jb(a,r);let s=this.get(i);return s||(s=new T4({client:t,queryKey:a,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(a)}),this.add(s)),s}add(t){C(this,Rn).has(t.queryHash)||(C(this,Rn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=C(this,Rn).get(t.queryHash);r&&(t.destroy(),r===t&&C(this,Rn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ot.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return C(this,Rn).get(t)}getAll(){return[...C(this,Rn).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Oj(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>Oj(t,n)):r}notify(t){Ot.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){Ot.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ot.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Rn=new WeakMap,VN),Mn,Jt,as,Dn,Ba,qN,I4=(qN=class extends _A{constructor(t){super();ce(this,Dn);ce(this,Mn,void 0);ce(this,Jt,void 0);ce(this,as,void 0);this.mutationId=t.mutationId,ae(this,Jt,t.mutationCache),ae(this,Mn,[]),this.state=t.state||NA(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){C(this,Mn).includes(t)||(C(this,Mn).push(t),this.clearGcTimeout(),C(this,Jt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ae(this,Mn,C(this,Mn).filter(r=>r!==t)),this.scheduleGc(),C(this,Jt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){C(this,Mn).length||(this.state.status==="pending"?this.scheduleGc():C(this,Jt).remove(this))}continue(){var t;return((t=C(this,as))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,o,c,u,d,f,h,p,m,y,g,b,x,v,S,w,j,k,_;const r=()=>{je(this,Dn,Ba).call(this,{type:"continue"})};ae(this,as,kA({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(E,O)=>{je(this,Dn,Ba).call(this,{type:"failed",failureCount:E,error:O})},onPause:()=>{je(this,Dn,Ba).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>C(this,Jt).canRun(this)}));const n=this.state.status==="pending",a=!C(this,as).canStart();try{if(n)r();else{je(this,Dn,Ba).call(this,{type:"pending",variables:t,isPaused:a}),await((s=(i=C(this,Jt).config).onMutate)==null?void 0:s.call(i,t,this));const O=await((c=(o=this.options).onMutate)==null?void 0:c.call(o,t));O!==this.state.context&&je(this,Dn,Ba).call(this,{type:"pending",context:O,variables:t,isPaused:a})}const E=await C(this,as).start();return await((d=(u=C(this,Jt).config).onSuccess)==null?void 0:d.call(u,E,t,this.state.context,this)),await((h=(f=this.options).onSuccess)==null?void 0:h.call(f,E,t,this.state.context)),await((m=(p=C(this,Jt).config).onSettled)==null?void 0:m.call(p,E,null,this.state.variables,this.state.context,this)),await((g=(y=this.options).onSettled)==null?void 0:g.call(y,E,null,t,this.state.context)),je(this,Dn,Ba).call(this,{type:"success",data:E}),E}catch(E){try{throw await((x=(b=C(this,Jt).config).onError)==null?void 0:x.call(b,E,t,this.state.context,this)),await((S=(v=this.options).onError)==null?void 0:S.call(v,E,t,this.state.context)),await((j=(w=C(this,Jt).config).onSettled)==null?void 0:j.call(w,void 0,E,this.state.variables,this.state.context,this)),await((_=(k=this.options).onSettled)==null?void 0:_.call(k,void 0,E,t,this.state.context)),E}finally{je(this,Dn,Ba).call(this,{type:"error",error:E})}}finally{C(this,Jt).runNext(this)}}},Mn=new WeakMap,Jt=new WeakMap,as=new WeakMap,Dn=new WeakSet,Ba=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),Ot.batch(()=>{C(this,Mn).forEach(n=>{n.onMutationUpdate(t)}),C(this,Jt).notify({mutation:this,type:"updated",action:t})})},qN);function NA(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var la,fn,Xu,WN,R4=(WN=class extends Tl{constructor(t={}){super();ce(this,la,void 0);ce(this,fn,void 0);ce(this,Xu,void 0);this.config=t,ae(this,la,new Set),ae(this,fn,new Map),ae(this,Xu,0)}build(t,r,n){const a=new I4({mutationCache:this,mutationId:++Pd(this,Xu)._,options:t.defaultMutationOptions(r),state:n});return this.add(a),a}add(t){C(this,la).add(t);const r=Qd(t);if(typeof r=="string"){const n=C(this,fn).get(r);n?n.push(t):C(this,fn).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(C(this,la).delete(t)){const r=Qd(t);if(typeof r=="string"){const n=C(this,fn).get(r);if(n)if(n.length>1){const a=n.indexOf(t);a!==-1&&n.splice(a,1)}else n[0]===t&&C(this,fn).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Qd(t);if(typeof r=="string"){const n=C(this,fn).get(r),a=n==null?void 0:n.find(i=>i.state.status==="pending");return!a||a===t}else return!0}runNext(t){var n;const r=Qd(t);if(typeof r=="string"){const a=(n=C(this,fn).get(r))==null?void 0:n.find(i=>i!==t&&i.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ot.batch(()=>{C(this,la).forEach(t=>{this.notify({type:"removed",mutation:t})}),C(this,la).clear(),C(this,fn).clear()})}getAll(){return Array.from(C(this,la))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Nj(r,n))}findAll(t={}){return this.getAll().filter(r=>Nj(t,r))}notify(t){Ot.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return Ot.batch(()=>Promise.all(t.map(r=>r.continue().catch(nr))))}},la=new WeakMap,fn=new WeakMap,Xu=new WeakMap,WN);function Qd(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Pj(e){return{onFetch:(t,r)=>{var d,f,h,p,m;const n=t.options,a=(h=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],s=((m=t.state.data)==null?void 0:m.pageParams)||[];let o={pages:[],pageParams:[]},c=0;const u=async()=>{let y=!1;const g=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(t.signal.aborted?y=!0:t.signal.addEventListener("abort",()=>{y=!0}),t.signal)})},b=bA(t.options,t.fetchOptions),x=async(v,S,w)=>{if(y)return Promise.reject();if(S==null&&v.pages.length)return Promise.resolve(v);const k=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:S,direction:w?"backward":"forward",meta:t.options.meta};return g(P),P})(),_=await b(k),{maxPages:E}=t.options,O=w?_4:k4;return{pages:O(v.pages,_,E),pageParams:O(v.pageParams,S,E)}};if(a&&i.length){const v=a==="backward",S=v?M4:Tj,w={pages:i,pageParams:s},j=S(n,w);o=await x(w,j,v)}else{const v=e??i.length;do{const S=c===0?s[0]??n.initialPageParam:Tj(n,o);if(c>0&&S==null)break;o=await x(o,S),c++}while(c{var y,g;return(g=(y=t.options).persister)==null?void 0:g.call(y,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function Tj(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function M4(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var lt,ei,ti,Ro,Mo,ri,Do,Lo,GN,D4=(GN=class{constructor(e={}){ce(this,lt,void 0);ce(this,ei,void 0);ce(this,ti,void 0);ce(this,Ro,void 0);ce(this,Mo,void 0);ce(this,ri,void 0);ce(this,Do,void 0);ce(this,Lo,void 0);ae(this,lt,e.queryCache||new $4),ae(this,ei,e.mutationCache||new R4),ae(this,ti,e.defaultOptions||{}),ae(this,Ro,new Map),ae(this,Mo,new Map),ae(this,ri,0)}mount(){Pd(this,ri)._++,C(this,ri)===1&&(ae(this,Do,kb.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,lt).onFocus())})),ae(this,Lo,hh.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,lt).onOnline())})))}unmount(){var e,t;Pd(this,ri)._--,C(this,ri)===0&&((e=C(this,Do))==null||e.call(this),ae(this,Do,void 0),(t=C(this,Lo))==null||t.call(this),ae(this,Lo,void 0))}isFetching(e){return C(this,lt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return C(this,ei).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=C(this,lt).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=C(this,lt).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(wi(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return C(this,lt).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),a=C(this,lt).get(n.queryHash),i=a==null?void 0:a.state.data,s=j4(t,i);if(s!==void 0)return C(this,lt).build(this,n).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return Ot.batch(()=>C(this,lt).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=C(this,lt).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=C(this,lt);Ot.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=C(this,lt);return Ot.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=Ot.batch(()=>C(this,lt).findAll(e).map(a=>a.cancel(r)));return Promise.all(n).then(nr).catch(nr)}invalidateQueries(e,t={}){return Ot.batch(()=>(C(this,lt).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=Ot.batch(()=>C(this,lt).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,r);return r.throwOnError||(i=i.catch(nr)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(nr)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=C(this,lt).build(this,t);return r.isStaleByTime(wi(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(nr).catch(nr)}fetchInfiniteQuery(e){return e.behavior=Pj(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(nr).catch(nr)}ensureInfiniteQueryData(e){return e.behavior=Pj(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return hh.isOnline()?C(this,ei).resumePausedMutations():Promise.resolve()}getQueryCache(){return C(this,lt)}getMutationCache(){return C(this,ei)}getDefaultOptions(){return C(this,ti)}setDefaultOptions(e){ae(this,ti,e)}setQueryDefaults(e,t){C(this,Ro).set(js(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...C(this,Ro).values()],r={};return t.forEach(n=>{cu(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){C(this,Mo).set(js(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...C(this,Mo).values()],r={};return t.forEach(n=>{cu(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...C(this,ti).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=jb(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Sb&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...C(this,ti).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){C(this,lt).clear(),C(this,ei).clear()}},lt=new WeakMap,ei=new WeakMap,ti=new WeakMap,Ro=new WeakMap,Mo=new WeakMap,ri=new WeakMap,Do=new WeakMap,Lo=new WeakMap,GN),fr,Ne,Yu,er,is,Fo,ni,ai,Zu,Uo,Bo,ss,os,ii,zo,ls,_c,Ju,S0,ed,k0,td,_0,rd,O0,nd,N0,ad,E0,id,A0,Np,EA,HN,L4=(HN=class extends Tl{constructor(t,r){super();ce(this,ls);ce(this,Ju);ce(this,ed);ce(this,td);ce(this,rd);ce(this,nd);ce(this,ad);ce(this,id);ce(this,Np);ce(this,fr,void 0);ce(this,Ne,void 0);ce(this,Yu,void 0);ce(this,er,void 0);ce(this,is,void 0);ce(this,Fo,void 0);ce(this,ni,void 0);ce(this,ai,void 0);ce(this,Zu,void 0);ce(this,Uo,void 0);ce(this,Bo,void 0);ce(this,ss,void 0);ce(this,os,void 0);ce(this,ii,void 0);ce(this,zo,new Set);this.options=r,ae(this,fr,t),ae(this,ai,null),ae(this,ni,j0()),this.options.experimental_prefetchInRender||C(this,ni).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(C(this,Ne).addObserver(this),Cj(C(this,Ne),this.options)?je(this,ls,_c).call(this):this.updateResult(),je(this,rd,O0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return P0(C(this,Ne),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return P0(C(this,Ne),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,je(this,nd,N0).call(this),je(this,ad,E0).call(this),C(this,Ne).removeObserver(this)}setOptions(t){const r=this.options,n=C(this,Ne);if(this.options=C(this,fr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof gn(this.options.enabled,C(this,Ne))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");je(this,id,A0).call(this),C(this,Ne).setOptions(this.options),r._defaulted&&!fh(this.options,r)&&C(this,fr).getQueryCache().notify({type:"observerOptionsUpdated",query:C(this,Ne),observer:this});const a=this.hasListeners();a&&$j(C(this,Ne),n,this.options,r)&&je(this,ls,_c).call(this),this.updateResult(),a&&(C(this,Ne)!==n||gn(this.options.enabled,C(this,Ne))!==gn(r.enabled,C(this,Ne))||wi(this.options.staleTime,C(this,Ne))!==wi(r.staleTime,C(this,Ne)))&&je(this,Ju,S0).call(this);const i=je(this,ed,k0).call(this);a&&(C(this,Ne)!==n||gn(this.options.enabled,C(this,Ne))!==gn(r.enabled,C(this,Ne))||i!==C(this,ii))&&je(this,td,_0).call(this,i)}getOptimisticResult(t){const r=C(this,fr).getQueryCache().build(C(this,fr),t),n=this.createResult(r,t);return U4(this,n)&&(ae(this,er,n),ae(this,Fo,this.options),ae(this,is,C(this,Ne).state)),n}getCurrentResult(){return C(this,er)}trackResult(t,r){return new Proxy(t,{get:(n,a)=>(this.trackProp(a),r==null||r(a),Reflect.get(n,a))})}trackProp(t){C(this,zo).add(t)}getCurrentQuery(){return C(this,Ne)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=C(this,fr).defaultQueryOptions(t),n=C(this,fr).getQueryCache().build(C(this,fr),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return je(this,ls,_c).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),C(this,er)))}createResult(t,r){var E;const n=C(this,Ne),a=this.options,i=C(this,er),s=C(this,is),o=C(this,Fo),u=t!==n?t.state:C(this,Yu),{state:d}=t;let f={...d},h=!1,p;if(r._optimisticResults){const O=this.hasListeners(),P=!O&&Cj(t,r),T=O&&$j(t,n,r,a);(P||T)&&(f={...f,...OA(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:m,errorUpdatedAt:y,status:g}=f;p=f.data;let b=!1;if(r.placeholderData!==void 0&&p===void 0&&g==="pending"){let O;i!=null&&i.isPlaceholderData&&r.placeholderData===(o==null?void 0:o.placeholderData)?(O=i.data,b=!0):O=typeof r.placeholderData=="function"?r.placeholderData((E=C(this,Bo))==null?void 0:E.state.data,C(this,Bo)):r.placeholderData,O!==void 0&&(g="success",p=w0(i==null?void 0:i.data,O,r),h=!0)}if(r.select&&p!==void 0&&!b)if(i&&p===(s==null?void 0:s.data)&&r.select===C(this,Zu))p=C(this,Uo);else try{ae(this,Zu,r.select),p=r.select(p),p=w0(i==null?void 0:i.data,p,r),ae(this,Uo,p),ae(this,ai,null)}catch(O){ae(this,ai,O)}C(this,ai)&&(m=C(this,ai),p=C(this,Uo),y=Date.now(),g="error");const x=f.fetchStatus==="fetching",v=g==="pending",S=g==="error",w=v&&x,j=p!==void 0,_={status:g,fetchStatus:f.fetchStatus,isPending:v,isSuccess:g==="success",isError:S,isInitialLoading:w,isLoading:w,data:p,dataUpdatedAt:f.dataUpdatedAt,error:m,errorUpdatedAt:y,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:x,isRefetching:x&&!v,isLoadingError:S&&!j,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:S&&j,isStale:_b(t,r),refetch:this.refetch,promise:C(this,ni)};if(this.options.experimental_prefetchInRender){const O=M=>{_.status==="error"?M.reject(_.error):_.data!==void 0&&M.resolve(_.data)},P=()=>{const M=ae(this,ni,_.promise=j0());O(M)},T=C(this,ni);switch(T.status){case"pending":t.queryHash===n.queryHash&&O(T);break;case"fulfilled":(_.status==="error"||_.data!==T.value)&&P();break;case"rejected":(_.status!=="error"||_.error!==T.reason)&&P();break}}return _}updateResult(){const t=C(this,er),r=this.createResult(C(this,Ne),this.options);if(ae(this,is,C(this,Ne).state),ae(this,Fo,this.options),C(this,is).data!==void 0&&ae(this,Bo,C(this,Ne)),fh(r,t))return;ae(this,er,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!C(this,zo).size)return!0;const s=new Set(i??C(this,zo));return this.options.throwOnError&&s.add("error"),Object.keys(C(this,er)).some(o=>{const c=o;return C(this,er)[c]!==t[c]&&s.has(c)})};je(this,Np,EA).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&je(this,rd,O0).call(this)}},fr=new WeakMap,Ne=new WeakMap,Yu=new WeakMap,er=new WeakMap,is=new WeakMap,Fo=new WeakMap,ni=new WeakMap,ai=new WeakMap,Zu=new WeakMap,Uo=new WeakMap,Bo=new WeakMap,ss=new WeakMap,os=new WeakMap,ii=new WeakMap,zo=new WeakMap,ls=new WeakSet,_c=function(t){je(this,id,A0).call(this);let r=C(this,Ne).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(nr)),r},Ju=new WeakSet,S0=function(){je(this,nd,N0).call(this);const t=wi(this.options.staleTime,C(this,Ne));if(ws||C(this,er).isStale||!x0(t))return;const n=vA(C(this,er).dataUpdatedAt,t)+1;ae(this,ss,setTimeout(()=>{C(this,er).isStale||this.updateResult()},n))},ed=new WeakSet,k0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(C(this,Ne)):this.options.refetchInterval)??!1},td=new WeakSet,_0=function(t){je(this,ad,E0).call(this),ae(this,ii,t),!(ws||gn(this.options.enabled,C(this,Ne))===!1||!x0(C(this,ii))||C(this,ii)===0)&&ae(this,os,setInterval(()=>{(this.options.refetchIntervalInBackground||kb.isFocused())&&je(this,ls,_c).call(this)},C(this,ii)))},rd=new WeakSet,O0=function(){je(this,Ju,S0).call(this),je(this,td,_0).call(this,je(this,ed,k0).call(this))},nd=new WeakSet,N0=function(){C(this,ss)&&(clearTimeout(C(this,ss)),ae(this,ss,void 0))},ad=new WeakSet,E0=function(){C(this,os)&&(clearInterval(C(this,os)),ae(this,os,void 0))},id=new WeakSet,A0=function(){const t=C(this,fr).getQueryCache().build(C(this,fr),this.options);if(t===C(this,Ne))return;const r=C(this,Ne);ae(this,Ne,t),ae(this,Yu,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},Np=new WeakSet,EA=function(t){Ot.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(C(this,er))}),C(this,fr).getQueryCache().notify({query:C(this,Ne),type:"observerResultsUpdated"})})},HN);function F4(e,t){return gn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Cj(e,t){return F4(e,t)||e.state.data!==void 0&&P0(e,t,t.refetchOnMount)}function P0(e,t,r){if(gn(t.enabled,e)!==!1&&wi(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&_b(e,t)}return!1}function $j(e,t,r,n){return(e!==t||gn(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&_b(e,r)}function _b(e,t){return gn(t.enabled,e)!==!1&&e.isStaleByTime(wi(t.staleTime,e))}function U4(e,t){return!fh(e.getCurrentResult(),t)}var si,oi,hr,ca,Vo,Nf,sd,T0,KN,B4=(KN=class extends Tl{constructor(r,n){super();ce(this,Vo);ce(this,sd);ce(this,si,void 0);ce(this,oi,void 0);ce(this,hr,void 0);ce(this,ca,void 0);ae(this,si,r),this.setOptions(n),this.bindMethods(),je(this,Vo,Nf).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var a;const n=this.options;this.options=C(this,si).defaultMutationOptions(r),fh(this.options,n)||C(this,si).getMutationCache().notify({type:"observerOptionsUpdated",mutation:C(this,hr),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&js(n.mutationKey)!==js(this.options.mutationKey)?this.reset():((a=C(this,hr))==null?void 0:a.state.status)==="pending"&&C(this,hr).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=C(this,hr))==null||r.removeObserver(this)}onMutationUpdate(r){je(this,Vo,Nf).call(this),je(this,sd,T0).call(this,r)}getCurrentResult(){return C(this,oi)}reset(){var r;(r=C(this,hr))==null||r.removeObserver(this),ae(this,hr,void 0),je(this,Vo,Nf).call(this),je(this,sd,T0).call(this)}mutate(r,n){var a;return ae(this,ca,n),(a=C(this,hr))==null||a.removeObserver(this),ae(this,hr,C(this,si).getMutationCache().build(C(this,si),this.options)),C(this,hr).addObserver(this),C(this,hr).execute(r)}},si=new WeakMap,oi=new WeakMap,hr=new WeakMap,ca=new WeakMap,Vo=new WeakSet,Nf=function(){var n;const r=((n=C(this,hr))==null?void 0:n.state)??NA();ae(this,oi,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},sd=new WeakSet,T0=function(r){Ot.batch(()=>{var n,a,i,s,o,c,u,d;if(C(this,ca)&&this.hasListeners()){const f=C(this,oi).variables,h=C(this,oi).context;(r==null?void 0:r.type)==="success"?((a=(n=C(this,ca)).onSuccess)==null||a.call(n,r.data,f,h),(s=(i=C(this,ca)).onSettled)==null||s.call(i,r.data,null,f,h)):(r==null?void 0:r.type)==="error"&&((c=(o=C(this,ca)).onError)==null||c.call(o,r.error,f,h),(d=(u=C(this,ca)).onSettled)==null||d.call(u,void 0,r.error,f,h))}this.listeners.forEach(f=>{f(C(this,oi))})})},KN),AA=N.createContext(void 0),yt=e=>{const t=N.useContext(AA);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},z4=({client:e,children:t})=>(N.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(AA.Provider,{value:e,children:t})),PA=N.createContext(!1),V4=()=>N.useContext(PA);PA.Provider;function q4(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var W4=N.createContext(q4()),G4=()=>N.useContext(W4),H4=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},K4=e=>{N.useEffect(()=>{e.clearReset()},[e])},Q4=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(a&&e.data===void 0||wA(r,[e.error,n])),X4=e=>{if(e.suspense){const t=n=>n==="static"?n:Math.max(n??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...n)=>t(r(...n)):t(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Y4=(e,t)=>e.isLoading&&e.isFetching&&!t,Z4=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ij=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function J4(e,t,r){var f,h,p,m,y;const n=V4(),a=G4(),i=yt(r),s=i.defaultQueryOptions(e);(h=(f=i.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||h.call(f,s),s._optimisticResults=n?"isRestoring":"optimistic",X4(s),H4(s,a),K4(a);const o=!i.getQueryCache().get(s.queryHash),[c]=N.useState(()=>new t(i,s)),u=c.getOptimisticResult(s),d=!n&&e.subscribed!==!1;if(N.useSyncExternalStore(N.useCallback(g=>{const b=d?c.subscribe(Ot.batchCalls(g)):nr;return c.updateResult(),b},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),N.useEffect(()=>{c.setOptions(s)},[s,c]),Z4(s,u))throw Ij(s,c,a);if(Q4({result:u,errorResetBoundary:a,throwOnError:s.throwOnError,query:i.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw u.error;if((m=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||m.call(p,s,u),s.experimental_prefetchInRender&&!ws&&Y4(u,n)){const g=o?Ij(s,c,a):(y=i.getQueryCache().get(s.queryHash))==null?void 0:y.promise;g==null||g.catch(nr).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?u:c.trackResult(u)}function kr(e,t){return J4(e,L4,t)}function ft(e,t){const r=yt(t),[n]=N.useState(()=>new B4(r,e));N.useEffect(()=>{n.setOptions(e)},[n,e]);const a=N.useSyncExternalStore(N.useCallback(s=>n.subscribe(Ot.batchCalls(s)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),i=N.useCallback((s,o)=>{n.mutate(s,o).catch(nr)},[n]);if(a.error&&wA(n.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:i,mutateAsync:a.mutate}}var eD=function(){return null};let tD={data:""},rD=e=>typeof window=="object"?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||tD,nD=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,aD=/\/\*[^]*?\*\/| +/g,Rj=/\n+/g,Ka=(e,t)=>{let r="",n="",a="";for(let i in e){let s=e[i];i[0]=="@"?i[1]=="i"?r=i+" "+s+";":n+=i[1]=="f"?Ka(s,i):i+"{"+Ka(s,i[1]=="k"?"":t)+"}":typeof s=="object"?n+=Ka(s,t?t.replace(/([^,])+/g,o=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,o):o?o+" "+c:c)):i):s!=null&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=Ka.p?Ka.p(i,s):i+":"+s+";")}return r+(t&&a?t+"{"+a+"}":a)+n},ea={},TA=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+TA(e[r]);return t}return e},iD=(e,t,r,n,a)=>{let i=TA(e),s=ea[i]||(ea[i]=(c=>{let u=0,d=11;for(;u>>0;return"go"+d})(i));if(!ea[s]){let c=i!==e?e:(u=>{let d,f,h=[{}];for(;d=nD.exec(u.replace(aD,""));)d[4]?h.shift():d[3]?(f=d[3].replace(Rj," ").trim(),h.unshift(h[0][f]=h[0][f]||{})):h[0][d[1]]=d[2].replace(Rj," ").trim();return h[0]})(e);ea[s]=Ka(a?{["@keyframes "+s]:c}:c,r?"":"."+s)}let o=r&&ea.g?ea.g:null;return r&&(ea.g=ea[s]),((c,u,d,f)=>{f?u.data=u.data.replace(f,c):u.data.indexOf(c)===-1&&(u.data=d?c+u.data:u.data+c)})(ea[s],t,n,o),s},sD=(e,t,r)=>e.reduce((n,a,i)=>{let s=t[i];if(s&&s.call){let o=s(r),c=o&&o.props&&o.props.className||/^go/.test(o)&&o;s=c?"."+c:o&&typeof o=="object"?o.props?"":Ka(o,""):o===!1?"":o}return n+a+(s??"")},"");function Hp(e){let t=this||{},r=e.call?e(t.p):e;return iD(r.unshift?r.raw?sD(r,[].slice.call(arguments,1),t.p):r.reduce((n,a)=>Object.assign(n,a&&a.call?a(t.p):a),{}):r,rD(t.target),t.g,t.o,t.k)}let CA,C0,$0;Hp.bind({g:1});let ka=Hp.bind({k:1});function oD(e,t,r,n){Ka.p=t,CA=e,C0=r,$0=n}function Ei(e,t){let r=this||{};return function(){let n=arguments;function a(i,s){let o=Object.assign({},i),c=o.className||a.className;r.p=Object.assign({theme:C0&&C0()},o),r.o=/ *go\d+/.test(c),o.className=Hp.apply(r,n)+(c?" "+c:""),t&&(o.ref=s);let u=e;return e[0]&&(u=o.as||e,delete o.as),$0&&u[0]&&$0(o),CA(u,o)}return t?t(a):a}}var lD=e=>typeof e=="function",ph=(e,t)=>lD(e)?e(t):e,cD=(()=>{let e=0;return()=>(++e).toString()})(),$A=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),uD=20,IA=(e,t)=>{switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,uD)};case 1:return{...e,toasts:e.toasts.map(i=>i.id===t.toast.id?{...i,...t.toast}:i)};case 2:let{toast:r}=t;return IA(e,{type:e.toasts.find(i=>i.id===r.id)?1:0,toast:r});case 3:let{toastId:n}=t;return{...e,toasts:e.toasts.map(i=>i.id===n||n===void 0?{...i,dismissed:!0,visible:!1}:i)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(i=>i.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let a=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(i=>({...i,pauseDuration:i.pauseDuration+a}))}}},Ef=[],Gi={toasts:[],pausedAt:void 0},Is=e=>{Gi=IA(Gi,e),Ef.forEach(t=>{t(Gi)})},dD={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},fD=(e={})=>{let[t,r]=N.useState(Gi),n=N.useRef(Gi);N.useEffect(()=>(n.current!==Gi&&r(Gi),Ef.push(r),()=>{let i=Ef.indexOf(r);i>-1&&Ef.splice(i,1)}),[]);let a=t.toasts.map(i=>{var s,o,c;return{...e,...e[i.type],...i,removeDelay:i.removeDelay||((s=e[i.type])==null?void 0:s.removeDelay)||(e==null?void 0:e.removeDelay),duration:i.duration||((o=e[i.type])==null?void 0:o.duration)||(e==null?void 0:e.duration)||dD[i.type],style:{...e.style,...(c=e[i.type])==null?void 0:c.style,...i.style}}});return{...t,toasts:a}},hD=(e,t="blank",r)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...r,id:(r==null?void 0:r.id)||cD()}),fd=e=>(t,r)=>{let n=hD(t,e,r);return Is({type:2,toast:n}),n.id},It=(e,t)=>fd("blank")(e,t);It.error=fd("error");It.success=fd("success");It.loading=fd("loading");It.custom=fd("custom");It.dismiss=e=>{Is({type:3,toastId:e})};It.remove=e=>Is({type:4,toastId:e});It.promise=(e,t,r)=>{let n=It.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(a=>{let i=t.success?ph(t.success,a):void 0;return i?It.success(i,{id:n,...r,...r==null?void 0:r.success}):It.dismiss(n),a}).catch(a=>{let i=t.error?ph(t.error,a):void 0;i?It.error(i,{id:n,...r,...r==null?void 0:r.error}):It.dismiss(n)}),e};var pD=(e,t)=>{Is({type:1,toast:{id:e,height:t}})},mD=()=>{Is({type:5,time:Date.now()})},Mc=new Map,yD=1e3,gD=(e,t=yD)=>{if(Mc.has(e))return;let r=setTimeout(()=>{Mc.delete(e),Is({type:4,toastId:e})},t);Mc.set(e,r)},vD=e=>{let{toasts:t,pausedAt:r}=fD(e);N.useEffect(()=>{if(r)return;let i=Date.now(),s=t.map(o=>{if(o.duration===1/0)return;let c=(o.duration||0)+o.pauseDuration-(i-o.createdAt);if(c<0){o.visible&&It.dismiss(o.id);return}return setTimeout(()=>It.dismiss(o.id),c)});return()=>{s.forEach(o=>o&&clearTimeout(o))}},[t,r]);let n=N.useCallback(()=>{r&&Is({type:6,time:Date.now()})},[r]),a=N.useCallback((i,s)=>{let{reverseOrder:o=!1,gutter:c=8,defaultPosition:u}=s||{},d=t.filter(p=>(p.position||u)===(i.position||u)&&p.height),f=d.findIndex(p=>p.id===i.id),h=d.filter((p,m)=>mp.visible).slice(...o?[h+1]:[0,h]).reduce((p,m)=>p+(m.height||0)+c,0)},[t]);return N.useEffect(()=>{t.forEach(i=>{if(i.dismissed)gD(i.id,i.removeDelay);else{let s=Mc.get(i.id);s&&(clearTimeout(s),Mc.delete(i.id))}})},[t]),{toasts:t,handlers:{updateHeight:pD,startPause:mD,endPause:n,calculateOffset:a}}},xD=ka` -from { - transform: scale(0) rotate(45deg); - opacity: 0; -} -to { - transform: scale(1) rotate(45deg); - opacity: 1; -}`,bD=ka` -from { - transform: scale(0); - opacity: 0; -} -to { - transform: scale(1); - opacity: 1; -}`,wD=ka` -from { - transform: scale(0) rotate(90deg); - opacity: 0; -} -to { - transform: scale(1) rotate(90deg); - opacity: 1; -}`,jD=Ei("div")` - width: 20px; - opacity: 0; - height: 20px; - border-radius: 10px; - background: ${e=>e.primary||"#ff4b4b"}; - position: relative; - transform: rotate(45deg); - - animation: ${xD} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) - forwards; - animation-delay: 100ms; - - &:after, - &:before { - content: ''; - animation: ${bD} 0.15s ease-out forwards; - animation-delay: 150ms; - position: absolute; - border-radius: 3px; - opacity: 0; - background: ${e=>e.secondary||"#fff"}; - bottom: 9px; - left: 4px; - height: 2px; - width: 12px; - } - - &:before { - animation: ${wD} 0.15s ease-out forwards; - animation-delay: 180ms; - transform: rotate(90deg); - } -`,SD=ka` - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -`,kD=Ei("div")` - width: 12px; - height: 12px; - box-sizing: border-box; - border: 2px solid; - border-radius: 100%; - border-color: ${e=>e.secondary||"#e0e0e0"}; - border-right-color: ${e=>e.primary||"#616161"}; - animation: ${SD} 1s linear infinite; -`,_D=ka` -from { - transform: scale(0) rotate(45deg); - opacity: 0; -} -to { - transform: scale(1) rotate(45deg); - opacity: 1; -}`,OD=ka` -0% { - height: 0; - width: 0; - opacity: 0; -} -40% { - height: 0; - width: 6px; - opacity: 1; -} -100% { - opacity: 1; - height: 10px; -}`,ND=Ei("div")` - width: 20px; - opacity: 0; - height: 20px; - border-radius: 10px; - background: ${e=>e.primary||"#61d345"}; - position: relative; - transform: rotate(45deg); - - animation: ${_D} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) - forwards; - animation-delay: 100ms; - &:after { - content: ''; - box-sizing: border-box; - animation: ${OD} 0.2s ease-out forwards; - opacity: 0; - animation-delay: 200ms; - position: absolute; - border-right: 2px solid; - border-bottom: 2px solid; - border-color: ${e=>e.secondary||"#fff"}; - bottom: 6px; - left: 6px; - height: 10px; - width: 6px; - } -`,ED=Ei("div")` - position: absolute; -`,AD=Ei("div")` - position: relative; - display: flex; - justify-content: center; - align-items: center; - min-width: 20px; - min-height: 20px; -`,PD=ka` -from { - transform: scale(0.6); - opacity: 0.4; -} -to { - transform: scale(1); - opacity: 1; -}`,TD=Ei("div")` - position: relative; - transform: scale(0.6); - opacity: 0.4; - min-width: 20px; - animation: ${PD} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) - forwards; -`,CD=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?N.createElement(TD,null,t):t:r==="blank"?null:N.createElement(AD,null,N.createElement(kD,{...n}),r!=="loading"&&N.createElement(ED,null,r==="error"?N.createElement(jD,{...n}):N.createElement(ND,{...n})))},$D=e=>` -0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;} -100% {transform: translate3d(0,0,0) scale(1); opacity:1;} -`,ID=e=>` -0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} -100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;} -`,RD="0%{opacity:0;} 100%{opacity:1;}",MD="0%{opacity:1;} 100%{opacity:0;}",DD=Ei("div")` - display: flex; - align-items: center; - background: #fff; - color: #363636; - line-height: 1.3; - will-change: transform; - box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05); - max-width: 350px; - pointer-events: auto; - padding: 8px 10px; - border-radius: 8px; -`,LD=Ei("div")` - display: flex; - justify-content: center; - margin: 4px 10px; - color: inherit; - flex: 1 1 auto; - white-space: pre-line; -`,FD=(e,t)=>{let r=e.includes("top")?1:-1,[n,a]=$A()?[RD,MD]:[$D(r),ID(r)];return{animation:t?`${ka(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${ka(a)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},UD=N.memo(({toast:e,position:t,style:r,children:n})=>{let a=e.height?FD(e.position||t||"top-center",e.visible):{opacity:0},i=N.createElement(CD,{toast:e}),s=N.createElement(LD,{...e.ariaProps},ph(e.message,e));return N.createElement(DD,{className:e.className,style:{...a,...r,...e.style}},typeof n=="function"?n({icon:i,message:s}):N.createElement(N.Fragment,null,i,s))});oD(N.createElement);var BD=({id:e,className:t,style:r,onHeightUpdate:n,children:a})=>{let i=N.useCallback(s=>{if(s){let o=()=>{let c=s.getBoundingClientRect().height;n(e,c)};o(),new MutationObserver(o).observe(s,{subtree:!0,childList:!0,characterData:!0})}},[e,n]);return N.createElement("div",{ref:i,className:t,style:r},a)},zD=(e,t)=>{let r=e.includes("top"),n=r?{top:0}:{bottom:0},a=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:$A()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...a}},VD=Hp` - z-index: 9999; - > * { - pointer-events: auto; - } -`,Xd=16,qD=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:a,containerStyle:i,containerClassName:s})=>{let{toasts:o,handlers:c}=vD(r);return N.createElement("div",{id:"_rht_toaster",style:{position:"fixed",zIndex:9999,top:Xd,left:Xd,right:Xd,bottom:Xd,pointerEvents:"none",...i},className:s,onMouseEnter:c.startPause,onMouseLeave:c.endPause},o.map(u=>{let d=u.position||t,f=c.calculateOffset(u,{reverseOrder:e,gutter:n,defaultPosition:t}),h=zD(d,f);return N.createElement(BD,{id:u.id,key:u.id,onHeightUpdate:c.updateHeight,className:u.visible?VD:"",style:h},u.type==="custom"?ph(u.message,u):a?a(u):N.createElement(UD,{toast:u,position:d}))}))},ye=It;const RA=N.createContext(void 0),WD=(e,t)=>{switch(t.type){case"LOGIN":case"RESTORE_SESSION":return{...e,isAuthenticated:!0,isLoading:!1,user:t.payload.user,permissions:t.payload.permissions,allPermissions:t.payload.allPermissions,token:t.payload.token,refreshToken:t.payload.refreshToken};case"LOGOUT":return{...e,isAuthenticated:!1,isLoading:!1,user:null,permissions:[],allPermissions:[],token:null,refreshToken:null};case"SET_LOADING":return{...e,isLoading:t.payload};default:return e}},GD={isAuthenticated:!1,isLoading:!0,user:null,permissions:[],allPermissions:[],token:null,refreshToken:null},HD=({children:e})=>{const[t,r]=N.useReducer(WD,GD),n=()=>{r({type:"SET_LOADING",payload:!0});const o=localStorage.getItem("admin_token"),c=localStorage.getItem("admin_refresh_token"),u=localStorage.getItem("admin_user"),d=localStorage.getItem("admin_permissions");if(o&&u&&d)try{const f=JSON.parse(u),h=JSON.parse(d);r({type:"RESTORE_SESSION",payload:{user:f,permissions:h,allPermissions:h,token:o,refreshToken:c||""}})}catch{localStorage.removeItem("admin_token"),localStorage.removeItem("admin_refresh_token"),localStorage.removeItem("admin_user"),localStorage.removeItem("admin_permissions"),r({type:"SET_LOADING",payload:!1})}else r({type:"SET_LOADING",payload:!1})};N.useEffect(()=>{n()},[]);const a=()=>{localStorage.removeItem("admin_token"),localStorage.removeItem("admin_refresh_token"),localStorage.removeItem("admin_user"),localStorage.removeItem("admin_permissions"),r({type:"LOGOUT"}),ye.success("خروج موفقیت‌آمیز بود")},i=o=>t.permissions.some(u=>u.id===1)?!0:t.permissions.some(u=>u.id===o),s=o=>t.permissions.some(u=>u.title==="AdminAll")?!0:t.permissions.some(u=>u.title===o);return l.jsx(RA.Provider,{value:{...t,logout:a,restoreSession:n,hasPermission:i,hasPermissionByTitle:s},children:e})},hd=()=>{const e=N.useContext(RA);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e},MA=N.createContext(void 0),KD=({children:e})=>{const[t,r]=N.useState("light");N.useEffect(()=>{const a=localStorage.getItem("admin_theme"),i=window.matchMedia("(prefers-color-scheme: dark)").matches,s=a||(i?"dark":"light");r(s),s==="dark"&&document.documentElement.classList.add("dark")},[]);const n=()=>{const a=t==="light"?"dark":"light";r(a),localStorage.setItem("admin_theme",a),a==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};return l.jsx(MA.Provider,{value:{mode:t,toggleTheme:n},children:e})},QD=()=>{const e=N.useContext(MA);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},DA=N.createContext(void 0),Fa={duration:4e3,position:"top-center",style:{fontFamily:"inherit",direction:"rtl"}},XD=({children:e})=>{const t=(c,u)=>{ye.success(c,{...Fa,...u})},r=(c,u)=>{ye.error(c,{...Fa,...u})},n=(c,u)=>{ye(c,{...Fa,icon:"⚠️",style:{...Fa.style,backgroundColor:"#fef3c7",color:"#92400e"},...u})},a=(c,u)=>{ye(c,{...Fa,icon:"ℹ️",style:{...Fa.style,backgroundColor:"#dbeafe",color:"#1e40af"},...u})},i=(c,u)=>ye.loading(c,{...Fa,...u}),s=c=>{ye.dismiss(c)},o=(c,u,d)=>ye.promise(c,u,{...Fa,...d});return l.jsxs(DA.Provider,{value:{success:t,error:r,warning:n,info:a,loading:i,dismiss:s,promise:o},children:[e,l.jsx(qD,{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"}}}})]})},YD=()=>{const e=N.useContext(DA);if(e===void 0)throw new Error("useToast must be used within a ToastProvider");return e};var ZD={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const JD=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),e6=(e,t)=>{const r=N.forwardRef(({color:n="currentColor",size:a=24,strokeWidth:i=2,absoluteStrokeWidth:s,children:o,...c},u)=>N.createElement("svg",{ref:u,...ZD,width:a,height:a,stroke:n,strokeWidth:s?Number(i)*24/Number(a):i,className:`lucide lucide-${JD(e)}`,...c},[...t.map(([d,f])=>N.createElement(d,f)),...(Array.isArray(o)?o:[o])||[]]));return r.displayName=`${e}`,r};var pe=e6;const $y=pe("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),t6=pe("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Qn=pe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),r6=pe("BarChart3",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]),Hs=pe("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Li=pe("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]),Ob=pe("Calendar",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",ry:"2",key:"eu3xkr"}],["line",{x1:"16",x2:"16",y1:"2",y2:"6",key:"m3sa8f"}],["line",{x1:"8",x2:"8",y1:"2",y2:"6",key:"18kwsl"}],["line",{x1:"3",x2:"21",y1:"10",y2:"10",key:"xt86sb"}]]),n6=pe("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["polyline",{points:"22 4 12 14.01 9 11.01",key:"6xbx8j"}]]),Nb=pe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),LA=pe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),a6=pe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),i6=pe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),Kp=pe("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]),s6=pe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]),o6=pe("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]),_a=pe("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),uu=pe("FileText",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["line",{x1:"16",x2:"8",y1:"13",y2:"13",key:"14keom"}],["line",{x1:"16",x2:"8",y1:"17",y2:"17",key:"17nazh"}],["line",{x1:"10",x2:"8",y1:"9",y2:"9",key:"1a5vjj"}]]),l6=pe("File",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}]]),c6=pe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]),I0=pe("FolderOpen",[["path",{d:"m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.93a2 2 0 0 1 1.66.9l.82 1.2a2 2 0 0 0 1.66.9H18a2 2 0 0 1 2 2v2",key:"1nmvlm"}]]),Mj=pe("Folder",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}]]),FA=pe("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]),mh=pe("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),UA=pe("Key",[["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["path",{d:"m15.5 7.5 3 3L22 7l-3-3",key:"1rn1fs"}]]),u6=pe("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Dj=pe("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),BA=pe("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]),d6=pe("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]),f6=pe("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),Ss=pe("Package",[["path",{d:"M16.5 9.4 7.55 4.24",key:"10qotr"}],["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),Nn=pe("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]),Eb=pe("PenSquare",[["path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1qinfi"}],["path",{d:"M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4Z",key:"w2jsv5"}]]),Pt=pe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),h6=pe("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),Ab=pe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),du=pe("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),yh=pe("Shield",[["path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",key:"3xmgem"}]]),zA=pe("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]),Lj=pe("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]),p6=pe("Sliders",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]),m6=pe("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),R0=pe("Tag",[["path",{d:"M12 2H2v10l9.29 9.29c.94.94 2.48.94 3.42 0l6.58-6.58c.94-.94.94-2.48 0-3.42L12 2Z",key:"14b2ls"}],["path",{d:"M7 7h.01",key:"7u93v4"}]]),Yt=pe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),y6=pe("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]),Pb=pe("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]),g6=pe("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]),M0=pe("UserCog",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["circle",{cx:"19",cy:"11",r:"2",key:"1rxg02"}],["path",{d:"M19 8v1",key:"1iffrw"}],["path",{d:"M19 13v1",key:"z4xc62"}],["path",{d:"m21.6 9.5-.87.5",key:"6lxupl"}],["path",{d:"m17.27 12-.87.5",key:"1rwhxx"}],["path",{d:"m21.6 12.5-.87-.5",key:"agvc9a"}],["path",{d:"m17.27 10-.87-.5",key:"12d57s"}]]),v6=pe("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]),Tb=pe("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),Zo=pe("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),pd=pe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function VA(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t{const c="inline-flex items-center justify-center rounded-lg font-medium transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2",u={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"},d={sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"},f=n||a?"opacity-50 cursor-not-allowed pointer-events-none":"";return l.jsxs("button",{type:s,onClick:i,disabled:n||a,className:ve(c,u[t],d[r],f,o),children:[a&&l.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[l.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),l.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 x6 extends N.Component{constructor(r){super(r);Ad(this,"logErrorToService",(r,n)=>{console.log("Error logged to service:",{error:r,errorInfo:n})});Ad(this,"handleRetry",()=>{this.setState({hasError:!1,error:void 0,errorInfo:void 0})});Ad(this,"handleGoHome",()=>{window.location.href="/"});this.state={hasError:!1}}static getDerivedStateFromError(r){return{hasError:!0}}componentDidCatch(r,n){this.setState({error:r,errorInfo:n}),console.error("ErrorBoundary caught an error:",r,n),this.logErrorToService(r,n)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:l.jsx("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 flex items-center justify-center p-4",children:l.jsxs("div",{className:"max-w-md w-full bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6 text-center",children:[l.jsx("div",{className:"mb-4",children:l.jsx(t6,{className:"h-16 w-16 text-red-500 mx-auto"})}),l.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-gray-100 mb-2",children:"خطایی رخ داده است"}),l.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:"متأسفانه مشکلی در برنامه رخ داده است. لطفاً دوباره تلاش کنید یا با پشتیبانی تماس بگیرید."}),!1,l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[l.jsxs(te,{onClick:this.handleRetry,className:"flex-1",variant:"primary",children:[l.jsx(h6,{className:"h-4 w-4 ml-2"}),"تلاش دوباره"]}),l.jsxs(te,{onClick:this.handleGoHome,className:"flex-1",variant:"secondary",children:[l.jsx(FA,{className:"h-4 w-4 ml-2"}),"بازگشت به خانه"]})]})]})}):this.props.children}}const Mr=({size:e="md",text:t="در حال بارگذاری...",fullScreen:r=!1})=>{const n={sm:"h-4 w-4",md:"h-8 w-8",lg:"h-12 w-12"},a=l.jsxs("div",{className:`flex flex-col items-center justify-center ${r?"min-h-screen":"p-8"}`,children:[l.jsx(u6,{className:`${n[e]} animate-spin text-primary-600 dark:text-primary-400`}),t&&l.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:t})]});return r?l.jsx("div",{className:"fixed inset-0 bg-white dark:bg-gray-900 z-50",children:a}):a},b6=new D4({defaultOptions:{queries:{gcTime:0,staleTime:0,refetchOnMount:!0,refetchOnReconnect:!0,refetchOnWindowFocus:!0,retry:1},mutations:{retry:1}}});var md=e=>e.type==="checkbox",Hi=e=>e instanceof Date,ar=e=>e==null;const qA=e=>typeof e=="object";var mt=e=>!ar(e)&&!Array.isArray(e)&&qA(e)&&!Hi(e),w6=e=>mt(e)&&e.target?md(e.target)?e.target.checked:e.target.value:e,j6=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,S6=(e,t)=>e.has(j6(t)),k6=e=>{const t=e.constructor&&e.constructor.prototype;return mt(t)&&t.hasOwnProperty("isPrototypeOf")},Cb=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ct(e){let t;const r=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Cb&&(e instanceof Blob||n))&&(r||mt(e)))if(t=r?[]:{},!r&&!k6(e))t=e;else for(const a in e)e.hasOwnProperty(a)&&(t[a]=ct(e[a]));else return e;return t}var yd=e=>Array.isArray(e)?e.filter(Boolean):[],Ze=e=>e===void 0,re=(e,t,r)=>{if(!t||!mt(e))return r;const n=yd(t.split(/[,[\].]+?/)).reduce((a,i)=>ar(a)?a:a[i],e);return Ze(n)||n===e?Ze(e[t])?r:e[t]:n},$n=e=>typeof e=="boolean",$b=e=>/^\w*$/.test(e),WA=e=>yd(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Re=(e,t,r)=>{let n=-1;const a=$b(t)?[t]:WA(t),i=a.length,s=i-1;for(;++nA.useContext(_6);var N6=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(a,i,{get:()=>{const s=i;return t._proxyFormState[s]!==Yr.all&&(t._proxyFormState[s]=!n||Yr.all),r&&(r[s]=!0),e[s]}});return a};const E6=typeof window<"u"?N.useLayoutEffect:N.useEffect;var Fn=e=>typeof e=="string",A6=(e,t,r,n,a)=>Fn(e)?(n&&t.watch.add(e),re(r,e,a)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),re(r,i))):(n&&(t.watchAll=!0),r),GA=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},gr=e=>Array.isArray(e)?e:[e],Uj=()=>{let e=[];return{get observers(){return e},next:a=>{for(const i of e)i.next&&i.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter(i=>i!==a)}}),unsubscribe:()=>{e=[]}}},D0=e=>ar(e)||!qA(e);function Qa(e,t){if(D0(e)||D0(t))return e===t;if(Hi(e)&&Hi(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const a of r){const i=e[a];if(!n.includes(a))return!1;if(a!=="ref"){const s=t[a];if(Hi(i)&&Hi(s)||mt(i)&&mt(s)||Array.isArray(i)&&Array.isArray(s)?!Qa(i,s):i!==s)return!1}}return!0}var tr=e=>mt(e)&&!Object.keys(e).length,Ib=e=>e.type==="file",vn=e=>typeof e=="function",gh=e=>{if(!Cb)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},HA=e=>e.type==="select-multiple",Rb=e=>e.type==="radio",P6=e=>Rb(e)||md(e),Iy=e=>gh(e)&&e.isConnected;function T6(e,t){const r=t.slice(0,-1).length;let n=0;for(;n{for(const t in e)if(vn(e[t]))return!0;return!1};function vh(e,t={}){const r=Array.isArray(e);if(mt(e)||r)for(const n in e)Array.isArray(e[n])||mt(e[n])&&!KA(e[n])?(t[n]=Array.isArray(e[n])?[]:{},vh(e[n],t[n])):ar(e[n])||(t[n]=!0);return t}function QA(e,t,r){const n=Array.isArray(e);if(mt(e)||n)for(const a in e)Array.isArray(e[a])||mt(e[a])&&!KA(e[a])?Ze(t)||D0(r[a])?r[a]=Array.isArray(e[a])?vh(e[a],[]):{...vh(e[a])}:QA(e[a],ar(t)?{}:t[a],r[a]):r[a]=!Qa(e[a],t[a]);return r}var sc=(e,t)=>QA(e,t,vh(t));const Bj={value:!1,isValid:!1},zj={value:!0,isValid:!0};var XA=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ze(e[0].attributes.value)?Ze(e[0].value)||e[0].value===""?zj:{value:e[0].value,isValid:!0}:zj:Bj}return Bj},YA=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ze(e)?e:t?e===""?NaN:e&&+e:r&&Fn(e)?new Date(e):n?n(e):e;const Vj={isValid:!1,value:null};var ZA=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Vj):Vj;function qj(e){const t=e.ref;return Ib(t)?t.files:Rb(t)?ZA(e.refs).value:HA(t)?[...t.selectedOptions].map(({value:r})=>r):md(t)?XA(e.refs).value:YA(Ze(t.value)?e.ref.value:t.value,e)}var $6=(e,t,r,n)=>{const a={};for(const i of e){const s=re(t,i);s&&Re(a,i,s._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}},xh=e=>e instanceof RegExp,oc=e=>Ze(e)?e:xh(e)?e.source:mt(e)?xh(e.value)?e.value.source:e.value:e,ho=e=>({isOnSubmit:!e||e===Yr.onSubmit,isOnBlur:e===Yr.onBlur,isOnChange:e===Yr.onChange,isOnAll:e===Yr.all,isOnTouch:e===Yr.onTouched});const Wj="AsyncFunction";var I6=e=>!!e&&!!e.validate&&!!(vn(e.validate)&&e.validate.constructor.name===Wj||mt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Wj)),R6=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),L0=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Oo=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const i=re(e,a);if(i){const{_f:s,...o}=i;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],a)&&!n)return!0;if(s.ref&&t(s.ref,s.name)&&!n)return!0;if(Oo(o,t))break}else if(mt(o)&&Oo(o,t))break}}};function Gj(e,t,r){const n=re(e,r);if(n||$b(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const i=a.join("."),s=re(t,i),o=re(e,i);if(s&&!Array.isArray(s)&&r!==i)return{name:r};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};a.pop()}return{name:r}}var M6=(e,t,r,n)=>{r(e);const{name:a,...i}=e;return tr(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(s=>t[s]===(!n||Yr.all))},D6=(e,t,r)=>!e||!t||e===t||gr(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),L6=(e,t,r,n,a)=>a.isOnAll?!1:!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:(r?n.isOnChange:a.isOnChange)?e:!0,F6=(e,t)=>!yd(re(e,t)).length&&vt(e,t),JA=(e,t,r)=>{const n=gr(re(e,r));return Re(n,"root",t[r]),Re(e,r,n),e},Af=e=>Fn(e);function Hj(e,t,r="validate"){if(Af(e)||Array.isArray(e)&&e.every(Af)||$n(e)&&!e)return{type:r,message:Af(e)?e:"",ref:t}}var Ks=e=>mt(e)&&!xh(e)?e:{value:e,message:""},F0=async(e,t,r,n,a,i)=>{const{ref:s,refs:o,required:c,maxLength:u,minLength:d,min:f,max:h,pattern:p,validate:m,name:y,valueAsNumber:g,mount:b}=e._f,x=re(r,y);if(!b||t.has(y))return{};const v=o?o[0]:s,S=T=>{a&&v.reportValidity&&(v.setCustomValidity($n(T)?"":T||""),v.reportValidity())},w={},j=Rb(s),k=md(s),_=j||k,E=(g||Ib(s))&&Ze(s.value)&&Ze(x)||gh(s)&&s.value===""||x===""||Array.isArray(x)&&!x.length,O=GA.bind(null,y,n,w),P=(T,M,I,R=ta.maxLength,F=ta.minLength)=>{const U=T?M:I;w[y]={type:T?R:F,message:U,ref:s,...O(T?R:F,U)}};if(i?!Array.isArray(x)||!x.length:c&&(!_&&(E||ar(x))||$n(x)&&!x||k&&!XA(o).isValid||j&&!ZA(o).isValid)){const{value:T,message:M}=Af(c)?{value:!!c,message:c}:Ks(c);if(T&&(w[y]={type:ta.required,message:M,ref:v,...O(ta.required,M)},!n))return S(M),w}if(!E&&(!ar(f)||!ar(h))){let T,M;const I=Ks(h),R=Ks(f);if(!ar(x)&&!isNaN(x)){const F=s.valueAsNumber||x&&+x;ar(I.value)||(T=F>I.value),ar(R.value)||(M=Fnew Date(new Date().toDateString()+" "+H),D=s.type=="time",V=s.type=="week";Fn(I.value)&&x&&(T=D?U(x)>U(I.value):V?x>I.value:F>new Date(I.value)),Fn(R.value)&&x&&(M=D?U(x)+T.value,R=!ar(M.value)&&x.length<+M.value;if((I||R)&&(P(I,T.message,M.message),!n))return S(w[y].message),w}if(p&&!E&&Fn(x)){const{value:T,message:M}=Ks(p);if(xh(T)&&!x.match(T)&&(w[y]={type:ta.pattern,message:M,ref:s,...O(ta.pattern,M)},!n))return S(M),w}if(m){if(vn(m)){const T=await m(x,r),M=Hj(T,v);if(M&&(w[y]={...M,...O(ta.validate,M.message)},!n))return S(M.message),w}else if(mt(m)){let T={};for(const M in m){if(!tr(T)&&!n)break;const I=Hj(await m[M](x,r),v,M);I&&(T={...I,...O(M,I.message)},S(I.message),n&&(w[y]=T))}if(!tr(T)&&(w[y]={ref:v,...T},!n))return w}}return S(!0),w};const U6={mode:Yr.onSubmit,reValidateMode:Yr.onChange,shouldFocusError:!0};function B6(e={}){let t={...U6,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:vn(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1};const n={};let a=mt(t.defaultValues)||mt(t.values)?ct(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:ct(a),s={action:!1,mount:!1,watch:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...d};const h={array:Uj(),state:Uj()},p=t.criteriaMode===Yr.all,m=$=>L=>{clearTimeout(u),u=setTimeout($,L)},y=async $=>{if(!t.disabled&&(d.isValid||f.isValid||$)){const L=t.resolver?tr((await k()).errors):await E(n,!0);L!==r.isValid&&h.state.next({isValid:L})}},g=($,L)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&(($||Array.from(o.mount)).forEach(q=>{q&&(L?Re(r.validatingFields,q,L):vt(r.validatingFields,q))}),h.state.next({validatingFields:r.validatingFields,isValidating:!tr(r.validatingFields)}))},b=($,L=[],q,ee,J=!0,X=!0)=>{if(ee&&q&&!t.disabled){if(s.action=!0,X&&Array.isArray(re(n,$))){const fe=q(re(n,$),ee.argA,ee.argB);J&&Re(n,$,fe)}if(X&&Array.isArray(re(r.errors,$))){const fe=q(re(r.errors,$),ee.argA,ee.argB);J&&Re(r.errors,$,fe),F6(r.errors,$)}if((d.touchedFields||f.touchedFields)&&X&&Array.isArray(re(r.touchedFields,$))){const fe=q(re(r.touchedFields,$),ee.argA,ee.argB);J&&Re(r.touchedFields,$,fe)}(d.dirtyFields||f.dirtyFields)&&(r.dirtyFields=sc(a,i)),h.state.next({name:$,isDirty:P($,L),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Re(i,$,L)},x=($,L)=>{Re(r.errors,$,L),h.state.next({errors:r.errors})},v=$=>{r.errors=$,h.state.next({errors:r.errors,isValid:!1})},S=($,L,q,ee)=>{const J=re(n,$);if(J){const X=re(i,$,Ze(q)?re(a,$):q);Ze(X)||ee&&ee.defaultChecked||L?Re(i,$,L?X:qj(J._f)):I($,X),s.mount&&y()}},w=($,L,q,ee,J)=>{let X=!1,fe=!1;const Le={name:$};if(!t.disabled){if(!q||ee){(d.isDirty||f.isDirty)&&(fe=r.isDirty,r.isDirty=Le.isDirty=P(),X=fe!==Le.isDirty);const Ve=Qa(re(a,$),L);fe=!!re(r.dirtyFields,$),Ve?vt(r.dirtyFields,$):Re(r.dirtyFields,$,!0),Le.dirtyFields=r.dirtyFields,X=X||(d.dirtyFields||f.dirtyFields)&&fe!==!Ve}if(q){const Ve=re(r.touchedFields,$);Ve||(Re(r.touchedFields,$,q),Le.touchedFields=r.touchedFields,X=X||(d.touchedFields||f.touchedFields)&&Ve!==q)}X&&J&&h.state.next(Le)}return X?Le:{}},j=($,L,q,ee)=>{const J=re(r.errors,$),X=(d.isValid||f.isValid)&&$n(L)&&r.isValid!==L;if(t.delayError&&q?(c=m(()=>x($,q)),c(t.delayError)):(clearTimeout(u),c=null,q?Re(r.errors,$,q):vt(r.errors,$)),(q?!Qa(J,q):J)||!tr(ee)||X){const fe={...ee,...X&&$n(L)?{isValid:L}:{},errors:r.errors,name:$};r={...r,...fe},h.state.next(fe)}},k=async $=>{g($,!0);const L=await t.resolver(i,t.context,$6($||o.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return g($),L},_=async $=>{const{errors:L}=await k($);if($)for(const q of $){const ee=re(L,q);ee?Re(r.errors,q,ee):vt(r.errors,q)}else r.errors=L;return L},E=async($,L,q={valid:!0})=>{for(const ee in $){const J=$[ee];if(J){const{_f:X,...fe}=J;if(X){const Le=o.array.has(X.name),Ve=J._f&&I6(J._f);Ve&&d.validatingFields&&g([ee],!0);const Vr=await F0(J,o.disabled,i,p,t.shouldUseNativeValidation&&!L,Le);if(Ve&&d.validatingFields&&g([ee]),Vr[X.name]&&(q.valid=!1,L))break;!L&&(re(Vr,X.name)?Le?JA(r.errors,Vr,X.name):Re(r.errors,X.name,Vr[X.name]):vt(r.errors,X.name))}!tr(fe)&&await E(fe,L,q)}}return q.valid},O=()=>{for(const $ of o.unMount){const L=re(n,$);L&&(L._f.refs?L._f.refs.every(q=>!Iy(q)):!Iy(L._f.ref))&&st($)}o.unMount=new Set},P=($,L)=>!t.disabled&&($&&L&&Re(i,$,L),!Qa(H(),a)),T=($,L,q)=>A6($,o,{...s.mount?i:Ze(L)?a:Fn($)?{[$]:L}:L},q,L),M=$=>yd(re(s.mount?i:a,$,t.shouldUnregister?re(a,$,[]):[])),I=($,L,q={})=>{const ee=re(n,$);let J=L;if(ee){const X=ee._f;X&&(!X.disabled&&Re(i,$,YA(L,X)),J=gh(X.ref)&&ar(L)?"":L,HA(X.ref)?[...X.ref.options].forEach(fe=>fe.selected=J.includes(fe.value)):X.refs?md(X.ref)?X.refs.forEach(fe=>{(!fe.defaultChecked||!fe.disabled)&&(Array.isArray(J)?fe.checked=!!J.find(Le=>Le===fe.value):fe.checked=J===fe.value||!!J)}):X.refs.forEach(fe=>fe.checked=fe.value===J):Ib(X.ref)?X.ref.value="":(X.ref.value=J,X.ref.type||h.state.next({name:$,values:ct(i)})))}(q.shouldDirty||q.shouldTouch)&&w($,J,q.shouldTouch,q.shouldDirty,!0),q.shouldValidate&&V($)},R=($,L,q)=>{for(const ee in L){if(!L.hasOwnProperty(ee))return;const J=L[ee],X=$+"."+ee,fe=re(n,X);(o.array.has($)||mt(J)||fe&&!fe._f)&&!Hi(J)?R(X,J,q):I(X,J,q)}},F=($,L,q={})=>{const ee=re(n,$),J=o.array.has($),X=ct(L);Re(i,$,X),J?(h.array.next({name:$,values:ct(i)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&q.shouldDirty&&h.state.next({name:$,dirtyFields:sc(a,i),isDirty:P($,X)})):ee&&!ee._f&&!ar(X)?R($,X,q):I($,X,q),L0($,o)&&h.state.next({...r}),h.state.next({name:s.mount?$:void 0,values:ct(i)})},U=async $=>{s.mount=!0;const L=$.target;let q=L.name,ee=!0;const J=re(n,q),X=Ve=>{ee=Number.isNaN(Ve)||Hi(Ve)&&isNaN(Ve.getTime())||Qa(Ve,re(i,q,Ve))},fe=ho(t.mode),Le=ho(t.reValidateMode);if(J){let Ve,Vr;const Ed=L.type?qj(J._f):w6($),Da=$.type===Fj.BLUR||$.type===Fj.FOCUS_OUT,MI=!R6(J._f)&&!t.resolver&&!re(r.errors,q)&&!J._f.deps||L6(Da,re(r.touchedFields,q),r.isSubmitted,Le,fe),ry=L0(q,o,Da);Re(i,q,Ed),Da?(J._f.onBlur&&J._f.onBlur($),c&&c(0)):J._f.onChange&&J._f.onChange($);const ny=w(q,Ed,Da),DI=!tr(ny)||ry;if(!Da&&h.state.next({name:q,type:$.type,values:ct(i)}),MI)return(d.isValid||f.isValid)&&(t.mode==="onBlur"?Da&&y():Da||y()),DI&&h.state.next({name:q,...ry?{}:ny});if(!Da&&ry&&h.state.next({...r}),t.resolver){const{errors:lw}=await k([q]);if(X(Ed),ee){const LI=Gj(r.errors,n,q),cw=Gj(lw,n,LI.name||q);Ve=cw.error,q=cw.name,Vr=tr(lw)}}else g([q],!0),Ve=(await F0(J,o.disabled,i,p,t.shouldUseNativeValidation))[q],g([q]),X(Ed),ee&&(Ve?Vr=!1:(d.isValid||f.isValid)&&(Vr=await E(n,!0)));ee&&(J._f.deps&&V(J._f.deps),j(q,Vr,Ve,ny))}},D=($,L)=>{if(re(r.errors,L)&&$.focus)return $.focus(),1},V=async($,L={})=>{let q,ee;const J=gr($);if(t.resolver){const X=await _(Ze($)?$:J);q=tr(X),ee=$?!J.some(fe=>re(X,fe)):q}else $?(ee=(await Promise.all(J.map(async X=>{const fe=re(n,X);return await E(fe&&fe._f?{[X]:fe}:fe)}))).every(Boolean),!(!ee&&!r.isValid)&&y()):ee=q=await E(n);return h.state.next({...!Fn($)||(d.isValid||f.isValid)&&q!==r.isValid?{}:{name:$},...t.resolver||!$?{isValid:q}:{},errors:r.errors}),L.shouldFocus&&!ee&&Oo(n,D,$?J:o.mount),ee},H=$=>{const L={...s.mount?i:a};return Ze($)?L:Fn($)?re(L,$):$.map(q=>re(L,q))},Z=($,L)=>({invalid:!!re((L||r).errors,$),isDirty:!!re((L||r).dirtyFields,$),error:re((L||r).errors,$),isValidating:!!re(r.validatingFields,$),isTouched:!!re((L||r).touchedFields,$)}),K=$=>{$&&gr($).forEach(L=>vt(r.errors,L)),h.state.next({errors:$?r.errors:{}})},le=($,L,q)=>{const ee=(re(n,$,{_f:{}})._f||{}).ref,J=re(r.errors,$)||{},{ref:X,message:fe,type:Le,...Ve}=J;Re(r.errors,$,{...Ve,...L,ref:ee}),h.state.next({name:$,errors:r.errors,isValid:!1}),q&&q.shouldFocus&&ee&&ee.focus&&ee.focus()},we=($,L)=>vn($)?h.state.subscribe({next:q=>$(T(void 0,L),q)}):T($,L,!0),Ae=$=>h.state.subscribe({next:L=>{D6($.name,L.name,$.exact)&&M6(L,$.formState||d,zt,$.reRenderRoot)&&$.callback({values:{...i},...r,...L})}}).unsubscribe,De=$=>(s.mount=!0,f={...f,...$.formState},Ae({...$,formState:f})),st=($,L={})=>{for(const q of $?gr($):o.mount)o.mount.delete(q),o.array.delete(q),L.keepValue||(vt(n,q),vt(i,q)),!L.keepError&&vt(r.errors,q),!L.keepDirty&&vt(r.dirtyFields,q),!L.keepTouched&&vt(r.touchedFields,q),!L.keepIsValidating&&vt(r.validatingFields,q),!t.shouldUnregister&&!L.keepDefaultValue&&vt(a,q);h.state.next({values:ct(i)}),h.state.next({...r,...L.keepDirty?{isDirty:P()}:{}}),!L.keepIsValid&&y()},gt=({disabled:$,name:L})=>{($n($)&&s.mount||$||o.disabled.has(L))&&($?o.disabled.add(L):o.disabled.delete(L))},z=($,L={})=>{let q=re(n,$);const ee=$n(L.disabled)||$n(t.disabled);return Re(n,$,{...q||{},_f:{...q&&q._f?q._f:{ref:{name:$}},name:$,mount:!0,...L}}),o.mount.add($),q?gt({disabled:$n(L.disabled)?L.disabled:t.disabled,name:$}):S($,!0,L.value),{...ee?{disabled:L.disabled||t.disabled}:{},...t.progressive?{required:!!L.required,min:oc(L.min),max:oc(L.max),minLength:oc(L.minLength),maxLength:oc(L.maxLength),pattern:oc(L.pattern)}:{},name:$,onChange:U,onBlur:U,ref:J=>{if(J){z($,L),q=re(n,$);const X=Ze(J.value)&&J.querySelectorAll&&J.querySelectorAll("input,select,textarea")[0]||J,fe=P6(X),Le=q._f.refs||[];if(fe?Le.find(Ve=>Ve===X):X===q._f.ref)return;Re(n,$,{_f:{...q._f,...fe?{refs:[...Le.filter(Iy),X,...Array.isArray(re(a,$))?[{}]:[]],ref:{type:X.type,name:$}}:{ref:X}}}),S($,!1,void 0,X)}else q=re(n,$,{}),q._f&&(q._f.mount=!1),(t.shouldUnregister||L.shouldUnregister)&&!(S6(o.array,$)&&s.action)&&o.unMount.add($)}}},ne=()=>t.shouldFocusError&&Oo(n,D,o.mount),ue=$=>{$n($)&&(h.state.next({disabled:$}),Oo(n,(L,q)=>{const ee=re(n,q);ee&&(L.disabled=ee._f.disabled||$,Array.isArray(ee._f.refs)&&ee._f.refs.forEach(J=>{J.disabled=ee._f.disabled||$}))},0,!1))},G=($,L)=>async q=>{let ee;q&&(q.preventDefault&&q.preventDefault(),q.persist&&q.persist());let J=ct(i);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:X,values:fe}=await k();r.errors=X,J=fe}else await E(n);if(o.disabled.size)for(const X of o.disabled)Re(J,X,void 0);if(vt(r.errors,"root"),tr(r.errors)){h.state.next({errors:{}});try{await $(J,q)}catch(X){ee=X}}else L&&await L({...r.errors},q),ne(),setTimeout(ne);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:tr(r.errors)&&!ee,submitCount:r.submitCount+1,errors:r.errors}),ee)throw ee},Ce=($,L={})=>{re(n,$)&&(Ze(L.defaultValue)?F($,ct(re(a,$))):(F($,L.defaultValue),Re(a,$,ct(L.defaultValue))),L.keepTouched||vt(r.touchedFields,$),L.keepDirty||(vt(r.dirtyFields,$),r.isDirty=L.defaultValue?P($,ct(re(a,$))):P()),L.keepError||(vt(r.errors,$),d.isValid&&y()),h.state.next({...r}))},oe=($,L={})=>{const q=$?ct($):a,ee=ct(q),J=tr($),X=J?a:ee;if(L.keepDefaultValues||(a=q),!L.keepValues){if(L.keepDirtyValues){const fe=new Set([...o.mount,...Object.keys(sc(a,i))]);for(const Le of Array.from(fe))re(r.dirtyFields,Le)?Re(X,Le,re(i,Le)):F(Le,re(X,Le))}else{if(Cb&&Ze($))for(const fe of o.mount){const Le=re(n,fe);if(Le&&Le._f){const Ve=Array.isArray(Le._f.refs)?Le._f.refs[0]:Le._f.ref;if(gh(Ve)){const Vr=Ve.closest("form");if(Vr){Vr.reset();break}}}}for(const fe of o.mount)F(fe,re(X,fe))}i=ct(X),h.array.next({values:{...X}}),h.state.next({values:{...X}})}o={mount:L.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!L.keepIsValid||!!L.keepDirtyValues,s.watch=!!t.shouldUnregister,h.state.next({submitCount:L.keepSubmitCount?r.submitCount:0,isDirty:J?!1:L.keepDirty?r.isDirty:!!(L.keepDefaultValues&&!Qa($,a)),isSubmitted:L.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:J?{}:L.keepDirtyValues?L.keepDefaultValues&&i?sc(a,i):r.dirtyFields:L.keepDefaultValues&&$?sc(a,$):L.keepDirty?r.dirtyFields:{},touchedFields:L.keepTouched?r.touchedFields:{},errors:L.keepErrors?r.errors:{},isSubmitSuccessful:L.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},ot=($,L)=>oe(vn($)?$(i):$,L),ht=($,L={})=>{const q=re(n,$),ee=q&&q._f;if(ee){const J=ee.refs?ee.refs[0]:ee.ref;J.focus&&(J.focus(),L.shouldSelect&&vn(J.select)&&J.select())}},zt=$=>{r={...r,...$}},Jn={control:{register:z,unregister:st,getFieldState:Z,handleSubmit:G,setError:le,_subscribe:Ae,_runSchema:k,_focusError:ne,_getWatch:T,_getDirty:P,_setValid:y,_setFieldArray:b,_setDisabledField:gt,_setErrors:v,_getFieldArray:M,_reset:oe,_resetDefaultValues:()=>vn(t.defaultValues)&&t.defaultValues().then($=>{ot($,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:O,_disableForm:ue,_subjects:h,_proxyFormState:d,get _fields(){return n},get _formValues(){return i},get _state(){return s},set _state($){s=$},get _defaultValues(){return a},get _names(){return o},set _names($){o=$},get _formState(){return r},get _options(){return t},set _options($){t={...t,...$}}},subscribe:De,trigger:V,register:z,handleSubmit:G,watch:we,setValue:F,getValues:H,reset:ot,resetField:Ce,clearErrors:K,unregister:st,setError:le,setFocus:ht,getFieldState:Z};return{...Jn,formControl:Jn}}var Ua=()=>{const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=(Math.random()*16+e)%16|0;return(t=="x"?r:r&3|8).toString(16)})},Ry=(e,t,r={})=>r.shouldFocus||Ze(r.shouldFocus)?r.focusName||`${e}.${Ze(r.focusIndex)?t:r.focusIndex}.`:"",My=(e,t)=>[...e,...gr(t)],Dy=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Ly(e,t,r){return[...e.slice(0,t),...gr(r),...e.slice(t)]}var Fy=(e,t,r)=>Array.isArray(e)?(Ze(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[],Uy=(e,t)=>[...gr(t),...gr(e)];function z6(e,t){let r=0;const n=[...e];for(const a of t)n.splice(a-r,1),r++;return yd(n).length?n:[]}var By=(e,t)=>Ze(t)?[]:z6(e,gr(t).sort((r,n)=>r-n)),zy=(e,t,r)=>{[e[t],e[r]]=[e[r],e[t]]},Kj=(e,t,r)=>(e[t]=r,e);function V6(e){const t=O6(),{control:r=t.control,name:n,keyName:a="id",shouldUnregister:i,rules:s}=e,[o,c]=A.useState(r._getFieldArray(n)),u=A.useRef(r._getFieldArray(n).map(Ua)),d=A.useRef(o),f=A.useRef(n),h=A.useRef(!1);f.current=n,d.current=o,r._names.array.add(n),s&&r.register(n,s),A.useEffect(()=>r._subjects.array.subscribe({next:({values:j,name:k})=>{if(k===f.current||!k){const _=re(j,f.current);Array.isArray(_)&&(c(_),u.current=_.map(Ua))}}}).unsubscribe,[r]);const p=A.useCallback(j=>{h.current=!0,r._setFieldArray(n,j)},[r,n]),m=(j,k)=>{const _=gr(ct(j)),E=My(r._getFieldArray(n),_);r._names.focus=Ry(n,E.length-1,k),u.current=My(u.current,_.map(Ua)),p(E),c(E),r._setFieldArray(n,E,My,{argA:Dy(j)})},y=(j,k)=>{const _=gr(ct(j)),E=Uy(r._getFieldArray(n),_);r._names.focus=Ry(n,0,k),u.current=Uy(u.current,_.map(Ua)),p(E),c(E),r._setFieldArray(n,E,Uy,{argA:Dy(j)})},g=j=>{const k=By(r._getFieldArray(n),j);u.current=By(u.current,j),p(k),c(k),!Array.isArray(re(r._fields,n))&&Re(r._fields,n,void 0),r._setFieldArray(n,k,By,{argA:j})},b=(j,k,_)=>{const E=gr(ct(k)),O=Ly(r._getFieldArray(n),j,E);r._names.focus=Ry(n,j,_),u.current=Ly(u.current,j,E.map(Ua)),p(O),c(O),r._setFieldArray(n,O,Ly,{argA:j,argB:Dy(k)})},x=(j,k)=>{const _=r._getFieldArray(n);zy(_,j,k),zy(u.current,j,k),p(_),c(_),r._setFieldArray(n,_,zy,{argA:j,argB:k},!1)},v=(j,k)=>{const _=r._getFieldArray(n);Fy(_,j,k),Fy(u.current,j,k),p(_),c(_),r._setFieldArray(n,_,Fy,{argA:j,argB:k},!1)},S=(j,k)=>{const _=ct(k),E=Kj(r._getFieldArray(n),j,_);u.current=[...E].map((O,P)=>!O||P===j?Ua():u.current[P]),p(E),c([...E]),r._setFieldArray(n,E,Kj,{argA:j,argB:_},!0,!1)},w=j=>{const k=gr(ct(j));u.current=k.map(Ua),p([...k]),c([...k]),r._setFieldArray(n,[...k],_=>_,{},!0,!1)};return A.useEffect(()=>{if(r._state.action=!1,L0(n,r._names)&&r._subjects.state.next({...r._formState}),h.current&&(!ho(r._options.mode).isOnSubmit||r._formState.isSubmitted)&&!ho(r._options.reValidateMode).isOnSubmit)if(r._options.resolver)r._runSchema([n]).then(j=>{const k=re(j.errors,n),_=re(r._formState.errors,n);(_?!k&&_.type||k&&(_.type!==k.type||_.message!==k.message):k&&k.type)&&(k?Re(r._formState.errors,n,k):vt(r._formState.errors,n),r._subjects.state.next({errors:r._formState.errors}))});else{const j=re(r._fields,n);j&&j._f&&!(ho(r._options.reValidateMode).isOnSubmit&&ho(r._options.mode).isOnSubmit)&&F0(j,r._names.disabled,r._formValues,r._options.criteriaMode===Yr.all,r._options.shouldUseNativeValidation,!0).then(k=>!tr(k)&&r._subjects.state.next({errors:JA(r._formState.errors,k,n)}))}r._subjects.state.next({name:n,values:ct(r._formValues)}),r._names.focus&&Oo(r._fields,(j,k)=>{if(r._names.focus&&k.startsWith(r._names.focus)&&j.focus)return j.focus(),1}),r._names.focus="",r._setValid(),h.current=!1},[o,n,r]),A.useEffect(()=>(!re(r._formValues,n)&&r._setFieldArray(n),()=>{const j=(k,_)=>{const E=re(r._fields,k);E&&E._f&&(E._f.mount=_)};r._options.shouldUnregister||i?r.unregister(n):j(n,!1)}),[n,r,a,i]),{swap:A.useCallback(x,[p,n,r]),move:A.useCallback(v,[p,n,r]),prepend:A.useCallback(y,[p,n,r]),append:A.useCallback(m,[p,n,r]),remove:A.useCallback(g,[p,n,r]),insert:A.useCallback(b,[p,n,r]),update:A.useCallback(S,[p,n,r]),replace:A.useCallback(w,[p,n,r]),fields:A.useMemo(()=>o.map((j,k)=>({...j,[a]:u.current[k]||Ua()})),[o,a])}}function Rs(e={}){const t=A.useRef(void 0),r=A.useRef(void 0),[n,a]=A.useState({isDirty:!1,isValidating:!1,isLoading:vn(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:vn(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...e.formControl?e.formControl:B6(e),formState:n},e.formControl&&e.defaultValues&&!vn(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const i=t.current.control;return i._options=e,E6(()=>{const s=i._subscribe({formState:i._proxyFormState,callback:()=>a({...i._formState}),reRenderRoot:!0});return a(o=>({...o,isReady:!0})),i._formState.isReady=!0,s},[i]),A.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),A.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),A.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),A.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),A.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==n.isDirty&&i._subjects.state.next({isDirty:s})}},[i,n.isDirty]),A.useEffect(()=>{e.values&&!Qa(e.values,r.current)?(i._reset(e.values,i._options.resetOptions),r.current=e.values,a(s=>({...s}))):i._resetDefaultValues()},[i,e.values]),A.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=N6(n,i),t.current}const Qj=(e,t,r)=>{if(e&&"reportValidity"in e){const n=re(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},eP=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Qj(n.ref,r,e):n&&n.refs&&n.refs.forEach(a=>Qj(a,r,e))}},q6=(e,t)=>{t.shouldUseNativeValidation&&eP(e,t);const r={};for(const n in e){const a=re(t.fields,n),i=Object.assign(e[n]||{},{ref:a&&a.ref});if(W6(t.names||Object.keys(e),n)){const s=Object.assign({},re(r,n));Re(s,"root",i),Re(r,n,s)}else Re(r,n,i)}return r},W6=(e,t)=>{const r=Xj(t);return e.some(n=>Xj(n).match(`^${r}\\.\\d+`))};function Xj(e){return e.replace(/\]|\[/g,"")}function Ms(e,t,r){return r===void 0&&(r={}),function(n,a,i){try{return Promise.resolve(function(s,o){try{var c=(t!=null&&t.context,Promise.resolve(e[r.mode==="sync"?"validateSync":"validate"](n,Object.assign({abortEarly:!1},t,{context:a}))).then(function(u){return i.shouldUseNativeValidation&&eP({},i),{values:r.raw?Object.assign({},n):u,errors:{}}}))}catch(u){return o(u)}return c&&c.then?c.then(void 0,o):c}(0,function(s){if(!s.inner)throw s;return{values:{},errors:q6((o=s,c=!i.shouldUseNativeValidation&&i.criteriaMode==="all",(o.inner||[]).reduce(function(u,d){if(u[d.path]||(u[d.path]={message:d.message,type:d.type}),c){var f=u[d.path].types,h=f&&f[d.type];u[d.path]=GA(d.path,c,u,d.type,h?[].concat(h,d.message):d.message)}return u},{})),i)};var o,c}))}catch(s){return Promise.reject(s)}}}const Ta=({children:e,className:t=""})=>l.jsx("h1",{className:`text-xl sm:text-2xl lg:text-3xl font-bold text-gray-900 dark:text-gray-100 ${t}`,children:e}),G6=({children:e,className:t=""})=>l.jsx("p",{className:`text-sm sm:text-base text-gray-600 dark:text-gray-400 mt-1 ${t}`,children:e}),xn=({children:e,className:t=""})=>l.jsx("h2",{className:`text-lg sm:text-xl font-semibold text-gray-900 dark:text-gray-100 ${t}`,children:e}),bh=({children:e,className:t=""})=>l.jsx("h3",{className:`text-base sm:text-lg font-medium text-gray-900 dark:text-gray-100 ${t}`,children:e}),Qp=({children:e,className:t=""})=>l.jsx("h3",{className:`text-base sm:text-lg font-semibold text-gray-900 dark:text-gray-100 ${t}`,children:e}),Xa=({children:e,className:t=""})=>l.jsx("div",{className:`text-lg sm:text-xl lg:text-2xl font-semibold text-gray-900 dark:text-gray-100 ${t}`,children:e}),H6=({children:e,className:t=""})=>l.jsx("dt",{className:`text-xs sm:text-sm font-medium text-gray-500 dark:text-gray-400 truncate ${t}`,children:e}),lc=({children:e,className:t=""})=>l.jsx("p",{className:`text-sm sm:text-base text-gray-700 dark:text-gray-300 ${t}`,children:e}),Yj=({children:e,className:t=""})=>l.jsx("p",{className:`text-xs sm:text-sm text-gray-600 dark:text-gray-400 ${t}`,children:e}),fu=({children:e,htmlFor:t,className:r=""})=>l.jsx("label",{htmlFor:t,className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 ${r}`,children:e}),Cl=({title:e,subtitle:t,backButton:r,actions:n,className:a=""})=>l.jsx("div",{className:`space-y-3 sm:space-y-4 ${a}`,children:l.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:items-center sm:gap-4 sm:space-y-0",children:[r&&l.jsx("div",{className:"flex-shrink-0",children:r}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx(Ta,{className:"break-words",children:e}),t&&l.jsx(G6,{className:"break-words",children:t})]})]})}),_r=({children:e,className:t=""})=>l.jsx("div",{className:`p-4 sm:p-6 lg:p-8 space-y-4 sm:space-y-6 max-w-none ${t}`,children:e}),tt=A.forwardRef(({label:e,error:t,helperText:r,inputSize:n="md",className:a,id:i,...s},o)=>{const u=ve("w-full border rounded-lg transition-all duration-200 focus:outline-none focus:ring-2",{sm:"px-3 py-2 text-sm",md:"px-3 py-3 text-base",lg:"px-4 py-4 text-lg"}[n],t?"border-red-300 focus:border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:border-primary-500 focus:ring-primary-500","bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100","placeholder-gray-500 dark:placeholder-gray-400",a);return l.jsxs("div",{className:"space-y-1",children:[e&&l.jsx(fu,{htmlFor:i,children:e}),l.jsx("input",{ref:o,id:i,className:u,...s}),r&&!t&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:r}),t&&l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:t})]})});function Ds(e){this._maxSize=e,this.clear()}Ds.prototype.clear=function(){this._size=0,this._values=Object.create(null)};Ds.prototype.get=function(e){return this._values[e]};Ds.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var K6=/[^.^\]^[]+|(?=\[\]|\.\.)/g,tP=/^\d+$/,Q6=/^\d/,X6=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,Y6=/^\s*(['"]?)(.*?)(\1)\s*$/,Mb=512,Zj=new Ds(Mb),Jj=new Ds(Mb),eS=new Ds(Mb),ds={Cache:Ds,split:U0,normalizePath:Vy,setter:function(e){var t=Vy(e);return Jj.get(e)||Jj.set(e,function(n,a){for(var i=0,s=t.length,o=n;ie.match(rL)||[],Yp=e=>e[0].toUpperCase()+e.slice(1),Lb=(e,t)=>Xp(e).join(t).toLowerCase(),rP=e=>Xp(e).reduce((t,r)=>`${t}${t?r[0].toUpperCase()+r.slice(1).toLowerCase():r.toLowerCase()}`,""),nL=e=>Yp(rP(e)),aL=e=>Lb(e,"_"),iL=e=>Lb(e,"-"),sL=e=>Yp(Lb(e," ")),oL=e=>Xp(e).map(Yp).join(" ");var qy={words:Xp,upperFirst:Yp,camelCase:rP,pascalCase:nL,snakeCase:aL,kebabCase:iL,sentenceCase:sL,titleCase:oL},Fb={exports:{}};Fb.exports=function(e){return nP(lL(e),e)};Fb.exports.array=nP;function nP(e,t){var r=e.length,n=new Array(r),a={},i=r,s=cL(t),o=uL(e);for(t.forEach(function(u){if(!o.has(u[0])||!o.has(u[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});i--;)a[i]||c(e[i],i,new Set);return n;function c(u,d,f){if(f.has(u)){var h;try{h=", node was:"+JSON.stringify(u)}catch{h=""}throw new Error("Cyclic dependency"+h)}if(!o.has(u))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(u));if(!a[d]){a[d]=!0;var p=s.get(u)||new Set;if(p=Array.from(p),d=p.length){f.add(u);do{var m=p[--d];c(m,o.get(m),f)}while(d);f.delete(u)}n[--r]=u}}}function lL(e){for(var t=new Set,r=0,n=e.length;r"",gL=/^Symbol\((.*)\)(.*)$/;function vL(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function tS(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const r=typeof e;if(r==="number")return vL(e);if(r==="string")return t?`"${e}"`:e;if(r==="function")return"[Function "+(e.name||"anonymous")+"]";if(r==="symbol")return yL.call(e).replace(gL,"Symbol($1)");const n=hL.call(e).slice(8,-1);return n==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):n==="Error"||e instanceof Error?"["+pL.call(e)+"]":n==="RegExp"?mL.call(e):null}function ya(e,t){let r=tS(e,t);return r!==null?r:JSON.stringify(e,function(n,a){let i=tS(this[n],t);return i!==null?i:a},2)}function aP(e){return e==null?[]:[].concat(e)}let iP,sP,oP,xL=/\$\{\s*(\w+)\s*\}/g;iP=Symbol.toStringTag;class rS{constructor(t,r,n,a){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[iP]="Error",this.name="ValidationError",this.value=r,this.path=n,this.type=a,this.errors=[],this.inner=[],aP(t).forEach(i=>{if(mr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}sP=Symbol.hasInstance;oP=Symbol.toStringTag;class mr extends Error{static formatError(t,r){const n=r.label||r.path||"this";return r=Object.assign({},r,{path:n,originalPath:r.path}),typeof t=="string"?t.replace(xL,(a,i)=>ya(r[i])):typeof t=="function"?t(r):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,r,n,a,i){const s=new rS(t,r,n,a);if(i)return s;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[oP]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,mr)}static[sP](t){return rS[Symbol.hasInstance](t)||super[Symbol.hasInstance](t)}}let In={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:r,originalValue:n})=>{const a=n!=null&&n!==r?` (cast from the value \`${ya(n,!0)}\`).`:".";return t!=="mixed"?`${e} must be a \`${t}\` type, but the final value was: \`${ya(r,!0)}\``+a:`${e} must match the configured type. The validated value was: \`${ya(r,!0)}\``+a}},dr={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},za={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},B0={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},z0={isValue:"${path} field must be ${value}"},Pf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Tf={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},bL={notType:e=>{const{path:t,value:r,spec:n}=e,a=n.types.length;if(Array.isArray(r)){if(r.lengtha)return`${t} tuple value has too many items, expected a length of ${a} but got ${r.length} for value: \`${ya(r,!0)}\``}return mr.formatError(In.notType,e)}};Object.assign(Object.create(null),{mixed:In,string:dr,number:za,date:B0,object:Pf,array:Tf,boolean:z0,tuple:bL});const Zp=e=>e&&e.__isYupSchema__;class wh{static fromOptions(t,r){if(!r.then&&!r.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:a,otherwise:i}=r,s=typeof n=="function"?n:(...o)=>o.every(c=>c===n);return new wh(t,(o,c)=>{var u;let d=s(...o)?a:i;return(u=d==null?void 0:d(c))!=null?u:c})}constructor(t,r){this.fn=void 0,this.refs=t,this.refs=t,this.fn=r}resolve(t,r){let n=this.refs.map(i=>i.getValue(r==null?void 0:r.value,r==null?void 0:r.parent,r==null?void 0:r.context)),a=this.fn(n,t,r);if(a===void 0||a===t)return t;if(!Zp(a))throw new TypeError("conditions must return a schema object");return a.resolve(r)}}const Yd={context:"$",value:"."};class Ls{constructor(t,r={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof t!="string")throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),t==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Yd.context,this.isValue=this.key[0]===Yd.value,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?Yd.context:this.isValue?Yd.value:"";this.path=this.key.slice(n.length),this.getter=this.path&&ds.getter(this.path,!0),this.map=r.map}getValue(t,r,n){let a=this.isContext?n:this.isValue?t:r;return this.getter&&(a=this.getter(a||{})),this.map&&(a=this.map(a)),a}cast(t,r){return this.getValue(t,r==null?void 0:r.parent,r==null?void 0:r.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}Ls.prototype.__isYupRef=!0;const wn=e=>e==null;function Qs(e){function t({value:r,path:n="",options:a,originalValue:i,schema:s},o,c){const{name:u,test:d,params:f,message:h,skipAbsent:p}=e;let{parent:m,context:y,abortEarly:g=s.spec.abortEarly,disableStackTrace:b=s.spec.disableStackTrace}=a;function x(P){return Ls.isRef(P)?P.getValue(r,m,y):P}function v(P={}){const T=Object.assign({value:r,originalValue:i,label:s.spec.label,path:P.path||n,spec:s.spec,disableStackTrace:P.disableStackTrace||b},f,P.params);for(const I of Object.keys(T))T[I]=x(T[I]);const M=new mr(mr.formatError(P.message||h,T),r,T.path,P.type||u,T.disableStackTrace);return M.params=T,M}const S=g?o:c;let w={path:n,parent:m,type:u,from:a.from,createError:v,resolve:x,options:a,originalValue:i,schema:s};const j=P=>{mr.isError(P)?S(P):P?c(null):S(v())},k=P=>{mr.isError(P)?S(P):o(P)};if(p&&wn(r))return j(!0);let E;try{var O;if(E=d.call(w,r,w),typeof((O=E)==null?void 0:O.then)=="function"){if(a.sync)throw new Error(`Validation test of type: "${w.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(E).then(j,k)}}catch(P){k(P);return}j(E)}return t.OPTIONS=e,t}function wL(e,t,r,n=r){let a,i,s;return t?(ds.forEach(t,(o,c,u)=>{let d=c?o.slice(1,o.length-1):o;e=e.resolve({context:n,parent:a,value:r});let f=e.type==="tuple",h=u?parseInt(d,10):0;if(e.innerType||f){if(f&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${s}" must contain an index to the tuple element, e.g. "${s}[0]"`);if(r&&h>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${o}, in the path: ${t}. because there is no value at that index. `);a=r,r=r&&r[h],e=f?e.spec.types[h]:e.innerType}if(!u){if(!e.fields||!e.fields[d])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${s} which is a type: "${e.type}")`);a=r,r=r&&r[d],e=e.fields[d]}i=d,s=c?"["+o+"]":"."+o}),{schema:e,parent:a,parentPath:i}):{parent:a,parentPath:t,schema:e}}class jh extends Set{describe(){const t=[];for(const r of this.values())t.push(Ls.isRef(r)?r.describe():r);return t}resolveAll(t){let r=[];for(const n of this.values())r.push(t(n));return r}clone(){return new jh(this.values())}merge(t,r){const n=this.clone();return t.forEach(a=>n.add(a)),r.forEach(a=>n.delete(a)),n}}function po(e,t=new Map){if(Zp(e)||!e||typeof e!="object")return e;if(t.has(e))return t.get(e);let r;if(e instanceof Date)r=new Date(e.getTime()),t.set(e,r);else if(e instanceof RegExp)r=new RegExp(e),t.set(e,r);else if(Array.isArray(e)){r=new Array(e.length),t.set(e,r);for(let n=0;n{this.typeError(In.notType)}),this.type=t.type,this._typeCheck=t.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},t==null?void 0:t.spec),this.withMutation(r=>{r.nonNullable()})}get _type(){return this.type}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const r=Object.create(Object.getPrototypeOf(this));return r.type=this.type,r._typeCheck=this._typeCheck,r._whitelist=this._whitelist.clone(),r._blacklist=this._blacklist.clone(),r.internalTests=Object.assign({},this.internalTests),r.exclusiveTests=Object.assign({},this.exclusiveTests),r.deps=[...this.deps],r.conditions=[...this.conditions],r.tests=[...this.tests],r.transforms=[...this.transforms],r.spec=po(Object.assign({},this.spec,t)),r}label(t){let r=this.clone();return r.spec.label=t,r}meta(...t){if(t.length===0)return this.spec.meta;let r=this.clone();return r.spec.meta=Object.assign(r.spec.meta||{},t[0]),r}withMutation(t){let r=this._mutate;this._mutate=!0;let n=t(this);return this._mutate=r,n}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let r=this,n=t.clone();const a=Object.assign({},r.spec,n.spec);return n.spec=a,n.internalTests=Object.assign({},r.internalTests,n.internalTests),n._whitelist=r._whitelist.merge(t._whitelist,t._blacklist),n._blacklist=r._blacklist.merge(t._blacklist,t._whitelist),n.tests=r.tests,n.exclusiveTests=r.exclusiveTests,n.withMutation(i=>{t.tests.forEach(s=>{i.test(s.OPTIONS)})}),n.transforms=[...r.transforms,...n.transforms],n}isType(t){return t==null?!!(this.spec.nullable&&t===null||this.spec.optional&&t===void 0):this._typeCheck(t)}resolve(t){let r=this;if(r.conditions.length){let n=r.conditions;r=r.clone(),r.conditions=[],r=n.reduce((a,i)=>i.resolve(a,t),r),r=r.resolve(t)}return r}resolveOptions(t){var r,n,a,i;return Object.assign({},t,{from:t.from||[],strict:(r=t.strict)!=null?r:this.spec.strict,abortEarly:(n=t.abortEarly)!=null?n:this.spec.abortEarly,recursive:(a=t.recursive)!=null?a:this.spec.recursive,disableStackTrace:(i=t.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(t,r={}){let n=this.resolve(Object.assign({value:t},r)),a=r.assert==="ignore-optionality",i=n._cast(t,r);if(r.assert!==!1&&!n.isType(i)){if(a&&wn(i))return i;let s=ya(t),o=ya(i);throw new TypeError(`The value of ${r.path||"field"} could not be cast to a value that satisfies the schema type: "${n.type}". - -attempted value: ${s} -`+(o!==s?`result of cast: ${o}`:""))}return i}_cast(t,r){let n=t===void 0?t:this.transforms.reduce((a,i)=>i.call(this,a,t,this),t);return n===void 0&&(n=this.getDefault(r)),n}_validate(t,r={},n,a){let{path:i,originalValue:s=t,strict:o=this.spec.strict}=r,c=t;o||(c=this._cast(c,Object.assign({assert:!1},r)));let u=[];for(let d of Object.values(this.internalTests))d&&u.push(d);this.runTests({path:i,value:c,originalValue:s,options:r,tests:u},n,d=>{if(d.length)return a(d,c);this.runTests({path:i,value:c,originalValue:s,options:r,tests:this.tests},n,a)})}runTests(t,r,n){let a=!1,{tests:i,value:s,originalValue:o,path:c,options:u}=t,d=y=>{a||(a=!0,r(y,s))},f=y=>{a||(a=!0,n(y,s))},h=i.length,p=[];if(!h)return f([]);let m={value:s,originalValue:o,path:c,options:u,schema:this};for(let y=0;ythis.resolve(d)._validate(u,d,h,p)}validate(t,r){var n;let a=this.resolve(Object.assign({},r,{value:t})),i=(n=r==null?void 0:r.disableStackTrace)!=null?n:a.spec.disableStackTrace;return new Promise((s,o)=>a._validate(t,r,(c,u)=>{mr.isError(c)&&(c.value=u),o(c)},(c,u)=>{c.length?o(new mr(c,u,void 0,void 0,i)):s(u)}))}validateSync(t,r){var n;let a=this.resolve(Object.assign({},r,{value:t})),i,s=(n=r==null?void 0:r.disableStackTrace)!=null?n:a.spec.disableStackTrace;return a._validate(t,Object.assign({},r,{sync:!0}),(o,c)=>{throw mr.isError(o)&&(o.value=c),o},(o,c)=>{if(o.length)throw new mr(o,t,void 0,void 0,s);i=c}),i}isValid(t,r){return this.validate(t,r).then(()=>!0,n=>{if(mr.isError(n))return!1;throw n})}isValidSync(t,r){try{return this.validateSync(t,r),!0}catch(n){if(mr.isError(n))return!1;throw n}}_getDefault(t){let r=this.spec.default;return r==null?r:typeof r=="function"?r.call(this,t):po(r)}getDefault(t){return this.resolve(t||{})._getDefault(t)}default(t){return arguments.length===0?this._getDefault():this.clone({default:t})}strict(t=!0){return this.clone({strict:t})}nullability(t,r){const n=this.clone({nullable:t});return n.internalTests.nullable=Qs({message:r,name:"nullable",test(a){return a===null?this.schema.spec.nullable:!0}}),n}optionality(t,r){const n=this.clone({optional:t});return n.internalTests.optionality=Qs({message:r,name:"optionality",test(a){return a===void 0?this.schema.spec.optional:!0}}),n}optional(){return this.optionality(!0)}defined(t=In.defined){return this.optionality(!1,t)}nullable(){return this.nullability(!0)}nonNullable(t=In.notNull){return this.nullability(!1,t)}required(t=In.required){return this.clone().withMutation(r=>r.nonNullable(t).defined(t))}notRequired(){return this.clone().withMutation(t=>t.nullable().optional())}transform(t){let r=this.clone();return r.transforms.push(t),r}test(...t){let r;if(t.length===1?typeof t[0]=="function"?r={test:t[0]}:r=t[0]:t.length===2?r={name:t[0],test:t[1]}:r={name:t[0],message:t[1],test:t[2]},r.message===void 0&&(r.message=In.default),typeof r.test!="function")throw new TypeError("`test` is a required parameters");let n=this.clone(),a=Qs(r),i=r.exclusive||r.name&&n.exclusiveTests[r.name]===!0;if(r.exclusive&&!r.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return r.name&&(n.exclusiveTests[r.name]=!!r.exclusive),n.tests=n.tests.filter(s=>!(s.OPTIONS.name===r.name&&(i||s.OPTIONS.test===a.OPTIONS.test))),n.tests.push(a),n}when(t,r){!Array.isArray(t)&&typeof t!="string"&&(r=t,t=".");let n=this.clone(),a=aP(t).map(i=>new Ls(i));return a.forEach(i=>{i.isSibling&&n.deps.push(i.key)}),n.conditions.push(typeof r=="function"?new wh(a,r):wh.fromOptions(a,r)),n}typeError(t){let r=this.clone();return r.internalTests.typeError=Qs({message:t,name:"typeError",skipAbsent:!0,test(n){return this.schema._typeCheck(n)?!0:this.createError({params:{type:this.schema.type}})}}),r}oneOf(t,r=In.oneOf){let n=this.clone();return t.forEach(a=>{n._whitelist.add(a),n._blacklist.delete(a)}),n.internalTests.whiteList=Qs({message:r,name:"oneOf",skipAbsent:!0,test(a){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(a)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),n}notOneOf(t,r=In.notOneOf){let n=this.clone();return t.forEach(a=>{n._blacklist.add(a),n._whitelist.delete(a)}),n.internalTests.blacklist=Qs({message:r,name:"notOneOf",test(a){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(a)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),n}strip(t=!0){let r=this.clone();return r.spec.strip=t,r}describe(t){const r=(t?this.resolve(t):this).clone(),{label:n,meta:a,optional:i,nullable:s}=r.spec;return{meta:a,label:n,optional:i,nullable:s,default:r.getDefault(t),type:r.type,oneOf:r._whitelist.describe(),notOneOf:r._blacklist.describe(),tests:r.tests.map(c=>({name:c.OPTIONS.name,params:c.OPTIONS.params})).filter((c,u,d)=>d.findIndex(f=>f.name===c.name)===u)}}}Ur.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])Ur.prototype[`${e}At`]=function(t,r,n={}){const{parent:a,parentPath:i,schema:s}=wL(this,t,r,n.context);return s[e](a&&a[i],Object.assign({},n,{parent:a,path:t}))};for(const e of["equals","is"])Ur.prototype[e]=Ur.prototype.oneOf;for(const e of["not","nope"])Ur.prototype[e]=Ur.prototype.notOneOf;function Ub(){return new lP}class lP extends Ur{constructor(){super({type:"boolean",check(t){return t instanceof Boolean&&(t=t.valueOf()),typeof t=="boolean"}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(n.spec.coerce&&!n.isType(t)){if(/^(true|1)$/i.test(String(t)))return!0;if(/^(false|0)$/i.test(String(t)))return!1}return t})})}isTrue(t=z0.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"true"},test(r){return wn(r)||r===!0}})}isFalse(t=z0.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"false"},test(r){return wn(r)||r===!1}})}default(t){return super.default(t)}defined(t){return super.defined(t)}optional(){return super.optional()}required(t){return super.required(t)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(t){return super.nonNullable(t)}strip(t){return super.strip(t)}}Ub.prototype=lP.prototype;const jL=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function SL(e){const t=V0(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(t.z===void 0&&t.plusMinus===void 0)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let r=0;return t.z!=="Z"&&t.plusMinus!==void 0&&(r=t.hourOffset*60+t.minuteOffset,t.plusMinus==="+"&&(r=0-r)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+r,t.second,t.millisecond)}function V0(e){var t,r;const n=jL.exec(e);return n?{year:ra(n[1]),month:ra(n[2],1)-1,day:ra(n[3],1),hour:ra(n[4]),minute:ra(n[5]),second:ra(n[6]),millisecond:n[7]?ra(n[7].substring(0,3)):0,precision:(t=(r=n[7])==null?void 0:r.length)!=null?t:void 0,z:n[8]||void 0,plusMinus:n[9]||void 0,hourOffset:ra(n[10]),minuteOffset:ra(n[11])}:null}function ra(e,t=0){return Number(e)||t}let kL=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,_L=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,OL=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,NL="^\\d{4}-\\d{2}-\\d{2}",EL="\\d{2}:\\d{2}:\\d{2}",AL="(([+-]\\d{2}(:?\\d{2})?)|Z)",PL=new RegExp(`${NL}T${EL}(\\.\\d+)?${AL}$`),TL=e=>wn(e)||e===e.trim(),CL={}.toString();function Se(){return new cP}class cP extends Ur{constructor(){super({type:"string",check(t){return t instanceof String&&(t=t.valueOf()),typeof t=="string"}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(!n.spec.coerce||n.isType(t)||Array.isArray(t))return t;const a=t!=null&&t.toString?t.toString():t;return a===CL?t:a})})}required(t){return super.required(t).withMutation(r=>r.test({message:t||In.required,name:"required",skipAbsent:!0,test:n=>!!n.length}))}notRequired(){return super.notRequired().withMutation(t=>(t.tests=t.tests.filter(r=>r.OPTIONS.name!=="required"),t))}length(t,r=dr.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(n){return n.length===this.resolve(t)}})}min(t,r=dr.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(n){return n.length>=this.resolve(t)}})}max(t,r=dr.max){return this.test({name:"max",exclusive:!0,message:r,params:{max:t},skipAbsent:!0,test(n){return n.length<=this.resolve(t)}})}matches(t,r){let n=!1,a,i;return r&&(typeof r=="object"?{excludeEmptyString:n=!1,message:a,name:i}=r:a=r),this.test({name:i||"matches",message:a||dr.matches,params:{regex:t},skipAbsent:!0,test:s=>s===""&&n||s.search(t)!==-1})}email(t=dr.email){return this.matches(kL,{name:"email",message:t,excludeEmptyString:!0})}url(t=dr.url){return this.matches(_L,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=dr.uuid){return this.matches(OL,{name:"uuid",message:t,excludeEmptyString:!1})}datetime(t){let r="",n,a;return t&&(typeof t=="object"?{message:r="",allowOffset:n=!1,precision:a=void 0}=t:r=t),this.matches(PL,{name:"datetime",message:r||dr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||dr.datetime_offset,params:{allowOffset:n},skipAbsent:!0,test:i=>{if(!i||n)return!0;const s=V0(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:r||dr.datetime_precision,params:{precision:a},skipAbsent:!0,test:i=>{if(!i||a==null)return!0;const s=V0(i);return s?s.precision===a:!1}})}ensure(){return this.default("").transform(t=>t===null?"":t)}trim(t=dr.trim){return this.transform(r=>r!=null?r.trim():r).test({message:t,name:"trim",test:TL})}lowercase(t=dr.lowercase){return this.transform(r=>wn(r)?r:r.toLowerCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>wn(r)||r===r.toLowerCase()})}uppercase(t=dr.uppercase){return this.transform(r=>wn(r)?r:r.toUpperCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>wn(r)||r===r.toUpperCase()})}}Se.prototype=cP.prototype;let $L=e=>e!=+e;function Ki(){return new uP}class uP extends Ur{constructor(){super({type:"number",check(t){return t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&!$L(t)}}),this.withMutation(()=>{this.transform((t,r,n)=>{if(!n.spec.coerce)return t;let a=t;if(typeof a=="string"){if(a=a.replace(/\s/g,""),a==="")return NaN;a=+a}return n.isType(a)||a===null?a:parseFloat(a)})})}min(t,r=za.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(n){return n>=this.resolve(t)}})}max(t,r=za.max){return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(n){return n<=this.resolve(t)}})}lessThan(t,r=za.lessThan){return this.test({message:r,name:"max",exclusive:!0,params:{less:t},skipAbsent:!0,test(n){return nthis.resolve(t)}})}positive(t=za.positive){return this.moreThan(0,t)}negative(t=za.negative){return this.lessThan(0,t)}integer(t=za.integer){return this.test({name:"integer",message:t,skipAbsent:!0,test:r=>Number.isInteger(r)})}truncate(){return this.transform(t=>wn(t)?t:t|0)}round(t){var r;let n=["ceil","floor","round","trunc"];if(t=((r=t)==null?void 0:r.toLowerCase())||"round",t==="trunc")return this.truncate();if(n.indexOf(t.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+n.join(", "));return this.transform(a=>wn(a)?a:Math[t](a))}}Ki.prototype=uP.prototype;let IL=new Date(""),RL=e=>Object.prototype.toString.call(e)==="[object Date]";class Jp extends Ur{constructor(){super({type:"date",check(t){return RL(t)&&!isNaN(t.getTime())}}),this.withMutation(()=>{this.transform((t,r,n)=>!n.spec.coerce||n.isType(t)||t===null?t:(t=SL(t),isNaN(t)?Jp.INVALID_DATE:new Date(t)))})}prepareParam(t,r){let n;if(Ls.isRef(t))n=t;else{let a=this.cast(t);if(!this._typeCheck(a))throw new TypeError(`\`${r}\` must be a Date or a value that can be \`cast()\` to a Date`);n=a}return n}min(t,r=B0.min){let n=this.prepareParam(t,"min");return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(a){return a>=this.resolve(n)}})}max(t,r=B0.max){let n=this.prepareParam(t,"max");return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(a){return a<=this.resolve(n)}})}}Jp.INVALID_DATE=IL;Jp.prototype;function ML(e,t=[]){let r=[],n=new Set,a=new Set(t.map(([s,o])=>`${s}-${o}`));function i(s,o){let c=ds.split(s)[0];n.add(c),a.has(`${o}-${c}`)||r.push([o,c])}for(const s of Object.keys(e)){let o=e[s];n.add(s),Ls.isRef(o)&&o.isSibling?i(o.path,s):Zp(o)&&"deps"in o&&o.deps.forEach(c=>i(c,s))}return fL.array(Array.from(n),r).reverse()}function nS(e,t){let r=1/0;return e.some((n,a)=>{var i;if((i=t.path)!=null&&i.includes(n))return r=a,!0}),r}function dP(e){return(t,r)=>nS(e,t)-nS(e,r)}const fP=(e,t,r)=>{if(typeof e!="string")return e;let n=e;try{n=JSON.parse(e)}catch{}return r.isType(n)?n:e};function Cf(e){if("fields"in e){const t={};for(const[r,n]of Object.entries(e.fields))t[r]=Cf(n);return e.setFields(t)}if(e.type==="array"){const t=e.optional();return t.innerType&&(t.innerType=Cf(t.innerType)),t}return e.type==="tuple"?e.optional().clone({types:e.spec.types.map(Cf)}):"optional"in e?e.optional():e}const DL=(e,t)=>{const r=[...ds.normalizePath(t)];if(r.length===1)return r[0]in e;let n=r.pop(),a=ds.getter(ds.join(r),!0)(e);return!!(a&&n in a)};let aS=e=>Object.prototype.toString.call(e)==="[object Object]";function iS(e,t){let r=Object.keys(e.fields);return Object.keys(t).filter(n=>r.indexOf(n)===-1)}const LL=dP([]);function jr(e){return new hP(e)}class hP extends Ur{constructor(t){super({type:"object",check(r){return aS(r)||typeof r=="function"}}),this.fields=Object.create(null),this._sortErrors=LL,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{t&&this.shape(t)})}_cast(t,r={}){var n;let a=super._cast(t,r);if(a===void 0)return this.getDefault(r);if(!this._typeCheck(a))return a;let i=this.fields,s=(n=r.stripUnknown)!=null?n:this.spec.noUnknown,o=[].concat(this._nodes,Object.keys(a).filter(f=>!this._nodes.includes(f))),c={},u=Object.assign({},r,{parent:c,__validating:r.__validating||!1}),d=!1;for(const f of o){let h=i[f],p=f in a;if(h){let m,y=a[f];u.path=(r.path?`${r.path}.`:"")+f,h=h.resolve({value:y,context:r.context,parent:c});let g=h instanceof Ur?h.spec:void 0,b=g==null?void 0:g.strict;if(g!=null&&g.strip){d=d||f in a;continue}m=!r.__validating||!b?h.cast(a[f],u):a[f],m!==void 0&&(c[f]=m)}else p&&!s&&(c[f]=a[f]);(p!==f in c||c[f]!==a[f])&&(d=!0)}return d?c:a}_validate(t,r={},n,a){let{from:i=[],originalValue:s=t,recursive:o=this.spec.recursive}=r;r.from=[{schema:this,value:s},...i],r.__validating=!0,r.originalValue=s,super._validate(t,r,n,(c,u)=>{if(!o||!aS(u)){a(c,u);return}s=s||u;let d=[];for(let f of this._nodes){let h=this.fields[f];!h||Ls.isRef(h)||d.push(h.asNestedTest({options:r,key:f,parent:u,parentPath:r.path,originalParent:s}))}this.runTests({tests:d,value:u,originalValue:s,options:r},n,f=>{a(f.sort(this._sortErrors).concat(c),u)})})}clone(t){const r=super.clone(t);return r.fields=Object.assign({},this.fields),r._nodes=this._nodes,r._excludedEdges=this._excludedEdges,r._sortErrors=this._sortErrors,r}concat(t){let r=super.concat(t),n=r.fields;for(let[a,i]of Object.entries(this.fields)){const s=n[a];n[a]=s===void 0?i:s}return r.withMutation(a=>a.setFields(n,[...this._excludedEdges,...t._excludedEdges]))}_getDefault(t){if("default"in this.spec)return super._getDefault(t);if(!this._nodes.length)return;let r={};return this._nodes.forEach(n=>{var a;const i=this.fields[n];let s=t;(a=s)!=null&&a.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[n]})),r[n]=i&&"getDefault"in i?i.getDefault(s):void 0}),r}setFields(t,r){let n=this.clone();return n.fields=t,n._nodes=ML(t,r),n._sortErrors=dP(Object.keys(t)),r&&(n._excludedEdges=r),n}shape(t,r=[]){return this.clone().withMutation(n=>{let a=n._excludedEdges;return r.length&&(Array.isArray(r[0])||(r=[r]),a=[...n._excludedEdges,...r]),n.setFields(Object.assign(n.fields,t),a)})}partial(){const t={};for(const[r,n]of Object.entries(this.fields))t[r]="optional"in n&&n.optional instanceof Function?n.optional():n;return this.setFields(t)}deepPartial(){return Cf(this)}pick(t){const r={};for(const n of t)this.fields[n]&&(r[n]=this.fields[n]);return this.setFields(r,this._excludedEdges.filter(([n,a])=>t.includes(n)&&t.includes(a)))}omit(t){const r=[];for(const n of Object.keys(this.fields))t.includes(n)||r.push(n);return this.pick(r)}from(t,r,n){let a=ds.getter(t,!0);return this.transform(i=>{if(!i)return i;let s=i;return DL(i,t)&&(s=Object.assign({},i),n||delete s[t],s[r]=a(i)),s})}json(){return this.transform(fP)}exact(t){return this.test({name:"exact",exclusive:!0,message:t||Pf.exact,test(r){if(r==null)return!0;const n=iS(this.schema,r);return n.length===0||this.createError({params:{properties:n.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(t=!0,r=Pf.noUnknown){typeof t!="boolean"&&(r=t,t=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:r,test(a){if(a==null)return!0;const i=iS(this.schema,a);return!t||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return n.spec.noUnknown=t,n}unknown(t=!0,r=Pf.noUnknown){return this.noUnknown(!t,r)}transformKeys(t){return this.transform(r=>{if(!r)return r;const n={};for(const a of Object.keys(r))n[t(a)]=r[a];return n})}camelCase(){return this.transformKeys(qy.camelCase)}snakeCase(){return this.transformKeys(qy.snakeCase)}constantCase(){return this.transformKeys(t=>qy.snakeCase(t).toUpperCase())}describe(t){const r=(t?this.resolve(t):this).clone(),n=super.describe(t);n.fields={};for(const[i,s]of Object.entries(r.fields)){var a;let o=t;(a=o)!=null&&a.value&&(o=Object.assign({},o,{parent:o.value,value:o.value[i]})),n.fields[i]=s.describe(o)}return n}}jr.prototype=hP.prototype;function fs(e){return new pP(e)}class pP extends Ur{constructor(t){super({type:"array",spec:{types:t},check(r){return Array.isArray(r)}}),this.innerType=void 0,this.innerType=t}_cast(t,r){const n=super._cast(t,r);if(!this._typeCheck(n)||!this.innerType)return n;let a=!1;const i=n.map((s,o)=>{const c=this.innerType.cast(s,Object.assign({},r,{path:`${r.path||""}[${o}]`}));return c!==s&&(a=!0),c});return a?i:n}_validate(t,r={},n,a){var i;let s=this.innerType,o=(i=r.recursive)!=null?i:this.spec.recursive;r.originalValue!=null&&r.originalValue,super._validate(t,r,n,(c,u)=>{var d;if(!o||!s||!this._typeCheck(u)){a(c,u);return}let f=new Array(u.length);for(let p=0;pa(p.concat(c),u))})}clone(t){const r=super.clone(t);return r.innerType=this.innerType,r}json(){return this.transform(fP)}concat(t){let r=super.concat(t);return r.innerType=this.innerType,t.innerType&&(r.innerType=r.innerType?r.innerType.concat(t.innerType):t.innerType),r}of(t){let r=this.clone();if(!Zp(t))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+ya(t));return r.innerType=t,r.spec=Object.assign({},r.spec,{types:t}),r}length(t,r=Tf.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(n){return n.length===this.resolve(t)}})}min(t,r){return r=r||Tf.min,this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(n){return n.length>=this.resolve(t)}})}max(t,r){return r=r||Tf.max,this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(n){return n.length<=this.resolve(t)}})}ensure(){return this.default(()=>[]).transform((t,r)=>this._typeCheck(t)?t:r==null?[]:[].concat(r))}compact(t){let r=t?(n,a,i)=>!t(n,a,i):n=>!!n;return this.transform(n=>n!=null?n.filter(r):n)}describe(t){const r=(t?this.resolve(t):this).clone(),n=super.describe(t);if(r.innerType){var a;let i=t;(a=i)!=null&&a.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[0]})),n.innerType=r.innerType.describe(i)}return n}}fs.prototype=pP.prototype;const FL=jr({username:Se().required("نام کاربری الزامی است").min(3,"نام کاربری باید حداقل ۳ کاراکتر باشد"),password:Se().required("رمز عبور الزامی است").min(6,"رمز عبور باید حداقل ۶ کاراکتر باشد")});jr({name:Se().required("نام الزامی است").min(2,"نام باید حداقل ۲ کاراکتر باشد"),email:Se().required("ایمیل الزامی است").email("فرمت ایمیل صحیح نیست"),phone:Se().required("شماره تلفن الزامی است").matches(/^09\d{9}$/,"شماره تلفن صحیح نیست"),role:Se().required("نقش الزامی است"),password:Se().optional().min(6,"رمز عبور باید حداقل ۶ کاراکتر باشد")});jr({siteName:Se().required("نام سایت الزامی است"),siteDescription:Se().required("توضیحات سایت الزامی است"),adminEmail:Se().required("ایمیل مدیر الزامی است").email("فرمت ایمیل صحیح نیست"),language:Se().required("زبان الزامی است")});const de={ADMIN_LOGIN:"admin_login",GET_DISCOUNT_DETAIL:"get_discount_detail",GET_DRAFT_DETAIL:"get_draft_detail",GET_ADMIN_USERS:"get_admin_users",GET_ADMIN_USER:"get_admin_user",CREATE_ADMIN_USER:"create_admin_user",UPDATE_ADMIN_USER:"update_admin_user",DELETE_ADMIN_USER:"delete_admin_user",GET_ROLES:"get_roles",GET_ROLE:"get_role",CREATE_ROLE:"create_role",UPDATE_ROLE:"update_role",DELETE_ROLE:"delete_role",GET_ROLE_PERMISSIONS:"get_role_permissions",ASSIGN_ROLE_PERMISSION:"assign_role_permission",REMOVE_ROLE_PERMISSION:"remove_role_permission",GET_PERMISSIONS:"get_permissions",GET_PERMISSION:"get_permission",CREATE_PERMISSION:"create_permission",UPDATE_PERMISSION:"update_permission",DELETE_PERMISSION:"delete_permission",GET_PRODUCT_OPTIONS:"get_product_options",GET_PRODUCT_OPTION:"get_product_option",CREATE_PRODUCT_OPTION:"create_product_option",UPDATE_PRODUCT_OPTION:"update_product_option",DELETE_PRODUCT_OPTION:"delete_product_option",GET_CATEGORIES:"get_categories",GET_CATEGORY:"get_category",CREATE_CATEGORY:"create_category",UPDATE_CATEGORY:"update_category",DELETE_CATEGORY:"delete_category",GET_PRODUCTS:"get_products",GET_PRODUCT:"get_product",CREATE_PRODUCT:"create_product",UPDATE_PRODUCT:"update_product",DELETE_PRODUCT:"delete_product",GET_PRODUCT_VARIANTS:"get_product_variants",CREATE_PRODUCT_VARIANT:"create_product_variant",UPDATE_PRODUCT_VARIANT:"update_product_variant",DELETE_PRODUCT_VARIANT:"delete_product_variant",GET_FILES:"get_files",UPLOAD_FILE:"upload_file",GET_FILE:"get_file",UPDATE_FILE:"update_file",DELETE_FILE:"delete_file",GET_IMAGES:"get_images",CREATE_IMAGE:"create_image",UPDATE_IMAGE:"update_image",DELETE_IMAGE:"delete_image"};function mP(e,t){return function(){return e.apply(t,arguments)}}const{toString:UL}=Object.prototype,{getPrototypeOf:Bb}=Object,{iterator:em,toStringTag:yP}=Symbol,tm=(e=>t=>{const r=UL.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),En=e=>(e=e.toLowerCase(),t=>tm(t)===e),rm=e=>t=>typeof t===e,{isArray:$l}=Array,hu=rm("undefined");function BL(e){return e!==null&&!hu(e)&&e.constructor!==null&&!hu(e.constructor)&&Sr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const gP=En("ArrayBuffer");function zL(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&gP(e.buffer),t}const VL=rm("string"),Sr=rm("function"),vP=rm("number"),nm=e=>e!==null&&typeof e=="object",qL=e=>e===!0||e===!1,$f=e=>{if(tm(e)!=="object")return!1;const t=Bb(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(yP in e)&&!(em in e)},WL=En("Date"),GL=En("File"),HL=En("Blob"),KL=En("FileList"),QL=e=>nm(e)&&Sr(e.pipe),XL=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Sr(e.append)&&((t=tm(e))==="formdata"||t==="object"&&Sr(e.toString)&&e.toString()==="[object FormData]"))},YL=En("URLSearchParams"),[ZL,JL,eF,tF]=["ReadableStream","Request","Response","Headers"].map(En),rF=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function gd(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,a;if(typeof e!="object"&&(e=[e]),$l(e))for(n=0,a=e.length;n0;)if(a=r[n],t===a.toLowerCase())return a;return null}const Qi=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),bP=e=>!hu(e)&&e!==Qi;function q0(){const{caseless:e}=bP(this)&&this||{},t={},r=(n,a)=>{const i=e&&xP(t,a)||a;$f(t[i])&&$f(n)?t[i]=q0(t[i],n):$f(n)?t[i]=q0({},n):$l(n)?t[i]=n.slice():t[i]=n};for(let n=0,a=arguments.length;n(gd(t,(a,i)=>{r&&Sr(a)?e[i]=mP(a,r):e[i]=a},{allOwnKeys:n}),e),aF=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),iF=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},sF=(e,t,r,n)=>{let a,i,s;const o={};if(t=t||{},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),i=a.length;i-- >0;)s=a[i],(!n||n(s,e,t))&&!o[s]&&(t[s]=e[s],o[s]=!0);e=r!==!1&&Bb(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},oF=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},lF=e=>{if(!e)return null;if($l(e))return e;let t=e.length;if(!vP(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},cF=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Bb(Uint8Array)),uF=(e,t)=>{const n=(e&&e[em]).call(e);let a;for(;(a=n.next())&&!a.done;){const i=a.value;t.call(e,i[0],i[1])}},dF=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},fF=En("HTMLFormElement"),hF=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,a){return n.toUpperCase()+a}),sS=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),pF=En("RegExp"),wP=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};gd(r,(a,i)=>{let s;(s=t(a,i,e))!==!1&&(n[i]=s||a)}),Object.defineProperties(e,n)},mF=e=>{wP(e,(t,r)=>{if(Sr(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(Sr(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},yF=(e,t)=>{const r={},n=a=>{a.forEach(i=>{r[i]=!0})};return $l(e)?n(e):n(String(e).split(t)),r},gF=()=>{},vF=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function xF(e){return!!(e&&Sr(e.append)&&e[yP]==="FormData"&&e[em])}const bF=e=>{const t=new Array(10),r=(n,a)=>{if(nm(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[a]=n;const i=$l(n)?[]:{};return gd(n,(s,o)=>{const c=r(s,a+1);!hu(c)&&(i[o]=c)}),t[a]=void 0,i}}return n};return r(e,0)},wF=En("AsyncFunction"),jF=e=>e&&(nm(e)||Sr(e))&&Sr(e.then)&&Sr(e.catch),jP=((e,t)=>e?setImmediate:t?((r,n)=>(Qi.addEventListener("message",({source:a,data:i})=>{a===Qi&&i===r&&n.length&&n.shift()()},!1),a=>{n.push(a),Qi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Sr(Qi.postMessage)),SF=typeof queueMicrotask<"u"?queueMicrotask.bind(Qi):typeof process<"u"&&process.nextTick||jP,kF=e=>e!=null&&Sr(e[em]),B={isArray:$l,isArrayBuffer:gP,isBuffer:BL,isFormData:XL,isArrayBufferView:zL,isString:VL,isNumber:vP,isBoolean:qL,isObject:nm,isPlainObject:$f,isReadableStream:ZL,isRequest:JL,isResponse:eF,isHeaders:tF,isUndefined:hu,isDate:WL,isFile:GL,isBlob:HL,isRegExp:pF,isFunction:Sr,isStream:QL,isURLSearchParams:YL,isTypedArray:cF,isFileList:KL,forEach:gd,merge:q0,extend:nF,trim:rF,stripBOM:aF,inherits:iF,toFlatObject:sF,kindOf:tm,kindOfTest:En,endsWith:oF,toArray:lF,forEachEntry:uF,matchAll:dF,isHTMLForm:fF,hasOwnProperty:sS,hasOwnProp:sS,reduceDescriptors:wP,freezeMethods:mF,toObjectSet:yF,toCamelCase:hF,noop:gF,toFiniteNumber:vF,findKey:xP,global:Qi,isContextDefined:bP,isSpecCompliantForm:xF,toJSONObject:bF,isAsyncFn:wF,isThenable:jF,setImmediate:jP,asap:SF,isIterable:kF};function be(e,t,r,n,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),a&&(this.response=a,this.status=a.status?a.status:null)}B.inherits(be,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:B.toJSONObject(this.config),code:this.code,status:this.status}}});const SP=be.prototype,kP={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{kP[e]={value:e}});Object.defineProperties(be,kP);Object.defineProperty(SP,"isAxiosError",{value:!0});be.from=(e,t,r,n,a,i)=>{const s=Object.create(SP);return B.toFlatObject(e,s,function(c){return c!==Error.prototype},o=>o!=="isAxiosError"),be.call(s,e.message,t,r,n,a),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};const _F=null;function W0(e){return B.isPlainObject(e)||B.isArray(e)}function _P(e){return B.endsWith(e,"[]")?e.slice(0,-2):e}function oS(e,t,r){return e?e.concat(t).map(function(a,i){return a=_P(a),!r&&i?"["+a+"]":a}).join(r?".":""):t}function OF(e){return B.isArray(e)&&!e.some(W0)}const NF=B.toFlatObject(B,{},null,function(t){return/^is[A-Z]/.test(t)});function am(e,t,r){if(!B.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=B.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,g){return!B.isUndefined(g[y])});const n=r.metaTokens,a=r.visitor||d,i=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&B.isSpecCompliantForm(t);if(!B.isFunction(a))throw new TypeError("visitor must be a function");function u(m){if(m===null)return"";if(B.isDate(m))return m.toISOString();if(!c&&B.isBlob(m))throw new be("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(m)||B.isTypedArray(m)?c&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function d(m,y,g){let b=m;if(m&&!g&&typeof m=="object"){if(B.endsWith(y,"{}"))y=n?y:y.slice(0,-2),m=JSON.stringify(m);else if(B.isArray(m)&&OF(m)||(B.isFileList(m)||B.endsWith(y,"[]"))&&(b=B.toArray(m)))return y=_P(y),b.forEach(function(v,S){!(B.isUndefined(v)||v===null)&&t.append(s===!0?oS([y],S,i):s===null?y:y+"[]",u(v))}),!1}return W0(m)?!0:(t.append(oS(g,y,i),u(m)),!1)}const f=[],h=Object.assign(NF,{defaultVisitor:d,convertValue:u,isVisitable:W0});function p(m,y){if(!B.isUndefined(m)){if(f.indexOf(m)!==-1)throw Error("Circular reference detected in "+y.join("."));f.push(m),B.forEach(m,function(b,x){(!(B.isUndefined(b)||b===null)&&a.call(t,b,B.isString(x)?x.trim():x,y,h))===!0&&p(b,y?y.concat(x):[x])}),f.pop()}}if(!B.isObject(e))throw new TypeError("data must be an object");return p(e),t}function lS(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function zb(e,t){this._pairs=[],e&&am(e,this,t)}const OP=zb.prototype;OP.append=function(t,r){this._pairs.push([t,r])};OP.toString=function(t){const r=t?function(n){return t.call(this,n,lS)}:lS;return this._pairs.map(function(a){return r(a[0])+"="+r(a[1])},"").join("&")};function EF(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function NP(e,t,r){if(!t)return e;const n=r&&r.encode||EF;B.isFunction(r)&&(r={serialize:r});const a=r&&r.serialize;let i;if(a?i=a(t,r):i=B.isURLSearchParams(t)?t.toString():new zb(t,r).toString(n),i){const s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class AF{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){B.forEach(this.handlers,function(n){n!==null&&t(n)})}}const cS=AF,EP={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},PF=typeof URLSearchParams<"u"?URLSearchParams:zb,TF=typeof FormData<"u"?FormData:null,CF=typeof Blob<"u"?Blob:null,$F={isBrowser:!0,classes:{URLSearchParams:PF,FormData:TF,Blob:CF},protocols:["http","https","file","blob","url","data"]},Vb=typeof window<"u"&&typeof document<"u",G0=typeof navigator=="object"&&navigator||void 0,IF=Vb&&(!G0||["ReactNative","NativeScript","NS"].indexOf(G0.product)<0),RF=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),MF=Vb&&window.location.href||"http://localhost",DF=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Vb,hasStandardBrowserEnv:IF,hasStandardBrowserWebWorkerEnv:RF,navigator:G0,origin:MF},Symbol.toStringTag,{value:"Module"})),Qt={...DF,...$F};function LF(e,t){return am(e,new Qt.classes.URLSearchParams,Object.assign({visitor:function(r,n,a,i){return Qt.isNode&&B.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function FF(e){return B.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function UF(e){const t={},r=Object.keys(e);let n;const a=r.length;let i;for(n=0;n=r.length;return s=!s&&B.isArray(a)?a.length:s,c?(B.hasOwnProp(a,s)?a[s]=[a[s],n]:a[s]=n,!o):((!a[s]||!B.isObject(a[s]))&&(a[s]=[]),t(r,n,a[s],i)&&B.isArray(a[s])&&(a[s]=UF(a[s])),!o)}if(B.isFormData(e)&&B.isFunction(e.entries)){const r={};return B.forEachEntry(e,(n,a)=>{t(FF(n),a,r,0)}),r}return null}function BF(e,t,r){if(B.isString(e))try{return(t||JSON.parse)(e),B.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const qb={transitional:EP,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",a=n.indexOf("application/json")>-1,i=B.isObject(t);if(i&&B.isHTMLForm(t)&&(t=new FormData(t)),B.isFormData(t))return a?JSON.stringify(AP(t)):t;if(B.isArrayBuffer(t)||B.isBuffer(t)||B.isStream(t)||B.isFile(t)||B.isBlob(t)||B.isReadableStream(t))return t;if(B.isArrayBufferView(t))return t.buffer;if(B.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return LF(t,this.formSerializer).toString();if((o=B.isFileList(t))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return am(o?{"files[]":t}:t,c&&new c,this.formSerializer)}}return i||a?(r.setContentType("application/json",!1),BF(t)):t}],transformResponse:[function(t){const r=this.transitional||qb.transitional,n=r&&r.forcedJSONParsing,a=this.responseType==="json";if(B.isResponse(t)||B.isReadableStream(t))return t;if(t&&B.isString(t)&&(n&&!this.responseType||a)){const s=!(r&&r.silentJSONParsing)&&a;try{return JSON.parse(t)}catch(o){if(s)throw o.name==="SyntaxError"?be.from(o,be.ERR_BAD_RESPONSE,this,null,this.response):o}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Qt.classes.FormData,Blob:Qt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};B.forEach(["delete","get","head","post","put","patch"],e=>{qb.headers[e]={}});const Wb=qb,zF=B.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),VF=e=>{const t={};let r,n,a;return e&&e.split(` -`).forEach(function(s){a=s.indexOf(":"),r=s.substring(0,a).trim().toLowerCase(),n=s.substring(a+1).trim(),!(!r||t[r]&&zF[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t},uS=Symbol("internals");function cc(e){return e&&String(e).trim().toLowerCase()}function If(e){return e===!1||e==null?e:B.isArray(e)?e.map(If):String(e)}function qF(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const WF=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Wy(e,t,r,n,a){if(B.isFunction(n))return n.call(this,t,r);if(a&&(t=r),!!B.isString(t)){if(B.isString(n))return t.indexOf(n)!==-1;if(B.isRegExp(n))return n.test(t)}}function GF(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function HF(e,t){const r=B.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(a,i,s){return this[n].call(this,t,a,i,s)},configurable:!0})})}class im{constructor(t){t&&this.set(t)}set(t,r,n){const a=this;function i(o,c,u){const d=cc(c);if(!d)throw new Error("header name must be a non-empty string");const f=B.findKey(a,d);(!f||a[f]===void 0||u===!0||u===void 0&&a[f]!==!1)&&(a[f||c]=If(o))}const s=(o,c)=>B.forEach(o,(u,d)=>i(u,d,c));if(B.isPlainObject(t)||t instanceof this.constructor)s(t,r);else if(B.isString(t)&&(t=t.trim())&&!WF(t))s(VF(t),r);else if(B.isObject(t)&&B.isIterable(t)){let o={},c,u;for(const d of t){if(!B.isArray(d))throw TypeError("Object iterator must return a key-value pair");o[u=d[0]]=(c=o[u])?B.isArray(c)?[...c,d[1]]:[c,d[1]]:d[1]}s(o,r)}else t!=null&&i(r,t,n);return this}get(t,r){if(t=cc(t),t){const n=B.findKey(this,t);if(n){const a=this[n];if(!r)return a;if(r===!0)return qF(a);if(B.isFunction(r))return r.call(this,a,n);if(B.isRegExp(r))return r.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=cc(t),t){const n=B.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Wy(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let a=!1;function i(s){if(s=cc(s),s){const o=B.findKey(n,s);o&&(!r||Wy(n,n[o],o,r))&&(delete n[o],a=!0)}}return B.isArray(t)?t.forEach(i):i(t),a}clear(t){const r=Object.keys(this);let n=r.length,a=!1;for(;n--;){const i=r[n];(!t||Wy(this,this[i],i,t,!0))&&(delete this[i],a=!0)}return a}normalize(t){const r=this,n={};return B.forEach(this,(a,i)=>{const s=B.findKey(n,i);if(s){r[s]=If(a),delete r[i];return}const o=t?GF(i):String(i).trim();o!==i&&delete r[i],r[o]=If(a),n[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return B.forEach(this,(n,a)=>{n!=null&&n!==!1&&(r[a]=t&&B.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(a=>n.set(a)),n}static accessor(t){const n=(this[uS]=this[uS]={accessors:{}}).accessors,a=this.prototype;function i(s){const o=cc(s);n[o]||(HF(a,s),n[o]=!0)}return B.isArray(t)?t.forEach(i):i(t),this}}im.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);B.reduceDescriptors(im.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});B.freezeMethods(im);const kn=im;function Gy(e,t){const r=this||Wb,n=t||r,a=kn.from(n.headers);let i=n.data;return B.forEach(e,function(o){i=o.call(r,i,a.normalize(),t?t.status:void 0)}),a.normalize(),i}function PP(e){return!!(e&&e.__CANCEL__)}function Il(e,t,r){be.call(this,e??"canceled",be.ERR_CANCELED,t,r),this.name="CanceledError"}B.inherits(Il,be,{__CANCEL__:!0});function TP(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new be("Request failed with status code "+r.status,[be.ERR_BAD_REQUEST,be.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function KF(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function QF(e,t){e=e||10;const r=new Array(e),n=new Array(e);let a=0,i=0,s;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=n[i];s||(s=u),r[a]=c,n[a]=u;let f=i,h=0;for(;f!==a;)h+=r[f++],f=f%e;if(a=(a+1)%e,a===i&&(i=(i+1)%e),u-s{r=d,a=null,i&&(clearTimeout(i),i=null),e.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-r;f>=n?s(u,d):(a=u,i||(i=setTimeout(()=>{i=null,s(a)},n-f)))},()=>a&&s(a)]}const Sh=(e,t,r=3)=>{let n=0;const a=QF(50,250);return XF(i=>{const s=i.loaded,o=i.lengthComputable?i.total:void 0,c=s-n,u=a(c),d=s<=o;n=s;const f={loaded:s,total:o,progress:o?s/o:void 0,bytes:c,rate:u||void 0,estimated:u&&o&&d?(o-s)/u:void 0,event:i,lengthComputable:o!=null,[t?"download":"upload"]:!0};e(f)},r)},dS=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},fS=e=>(...t)=>B.asap(()=>e(...t)),YF=Qt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Qt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Qt.origin),Qt.navigator&&/(msie|trident)/i.test(Qt.navigator.userAgent)):()=>!0,ZF=Qt.hasStandardBrowserEnv?{write(e,t,r,n,a,i){const s=[e+"="+encodeURIComponent(t)];B.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),B.isString(n)&&s.push("path="+n),B.isString(a)&&s.push("domain="+a),i===!0&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function JF(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function e5(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function CP(e,t,r){let n=!JF(t);return e&&(n||r==!1)?e5(e,t):t}const hS=e=>e instanceof kn?{...e}:e;function ks(e,t){t=t||{};const r={};function n(u,d,f,h){return B.isPlainObject(u)&&B.isPlainObject(d)?B.merge.call({caseless:h},u,d):B.isPlainObject(d)?B.merge({},d):B.isArray(d)?d.slice():d}function a(u,d,f,h){if(B.isUndefined(d)){if(!B.isUndefined(u))return n(void 0,u,f,h)}else return n(u,d,f,h)}function i(u,d){if(!B.isUndefined(d))return n(void 0,d)}function s(u,d){if(B.isUndefined(d)){if(!B.isUndefined(u))return n(void 0,u)}else return n(void 0,d)}function o(u,d,f){if(f in t)return n(u,d);if(f in e)return n(void 0,u)}const c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(u,d,f)=>a(hS(u),hS(d),f,!0)};return B.forEach(Object.keys(Object.assign({},e,t)),function(d){const f=c[d]||a,h=f(e[d],t[d],d);B.isUndefined(h)&&f!==o||(r[d]=h)}),r}const $P=e=>{const t=ks({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:i,headers:s,auth:o}=t;t.headers=s=kn.from(s),t.url=NP(CP(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):"")));let c;if(B.isFormData(r)){if(Qt.hasStandardBrowserEnv||Qt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((c=s.getContentType())!==!1){const[u,...d]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];s.setContentType([u||"multipart/form-data",...d].join("; "))}}if(Qt.hasStandardBrowserEnv&&(n&&B.isFunction(n)&&(n=n(t)),n||n!==!1&&YF(t.url))){const u=a&&i&&ZF.read(i);u&&s.set(a,u)}return t},t5=typeof XMLHttpRequest<"u",r5=t5&&function(e){return new Promise(function(r,n){const a=$P(e);let i=a.data;const s=kn.from(a.headers).normalize();let{responseType:o,onUploadProgress:c,onDownloadProgress:u}=a,d,f,h,p,m;function y(){p&&p(),m&&m(),a.cancelToken&&a.cancelToken.unsubscribe(d),a.signal&&a.signal.removeEventListener("abort",d)}let g=new XMLHttpRequest;g.open(a.method.toUpperCase(),a.url,!0),g.timeout=a.timeout;function b(){if(!g)return;const v=kn.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),w={data:!o||o==="text"||o==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:v,config:e,request:g};TP(function(k){r(k),y()},function(k){n(k),y()},w),g=null}"onloadend"in g?g.onloadend=b:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(b)},g.onabort=function(){g&&(n(new be("Request aborted",be.ECONNABORTED,e,g)),g=null)},g.onerror=function(){n(new be("Network Error",be.ERR_NETWORK,e,g)),g=null},g.ontimeout=function(){let S=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const w=a.transitional||EP;a.timeoutErrorMessage&&(S=a.timeoutErrorMessage),n(new be(S,w.clarifyTimeoutError?be.ETIMEDOUT:be.ECONNABORTED,e,g)),g=null},i===void 0&&s.setContentType(null),"setRequestHeader"in g&&B.forEach(s.toJSON(),function(S,w){g.setRequestHeader(w,S)}),B.isUndefined(a.withCredentials)||(g.withCredentials=!!a.withCredentials),o&&o!=="json"&&(g.responseType=a.responseType),u&&([h,m]=Sh(u,!0),g.addEventListener("progress",h)),c&&g.upload&&([f,p]=Sh(c),g.upload.addEventListener("progress",f),g.upload.addEventListener("loadend",p)),(a.cancelToken||a.signal)&&(d=v=>{g&&(n(!v||v.type?new Il(null,e,g):v),g.abort(),g=null)},a.cancelToken&&a.cancelToken.subscribe(d),a.signal&&(a.signal.aborted?d():a.signal.addEventListener("abort",d)));const x=KF(a.url);if(x&&Qt.protocols.indexOf(x)===-1){n(new be("Unsupported protocol "+x+":",be.ERR_BAD_REQUEST,e));return}g.send(i||null)})},n5=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,a;const i=function(u){if(!a){a=!0,o();const d=u instanceof Error?u:this.reason;n.abort(d instanceof be?d:new Il(d instanceof Error?d.message:d))}};let s=t&&setTimeout(()=>{s=null,i(new be(`timeout ${t} of ms exceeded`,be.ETIMEDOUT))},t);const o=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:c}=n;return c.unsubscribe=()=>B.asap(o),c}},a5=n5,i5=function*(e,t){let r=e.byteLength;if(!t||r{const a=s5(e,t);let i=0,s,o=c=>{s||(s=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await a.next();if(u){o(),c.close();return}let f=d.byteLength;if(r){let h=i+=f;r(h)}c.enqueue(new Uint8Array(d))}catch(u){throw o(u),u}},cancel(c){return o(c),a.return()}},{highWaterMark:2})},sm=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",IP=sm&&typeof ReadableStream=="function",l5=sm&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),RP=(e,...t)=>{try{return!!e(...t)}catch{return!1}},c5=IP&&RP(()=>{let e=!1;const t=new Request(Qt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),mS=64*1024,H0=IP&&RP(()=>B.isReadableStream(new Response("").body)),kh={stream:H0&&(e=>e.body)};sm&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!kh[t]&&(kh[t]=B.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new be(`Response type '${t}' is not supported`,be.ERR_NOT_SUPPORT,n)})})})(new Response);const u5=async e=>{if(e==null)return 0;if(B.isBlob(e))return e.size;if(B.isSpecCompliantForm(e))return(await new Request(Qt.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(B.isArrayBufferView(e)||B.isArrayBuffer(e))return e.byteLength;if(B.isURLSearchParams(e)&&(e=e+""),B.isString(e))return(await l5(e)).byteLength},d5=async(e,t)=>{const r=B.toFiniteNumber(e.getContentLength());return r??u5(t)},f5=sm&&(async e=>{let{url:t,method:r,data:n,signal:a,cancelToken:i,timeout:s,onDownloadProgress:o,onUploadProgress:c,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:h}=$P(e);u=u?(u+"").toLowerCase():"text";let p=a5([a,i&&i.toAbortSignal()],s),m;const y=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let g;try{if(c&&c5&&r!=="get"&&r!=="head"&&(g=await d5(d,n))!==0){let w=new Request(t,{method:"POST",body:n,duplex:"half"}),j;if(B.isFormData(n)&&(j=w.headers.get("content-type"))&&d.setContentType(j),w.body){const[k,_]=dS(g,Sh(fS(c)));n=pS(w.body,mS,k,_)}}B.isString(f)||(f=f?"include":"omit");const b="credentials"in Request.prototype;m=new Request(t,{...h,signal:p,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:b?f:void 0});let x=await fetch(m);const v=H0&&(u==="stream"||u==="response");if(H0&&(o||v&&y)){const w={};["status","statusText","headers"].forEach(E=>{w[E]=x[E]});const j=B.toFiniteNumber(x.headers.get("content-length")),[k,_]=o&&dS(j,Sh(fS(o),!0))||[];x=new Response(pS(x.body,mS,k,()=>{_&&_(),y&&y()}),w)}u=u||"text";let S=await kh[B.findKey(kh,u)||"text"](x,e);return!v&&y&&y(),await new Promise((w,j)=>{TP(w,j,{data:S,headers:kn.from(x.headers),status:x.status,statusText:x.statusText,config:e,request:m})})}catch(b){throw y&&y(),b&&b.name==="TypeError"&&/Load failed|fetch/i.test(b.message)?Object.assign(new be("Network Error",be.ERR_NETWORK,e,m),{cause:b.cause||b}):be.from(b,b&&b.code,e,m)}}),K0={http:_F,xhr:r5,fetch:f5};B.forEach(K0,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const yS=e=>`- ${e}`,h5=e=>B.isFunction(e)||e===null||e===!1,MP={getAdapter:e=>{e=B.isArray(e)?e:[e];const{length:t}=e;let r,n;const a={};for(let i=0;i`adapter ${o} `+(c===!1?"is not supported by the environment":"is not available in the build"));let s=t?i.length>1?`since : -`+i.map(yS).join(` -`):" "+yS(i[0]):"as no adapter specified";throw new be("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return n},adapters:K0};function Hy(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Il(null,e)}function gS(e){return Hy(e),e.headers=kn.from(e.headers),e.data=Gy.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),MP.getAdapter(e.adapter||Wb.adapter)(e).then(function(n){return Hy(e),n.data=Gy.call(e,e.transformResponse,n),n.headers=kn.from(n.headers),n},function(n){return PP(n)||(Hy(e),n&&n.response&&(n.response.data=Gy.call(e,e.transformResponse,n.response),n.response.headers=kn.from(n.response.headers))),Promise.reject(n)})}const DP="1.9.0",om={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{om[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const vS={};om.transitional=function(t,r,n){function a(i,s){return"[Axios v"+DP+"] Transitional option '"+i+"'"+s+(n?". "+n:"")}return(i,s,o)=>{if(t===!1)throw new be(a(s," has been removed"+(r?" in "+r:"")),be.ERR_DEPRECATED);return r&&!vS[s]&&(vS[s]=!0,console.warn(a(s," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,s,o):!0}};om.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function p5(e,t,r){if(typeof e!="object")throw new be("options must be an object",be.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const i=n[a],s=t[i];if(s){const o=e[i],c=o===void 0||s(o,i,e);if(c!==!0)throw new be("option "+i+" must be "+c,be.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new be("Unknown option "+i,be.ERR_BAD_OPTION)}}const Rf={assertOptions:p5,validators:om},Tn=Rf.validators;class _h{constructor(t){this.defaults=t||{},this.interceptors={request:new cS,response:new cS}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const i=a.stack?a.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=` -`+i):n.stack=i}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=ks(this.defaults,r);const{transitional:n,paramsSerializer:a,headers:i}=r;n!==void 0&&Rf.assertOptions(n,{silentJSONParsing:Tn.transitional(Tn.boolean),forcedJSONParsing:Tn.transitional(Tn.boolean),clarifyTimeoutError:Tn.transitional(Tn.boolean)},!1),a!=null&&(B.isFunction(a)?r.paramsSerializer={serialize:a}:Rf.assertOptions(a,{encode:Tn.function,serialize:Tn.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Rf.assertOptions(r,{baseUrl:Tn.spelling("baseURL"),withXsrfToken:Tn.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=i&&B.merge(i.common,i[r.method]);i&&B.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),r.headers=kn.concat(s,i);const o=[];let c=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(r)===!1||(c=c&&y.synchronous,o.unshift(y.fulfilled,y.rejected))});const u=[];this.interceptors.response.forEach(function(y){u.push(y.fulfilled,y.rejected)});let d,f=0,h;if(!c){const m=[gS.bind(this),void 0];for(m.unshift.apply(m,o),m.push.apply(m,u),h=m.length,d=Promise.resolve(r);f{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](a);n._listeners=null}),this.promise.then=a=>{let i;const s=new Promise(o=>{n.subscribe(o),i=o}).then(a);return s.cancel=function(){n.unsubscribe(i)},s},t(function(i,s,o){n.reason||(n.reason=new Il(i,s,o),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new Gb(function(a){t=a}),cancel:t}}}const m5=Gb;function y5(e){return function(r){return e.apply(null,r)}}function g5(e){return B.isObject(e)&&e.isAxiosError===!0}const Q0={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Q0).forEach(([e,t])=>{Q0[t]=e});const v5=Q0;function LP(e){const t=new Mf(e),r=mP(Mf.prototype.request,t);return B.extend(r,Mf.prototype,t,{allOwnKeys:!0}),B.extend(r,t,null,{allOwnKeys:!0}),r.create=function(a){return LP(ks(e,a))},r}const jt=LP(Wb);jt.Axios=Mf;jt.CanceledError=Il;jt.CancelToken=m5;jt.isCancel=PP;jt.VERSION=DP;jt.toFormData=am;jt.AxiosError=be;jt.Cancel=jt.CanceledError;jt.all=function(t){return Promise.all(t)};jt.spread=y5;jt.isAxiosError=g5;jt.mergeConfig=ks;jt.AxiosHeaders=kn;jt.formToJSON=e=>AP(B.isHTMLForm(e)?new FormData(e):e);jt.getAdapter=MP.getAdapter;jt.HttpStatusCode=v5;jt.default=jt;const Hb=jt,Kb="https://apimznstg.aireview.ir",x5=3e4,ke={ADMIN_LOGIN:"api/v1/admin/auth/login",GET_DISCOUNT_DETAIL:e=>`api/v1/discount-drafts/${e}`,GET_DRAFT_DETAIL:e=>`api/v1/drafts/${e}`,GET_ADMIN_USERS:"api/v1/admin/admin-users",GET_ADMIN_USER:e=>`api/v1/admin/admin-users/${e}`,CREATE_ADMIN_USER:"api/v1/admin/admin-users",UPDATE_ADMIN_USER:e=>`api/v1/admin/admin-users/${e}`,DELETE_ADMIN_USER:e=>`api/v1/admin/admin-users/${e}`,GET_ROLES:"api/v1/admin/roles",GET_ROLE:e=>`api/v1/admin/roles/${e}`,CREATE_ROLE:"api/v1/admin/roles",UPDATE_ROLE:e=>`api/v1/admin/roles/${e}`,DELETE_ROLE:e=>`api/v1/admin/roles/${e}`,GET_ROLE_PERMISSIONS:e=>`api/v1/admin/roles/${e}/permissions`,ASSIGN_ROLE_PERMISSION:(e,t)=>`api/v1/admin/roles/${e}/permissions/${t}`,REMOVE_ROLE_PERMISSION:(e,t)=>`api/v1/admin/roles/${e}/permissions/${t}`,GET_PERMISSIONS:"api/v1/admin/permissions",GET_PERMISSION:e=>`api/v1/admin/permissions/${e}`,CREATE_PERMISSION:"api/v1/admin/permissions",UPDATE_PERMISSION:e=>`api/v1/admin/permissions/${e}`,DELETE_PERMISSION:e=>`api/v1/admin/permissions/${e}`,GET_PRODUCT_OPTIONS:"api/v1/product-options",GET_PRODUCT_OPTION:e=>`api/v1/product-options/${e}`,CREATE_PRODUCT_OPTION:"api/v1/product-options",UPDATE_PRODUCT_OPTION:e=>`api/v1/product-options/${e}`,DELETE_PRODUCT_OPTION:e=>`api/v1/product-options/${e}`,GET_CATEGORIES:"api/v1/products/categories",GET_CATEGORY:e=>`api/v1/products/categories/${e}`,CREATE_CATEGORY:"api/v1/products/categories",UPDATE_CATEGORY:e=>`api/v1/products/categories/${e}`,DELETE_CATEGORY:e=>`api/v1/products/categories/${e}`,GET_PRODUCTS:"api/v1/products",GET_PRODUCT:e=>`api/v1/products/${e}`,CREATE_PRODUCT:"api/v1/products",UPDATE_PRODUCT:e=>`api/v1/products/${e}`,DELETE_PRODUCT:e=>`api/v1/products/${e}`,GET_PRODUCT_VARIANTS:e=>`api/v1/products/${e}/variants`,CREATE_PRODUCT_VARIANT:e=>`api/v1/products/${e}/variants`,UPDATE_PRODUCT_VARIANT:e=>`api/v1/products/variants/${e}`,DELETE_PRODUCT_VARIANT:e=>`api/v1/products/variants/${e}`,GET_FILES:"api/v1/admin/files",UPLOAD_FILE:"api/v1/admin/files",GET_FILE:e=>`api/v1/admin/files/${e}`,UPDATE_FILE:e=>`api/v1/admin/files/${e}`,DELETE_FILE:e=>`api/v1/admin/files/${e}`,DOWNLOAD_FILE:e=>`api/v1/files/${e}`,GET_IMAGES:"api/v1/images",CREATE_IMAGE:"api/v1/images",UPDATE_IMAGE:e=>`api/v1/products/images/${e}`,DELETE_IMAGE:e=>`api/v1/products/images/${e}`},b5=async()=>{const e=localStorage.getItem("admin_token"),t=localStorage.getItem("admin_user");if(e&&t)try{const r=JSON.parse(t);return{token:e,user:r}}catch{return localStorage.removeItem("admin_token"),localStorage.removeItem("admin_refresh_token"),localStorage.removeItem("admin_user"),localStorage.removeItem("admin_permissions"),null}return null};/*! js-cookie v3.0.5 | MIT */function Zd(e){for(var t=1;t"u")){s=Zd({},t,s),typeof s.expires=="number"&&(s.expires=new Date(Date.now()+s.expires*864e5)),s.expires&&(s.expires=s.expires.toUTCString()),a=encodeURIComponent(a).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var c in s)s[c]&&(o+="; "+c,s[c]!==!0&&(o+="="+s[c].split(";")[0]));return document.cookie=a+"="+e.write(i,a)+o}}function n(a){if(!(typeof document>"u"||arguments.length&&!a)){for(var i=document.cookie?document.cookie.split("; "):[],s={},o=0;oRl({method:"get",url:e,...t}),Ca=(e,t,r)=>Rl({method:"post",url:e,data:t,...r}),Ml=(e,t,r)=>Rl({method:"put",url:e,data:t,...r}),Fs=(e,t)=>Rl({method:"delete",url:e,...t});Rl.interceptors.request.use(async e=>{const t=await b5();return t!=null&&t.token&&(e.headers.Authorization=`Bearer ${t.token}`),e});Rl.interceptors.response.use(e=>e,e=>{const t=e.response.status;if(console.log("object"),j5.remove("jwtToken"),(t===401||t===403)&&location.pathname!=="/auth")_5(),window.location.replace({}.VITE_APP_BASE_URL+"auth");else throw{...e,message:e.response.data.title}});function Oe(e,t,r){const n=t||{},a=Object.keys(n);let i=`${r||Kb}/${e}`;return a.forEach((s,o)=>{o===0&&(i+="?"),n[s]!==null&&n[s]!==void 0&&n[s]!==""&&(i+=`${s}=${n[s]}${o(await Ca(Oe(ke.ADMIN_LOGIN),e)).data,_5=()=>{localStorage.removeItem("admin_token"),localStorage.removeItem("admin_refresh_token"),localStorage.removeItem("admin_user"),localStorage.removeItem("admin_permissions")},O5=()=>ft({mutationKey:[de.ADMIN_LOGIN],mutationFn:e=>k5(e),onSuccess:e=>{localStorage.setItem("admin_token",e.tokens.access_token),localStorage.setItem("admin_refresh_token",e.tokens.refresh_token),localStorage.setItem("admin_user",JSON.stringify(e.admin_user)),localStorage.setItem("admin_permissions",JSON.stringify(e.permissions)),ye.success("ورود موفقیت‌آمیز بود")},onError:e=>{console.error("Login error:",e),ye.error((e==null?void 0:e.message)||"خطا در ورود")}}),N5=()=>{var y;const{isAuthenticated:e,isLoading:t,restoreSession:r}=hd(),n=St(),[a,i]=N.useState(!1),[s,o]=N.useState(""),{mutate:c,isPending:u}=O5(),{register:d,handleSubmit:f,formState:{errors:h,isValid:p}}=Rs({resolver:Ms(FL),mode:"onChange"});if(t)return l.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900",children:l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary-600 mx-auto"}),l.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"در حال بارگذاری..."})]})});if(e)return l.jsx(yA,{to:"/",replace:!0});const m=async g=>{o(""),c(g,{onSuccess:()=>{r(),n("/")},onError:()=>{o("نام کاربری یا رمز عبور اشتباه است")}})};return l.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900 py-12 px-4 sm:px-6 lg:px-8",children:l.jsxs("div",{className:"max-w-md w-full space-y-8",children:[l.jsxs("div",{children:[l.jsx("div",{className:"mx-auto h-12 w-12 bg-primary-600 rounded-lg flex items-center justify-center",children:l.jsx(Dj,{className:"h-6 w-6 text-white"})}),l.jsx("h2",{className:"mt-6 text-center text-3xl font-extrabold text-gray-900 dark:text-gray-100",children:"ورود به پنل مدیریت"}),l.jsx("p",{className:"mt-2 text-center text-sm text-gray-600 dark:text-gray-400",children:"لطفا اطلاعات خود را وارد کنید"})]}),l.jsxs("form",{className:"mt-8 space-y-6",onSubmit:f(m),children:[l.jsxs("div",{className:"space-y-4",children:[l.jsx(tt,{label:"نام کاربری",type:"text",placeholder:"نام کاربری خود را وارد کنید",icon:Tb,error:(y=h.username)==null?void 0:y.message,...d("username")}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"رمز عبور"}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none",children:l.jsx(Dj,{className:"h-5 w-5 text-gray-400"})}),l.jsx("input",{type:a?"text":"password",placeholder:"رمز عبور خود را وارد کنید",className:`input pr-10 pl-10 ${h.password?"border-red-500 dark:border-red-500 focus:ring-red-500":""}`,...d("password")}),l.jsx("button",{type:"button",className:"absolute inset-y-0 left-0 pl-3 flex items-center",onClick:()=>i(!a),children:a?l.jsx(o6,{className:"h-5 w-5 text-gray-400 hover:text-gray-600"}):l.jsx(_a,{className:"h-5 w-5 text-gray-400 hover:text-gray-600"})})]}),h.password&&l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:h.password.message})]})]}),s&&l.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-600 dark:text-red-400 px-4 py-3 rounded-lg text-sm",children:s}),l.jsx(te,{type:"submit",loading:u,disabled:!p,className:"w-full",children:"ورود"})]})]})})},E5=({title:e,value:t,change:r,icon:n,color:a="blue"})=>{const i={blue:"bg-blue-500",green:"bg-green-500",yellow:"bg-yellow-500",red:"bg-red-500",purple:"bg-purple-500"},s=r&&r>0,o=r&&r<0;return l.jsx("div",{className:"card p-3 sm:p-4 lg:p-6 animate-fade-in",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"flex-shrink-0",children:l.jsx("div",{className:`p-2 sm:p-3 rounded-lg ${i[a]||i.blue}`,children:l.jsx(n,{className:"h-5 w-5 sm:h-6 sm:w-6 text-white"})})}),l.jsx("div",{className:"mr-3 sm:mr-5 w-0 flex-1 min-w-0",children:l.jsxs("dl",{children:[l.jsx(H6,{className:"truncate",children:e}),l.jsxs("dd",{className:"flex items-baseline",children:[l.jsx(Xa,{className:"truncate",children:typeof t=="number"?t.toLocaleString():t}),r!==void 0&&l.jsxs("div",{className:`mr-1 sm:mr-2 flex items-baseline text-xs sm:text-sm font-semibold ${s?"text-green-600":o?"text-red-600":"text-gray-500"}`,children:[s&&l.jsx(Pb,{className:"h-3 w-3 sm:h-4 sm:w-4 flex-shrink-0 self-center ml-1"}),o&&l.jsx(y6,{className:"h-3 w-3 sm:h-4 sm:w-4 flex-shrink-0 self-center ml-1"}),l.jsx("span",{className:"sr-only",children:s?"افزایش":"کاهش"}),l.jsxs("span",{className:"truncate",children:[Math.abs(r),"%"]})]})]})]})})]})})};var A5=Array.isArray,Nr=A5,P5=typeof Td=="object"&&Td&&Td.Object===Object&&Td,FP=P5,T5=FP,C5=typeof self=="object"&&self&&self.Object===Object&&self,$5=T5||C5||Function("return this")(),Xn=$5,I5=Xn,R5=I5.Symbol,vd=R5,xS=vd,UP=Object.prototype,M5=UP.hasOwnProperty,D5=UP.toString,uc=xS?xS.toStringTag:void 0;function L5(e){var t=M5.call(e,uc),r=e[uc];try{e[uc]=void 0;var n=!0}catch{}var a=D5.call(e);return n&&(t?e[uc]=r:delete e[uc]),a}var F5=L5,U5=Object.prototype,B5=U5.toString;function z5(e){return B5.call(e)}var V5=z5,bS=vd,q5=F5,W5=V5,G5="[object Null]",H5="[object Undefined]",wS=bS?bS.toStringTag:void 0;function K5(e){return e==null?e===void 0?H5:G5:wS&&wS in Object(e)?q5(e):W5(e)}var $a=K5;function Q5(e){return e!=null&&typeof e=="object"}var Ia=Q5,X5=$a,Y5=Ia,Z5="[object Symbol]";function J5(e){return typeof e=="symbol"||Y5(e)&&X5(e)==Z5}var Dl=J5,e8=Nr,t8=Dl,r8=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n8=/^\w*$/;function a8(e,t){if(e8(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||t8(e)?!0:n8.test(e)||!r8.test(e)||t!=null&&e in Object(t)}var Qb=a8;function i8(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ai=i8;const Ll=Me(Ai);var s8=$a,o8=Ai,l8="[object AsyncFunction]",c8="[object Function]",u8="[object GeneratorFunction]",d8="[object Proxy]";function f8(e){if(!o8(e))return!1;var t=s8(e);return t==c8||t==u8||t==l8||t==d8}var Xb=f8;const ge=Me(Xb);var h8=Xn,p8=h8["__core-js_shared__"],m8=p8,Ky=m8,jS=function(){var e=/[^.]+$/.exec(Ky&&Ky.keys&&Ky.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function y8(e){return!!jS&&jS in e}var g8=y8,v8=Function.prototype,x8=v8.toString;function b8(e){if(e!=null){try{return x8.call(e)}catch{}try{return e+""}catch{}}return""}var BP=b8,w8=Xb,j8=g8,S8=Ai,k8=BP,_8=/[\\^$.*+?()[\]{}|]/g,O8=/^\[object .+?Constructor\]$/,N8=Function.prototype,E8=Object.prototype,A8=N8.toString,P8=E8.hasOwnProperty,T8=RegExp("^"+A8.call(P8).replace(_8,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function C8(e){if(!S8(e)||j8(e))return!1;var t=w8(e)?T8:O8;return t.test(k8(e))}var $8=C8;function I8(e,t){return e==null?void 0:e[t]}var R8=I8,M8=$8,D8=R8;function L8(e,t){var r=D8(e,t);return M8(r)?r:void 0}var Us=L8,F8=Us,U8=F8(Object,"create"),lm=U8,SS=lm;function B8(){this.__data__=SS?SS(null):{},this.size=0}var z8=B8;function V8(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var q8=V8,W8=lm,G8="__lodash_hash_undefined__",H8=Object.prototype,K8=H8.hasOwnProperty;function Q8(e){var t=this.__data__;if(W8){var r=t[e];return r===G8?void 0:r}return K8.call(t,e)?t[e]:void 0}var X8=Q8,Y8=lm,Z8=Object.prototype,J8=Z8.hasOwnProperty;function eU(e){var t=this.__data__;return Y8?t[e]!==void 0:J8.call(t,e)}var tU=eU,rU=lm,nU="__lodash_hash_undefined__";function aU(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=rU&&t===void 0?nU:t,this}var iU=aU,sU=z8,oU=q8,lU=X8,cU=tU,uU=iU;function Fl(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t-1}var NU=OU,EU=cm;function AU(e,t){var r=this.__data__,n=EU(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var PU=AU,TU=hU,CU=wU,$U=kU,IU=NU,RU=PU;function Ul(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t0?1:-1},Xi=function(t){return _s(t)&&t.indexOf("%")===t.length-1},Y=function(t){return n7(t)&&!xd(t)},At=function(t){return Y(t)||_s(t)},o7=0,zl=function(t){var r=++o7;return"".concat(t||"").concat(r)},sr=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Y(t)&&!_s(t))return n;var i;if(Xi(t)){var s=t.indexOf("%");i=r*parseFloat(t.slice(0,s))/100}else i=+t;return xd(i)&&(i=n),a&&i>r&&(i=r),i},Ya=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},l7=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function m7(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Z0(e){"@babel/helpers - typeof";return Z0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Z0(e)}var PS={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},ga=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},TS=null,Xy=null,s1=function e(t){if(t===TS&&Array.isArray(Xy))return Xy;var r=[];return N.Children.forEach(t,function(n){xe(n)||(ZB.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),Xy=r,TS=t,r};function Lr(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(a){return ga(a)}):n=[ga(t)],s1(e).forEach(function(a){var i=Dr(a,"type.displayName")||Dr(a,"type.name");n.indexOf(i)!==-1&&r.push(a)}),r}function Tr(e,t){var r=Lr(e,t);return r&&r[0]}var CS=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,a=r.height;return!(!Y(n)||n<=0||!Y(a)||a<=0)},y7=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],g7=function(t){return t&&t.type&&_s(t.type)&&y7.indexOf(t.type)>=0},v7=function(t){return t&&Z0(t)==="object"&&"clipDot"in t},x7=function(t,r,n,a){var i,s=(i=Qy==null?void 0:Qy[a])!==null&&i!==void 0?i:[];return r.startsWith("data-")||!ge(t)&&(a&&s.includes(r)||d7.includes(r))||n&&i1.includes(r)},he=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(N.isValidElement(t)&&(a=t.props),!Ll(a))return null;var i={};return Object.keys(a).forEach(function(s){var o;x7((o=a)===null||o===void 0?void 0:o[s],s,r,n)&&(i[s]=a[s])}),i},J0=function e(t,r){if(t===r)return!0;var n=N.Children.count(t);if(n!==N.Children.count(r))return!1;if(n===0)return!0;if(n===1)return $S(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function k7(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function tv(e){var t=e.children,r=e.width,n=e.height,a=e.viewBox,i=e.className,s=e.style,o=e.title,c=e.desc,u=S7(e,j7),d=a||{width:r,height:n,x:0,y:0},f=ve("recharts-surface",i);return A.createElement("svg",ev({},he(u,!0,"svg"),{className:f,width:r,height:n,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),A.createElement("title",null,o),A.createElement("desc",null,c),t)}var _7=["children","className"];function rv(){return rv=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function N7(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Pe=A.forwardRef(function(e,t){var r=e.children,n=e.className,a=O7(e,_7),i=ve("recharts-layer",n);return A.createElement("g",rv({className:i},he(a,!0),{ref:t}),r)}),_n=function(t,r){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;ia?0:a+t),r=r>a?a:r,r<0&&(r+=a),a=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(a);++n=n?e:P7(e,t,r)}var C7=T7,$7="\\ud800-\\udfff",I7="\\u0300-\\u036f",R7="\\ufe20-\\ufe2f",M7="\\u20d0-\\u20ff",D7=I7+R7+M7,L7="\\ufe0e\\ufe0f",F7="\\u200d",U7=RegExp("["+F7+$7+D7+L7+"]");function B7(e){return U7.test(e)}var YP=B7;function z7(e){return e.split("")}var V7=z7,ZP="\\ud800-\\udfff",q7="\\u0300-\\u036f",W7="\\ufe20-\\ufe2f",G7="\\u20d0-\\u20ff",H7=q7+W7+G7,K7="\\ufe0e\\ufe0f",Q7="["+ZP+"]",nv="["+H7+"]",av="\\ud83c[\\udffb-\\udfff]",X7="(?:"+nv+"|"+av+")",JP="[^"+ZP+"]",eT="(?:\\ud83c[\\udde6-\\uddff]){2}",tT="[\\ud800-\\udbff][\\udc00-\\udfff]",Y7="\\u200d",rT=X7+"?",nT="["+K7+"]?",Z7="(?:"+Y7+"(?:"+[JP,eT,tT].join("|")+")"+nT+rT+")*",J7=nT+rT+Z7,ez="(?:"+[JP+nv+"?",nv,eT,tT,Q7].join("|")+")",tz=RegExp(av+"(?="+av+")|"+ez+J7,"g");function rz(e){return e.match(tz)||[]}var nz=rz,az=V7,iz=YP,sz=nz;function oz(e){return iz(e)?sz(e):az(e)}var lz=oz,cz=C7,uz=YP,dz=lz,fz=WP;function hz(e){return function(t){t=fz(t);var r=uz(t)?dz(t):void 0,n=r?r[0]:t.charAt(0),a=r?cz(r,1).join(""):t.slice(1);return n[e]()+a}}var pz=hz,mz=pz,yz=mz("toUpperCase"),gz=yz;const Sm=Me(gz);function We(e){return function(){return e}}const aT=Math.cos,Eh=Math.sin,An=Math.sqrt,Ah=Math.PI,km=2*Ah,iv=Math.PI,sv=2*iv,Fi=1e-6,vz=sv-Fi;function iT(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return iT;const r=10**t;return function(n){this._+=n[0];for(let a=1,i=n.length;aFi)if(!(Math.abs(f*c-u*d)>Fi)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-s,m=a-o,y=c*c+u*u,g=p*p+m*m,b=Math.sqrt(y),x=Math.sqrt(h),v=i*Math.tan((iv-Math.acos((y+h-g)/(2*b*x)))/2),S=v/x,w=v/b;Math.abs(S-1)>Fi&&this._append`L${t+S*d},${r+S*f}`,this._append`A${i},${i},0,0,${+(f*p>d*m)},${this._x1=t+w*c},${this._y1=r+w*u}`}}arc(t,r,n,a,i,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(a),c=n*Math.sin(a),u=t+o,d=r+c,f=1^s,h=s?a-i:i-a;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Fi||Math.abs(this._y1-d)>Fi)&&this._append`L${u},${d}`,n&&(h<0&&(h=h%sv+sv),h>vz?this._append`A${n},${n},0,1,${f},${t-o},${r-c}A${n},${n},0,1,${f},${this._x1=u},${this._y1=d}`:h>Fi&&this._append`A${n},${n},0,${+(h>=iv)},${f},${this._x1=t+n*Math.cos(i)},${this._y1=r+n*Math.sin(i)}`)}rect(t,r,n,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+a}h${-n}Z`}toString(){return this._}}function o1(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new bz(t)}function l1(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function sT(e){this._context=e}sT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function _m(e){return new sT(e)}function oT(e){return e[0]}function lT(e){return e[1]}function cT(e,t){var r=We(!0),n=null,a=_m,i=null,s=o1(o);e=typeof e=="function"?e:e===void 0?oT:We(e),t=typeof t=="function"?t:t===void 0?lT:We(t);function o(c){var u,d=(c=l1(c)).length,f,h=!1,p;for(n==null&&(i=a(p=s())),u=0;u<=d;++u)!(u=p;--m)o.point(v[m],S[m]);o.lineEnd(),o.areaEnd()}b&&(v[h]=+e(g,h,f),S[h]=+t(g,h,f),o.point(n?+n(g,h,f):v[h],r?+r(g,h,f):S[h]))}if(x)return o=null,x+""||null}function d(){return cT().defined(a).curve(s).context(i)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:We(+f),n=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:We(+f),u):e},u.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:We(+f),u):n},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:We(+f),r=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:We(+f),u):t},u.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:We(+f),u):r},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(r)},u.lineX1=function(){return d().x(n).y(t)},u.defined=function(f){return arguments.length?(a=typeof f=="function"?f:We(!!f),u):a},u.curve=function(f){return arguments.length?(s=f,i!=null&&(o=s(i)),u):s},u.context=function(f){return arguments.length?(f==null?i=o=null:o=s(i=f),u):i},u}class uT{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function wz(e){return new uT(e,!0)}function jz(e){return new uT(e,!1)}const c1={draw(e,t){const r=An(t/Ah);e.moveTo(r,0),e.arc(0,0,r,0,km)}},Sz={draw(e,t){const r=An(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},dT=An(1/3),kz=dT*2,_z={draw(e,t){const r=An(t/kz),n=r*dT;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},Oz={draw(e,t){const r=An(t),n=-r/2;e.rect(n,n,r,r)}},Nz=.8908130915292852,fT=Eh(Ah/10)/Eh(7*Ah/10),Ez=Eh(km/10)*fT,Az=-aT(km/10)*fT,Pz={draw(e,t){const r=An(t*Nz),n=Ez*r,a=Az*r;e.moveTo(0,-r),e.lineTo(n,a);for(let i=1;i<5;++i){const s=km*i/5,o=aT(s),c=Eh(s);e.lineTo(c*r,-o*r),e.lineTo(o*n-c*a,c*n+o*a)}e.closePath()}},Yy=An(3),Tz={draw(e,t){const r=-An(t/(Yy*3));e.moveTo(0,r*2),e.lineTo(-Yy*r,-r),e.lineTo(Yy*r,-r),e.closePath()}},qr=-.5,Wr=An(3)/2,ov=1/An(12),Cz=(ov/2+1)*3,$z={draw(e,t){const r=An(t/Cz),n=r/2,a=r*ov,i=n,s=r*ov+r,o=-i,c=s;e.moveTo(n,a),e.lineTo(i,s),e.lineTo(o,c),e.lineTo(qr*n-Wr*a,Wr*n+qr*a),e.lineTo(qr*i-Wr*s,Wr*i+qr*s),e.lineTo(qr*o-Wr*c,Wr*o+qr*c),e.lineTo(qr*n+Wr*a,qr*a-Wr*n),e.lineTo(qr*i+Wr*s,qr*s-Wr*i),e.lineTo(qr*o+Wr*c,qr*c-Wr*o),e.closePath()}};function Iz(e,t){let r=null,n=o1(a);e=typeof e=="function"?e:We(e||c1),t=typeof t=="function"?t:We(t===void 0?64:+t);function a(){let i;if(r||(r=i=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),i)return r=null,i+""||null}return a.type=function(i){return arguments.length?(e=typeof i=="function"?i:We(i),a):e},a.size=function(i){return arguments.length?(t=typeof i=="function"?i:We(+i),a):t},a.context=function(i){return arguments.length?(r=i??null,a):r},a}function Ph(){}function Th(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function hT(e){this._context=e}hT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Th(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Th(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Rz(e){return new hT(e)}function pT(e){this._context=e}pT.prototype={areaStart:Ph,areaEnd:Ph,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Th(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Mz(e){return new pT(e)}function mT(e){this._context=e}mT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Th(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Dz(e){return new mT(e)}function yT(e){this._context=e}yT.prototype={areaStart:Ph,areaEnd:Ph,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Lz(e){return new yT(e)}function RS(e){return e<0?-1:1}function MS(e,t,r){var n=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(n||a<0&&-0),s=(r-e._y1)/(a||n<0&&-0),o=(i*a+s*n)/(n+a);return(RS(i)+RS(s))*Math.min(Math.abs(i),Math.abs(s),.5*Math.abs(o))||0}function DS(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Zy(e,t,r){var n=e._x0,a=e._y0,i=e._x1,s=e._y1,o=(i-n)/3;e._context.bezierCurveTo(n+o,a+o*t,i-o,s-o*r,i,s)}function Ch(e){this._context=e}Ch.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Zy(this,this._t0,DS(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Zy(this,DS(this,r=MS(this,e,t)),r);break;default:Zy(this,this._t0,r=MS(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function gT(e){this._context=new vT(e)}(gT.prototype=Object.create(Ch.prototype)).point=function(e,t){Ch.prototype.point.call(this,t,e)};function vT(e){this._context=e}vT.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,a,i){this._context.bezierCurveTo(t,e,n,r,i,a)}};function Fz(e){return new Ch(e)}function Uz(e){return new gT(e)}function xT(e){this._context=e}xT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=LS(e),a=LS(t),i=0,s=1;s=0;--t)a[t]=(s[t]-a[t+1])/i[t];for(i[r-1]=(e[r]+a[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function zz(e){return new Om(e,.5)}function Vz(e){return new Om(e,0)}function qz(e){return new Om(e,1)}function Jo(e,t){if((s=e.length)>1)for(var r=1,n,a,i=e[t[0]],s,o=i.length;r=0;)r[t]=t;return r}function Wz(e,t){return e[t]}function Gz(e){const t=[];return t.key=e,t}function Hz(){var e=We([]),t=lv,r=Jo,n=Wz;function a(i){var s=Array.from(e.apply(this,arguments),Gz),o,c=s.length,u=-1,d;for(const f of i)for(o=0,++u;o0){for(var r,n,a=0,i=e[0].length,s;a0){for(var r=0,n=e[t[0]],a,i=n.length;r0)||!((i=(a=e[t[0]]).length)>0))){for(var r=0,n=1,a,i,s;n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function r9(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var bT={symbolCircle:c1,symbolCross:Sz,symbolDiamond:_z,symbolSquare:Oz,symbolStar:Pz,symbolTriangle:Tz,symbolWye:$z},n9=Math.PI/180,a9=function(t){var r="symbol".concat(Sm(t));return bT[r]||c1},i9=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*n9;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},s9=function(t,r){bT["symbol".concat(Sm(t))]=r},u1=function(t){var r=t.type,n=r===void 0?"circle":r,a=t.size,i=a===void 0?64:a,s=t.sizeType,o=s===void 0?"area":s,c=t9(t,Yz),u=US(US({},c),{},{type:n,size:i,sizeType:o}),d=function(){var g=a9(n),b=Iz().type(g).size(i9(i,o,n));return b()},f=u.className,h=u.cx,p=u.cy,m=he(u,!0);return h===+h&&p===+p&&i===+i?A.createElement("path",cv({},m,{className:ve("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};u1.registerSymbol=s9;function el(e){"@babel/helpers - typeof";return el=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},el(e)}function uv(){return uv=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var x=p.inactive?u:p.color;return A.createElement("li",uv({className:g,style:f,key:"legend-item-".concat(m)},Os(n.props,p,m)),A.createElement(tv,{width:s,height:s,viewBox:d,style:h},n.renderIcon(p)),A.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},y?y(b,p,m):b))})}},{key:"render",value:function(){var n=this.props,a=n.payload,i=n.layout,s=n.align;if(!a||!a.length)return null;var o={padding:0,margin:0,textAlign:i==="horizontal"?s:"left"};return A.createElement("ul",{className:"recharts-default-legend",style:o},this.renderItems())}}])}(N.PureComponent);mu(d1,"displayName","Legend");mu(d1,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var m9=um;function y9(){this.__data__=new m9,this.size=0}var g9=y9;function v9(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var x9=v9;function b9(e){return this.__data__.get(e)}var w9=b9;function j9(e){return this.__data__.has(e)}var S9=j9,k9=um,_9=Zb,O9=Jb,N9=200;function E9(e,t){var r=this.__data__;if(r instanceof k9){var n=r.__data__;if(!_9||n.lengtho))return!1;var u=i.get(e),d=i.get(t);if(u&&d)return u==t&&d==e;var f=-1,h=!0,p=r&X9?new G9:void 0;for(i.set(e,t),i.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=eq}var m1=tq,rq=$a,nq=m1,aq=Ia,iq="[object Arguments]",sq="[object Array]",oq="[object Boolean]",lq="[object Date]",cq="[object Error]",uq="[object Function]",dq="[object Map]",fq="[object Number]",hq="[object Object]",pq="[object RegExp]",mq="[object Set]",yq="[object String]",gq="[object WeakMap]",vq="[object ArrayBuffer]",xq="[object DataView]",bq="[object Float32Array]",wq="[object Float64Array]",jq="[object Int8Array]",Sq="[object Int16Array]",kq="[object Int32Array]",_q="[object Uint8Array]",Oq="[object Uint8ClampedArray]",Nq="[object Uint16Array]",Eq="[object Uint32Array]",Qe={};Qe[bq]=Qe[wq]=Qe[jq]=Qe[Sq]=Qe[kq]=Qe[_q]=Qe[Oq]=Qe[Nq]=Qe[Eq]=!0;Qe[iq]=Qe[sq]=Qe[vq]=Qe[oq]=Qe[xq]=Qe[lq]=Qe[cq]=Qe[uq]=Qe[dq]=Qe[fq]=Qe[hq]=Qe[pq]=Qe[mq]=Qe[yq]=Qe[gq]=!1;function Aq(e){return aq(e)&&nq(e.length)&&!!Qe[rq(e)]}var Pq=Aq;function Tq(e){return function(t){return e(t)}}var TT=Tq,Mh={exports:{}};Mh.exports;(function(e,t){var r=FP,n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===n,s=i&&r.process,o=function(){try{var c=a&&a.require&&a.require("util").types;return c||s&&s.binding&&s.binding("util")}catch{}}();e.exports=o})(Mh,Mh.exports);var Cq=Mh.exports,$q=Pq,Iq=TT,KS=Cq,QS=KS&&KS.isTypedArray,Rq=QS?Iq(QS):$q,CT=Rq,Mq=FV,Dq=h1,Lq=Nr,Fq=PT,Uq=p1,Bq=CT,zq=Object.prototype,Vq=zq.hasOwnProperty;function qq(e,t){var r=Lq(e),n=!r&&Dq(e),a=!r&&!n&&Fq(e),i=!r&&!n&&!a&&Bq(e),s=r||n||a||i,o=s?Mq(e.length,String):[],c=o.length;for(var u in e)(t||Vq.call(e,u))&&!(s&&(u=="length"||a&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Uq(u,c)))&&o.push(u);return o}var Wq=qq,Gq=Object.prototype;function Hq(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Gq;return e===r}var Kq=Hq;function Qq(e,t){return function(r){return e(t(r))}}var $T=Qq,Xq=$T,Yq=Xq(Object.keys,Object),Zq=Yq,Jq=Kq,eW=Zq,tW=Object.prototype,rW=tW.hasOwnProperty;function nW(e){if(!Jq(e))return eW(e);var t=[];for(var r in Object(e))rW.call(e,r)&&r!="constructor"&&t.push(r);return t}var aW=nW,iW=Xb,sW=m1;function oW(e){return e!=null&&sW(e.length)&&!iW(e)}var bd=oW,lW=Wq,cW=aW,uW=bd;function dW(e){return uW(e)?lW(e):cW(e)}var Nm=dW,fW=NV,hW=DV,pW=Nm;function mW(e){return fW(e,pW,hW)}var yW=mW,XS=yW,gW=1,vW=Object.prototype,xW=vW.hasOwnProperty;function bW(e,t,r,n,a,i){var s=r&gW,o=XS(e),c=o.length,u=XS(t),d=u.length;if(c!=d&&!s)return!1;for(var f=c;f--;){var h=o[f];if(!(s?h in t:xW.call(t,h)))return!1}var p=i.get(e),m=i.get(t);if(p&&m)return p==t&&m==e;var y=!0;i.set(e,t),i.set(t,e);for(var g=s;++f-1}var vH=gH;function xH(e,t,r){for(var n=-1,a=e==null?0:e.length;++n=IH){var u=t?null:CH(e);if(u)return $H(u);s=!1,a=TH,c=new EH}else c=t?[]:o;e:for(;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function XH(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function YH(e){return e.value}function ZH(e,t){if(A.isValidElement(e))return A.cloneElement(e,t);if(typeof e=="function")return A.createElement(e,t);t.ref;var r=QH(t,BH);return A.createElement(d1,r)}var fk=1,hs=function(e){function t(){var r;zH(this,t);for(var n=arguments.length,a=new Array(n),i=0;ifk||Math.abs(a.height-this.lastBoundingBox.height)>fk)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,n&&n(a)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?na({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var a=this.props,i=a.layout,s=a.align,o=a.verticalAlign,c=a.margin,u=a.chartWidth,d=a.chartHeight,f,h;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(s==="center"&&i==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=s==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(o==="middle"){var m=this.getBBoxSnapshot();h={top:((d||0)-m.height)/2}}else h=o==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return na(na({},f),h)}},{key:"render",value:function(){var n=this,a=this.props,i=a.content,s=a.width,o=a.height,c=a.wrapperStyle,u=a.payloadUniqBy,d=a.payload,f=na(na({position:"absolute",width:s||"auto",height:o||"auto"},this.getDefaultPosition(c)),c);return A.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){n.wrapperNode=p}},ZH(i,na(na({},this.props),{},{payload:UT(d,u,YH)})))}}],[{key:"getWithHeight",value:function(n,a){var i=na(na({},this.defaultProps),n.props),s=i.layout;return s==="vertical"&&Y(n.props.height)?{height:n.props.height}:s==="horizontal"?{width:n.props.width||a}:null}}])}(N.PureComponent);Em(hs,"displayName","Legend");Em(hs,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var hk=vd,JH=h1,eK=Nr,pk=hk?hk.isConcatSpreadable:void 0;function tK(e){return eK(e)||JH(e)||!!(pk&&e&&e[pk])}var rK=tK,nK=ET,aK=rK;function VT(e,t,r,n,a){var i=-1,s=e.length;for(r||(r=aK),a||(a=[]);++i0&&r(o)?t>1?VT(o,t-1,r,n,a):nK(a,o):n||(a[a.length]=o)}return a}var qT=VT;function iK(e){return function(t,r,n){for(var a=-1,i=Object(t),s=n(t),o=s.length;o--;){var c=s[e?o:++a];if(r(i[c],c,i)===!1)break}return t}}var sK=iK,oK=sK,lK=oK(),cK=lK,uK=cK,dK=Nm;function fK(e,t){return e&&uK(e,t,dK)}var WT=fK,hK=bd;function pK(e,t){return function(r,n){if(r==null)return r;if(!hK(r))return e(r,n);for(var a=r.length,i=t?a:-1,s=Object(r);(t?i--:++it||i&&s&&c&&!o&&!u||n&&s&&c||!r&&c||!a)return 1;if(!n&&!i&&!u&&e=o)return c;var u=r[n];return c*(u=="desc"?-1:1)}}return e.index-t.index}var EK=NK,rg=t1,AK=r1,PK=Yn,TK=GT,CK=SK,$K=TT,IK=EK,RK=Wl,MK=Nr;function DK(e,t,r){t.length?t=rg(t,function(i){return MK(i)?function(s){return AK(s,i.length===1?i[0]:i)}:i}):t=[RK];var n=-1;t=rg(t,$K(PK));var a=TK(e,function(i,s,o){var c=rg(t,function(u){return u(i)});return{criteria:c,index:++n,value:i}});return CK(a,function(i,s){return IK(i,s,r)})}var LK=DK;function FK(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var UK=FK,BK=UK,yk=Math.max;function zK(e,t,r){return t=yk(t===void 0?e.length-1:t,0),function(){for(var n=arguments,a=-1,i=yk(n.length-t,0),s=Array(i);++a0){if(++t>=ZK)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var rQ=tQ,nQ=YK,aQ=rQ,iQ=aQ(nQ),sQ=iQ,oQ=Wl,lQ=VK,cQ=sQ;function uQ(e,t){return cQ(lQ(e,t,oQ),e+"")}var dQ=uQ,fQ=Yb,hQ=bd,pQ=p1,mQ=Ai;function yQ(e,t,r){if(!mQ(r))return!1;var n=typeof t;return(n=="number"?hQ(r)&&pQ(t,r.length):n=="string"&&t in r)?fQ(r[t],e):!1}var Am=yQ,gQ=qT,vQ=LK,xQ=dQ,vk=Am,bQ=xQ(function(e,t){if(e==null)return[];var r=t.length;return r>1&&vk(e,t[0],t[1])?t=[]:r>2&&vk(t[0],t[1],t[2])&&(t=[t[0]]),vQ(e,gQ(t,1),[])}),wQ=bQ;const v1=Me(wQ);function yu(e){"@babel/helpers - typeof";return yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yu(e)}function vv(){return vv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t.x),"".concat(dc,"-left"),Y(r)&&t&&Y(t.x)&&r=t.y),"".concat(dc,"-top"),Y(n)&&t&&Y(t.y)&&ny?Math.max(d,c[n]):Math.max(f,c[n])}function MQ(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function DQ(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,a=e.position,i=e.reverseDirection,s=e.tooltipBox,o=e.useTranslate3d,c=e.viewBox,u,d,f;return s.height>0&&s.width>0&&r?(d=wk({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:a,reverseDirection:i,tooltipDimension:s.width,viewBox:c,viewBoxDimension:c.width}),f=wk({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:a,reverseDirection:i,tooltipDimension:s.height,viewBox:c,viewBoxDimension:c.height}),u=MQ({translateX:d,translateY:f,useTranslate3d:o})):u=IQ,{cssProperties:u,cssClasses:RQ({translateX:d,translateY:f,coordinate:r})}}function rl(e){"@babel/helpers - typeof";return rl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rl(e)}function jk(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Sk(e){for(var t=1;t_k||Math.abs(n.height-this.state.lastBoundingBox.height)>_k)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,a=this.props,i=a.active,s=a.allowEscapeViewBox,o=a.animationDuration,c=a.animationEasing,u=a.children,d=a.coordinate,f=a.hasPayload,h=a.isAnimationActive,p=a.offset,m=a.position,y=a.reverseDirection,g=a.useTranslate3d,b=a.viewBox,x=a.wrapperStyle,v=DQ({allowEscapeViewBox:s,coordinate:d,offsetTopLeft:p,position:m,reverseDirection:y,tooltipBox:this.state.lastBoundingBox,useTranslate3d:g,viewBox:b}),S=v.cssClasses,w=v.cssProperties,j=Sk(Sk({transition:h&&i?"transform ".concat(o,"ms ").concat(c):void 0},w),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&f?"visible":"hidden",position:"absolute",top:0,left:0},x);return A.createElement("div",{tabIndex:-1,className:S,style:j,ref:function(_){n.wrapperNode=_}},u)}}])}(N.PureComponent),GQ=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Vn={isSsr:GQ(),get:function(t){return Vn[t]},set:function(t,r){if(typeof t=="string")Vn[t]=r;else{var n=Object.keys(t);n&&n.length&&n.forEach(function(a){Vn[a]=t[a]})}}};function nl(e){"@babel/helpers - typeof";return nl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nl(e)}function Ok(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Nk(e){for(var t=1;t0;return A.createElement(WQ,{allowEscapeViewBox:s,animationDuration:o,animationEasing:c,isAnimationActive:h,active:i,coordinate:d,hasPayload:j,offset:p,position:g,reverseDirection:b,useTranslate3d:x,viewBox:v,wrapperStyle:S},tX(u,Nk(Nk({},this.props),{},{payload:w})))}}])}(N.PureComponent);x1(Kr,"displayName","Tooltip");x1(Kr,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Vn.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var rX=Xn,nX=function(){return rX.Date.now()},aX=nX,iX=/\s/;function sX(e){for(var t=e.length;t--&&iX.test(e.charAt(t)););return t}var oX=sX,lX=oX,cX=/^\s+/;function uX(e){return e&&e.slice(0,lX(e)+1).replace(cX,"")}var dX=uX,fX=dX,Ak=Ai,hX=Dl,Pk=0/0,pX=/^[-+]0x[0-9a-f]+$/i,mX=/^0b[01]+$/i,yX=/^0o[0-7]+$/i,gX=parseInt;function vX(e){if(typeof e=="number")return e;if(hX(e))return Pk;if(Ak(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ak(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=fX(e);var r=mX.test(e);return r||yX.test(e)?gX(e.slice(2),r?2:8):pX.test(e)?Pk:+e}var ZT=vX,xX=Ai,ag=aX,Tk=ZT,bX="Expected a function",wX=Math.max,jX=Math.min;function SX(e,t,r){var n,a,i,s,o,c,u=0,d=!1,f=!1,h=!0;if(typeof e!="function")throw new TypeError(bX);t=Tk(t)||0,xX(r)&&(d=!!r.leading,f="maxWait"in r,i=f?wX(Tk(r.maxWait)||0,t):i,h="trailing"in r?!!r.trailing:h);function p(j){var k=n,_=a;return n=a=void 0,u=j,s=e.apply(_,k),s}function m(j){return u=j,o=setTimeout(b,t),d?p(j):s}function y(j){var k=j-c,_=j-u,E=t-k;return f?jX(E,i-_):E}function g(j){var k=j-c,_=j-u;return c===void 0||k>=t||k<0||f&&_>=i}function b(){var j=ag();if(g(j))return x(j);o=setTimeout(b,y(j))}function x(j){return o=void 0,h&&n?p(j):(n=a=void 0,s)}function v(){o!==void 0&&clearTimeout(o),u=0,n=c=a=o=void 0}function S(){return o===void 0?s:x(ag())}function w(){var j=ag(),k=g(j);if(n=arguments,a=this,c=j,k){if(o===void 0)return m(c);if(f)return clearTimeout(o),o=setTimeout(b,t),p(c)}return o===void 0&&(o=setTimeout(b,t)),s}return w.cancel=v,w.flush=S,w}var kX=SX,_X=kX,OX=Ai,NX="Expected a function";function EX(e,t,r){var n=!0,a=!0;if(typeof e!="function")throw new TypeError(NX);return OX(r)&&(n="leading"in r?!!r.leading:n,a="trailing"in r?!!r.trailing:a),_X(e,t,{leading:n,maxWait:t,trailing:a})}var AX=EX;const JT=Me(AX);function vu(e){"@babel/helpers - typeof";return vu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vu(e)}function Ck(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function rf(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(M=JT(M,y,{trailing:!0,leading:!1}));var I=new ResizeObserver(M),R=w.current.getBoundingClientRect(),F=R.width,U=R.height;return P(F,U),I.observe(w.current),function(){I.disconnect()}},[P,y]);var T=N.useMemo(function(){var M=E.containerWidth,I=E.containerHeight;if(M<0||I<0)return null;_n(Xi(s)||Xi(c),`The width(%s) and height(%s) are both fixed numbers, - maybe you don't need to use a ResponsiveContainer.`,s,c),_n(!r||r>0,"The aspect(%s) must be greater than zero.",r);var R=Xi(s)?M:s,F=Xi(c)?I:c;r&&r>0&&(R?F=R/r:F&&(R=F*r),h&&F>h&&(F=h)),_n(R>0||F>0,`The width(%s) and height(%s) of chart should be greater than 0, - please check the style of container, or the props width(%s) and height(%s), - or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the - height and width.`,R,F,s,c,d,f,r);var U=!Array.isArray(p)&&ga(p.type).endsWith("Chart");return A.Children.map(p,function(D){return A.isValidElement(D)?N.cloneElement(D,rf({width:R,height:F},U?{style:rf({height:"100%",width:"100%",maxHeight:F,maxWidth:R},D.props.style)}:{})):D})},[r,p,c,h,f,d,E,s]);return A.createElement("div",{id:g?"".concat(g):void 0,className:ve("recharts-responsive-container",b),style:rf(rf({},S),{},{width:s,height:c,minWidth:d,minHeight:f,maxHeight:h}),ref:w},T)}),Pm=function(t){return null};Pm.displayName="Cell";function xu(e){"@babel/helpers - typeof";return xu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xu(e)}function Ik(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function jv(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Vn.isSsr)return{width:0,height:0};var n=VX(r),a=JSON.stringify({text:t,copyStyle:n});if(Xs.widthCache[a])return Xs.widthCache[a];try{var i=document.getElementById(Rk);i||(i=document.createElement("span"),i.setAttribute("id",Rk),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var s=jv(jv({},zX),n);Object.assign(i.style,s),i.textContent="".concat(t);var o=i.getBoundingClientRect(),c={width:o.width,height:o.height};return Xs.widthCache[a]=c,++Xs.cacheCount>BX&&(Xs.cacheCount=0,Xs.widthCache={}),c}catch{return{width:0,height:0}}},qX=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function bu(e){"@babel/helpers - typeof";return bu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bu(e)}function Uh(e,t){return KX(e)||HX(e,t)||GX(e,t)||WX()}function WX(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GX(e,t){if(e){if(typeof e=="string")return Mk(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Mk(e,t)}}function Mk(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function lY(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function zk(e,t){return fY(e)||dY(e,t)||uY(e,t)||cY()}function cY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uY(e,t){if(e){if(typeof e=="string")return Vk(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Vk(e,t)}}function Vk(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[];return R.reduce(function(F,U){var D=U.word,V=U.width,H=F[F.length-1];if(H&&(a==null||i||H.width+V+nU.width?F:U})};if(!d)return p;for(var y="…",g=function(R){var F=f.slice(0,R),U=nC({breakAll:u,style:c,children:F+y}).wordsWithComputedWidth,D=h(U),V=D.length>s||m(D).width>Number(a);return[V,D]},b=0,x=f.length-1,v=0,S;b<=x&&v<=f.length-1;){var w=Math.floor((b+x)/2),j=w-1,k=g(j),_=zk(k,2),E=_[0],O=_[1],P=g(w),T=zk(P,1),M=T[0];if(!E&&!M&&(b=w+1),E&&M&&(x=w-1),!E&&M){S=O;break}v++}return S||p},qk=function(t){var r=xe(t)?[]:t.toString().split(rC);return[{words:r}]},pY=function(t){var r=t.width,n=t.scaleToFit,a=t.children,i=t.style,s=t.breakAll,o=t.maxLines;if((r||n)&&!Vn.isSsr){var c,u,d=nC({breakAll:s,children:a,style:i});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;c=f,u=h}else return qk(a);return hY({breakAll:s,children:a,maxLines:o,style:i},c,u,r,n)}return qk(a)},Wk="#808080",Ns=function(t){var r=t.x,n=r===void 0?0:r,a=t.y,i=a===void 0?0:a,s=t.lineHeight,o=s===void 0?"1em":s,c=t.capHeight,u=c===void 0?"0.71em":c,d=t.scaleToFit,f=d===void 0?!1:d,h=t.textAnchor,p=h===void 0?"start":h,m=t.verticalAnchor,y=m===void 0?"end":m,g=t.fill,b=g===void 0?Wk:g,x=Bk(t,sY),v=N.useMemo(function(){return pY({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:f,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,f,x.style,x.width]),S=x.dx,w=x.dy,j=x.angle,k=x.className,_=x.breakAll,E=Bk(x,oY);if(!At(n)||!At(i))return null;var O=n+(Y(S)?S:0),P=i+(Y(w)?w:0),T;switch(y){case"start":T=ig("calc(".concat(u,")"));break;case"middle":T=ig("calc(".concat((v.length-1)/2," * -").concat(o," + (").concat(u," / 2))"));break;default:T=ig("calc(".concat(v.length-1," * -").concat(o,")"));break}var M=[];if(f){var I=v[0].width,R=x.width;M.push("scale(".concat((Y(R)?R/I:1)/I,")"))}return j&&M.push("rotate(".concat(j,", ").concat(O,", ").concat(P,")")),M.length&&(E.transform=M.join(" ")),A.createElement("text",Sv({},he(E,!0),{x:O,y:P,className:ve("recharts-text",k),textAnchor:p,fill:b.includes("url")?Wk:b}),v.map(function(F,U){var D=F.words.join(_?"":" ");return A.createElement("tspan",{x:O,dy:U===0?T:o,key:"".concat(D,"-").concat(U)},D)}))};function ji(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function mY(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function w1(e){let t,r,n;e.length!==2?(t=ji,r=(o,c)=>ji(e(o),c),n=(o,c)=>e(o)-c):(t=e===ji||e===mY?e:yY,r=e,n=e);function a(o,c,u=0,d=o.length){if(u>>1;r(o[f],c)<0?u=f+1:d=f}while(u>>1;r(o[f],c)<=0?u=f+1:d=f}while(uu&&n(o[f-1],c)>-n(o[f],c)?f-1:f}return{left:a,center:s,right:i}}function yY(){return 0}function aC(e){return e===null?NaN:+e}function*gY(e,t){if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&(yield r);else{let r=-1;for(let n of e)(n=t(n,++r,e))!=null&&(n=+n)>=n&&(yield n)}}const vY=w1(ji),xY=vY.right;w1(aC).center;const wd=xY;class Gk extends Map{constructor(t,r=jY){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,a]of t)this.set(n,a)}get(t){return super.get(Hk(this,t))}has(t){return super.has(Hk(this,t))}set(t,r){return super.set(bY(this,t),r)}delete(t){return super.delete(wY(this,t))}}function Hk({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function bY({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function wY({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function jY(e){return e!==null&&typeof e=="object"?e.valueOf():e}function SY(e=ji){if(e===ji)return iC;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function iC(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const kY=Math.sqrt(50),_Y=Math.sqrt(10),OY=Math.sqrt(2);function Bh(e,t,r){const n=(t-e)/Math.max(0,r),a=Math.floor(Math.log10(n)),i=n/Math.pow(10,a),s=i>=kY?10:i>=_Y?5:i>=OY?2:1;let o,c,u;return a<0?(u=Math.pow(10,-a)/s,o=Math.round(e*u),c=Math.round(t*u),o/ut&&--c,u=-u):(u=Math.pow(10,a)*s,o=Math.round(e/u),c=Math.round(t/u),o*ut&&--c),c0))return[];if(e===t)return[e];const n=t=a))return[];const o=i-a+1,c=new Array(o);if(n)if(s<0)for(let u=0;u=n)&&(r=n);else{let n=-1;for(let a of e)(a=t(a,++n,e))!=null&&(r=a)&&(r=a)}return r}function Qk(e,t){let r;if(t===void 0)for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let a of e)(a=t(a,++n,e))!=null&&(r>a||r===void 0&&a>=a)&&(r=a)}return r}function sC(e,t,r=0,n=1/0,a){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(a=a===void 0?iC:SY(a);n>r;){if(n-r>600){const c=n-r+1,u=t-r+1,d=Math.log(c),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),p=Math.max(r,Math.floor(t-u*f/c+h)),m=Math.min(n,Math.floor(t+(c-u)*f/c+h));sC(e,t,p,m,a)}const i=e[t];let s=r,o=n;for(fc(e,r,t),a(e[n],i)>0&&fc(e,r,n);s0;)--o}a(e[r],i)===0?fc(e,r,o):(++o,fc(e,o,n)),o<=t&&(r=o+1),t<=o&&(n=o-1)}return e}function fc(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function NY(e,t,r){if(e=Float64Array.from(gY(e,r)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Qk(e);if(t>=1)return Kk(e);var n,a=(n-1)*t,i=Math.floor(a),s=Kk(sC(e,i).subarray(0,i+1)),o=Qk(e.subarray(i+1));return s+(o-s)*(a-i)}}function EY(e,t,r=aC){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,a=(n-1)*t,i=Math.floor(a),s=+r(e[i],i,e),o=+r(e[i+1],i+1,e);return s+(o-s)*(a-i)}}function AY(e,t,r){e=+e,t=+t,r=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+r;for(var n=-1,a=Math.max(0,Math.ceil((t-e)/r))|0,i=new Array(a);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?af(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?af(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=TY.exec(e))?new vr(t[1],t[2],t[3],1):(t=CY.exec(e))?new vr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=$Y.exec(e))?af(t[1],t[2],t[3],t[4]):(t=IY.exec(e))?af(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=RY.exec(e))?r_(t[1],t[2]/100,t[3]/100,1):(t=MY.exec(e))?r_(t[1],t[2]/100,t[3]/100,t[4]):Xk.hasOwnProperty(e)?Jk(Xk[e]):e==="transparent"?new vr(NaN,NaN,NaN,0):null}function Jk(e){return new vr(e>>16&255,e>>8&255,e&255,1)}function af(e,t,r,n){return n<=0&&(e=t=r=NaN),new vr(e,t,r,n)}function FY(e){return e instanceof jd||(e=ku(e)),e?(e=e.rgb(),new vr(e.r,e.g,e.b,e.opacity)):new vr}function Ev(e,t,r,n){return arguments.length===1?FY(e):new vr(e,t,r,n??1)}function vr(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}S1(vr,Ev,lC(jd,{brighter(e){return e=e==null?zh:Math.pow(zh,e),new vr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ju:Math.pow(ju,e),new vr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new vr(ps(this.r),ps(this.g),ps(this.b),Vh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:e_,formatHex:e_,formatHex8:UY,formatRgb:t_,toString:t_}));function e_(){return`#${Yi(this.r)}${Yi(this.g)}${Yi(this.b)}`}function UY(){return`#${Yi(this.r)}${Yi(this.g)}${Yi(this.b)}${Yi((isNaN(this.opacity)?1:this.opacity)*255)}`}function t_(){const e=Vh(this.opacity);return`${e===1?"rgb(":"rgba("}${ps(this.r)}, ${ps(this.g)}, ${ps(this.b)}${e===1?")":`, ${e})`}`}function Vh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ps(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Yi(e){return e=ps(e),(e<16?"0":"")+e.toString(16)}function r_(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new bn(e,t,r,n)}function cC(e){if(e instanceof bn)return new bn(e.h,e.s,e.l,e.opacity);if(e instanceof jd||(e=ku(e)),!e)return new bn;if(e instanceof bn)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,a=Math.min(t,r,n),i=Math.max(t,r,n),s=NaN,o=i-a,c=(i+a)/2;return o?(t===i?s=(r-n)/o+(r0&&c<1?0:s,new bn(s,o,c,e.opacity)}function BY(e,t,r,n){return arguments.length===1?cC(e):new bn(e,t,r,n??1)}function bn(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}S1(bn,BY,lC(jd,{brighter(e){return e=e==null?zh:Math.pow(zh,e),new bn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ju:Math.pow(ju,e),new bn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,a=2*r-n;return new vr(sg(e>=240?e-240:e+120,a,n),sg(e,a,n),sg(e<120?e+240:e-120,a,n),this.opacity)},clamp(){return new bn(n_(this.h),sf(this.s),sf(this.l),Vh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Vh(this.opacity);return`${e===1?"hsl(":"hsla("}${n_(this.h)}, ${sf(this.s)*100}%, ${sf(this.l)*100}%${e===1?")":`, ${e})`}`}}));function n_(e){return e=(e||0)%360,e<0?e+360:e}function sf(e){return Math.max(0,Math.min(1,e||0))}function sg(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const k1=e=>()=>e;function zY(e,t){return function(r){return e+r*t}}function VY(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function qY(e){return(e=+e)==1?uC:function(t,r){return r-t?VY(t,r,e):k1(isNaN(t)?r:t)}}function uC(e,t){var r=t-e;return r?zY(e,r):k1(isNaN(e)?t:e)}const a_=function e(t){var r=qY(t);function n(a,i){var s=r((a=Ev(a)).r,(i=Ev(i)).r),o=r(a.g,i.g),c=r(a.b,i.b),u=uC(a.opacity,i.opacity);return function(d){return a.r=s(d),a.g=o(d),a.b=c(d),a.opacity=u(d),a+""}}return n.gamma=e,n}(1);function WY(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),a;return function(i){for(a=0;ar&&(i=t.slice(r,i),o[s]?o[s]+=i:o[++s]=i),(n=n[0])===(a=a[0])?o[s]?o[s]+=a:o[++s]=a:(o[++s]=null,c.push({i:s,x:qh(n,a)})),r=og.lastIndex;return rt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function rZ(e,t,r){var n=e[0],a=e[1],i=t[0],s=t[1];return a2?nZ:rZ,c=u=null,f}function f(h){return h==null||isNaN(h=+h)?i:(c||(c=o(e.map(n),t,r)))(n(s(h)))}return f.invert=function(h){return s(a((u||(u=o(t,e.map(n),qh)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,Wh),d()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),d()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),r=_1,d()},f.clamp=function(h){return arguments.length?(s=h?!0:or,d()):s!==or},f.interpolate=function(h){return arguments.length?(r=h,d()):r},f.unknown=function(h){return arguments.length?(i=h,f):i},function(h,p){return n=h,a=p,d()}}function O1(){return Tm()(or,or)}function aZ(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Gh(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function al(e){return e=Gh(Math.abs(e)),e?e[1]:NaN}function iZ(e,t){return function(r,n){for(var a=r.length,i=[],s=0,o=e[0],c=0;a>0&&o>0&&(c+o+1>n&&(o=Math.max(1,n-c)),i.push(r.substring(a-=o,a+o)),!((c+=o+1)>n));)o=e[s=(s+1)%e.length];return i.reverse().join(t)}}function sZ(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var oZ=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function _u(e){if(!(t=oZ.exec(e)))throw new Error("invalid format: "+e);var t;return new N1({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}_u.prototype=N1.prototype;function N1(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}N1.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function lZ(e){e:for(var t=e.length,r=1,n=-1,a;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(a+1):e}var dC;function cZ(e,t){var r=Gh(e,t);if(!r)return e+"";var n=r[0],a=r[1],i=a-(dC=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,s=n.length;return i===s?n:i>s?n+new Array(i-s+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+Gh(e,Math.max(0,t+i-1))[0]}function s_(e,t){var r=Gh(e,t);if(!r)return e+"";var n=r[0],a=r[1];return a<0?"0."+new Array(-a).join("0")+n:n.length>a+1?n.slice(0,a+1)+"."+n.slice(a+1):n+new Array(a-n.length+2).join("0")}const o_={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:aZ,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>s_(e*100,t),r:s_,s:cZ,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function l_(e){return e}var c_=Array.prototype.map,u_=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function uZ(e){var t=e.grouping===void 0||e.thousands===void 0?l_:iZ(c_.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?l_:sZ(c_.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",o=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f){f=_u(f);var h=f.fill,p=f.align,m=f.sign,y=f.symbol,g=f.zero,b=f.width,x=f.comma,v=f.precision,S=f.trim,w=f.type;w==="n"?(x=!0,w="g"):o_[w]||(v===void 0&&(v=12),S=!0,w="g"),(g||h==="0"&&p==="=")&&(g=!0,h="0",p="=");var j=y==="$"?r:y==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",k=y==="$"?n:/[%p]/.test(w)?s:"",_=o_[w],E=/[defgprs%]/.test(w);v=v===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v));function O(P){var T=j,M=k,I,R,F;if(w==="c")M=_(P)+M,P="";else{P=+P;var U=P<0||1/P<0;if(P=isNaN(P)?c:_(Math.abs(P),v),S&&(P=lZ(P)),U&&+P==0&&m!=="+"&&(U=!1),T=(U?m==="("?m:o:m==="-"||m==="("?"":m)+T,M=(w==="s"?u_[8+dC/3]:"")+M+(U&&m==="("?")":""),E){for(I=-1,R=P.length;++IF||F>57){M=(F===46?a+P.slice(I+1):P.slice(I))+M,P=P.slice(0,I);break}}}x&&!g&&(P=t(P,1/0));var D=T.length+P.length+M.length,V=D>1)+T+P+M+V.slice(D);break;default:P=V+T+P+M;break}return i(P)}return O.toString=function(){return f+""},O}function d(f,h){var p=u((f=_u(f),f.type="f",f)),m=Math.max(-8,Math.min(8,Math.floor(al(h)/3)))*3,y=Math.pow(10,-m),g=u_[8+m/3];return function(b){return p(y*b)+g}}return{format:u,formatPrefix:d}}var of,E1,fC;dZ({thousands:",",grouping:[3],currency:["$",""]});function dZ(e){return of=uZ(e),E1=of.format,fC=of.formatPrefix,of}function fZ(e){return Math.max(0,-al(Math.abs(e)))}function hZ(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(al(t)/3)))*3-al(Math.abs(e)))}function pZ(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,al(t)-al(e))+1}function hC(e,t,r,n){var a=Ov(e,t,r),i;switch(n=_u(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=hZ(a,s))&&(n.precision=i),fC(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=pZ(a,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=fZ(a))&&(n.precision=i-(n.type==="%")*2);break}}return E1(n)}function Pi(e){var t=e.domain;return e.ticks=function(r){var n=t();return kv(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var a=t();return hC(a[0],a[a.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),a=0,i=n.length-1,s=n[a],o=n[i],c,u,d=10;for(o0;){if(u=_v(s,o,r),u===c)return n[a]=s,n[i]=o,t(n);if(u>0)s=Math.floor(s/u)*u,o=Math.ceil(o/u)*u;else if(u<0)s=Math.ceil(s*u)/u,o=Math.floor(o*u)/u;else break;c=u}return e},e}function Hh(){var e=O1();return e.copy=function(){return Sd(e,Hh())},on.apply(e,arguments),Pi(e)}function pC(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,Wh),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return pC(e).unknown(t)},e=arguments.length?Array.from(e,Wh):[0,1],Pi(r)}function mC(e,t){e=e.slice();var r=0,n=e.length-1,a=e[r],i=e[n],s;return iMath.pow(e,t)}function xZ(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function h_(e){return(t,r)=>-e(-t,r)}function A1(e){const t=e(d_,f_),r=t.domain;let n=10,a,i;function s(){return a=xZ(n),i=vZ(n),r()[0]<0?(a=h_(a),i=h_(i),e(mZ,yZ)):e(d_,f_),t}return t.base=function(o){return arguments.length?(n=+o,s()):n},t.domain=function(o){return arguments.length?(r(o),s()):r()},t.ticks=o=>{const c=r();let u=c[0],d=c[c.length-1];const f=d0){for(;h<=p;++h)for(m=1;md)break;b.push(y)}}else for(;h<=p;++h)for(m=n-1;m>=1;--m)if(y=h>0?m/i(-h):m*i(h),!(yd)break;b.push(y)}b.length*2{if(o==null&&(o=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=_u(c)).precision==null&&(c.trim=!0),c=E1(c)),o===1/0)return c;const u=Math.max(1,n*o/t.ticks().length);return d=>{let f=d/i(Math.round(a(d)));return f*nr(mC(r(),{floor:o=>i(Math.floor(a(o))),ceil:o=>i(Math.ceil(a(o)))})),t}function yC(){const e=A1(Tm()).domain([1,10]);return e.copy=()=>Sd(e,yC()).base(e.base()),on.apply(e,arguments),e}function p_(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function m_(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function P1(e){var t=1,r=e(p_(t),m_(t));return r.constant=function(n){return arguments.length?e(p_(t=+n),m_(t)):t},Pi(r)}function gC(){var e=P1(Tm());return e.copy=function(){return Sd(e,gC()).constant(e.constant())},on.apply(e,arguments)}function y_(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function bZ(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function wZ(e){return e<0?-e*e:e*e}function T1(e){var t=e(or,or),r=1;function n(){return r===1?e(or,or):r===.5?e(bZ,wZ):e(y_(r),y_(1/r))}return t.exponent=function(a){return arguments.length?(r=+a,n()):r},Pi(t)}function C1(){var e=T1(Tm());return e.copy=function(){return Sd(e,C1()).exponent(e.exponent())},on.apply(e,arguments),e}function jZ(){return C1.apply(null,arguments).exponent(.5)}function g_(e){return Math.sign(e)*e*e}function SZ(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function vC(){var e=O1(),t=[0,1],r=!1,n;function a(i){var s=SZ(e(i));return isNaN(s)?n:r?Math.round(s):s}return a.invert=function(i){return e.invert(g_(i))},a.domain=function(i){return arguments.length?(e.domain(i),a):e.domain()},a.range=function(i){return arguments.length?(e.range((t=Array.from(i,Wh)).map(g_)),a):t.slice()},a.rangeRound=function(i){return a.range(i).round(!0)},a.round=function(i){return arguments.length?(r=!!i,a):r},a.clamp=function(i){return arguments.length?(e.clamp(i),a):e.clamp()},a.unknown=function(i){return arguments.length?(n=i,a):n},a.copy=function(){return vC(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},on.apply(a,arguments),Pi(a)}function xC(){var e=[],t=[],r=[],n;function a(){var s=0,o=Math.max(1,t.length);for(r=new Array(o-1);++s0?r[o-1]:e[0],o=r?[n[r-1],t]:[n[u-1],n[u]]},s.unknown=function(c){return arguments.length&&(i=c),s},s.thresholds=function(){return n.slice()},s.copy=function(){return bC().domain([e,t]).range(a).unknown(i)},on.apply(Pi(s),arguments)}function wC(){var e=[.5],t=[0,1],r,n=1;function a(i){return i!=null&&i<=i?t[wd(e,i,0,n)]:r}return a.domain=function(i){return arguments.length?(e=Array.from(i),n=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(i){return arguments.length?(t=Array.from(i),n=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(i){var s=t.indexOf(i);return[e[s-1],e[s]]},a.unknown=function(i){return arguments.length?(r=i,a):r},a.copy=function(){return wC().domain(e).range(t).unknown(r)},on.apply(a,arguments)}const lg=new Date,cg=new Date;function Tt(e,t,r,n){function a(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return a.floor=i=>(e(i=new Date(+i)),i),a.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),a.round=i=>{const s=a(i),o=a.ceil(i);return i-s(t(i=new Date(+i),s==null?1:Math.floor(s)),i),a.range=(i,s,o)=>{const c=[];if(i=a.ceil(i),o=o==null?1:Math.floor(o),!(i0))return c;let u;do c.push(u=new Date(+i)),t(i,o),e(i);while(uTt(s=>{if(s>=s)for(;e(s),!i(s);)s.setTime(s-1)},(s,o)=>{if(s>=s)if(o<0)for(;++o<=0;)for(;t(s,-1),!i(s););else for(;--o>=0;)for(;t(s,1),!i(s););}),r&&(a.count=(i,s)=>(lg.setTime(+i),cg.setTime(+s),e(lg),e(cg),Math.floor(r(lg,cg))),a.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?a.filter(n?s=>n(s)%i===0:s=>a.count(0,s)%i===0):a)),a}const Kh=Tt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Kh.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Tt(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):Kh);Kh.range;const fa=1e3,en=fa*60,ha=en*60,Oa=ha*24,$1=Oa*7,v_=Oa*30,ug=Oa*365,Zi=Tt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*fa)},(e,t)=>(t-e)/fa,e=>e.getUTCSeconds());Zi.range;const I1=Tt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*fa)},(e,t)=>{e.setTime(+e+t*en)},(e,t)=>(t-e)/en,e=>e.getMinutes());I1.range;const R1=Tt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*en)},(e,t)=>(t-e)/en,e=>e.getUTCMinutes());R1.range;const M1=Tt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*fa-e.getMinutes()*en)},(e,t)=>{e.setTime(+e+t*ha)},(e,t)=>(t-e)/ha,e=>e.getHours());M1.range;const D1=Tt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*ha)},(e,t)=>(t-e)/ha,e=>e.getUTCHours());D1.range;const kd=Tt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*en)/Oa,e=>e.getDate()-1);kd.range;const Cm=Tt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Oa,e=>e.getUTCDate()-1);Cm.range;const jC=Tt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Oa,e=>Math.floor(e/Oa));jC.range;function Bs(e){return Tt(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*en)/$1)}const $m=Bs(0),Qh=Bs(1),kZ=Bs(2),_Z=Bs(3),il=Bs(4),OZ=Bs(5),NZ=Bs(6);$m.range;Qh.range;kZ.range;_Z.range;il.range;OZ.range;NZ.range;function zs(e){return Tt(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/$1)}const Im=zs(0),Xh=zs(1),EZ=zs(2),AZ=zs(3),sl=zs(4),PZ=zs(5),TZ=zs(6);Im.range;Xh.range;EZ.range;AZ.range;sl.range;PZ.range;TZ.range;const L1=Tt(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());L1.range;const F1=Tt(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());F1.range;const Na=Tt(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Na.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Tt(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});Na.range;const Ea=Tt(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Ea.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Tt(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});Ea.range;function SC(e,t,r,n,a,i){const s=[[Zi,1,fa],[Zi,5,5*fa],[Zi,15,15*fa],[Zi,30,30*fa],[i,1,en],[i,5,5*en],[i,15,15*en],[i,30,30*en],[a,1,ha],[a,3,3*ha],[a,6,6*ha],[a,12,12*ha],[n,1,Oa],[n,2,2*Oa],[r,1,$1],[t,1,v_],[t,3,3*v_],[e,1,ug]];function o(u,d,f){const h=dg).right(s,h);if(p===s.length)return e.every(Ov(u/ug,d/ug,f));if(p===0)return Kh.every(Math.max(Ov(u,d,f),1));const[m,y]=s[h/s[p-1][2]53)return null;"w"in G||(G.w=1),"Z"in G?(oe=fg(hc(G.y,0,1)),ot=oe.getUTCDay(),oe=ot>4||ot===0?Xh.ceil(oe):Xh(oe),oe=Cm.offset(oe,(G.V-1)*7),G.y=oe.getUTCFullYear(),G.m=oe.getUTCMonth(),G.d=oe.getUTCDate()+(G.w+6)%7):(oe=dg(hc(G.y,0,1)),ot=oe.getDay(),oe=ot>4||ot===0?Qh.ceil(oe):Qh(oe),oe=kd.offset(oe,(G.V-1)*7),G.y=oe.getFullYear(),G.m=oe.getMonth(),G.d=oe.getDate()+(G.w+6)%7)}else("W"in G||"U"in G)&&("w"in G||(G.w="u"in G?G.u%7:"W"in G?1:0),ot="Z"in G?fg(hc(G.y,0,1)).getUTCDay():dg(hc(G.y,0,1)).getDay(),G.m=0,G.d="W"in G?(G.w+6)%7+G.W*7-(ot+5)%7:G.w+G.U*7-(ot+6)%7);return"Z"in G?(G.H+=G.Z/100|0,G.M+=G.Z%100,fg(G)):dg(G)}}function _(z,ne,ue,G){for(var Ce=0,oe=ne.length,ot=ue.length,ht,zt;Ce=ot)return-1;if(ht=ne.charCodeAt(Ce++),ht===37){if(ht=ne.charAt(Ce++),zt=w[ht in x_?ne.charAt(Ce++):ht],!zt||(G=zt(z,ue,G))<0)return-1}else if(ht!=ue.charCodeAt(G++))return-1}return G}function E(z,ne,ue){var G=u.exec(ne.slice(ue));return G?(z.p=d.get(G[0].toLowerCase()),ue+G[0].length):-1}function O(z,ne,ue){var G=p.exec(ne.slice(ue));return G?(z.w=m.get(G[0].toLowerCase()),ue+G[0].length):-1}function P(z,ne,ue){var G=f.exec(ne.slice(ue));return G?(z.w=h.get(G[0].toLowerCase()),ue+G[0].length):-1}function T(z,ne,ue){var G=b.exec(ne.slice(ue));return G?(z.m=x.get(G[0].toLowerCase()),ue+G[0].length):-1}function M(z,ne,ue){var G=y.exec(ne.slice(ue));return G?(z.m=g.get(G[0].toLowerCase()),ue+G[0].length):-1}function I(z,ne,ue){return _(z,t,ne,ue)}function R(z,ne,ue){return _(z,r,ne,ue)}function F(z,ne,ue){return _(z,n,ne,ue)}function U(z){return s[z.getDay()]}function D(z){return i[z.getDay()]}function V(z){return c[z.getMonth()]}function H(z){return o[z.getMonth()]}function Z(z){return a[+(z.getHours()>=12)]}function K(z){return 1+~~(z.getMonth()/3)}function le(z){return s[z.getUTCDay()]}function we(z){return i[z.getUTCDay()]}function Ae(z){return c[z.getUTCMonth()]}function De(z){return o[z.getUTCMonth()]}function st(z){return a[+(z.getUTCHours()>=12)]}function gt(z){return 1+~~(z.getUTCMonth()/3)}return{format:function(z){var ne=j(z+="",v);return ne.toString=function(){return z},ne},parse:function(z){var ne=k(z+="",!1);return ne.toString=function(){return z},ne},utcFormat:function(z){var ne=j(z+="",S);return ne.toString=function(){return z},ne},utcParse:function(z){var ne=k(z+="",!0);return ne.toString=function(){return z},ne}}}var x_={"-":"",_:" ",0:"0"},Dt=/^\s*\d+/,DZ=/^%/,LZ=/[\\^$*+?|[\]().{}]/g;function Te(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i[t.toLowerCase(),r]))}function UZ(e,t,r){var n=Dt.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function BZ(e,t,r){var n=Dt.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function zZ(e,t,r){var n=Dt.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function VZ(e,t,r){var n=Dt.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function qZ(e,t,r){var n=Dt.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function b_(e,t,r){var n=Dt.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function w_(e,t,r){var n=Dt.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function WZ(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function GZ(e,t,r){var n=Dt.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function HZ(e,t,r){var n=Dt.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function j_(e,t,r){var n=Dt.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function KZ(e,t,r){var n=Dt.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function S_(e,t,r){var n=Dt.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function QZ(e,t,r){var n=Dt.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function XZ(e,t,r){var n=Dt.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function YZ(e,t,r){var n=Dt.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function ZZ(e,t,r){var n=Dt.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function JZ(e,t,r){var n=DZ.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function eJ(e,t,r){var n=Dt.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function tJ(e,t,r){var n=Dt.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function k_(e,t){return Te(e.getDate(),t,2)}function rJ(e,t){return Te(e.getHours(),t,2)}function nJ(e,t){return Te(e.getHours()%12||12,t,2)}function aJ(e,t){return Te(1+kd.count(Na(e),e),t,3)}function kC(e,t){return Te(e.getMilliseconds(),t,3)}function iJ(e,t){return kC(e,t)+"000"}function sJ(e,t){return Te(e.getMonth()+1,t,2)}function oJ(e,t){return Te(e.getMinutes(),t,2)}function lJ(e,t){return Te(e.getSeconds(),t,2)}function cJ(e){var t=e.getDay();return t===0?7:t}function uJ(e,t){return Te($m.count(Na(e)-1,e),t,2)}function _C(e){var t=e.getDay();return t>=4||t===0?il(e):il.ceil(e)}function dJ(e,t){return e=_C(e),Te(il.count(Na(e),e)+(Na(e).getDay()===4),t,2)}function fJ(e){return e.getDay()}function hJ(e,t){return Te(Qh.count(Na(e)-1,e),t,2)}function pJ(e,t){return Te(e.getFullYear()%100,t,2)}function mJ(e,t){return e=_C(e),Te(e.getFullYear()%100,t,2)}function yJ(e,t){return Te(e.getFullYear()%1e4,t,4)}function gJ(e,t){var r=e.getDay();return e=r>=4||r===0?il(e):il.ceil(e),Te(e.getFullYear()%1e4,t,4)}function vJ(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Te(t/60|0,"0",2)+Te(t%60,"0",2)}function __(e,t){return Te(e.getUTCDate(),t,2)}function xJ(e,t){return Te(e.getUTCHours(),t,2)}function bJ(e,t){return Te(e.getUTCHours()%12||12,t,2)}function wJ(e,t){return Te(1+Cm.count(Ea(e),e),t,3)}function OC(e,t){return Te(e.getUTCMilliseconds(),t,3)}function jJ(e,t){return OC(e,t)+"000"}function SJ(e,t){return Te(e.getUTCMonth()+1,t,2)}function kJ(e,t){return Te(e.getUTCMinutes(),t,2)}function _J(e,t){return Te(e.getUTCSeconds(),t,2)}function OJ(e){var t=e.getUTCDay();return t===0?7:t}function NJ(e,t){return Te(Im.count(Ea(e)-1,e),t,2)}function NC(e){var t=e.getUTCDay();return t>=4||t===0?sl(e):sl.ceil(e)}function EJ(e,t){return e=NC(e),Te(sl.count(Ea(e),e)+(Ea(e).getUTCDay()===4),t,2)}function AJ(e){return e.getUTCDay()}function PJ(e,t){return Te(Xh.count(Ea(e)-1,e),t,2)}function TJ(e,t){return Te(e.getUTCFullYear()%100,t,2)}function CJ(e,t){return e=NC(e),Te(e.getUTCFullYear()%100,t,2)}function $J(e,t){return Te(e.getUTCFullYear()%1e4,t,4)}function IJ(e,t){var r=e.getUTCDay();return e=r>=4||r===0?sl(e):sl.ceil(e),Te(e.getUTCFullYear()%1e4,t,4)}function RJ(){return"+0000"}function O_(){return"%"}function N_(e){return+e}function E_(e){return Math.floor(+e/1e3)}var Ys,EC,AC;MJ({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function MJ(e){return Ys=MZ(e),EC=Ys.format,Ys.parse,AC=Ys.utcFormat,Ys.utcParse,Ys}function DJ(e){return new Date(e)}function LJ(e){return e instanceof Date?+e:+new Date(+e)}function U1(e,t,r,n,a,i,s,o,c,u){var d=O1(),f=d.invert,h=d.domain,p=u(".%L"),m=u(":%S"),y=u("%I:%M"),g=u("%I %p"),b=u("%a %d"),x=u("%b %d"),v=u("%B"),S=u("%Y");function w(j){return(c(j)t(a/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(a,i)=>NY(e,i/n))},r.copy=function(){return $C(t).domain(e)},Ra.apply(r,arguments)}function Mm(){var e=0,t=.5,r=1,n=1,a,i,s,o,c,u=or,d,f=!1,h;function p(y){return isNaN(y=+y)?h:(y=.5+((y=+d(y))-i)*(n*yt}var DC=WJ,GJ=Dm,HJ=DC,KJ=Wl;function QJ(e){return e&&e.length?GJ(e,KJ,HJ):void 0}var XJ=QJ;const Lm=Me(XJ);function YJ(e,t){return ee.e^i.s<0?1:-1;for(n=i.d.length,a=e.d.length,t=0,r=ne.d[t]^i.s<0?1:-1;return n===a?0:n>a^i.s<0?1:-1};se.decimalPlaces=se.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*Xe;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};se.dividedBy=se.div=function(e){return va(this,new this.constructor(e))};se.dividedToIntegerBy=se.idiv=function(e){var t=this,r=t.constructor;return ze(va(t,new r(e),0,1),r.precision)};se.equals=se.eq=function(e){return!this.cmp(e)};se.exponent=function(){return wt(this)};se.greaterThan=se.gt=function(e){return this.cmp(e)>0};se.greaterThanOrEqualTo=se.gte=function(e){return this.cmp(e)>=0};se.isInteger=se.isint=function(){return this.e>this.d.length-2};se.isNegative=se.isneg=function(){return this.s<0};se.isPositive=se.ispos=function(){return this.s>0};se.isZero=function(){return this.s===0};se.lessThan=se.lt=function(e){return this.cmp(e)<0};se.lessThanOrEqualTo=se.lte=function(e){return this.cmp(e)<1};se.logarithm=se.log=function(e){var t,r=this,n=r.constructor,a=n.precision,i=a+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq($r))throw Error(an+"NaN");if(r.s<1)throw Error(an+(r.s?"NaN":"-Infinity"));return r.eq($r)?new n(0):(et=!1,t=va(Ou(r,i),Ou(e,i),i),et=!0,ze(t,a))};se.minus=se.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?zC(t,e):UC(t,(e.s=-e.s,e))};se.modulo=se.mod=function(e){var t,r=this,n=r.constructor,a=n.precision;if(e=new n(e),!e.s)throw Error(an+"NaN");return r.s?(et=!1,t=va(r,e,0,1).times(e),et=!0,r.minus(t)):ze(new n(r),a)};se.naturalExponential=se.exp=function(){return BC(this)};se.naturalLogarithm=se.ln=function(){return Ou(this)};se.negated=se.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};se.plus=se.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?UC(t,e):zC(t,(e.s=-e.s,e))};se.precision=se.sd=function(e){var t,r,n,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ms+e);if(t=wt(a)+1,n=a.d.length-1,r=n*Xe+1,n=a.d[n],n){for(;n%10==0;n/=10)r--;for(n=a.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};se.squareRoot=se.sqrt=function(){var e,t,r,n,a,i,s,o=this,c=o.constructor;if(o.s<1){if(!o.s)return new c(0);throw Error(an+"NaN")}for(e=wt(o),et=!1,a=Math.sqrt(+o),a==0||a==1/0?(t=Un(o.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=Kl((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new c(t)):n=new c(a.toString()),r=c.precision,a=s=r+3;;)if(i=n,n=i.plus(va(o,i,s+2)).times(.5),Un(i.d).slice(0,s)===(t=Un(n.d)).slice(0,s)){if(t=t.slice(s-3,s+1),a==s&&t=="4999"){if(ze(i,r+1,0),i.times(i).eq(o)){n=i;break}}else if(t!="9999")break;s+=4}return et=!0,ze(n,r)};se.times=se.mul=function(e){var t,r,n,a,i,s,o,c,u,d=this,f=d.constructor,h=d.d,p=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,r=d.e+e.e,c=h.length,u=p.length,c=0;){for(t=0,a=c+n;a>n;)o=i[a]+p[n]*h[a-n-1]+t,i[a--]=o%Ct|0,t=o/Ct|0;i[a]=(i[a]+t)%Ct|0}for(;!i[--s];)i.pop();return t?++r:i.shift(),e.d=i,e.e=r,et?ze(e,f.precision):e};se.toDecimalPlaces=se.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Gn(e,0,Hl),t===void 0?t=n.rounding:Gn(t,0,8),ze(r,e+wt(r)+1,t))};se.toExponential=function(e,t){var r,n=this,a=n.constructor;return e===void 0?r=Es(n,!0):(Gn(e,0,Hl),t===void 0?t=a.rounding:Gn(t,0,8),n=ze(new a(n),e+1,t),r=Es(n,!0,e+1)),r};se.toFixed=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?Es(a):(Gn(e,0,Hl),t===void 0?t=i.rounding:Gn(t,0,8),n=ze(new i(a),e+wt(a)+1,t),r=Es(n.abs(),!1,e+wt(n)+1),a.isneg()&&!a.isZero()?"-"+r:r)};se.toInteger=se.toint=function(){var e=this,t=e.constructor;return ze(new t(e),wt(e)+1,t.rounding)};se.toNumber=function(){return+this};se.toPower=se.pow=function(e){var t,r,n,a,i,s,o=this,c=o.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c($r);if(o=new c(o),!o.s){if(e.s<1)throw Error(an+"Infinity");return o}if(o.eq($r))return o;if(n=c.precision,e.eq($r))return ze(o,n);if(t=e.e,r=e.d.length-1,s=t>=r,i=o.s,s){if((r=d<0?-d:d)<=FC){for(a=new c($r),t=Math.ceil(n/Xe+4),et=!1;r%2&&(a=a.times(o),T_(a.d,t)),r=Kl(r/2),r!==0;)o=o.times(o),T_(o.d,t);return et=!0,e.s<0?new c($r).div(a):ze(a,n)}}else if(i<0)throw Error(an+"NaN");return i=i<0&&e.d[Math.max(t,r)]&1?-1:1,o.s=1,et=!1,a=e.times(Ou(o,n+u)),et=!0,a=BC(a),a.s=i,a};se.toPrecision=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?(r=wt(a),n=Es(a,r<=i.toExpNeg||r>=i.toExpPos)):(Gn(e,1,Hl),t===void 0?t=i.rounding:Gn(t,0,8),a=ze(new i(a),e,t),r=wt(a),n=Es(a,e<=r||r<=i.toExpNeg,e)),n};se.toSignificantDigits=se.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Gn(e,1,Hl),t===void 0?t=n.rounding:Gn(t,0,8)),ze(new n(r),e,t)};se.toString=se.valueOf=se.val=se.toJSON=se[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=wt(e),r=e.constructor;return Es(e,t<=r.toExpNeg||t>=r.toExpPos)};function UC(e,t){var r,n,a,i,s,o,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),et?ze(t,f):t;if(c=e.d,u=t.d,s=e.e,a=t.e,c=c.slice(),i=s-a,i){for(i<0?(n=c,i=-i,o=u.length):(n=u,a=s,o=c.length),s=Math.ceil(f/Xe),o=s>o?s+1:o+1,i>o&&(i=o,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(o=c.length,i=u.length,o-i<0&&(i=o,n=u,u=c,c=n),r=0;i;)r=(c[--i]=c[i]+u[i]+r)/Ct|0,c[i]%=Ct;for(r&&(c.unshift(r),++a),o=c.length;c[--o]==0;)c.pop();return t.d=c,t.e=a,et?ze(t,f):t}function Gn(e,t,r){if(e!==~~e||er)throw Error(ms+e)}function Un(e){var t,r,n,a=e.length-1,i="",s=e[0];if(a>0){for(i+=s,t=1;ts?1:-1;else for(o=c=0;oa[o]?1:-1;break}return c}function r(n,a,i){for(var s=0;i--;)n[i]-=s,s=n[i]1;)n.shift()}return function(n,a,i,s){var o,c,u,d,f,h,p,m,y,g,b,x,v,S,w,j,k,_,E=n.constructor,O=n.s==a.s?1:-1,P=n.d,T=a.d;if(!n.s)return new E(n);if(!a.s)throw Error(an+"Division by zero");for(c=n.e-a.e,k=T.length,w=P.length,p=new E(O),m=p.d=[],u=0;T[u]==(P[u]||0);)++u;if(T[u]>(P[u]||0)&&--c,i==null?x=i=E.precision:s?x=i+(wt(n)-wt(a))+1:x=i,x<0)return new E(0);if(x=x/Xe+2|0,u=0,k==1)for(d=0,T=T[0],x++;(u1&&(T=e(T,d),P=e(P,d),k=T.length,w=P.length),S=k,y=P.slice(0,k),g=y.length;g=Ct/2&&++j;do d=0,o=t(T,y,k,g),o<0?(b=y[0],k!=g&&(b=b*Ct+(y[1]||0)),d=b/j|0,d>1?(d>=Ct&&(d=Ct-1),f=e(T,d),h=f.length,g=y.length,o=t(f,y,h,g),o==1&&(d--,r(f,k16)throw Error(V1+wt(e));if(!e.s)return new d($r);for(t==null?(et=!1,o=f):o=t,s=new d(.03125);e.abs().gte(.1);)e=e.times(s),u+=5;for(n=Math.log(Bi(2,u))/Math.LN10*2+5|0,o+=n,r=a=i=new d($r),d.precision=o;;){if(a=ze(a.times(e),o),r=r.times(++c),s=i.plus(va(a,r,o)),Un(s.d).slice(0,o)===Un(i.d).slice(0,o)){for(;u--;)i=ze(i.times(i),o);return d.precision=f,t==null?(et=!0,ze(i,f)):i}i=s}}function wt(e){for(var t=e.e*Xe,r=e.d[0];r>=10;r/=10)t++;return t}function hg(e,t,r){if(t>e.LN10.sd())throw et=!0,r&&(e.precision=r),Error(an+"LN10 precision limit exceeded");return ze(new e(e.LN10),t)}function Wa(e){for(var t="";e--;)t+="0";return t}function Ou(e,t){var r,n,a,i,s,o,c,u,d,f=1,h=10,p=e,m=p.d,y=p.constructor,g=y.precision;if(p.s<1)throw Error(an+(p.s?"NaN":"-Infinity"));if(p.eq($r))return new y(0);if(t==null?(et=!1,u=g):u=t,p.eq(10))return t==null&&(et=!0),hg(y,u);if(u+=h,y.precision=u,r=Un(m),n=r.charAt(0),i=wt(p),Math.abs(i)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)p=p.times(e),r=Un(p.d),n=r.charAt(0),f++;i=wt(p),n>1?(p=new y("0."+r),i++):p=new y(n+"."+r.slice(1))}else return c=hg(y,u+2,g).times(i+""),p=Ou(new y(n+"."+r.slice(1)),u-h).plus(c),y.precision=g,t==null?(et=!0,ze(p,g)):p;for(o=s=p=va(p.minus($r),p.plus($r),u),d=ze(p.times(p),u),a=3;;){if(s=ze(s.times(d),u),c=o.plus(va(s,new y(a),u)),Un(c.d).slice(0,u)===Un(o.d).slice(0,u))return o=o.times(2),i!==0&&(o=o.plus(hg(y,u+2,g).times(i+""))),o=va(o,new y(f),u),y.precision=g,t==null?(et=!0,ze(o,g)):o;o=c,a+=2}}function P_(e,t){var r,n,a;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(n,a),t){if(a-=n,r=r-n-1,e.e=Kl(r/Xe),e.d=[],n=(r+1)%Xe,r<0&&(n+=Xe),nYh||e.e<-Yh))throw Error(V1+r)}else e.s=0,e.e=0,e.d=[0];return e}function ze(e,t,r){var n,a,i,s,o,c,u,d,f=e.d;for(s=1,i=f[0];i>=10;i/=10)s++;if(n=t-s,n<0)n+=Xe,a=t,u=f[d=0];else{if(d=Math.ceil((n+1)/Xe),i=f.length,d>=i)return e;for(u=i=f[d],s=1;i>=10;i/=10)s++;n%=Xe,a=n-Xe+s}if(r!==void 0&&(i=Bi(10,s-a-1),o=u/i%10|0,c=t<0||f[d+1]!==void 0||u%i,c=r<4?(o||c)&&(r==0||r==(e.s<0?3:2)):o>5||o==5&&(r==4||c||r==6&&(n>0?a>0?u/Bi(10,s-a):0:f[d-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return c?(i=wt(e),f.length=1,t=t-i-1,f[0]=Bi(10,(Xe-t%Xe)%Xe),e.e=Kl(-t/Xe)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(n==0?(f.length=d,i=1,d--):(f.length=d+1,i=Bi(10,Xe-n),f[d]=a>0?(u/Bi(10,s-a)%Bi(10,a)|0)*i:0),c)for(;;)if(d==0){(f[0]+=i)==Ct&&(f[0]=1,++e.e);break}else{if(f[d]+=i,f[d]!=Ct)break;f[d--]=0,i=1}for(n=f.length;f[--n]===0;)f.pop();if(et&&(e.e>Yh||e.e<-Yh))throw Error(V1+wt(e));return e}function zC(e,t){var r,n,a,i,s,o,c,u,d,f,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),et?ze(t,p):t;if(c=e.d,f=t.d,n=t.e,u=e.e,c=c.slice(),s=u-n,s){for(d=s<0,d?(r=c,s=-s,o=f.length):(r=f,n=u,o=c.length),a=Math.max(Math.ceil(p/Xe),o)+2,s>a&&(s=a,r.length=1),r.reverse(),a=s;a--;)r.push(0);r.reverse()}else{for(a=c.length,o=f.length,d=a0;--a)c[o++]=0;for(a=f.length;a>s;){if(c[--a]0?i=i.charAt(0)+"."+i.slice(1)+Wa(n):s>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+Wa(-a-1)+i,r&&(n=r-s)>0&&(i+=Wa(n))):a>=s?(i+=Wa(a+1-s),r&&(n=r-a-1)>0&&(i=i+"."+Wa(n))):((n=a+1)0&&(a+1===s&&(i+="."),i+=Wa(n))),e.s<0?"-"+i:i}function T_(e,t){if(e.length>t)return e.length=t,!0}function VC(e){var t,r,n;function a(i){var s=this;if(!(s instanceof a))return new a(i);if(s.constructor=a,i instanceof a){s.s=i.s,s.e=i.e,s.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(ms+i);if(i>0)s.s=1;else if(i<0)i=-i,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(i===~~i&&i<1e7){s.e=0,s.d=[i];return}return P_(s,i.toString())}else if(typeof i!="string")throw Error(ms+i);if(i.charCodeAt(0)===45?(i=i.slice(1),s.s=-1):s.s=1,vee.test(i))P_(s,i);else throw Error(ms+i)}if(a.prototype=se,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=VC,a.config=a.set=xee,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(ms+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(ms+r+": "+n);return this}var q1=VC(gee);$r=new q1(1);const Be=q1;function bee(e){return kee(e)||See(e)||jee(e)||wee()}function wee(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jee(e,t){if(e){if(typeof e=="string")return Tv(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Tv(e,t)}}function See(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function kee(e){if(Array.isArray(e))return Tv(e)}function Tv(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=t?r.apply(void 0,a):e(t-s,C_(function(){for(var o=arguments.length,c=new Array(o),u=0;ue.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,a=!1,i=void 0;try{for(var s=e[Symbol.iterator](),o;!(n=(o=s.next()).done)&&(r.push(o.value),!(t&&r.length===t));n=!0);}catch(c){a=!0,i=c}finally{try{!n&&s.return!=null&&s.return()}finally{if(a)throw i}}return r}}function Fee(e){if(Array.isArray(e))return e}function KC(e){var t=Nu(e,2),r=t[0],n=t[1],a=r,i=n;return r>n&&(a=n,i=r),[a,i]}function QC(e,t,r){if(e.lte(0))return new Be(0);var n=Bm.getDigitCount(e.toNumber()),a=new Be(10).pow(n),i=e.div(a),s=n!==1?.05:.1,o=new Be(Math.ceil(i.div(s).toNumber())).add(r).mul(s),c=o.mul(a);return t?c:new Be(Math.ceil(c))}function Uee(e,t,r){var n=1,a=new Be(e);if(!a.isint()&&r){var i=Math.abs(e);i<1?(n=new Be(10).pow(Bm.getDigitCount(e)-1),a=new Be(Math.floor(a.div(n).toNumber())).mul(n)):i>1&&(a=new Be(Math.floor(e)))}else e===0?a=new Be(Math.floor((t-1)/2)):r||(a=new Be(Math.floor(e)));var s=Math.floor((t-1)/2),o=Eee(Nee(function(c){return a.add(new Be(c-s).mul(n)).toNumber()}),Cv);return o(0,t)}function XC(e,t,r,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new Be(0),tickMin:new Be(0),tickMax:new Be(0)};var i=QC(new Be(t).sub(e).div(r-1),n,a),s;e<=0&&t>=0?s=new Be(0):(s=new Be(e).add(t).div(2),s=s.sub(new Be(s).mod(i)));var o=Math.ceil(s.sub(e).div(i).toNumber()),c=Math.ceil(new Be(t).sub(s).div(i).toNumber()),u=o+c+1;return u>r?XC(e,t,r,n,a+1):(u0?c+(r-u):c,o=t>0?o:o+(r-u)),{step:i,tickMin:s.sub(new Be(o).mul(i)),tickMax:s.add(new Be(c).mul(i))})}function Bee(e){var t=Nu(e,2),r=t[0],n=t[1],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(a,2),o=KC([r,n]),c=Nu(o,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(Iv(Cv(0,a-1).map(function(){return 1/0}))):[].concat(Iv(Cv(0,a-1).map(function(){return-1/0})),[d]);return r>n?$v(f):f}if(u===d)return Uee(u,a,i);var h=XC(u,d,s,i),p=h.step,m=h.tickMin,y=h.tickMax,g=Bm.rangeStep(m,y.add(new Be(.1).mul(p)),p);return r>n?$v(g):g}function zee(e,t){var r=Nu(e,2),n=r[0],a=r[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=KC([n,a]),o=Nu(s,2),c=o[0],u=o[1];if(c===-1/0||u===1/0)return[n,a];if(c===u)return[c];var d=Math.max(t,2),f=QC(new Be(u).sub(c).div(d-1),i,0),h=[].concat(Iv(Bm.rangeStep(new Be(c),new Be(u).sub(new Be(.99).mul(f)),f)),[u]);return n>a?$v(h):h}var Vee=GC(Bee),qee=GC(zee),Wee=!0,pg="Invariant failed";function As(e,t){if(!e){if(Wee)throw new Error(pg);var r=typeof t=="function"?t():t,n=r?"".concat(pg,": ").concat(r):pg;throw new Error(n)}}var Gee=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function ol(e){"@babel/helpers - typeof";return ol=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ol(e)}function Zh(){return Zh=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Jee(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ete(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I_(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,s=-1,o=(r=n==null?void 0:n.length)!==null&&r!==void 0?r:0;if(o<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var c=i.range,u=0;u0?a[u-1].coordinate:a[o-1].coordinate,f=a[u].coordinate,h=u>=o-1?a[0].coordinate:a[u+1].coordinate,p=void 0;if(ir(f-d)!==ir(h-f)){var m=[];if(ir(h-f)===ir(c[1]-c[0])){p=h;var y=f+c[1]-c[0];m[0]=Math.min(y,(y+d)/2),m[1]=Math.max(y,(y+d)/2)}else{p=d;var g=h+c[1]-c[0];m[0]=Math.min(f,(g+f)/2),m[1]=Math.max(f,(g+f)/2)}var b=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(t>b[0]&&t<=b[1]||t>=m[0]&&t<=m[1]){s=a[u].index;break}}else{var x=Math.min(d,h),v=Math.max(d,h);if(t>(x+f)/2&&t<=(v+f)/2){s=a[u].index;break}}}else for(var S=0;S0&&S(n[S].coordinate+n[S-1].coordinate)/2&&t<=(n[S].coordinate+n[S+1].coordinate)/2||S===o-1&&t>(n[S].coordinate+n[S-1].coordinate)/2){s=n[S].index;break}return s},W1=function(t){var r,n=t,a=n.type.displayName,i=(r=t.type)!==null&&r!==void 0&&r.defaultProps?dt(dt({},t.type.defaultProps),t.props):t.props,s=i.stroke,o=i.fill,c;switch(a){case"Line":c=s;break;case"Area":case"Radar":c=s&&s!=="none"?s:o;break;default:c=o;break}return c},gte=function(t){var r=t.barSize,n=t.totalSize,a=t.stackGroups,i=a===void 0?{}:a;if(!i)return{};for(var s={},o=Object.keys(i),c=0,u=o.length;c=0});if(b&&b.length){var x=b[0].type.defaultProps,v=x!==void 0?dt(dt({},x),b[0].props):b[0].props,S=v.barSize,w=v[g];s[w]||(s[w]=[]);var j=xe(S)?r:S;s[w].push({item:b[0],stackList:b.slice(1),barSize:xe(j)?void 0:sr(j,n,0)})}}return s},vte=function(t){var r=t.barGap,n=t.barCategoryGap,a=t.bandSize,i=t.sizeList,s=i===void 0?[]:i,o=t.maxBarSize,c=s.length;if(c<1)return null;var u=sr(r,a,0,!0),d,f=[];if(s[0].barSize===+s[0].barSize){var h=!1,p=a/c,m=s.reduce(function(S,w){return S+w.barSize||0},0);m+=(c-1)*u,m>=a&&(m-=(c-1)*u,u=0),m>=a&&p>0&&(h=!0,p*=.9,m=c*p);var y=(a-m)/2>>0,g={offset:y-u,size:0};d=s.reduce(function(S,w){var j={item:w.item,position:{offset:g.offset+g.size+u,size:h?p:w.barSize}},k=[].concat(M_(S),[j]);return g=k[k.length-1].position,w.stackList&&w.stackList.length&&w.stackList.forEach(function(_){k.push({item:_,position:g})}),k},f)}else{var b=sr(n,a,0,!0);a-2*b-(c-1)*u<=0&&(u=0);var x=(a-2*b-(c-1)*u)/c;x>1&&(x>>=0);var v=o===+o?Math.min(x,o):x;d=s.reduce(function(S,w,j){var k=[].concat(M_(S),[{item:w.item,position:{offset:b+(x+u)*j+(x-v)/2,size:v}}]);return w.stackList&&w.stackList.length&&w.stackList.forEach(function(_){k.push({item:_,position:k[k.length-1].position})}),k},f)}return d},xte=function(t,r,n,a){var i=n.children,s=n.width,o=n.margin,c=s-(o.left||0)-(o.right||0),u=e$({children:i,legendWidth:c});if(u){var d=a||{},f=d.width,h=d.height,p=u.align,m=u.verticalAlign,y=u.layout;if((y==="vertical"||y==="horizontal"&&m==="middle")&&p!=="center"&&Y(t[p]))return dt(dt({},t),{},Ao({},p,t[p]+(f||0)));if((y==="horizontal"||y==="vertical"&&p==="center")&&m!=="middle"&&Y(t[m]))return dt(dt({},t),{},Ao({},m,t[m]+(h||0)))}return t},bte=function(t,r,n){return xe(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},t$=function(t,r,n,a,i){var s=r.props.children,o=Lr(s,Od).filter(function(u){return bte(a,i,u.props.direction)});if(o&&o.length){var c=o.map(function(u){return u.props.dataKey});return t.reduce(function(u,d){var f=Nt(d,n);if(xe(f))return u;var h=Array.isArray(f)?[Fm(f),Lm(f)]:[f,f],p=c.reduce(function(m,y){var g=Nt(d,y,0),b=h[0]-Math.abs(Array.isArray(g)?g[0]:g),x=h[1]+Math.abs(Array.isArray(g)?g[1]:g);return[Math.min(b,m[0]),Math.max(x,m[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},wte=function(t,r,n,a,i){var s=r.map(function(o){return t$(t,o,n,i,a)}).filter(function(o){return!xe(o)});return s&&s.length?s.reduce(function(o,c){return[Math.min(o[0],c[0]),Math.max(o[1],c[1])]},[1/0,-1/0]):null},r$=function(t,r,n,a,i){var s=r.map(function(c){var u=c.props.dataKey;return n==="number"&&u&&t$(t,c,u,a)||Fc(t,u,n,i)});if(n==="number")return s.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var o={};return s.reduce(function(c,u){for(var d=0,f=u.length;d=2?ir(o[0]-o[1])*2*u:u,r&&(t.ticks||t.niceTicks)){var d=(t.ticks||t.niceTicks).map(function(f){var h=i?i.indexOf(f):f;return{coordinate:a(h)+u,value:f,offset:u}});return d.filter(function(f){return!xd(f.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(f,h){return{coordinate:a(f)+u,value:f,index:h,offset:u}}):a.ticks&&!n?a.ticks(t.tickCount).map(function(f){return{coordinate:a(f)+u,value:f,offset:u}}):a.domain().map(function(f,h){return{coordinate:a(f)+u,value:i?i[f]:f,index:h,offset:u}})},mg=new WeakMap,lf=function(t,r){if(typeof r!="function")return t;mg.has(t)||mg.set(t,new WeakMap);var n=mg.get(t);if(n.has(r))return n.get(r);var a=function(){t.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,a),a},i$=function(t,r,n){var a=t.scale,i=t.type,s=t.layout,o=t.axisType;if(a==="auto")return s==="radial"&&o==="radiusAxis"?{scale:wu(),realScaleType:"band"}:s==="radial"&&o==="angleAxis"?{scale:Hh(),realScaleType:"linear"}:i==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:Lc(),realScaleType:"point"}:i==="category"?{scale:wu(),realScaleType:"band"}:{scale:Hh(),realScaleType:"linear"};if(_s(a)){var c="scale".concat(Sm(a));return{scale:(A_[c]||Lc)(),realScaleType:A_[c]?c:"point"}}return ge(a)?{scale:a}:{scale:Lc(),realScaleType:"point"}},L_=1e-4,s$=function(t){var r=t.domain();if(!(!r||r.length<=2)){var n=r.length,a=t.range(),i=Math.min(a[0],a[1])-L_,s=Math.max(a[0],a[1])+L_,o=t(r[0]),c=t(r[n-1]);(os||cs)&&t.domain([r[0],r[n-1]])}},jte=function(t,r){if(!t)return null;for(var n=0,a=t.length;na)&&(i[1]=a),i[0]>a&&(i[0]=a),i[1]=0?(t[o][n][0]=i,t[o][n][1]=i+c,i=t[o][n][1]):(t[o][n][0]=s,t[o][n][1]=s+c,s=t[o][n][1])}},_te=function(t){var r=t.length;if(!(r<=0))for(var n=0,a=t[0].length;n=0?(t[s][n][0]=i,t[s][n][1]=i+o,i=t[s][n][1]):(t[s][n][0]=0,t[s][n][1]=0)}},Ote={sign:kte,expand:Kz,none:Jo,silhouette:Qz,wiggle:Xz,positive:_te},Nte=function(t,r,n){var a=r.map(function(o){return o.props.dataKey}),i=Ote[n],s=Hz().keys(a).value(function(o,c){return+Nt(o,c,0)}).order(lv).offset(i);return s(t)},Ete=function(t,r,n,a,i,s){if(!t)return null;var o=s?r.reverse():r,c={},u=o.reduce(function(f,h){var p,m=(p=h.type)!==null&&p!==void 0&&p.defaultProps?dt(dt({},h.type.defaultProps),h.props):h.props,y=m.stackId,g=m.hide;if(g)return f;var b=m[n],x=f[b]||{hasStack:!1,stackGroups:{}};if(At(y)){var v=x.stackGroups[y]||{numericAxisId:n,cateAxisId:a,items:[]};v.items.push(h),x.hasStack=!0,x.stackGroups[y]=v}else x.stackGroups[zl("_stackId_")]={numericAxisId:n,cateAxisId:a,items:[h]};return dt(dt({},f),{},Ao({},b,x))},c),d={};return Object.keys(u).reduce(function(f,h){var p=u[h];if(p.hasStack){var m={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(y,g){var b=p.stackGroups[g];return dt(dt({},y),{},Ao({},g,{numericAxisId:n,cateAxisId:a,items:b.items,stackedData:Nte(t,b.items,i)}))},m)}return dt(dt({},f),{},Ao({},h,p))},d)},o$=function(t,r){var n=r.realScaleType,a=r.type,i=r.tickCount,s=r.originalDomain,o=r.allowDecimals,c=n||r.scale;if(c!=="auto"&&c!=="linear")return null;if(i&&a==="number"&&s&&(s[0]==="auto"||s[1]==="auto")){var u=t.domain();if(!u.length)return null;var d=Vee(u,i,o);return t.domain([Fm(d),Lm(d)]),{niceTicks:d}}if(i&&a==="number"){var f=t.domain(),h=qee(f,i,o);return{niceTicks:h}}return null};function F_(e){var t=e.axis,r=e.ticks,n=e.bandSize,a=e.entry,i=e.index,s=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!xe(a[t.dataKey])){var o=Oh(r,"value",a[t.dataKey]);if(o)return o.coordinate+n/2}return r[i]?r[i].coordinate+n/2:null}var c=Nt(a,xe(s)?t.dataKey:s);return xe(c)?null:t.scale(c)}var U_=function(t){var r=t.axis,n=t.ticks,a=t.offset,i=t.bandSize,s=t.entry,o=t.index;if(r.type==="category")return n[o]?n[o].coordinate+a:null;var c=Nt(s,r.dataKey,r.domain[o]);return xe(c)?null:r.scale(c)-i/2+a},Ate=function(t){var r=t.numericAxis,n=r.scale.domain();if(r.type==="number"){var a=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return a<=0&&i>=0?0:i<0?i:a}return n[0]},Pte=function(t,r){var n,a=(n=t.type)!==null&&n!==void 0&&n.defaultProps?dt(dt({},t.type.defaultProps),t.props):t.props,i=a.stackId;if(At(i)){var s=r[i];if(s){var o=s.items.indexOf(t);return o>=0?s.stackedData[o]:null}}return null},Tte=function(t){return t.reduce(function(r,n){return[Fm(n.concat([r[0]]).filter(Y)),Lm(n.concat([r[1]]).filter(Y))]},[1/0,-1/0])},l$=function(t,r,n){return Object.keys(t).reduce(function(a,i){var s=t[i],o=s.stackedData,c=o.reduce(function(u,d){var f=Tte(d.slice(r,n+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(c[0],a[0]),Math.max(c[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},B_=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,z_=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Lv=function(t,r,n){if(ge(t))return t(r,n);if(!Array.isArray(t))return r;var a=[];if(Y(t[0]))a[0]=n?t[0]:Math.min(t[0],r[0]);else if(B_.test(t[0])){var i=+B_.exec(t[0])[1];a[0]=r[0]-i}else ge(t[0])?a[0]=t[0](r[0]):a[0]=r[0];if(Y(t[1]))a[1]=n?t[1]:Math.max(t[1],r[1]);else if(z_.test(t[1])){var s=+z_.exec(t[1])[1];a[1]=r[1]+s}else ge(t[1])?a[1]=t[1](r[1]):a[1]=r[1];return a},ep=function(t,r,n){if(t&&t.scale&&t.scale.bandwidth){var a=t.scale.bandwidth();if(!n||a>0)return a}if(t&&r&&r.length>=2){for(var i=v1(r,function(f){return f.coordinate}),s=1/0,o=1,c=i.length;oe.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},Ute=function(t,r,n,a,i){var s=t.width,o=t.height,c=t.startAngle,u=t.endAngle,d=sr(t.cx,s,s/2),f=sr(t.cy,o,o/2),h=d$(s,o,n),p=sr(t.innerRadius,h,0),m=sr(t.outerRadius,h,h*.8),y=Object.keys(r);return y.reduce(function(g,b){var x=r[b],v=x.domain,S=x.reversed,w;if(xe(x.range))a==="angleAxis"?w=[c,u]:a==="radiusAxis"&&(w=[p,m]),S&&(w=[w[1],w[0]]);else{w=x.range;var j=w,k=Ite(j,2);c=k[0],u=k[1]}var _=i$(x,i),E=_.realScaleType,O=_.scale;O.domain(v).range(w),s$(O);var P=o$(O,sa(sa({},x),{},{realScaleType:E})),T=sa(sa(sa({},x),P),{},{range:w,radius:m,realScaleType:E,scale:O,cx:d,cy:f,innerRadius:p,outerRadius:m,startAngle:c,endAngle:u});return sa(sa({},g),{},u$({},b,T))},{})},Bte=function(t,r){var n=t.x,a=t.y,i=r.x,s=r.y;return Math.sqrt(Math.pow(n-i,2)+Math.pow(a-s,2))},zte=function(t,r){var n=t.x,a=t.y,i=r.cx,s=r.cy,o=Bte({x:n,y:a},{x:i,y:s});if(o<=0)return{radius:o};var c=(n-i)/o,u=Math.acos(c);return a>s&&(u=2*Math.PI-u),{radius:o,angle:Fte(u),angleInRadian:u}},Vte=function(t){var r=t.startAngle,n=t.endAngle,a=Math.floor(r/360),i=Math.floor(n/360),s=Math.min(a,i);return{startAngle:r-s*360,endAngle:n-s*360}},qte=function(t,r){var n=r.startAngle,a=r.endAngle,i=Math.floor(n/360),s=Math.floor(a/360),o=Math.min(i,s);return t+o*360},G_=function(t,r){var n=t.x,a=t.y,i=zte({x:n,y:a},r),s=i.radius,o=i.angle,c=r.innerRadius,u=r.outerRadius;if(su)return!1;if(s===0)return!0;var d=Vte(r),f=d.startAngle,h=d.endAngle,p=o,m;if(f<=h){for(;p>h;)p-=360;for(;p=f&&p<=h}else{for(;p>f;)p-=360;for(;p=h&&p<=f}return m?sa(sa({},r),{},{radius:s,angle:qte(p,r)}):null},f$=function(t){return!N.isValidElement(t)&&!ge(t)&&typeof t!="boolean"?t.className:""};function Tu(e){"@babel/helpers - typeof";return Tu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tu(e)}var Wte=["offset"];function Gte(e){return Xte(e)||Qte(e)||Kte(e)||Hte()}function Hte(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kte(e,t){if(e){if(typeof e=="string")return Fv(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Fv(e,t)}}function Qte(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Xte(e){if(Array.isArray(e))return Fv(e)}function Fv(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Zte(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function H_(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function kt(e){for(var t=1;t=0?1:-1,v,S;a==="insideStart"?(v=p+x*s,S=y):a==="insideEnd"?(v=m-x*s,S=!y):a==="end"&&(v=m+x*s,S=y),S=b<=0?S:!S;var w=He(u,d,g,v),j=He(u,d,g,v+(S?1:-1)*359),k="M".concat(w.x,",").concat(w.y,` - A`).concat(g,",").concat(g,",0,1,").concat(S?0:1,`, - `).concat(j.x,",").concat(j.y),_=xe(t.id)?zl("recharts-radial-line-"):t.id;return A.createElement("text",Cu({},n,{dominantBaseline:"central",className:ve("recharts-radial-bar-label",o)}),A.createElement("defs",null,A.createElement("path",{id:_,d:k})),A.createElement("textPath",{xlinkHref:"#".concat(_)},r))},ire=function(t){var r=t.viewBox,n=t.offset,a=t.position,i=r,s=i.cx,o=i.cy,c=i.innerRadius,u=i.outerRadius,d=i.startAngle,f=i.endAngle,h=(d+f)/2;if(a==="outside"){var p=He(s,o,u+n,h),m=p.x,y=p.y;return{x:m,y,textAnchor:m>=s?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:s,y:o,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:s,y:o,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:s,y:o,textAnchor:"middle",verticalAnchor:"end"};var g=(c+u)/2,b=He(s,o,g,h),x=b.x,v=b.y;return{x,y:v,textAnchor:"middle",verticalAnchor:"middle"}},sre=function(t){var r=t.viewBox,n=t.parentViewBox,a=t.offset,i=t.position,s=r,o=s.x,c=s.y,u=s.width,d=s.height,f=d>=0?1:-1,h=f*a,p=f>0?"end":"start",m=f>0?"start":"end",y=u>=0?1:-1,g=y*a,b=y>0?"end":"start",x=y>0?"start":"end";if(i==="top"){var v={x:o+u/2,y:c-f*a,textAnchor:"middle",verticalAnchor:p};return kt(kt({},v),n?{height:Math.max(c-n.y,0),width:u}:{})}if(i==="bottom"){var S={x:o+u/2,y:c+d+h,textAnchor:"middle",verticalAnchor:m};return kt(kt({},S),n?{height:Math.max(n.y+n.height-(c+d),0),width:u}:{})}if(i==="left"){var w={x:o-g,y:c+d/2,textAnchor:b,verticalAnchor:"middle"};return kt(kt({},w),n?{width:Math.max(w.x-n.x,0),height:d}:{})}if(i==="right"){var j={x:o+u+g,y:c+d/2,textAnchor:x,verticalAnchor:"middle"};return kt(kt({},j),n?{width:Math.max(n.x+n.width-j.x,0),height:d}:{})}var k=n?{width:u,height:d}:{};return i==="insideLeft"?kt({x:o+g,y:c+d/2,textAnchor:x,verticalAnchor:"middle"},k):i==="insideRight"?kt({x:o+u-g,y:c+d/2,textAnchor:b,verticalAnchor:"middle"},k):i==="insideTop"?kt({x:o+u/2,y:c+h,textAnchor:"middle",verticalAnchor:m},k):i==="insideBottom"?kt({x:o+u/2,y:c+d-h,textAnchor:"middle",verticalAnchor:p},k):i==="insideTopLeft"?kt({x:o+g,y:c+h,textAnchor:x,verticalAnchor:m},k):i==="insideTopRight"?kt({x:o+u-g,y:c+h,textAnchor:b,verticalAnchor:m},k):i==="insideBottomLeft"?kt({x:o+g,y:c+d-h,textAnchor:x,verticalAnchor:p},k):i==="insideBottomRight"?kt({x:o+u-g,y:c+d-h,textAnchor:b,verticalAnchor:p},k):Ll(i)&&(Y(i.x)||Xi(i.x))&&(Y(i.y)||Xi(i.y))?kt({x:o+sr(i.x,u),y:c+sr(i.y,d),textAnchor:"end",verticalAnchor:"end"},k):kt({x:o+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},k)},ore=function(t){return"cx"in t&&Y(t.cx)};function Rt(e){var t=e.offset,r=t===void 0?5:t,n=Yte(e,Wte),a=kt({offset:r},n),i=a.viewBox,s=a.position,o=a.value,c=a.children,u=a.content,d=a.className,f=d===void 0?"":d,h=a.textBreakAll;if(!i||xe(o)&&xe(c)&&!N.isValidElement(u)&&!ge(u))return null;if(N.isValidElement(u))return N.cloneElement(u,a);var p;if(ge(u)){if(p=N.createElement(u,a),N.isValidElement(p))return p}else p=rre(a);var m=ore(i),y=he(a,!0);if(m&&(s==="insideStart"||s==="insideEnd"||s==="end"))return are(a,p,y);var g=m?ire(a):sre(a);return A.createElement(Ns,Cu({className:ve("recharts-label",f)},y,g,{breakAll:h}),p)}Rt.displayName="Label";var h$=function(t){var r=t.cx,n=t.cy,a=t.angle,i=t.startAngle,s=t.endAngle,o=t.r,c=t.radius,u=t.innerRadius,d=t.outerRadius,f=t.x,h=t.y,p=t.top,m=t.left,y=t.width,g=t.height,b=t.clockWise,x=t.labelViewBox;if(x)return x;if(Y(y)&&Y(g)){if(Y(f)&&Y(h))return{x:f,y:h,width:y,height:g};if(Y(p)&&Y(m))return{x:p,y:m,width:y,height:g}}return Y(f)&&Y(h)?{x:f,y:h,width:0,height:0}:Y(r)&&Y(n)?{cx:r,cy:n,startAngle:i||a||0,endAngle:s||a||0,innerRadius:u||0,outerRadius:d||c||o||0,clockWise:b}:t.viewBox?t.viewBox:{}},lre=function(t,r){return t?t===!0?A.createElement(Rt,{key:"label-implicit",viewBox:r}):At(t)?A.createElement(Rt,{key:"label-implicit",viewBox:r,value:t}):N.isValidElement(t)?t.type===Rt?N.cloneElement(t,{key:"label-implicit",viewBox:r}):A.createElement(Rt,{key:"label-implicit",content:t,viewBox:r}):ge(t)?A.createElement(Rt,{key:"label-implicit",content:t,viewBox:r}):Ll(t)?A.createElement(Rt,Cu({viewBox:r},t,{key:"label-implicit"})):null:null},cre=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var a=t.children,i=h$(t),s=Lr(a,Rt).map(function(c,u){return N.cloneElement(c,{viewBox:r||i,key:"label-".concat(u)})});if(!n)return s;var o=lre(t.label,r||i);return[o].concat(Gte(s))};Rt.parseViewBox=h$;Rt.renderCallByParent=cre;function ure(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var dre=ure;const fre=Me(dre);function $u(e){"@babel/helpers - typeof";return $u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$u(e)}var hre=["valueAccessor"],pre=["data","dataKey","clockWise","id","textBreakAll"];function mre(e){return xre(e)||vre(e)||gre(e)||yre()}function yre(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gre(e,t){if(e){if(typeof e=="string")return Uv(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Uv(e,t)}}function vre(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function xre(e){if(Array.isArray(e))return Uv(e)}function Uv(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Sre(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var kre=function(t){return Array.isArray(t.value)?fre(t.value):t.value};function xa(e){var t=e.valueAccessor,r=t===void 0?kre:t,n=X_(e,hre),a=n.data,i=n.dataKey,s=n.clockWise,o=n.id,c=n.textBreakAll,u=X_(n,pre);return!a||!a.length?null:A.createElement(Pe,{className:"recharts-label-list"},a.map(function(d,f){var h=xe(i)?r(d,f):Nt(d&&d.payload,i),p=xe(o)?{}:{id:"".concat(o,"-").concat(f)};return A.createElement(Rt,rp({},he(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:c,viewBox:Rt.parseViewBox(xe(s)?d:Q_(Q_({},d),{},{clockWise:s})),key:"label-".concat(f),index:f}))}))}xa.displayName="LabelList";function _re(e,t){return e?e===!0?A.createElement(xa,{key:"labelList-implicit",data:t}):A.isValidElement(e)||ge(e)?A.createElement(xa,{key:"labelList-implicit",data:t,content:e}):Ll(e)?A.createElement(xa,rp({data:t},e,{key:"labelList-implicit"})):null:null}function Ore(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,a=Lr(n,xa).map(function(s,o){return N.cloneElement(s,{data:t,key:"labelList-".concat(o)})});if(!r)return a;var i=_re(e.label,t);return[i].concat(mre(a))}xa.renderCallByParent=Ore;function Iu(e){"@babel/helpers - typeof";return Iu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Iu(e)}function Bv(){return Bv=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(s>u),`, - `).concat(f.x,",").concat(f.y,` - `);if(a>0){var p=He(r,n,a,s),m=He(r,n,a,u);h+="L ".concat(m.x,",").concat(m.y,` - A `).concat(a,",").concat(a,`,0, - `).concat(+(Math.abs(c)>180),",").concat(+(s<=u),`, - `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(r,",").concat(n," Z");return h},Tre=function(t){var r=t.cx,n=t.cy,a=t.innerRadius,i=t.outerRadius,s=t.cornerRadius,o=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,f=ir(d-u),h=cf({cx:r,cy:n,radius:i,angle:u,sign:f,cornerRadius:s,cornerIsExternal:c}),p=h.circleTangency,m=h.lineTangency,y=h.theta,g=cf({cx:r,cy:n,radius:i,angle:d,sign:-f,cornerRadius:s,cornerIsExternal:c}),b=g.circleTangency,x=g.lineTangency,v=g.theta,S=c?Math.abs(u-d):Math.abs(u-d)-y-v;if(S<0)return o?"M ".concat(m.x,",").concat(m.y,` - a`).concat(s,",").concat(s,",0,0,1,").concat(s*2,`,0 - a`).concat(s,",").concat(s,",0,0,1,").concat(-s*2,`,0 - `):p$({cx:r,cy:n,innerRadius:a,outerRadius:i,startAngle:u,endAngle:d});var w="M ".concat(m.x,",").concat(m.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,` - A`).concat(i,",").concat(i,",0,").concat(+(S>180),",").concat(+(f<0),",").concat(b.x,",").concat(b.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(x.x,",").concat(x.y,` - `);if(a>0){var j=cf({cx:r,cy:n,radius:a,angle:u,sign:f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),k=j.circleTangency,_=j.lineTangency,E=j.theta,O=cf({cx:r,cy:n,radius:a,angle:d,sign:-f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),P=O.circleTangency,T=O.lineTangency,M=O.theta,I=c?Math.abs(u-d):Math.abs(u-d)-E-M;if(I<0&&s===0)return"".concat(w,"L").concat(r,",").concat(n,"Z");w+="L".concat(T.x,",").concat(T.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(P.x,",").concat(P.y,` - A`).concat(a,",").concat(a,",0,").concat(+(I>180),",").concat(+(f>0),",").concat(k.x,",").concat(k.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(_.x,",").concat(_.y,"Z")}else w+="L".concat(r,",").concat(n,"Z");return w},Cre={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},m$=function(t){var r=Z_(Z_({},Cre),t),n=r.cx,a=r.cy,i=r.innerRadius,s=r.outerRadius,o=r.cornerRadius,c=r.forceCornerRadius,u=r.cornerIsExternal,d=r.startAngle,f=r.endAngle,h=r.className;if(s0&&Math.abs(d-f)<360?g=Tre({cx:n,cy:a,innerRadius:i,outerRadius:s,cornerRadius:Math.min(y,m/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):g=p$({cx:n,cy:a,innerRadius:i,outerRadius:s,startAngle:d,endAngle:f}),A.createElement("path",Bv({},he(r,!0),{className:p,d:g,role:"img"}))};function Ru(e){"@babel/helpers - typeof";return Ru=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ru(e)}function zv(){return zv=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function Yre(e,t){return Vs(e.getTime(),t.getTime())}function Zre(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Jre(e,t){return e===t}function sO(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var a=new Array(n),i=e.entries(),s,o,c=0;(s=i.next())&&!s.done;){for(var u=t.entries(),d=!1,f=0;(o=u.next())&&!o.done;){if(a[f]){f++;continue}var h=s.value,p=o.value;if(r.equals(h[0],p[0],c,f,e,t,r)&&r.equals(h[1],p[1],h[0],p[0],e,t,r)){d=a[f]=!0;break}f++}if(!d)return!1;c++}return!0}var ene=Vs;function tne(e,t,r){var n=iO(e),a=n.length;if(iO(t).length!==a)return!1;for(;a-- >0;)if(!x$(e,t,r,n[a]))return!1;return!0}function vc(e,t,r){var n=nO(e),a=n.length;if(nO(t).length!==a)return!1;for(var i,s,o;a-- >0;)if(i=n[a],!x$(e,t,r,i)||(s=aO(e,i),o=aO(t,i),(s||o)&&(!s||!o||s.configurable!==o.configurable||s.enumerable!==o.enumerable||s.writable!==o.writable)))return!1;return!0}function rne(e,t){return Vs(e.valueOf(),t.valueOf())}function nne(e,t){return e.source===t.source&&e.flags===t.flags}function oO(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var a=new Array(n),i=e.values(),s,o;(s=i.next())&&!s.done;){for(var c=t.values(),u=!1,d=0;(o=c.next())&&!o.done;){if(!a[d]&&r.equals(s.value,o.value,s.value,o.value,e,t,r)){u=a[d]=!0;break}d++}if(!u)return!1}return!0}function ane(e,t){var r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function ine(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function x$(e,t,r,n){return(n===Qre||n===Kre||n===Hre)&&(e.$$typeof||t.$$typeof)?!0:Gre(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var sne="[object Arguments]",one="[object Boolean]",lne="[object Date]",cne="[object Error]",une="[object Map]",dne="[object Number]",fne="[object Object]",hne="[object RegExp]",pne="[object Set]",mne="[object String]",yne="[object URL]",gne=Array.isArray,lO=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,cO=Object.assign,vne=Object.prototype.toString.call.bind(Object.prototype.toString);function xne(e){var t=e.areArraysEqual,r=e.areDatesEqual,n=e.areErrorsEqual,a=e.areFunctionsEqual,i=e.areMapsEqual,s=e.areNumbersEqual,o=e.areObjectsEqual,c=e.arePrimitiveWrappersEqual,u=e.areRegExpsEqual,d=e.areSetsEqual,f=e.areTypedArraysEqual,h=e.areUrlsEqual;return function(m,y,g){if(m===y)return!0;if(m==null||y==null)return!1;var b=typeof m;if(b!==typeof y)return!1;if(b!=="object")return b==="number"?s(m,y,g):b==="function"?a(m,y,g):!1;var x=m.constructor;if(x!==y.constructor)return!1;if(x===Object)return o(m,y,g);if(gne(m))return t(m,y,g);if(lO!=null&&lO(m))return f(m,y,g);if(x===Date)return r(m,y,g);if(x===RegExp)return u(m,y,g);if(x===Map)return i(m,y,g);if(x===Set)return d(m,y,g);var v=vne(m);return v===lne?r(m,y,g):v===hne?u(m,y,g):v===une?i(m,y,g):v===pne?d(m,y,g):v===fne?typeof m.then!="function"&&typeof y.then!="function"&&o(m,y,g):v===yne?h(m,y,g):v===cne?n(m,y,g):v===sne?o(m,y,g):v===one||v===dne||v===mne?c(m,y,g):!1}}function bne(e){var t=e.circular,r=e.createCustomConfig,n=e.strict,a={areArraysEqual:n?vc:Xre,areDatesEqual:Yre,areErrorsEqual:Zre,areFunctionsEqual:Jre,areMapsEqual:n?rO(sO,vc):sO,areNumbersEqual:ene,areObjectsEqual:n?vc:tne,arePrimitiveWrappersEqual:rne,areRegExpsEqual:nne,areSetsEqual:n?rO(oO,vc):oO,areTypedArraysEqual:n?vc:ane,areUrlsEqual:ine};if(r&&(a=cO({},a,r(a))),t){var i=df(a.areArraysEqual),s=df(a.areMapsEqual),o=df(a.areObjectsEqual),c=df(a.areSetsEqual);a=cO({},a,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:c})}return a}function wne(e){return function(t,r,n,a,i,s,o){return e(t,r,o)}}function jne(e){var t=e.circular,r=e.comparator,n=e.createState,a=e.equals,i=e.strict;if(n)return function(c,u){var d=n(),f=d.cache,h=f===void 0?t?new WeakMap:void 0:f,p=d.meta;return r(c,u,{cache:h,equals:a,meta:p,strict:i})};if(t)return function(c,u){return r(c,u,{cache:new WeakMap,equals:a,meta:void 0,strict:i})};var s={cache:void 0,equals:a,meta:void 0,strict:i};return function(c,u){return r(c,u,s)}}var Sne=Ci();Ci({strict:!0});Ci({circular:!0});Ci({circular:!0,strict:!0});Ci({createInternalComparator:function(){return Vs}});Ci({strict:!0,createInternalComparator:function(){return Vs}});Ci({circular:!0,createInternalComparator:function(){return Vs}});Ci({circular:!0,createInternalComparator:function(){return Vs},strict:!0});function Ci(e){e===void 0&&(e={});var t=e.circular,r=t===void 0?!1:t,n=e.createInternalComparator,a=e.createState,i=e.strict,s=i===void 0?!1:i,o=bne(e),c=xne(o),u=n?n(c):wne(c);return jne({circular:r,comparator:c,createState:a,equals:u,strict:s})}function kne(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function uO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function a(i){r<0&&(r=i),i-r>t?(e(i),r=-1):kne(a)};requestAnimationFrame(n)}function Vv(e){"@babel/helpers - typeof";return Vv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vv(e)}function _ne(e){return Ane(e)||Ene(e)||Nne(e)||One()}function One(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nne(e,t){if(e){if(typeof e=="string")return dO(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return dO(e,t)}}function dO(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);re.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?1:b<0?0:b},y=function(b){for(var x=b>1?1:b,v=x,S=0;S<8;++S){var w=f(v)-x,j=p(v);if(Math.abs(w-x)0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,a=t.damping,i=a===void 0?8:a,s=t.dt,o=s===void 0?17:s,c=function(d,f,h){var p=-(d-f)*n,m=h*i,y=h+(p-m)*o/1e3,g=h*o/1e3+d;return Math.abs(g-f)e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function sae(e,t){if(e==null)return{};var r={},n=Object.keys(e),a,i;for(i=0;i=0)&&(r[a]=e[a]);return r}function yg(e){return uae(e)||cae(e)||lae(e)||oae()}function oae(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lae(e,t){if(e){if(typeof e=="string")return Kv(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Kv(e,t)}}function cae(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function uae(e){if(Array.isArray(e))return Kv(e)}function Kv(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function sp(e){return sp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},sp(e)}var zm=function(e){pae(r,e);var t=mae(r);function r(n,a){var i;dae(this,r),i=t.call(this,n,a);var s=i.props,o=s.isActive,c=s.attributeName,u=s.from,d=s.to,f=s.steps,h=s.children,p=s.duration;if(i.handleStyleChange=i.handleStyleChange.bind(Yv(i)),i.changeStyle=i.changeStyle.bind(Yv(i)),!o||p<=0)return i.state={style:{}},typeof h=="function"&&(i.state={style:d}),Xv(i);if(f&&f.length)i.state={style:f[0].style};else if(u){if(typeof h=="function")return i.state={style:u},Xv(i);i.state={style:c?Oc({},c,u):u}}else i.state={style:{}};return i}return fae(r,[{key:"componentDidMount",value:function(){var a=this.props,i=a.isActive,s=a.canBegin;this.mounted=!0,!(!i||!s)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(a){var i=this.props,s=i.isActive,o=i.canBegin,c=i.attributeName,u=i.shouldReAnimate,d=i.to,f=i.from,h=this.state.style;if(o){if(!s){var p={style:c?Oc({},c,d):d};this.state&&h&&(c&&h[c]!==d||!c&&h!==d)&&this.setState(p);return}if(!(Sne(a.to,d)&&a.canBegin&&a.isActive)){var m=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var y=m||u?f:a.to;if(this.state&&h){var g={style:c?Oc({},c,y):y};(c&&h[c]!==y||!c&&h!==y)&&this.setState(g)}this.runAnimation(cn(cn({},this.props),{},{from:y,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var a=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),a&&a()}},{key:"handleStyleChange",value:function(a){this.changeStyle(a)}},{key:"changeStyle",value:function(a){this.mounted&&this.setState({style:a})}},{key:"runJSAnimation",value:function(a){var i=this,s=a.from,o=a.to,c=a.duration,u=a.easing,d=a.begin,f=a.onAnimationEnd,h=a.onAnimationStart,p=nae(s,o,Gne(u),c,this.changeStyle),m=function(){i.stopJSAnimation=p()};this.manager.start([h,d,m,c,f])}},{key:"runStepAnimation",value:function(a){var i=this,s=a.steps,o=a.begin,c=a.onAnimationStart,u=s[0],d=u.style,f=u.duration,h=f===void 0?0:f,p=function(y,g,b){if(b===0)return y;var x=g.duration,v=g.easing,S=v===void 0?"ease":v,w=g.style,j=g.properties,k=g.onAnimationEnd,_=b>0?s[b-1]:g,E=j||Object.keys(w);if(typeof S=="function"||S==="spring")return[].concat(yg(y),[i.runJSAnimation.bind(i,{from:_.style,to:w,duration:x,easing:S}),x]);var O=pO(E,x,S),P=cn(cn(cn({},_.style),w),{},{transition:O});return[].concat(yg(y),[P,x,k]).filter(Ine)};return this.manager.start([c].concat(yg(s.reduce(p,[d,Math.max(h,o)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=Pne());var i=a.begin,s=a.duration,o=a.attributeName,c=a.to,u=a.easing,d=a.onAnimationStart,f=a.onAnimationEnd,h=a.steps,p=a.children,m=this.manager;if(this.unSubscribe=m.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(a);return}if(h.length>1){this.runStepAnimation(a);return}var y=o?Oc({},o,c):c,g=pO(Object.keys(y),s,u);m.start([d,i,cn(cn({},y),{},{transition:g}),s,f])}},{key:"render",value:function(){var a=this.props,i=a.children;a.begin;var s=a.duration;a.attributeName,a.easing;var o=a.isActive;a.steps,a.from,a.to,a.canBegin,a.onAnimationEnd,a.shouldReAnimate,a.onAnimationReStart;var c=iae(a,aae),u=N.Children.count(i),d=this.state.style;if(typeof i=="function")return i(d);if(!o||u===0||s<=0)return i;var f=function(p){var m=p.props,y=m.style,g=y===void 0?{}:y,b=m.className,x=N.cloneElement(p,cn(cn({},c),{},{style:cn(cn({},g),d),className:b}));return x};return u===1?f(N.Children.only(i)):A.createElement("div",null,N.Children.map(i,function(h){return f(h)}))}}]),r}(N.PureComponent);zm.displayName="Animate";zm.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};zm.propTypes={from:$e.oneOfType([$e.object,$e.string]),to:$e.oneOfType([$e.object,$e.string]),attributeName:$e.string,duration:$e.number,begin:$e.number,easing:$e.oneOfType([$e.string,$e.func]),steps:$e.arrayOf($e.shape({duration:$e.number.isRequired,style:$e.object.isRequired,easing:$e.oneOfType([$e.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),$e.func]),properties:$e.arrayOf("string"),onAnimationEnd:$e.func})),children:$e.oneOfType([$e.node,$e.func]),isActive:$e.bool,canBegin:$e.bool,onAnimationEnd:$e.func,shouldReAnimate:$e.bool,onAnimationStart:$e.func,onAnimationReStart:$e.func};const Ps=zm;function Lu(e){"@babel/helpers - typeof";return Lu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lu(e)}function op(){return op=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0?1:-1,c=n>=0?1:-1,u=a>=0&&n>=0||a<0&&n<0?1:0,d;if(s>0&&i instanceof Array){for(var f=[0,0,0,0],h=0,p=4;hs?s:i[h];d="M".concat(t,",").concat(r+o*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(t+c*f[0],",").concat(r)),d+="L ".concat(t+n-c*f[1],",").concat(r),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`, - `).concat(t+n,",").concat(r+o*f[1])),d+="L ".concat(t+n,",").concat(r+a-o*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`, - `).concat(t+n-c*f[2],",").concat(r+a)),d+="L ".concat(t+c*f[3],",").concat(r+a),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`, - `).concat(t,",").concat(r+a-o*f[3])),d+="Z"}else if(s>0&&i===+i&&i>0){var m=Math.min(s,i);d="M ".concat(t,",").concat(r+o*m,` - A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(t+c*m,",").concat(r,` - L `).concat(t+n-c*m,",").concat(r,` - A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(t+n,",").concat(r+o*m,` - L `).concat(t+n,",").concat(r+a-o*m,` - A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(t+n-c*m,",").concat(r+a,` - L `).concat(t+c*m,",").concat(r+a,` - A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(t,",").concat(r+a-o*m," Z")}else d="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(a," h ").concat(-n," Z");return d},_ae=function(t,r){if(!t||!r)return!1;var n=t.x,a=t.y,i=r.x,s=r.y,o=r.width,c=r.height;if(Math.abs(o)>0&&Math.abs(c)>0){var u=Math.min(i,i+o),d=Math.max(i,i+o),f=Math.min(s,s+c),h=Math.max(s,s+c);return n>=u&&n<=d&&a>=f&&a<=h}return!1},Oae={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},G1=function(t){var r=SO(SO({},Oae),t),n=N.useRef(),a=N.useState(-1),i=gae(a,2),s=i[0],o=i[1];N.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var S=n.current.getTotalLength();S&&o(S)}catch{}},[]);var c=r.x,u=r.y,d=r.width,f=r.height,h=r.radius,p=r.className,m=r.animationEasing,y=r.animationDuration,g=r.animationBegin,b=r.isAnimationActive,x=r.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var v=ve("recharts-rectangle",p);return x?A.createElement(Ps,{canBegin:s>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:y,animationEasing:m,isActive:x},function(S){var w=S.width,j=S.height,k=S.x,_=S.y;return A.createElement(Ps,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:g,duration:y,isActive:b,easing:m},A.createElement("path",op({},he(r,!0),{className:v,d:kO(k,_,w,j,h),ref:n})))}):A.createElement("path",op({},he(r,!0),{className:v,d:kO(c,u,d,f,h)}))},Nae=["points","className","baseLinePoints","connectNulls"];function yo(){return yo=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Aae(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function _O(e){return $ae(e)||Cae(e)||Tae(e)||Pae()}function Pae(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tae(e,t){if(e){if(typeof e=="string")return Zv(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zv(e,t)}}function Cae(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function $ae(e){if(Array.isArray(e))return Zv(e)}function Zv(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(n){OO(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),OO(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},Bc=function(t,r){var n=Iae(t);r&&(n=[n.reduce(function(i,s){return[].concat(_O(i),_O(s))},[])]);var a=n.map(function(i){return i.reduce(function(s,o,c){return"".concat(s).concat(c===0?"M":"L").concat(o.x,",").concat(o.y)},"")}).join("");return n.length===1?"".concat(a,"Z"):a},Rae=function(t,r,n){var a=Bc(t,n);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(Bc(r.reverse(),n).slice(1))},Mae=function(t){var r=t.points,n=t.className,a=t.baseLinePoints,i=t.connectNulls,s=Eae(t,Nae);if(!r||!r.length)return null;var o=ve("recharts-polygon",n);if(a&&a.length){var c=s.stroke&&s.stroke!=="none",u=Rae(r,a,i);return A.createElement("g",{className:o},A.createElement("path",yo({},he(s,!0),{fill:u.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:u})),c?A.createElement("path",yo({},he(s,!0),{fill:"none",d:Bc(r,i)})):null,c?A.createElement("path",yo({},he(s,!0),{fill:"none",d:Bc(a,i)})):null)}var d=Bc(r,i);return A.createElement("path",yo({},he(s,!0),{fill:d.slice(-1)==="Z"?s.fill:"none",className:o,d}))};function Jv(){return Jv=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Vae(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var qae=function(t,r,n,a,i,s){return"M".concat(t,",").concat(i,"v").concat(a,"M").concat(s,",").concat(r,"h").concat(n)},Wae=function(t){var r=t.x,n=r===void 0?0:r,a=t.y,i=a===void 0?0:a,s=t.top,o=s===void 0?0:s,c=t.left,u=c===void 0?0:c,d=t.width,f=d===void 0?0:d,h=t.height,p=h===void 0?0:h,m=t.className,y=zae(t,Dae),g=Lae({x:n,y:i,top:o,left:u,width:f,height:p},y);return!Y(n)||!Y(i)||!Y(f)||!Y(p)||!Y(o)||!Y(u)?null:A.createElement("path",ex({},he(g,!0),{className:ve("recharts-cross",m),d:qae(n,i,f,p,o,u)}))},Gae=Dm,Hae=DC,Kae=Yn;function Qae(e,t){return e&&e.length?Gae(e,Kae(t),Hae):void 0}var Xae=Qae;const Yae=Me(Xae);var Zae=Dm,Jae=Yn,eie=LC;function tie(e,t){return e&&e.length?Zae(e,Jae(t),eie):void 0}var rie=tie;const nie=Me(rie);var aie=["cx","cy","angle","ticks","axisLine"],iie=["ticks","tick","angle","tickFormatter","stroke"];function cl(e){"@babel/helpers - typeof";return cl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cl(e)}function zc(){return zc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function sie(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function oie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function PO(e,t){for(var r=0;r$O?s=a==="outer"?"start":"end":i<-$O?s=a==="outer"?"end":"start":s="middle",s}},{key:"renderAxisLine",value:function(){var n=this.props,a=n.cx,i=n.cy,s=n.radius,o=n.axisLine,c=n.axisLineType,u=Ri(Ri({},he(this.props,!1)),{},{fill:"none"},he(o,!1));if(c==="circle")return A.createElement(Vm,zi({className:"recharts-polar-angle-axis-line"},u,{cx:a,cy:i,r:s}));var d=this.props.ticks,f=d.map(function(h){return He(a,i,s,h.coordinate)});return A.createElement(Mae,zi({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var n=this,a=this.props,i=a.ticks,s=a.tick,o=a.tickLine,c=a.tickFormatter,u=a.stroke,d=he(this.props,!1),f=he(s,!1),h=Ri(Ri({},d),{},{fill:"none"},he(o,!1)),p=i.map(function(m,y){var g=n.getTickLineCoord(m),b=n.getTickTextAnchor(m),x=Ri(Ri(Ri({textAnchor:b},d),{},{stroke:"none",fill:u},f),{},{index:y,payload:m,x:g.x2,y:g.y2});return A.createElement(Pe,zi({className:ve("recharts-polar-angle-axis-tick",f$(s)),key:"tick-".concat(m.coordinate)},Os(n.props,m,y)),o&&A.createElement("line",zi({className:"recharts-polar-angle-axis-tick-line"},h,g)),s&&t.renderTickItem(s,x,c?c(m.value,y):m.value))});return A.createElement(Pe,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var n=this.props,a=n.ticks,i=n.radius,s=n.axisLine;return i<=0||!a||!a.length?null:A.createElement(Pe,{className:ve("recharts-polar-angle-axis",this.props.className)},s&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,a,i){var s;return A.isValidElement(n)?s=A.cloneElement(n,a):ge(n)?s=n(a):s=A.createElement(Ns,zi({},a,{className:"recharts-polar-angle-axis-tick-value"}),i),s}}])}(N.PureComponent);Gm(Hm,"displayName","PolarAngleAxis");Gm(Hm,"axisType","angleAxis");Gm(Hm,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var jie=$T,Sie=jie(Object.getPrototypeOf,Object),kie=Sie,_ie=$a,Oie=kie,Nie=Ia,Eie="[object Object]",Aie=Function.prototype,Pie=Object.prototype,P$=Aie.toString,Tie=Pie.hasOwnProperty,Cie=P$.call(Object);function $ie(e){if(!Nie(e)||_ie(e)!=Eie)return!1;var t=Oie(e);if(t===null)return!0;var r=Tie.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&P$.call(r)==Cie}var Iie=$ie;const Rie=Me(Iie);var Mie=$a,Die=Ia,Lie="[object Boolean]";function Fie(e){return e===!0||e===!1||Die(e)&&Mie(e)==Lie}var Uie=Fie;const Bie=Me(Uie);function Uu(e){"@babel/helpers - typeof";return Uu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uu(e)}function up(){return up=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:h,x:c,y:u},duration:y,animationEasing:m,isActive:b},function(v){var S=v.upperWidth,w=v.lowerWidth,j=v.height,k=v.x,_=v.y;return A.createElement(Ps,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:g,duration:y,easing:m},A.createElement("path",up({},he(r,!0),{className:x,d:DO(k,_,S,w,j),ref:n})))}):A.createElement("g",null,A.createElement("path",up({},he(r,!0),{className:x,d:DO(c,u,d,f,h)})))},Zie=["option","shapeType","propTransformer","activeClassName","isActive"];function Bu(e){"@babel/helpers - typeof";return Bu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bu(e)}function Jie(e,t){if(e==null)return{};var r=ese(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function ese(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function LO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function dp(e){for(var t=1;t0?Dr(v,"paddingAngle",0):0;if(w){var k=Cr(w.endAngle-w.startAngle,v.endAngle-v.startAngle),_=qe(qe({},v),{},{startAngle:x+j,endAngle:x+k(y)+j});g.push(_),x=_.endAngle}else{var E=v.endAngle,O=v.startAngle,P=Cr(0,E-O),T=P(y),M=qe(qe({},v),{},{startAngle:x+j,endAngle:x+T+j});g.push(M),x=M.endAngle}}),A.createElement(Pe,null,n.renderSectorsStatically(g))})}},{key:"attachKeyboardHandlers",value:function(n){var a=this;n.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var s=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[s].focus(),a.setState({sectorToFocus:s});break}case"ArrowRight":{var o=--a.state.sectorToFocus<0?a.sectorRefs.length-1:a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[o].focus(),a.setState({sectorToFocus:o});break}case"Escape":{a.sectorRefs[a.state.sectorToFocus].blur(),a.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,a=n.sectors,i=n.isAnimationActive,s=this.state.prevSectors;return i&&a&&a.length&&(!s||!_d(s,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,a=this.props,i=a.hide,s=a.sectors,o=a.className,c=a.label,u=a.cx,d=a.cy,f=a.innerRadius,h=a.outerRadius,p=a.isAnimationActive,m=this.state.isAnimationFinished;if(i||!s||!s.length||!Y(u)||!Y(d)||!Y(f)||!Y(h))return null;var y=ve("recharts-pie",o);return A.createElement(Pe,{tabIndex:this.props.rootTabIndex,className:y,ref:function(b){n.pieRef=b}},this.renderSectors(),c&&this.renderLabels(s),Rt.renderCallByParent(this.props,null,!1),(!p||m)&&xa.renderCallByParent(this.props,s,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,a){return a.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==a.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:n.sectors!==a.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,a){return n>a?"start":n=360?x:x-1)*c,S=g-x*p-v,w=a.reduce(function(_,E){var O=Nt(E,b,0);return _+(Y(O)?O:0)},0),j;if(w>0){var k;j=a.map(function(_,E){var O=Nt(_,b,0),P=Nt(_,d,E),T=(Y(O)?O:0)/w,M;E?M=k.endAngle+ir(y)*c*(O!==0?1:0):M=s;var I=M+ir(y)*((O!==0?p:0)+T*S),R=(M+I)/2,F=(m.innerRadius+m.outerRadius)/2,U=[{name:P,value:O,payload:_,dataKey:b,type:h}],D=He(m.cx,m.cy,F,R);return k=qe(qe(qe({percent:T,cornerRadius:i,name:P,tooltipPayload:U,midAngle:R,middleRadius:F,tooltipPosition:D},_),m),{},{value:Nt(_,b),startAngle:M,endAngle:I,payload:_,paddingAngle:ir(y)*c}),k})}return qe(qe({},m),{},{sectors:j,data:a})});var wse=Math.ceil,jse=Math.max;function Sse(e,t,r,n){for(var a=-1,i=jse(wse((t-e)/(r||1)),0),s=Array(i);i--;)s[n?i:++a]=e,e+=r;return s}var kse=Sse,_se=ZT,zO=1/0,Ose=17976931348623157e292;function Nse(e){if(!e)return e===0?e:0;if(e=_se(e),e===zO||e===-zO){var t=e<0?-1:1;return t*Ose}return e===e?e:0}var I$=Nse,Ese=kse,Ase=Am,gg=I$;function Pse(e){return function(t,r,n){return n&&typeof n!="number"&&Ase(t,r,n)&&(r=n=void 0),t=gg(t),r===void 0?(r=t,t=0):r=gg(r),n=n===void 0?t0&&n.handleDrag(a.changedTouches[0])}),Ar(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=n.props,i=a.endIndex,s=a.onDragEnd,o=a.startIndex;s==null||s({endIndex:i,startIndex:o})}),n.detachDragEndListener()}),Ar(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),Ar(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),Ar(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),Ar(n,"handleSlideDragStart",function(a){var i=HO(a)?a.changedTouches[0]:a;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return qse(t,e),Use(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var a=n.startX,i=n.endX,s=this.state.scaleValues,o=this.props,c=o.gap,u=o.data,d=u.length-1,f=Math.min(a,i),h=Math.max(a,i),p=t.getIndexInRange(s,f),m=t.getIndexInRange(s,h);return{startIndex:p-p%c,endIndex:m===d?d:m-m%c}}},{key:"getTextOfTick",value:function(n){var a=this.props,i=a.data,s=a.tickFormatter,o=a.dataKey,c=Nt(i[n],o,n);return ge(s)?s(c,n):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var a=this.state,i=a.slideMoveStartX,s=a.startX,o=a.endX,c=this.props,u=c.x,d=c.width,f=c.travellerWidth,h=c.startIndex,p=c.endIndex,m=c.onChange,y=n.pageX-i;y>0?y=Math.min(y,u+d-f-o,u+d-f-s):y<0&&(y=Math.max(y,u-s,u-o));var g=this.getIndex({startX:s+y,endX:o+y});(g.startIndex!==h||g.endIndex!==p)&&m&&m(g),this.setState({startX:s+y,endX:o+y,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,a){var i=HO(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var a=this.state,i=a.brushMoveStartX,s=a.movingTravellerId,o=a.endX,c=a.startX,u=this.state[s],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,m=d.onChange,y=d.gap,g=d.data,b={startX:this.state.startX,endX:this.state.endX},x=n.pageX-i;x>0?x=Math.min(x,f+h-p-u):x<0&&(x=Math.max(x,f-u)),b[s]=u+x;var v=this.getIndex(b),S=v.startIndex,w=v.endIndex,j=function(){var _=g.length-1;return s==="startX"&&(o>c?S%y===0:w%y===0)||oc?w%y===0:S%y===0)||o>c&&w===_};this.setState(Ar(Ar({},s,u+x),"brushMoveStartX",n.pageX),function(){m&&j()&&m(v)})}},{key:"handleTravellerMoveKeyboard",value:function(n,a){var i=this,s=this.state,o=s.scaleValues,c=s.startX,u=s.endX,d=this.state[a],f=o.indexOf(d);if(f!==-1){var h=f+n;if(!(h===-1||h>=o.length)){var p=o[h];a==="startX"&&p>=u||a==="endX"&&p<=c||this.setState(Ar({},a,p),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,a=n.x,i=n.y,s=n.width,o=n.height,c=n.fill,u=n.stroke;return A.createElement("rect",{stroke:u,fill:c,x:a,y:i,width:s,height:o})}},{key:"renderPanorama",value:function(){var n=this.props,a=n.x,i=n.y,s=n.width,o=n.height,c=n.data,u=n.children,d=n.padding,f=N.Children.only(u);return f?A.cloneElement(f,{x:a,y:i,width:s,height:o,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(n,a){var i,s,o=this,c=this.props,u=c.y,d=c.travellerWidth,f=c.height,h=c.traveller,p=c.ariaLabel,m=c.data,y=c.startIndex,g=c.endIndex,b=Math.max(n,this.props.x),x=vg(vg({},he(this.props,!1)),{},{x:b,y:u,width:d,height:f}),v=p||"Min value: ".concat((i=m[y])===null||i===void 0?void 0:i.name,", Max value: ").concat((s=m[g])===null||s===void 0?void 0:s.name);return A.createElement(Pe,{tabIndex:0,role:"slider","aria-label":v,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(w){["ArrowLeft","ArrowRight"].includes(w.key)&&(w.preventDefault(),w.stopPropagation(),o.handleTravellerMoveKeyboard(w.key==="ArrowRight"?1:-1,a))},onFocus:function(){o.setState({isTravellerFocused:!0})},onBlur:function(){o.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(h,x))}},{key:"renderSlide",value:function(n,a){var i=this.props,s=i.y,o=i.height,c=i.stroke,u=i.travellerWidth,d=Math.min(n,a)+u,f=Math.max(Math.abs(a-n)-u,0);return A.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:d,y:s,width:f,height:o})}},{key:"renderText",value:function(){var n=this.props,a=n.startIndex,i=n.endIndex,s=n.y,o=n.height,c=n.travellerWidth,u=n.stroke,d=this.state,f=d.startX,h=d.endX,p=5,m={pointerEvents:"none",fill:u};return A.createElement(Pe,{className:"recharts-brush-texts"},A.createElement(Ns,pp({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:s+o/2},m),this.getTextOfTick(a)),A.createElement(Ns,pp({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+c+p,y:s+o/2},m),this.getTextOfTick(i)))}},{key:"render",value:function(){var n=this.props,a=n.data,i=n.className,s=n.children,o=n.x,c=n.y,u=n.width,d=n.height,f=n.alwaysShowText,h=this.state,p=h.startX,m=h.endX,y=h.isTextActive,g=h.isSlideMoving,b=h.isTravellerMoving,x=h.isTravellerFocused;if(!a||!a.length||!Y(o)||!Y(c)||!Y(u)||!Y(d)||u<=0||d<=0)return null;var v=ve("recharts-brush",i),S=A.Children.count(s)===1,w=Lse("userSelect","none");return A.createElement(Pe,{className:v,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:w},this.renderBackground(),S&&this.renderPanorama(),this.renderSlide(p,m),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(m,"endX"),(y||g||b||x||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var a=n.x,i=n.y,s=n.width,o=n.height,c=n.stroke,u=Math.floor(i+o/2)-1;return A.createElement(A.Fragment,null,A.createElement("rect",{x:a,y:i,width:s,height:o,fill:c,stroke:"none"}),A.createElement("line",{x1:a+1,y1:u,x2:a+s-1,y2:u,fill:"none",stroke:"#fff"}),A.createElement("line",{x1:a+1,y1:u+2,x2:a+s-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,a){var i;return A.isValidElement(n)?i=A.cloneElement(n,a):ge(n)?i=n(a):i=t.renderDefaultTraveller(a),i}},{key:"getDerivedStateFromProps",value:function(n,a){var i=n.data,s=n.width,o=n.x,c=n.travellerWidth,u=n.updateId,d=n.startIndex,f=n.endIndex;if(i!==a.prevData||u!==a.prevUpdateId)return vg({prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:o,prevWidth:s},i&&i.length?Gse({data:i,width:s,x:o,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(a.scale&&(s!==a.prevWidth||o!==a.prevX||c!==a.prevTravellerWidth)){a.scale.range([o,o+s-c]);var h=a.scale.domain().map(function(p){return a.scale(p)});return{prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:o,prevWidth:s,startX:a.scale(n.startIndex),endX:a.scale(n.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(n,a){for(var i=n.length,s=0,o=i-1;o-s>1;){var c=Math.floor((s+o)/2);n[c]>a?o=c:s=c}return a>=n[o]?o:s}}])}(N.PureComponent);Ar(hl,"displayName","Brush");Ar(hl,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var Hse=g1;function Kse(e,t){var r;return Hse(e,function(n,a,i){return r=t(n,a,i),!r}),!!r}var Qse=Kse,Xse=_T,Yse=Yn,Zse=Qse,Jse=Nr,eoe=Am;function toe(e,t,r){var n=Jse(e)?Xse:Zse;return r&&eoe(e,t,r)&&(t=void 0),n(e,Yse(t))}var roe=toe;const noe=Me(roe);var Wn=function(t,r){var n=t.alwaysShow,a=t.ifOverflow;return n&&(a="extendDomain"),a===r},KO=HT;function aoe(e,t,r){t=="__proto__"&&KO?KO(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var ioe=aoe,soe=ioe,ooe=WT,loe=Yn;function coe(e,t){var r={};return t=loe(t),ooe(e,function(n,a,i){soe(r,a,t(n,a,i))}),r}var uoe=coe;const doe=Me(uoe);function foe(e,t){for(var r=-1,n=e==null?0:e.length;++r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Aoe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Poe(e,t){var r=e.x,n=e.y,a=Eoe(e,koe),i="".concat(r),s=parseInt(i,10),o="".concat(n),c=parseInt(o,10),u="".concat(t.height||a.height),d=parseInt(u,10),f="".concat(t.width||a.width),h=parseInt(f,10);return xc(xc(xc(xc(xc({},t),a),s?{x:s}:{}),c?{y:c}:{}),{},{height:d,width:h,name:t.name,radius:t.radius})}function XO(e){return A.createElement(T$,ix({shapeType:"rectangle",propTransformer:Poe,activeClassName:"recharts-active-bar"},e))}var Toe=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,a){if(typeof t=="number")return t;var i=typeof n=="number";return i?t(n,a):(i||As(!1),r)}},Coe=["value","background"],F$;function pl(e){"@babel/helpers - typeof";return pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pl(e)}function $oe(e,t){if(e==null)return{};var r=Ioe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Ioe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function yp(){return yp=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(R)0&&Math.abs(I)0&&(M=Math.min((we||0)-(I[Ae-1]||0),M))}),Number.isFinite(M)){var R=M/T,F=y.layout==="vertical"?n.height:n.width;if(y.padding==="gap"&&(k=R*F/2),y.padding==="no-gap"){var U=sr(t.barCategoryGap,R*F),D=R*F/2;k=D-U-(D-U)/F*U}}}a==="xAxis"?_=[n.left+(v.left||0)+(k||0),n.left+n.width-(v.right||0)-(k||0)]:a==="yAxis"?_=c==="horizontal"?[n.top+n.height-(v.bottom||0),n.top+(v.top||0)]:[n.top+(v.top||0)+(k||0),n.top+n.height-(v.bottom||0)-(k||0)]:_=y.range,w&&(_=[_[1],_[0]]);var V=i$(y,i,h),H=V.scale,Z=V.realScaleType;H.domain(b).range(_),s$(H);var K=o$(H,pn(pn({},y),{},{realScaleType:Z}));a==="xAxis"?(P=g==="top"&&!S||g==="bottom"&&S,E=n.left,O=f[j]-P*y.height):a==="yAxis"&&(P=g==="left"&&!S||g==="right"&&S,E=f[j]-P*y.width,O=n.top);var le=pn(pn(pn({},y),K),{},{realScaleType:Z,x:E,y:O,scale:H,width:a==="xAxis"?n.width:y.width,height:a==="yAxis"?n.height:y.height});return le.bandSize=ep(le,K),!y.hide&&a==="xAxis"?f[j]+=(P?-1:1)*le.height:y.hide||(f[j]+=(P?-1:1)*le.width),pn(pn({},p),{},Xm({},m,le))},{})},q$=function(t,r){var n=t.x,a=t.y,i=r.x,s=r.y;return{x:Math.min(n,i),y:Math.min(a,s),width:Math.abs(i-n),height:Math.abs(s-a)}},Woe=function(t){var r=t.x1,n=t.y1,a=t.x2,i=t.y2;return q$({x:r,y:n},{x:a,y:i})},W$=function(){function e(t){zoe(this,e),this.scale=t}return Voe(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.bandAware,i=n.position;if(r!==void 0){if(i)switch(i){case"start":return this.scale(r);case"middle":{var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+s}case"end":{var o=this.bandwidth?this.bandwidth():0;return this.scale(r)+o}default:return this.scale(r)}if(a){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+c}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),a=n[0],i=n[n.length-1];return a<=i?r>=a&&r<=i:r>=i&&r<=a}}],[{key:"create",value:function(r){return new e(r)}}])}();Xm(W$,"EPS",1e-4);var H1=function(t){var r=Object.keys(t).reduce(function(n,a){return pn(pn({},n),{},Xm({},a,W$.create(t[a])))},{});return pn(pn({},r),{},{apply:function(a){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=i.bandAware,o=i.position;return doe(a,function(c,u){return r[u].apply(c,{bandAware:s,position:o})})},isInRange:function(a){return L$(a,function(i,s){return r[s].isInRange(i)})}})};function Goe(e){return(e%180+180)%180}var Hoe=function(t){var r=t.width,n=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=Goe(a),s=i*Math.PI/180,o=Math.atan(n/r),c=s>o&&s-1?a[i?t[s]:s]:void 0}}var Zoe=Yoe,Joe=I$;function ele(e){var t=Joe(e),r=t%1;return t===t?r?t-r:t:0}var tle=ele,rle=FT,nle=Yn,ale=tle,ile=Math.max;function sle(e,t,r){var n=e==null?0:e.length;if(!n)return-1;var a=r==null?0:ale(r);return a<0&&(a=ile(n+a,0)),rle(e,nle(t),a)}var ole=sle,lle=Zoe,cle=ole,ule=lle(cle),dle=ule;const fle=Me(dle);var hle=dB(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),K1=N.createContext(void 0),Q1=N.createContext(void 0),G$=N.createContext(void 0),H$=N.createContext({}),K$=N.createContext(void 0),Q$=N.createContext(0),X$=N.createContext(0),tN=function(t){var r=t.state,n=r.xAxisMap,a=r.yAxisMap,i=r.offset,s=t.clipPathId,o=t.children,c=t.width,u=t.height,d=hle(i);return A.createElement(K1.Provider,{value:n},A.createElement(Q1.Provider,{value:a},A.createElement(H$.Provider,{value:i},A.createElement(G$.Provider,{value:d},A.createElement(K$.Provider,{value:s},A.createElement(Q$.Provider,{value:u},A.createElement(X$.Provider,{value:c},o)))))))},ple=function(){return N.useContext(K$)},Y$=function(t){var r=N.useContext(K1);r==null&&As(!1);var n=r[t];return n==null&&As(!1),n},mle=function(){var t=N.useContext(K1);return Ya(t)},yle=function(){var t=N.useContext(Q1),r=fle(t,function(n){return L$(n.domain,Number.isFinite)});return r||Ya(t)},Z$=function(t){var r=N.useContext(Q1);r==null&&As(!1);var n=r[t];return n==null&&As(!1),n},gle=function(){var t=N.useContext(G$);return t},vle=function(){return N.useContext(H$)},X1=function(){return N.useContext(X$)},Y1=function(){return N.useContext(Q$)};function ml(e){"@babel/helpers - typeof";return ml=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ml(e)}function xle(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rN(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);re*a)return!1;var i=r();return e*(t-e*i/2-n)>=0&&e*(t+e*i/2-a)<=0}function Zle(e,t){return iI(e,t+1)}function Jle(e,t,r,n,a){for(var i=(n||[]).slice(),s=t.start,o=t.end,c=0,u=1,d=s,f=function(){var m=n==null?void 0:n[c];if(m===void 0)return{v:iI(n,u)};var y=c,g,b=function(){return g===void 0&&(g=r(m,y)),g},x=m.coordinate,v=c===0||wp(e,x,b,d,o);v||(c=0,d=s,u+=1),v&&(d=x+e*(b()/2+a),c+=u)},h;u<=i.length;)if(h=f(),h)return h.v;return[]}function Gu(e){"@babel/helpers - typeof";return Gu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gu(e)}function fN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Gt(e){for(var t=1;t0?p.coordinate-g*e:p.coordinate})}else i[h]=p=Gt(Gt({},p),{},{tickCoord:p.coordinate});var b=wp(e,p.tickCoord,y,o,c);b&&(c=p.tickCoord-e*(y()/2+a),i[h]=Gt(Gt({},p),{},{isShow:!0}))},d=s-1;d>=0;d--)u(d);return i}function ace(e,t,r,n,a,i){var s=(n||[]).slice(),o=s.length,c=t.start,u=t.end;if(i){var d=n[o-1],f=r(d,o-1),h=e*(d.coordinate+e*f/2-u);s[o-1]=d=Gt(Gt({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate});var p=wp(e,d.tickCoord,function(){return f},c,u);p&&(u=d.tickCoord-e*(f/2+a),s[o-1]=Gt(Gt({},d),{},{isShow:!0}))}for(var m=i?o-1:o,y=function(x){var v=s[x],S,w=function(){return S===void 0&&(S=r(v,x)),S};if(x===0){var j=e*(v.coordinate-e*w()/2-c);s[x]=v=Gt(Gt({},v),{},{tickCoord:j<0?v.coordinate-j*e:v.coordinate})}else s[x]=v=Gt(Gt({},v),{},{tickCoord:v.coordinate});var k=wp(e,v.tickCoord,w,c,u);k&&(c=v.tickCoord+e*(w()/2+a),s[x]=Gt(Gt({},v),{},{isShow:!0}))},g=0;g=2?ir(a[1].coordinate-a[0].coordinate):1,b=Yle(i,g,p);return c==="equidistantPreserveStart"?Jle(g,b,y,a,s):(c==="preserveStart"||c==="preserveStartEnd"?h=ace(g,b,y,a,s,c==="preserveStartEnd"):h=nce(g,b,y,a,s),h.filter(function(x){return x.isShow}))}var ice=["viewBox"],sce=["viewBox"],oce=["ticks"];function vl(e){"@babel/helpers - typeof";return vl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vl(e)}function vo(){return vo=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function lce(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function cce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pN(e,t){for(var r=0;r0?c(this.props):c(p)),s<=0||o<=0||!m||!m.length?null:A.createElement(Pe,{className:ve("recharts-cartesian-axis",u),ref:function(g){n.layerReference=g}},i&&this.renderAxisLine(),this.renderTicks(m,this.state.fontSize,this.state.letterSpacing),Rt.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,a,i){var s;return A.isValidElement(n)?s=A.cloneElement(n,a):ge(n)?s=n(a):s=A.createElement(Ns,vo({},a,{className:"recharts-cartesian-axis-tick-value"}),i),s}}])}(N.Component);tw(Ql,"displayName","CartesianAxis");tw(Ql,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var yce=["x1","y1","x2","y2","key"],gce=["offset"];function Ts(e){"@babel/helpers - typeof";return Ts=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ts(e)}function mN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Kt(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function wce(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var jce=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,a=t.x,i=t.y,s=t.width,o=t.height,c=t.ry;return A.createElement("rect",{x:a,y:i,ry:c,width:s,height:o,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function lI(e,t){var r;if(A.isValidElement(e))r=A.cloneElement(e,t);else if(ge(e))r=e(t);else{var n=t.x1,a=t.y1,i=t.x2,s=t.y2,o=t.key,c=yN(t,yce),u=he(c,!1);u.offset;var d=yN(u,gce);r=A.createElement("line",Ji({},d,{x1:n,y1:a,x2:i,y2:s,fill:"none",key:o}))}return r}function Sce(e){var t=e.x,r=e.width,n=e.horizontal,a=n===void 0?!0:n,i=e.horizontalPoints;if(!a||!i||!i.length)return null;var s=i.map(function(o,c){var u=Kt(Kt({},e),{},{x1:t,y1:o,x2:t+r,y2:o,key:"line-".concat(c),index:c});return lI(a,u)});return A.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function kce(e){var t=e.y,r=e.height,n=e.vertical,a=n===void 0?!0:n,i=e.verticalPoints;if(!a||!i||!i.length)return null;var s=i.map(function(o,c){var u=Kt(Kt({},e),{},{x1:o,y1:t,x2:o,y2:t+r,key:"line-".concat(c),index:c});return lI(a,u)});return A.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function _ce(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,a=e.y,i=e.width,s=e.height,o=e.horizontalPoints,c=e.horizontal,u=c===void 0?!0:c;if(!u||!t||!t.length)return null;var d=o.map(function(h){return Math.round(h+a-a)}).sort(function(h,p){return h-p});a!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var m=!d[p+1],y=m?a+s-h:d[p+1]-h;if(y<=0)return null;var g=p%t.length;return A.createElement("rect",{key:"react-".concat(p),y:h,x:n,height:y,width:i,stroke:"none",fill:t[g],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return A.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Oce(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,a=e.fillOpacity,i=e.x,s=e.y,o=e.width,c=e.height,u=e.verticalPoints;if(!r||!n||!n.length)return null;var d=u.map(function(h){return Math.round(h+i-i)}).sort(function(h,p){return h-p});i!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var m=!d[p+1],y=m?i+o-h:d[p+1]-h;if(y<=0)return null;var g=p%n.length;return A.createElement("rect",{key:"react-".concat(p),x:h,y:s,width:y,height:c,stroke:"none",fill:n[g],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return A.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Nce=function(t,r){var n=t.xAxis,a=t.width,i=t.height,s=t.offset;return a$(ew(Kt(Kt(Kt({},Ql.defaultProps),n),{},{ticks:pa(n,!0),viewBox:{x:0,y:0,width:a,height:i}})),s.left,s.left+s.width,r)},Ece=function(t,r){var n=t.yAxis,a=t.width,i=t.height,s=t.offset;return a$(ew(Kt(Kt(Kt({},Ql.defaultProps),n),{},{ticks:pa(n,!0),viewBox:{x:0,y:0,width:a,height:i}})),s.top,s.top+s.height,r)},Zs={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function rw(e){var t,r,n,a,i,s,o=X1(),c=Y1(),u=vle(),d=Kt(Kt({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:Zs.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:Zs.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:Zs.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:Zs.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:Zs.vertical,verticalFill:(s=e.verticalFill)!==null&&s!==void 0?s:Zs.verticalFill,x:Y(e.x)?e.x:u.left,y:Y(e.y)?e.y:u.top,width:Y(e.width)?e.width:u.width,height:Y(e.height)?e.height:u.height}),f=d.x,h=d.y,p=d.width,m=d.height,y=d.syncWithTicks,g=d.horizontalValues,b=d.verticalValues,x=mle(),v=yle();if(!Y(p)||p<=0||!Y(m)||m<=0||!Y(f)||f!==+f||!Y(h)||h!==+h)return null;var S=d.verticalCoordinatesGenerator||Nce,w=d.horizontalCoordinatesGenerator||Ece,j=d.horizontalPoints,k=d.verticalPoints;if((!j||!j.length)&&ge(w)){var _=g&&g.length,E=w({yAxis:v?Kt(Kt({},v),{},{ticks:_?g:v.ticks}):void 0,width:o,height:c,offset:u},_?!0:y);_n(Array.isArray(E),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Ts(E),"]")),Array.isArray(E)&&(j=E)}if((!k||!k.length)&&ge(S)){var O=b&&b.length,P=S({xAxis:x?Kt(Kt({},x),{},{ticks:O?b:x.ticks}):void 0,width:o,height:c,offset:u},O?!0:y);_n(Array.isArray(P),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Ts(P),"]")),Array.isArray(P)&&(k=P)}return A.createElement("g",{className:"recharts-cartesian-grid"},A.createElement(jce,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),A.createElement(Sce,Ji({},d,{offset:u,horizontalPoints:j,xAxis:x,yAxis:v})),A.createElement(kce,Ji({},d,{offset:u,verticalPoints:k,xAxis:x,yAxis:v})),A.createElement(_ce,Ji({},d,{horizontalPoints:j})),A.createElement(Oce,Ji({},d,{verticalPoints:k})))}rw.displayName="CartesianGrid";var Ace=["type","layout","connectNulls","ref"],Pce=["key"];function xl(e){"@babel/helpers - typeof";return xl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xl(e)}function gN(e,t){if(e==null)return{};var r=Tce(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Tce(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Vc(){return Vc=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);rf){p=[].concat(Js(c.slice(0,m)),[f-y]);break}var g=p.length%2===0?[0,h]:[h];return[].concat(Js(t.repeat(c,d)),Js(p),g).map(function(b){return"".concat(b,"px")}).join(", ")}),mn(r,"id",zl("recharts-line-")),mn(r,"pathRef",function(s){r.mainCurve=s}),mn(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),mn(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return Bce(t,e),Dce(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,s=i.points,o=i.xAxis,c=i.yAxis,u=i.layout,d=i.children,f=Lr(d,Od);if(!f)return null;var h=function(y,g){return{x:y.x,y:y.y,value:y.value,errorVal:Nt(y.payload,g)}},p={clipPath:n?"url(#clipPath-".concat(a,")"):null};return A.createElement(Pe,p,f.map(function(m){return A.cloneElement(m,{key:"bar-".concat(m.props.dataKey),data:s,xAxis:o,yAxis:c,layout:u,dataPointFormatter:h})}))}},{key:"renderDots",value:function(n,a,i){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var o=this.props,c=o.dot,u=o.points,d=o.dataKey,f=he(this.props,!1),h=he(c,!0),p=u.map(function(y,g){var b=Er(Er(Er({key:"dot-".concat(g),r:3},f),h),{},{index:g,cx:y.x,cy:y.y,value:y.value,dataKey:d,payload:y.payload,points:u});return t.renderDotItem(c,b)}),m={clipPath:n?"url(#clipPath-".concat(a?"":"dots-").concat(i,")"):null};return A.createElement(Pe,Vc({className:"recharts-line-dots",key:"dots"},m),p)}},{key:"renderCurveStatically",value:function(n,a,i,s){var o=this.props,c=o.type,u=o.layout,d=o.connectNulls;o.ref;var f=gN(o,Ace),h=Er(Er(Er({},he(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:a?"url(#clipPath-".concat(i,")"):null,points:n},s),{},{type:c,layout:u,connectNulls:d});return A.createElement(np,Vc({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,a){var i=this,s=this.props,o=s.points,c=s.strokeDasharray,u=s.isAnimationActive,d=s.animationBegin,f=s.animationDuration,h=s.animationEasing,p=s.animationId,m=s.animateNewValues,y=s.width,g=s.height,b=this.state,x=b.prevPoints,v=b.totalLength;return A.createElement(Ps,{begin:d,duration:f,isActive:u,easing:h,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(S){var w=S.t;if(x){var j=x.length/o.length,k=o.map(function(T,M){var I=Math.floor(M*j);if(x[I]){var R=x[I],F=Cr(R.x,T.x),U=Cr(R.y,T.y);return Er(Er({},T),{},{x:F(w),y:U(w)})}if(m){var D=Cr(y*2,T.x),V=Cr(g/2,T.y);return Er(Er({},T),{},{x:D(w),y:V(w)})}return Er(Er({},T),{},{x:T.x,y:T.y})});return i.renderCurveStatically(k,n,a)}var _=Cr(0,v),E=_(w),O;if(c){var P="".concat(c).split(/[,\s]+/gim).map(function(T){return parseFloat(T)});O=i.getStrokeDasharray(E,v,P)}else O=i.generateSimpleStrokeDasharray(v,E);return i.renderCurveStatically(o,n,a,{strokeDasharray:O})})}},{key:"renderCurve",value:function(n,a){var i=this.props,s=i.points,o=i.isAnimationActive,c=this.state,u=c.prevPoints,d=c.totalLength;return o&&s&&s.length&&(!u&&d>0||!_d(u,s))?this.renderCurveWithAnimation(n,a):this.renderCurveStatically(s,n,a)}},{key:"render",value:function(){var n,a=this.props,i=a.hide,s=a.dot,o=a.points,c=a.className,u=a.xAxis,d=a.yAxis,f=a.top,h=a.left,p=a.width,m=a.height,y=a.isAnimationActive,g=a.id;if(i||!o||!o.length)return null;var b=this.state.isAnimationFinished,x=o.length===1,v=ve("recharts-line",c),S=u&&u.allowDataOverflow,w=d&&d.allowDataOverflow,j=S||w,k=xe(g)?this.id:g,_=(n=he(s,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},E=_.r,O=E===void 0?3:E,P=_.strokeWidth,T=P===void 0?2:P,M=v7(s)?s:{},I=M.clipDot,R=I===void 0?!0:I,F=O*2+T;return A.createElement(Pe,{className:v},S||w?A.createElement("defs",null,A.createElement("clipPath",{id:"clipPath-".concat(k)},A.createElement("rect",{x:S?h:h-p/2,y:w?f:f-m/2,width:S?p:p*2,height:w?m:m*2})),!R&&A.createElement("clipPath",{id:"clipPath-dots-".concat(k)},A.createElement("rect",{x:h-F/2,y:f-F/2,width:p+F,height:m+F}))):null,!x&&this.renderCurve(j,k),this.renderErrorBar(j,k),(x||s)&&this.renderDots(j,R,k),(!y||b)&&xa.renderCallByParent(this.props,o))}}],[{key:"getDerivedStateFromProps",value:function(n,a){return n.animationId!==a.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:a.curPoints}:n.points!==a.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,a){for(var i=n.length%2!==0?[].concat(Js(n),[0]):n,s=[],o=0;oe.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Nue(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Eue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function NN(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?s:t&&t.length&&Y(a)&&Y(i)?t.slice(a,i+1):[]};function kI(e){return e==="number"?[0,"auto"]:void 0}var kx=function(t,r,n,a){var i=t.graphicalItems,s=t.tooltipAxis,o=ty(r,t);return n<0||!i||!i.length||n>=o.length?null:i.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:r;f&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(f=f.slice(t.dataStartIndex,t.dataEndIndex+1));var h;if(s.dataKey&&!s.allowDuplicatedCategory){var p=f===void 0?o:f;h=Oh(p,s.dataKey,a)}else h=f&&f[n]||o[n];return h?[].concat(Sl(c),[c$(u,h)]):c},[])},AN=function(t,r,n,a){var i=a||{x:t.chartX,y:t.chartY},s=Uue(i,n),o=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,d=yte(s,o,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,h=kx(t,r,d,f),p=Bue(n,o,d,i);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},zue=function(t,r){var n=r.axes,a=r.graphicalItems,i=r.axisType,s=r.axisIdKey,o=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=t.layout,f=t.children,h=t.stackOffset,p=n$(d,i);return n.reduce(function(m,y){var g,b=y.type.defaultProps!==void 0?W(W({},y.type.defaultProps),y.props):y.props,x=b.type,v=b.dataKey,S=b.allowDataOverflow,w=b.allowDuplicatedCategory,j=b.scale,k=b.ticks,_=b.includeHidden,E=b[s];if(m[E])return m;var O=ty(t.data,{graphicalItems:a.filter(function(K){var le,we=s in K.props?K.props[s]:(le=K.type.defaultProps)===null||le===void 0?void 0:le[s];return we===E}),dataStartIndex:c,dataEndIndex:u}),P=O.length,T,M,I;mue(b.domain,S,x)&&(T=Lv(b.domain,null,S),p&&(x==="number"||j!=="auto")&&(I=Fc(O,v,"category")));var R=kI(x);if(!T||T.length===0){var F,U=(F=b.domain)!==null&&F!==void 0?F:R;if(v){if(T=Fc(O,v,x),x==="category"&&p){var D=l7(T);w&&D?(M=T,T=hp(0,P)):w||(T=V_(U,T,y).reduce(function(K,le){return K.indexOf(le)>=0?K:[].concat(Sl(K),[le])},[]))}else if(x==="category")w?T=T.filter(function(K){return K!==""&&!xe(K)}):T=V_(U,T,y).reduce(function(K,le){return K.indexOf(le)>=0||le===""||xe(le)?K:[].concat(Sl(K),[le])},[]);else if(x==="number"){var V=wte(O,a.filter(function(K){var le,we,Ae=s in K.props?K.props[s]:(le=K.type.defaultProps)===null||le===void 0?void 0:le[s],De="hide"in K.props?K.props.hide:(we=K.type.defaultProps)===null||we===void 0?void 0:we.hide;return Ae===E&&(_||!De)}),v,i,d);V&&(T=V)}p&&(x==="number"||j!=="auto")&&(I=Fc(O,v,"category"))}else p?T=hp(0,P):o&&o[E]&&o[E].hasStack&&x==="number"?T=h==="expand"?[0,1]:l$(o[E].stackGroups,c,u):T=r$(O,a.filter(function(K){var le=s in K.props?K.props[s]:K.type.defaultProps[s],we="hide"in K.props?K.props.hide:K.type.defaultProps.hide;return le===E&&(_||!we)}),x,d,!0);if(x==="number")T=wx(f,T,E,i,k),U&&(T=Lv(U,T,S));else if(x==="category"&&U){var H=U,Z=T.every(function(K){return H.indexOf(K)>=0});Z&&(T=H)}}return W(W({},m),{},me({},E,W(W({},b),{},{axisType:i,domain:T,categoricalDomain:I,duplicateDomain:M,originalDomain:(g=b.domain)!==null&&g!==void 0?g:R,isCategorical:p,layout:d})))},{})},Vue=function(t,r){var n=r.graphicalItems,a=r.Axis,i=r.axisType,s=r.axisIdKey,o=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=t.layout,f=t.children,h=ty(t.data,{graphicalItems:n,dataStartIndex:c,dataEndIndex:u}),p=h.length,m=n$(d,i),y=-1;return n.reduce(function(g,b){var x=b.type.defaultProps!==void 0?W(W({},b.type.defaultProps),b.props):b.props,v=x[s],S=kI("number");if(!g[v]){y++;var w;return m?w=hp(0,p):o&&o[v]&&o[v].hasStack?(w=l$(o[v].stackGroups,c,u),w=wx(f,w,v,i)):(w=Lv(S,r$(h,n.filter(function(j){var k,_,E=s in j.props?j.props[s]:(k=j.type.defaultProps)===null||k===void 0?void 0:k[s],O="hide"in j.props?j.props.hide:(_=j.type.defaultProps)===null||_===void 0?void 0:_.hide;return E===v&&!O}),"number",d),a.defaultProps.allowDataOverflow),w=wx(f,w,v,i)),W(W({},g),{},me({},v,W(W({axisType:i},a.defaultProps),{},{hide:!0,orientation:Dr(Lue,"".concat(i,".").concat(y%2),null),domain:w,originalDomain:S,isCategorical:m,layout:d})))}return g},{})},que=function(t,r){var n=r.axisType,a=n===void 0?"xAxis":n,i=r.AxisComp,s=r.graphicalItems,o=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=t.children,f="".concat(a,"Id"),h=Lr(d,i),p={};return h&&h.length?p=zue(t,{axes:h,graphicalItems:s,axisType:a,axisIdKey:f,stackGroups:o,dataStartIndex:c,dataEndIndex:u}):s&&s.length&&(p=Vue(t,{Axis:i,graphicalItems:s,axisType:a,axisIdKey:f,stackGroups:o,dataStartIndex:c,dataEndIndex:u})),p},Wue=function(t){var r=Ya(t),n=pa(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:v1(n,function(a){return a.coordinate}),tooltipAxis:r,tooltipAxisBandSize:ep(r,n)}},PN=function(t){var r=t.children,n=t.defaultShowTooltip,a=Tr(r,hl),i=0,s=0;return t.data&&t.data.length!==0&&(s=t.data.length-1),a&&a.props&&(a.props.startIndex>=0&&(i=a.props.startIndex),a.props.endIndex>=0&&(s=a.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!n}},Gue=function(t){return!t||!t.length?!1:t.some(function(r){var n=ga(r&&r.type);return n&&n.indexOf("Bar")>=0})},TN=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Hue=function(t,r){var n=t.props,a=t.graphicalItems,i=t.xAxisMap,s=i===void 0?{}:i,o=t.yAxisMap,c=o===void 0?{}:o,u=n.width,d=n.height,f=n.children,h=n.margin||{},p=Tr(f,hl),m=Tr(f,hs),y=Object.keys(c).reduce(function(w,j){var k=c[j],_=k.orientation;return!k.mirror&&!k.hide?W(W({},w),{},me({},_,w[_]+k.width)):w},{left:h.left||0,right:h.right||0}),g=Object.keys(s).reduce(function(w,j){var k=s[j],_=k.orientation;return!k.mirror&&!k.hide?W(W({},w),{},me({},_,Dr(w,"".concat(_))+k.height)):w},{top:h.top||0,bottom:h.bottom||0}),b=W(W({},g),y),x=b.bottom;p&&(b.bottom+=p.props.height||hl.defaultProps.height),m&&r&&(b=xte(b,a,n,r));var v=u-b.left-b.right,S=d-b.top-b.bottom;return W(W({brushBottom:x},b),{},{width:Math.max(v,0),height:Math.max(S,0)})},Kue=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},nw=function(t){var r=t.chartName,n=t.GraphicalChild,a=t.defaultTooltipEventType,i=a===void 0?"axis":a,s=t.validateTooltipEventTypes,o=s===void 0?["axis"]:s,c=t.axisComponents,u=t.legendContent,d=t.formatAxisMap,f=t.defaultProps,h=function(b,x){var v=x.graphicalItems,S=x.stackGroups,w=x.offset,j=x.updateId,k=x.dataStartIndex,_=x.dataEndIndex,E=b.barSize,O=b.layout,P=b.barGap,T=b.barCategoryGap,M=b.maxBarSize,I=TN(O),R=I.numericAxisName,F=I.cateAxisName,U=Gue(v),D=[];return v.forEach(function(V,H){var Z=ty(b.data,{graphicalItems:[V],dataStartIndex:k,dataEndIndex:_}),K=V.type.defaultProps!==void 0?W(W({},V.type.defaultProps),V.props):V.props,le=K.dataKey,we=K.maxBarSize,Ae=K["".concat(R,"Id")],De=K["".concat(F,"Id")],st={},gt=c.reduce(function(L,q){var ee=x["".concat(q.axisType,"Map")],J=K["".concat(q.axisType,"Id")];ee&&ee[J]||q.axisType==="zAxis"||As(!1);var X=ee[J];return W(W({},L),{},me(me({},q.axisType,X),"".concat(q.axisType,"Ticks"),pa(X)))},st),z=gt[F],ne=gt["".concat(F,"Ticks")],ue=S&&S[Ae]&&S[Ae].hasStack&&Pte(V,S[Ae].stackGroups),G=ga(V.type).indexOf("Bar")>=0,Ce=ep(z,ne),oe=[],ot=U&>e({barSize:E,stackGroups:S,totalSize:Kue(gt,F)});if(G){var ht,zt,Zn=xe(we)?M:we,Jn=(ht=(zt=ep(z,ne,!0))!==null&&zt!==void 0?zt:Zn)!==null&&ht!==void 0?ht:0;oe=vte({barGap:P,barCategoryGap:T,bandSize:Jn!==Ce?Jn:Ce,sizeList:ot[De],maxBarSize:Zn}),Jn!==Ce&&(oe=oe.map(function(L){return W(W({},L),{},{position:W(W({},L.position),{},{offset:L.position.offset-Jn/2})})}))}var $=V&&V.type&&V.type.getComposedData;$&&D.push({props:W(W({},$(W(W({},gt),{},{displayedData:Z,props:b,dataKey:le,item:V,bandSize:Ce,barPosition:oe,offset:w,stackedData:ue,layout:O,dataStartIndex:k,dataEndIndex:_}))),{},me(me(me({key:V.key||"item-".concat(H)},R,gt[R]),F,gt[F]),"animationId",j)),childIndex:w7(V,b.children),item:V})}),D},p=function(b,x){var v=b.props,S=b.dataStartIndex,w=b.dataEndIndex,j=b.updateId;if(!CS({props:v}))return null;var k=v.children,_=v.layout,E=v.stackOffset,O=v.data,P=v.reverseStackOrder,T=TN(_),M=T.numericAxisName,I=T.cateAxisName,R=Lr(k,n),F=Ete(O,R,"".concat(M,"Id"),"".concat(I,"Id"),E,P),U=c.reduce(function(K,le){var we="".concat(le.axisType,"Map");return W(W({},K),{},me({},we,que(v,W(W({},le),{},{graphicalItems:R,stackGroups:le.axisType===M&&F,dataStartIndex:S,dataEndIndex:w}))))},{}),D=Hue(W(W({},U),{},{props:v,graphicalItems:R}),x==null?void 0:x.legendBBox);Object.keys(U).forEach(function(K){U[K]=d(v,U[K],D,K.replace("Map",""),r)});var V=U["".concat(I,"Map")],H=Wue(V),Z=h(v,W(W({},U),{},{dataStartIndex:S,dataEndIndex:w,updateId:j,graphicalItems:R,stackGroups:F,offset:D}));return W(W({formattedGraphicalItems:Z,graphicalItems:R,offset:D,stackGroups:F},H),U)},m=function(g){function b(x){var v,S,w;return Eue(this,b),w=Pue(this,b,[x]),me(w,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),me(w,"accessibilityManager",new pue),me(w,"handleLegendBBoxUpdate",function(j){if(j){var k=w.state,_=k.dataStartIndex,E=k.dataEndIndex,O=k.updateId;w.setState(W({legendBBox:j},p({props:w.props,dataStartIndex:_,dataEndIndex:E,updateId:O},W(W({},w.state),{},{legendBBox:j}))))}}),me(w,"handleReceiveSyncEvent",function(j,k,_){if(w.props.syncId===j){if(_===w.eventEmitterSymbol&&typeof w.props.syncMethod!="function")return;w.applySyncEvent(k)}}),me(w,"handleBrushChange",function(j){var k=j.startIndex,_=j.endIndex;if(k!==w.state.dataStartIndex||_!==w.state.dataEndIndex){var E=w.state.updateId;w.setState(function(){return W({dataStartIndex:k,dataEndIndex:_},p({props:w.props,dataStartIndex:k,dataEndIndex:_,updateId:E},w.state))}),w.triggerSyncEvent({dataStartIndex:k,dataEndIndex:_})}}),me(w,"handleMouseEnter",function(j){var k=w.getMouseInfo(j);if(k){var _=W(W({},k),{},{isTooltipActive:!0});w.setState(_),w.triggerSyncEvent(_);var E=w.props.onMouseEnter;ge(E)&&E(_,j)}}),me(w,"triggeredAfterMouseMove",function(j){var k=w.getMouseInfo(j),_=k?W(W({},k),{},{isTooltipActive:!0}):{isTooltipActive:!1};w.setState(_),w.triggerSyncEvent(_);var E=w.props.onMouseMove;ge(E)&&E(_,j)}),me(w,"handleItemMouseEnter",function(j){w.setState(function(){return{isTooltipActive:!0,activeItem:j,activePayload:j.tooltipPayload,activeCoordinate:j.tooltipPosition||{x:j.cx,y:j.cy}}})}),me(w,"handleItemMouseLeave",function(){w.setState(function(){return{isTooltipActive:!1}})}),me(w,"handleMouseMove",function(j){j.persist(),w.throttleTriggeredAfterMouseMove(j)}),me(w,"handleMouseLeave",function(j){w.throttleTriggeredAfterMouseMove.cancel();var k={isTooltipActive:!1};w.setState(k),w.triggerSyncEvent(k);var _=w.props.onMouseLeave;ge(_)&&_(k,j)}),me(w,"handleOuterEvent",function(j){var k=b7(j),_=Dr(w.props,"".concat(k));if(k&&ge(_)){var E,O;/.*touch.*/i.test(k)?O=w.getMouseInfo(j.changedTouches[0]):O=w.getMouseInfo(j),_((E=O)!==null&&E!==void 0?E:{},j)}}),me(w,"handleClick",function(j){var k=w.getMouseInfo(j);if(k){var _=W(W({},k),{},{isTooltipActive:!0});w.setState(_),w.triggerSyncEvent(_);var E=w.props.onClick;ge(E)&&E(_,j)}}),me(w,"handleMouseDown",function(j){var k=w.props.onMouseDown;if(ge(k)){var _=w.getMouseInfo(j);k(_,j)}}),me(w,"handleMouseUp",function(j){var k=w.props.onMouseUp;if(ge(k)){var _=w.getMouseInfo(j);k(_,j)}}),me(w,"handleTouchMove",function(j){j.changedTouches!=null&&j.changedTouches.length>0&&w.throttleTriggeredAfterMouseMove(j.changedTouches[0])}),me(w,"handleTouchStart",function(j){j.changedTouches!=null&&j.changedTouches.length>0&&w.handleMouseDown(j.changedTouches[0])}),me(w,"handleTouchEnd",function(j){j.changedTouches!=null&&j.changedTouches.length>0&&w.handleMouseUp(j.changedTouches[0])}),me(w,"handleDoubleClick",function(j){var k=w.props.onDoubleClick;if(ge(k)){var _=w.getMouseInfo(j);k(_,j)}}),me(w,"handleContextMenu",function(j){var k=w.props.onContextMenu;if(ge(k)){var _=w.getMouseInfo(j);k(_,j)}}),me(w,"triggerSyncEvent",function(j){w.props.syncId!==void 0&&bg.emit(wg,w.props.syncId,j,w.eventEmitterSymbol)}),me(w,"applySyncEvent",function(j){var k=w.props,_=k.layout,E=k.syncMethod,O=w.state.updateId,P=j.dataStartIndex,T=j.dataEndIndex;if(j.dataStartIndex!==void 0||j.dataEndIndex!==void 0)w.setState(W({dataStartIndex:P,dataEndIndex:T},p({props:w.props,dataStartIndex:P,dataEndIndex:T,updateId:O},w.state)));else if(j.activeTooltipIndex!==void 0){var M=j.chartX,I=j.chartY,R=j.activeTooltipIndex,F=w.state,U=F.offset,D=F.tooltipTicks;if(!U)return;if(typeof E=="function")R=E(D,j);else if(E==="value"){R=-1;for(var V=0;V=0){var ue,G;if(M.dataKey&&!M.allowDuplicatedCategory){var Ce=typeof M.dataKey=="function"?ne:"payload.".concat(M.dataKey.toString());ue=Oh(V,Ce,R),G=H&&Z&&Oh(Z,Ce,R)}else ue=V==null?void 0:V[I],G=H&&Z&&Z[I];if(De||Ae){var oe=j.props.activeIndex!==void 0?j.props.activeIndex:I;return[N.cloneElement(j,W(W(W({},E.props),gt),{},{activeIndex:oe})),null,null]}if(!xe(ue))return[z].concat(Sl(w.renderActivePoints({item:E,activePoint:ue,basePoint:G,childIndex:I,isRange:H})))}else{var ot,ht=(ot=w.getItemByXY(w.state.activeCoordinate))!==null&&ot!==void 0?ot:{graphicalItem:z},zt=ht.graphicalItem,Zn=zt.item,Jn=Zn===void 0?j:Zn,$=zt.childIndex,L=W(W(W({},E.props),gt),{},{activeIndex:$});return[N.cloneElement(Jn,L),null,null]}return H?[z,null,null]:[z,null]}),me(w,"renderCustomized",function(j,k,_){return N.cloneElement(j,W(W({key:"recharts-customized-".concat(_)},w.props),w.state))}),me(w,"renderMap",{CartesianGrid:{handler:hf,once:!0},ReferenceArea:{handler:w.renderReferenceElement},ReferenceLine:{handler:hf},ReferenceDot:{handler:w.renderReferenceElement},XAxis:{handler:hf},YAxis:{handler:hf},Brush:{handler:w.renderBrush,once:!0},Bar:{handler:w.renderGraphicChild},Line:{handler:w.renderGraphicChild},Area:{handler:w.renderGraphicChild},Radar:{handler:w.renderGraphicChild},RadialBar:{handler:w.renderGraphicChild},Scatter:{handler:w.renderGraphicChild},Pie:{handler:w.renderGraphicChild},Funnel:{handler:w.renderGraphicChild},Tooltip:{handler:w.renderCursor,once:!0},PolarGrid:{handler:w.renderPolarGrid,once:!0},PolarAngleAxis:{handler:w.renderPolarAxis},PolarRadiusAxis:{handler:w.renderPolarAxis},Customized:{handler:w.renderCustomized}}),w.clipPathId="".concat((v=x.id)!==null&&v!==void 0?v:zl("recharts"),"-clip"),w.throttleTriggeredAfterMouseMove=JT(w.triggeredAfterMouseMove,(S=x.throttleDelay)!==null&&S!==void 0?S:1e3/60),w.state={},w}return $ue(b,g),Aue(b,[{key:"componentDidMount",value:function(){var v,S;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(v=this.props.margin.left)!==null&&v!==void 0?v:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var v=this.props,S=v.children,w=v.data,j=v.height,k=v.layout,_=Tr(S,Kr);if(_){var E=_.props.defaultIndex;if(!(typeof E!="number"||E<0||E>this.state.tooltipTicks.length-1)){var O=this.state.tooltipTicks[E]&&this.state.tooltipTicks[E].value,P=kx(this.state,w,E,O),T=this.state.tooltipTicks[E].coordinate,M=(this.state.offset.top+j)/2,I=k==="horizontal",R=I?{x:T,y:M}:{y:T,x:M},F=this.state.formattedGraphicalItems.find(function(D){var V=D.item;return V.type.name==="Scatter"});F&&(R=W(W({},R),F.props.points[E].tooltipPosition),P=F.props.points[E].tooltipPayload);var U={activeTooltipIndex:E,isTooltipActive:!0,activeLabel:O,activePayload:P,activeCoordinate:R};this.setState(U),this.renderCursor(_),this.accessibilityManager.setIndex(E)}}}},{key:"getSnapshotBeforeUpdate",value:function(v,S){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==S.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==v.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==v.margin){var w,j;this.accessibilityManager.setDetails({offset:{left:(w=this.props.margin.left)!==null&&w!==void 0?w:0,top:(j=this.props.margin.top)!==null&&j!==void 0?j:0}})}return null}},{key:"componentDidUpdate",value:function(v){J0([Tr(v.children,Kr)],[Tr(this.props.children,Kr)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var v=Tr(this.props.children,Kr);if(v&&typeof v.props.shared=="boolean"){var S=v.props.shared?"axis":"item";return o.indexOf(S)>=0?S:i}return i}},{key:"getMouseInfo",value:function(v){if(!this.container)return null;var S=this.container,w=S.getBoundingClientRect(),j=qX(w),k={chartX:Math.round(v.pageX-j.left),chartY:Math.round(v.pageY-j.top)},_=w.width/S.offsetWidth||1,E=this.inRange(k.chartX,k.chartY,_);if(!E)return null;var O=this.state,P=O.xAxisMap,T=O.yAxisMap,M=this.getTooltipEventType(),I=AN(this.state,this.props.data,this.props.layout,E);if(M!=="axis"&&P&&T){var R=Ya(P).scale,F=Ya(T).scale,U=R&&R.invert?R.invert(k.chartX):null,D=F&&F.invert?F.invert(k.chartY):null;return W(W({},k),{},{xValue:U,yValue:D},I)}return I?W(W({},k),I):null}},{key:"inRange",value:function(v,S){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,j=this.props.layout,k=v/w,_=S/w;if(j==="horizontal"||j==="vertical"){var E=this.state.offset,O=k>=E.left&&k<=E.left+E.width&&_>=E.top&&_<=E.top+E.height;return O?{x:k,y:_}:null}var P=this.state,T=P.angleAxisMap,M=P.radiusAxisMap;if(T&&M){var I=Ya(T);return G_({x:k,y:_},I)}return null}},{key:"parseEventsOfWrapper",value:function(){var v=this.props.children,S=this.getTooltipEventType(),w=Tr(v,Kr),j={};w&&S==="axis"&&(w.props.trigger==="click"?j={onClick:this.handleClick}:j={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var k=Nh(this.props,this.handleOuterEvent);return W(W({},k),j)}},{key:"addListener",value:function(){bg.on(wg,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){bg.removeListener(wg,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(v,S,w){for(var j=this.state.formattedGraphicalItems,k=0,_=j.length;k<_;k++){var E=j[k];if(E.item===v||E.props.key===v.key||S===ga(E.item.type)&&w===E.childIndex)return E}return null}},{key:"renderClipPath",value:function(){var v=this.clipPathId,S=this.state.offset,w=S.left,j=S.top,k=S.height,_=S.width;return A.createElement("defs",null,A.createElement("clipPath",{id:v},A.createElement("rect",{x:w,y:j,height:k,width:_})))}},{key:"getXScales",value:function(){var v=this.state.xAxisMap;return v?Object.entries(v).reduce(function(S,w){var j=_N(w,2),k=j[0],_=j[1];return W(W({},S),{},me({},k,_.scale))},{}):null}},{key:"getYScales",value:function(){var v=this.state.yAxisMap;return v?Object.entries(v).reduce(function(S,w){var j=_N(w,2),k=j[0],_=j[1];return W(W({},S),{},me({},k,_.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(v){var S;return(S=this.state.xAxisMap)===null||S===void 0||(S=S[v])===null||S===void 0?void 0:S.scale}},{key:"getYScaleByAxisId",value:function(v){var S;return(S=this.state.yAxisMap)===null||S===void 0||(S=S[v])===null||S===void 0?void 0:S.scale}},{key:"getItemByXY",value:function(v){var S=this.state,w=S.formattedGraphicalItems,j=S.activeItem;if(w&&w.length)for(var k=0,_=w.length;k<_;k++){var E=w[k],O=E.props,P=E.item,T=P.type.defaultProps!==void 0?W(W({},P.type.defaultProps),P.props):P.props,M=ga(P.type);if(M==="Bar"){var I=(O.data||[]).find(function(D){return _ae(v,D)});if(I)return{graphicalItem:E,payload:I}}else if(M==="RadialBar"){var R=(O.data||[]).find(function(D){return G_(v,D)});if(R)return{graphicalItem:E,payload:R}}else if(Km(E,j)||Qm(E,j)||zu(E,j)){var F=hse({graphicalItem:E,activeTooltipItem:j,itemData:T.data}),U=T.activeIndex===void 0?F:T.activeIndex;return{graphicalItem:W(W({},E),{},{childIndex:U}),payload:zu(E,j)?T.data[F]:E.props.data[F]}}}return null}},{key:"render",value:function(){var v=this;if(!CS(this))return null;var S=this.props,w=S.children,j=S.className,k=S.width,_=S.height,E=S.style,O=S.compact,P=S.title,T=S.desc,M=ON(S,Sue),I=he(M,!1);if(O)return A.createElement(tN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},A.createElement(tv,xo({},I,{width:k,height:_,title:P,desc:T}),this.renderClipPath(),IS(w,this.renderMap)));if(this.props.accessibilityLayer){var R,F;I.tabIndex=(R=this.props.tabIndex)!==null&&R!==void 0?R:0,I.role=(F=this.props.role)!==null&&F!==void 0?F:"application",I.onKeyDown=function(D){v.accessibilityManager.keyboardEvent(D)},I.onFocus=function(){v.accessibilityManager.focus()}}var U=this.parseEventsOfWrapper();return A.createElement(tN,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},A.createElement("div",xo({className:ve("recharts-wrapper",j),style:W({position:"relative",cursor:"default",width:k,height:_},E)},U,{ref:function(V){v.container=V}}),A.createElement(tv,xo({},I,{width:k,height:_,title:P,desc:T,style:Fue}),this.renderClipPath(),IS(w,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(N.Component);me(m,"displayName",r),me(m,"defaultProps",W({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),me(m,"getDerivedStateFromProps",function(g,b){var x=g.dataKey,v=g.data,S=g.children,w=g.width,j=g.height,k=g.layout,_=g.stackOffset,E=g.margin,O=b.dataStartIndex,P=b.dataEndIndex;if(b.updateId===void 0){var T=PN(g);return W(W(W({},T),{},{updateId:0},p(W(W({props:g},T),{},{updateId:0}),b)),{},{prevDataKey:x,prevData:v,prevWidth:w,prevHeight:j,prevLayout:k,prevStackOffset:_,prevMargin:E,prevChildren:S})}if(x!==b.prevDataKey||v!==b.prevData||w!==b.prevWidth||j!==b.prevHeight||k!==b.prevLayout||_!==b.prevStackOffset||!No(E,b.prevMargin)){var M=PN(g),I={chartX:b.chartX,chartY:b.chartY,isTooltipActive:b.isTooltipActive},R=W(W({},AN(b,v,k)),{},{updateId:b.updateId+1}),F=W(W(W({},M),I),R);return W(W(W({},F),p(W({props:g},F),b)),{},{prevDataKey:x,prevData:v,prevWidth:w,prevHeight:j,prevLayout:k,prevStackOffset:_,prevMargin:E,prevChildren:S})}if(!J0(S,b.prevChildren)){var U,D,V,H,Z=Tr(S,hl),K=Z&&(U=(D=Z.props)===null||D===void 0?void 0:D.startIndex)!==null&&U!==void 0?U:O,le=Z&&(V=(H=Z.props)===null||H===void 0?void 0:H.endIndex)!==null&&V!==void 0?V:P,we=K!==O||le!==P,Ae=!xe(v),De=Ae&&!we?b.updateId:b.updateId+1;return W(W({updateId:De},p(W(W({props:g},b),{},{updateId:De,dataStartIndex:K,dataEndIndex:le}),b)),{},{prevChildren:S,dataStartIndex:K,dataEndIndex:le})}return null}),me(m,"renderActiveDot",function(g,b,x){var v;return N.isValidElement(g)?v=N.cloneElement(g,b):ge(g)?v=g(b):v=A.createElement(Vm,b),A.createElement(Pe,{className:"recharts-active-dot",key:x},v)});var y=N.forwardRef(function(b,x){return A.createElement(m,xo({},b,{ref:x}))});return y.displayName=m.displayName,y},Que=nw({chartName:"LineChart",GraphicalChild:Nd,axisComponents:[{axisType:"xAxis",AxisComp:Xl},{axisType:"yAxis",AxisComp:Yl}],formatAxisMap:V$}),Xue=nw({chartName:"BarChart",GraphicalChild:qs,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Xl},{axisType:"yAxis",AxisComp:Yl}],formatAxisMap:V$}),Yue=nw({chartName:"PieChart",GraphicalChild:Ma,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:Hm},{axisType:"radiusAxis",AxisComp:Wm}],formatAxisMap:Ute,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const _I=({data:e,title:t,color:r="#3b82f6"})=>l.jsxs("div",{className:"card p-3 sm:p-4 lg:p-6",children:[t&&l.jsx(Qp,{className:"mb-3 sm:mb-4",children:t}),l.jsx("div",{className:"w-full",children:l.jsx(b1,{width:"100%",height:250,minHeight:200,children:l.jsxs(Xue,{data:e,margin:{top:5,right:5,left:5,bottom:5},children:[l.jsx(rw,{strokeDasharray:"3 3",className:"stroke-gray-300 dark:stroke-gray-600"}),l.jsx(Xl,{dataKey:"name",className:"text-gray-600 dark:text-gray-400",tick:{fontSize:10},interval:0,angle:-45,textAnchor:"end",height:60}),l.jsx(Yl,{className:"text-gray-600 dark:text-gray-400",tick:{fontSize:10},width:40}),l.jsx(Kr,{contentStyle:{backgroundColor:"var(--toast-bg)",color:"var(--toast-color)",border:"none",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",fontSize:"12px"}}),l.jsx(qs,{dataKey:"value",fill:r,radius:[2,2,0,0]})]})})})]}),OI=({data:e,title:t,color:r="#10b981"})=>l.jsxs("div",{className:"card p-3 sm:p-4 lg:p-6",children:[t&&l.jsx(Qp,{className:"mb-3 sm:mb-4",children:t}),l.jsx("div",{className:"w-full",children:l.jsx(b1,{width:"100%",height:250,minHeight:200,children:l.jsxs(Que,{data:e,margin:{top:5,right:5,left:5,bottom:5},children:[l.jsx(rw,{strokeDasharray:"3 3",className:"stroke-gray-300 dark:stroke-gray-600"}),l.jsx(Xl,{dataKey:"name",className:"text-gray-600 dark:text-gray-400",tick:{fontSize:10},interval:0,angle:-45,textAnchor:"end",height:60}),l.jsx(Yl,{className:"text-gray-600 dark:text-gray-400",tick:{fontSize:10},width:40}),l.jsx(Kr,{contentStyle:{backgroundColor:"var(--toast-bg)",color:"var(--toast-color)",border:"none",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",fontSize:"12px"}}),l.jsx(Nd,{type:"monotone",dataKey:"value",stroke:r,strokeWidth:2,dot:{r:3,strokeWidth:2},activeDot:{r:5}})]})})})]}),Zue=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6"],Jue=({data:e,title:t,colors:r=Zue})=>{const n=a=>{const{payload:i}=a;return l.jsx("div",{className:"flex flex-wrap justify-center gap-2 mt-3",children:i.map((s,o)=>l.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm",children:[l.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:s.color}}),l.jsxs("span",{className:"text-gray-700 dark:text-gray-300 whitespace-nowrap",children:[s.value,": ",s.payload.value]})]},o))})};return l.jsxs("div",{className:"card p-3 sm:p-4 lg:p-6",children:[t&&l.jsx(Qp,{className:"mb-3 sm:mb-4 text-center",children:t}),l.jsx("div",{className:"w-full",children:l.jsx(b1,{width:"100%",height:280,minHeight:220,children:l.jsxs(Yue,{children:[l.jsx(Ma,{data:e,cx:"50%",cy:"45%",labelLine:!1,label:!1,outerRadius:"65%",fill:"#8884d8",dataKey:"value",children:e.map((a,i)=>l.jsx(Pm,{fill:r[i%r.length]},`cell-${i}`))}),l.jsx(Kr,{contentStyle:{backgroundColor:"var(--toast-bg)",color:"var(--toast-color)",border:"none",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",fontSize:"14px"},formatter:(a,i)=>[`${a}`,i]}),l.jsx(hs,{content:l.jsx(n,{}),wrapperStyle:{paddingTop:"10px"}})]})})})]})},aw=({columns:e,data:t,loading:r=!1})=>{const[n,a]=N.useState(""),[i,s]=N.useState("asc"),o=u=>{n===u?s(i==="asc"?"desc":"asc"):(a(u),s("asc"))},c=[...t].sort((u,d)=>{if(!n)return 0;const f=u[n],h=d[n];return fh?i==="asc"?1:-1:0});return r?l.jsxs("div",{className:"animate-pulse",children:[l.jsx("div",{className:"hidden md:block",children:l.jsxs("div",{className:"card overflow-hidden",children:[l.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 px-6 py-3",children:l.jsx("div",{className:"flex space-x-4",children:e.map((u,d)=>l.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded flex-1"},d))})}),[...Array(5)].map((u,d)=>l.jsx("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:l.jsx("div",{className:"flex space-x-4",children:e.map((f,h)=>l.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded flex-1"},h))})},d))]})}),l.jsx("div",{className:"md:hidden space-y-4",children:[...Array(3)].map((u,d)=>l.jsx("div",{className:"card p-4 space-y-3",children:e.map((f,h)=>l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"h-3 bg-gray-300 dark:bg-gray-600 rounded w-1/3"}),l.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-2/3"})]},h))},d))})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"hidden md:block card overflow-hidden",children:l.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[l.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:l.jsx("tr",{children:e.map(u=>l.jsx("th",{className:ve("px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",u.sortable&&"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-600"),onClick:()=>u.sortable&&o(u.key),children:l.jsxs("div",{className:"flex items-center justify-end space-x-1",children:[l.jsx("span",{children:u.label}),u.sortable&&l.jsxs("div",{className:"flex flex-col",children:[l.jsx(i6,{className:ve("h-3 w-3",n===u.key&&i==="asc"?"text-primary-600":"text-gray-400")}),l.jsx(Nb,{className:ve("h-3 w-3 -mt-1",n===u.key&&i==="desc"?"text-primary-600":"text-gray-400")})]})]})},u.key))})}),l.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:c.map((u,d)=>l.jsx("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:e.map(f=>l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100 text-right",children:f.render?f.render(u[f.key],u):u[f.key]},f.key))},d))})]})}),l.jsx("div",{className:"md:hidden space-y-4",children:c.map((u,d)=>l.jsx("div",{className:"card p-4 space-y-3",children:e.map(f=>l.jsxs("div",{className:"flex justify-between items-start",children:[l.jsxs("span",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:[f.label,":"]}),l.jsx("span",{className:"text-sm text-gray-900 dark:text-gray-100 text-right",children:f.render?f.render(u[f.key],u):u[f.key]})]},f.key))},d))})]})},kl=({permission:e,children:t,fallback:r=null})=>{const{hasPermission:n}=hd();return n(e)?t:r},ede=[{title:"کل کاربران",value:1247,change:12,icon:Zo,color:"blue"},{title:"فروش ماهانه",value:"۲۴,۵۶۷,۰۰۰",change:8.5,icon:Kp,color:"green"},{title:"کل سفارشات",value:356,change:-2.3,icon:zA,color:"yellow"},{title:"رشد فروش",value:"۲۳.۵%",change:15.2,icon:Pb,color:"purple"}],CN=[{name:"فروردین",value:4e3},{name:"اردیبهشت",value:3e3},{name:"خرداد",value:5e3},{name:"تیر",value:4500},{name:"مرداد",value:6e3},{name:"شهریور",value:5500}],tde=[{name:"دسکتاپ",value:45},{name:"موبایل",value:35},{name:"تبلت",value:20}],rde=[{id:1,name:"علی احمدی",email:"ali@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۵"},{id:2,name:"فاطمه حسینی",email:"fateme@example.com",role:"مدیر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۴"},{id:3,name:"محمد رضایی",email:"mohammad@example.com",role:"کاربر",status:"غیرفعال",createdAt:"۱۴۰۲/۰۸/۱۳"},{id:4,name:"زهرا کریمی",email:"zahra@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۲"}],nde=[{key:"name",label:"نام",sortable:!0},{key:"email",label:"ایمیل"},{key:"role",label:"نقش"},{key:"status",label:"وضعیت",render:e=>l.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${e==="فعال"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}`,children:e})},{key:"createdAt",label:"تاریخ عضویت"},{key:"actions",label:"عملیات",render:()=>l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(te,{size:"sm",variant:"secondary",children:"ویرایش"}),l.jsx(kl,{permission:22,children:l.jsx(te,{size:"sm",variant:"danger",children:"حذف"})})]})}],ade=()=>l.jsxs(_r,{children:[l.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:items-center sm:justify-between sm:space-y-0",children:[l.jsx(Ta,{children:"داشبورد"}),l.jsxs("div",{className:"flex justify-start gap-3",children:[l.jsx("button",{className:"flex items-center justify-center w-12 h-12 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 rounded-full transition-colors duration-200 text-gray-600 dark:text-gray-300",title:"گزارش‌گیری",children:l.jsx(r6,{className:"h-5 w-5"})}),l.jsx(kl,{permission:25,children:l.jsx("button",{className:"flex items-center justify-center w-12 h-12 bg-primary-600 hover:bg-primary-700 rounded-full transition-colors duration-200 text-white shadow-lg hover:shadow-xl",title:"اضافه کردن",children:l.jsx(Pt,{className:"h-5 w-5"})})})]})]}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4 lg:gap-6",children:ede.map((e,t)=>l.jsx(E5,{...e},t))}),l.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4 sm:gap-6",children:[l.jsx("div",{className:"min-w-0",children:l.jsx(_I,{data:CN,title:"فروش ماهانه",color:"#3b82f6"})}),l.jsx("div",{className:"min-w-0",children:l.jsx(OI,{data:CN,title:"روند رشد",color:"#10b981"})})]}),l.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-4 sm:gap-6",children:[l.jsx("div",{className:"xl:col-span-2 min-w-0",children:l.jsxs("div",{className:"card p-3 sm:p-4 lg:p-6",children:[l.jsx(Qp,{className:"mb-3 sm:mb-4",children:"کاربران اخیر"}),l.jsx("div",{className:"overflow-x-auto",children:l.jsx(aw,{columns:nde,data:rde})})]})}),l.jsx("div",{className:"min-w-0",children:l.jsx(Jue,{data:tde,title:"دستگاه‌های کاربری",colors:["#3b82f6","#10b981","#f59e0b"]})})]})]}),Ws=({isOpen:e,onClose:t,title:r,children:n,size:a="md",showCloseButton:i=!0,actions:s})=>{if(N.useEffect(()=>{const c=u=>{u.key==="Escape"&&t()};return e&&(document.addEventListener("keydown",c),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",c),document.body.style.overflow="unset"}},[e,t]),!e)return null;const o={sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"};return l.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto",children:l.jsxs("div",{className:"flex min-h-screen items-center justify-center p-4",children:[l.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 transition-opacity",onClick:t}),l.jsxs("div",{className:` - relative w-full ${o[a]} - bg-white dark:bg-gray-800 rounded-lg shadow-xl - transform transition-all - `,children:[l.jsxs("div",{className:"flex items-center justify-between p-4 sm:p-6 border-b border-gray-200 dark:border-gray-700",children:[l.jsx(bh,{children:r}),i&&l.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",children:l.jsx(pd,{className:"h-5 w-5"})})]}),l.jsx("div",{className:"p-4 sm:p-6",children:n}),s&&l.jsx("div",{className:"flex flex-col space-y-2 sm:flex-row sm:justify-end sm:space-y-0 sm:space-x-3 sm:space-x-reverse p-4 sm:p-6 border-t border-gray-200 dark:border-gray-700",children:s})]})]})})},iw=({currentPage:e,totalPages:t,onPageChange:r,itemsPerPage:n,totalItems:a})=>{const i=(e-1)*n+1,s=Math.min(e*n,a),o=()=>{const c=[];if(t<=5)for(let d=1;d<=t;d++)c.push(d);else{const d=Math.max(1,e-2),f=Math.min(t,d+5-1);for(let h=d;h<=f;h++)c.push(h);d>1&&(c.unshift("..."),c.unshift(1)),fr(e-1),disabled:e===1,children:"قبلی"}),l.jsx(te,{variant:"secondary",size:"sm",onClick:()=>r(e+1),disabled:e===t,children:"بعدی"})]}),l.jsxs("div",{className:"hidden sm:flex sm:flex-1 sm:items-center sm:justify-between",children:[l.jsx("div",{children:l.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:["نمایش ",l.jsx("span",{className:"font-medium",children:i})," تا"," ",l.jsx("span",{className:"font-medium",children:s})," از"," ",l.jsx("span",{className:"font-medium",children:a})," نتیجه"]})}),l.jsx("div",{children:l.jsxs("nav",{className:"relative z-0 inline-flex rounded-md shadow-sm -space-x-px",children:[l.jsx("button",{onClick:()=>r(e-1),disabled:e===1,className:"relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-sm font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:l.jsx(a6,{className:"h-5 w-5"})}),o().map((c,u)=>l.jsx("button",{onClick:()=>typeof c=="number"&&r(c),disabled:c==="...",className:`relative inline-flex items-center px-4 py-2 border text-sm font-medium ${c===e?"z-10 bg-primary-50 dark:bg-primary-900 border-primary-500 text-primary-600 dark:text-primary-400":c==="..."?"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300 cursor-default":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-600"}`,children:c},u)),l.jsx("button",{onClick:()=>r(e+1),disabled:e===t,className:"relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-sm font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:l.jsx(LA,{className:"h-5 w-5"})})]})})]})]})},ide=jr({name:Se().required("نام الزامی است"),email:Se().email("ایمیل معتبر نیست").required("ایمیل الزامی است"),phone:Se().required("شماره تلفن الزامی است"),role:Se().required("نقش الزامی است"),password:Se().notRequired()}),sde=({onSubmit:e,defaultValues:t,initialData:r,onCancel:n,loading:a,isEdit:i,isLoading:s})=>{var f,h,p;const{register:o,handleSubmit:c,formState:{errors:u,isValid:d}}=Rs({resolver:Ms(ide),defaultValues:t||r,mode:"onChange"});return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-gray-100",children:"اطلاعات کاربر"}),l.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"لطفا اطلاعات کاربر را کامل کنید"})]}),l.jsxs("form",{onSubmit:c(e),className:"space-y-4",children:[l.jsx(tt,{label:"نام",...o("name"),error:(f=u.name)==null?void 0:f.message,placeholder:"نام کاربر"}),l.jsx(tt,{label:"ایمیل",type:"email",...o("email"),error:(h=u.email)==null?void 0:h.message,placeholder:"example@email.com"}),l.jsx(tt,{label:"تلفن",type:"tel",...o("phone"),error:(p=u.phone)==null?void 0:p.message,placeholder:"09xxxxxxxxx"}),l.jsx("div",{className:"pt-4",children:l.jsx(te,{type:"submit",disabled:!d||s,className:"w-full",children:s?"در حال ذخیره...":"ذخیره"})})]})]})},ode=[{id:1,name:"علی احمدی",email:"ali@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۵",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:2,name:"فاطمه حسینی",email:"fateme@example.com",role:"مدیر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۴",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:3,name:"محمد رضایی",email:"mohammad@example.com",role:"کاربر",status:"غیرفعال",createdAt:"۱۴۰۲/۰۸/۱۳",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:4,name:"زهرا کریمی",email:"zahra@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۲",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:5,name:"حسن نوری",email:"hassan@example.com",role:"مدیر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۱۱",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:6,name:"مریم صادقی",email:"maryam@example.com",role:"کاربر",status:"غیرفعال",createdAt:"۱۴۰۲/۰۸/۱۰",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:7,name:"احمد قاسمی",email:"ahmad@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۰۹",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:8,name:"سارا محمدی",email:"sara@example.com",role:"مدیر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۰۸",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:9,name:"رضا کریمی",email:"reza@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۰۷",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:10,name:"نرگس احمدی",email:"narges@example.com",role:"کاربر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۰۶",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:11,name:"امیر حسینی",email:"amir@example.com",role:"مدیر",status:"فعال",createdAt:"۱۴۰۲/۰۸/۰۵",phone:"۰۹۱۲۳۴۵۶۷۸۹"},{id:12,name:"مینا رضایی",email:"mina@example.com",role:"کاربر",status:"غیرفعال",createdAt:"۱۴۰۲/۰۸/۰۴",phone:"۰۹۱۲۳۴۵۶۷۸۹"}],lde=()=>{const[e,t]=N.useState(""),[r,n]=N.useState(!1),[a,i]=N.useState(null),[s,o]=N.useState(1),c=5,u=[{key:"name",label:"نام",sortable:!0},{key:"email",label:"ایمیل",sortable:!0},{key:"phone",label:"تلفن"},{key:"role",label:"نقش"},{key:"status",label:"وضعیت",render:v=>l.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${v==="فعال"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}`,children:v})},{key:"createdAt",label:"تاریخ عضویت",sortable:!0},{key:"actions",label:"عملیات",render:(v,S)=>l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(te,{size:"sm",variant:"secondary",onClick:()=>y(S),children:"ویرایش"}),l.jsx(kl,{permission:22,children:l.jsx(te,{size:"sm",variant:"danger",onClick:()=>g(S.id),children:"حذف"})})]})}],d=ode.filter(v=>v.name.toLowerCase().includes(e.toLowerCase())||v.email.toLowerCase().includes(e.toLowerCase())),f=Math.ceil(d.length/c),h=(s-1)*c,p=d.slice(h,h+c),m=()=>{i(null),n(!0)},y=v=>{i(v),n(!0)},g=v=>{confirm("آیا از حذف این کاربر اطمینان دارید؟")&&console.log("Deleting user:",v)},b=v=>{console.log("User data:",v),n(!1)},x=()=>{n(!1),i(null)};return l.jsxs(_r,{children:[l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx(Ta,{children:"مدیریت کاربران"}),l.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:[d.length," کاربر یافت شد"]})]}),l.jsxs("div",{className:"flex items-center space-x-3 space-x-reverse",children:[l.jsxs(te,{variant:"secondary",children:[l.jsx(c6,{className:"h-4 w-4 ml-2"}),"فیلتر"]}),l.jsx(kl,{permission:25,children:l.jsx("button",{onClick:m,className:"flex items-center justify-center w-12 h-12 bg-primary-600 hover:bg-primary-700 rounded-full transition-colors duration-200 text-white shadow-lg hover:shadow-xl",title:"افزودن کاربر",children:l.jsx(Pt,{className:"h-5 w-5"})})})]})]}),l.jsxs("div",{className:"card p-6",children:[l.jsx("div",{className:"mb-6",children:l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none",children:l.jsx(Ab,{className:"h-5 w-5 text-gray-400"})}),l.jsx("input",{type:"text",placeholder:"جستجو در کاربران...",value:e,onChange:v=>t(v.target.value),className:"input pr-10 max-w-md"})]})}),l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg overflow-hidden",children:[l.jsx(aw,{columns:u,data:p,loading:!1}),l.jsx(iw,{currentPage:s,totalPages:f,onPageChange:o,itemsPerPage:c,totalItems:d.length})]})]}),l.jsx(Ws,{title:a?"ویرایش کاربر":"افزودن کاربر",isOpen:r,onClose:x,size:"lg",children:l.jsx(sde,{initialData:a,onSubmit:b,onCancel:x,loading:!1,isEdit:!!a})})]})},bc=[{id:1001,customer:"علی احمدی",products:"۳ محصول",amount:"۴۵,۰۰۰,۰۰۰",status:"تحویل شده",date:"۱۴۰۲/۰۸/۱۵"},{id:1002,customer:"فاطمه حسینی",products:"۱ محصول",amount:"۲۵,۰۰۰,۰۰۰",status:"در حال پردازش",date:"۱۴۰۲/۰۸/۱۴"},{id:1003,customer:"محمد رضایی",products:"۲ محصول",amount:"۳۲,۰۰۰,۰۰۰",status:"ارسال شده",date:"۱۴۰۲/۰۸/۱۳"},{id:1004,customer:"زهرا کریمی",products:"۵ محصول",amount:"۱۲۰,۰۰۰,۰۰۰",status:"تحویل شده",date:"۱۴۰۲/۰۸/۱۲"},{id:1005,customer:"حسن نوری",products:"۱ محصول",amount:"۱۸,۰۰۰,۰۰۰",status:"لغو شده",date:"۱۴۰۲/۰۸/۱۱"},{id:1006,customer:"مریم صادقی",products:"۴ محصول",amount:"۸۵,۰۰۰,۰۰۰",status:"در حال پردازش",date:"۱۴۰۲/۰۸/۱۰"},{id:1007,customer:"احمد قاسمی",products:"۲ محصول",amount:"۳۸,۰۰۰,۰۰۰",status:"ارسال شده",date:"۱۴۰۲/۰۸/۰۹"},{id:1008,customer:"سارا محمدی",products:"۳ محصول",amount:"۶۲,۰۰۰,۰۰۰",status:"تحویل شده",date:"۱۴۰۲/۰۸/۰۸"},{id:1009,customer:"رضا کریمی",products:"۱ محصول",amount:"۱۵,۰۰۰,۰۰۰",status:"در حال پردازش",date:"۱۴۰۲/۰۸/۰۷"},{id:1010,customer:"نرگس احمدی",products:"۶ محصول",amount:"۱۴۵,۰۰۰,۰۰۰",status:"تحویل شده",date:"۱۴۰۲/۰۸/۰۶"}],cde=()=>{const[e,t]=N.useState(""),[r,n]=N.useState(1),a=6,i=[{key:"id",label:"شماره سفارش",sortable:!0},{key:"customer",label:"مشتری",sortable:!0},{key:"products",label:"محصولات"},{key:"amount",label:"مبلغ",render:p=>l.jsxs("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:[p," تومان"]})},{key:"status",label:"وضعیت",render:p=>l.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${p==="تحویل شده"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":p==="ارسال شده"?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":p==="در حال پردازش"?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}`,children:p})},{key:"date",label:"تاریخ سفارش",sortable:!0},{key:"actions",label:"عملیات",render:(p,m)=>l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(te,{size:"sm",variant:"secondary",onClick:()=>d(m),children:"مشاهده"}),l.jsx(te,{size:"sm",variant:"primary",onClick:()=>f(m),children:"ویرایش"})]})}],s=bc.filter(p=>p.customer.toLowerCase().includes(e.toLowerCase())||p.id.toString().includes(e)),o=Math.ceil(s.length/a),c=(r-1)*a,u=s.slice(c,c+a),d=p=>{console.log("Viewing order:",p)},f=p=>{console.log("Editing order:",p)},h=bc.reduce((p,m)=>{const y=parseInt(m.amount.replace(/[,]/g,""));return p+y},0);return l.jsxs(_r,{children:[l.jsx(Ta,{children:"مدیریت سفارشات"}),l.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:[s.length," سفارش یافت شد"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6 mb-6",children:[l.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx(Lj,{className:"h-8 w-8 text-blue-600"}),l.jsxs("div",{className:"mr-3",children:[l.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"کل سفارشات"}),l.jsx(Xa,{children:bc.length})]})]})}),l.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx(Ss,{className:"h-8 w-8 text-green-600"}),l.jsxs("div",{className:"mr-3",children:[l.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"تحویل شده"}),l.jsx(Xa,{children:bc.filter(p=>p.status==="تحویل شده").length})]})]})}),l.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx(Lj,{className:"h-8 w-8 text-yellow-600"}),l.jsxs("div",{className:"mr-3",children:[l.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"در انتظار"}),l.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:bc.filter(p=>p.status==="در حال پردازش").length})]})]})}),l.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx(Kp,{className:"h-8 w-8 text-purple-600"}),l.jsxs("div",{className:"mr-3",children:[l.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"کل فروش"}),l.jsxs("p",{className:"text-xl font-bold text-gray-900 dark:text-gray-100",children:[h.toLocaleString()," تومان"]})]})]})})]}),l.jsxs("div",{className:"card p-6",children:[l.jsx("div",{className:"mb-6",children:l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none",children:l.jsx(Ab,{className:"h-5 w-5 text-gray-400"})}),l.jsx("input",{type:"text",placeholder:"جستجو در سفارشات...",value:e,onChange:p=>t(p.target.value),className:"input pr-10 max-w-md"})]})}),l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg overflow-hidden",children:[l.jsx(aw,{columns:i,data:u,loading:!1}),l.jsx(iw,{currentPage:r,totalPages:o,onPageChange:n,itemsPerPage:a,totalItems:s.length})]})]})]})},ude=()=>{const[e,t]=N.useState("month"),r=[{name:"فروردین",value:12e6},{name:"اردیبهشت",value:19e6},{name:"خرداد",value:15e6},{name:"تیر",value:22e6},{name:"مرداد",value:18e6},{name:"شهریور",value:25e6}],n=[{name:"فروردین",value:150},{name:"اردیبهشت",value:230},{name:"خرداد",value:180},{name:"تیر",value:280},{name:"مرداد",value:200},{name:"شهریور",value:320}],a=[{id:1,title:"گزارش فروش ماهانه",description:"گزارش کامل فروش محصولات در ماه گذشته",type:"فروش",date:"۱۴۰۲/۰۸/۳۰",format:"PDF"},{id:2,title:"گزارش کاربران جدید",description:"آمار کاربران جدید عضو شده در سیستم",type:"کاربران",date:"۱۴۰۲/۰۸/۲۹",format:"Excel"},{id:3,title:"گزارش موجودی انبار",description:"وضعیت موجودی محصولات در انبار",type:"انبار",date:"۱۴۰۲/۰۸/۲۸",format:"PDF"},{id:4,title:"گزارش درآمد روزانه",description:"جزئیات درآمد حاصل از فروش در ۳۰ روز گذشته",type:"مالی",date:"۱۴۰۲/۰۸/۲۷",format:"Excel"}],i=o=>{console.log("Downloading report:",o)},s=()=>{console.log("Generating new report")};return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"گزارش‌ها و آمار"}),l.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"مشاهده و دانلود گزارش‌های مختلف سیستم"})]}),l.jsxs("div",{className:"flex items-center space-x-4",children:[l.jsxs("select",{value:e,onChange:o=>t(o.target.value),className:"input max-w-xs",children:[l.jsx("option",{value:"week",children:"هفته گذشته"}),l.jsx("option",{value:"month",children:"ماه گذشته"}),l.jsx("option",{value:"quarter",children:"سه ماه گذشته"}),l.jsx("option",{value:"year",children:"سال گذشته"})]}),l.jsxs(te,{onClick:s,children:[l.jsx(uu,{className:"h-4 w-4 ml-2"}),"تولید گزارش جدید"]})]})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6",children:[l.jsx("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"p-3 rounded-full bg-blue-100 dark:bg-blue-900",children:l.jsx(Kp,{className:"h-6 w-6 text-blue-600 dark:text-blue-400"})}),l.jsxs("div",{className:"mr-4",children:[l.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"کل فروش"}),l.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"۱۱۱ میلیون"}),l.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"+۱۲% از ماه قبل"})]})]})}),l.jsx("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"p-3 rounded-full bg-green-100 dark:bg-green-900",children:l.jsx(Zo,{className:"h-6 w-6 text-green-600 dark:text-green-400"})}),l.jsxs("div",{className:"mr-4",children:[l.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"کاربران جدید"}),l.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"۳۲۰"}),l.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"+۸% از ماه قبل"})]})]})}),l.jsx("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"p-3 rounded-full bg-purple-100 dark:bg-purple-900",children:l.jsx(zA,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),l.jsxs("div",{className:"mr-4",children:[l.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"کل سفارشات"}),l.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"۱,۲۵۴"}),l.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"+۱۵% از ماه قبل"})]})]})}),l.jsx("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"p-3 rounded-full bg-yellow-100 dark:bg-yellow-900",children:l.jsx(Pb,{className:"h-6 w-6 text-yellow-600 dark:text-yellow-400"})}),l.jsxs("div",{className:"mr-4",children:[l.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"نرخ رشد"}),l.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"+۲۳%"}),l.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"بهبود یافته"})]})]})})]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"روند فروش"}),l.jsx(_I,{data:r})]}),l.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"رشد کاربران"}),l.jsx(OI,{data:n})]})]}),l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow",children:[l.jsx("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:"گزارش‌های اخیر"})}),l.jsx("div",{className:"p-6",children:l.jsx("div",{className:"space-y-4",children:a.map(o=>l.jsxs("div",{className:"flex items-center justify-between p-4 border border-gray-200 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-900 rounded-lg ml-4",children:l.jsx(uu,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-medium text-gray-900 dark:text-gray-100",children:o.title}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:o.description}),l.jsxs("div",{className:"flex items-center mt-1 space-x-4",children:[l.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-500",children:["نوع: ",o.type]}),l.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-500",children:["تاریخ: ",o.date]}),l.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-500",children:["فرمت: ",o.format]})]})]})]}),l.jsxs(te,{size:"sm",variant:"secondary",onClick:()=>i(o.id),children:[l.jsx(s6,{className:"h-4 w-4 ml-2"}),"دانلود"]})]},o.id))})})]})]})},dde=[{id:1,title:"سفارش جدید دریافت شد",message:"سفارش شماره ۱۰۰۱ از طرف علی احمدی ثبت شد",type:"order",priority:"high",isRead:!1,date:"۱۴۰۲/۰۸/۱۵ - ۱۴:۳۰",sender:"سیستم فروش"},{id:2,title:"محصول در حال اتمام",message:"موجودی لپ‌تاپ ایسوس به کمتر از ۵ عدد رسیده است",type:"warning",priority:"medium",isRead:!1,date:"۱۴۰۲/۰۸/۱۵ - ۱۲:۱۵",sender:"سیستم انبار"},{id:3,title:"کاربر جدید عضو شد",message:"فاطمه حسینی با موفقیت در سیستم ثبت نام کرد",type:"info",priority:"low",isRead:!0,date:"۱۴۰۲/۰۸/۱۴ - ۱۶:۴۵",sender:"سیستم کاربری"},{id:4,title:"پرداخت انجام شد",message:"پرداخت سفارش ۱۰۰۲ با موفقیت تایید شد",type:"success",priority:"medium",isRead:!0,date:"۱۴۰۲/۰۸/۱۴ - ۱۰:۲۰",sender:"سیستم پرداخت"},{id:5,title:"خطا در سیستم",message:"خطا در اتصال به درگاه پرداخت - نیاز به بررسی فوری",type:"error",priority:"high",isRead:!1,date:"۱۴۰۲/۰۸/۱۴ - ۰۹:۱۰",sender:"سیستم مانیتورینگ"},{id:6,title:"بک‌آپ تکمیل شد",message:"بک‌آپ روزانه اطلاعات با موفقیت انجام شد",type:"success",priority:"low",isRead:!0,date:"۱۴۰۲/۰۸/۱۳ - ۲۳:۰۰",sender:"سیستم بک‌آپ"},{id:7,title:"بروزرسانی سیستم",message:"نسخه جدید سیستم منتشر شد - بروزرسانی در دسترس است",type:"info",priority:"medium",isRead:!1,date:"۱۴۰۲/۰۸/۱۳ - ۱۱:۳۰",sender:"تیم توسعه"},{id:8,title:"گزارش فروش آماده شد",message:"گزارش فروش ماهانه تولید و آماده دانلود است",type:"info",priority:"low",isRead:!0,date:"۱۴۰۲/۰۸/۱۲ - ۰۸:۰۰",sender:"سیستم گزارش‌گیری"}],fde=()=>{const[e,t]=N.useState(dde),[r,n]=N.useState(""),[a,i]=N.useState("all"),[s,o]=N.useState(1),c=6,u=v=>{switch(v){case"error":return l.jsx(Hs,{className:"h-5 w-5 text-red-600"});case"warning":return l.jsx(Li,{className:"h-5 w-5 text-yellow-600"});case"success":return l.jsx(Li,{className:"h-5 w-5 text-green-600"});case"info":return l.jsx(_a,{className:"h-5 w-5 text-blue-600"});default:return l.jsx(Li,{className:"h-5 w-5 text-gray-600"})}},d=v=>{switch(v){case"high":return"border-r-red-500";case"medium":return"border-r-yellow-500";case"low":return"border-r-green-500";default:return"border-r-gray-300"}},f=e.filter(v=>{const S=v.title.toLowerCase().includes(r.toLowerCase())||v.message.toLowerCase().includes(r.toLowerCase()),w=a==="all"||a==="unread"&&!v.isRead||a==="read"&&v.isRead||v.type===a;return S&&w}),h=Math.ceil(f.length/c),p=(s-1)*c,m=f.slice(p,p+c),y=v=>{t(S=>S.map(w=>w.id===v?{...w,isRead:!0}:w))},g=()=>{t(v=>v.map(S=>({...S,isRead:!0})))},b=v=>{t(S=>S.filter(w=>w.id!==v))},x=e.filter(v=>!v.isRead).length;return l.jsxs(_r,{children:[l.jsx(Ta,{children:"اعلانات"}),l.jsxs(Xa,{children:[x," اعلان خوانده نشده از ",e.length," اعلان"]}),l.jsxs("div",{className:"flex items-center space-x-4",children:[l.jsxs(te,{variant:"secondary",onClick:g,disabled:x===0,children:[l.jsx(Hs,{className:"h-4 w-4 ml-2"}),"همه را خوانده شده علامت بزن"]}),l.jsxs(te,{children:[l.jsx(Pt,{className:"h-4 w-4 ml-2"}),"اعلان جدید"]})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6",children:[l.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx(Li,{className:"h-8 w-8 text-blue-600"}),l.jsxs("div",{className:"mr-3",children:[l.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"کل اعلانات"}),l.jsx(Xa,{children:e.length})]})]})}),l.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx(Hs,{className:"h-8 w-8 text-red-600"}),l.jsxs("div",{className:"mr-3",children:[l.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"خوانده نشده"}),l.jsx(Xa,{children:x})]})]})}),l.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx(Hs,{className:"h-8 w-8 text-red-600"}),l.jsxs("div",{className:"mr-3",children:[l.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"خطا"}),l.jsx(Xa,{children:e.filter(v=>v.type==="error").length})]})]})}),l.jsx("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx(Li,{className:"h-8 w-8 text-yellow-600"}),l.jsxs("div",{className:"mr-3",children:[l.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"هشدار"}),l.jsx(Xa,{children:e.filter(v=>v.type==="warning").length})]})]})})]}),l.jsxs("div",{className:"card p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none",children:l.jsx(Ab,{className:"h-5 w-5 text-gray-400"})}),l.jsx("input",{type:"text",placeholder:"جستجو در اعلانات...",value:r,onChange:v=>n(v.target.value),className:"input pr-10"})]}),l.jsxs("select",{value:a,onChange:v=>i(v.target.value),className:"input min-w-[150px]",children:[l.jsx("option",{value:"all",children:"همه اعلانات"}),l.jsx("option",{value:"unread",children:"خوانده نشده"}),l.jsx("option",{value:"read",children:"خوانده شده"}),l.jsx("option",{value:"error",children:"خطا"}),l.jsx("option",{value:"warning",children:"هشدار"}),l.jsx("option",{value:"success",children:"موفق"}),l.jsx("option",{value:"info",children:"اطلاعات"})]})]}),l.jsx("div",{className:"space-y-4",children:m.map(v=>l.jsx("div",{className:`p-4 border-r-4 ${d(v.priority)} ${v.isRead?"bg-gray-50 dark:bg-gray-700":"bg-white dark:bg-gray-800"} border border-gray-200 dark:border-gray-600 rounded-lg shadow-sm hover:shadow-md transition-shadow`,children:l.jsxs("div",{className:"flex items-start justify-between",children:[l.jsxs("div",{className:"flex items-start space-x-3",children:[l.jsx("div",{className:"flex-shrink-0 mt-1",children:u(v.type)}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("h3",{className:`text-sm font-medium ${v.isRead?"text-gray-600 dark:text-gray-400":"text-gray-900 dark:text-gray-100"}`,children:v.title}),!v.isRead&&l.jsx("div",{className:"w-2 h-2 bg-blue-600 rounded-full"})]}),l.jsx("p",{className:`mt-1 text-sm ${v.isRead?"text-gray-500 dark:text-gray-500":"text-gray-700 dark:text-gray-300"}`,children:v.message}),l.jsxs("div",{className:"mt-2 flex items-center text-xs text-gray-500 dark:text-gray-500 space-x-4",children:[l.jsx("span",{children:v.date}),l.jsxs("span",{children:["از: ",v.sender]})]})]})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[!v.isRead&&l.jsx(te,{size:"sm",variant:"secondary",onClick:()=>y(v.id),children:l.jsx(Hs,{className:"h-4 w-4"})}),l.jsx(te,{size:"sm",variant:"danger",onClick:()=>b(v.id),children:l.jsx(Hs,{className:"h-4 w-4"})})]})]})},v.id))}),m.length===0&&l.jsxs("div",{className:"text-center py-12",children:[l.jsx(Li,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),l.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"هیچ اعلانی یافت نشد"})]}),l.jsx(iw,{currentPage:s,totalPages:h,onPageChange:o,itemsPerPage:c,totalItems:f.length})]})]})},hde=[{title:"داشبورد",icon:FA,path:"/"},{title:"مدیریت محصولات",icon:Ss,children:[{title:"محصولات",icon:Ss,path:"/products"},{title:"دسته‌بندی‌ها",icon:I0,path:"/categories"},{title:"گزینه‌های محصول",icon:p6,path:"/product-options"}]},{title:"مدیریت سیستم",icon:du,children:[{title:"نقش‌ها",icon:yh,path:"/roles",permission:22},{title:"کاربران ادمین",icon:M0,path:"/admin-users",permission:22},{title:"دسترسی‌ها",icon:UA,path:"/permissions",permission:22}]}],pde=({isOpen:e,onClose:t})=>{var c,u;const{user:r,logout:n}=hd(),[a,i]=A.useState([]),s=d=>{i(f=>f.includes(d)?f.filter(h=>h!==d):[...f,d])},o=(d,f=0)=>{const h=d.children&&d.children.length>0,p=a.includes(d.title),m=f*16;if(h)return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("button",{onClick:()=>s(d.title),className:`w-full flex items-center px-4 py-3 text-sm font-medium rounded-lg transition-colors - text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700`,style:{paddingLeft:`${m+16}px`},children:[l.jsx(d.icon,{className:"ml-3 h-5 w-5"}),l.jsx("span",{className:"flex-1 text-right",children:d.title}),p?l.jsx(Nb,{className:"h-4 w-4"}):l.jsx(LA,{className:"h-4 w-4"})]}),p&&d.children&&l.jsx("div",{className:"space-y-1",children:d.children.map(g=>o(g,f+1))})]},d.title);const y=l.jsxs(v4,{to:d.path,onClick:()=>{window.innerWidth<1024&&t()},className:({isActive:g})=>`w-full flex items-center px-4 py-3 text-sm font-medium rounded-lg transition-colors ${g?"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:`${m+16}px`},children:[l.jsx(d.icon,{className:"ml-3 h-5 w-5"}),d.title]});return d.permission?l.jsx(kl,{permission:d.permission,children:y},d.title):l.jsx("div",{children:y},d.title)};return l.jsxs(l.Fragment,{children:[e&&l.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-40 lg:hidden",onClick:t}),l.jsxs("div",{className:` - fixed lg:static inset-y-0 right-0 z-50 - w-64 transform transition-transform duration-300 ease-in-out - lg:translate-x-0 lg:block - ${e?"translate-x-0":"translate-x-full lg:translate-x-0"} - flex flex-col bg-white dark:bg-gray-800 border-l border-gray-200 dark:border-gray-700 - `,children:[l.jsxs("div",{className:"lg:hidden flex justify-between items-center p-4 border-b border-gray-200 dark:border-gray-700",children:[l.jsx(xn,{children:"پنل مدیریت"}),l.jsx("button",{onClick:t,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700",children:l.jsx(pd,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})})]}),l.jsx("div",{className:"hidden lg:flex h-16 items-center justify-center border-b border-gray-200 dark:border-gray-700",children:l.jsx(xn,{children:"پنل مدیریت"})}),l.jsx("nav",{className:"flex-1 space-y-1 px-4 py-6 overflow-y-auto",children:hde.map(d=>o(d))}),l.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4",children:l.jsxs("div",{className:"flex items-center space-x-3 space-x-reverse",children:[l.jsx("div",{className:"h-8 w-8 rounded-full bg-primary-600 flex items-center justify-center",children:l.jsxs("span",{className:"text-sm font-medium text-white",children:[(c=r==null?void 0:r.first_name)==null?void 0:c[0],(u=r==null?void 0:r.last_name)==null?void 0:u[0]]})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs(Yj,{children:[r==null?void 0:r.first_name," ",r==null?void 0:r.last_name]}),l.jsx(Yj,{children:r==null?void 0:r.username})]}),l.jsx("button",{onClick:n,className:"text-gray-500 hover:text-red-600 dark:text-gray-400 dark:hover:text-red-400",children:l.jsx(BA,{className:"h-5 w-5"})})]})})]})]})},mde=({onMenuClick:e})=>{var o;const{user:t,logout:r}=hd(),{mode:n,toggleTheme:a}=QD(),[i,s]=N.useState(!1);return l.jsx("header",{className:"bg-white dark:bg-gray-800 shadow-sm border-b border-gray-200 dark:border-gray-700",children:l.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[l.jsxs("div",{className:"flex items-center space-x-4 space-x-reverse",children:[l.jsx("button",{onClick:e,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 lg:hidden",children:l.jsx(d6,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})}),l.jsx(xn,{children:"خوش آمدید"})]}),l.jsxs("div",{className:"flex items-center space-x-2 space-x-reverse",children:[l.jsx("button",{onClick:a,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:n==="dark"?l.jsx(m6,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):l.jsx(f6,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})}),l.jsxs("button",{className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors relative",children:[l.jsx(Li,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),l.jsx("span",{className:"absolute top-0 left-0 w-2 h-2 bg-red-500 rounded-full"})]}),l.jsxs("div",{className:"relative",children:[l.jsxs("button",{onClick:()=>s(!i),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:[l.jsx("div",{className:"w-8 h-8 bg-primary-600 rounded-full flex items-center justify-center",children:l.jsx("span",{className:"text-white text-sm font-medium",children:((o=t==null?void 0:t.first_name)==null?void 0:o.charAt(0))||"A"})}),l.jsxs("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 hidden sm:block",children:[t==null?void 0:t.first_name," ",t==null?void 0:t.last_name]})]}),i&&l.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:l.jsxs("div",{className:"py-1",children:[l.jsxs("div",{className:"px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:[l.jsxs("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:[t==null?void 0:t.first_name," ",t==null?void 0:t.last_name]}),l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:t==null?void 0:t.username})]}),l.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:[l.jsx(Tb,{className:"h-4 w-4 ml-2"}),"پروفایل"]}),l.jsxs("button",{onClick:()=>{r(),s(!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:[l.jsx(BA,{className:"h-4 w-4 ml-2"}),"خروج"]})]})})]})]})]})})},yde=()=>{const[e,t]=N.useState(!1);return l.jsxs("div",{className:"flex h-screen bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[l.jsx(pde,{isOpen:e,onClose:()=>t(!1)}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[l.jsx(mde,{onMenuClick:()=>t(!0)}),l.jsx("main",{className:"flex-1 overflow-y-auto bg-gray-50 dark:bg-gray-900",children:l.jsx("div",{className:"min-h-full",children:l.jsx(a4,{})})})]})]})},gde=async e=>{try{const t={};e!=null&&e.search&&(t.search=e.search),e!=null&&e.page&&(t.page=e.page),e!=null&&e.limit&&(t.limit=e.limit);const r=await Or(Oe(ke.GET_ROLES,t));return console.log("Roles API Response:",r),console.log("Roles data:",r.data),r.data&&r.data.roles&&Array.isArray(r.data.roles)?r.data.roles:(console.warn("Roles is null or not an array:",r.data),[])}catch(t){return console.error("Error fetching roles:",t),[]}},vde=async e=>{try{const t=await Or(Oe(ke.GET_ROLE(e)));if(console.log("Role API Response:",t),t.data&&t.data.role)return t.data.role;if(t.data)return t.data;throw new Error("No role data found in response")}catch(t){throw console.error("Error fetching role:",t),t}},xde=async e=>(await Ca(Oe(ke.CREATE_ROLE),e)).data,bde=async(e,t)=>(await Ml(Oe(ke.UPDATE_ROLE(e)),t)).data,wde=async e=>(await Fs(Oe(ke.DELETE_ROLE(e)))).data,jde=async e=>{try{const t=await Or(Oe(ke.GET_ROLE_PERMISSIONS(e)));return console.log("Role Permissions API Response:",t),console.log("Role Permissions data:",t.data),t.data&&t.data.permissions&&Array.isArray(t.data.permissions)?t.data.permissions:(console.warn("Role Permissions is null or not an array:",t.data),[])}catch(t){return console.error("Error fetching role permissions:",t),[]}},Sde=async(e,t)=>(await Ca(Oe(ke.ASSIGN_ROLE_PERMISSION(e,t)),{})).data,kde=async(e,t)=>(await Fs(Oe(ke.REMOVE_ROLE_PERMISSION(e,t)))).data,_de=async()=>(await Or(Oe(ke.GET_PERMISSIONS))).data,NI=e=>kr({queryKey:[de.GET_ROLES,e],queryFn:()=>gde(e)}),sw=e=>kr({queryKey:[de.GET_ROLE,e],queryFn:()=>vde(e),enabled:!!e}),Ode=()=>{const e=yt();return ft({mutationFn:t=>xde(t),onSuccess:()=>{e.invalidateQueries({queryKey:[de.GET_ROLES]}),ye.success("نقش با موفقیت ایجاد شد")},onError:t=>{ye.error((t==null?void 0:t.message)||"خطا در ایجاد نقش")}})},Nde=()=>{const e=yt();return ft({mutationFn:t=>bde(t.id.toString(),t),onSuccess:t=>{e.invalidateQueries({queryKey:[de.GET_ROLES]}),e.invalidateQueries({queryKey:[de.GET_ROLE,t.id.toString()]}),ye.success("نقش با موفقیت به‌روزرسانی شد")},onError:t=>{ye.error((t==null?void 0:t.message)||"خطا در به‌روزرسانی نقش")}})},Ede=()=>{const e=yt();return ft({mutationFn:t=>wde(t),onSuccess:()=>{e.invalidateQueries({queryKey:[de.GET_ROLES]}),ye.success("نقش با موفقیت حذف شد")},onError:t=>{ye.error((t==null?void 0:t.message)||"خطا در حذف نقش")}})},Ade=e=>kr({queryKey:[de.GET_ROLE_PERMISSIONS,e],queryFn:()=>jde(e),enabled:!!e}),Pde=()=>{const e=yt();return ft({mutationFn:({roleId:t,permissionId:r})=>Sde(t,r),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:[de.GET_ROLE_PERMISSIONS,r.roleId]}),e.invalidateQueries({queryKey:[de.GET_ROLE,r.roleId]}),ye.success("دسترسی با موفقیت اختصاص داده شد")},onError:t=>{ye.error((t==null?void 0:t.message)||"خطا در اختصاص دسترسی")}})},Tde=()=>{const e=yt();return ft({mutationFn:({roleId:t,permissionId:r})=>kde(t,r),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:[de.GET_ROLE_PERMISSIONS,r.roleId]}),e.invalidateQueries({queryKey:[de.GET_ROLE,r.roleId]}),ye.success("دسترسی با موفقیت حذف شد")},onError:t=>{ye.error((t==null?void 0:t.message)||"خطا در حذف دسترسی")}})},Cde=()=>kr({queryKey:[de.GET_PERMISSIONS],queryFn:()=>_de()}),$de=()=>l.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[l.jsx("div",{className:"hidden md:block",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[l.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام نقش"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"توضیحات"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),l.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:[...Array(5)].map((e,t)=>l.jsxs("tr",{className:"animate-pulse",children:[l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-32"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-48"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-20"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"})]})})]},t))})]})})}),l.jsx("div",{className:"md:hidden p-4 space-y-4",children:[...Array(3)].map((e,t)=>l.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 animate-pulse",children:l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"h-5 bg-gray-300 dark:bg-gray-600 rounded w-3/4"}),l.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-full"}),l.jsx("div",{className:"h-3 bg-gray-300 dark:bg-gray-600 rounded w-1/3"}),l.jsxs("div",{className:"flex gap-2 pt-2",children:[l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"})]})]})},t))})]}),Ide=()=>{const e=St(),[t,r]=N.useState(null),[n,a]=N.useState({search:""}),{data:i,isLoading:s,error:o}=NI(n),{mutate:c,isPending:u}=Ede(),d=()=>{e("/roles/create")},f=b=>{e(`/roles/${b}`)},h=b=>{e(`/roles/${b}/edit`)},p=b=>{e(`/roles/${b}/permissions`)},m=()=>{t&&c(t,{onSuccess:()=>{r(null)}})},y=b=>{a(x=>({...x,search:b.target.value}))},g=()=>{r(null)};return o?l.jsx("div",{className:"p-6",children:l.jsx("div",{className:"text-center py-12",children:l.jsx("p",{className:"text-red-600 dark:text-red-400",children:"خطا در بارگذاری نقش‌ها"})})}):l.jsxs(_r,{children:[l.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:items-center sm:justify-between sm:space-y-0",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(M0,{className:"h-6 w-6"}),l.jsx(Ta,{children:"مدیریت نقش‌ها"})]}),l.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"مدیریت نقش‌ها و دسترسی‌های سیستم"})]}),l.jsx("button",{onClick:d,className:"flex items-center justify-center w-12 h-12 bg-primary-600 hover:bg-primary-700 rounded-full transition-colors duration-200 text-white shadow-lg hover:shadow-xl",title:"نقش جدید",children:l.jsx(Pt,{className:"h-5 w-5"})})]}),l.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"جستجو"}),l.jsx("input",{type:"text",placeholder:"جستجو در نام یا توضیحات نقش...",value:n.search,onChange:y,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"})]})})}),s?l.jsx($de,{}):(i||[]).length===0?l.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg",children:l.jsxs("div",{className:"text-center py-12",children:[l.jsx(M0,{className:"h-12 w-12 text-gray-400 dark:text-gray-500 mx-auto mb-4"}),l.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-2",children:"هیچ نقش یافت نشد"}),l.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:n.search?"نتیجه‌ای برای جستجوی شما یافت نشد":"شما هنوز هیچ نقش ایجاد نکرده‌اید"}),l.jsxs(te,{onClick:d,className:"flex items-center gap-2",children:[l.jsx(Pt,{className:"h-4 w-4 ml-2"}),"اولین نقش را ایجاد کنید"]})]})}):l.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[l.jsx("div",{className:"hidden md:block",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[l.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام نقش"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"توضیحات"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),l.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:(i||[]).map(b=>l.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:b.title}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:b.description}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:new Date(b.created_at).toLocaleDateString("fa-IR")}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>f(b.id),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",title:"مشاهده",children:l.jsx(_a,{className:"h-4 w-4"})}),l.jsx("button",{onClick:()=>h(b.id),className:"text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",title:"ویرایش",children:l.jsx(Nn,{className:"h-4 w-4"})}),l.jsx("button",{onClick:()=>p(b.id),className:"text-green-600 hover:text-green-900 dark:text-green-400 dark:hover:text-green-300",title:"مدیریت دسترسی‌ها",children:l.jsx(du,{className:"h-4 w-4"})}),l.jsx("button",{onClick:()=>r(b.id.toString()),className:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",title:"حذف",children:l.jsx(Yt,{className:"h-4 w-4"})})]})})]},b.id))})]})})}),l.jsx("div",{className:"md:hidden p-4 space-y-4",children:(i||[]).map(b=>l.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[l.jsx("div",{className:"flex justify-between items-start mb-2",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:b.title}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:b.description})]})}),l.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:["تاریخ ایجاد: ",new Date(b.created_at).toLocaleDateString("fa-IR")]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>f(b.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",children:[l.jsx(_a,{className:"h-3 w-3"}),"مشاهده"]}),l.jsxs("button",{onClick:()=>h(b.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",children:[l.jsx(Nn,{className:"h-3 w-3"}),"ویرایش"]}),l.jsxs("button",{onClick:()=>p(b.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-green-600 hover:text-green-900 dark:text-green-400 dark:hover:text-green-300",children:[l.jsx(du,{className:"h-3 w-3"}),"دسترسی‌ها"]}),l.jsxs("button",{onClick:()=>r(b.id.toString()),className:"flex items-center gap-1 px-2 py-1 text-xs text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",children:[l.jsx(Yt,{className:"h-3 w-3"}),"حذف"]})]})]},b.id))})]}),l.jsx(Ws,{isOpen:!!t,onClose:g,title:"تأیید حذف",size:"sm",children:l.jsxs("div",{className:"space-y-4",children:[l.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"آیا از حذف این نقش اطمینان دارید؟ این عمل قابل بازگشت نیست."}),l.jsxs("div",{className:"flex justify-end gap-3",children:[l.jsx(te,{variant:"secondary",onClick:g,children:"انصراف"}),l.jsx(te,{variant:"danger",onClick:m,loading:u,children:"حذف"})]})]})})]})},Rde=jr({title:Se().required("نام نقش الزامی است").min(2,"نام نقش باید حداقل ۲ کاراکتر باشد"),description:Se().required("توضیحات الزامی است").min(5,"توضیحات باید حداقل ۵ کاراکتر باشد")}),$N=()=>{var g;const e=St(),{id:t}=Kn(),r=!!t,{data:n,isLoading:a}=sw(t||""),{mutate:i,isPending:s}=Ode(),{mutate:o,isPending:c}=Nde(),{register:u,handleSubmit:d,formState:{errors:f,isValid:h},reset:p}=Rs({resolver:Ms(Rde),mode:"onChange"});N.useEffect(()=>{r&&n&&p({title:n.title,description:n.description})},[r,n,p]);const m=b=>{r&&t?o({id:parseInt(t),...b},{onSuccess:()=>{e("/roles")}}):i(b,{onSuccess:()=>{e("/roles")}})};if(r&&a)return l.jsx(Mr,{});const y=s||c;return l.jsxs(_r,{children:[l.jsx(Cl,{title:r?"ویرایش نقش":"ایجاد نقش جدید",actions:l.jsxs(te,{variant:"secondary",onClick:()=>e("/roles"),className:"flex items-center gap-2",children:[l.jsx(Qn,{className:"h-4 w-4"}),"بازگشت"]})}),l.jsx("div",{className:"max-w-2xl",children:l.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:l.jsxs("form",{onSubmit:d(m),className:"space-y-6",children:[l.jsx(tt,{label:"نام نقش",type:"text",placeholder:"نام نقش را وارد کنید",error:(g=f.title)==null?void 0:g.message,...u("title")}),l.jsxs("div",{className:"space-y-1",children:[l.jsx(fu,{htmlFor:"description",children:"توضیحات"}),l.jsx("textarea",{id:"description",placeholder:"توضیحات نقش را وارد کنید",className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 resize-none h-24 ${f.description?"border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600"} dark:bg-gray-700 dark:text-gray-100`,...u("description")}),f.description&&l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:f.description.message})]}),l.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[l.jsx(te,{type:"button",variant:"secondary",onClick:()=>e("/roles"),children:"انصراف"}),l.jsx(te,{type:"submit",variant:"primary",loading:y,disabled:!h,children:r?"به‌روزرسانی":"ایجاد"})]})]})})})]})},Mde=()=>{var i;const e=St(),{id:t=""}=Kn(),{data:r,isLoading:n,error:a}=sw(t);return n?l.jsx(Mr,{}):a?l.jsx("div",{className:"text-red-600",children:"خطا در بارگذاری اطلاعات نقش"}):r?l.jsxs("div",{className:"p-6",children:[l.jsx("div",{className:"mb-6",children:l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs(te,{variant:"secondary",onClick:()=>e("/roles"),className:"flex items-center gap-2",children:[l.jsx(Qn,{className:"h-4 w-4"}),"بازگشت"]}),l.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"جزئیات نقش"})]}),l.jsxs("div",{className:"flex gap-3",children:[l.jsxs(te,{variant:"primary",onClick:()=>e(`/roles/${t}/permissions`),className:"flex items-center gap-2",children:[l.jsx(Zo,{className:"h-4 w-4"}),"مدیریت دسترسی‌ها"]}),l.jsxs(te,{variant:"secondary",onClick:()=>e(`/roles/${t}/edit`),className:"flex items-center gap-2",children:[l.jsx(Eb,{className:"h-4 w-4"}),"ویرایش"]})]})]})}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[l.jsx("div",{className:"lg:col-span-2",children:l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-6",children:"اطلاعات نقش"}),l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"نام نقش"}),l.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:l.jsx("p",{className:"text-gray-900 dark:text-gray-100 font-medium",children:r.title})})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"توضیحات"}),l.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:l.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:r.description})})]})]})]})}),l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"آمار"}),l.jsx("div",{className:"space-y-4",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Zo,{className:"h-4 w-4 text-blue-500"}),l.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تعداد دسترسی‌ها"})]}),l.jsx("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:((i=r.permissions)==null?void 0:i.length)||0})]})})]}),l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"اطلاعات زمانی"}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx(Ob,{className:"h-4 w-4 text-green-500"}),l.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تاریخ ایجاد"})]}),l.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:new Date(r.created_at).toLocaleDateString("fa-IR")})]}),l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx(uu,{className:"h-4 w-4 text-orange-500"}),l.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"آخرین به‌روزرسانی"})]}),l.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:new Date(r.updated_at).toLocaleDateString("fa-IR")})]})]})]})]})]}),r.permissions&&r.permissions.length>0&&l.jsx("div",{className:"mt-6",children:l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"دسترسی‌های تخصیص یافته"}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:r.permissions.map(s=>l.jsxs("div",{className:"p-3 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[l.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:s.title}),l.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:s.description})]},s.id))})]})})]}):l.jsx("div",{children:"نقش یافت نشد"})},Dde=()=>{const e=St(),{id:t=""}=Kn();N.useState(!1);const[r,n]=N.useState(null),{data:a,isLoading:i}=sw(t),{data:s,isLoading:o}=Ade(t),{data:c,isLoading:u}=Cde(),d=(s||[]).map(w=>w.id),h=(Array.isArray(c==null?void 0:c.permissions)?c.permissions:[]).filter(w=>!d.includes(w.id)),{mutate:p,isPending:m}=Pde(),{mutate:y,isPending:g}=Tde(),b=w=>{p({roleId:t,permissionId:w.toString()})},x=w=>{n(w.toString())},v=()=>{r&&y({roleId:t,permissionId:r},{onSuccess:()=>{n(null)}})};return i||o?l.jsx(Mr,{}):a?l.jsx("div",{className:"p-6",children:l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs(te,{variant:"secondary",onClick:()=>e("/roles"),className:"flex items-center gap-2",children:[l.jsx(Qn,{className:"h-4 w-4"}),"بازگشت"]}),l.jsxs("div",{children:[l.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:["مدیریت دسترسی‌های نقش: ",a==null?void 0:a.title]}),l.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"تخصیص و حذف دسترسی‌ها برای این نقش"})]})]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md",children:[l.jsx("div",{className:"p-6 border-b border-gray-200 dark:border-gray-700",children:l.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:["دسترسی‌های تخصیص یافته (",(s||[]).length,")"]})}),l.jsx("div",{className:"p-6",children:o?l.jsx("div",{className:"flex justify-center",children:l.jsx(Mr,{})}):l.jsx("div",{className:"space-y-3",children:(s||[]).length>0?(s||[]).map(w=>l.jsxs("div",{className:"flex items-center justify-between p-3 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx("h4",{className:"font-medium text-green-900 dark:text-green-100",children:w.title}),l.jsx("p",{className:"text-sm text-green-700 dark:text-green-300",children:w.description})]}),l.jsxs(te,{size:"sm",variant:"danger",onClick:()=>x(w.id),className:"flex items-center gap-1 ml-3",children:[l.jsx(Yt,{className:"h-3 w-3"}),"حذف"]})]},w.id)):l.jsx("p",{className:"text-center text-gray-500 dark:text-gray-400 py-8",children:"هیچ دسترسی تخصیص داده نشده است"})})})]}),l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md",children:[l.jsx("div",{className:"p-6 border-b border-gray-200 dark:border-gray-700",children:l.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:["دسترسی‌های قابل تخصیص (",h.length,")"]})}),l.jsx("div",{className:"p-6",children:u?l.jsx("div",{className:"flex justify-center",children:l.jsx(Mr,{})}):l.jsx("div",{className:"space-y-3",children:h.length>0?h.map(w=>l.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx("h4",{className:"font-medium text-gray-900 dark:text-gray-100",children:w.title}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:w.description})]}),l.jsxs(te,{size:"sm",variant:"primary",onClick:()=>b(w.id),className:"flex items-center gap-1 ml-3",loading:m,children:[l.jsx(Pt,{className:"h-3 w-3"}),"اختصاص"]})]},w.id)):l.jsx("p",{className:"text-center text-gray-500 dark:text-gray-400 py-8",children:"تمام دسترسی‌ها به این نقش تخصیص داده شده است"})})})]})]}),l.jsx(Ws,{isOpen:!!r,onClose:()=>n(null),title:"حذف دسترسی",children:l.jsxs("div",{className:"space-y-4",children:[l.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"آیا از حذف این دسترسی از نقش اطمینان دارید؟"}),l.jsxs("div",{className:"flex justify-end space-x-2 space-x-reverse",children:[l.jsx(te,{variant:"secondary",onClick:()=>n(null),disabled:g,children:"انصراف"}),l.jsx(te,{variant:"danger",onClick:v,loading:g,children:"حذف"})]})]})})]})}):l.jsx("div",{className:"text-red-600",children:"نقش یافت نشد"})},Lde=async e=>{try{const t={};e!=null&&e.search&&(t.search=e.search),e!=null&&e.status&&(t.status=e.status),e!=null&&e.page&&(t.page=e.page),e!=null&&e.limit&&(t.limit=e.limit);const r=Oe(ke.GET_ADMIN_USERS,t);console.log("🔍 Admin Users URL:",r),console.log("🔍 API_ROUTES.GET_ADMIN_USERS:",ke.GET_ADMIN_USERS);const n=await Or(r);return console.log("Admin Users API Response:",n),console.log("Admin Users data:",n.data),n.data&&n.data.admin_users?Array.isArray(n.data.admin_users)?n.data.admin_users:[]:n.data&&n.data.users?Array.isArray(n.data.users)?n.data.users:[]:n.data&&Array.isArray(n.data)?n.data:[]}catch(t){return console.error("Error fetching admin users:",t),[]}},Fde=async e=>{try{const t=await Or(Oe(ke.GET_ADMIN_USER(e)));if(console.log("Get Admin User API Response:",t),console.log("Get Admin User data:",t.data),t.data&&t.data.admin_user)return t.data.admin_user;if(t.data&&t.data.user)return t.data.user;throw new Error("Failed to get admin user")}catch(t){throw console.error("Error getting admin user:",t),t}},Ude=async e=>{try{console.log("🚀 Creating admin user with data:",e);const t=await Ca(Oe(ke.CREATE_ADMIN_USER),e);if(console.log("✅ Create Admin User API Response:",t),console.log("📊 Response data:",t.data),t.data&&t.data.admin_user)return console.log("✅ Returning admin_user from response"),t.data.admin_user;if(t.data&&t.data.user)return console.log("✅ Returning user from response"),t.data.user;throw console.log("⚠️ Response structure unexpected, throwing error"),new Error("Failed to create admin user")}catch(t){throw console.error("❌ Error creating admin user:",t),t}},Bde=async(e,t)=>{try{const r=await Ml(Oe(ke.UPDATE_ADMIN_USER(e)),t);if(console.log("Update Admin User API Response:",r),console.log("Update Admin User data:",r.data),r.data&&r.data.admin_user)return r.data.admin_user;if(r.data&&r.data.user)return r.data.user;throw new Error("Failed to update admin user")}catch(r){throw console.error("Error updating admin user:",r),r}},zde=async e=>{try{return(await Fs(Oe(ke.DELETE_ADMIN_USER(e)))).data}catch(t){throw console.error("Error deleting admin user:",t),t}},Vde=e=>kr({queryKey:[de.GET_ADMIN_USERS,e],queryFn:()=>Lde(e)}),EI=(e,t=!0)=>kr({queryKey:[de.GET_ADMIN_USER,e],queryFn:()=>Fde(e),enabled:t&&!!e}),qde=()=>{const e=yt();return ft({mutationKey:[de.CREATE_ADMIN_USER],mutationFn:t=>Ude(t),onSuccess:t=>{e.invalidateQueries({queryKey:[de.GET_ADMIN_USERS]}),ye.success("کاربر ادمین با موفقیت ایجاد شد")},onError:t=>{console.error("Create admin user error:",t),ye.error((t==null?void 0:t.message)||"خطا در ایجاد کاربر ادمین")}})},Wde=()=>{const e=yt();return ft({mutationKey:[de.UPDATE_ADMIN_USER],mutationFn:({id:t,userData:r})=>Bde(t,r),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:[de.GET_ADMIN_USERS]}),e.invalidateQueries({queryKey:[de.GET_ADMIN_USER,r.id]}),ye.success("کاربر ادمین با موفقیت به‌روزرسانی شد")},onError:t=>{console.error("Update admin user error:",t),ye.error((t==null?void 0:t.message)||"خطا در به‌روزرسانی کاربر ادمین")}})},Gde=()=>{const e=yt();return ft({mutationKey:[de.DELETE_ADMIN_USER],mutationFn:t=>zde(t),onSuccess:()=>{e.invalidateQueries({queryKey:[de.GET_ADMIN_USERS]}),ye.success("کاربر ادمین با موفقیت حذف شد")},onError:t=>{console.error("Delete admin user error:",t),ye.error((t==null?void 0:t.message)||"خطا در حذف کاربر ادمین")}})},Hde=()=>l.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[l.jsx("div",{className:"hidden md:block",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[l.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام و نام خانوادگی"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام کاربری"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"وضعیت"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),l.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:[...Array(5)].map((e,t)=>l.jsxs("tr",{className:"animate-pulse",children:[l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-32"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-24"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-6 bg-gray-300 dark:bg-gray-600 rounded-full w-16"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-20"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"})]})})]},t))})]})})}),l.jsx("div",{className:"md:hidden p-4 space-y-4",children:[...Array(3)].map((e,t)=>l.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 animate-pulse",children:l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"h-5 bg-gray-300 dark:bg-gray-600 rounded w-3/4"}),l.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-1/2"}),l.jsx("div",{className:"h-6 bg-gray-300 dark:bg-gray-600 rounded-full w-16"}),l.jsxs("div",{className:"flex gap-2 pt-2",children:[l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"})]})]})},t))})]}),Kde=()=>{const e=St(),[t,r]=N.useState(null),[n,a]=N.useState({search:"",status:""}),{data:i,isLoading:s,error:o}=Vde(n),{mutate:c,isPending:u}=Gde(),d=()=>{e("/admin-users/create")},f=g=>{e(`/admin-users/${g}`)},h=g=>{e(`/admin-users/${g}/edit`)},p=()=>{t&&c(t,{onSuccess:()=>{r(null)}})},m=g=>{a(b=>({...b,search:g.target.value}))},y=g=>{a(b=>({...b,status:g.target.value}))};return o?l.jsx("div",{className:"p-6",children:l.jsx("div",{className:"text-center py-12",children:l.jsx("p",{className:"text-red-600 dark:text-red-400",children:"خطا در بارگذاری کاربران ادمین"})})}):l.jsxs(_r,{children:[l.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:items-center sm:justify-between sm:space-y-0",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(Zo,{className:"h-6 w-6"}),l.jsx(Ta,{children:"مدیریت کاربران ادمین"})]}),l.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"مدیریت کاربران دسترسی به پنل ادمین"})]}),l.jsx("button",{onClick:d,className:"flex items-center justify-center w-12 h-12 bg-primary-600 hover:bg-primary-700 rounded-full transition-colors duration-200 text-white shadow-lg hover:shadow-xl",title:"کاربر ادمین جدید",children:l.jsx(Pt,{className:"h-5 w-5"})})]}),l.jsx(bh,{children:"فیلترها"}),l.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"جستجو"}),l.jsx("input",{type:"text",placeholder:"جستجو در نام، نام خانوادگی یا نام کاربری...",value:n.search,onChange:m,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"وضعیت"}),l.jsxs("select",{value:n.status,onChange:y,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",children:[l.jsx("option",{value:"",children:"همه"}),l.jsx("option",{value:"active",children:"فعال"}),l.jsx("option",{value:"deactive",children:"غیرفعال"})]})]})]})}),s?l.jsx(Hde,{}):(i||[]).length===0?l.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg",children:l.jsxs("div",{className:"text-center py-12",children:[l.jsx(Zo,{className:"h-12 w-12 text-gray-400 dark:text-gray-500 mx-auto mb-4"}),l.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-2",children:"هیچ کاربر ادمین یافت نشد"}),l.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:n.search||n.status?"نتیجه‌ای برای جستجوی شما یافت نشد":"شما هنوز هیچ کاربر ادمین ایجاد نکرده‌اید"}),l.jsxs(te,{onClick:d,children:[l.jsx(v6,{className:"h-4 w-4 ml-2"}),"اولین کاربر ادمین را ایجاد کنید"]})]})}):l.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[l.jsx("div",{className:"hidden md:block",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[l.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام و نام خانوادگی"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام کاربری"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"وضعیت"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),l.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:(i||[]).map(g=>l.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[l.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:[g.first_name," ",g.last_name]}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:g.username}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${g.status==="active"?"bg-green-100 text-green-800 dark:bg-green-800 dark:text-green-100":"bg-red-100 text-red-800 dark:bg-red-800 dark:text-red-100"}`,children:g.status==="active"?"فعال":"غیرفعال"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:new Date(g.created_at).toLocaleDateString("fa-IR")}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>f(g.id),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",title:"مشاهده",children:l.jsx(_a,{className:"h-4 w-4"})}),l.jsx("button",{onClick:()=>h(g.id),className:"text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",title:"ویرایش",children:l.jsx(Nn,{className:"h-4 w-4"})}),l.jsx("button",{onClick:()=>r(g.id.toString()),className:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",title:"حذف",children:l.jsx(Yt,{className:"h-4 w-4"})})]})})]},g.id))})]})})}),l.jsx("div",{className:"md:hidden p-4 space-y-4",children:(i||[]).map(g=>l.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[l.jsxs("div",{className:"flex justify-between items-start mb-2",children:[l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:[g.first_name," ",g.last_name]}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:g.username})]}),l.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${g.status==="active"?"bg-green-100 text-green-800 dark:bg-green-800 dark:text-green-100":"bg-red-100 text-red-800 dark:bg-red-800 dark:text-red-100"}`,children:g.status==="active"?"فعال":"غیرفعال"})]}),l.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:["تاریخ ایجاد: ",new Date(g.created_at).toLocaleDateString("fa-IR")]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>f(g.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",children:[l.jsx(_a,{className:"h-3 w-3"}),"مشاهده"]}),l.jsxs("button",{onClick:()=>h(g.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",children:[l.jsx(Nn,{className:"h-3 w-3"}),"ویرایش"]}),l.jsxs("button",{onClick:()=>r(g.id.toString()),className:"flex items-center gap-1 px-2 py-1 text-xs text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",children:[l.jsx(Yt,{className:"h-3 w-3"}),"حذف"]})]})]},g.id))})]}),l.jsx(Ws,{isOpen:!!t,onClose:()=>r(null),title:"حذف کاربر ادمین",children:l.jsxs("div",{className:"space-y-4",children:[l.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"آیا از حذف این کاربر ادمین اطمینان دارید؟ این عمل قابل بازگشت نیست."}),l.jsxs("div",{className:"flex justify-end space-x-2 space-x-reverse",children:[l.jsx(te,{variant:"secondary",onClick:()=>r(null),disabled:u,children:"انصراف"}),l.jsx(te,{variant:"danger",onClick:p,loading:u,children:"حذف"})]})]})})]})},Qde=async e=>{try{const t={};e!=null&&e.search&&(t.search=e.search),e!=null&&e.page&&(t.page=e.page),e!=null&&e.limit&&(t.limit=e.limit);const r=await Or(Oe(ke.GET_PERMISSIONS,t));return console.log("Permissions API Response:",r),console.log("Permissions data:",r.data),r.data&&r.data.permissions&&Array.isArray(r.data.permissions)?r.data.permissions:(console.warn("Permissions is null or not an array:",r.data),[])}catch(t){return console.error("Error fetching permissions:",t),[]}},Xde=async e=>{try{const t=await Or(Oe(ke.GET_PERMISSION(e)));if(t.data&&t.data.permission)return t.data.permission;throw new Error("Permission not found")}catch(t){throw console.error("Error fetching permission:",t),t}},Yde=async e=>{try{const t=await Ca(Oe(ke.CREATE_PERMISSION),e);if(t.data&&t.data.permission)return t.data.permission;throw new Error("Failed to create permission")}catch(t){throw console.error("Error creating permission:",t),t}},Zde=async(e,t)=>{try{const r=await Ml(Oe(ke.UPDATE_PERMISSION(e)),t);if(r.data&&r.data.permission)return r.data.permission;throw new Error("Failed to update permission")}catch(r){throw console.error("Error updating permission:",r),r}},AI=e=>kr({queryKey:[de.GET_PERMISSIONS,e],queryFn:()=>Qde(e)}),Jde=(e,t=!0)=>kr({queryKey:[de.GET_PERMISSION,e],queryFn:()=>Xde(e),enabled:t&&!!e}),efe=()=>{const e=yt();return ft({mutationKey:[de.CREATE_PERMISSION],mutationFn:t=>Yde(t),onSuccess:t=>{e.invalidateQueries({queryKey:[de.GET_PERMISSIONS]}),e.invalidateQueries({queryKey:[de.GET_ROLE_PERMISSIONS]}),ye.success("دسترسی با موفقیت ایجاد شد")},onError:t=>{console.error("Create permission error:",t),ye.error((t==null?void 0:t.message)||"خطا در ایجاد دسترسی")}})},tfe=()=>{const e=yt();return ft({mutationKey:[de.UPDATE_PERMISSION],mutationFn:({id:t,permissionData:r})=>Zde(t,r),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:[de.GET_PERMISSIONS]}),e.invalidateQueries({queryKey:[de.GET_PERMISSION,r.id]}),e.invalidateQueries({queryKey:[de.GET_ROLE_PERMISSIONS]}),ye.success("دسترسی با موفقیت به‌روزرسانی شد")},onError:t=>{console.error("Update permission error:",t),ye.error((t==null?void 0:t.message)||"خطا در به‌روزرسانی دسترسی")}})},_x=({options:e,selectedValues:t,onChange:r,placeholder:n="انتخاب کنید...",label:a,error:i,isLoading:s=!1,disabled:o=!1})=>{const[c,u]=N.useState(!1),[d,f]=N.useState(""),h=N.useRef(null),p=N.useRef(null),m=e.filter(v=>v.title.toLowerCase().includes(d.toLowerCase())||v.description&&v.description.toLowerCase().includes(d.toLowerCase())),y=e.filter(v=>t.includes(v.id));N.useEffect(()=>{const v=S=>{h.current&&!h.current.contains(S.target)&&(u(!1),f(""))};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[]);const g=v=>{t.includes(v)?r(t.filter(S=>S!==v)):r([...t,v])},b=v=>{r(t.filter(S=>S!==v))},x=()=>{o||(u(!c),c||setTimeout(()=>{var v;return(v=p.current)==null?void 0:v.focus()},100))};return l.jsxs("div",{className:"relative",ref:h,children:[a&&l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:a}),l.jsx("div",{className:` - - w-full min-h-[42px] px-3 py-2 border rounded-md - focus-within:outline-none focus-within:ring-1 focus-within:ring-primary-500 - cursor-pointer - ${i?"border-red-500":"border-gray-300 dark:border-gray-600"} - ${o?"bg-gray-100 cursor-not-allowed":"bg-white dark:bg-gray-700"} - dark:text-gray-100 - `,onClick:x,children:l.jsxs("div",{className:"flex flex-wrap gap-1 items-center",children:[y.length>0?y.map(v=>l.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-primary-100 text-primary-800 text-xs rounded-md",children:[v.title,l.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),b(v.id)},className:"hover:bg-primary-200 rounded-full p-0.5",disabled:o,children:l.jsx(pd,{className:"h-3 w-3"})})]},v.id)):l.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:n}),l.jsx("div",{className:"flex-1 min-w-[60px]",children:c&&!o&&l.jsx("input",{ref:p,type:"text",value:d,onChange:v=>f(v.target.value),className:"w-full border-none outline-none bg-transparent text-sm",placeholder:"جستجو..."})}),l.jsx(Nb,{className:`h-4 w-4 transition-transform ${c?"rotate-180":""}`})]})}),c&&!o&&l.jsx("div",{className:"absolute z-50 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-md shadow-lg max-h-60 overflow-auto",children:s?l.jsx("div",{className:"p-3 text-center text-gray-500 dark:text-gray-400",children:"در حال بارگذاری..."}):m.length>0?m.map(v=>l.jsx("div",{className:` - px-3 py-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700 - ${t.includes(v.id)?"bg-primary-50 dark:bg-primary-900/80":""} - `,onClick:()=>g(v.id),children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:v.title}),v.description&&l.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:v.description})]}),t.includes(v.id)&&l.jsx("div",{className:"text-primary-600 dark:text-primary-400",children:"✓"})]})},v.id)):l.jsx("div",{className:"p-3 text-center text-gray-500 dark:text-gray-400",children:"موردی یافت نشد"})}),i&&l.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400",children:i})]})},rfe=jr({first_name:Se().required("نام الزامی است").min(2,"نام باید حداقل 2 کاراکتر باشد"),last_name:Se().required("نام خانوادگی الزامی است").min(2,"نام خانوادگی باید حداقل 2 کاراکتر باشد"),username:Se().required("نام کاربری الزامی است").min(3,"نام کاربری باید حداقل 3 کاراکتر باشد"),password:Se().when("isEdit",{is:!1,then:e=>e.required("رمز عبور الزامی است").min(8,"رمز عبور باید حداقل 8 کاراکتر باشد"),otherwise:e=>e.notRequired().test("min-length","رمز عبور باید حداقل 8 کاراکتر باشد",function(t){return!t||t.length>=8})}),status:Se().required("وضعیت الزامی است").oneOf(["active","deactive"],"وضعیت نامعتبر است"),permissions:fs().of(Ki()).default([]),roles:fs().of(Ki()).default([]),isEdit:Ub().default(!1)}),IN=()=>{var E,O,P,T,M,I;const e=St(),{id:t}=Kn(),r=!!t,{data:n,isLoading:a}=EI(t||"",r),{mutate:i,isPending:s}=qde(),{mutate:o,isPending:c}=Wde(),{data:u,isLoading:d}=AI(),{data:f,isLoading:h}=NI(),p=s||c,{register:m,handleSubmit:y,formState:{errors:g,isValid:b,isDirty:x},setValue:v,watch:S}=Rs({resolver:Ms(rfe),mode:"onChange",defaultValues:{first_name:"",last_name:"",username:"",password:"",status:"active",permissions:[],roles:[],isEdit:r}}),w=S();console.log("🔍 Current form values:",w),console.log("🔍 Form isValid:",b),console.log("🔍 Form isDirty:",x),console.log("🔍 Form errors:",g),N.useEffect(()=>{var R,F;r&&n&&(v("first_name",n.first_name,{shouldValidate:!0}),v("last_name",n.last_name,{shouldValidate:!0}),v("username",n.username,{shouldValidate:!0}),v("status",n.status,{shouldValidate:!0}),v("permissions",((R=n.permissions)==null?void 0:R.map(U=>U.id))||[],{shouldValidate:!0}),v("roles",((F=n.roles)==null?void 0:F.map(U=>U.id))||[],{shouldValidate:!0}),v("isEdit",!0,{shouldValidate:!0}))},[r,n,v]);const j=R=>{r&&t?o({id:t,userData:{id:parseInt(t),first_name:R.first_name,last_name:R.last_name,username:R.username,password:R.password&&R.password.trim()?R.password:void 0,status:R.status,permissions:R.permissions,roles:R.roles}},{onSuccess:()=>{e("/admin-users")}}):(console.log("🚀 Creating new admin user..."),i({first_name:R.first_name,last_name:R.last_name,username:R.username,password:R.password||"",status:R.status,permissions:R.permissions,roles:R.roles},{onSuccess:F=>{console.log("✅ Admin user created successfully:",F),console.log("🔄 Navigating to admin users list..."),e("/admin-users")},onError:F=>{console.error("❌ Error in component onError:",F)}}))},k=()=>{e("/admin-users")};if(r&&a)return l.jsx("div",{className:"flex justify-center items-center h-64",children:l.jsx(Mr,{})});const _=l.jsxs(te,{variant:"secondary",onClick:k,className:"flex items-center gap-2",children:[l.jsx(Qn,{className:"h-4 w-4"}),"بازگشت"]});return l.jsxs(_r,{className:"max-w-2xl mx-auto",children:[l.jsx(Cl,{title:r?"ویرایش کاربر ادمین":"ایجاد کاربر ادمین جدید",subtitle:r?"ویرایش اطلاعات کاربر ادمین":"اطلاعات کاربر ادمین جدید را وارد کنید",backButton:_}),l.jsx("div",{className:"card p-4 sm:p-6",children:l.jsxs("form",{onSubmit:y(j),className:"space-y-4 sm:space-y-6",children:[l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[l.jsx(tt,{label:"نام",...m("first_name"),error:(E=g.first_name)==null?void 0:E.message,placeholder:"نام کاربر"}),l.jsx(tt,{label:"نام خانوادگی",...m("last_name"),error:(O=g.last_name)==null?void 0:O.message,placeholder:"نام خانوادگی کاربر"})]}),l.jsx(tt,{label:"نام کاربری",...m("username"),error:(P=g.username)==null?void 0:P.message,placeholder:"نام کاربری"}),l.jsx(tt,{label:r?"رمز عبور (اختیاری)":"رمز عبور",type:"password",...m("password"),error:(T=g.password)==null?void 0:T.message,placeholder:r?"رمز عبور جدید (در صورت تمایل به تغییر)":"رمز عبور"}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[l.jsx(_x,{label:"دسترسی‌ها",options:(u||[]).map(R=>({id:R.id,title:R.title,description:R.description})),selectedValues:S("permissions")||[],onChange:R=>v("permissions",R,{shouldValidate:!0}),placeholder:"انتخاب دسترسی‌ها...",isLoading:d,error:(M=g.permissions)==null?void 0:M.message}),l.jsx(_x,{label:"نقش‌ها",options:(f||[]).map(R=>({id:R.id,title:R.title,description:R.description})),selectedValues:S("roles")||[],onChange:R=>v("roles",R,{shouldValidate:!0}),placeholder:"انتخاب نقش‌ها...",isLoading:h,error:(I=g.roles)==null?void 0:I.message})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"وضعیت"}),l.jsxs("select",{...m("status"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",children:[l.jsx("option",{value:"active",children:"فعال"}),l.jsx("option",{value:"deactive",children:"غیرفعال"})]}),g.status&&l.jsx("p",{className:"text-red-500 text-sm mt-1",children:g.status.message})]}),l.jsxs("div",{className:"flex justify-end space-x-4 space-x-reverse pt-6 border-t border-gray-200 dark:border-gray-600",children:[l.jsx(te,{type:"button",variant:"secondary",onClick:k,disabled:p,children:"انصراف"}),l.jsx(te,{type:"submit",loading:p,disabled:!b||p,children:r?"به‌روزرسانی":"ایجاد"})]})]})})]})},nfe=()=>{const e=St(),{id:t=""}=Kn(),{data:r,isLoading:n,error:a}=EI(t);if(n)return l.jsx(Mr,{});if(a)return l.jsx("div",{className:"text-red-600",children:"خطا در بارگذاری اطلاعات کاربر"});if(!r)return l.jsx("div",{children:"کاربر یافت نشد"});const i=o=>new Date(o).toLocaleDateString("fa-IR"),s=o=>{const c=o==="active";return l.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium ${c?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}`,children:c?"فعال":"غیرفعال"})};return l.jsxs(_r,{children:[l.jsxs("div",{className:"flex items-center justify-between mb-6",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{onClick:()=>e("/admin-users"),className:"flex items-center justify-center w-10 h-10 rounded-lg bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 transition-colors",children:l.jsx(Qn,{className:"h-5 w-5"})}),l.jsxs("div",{children:[l.jsx(Ta,{children:"جزئیات کاربر ادمین"}),l.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"نمایش اطلاعات کامل کاربر ادمین"})]})]}),l.jsx("div",{className:"flex gap-3",children:l.jsx(kl,{permission:23,children:l.jsxs(te,{onClick:()=>e(`/admin-users/${t}/edit`),className:"flex items-center gap-2",children:[l.jsx(Eb,{className:"h-4 w-4"}),"ویرایش"]})})})]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[l.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[l.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[l.jsxs(xn,{className:"flex items-center gap-2 mb-4",children:[l.jsx(Tb,{className:"h-5 w-5"}),"اطلاعات اصلی"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"نام"}),l.jsx(lc,{children:r.first_name||"تعریف نشده"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"نام خانوادگی"}),l.jsx(lc,{children:r.last_name||"تعریف نشده"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"نام کاربری"}),l.jsx(lc,{children:r.username})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"وضعیت"}),s(r.status)]})]})]}),r.roles&&r.roles.length>0&&l.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[l.jsxs(xn,{className:"flex items-center gap-2 mb-4",children:[l.jsx(yh,{className:"h-5 w-5"}),"نقش‌ها"]}),l.jsx("div",{className:"flex flex-wrap gap-2",children:r.roles.map(o=>l.jsx("span",{className:"px-3 py-1 bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200 rounded-full text-sm font-medium",children:o.title},o.id))})]}),r.permissions&&r.permissions.length>0&&l.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[l.jsxs(xn,{className:"flex items-center gap-2 mb-4",children:[l.jsx(UA,{className:"h-5 w-5"}),"دسترسی‌های مستقیم"]}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:r.permissions.map(o=>l.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[l.jsx("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:o.title}),l.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:o.description})]},o.id))})]})]}),l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[l.jsxs(xn,{className:"flex items-center gap-2 mb-4",children:[l.jsx(Ob,{className:"h-5 w-5"}),"اطلاعات زمانی"]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(bh,{className:"text-sm text-gray-600 dark:text-gray-400 mb-1",children:"تاریخ ایجاد"}),l.jsx(lc,{children:r.created_at?i(r.created_at):"تعریف نشده"})]}),l.jsxs("div",{children:[l.jsx(bh,{className:"text-sm text-gray-600 dark:text-gray-400 mb-1",children:"آخرین بروزرسانی"}),l.jsx(lc,{children:r.updated_at?i(r.updated_at):"تعریف نشده"})]})]})]}),l.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:[l.jsxs(xn,{className:"flex items-center gap-2 mb-4",children:[l.jsx(uu,{className:"h-5 w-5"}),"آمار سریع"]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تعداد نقش‌ها"}),l.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:r.roles?r.roles.length:0})]}),l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تعداد دسترسی‌ها"}),l.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:r.permissions?r.permissions.length:0})]})]})]})]})]})]})},afe=()=>l.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[l.jsx("div",{className:"hidden md:block",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[l.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عنوان"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"توضیحات"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"})]})}),l.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:[...Array(5)].map((e,t)=>l.jsxs("tr",{className:"animate-pulse",children:[l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-32"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-48"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-20"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"})]})})]},t))})]})})}),l.jsx("div",{className:"md:hidden p-4 space-y-4",children:[...Array(3)].map((e,t)=>l.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 animate-pulse",children:l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"h-5 bg-gray-300 dark:bg-gray-600 rounded w-3/4"}),l.jsx("div",{className:"h-4 bg-gray-300 dark:bg-gray-600 rounded w-full"}),l.jsx("div",{className:"h-3 bg-gray-300 dark:bg-gray-600 rounded w-1/3"}),l.jsxs("div",{className:"flex gap-2 pt-2",children:[l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"}),l.jsx("div",{className:"h-8 w-8 bg-gray-300 dark:bg-gray-600 rounded"})]})]})},t))})]}),ife=()=>{const[e,t]=N.useState({search:""}),{data:r,isLoading:n,error:a}=AI(e),i=s=>{t(o=>({...o,search:s.target.value}))};return a?l.jsx("div",{className:"p-6",children:l.jsx("div",{className:"text-center py-12",children:l.jsx("p",{className:"text-red-600 dark:text-red-400",children:"خطا در بارگذاری دسترسی‌ها"})})}):l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:l.jsxs("div",{children:[l.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[l.jsx(yh,{className:"h-6 w-6"}),"لیست دسترسی‌ها"]}),l.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"نمایش دسترسی‌های سیستم"})]})}),l.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"جستجو"}),l.jsx("input",{type:"text",placeholder:"جستجو در عنوان یا توضیحات...",value:e.search,onChange:i,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"})]})})}),n?l.jsx(afe,{}):(r||[]).length===0?l.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg",children:l.jsxs("div",{className:"text-center py-12",children:[l.jsx(yh,{className:"h-12 w-12 text-gray-400 dark:text-gray-500 mx-auto mb-4"}),l.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-2",children:"هیچ دسترسی یافت نشد"}),l.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:e.search?"نتیجه‌ای برای جستجوی شما یافت نشد":"دسترسی‌های سیستم در اینجا نمایش داده می‌شوند"})]})}):l.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[l.jsx("div",{className:"hidden md:block",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[l.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عنوان"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"توضیحات"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),l.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:(r||[]).map(s=>l.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:s.title}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:s.description}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:new Date(s.created_at).toLocaleDateString("fa-IR")})]},s.id))})]})})}),l.jsx("div",{className:"md:hidden p-4 space-y-4",children:(r||[]).map(s=>l.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[l.jsx("div",{className:"flex justify-between items-start mb-2",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:s.title}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:s.description})]})}),l.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["تاریخ ایجاد: ",new Date(s.created_at).toLocaleDateString("fa-IR")]})]},s.id))})]})]})},sfe=jr({title:Se().required("عنوان الزامی است").min(3,"عنوان باید حداقل 3 کاراکتر باشد"),description:Se().required("توضیحات الزامی است").min(10,"توضیحات باید حداقل 10 کاراکتر باشد")}),RN=()=>{var b;const e=St(),{id:t}=Kn(),r=!!t,{data:n,isLoading:a}=Jde(t||"",r),{mutate:i,isPending:s}=efe(),{mutate:o,isPending:c}=tfe(),u=s||c,{register:d,handleSubmit:f,formState:{errors:h,isValid:p},setValue:m}=Rs({resolver:Ms(sfe),mode:"onChange",defaultValues:{title:"",description:""}});N.useEffect(()=>{r&&n&&(m("title",n.title),m("description",n.description))},[r,n,m]);const y=x=>{r&&t?o({id:t,permissionData:{id:parseInt(t),title:x.title,description:x.description}},{onSuccess:()=>{e("/permissions")}}):i({title:x.title,description:x.description},{onSuccess:()=>{e("/permissions")}})},g=()=>{e("/permissions")};return r&&a?l.jsx("div",{className:"flex justify-center items-center h-64",children:l.jsx(Mr,{})}):l.jsxs(_r,{children:[l.jsx(Cl,{title:r?"ویرایش دسترسی":"ایجاد دسترسی جدید",subtitle:r?"ویرایش اطلاعات دسترسی":"اطلاعات دسترسی جدید را وارد کنید",backButton:l.jsxs(te,{variant:"secondary",onClick:g,className:"flex items-center gap-2",children:[l.jsx(Qn,{className:"h-4 w-4"}),"بازگشت"]})}),l.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:l.jsxs("form",{onSubmit:f(y),className:"space-y-6",children:[l.jsx(tt,{label:"عنوان دسترسی",...d("title"),error:(b=h.title)==null?void 0:b.message,placeholder:"مثال: CREATE_USER, DELETE_POST, MANAGE_ADMIN"}),l.jsxs("div",{children:[l.jsx(fu,{htmlFor:"description",children:"توضیحات"}),l.jsx("textarea",{...d("description"),rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",placeholder:"توضیح کاملی از این دسترسی ارائه دهید..."}),h.description&&l.jsx("p",{className:"text-red-500 text-sm mt-1",children:h.description.message})]}),l.jsxs("div",{className:"flex justify-end space-x-4 space-x-reverse pt-6 border-t border-gray-200 dark:border-gray-600",children:[l.jsx(te,{type:"button",variant:"secondary",onClick:g,disabled:u,children:"انصراف"}),l.jsx(te,{type:"submit",loading:u,disabled:!p,children:r?"به‌روزرسانی":"ایجاد"})]})]})})]})},ofe=async e=>{try{const t={};e!=null&&e.search&&(t.search=e.search),e!=null&&e.page&&(t.page=e.page),e!=null&&e.limit&&(t.limit=e.limit);const r=await Or(Oe(ke.GET_PRODUCT_OPTIONS,t));return console.log("Product Options API Response:",r),r.data&&r.data.product_options&&Array.isArray(r.data.product_options)?r.data.product_options:(console.warn("Product options is null or not an array:",r.data),[])}catch(t){return console.error("Error fetching product options:",t),[]}},lfe=async e=>(await Or(Oe(ke.GET_PRODUCT_OPTION(e)))).data.product_option,cfe=async e=>(await Ca(Oe(ke.CREATE_PRODUCT_OPTION),e)).data.product_option,ufe=async e=>(await Ml(Oe(ke.UPDATE_PRODUCT_OPTION(e.id.toString())),e)).data.product_option,dfe=async e=>(await Fs(Oe(ke.DELETE_PRODUCT_OPTION(e)))).data,PI=e=>kr({queryKey:[de.GET_PRODUCT_OPTIONS,e],queryFn:()=>ofe(e)}),ffe=(e,t=!0)=>kr({queryKey:[de.GET_PRODUCT_OPTION,e],queryFn:()=>lfe(e),enabled:t&&!!e}),hfe=()=>{const e=yt();return ft({mutationKey:[de.CREATE_PRODUCT_OPTION],mutationFn:t=>cfe(t),onSuccess:()=>{e.invalidateQueries({queryKey:[de.GET_PRODUCT_OPTIONS]}),ye.success("گزینه محصول با موفقیت ایجاد شد")},onError:t=>{console.error("Create product option error:",t),ye.error((t==null?void 0:t.message)||"خطا در ایجاد گزینه محصول")}})},pfe=()=>{const e=yt();return ft({mutationKey:[de.UPDATE_PRODUCT_OPTION],mutationFn:t=>ufe(t),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:[de.GET_PRODUCT_OPTIONS]}),e.invalidateQueries({queryKey:[de.GET_PRODUCT_OPTION,r.id.toString()]}),ye.success("گزینه محصول با موفقیت ویرایش شد")},onError:t=>{console.error("Update product option error:",t),ye.error((t==null?void 0:t.message)||"خطا در ویرایش گزینه محصول")}})},mfe=()=>{const e=yt();return ft({mutationKey:[de.DELETE_PRODUCT_OPTION],mutationFn:t=>dfe(t),onSuccess:()=>{e.invalidateQueries({queryKey:[de.GET_PRODUCT_OPTIONS]}),ye.success("گزینه محصول با موفقیت حذف شد")},onError:t=>{console.error("Delete product option error:",t),ye.error((t==null?void 0:t.message)||"خطا در حذف گزینه محصول")}})},yfe=()=>l.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:l.jsx("div",{className:"hidden md:block",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[l.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام گزینه"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"مقادیر"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),l.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:[...Array(5)].map((e,t)=>l.jsxs("tr",{children:[l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx("div",{className:"h-8 w-8 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"}),l.jsx("div",{className:"h-8 w-8 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})]})})]},t))})]})})})}),gfe=()=>{const e=St(),[t,r]=N.useState(null),[n,a]=N.useState({search:""}),{data:i,isLoading:s,error:o}=PI(n),{mutate:c,isPending:u}=mfe(),d=()=>{e("/product-options/create")},f=m=>{e(`/product-options/${m}/edit`)},h=()=>{t&&c(t,{onSuccess:()=>{r(null)}})},p=m=>{a(y=>({...y,search:m.target.value}))};return o?l.jsx("div",{className:"p-6",children:l.jsx("div",{className:"text-center py-12",children:l.jsx("p",{className:"text-red-600 dark:text-red-400",children:"خطا در بارگذاری گزینه‌های محصول"})})}):l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:items-center sm:justify-between sm:space-y-0",children:[l.jsxs("div",{children:[l.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[l.jsx(du,{className:"h-6 w-6"}),"مدیریت گزینه‌های محصول"]}),l.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"تنظیمات گزینه‌های قابل انتخاب برای محصولات"})]}),l.jsx("button",{onClick:d,className:"flex items-center justify-center w-12 h-12 bg-primary-600 hover:bg-primary-700 rounded-full transition-colors duration-200 text-white shadow-lg hover:shadow-xl",title:"گزینه محصول جدید",children:l.jsx(Pt,{className:"h-5 w-5"})})]}),l.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"جستجو"}),l.jsx("input",{type:"text",placeholder:"جستجو در نام گزینه...",value:n.search,onChange:p,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"})]})})}),s?l.jsx(yfe,{}):l.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[l.jsx("div",{className:"hidden md:block",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[l.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام گزینه"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"مقادیر"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),l.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:(i||[]).map(m=>l.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-100",children:m.title}),l.jsx("td",{className:"px-6 py-4 text-sm text-gray-900 dark:text-gray-100",children:l.jsxs("div",{className:"flex flex-wrap gap-1 max-w-xs",children:[(m.options||[]).slice(0,3).map((y,g)=>l.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs bg-gray-100 dark:bg-gray-600 text-gray-800 dark:text-gray-200",children:[l.jsx(R0,{className:"h-3 w-3 mr-1"}),y.title]},g)),(m.options||[]).length>3&&l.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs bg-primary-100 dark:bg-primary-900 text-primary-800 dark:text-primary-200",children:["+",(m.options||[]).length-3," بیشتر"]})]})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:new Date(m.created_at).toLocaleDateString("fa-IR")}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>f(m.id),className:"text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",title:"ویرایش",children:l.jsx(Nn,{className:"h-4 w-4"})}),l.jsx("button",{onClick:()=>r(m.id.toString()),className:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",title:"حذف",children:l.jsx(Yt,{className:"h-4 w-4"})})]})})]},m.id))})]})})}),l.jsx("div",{className:"md:hidden p-4 space-y-4",children:(i||[]).map(m=>l.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[l.jsx("div",{className:"flex justify-between items-start mb-3",children:l.jsxs("div",{className:"flex-1",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:m.title}),l.jsxs("div",{className:"flex flex-wrap gap-1 mt-2",children:[(m.options||[]).slice(0,3).map((y,g)=>l.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs bg-gray-100 dark:bg-gray-600 text-gray-800 dark:text-gray-200",children:[l.jsx(R0,{className:"h-3 w-3 mr-1"}),y.title]},g)),(m.options||[]).length>3&&l.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs bg-primary-100 dark:bg-primary-900 text-primary-800 dark:text-primary-200",children:["+",(m.options||[]).length-3," بیشتر"]})]})]})}),l.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:["تاریخ ایجاد: ",new Date(m.created_at).toLocaleDateString("fa-IR")]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>f(m.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",children:[l.jsx(Nn,{className:"h-3 w-3"}),"ویرایش"]}),l.jsxs("button",{onClick:()=>r(m.id.toString()),className:"flex items-center gap-1 px-2 py-1 text-xs text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",children:[l.jsx(Yt,{className:"h-3 w-3"}),"حذف"]})]})]},m.id))}),(!i||i.length===0)&&!s&&l.jsxs("div",{className:"text-center py-12",children:[l.jsx(du,{className:"mx-auto h-12 w-12 text-gray-400"}),l.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900 dark:text-gray-100",children:"گزینه‌ای موجود نیست"}),l.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"برای شروع، اولین گزینه محصول خود را ایجاد کنید."}),l.jsx("div",{className:"mt-6",children:l.jsxs(te,{onClick:d,className:"flex items-center gap-2 mx-auto",children:[l.jsx(Pt,{className:"h-4 w-4"}),"ایجاد گزینه جدید"]})})]})]}),l.jsx(Ws,{isOpen:!!t,onClose:()=>r(null),title:"حذف گزینه محصول",children:l.jsxs("div",{className:"space-y-4",children:[l.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"آیا از حذف این گزینه محصول اطمینان دارید؟ این عمل قابل بازگشت نیست و ممکن است بر محصولاتی که از این گزینه استفاده می‌کنند تأثیر بگذارد."}),l.jsxs("div",{className:"flex justify-end space-x-2 space-x-reverse",children:[l.jsx(te,{variant:"secondary",onClick:()=>r(null),disabled:u,children:"انصراف"}),l.jsx(te,{variant:"danger",onClick:h,loading:u,children:"حذف"})]})]})})]})},vfe=jr({title:Se().required("عنوان نگهداری الزامی است"),description:Se().required("توضیحات نگهداری الزامی است"),content:Se().required("محتوای نگهداری الزامی است"),image:Se().required("تصویر نگهداری الزامی است")}),xfe=jr({title:Se().required("عنوان گزینه الزامی است"),description:Se().required("توضیحات گزینه الزامی است"),meta_title:Se().required("متا تایتل الزامی است")}),bfe=jr({title:Se().required("عنوان الزامی است").min(2,"عنوان باید حداقل 2 کاراکتر باشد"),description:Se().required("توضیحات الزامی است"),maintenance:vfe.required("اطلاعات نگهداری الزامی است"),options:fs().of(xfe).min(1,"حداقل یک گزینه باید وارد شود").required("گزینه‌ها الزامی است")}),MN=()=>{var k,_,E,O,P,T,M,I,R,F;const e=St(),{id:t}=Kn(),r=!!t,{data:n,isLoading:a}=ffe(t||"",r),{mutate:i,isPending:s}=hfe(),{mutate:o,isPending:c}=pfe(),u=s||c,{register:d,handleSubmit:f,formState:{errors:h,isValid:p},setValue:m,watch:y,control:g}=Rs({resolver:Ms(bfe),mode:"onChange",defaultValues:{title:"",description:"",maintenance:{title:"",description:"",content:"",image:""},options:[]}}),{fields:b,append:x,remove:v}=V6({control:g,name:"options"});y(),N.useEffect(()=>{r&&n&&(m("title",n.title,{shouldValidate:!0}),m("description",n.description,{shouldValidate:!0}),m("maintenance",n.maintenance,{shouldValidate:!0}),m("options",n.options,{shouldValidate:!0}))},[r,n,m]);const S=U=>{r&&t?o({id:parseInt(t),...U},{onSuccess:()=>{e("/product-options")}}):i(U,{onSuccess:()=>{e("/product-options")}})},w=()=>{x({title:"",description:"",meta_title:""})};if(a)return l.jsx("div",{className:"flex items-center justify-center min-h-screen",children:l.jsx(Mr,{})});const j=l.jsxs(te,{variant:"secondary",onClick:()=>e("/product-options"),className:"flex items-center gap-2",children:[l.jsx(Qn,{className:"h-4 w-4"}),"برگشت"]});return l.jsxs(_r,{className:"max-w-4xl mx-auto",children:[l.jsx(Cl,{title:r?"ویرایش گزینه محصول":"ایجاد گزینه محصول جدید",subtitle:"اطلاعات گزینه محصول را وارد کنید",backButton:j}),l.jsxs("div",{className:"card",children:[l.jsx("div",{className:"p-4 sm:p-6 border-b border-gray-200 dark:border-gray-700",children:l.jsx(xn,{children:"اطلاعات اصلی"})}),l.jsxs("form",{onSubmit:f(S),className:"p-6 space-y-6",children:[l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[l.jsx("div",{children:l.jsx(tt,{label:"عنوان",...d("title"),error:(k=h.title)==null?void 0:k.message,placeholder:"عنوان گزینه محصول را وارد کنید"})}),l.jsx("div",{children:l.jsx(tt,{label:"توضیحات",...d("description"),error:(_=h.description)==null?void 0:_.message,placeholder:"توضیحات گزینه محصول را وارد کنید"})})]}),l.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[l.jsx(xn,{className:"mb-4",children:"اطلاعات نگهداری"}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[l.jsx(tt,{label:"عنوان نگهداری",...d("maintenance.title"),error:(O=(E=h.maintenance)==null?void 0:E.title)==null?void 0:O.message,placeholder:"عنوان نگهداری را وارد کنید"}),l.jsx(tt,{label:"توضیحات نگهداری",...d("maintenance.description"),error:(T=(P=h.maintenance)==null?void 0:P.description)==null?void 0:T.message,placeholder:"توضیحات نگهداری را وارد کنید"}),l.jsx(tt,{label:"محتوای نگهداری",...d("maintenance.content"),error:(I=(M=h.maintenance)==null?void 0:M.content)==null?void 0:I.message,placeholder:"محتوای نگهداری را وارد کنید"}),l.jsx(tt,{label:"تصویر نگهداری",...d("maintenance.image"),error:(F=(R=h.maintenance)==null?void 0:R.image)==null?void 0:F.message,placeholder:"آدرس تصویر نگهداری را وارد کنید"})]})]}),l.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx(xn,{children:"گزینه‌ها"}),l.jsxs(te,{type:"button",variant:"primary",onClick:w,className:"flex items-center gap-2",children:[l.jsx(Pt,{className:"h-4 w-4"}),"افزودن گزینه"]})]}),b.map((U,D)=>{var V,H,Z,K,le,we,Ae,De,st;return l.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 mb-4",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("h4",{className:"text-md font-medium text-gray-900 dark:text-gray-100",children:["گزینه ",D+1]}),l.jsxs(te,{type:"button",variant:"danger",onClick:()=>v(D),className:"flex items-center gap-2",children:[l.jsx(Yt,{className:"h-4 w-4"}),"حذف"]})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[l.jsx(tt,{label:"عنوان",...d(`options.${D}.title`),error:(Z=(H=(V=h.options)==null?void 0:V[D])==null?void 0:H.title)==null?void 0:Z.message,placeholder:"عنوان گزینه را وارد کنید"}),l.jsx(tt,{label:"توضیحات",...d(`options.${D}.description`),error:(we=(le=(K=h.options)==null?void 0:K[D])==null?void 0:le.description)==null?void 0:we.message,placeholder:"توضیحات گزینه را وارد کنید"}),l.jsx(tt,{label:"متا تایتل",...d(`options.${D}.meta_title`),error:(st=(De=(Ae=h.options)==null?void 0:Ae[D])==null?void 0:De.meta_title)==null?void 0:st.message,placeholder:"متا تایتل را وارد کنید"})]})]},U.id)}),b.length===0&&l.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"هیچ گزینه‌ای تعریف نشده است. برای شروع گزینه‌ای اضافه کنید."})]}),l.jsxs("div",{className:"flex justify-end gap-4 pt-6",children:[l.jsx(te,{type:"button",variant:"secondary",onClick:()=>e("/product-options"),disabled:u,children:"لغو"}),l.jsx(te,{type:"submit",variant:"primary",disabled:!p||u,loading:u,children:r?"ویرایش گزینه محصول":"ایجاد گزینه محصول"})]})]})]})]})},wfe=async e=>{try{const t={};e!=null&&e.search&&(t.search=e.search),e!=null&&e.page&&(t.page=e.page),e!=null&&e.limit&&(t.limit=e.limit);const r=await Or(Oe(ke.GET_CATEGORIES,t));return console.log("Categories API Response:",r),r.data&&r.data.categories&&Array.isArray(r.data.categories)?r.data.categories:(console.warn("Categories is null or not an array:",r.data),[])}catch(t){return console.error("Error fetching categories:",t),[]}},jfe=async e=>(await Or(Oe(ke.GET_CATEGORY(e)))).data.category,Sfe=async e=>(await Ca(Oe(ke.CREATE_CATEGORY),e)).data.category,kfe=async e=>(await Ml(Oe(ke.UPDATE_CATEGORY(e.id.toString())),e)).data.category,_fe=async e=>(await Fs(Oe(ke.DELETE_CATEGORY(e)))).data,ow=e=>kr({queryKey:[de.GET_CATEGORIES,e],queryFn:()=>wfe(e)}),Ofe=(e,t=!0)=>kr({queryKey:[de.GET_CATEGORY,e],queryFn:()=>jfe(e),enabled:t&&!!e}),Nfe=()=>{const e=yt(),t=St();return ft({mutationKey:[de.CREATE_CATEGORY],mutationFn:r=>Sfe(r),onSuccess:()=>{e.invalidateQueries({queryKey:[de.GET_CATEGORIES]}),ye.success("دسته‌بندی با موفقیت ایجاد شد"),t("/categories")},onError:r=>{console.error("Create category error:",r),ye.error((r==null?void 0:r.message)||"خطا در ایجاد دسته‌بندی")}})},Efe=()=>{const e=yt(),t=St();return ft({mutationKey:[de.UPDATE_CATEGORY],mutationFn:r=>kfe(r),onSuccess:(r,n)=>{e.invalidateQueries({queryKey:[de.GET_CATEGORIES]}),e.invalidateQueries({queryKey:[de.GET_CATEGORY,n.id.toString()]}),ye.success("دسته‌بندی با موفقیت ویرایش شد"),t("/categories")},onError:r=>{console.error("Update category error:",r),ye.error((r==null?void 0:r.message)||"خطا در ویرایش دسته‌بندی")}})},Afe=()=>{const e=yt();return ft({mutationKey:[de.DELETE_CATEGORY],mutationFn:t=>_fe(t),onSuccess:()=>{e.invalidateQueries({queryKey:[de.GET_CATEGORIES]}),ye.success("دسته‌بندی با موفقیت حذف شد")},onError:t=>{console.error("Delete category error:",t),ye.error((t==null?void 0:t.message)||"خطا در حذف دسته‌بندی")}})},Pfe=()=>l.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:l.jsx("div",{className:"hidden md:block",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[l.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام دسته‌بندی"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"توضیحات"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),l.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:[...Array(5)].map((e,t)=>l.jsxs("tr",{children:[l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx("div",{className:"h-8 w-8 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"}),l.jsx("div",{className:"h-8 w-8 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})]})})]},t))})]})})})}),Tfe=()=>{const e=St(),[t,r]=N.useState(null),[n,a]=N.useState({search:""}),{data:i,isLoading:s,error:o}=ow(n),{mutate:c,isPending:u}=Afe(),d=()=>{e("/categories/create")},f=m=>{e(`/categories/${m}/edit`)},h=()=>{t&&c(t,{onSuccess:()=>{r(null)}})},p=m=>{a(y=>({...y,search:m.target.value}))};return o?l.jsx("div",{className:"p-6",children:l.jsx("div",{className:"text-center py-12",children:l.jsx("p",{className:"text-red-600 dark:text-red-400",children:"خطا در بارگذاری دسته‌بندی‌ها"})})}):l.jsxs(_r,{children:[l.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:items-center sm:justify-between sm:space-y-0",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(I0,{className:"h-6 w-6"}),l.jsx(Ta,{children:"مدیریت دسته‌بندی‌ها"})]}),l.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"مدیریت دسته‌بندی‌های محصولات"})]}),l.jsx("button",{onClick:d,className:"flex items-center justify-center w-12 h-12 bg-primary-600 hover:bg-primary-700 rounded-full transition-colors duration-200 text-white shadow-lg hover:shadow-xl",title:"دسته‌بندی جدید",children:l.jsx(Pt,{className:"h-5 w-5"})})]}),l.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"جستجو"}),l.jsx("input",{type:"text",placeholder:"جستجو در نام دسته‌بندی...",value:n.search,onChange:p,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"})]})})}),s?l.jsx(Pfe,{}):l.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[l.jsx("div",{className:"hidden md:block",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[l.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"نام دسته‌بندی"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"توضیحات"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"تاریخ ایجاد"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),l.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:(i||[]).map(m=>l.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-100",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Mj,{className:"h-4 w-4 text-amber-500"}),m.name]})}),l.jsx("td",{className:"px-6 py-4 text-sm text-gray-900 dark:text-gray-100",children:l.jsx("div",{className:"max-w-xs truncate",children:m.description||"بدون توضیحات"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:new Date(m.created_at).toLocaleDateString("fa-IR")}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>f(m.id),className:"text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",title:"ویرایش",children:l.jsx(Nn,{className:"h-4 w-4"})}),l.jsx("button",{onClick:()=>r(m.id.toString()),className:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",title:"حذف",children:l.jsx(Yt,{className:"h-4 w-4"})})]})})]},m.id))})]})})}),l.jsx("div",{className:"md:hidden p-4 space-y-4",children:(i||[]).map(m=>l.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[l.jsx("div",{className:"flex justify-between items-start mb-3",children:l.jsxs("div",{className:"flex-1",children:[l.jsxs("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[l.jsx(Mj,{className:"h-4 w-4 text-amber-500"}),m.name]}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:m.description||"بدون توضیحات"})]})}),l.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-3",children:["تاریخ ایجاد: ",new Date(m.created_at).toLocaleDateString("fa-IR")]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>f(m.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",children:[l.jsx(Nn,{className:"h-3 w-3"}),"ویرایش"]}),l.jsxs("button",{onClick:()=>r(m.id.toString()),className:"flex items-center gap-1 px-2 py-1 text-xs text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",children:[l.jsx(Yt,{className:"h-3 w-3"}),"حذف"]})]})]},m.id))}),(!i||i.length===0)&&!s&&l.jsxs("div",{className:"text-center py-12",children:[l.jsx(I0,{className:"mx-auto h-12 w-12 text-gray-400"}),l.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900 dark:text-gray-100",children:"دسته‌بندی‌ای موجود نیست"}),l.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"برای شروع، اولین دسته‌بندی محصولات خود را ایجاد کنید."}),l.jsx("div",{className:"mt-6",children:l.jsxs(te,{onClick:d,className:"flex items-center gap-2 mx-auto",children:[l.jsx(Pt,{className:"h-4 w-4"}),"ایجاد دسته‌بندی جدید"]})})]})]}),l.jsx(Ws,{isOpen:!!t,onClose:()=>r(null),title:"حذف دسته‌بندی",children:l.jsxs("div",{className:"space-y-4",children:[l.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"آیا از حذف این دسته‌بندی اطمینان دارید؟ این عمل قابل بازگشت نیست و ممکن است بر محصولاتی که در این دسته‌بندی قرار دارند تأثیر بگذارد."}),l.jsxs("div",{className:"flex justify-end space-x-2 space-x-reverse",children:[l.jsx(te,{variant:"secondary",onClick:()=>r(null),disabled:u,children:"انصراف"}),l.jsx(te,{variant:"danger",onClick:h,loading:u,children:"حذف"})]})]})})]})},DN=()=>{const e=St(),{id:t}=Kn();YD();const r=!!t,[n,a]=N.useState({name:"",description:"",parent_id:null}),{data:i,isLoading:s}=Ofe(t||"0",r),o=Nfe(),c=Efe();N.useEffect(()=>{i&&r&&a({name:i.name||"",description:i.description||"",parent_id:i.parent_id||null})},[i,r]);const u=(p,m)=>{a(y=>({...y,[p]:m}))},d=async p=>{p.preventDefault();try{r?await c.mutateAsync({id:parseInt(t),...n}):await o.mutateAsync(n)}catch(m){console.error("Error saving category:",m)}},f=()=>{e("/categories")};if(r&&s)return l.jsx("div",{className:"flex justify-center items-center h-64",children:l.jsx(Mr,{})});const h=l.jsxs(te,{variant:"secondary",onClick:f,className:"flex items-center gap-2",children:[l.jsx(Qn,{className:"h-4 w-4"}),"بازگشت"]});return l.jsxs(_r,{className:"max-w-2xl mx-auto",children:[l.jsx(Cl,{title:r?"ویرایش دسته‌بندی":"ایجاد دسته‌بندی جدید",subtitle:r?"ویرایش اطلاعات دسته‌بندی":"اطلاعات دسته‌بندی جدید را وارد کنید",backButton:h}),l.jsx("div",{className:"card p-4 sm:p-6",children:l.jsxs("form",{onSubmit:d,className:"space-y-4 sm:space-y-6",children:[l.jsxs("div",{children:[l.jsx(fu,{htmlFor:"name",children:"نام دسته‌بندی"}),l.jsx(tt,{id:"name",type:"text",value:n.name,onChange:p=>u("name",p.target.value),placeholder:"نام دسته‌بندی را وارد کنید",required:!0})]}),l.jsxs("div",{children:[l.jsx(fu,{htmlFor:"description",children:"توضیحات"}),l.jsx("textarea",{id:"description",value:n.description,onChange:p=>u("description",p.target.value),placeholder:"توضیحات دسته‌بندی",rows:4,className:"input resize-none"})]}),l.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:justify-end sm:space-y-0 sm:space-x-3 sm:space-x-reverse pt-4 border-t border-gray-200 dark:border-gray-700",children:[l.jsx(te,{type:"button",variant:"secondary",onClick:f,className:"w-full sm:w-auto",children:"انصراف"}),l.jsx(te,{type:"submit",loading:o.isPending||c.isPending,className:"w-full sm:w-auto",children:r?"ویرایش":"ایجاد"})]})]})})]})},Cfe=async e=>{try{const t={};e!=null&&e.search&&(t.search=e.search),e!=null&&e.category_id&&(t.category_id=e.category_id),e!=null&&e.status&&(t.status=e.status),e!=null&&e.min_price&&(t.min_price=e.min_price),e!=null&&e.max_price&&(t.max_price=e.max_price),e!=null&&e.page&&(t.page=e.page),e!=null&&e.limit&&(t.limit=e.limit);const r=await Or(Oe(ke.GET_PRODUCTS,t));return console.log("Products API Response:",r),r.data&&r.data.products&&Array.isArray(r.data.products)?{products:r.data.products,total:r.data.total,page:r.data.page,per_page:r.data.per_page}:(console.warn("Products is null or not an array:",r.data),{products:[],total:0,page:1,per_page:10})}catch(t){return console.error("Error fetching products:",t),{products:[],total:0,page:1,per_page:10}}},$fe=async e=>(await Or(Oe(ke.GET_PRODUCT(e)))).data.product,Ife=async e=>(await Ca(Oe(ke.CREATE_PRODUCT),e)).data.product,Rfe=async e=>(await Ml(Oe(ke.UPDATE_PRODUCT(e.id.toString())),e)).data.product,Mfe=async e=>(await Fs(Oe(ke.DELETE_PRODUCT(e)))).data,Dfe=e=>kr({queryKey:[de.GET_PRODUCTS,e],queryFn:()=>Cfe(e)}),TI=(e,t=!0)=>kr({queryKey:[de.GET_PRODUCT,e],queryFn:()=>$fe(e),enabled:t&&!!e}),Lfe=()=>{const e=yt();return ft({mutationKey:[de.CREATE_PRODUCT],mutationFn:t=>Ife(t),onSuccess:()=>{e.invalidateQueries({queryKey:[de.GET_PRODUCTS]}),ye.success("محصول با موفقیت ایجاد شد")},onError:t=>{console.error("Create product error:",t),ye.error((t==null?void 0:t.message)||"خطا در ایجاد محصول")}})},Ffe=()=>{const e=yt();return ft({mutationKey:[de.UPDATE_PRODUCT],mutationFn:t=>Rfe(t),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:[de.GET_PRODUCTS]}),e.invalidateQueries({queryKey:[de.GET_PRODUCT,r.id.toString()]}),ye.success("محصول با موفقیت ویرایش شد")},onError:t=>{console.error("Update product error:",t),ye.error((t==null?void 0:t.message)||"خطا در ویرایش محصول")}})},Ufe=()=>{const e=yt();return ft({mutationKey:[de.DELETE_PRODUCT],mutationFn:t=>Mfe(t),onSuccess:()=>{e.invalidateQueries({queryKey:[de.GET_PRODUCTS]}),ye.success("محصول با موفقیت حذف شد")},onError:t=>{console.error("Delete product error:",t),ye.error((t==null?void 0:t.message)||"خطا در حذف محصول")}})},Bfe=()=>l.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:l.jsx("div",{className:"hidden md:block",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[l.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"محصول"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"قیمت"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"دسته‌بندی"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"وضعیت"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),l.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:[...Array(5)].map((e,t)=>l.jsxs("tr",{children:[l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx("div",{className:"h-8 w-8 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"}),l.jsx("div",{className:"h-8 w-8 bg-gray-200 dark:bg-gray-600 rounded animate-pulse"})]})})]},t))})]})})})}),zfe=()=>{const e=St(),[t,r]=N.useState(null),[n,a]=N.useState({search:"",category_id:"",status:"",min_price:"",max_price:""}),{data:i,isLoading:s,error:o}=Dfe({...n,category_id:n.category_id?Number(n.category_id):void 0,min_price:n.min_price?Number(n.min_price):void 0,max_price:n.max_price?Number(n.max_price):void 0}),{data:c}=ow(),{mutate:u,isPending:d}=Ufe(),f=(i==null?void 0:i.products)||[],h=()=>{e("/products/create")},p=w=>{e(`/products/${w}/edit`)},m=w=>{e(`/products/${w}`)},y=()=>{t&&u(t,{onSuccess:()=>{r(null)}})},g=w=>{a(j=>({...j,search:w.target.value}))},b=w=>{a(j=>({...j,category_id:w.target.value}))},x=w=>{a(j=>({...j,status:w.target.value}))},v=w=>new Intl.NumberFormat("fa-IR").format(w)+" تومان",S=w=>{switch(w){case"active":return l.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:"فعال"});case"inactive":return l.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",children:"غیرفعال"});case"draft":return l.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200",children:"پیش‌نویس"});default:return l.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200",children:w})}};return o?l.jsx("div",{className:"p-6",children:l.jsx("div",{className:"text-center py-12",children:l.jsx("p",{className:"text-red-600 dark:text-red-400",children:"خطا در بارگذاری محصولات"})})}):l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"flex flex-col space-y-3 sm:flex-row sm:items-center sm:justify-between sm:space-y-0",children:[l.jsxs("div",{children:[l.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[l.jsx(Ss,{className:"h-6 w-6"}),"مدیریت محصولات"]}),l.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"مدیریت محصولات، قیمت‌ها و موجودی"})]}),l.jsx("button",{onClick:h,className:"flex items-center justify-center w-12 h-12 bg-primary-600 hover:bg-primary-700 rounded-full transition-colors duration-200 text-white shadow-lg hover:shadow-xl",title:"محصول جدید",children:l.jsx(Pt,{className:"h-5 w-5"})})]}),l.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"جستجو"}),l.jsx("input",{type:"text",placeholder:"جستجو در نام محصول...",value:n.search,onChange:g,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"دسته‌بندی"}),l.jsxs("select",{value:n.category_id,onChange:b,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",children:[l.jsx("option",{value:"",children:"همه دسته‌بندی‌ها"}),(c||[]).map(w=>l.jsx("option",{value:w.id,children:w.name},w.id))]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"وضعیت"}),l.jsxs("select",{value:n.status,onChange:x,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",children:[l.jsx("option",{value:"",children:"همه وضعیت‌ها"}),l.jsx("option",{value:"active",children:"فعال"}),l.jsx("option",{value:"inactive",children:"غیرفعال"}),l.jsx("option",{value:"draft",children:"پیش‌نویس"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"محدوده قیمت"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"number",placeholder:"حداقل",value:n.min_price,onChange:w=>a(j=>({...j,min_price:w.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"}),l.jsx("input",{type:"number",placeholder:"حداکثر",value:n.max_price,onChange:w=>a(j=>({...j,max_price:w.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"})]})]})]})}),s?l.jsx(Bfe,{}):l.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[l.jsx("div",{className:"hidden md:block",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[l.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"محصول"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"قیمت"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"دسته‌بندی"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"وضعیت"}),l.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"عملیات"})]})}),l.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:f.map(w=>{var j;return l.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"flex-shrink-0",children:w.images&&w.images.length>0?l.jsx("img",{src:w.images[0].url,alt:w.name,className:"w-10 h-10 object-cover rounded"}):l.jsx("div",{className:"w-10 h-10 bg-gray-200 dark:bg-gray-600 rounded flex items-center justify-center",children:l.jsx(mh,{className:"h-5 w-5 text-gray-500"})})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:w.name}),w.sku&&l.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["SKU: ",w.sku]})]})]})}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:v(w.price||0)}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100",children:((j=w.category)==null?void 0:j.name)||"بدون دسته‌بندی"}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:S(w.status||"")}),l.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>m(w.id),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",title:"مشاهده",children:l.jsx(_a,{className:"h-4 w-4"})}),l.jsx("button",{onClick:()=>p(w.id),className:"text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",title:"ویرایش",children:l.jsx(Nn,{className:"h-4 w-4"})}),l.jsx("button",{onClick:()=>r(w.id.toString()),className:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",title:"حذف",children:l.jsx(Yt,{className:"h-4 w-4"})})]})})]},w.id)})})]})})}),l.jsx("div",{className:"md:hidden p-4 space-y-4",children:f.map(w=>l.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[l.jsxs("div",{className:"flex gap-3 mb-3",children:[l.jsx("div",{className:"flex-shrink-0",children:w.images&&w.images.length>0?l.jsx("img",{src:w.images[0].url,alt:w.name,className:"w-12 h-12 object-cover rounded"}):l.jsx("div",{className:"w-12 h-12 bg-gray-200 dark:bg-gray-600 rounded flex items-center justify-center",children:l.jsx(mh,{className:"h-6 w-6 text-gray-500"})})}),l.jsxs("div",{className:"flex-1",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:w.name}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:v(w.price||0)}),l.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[S(w.status||""),w.category&&l.jsx("span",{className:"text-xs text-gray-500",children:w.category.name})]})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>m(w.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",children:[l.jsx(_a,{className:"h-3 w-3"}),"مشاهده"]}),l.jsxs("button",{onClick:()=>p(w.id),className:"flex items-center gap-1 px-2 py-1 text-xs text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300",children:[l.jsx(Nn,{className:"h-3 w-3"}),"ویرایش"]}),l.jsxs("button",{onClick:()=>r(w.id.toString()),className:"flex items-center gap-1 px-2 py-1 text-xs text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",children:[l.jsx(Yt,{className:"h-3 w-3"}),"حذف"]})]})]},w.id))}),(!f||f.length===0)&&!s&&l.jsxs("div",{className:"text-center py-12",children:[l.jsx(Ss,{className:"mx-auto h-12 w-12 text-gray-400"}),l.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900 dark:text-gray-100",children:"محصولی موجود نیست"}),l.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"برای شروع، اولین محصول خود را ایجاد کنید."}),l.jsx("div",{className:"mt-6",children:l.jsxs(te,{onClick:h,className:"flex items-center gap-2 mx-auto",children:[l.jsx(Pt,{className:"h-4 w-4"}),"ایجاد محصول جدید"]})})]})]}),l.jsx(Ws,{isOpen:!!t,onClose:()=>r(null),title:"حذف محصول",children:l.jsxs("div",{className:"space-y-4",children:[l.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"آیا از حذف این محصول اطمینان دارید؟ این عمل قابل بازگشت نیست و تمام اطلاعات مربوط به محصول از جمله نسخه‌ها و تصاویر حذف خواهد شد."}),l.jsxs("div",{className:"flex justify-end space-x-2 space-x-reverse",children:[l.jsx(te,{variant:"secondary",onClick:()=>r(null),disabled:d,children:"انصراف"}),l.jsx(te,{variant:"danger",onClick:y,loading:d,children:"حذف"})]})]})})]})},CI=()=>ft({mutationFn:async e=>{var n;const t=new FormData;t.append("file",e),t.append("name","uploaded-file"),console.log("Uploading file:",e.name);const r=await Ca(Oe(ke.UPLOAD_FILE),t,{headers:{"Content-Type":"multipart/form-data"}});if(console.log("Upload response:",r),!((n=r.data)!=null&&n.file))throw new Error("Invalid upload response");return{id:r.data.file.id.toString(),url:r.data.file.url}},onError:e=>{console.error("File upload error:",e),It.error((e==null?void 0:e.message)||"خطا در آپلود فایل")}}),$I=()=>ft({mutationFn:async e=>(await Fs(Oe(ke.DELETE_FILE(e)))).data,onSuccess:()=>{It.success("فایل با موفقیت حذف شد")},onError:e=>{console.error("File delete error:",e),It.error((e==null?void 0:e.message)||"خطا در حذف فایل")}}),pf={SIMPLE:0,VARIABLE:1,GROUPED:2,EXTERNAL:3},II={[pf.SIMPLE]:"محصول ساده",[pf.VARIABLE]:"محصول متغیر",[pf.GROUPED]:"محصول گروهی",[pf.EXTERNAL]:"محصول خارجی"},RI=({onUpload:e,onRemove:t,acceptedTypes:r=["image/*","video/*"],maxFileSize:n=10*1024*1024,maxFiles:a=10,label:i="فایل‌ها",description:s="تصاویر و ویدیوها را اینجا بکشید یا کلیک کنید",error:o,disabled:c=!1,className:u=""})=>{const[d,f]=N.useState([]),[h,p]=N.useState(!1),m=N.useRef(null),y=O=>O.startsWith("image/"),g=O=>{if(O===0)return"0 Bytes";const P=1024,T=["Bytes","KB","MB","GB"],M=Math.floor(Math.log(O)/Math.log(P));return parseFloat((O/Math.pow(P,M)).toFixed(2))+" "+T[M]},b=O=>n&&O.size>n?`حجم فایل نباید بیشتر از ${g(n)} باشد`:r.length>0&&!r.some(T=>T==="image/*"?O.type.startsWith("image/"):T==="video/*"?O.type.startsWith("video/"):O.type===T)?"نوع فایل پشتیبانی نمی‌شود":a&&d.length>=a?`حداکثر ${a} فایل مجاز است`:null,x=O=>new Promise(P=>{if(y(O.type)){const T=new FileReader;T.onload=M=>{var I;return P((I=M.target)==null?void 0:I.result)},T.readAsDataURL(O)}else P("")}),v=N.useCallback(async O=>{const P=b(O);if(P){const R={id:Math.random().toString(36).substr(2,9),name:O.name,size:O.size,type:O.type,progress:0,status:"error",error:P};f(F=>[...F,R]);return}const T=Math.random().toString(36).substr(2,9),M=await x(O),I={id:T,name:O.name,size:O.size,type:O.type,preview:M,progress:0,status:"uploading"};f(R=>[...R,I]);try{const R=setInterval(()=>{f(U=>U.map(D=>D.id===T&&D.progress<90?{...D,progress:D.progress+10}:D))},200),F=await e(O);clearInterval(R),f(U=>U.map(D=>D.id===T?{...D,progress:100,status:"completed",url:F.url,id:F.id}:D))}catch(R){f(F=>F.map(U=>U.id===T?{...U,status:"error",error:R.message||"خطا در آپلود فایل"}:U))}},[e,a,n,r]),S=N.useCallback(O=>{Array.from(O).forEach(P=>{v(P)})},[v]),w=N.useCallback(O=>{if(O.preventDefault(),p(!1),c)return;const P=O.dataTransfer.files;S(P)},[c,S]),j=N.useCallback(O=>{O.preventDefault(),c||p(!0)},[c]),k=N.useCallback(O=>{O.preventDefault(),p(!1)},[]),_=()=>{var O;c||(O=m.current)==null||O.click()},E=O=>{f(P=>P.filter(T=>T.id!==O)),t==null||t(O)};return l.jsxs("div",{className:`space-y-4 ${u}`,children:[i&&l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:i}),l.jsxs("div",{className:` - relative border-2 border-dashed rounded-lg p-6 transition-colors cursor-pointer - ${h?"border-primary-400 bg-primary-50 dark:bg-primary-900/20":"border-gray-300 dark:border-gray-600"} - ${c?"opacity-50 cursor-not-allowed":"hover:border-primary-400 hover:bg-gray-50 dark:hover:bg-gray-700"} - ${o?"border-red-300 bg-red-50 dark:bg-red-900/20":""} - `,onDrop:w,onDragOver:j,onDragLeave:k,onClick:_,children:[l.jsx("input",{ref:m,type:"file",multiple:!0,accept:r.join(","),className:"hidden",onChange:O=>O.target.files&&S(O.target.files),disabled:c}),l.jsxs("div",{className:"text-center",children:[l.jsx(g6,{className:"mx-auto h-12 w-12 text-gray-400"}),l.jsxs("div",{className:"mt-4",children:[l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:s}),l.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-500 mt-1",children:["حداکثر ",g(n)," • ",r.join(", ")]})]})]})]}),o&&l.jsxs("p",{className:"text-sm text-red-600 dark:text-red-400 flex items-center gap-1",children:[l.jsx($y,{className:"h-4 w-4"}),o]}),d.length>0&&l.jsxs("div",{className:"space-y-3",children:[l.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:["فایل‌های آپلود شده (",d.length,")"]}),l.jsx("div",{className:"space-y-2",children:d.map(O=>l.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[l.jsx("div",{className:"flex-shrink-0",children:O.preview?l.jsx("img",{src:O.preview,alt:O.name,className:"w-10 h-10 object-cover rounded"}):l.jsx("div",{className:"w-10 h-10 bg-gray-200 dark:bg-gray-600 rounded flex items-center justify-center",children:y(O.type)?l.jsx(mh,{className:"h-5 w-5 text-gray-500"}):l.jsx(l6,{className:"h-5 w-5 text-gray-500"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:O.name}),l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g(O.size)}),O.status==="uploading"&&l.jsxs("div",{className:"mt-1",children:[l.jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-600 rounded-full h-1.5",children:l.jsx("div",{className:"bg-primary-600 h-1.5 rounded-full transition-all duration-300",style:{width:`${O.progress}%`}})}),l.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[O.progress,"%"]})]}),O.status==="error"&&O.error&&l.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1 flex items-center gap-1",children:[l.jsx($y,{className:"h-3 w-3"}),O.error]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[O.status==="completed"&&l.jsx(n6,{className:"h-5 w-5 text-green-500"}),O.status==="error"&&l.jsx($y,{className:"h-5 w-5 text-red-500"}),l.jsx(te,{variant:"secondary",size:"sm",onClick:P=>{P==null||P.stopPropagation(),E(O.id)},className:"p-1 h-8 w-8",children:l.jsx(pd,{className:"h-4 w-4"})})]})]},O.id))})]})]})},Vfe=({variant:e,onSave:t,onCancel:r,isEdit:n=!1})=>{const[a,i]=N.useState(e||{enabled:!0,fee_percentage:0,profit_percentage:0,stock_limit:0,stock_managed:!0,stock_number:0,weight:0,attributes:{},meta:{},images:[]}),[s,o]=N.useState((e==null?void 0:e.images)||[]),[c,u]=N.useState((e==null?void 0:e.attributes)||{}),[d,f]=N.useState((e==null?void 0:e.meta)||{}),[h,p]=N.useState(""),[m,y]=N.useState(""),[g,b]=N.useState(""),[x,v]=N.useState(""),{mutateAsync:S}=CI(),{mutate:w}=$I(),j=(I,R)=>{i(F=>({...F,[I]:R}))},k=async I=>{try{const R=await S(I),F={id:R.id,url:R.url,alt:I.name,order:s.length},U=[...s,F];return o(U),R}catch(R){throw console.error("Upload error:",R),R}},_=I=>{const R=s.filter(F=>F.id!==I);o(R),w(I)},E=()=>{if(h.trim()&&m.trim()){const I={...c,[h.trim()]:m.trim()};u(I),p(""),y("")}},O=I=>{const R={...c};delete R[I],u(R)},P=()=>{if(g.trim()&&x.trim()){const I={...d,[g.trim()]:x.trim()};f(I),b(""),v("")}},T=I=>{const R={...d};delete R[I],f(R)},M=()=>{const I={...a,images:s,attributes:c,meta:d};t(I)};return l.jsxs("div",{className:"space-y-6 bg-gray-50 dark:bg-gray-700 p-6 rounded-lg border",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h4",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:n?"ویرایش Variant":"افزودن Variant جدید"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(te,{variant:"secondary",onClick:r,children:"انصراف"}),l.jsx(te,{onClick:M,children:n?"به‌روزرسانی":"افزودن"})]})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"درصد کارمزد"}),l.jsx("input",{type:"number",value:a.fee_percentage,onChange:I=>j("fee_percentage",parseFloat(I.target.value)||0),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",placeholder:"0",min:"0",max:"100",step:"0.1"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"درصد سود"}),l.jsx("input",{type:"number",value:a.profit_percentage,onChange:I=>j("profit_percentage",parseFloat(I.target.value)||0),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",placeholder:"0",min:"0",max:"100",step:"0.1"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"وزن (گرم)"}),l.jsx("input",{type:"number",value:a.weight,onChange:I=>j("weight",parseFloat(I.target.value)||0),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",placeholder:"0",min:"0",step:"0.1"})]})]}),l.jsxs("div",{children:[l.jsx("h5",{className:"text-md font-medium text-gray-900 dark:text-gray-100 mb-3",children:"مدیریت موجودی"}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"flex items-center space-x-3 space-x-reverse",children:[l.jsx("input",{type:"checkbox",checked:a.stock_managed,onChange:I=>j("stock_managed",I.target.checked),className:"w-4 h-4 text-primary-600 bg-gray-100 border-gray-300 rounded focus:ring-primary-500"}),l.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"مدیریت موجودی فعال باشد"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"تعداد موجودی"}),l.jsx("input",{type:"number",value:a.stock_number,onChange:I=>j("stock_number",parseInt(I.target.value)||0),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",placeholder:"0",min:"0",disabled:!a.stock_managed})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"حد کمینه موجودی"}),l.jsx("input",{type:"number",value:a.stock_limit,onChange:I=>j("stock_limit",parseInt(I.target.value)||0),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",placeholder:"0",min:"0",disabled:!a.stock_managed})]})]})]}),l.jsxs("div",{children:[l.jsx("h5",{className:"text-md font-medium text-gray-900 dark:text-gray-100 mb-3",children:"تصاویر Variant"}),l.jsx(RI,{onUpload:k,onRemove:_,acceptedTypes:["image/*"],maxFileSize:5*1024*1024,maxFiles:5,label:"",description:"تصاویر مخصوص این variant را آپلود کنید"}),s.length>0&&l.jsx("div",{className:"mt-4",children:l.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:s.map((I,R)=>l.jsxs("div",{className:"relative group",children:[l.jsx("img",{src:I.url,alt:I.alt||`تصویر ${R+1}`,className:"w-full h-20 object-cover rounded-lg border"}),l.jsx("button",{type:"button",onClick:()=>_(I.id),className:"absolute -top-1 -right-1 w-5 h-5 bg-red-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]},I.id))})})]}),l.jsxs("div",{children:[l.jsx("h5",{className:"text-md font-medium text-gray-900 dark:text-gray-100 mb-3",children:"ویژگی‌های Variant"}),l.jsxs("div",{className:"flex gap-3 mb-3",children:[l.jsx("input",{type:"text",value:h,onChange:I=>p(I.target.value),placeholder:"نام ویژگی (مثل: رنگ، سایز)",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"}),l.jsx("input",{type:"text",value:m,onChange:I=>y(I.target.value),placeholder:"مقدار (مثل: قرمز، بزرگ)",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"}),l.jsxs(te,{type:"button",variant:"secondary",onClick:E,className:"flex items-center gap-2",children:[l.jsx(Pt,{className:"h-4 w-4"}),"افزودن"]})]}),Object.keys(c).length>0&&l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:Object.entries(c).map(([I,R])=>l.jsxs("div",{className:"flex items-center justify-between bg-white dark:bg-gray-600 px-3 py-2 rounded-md border",children:[l.jsxs("span",{className:"text-sm",children:[l.jsxs("strong",{children:[I,":"]})," ",String(R)]}),l.jsx("button",{type:"button",onClick:()=>O(I),className:"text-red-500 hover:text-red-700",children:l.jsx(Yt,{className:"h-3 w-3"})})]},I))})]}),l.jsxs("div",{children:[l.jsx("h5",{className:"text-md font-medium text-gray-900 dark:text-gray-100 mb-3",children:"Meta Data"}),l.jsxs("div",{className:"flex gap-3 mb-3",children:[l.jsx("input",{type:"text",value:g,onChange:I=>b(I.target.value),placeholder:"کلید Meta",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"}),l.jsx("input",{type:"text",value:x,onChange:I=>v(I.target.value),placeholder:"مقدار Meta",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"}),l.jsxs(te,{type:"button",variant:"secondary",onClick:P,className:"flex items-center gap-2",children:[l.jsx(Pt,{className:"h-4 w-4"}),"افزودن"]})]}),Object.keys(d).length>0&&l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:Object.entries(d).map(([I,R])=>l.jsxs("div",{className:"flex items-center justify-between bg-white dark:bg-gray-600 px-3 py-2 rounded-md border",children:[l.jsxs("span",{className:"text-sm",children:[l.jsxs("strong",{children:[I,":"]})," ",String(R)]}),l.jsx("button",{type:"button",onClick:()=>T(I),className:"text-red-500 hover:text-red-700",children:l.jsx(Yt,{className:"h-3 w-3"})})]},I))})]}),l.jsxs("div",{className:"flex items-center space-x-3 space-x-reverse",children:[l.jsx("input",{type:"checkbox",checked:a.enabled,onChange:I=>j("enabled",I.target.checked),className:"w-4 h-4 text-primary-600 bg-gray-100 border-gray-300 rounded focus:ring-primary-500"}),l.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Variant فعال باشد"})]})]})},qfe=({variants:e,onChange:t,disabled:r=!1})=>{const[n,a]=N.useState(!1),[i,s]=N.useState(null),o=()=>{s(null),a(!0)},c=h=>{s(h),a(!0)},u=h=>{const p=e.filter((m,y)=>y!==h);t(p)},d=h=>{if(i!==null){const p=[...e];p[i]=h,t(p)}else t([...e,h]);a(!1),s(null)},f=()=>{a(!1),s(null)};return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:["Variants محصول (",e.length,")"]}),!r&&!n&&l.jsxs(te,{onClick:o,className:"flex items-center gap-2",children:[l.jsx(Pt,{className:"h-4 w-4"}),"افزودن Variant"]})]}),n&&l.jsx(Vfe,{variant:i!==null?e[i]:void 0,onSave:d,onCancel:f,isEdit:i!==null}),e.length>0&&l.jsx("div",{className:"space-y-3",children:e.map((h,p)=>l.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex-1",children:[l.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[l.jsxs("h4",{className:"font-medium text-gray-900 dark:text-gray-100",children:["Variant ",p+1]}),l.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${h.enabled?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:h.enabled?"فعال":"غیرفعال"})]}),l.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm text-gray-600 dark:text-gray-400",children:[l.jsxs("div",{children:[l.jsx("strong",{children:"درصد کارمزد:"})," ",h.fee_percentage,"%"]}),l.jsxs("div",{children:[l.jsx("strong",{children:"درصد سود:"})," ",h.profit_percentage,"%"]}),l.jsxs("div",{children:[l.jsx("strong",{children:"موجودی:"})," ",h.stock_managed?`${h.stock_number} عدد`:"بدون محدودیت"]}),l.jsxs("div",{children:[l.jsx("strong",{children:"وزن:"})," ",h.weight," گرم"]})]}),h.images&&h.images.length>0&&l.jsxs("div",{className:"flex gap-2 mt-3",children:[h.images.slice(0,3).map((m,y)=>l.jsx("img",{src:m.url,alt:m.alt||`تصویر ${y+1}`,className:"w-12 h-12 object-cover rounded border"},m.id)),h.images.length>3&&l.jsxs("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-600 rounded border flex items-center justify-center text-xs",children:["+",h.images.length-3]})]}),Object.keys(h.attributes).length>0&&l.jsxs("div",{className:"mt-2",children:[l.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"ویژگی‌ها:"}),l.jsx("div",{className:"flex flex-wrap gap-1",children:Object.entries(h.attributes).map(([m,y])=>l.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs bg-blue-100 text-blue-800",children:[m,": ",String(y)]},m))})]})]}),!r&&l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>c(p),className:"p-2 text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-md",title:"ویرایش",children:l.jsx(Nn,{className:"h-4 w-4"})}),l.jsx("button",{onClick:()=>u(p),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-md",title:"حذف",children:l.jsx(Yt,{className:"h-4 w-4"})})]})]})},p))}),e.length===0&&!n&&l.jsxs("div",{className:"text-center py-8 bg-gray-50 dark:bg-gray-700 rounded-lg border-2 border-dashed border-gray-300 dark:border-gray-600",children:[l.jsx(Ss,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),l.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:"هنوز هیچ Variant ای اضافه نشده"}),!r&&l.jsxs(te,{onClick:o,className:"flex items-center gap-2 mx-auto",children:[l.jsx(Pt,{className:"h-4 w-4"}),"افزودن اولین Variant"]})]})]})},Wfe=jr({name:Se().required("نام محصول الزامی است").min(2,"نام محصول باید حداقل 2 کاراکتر باشد"),description:Se().default(""),design_style:Se().default(""),enabled:Ub().default(!0),total_sold:Ki().min(0).default(0),type:Ki().oneOf([0,1,2,3]).default(0),category_ids:fs().of(Ki()).default([]),product_option_id:Ki().optional().nullable(),attributes:jr().default({}),images:fs().of(jr()).default([]),variants:fs().default([])}),LN=()=>{var De,st,gt;const e=St(),{id:t}=Kn(),r=!!t,[n,a]=N.useState([]),[i,s]=N.useState({}),[o,c]=N.useState(""),[u,d]=N.useState(""),{data:f,isLoading:h}=TI(t||"",r),{data:p,isLoading:m}=ow(),{data:y,isLoading:g}=PI(),{mutate:b,isPending:x}=Lfe(),{mutate:v,isPending:S}=Ffe(),{mutateAsync:w}=CI(),{mutate:j}=$I(),k=x||S,{register:_,handleSubmit:E,formState:{errors:O,isValid:P,isDirty:T},setValue:M,watch:I,reset:R,control:F}=Rs({resolver:Ms(Wfe),mode:"onChange",defaultValues:{name:"",description:"",design_style:"",enabled:!0,total_sold:0,type:1,category_ids:[],product_option_id:void 0,attributes:{},images:[],variants:[]}}),U=I();N.useEffect(()=>{var z;if(r&&f){const ne=((z=f.variants)==null?void 0:z.map(ue=>({id:ue.id,enabled:ue.enabled,fee_percentage:ue.fee_percentage,profit_percentage:ue.profit_percentage,stock_limit:ue.stock_limit,stock_managed:ue.stock_managed,stock_number:ue.stock_number,weight:ue.weight,attributes:ue.attributes||{},meta:ue.meta||{},images:ue.images||[]})))||[];R({name:f.name,description:f.description||"",design_style:f.design_style||"",enabled:f.enabled,total_sold:f.total_sold||0,type:1,category_ids:f.category_ids||[],product_option_id:f.product_option_id||void 0,attributes:f.attributes||{},images:f.images||[],variants:ne}),a(f.images||[]),s(f.attributes||{})}},[r,f,R]);const D=async z=>{try{const ne=await w(z),ue={id:ne.id,url:ne.url,alt:z.name,order:n.length},G=[...n,ue];return a(G),M("images",G,{shouldValidate:!0,shouldDirty:!0}),ne}catch(ne){throw console.error("Upload error:",ne),ne}},V=z=>{const ne=n.filter(ue=>ue.id!==z);a(ne),M("images",ne,{shouldValidate:!0,shouldDirty:!0}),j(z)},H=()=>{if(o.trim()&&u.trim()){const z={...i,[o.trim()]:u.trim()};s(z),M("attributes",z,{shouldValidate:!0,shouldDirty:!0}),c(""),d("")}},Z=z=>{const ne={...i};delete ne[z],s(ne),M("attributes",ne,{shouldValidate:!0,shouldDirty:!0})},K=z=>{var ue,G;const ne={name:z.name,description:z.description,design_style:z.design_style,enabled:z.enabled,total_sold:z.total_sold,type:1,attributes:i,category_ids:z.category_ids.length>0?z.category_ids:[],product_option_id:z.product_option_id||void 0,images:n.map(Ce=>parseInt(Ce.id))};if(console.log("Submitting product data:",ne),r&&t){const Ce=((ue=z.variants)==null?void 0:ue.map(oe=>({id:oe.id||0,enabled:oe.enabled,fee_percentage:oe.fee_percentage,profit_percentage:oe.profit_percentage,stock_limit:oe.stock_limit,stock_managed:oe.stock_managed,stock_number:oe.stock_number,weight:oe.weight,attributes:oe.attributes&&Object.keys(oe.attributes).length>0?oe.attributes:{},meta:oe.meta&&Object.keys(oe.meta).length>0?oe.meta:{}})))||[];v({id:parseInt(t),...ne,variants:Ce},{onSuccess:()=>{e("/products")}})}else{const Ce=((G=z.variants)==null?void 0:G.map(oe=>({enabled:oe.enabled,fee_percentage:oe.fee_percentage,profit_percentage:oe.profit_percentage,stock_limit:oe.stock_limit,stock_managed:oe.stock_managed,stock_number:oe.stock_number,weight:oe.weight,attributes:oe.attributes&&Object.keys(oe.attributes).length>0?oe.attributes:{},meta:oe.meta&&Object.keys(oe.meta).length>0?oe.meta:{}})))||[];b({...ne,variants:Ce},{onSuccess:()=>{e("/products")}})}},le=()=>{e("/products")};if(r&&h)return l.jsx("div",{className:"flex justify-center items-center h-64",children:l.jsx(Mr,{})});const we=(p||[]).map(z=>({id:z.id,title:z.name,description:z.description}));(y||[]).map(z=>({id:z.id,title:z.title,description:`تعداد گزینه‌ها: ${(z.options||[]).length}`}));const Ae=l.jsxs(te,{variant:"secondary",onClick:le,className:"flex items-center gap-2",children:[l.jsx(Qn,{className:"h-4 w-4"}),"بازگشت"]});return l.jsxs(_r,{className:"max-w-6xl mx-auto",children:[l.jsx(Cl,{title:r?"ویرایش محصول":"ایجاد محصول جدید",subtitle:r?"ویرایش اطلاعات محصول":"اطلاعات محصول جدید را وارد کنید",backButton:Ae}),l.jsx("div",{className:"bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 rounded-lg p-6",children:l.jsxs("form",{onSubmit:E(K),className:"space-y-8",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:"اطلاعات پایه"}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[l.jsx("div",{className:"md:col-span-2",children:l.jsx(tt,{label:"نام محصول",..._("name"),error:(De=O.name)==null?void 0:De.message,placeholder:"نام محصول را وارد کنید"})}),l.jsxs("div",{className:"flex items-center space-x-3 space-x-reverse",children:[l.jsx("input",{type:"checkbox",..._("enabled"),className:"w-4 h-4 text-primary-600 bg-gray-100 border-gray-300 rounded focus:ring-primary-500 dark:focus:ring-primary-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"}),l.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"محصول فعال باشد"})]}),l.jsx(tt,{label:"تعداد فروخته شده",type:"number",..._("total_sold"),error:(st=O.total_sold)==null?void 0:st.message,placeholder:"0",min:"0"}),l.jsx(tt,{label:"استایل طراحی",..._("design_style"),error:(gt=O.design_style)==null?void 0:gt.message,placeholder:"مدرن، کلاسیک، مینیمال..."}),l.jsxs("div",{className:"md:col-span-2",children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"توضیحات"}),l.jsx("textarea",{..._("description"),rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",placeholder:"توضیحات کامل محصول را وارد کنید..."}),O.description&&l.jsx("p",{className:"text-red-500 text-sm mt-1",children:O.description.message})]})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:"دسته‌بندی و گزینه‌ها"}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[l.jsx(_x,{label:"دسته‌بندی‌ها",options:we,selectedValues:I("category_ids")||[],onChange:z=>M("category_ids",z,{shouldValidate:!0,shouldDirty:!0}),placeholder:"دسته‌بندی‌ها را انتخاب کنید...",isLoading:m}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"گزینه محصول"}),l.jsxs("select",{..._("product_option_id"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100",children:[l.jsx("option",{value:"",children:"بدون گزینه"}),(y||[]).map(z=>l.jsxs("option",{value:z.id,children:[z.title," (",(z.options||[]).length," گزینه)"]},z.id))]}),O.product_option_id&&l.jsx("p",{className:"text-red-500 text-sm mt-1",children:O.product_option_id.message})]})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:"تصاویر محصول"}),l.jsx(RI,{onUpload:D,onRemove:V,acceptedTypes:["image/*"],maxFileSize:5*1024*1024,maxFiles:10,label:"",description:"تصاویر محصول را اینجا بکشید یا کلیک کنید"}),n.length>0&&l.jsxs("div",{className:"mt-6",children:[l.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["تصاویر آپلود شده (",n.length,")"]}),l.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:n.map((z,ne)=>l.jsxs("div",{className:"relative group",children:[l.jsx("img",{src:z.url,alt:z.alt||`تصویر ${ne+1}`,className:"w-full h-24 object-cover rounded-lg border border-gray-200 dark:border-gray-600"}),l.jsx("button",{type:"button",onClick:()=>V(z.id),className:"absolute -top-2 -right-2 w-6 h-6 bg-red-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:l.jsx(pd,{className:"h-3 w-3"})}),ne===0&&l.jsx("div",{className:"absolute bottom-1 left-1 bg-primary-500 text-white text-xs px-1 py-0.5 rounded",children:"اصلی"})]},z.id))})]})]}),l.jsx("div",{children:l.jsx(qfe,{variants:I("variants")||[],onChange:z=>M("variants",z,{shouldValidate:!0,shouldDirty:!0})})}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:"ویژگی‌های سفارشی"}),l.jsxs("div",{className:"flex gap-3 mb-4",children:[l.jsx("input",{type:"text",value:o,onChange:z=>c(z.target.value),placeholder:"نام ویژگی (مثل: رنگ، سایز)",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"}),l.jsx("input",{type:"text",value:u,onChange:z=>d(z.target.value),placeholder:"مقدار (مثل: قرمز، بزرگ)",className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"}),l.jsxs(te,{type:"button",variant:"secondary",onClick:H,className:"flex items-center gap-2",children:[l.jsx(Pt,{className:"h-4 w-4"}),"افزودن"]})]}),Object.keys(i).length>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"ویژگی‌های فعلی:"}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Object.entries(i).map(([z,ne])=>l.jsxs("div",{className:"flex items-center justify-between bg-gray-50 dark:bg-gray-700 px-3 py-2 rounded-md",children:[l.jsxs("span",{className:"text-sm",children:[l.jsxs("strong",{children:[z,":"]})," ",String(ne)]}),l.jsx("button",{type:"button",onClick:()=>Z(z),className:"text-red-500 hover:text-red-700",children:l.jsx(Yt,{className:"h-4 w-4"})})]},z))})]})]}),U.name&&l.jsxs("div",{className:"border border-gray-200 dark:border-gray-600 rounded-lg p-4 bg-gray-50 dark:bg-gray-700",children:[l.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-3",children:"پیش‌نمایش محصول"}),l.jsxs("div",{className:"flex gap-4",children:[n.length>0&&l.jsx("img",{src:n[0].url,alt:U.name,className:"w-20 h-20 object-cover rounded-lg border"}),l.jsxs("div",{className:"flex-1 space-y-2",children:[l.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[l.jsx("strong",{children:"نام:"})," ",U.name]}),l.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[l.jsx("strong",{children:"نوع:"})," ",II[U.type]]}),l.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[l.jsx("strong",{children:"تعداد فروخته شده:"})," ",U.total_sold]}),U.design_style&&l.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[l.jsx("strong",{children:"استایل:"})," ",U.design_style]}),U.category_ids&&U.category_ids.length>0&&l.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[l.jsx("strong",{children:"دسته‌بندی‌ها:"})," ",p==null?void 0:p.filter(z=>U.category_ids.includes(z.id)).map(z=>z.name).join(", ")]}),U.variants&&U.variants.length>0&&l.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[l.jsx("strong",{children:"تعداد Variants:"})," ",U.variants.length," نوع"]}),Object.keys(i).length>0&&l.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:[l.jsx("strong",{children:"ویژگی‌ها:"})," ",Object.keys(i).length," مورد"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[U.enabled&&l.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800",children:"فعال"}),!U.enabled&&l.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-red-100 text-red-800",children:"غیرفعال"})]})]})]})]}),l.jsxs("div",{className:"flex justify-end space-x-4 space-x-reverse pt-6 border-t border-gray-200 dark:border-gray-600",children:[l.jsx(te,{type:"button",variant:"secondary",onClick:le,disabled:k,children:"انصراف"}),l.jsx(te,{type:"submit",loading:k,disabled:!P||k,children:r?"به‌روزرسانی":"ایجاد محصول"})]})]})}),l.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[l.jsx("h3",{className:"text-sm font-medium text-blue-900 dark:text-blue-100 mb-2",children:"راهنما"}),l.jsxs("ul",{className:"text-sm text-blue-700 dark:text-blue-300 space-y-1",children:[l.jsx("li",{children:"• نام محصول باید واضح و جذاب باشد"}),l.jsx("li",{children:"• میتوانید چندین دسته‌بندی برای محصول انتخاب کنید"}),l.jsx("li",{children:"• گزینه محصول برای محصولات متغیر (با رنگ، سایز و...) استفاده میشود"}),l.jsx("li",{children:"• ویژگی‌های سفارشی برای اطلاعات اضافی محصول مفید هستند"}),l.jsx("li",{children:"• Variants برای انواع مختلف محصول استفاده میشود"}),l.jsx("li",{children:"• اولین تصویر به عنوان تصویر اصلی محصول استفاده می‌شود"})]})]})]})},Gfe=()=>{const e=St(),{id:t=""}=Kn(),{data:r,isLoading:n,error:a}=TI(t);return n?l.jsx(Mr,{}):a?l.jsx("div",{className:"text-red-600",children:"خطا در بارگذاری اطلاعات محصول"}):r?l.jsxs("div",{className:"p-6",children:[l.jsx("div",{className:"mb-6",children:l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs(te,{variant:"secondary",onClick:()=>e("/products"),className:"flex items-center gap-2",children:[l.jsx(Qn,{className:"h-4 w-4"}),"بازگشت"]}),l.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"جزئیات محصول"})]}),l.jsx("div",{className:"flex gap-3",children:l.jsxs(te,{variant:"secondary",onClick:()=>e(`/products/${t}/edit`),className:"flex items-center gap-2",children:[l.jsx(Eb,{className:"h-4 w-4"}),"ویرایش"]})})]})}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[l.jsxs("div",{className:"lg:col-span-2",children:[l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 mb-6",children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-6",children:"اطلاعات محصول"}),l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"نام محصول"}),l.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:l.jsx("p",{className:"text-gray-900 dark:text-gray-100 font-medium",children:r.name})})]}),r.description&&l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"توضیحات"}),l.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:l.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:r.description})})]}),r.design_style&&l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"سبک طراحی"}),l.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:l.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:r.design_style})})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"نوع محصول"}),l.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:l.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:II[r.type]||"نامشخص"})})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"وضعیت"}),l.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:l.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${r.enabled?"bg-green-100 text-green-800 dark:bg-green-800 dark:text-green-100":"bg-red-100 text-red-800 dark:bg-red-800 dark:text-red-100"}`,children:r.enabled?"فعال":"غیرفعال"})})]})]})]})]}),r.images&&r.images.length>0&&l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 mb-6",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"تصاویر محصول"}),l.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:r.images.map((i,s)=>l.jsxs("div",{className:"relative group",children:[l.jsx("img",{src:i.url,alt:i.alt||`تصویر ${s+1}`,className:"w-full h-32 object-cover rounded-lg border border-gray-200 dark:border-gray-600"}),l.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-50 opacity-0 group-hover:opacity-100 transition-opacity rounded-lg flex items-center justify-center",children:l.jsx(_a,{className:"h-6 w-6 text-white"})})]},i.id||s))})]}),r.variants&&r.variants.length>0&&l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"نسخه‌های محصول"}),l.jsx("div",{className:"space-y-4",children:r.variants.map((i,s)=>l.jsx("div",{className:"p-4 border border-gray-200 dark:border-gray-600 rounded-lg",children:l.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"وضعیت:"}),l.jsx("span",{className:`ml-2 px-2 py-1 text-xs rounded-full ${i.enabled?"bg-green-100 text-green-800 dark:bg-green-800 dark:text-green-100":"bg-red-100 text-red-800 dark:bg-red-800 dark:text-red-100"}`,children:i.enabled?"فعال":"غیرفعال"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"موجودی:"}),l.jsx("span",{className:"ml-2 font-medium text-gray-900 dark:text-gray-100",children:i.stock_number})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"وزن:"}),l.jsxs("span",{className:"ml-2 font-medium text-gray-900 dark:text-gray-100",children:[i.weight," گرم"]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"درصد سود:"}),l.jsxs("span",{className:"ml-2 font-medium text-gray-900 dark:text-gray-100",children:[i.profit_percentage,"%"]})]})]})},i.id||s))})]})]}),l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"آمار"}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Kp,{className:"h-4 w-4 text-green-500"}),l.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تعداد فروش"})]}),l.jsx("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:r.total_sold||0})]}),r.variants&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ss,{className:"h-4 w-4 text-blue-500"}),l.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تعداد نسخه‌ها"})]}),l.jsx("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:r.variants.length})]}),r.images&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(mh,{className:"h-4 w-4 text-purple-500"}),l.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تعداد تصاویر"})]}),l.jsx("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:r.images.length})]})]})]}),r.categories&&r.categories.length>0&&l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"دسته‌بندی‌ها"}),l.jsx("div",{className:"space-y-2",children:r.categories.map(i=>l.jsxs("div",{className:"flex items-center gap-2 p-2 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[l.jsx(R0,{className:"h-4 w-4 text-blue-500"}),l.jsx("span",{className:"text-blue-900 dark:text-blue-100 font-medium",children:i.name})]},i.id))})]}),r.product_option&&l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"گزینه محصول"}),l.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[l.jsx("p",{className:"text-gray-900 dark:text-gray-100 font-medium",children:r.product_option.name}),r.product_option.description&&l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:r.product_option.description})]})]}),l.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"اطلاعات زمانی"}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx(Ob,{className:"h-4 w-4 text-green-500"}),l.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"تاریخ ایجاد"})]}),l.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:new Date(r.created_at).toLocaleDateString("fa-IR")})]}),l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx(uu,{className:"h-4 w-4 text-orange-500"}),l.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"آخرین به‌روزرسانی"})]}),l.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:new Date(r.updated_at).toLocaleDateString("fa-IR")})]})]})]})]})]})]}):l.jsx("div",{children:"محصول یافت نشد"})},Hfe=({children:e})=>{const{user:t,isLoading:r}=hd();return r?l.jsx("div",{className:"min-h-screen flex items-center justify-center",children:l.jsx(Mr,{})}):t?e:l.jsx(yA,{to:"/login",replace:!0})},Kfe=()=>l.jsxs(s4,{children:[l.jsx(Ie,{path:"/login",element:l.jsx(N5,{})}),l.jsxs(Ie,{path:"/",element:l.jsx(Hfe,{children:l.jsx(yde,{})}),children:[l.jsx(Ie,{index:!0,element:l.jsx(ade,{})}),l.jsx(Ie,{path:"users",element:l.jsx(lde,{})}),l.jsx(Ie,{path:"products",element:l.jsx(zfe,{})}),l.jsx(Ie,{path:"orders",element:l.jsx(cde,{})}),l.jsx(Ie,{path:"reports",element:l.jsx(ude,{})}),l.jsx(Ie,{path:"notifications",element:l.jsx(fde,{})}),l.jsx(Ie,{path:"roles",element:l.jsx(Ide,{})}),l.jsx(Ie,{path:"roles/create",element:l.jsx($N,{})}),l.jsx(Ie,{path:"roles/:id",element:l.jsx(Mde,{})}),l.jsx(Ie,{path:"roles/:id/edit",element:l.jsx($N,{})}),l.jsx(Ie,{path:"roles/:id/permissions",element:l.jsx(Dde,{})}),l.jsx(Ie,{path:"admin-users",element:l.jsx(Kde,{})}),l.jsx(Ie,{path:"admin-users/create",element:l.jsx(IN,{})}),l.jsx(Ie,{path:"admin-users/:id",element:l.jsx(nfe,{})}),l.jsx(Ie,{path:"admin-users/:id/edit",element:l.jsx(IN,{})}),l.jsx(Ie,{path:"permissions",element:l.jsx(ife,{})}),l.jsx(Ie,{path:"permissions/create",element:l.jsx(RN,{})}),l.jsx(Ie,{path:"permissions/:id/edit",element:l.jsx(RN,{})}),l.jsx(Ie,{path:"product-options",element:l.jsx(gfe,{})}),l.jsx(Ie,{path:"product-options/create",element:l.jsx(MN,{})}),l.jsx(Ie,{path:"product-options/:id/edit",element:l.jsx(MN,{})}),l.jsx(Ie,{path:"categories",element:l.jsx(Tfe,{})}),l.jsx(Ie,{path:"categories/create",element:l.jsx(DN,{})}),l.jsx(Ie,{path:"categories/:id/edit",element:l.jsx(DN,{})}),l.jsx(Ie,{path:"products/create",element:l.jsx(LN,{})}),l.jsx(Ie,{path:"products/:id",element:l.jsx(Gfe,{})}),l.jsx(Ie,{path:"products/:id/edit",element:l.jsx(LN,{})})]})]}),Qfe=()=>l.jsx(x6,{children:l.jsxs(z4,{client:b6,children:[l.jsx(KD,{children:l.jsx(XD,{children:l.jsx(HD,{children:l.jsx(p4,{children:l.jsx(Kfe,{})})})})}),l.jsx(eD,{initialIsOpen:!1})]})});Sg.createRoot(document.getElementById("root")).render(l.jsx(A.StrictMode,{children:l.jsx(Qfe,{})})); diff --git a/dist/assets/index-590deac5.js b/dist/assets/index-590deac5.js new file mode 100644 index 0000000..a46de18 --- /dev/null +++ b/dist/assets/index-590deac5.js @@ -0,0 +1 @@ +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}; diff --git a/dist/assets/vendor-charts-4c310516.js b/dist/assets/vendor-charts-4c310516.js new file mode 100644 index 0000000..881d2f7 --- /dev/null +++ b/dist/assets/vendor-charts-4c310516.js @@ -0,0 +1 @@ +import{c as t}from"./vendor-ui-8a3c5c7d.js";import{c as e,g as r,r as n,R as o}from"./vendor-react-ac1483bd.js";var i=Array.isArray,a="object"==typeof e&&e&&e.Object===Object&&e,c=a,u="object"==typeof self&&self&&self.Object===Object&&self,l=c||u||Function("return this")(),s=l.Symbol,f=s,p=Object.prototype,h=p.hasOwnProperty,y=p.toString,d=f?f.toStringTag:void 0;var v=function(t){var e=h.call(t,d),r=t[d];try{t[d]=void 0;var n=!0}catch(i){}var o=y.call(t);return n&&(e?t[d]=r:delete t[d]),o},m=Object.prototype.toString;var b=v,g=function(t){return m.call(t)},w=s?s.toStringTag:void 0;var x=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":w&&w in Object(t)?b(t):g(t)};var O=function(t){return null!=t&&"object"==typeof t},j=x,S=O;var P=function(t){return"symbol"==typeof t||S(t)&&"[object Symbol]"==j(t)},A=i,E=P,k=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,T=/^\w*$/;var M=function(t,e){if(A(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!E(t))||(T.test(t)||!k.test(t)||null!=e&&t in Object(e))};var _=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};const C=r(_);var D=x,I=_;var N=function(t){if(!I(t))return!1;var e=D(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e};const B=r(N);var R,L=l["__core-js_shared__"],z=(R=/[^.]+$/.exec(L&&L.keys&&L.keys.IE_PROTO||""))?"Symbol(src)_1."+R:"";var F=function(t){return!!z&&z in t},U=Function.prototype.toString;var $=function(t){if(null!=t){try{return U.call(t)}catch(e){}try{return t+""}catch(e){}}return""},q=N,W=F,X=_,V=$,H=/^\[object .+?Constructor\]$/,G=Function.prototype,K=Object.prototype,Y=G.toString,Z=K.hasOwnProperty,J=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Q=function(t){return!(!X(t)||W(t))&&(q(t)?J:H).test(V(t))},tt=function(t,e){return null==t?void 0:t[e]};var et=function(t,e){var r=tt(t,e);return Q(r)?r:void 0},rt=et(Object,"create"),nt=rt;var ot=function(){this.__data__=nt?nt(null):{},this.size=0};var it=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},at=rt,ct=Object.prototype.hasOwnProperty;var ut=function(t){var e=this.__data__;if(at){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return ct.call(e,t)?e[t]:void 0},lt=rt,st=Object.prototype.hasOwnProperty;var ft=rt;var pt=ot,ht=it,yt=ut,dt=function(t){var e=this.__data__;return lt?void 0!==e[t]:st.call(e,t)},vt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ft&&void 0===e?"__lodash_hash_undefined__":e,this};function mt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e-1},Ct=function(t,e){var r=this.__data__,n=Et(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function Dt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e0?1:-1},ir=function(t){return Ce(t)&&t.indexOf("%")===t.length-1},ar=function(t){return er(t)&&!nr(t)},cr=function(t){return ar(t)||Ce(t)},ur=0,lr=function(t){var e=++ur;return"".concat(t||"").concat(e)},sr=function(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!ar(t)&&!Ce(t))return n;if(ir(t)){var i=t.indexOf("%");r=e*parseFloat(t.slice(0,i))/100}else r=+t;return nr(r)&&(r=n),o&&r>e&&(r=e),r},fr=function(t){if(!t)return null;var e=Object.keys(t);return e&&e.length?t[e[0]]:null},pr=function(t,e){return ar(t)&&ar(e)?function(r){return t+r*(e-t)}:function(){return e}};function hr(t,e,r){return t&&t.length?t.find(function(t){return t&&("function"==typeof e?e(t):Ee(t,e))===r}):null}var yr=function(t,e){return ar(t)&&ar(e)?t-e:Ce(t)&&Ce(e)?t.localeCompare(e):t instanceof Date&&e instanceof Date?t.getTime()-e.getTime():String(t).localeCompare(String(e))};function dr(t,e){for(var r in t)if({}.hasOwnProperty.call(t,r)&&(!{}.hasOwnProperty.call(e,r)||t[r]!==e[r]))return!1;for(var n in e)if({}.hasOwnProperty.call(e,n)&&!{}.hasOwnProperty.call(t,n))return!1;return!0}function vr(t){return(vr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var mr=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],br=["points","pathLength"],gr={svg:["viewBox","children"],polygon:br,polyline:br},wr=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],xr=function(t,e){if(!t||"function"==typeof t||"boolean"==typeof t)return null;var r=t;if(n.isValidElement(t)&&(r=t.props),!C(r))return null;var o={};return Object.keys(r).forEach(function(t){wr.includes(t)&&(o[t]=e||function(e){return r[t](r,e)})}),o},Or=function(t,e,r){if(!C(t)||"object"!==vr(t))return null;var n=null;return Object.keys(t).forEach(function(o){var i=t[o];wr.includes(o)&&"function"==typeof i&&(n||(n={}),n[o]=function(t,e,r){return function(n){return t(e,r,n),null}}(i,e,r))}),n},jr=["children"],Sr=["children"];function Pr(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function Ar(t){return(Ar="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Er={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},kr=function(t){return"string"==typeof t?t:t?t.displayName||t.name||"Component":""},Tr=null,Mr=null,_r=function t(e){if(e===Tr&&Array.isArray(Mr))return Mr;var r=[];return n.Children.forEach(e,function(e){ke(e)||(Ze.isFragment(e)?r=r.concat(t(e.props.children)):r.push(e))}),Mr=r,Tr=e,r};function Cr(t,e){var r=[],n=[];return n=Array.isArray(e)?e.map(function(t){return kr(t)}):[kr(e)],_r(t).forEach(function(t){var e=Ee(t,"type.displayName")||Ee(t,"type.name");-1!==n.indexOf(e)&&r.push(t)}),r}function Dr(t,e){var r=Cr(t,e);return r&&r[0]}var Ir=function(t){if(!t||!t.props)return!1;var e=t.props,r=e.width,n=e.height;return!(!ar(r)||r<=0||!ar(n)||n<=0)},Nr=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],Br=function(t,e,r){if(!t||"function"==typeof t||"boolean"==typeof t)return null;var o=t;if(n.isValidElement(t)&&(o=t.props),!C(o))return null;var i={};return Object.keys(o).forEach(function(t){var n;(function(t,e,r,n){var o,i=null!==(o=null==gr?void 0:gr[n])&&void 0!==o?o:[];return e.startsWith("data-")||!B(t)&&(n&&i.includes(e)||mr.includes(e))||r&&wr.includes(e)})(null===(n=o)||void 0===n?void 0:n[t],t,e,r)&&(i[t]=o[t])}),i},Rr=function t(e,r){if(e===r)return!0;var o=n.Children.count(e);if(o!==n.Children.count(r))return!1;if(0===o)return!0;if(1===o)return Lr(Array.isArray(e)?e[0]:e,Array.isArray(r)?r[0]:r);for(var i=0;i=0}(t))r.push(t);else if(t){var i=kr(t.type),a=e[i]||{},c=a.handler,u=a.once;if(c&&(!u||!n[i])){var l=c(t,i,o);r.push(l),n[i]=!0}}}),r},Fr=["children","width","height","viewBox","className","style","title","desc"];function Ur(){return Ur=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function qr(e){var r=e.children,n=e.width,i=e.height,a=e.viewBox,c=e.className,u=e.style,l=e.title,s=e.desc,f=$r(e,Fr),p=a||{width:n,height:i,x:0,y:0},h=t("recharts-surface",c);return o.createElement("svg",Ur({},Br(f,!0,"svg"),{className:h,width:n,height:i,style:u,viewBox:"".concat(p.x," ").concat(p.y," ").concat(p.width," ").concat(p.height)}),o.createElement("title",null,l),o.createElement("desc",null,s),r)}var Wr=["children","className"];function Xr(){return Xr=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var Hr=o.forwardRef(function(e,r){var n=e.children,i=e.className,a=Vr(e,Wr),c=t("recharts-layer",i);return o.createElement("g",Xr({className:c},Br(a,!0),{ref:r}),n)}),Gr=function(t,e){for(var r=arguments.length,n=new Array(r>2?r-2:0),o=2;oo?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(o);++n=n?t:Kr(t,e,r)},Zr=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Jr=function(t){return Zr.test(t)};var Qr=function(t){return t.split("")},tn="\\ud800-\\udfff",en="["+tn+"]",rn="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",nn="\\ud83c[\\udffb-\\udfff]",on="[^"+tn+"]",an="(?:\\ud83c[\\udde6-\\uddff]){2}",cn="[\\ud800-\\udbff][\\udc00-\\udfff]",un="(?:"+rn+"|"+nn+")"+"?",ln="[\\ufe0e\\ufe0f]?",sn=ln+un+("(?:\\u200d(?:"+[on,an,cn].join("|")+")"+ln+un+")*"),fn="(?:"+[on+rn+"?",rn,an,cn,en].join("|")+")",pn=RegExp(nn+"(?="+nn+")|"+fn+sn,"g");var hn=Qr,yn=Jr,dn=function(t){return t.match(pn)||[]};var vn=Yr,mn=Jr,bn=function(t){return yn(t)?dn(t):hn(t)},gn=ye;const wn=r(function(t){return function(e){e=gn(e);var r=mn(e)?bn(e):void 0,n=r?r[0]:e.charAt(0),o=r?vn(r,1).join(""):e.slice(1);return n[t]()+o}}("toUpperCase"));function xn(t){return function(){return t}}const On=Math.cos,jn=Math.sin,Sn=Math.sqrt,Pn=Math.PI,An=2*Pn,En=Math.PI,kn=2*En,Tn=1e-6,Mn=kn-Tn;function _n(t){this._+=t[0];for(let e=1,r=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return _n;const r=10**e;return function(t){this._+=t[0];for(let e=1,n=t.length;eTn)if(Math.abs(s*c-u*l)>Tn&&o){let p=r-i,h=n-a,y=c*c+u*u,d=p*p+h*h,v=Math.sqrt(y),m=Math.sqrt(f),b=o*Math.tan((En-Math.acos((y+f-d)/(2*v*m)))/2),g=b/m,w=b/v;Math.abs(g-1)>Tn&&this._append`L${t+g*l},${e+g*s}`,this._append`A${o},${o},0,0,${+(s*p>l*h)},${this._x1=t+w*c},${this._y1=e+w*u}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,r,n,o,i){if(t=+t,e=+e,i=!!i,(r=+r)<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(n),c=r*Math.sin(n),u=t+a,l=e+c,s=1^i,f=i?n-o:o-n;null===this._x1?this._append`M${u},${l}`:(Math.abs(this._x1-u)>Tn||Math.abs(this._y1-l)>Tn)&&this._append`L${u},${l}`,r&&(f<0&&(f=f%kn+kn),f>Mn?this._append`A${r},${r},0,1,${s},${t-a},${e-c}A${r},${r},0,1,${s},${this._x1=u},${this._y1=l}`:f>Tn&&this._append`A${r},${r},0,${+(f>=En)},${s},${this._x1=t+r*Math.cos(o)},${this._y1=e+r*Math.sin(o)}`)}rect(t,e,r,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${r=+r}v${+n}h${-r}Z`}toString(){return this._}}function Dn(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(null==r)e=null;else{const t=Math.floor(r);if(!(t>=0))throw new RangeError(`invalid digits: ${r}`);e=t}return t},()=>new Cn(e)}function In(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Nn(t){this._context=t}function Bn(t){return new Nn(t)}function Rn(t){return t[0]}function Ln(t){return t[1]}function zn(t,e){var r=xn(!0),n=null,o=Bn,i=null,a=Dn(c);function c(c){var u,l,s,f=(c=In(c)).length,p=!1;for(null==n&&(i=o(s=a())),u=0;u<=f;++u)!(u=f;--p)c.point(m[p],b[p]);c.lineEnd(),c.areaEnd()}v&&(m[s]=+t(h,s,l),b[s]=+e(h,s,l),c.point(n?+n(h,s,l):m[s],r?+r(h,s,l):b[s]))}if(y)return c=null,y+""||null}function s(){return zn().defined(o).curve(a).context(i)}return t="function"==typeof t?t:void 0===t?Rn:xn(+t),e="function"==typeof e?e:xn(void 0===e?0:+e),r="function"==typeof r?r:void 0===r?Ln:xn(+r),l.x=function(e){return arguments.length?(t="function"==typeof e?e:xn(+e),n=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:xn(+e),l):t},l.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:xn(+t),l):n},l.y=function(t){return arguments.length?(e="function"==typeof t?t:xn(+t),r=null,l):e},l.y0=function(t){return arguments.length?(e="function"==typeof t?t:xn(+t),l):e},l.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:xn(+t),l):r},l.lineX0=l.lineY0=function(){return s().x(t).y(e)},l.lineY1=function(){return s().x(t).y(r)},l.lineX1=function(){return s().x(n).y(e)},l.defined=function(t){return arguments.length?(o="function"==typeof t?t:xn(!!t),l):o},l.curve=function(t){return arguments.length?(a=t,null!=i&&(c=a(i)),l):a},l.context=function(t){return arguments.length?(null==t?i=c=null:c=a(i=t),l):i},l}Nn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};class Un{constructor(t,e){this._context=t,this._x=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,e,t,e):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+e)/2,t,this._y0,t,e)}this._x0=t,this._y0=e}}const $n={draw(t,e){const r=Sn(e/Pn);t.moveTo(r,0),t.arc(0,0,r,0,An)}},qn={draw(t,e){const r=Sn(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},Wn=Sn(1/3),Xn=2*Wn,Vn={draw(t,e){const r=Sn(e/Xn),n=r*Wn;t.moveTo(0,-r),t.lineTo(n,0),t.lineTo(0,r),t.lineTo(-n,0),t.closePath()}},Hn={draw(t,e){const r=Sn(e),n=-r/2;t.rect(n,n,r,r)}},Gn=jn(Pn/10)/jn(7*Pn/10),Kn=jn(An/10)*Gn,Yn=-On(An/10)*Gn,Zn={draw(t,e){const r=Sn(.8908130915292852*e),n=Kn*r,o=Yn*r;t.moveTo(0,-r),t.lineTo(n,o);for(let i=1;i<5;++i){const e=An*i/5,a=On(e),c=jn(e);t.lineTo(c*r,-a*r),t.lineTo(a*n-c*o,c*n+a*o)}t.closePath()}},Jn=Sn(3),Qn={draw(t,e){const r=-Sn(e/(3*Jn));t.moveTo(0,2*r),t.lineTo(-Jn*r,-r),t.lineTo(Jn*r,-r),t.closePath()}},to=-.5,eo=Sn(3)/2,ro=1/Sn(12),no=3*(ro/2+1),oo={draw(t,e){const r=Sn(e/no),n=r/2,o=r*ro,i=n,a=r*ro+r,c=-i,u=a;t.moveTo(n,o),t.lineTo(i,a),t.lineTo(c,u),t.lineTo(to*n-eo*o,eo*n+to*o),t.lineTo(to*i-eo*a,eo*i+to*a),t.lineTo(to*c-eo*u,eo*c+to*u),t.lineTo(to*n+eo*o,to*o-eo*n),t.lineTo(to*i+eo*a,to*a-eo*i),t.lineTo(to*c+eo*u,to*u-eo*c),t.closePath()}};function io(){}function ao(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function co(t){this._context=t}function uo(t){this._context=t}function lo(t){this._context=t}function so(t){this._context=t}function fo(t){return t<0?-1:1}function po(t,e,r){var n=t._x1-t._x0,o=e-t._x1,i=(t._y1-t._y0)/(n||o<0&&-0),a=(r-t._y1)/(o||n<0&&-0),c=(i*o+a*n)/(n+o);return(fo(i)+fo(a))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs(c))||0}function ho(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function yo(t,e,r){var n=t._x0,o=t._y0,i=t._x1,a=t._y1,c=(i-n)/3;t._context.bezierCurveTo(n+c,o+c*e,i-c,a-c*r,i,a)}function vo(t){this._context=t}function mo(t){this._context=new bo(t)}function bo(t){this._context=t}function go(t){this._context=t}function wo(t){var e,r,n=t.length-1,o=new Array(n),i=new Array(n),a=new Array(n);for(o[0]=0,i[0]=2,a[0]=t[0]+2*t[1],e=1;e=0;--e)o[e]=(a[e]-o[e+1])/i[e];for(i[n-1]=(t[n]+o[n-1])/2,e=0;e1)for(var r,n,o,i=1,a=t[e[0]],c=a.length;i=0;)r[e]=e;return r}function So(t,e){return t[e]}function Po(t){const e=[];return e.key=t,e}function Ao(t){return(Ao="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}co.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ao(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ao(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},uo.prototype={areaStart:io,areaEnd:io,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:ao(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},lo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:ao(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},so.prototype={areaStart:io,areaEnd:io,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}},vo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:yo(this,this._t0,ho(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var r=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,yo(this,ho(this,r=po(this,t,e)),r);break;default:yo(this,this._t0,r=po(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}},(mo.prototype=Object.create(vo.prototype)).point=function(t,e){vo.prototype.point.call(this,e,t)},bo.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,r,n,o,i){this._context.bezierCurveTo(e,t,n,r,i,o)}},go.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===r)this._context.lineTo(t[1],e[1]);else for(var n=wo(t),o=wo(e),i=0,a=1;a=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}}this._x=t,this._y=e}};var Eo=["type","size","sizeType"];function ko(){return ko=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var Do={symbolCircle:$n,symbolCross:qn,symbolDiamond:Vn,symbolSquare:Hn,symbolStar:Zn,symbolTriangle:Qn,symbolWye:oo},Io=Math.PI/180,No=function(e){var r,n,i=e.type,a=void 0===i?"circle":i,c=e.size,u=void 0===c?64:c,l=e.sizeType,s=void 0===l?"area":l,f=Mo(Mo({},Co(e,Eo)),{},{type:a,size:u,sizeType:s}),p=f.className,h=f.cx,y=f.cy,d=Br(f,!0);return h===+h&&y===+y&&u===+u?o.createElement("path",ko({},d,{className:t("recharts-symbols",p),transform:"translate(".concat(h,", ").concat(y,")"),d:(r=function(t){var e="symbol".concat(wn(t));return Do[e]||$n}(a),n=function(t,e){let r=null,n=Dn(o);function o(){let o;if(r||(r=o=n()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),o)return r=null,o+""||null}return t="function"==typeof t?t:xn(t||$n),e="function"==typeof e?e:xn(void 0===e?64:+e),o.type=function(e){return arguments.length?(t="function"==typeof e?e:xn(e),o):t},o.size=function(t){return arguments.length?(e="function"==typeof t?t:xn(+t),o):e},o.context=function(t){return arguments.length?(r=null==t?null:t,o):r},o}().type(r).size(function(t,e,r){if("area"===e)return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return.5*t*t/Math.sqrt(3);case"square":return t*t;case"star":var n=18*Io;return 1.25*t*t*(Math.tan(n)-Math.tan(2*n)*Math.pow(Math.tan(n),2));case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}}(u,s,a)),n())})):null};function Bo(t){return(Bo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ro(){return Ro=Object.assign?Object.assign.bind():function(t){for(var e=1;e');var y=r.inactive?u:r.color;return o.createElement("li",Ro({className:p,style:s,key:"legend-item-".concat(n)},Or(e.props,r,n)),o.createElement(qr,{width:i,height:i,viewBox:l,style:f},e.renderIcon(r)),o.createElement("span",{className:"recharts-legend-item-text",style:{color:y}},a?a(h,r,n):h))})}},{key:"render",value:function(){var t=this.props,e=t.payload,r=t.layout,n=t.align;if(!e||!e.length)return null;var i={padding:0,margin:0,textAlign:"horizontal"===r?n:"left"};return o.createElement("ul",{className:"recharts-default-legend",style:i},this.renderItems())}}],i&&zo(r.prototype,i),a&&zo(r,a),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,i,a}();Wo(Ho,"displayName","Legend"),Wo(Ho,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Go=It;var Ko=It,Yo=Nt,Zo=Zt;var Jo=It,Qo=function(){this.__data__=new Go,this.size=0},ti=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},ei=function(t){return this.__data__.get(t)},ri=function(t){return this.__data__.has(t)},ni=function(t,e){var r=this.__data__;if(r instanceof Ko){var n=r.__data__;if(!Yo||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Zo(n)}return r.set(t,e),this.size=r.size,this};function oi(t){var e=this.__data__=new Jo(t);this.size=e.size}oi.prototype.clear=Qo,oi.prototype.delete=ti,oi.prototype.get=ei,oi.prototype.has=ri,oi.prototype.set=ni;var ii=oi;var ai=Zt,ci=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},ui=function(t){return this.__data__.has(t)};function li(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new ai;++ec))return!1;var l=i.get(t),s=i.get(e);if(l&&s)return l==e&&s==t;var f=-1,p=!0,h=2&r?new hi:void 0;for(i.set(t,e),i.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991},na=x,oa=ra,ia=O,aa={};aa["[object Float32Array]"]=aa["[object Float64Array]"]=aa["[object Int8Array]"]=aa["[object Int16Array]"]=aa["[object Int32Array]"]=aa["[object Uint8Array]"]=aa["[object Uint8ClampedArray]"]=aa["[object Uint16Array]"]=aa["[object Uint32Array]"]=!0,aa["[object Arguments]"]=aa["[object Array]"]=aa["[object ArrayBuffer]"]=aa["[object Boolean]"]=aa["[object DataView]"]=aa["[object Date]"]=aa["[object Error]"]=aa["[object Function]"]=aa["[object Map]"]=aa["[object Number]"]=aa["[object Object]"]=aa["[object RegExp]"]=aa["[object Set]"]=aa["[object String]"]=aa["[object WeakMap]"]=!1;var ca=function(t){return ia(t)&&oa(t.length)&&!!aa[na(t)]};var ua=function(t){return function(e){return t(e)}},la={exports:{}};!function(t,e){var r=a,n=e&&!e.nodeType&&e,o=n&&t&&!t.nodeType&&t,i=o&&o.exports===n&&r.process,c=function(){try{var t=o&&o.require&&o.require("util").types;return t||i&&i.binding&&i.binding("util")}catch(e){}}();t.exports=c}(la,la.exports);var sa=la.exports,fa=ca,pa=ua,ha=sa&&sa.isTypedArray,ya=ha?pa(ha):fa,da=Ni,va=Zi,ma=i,ba=Qi,ga=ea,wa=ya,xa=Object.prototype.hasOwnProperty;var Oa=function(t,e){var r=ma(t),n=!r&&va(t),o=!r&&!n&&ba(t),i=!r&&!n&&!o&&wa(t),a=r||n||o||i,c=a?da(t.length,String):[],u=c.length;for(var l in t)!e&&!xa.call(t,l)||a&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||ga(l,u))||c.push(l);return c},ja=Object.prototype;var Sa=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||ja)};var Pa=function(t,e){return function(r){return t(e(r))}},Aa=Pa(Object.keys,Object),Ea=Sa,ka=Aa,Ta=Object.prototype.hasOwnProperty;var Ma=N,_a=ra;var Ca=function(t){return null!=t&&_a(t.length)&&!Ma(t)},Da=Oa,Ia=function(t){if(!Ea(t))return ka(t);var e=[];for(var r in Object(t))Ta.call(t,r)&&"constructor"!=r&&e.push(r);return e},Na=Ca;var Ba=function(t){return Na(t)?Da(t):Ia(t)},Ra=Ti,La=Ii,za=Ba;var Fa=function(t){return Ra(t,za,La)},Ua=Object.prototype.hasOwnProperty;var $a=function(t,e,r,n,o,i){var a=1&r,c=Fa(t),u=c.length;if(u!=Fa(e).length&&!a)return!1;for(var l=u;l--;){var s=c[l];if(!(a?s in e:Ua.call(e,s)))return!1}var f=i.get(t),p=i.get(e);if(f&&p)return f==e&&p==t;var h=!0;i.set(t,e),i.set(e,t);for(var y=a;++l-1};var yu=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n=200){var l=e?null:Ou(t);if(l)return ju(l);a=!1,o=xu,u=new bu}else u=e?[]:c;t:for(;++n=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function Fu(t){return t.value}var Uu=function(){function t(){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);for(var r=arguments.length,n=new Array(r),o=0;o1||Math.abs(e.height-this.lastBoundingBox.height)>1)&&(this.lastBoundingBox.width=e.width,this.lastBoundingBox.height=e.height,t&&t(e)):-1===this.lastBoundingBox.width&&-1===this.lastBoundingBox.height||(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,t&&t(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?_u({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(t){var e,r,n=this.props,o=n.layout,i=n.align,a=n.verticalAlign,c=n.margin,u=n.chartWidth,l=n.chartHeight;return t&&(void 0!==t.left&&null!==t.left||void 0!==t.right&&null!==t.right)||(e="center"===i&&"vertical"===o?{left:((u||0)-this.getBBoxSnapshot().width)/2}:"right"===i?{right:c&&c.right||0}:{left:c&&c.left||0}),t&&(void 0!==t.top&&null!==t.top||void 0!==t.bottom&&null!==t.bottom)||(r="middle"===a?{top:((l||0)-this.getBBoxSnapshot().height)/2}:"bottom"===a?{bottom:c&&c.bottom||0}:{top:c&&c.top||0}),_u(_u({},e),r)}},{key:"render",value:function(){var t=this,e=this.props,r=e.content,n=e.width,i=e.height,a=e.wrapperStyle,c=e.payloadUniqBy,u=e.payload,l=_u(_u({position:"absolute",width:n||"auto",height:i||"auto"},this.getDefaultPosition(a)),a);return o.createElement("div",{className:"recharts-legend-wrapper",style:l,ref:function(e){t.wrapperNode=e}},function(t,e){if(o.isValidElement(t))return o.cloneElement(t,e);if("function"==typeof t)return o.createElement(t,e);e.ref;var r=zu(e,Tu);return o.createElement(Ho,r)}(r,_u(_u({},this.props),{},{payload:Eu(u,c,Fu)})))}}])&&Cu(e.prototype,r),i&&Cu(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r,i}();Ru(Uu,"displayName","Legend"),Ru(Uu,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var $u=Zi,qu=i,Wu=s?s.isConcatSpreadable:void 0;var Xu=Ai,Vu=function(t){return qu(t)||$u(t)||!!(Wu&&t&&t[Wu])};var Hu=function t(e,r,n,o,i){var a=-1,c=e.length;for(n||(n=Vu),i||(i=[]);++a0&&n(u)?r>1?t(u,r-1,n,o,i):Xu(i,u):o||(i[i.length]=u)}return i};var Gu=function(t){return function(e,r,n){for(var o=-1,i=Object(e),a=n(e),c=a.length;c--;){var u=a[t?c:++o];if(!1===r(i[u],u,i))break}return e}}(),Ku=Ba;var Yu=function(t,e){return t&&Gu(t,e,Ku)},Zu=Ca;var Ju=function(t,e){return function(r,n){if(null==r)return r;if(!Zu(r))return t(r,n);for(var o=r.length,i=e?o:-1,a=Object(r);(e?i--:++ie||i&&a&&u&&!c&&!l||n&&a&&u||!r&&u||!o)return 1;if(!n&&!i&&!l&&t=c?u:u*("desc"==r[n]?-1:1)}return t.index-e.index},fl=Yc,pl=i;var hl=function(t,e,r){e=e.length?ol(e,function(t){return pl(t)?function(e){return il(e,1===t.length?t[0]:t)}:t}):[fl];var n=-1;e=ol(e,ll(al));var o=cl(t,function(t,r,o){return{criteria:ol(e,function(e){return e(t)}),index:++n,value:t}});return ul(o,function(t,e){return sl(t,e,r)})};var yl=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)},dl=Math.max;var vl=function(t,e,r){return e=dl(void 0===e?t.length-1:e,0),function(){for(var n=arguments,o=-1,i=dl(n.length-e,0),a=Array(i);++o0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Ol),Pl=Yc,Al=vl,El=Sl;var kl=wt,Tl=Ca,Ml=ea,_l=_;var Cl=function(t,e,r){if(!_l(r))return!1;var n=typeof e;return!!("number"==n?Tl(r)&&Ml(e,r.length):"string"==n&&e in r)&&kl(r[e],t)},Dl=Hu,Il=hl,Nl=Cl;const Bl=r(function(t,e){return El(Al(t,e,Pl),t+"")}(function(t,e){if(null==t)return[];var r=e.length;return r>1&&Nl(t,e[0],e[1])?e=[]:r>2&&Nl(e[0],e[1],e[2])&&(e=[e[0]]),Il(t,Dl(e,1),[])}));function Rl(t){return(Rl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ll(){return Ll=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);r=r.x),"".concat(Gl,"-left"),ar(n)&&r&&ar(r.x)&&n=r.y),"".concat(Gl,"-top"),ar(o)&&r&&ar(r.y)&&ou[n]+l?Math.max(s,u[n]):Math.max(f,u[n])}function Jl(t){return(Jl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ql(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function ts(t){for(var e=1;e1||Math.abs(t.height-this.state.lastBoundingBox.height)>1)&&this.setState({lastBoundingBox:{width:t.width,height:t.height}})}else-1===this.state.lastBoundingBox.width&&-1===this.state.lastBoundingBox.height||this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var t,e;this.props.active&&this.updateBBox(),this.state.dismissed&&((null===(t=this.props.coordinate)||void 0===t?void 0:t.x)===this.state.dismissedAtCoordinate.x&&(null===(e=this.props.coordinate)||void 0===e?void 0:e.y)===this.state.dismissedAtCoordinate.y||(this.state.dismissed=!1))}},{key:"render",value:function(){var t=this,e=this.props,r=e.active,n=e.allowEscapeViewBox,i=e.animationDuration,a=e.animationEasing,c=e.children,u=e.coordinate,l=e.hasPayload,s=e.isAnimationActive,f=e.offset,p=e.position,h=e.reverseDirection,y=e.useTranslate3d,d=e.viewBox,v=e.wrapperStyle,m=function(t){var e,r,n=t.allowEscapeViewBox,o=t.coordinate,i=t.offsetTopLeft,a=t.position,c=t.reverseDirection,u=t.tooltipBox,l=t.useTranslate3d,s=t.viewBox;return{cssProperties:u.height>0&&u.width>0&&o?function(t){var e=t.translateX,r=t.translateY;return{transform:t.useTranslate3d?"translate3d(".concat(e,"px, ").concat(r,"px, 0)"):"translate(".concat(e,"px, ").concat(r,"px)")}}({translateX:e=Zl({allowEscapeViewBox:n,coordinate:o,key:"x",offsetTopLeft:i,position:a,reverseDirection:c,tooltipDimension:u.width,viewBox:s,viewBoxDimension:s.width}),translateY:r=Zl({allowEscapeViewBox:n,coordinate:o,key:"y",offsetTopLeft:i,position:a,reverseDirection:c,tooltipDimension:u.height,viewBox:s,viewBoxDimension:s.height}),useTranslate3d:l}):Kl,cssClasses:Yl({translateX:e,translateY:r,coordinate:o})}}({allowEscapeViewBox:n,coordinate:u,offsetTopLeft:f,position:p,reverseDirection:h,tooltipBox:this.state.lastBoundingBox,useTranslate3d:y,viewBox:d}),b=m.cssClasses,g=m.cssProperties,w=ts(ts({transition:s&&r?"transform ".concat(i,"ms ").concat(a):void 0},g),{},{pointerEvents:"none",visibility:!this.state.dismissed&&r&&l?"visible":"hidden",position:"absolute",top:0,left:0},v);return o.createElement("div",{tabIndex:-1,className:b,style:w,ref:function(e){t.wrapperNode=e}},c)}}])&&es(e.prototype,r),i&&es(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r,i}(),ls={isSsr:!("undefined"!=typeof window&&window.document&&window.document.createElement&&window.setTimeout),get:function(t){return ls[t]},set:function(t,e){if("string"==typeof t)ls[t]=e;else{var r=Object.keys(t);r&&r.length&&r.forEach(function(e){ls[e]=t[e]})}}};function ss(t){return(ss="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function fs(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function ps(t){for(var e=1;e0;return o.createElement(us,{allowEscapeViewBox:n,animationDuration:i,animationEasing:a,isAnimationActive:s,active:r,coordinate:u,hasPayload:w,offset:f,position:y,reverseDirection:d,useTranslate3d:v,viewBox:m,wrapperStyle:b},function(t,e){return o.isValidElement(t)?o.cloneElement(t,e):"function"==typeof t?o.createElement(t,e):o.createElement(Xl,e)}(c,ps(ps({},this.props),{},{payload:g})))}}])&&hs(e.prototype,r),i&&hs(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r,i}();bs(xs,"displayName","Tooltip"),bs(xs,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!ls.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var Os=l,js=/\s/;var Ss=function(t){for(var e=t.length;e--&&js.test(t.charAt(e)););return e},Ps=/^\s+/;var As=function(t){return t?t.slice(0,Ss(t)+1).replace(Ps,""):t},Es=_,ks=P,Ts=/^[-+]0x[0-9a-f]+$/i,Ms=/^0b[01]+$/i,_s=/^0o[0-7]+$/i,Cs=parseInt;var Ds=function(t){if("number"==typeof t)return t;if(ks(t))return NaN;if(Es(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Es(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=As(t);var r=Ms.test(t);return r||_s.test(t)?Cs(t.slice(2),r?2:8):Ts.test(t)?NaN:+t},Is=_,Ns=function(){return Os.Date.now()},Bs=Ds,Rs=Math.max,Ls=Math.min;var zs=function(t,e,r){var n,o,i,a,c,u,l=0,s=!1,f=!1,p=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function h(e){var r=n,i=o;return n=o=void 0,l=e,a=t.apply(i,r)}function y(t){var r=t-u;return void 0===u||r>=e||r<0||f&&t-l>=i}function d(){var t=Ns();if(y(t))return v(t);c=setTimeout(d,function(t){var r=e-(t-u);return f?Ls(r,i-(t-l)):r}(t))}function v(t){return c=void 0,p&&n?h(t):(n=o=void 0,a)}function m(){var t=Ns(),r=y(t);if(n=arguments,o=this,u=t,r){if(void 0===c)return function(t){return l=t,c=setTimeout(d,e),s?h(t):a}(u);if(f)return clearTimeout(c),c=setTimeout(d,e),h(u)}return void 0===c&&(c=setTimeout(d,e)),a}return e=Bs(e)||0,Is(r)&&(s=!!r.leading,i=(f="maxWait"in r)?Rs(Bs(r.maxWait)||0,e):i,p="trailing"in r?!!r.trailing:p),m.cancel=function(){void 0!==c&&clearTimeout(c),l=0,n=u=o=c=void 0},m.flush=function(){return void 0===c?a:v(Ns())},m},Fs=_;const Us=r(function(t,e,r){var n=!0,o=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return Fs(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),zs(t,e,{leading:n,maxWait:e,trailing:o})});function $s(t){return($s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function qs(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function Ws(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&(t=Us(t,b,{trailing:!0,leading:!1}));var e=new ResizeObserver(t),r=S.current.getBoundingClientRect(),n=r.width,o=r.height;return T(n,o),e.observe(S.current),function(){e.disconnect()}},[T,b]);var M=n.useMemo(function(){var t=E.containerWidth,e=E.containerHeight;if(t<0||e<0)return null;Gr(ir(l)||ir(f),"The width(%s) and height(%s) are both fixed numbers,\n maybe you don't need to use a ResponsiveContainer.",l,f),Gr(!i||i>0,"The aspect(%s) must be greater than zero.",i);var r=ir(l)?t:l,a=ir(f)?e:f;i&&i>0&&(r?a=r/i:a&&(r=a*i),d&&a>d&&(a=d)),Gr(r>0||a>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",r,a,l,f,h,y,i);var c=!Array.isArray(v)&&kr(v.type).endsWith("Chart");return o.Children.map(v,function(t){return o.isValidElement(t)?n.cloneElement(t,Ws({width:r,height:a},c?{style:Ws({height:"100%",width:"100%",maxHeight:a,maxWidth:r},t.props.style)}:{})):t})},[i,v,f,d,y,h,E,l]);return o.createElement("div",{id:g?"".concat(g):void 0,className:t("recharts-responsive-container",w),style:Ws(Ws({},j),{},{width:l,height:f,minWidth:h,minHeight:y,maxHeight:d}),ref:S},M)}),Ks=function(t){return null};function Ys(t){return(Ys="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Zs(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function Js(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{};if(null==t||ls.isSsr)return{width:0,height:0};var r,n=(r=Js({},e),Object.keys(r).forEach(function(t){r[t]||delete r[t]}),r),o=JSON.stringify({text:t,copyStyle:n});if(tf.widthCache[o])return tf.widthCache[o];try{var i=document.getElementById(rf);i||((i=document.createElement("span")).setAttribute("id",rf),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var a=Js(Js({},ef),n);Object.assign(i.style,a),i.textContent="".concat(t);var c=i.getBoundingClientRect(),u={width:c.width,height:c.height};return tf.widthCache[o]=u,++tf.cacheCount>2e3&&(tf.cacheCount=0,tf.widthCache={}),u}catch(l){return{width:0,height:0}}};function of(t){return(of="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function af(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(s){l=!0,o=s}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return cf(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return cf(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function cf(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function Af(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(s){l=!0,o=s}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Ef(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ef(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ef(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:[]).reduce(function(t,e){var i=e.word,a=e.width,c=t[t.length-1];if(c&&(null==n||o||c.width+a+ri||function(t){return t.reduce(function(t,e){return t.width>e.width?t:e})}(o).width>Number(n);return[a,o]},d=0,v=s.length-1,m=0;d<=v&&m<=s.length-1;){var b=Math.floor((d+v)/2),g=Af(y(b-1),2),w=g[0],x=g[1],O=Af(y(b),1)[0];if(w||O||(d=b+1),w&&O&&(v=b-1),!w&&O){h=x;break}m++}return h||p}({breakAll:i,children:n,maxLines:a,style:o},c.wordsWithComputedWidth,c.spaceWidth,e,r):Mf(n)}return Mf(n)},Cf="#808080",Df=function(e){var r=e.x,i=void 0===r?0:r,a=e.y,c=void 0===a?0:a,u=e.lineHeight,l=void 0===u?"1em":u,s=e.capHeight,f=void 0===s?"0.71em":s,p=e.scaleToFit,h=void 0!==p&&p,y=e.textAnchor,d=void 0===y?"start":y,v=e.verticalAnchor,m=void 0===v?"end":v,b=e.fill,g=void 0===b?Cf:b,w=Pf(e,Of),x=n.useMemo(function(){return _f({breakAll:w.breakAll,children:w.children,maxLines:w.maxLines,scaleToFit:h,style:w.style,width:w.width})},[w.breakAll,w.children,w.maxLines,h,w.style,w.width]),O=w.dx,j=w.dy,S=w.angle,P=w.className,A=w.breakAll,E=Pf(w,jf);if(!cr(i)||!cr(c))return null;var k,T=i+(ar(O)?O:0),M=c+(ar(j)?j:0);switch(m){case"start":k=xf("calc(".concat(f,")"));break;case"middle":k=xf("calc(".concat((x.length-1)/2," * -").concat(l," + (").concat(f," / 2))"));break;default:k=xf("calc(".concat(x.length-1," * -").concat(l,")"))}var _=[];if(h){var C=x[0].width,D=w.width;_.push("scale(".concat((ar(D)?D/C:1)/C,")"))}return S&&_.push("rotate(".concat(S,", ").concat(T,", ").concat(M,")")),_.length&&(E.transform=_.join(" ")),o.createElement("text",Sf({},Br(E,!0),{x:T,y:M,className:t("recharts-text",P),textAnchor:d,fill:g.includes("url")?Cf:g}),x.map(function(t,e){var r=t.words.join(A?"":" ");return o.createElement("tspan",{x:T,dy:0===e?k:l,key:"".concat(r,"-").concat(e)},r)}))};function If(t,e){return null==t||null==e?NaN:te?1:t>=e?0:NaN}function Nf(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}function Bf(t){let e,r,n;function o(t,n,o=0,i=t.length){if(o>>1;r(t[e],n)<0?o=e+1:i=e}while(oIf(t(e),r),n=(e,r)=>t(e)-r):(e=t===If||t===Nf?t:Rf,r=t,n=t),{left:o,center:function(t,e,r=0,i=t.length){const a=o(t,e,r,i-1);return a>r&&n(t[a-1],e)>-n(t[a],e)?a-1:a},right:function(t,n,o=0,i=t.length){if(o>>1;r(t[e],n)<=0?o=e+1:i=e}while(o=t))-(null==e||!(e>=e))||(te?1:0)}const Xf=Math.sqrt(50),Vf=Math.sqrt(10),Hf=Math.sqrt(2);function Gf(t,e,r){const n=(e-t)/Math.max(0,r),o=Math.floor(Math.log10(n)),i=n/Math.pow(10,o),a=i>=Xf?10:i>=Vf?5:i>=Hf?2:1;let c,u,l;return o<0?(l=Math.pow(10,-o)/a,c=Math.round(t*l),u=Math.round(e*l),c/le&&--u,l=-l):(l=Math.pow(10,o)*a,c=Math.round(t/l),u=Math.round(e/l),c*le&&--u),u0))return[];if((t=+t)===(e=+e))return[t];const n=e=o))return[];const c=i-o+1,u=new Array(c);if(n)if(a<0)for(let l=0;l=n)&&(r=n);else{let n=-1;for(let o of t)null!=(o=e(o,++n,t))&&(r=o)&&(r=o)}return r}function Qf(t,e){let r;if(void 0===e)for(const n of t)null!=n&&(r>n||void 0===r&&n>=n)&&(r=n);else{let n=-1;for(let o of t)null!=(o=e(o,++n,t))&&(r>o||void 0===r&&o>=o)&&(r=o)}return r}function tp(t,e,r=0,n=1/0,o){if(e=Math.floor(e),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(t.length-1,n)),!(r<=e&&e<=n))return t;for(o=void 0===o?Wf:function(t=If){if(t===If)return Wf;if("function"!=typeof t)throw new TypeError("compare is not a function");return(e,r)=>{const n=t(e,r);return n||0===n?n:(0===t(r,r))-(0===t(e,e))}}(o);n>r;){if(n-r>600){const i=n-r+1,a=e-r+1,c=Math.log(i),u=.5*Math.exp(2*c/3),l=.5*Math.sqrt(c*u*(i-u)/i)*(a-i/2<0?-1:1);tp(t,e,Math.max(r,Math.floor(e-a*u/i+l)),Math.min(n,Math.floor(e+(i-a)*u/i+l)),o)}const i=t[e];let a=r,c=n;for(ep(t,r,e),o(t[n],i)>0&&ep(t,r,n);a0;)--c}0===o(t[r],i)?ep(t,r,c):(++c,ep(t,c,n)),c<=e&&(r=c+1),e<=c&&(n=c-1)}return t}function ep(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function rp(t,e,r=Lf){if((n=t.length)&&!isNaN(e=+e)){if(e<=0||n<2)return+r(t[0],0,t);if(e>=1)return+r(t[n-1],n-1,t);var n,o=(n-1)*e,i=Math.floor(o),a=+r(t[i],i,t);return a+(+r(t[i+1],i+1,t)-a)*(o-i)}}function np(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function op(t,e){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof e?this.interpolator(e):this.range(e)}return this}const ip=Symbol("implicit");function ap(){var t=new Uf,e=[],r=[],n=ip;function o(o){let i=t.get(o);if(void 0===i){if(n!==ip)return n;t.set(o,i=e.push(o)-1)}return r[i%r.length]}return o.domain=function(r){if(!arguments.length)return e.slice();e=[],t=new Uf;for(const n of r)t.has(n)||t.set(n,e.push(n)-1);return o},o.range=function(t){return arguments.length?(r=Array.from(t),o):r.slice()},o.unknown=function(t){return arguments.length?(n=t,o):n},o.copy=function(){return ap(e,r).unknown(n)},np.apply(o,arguments),o}function cp(){var t,e,r=ap().unknown(void 0),n=r.domain,o=r.range,i=0,a=1,c=!1,u=0,l=0,s=.5;function f(){var r=n().length,f=a>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?Mp(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?Mp(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=gp.exec(t))?new Cp(e[1],e[2],e[3],1):(e=wp.exec(t))?new Cp(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=xp.exec(t))?Mp(e[1],e[2],e[3],e[4]):(e=Op.exec(t))?Mp(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=jp.exec(t))?Lp(e[1],e[2]/100,e[3]/100,1):(e=Sp.exec(t))?Lp(e[1],e[2]/100,e[3]/100,e[4]):Pp.hasOwnProperty(t)?Tp(Pp[t]):"transparent"===t?new Cp(NaN,NaN,NaN,0):null}function Tp(t){return new Cp(t>>16&255,t>>8&255,255&t,1)}function Mp(t,e,r,n){return n<=0&&(t=e=r=NaN),new Cp(t,e,r,n)}function _p(t,e,r,n){return 1===arguments.length?((o=t)instanceof pp||(o=kp(o)),o?new Cp((o=o.rgb()).r,o.g,o.b,o.opacity):new Cp):new Cp(t,e,r,null==n?1:n);var o}function Cp(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function Dp(){return`#${Rp(this.r)}${Rp(this.g)}${Rp(this.b)}`}function Ip(){const t=Np(this.opacity);return`${1===t?"rgb(":"rgba("}${Bp(this.r)}, ${Bp(this.g)}, ${Bp(this.b)}${1===t?")":`, ${t})`}`}function Np(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Bp(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Rp(t){return((t=Bp(t))<16?"0":"")+t.toString(16)}function Lp(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Fp(t,e,r,n)}function zp(t){if(t instanceof Fp)return new Fp(t.h,t.s,t.l,t.opacity);if(t instanceof pp||(t=kp(t)),!t)return new Fp;if(t instanceof Fp)return t;var e=(t=t.rgb()).r/255,r=t.g/255,n=t.b/255,o=Math.min(e,r,n),i=Math.max(e,r,n),a=NaN,c=i-o,u=(i+o)/2;return c?(a=e===i?(r-n)/c+6*(r0&&u<1?0:a,new Fp(a,c,u,t.opacity)}function Fp(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function Up(t){return(t=(t||0)%360)<0?t+360:t}function $p(t){return Math.max(0,Math.min(1,t||0))}function qp(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}sp(pp,kp,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ap,formatHex:Ap,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return zp(this).formatHsl()},formatRgb:Ep,toString:Ep}),sp(Cp,_p,fp(pp,{brighter(t){return t=null==t?yp:Math.pow(yp,t),new Cp(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?hp:Math.pow(hp,t),new Cp(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Cp(Bp(this.r),Bp(this.g),Bp(this.b),Np(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Dp,formatHex:Dp,formatHex8:function(){return`#${Rp(this.r)}${Rp(this.g)}${Rp(this.b)}${Rp(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ip,toString:Ip})),sp(Fp,function(t,e,r,n){return 1===arguments.length?zp(t):new Fp(t,e,r,null==n?1:n)},fp(pp,{brighter(t){return t=null==t?yp:Math.pow(yp,t),new Fp(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?hp:Math.pow(hp,t),new Fp(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,o=2*r-n;return new Cp(qp(t>=240?t-240:t+120,o,n),qp(t,o,n),qp(t<120?t+240:t-120,o,n),this.opacity)},clamp(){return new Fp(Up(this.h),$p(this.s),$p(this.l),Np(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Np(this.opacity);return`${1===t?"hsl(":"hsla("}${Up(this.h)}, ${100*$p(this.s)}%, ${100*$p(this.l)}%${1===t?")":`, ${t})`}`}}));const Wp=t=>()=>t;function Xp(t){return 1===(t=+t)?Vp:function(e,r){return r-e?function(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}(e,r,t):Wp(isNaN(e)?r:e)}}function Vp(t,e){var r=e-t;return r?function(t,e){return function(r){return t+r*e}}(t,r):Wp(isNaN(t)?e:t)}const Hp=function t(e){var r=Xp(e);function n(t,e){var n=r((t=_p(t)).r,(e=_p(e)).r),o=r(t.g,e.g),i=r(t.b,e.b),a=Vp(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=o(e),t.b=i(e),t.opacity=a(e),t+""}}return n.gamma=t,n}(1);function Gp(t,e){e||(e=[]);var r,n=t?Math.min(e.length,t.length):0,o=e.slice();return function(i){for(r=0;ri&&(o=e.slice(i,o),c[a]?c[a]+=o:c[++a]=o),(r=r[0])===(n=n[0])?c[a]?c[a]+=n:c[++a]=n:(c[++a]=null,u.push({i:a,x:Zp(r,n)})),i=th.lastIndex;return ie&&(r=t,t=e,e=r),l=function(r){return Math.max(t,Math.min(e,r))}),n=u>2?lh:uh,o=i=null,f}function f(e){return null==e||isNaN(e=+e)?r:(o||(o=n(a.map(t),c,u)))(t(l(e)))}return f.invert=function(r){return l(e((i||(i=n(c,a.map(t),Zp)))(r)))},f.domain=function(t){return arguments.length?(a=Array.from(t,oh),s()):a.slice()},f.range=function(t){return arguments.length?(c=Array.from(t),s()):c.slice()},f.rangeRound=function(t){return c=Array.from(t),u=nh,s()},f.clamp=function(t){return arguments.length?(l=!!t||ah,s()):l!==ah},f.interpolate=function(t){return arguments.length?(u=t,s()):u},f.unknown=function(t){return arguments.length?(r=t,f):r},function(r,n){return t=r,e=n,s()}}function ph(){return fh()(ah,ah)}function hh(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function yh(t){return(t=hh(Math.abs(t)))?t[1]:NaN}var dh,vh=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function mh(t){if(!(e=vh.exec(t)))throw new Error("invalid format: "+t);var e;return new bh({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function bh(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function gh(t,e){var r=hh(t,e);if(!r)return t+"";var n=r[0],o=r[1];return o<0?"0."+new Array(-o).join("0")+n:n.length>o+1?n.slice(0,o+1)+"."+n.slice(o+1):n+new Array(o-n.length+2).join("0")}mh.prototype=bh.prototype,bh.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const wh={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>gh(100*t,e),r:gh,s:function(t,e){var r=hh(t,e);if(!r)return t+"";var n=r[0],o=r[1],i=o-(dh=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,a=n.length;return i===a?n:i>a?n+new Array(i-a+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+hh(t,Math.max(0,e+i-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function xh(t){return t}var Oh,jh,Sh,Ph=Array.prototype.map,Ah=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Eh(t){var e,r,n=void 0===t.grouping||void 0===t.thousands?xh:(e=Ph.call(t.grouping,Number),r=t.thousands+"",function(t,n){for(var o=t.length,i=[],a=0,c=e[0],u=0;o>0&&c>0&&(u+c+1>n&&(c=Math.max(1,n-u)),i.push(t.substring(o-=c,o+c)),!((u+=c+1)>n));)c=e[a=(a+1)%e.length];return i.reverse().join(r)}),o=void 0===t.currency?"":t.currency[0]+"",i=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",c=void 0===t.numerals?xh:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(Ph.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",s=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=mh(t)).fill,r=t.align,f=t.sign,p=t.symbol,h=t.zero,y=t.width,d=t.comma,v=t.precision,m=t.trim,b=t.type;"n"===b?(d=!0,b="g"):wh[b]||(void 0===v&&(v=12),m=!0,b="g"),(h||"0"===e&&"="===r)&&(h=!0,e="0",r="=");var g="$"===p?o:"#"===p&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",w="$"===p?i:/[%p]/.test(b)?u:"",x=wh[b],O=/[defgprs%]/.test(b);function j(t){var o,i,u,p=g,j=w;if("c"===b)j=x(t)+j,t="";else{var S=(t=+t)<0||1/t<0;if(t=isNaN(t)?s:x(Math.abs(t),v),m&&(t=function(t){t:for(var e,r=t.length,n=1,o=-1;n0&&(o=0)}return o>0?t.slice(0,o)+t.slice(e+1):t}(t)),S&&0===+t&&"+"!==f&&(S=!1),p=(S?"("===f?f:l:"-"===f||"("===f?"":f)+p,j=("s"===b?Ah[8+dh/3]:"")+j+(S&&"("===f?")":""),O)for(o=-1,i=t.length;++o(u=t.charCodeAt(o))||u>57){j=(46===u?a+t.slice(o+1):t.slice(o))+j,t=t.slice(0,o);break}}d&&!h&&(t=n(t,1/0));var P=p.length+t.length+j.length,A=P>1)+p+t+j+A.slice(P);break;default:t=A+p+t+j}return c(t)}return v=void 0===v?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),j.toString=function(){return t+""},j}return{format:f,formatPrefix:function(t,e){var r=f(((t=mh(t)).type="f",t)),n=3*Math.max(-8,Math.min(8,Math.floor(yh(e)/3))),o=Math.pow(10,-n),i=Ah[8+n/3];return function(t){return r(o*t)+i}}}}function kh(t,e,r,n){var o,i=Zf(t,e,r);switch((n=mh(null==n?",f":n)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=n.precision||isNaN(o=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(yh(e)/3)))-yh(Math.abs(t)))}(i,a))||(n.precision=o),Sh(n,a);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(o=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,yh(e)-yh(t))+1}(i,Math.max(Math.abs(t),Math.abs(e))))||(n.precision=o-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(o=function(t){return Math.max(0,-yh(Math.abs(t)))}(i))||(n.precision=o-2*("%"===n.type))}return jh(n)}function Th(t){var e=t.domain;return t.ticks=function(t){var r=e();return Kf(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,r){var n=e();return kh(n[0],n[n.length-1],null==t?10:t,r)},t.nice=function(r){null==r&&(r=10);var n,o,i=e(),a=0,c=i.length-1,u=i[a],l=i[c],s=10;for(l0;){if((o=Yf(u,l,r))===n)return i[a]=u,i[c]=l,e(i);if(o>0)u=Math.floor(u/o)*o,l=Math.ceil(l/o)*o;else{if(!(o<0))break;u=Math.ceil(u*o)/o,l=Math.floor(l*o)/o}n=o}return t},t}function Mh(){var t=ph();return t.copy=function(){return sh(t,Mh())},np.apply(t,arguments),Th(t)}function _h(t,e){var r,n=0,o=(t=t.slice()).length-1,i=t[n],a=t[o];return a-t(-e,r)}function Lh(t){const e=t(Ch,Dh),r=e.domain;let n,o,i=10;function a(){return n=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}(i),o=function(t){return 10===t?Bh:t===Math.E?Math.exp:e=>Math.pow(t,e)}(i),r()[0]<0?(n=Rh(n),o=Rh(o),t(Ih,Nh)):t(Ch,Dh),e}return e.base=function(t){return arguments.length?(i=+t,a()):i},e.domain=function(t){return arguments.length?(r(t),a()):r()},e.ticks=t=>{const e=r();let a=e[0],c=e[e.length-1];const u=c0){for(;f<=p;++f)for(l=1;lc)break;y.push(s)}}else for(;f<=p;++f)for(l=i-1;l>=1;--l)if(s=f>0?l/o(-f):l*o(f),!(sc)break;y.push(s)}2*y.length{if(null==t&&(t=10),null==r&&(r=10===i?"s":","),"function"!=typeof r&&(i%1||null!=(r=mh(r)).precision||(r.trim=!0),r=jh(r)),t===1/0)return r;const a=Math.max(1,i*t/e.ticks().length);return t=>{let e=t/o(Math.round(n(t)));return e*ir(_h(r(),{floor:t=>o(Math.floor(n(t))),ceil:t=>o(Math.ceil(n(t)))})),e}function zh(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function Fh(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Uh(t){var e=1,r=t(zh(e),Fh(e));return r.constant=function(r){return arguments.length?t(zh(e=+r),Fh(e)):e},Th(r)}function $h(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function qh(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Wh(t){return t<0?-t*t:t*t}function Xh(t){var e=t(ah,ah),r=1;return e.exponent=function(e){return arguments.length?1===(r=+e)?t(ah,ah):.5===r?t(qh,Wh):t($h(r),$h(1/r)):r},Th(e)}function Vh(){var t=Xh(fh());return t.copy=function(){return sh(t,Vh()).exponent(t.exponent())},np.apply(t,arguments),t}function Hh(t){return Math.sign(t)*t*t}Oh=Eh({thousands:",",grouping:[3],currency:["$",""]}),jh=Oh.format,Sh=Oh.formatPrefix;const Gh=new Date,Kh=new Date;function Yh(t,e,r,n){function o(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return o.floor=e=>(t(e=new Date(+e)),e),o.ceil=r=>(t(r=new Date(r-1)),e(r,1),t(r),r),o.round=t=>{const e=o(t),r=o.ceil(t);return t-e(e(t=new Date(+t),null==r?1:Math.floor(r)),t),o.range=(r,n,i)=>{const a=[];if(r=o.ceil(r),i=null==i?1:Math.floor(i),!(r0))return a;let c;do{a.push(c=new Date(+r)),e(r,i),t(r)}while(cYh(e=>{if(e>=e)for(;t(e),!r(e);)e.setTime(e-1)},(t,n)=>{if(t>=t)if(n<0)for(;++n<=0;)for(;e(t,-1),!r(t););else for(;--n>=0;)for(;e(t,1),!r(t););}),r&&(o.count=(e,n)=>(Gh.setTime(+e),Kh.setTime(+n),t(Gh),t(Kh),Math.floor(r(Gh,Kh))),o.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?o.filter(n?e=>n(e)%t===0:e=>o.count(0,e)%t===0):o:null)),o}const Zh=Yh(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Zh.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Yh(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):Zh:null),Zh.range;const Jh=1e3,Qh=6e4,ty=36e5,ey=864e5,ry=6048e5,ny=2592e6,oy=31536e6,iy=Yh(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Jh)},(t,e)=>(e-t)/Jh,t=>t.getUTCSeconds());iy.range;const ay=Yh(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Jh)},(t,e)=>{t.setTime(+t+e*Qh)},(t,e)=>(e-t)/Qh,t=>t.getMinutes());ay.range;const cy=Yh(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Qh)},(t,e)=>(e-t)/Qh,t=>t.getUTCMinutes());cy.range;const uy=Yh(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Jh-t.getMinutes()*Qh)},(t,e)=>{t.setTime(+t+e*ty)},(t,e)=>(e-t)/ty,t=>t.getHours());uy.range;const ly=Yh(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*ty)},(t,e)=>(e-t)/ty,t=>t.getUTCHours());ly.range;const sy=Yh(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Qh)/ey,t=>t.getDate()-1);sy.range;const fy=Yh(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/ey,t=>t.getUTCDate()-1);fy.range;const py=Yh(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/ey,t=>Math.floor(t/ey));function hy(t){return Yh(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+7*e)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Qh)/ry)}py.range;const yy=hy(0),dy=hy(1),vy=hy(2),my=hy(3),by=hy(4),gy=hy(5),wy=hy(6);function xy(t){return Yh(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)},(t,e)=>(e-t)/ry)}yy.range,dy.range,vy.range,my.range,by.range,gy.range,wy.range;const Oy=xy(0),jy=xy(1),Sy=xy(2),Py=xy(3),Ay=xy(4),Ey=xy(5),ky=xy(6);Oy.range,jy.range,Sy.range,Py.range,Ay.range,Ey.range,ky.range;const Ty=Yh(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),t=>t.getMonth());Ty.range;const My=Yh(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),t=>t.getUTCMonth());My.range;const _y=Yh(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());_y.every=t=>isFinite(t=Math.floor(t))&&t>0?Yh(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)}):null,_y.range;const Cy=Yh(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());function Dy(t,e,r,n,o,i){const a=[[iy,1,Jh],[iy,5,5e3],[iy,15,15e3],[iy,30,3e4],[i,1,Qh],[i,5,3e5],[i,15,9e5],[i,30,18e5],[o,1,ty],[o,3,108e5],[o,6,216e5],[o,12,432e5],[n,1,ey],[n,2,1728e5],[r,1,ry],[e,1,ny],[e,3,7776e6],[t,1,oy]];function c(e,r,n){const o=Math.abs(r-e)/n,i=Bf(([,,t])=>t).right(a,o);if(i===a.length)return t.every(Zf(e/oy,r/oy,n));if(0===i)return Zh.every(Math.max(Zf(e,r,n),1));const[c,u]=a[o/a[i-1][2]isFinite(t=Math.floor(t))&&t>0?Yh(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)}):null,Cy.range;const[Iy,Ny]=Dy(Cy,My,Oy,py,ly,cy),[By,Ry]=Dy(_y,Ty,yy,sy,uy,ay);function Ly(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function zy(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Fy(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}var Uy,$y,qy,Wy={"-":"",_:" ",0:"0"},Xy=/^\s*\d+/,Vy=/^%/,Hy=/[\\^$*+?|[\]().{}]/g;function Gy(t,e,r){var n=t<0?"-":"",o=(n?-t:t)+"",i=o.length;return n+(i[t.toLowerCase(),e]))}function Jy(t,e,r){var n=Xy.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function Qy(t,e,r){var n=Xy.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function td(t,e,r){var n=Xy.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function ed(t,e,r){var n=Xy.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function rd(t,e,r){var n=Xy.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function nd(t,e,r){var n=Xy.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function od(t,e,r){var n=Xy.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function id(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function ad(t,e,r){var n=Xy.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function cd(t,e,r){var n=Xy.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function ud(t,e,r){var n=Xy.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ld(t,e,r){var n=Xy.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function sd(t,e,r){var n=Xy.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function fd(t,e,r){var n=Xy.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function pd(t,e,r){var n=Xy.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function hd(t,e,r){var n=Xy.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function yd(t,e,r){var n=Xy.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function dd(t,e,r){var n=Vy.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function vd(t,e,r){var n=Xy.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function md(t,e,r){var n=Xy.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function bd(t,e){return Gy(t.getDate(),e,2)}function gd(t,e){return Gy(t.getHours(),e,2)}function wd(t,e){return Gy(t.getHours()%12||12,e,2)}function xd(t,e){return Gy(1+sy.count(_y(t),t),e,3)}function Od(t,e){return Gy(t.getMilliseconds(),e,3)}function jd(t,e){return Od(t,e)+"000"}function Sd(t,e){return Gy(t.getMonth()+1,e,2)}function Pd(t,e){return Gy(t.getMinutes(),e,2)}function Ad(t,e){return Gy(t.getSeconds(),e,2)}function Ed(t){var e=t.getDay();return 0===e?7:e}function kd(t,e){return Gy(yy.count(_y(t)-1,t),e,2)}function Td(t){var e=t.getDay();return e>=4||0===e?by(t):by.ceil(t)}function Md(t,e){return t=Td(t),Gy(by.count(_y(t),t)+(4===_y(t).getDay()),e,2)}function _d(t){return t.getDay()}function Cd(t,e){return Gy(dy.count(_y(t)-1,t),e,2)}function Dd(t,e){return Gy(t.getFullYear()%100,e,2)}function Id(t,e){return Gy((t=Td(t)).getFullYear()%100,e,2)}function Nd(t,e){return Gy(t.getFullYear()%1e4,e,4)}function Bd(t,e){var r=t.getDay();return Gy((t=r>=4||0===r?by(t):by.ceil(t)).getFullYear()%1e4,e,4)}function Rd(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Gy(e/60|0,"0",2)+Gy(e%60,"0",2)}function Ld(t,e){return Gy(t.getUTCDate(),e,2)}function zd(t,e){return Gy(t.getUTCHours(),e,2)}function Fd(t,e){return Gy(t.getUTCHours()%12||12,e,2)}function Ud(t,e){return Gy(1+fy.count(Cy(t),t),e,3)}function $d(t,e){return Gy(t.getUTCMilliseconds(),e,3)}function qd(t,e){return $d(t,e)+"000"}function Wd(t,e){return Gy(t.getUTCMonth()+1,e,2)}function Xd(t,e){return Gy(t.getUTCMinutes(),e,2)}function Vd(t,e){return Gy(t.getUTCSeconds(),e,2)}function Hd(t){var e=t.getUTCDay();return 0===e?7:e}function Gd(t,e){return Gy(Oy.count(Cy(t)-1,t),e,2)}function Kd(t){var e=t.getUTCDay();return e>=4||0===e?Ay(t):Ay.ceil(t)}function Yd(t,e){return t=Kd(t),Gy(Ay.count(Cy(t),t)+(4===Cy(t).getUTCDay()),e,2)}function Zd(t){return t.getUTCDay()}function Jd(t,e){return Gy(jy.count(Cy(t)-1,t),e,2)}function Qd(t,e){return Gy(t.getUTCFullYear()%100,e,2)}function tv(t,e){return Gy((t=Kd(t)).getUTCFullYear()%100,e,2)}function ev(t,e){return Gy(t.getUTCFullYear()%1e4,e,4)}function rv(t,e){var r=t.getUTCDay();return Gy((t=r>=4||0===r?Ay(t):Ay.ceil(t)).getUTCFullYear()%1e4,e,4)}function nv(){return"+0000"}function ov(){return"%"}function iv(t){return+t}function av(t){return Math.floor(+t/1e3)}function cv(t){return new Date(t)}function uv(t){return t instanceof Date?+t:+new Date(+t)}function lv(t,e,r,n,o,i,a,c,u,l){var s=ph(),f=s.invert,p=s.domain,h=l(".%L"),y=l(":%S"),d=l("%I:%M"),v=l("%I %p"),m=l("%a %d"),b=l("%b %d"),g=l("%B"),w=l("%Y");function x(t){return(u(t)=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:iv,s:av,S:Ad,u:Ed,U:kd,V:Md,w:_d,W:Cd,x:null,X:null,y:Dd,Y:Nd,Z:Rd,"%":ov},w={a:function(t){return a[t.getUTCDay()]},A:function(t){return i[t.getUTCDay()]},b:function(t){return u[t.getUTCMonth()]},B:function(t){return c[t.getUTCMonth()]},c:null,d:Ld,e:Ld,f:qd,g:tv,G:rv,H:zd,I:Fd,j:Ud,L:$d,m:Wd,M:Xd,p:function(t){return o[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:iv,s:av,S:Vd,u:Hd,U:Gd,V:Yd,w:Zd,W:Jd,x:null,X:null,y:Qd,Y:ev,Z:nv,"%":ov},x={a:function(t,e,r){var n=h.exec(e.slice(r));return n?(t.w=y.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(t,e,r){var n=f.exec(e.slice(r));return n?(t.w=p.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){var n=m.exec(e.slice(r));return n?(t.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){var n=d.exec(e.slice(r));return n?(t.m=v.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(t,r,n){return S(t,e,r,n)},d:ud,e:ud,f:yd,g:od,G:nd,H:sd,I:sd,j:ld,L:hd,m:cd,M:fd,p:function(t,e,r){var n=l.exec(e.slice(r));return n?(t.p=s.get(n[0].toLowerCase()),r+n[0].length):-1},q:ad,Q:vd,s:md,S:pd,u:Qy,U:td,V:ed,w:Jy,W:rd,x:function(t,e,n){return S(t,r,e,n)},X:function(t,e,r){return S(t,n,e,r)},y:od,Y:nd,Z:id,"%":dd};function O(t,e){return function(r){var n,o,i,a=[],c=-1,u=0,l=t.length;for(r instanceof Date||(r=new Date(+r));++c53)return null;"w"in i||(i.w=1),"Z"in i?(o=(n=zy(Fy(i.y,0,1))).getUTCDay(),n=o>4||0===o?jy.ceil(n):jy(n),n=fy.offset(n,7*(i.V-1)),i.y=n.getUTCFullYear(),i.m=n.getUTCMonth(),i.d=n.getUTCDate()+(i.w+6)%7):(o=(n=Ly(Fy(i.y,0,1))).getDay(),n=o>4||0===o?dy.ceil(n):dy(n),n=sy.offset(n,7*(i.V-1)),i.y=n.getFullYear(),i.m=n.getMonth(),i.d=n.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),o="Z"in i?zy(Fy(i.y,0,1)).getUTCDay():Ly(Fy(i.y,0,1)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(o+5)%7:i.w+7*i.U-(o+6)%7);return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,zy(i)):Ly(i)}}function S(t,e,r,n){for(var o,i,a=0,c=e.length,u=r.length;a=u)return-1;if(37===(o=e.charCodeAt(a++))){if(o=e.charAt(a++),!(i=x[o in Wy?e.charAt(a++):o])||(n=i(t,r,n))<0)return-1}else if(o!=r.charCodeAt(n++))return-1}return n}return g.x=O(r,g),g.X=O(n,g),g.c=O(e,g),w.x=O(r,w),w.X=O(n,w),w.c=O(e,w),{format:function(t){var e=O(t+="",g);return e.toString=function(){return t},e},parse:function(t){var e=j(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=O(t+="",w);return e.toString=function(){return t},e},utcParse:function(t){var e=j(t+="",!0);return e.toString=function(){return t},e}}}(t),$y=Uy.format,Uy.parse,qy=Uy.utcFormat,Uy.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});const dv=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:cp,scaleDiverging:function t(){var e=Th(hv()(ah));return e.copy=function(){return fv(e,t())},op.apply(e,arguments)},scaleDivergingLog:function t(){var e=Lh(hv()).domain([.1,1,10]);return e.copy=function(){return fv(e,t()).base(e.base())},op.apply(e,arguments)},scaleDivergingPow:yv,scaleDivergingSqrt:function(){return yv.apply(null,arguments).exponent(.5)},scaleDivergingSymlog:function t(){var e=Uh(hv());return e.copy=function(){return fv(e,t()).constant(e.constant())},op.apply(e,arguments)},scaleIdentity:function t(e){var r;function n(t){return null==t||isNaN(t=+t)?r:t}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,oh),n):e.slice()},n.unknown=function(t){return arguments.length?(r=t,n):r},n.copy=function(){return t(e).unknown(r)},e=arguments.length?Array.from(e,oh):[0,1],Th(n)},scaleImplicit:ip,scaleLinear:Mh,scaleLog:function t(){const e=Lh(fh()).domain([1,10]);return e.copy=()=>sh(e,t()).base(e.base()),np.apply(e,arguments),e},scaleOrdinal:ap,scalePoint:lp,scalePow:Vh,scaleQuantile:function t(){var e,r=[],n=[],o=[];function i(){var t=0,e=Math.max(1,n.length);for(o=new Array(e-1);++t0?o[e-1]:r[0],e=o?[i[o-1],n]:[i[e-1],i[e]]},c.unknown=function(t){return arguments.length?(e=t,c):c},c.thresholds=function(){return i.slice()},c.copy=function(){return t().domain([r,n]).range(a).unknown(e)},np.apply(Th(c),arguments)},scaleRadial:function t(){var e,r=ph(),n=[0,1],o=!1;function i(t){var n=function(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}(r(t));return isNaN(n)?e:o?Math.round(n):n}return i.invert=function(t){return r.invert(Hh(t))},i.domain=function(t){return arguments.length?(r.domain(t),i):r.domain()},i.range=function(t){return arguments.length?(r.range((n=Array.from(t,oh)).map(Hh)),i):n.slice()},i.rangeRound=function(t){return i.range(t).round(!0)},i.round=function(t){return arguments.length?(o=!!t,i):o},i.clamp=function(t){return arguments.length?(r.clamp(t),i):r.clamp()},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return t(r.domain(),n).round(o).clamp(r.clamp()).unknown(e)},np.apply(i,arguments),Th(i)},scaleSequential:function t(){var e=Th(sv()(ah));return e.copy=function(){return fv(e,t())},op.apply(e,arguments)},scaleSequentialLog:function t(){var e=Lh(sv()).domain([1,10]);return e.copy=function(){return fv(e,t()).base(e.base())},op.apply(e,arguments)},scaleSequentialPow:pv,scaleSequentialQuantile:function t(){var e=[],r=ah;function n(t){if(null!=t&&!isNaN(t=+t))return r((Ff(e,t,1)-1)/(e.length-1))}return n.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let r of t)null==r||isNaN(r=+r)||e.push(r);return e.sort(If),n},n.interpolator=function(t){return arguments.length?(r=t,n):r},n.range=function(){return e.map((t,n)=>r(n/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(r,n)=>function(t,e,r){if(t=Float64Array.from(function*(t,e){if(void 0===e)for(let r of t)null!=r&&(r=+r)>=r&&(yield r);else{let r=-1;for(let n of t)null!=(n=e(n,++r,t))&&(n=+n)>=n&&(yield n)}}(t,r)),(n=t.length)&&!isNaN(e=+e)){if(e<=0||n<2)return Qf(t);if(e>=1)return Jf(t);var n,o=(n-1)*e,i=Math.floor(o),a=Jf(tp(t,i).subarray(0,i+1));return a+(Qf(t.subarray(i+1))-a)*(o-i)}}(e,n/t))},n.copy=function(){return t(r).domain(e)},op.apply(n,arguments)},scaleSequentialSqrt:function(){return pv.apply(null,arguments).exponent(.5)},scaleSequentialSymlog:function t(){var e=Uh(sv());return e.copy=function(){return fv(e,t()).constant(e.constant())},op.apply(e,arguments)},scaleSqrt:function(){return Vh.apply(null,arguments).exponent(.5)},scaleSymlog:function t(){var e=Uh(fh());return e.copy=function(){return sh(e,t()).constant(e.constant())},np.apply(e,arguments)},scaleThreshold:function t(){var e,r=[.5],n=[0,1],o=1;function i(t){return null!=t&&t<=t?n[Ff(r,t,0,o)]:e}return i.domain=function(t){return arguments.length?(r=Array.from(t),o=Math.min(r.length,n.length-1),i):r.slice()},i.range=function(t){return arguments.length?(n=Array.from(t),o=Math.min(r.length,n.length-1),i):n.slice()},i.invertExtent=function(t){var e=n.indexOf(t);return[r[e-1],r[e]]},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return t().domain(r).range(n).unknown(e)},np.apply(i,arguments)},scaleTime:function(){return np.apply(lv(By,Ry,_y,Ty,yy,sy,uy,ay,iy,$y).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},scaleUtc:function(){return np.apply(lv(Iy,Ny,Cy,My,Oy,fy,ly,cy,iy,qy).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},tickFormat:kh},Symbol.toStringTag,{value:"Module"}));var vv=P;var mv=function(t,e,r){for(var n=-1,o=t.length;++ne},gv=mv,wv=bv,xv=Yc;const Ov=r(function(t){return t&&t.length?gv(t,xv,wv):void 0});var jv=function(t,e){return t(c=(a=Math.ceil(f/7))>c?a+1:c+1)&&(i=c,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((c=u.length)-(i=l.length)<0&&(i=c,n=l,l=u,u=n),r=0;i;)r=(u[--i]=u[i]+l[i]+r)/Vv|0,u[i]%=Vv;for(r&&(u.unshift(r),++o),c=u.length;0==u[--c];)u.pop();return e.d=u,e.e=o,zv?am(e,f):e}function Zv(t,e,r){if(t!==~~t||tr)throw Error(Uv+t)}function Jv(t){var e,r,n,o=t.length-1,i="",a=t[0];if(o>0){for(i+=a,e=1;et.e^i.s<0?1:-1;for(e=0,r=(n=i.d.length)<(o=t.d.length)?n:o;et.d[e]^i.s<0?1:-1;return n===o?0:n>o^i.s<0?1:-1},Kv.decimalPlaces=Kv.dp=function(){var t=this,e=t.d.length-1,r=7*(e-t.e);if(e=t.d[e])for(;e%10==0;e/=10)r--;return r<0?0:r},Kv.dividedBy=Kv.div=function(t){return Qv(this,new this.constructor(t))},Kv.dividedToIntegerBy=Kv.idiv=function(t){var e=this.constructor;return am(Qv(this,new e(t),0,1),e.precision)},Kv.equals=Kv.eq=function(t){return!this.cmp(t)},Kv.exponent=function(){return em(this)},Kv.greaterThan=Kv.gt=function(t){return this.cmp(t)>0},Kv.greaterThanOrEqualTo=Kv.gte=function(t){return this.cmp(t)>=0},Kv.isInteger=Kv.isint=function(){return this.e>this.d.length-2},Kv.isNegative=Kv.isneg=function(){return this.s<0},Kv.isPositive=Kv.ispos=function(){return this.s>0},Kv.isZero=function(){return 0===this.s},Kv.lessThan=Kv.lt=function(t){return this.cmp(t)<0},Kv.lessThanOrEqualTo=Kv.lte=function(t){return this.cmp(t)<1},Kv.logarithm=Kv.log=function(t){var e,r=this,n=r.constructor,o=n.precision,i=o+5;if(void 0===t)t=new n(10);else if((t=new n(t)).s<1||t.eq(Rv))throw Error(Fv+"NaN");if(r.s<1)throw Error(Fv+(r.s?"NaN":"-Infinity"));return r.eq(Rv)?new n(0):(zv=!1,e=Qv(om(r,i),om(t,i),i),zv=!0,am(e,o))},Kv.minus=Kv.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?cm(e,t):Yv(e,(t.s=-t.s,t))},Kv.modulo=Kv.mod=function(t){var e,r=this,n=r.constructor,o=n.precision;if(!(t=new n(t)).s)throw Error(Fv+"NaN");return r.s?(zv=!1,e=Qv(r,t,0,1).times(t),zv=!0,r.minus(e)):am(new n(r),o)},Kv.naturalExponential=Kv.exp=function(){return tm(this)},Kv.naturalLogarithm=Kv.ln=function(){return om(this)},Kv.negated=Kv.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t},Kv.plus=Kv.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?Yv(e,t):cm(e,(t.s=-t.s,t))},Kv.precision=Kv.sd=function(t){var e,r,n,o=this;if(void 0!==t&&t!==!!t&&1!==t&&0!==t)throw Error(Uv+t);if(e=em(o)+1,r=7*(n=o.d.length-1)+1,n=o.d[n]){for(;n%10==0;n/=10)r--;for(n=o.d[0];n>=10;n/=10)r++}return t&&e>r?e:r},Kv.squareRoot=Kv.sqrt=function(){var t,e,r,n,o,i,a,c=this,u=c.constructor;if(c.s<1){if(!c.s)return new u(0);throw Error(Fv+"NaN")}for(t=em(c),zv=!1,0==(o=Math.sqrt(+c))||o==1/0?(((e=Jv(c.d)).length+t)%2==0&&(e+="0"),o=Math.sqrt(e),t=qv((t+1)/2)-(t<0||t%2),n=new u(e=o==1/0?"5e"+t:(e=o.toExponential()).slice(0,e.indexOf("e")+1)+t)):n=new u(o.toString()),o=a=(r=u.precision)+3;;)if(n=(i=n).plus(Qv(c,i,a+2)).times(.5),Jv(i.d).slice(0,a)===(e=Jv(n.d)).slice(0,a)){if(e=e.slice(a-3,a+1),o==a&&"4999"==e){if(am(i,r+1,0),i.times(i).eq(c)){n=i;break}}else if("9999"!=e)break;a+=4}return zv=!0,am(n,r)},Kv.times=Kv.mul=function(t){var e,r,n,o,i,a,c,u,l,s=this,f=s.constructor,p=s.d,h=(t=new f(t)).d;if(!s.s||!t.s)return new f(0);for(t.s*=s.s,r=s.e+t.e,(u=p.length)<(l=h.length)&&(i=p,p=h,h=i,a=u,u=l,l=a),i=[],n=a=u+l;n--;)i.push(0);for(n=l;--n>=0;){for(e=0,o=u+n;o>n;)c=i[o]+h[n]*p[o-n-1]+e,i[o--]=c%Vv|0,e=c/Vv|0;i[o]=(i[o]+e)%Vv|0}for(;!i[--a];)i.pop();return e?++r:i.shift(),t.d=i,t.e=r,zv?am(t,f.precision):t},Kv.toDecimalPlaces=Kv.todp=function(t,e){var r=this,n=r.constructor;return r=new n(r),void 0===t?r:(Zv(t,0,Lv),void 0===e?e=n.rounding:Zv(e,0,8),am(r,t+em(r)+1,e))},Kv.toExponential=function(t,e){var r,n=this,o=n.constructor;return void 0===t?r=um(n,!0):(Zv(t,0,Lv),void 0===e?e=o.rounding:Zv(e,0,8),r=um(n=am(new o(n),t+1,e),!0,t+1)),r},Kv.toFixed=function(t,e){var r,n,o=this,i=o.constructor;return void 0===t?um(o):(Zv(t,0,Lv),void 0===e?e=i.rounding:Zv(e,0,8),r=um((n=am(new i(o),t+em(o)+1,e)).abs(),!1,t+em(n)+1),o.isneg()&&!o.isZero()?"-"+r:r)},Kv.toInteger=Kv.toint=function(){var t=this,e=t.constructor;return am(new e(t),em(t)+1,e.rounding)},Kv.toNumber=function(){return+this},Kv.toPower=Kv.pow=function(t){var e,r,n,o,i,a,c=this,u=c.constructor,l=+(t=new u(t));if(!t.s)return new u(Rv);if(!(c=new u(c)).s){if(t.s<1)throw Error(Fv+"Infinity");return c}if(c.eq(Rv))return c;if(n=u.precision,t.eq(Rv))return am(c,n);if(a=(e=t.e)>=(r=t.d.length-1),i=c.s,a){if((r=l<0?-l:l)<=Hv){for(o=new u(Rv),e=Math.ceil(n/7+4),zv=!1;r%2&&lm((o=o.times(c)).d,e),0!==(r=qv(r/2));)lm((c=c.times(c)).d,e);return zv=!0,t.s<0?new u(Rv).div(o):am(o,n)}}else if(i<0)throw Error(Fv+"NaN");return i=i<0&&1&t.d[Math.max(e,r)]?-1:1,c.s=1,zv=!1,o=t.times(om(c,n+12)),zv=!0,(o=tm(o)).s=i,o},Kv.toPrecision=function(t,e){var r,n,o=this,i=o.constructor;return void 0===t?n=um(o,(r=em(o))<=i.toExpNeg||r>=i.toExpPos):(Zv(t,1,Lv),void 0===e?e=i.rounding:Zv(e,0,8),n=um(o=am(new i(o),t,e),t<=(r=em(o))||r<=i.toExpNeg,t)),n},Kv.toSignificantDigits=Kv.tosd=function(t,e){var r=this.constructor;return void 0===t?(t=r.precision,e=r.rounding):(Zv(t,1,Lv),void 0===e?e=r.rounding:Zv(e,0,8)),am(new r(this),t,e)},Kv.toString=Kv.valueOf=Kv.val=Kv.toJSON=Kv[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=em(t),r=t.constructor;return um(t,e<=r.toExpNeg||e>=r.toExpPos)};var Qv=function(){function t(t,e){var r,n=0,o=t.length;for(t=t.slice();o--;)r=t[o]*e+n,t[o]=r%Vv|0,n=r/Vv|0;return n&&t.unshift(n),t}function e(t,e,r,n){var o,i;if(r!=n)i=r>n?1:-1;else for(o=i=0;oe[o]?1:-1;break}return i}function r(t,e,r){for(var n=0;r--;)t[r]-=n,n=t[r]1;)t.shift()}return function(n,o,i,a){var c,u,l,s,f,p,h,y,d,v,m,b,g,w,x,O,j,S,P=n.constructor,A=n.s==o.s?1:-1,E=n.d,k=o.d;if(!n.s)return new P(n);if(!o.s)throw Error(Fv+"Division by zero");for(u=n.e-o.e,j=k.length,x=E.length,y=(h=new P(A)).d=[],l=0;k[l]==(E[l]||0);)++l;if(k[l]>(E[l]||0)&&--u,(b=null==i?i=P.precision:a?i+(em(n)-em(o))+1:i)<0)return new P(0);if(b=b/7+2|0,l=0,1==j)for(s=0,k=k[0],b++;(l1&&(k=t(k,s),E=t(E,s),j=k.length,x=E.length),w=j,v=(d=E.slice(0,j)).length;v=Vv/2&&++O;do{s=0,(c=e(k,d,j,v))<0?(m=d[0],j!=v&&(m=m*Vv+(d[1]||0)),(s=m/O|0)>1?(s>=Vv&&(s=Vv-1),1==(c=e(f=t(k,s),d,p=f.length,v=d.length))&&(s--,r(f,j16)throw Error($v+em(t));if(!t.s)return new l(Rv);for(null==e?(zv=!1,a=s):a=e,i=new l(.03125);t.abs().gte(.1);)t=t.times(i),u+=5;for(a+=Math.log(Wv(2,u))/Math.LN10*2+5|0,r=n=o=new l(Rv),l.precision=a;;){if(n=am(n.times(t),a),r=r.times(++c),Jv((i=o.plus(Qv(n,r,a))).d).slice(0,a)===Jv(o.d).slice(0,a)){for(;u--;)o=am(o.times(o),a);return l.precision=s,null==e?(zv=!0,am(o,s)):o}o=i}}function em(t){for(var e=7*t.e,r=t.d[0];r>=10;r/=10)e++;return e}function rm(t,e,r){if(e>t.LN10.sd())throw zv=!0,r&&(t.precision=r),Error(Fv+"LN10 precision limit exceeded");return am(new t(t.LN10),e)}function nm(t){for(var e="";t--;)e+="0";return e}function om(t,e){var r,n,o,i,a,c,u,l,s,f=1,p=t,h=p.d,y=p.constructor,d=y.precision;if(p.s<1)throw Error(Fv+(p.s?"NaN":"-Infinity"));if(p.eq(Rv))return new y(0);if(null==e?(zv=!1,l=d):l=e,p.eq(10))return null==e&&(zv=!0),rm(y,l);if(l+=10,y.precision=l,n=(r=Jv(h)).charAt(0),i=em(p),!(Math.abs(i)<15e14))return u=rm(y,l+2,d).times(i+""),p=om(new y(n+"."+r.slice(1)),l-10).plus(u),y.precision=d,null==e?(zv=!0,am(p,d)):p;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=Jv((p=p.times(t)).d)).charAt(0),f++;for(i=em(p),n>1?(p=new y("0."+r),i++):p=new y(n+"."+r.slice(1)),c=a=p=Qv(p.minus(Rv),p.plus(Rv),l),s=am(p.times(p),l),o=3;;){if(a=am(a.times(s),l),Jv((u=c.plus(Qv(a,new y(o),l))).d).slice(0,l)===Jv(c.d).slice(0,l))return c=c.times(2),0!==i&&(c=c.plus(rm(y,l+2,d).times(i+""))),c=Qv(c,new y(f),l),y.precision=d,null==e?(zv=!0,am(c,d)):c;c=u,o+=2}}function im(t,e){var r,n,o;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;48===e.charCodeAt(n);)++n;for(o=e.length;48===e.charCodeAt(o-1);)--o;if(e=e.slice(n,o)){if(o-=n,r=r-n-1,t.e=qv(r/7),t.d=[],n=(r+1)%7,r<0&&(n+=7),nGv||t.e<-Gv))throw Error($v+r)}else t.s=0,t.e=0,t.d=[0];return t}function am(t,e,r){var n,o,i,a,c,u,l,s,f=t.d;for(a=1,i=f[0];i>=10;i/=10)a++;if((n=e-a)<0)n+=7,o=e,l=f[s=0];else{if((s=Math.ceil((n+1)/7))>=(i=f.length))return t;for(l=i=f[s],a=1;i>=10;i/=10)a++;o=(n%=7)-7+a}if(void 0!==r&&(c=l/(i=Wv(10,a-o-1))%10|0,u=e<0||void 0!==f[s+1]||l%i,u=r<4?(c||u)&&(0==r||r==(t.s<0?3:2)):c>5||5==c&&(4==r||u||6==r&&(n>0?o>0?l/Wv(10,a-o):0:f[s-1])%10&1||r==(t.s<0?8:7))),e<1||!f[0])return u?(i=em(t),f.length=1,e=e-i-1,f[0]=Wv(10,(7-e%7)%7),t.e=qv(-e/7)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(0==n?(f.length=s,i=1,s--):(f.length=s+1,i=Wv(10,7-n),f[s]=o>0?(l/Wv(10,a-o)%Wv(10,o)|0)*i:0),u)for(;;){if(0==s){(f[0]+=i)==Vv&&(f[0]=1,++t.e);break}if(f[s]+=i,f[s]!=Vv)break;f[s--]=0,i=1}for(n=f.length;0===f[--n];)f.pop();if(zv&&(t.e>Gv||t.e<-Gv))throw Error($v+em(t));return t}function cm(t,e){var r,n,o,i,a,c,u,l,s,f,p=t.constructor,h=p.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new p(t),zv?am(e,h):e;if(u=t.d,f=e.d,n=e.e,l=t.e,u=u.slice(),a=l-n){for((s=a<0)?(r=u,a=-a,c=f.length):(r=f,n=l,c=u.length),a>(o=Math.max(Math.ceil(h/7),c)+2)&&(a=o,r.length=1),r.reverse(),o=a;o--;)r.push(0);r.reverse()}else{for((s=(o=u.length)<(c=f.length))&&(c=o),o=0;o0;--o)u[c++]=0;for(o=f.length;o>a;){if(u[--o]0?i=i.charAt(0)+"."+i.slice(1)+nm(n):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(o<0?"e":"e+")+o):o<0?(i="0."+nm(-o-1)+i,r&&(n=r-a)>0&&(i+=nm(n))):o>=a?(i+=nm(o+1-a),r&&(n=r-o-1)>0&&(i=i+"."+nm(n))):((n=o+1)0&&(o+1===a&&(i+="."),i+=nm(n))),t.s<0?"-"+i:i}function lm(t,e){if(t.length>e)return t.length=e,!0}function sm(t){if(!t||"object"!=typeof t)throw Error(Fv+"Object expected");var e,r,n,o=["precision",1,Lv,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e=o[e+1]&&n<=o[e+2]))throw Error(Uv+r+": "+n);this[r]=n}if(void 0!==(n=t[r="LN10"])){if(n!=Math.LN10)throw Error(Uv+r+": "+n);this[r]=new this(n)}return this}var fm=function t(e){var r,n,o;function i(t){var e=this;if(!(e instanceof i))return new i(t);if(e.constructor=i,t instanceof i)return e.s=t.s,e.e=t.e,void(e.d=(t=t.d)?t.slice():t);if("number"==typeof t){if(0*t!=0)throw Error(Uv+t);if(t>0)e.s=1;else{if(!(t<0))return e.s=0,e.e=0,void(e.d=[0]);t=-t,e.s=-1}return t===~~t&&t<1e7?(e.e=0,void(e.d=[t])):im(e,t.toString())}if("string"!=typeof t)throw Error(Uv+t);if(45===t.charCodeAt(0)?(t=t.slice(1),e.s=-1):e.s=1,!Xv.test(t))throw Error(Uv+t);im(e,t)}if(i.prototype=Kv,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=t,i.config=i.set=sm,void 0===e&&(e={}),e)for(o=["precision","rounding","toExpNeg","toExpPos","LN10"],r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r=e?r.apply(void 0,o):t(e-a,bm(function(){for(var t=arguments.length,e=new Array(t),n=0;nt.length)&&(e=t.length);for(var r=0,n=new Array(e);rn&&(o=n,i=r),[o,i]}function _m(t,e,r){if(t.lte(0))return new pm(0);var n=Pm.getDigitCount(t.toNumber()),o=new pm(10).pow(n),i=t.div(o),a=1!==n?.05:.1,c=new pm(Math.ceil(i.div(a).toNumber())).add(r).mul(a).mul(o);return e?c:new pm(Math.ceil(c))}function Cm(t,e,r){var n=1,o=new pm(t);if(!o.isint()&&r){var i=Math.abs(t);i<1?(n=new pm(10).pow(Pm.getDigitCount(t)-1),o=new pm(Math.floor(o.div(n).toNumber())).mul(n)):i>1&&(o=new pm(Math.floor(t)))}else 0===t?o=new pm(Math.floor((e-1)/2)):r||(o=new pm(Math.floor(t)));var a=Math.floor((e-1)/2),c=function(){for(var t=arguments.length,e=new Array(t),r=0;r4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((e-t)/(r-1)))return{step:new pm(0),tickMin:new pm(0),tickMax:new pm(0)};var i,a=_m(new pm(e).sub(t).div(r-1),n,o);i=t<=0&&e>=0?new pm(0):(i=new pm(t).add(e).div(2)).sub(new pm(i).mod(a));var c=Math.ceil(i.sub(t).div(a).toNumber()),u=Math.ceil(new pm(e).sub(i).div(a).toNumber()),l=c+u+1;return l>r?Dm(t,e,r,n,o+1):(l0?u+(r-l):u,c=e>0?c:c+(r-l)),{step:a,tickMin:i.sub(new pm(c).mul(a)),tickMax:i.add(new pm(u).mul(a))})}var Im=Sm(function(t){var e=Em(t,2),r=e[0],n=e[1],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=Math.max(o,2),c=Em(Mm([r,n]),2),u=c[0],l=c[1];if(u===-1/0||l===1/0){var s=l===1/0?[u].concat(Am(xm(0,o-1).map(function(){return 1/0}))):[].concat(Am(xm(0,o-1).map(function(){return-1/0})),[l]);return r>n?jm(s):s}if(u===l)return Cm(u,o,i);var f=Dm(u,l,a,i),p=f.step,h=f.tickMin,y=f.tickMax,d=Pm.rangeStep(h,y.add(new pm(.1).mul(p)),p);return r>n?jm(d):d}),Nm=Sm(function(t,e){var r=Em(t,2),n=r[0],o=r[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=Em(Mm([n,o]),2),c=a[0],u=a[1];if(c===-1/0||u===1/0)return[n,o];if(c===u)return[c];var l=Math.max(e,2),s=_m(new pm(u).sub(c).div(l-1),i,0),f=[].concat(Am(Pm.rangeStep(new pm(c),new pm(u).sub(new pm(.99).mul(s)),s)),[u]);return n>o?jm(f):f}),Bm="Invariant failed";function Rm(t,e){if(!t)throw new Error(Bm)}var Lm=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function zm(t){return(zm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Fm(){return Fm=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function Wm(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r=2?2*or(a[0]-a[1])*u:u,e&&(t.ticks||t.niceTicks)?(t.ticks||t.niceTicks).map(function(t){var e=o?o.indexOf(t):t;return{coordinate:n(e)+u,value:t,offset:u}}).filter(function(t){return!nr(t.coordinate)}):t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(t,e){return{coordinate:n(t)+u,value:t,index:e,offset:u}}):n.ticks&&!r?n.ticks(t.tickCount).map(function(t){return{coordinate:n(t)+u,value:t,offset:u}}):n.domain().map(function(t,e){return{coordinate:n(t)+u,value:o?o[t]:t,index:e,offset:u}})},mb=new WeakMap,bb=function(t,e){if("function"!=typeof e)return t;mb.has(t)||mb.set(t,new WeakMap);var r=mb.get(t);if(r.has(e))return r.get(e);var n=function(){t.apply(void 0,arguments),e.apply(void 0,arguments)};return r.set(e,n),n},gb=function(t,e,r){var n=t.scale,o=t.type,i=t.layout,a=t.axisType;if("auto"===n)return"radial"===i&&"radiusAxis"===a?{scale:cp(),realScaleType:"band"}:"radial"===i&&"angleAxis"===a?{scale:Mh(),realScaleType:"linear"}:"category"===o&&e&&(e.indexOf("LineChart")>=0||e.indexOf("AreaChart")>=0||e.indexOf("ComposedChart")>=0&&!r)?{scale:lp(),realScaleType:"point"}:"category"===o?{scale:cp(),realScaleType:"band"}:{scale:Mh(),realScaleType:"linear"};if(Ce(n)){var c="scale".concat(wn(n));return{scale:(dv[c]||lp)(),realScaleType:dv[c]?c:"point"}}return B(n)?{scale:n}:{scale:lp(),realScaleType:"point"}},wb=1e-4,xb=function(t){var e=t.domain();if(e&&!(e.length<=2)){var r=e.length,n=t.range(),o=Math.min(n[0],n[1])-wb,i=Math.max(n[0],n[1])+wb,a=t(e[0]),c=t(e[r-1]);(ai||ci)&&t.domain([e[0],e[r-1]])}},Ob={sign:function(t){var e=t.length;if(!(e<=0))for(var r=0,n=t[0].length;r=0?(t[a][r][0]=o,t[a][r][1]=o+c,o=t[a][r][1]):(t[a][r][0]=i,t[a][r][1]=i+c,i=t[a][r][1])}},expand:function(t,e){if((n=t.length)>0){for(var r,n,o,i=0,a=t[0].length;i0){for(var r,n=0,o=t[e[0]],i=o.length;n0&&(n=(r=t[e[0]]).length)>0){for(var r,n,o,i=0,a=1;a=0?(t[i][r][0]=o,t[i][r][1]=o+a,o=t[i][r][1]):(t[i][r][0]=0,t[i][r][1]=0)}}},jb=function(t,e,r){var n=e.map(function(t){return t.props.dataKey}),o=Ob[r],i=function(){var t=xn([]),e=jo,r=Oo,n=So;function o(o){var i,a,c=Array.from(t.apply(this,arguments),Po),u=c.length,l=-1;for(const t of o)for(i=0,++l;i0)return n}if(t&&e&&e.length>=2){for(var o=Bl(e,function(t){return t.coordinate}),i=1/0,a=1,c=o.length;at.length)&&(e=t.length);for(var r=0,n=new Array(e);r2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(e-(r.top||0)-(r.bottom||0)))/2},Wb=function(t,e){var r=t.x,n=t.y,o=e.cx,i=e.cy,a=function(t,e){var r=t.x,n=t.y,o=e.x,i=e.y;return Math.sqrt(Math.pow(r-o,2)+Math.pow(n-i,2))}({x:r,y:n},{x:o,y:i});if(a<=0)return{radius:a};var c=(r-o)/a,u=Math.acos(c);return n>i&&(u=2*Math.PI-u),{radius:a,angle:Ub(u),angleInRadian:u}},Xb=function(t,e){var r=e.startAngle,n=e.endAngle,o=Math.floor(r/360),i=Math.floor(n/360);return t+360*Math.min(o,i)},Vb=function(t,e){var r=t.x,n=t.y,o=Wb({x:r,y:n},e),i=o.radius,a=o.angle,c=e.innerRadius,u=e.outerRadius;if(iu)return!1;if(0===i)return!0;var l,s=function(t){var e=t.startAngle,r=t.endAngle,n=Math.floor(e/360),o=Math.floor(r/360),i=Math.min(n,o);return{startAngle:e-360*i,endAngle:r-360*i}}(e),f=s.startAngle,p=s.endAngle,h=a;if(f<=p){for(;h>p;)h-=360;for(;h=f&&h<=p}else{for(;h>f;)h-=360;for(;h=p&&h<=f}return l?Bb(Bb({},e),{},{radius:i,angle:Xb(h,e)}):null},Hb=function(t){return n.isValidElement(t)||B(t)||"boolean"==typeof t?"":t.className};function Gb(t){return(Gb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Kb=["offset"];function Yb(t){return function(t){if(Array.isArray(t))return Zb(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Zb(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zb(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Zb(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function Qb(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function tg(t){for(var e=1;e=0?1:-1;"insideStart"===c?(i=v+x*l,a=b):"insideEnd"===c?(i=m-x*l,a=!b):"end"===c&&(i=m+x*l,a=b),a=w<=0?a:!a;var O=$b(p,h,g,i),j=$b(p,h,g,i+359*(a?1:-1)),S="M".concat(O.x,",").concat(O.y,"\n A").concat(g,",").concat(g,",0,1,").concat(a?0:1,",\n ").concat(j.x,",").concat(j.y),P=ke(e.id)?lr("recharts-radial-line-"):e.id;return o.createElement("text",rg({},n,{dominantBaseline:"central",className:t("recharts-radial-bar-label",s)}),o.createElement("defs",null,o.createElement("path",{id:P,d:S})),o.createElement("textPath",{xlinkHref:"#".concat(P)},r))};function og(e){var r,i=e.offset,a=tg({offset:void 0===i?5:i},Jb(e,Kb)),c=a.viewBox,u=a.position,l=a.value,s=a.children,f=a.content,p=a.className,h=void 0===p?"":p,y=a.textBreakAll;if(!c||ke(l)&&ke(s)&&!n.isValidElement(f)&&!B(f))return null;if(n.isValidElement(f))return n.cloneElement(f,a);if(B(f)){if(r=n.createElement(f,a),n.isValidElement(r))return r}else r=function(t){var e=t.value,r=t.formatter,n=ke(t.children)?e:t.children;return B(r)?r(n):n}(a);var d=function(t){return"cx"in t&&ar(t.cx)}(c),v=Br(a,!0);if(d&&("insideStart"===u||"insideEnd"===u||"end"===u))return ng(a,r,v);var m=d?function(t){var e=t.viewBox,r=t.offset,n=t.position,o=e,i=o.cx,a=o.cy,c=o.innerRadius,u=o.outerRadius,l=(o.startAngle+o.endAngle)/2;if("outside"===n){var s=$b(i,a,u+r,l),f=s.x;return{x:f,y:s.y,textAnchor:f>=i?"start":"end",verticalAnchor:"middle"}}if("center"===n)return{x:i,y:a,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===n)return{x:i,y:a,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===n)return{x:i,y:a,textAnchor:"middle",verticalAnchor:"end"};var p=$b(i,a,(c+u)/2,l);return{x:p.x,y:p.y,textAnchor:"middle",verticalAnchor:"middle"}}(a):function(t){var e=t.viewBox,r=t.parentViewBox,n=t.offset,o=t.position,i=e,a=i.x,c=i.y,u=i.width,l=i.height,s=l>=0?1:-1,f=s*n,p=s>0?"end":"start",h=s>0?"start":"end",y=u>=0?1:-1,d=y*n,v=y>0?"end":"start",m=y>0?"start":"end";if("top"===o)return tg(tg({},{x:a+u/2,y:c-s*n,textAnchor:"middle",verticalAnchor:p}),r?{height:Math.max(c-r.y,0),width:u}:{});if("bottom"===o)return tg(tg({},{x:a+u/2,y:c+l+f,textAnchor:"middle",verticalAnchor:h}),r?{height:Math.max(r.y+r.height-(c+l),0),width:u}:{});if("left"===o){var b={x:a-d,y:c+l/2,textAnchor:v,verticalAnchor:"middle"};return tg(tg({},b),r?{width:Math.max(b.x-r.x,0),height:l}:{})}if("right"===o){var g={x:a+u+d,y:c+l/2,textAnchor:m,verticalAnchor:"middle"};return tg(tg({},g),r?{width:Math.max(r.x+r.width-g.x,0),height:l}:{})}var w=r?{width:u,height:l}:{};return"insideLeft"===o?tg({x:a+d,y:c+l/2,textAnchor:m,verticalAnchor:"middle"},w):"insideRight"===o?tg({x:a+u-d,y:c+l/2,textAnchor:v,verticalAnchor:"middle"},w):"insideTop"===o?tg({x:a+u/2,y:c+f,textAnchor:"middle",verticalAnchor:h},w):"insideBottom"===o?tg({x:a+u/2,y:c+l-f,textAnchor:"middle",verticalAnchor:p},w):"insideTopLeft"===o?tg({x:a+d,y:c+f,textAnchor:m,verticalAnchor:h},w):"insideTopRight"===o?tg({x:a+u-d,y:c+f,textAnchor:v,verticalAnchor:h},w):"insideBottomLeft"===o?tg({x:a+d,y:c+l-f,textAnchor:m,verticalAnchor:p},w):"insideBottomRight"===o?tg({x:a+u-d,y:c+l-f,textAnchor:v,verticalAnchor:p},w):C(o)&&(ar(o.x)||ir(o.x))&&(ar(o.y)||ir(o.y))?tg({x:a+sr(o.x,u),y:c+sr(o.y,l),textAnchor:"end",verticalAnchor:"end"},w):tg({x:a+u/2,y:c+l/2,textAnchor:"middle",verticalAnchor:"middle"},w)}(a);return o.createElement(Df,rg({className:t("recharts-label",h)},v,m,{breakAll:y}),r)}og.displayName="Label";var ig=function(t){var e=t.cx,r=t.cy,n=t.angle,o=t.startAngle,i=t.endAngle,a=t.r,c=t.radius,u=t.innerRadius,l=t.outerRadius,s=t.x,f=t.y,p=t.top,h=t.left,y=t.width,d=t.height,v=t.clockWise,m=t.labelViewBox;if(m)return m;if(ar(y)&&ar(d)){if(ar(s)&&ar(f))return{x:s,y:f,width:y,height:d};if(ar(p)&&ar(h))return{x:p,y:h,width:y,height:d}}return ar(s)&&ar(f)?{x:s,y:f,width:0,height:0}:ar(e)&&ar(r)?{cx:e,cy:r,startAngle:o||n||0,endAngle:i||n||0,innerRadius:u||0,outerRadius:l||c||a||0,clockWise:v}:t.viewBox?t.viewBox:{}};og.parseViewBox=ig,og.renderCallByParent=function(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t||!t.children&&r&&!t.label)return null;var i=t.children,a=ig(t),c=Cr(i,og).map(function(t,r){return n.cloneElement(t,{viewBox:e||a,key:"label-".concat(r)})});if(!r)return c;var u=function(t,e){return t?!0===t?o.createElement(og,{key:"label-implicit",viewBox:e}):cr(t)?o.createElement(og,{key:"label-implicit",viewBox:e,value:t}):n.isValidElement(t)?t.type===og?n.cloneElement(t,{key:"label-implicit",viewBox:e}):o.createElement(og,{key:"label-implicit",content:t,viewBox:e}):B(t)?o.createElement(og,{key:"label-implicit",content:t,viewBox:e}):C(t)?o.createElement(og,rg({viewBox:e},t,{key:"label-implicit"})):null:null}(t.label,e||a);return[u].concat(Yb(c))};const ag=r(function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0});function cg(t){return(cg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var ug=["valueAccessor"],lg=["data","dataKey","clockWise","id","textBreakAll"];function sg(t){return function(t){if(Array.isArray(t))return fg(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return fg(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fg(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fg(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var mg=function(t){return Array.isArray(t.value)?ag(t.value):t.value};function bg(t){var e=t.valueAccessor,r=void 0===e?mg:e,n=vg(t,ug),i=n.data,a=n.dataKey,c=n.clockWise,u=n.id,l=n.textBreakAll,s=vg(n,lg);return i&&i.length?o.createElement(Hr,{className:"recharts-label-list"},i.map(function(t,e){var n=ke(a)?r(t,e):lb(t&&t.payload,a),i=ke(u)?{}:{id:"".concat(u,"-").concat(e)};return o.createElement(og,pg({},Br(t,!0),s,i,{parentViewBox:t.parentViewBox,value:n,textBreakAll:l,viewBox:og.parseViewBox(ke(c)?t:yg(yg({},t),{},{clockWise:c})),key:"label-".concat(e),index:e}))})):null}function gg(t){return(gg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function wg(){return wg=Object.assign?Object.assign.bind():function(t){for(var e=1;e2&&void 0!==arguments[2])||arguments[2];if(!t||!t.children&&r&&!t.label)return null;var i=Cr(t.children,bg).map(function(t,r){return n.cloneElement(t,{data:e,key:"labelList-".concat(r)})});return r?[function(t,e){return t?!0===t?o.createElement(bg,{key:"labelList-implicit",data:e}):o.isValidElement(t)||B(t)?o.createElement(bg,{key:"labelList-implicit",data:e,content:t}):C(t)?o.createElement(bg,pg({data:e},t,{key:"labelList-implicit"})):null:null}(t.label,e)].concat(sg(i)):i};var Sg=function(t){var e=t.cx,r=t.cy,n=t.radius,o=t.angle,i=t.sign,a=t.isExternal,c=t.cornerRadius,u=t.cornerIsExternal,l=c*(a?1:-1)+n,s=Math.asin(c/l)/Fb,f=u?o:o+i*s,p=u?o-i*s:o;return{center:$b(e,r,l,f),circleTangency:$b(e,r,n,f),lineTangency:$b(e,r,l*Math.cos(s*Fb),p),theta:s}},Pg=function(t){var e=t.cx,r=t.cy,n=t.innerRadius,o=t.outerRadius,i=t.startAngle,a=function(t,e){return or(e-t)*Math.min(Math.abs(e-t),359.999)}(i,t.endAngle),c=i+a,u=$b(e,r,o,i),l=$b(e,r,o,c),s="M ".concat(u.x,",").concat(u.y,"\n A ").concat(o,",").concat(o,",0,\n ").concat(+(Math.abs(a)>180),",").concat(+(i>c),",\n ").concat(l.x,",").concat(l.y,"\n ");if(n>0){var f=$b(e,r,n,i),p=$b(e,r,n,c);s+="L ".concat(p.x,",").concat(p.y,"\n A ").concat(n,",").concat(n,",0,\n ").concat(+(Math.abs(a)>180),",").concat(+(i<=c),",\n ").concat(f.x,",").concat(f.y," Z")}else s+="L ".concat(e,",").concat(r," Z");return s},Ag={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Eg=function(e){var r=Og(Og({},Ag),e),n=r.cx,i=r.cy,a=r.innerRadius,c=r.outerRadius,u=r.cornerRadius,l=r.forceCornerRadius,s=r.cornerIsExternal,f=r.startAngle,p=r.endAngle,h=r.className;if(c0&&Math.abs(f-p)<360?function(t){var e=t.cx,r=t.cy,n=t.innerRadius,o=t.outerRadius,i=t.cornerRadius,a=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,l=t.endAngle,s=or(l-u),f=Sg({cx:e,cy:r,radius:o,angle:u,sign:s,cornerRadius:i,cornerIsExternal:c}),p=f.circleTangency,h=f.lineTangency,y=f.theta,d=Sg({cx:e,cy:r,radius:o,angle:l,sign:-s,cornerRadius:i,cornerIsExternal:c}),v=d.circleTangency,m=d.lineTangency,b=d.theta,g=c?Math.abs(u-l):Math.abs(u-l)-y-b;if(g<0)return a?"M ".concat(h.x,",").concat(h.y,"\n a").concat(i,",").concat(i,",0,0,1,").concat(2*i,",0\n a").concat(i,",").concat(i,",0,0,1,").concat(2*-i,",0\n "):Pg({cx:e,cy:r,innerRadius:n,outerRadius:o,startAngle:u,endAngle:l});var w="M ".concat(h.x,",").concat(h.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(s<0),",").concat(p.x,",").concat(p.y,"\n A").concat(o,",").concat(o,",0,").concat(+(g>180),",").concat(+(s<0),",").concat(v.x,",").concat(v.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(s<0),",").concat(m.x,",").concat(m.y,"\n ");if(n>0){var x=Sg({cx:e,cy:r,radius:n,angle:u,sign:s,isExternal:!0,cornerRadius:i,cornerIsExternal:c}),O=x.circleTangency,j=x.lineTangency,S=x.theta,P=Sg({cx:e,cy:r,radius:n,angle:l,sign:-s,isExternal:!0,cornerRadius:i,cornerIsExternal:c}),A=P.circleTangency,E=P.lineTangency,k=P.theta,T=c?Math.abs(u-l):Math.abs(u-l)-S-k;if(T<0&&0===i)return"".concat(w,"L").concat(e,",").concat(r,"Z");w+="L".concat(E.x,",").concat(E.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(s<0),",").concat(A.x,",").concat(A.y,"\n A").concat(n,",").concat(n,",0,").concat(+(T>180),",").concat(+(s>0),",").concat(O.x,",").concat(O.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(s<0),",").concat(j.x,",").concat(j.y,"Z")}else w+="L".concat(e,",").concat(r,"Z");return w}({cx:n,cy:i,innerRadius:a,outerRadius:c,cornerRadius:Math.min(m,v/2),forceCornerRadius:l,cornerIsExternal:s,startAngle:f,endAngle:p}):Pg({cx:n,cy:i,innerRadius:a,outerRadius:c,startAngle:f,endAngle:p}),o.createElement("path",wg({},Br(r,!0),{className:d,d:y,role:"img"}))};function kg(t){return(kg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Tg(){return Tg=Object.assign?Object.assign.bind():function(t){for(var e=1;e0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function tw(t,e){return Yg(t.getTime(),e.getTime())}function ew(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function rw(t,e){return t===e}function nw(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var o,i,a=new Array(n),c=t.entries(),u=0;(o=c.next())&&!o.done;){for(var l=e.entries(),s=!1,f=0;(i=l.next())&&!i.done;)if(a[f])f++;else{var p=o.value,h=i.value;if(r.equals(p[0],h[0],u,f,t,e,r)&&r.equals(p[1],h[1],p[0],h[0],t,e,r)){s=a[f]=!0;break}f++}if(!s)return!1;u++}return!0}var ow=Yg;function iw(t,e,r){var n=Jg(t),o=n.length;if(Jg(e).length!==o)return!1;for(;o-- >0;)if(!pw(t,e,r,n[o]))return!1;return!0}function aw(t,e,r){var n,o,i,a=Gg(t),c=a.length;if(Gg(e).length!==c)return!1;for(;c-- >0;){if(!pw(t,e,r,n=a[c]))return!1;if(o=Zg(t,n),i=Zg(e,n),(o||i)&&(!o||!i||o.configurable!==i.configurable||o.enumerable!==i.enumerable||o.writable!==i.writable))return!1}return!0}function cw(t,e){return Yg(t.valueOf(),e.valueOf())}function uw(t,e){return t.source===e.source&&t.flags===e.flags}function lw(t,e,r){var n=t.size;if(n!==e.size)return!1;if(!n)return!0;for(var o,i,a=new Array(n),c=t.values();(o=c.next())&&!o.done;){for(var u=e.values(),l=!1,s=0;(i=u.next())&&!i.done;){if(!a[s]&&r.equals(o.value,i.value,o.value,i.value,t,e,r)){l=a[s]=!0;break}s++}if(!l)return!1}return!0}function sw(t,e){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function fw(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function pw(t,e,r,n){return!("_owner"!==n&&"__o"!==n&&"__v"!==n||!t.$$typeof&&!e.$$typeof)||Kg(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}var hw=Array.isArray,yw="function"==typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView:null,dw=Object.assign,vw=Object.prototype.toString.call.bind(Object.prototype.toString);var mw=bw();function bw(t){void 0===t&&(t={});var e,r=t.circular,n=void 0!==r&&r,o=t.createInternalComparator,i=t.createState,a=t.strict,c=void 0!==a&&a,u=function(t){var e=t.circular,r=t.createCustomConfig,n=t.strict,o={areArraysEqual:n?aw:Qg,areDatesEqual:tw,areErrorsEqual:ew,areFunctionsEqual:rw,areMapsEqual:n?Vg(nw,aw):nw,areNumbersEqual:ow,areObjectsEqual:n?aw:iw,arePrimitiveWrappersEqual:cw,areRegExpsEqual:uw,areSetsEqual:n?Vg(lw,aw):lw,areTypedArraysEqual:n?aw:sw,areUrlsEqual:fw};if(r&&(o=dw({},o,r(o))),e){var i=Hg(o.areArraysEqual),a=Hg(o.areMapsEqual),c=Hg(o.areObjectsEqual),u=Hg(o.areSetsEqual);o=dw({},o,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:c,areSetsEqual:u})}return o}(t),l=function(t){var e=t.areArraysEqual,r=t.areDatesEqual,n=t.areErrorsEqual,o=t.areFunctionsEqual,i=t.areMapsEqual,a=t.areNumbersEqual,c=t.areObjectsEqual,u=t.arePrimitiveWrappersEqual,l=t.areRegExpsEqual,s=t.areSetsEqual,f=t.areTypedArraysEqual,p=t.areUrlsEqual;return function(t,h,y){if(t===h)return!0;if(null==t||null==h)return!1;var d=typeof t;if(d!==typeof h)return!1;if("object"!==d)return"number"===d?a(t,h,y):"function"===d&&o(t,h,y);var v=t.constructor;if(v!==h.constructor)return!1;if(v===Object)return c(t,h,y);if(hw(t))return e(t,h,y);if(null!=yw&&yw(t))return f(t,h,y);if(v===Date)return r(t,h,y);if(v===RegExp)return l(t,h,y);if(v===Map)return i(t,h,y);if(v===Set)return s(t,h,y);var m=vw(t);return"[object Date]"===m?r(t,h,y):"[object RegExp]"===m?l(t,h,y):"[object Map]"===m?i(t,h,y):"[object Set]"===m?s(t,h,y):"[object Object]"===m?"function"!=typeof t.then&&"function"!=typeof h.then&&c(t,h,y):"[object URL]"===m?p(t,h,y):"[object Error]"===m?n(t,h,y):"[object Arguments]"===m?c(t,h,y):("[object Boolean]"===m||"[object Number]"===m||"[object String]"===m)&&u(t,h,y)}}(u);return function(t){var e=t.circular,r=t.comparator,n=t.createState,o=t.equals,i=t.strict;if(n)return function(t,a){var c=n(),u=c.cache,l=void 0===u?e?new WeakMap:void 0:u,s=c.meta;return r(t,a,{cache:l,equals:o,meta:s,strict:i})};if(e)return function(t,e){return r(t,e,{cache:new WeakMap,equals:o,meta:void 0,strict:i})};var a={cache:void 0,equals:o,meta:void 0,strict:i};return function(t,e){return r(t,e,a)}}({circular:n,comparator:l,createState:i,equals:o?o(l):(e=l,function(t,r,n,o,i,a,c){return e(t,r,c)}),strict:c})}function gw(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=-1;requestAnimationFrame(function n(o){r<0&&(r=o),o-r>e?(t(o),r=-1):function(t){"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame(t)}(n)})}function ww(t){return(ww="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function xw(t){return function(t){if(Array.isArray(t))return t}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Ow(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ow(t,e)}(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ow(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r1?1:t<0?0:t},d=function(t){for(var e=t>1?1:t,r=e,n=0;n<8;++n){var o=f(r)-e,i=h(r);if(Math.abs(o-e)0&&void 0!==arguments[0]?arguments[0]:{},e=t.stiff,r=void 0===e?100:e,n=t.damping,o=void 0===n?8:n,i=t.dt,a=void 0===i?17:i,c=function(t,e,n){var i=n+(-(t-e)*r-n*o)*a/1e3,c=n*a/1e3+t;return Math.abs(c-e)t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function rx(t){return function(t){if(Array.isArray(t))return nx(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return nx(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nx(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nx(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0?r[o-1]:n,p=l||Object.keys(u);if("function"==typeof c||"spring"===c)return[].concat(rx(t),[e.runJSAnimation.bind(e,{from:f.style,to:u,duration:i,easing:c}),i]);var h=Mw(p,i,c),y=ix(ix(ix({},f.style),u),{},{transition:h});return[].concat(rx(t),[y,i,s]).filter(kw)},[a,Math.max(u,n)])),[t.onAnimationEnd]))}},{key:"runAnimation",value:function(t){this.manager||(this.manager=jw());var e=t.begin,r=t.duration,n=t.attributeName,o=t.to,i=t.easing,a=t.onAnimationStart,c=t.onAnimationEnd,u=t.steps,l=t.children,s=this.manager;if(this.unSubscribe=s.subscribe(this.handleStyleChange),"function"!=typeof i&&"function"!=typeof l&&"spring"!==i)if(u.length>1)this.runStepAnimation(t);else{var f=n?ax({},n,o):o,p=Mw(Object.keys(f),r,i);s.start([a,e,ix(ix({},f),{},{transition:p}),r,c])}else this.runJSAnimation(t)}},{key:"render",value:function(){var t=this.props,e=t.children;t.begin;var r=t.duration;t.attributeName,t.easing;var i=t.isActive;t.steps,t.from,t.to,t.canBegin,t.onAnimationEnd,t.shouldReAnimate,t.onAnimationReStart;var a=ex(t,tx),c=n.Children.count(e),u=this.state.style;if("function"==typeof e)return e(u);if(!i||0===c||r<=0)return e;var l=function(t){var e=t.props,r=e.style,o=void 0===r?{}:r,i=e.className;return n.cloneElement(t,ix(ix({},a),{},{style:ix(ix({},o),u),className:i}))};return 1===c?l(n.Children.only(e)):o.createElement("div",null,n.Children.map(e,function(t){return l(t)}))}}])&&cx(t.prototype,e),r&&cx(t,r),Object.defineProperty(t,"prototype",{writable:!1}),a}();yx.displayName="Animate",yx.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}},yx.propTypes={from:$g.oneOfType([$g.object,$g.string]),to:$g.oneOfType([$g.object,$g.string]),attributeName:$g.string,duration:$g.number,begin:$g.number,easing:$g.oneOfType([$g.string,$g.func]),steps:$g.arrayOf($g.shape({duration:$g.number.isRequired,style:$g.object.isRequired,easing:$g.oneOfType([$g.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),$g.func]),properties:$g.arrayOf("string"),onAnimationEnd:$g.func})),children:$g.oneOfType([$g.node,$g.func]),isActive:$g.bool,canBegin:$g.bool,onAnimationEnd:$g.func,shouldReAnimate:$g.bool,onAnimationStart:$g.func,onAnimationReStart:$g.func};const dx=yx;function vx(t){return(vx="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function mx(){return mx=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0?1:-1,u=r>=0?1:-1,l=n>=0&&r>=0||n<0&&r<0?1:0;if(a>0&&o instanceof Array){for(var s=[0,0,0,0],f=0;f<4;f++)s[f]=o[f]>a?a:o[f];i="M".concat(t,",").concat(e+c*s[0]),s[0]>0&&(i+="A ".concat(s[0],",").concat(s[0],",0,0,").concat(l,",").concat(t+u*s[0],",").concat(e)),i+="L ".concat(t+r-u*s[1],",").concat(e),s[1]>0&&(i+="A ".concat(s[1],",").concat(s[1],",0,0,").concat(l,",\n ").concat(t+r,",").concat(e+c*s[1])),i+="L ".concat(t+r,",").concat(e+n-c*s[2]),s[2]>0&&(i+="A ".concat(s[2],",").concat(s[2],",0,0,").concat(l,",\n ").concat(t+r-u*s[2],",").concat(e+n)),i+="L ".concat(t+u*s[3],",").concat(e+n),s[3]>0&&(i+="A ".concat(s[3],",").concat(s[3],",0,0,").concat(l,",\n ").concat(t,",").concat(e+n-c*s[3])),i+="Z"}else if(a>0&&o===+o&&o>0){var p=Math.min(a,o);i="M ".concat(t,",").concat(e+c*p,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t+u*p,",").concat(e,"\n L ").concat(t+r-u*p,",").concat(e,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t+r,",").concat(e+c*p,"\n L ").concat(t+r,",").concat(e+n-c*p,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t+r-u*p,",").concat(e+n,"\n L ").concat(t+u*p,",").concat(e+n,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t,",").concat(e+n-c*p," Z")}else i="M ".concat(t,",").concat(e," h ").concat(r," v ").concat(n," h ").concat(-r," Z");return i},Sx=function(t,e){if(!t||!e)return!1;var r=t.x,n=t.y,o=e.x,i=e.y,a=e.width,c=e.height;if(Math.abs(a)>0&&Math.abs(c)>0){var u=Math.min(o,o+a),l=Math.max(o,o+a),s=Math.min(i,i+c),f=Math.max(i,i+c);return r>=u&&r<=l&&n>=s&&n<=f}return!1},Px={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Ax=function(e){var r=xx(xx({},Px),e),i=n.useRef(),a=bx(n.useState(-1),2),c=a[0],u=a[1];n.useEffect(function(){if(i.current&&i.current.getTotalLength)try{var t=i.current.getTotalLength();t&&u(t)}catch(e){}},[]);var l=r.x,s=r.y,f=r.width,p=r.height,h=r.radius,y=r.className,d=r.animationEasing,v=r.animationDuration,m=r.animationBegin,b=r.isAnimationActive,g=r.isUpdateAnimationActive;if(l!==+l||s!==+s||f!==+f||p!==+p||0===f||0===p)return null;var w=t("recharts-rectangle",y);return g?o.createElement(dx,{canBegin:c>0,from:{width:f,height:p,x:l,y:s},to:{width:f,height:p,x:l,y:s},duration:v,animationEasing:d,isActive:g},function(t){var e=t.width,n=t.height,a=t.x,u=t.y;return o.createElement(dx,{canBegin:c>0,from:"0px ".concat(-1===c?1:c,"px"),to:"".concat(c,"px 0px"),attributeName:"strokeDasharray",begin:m,duration:v,isActive:b,easing:d},o.createElement("path",mx({},Br(r,!0),{className:w,d:jx(a,u,e,n,h),ref:i})))}):o.createElement("path",mx({},Br(r,!0),{className:w,d:jx(l,s,f,p,h)}))},Ex=["points","className","baseLinePoints","connectNulls"];function kx(){return kx=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function Mx(t){return function(t){if(Array.isArray(t))return _x(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return _x(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _x(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _x(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:[],e=[[]];return t.forEach(function(t){Cx(t)?e[e.length-1].push(t):e[e.length-1].length>0&&e.push([])}),Cx(t[0])&&e[e.length-1].push(t[0]),e[e.length-1].length<=0&&(e=e.slice(0,-1)),e}(t);e&&(r=[r.reduce(function(t,e){return[].concat(Mx(t),Mx(e))},[])]);var n=r.map(function(t){return t.reduce(function(t,e,r){return"".concat(t).concat(0===r?"M":"L").concat(e.x,",").concat(e.y)},"")}).join("");return 1===r.length?"".concat(n,"Z"):n},Ix=function(e){var r=e.points,n=e.className,i=e.baseLinePoints,a=e.connectNulls,c=Tx(e,Ex);if(!r||!r.length)return null;var u=t("recharts-polygon",n);if(i&&i.length){var l=c.stroke&&"none"!==c.stroke,s=function(t,e,r){var n=Dx(t,r);return"".concat("Z"===n.slice(-1)?n.slice(0,-1):n,"L").concat(Dx(e.reverse(),r).slice(1))}(r,i,a);return o.createElement("g",{className:u},o.createElement("path",kx({},Br(c,!0),{fill:"Z"===s.slice(-1)?c.fill:"none",stroke:"none",d:s})),l?o.createElement("path",kx({},Br(c,!0),{fill:"none",d:Dx(r,a)})):null,l?o.createElement("path",kx({},Br(c,!0),{fill:"none",d:Dx(i,a)})):null)}var f=Dx(r,a);return o.createElement("path",kx({},Br(c,!0),{fill:"Z"===f.slice(-1)?c.fill:"none",className:u,d:f}))};function Nx(){return Nx=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var qx=function(t,e,r,n,o,i){return"M".concat(t,",").concat(o,"v").concat(n,"M").concat(i,",").concat(e,"h").concat(r)},Wx=function(e){var r=e.x,n=void 0===r?0:r,i=e.y,a=void 0===i?0:i,c=e.top,u=void 0===c?0:c,l=e.left,s=void 0===l?0:l,f=e.width,p=void 0===f?0:f,h=e.height,y=void 0===h?0:h,d=e.className,v=function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function aO(t,e){for(var r=0;rAO?"outer"===e?"start":"end":r<-AO?"outer"===e?"end":"start":"middle"}},{key:"renderAxisLine",value:function(){var t=this.props,e=t.cx,r=t.cy,n=t.radius,i=t.axisLine,a=t.axisLineType,c=mO(mO({},Br(this.props,!1)),{},{fill:"none"},Br(i,!1));if("circle"===a)return o.createElement(Bx,dO({className:"recharts-polar-angle-axis-line"},c,{cx:e,cy:r,r:n}));var u=this.props.ticks.map(function(t){return $b(e,r,n,t.coordinate)});return o.createElement(Ix,dO({className:"recharts-polar-angle-axis-line"},c,{points:u}))}},{key:"renderTicks",value:function(){var r=this,n=this.props,i=n.ticks,a=n.tick,c=n.tickLine,u=n.tickFormatter,l=n.stroke,s=Br(this.props,!1),f=Br(a,!1),p=mO(mO({},s),{},{fill:"none"},Br(c,!1)),h=i.map(function(n,i){var h=r.getTickLineCoord(n),y=mO(mO(mO({textAnchor:r.getTickTextAnchor(n)},s),{},{stroke:"none",fill:l},f),{},{index:i,payload:n,x:h.x2,y:h.y2});return o.createElement(Hr,dO({className:t("recharts-polar-angle-axis-tick",Hb(a)),key:"tick-".concat(n.coordinate)},Or(r.props,n,i)),c&&o.createElement("line",dO({className:"recharts-polar-angle-axis-tick-line"},p,h)),a&&e.renderTickItem(a,y,u?u(n.value,i):n.value))});return o.createElement(Hr,{className:"recharts-polar-angle-axis-ticks"},h)}},{key:"render",value:function(){var e=this.props,r=e.ticks,n=e.radius,i=e.axisLine;return n<=0||!r||!r.length?null:o.createElement(Hr,{className:t("recharts-polar-angle-axis",this.props.className)},i&&this.renderAxisLine(),this.renderTicks())}}])&&bO(r.prototype,i),a&&bO(r,a),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,i,a}();jO(EO,"displayName","PolarAngleAxis"),jO(EO,"axisType","angleAxis"),jO(EO,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var kO=Pa(Object.getPrototypeOf,Object),TO=x,MO=kO,_O=O,CO=Function.prototype,DO=Object.prototype,IO=CO.toString,NO=DO.hasOwnProperty,BO=IO.call(Object);const RO=r(function(t){if(!_O(t)||"[object Object]"!=TO(t))return!1;var e=MO(t);if(null===e)return!0;var r=NO.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&IO.call(r)==BO});var LO=x,zO=O;const FO=r(function(t){return!0===t||!1===t||zO(t)&&"[object Boolean]"==LO(t)});function UO(t){return(UO="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function $O(){return $O=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);r0,from:{upperWidth:0,lowerWidth:0,height:h,x:l,y:s},to:{upperWidth:f,lowerWidth:p,height:h,x:l,y:s},duration:v,animationEasing:d,isActive:b},function(t){var e=t.upperWidth,n=t.lowerWidth,a=t.height,u=t.x,l=t.y;return o.createElement(dx,{canBegin:c>0,from:"0px ".concat(-1===c?1:c,"px"),to:"".concat(c,"px 0px"),attributeName:"strokeDasharray",begin:m,duration:v,easing:d},o.createElement("path",$O({},Br(r,!0),{className:g,d:KO(u,l,e,n,a),ref:i})))}):o.createElement("g",null,o.createElement("path",$O({},Br(r,!0),{className:g,d:KO(l,s,f,p,h)})))},JO=["option","shapeType","propTransformer","activeClassName","isActive"];function QO(t){return(QO="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function tj(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function ej(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function rj(t){for(var e=1;ee?"start":t0?Ee(t,"paddingAngle",0):0;if(r){var c=pr(r.endAngle-r.startAngle,t.endAngle-t.startAngle),u=mj(mj({},t),{},{startAngle:a+o,endAngle:a+c(n)+o});i.push(u),a=u.endAngle}else{var l=t.endAngle,f=t.startAngle,p=pr(0,l-f)(n),h=mj(mj({},t),{},{startAngle:a+o,endAngle:a+p+o});i.push(h),a=h.endAngle}}),o.createElement(Hr,null,t.renderSectorsStatically(i))})}},{key:"attachKeyboardHandlers",value:function(t){var e=this;t.onkeydown=function(t){if(!t.altKey)switch(t.key){case"ArrowLeft":var r=++e.state.sectorToFocus%e.sectorRefs.length;e.sectorRefs[r].focus(),e.setState({sectorToFocus:r});break;case"ArrowRight":var n=--e.state.sectorToFocus<0?e.sectorRefs.length-1:e.state.sectorToFocus%e.sectorRefs.length;e.sectorRefs[n].focus(),e.setState({sectorToFocus:n});break;case"Escape":e.sectorRefs[e.state.sectorToFocus].blur(),e.setState({sectorToFocus:0})}}}},{key:"renderSectors",value:function(){var t=this.props,e=t.sectors,r=t.isAnimationActive,n=this.state.prevSectors;return!(r&&e&&e.length)||n&&Bv(n,e)?this.renderSectorsStatically(e):this.renderSectorsWithAnimation()}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var e=this,r=this.props,n=r.hide,i=r.sectors,a=r.className,c=r.label,u=r.cx,l=r.cy,s=r.innerRadius,f=r.outerRadius,p=r.isAnimationActive,h=this.state.isAnimationFinished;if(n||!i||!i.length||!ar(u)||!ar(l)||!ar(s)||!ar(f))return null;var y=t("recharts-pie",a);return o.createElement(Hr,{tabIndex:this.props.rootTabIndex,className:y,ref:function(t){e.pieRef=t}},this.renderSectors(),c&&this.renderLabels(i),og.renderCallByParent(this.props,null,!1),(!p||h)&&bg.renderCallByParent(this.props,i,!1))}}])&&bj(r.prototype,i),a&&bj(r,a),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,i,a}();GO=Pj,jj(Pj,"displayName","Pie"),jj(Pj,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!ls.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0}),jj(Pj,"parseDeltaAngle",function(t,e){return or(e-t)*Math.min(Math.abs(e-t),360)}),jj(Pj,"getRealPieData",function(t){var e=t.data,r=t.children,n=Br(t,!1),o=Cr(r,Ks);return e&&e.length?e.map(function(t,e){return mj(mj(mj({payload:t},n),t),o&&o[e]&&o[e].props)}):o&&o.length?o.map(function(t){return mj(mj({},n),t.props)}):[]}),jj(Pj,"parseCoordinateOfPie",function(t,e){var r=e.top,n=e.left,o=e.width,i=e.height,a=qb(o,i);return{cx:n+sr(t.cx,o,o/2),cy:r+sr(t.cy,i,i/2),innerRadius:sr(t.innerRadius,a,0),outerRadius:sr(t.outerRadius,a,.8*a),maxRadius:t.maxRadius||Math.sqrt(o*o+i*i)/2}}),jj(Pj,"getComposedData",function(t){var e=t.item,r=t.offset,n=void 0!==e.type.defaultProps?mj(mj({},e.type.defaultProps),e.props):e.props,o=GO.getRealPieData(n);if(!o||!o.length)return null;var i=n.cornerRadius,a=n.startAngle,c=n.endAngle,u=n.paddingAngle,l=n.dataKey,s=n.nameKey,f=n.valueKey,p=n.tooltipType,h=Math.abs(n.minAngle),y=GO.parseCoordinateOfPie(n,r),d=GO.parseDeltaAngle(a,c),v=Math.abs(d),m=l;ke(l)&&ke(f)?(Gr(!1,'Use "dataKey" to specify the value of pie,\n the props "valueKey" will be deprecated in 1.1.0'),m="value"):ke(l)&&(Gr(!1,'Use "dataKey" to specify the value of pie,\n the props "valueKey" will be deprecated in 1.1.0'),m=f);var b,g,w=o.filter(function(t){return 0!==lb(t,m,0)}).length,x=v-w*h-(v>=360?w:w-1)*u,O=o.reduce(function(t,e){var r=lb(e,m,0);return t+(ar(r)?r:0)},0);O>0&&(b=o.map(function(t,e){var r,n=lb(t,m,0),o=lb(t,s,e),c=(ar(n)?n:0)/O,l=(r=e?g.endAngle+or(d)*u*(0!==n?1:0):a)+or(d)*((0!==n?h:0)+c*x),f=(r+l)/2,v=(y.innerRadius+y.outerRadius)/2,b=[{name:o,value:n,payload:t,dataKey:m,type:p}],w=$b(y.cx,y.cy,v,f);return g=mj(mj(mj({percent:c,cornerRadius:i,name:o,tooltipPayload:b,midAngle:f,middleRadius:v,tooltipPosition:w},t),y),{},{value:lb(t,m),startAngle:r,endAngle:l,payload:t,paddingAngle:or(d)*u})}));return mj(mj({},y),{},{sectors:b,data:o})});var Aj=Math.ceil,Ej=Math.max;var kj=Ds,Tj=1/0;var Mj=function(t){return t?(t=kj(t))===Tj||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0},_j=function(t,e,r,n){for(var o=-1,i=Ej(Aj((e-t)/(r||1)),0),a=Array(i);i--;)a[n?i:++o]=t,t+=r;return a},Cj=Cl,Dj=Mj;const Ij=r(function(t){return function(e,r,n){return n&&"number"!=typeof n&&Cj(e,r,n)&&(r=n=void 0),e=Dj(e),void 0===r?(r=e,e=0):r=Dj(r),n=void 0===n?e0&&r.handleDrag(t.changedTouches[0])}),Kj(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var t=r.props,e=t.endIndex,n=t.onDragEnd,o=t.startIndex;null==n||n({endIndex:e,startIndex:o})}),r.detachDragEndListener()}),Kj(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Kj(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Kj(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Kj(r,"handleSlideDragStart",function(t){var e=Zj(t)?t.changedTouches[0]:t;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:e.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gj(t,e)}(e,n.PureComponent),r=e,a=[{key:"renderDefaultTraveller",value:function(t){var e=t.x,r=t.y,n=t.width,i=t.height,a=t.stroke,c=Math.floor(r+i/2)-1;return o.createElement(o.Fragment,null,o.createElement("rect",{x:e,y:r,width:n,height:i,fill:a,stroke:"none"}),o.createElement("line",{x1:e+1,y1:c,x2:e+n-1,y2:c,fill:"none",stroke:"#fff"}),o.createElement("line",{x1:e+1,y1:c+2,x2:e+n-1,y2:c+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(t,r){return o.isValidElement(t)?o.cloneElement(t,r):B(t)?t(r):e.renderDefaultTraveller(r)}},{key:"getDerivedStateFromProps",value:function(t,e){var r=t.data,n=t.width,o=t.x,i=t.travellerWidth,a=t.updateId,c=t.startIndex,u=t.endIndex;if(r!==e.prevData||a!==e.prevUpdateId)return qj({prevData:r,prevTravellerWidth:i,prevUpdateId:a,prevX:o,prevWidth:n},r&&r.length?function(t){var e=t.data,r=t.startIndex,n=t.endIndex,o=t.x,i=t.width,a=t.travellerWidth;if(!e||!e.length)return{};var c=e.length,u=lp().domain(Ij(0,c)).range([o,o+i-a]),l=u.domain().map(function(t){return u(t)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:u(r),endX:u(n),scale:u,scaleValues:l}}({data:r,width:n,x:o,travellerWidth:i,startIndex:c,endIndex:u}):{scale:null,scaleValues:null});if(e.scale&&(n!==e.prevWidth||o!==e.prevX||i!==e.prevTravellerWidth)){e.scale.range([o,o+n-i]);var l=e.scale.domain().map(function(t){return e.scale(t)});return{prevData:r,prevTravellerWidth:i,prevUpdateId:a,prevX:o,prevWidth:n,startX:e.scale(t.startIndex),endX:e.scale(t.endIndex),scaleValues:l}}return null}},{key:"getIndexInRange",value:function(t,e){for(var r=0,n=t.length-1;n-r>1;){var o=Math.floor((r+n)/2);t[o]>e?n=o:r=o}return e>=t[n]?n:r}}],(i=[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(t){var r=t.startX,n=t.endX,o=this.state.scaleValues,i=this.props,a=i.gap,c=i.data.length-1,u=Math.min(r,n),l=Math.max(r,n),s=e.getIndexInRange(o,u),f=e.getIndexInRange(o,l);return{startIndex:s-s%a,endIndex:f===c?c:f-f%a}}},{key:"getTextOfTick",value:function(t){var e=this.props,r=e.data,n=e.tickFormatter,o=e.dataKey,i=lb(r[t],o,t);return B(n)?n(i,t):i}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(t){var e=this.state,r=e.slideMoveStartX,n=e.startX,o=e.endX,i=this.props,a=i.x,c=i.width,u=i.travellerWidth,l=i.startIndex,s=i.endIndex,f=i.onChange,p=t.pageX-r;p>0?p=Math.min(p,a+c-u-o,a+c-u-n):p<0&&(p=Math.max(p,a-n,a-o));var h=this.getIndex({startX:n+p,endX:o+p});h.startIndex===l&&h.endIndex===s||!f||f(h),this.setState({startX:n+p,endX:o+p,slideMoveStartX:t.pageX})}},{key:"handleTravellerDragStart",value:function(t,e){var r=Zj(e)?e.changedTouches[0]:e;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:t,brushMoveStartX:r.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(t){var e=this.state,r=e.brushMoveStartX,n=e.movingTravellerId,o=e.endX,i=e.startX,a=this.state[n],c=this.props,u=c.x,l=c.width,s=c.travellerWidth,f=c.onChange,p=c.gap,h=c.data,y={startX:this.state.startX,endX:this.state.endX},d=t.pageX-r;d>0?d=Math.min(d,u+l-s-a):d<0&&(d=Math.max(d,u-a)),y[n]=a+d;var v=this.getIndex(y),m=v.startIndex,b=v.endIndex;this.setState(Kj(Kj({},n,a+d),"brushMoveStartX",t.pageX),function(){var t;f&&(t=h.length-1,("startX"===n&&(o>i?m%p===0:b%p===0)||oi?b%p===0:m%p===0)||o>i&&b===t)&&f(v))})}},{key:"handleTravellerMoveKeyboard",value:function(t,e){var r=this,n=this.state,o=n.scaleValues,i=n.startX,a=n.endX,c=this.state[e],u=o.indexOf(c);if(-1!==u){var l=u+t;if(!(-1===l||l>=o.length)){var s=o[l];"startX"===e&&s>=a||"endX"===e&&s<=i||this.setState(Kj({},e,s),function(){r.props.onChange(r.getIndex({startX:r.state.startX,endX:r.state.endX}))})}}}},{key:"renderBackground",value:function(){var t=this.props,e=t.x,r=t.y,n=t.width,i=t.height,a=t.fill,c=t.stroke;return o.createElement("rect",{stroke:c,fill:a,x:e,y:r,width:n,height:i})}},{key:"renderPanorama",value:function(){var t=this.props,e=t.x,r=t.y,i=t.width,a=t.height,c=t.data,u=t.children,l=t.padding,s=n.Children.only(u);return s?o.cloneElement(s,{x:e,y:r,width:i,height:a,margin:l,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(t,r){var n,i,a=this,c=this.props,u=c.y,l=c.travellerWidth,s=c.height,f=c.traveller,p=c.ariaLabel,h=c.data,y=c.startIndex,d=c.endIndex,v=Math.max(t,this.props.x),m=qj(qj({},Br(this.props,!1)),{},{x:v,y:u,width:l,height:s}),b=p||"Min value: ".concat(null===(n=h[y])||void 0===n?void 0:n.name,", Max value: ").concat(null===(i=h[d])||void 0===i?void 0:i.name);return o.createElement(Hr,{tabIndex:0,role:"slider","aria-label":b,"aria-valuenow":t,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[r],onTouchStart:this.travellerDragStartHandlers[r],onKeyDown:function(t){["ArrowLeft","ArrowRight"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),a.handleTravellerMoveKeyboard("ArrowRight"===t.key?1:-1,r))},onFocus:function(){a.setState({isTravellerFocused:!0})},onBlur:function(){a.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(f,m))}},{key:"renderSlide",value:function(t,e){var r=this.props,n=r.y,i=r.height,a=r.stroke,c=r.travellerWidth,u=Math.min(t,e)+c,l=Math.max(Math.abs(e-t)-c,0);return o.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:a,fillOpacity:.2,x:u,y:n,width:l,height:i})}},{key:"renderText",value:function(){var t=this.props,e=t.startIndex,r=t.endIndex,n=t.y,i=t.height,a=t.travellerWidth,c=t.stroke,u=this.state,l=u.startX,s=u.endX,f={pointerEvents:"none",fill:c};return o.createElement(Hr,{className:"recharts-brush-texts"},o.createElement(Df,Uj({textAnchor:"end",verticalAnchor:"middle",x:Math.min(l,s)-5,y:n+i/2},f),this.getTextOfTick(e)),o.createElement(Df,Uj({textAnchor:"start",verticalAnchor:"middle",x:Math.max(l,s)+a+5,y:n+i/2},f),this.getTextOfTick(r)))}},{key:"render",value:function(){var e=this.props,r=e.data,n=e.className,i=e.children,a=e.x,c=e.y,u=e.width,l=e.height,s=e.alwaysShowText,f=this.state,p=f.startX,h=f.endX,y=f.isTextActive,d=f.isSlideMoving,v=f.isTravellerMoving,m=f.isTravellerFocused;if(!r||!r.length||!ar(a)||!ar(c)||!ar(u)||!ar(l)||u<=0||l<=0)return null;var b=t("recharts-brush",n),g=1===o.Children.count(i),w=function(t,e){if(!t)return null;var r=t.replace(/(\w)/,function(t){return t.toUpperCase()}),n=zj.reduce(function(t,n){return Rj(Rj({},t),{},Lj({},n+r,e))},{});return n[t]=e,n}("userSelect","none");return o.createElement(Hr,{className:b,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:w},this.renderBackground(),g&&this.renderPanorama(),this.renderSlide(p,h),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(h,"endX"),(y||d||v||m||s)&&this.renderText())}}])&&Wj(r.prototype,i),a&&Wj(r,a),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,i,a}();Kj(Jj,"displayName","Brush"),Kj(Jj,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var Qj=Ju;var tS=fi,eS=cu,rS=function(t,e){var r;return Qj(t,function(t,n,o){return!(r=e(t,n,o))}),!!r},nS=i,oS=Cl;const iS=r(function(t,e,r){var n=nS(t)?tS:rS;return r&&oS(t,e,r)&&(e=void 0),n(t,eS(e))});var aS=function(t,e){var r=t.alwaysShow,n=t.ifOverflow;return r&&(n="extendDomain"),n===e},cS=gl;var uS=function(t,e,r){"__proto__"==e&&cS?cS(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r},lS=Yu,sS=cu;const fS=r(function(t,e){var r={};return e=sS(e),lS(t,function(t,n,o){uS(r,n,e(t,n,o))}),r});var pS=Ju;var hS=function(t,e){for(var r=-1,n=null==t?0:t.length;++r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function AS(t,e){var r=t.x,n=t.y,o=PS(t,gS),i="".concat(r),a=parseInt(i,10),c="".concat(n),u=parseInt(c,10),l="".concat(e.height||o.height),s=parseInt(l,10),f="".concat(e.width||o.width),p=parseInt(f,10);return jS(jS(jS(jS(jS({},e),o),a?{x:a}:{}),u?{y:u}:{}),{},{height:s,width:p,name:e.name,radius:e.radius})}function ES(t){return o.createElement(aj,xS({shapeType:"rectangle",propTransformer:AS,activeClassName:"recharts-active-bar"},t))}var kS,TS=["value","background"];function MS(t){return(MS="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _S(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function CS(){return CS=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0?0:o<0?o:n}return r[0]}({numericAxis:w}),j=Cr(b,Ks),S=f.map(function(t,e){var n,f,p,d,v,b;l?n=function(t,e){if(!e||2!==e.length||!ar(e[0])||!ar(e[1]))return t;var r=Math.min(e[0],e[1]),n=Math.max(e[0],e[1]),o=[t[0],t[1]];return(!ar(t[0])||t[0]n)&&(o[1]=n),o[0]>n&&(o[0]=n),o[1]1&&void 0!==arguments[1]?arguments[1]:0;return function(r,n){if("number"==typeof t)return t;var o="number"==typeof r;return o?t(r,n):(o||Rm(!1),e)}}(g,kS.defaultProps.minPointSize)(n[1],e);if("horizontal"===y){var S,P=[a.scale(n[0]),a.scale(n[1])],A=P[0],E=P[1];f=Ab({axis:i,ticks:c,bandSize:o,offset:h.offset,entry:t,index:e}),p=null!==(S=null!=E?E:A)&&void 0!==S?S:void 0,d=h.size;var k=A-E;if(v=Number.isNaN(k)?0:k,b={x:f,y:a.y,width:d,height:a.height},Math.abs(w)>0&&Math.abs(v)0&&Math.abs(d)0&&(S=Math.min((t||0)-(P[e-1]||0),S))}),Number.isFinite(S)){var A=S/j,E="vertical"===d.layout?r.height:r.width;if("gap"===d.padding&&(u=A*E/2),"no-gap"===d.padding){var k=sr(t.barCategoryGap,A*E),T=A*E/2;u=T-k-(T-k)/E*k}}}l="xAxis"===n?[r.left+(g.left||0)+(u||0),r.left+r.width-(g.right||0)-(u||0)]:"yAxis"===n?"horizontal"===c?[r.top+r.height-(g.bottom||0),r.top+(g.top||0)]:[r.top+(g.top||0)+(u||0),r.top+r.height-(g.bottom||0)-(u||0)]:d.range,x&&(l=[l[1],l[0]]);var M=gb(d,o,f),_=M.scale,C=M.realScaleType;_.domain(m).range(l),xb(_);var D=Sb(_,VS(VS({},d),{},{realScaleType:C}));"xAxis"===n?(y="top"===v&&!w||"bottom"===v&&w,p=r.left,h=s[O]-y*d.height):"yAxis"===n&&(y="left"===v&&!w||"right"===v&&w,p=s[O]-y*d.width,h=r.top);var I=VS(VS(VS({},d),D),{},{realScaleType:C,x:p,y:h,scale:_,width:"xAxis"===n?r.width:d.width,height:"yAxis"===n?r.height:d.height});return I.bandSize=_b(I,D),d.hide||"xAxis"!==n?d.hide||(s[O]+=(y?-1:1)*I.width):s[O]+=(y?-1:1)*I.height,VS(VS({},i),{},HS({},a,I))},{})},YS=function(t,e){var r=t.x,n=t.y,o=e.x,i=e.y;return{x:Math.min(r,o),y:Math.min(n,i),width:Math.abs(o-r),height:Math.abs(i-n)}},ZS=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.scale=e}return e=t,r=[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.bandAware,n=e.position;if(void 0!==t){if(n)switch(n){case"start":default:return this.scale(t);case"middle":var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+o;case"end":var i=this.bandwidth?this.bandwidth():0;return this.scale(t)+i}if(r){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+a}return this.scale(t)}}},{key:"isInRange",value:function(t){var e=this.range(),r=e[0],n=e[e.length-1];return r<=n?t>=r&&t<=n:t>=n&&t<=r}}],n=[{key:"create",value:function(e){return new t(e)}}],r&&WS(e.prototype,r),n&&WS(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r,n}();HS(ZS,"EPS",1e-4);var JS=function(t){var e=Object.keys(t).reduce(function(e,r){return VS(VS({},e),{},HS({},r,ZS.create(t[r])))},{});return VS(VS({},e),{},{apply:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.bandAware,o=r.position;return fS(t,function(t,r){return e[r].apply(t,{bandAware:n,position:o})})},isInRange:function(t){return bS(t,function(t,r){return e[r].isInRange(t)})}})};var QS=cu,tP=Ca,eP=Ba;var rP=function(t){return function(e,r,n){var o=Object(e);if(!tP(e)){var i=QS(r);e=eP(e),r=function(t){return i(o[t],t,o)}}var a=t(e,r,n);return a>-1?o[i?e[a]:a]:void 0}},nP=Mj;var oP=uu,iP=cu,aP=function(t){var e=nP(t),r=e%1;return e==e?r?e-r:e:0},cP=Math.max;const uP=r(rP(function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var o=null==r?0:aP(r);return o<0&&(o=cP(n+o,0)),oP(t,iP(e),o)}));var lP=ee(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),sP=n.createContext(void 0),fP=n.createContext(void 0),pP=n.createContext(void 0),hP=n.createContext({}),yP=n.createContext(void 0),dP=n.createContext(0),vP=n.createContext(0),mP=function(t){var e=t.state,r=e.xAxisMap,n=e.yAxisMap,i=e.offset,a=t.clipPathId,c=t.children,u=t.width,l=t.height,s=lP(i);return o.createElement(sP.Provider,{value:r},o.createElement(fP.Provider,{value:n},o.createElement(hP.Provider,{value:i},o.createElement(pP.Provider,{value:s},o.createElement(yP.Provider,{value:a},o.createElement(dP.Provider,{value:l},o.createElement(vP.Provider,{value:u},c)))))))},bP=function(t){var e=n.useContext(sP);null==e&&Rm(!1);var r=e[t];return null==r&&Rm(!1),r},gP=function(t){var e=n.useContext(fP);null==e&&Rm(!1);var r=e[t];return null==r&&Rm(!1),r},wP=function(){return n.useContext(vP)},xP=function(){return n.useContext(dP)};function OP(t){return(OP="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function jP(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r1&&void 0!==arguments[1]?arguments[1]:0),o=n*Math.PI/180,i=Math.atan(r/e),a=o>i&&ot*o)return!1;var i=r();return t*(e-t*i/2-n)>=0&&t*(e+t*i/2-o)<=0}function sA(t){return(sA="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function fA(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function pA(t){for(var e=1;e=2?or(o[1].coordinate-o[0].coordinate):1,m=function(t,e,r){var n="width"===r,o=t.x,i=t.y,a=t.width,c=t.height;return 1===e?{start:n?o:i,end:n?o+a:i+c}:{start:n?o+a:i+c,end:n?o:i}}(i,v,h);return"equidistantPreserveStart"===u?function(t,e,r,n,o){for(var i,a=(n||[]).slice(),c=e.start,u=e.end,l=0,s=1,f=c,p=function(){var e=null==n?void 0:n[l];if(void 0===e)return{v:cA(n,s)};var i,a=l,p=function(){return void 0===i&&(i=r(e,a)),i},h=e.coordinate,y=0===l||lA(t,h,p,f,u);y||(l=0,f=c,s+=1),y&&(f=h+t*(p()/2+o),l+=s)};s<=a.length;)if(i=p())return i.v;return[]}(v,m,d,o,a):(p="preserveStart"===u||"preserveStartEnd"===u?function(t,e,r,n,o,i){var a=(n||[]).slice(),c=a.length,u=e.start,l=e.end;if(i){var s=n[c-1],f=r(s,c-1),p=t*(s.coordinate+t*f/2-l);a[c-1]=s=pA(pA({},s),{},{tickCoord:p>0?s.coordinate-p*t:s.coordinate}),lA(t,s.tickCoord,function(){return f},u,l)&&(l=s.tickCoord-t*(f/2+o),a[c-1]=pA(pA({},s),{},{isShow:!0}))}for(var h=i?c-1:c,y=function(e){var n,i=a[e],c=function(){return void 0===n&&(n=r(i,e)),n};if(0===e){var s=t*(i.coordinate-t*c()/2-u);a[e]=i=pA(pA({},i),{},{tickCoord:s<0?i.coordinate-s*t:i.coordinate})}else a[e]=i=pA(pA({},i),{},{tickCoord:i.coordinate});lA(t,i.tickCoord,c,u,l)&&(u=i.tickCoord+t*(c()/2+o),a[e]=pA(pA({},i),{},{isShow:!0}))},d=0;d0?l.coordinate-f*t:l.coordinate})}else i[e]=l=pA(pA({},l),{},{tickCoord:l.coordinate});lA(t,l.tickCoord,s,c,u)&&(u=l.tickCoord-t*(s()/2+o),i[e]=pA(pA({},l),{},{isShow:!0}))},s=a-1;s>=0;s--)l(s);return i}(v,m,d,o,a),p.filter(function(t){return t.isShow}))}oA(aA,"displayName","ReferenceArea"),oA(aA,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1}),oA(aA,"renderRect",function(t,e){return o.isValidElement(t)?o.cloneElement(t,e):B(t)?t(e):o.createElement(Ax,KP({},e,{className:"recharts-reference-area-rect"}))});var dA=["viewBox"],vA=["viewBox"],mA=["ticks"];function bA(t){return(bA="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function gA(){return gA=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function jA(t,e){for(var r=0;r0?c(this.props):c(f)),i<=0||a<=0||!p||!p.length?null:o.createElement(Hr,{className:t("recharts-cartesian-axis",u),ref:function(t){e.layerReference=t}},n&&this.renderAxisLine(),this.renderTicks(p,this.state.fontSize,this.state.letterSpacing),og.renderCallByParent(this.props))}}])&&jA(r.prototype,i),a&&jA(r,a),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,i,a}();kA(MA,"displayName","CartesianAxis"),kA(MA,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var _A=["x1","y1","x2","y2","key"],CA=["offset"];function DA(t){return(DA="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function IA(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function NA(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var zA=function(t){var e=t.fill;if(!e||"none"===e)return null;var r=t.fillOpacity,n=t.x,i=t.y,a=t.width,c=t.height,u=t.ry;return o.createElement("rect",{x:n,y:i,ry:u,width:a,height:c,stroke:"none",fill:e,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function FA(t,e){var r;if(o.isValidElement(t))r=o.cloneElement(t,e);else if(B(t))r=t(e);else{var n=e.x1,i=e.y1,a=e.x2,c=e.y2,u=e.key,l=LA(e,_A),s=Br(l,!1);s.offset;var f=LA(s,CA);r=o.createElement("line",RA({},f,{x1:n,y1:i,x2:a,y2:c,fill:"none",key:u}))}return r}function UA(t){var e=t.x,r=t.width,n=t.horizontal,i=void 0===n||n,a=t.horizontalPoints;if(!i||!a||!a.length)return null;var c=a.map(function(n,o){var a=NA(NA({},t),{},{x1:e,y1:n,x2:e+r,y2:n,key:"line-".concat(o),index:o});return FA(i,a)});return o.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function $A(t){var e=t.y,r=t.height,n=t.vertical,i=void 0===n||n,a=t.verticalPoints;if(!i||!a||!a.length)return null;var c=a.map(function(n,o){var a=NA(NA({},t),{},{x1:n,y1:e,x2:n,y2:e+r,key:"line-".concat(o),index:o});return FA(i,a)});return o.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function qA(t){var e=t.horizontalFill,r=t.fillOpacity,n=t.x,i=t.y,a=t.width,c=t.height,u=t.horizontalPoints,l=t.horizontal;if(!(void 0===l||l)||!e||!e.length)return null;var s=u.map(function(t){return Math.round(t+i-i)}).sort(function(t,e){return t-e});i!==s[0]&&s.unshift(0);var f=s.map(function(t,u){var l=!s[u+1]?i+c-t:s[u+1]-t;if(l<=0)return null;var f=u%e.length;return o.createElement("rect",{key:"react-".concat(u),y:t,x:n,height:l,width:a,stroke:"none",fill:e[f],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return o.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function WA(t){var e=t.vertical,r=void 0===e||e,n=t.verticalFill,i=t.fillOpacity,a=t.x,c=t.y,u=t.width,l=t.height,s=t.verticalPoints;if(!r||!n||!n.length)return null;var f=s.map(function(t){return Math.round(t+a-a)}).sort(function(t,e){return t-e});a!==f[0]&&f.unshift(0);var p=f.map(function(t,e){var r=!f[e+1]?a+u-t:f[e+1]-t;if(r<=0)return null;var s=e%n.length;return o.createElement("rect",{key:"react-".concat(e),x:t,y:c,width:r,height:l,stroke:"none",fill:n[s],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return o.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},p)}var XA=function(t,e){var r=t.xAxis,n=t.width,o=t.height,i=t.offset;return db(yA(NA(NA(NA({},MA.defaultProps),r),{},{ticks:vb(r,!0),viewBox:{x:0,y:0,width:n,height:o}})),i.left,i.left+i.width,e)},VA=function(t,e){var r=t.yAxis,n=t.width,o=t.height,i=t.offset;return db(yA(NA(NA(NA({},MA.defaultProps),r),{},{ticks:vb(r,!0),viewBox:{x:0,y:0,width:n,height:o}})),i.top,i.top+i.height,e)},HA={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function GA(t){var e,r,i,a,c,u,l,s,f=wP(),p=xP(),h=n.useContext(hP),y=NA(NA({},t),{},{stroke:null!==(e=t.stroke)&&void 0!==e?e:HA.stroke,fill:null!==(r=t.fill)&&void 0!==r?r:HA.fill,horizontal:null!==(i=t.horizontal)&&void 0!==i?i:HA.horizontal,horizontalFill:null!==(a=t.horizontalFill)&&void 0!==a?a:HA.horizontalFill,vertical:null!==(c=t.vertical)&&void 0!==c?c:HA.vertical,verticalFill:null!==(u=t.verticalFill)&&void 0!==u?u:HA.verticalFill,x:ar(t.x)?t.x:h.left,y:ar(t.y)?t.y:h.top,width:ar(t.width)?t.width:h.width,height:ar(t.height)?t.height:h.height}),d=y.x,v=y.y,m=y.width,b=y.height,g=y.syncWithTicks,w=y.horizontalValues,x=y.verticalValues,O=(l=n.useContext(sP),fr(l)),j=(s=n.useContext(fP),uP(s,function(t){return bS(t.domain,Number.isFinite)})||fr(s));if(!ar(m)||m<=0||!ar(b)||b<=0||!ar(d)||d!==+d||!ar(v)||v!==+v)return null;var S=y.verticalCoordinatesGenerator||XA,P=y.horizontalCoordinatesGenerator||VA,A=y.horizontalPoints,E=y.verticalPoints;if((!A||!A.length)&&B(P)){var k=w&&w.length,T=P({yAxis:j?NA(NA({},j),{},{ticks:k?w:j.ticks}):void 0,width:f,height:p,offset:h},!!k||g);Gr(Array.isArray(T),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(DA(T),"]")),Array.isArray(T)&&(A=T)}if((!E||!E.length)&&B(S)){var M=x&&x.length,_=S({xAxis:O?NA(NA({},O),{},{ticks:M?x:O.ticks}):void 0,width:f,height:p,offset:h},!!M||g);Gr(Array.isArray(_),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(DA(_),"]")),Array.isArray(_)&&(E=_)}return o.createElement("g",{className:"recharts-cartesian-grid"},o.createElement(zA,{fill:y.fill,fillOpacity:y.fillOpacity,x:y.x,y:y.y,width:y.width,height:y.height,ry:y.ry}),o.createElement(UA,RA({},y,{offset:h,horizontalPoints:A,xAxis:O,yAxis:j})),o.createElement($A,RA({},y,{offset:h,verticalPoints:E,xAxis:O,yAxis:j})),o.createElement(qA,RA({},y,{horizontalPoints:A})),o.createElement(WA,RA({},y,{verticalPoints:E})))}GA.displayName="CartesianGrid";var KA=["type","layout","connectNulls","ref"],YA=["key"];function ZA(t){return(ZA="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function JA(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function QA(){return QA=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);rc){l=[].concat(rE(o.slice(0,s)),[c-f]);break}var p=l.length%2==0?[0,u]:[u];return[].concat(rE(e.repeat(o,a)),rE(l),p).map(function(t){return"".concat(t,"px")}).join(", ")}),lE(t,"id",lr("recharts-line-")),lE(t,"pathRef",function(e){t.mainCurve=e}),lE(t,"handleAnimationEnd",function(){t.setState({isAnimationFinished:!0}),t.props.onAnimationEnd&&t.props.onAnimationEnd()}),lE(t,"handleAnimationStart",function(){t.setState({isAnimationFinished:!1}),t.props.onAnimationStart&&t.props.onAnimationStart()}),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&uE(t,e)}(e,n.PureComponent),r=e,a=[{key:"getDerivedStateFromProps",value:function(t,e){return t.animationId!==e.prevAnimationId?{prevAnimationId:t.animationId,curPoints:t.points,prevPoints:e.curPoints}:t.points!==e.curPoints?{curPoints:t.points}:null}},{key:"repeat",value:function(t,e){for(var r=t.length%2!=0?[].concat(rE(t),[0]):t,n=[],o=0;o0||!Bv(a,n))?this.renderCurveWithAnimation(t,e):this.renderCurveStatically(n,t,e)}},{key:"render",value:function(){var e,r=this.props,n=r.hide,i=r.dot,a=r.points,c=r.className,u=r.xAxis,l=r.yAxis,s=r.top,f=r.left,p=r.width,h=r.height,y=r.isAnimationActive,d=r.id;if(n||!a||!a.length)return null;var v=this.state.isAnimationFinished,m=1===a.length,b=t("recharts-line",c),g=u&&u.allowDataOverflow,w=l&&l.allowDataOverflow,x=g||w,O=ke(d)?this.id:d,j=null!==(e=Br(i,!1))&&void 0!==e?e:{r:3,strokeWidth:2},S=j.r,P=void 0===S?3:S,A=j.strokeWidth,E=void 0===A?2:A,k=(function(t){return t&&"object"===Ar(t)&&"clipDot"in t}(i)?i:{}).clipDot,T=void 0===k||k,M=2*P+E;return o.createElement(Hr,{className:b},g||w?o.createElement("defs",null,o.createElement("clipPath",{id:"clipPath-".concat(O)},o.createElement("rect",{x:g?f:f-p/2,y:w?s:s-h/2,width:g?p:2*p,height:w?h:2*h})),!T&&o.createElement("clipPath",{id:"clipPath-dots-".concat(O)},o.createElement("rect",{x:f-M/2,y:s-M/2,width:p+M,height:h+M}))):null,!m&&this.renderCurve(x,O),this.renderErrorBar(x,O),(m||i)&&this.renderDots(x,T,O),(!y||v)&&bg.renderCallByParent(this.props,a))}}])&&oE(r.prototype,i),a&&oE(r,a),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,i,a}();function pE(t){return(pE="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function hE(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function ok(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r0?i:t&&t.length&&ar(n)&&ar(o)?t.slice(n,o+1):[]};function xk(t){return"number"===t?[0,"auto"]:void 0}var Ok=function(t,e,r,n){var o=t.graphicalItems,i=t.tooltipAxis,a=wk(e,t);return r<0||!o||!o.length||r>=a.length?null:o.reduce(function(o,c){var u,l,s=null!==(u=c.props.data)&&void 0!==u?u:e;(s&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(s=s.slice(t.dataStartIndex,t.dataEndIndex+1)),i.dataKey&&!i.allowDuplicatedCategory)?l=hr(void 0===s?a:s,i.dataKey,n):l=s&&s[r]||a[r];return l?[].concat(lk(o),[Db(c,l)]):o},[])},jk=function(t,e,r,n){var o=n||{x:t.chartX,y:t.chartY},i=function(t,e){return"horizontal"===e?t.x:"vertical"===e?t.y:"centric"===e?t.angle:t.radius}(o,r),a=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,l=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,i=-1,a=null!==(e=null==r?void 0:r.length)&&void 0!==e?e:0;if(a<=1)return 0;if(o&&"angleAxis"===o.axisType&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var c=o.range,u=0;u0?n[u-1].coordinate:n[a-1].coordinate,s=n[u].coordinate,f=u>=a-1?n[0].coordinate:n[u+1].coordinate,p=void 0;if(or(s-l)!==or(f-s)){var h=[];if(or(f-s)===or(c[1]-c[0])){p=f;var y=s+c[1]-c[0];h[0]=Math.min(y,(y+l)/2),h[1]=Math.max(y,(y+l)/2)}else{p=l;var d=f+c[1]-c[0];h[0]=Math.min(s,(d+s)/2),h[1]=Math.max(s,(d+s)/2)}var v=[Math.min(s,(p+s)/2),Math.max(s,(p+s)/2)];if(t>v[0]&&t<=v[1]||t>=h[0]&&t<=h[1]){i=n[u].index;break}}else{var m=Math.min(l,f),b=Math.max(l,f);if(t>(m+s)/2&&t<=(b+s)/2){i=n[u].index;break}}}else for(var g=0;g0&&g(r[g].coordinate+r[g-1].coordinate)/2&&t<=(r[g].coordinate+r[g+1].coordinate)/2||g===a-1&&t>(r[g].coordinate+r[g-1].coordinate)/2){i=r[g].index;break}return i}(i,a,u,c);if(l>=0&&u){var s=u[l]&&u[l].value,f=Ok(t,e,l,s),p=function(t,e,r,n){var o=e.find(function(t){return t&&t.index===r});if(o){if("horizontal"===t)return{x:o.coordinate,y:n.y};if("vertical"===t)return{x:n.x,y:o.coordinate};if("centric"===t){var i=o.coordinate,a=n.radius;return hk(hk(hk({},n),$b(n.cx,n.cy,a,i)),{},{angle:i,radius:a})}var c=o.coordinate,u=n.angle;return hk(hk(hk({},n),$b(n.cx,n.cy,c,u)),{},{angle:u,radius:c})}return bk}(r,a,l,o);return{activeTooltipIndex:l,activeLabel:s,activePayload:f,activeCoordinate:p}}return null},Sk=function(t,e){var r=e.axes,n=e.graphicalItems,o=e.axisType,i=e.axisIdKey,a=e.stackGroups,c=e.dataStartIndex,u=e.dataEndIndex,l=t.layout,s=t.children,f=t.stackOffset,p=yb(l,o);return r.reduce(function(e,r){var h,y=void 0!==r.type.defaultProps?hk(hk({},r.type.defaultProps),r.props):r.props,d=y.type,v=y.dataKey,m=y.allowDataOverflow,b=y.allowDuplicatedCategory,g=y.scale,w=y.ticks,x=y.includeHidden,O=y[i];if(e[O])return e;var j,S,P,A=wk(t.data,{graphicalItems:n.filter(function(t){var e;return(i in t.props?t.props[i]:null===(e=t.type.defaultProps)||void 0===e?void 0:e[i])===O}),dataStartIndex:c,dataEndIndex:u}),E=A.length;(function(t,e,r){if("number"===r&&!0===e&&Array.isArray(t)){var n=null==t?void 0:t[0],o=null==t?void 0:t[1];if(n&&o&&ar(n)&&ar(o))return!0}return!1})(y.domain,m,d)&&(j=Mb(y.domain,null,m),!p||"number"!==d&&"auto"===g||(P=sb(A,v,"category")));var k=xk(d);if(!j||0===j.length){var T,M=null!==(T=y.domain)&&void 0!==T?T:k;if(v){if(j=sb(A,v,d),"category"===d&&p){var _=function(t){if(!Array.isArray(t))return!1;for(var e=t.length,r={},n=0;n=0?t:[].concat(lk(t),[e])},[]))}else if("category"===d)j=b?j.filter(function(t){return""!==t&&!ke(t)}):Cb(M,j,r).reduce(function(t,e){return t.indexOf(e)>=0||""===e||ke(e)?t:[].concat(lk(t),[e])},[]);else if("number"===d){var C=function(t,e,r,n,o){var i=e.map(function(e){return pb(t,e,r,o,n)}).filter(function(t){return!ke(t)});return i&&i.length?i.reduce(function(t,e){return[Math.min(t[0],e[0]),Math.max(t[1],e[1])]},[1/0,-1/0]):null}(A,n.filter(function(t){var e,r,n=i in t.props?t.props[i]:null===(e=t.type.defaultProps)||void 0===e?void 0:e[i],o="hide"in t.props?t.props.hide:null===(r=t.type.defaultProps)||void 0===r?void 0:r.hide;return n===O&&(x||!o)}),v,o,l);C&&(j=C)}!p||"number"!==d&&"auto"===g||(P=sb(A,v,"category"))}else j=p?Ij(0,E):a&&a[O]&&a[O].hasStack&&"number"===d?"expand"===f?[0,1]:Eb(a[O].stackGroups,c,u):hb(A,n.filter(function(t){var e=i in t.props?t.props[i]:t.type.defaultProps[i],r="hide"in t.props?t.props.hide:t.type.defaultProps.hide;return e===O&&(x||!r)}),d,l,!0);if("number"===d)j=BE(s,j,O,o,w),M&&(j=Mb(M,j,m));else if("category"===d&&M){var D=M;j.every(function(t){return D.indexOf(t)>=0})&&(j=D)}}return hk(hk({},e),{},yk({},O,hk(hk({},y),{},{axisType:o,domain:j,categoricalDomain:P,duplicateDomain:S,originalDomain:null!==(h=y.domain)&&void 0!==h?h:k,isCategorical:p,layout:l})))},{})},Pk=function(t,e){var r=e.axisType,n=void 0===r?"xAxis":r,o=e.AxisComp,i=e.graphicalItems,a=e.stackGroups,c=e.dataStartIndex,u=e.dataEndIndex,l=t.children,s="".concat(n,"Id"),f=Cr(l,o),p={};return f&&f.length?p=Sk(t,{axes:f,graphicalItems:i,axisType:n,axisIdKey:s,stackGroups:a,dataStartIndex:c,dataEndIndex:u}):i&&i.length&&(p=function(t,e){var r=e.graphicalItems,n=e.Axis,o=e.axisType,i=e.axisIdKey,a=e.stackGroups,c=e.dataStartIndex,u=e.dataEndIndex,l=t.layout,s=t.children,f=wk(t.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:u}),p=f.length,h=yb(l,o),y=-1;return r.reduce(function(t,e){var d,v=(void 0!==e.type.defaultProps?hk(hk({},e.type.defaultProps),e.props):e.props)[i],m=xk("number");return t[v]?t:(y++,h?d=Ij(0,p):a&&a[v]&&a[v].hasStack?(d=Eb(a[v].stackGroups,c,u),d=BE(s,d,v,o)):(d=Mb(m,hb(f,r.filter(function(t){var e,r,n=i in t.props?t.props[i]:null===(e=t.type.defaultProps)||void 0===e?void 0:e[i],o="hide"in t.props?t.props.hide:null===(r=t.type.defaultProps)||void 0===r?void 0:r.hide;return n===v&&!o}),"number",l),n.defaultProps.allowDataOverflow),d=BE(s,d,v,o)),hk(hk({},t),{},yk({},v,hk(hk({axisType:o},n.defaultProps),{},{hide:!0,orientation:Ee(vk,"".concat(o,".").concat(y%2),null),domain:d,originalDomain:m,isCategorical:h,layout:l}))))},{})}(t,{Axis:o,graphicalItems:i,axisType:n,axisIdKey:s,stackGroups:a,dataStartIndex:c,dataEndIndex:u})),p},Ak=function(t){var e=t.children,r=t.defaultShowTooltip,n=Dr(e,Jj),o=0,i=0;return t.data&&0!==t.data.length&&(i=t.data.length-1),n&&n.props&&(n.props.startIndex>=0&&(o=n.props.startIndex),n.props.endIndex>=0&&(i=n.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:i,activeTooltipIndex:-1,isTooltipActive:Boolean(r)}},Ek=function(t){return"horizontal"===t?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:"vertical"===t?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:"centric"===t?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},kk=function(t,e){var r=t.props,n=(t.graphicalItems,t.xAxisMap),o=void 0===n?{}:n,i=t.yAxisMap,a=void 0===i?{}:i,c=r.width,u=r.height,l=r.children,s=r.margin||{},f=Dr(l,Jj),p=Dr(l,Uu),h=Object.keys(a).reduce(function(t,e){var r=a[e],n=r.orientation;return r.mirror||r.hide?t:hk(hk({},t),{},yk({},n,t[n]+r.width))},{left:s.left||0,right:s.right||0}),y=Object.keys(o).reduce(function(t,e){var r=o[e],n=r.orientation;return r.mirror||r.hide?t:hk(hk({},t),{},yk({},n,Ee(t,"".concat(n))+r.height))},{top:s.top||0,bottom:s.bottom||0}),d=hk(hk({},y),h),v=d.bottom;f&&(d.bottom+=f.props.height||Jj.defaultProps.height),p&&e&&(d=function(t,e,r,n){var o=r.children,i=r.width,a=r.margin,c=i-(a.left||0)-(a.right||0),u=rb({children:o,legendWidth:c});if(u){var l=n||{},s=l.width,f=l.height,p=u.align,h=u.verticalAlign,y=u.layout;if(("vertical"===y||"horizontal"===y&&"middle"===h)&&"center"!==p&&ar(t[p]))return cb(cb({},t),{},ub({},p,t[p]+(s||0)));if(("horizontal"===y||"vertical"===y&&"center"===p)&&"middle"!==h&&ar(t[h]))return cb(cb({},t),{},ub({},h,t[h]+(f||0)))}return t}(d,0,r,e));var m=c-d.left-d.right,b=u-d.top-d.bottom;return hk(hk({brushBottom:v},d),{},{width:Math.max(m,0),height:Math.max(b,0)})},Tk=function(t,e){return"xAxis"===e?t[e].width:"yAxis"===e?t[e].height:void 0},Mk=function(e){var r=e.chartName,i=e.GraphicalChild,a=e.defaultTooltipEventType,c=void 0===a?"axis":a,u=e.validateTooltipEventTypes,l=void 0===u?["axis"]:u,s=e.axisComponents,f=e.legendContent,p=e.formatAxisMap,h=e.defaultProps,y=function(t,e){var r=e.graphicalItems,n=e.stackGroups,o=e.offset,i=e.updateId,a=e.dataStartIndex,c=e.dataEndIndex,u=t.barSize,l=t.layout,f=t.barGap,p=t.barCategoryGap,h=t.maxBarSize,y=Ek(l),d=y.numericAxisName,v=y.cateAxisName,m=function(t){return!(!t||!t.length)&&t.some(function(t){var e=kr(t&&t.type);return e&&e.indexOf("Bar")>=0})}(r),b=[];return r.forEach(function(r,y){var g=wk(t.data,{graphicalItems:[r],dataStartIndex:a,dataEndIndex:c}),w=void 0!==r.type.defaultProps?hk(hk({},r.type.defaultProps),r.props):r.props,x=w.dataKey,O=w.maxBarSize,j=w["".concat(d,"Id")],S=w["".concat(v,"Id")],P=s.reduce(function(t,r){var n=e["".concat(r.axisType,"Map")],o=w["".concat(r.axisType,"Id")];n&&n[o]||"zAxis"===r.axisType||Rm(!1);var i=n[o];return hk(hk({},t),{},yk(yk({},r.axisType,i),"".concat(r.axisType,"Ticks"),vb(i)))},{}),A=P[v],E=P["".concat(v,"Ticks")],k=n&&n[j]&&n[j].hasStack&&function(t,e){var r,n=(null!==(r=t.type)&&void 0!==r&&r.defaultProps?cb(cb({},t.type.defaultProps),t.props):t.props).stackId;if(cr(n)){var o=e[n];if(o){var i=o.items.indexOf(t);return i>=0?o.stackedData[i]:null}}return null}(r,n[j].stackGroups),T=kr(r.type).indexOf("Bar")>=0,M=_b(A,E),_=[],C=m&&function(t){var e=t.barSize,r=t.totalSize,n=t.stackGroups,o=void 0===n?{}:n;if(!o)return{};for(var i={},a=Object.keys(o),c=0,u=a.length;c=0});if(v&&v.length){var m=v[0].type.defaultProps,b=void 0!==m?cb(cb({},m),v[0].props):v[0].props,g=b.barSize,w=b[d];i[w]||(i[w]=[]);var x=ke(g)?e:g;i[w].push({item:v[0],stackList:v.slice(1),barSize:ke(x)?void 0:sr(x,r,0)})}}return i}({barSize:u,stackGroups:n,totalSize:Tk(P,v)});if(T){var D,I,N=ke(O)?h:O,B=null!==(D=null!==(I=_b(A,E,!0))&&void 0!==I?I:N)&&void 0!==D?D:0;_=function(t){var e=t.barGap,r=t.barCategoryGap,n=t.bandSize,o=t.sizeList,i=void 0===o?[]:o,a=t.maxBarSize,c=i.length;if(c<1)return null;var u,l=sr(e,n,0,!0),s=[];if(i[0].barSize===+i[0].barSize){var f=!1,p=n/c,h=i.reduce(function(t,e){return t+e.barSize||0},0);(h+=(c-1)*l)>=n&&(h-=(c-1)*l,l=0),h>=n&&p>0&&(f=!0,h=c*(p*=.9));var y={offset:((n-h)/2|0)-l,size:0};u=i.reduce(function(t,e){var r={item:e.item,position:{offset:y.offset+y.size+l,size:f?p:e.barSize}},n=[].concat(ob(t),[r]);return y=n[n.length-1].position,e.stackList&&e.stackList.length&&e.stackList.forEach(function(t){n.push({item:t,position:y})}),n},s)}else{var d=sr(r,n,0,!0);n-2*d-(c-1)*l<=0&&(l=0);var v=(n-2*d-(c-1)*l)/c;v>1&&(v>>=0);var m=a===+a?Math.min(v,a):v;u=i.reduce(function(t,e,r){var n=[].concat(ob(t),[{item:e.item,position:{offset:d+(v+l)*r+(v-m)/2,size:m}}]);return e.stackList&&e.stackList.length&&e.stackList.forEach(function(t){n.push({item:t,position:n[n.length-1].position})}),n},s)}return u}({barGap:f,barCategoryGap:p,bandSize:B!==M?B:M,sizeList:C[S],maxBarSize:N}),B!==M&&(_=_.map(function(t){return hk(hk({},t),{},{position:hk(hk({},t.position),{},{offset:t.position.offset-B/2})})}))}var R,L,z=r&&r.type&&r.type.getComposedData;z&&b.push({props:hk(hk({},z(hk(hk({},P),{},{displayedData:g,props:t,dataKey:x,item:r,bandSize:M,barPosition:_,offset:o,stackedData:k,layout:l,dataStartIndex:a,dataEndIndex:c}))),{},yk(yk(yk({key:r.key||"item-".concat(y)},d,P[d]),v,P[v]),"animationId",i)),childIndex:(R=r,L=t.children,_r(L).indexOf(R)),item:r})}),b},d=function(t,e){var n=t.props,o=t.dataStartIndex,a=t.dataEndIndex,c=t.updateId;if(!Ir({props:n}))return null;var u=n.children,l=n.layout,f=n.stackOffset,h=n.data,d=n.reverseStackOrder,v=Ek(l),m=v.numericAxisName,b=v.cateAxisName,g=Cr(u,i),w=function(t,e,r,n,o,i){if(!t)return null;var a=(i?e.reverse():e).reduce(function(t,e){var o,i=null!==(o=e.type)&&void 0!==o&&o.defaultProps?cb(cb({},e.type.defaultProps),e.props):e.props,a=i.stackId;if(i.hide)return t;var c=i[r],u=t[c]||{hasStack:!1,stackGroups:{}};if(cr(a)){var l=u.stackGroups[a]||{numericAxisId:r,cateAxisId:n,items:[]};l.items.push(e),u.hasStack=!0,u.stackGroups[a]=l}else u.stackGroups[lr("_stackId_")]={numericAxisId:r,cateAxisId:n,items:[e]};return cb(cb({},t),{},ub({},c,u))},{});return Object.keys(a).reduce(function(e,i){var c=a[i];return c.hasStack&&(c.stackGroups=Object.keys(c.stackGroups).reduce(function(e,i){var a=c.stackGroups[i];return cb(cb({},e),{},ub({},i,{numericAxisId:r,cateAxisId:n,items:a.items,stackedData:jb(t,a.items,o)}))},{})),cb(cb({},e),{},ub({},i,c))},{})}(h,g,"".concat(m,"Id"),"".concat(b,"Id"),f,d),x=s.reduce(function(t,e){var r="".concat(e.axisType,"Map");return hk(hk({},t),{},yk({},r,Pk(n,hk(hk({},e),{},{graphicalItems:g,stackGroups:e.axisType===m&&w,dataStartIndex:o,dataEndIndex:a}))))},{}),O=kk(hk(hk({},x),{},{props:n,graphicalItems:g}),null==e?void 0:e.legendBBox);Object.keys(x).forEach(function(t){x[t]=p(n,x[t],O,t.replace("Map",""),r)});var j,S,P=x["".concat(b,"Map")],A=(j=fr(P),{tooltipTicks:S=vb(j,!1,!0),orderedTooltipTicks:Bl(S,function(t){return t.coordinate}),tooltipAxis:j,tooltipAxisBandSize:_b(j,S)}),E=y(n,hk(hk({},x),{},{dataStartIndex:o,dataEndIndex:a,updateId:c,graphicalItems:g,stackGroups:w,offset:O}));return hk(hk({formattedGraphicalItems:E,graphicalItems:g,offset:O,stackGroups:w},A),x)},v=function(){function e(i){var a,c,u;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),yk(u=ik(this,e,[i]),"eventEmitterSymbol",Symbol("rechartsEventEmitter")),yk(u,"accessibilityManager",new WE),yk(u,"handleLegendBBoxUpdate",function(t){if(t){var e=u.state,r=e.dataStartIndex,n=e.dataEndIndex,o=e.updateId;u.setState(hk({legendBBox:t},d({props:u.props,dataStartIndex:r,dataEndIndex:n,updateId:o},hk(hk({},u.state),{},{legendBBox:t}))))}}),yk(u,"handleReceiveSyncEvent",function(t,e,r){if(u.props.syncId===t){if(r===u.eventEmitterSymbol&&"function"!=typeof u.props.syncMethod)return;u.applySyncEvent(e)}}),yk(u,"handleBrushChange",function(t){var e=t.startIndex,r=t.endIndex;if(e!==u.state.dataStartIndex||r!==u.state.dataEndIndex){var n=u.state.updateId;u.setState(function(){return hk({dataStartIndex:e,dataEndIndex:r},d({props:u.props,dataStartIndex:e,dataEndIndex:r,updateId:n},u.state))}),u.triggerSyncEvent({dataStartIndex:e,dataEndIndex:r})}}),yk(u,"handleMouseEnter",function(t){var e=u.getMouseInfo(t);if(e){var r=hk(hk({},e),{},{isTooltipActive:!0});u.setState(r),u.triggerSyncEvent(r);var n=u.props.onMouseEnter;B(n)&&n(r,t)}}),yk(u,"triggeredAfterMouseMove",function(t){var e=u.getMouseInfo(t),r=e?hk(hk({},e),{},{isTooltipActive:!0}):{isTooltipActive:!1};u.setState(r),u.triggerSyncEvent(r);var n=u.props.onMouseMove;B(n)&&n(r,t)}),yk(u,"handleItemMouseEnter",function(t){u.setState(function(){return{isTooltipActive:!0,activeItem:t,activePayload:t.tooltipPayload,activeCoordinate:t.tooltipPosition||{x:t.cx,y:t.cy}}})}),yk(u,"handleItemMouseLeave",function(){u.setState(function(){return{isTooltipActive:!1}})}),yk(u,"handleMouseMove",function(t){t.persist(),u.throttleTriggeredAfterMouseMove(t)}),yk(u,"handleMouseLeave",function(t){u.throttleTriggeredAfterMouseMove.cancel();var e={isTooltipActive:!1};u.setState(e),u.triggerSyncEvent(e);var r=u.props.onMouseLeave;B(r)&&r(e,t)}),yk(u,"handleOuterEvent",function(t){var e,r=function(t){var e=t&&t.type;return e&&Er[e]?Er[e]:null}(t),n=Ee(u.props,"".concat(r));r&&B(n)&&n(null!==(e=/.*touch.*/i.test(r)?u.getMouseInfo(t.changedTouches[0]):u.getMouseInfo(t))&&void 0!==e?e:{},t)}),yk(u,"handleClick",function(t){var e=u.getMouseInfo(t);if(e){var r=hk(hk({},e),{},{isTooltipActive:!0});u.setState(r),u.triggerSyncEvent(r);var n=u.props.onClick;B(n)&&n(r,t)}}),yk(u,"handleMouseDown",function(t){var e=u.props.onMouseDown;B(e)&&e(u.getMouseInfo(t),t)}),yk(u,"handleMouseUp",function(t){var e=u.props.onMouseUp;B(e)&&e(u.getMouseInfo(t),t)}),yk(u,"handleTouchMove",function(t){null!=t.changedTouches&&t.changedTouches.length>0&&u.throttleTriggeredAfterMouseMove(t.changedTouches[0])}),yk(u,"handleTouchStart",function(t){null!=t.changedTouches&&t.changedTouches.length>0&&u.handleMouseDown(t.changedTouches[0])}),yk(u,"handleTouchEnd",function(t){null!=t.changedTouches&&t.changedTouches.length>0&&u.handleMouseUp(t.changedTouches[0])}),yk(u,"handleDoubleClick",function(t){var e=u.props.onDoubleClick;B(e)&&e(u.getMouseInfo(t),t)}),yk(u,"handleContextMenu",function(t){var e=u.props.onContextMenu;B(e)&&e(u.getMouseInfo(t),t)}),yk(u,"triggerSyncEvent",function(t){void 0!==u.props.syncId&&LE.emit(zE,u.props.syncId,t,u.eventEmitterSymbol)}),yk(u,"applySyncEvent",function(t){var e=u.props,r=e.layout,n=e.syncMethod,o=u.state.updateId,i=t.dataStartIndex,a=t.dataEndIndex;if(void 0!==t.dataStartIndex||void 0!==t.dataEndIndex)u.setState(hk({dataStartIndex:i,dataEndIndex:a},d({props:u.props,dataStartIndex:i,dataEndIndex:a,updateId:o},u.state)));else if(void 0!==t.activeTooltipIndex){var c=t.chartX,l=t.chartY,s=t.activeTooltipIndex,f=u.state,p=f.offset,h=f.tooltipTicks;if(!p)return;if("function"==typeof n)s=n(h,t);else if("value"===n){s=-1;for(var y=0;y=0)){var P,A=(null!==(P=u.getItemByXY(u.state.activeCoordinate))&&void 0!==P?P:{graphicalItem:S}).graphicalItem,E=A.item,k=void 0===E?t:E,T=A.childIndex,M=hk(hk(hk({},o.props),j),{},{activeIndex:T});return[n.cloneElement(k,M),null,null]}var _,C;if(l.dataKey&&!l.allowDuplicatedCategory){var D="function"==typeof l.dataKey?function(t){return"function"==typeof l.dataKey?l.dataKey(t.payload):null}:"payload.".concat(l.dataKey.toString());_=hr(y,D,f),C=d&&v&&hr(v,D,f)}else _=null==y?void 0:y[s],C=d&&v&&v[s];if(x||w){var I=void 0!==t.props.activeIndex?t.props.activeIndex:s;return[n.cloneElement(t,hk(hk(hk({},o.props),j),{},{activeIndex:I})),null,null]}if(!ke(_))return[S].concat(lk(u.renderActivePoints({item:o,activePoint:_,basePoint:C,childIndex:s,isRange:d})))}return d?[S,null,null]:[S,null]}),yk(u,"renderCustomized",function(t,e,r){return n.cloneElement(t,hk(hk({key:"recharts-customized-".concat(r)},u.props),u.state))}),yk(u,"renderMap",{CartesianGrid:{handler:gk,once:!0},ReferenceArea:{handler:u.renderReferenceElement},ReferenceLine:{handler:gk},ReferenceDot:{handler:u.renderReferenceElement},XAxis:{handler:gk},YAxis:{handler:gk},Brush:{handler:u.renderBrush,once:!0},Bar:{handler:u.renderGraphicChild},Line:{handler:u.renderGraphicChild},Area:{handler:u.renderGraphicChild},Radar:{handler:u.renderGraphicChild},RadialBar:{handler:u.renderGraphicChild},Scatter:{handler:u.renderGraphicChild},Pie:{handler:u.renderGraphicChild},Funnel:{handler:u.renderGraphicChild},Tooltip:{handler:u.renderCursor,once:!0},PolarGrid:{handler:u.renderPolarGrid,once:!0},PolarAngleAxis:{handler:u.renderPolarAxis},PolarRadiusAxis:{handler:u.renderPolarAxis},Customized:{handler:u.renderCustomized}}),u.clipPathId="".concat(null!==(a=i.id)&&void 0!==a?a:lr("recharts"),"-clip"),u.throttleTriggeredAfterMouseMove=Us(u.triggeredAfterMouseMove,null!==(c=i.throttleDelay)&&void 0!==c?c:1e3/60),u.state={},u}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&uk(t,e)}(e,n.Component),i=e,a=[{key:"componentDidMount",value:function(){var t,e;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:null!==(t=this.props.margin.left)&&void 0!==t?t:0,top:null!==(e=this.props.margin.top)&&void 0!==e?e:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var t=this.props,e=t.children,r=t.data,n=t.height,o=t.layout,i=Dr(e,xs);if(i){var a=i.props.defaultIndex;if(!("number"!=typeof a||a<0||a>this.state.tooltipTicks.length-1)){var c=this.state.tooltipTicks[a]&&this.state.tooltipTicks[a].value,u=Ok(this.state,r,a,c),l=this.state.tooltipTicks[a].coordinate,s=(this.state.offset.top+n)/2,f="horizontal"===o?{x:l,y:s}:{y:l,x:s},p=this.state.formattedGraphicalItems.find(function(t){return"Scatter"===t.item.type.name});p&&(f=hk(hk({},f),p.props.points[a].tooltipPosition),u=p.props.points[a].tooltipPayload);var h={activeTooltipIndex:a,isTooltipActive:!0,activeLabel:c,activePayload:u,activeCoordinate:f};this.setState(h),this.renderCursor(i),this.accessibilityManager.setIndex(a)}}}},{key:"getSnapshotBeforeUpdate",value:function(t,e){return this.props.accessibilityLayer?(this.state.tooltipTicks!==e.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==t.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==t.margin&&this.accessibilityManager.setDetails({offset:{left:null!==(r=this.props.margin.left)&&void 0!==r?r:0,top:null!==(n=this.props.margin.top)&&void 0!==n?n:0}}),null):null;var r,n}},{key:"componentDidUpdate",value:function(t){Rr([Dr(t.children,xs)],[Dr(this.props.children,xs)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var t=Dr(this.props.children,xs);if(t&&"boolean"==typeof t.props.shared){var e=t.props.shared?"axis":"item";return l.indexOf(e)>=0?e:c}return c}},{key:"getMouseInfo",value:function(t){if(!this.container)return null;var e,r=this.container,n=r.getBoundingClientRect(),o={top:(e=n).top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft},i={chartX:Math.round(t.pageX-o.left),chartY:Math.round(t.pageY-o.top)},a=n.width/r.offsetWidth||1,c=this.inRange(i.chartX,i.chartY,a);if(!c)return null;var u=this.state,l=u.xAxisMap,s=u.yAxisMap,f=this.getTooltipEventType(),p=jk(this.state,this.props.data,this.props.layout,c);if("axis"!==f&&l&&s){var h=fr(l).scale,y=fr(s).scale,d=h&&h.invert?h.invert(i.chartX):null,v=y&&y.invert?y.invert(i.chartY):null;return hk(hk({},i),{},{xValue:d,yValue:v},p)}return p?hk(hk({},i),p):null}},{key:"inRange",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=this.props.layout,o=t/r,i=e/r;if("horizontal"===n||"vertical"===n){var a=this.state.offset;return o>=a.left&&o<=a.left+a.width&&i>=a.top&&i<=a.top+a.height?{x:o,y:i}:null}var c=this.state,u=c.angleAxisMap,l=c.radiusAxisMap;if(u&&l){var s=fr(u);return Vb({x:o,y:i},s)}return null}},{key:"parseEventsOfWrapper",value:function(){var t=this.props.children,e=this.getTooltipEventType(),r=Dr(t,xs),n={};return r&&"axis"===e&&(n="click"===r.props.trigger?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),hk(hk({},xr(this.props,this.handleOuterEvent)),n)}},{key:"addListener",value:function(){LE.on(zE,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){LE.removeListener(zE,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(t,e,r){for(var n=this.state.formattedGraphicalItems,o=0,i=n.length;o"checkbox"===e.type,n=e=>e instanceof Date,i=e=>null==e;const a=e=>"object"==typeof e;var o=e=>!i(e)&&!Array.isArray(e)&&a(e)&&!n(e),u="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function l(e){let t;const r=Array.isArray(e),s="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(u&&(e instanceof Blob||s)||!r&&!o(e))return e;if(t=r?[]:{},r||(e=>{const t=e.constructor&&e.constructor.prototype;return o(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=l(e[r]));else t=e}return t}var c=e=>Array.isArray(e)?e.filter(Boolean):[],d=e=>void 0===e,f=(e,t,r)=>{if(!t||!o(e))return r;const s=c(t.split(/[,[\].]+?/)).reduce((e,t)=>i(e)?e:e[t],e);return d(s)||s===e?d(e[t])?r:e[t]:s},h=e=>"boolean"==typeof e,p=e=>/^\w*$/.test(e),m=e=>c(e.replace(/["|']|\]/g,"").split(/\.|\[/)),y=(e,t,r)=>{let s=-1;const n=p(t)?[t]:m(t),i=n.length,a=i-1;for(;++s"string"==typeof e,C=(e,t,r,s,n)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[s]:n||!0}}:{},N=e=>Array.isArray(e)?e:[e],M=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},U=e=>i(e)||!a(e);function z(e,t){if(U(e)||U(t))return e===t;if(n(e)&&n(t))return e.getTime()===t.getTime();const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(const i of r){const r=e[i];if(!s.includes(i))return!1;if("ref"!==i){const e=t[i];if(n(r)&&n(e)||o(r)&&o(e)||Array.isArray(r)&&Array.isArray(e)?!z(r,e):r!==e)return!1}}return!0}var R=e=>o(e)&&!Object.keys(e).length,P=e=>"file"===e.type,L=e=>"function"==typeof e,q=e=>{if(!u)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},I=e=>"select-multiple"===e.type,Z=e=>"radio"===e.type,B=e=>q(e)&&e.isConnected;function Y(e,t){const r=Array.isArray(t)?t:p(t)?[t]:m(t),s=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let s=0;for(;s{for(const t in e)if(L(e[t]))return!0;return!1};function H(e,t={}){const r=Array.isArray(e);if(o(e)||r)for(const s in e)Array.isArray(e[s])||o(e[s])&&!W(e[s])?(t[s]=Array.isArray(e[s])?[]:{},H(e[s],t[s])):i(e[s])||(t[s]=!0);return t}function J(e,t,r){const s=Array.isArray(e);if(o(e)||s)for(const n in e)Array.isArray(e[n])||o(e[n])&&!W(e[n])?d(t)||U(r[n])?r[n]=Array.isArray(e[n])?H(e[n],[]):{...H(e[n])}:J(e[n],i(t)?{}:t[n],r[n]):r[n]=!z(e[n],t[n]);return r}var K=(e,t)=>J(e,t,H(t));const G={value:!1,isValid:!1},Q={value:!0,isValid:!0};var X=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!d(e[0].attributes.value)?d(e[0].value)||""===e[0].value?Q:{value:e[0].value,isValid:!0}:Q:G}return G},ee=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:s})=>d(e)?e:t?""===e?NaN:e?+e:e:r&&j(e)?new Date(e):s?s(e):e;const te={isValid:!1,value:null};var re=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,te):te;function se(e){const t=e.ref;return P(t)?t.files:Z(t)?re(e.refs).value:I(t)?[...t.selectedOptions].map(({value:e})=>e):s(t)?X(e.refs).value:ee(d(t.value)?e.ref.value:t.value,e)}var ne=e=>e instanceof RegExp,ie=e=>d(e)?e:ne(e)?e.source:o(e)?ne(e.value)?e.value.source:e.value:e,ae=e=>({isOnSubmit:!e||e===_,isOnBlur:e===b,isOnChange:e===x,isOnAll:e===w,isOnTouch:e===F});const oe="AsyncFunction";var ue=e=>!!e&&!!e.validate&&!!(L(e.validate)&&e.validate.constructor.name===oe||o(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===oe)),le=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const ce=(e,t,r,s)=>{for(const n of r||Object.keys(e)){const r=f(e,n);if(r){const{_f:e,...i}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],n)&&!s)return!0;if(e.ref&&t(e.ref,e.name)&&!s)return!0;if(ce(i,t))break}else if(o(i)&&ce(i,t))break}}};function de(e,t,r){const s=f(e,r);if(s||p(r))return{error:s,name:r};const n=r.split(".");for(;n.length;){const s=n.join("."),i=f(t,s),a=f(e,s);if(i&&!Array.isArray(i)&&r!==s)return{name:r};if(a&&a.type)return{name:s,error:a};if(a&&a.root&&a.root.type)return{name:`${s}.root`,error:a.root};n.pop()}return{name:r}}var fe=(e,t,r)=>{const s=N(f(e,r));return y(s,"root",t[r]),y(e,r,s),e},he=e=>j(e);function pe(e,t,r="validate"){if(he(e)||Array.isArray(e)&&e.every(he)||h(e)&&!e)return{type:r,message:he(e)?e:"",ref:t}}var me=e=>o(e)&&!ne(e)?e:{value:e,message:""},ye=async(e,t,r,n,a,u)=>{const{ref:l,refs:c,required:p,maxLength:m,minLength:y,min:g,max:v,pattern:b,validate:x,name:_,valueAsNumber:F,mount:w}=e._f,D=f(r,_);if(!w||t.has(_))return{};const $=c?c[0]:l,N=e=>{a&&$.reportValidity&&($.setCustomValidity(h(e)?"":e||""),$.reportValidity())},M={},U=Z(l),z=s(l),I=U||z,B=(F||P(l))&&d(l.value)&&d(D)||q(l)&&""===l.value||""===D||Array.isArray(D)&&!D.length,Y=C.bind(null,_,n,M),W=(e,t,r,s=S,n=E)=>{const i=e?t:r;M[_]={type:e?s:n,message:i,ref:l,...Y(e?s:n,i)}};if(u?!Array.isArray(D)||!D.length:p&&(!I&&(B||i(D))||h(D)&&!D||z&&!X(c).isValid||U&&!re(c).isValid)){const{value:e,message:t}=he(p)?{value:!!p,message:p}:me(p);if(e&&(M[_]={type:V,message:t,ref:$,...Y(V,t)},!n))return N(t),M}if(!(B||i(g)&&i(v))){let e,t;const r=me(v),s=me(g);if(i(D)||isNaN(D)){const n=l.valueAsDate||new Date(D),i=e=>new Date((new Date).toDateString()+" "+e),a="time"==l.type,o="week"==l.type;j(r.value)&&D&&(e=a?i(D)>i(r.value):o?D>r.value:n>new Date(r.value)),j(s.value)&&D&&(t=a?i(D)r.value),i(s.value)||(t=n+e.value,s=!i(t.value)&&D.length<+t.value;if((r||s)&&(W(r,e.message,t.message),!n))return N(M[_].message),M}if(b&&!B&&j(D)){const{value:e,message:t}=me(b);if(ne(e)&&!D.match(e)&&(M[_]={type:O,message:t,ref:l,...Y(O,t)},!n))return N(t),M}if(x)if(L(x)){const e=pe(await x(D,r),$);if(e&&(M[_]={...e,...Y(T,e.message)},!n))return N(e.message),M}else if(o(x)){let e={};for(const t in x){if(!R(e)&&!n)break;const s=pe(await x[t](D,r),$,t);s&&(e={...s,...Y(t,s.message)},N(s.message),n&&(M[_]=e))}if(!R(e)&&(M[_]={ref:$,...e},!n))return M}return N(!0),M};const ge={mode:_,reValidateMode:x,shouldFocusError:!0};function ve(e={}){let t={...ge,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:L(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1};const a={};let p,m=(o(t.defaultValues)||o(t.values))&&l(t.defaultValues||t.values)||{},b=t.shouldUnregister?{}:l(m),x={action:!1,mount:!1,watch:!1},_={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},F=0;const A={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let k={...A};const S={array:M(),state:M()},E=t.criteriaMode===w,O=async e=>{if(!t.disabled&&(A.isValid||k.isValid||e)){const e=t.resolver?R((await C()).errors):await U(a,!0);e!==r.isValid&&S.state.next({isValid:e})}},V=(e,s)=>{!t.disabled&&(A.isValidating||A.validatingFields||k.isValidating||k.validatingFields)&&((e||Array.from(_.mount)).forEach(e=>{e&&(s?y(r.validatingFields,e,s):Y(r.validatingFields,e))}),S.state.next({validatingFields:r.validatingFields,isValidating:!R(r.validatingFields)}))},T=(e,t,r,s)=>{const n=f(a,e);if(n){const i=f(b,e,d(r)?f(m,e):r);d(i)||s&&s.defaultChecked||t?y(b,e,t?i:se(n._f)):J(e,i),x.mount&&O()}},D=(e,s,n,i,a)=>{let o=!1,u=!1;const l={name:e};if(!t.disabled){if(!n||i){(A.isDirty||k.isDirty)&&(u=r.isDirty,r.isDirty=l.isDirty=W(),o=u!==l.isDirty);const t=z(f(m,e),s);u=!!f(r.dirtyFields,e),t?Y(r.dirtyFields,e):y(r.dirtyFields,e,!0),l.dirtyFields=r.dirtyFields,o=o||(A.dirtyFields||k.dirtyFields)&&u!==!t}if(n){const t=f(r.touchedFields,e);t||(y(r.touchedFields,e,n),l.touchedFields=r.touchedFields,o=o||(A.touchedFields||k.touchedFields)&&t!==n)}o&&a&&S.state.next(l)}return o?l:{}},$=(e,s,n,i)=>{const a=f(r.errors,e),o=(A.isValid||k.isValid)&&h(s)&&r.isValid!==s;var u;if(t.delayError&&n?(u=()=>((e,t)=>{y(r.errors,e,t),S.state.next({errors:r.errors})})(e,n),p=e=>{clearTimeout(F),F=setTimeout(u,e)},p(t.delayError)):(clearTimeout(F),p=null,n?y(r.errors,e,n):Y(r.errors,e)),(n?!z(a,n):a)||!R(i)||o){const t={...i,...o&&h(s)?{isValid:s}:{},errors:r.errors,name:e};r={...r,...t},S.state.next(t)}},C=async e=>{V(e,!0);const r=await t.resolver(b,t.context,((e,t,r,s)=>{const n={};for(const i of e){const e=f(t,i);e&&y(n,i,e._f)}return{criteriaMode:r,names:[...e],fields:n,shouldUseNativeValidation:s}})(e||_.mount,a,t.criteriaMode,t.shouldUseNativeValidation));return V(e),r},U=async(e,s,n={valid:!0})=>{for(const i in e){const a=e[i];if(a){const{_f:e,...o}=a;if(e){const o=_.array.has(e.name),u=a._f&&ue(a._f);u&&A.validatingFields&&V([i],!0);const l=await ye(a,_.disabled,b,E,t.shouldUseNativeValidation&&!s,o);if(u&&A.validatingFields&&V([i]),l[e.name]&&(n.valid=!1,s))break;!s&&(f(l,e.name)?o?fe(r.errors,l,e.name):y(r.errors,e.name,l[e.name]):Y(r.errors,e.name))}!R(o)&&await U(o,s,n)}}return n.valid},W=(e,r)=>!t.disabled&&(e&&r&&y(b,e,r),!z(ne(),m)),H=(e,t,r)=>((e,t,r,s,n)=>j(e)?(s&&t.watch.add(e),f(r,e,n)):Array.isArray(e)?e.map(e=>(s&&t.watch.add(e),f(r,e))):(s&&(t.watchAll=!0),r))(e,_,{...x.mount?b:d(t)?m:j(e)?{[e]:t}:t},r,t),J=(e,t,r={})=>{const n=f(a,e);let o=t;if(n){const r=n._f;r&&(!r.disabled&&y(b,e,ee(t,r)),o=q(r.ref)&&i(t)?"":t,I(r.ref)?[...r.ref.options].forEach(e=>e.selected=o.includes(e.value)):r.refs?s(r.ref)?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(o)?e.checked=!!o.find(t=>t===e.value):e.checked=o===e.value||!!o)}):r.refs.forEach(e=>e.checked=e.value===o):P(r.ref)?r.ref.value="":(r.ref.value=o,r.ref.type||S.state.next({name:e,values:l(b)})))}(r.shouldDirty||r.shouldTouch)&&D(e,o,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&re(e)},G=(e,t,r)=>{for(const s in t){if(!t.hasOwnProperty(s))return;const i=t[s],u=e+"."+s,l=f(a,u);(_.array.has(e)||o(i)||l&&!l._f)&&!n(i)?G(u,i,r):J(u,i,r)}},Q=(e,t,s={})=>{const n=f(a,e),o=_.array.has(e),u=l(t);y(b,e,u),o?(S.array.next({name:e,values:l(b)}),(A.isDirty||A.dirtyFields||k.isDirty||k.dirtyFields)&&s.shouldDirty&&S.state.next({name:e,dirtyFields:K(m,b),isDirty:W(e,u)})):!n||n._f||i(u)?J(e,u,s):G(e,u,s),le(e,_)&&S.state.next({...r}),S.state.next({name:x.mount?e:void 0,values:l(b)})},X=async e=>{x.mount=!0;const i=e.target;let u=i.name,c=!0;const d=f(a,u),h=e=>{c=Number.isNaN(e)||n(e)&&isNaN(e.getTime())||z(e,f(b,u,e))},m=ae(t.mode),F=ae(t.reValidateMode);if(d){let n,x;const T=i.type?se(d._f):(e=>o(e)&&e.target?s(e.target)?e.target.checked:e.target.value:e)(e),j=e.type===g||e.type===v,N=!((w=d._f).mount&&(w.required||w.min||w.max||w.maxLength||w.minLength||w.pattern||w.validate)||t.resolver||f(r.errors,u)||d._f.deps)||((e,t,r,s,n)=>!n.isOnAll&&(!r&&n.isOnTouch?!(t||e):(r?s.isOnBlur:n.isOnBlur)?!e:!(r?s.isOnChange:n.isOnChange)||e))(j,f(r.touchedFields,u),r.isSubmitted,F,m),M=le(u,_,j);y(b,u,T),j?(d._f.onBlur&&d._f.onBlur(e),p&&p(0)):d._f.onChange&&d._f.onChange(e);const z=D(u,T,j),P=!R(z)||M;if(!j&&S.state.next({name:u,type:e.type,values:l(b)}),N)return(A.isValid||k.isValid)&&("onBlur"===t.mode?j&&O():j||O()),P&&S.state.next({name:u,...M?{}:z});if(!j&&M&&S.state.next({...r}),t.resolver){const{errors:e}=await C([u]);if(h(T),c){const t=de(r.errors,a,u),s=de(e,a,t.name||u);n=s.error,u=s.name,x=R(e)}}else V([u],!0),n=(await ye(d,_.disabled,b,E,t.shouldUseNativeValidation))[u],V([u]),h(T),c&&(n?x=!1:(A.isValid||k.isValid)&&(x=await U(a,!0)));c&&(d._f.deps&&re(d._f.deps),$(u,x,n,z))}var w},te=(e,t)=>{if(f(r.errors,t)&&e.focus)return e.focus(),1},re=async(e,s={})=>{let n,i;const o=N(e);if(t.resolver){const t=await(async e=>{const{errors:t}=await C(e);if(e)for(const s of e){const e=f(t,s);e?y(r.errors,s,e):Y(r.errors,s)}else r.errors=t;return t})(d(e)?e:o);n=R(t),i=e?!o.some(e=>f(t,e)):n}else e?(i=(await Promise.all(o.map(async e=>{const t=f(a,e);return await U(t&&t._f?{[e]:t}:t)}))).every(Boolean),(i||r.isValid)&&O()):i=n=await U(a);return S.state.next({...!j(e)||(A.isValid||k.isValid)&&n!==r.isValid?{}:{name:e},...t.resolver||!e?{isValid:n}:{},errors:r.errors}),s.shouldFocus&&!i&&ce(a,te,e?o:_.mount),i},ne=e=>{const t={...x.mount?b:m};return d(e)?t:j(e)?f(t,e):e.map(e=>f(t,e))},oe=(e,t)=>({invalid:!!f((t||r).errors,e),isDirty:!!f((t||r).dirtyFields,e),error:f((t||r).errors,e),isValidating:!!f(r.validatingFields,e),isTouched:!!f((t||r).touchedFields,e)}),he=(e,t,s)=>{const n=(f(a,e,{_f:{}})._f||{}).ref,i=f(r.errors,e)||{},{ref:o,message:u,type:l,...c}=i;y(r.errors,e,{...c,...t,ref:n}),S.state.next({name:e,errors:r.errors,isValid:!1}),s&&s.shouldFocus&&n&&n.focus&&n.focus()},pe=e=>S.state.subscribe({next:t=>{var s,n,i;s=e.name,n=t.name,i=e.exact,s&&n&&s!==n&&!N(s).some(e=>e&&(i?e===n:e.startsWith(n)||n.startsWith(e)))||!((e,t,r,s)=>{r(e);const{name:n,...i}=e;return R(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(e=>t[e]===(!s||w))})(t,e.formState||A,Ae,e.reRenderRoot)||e.callback({values:{...b},...r,...t})}}).unsubscribe,me=(e,s={})=>{for(const n of e?N(e):_.mount)_.mount.delete(n),_.array.delete(n),s.keepValue||(Y(a,n),Y(b,n)),!s.keepError&&Y(r.errors,n),!s.keepDirty&&Y(r.dirtyFields,n),!s.keepTouched&&Y(r.touchedFields,n),!s.keepIsValidating&&Y(r.validatingFields,n),!t.shouldUnregister&&!s.keepDefaultValue&&Y(m,n);S.state.next({values:l(b)}),S.state.next({...r,...s.keepDirty?{isDirty:W()}:{}}),!s.keepIsValid&&O()},ve=({disabled:e,name:t})=>{(h(e)&&x.mount||e||_.disabled.has(t))&&(e?_.disabled.add(t):_.disabled.delete(t))},be=(e,r={})=>{let n=f(a,e);const i=h(r.disabled)||h(t.disabled);return y(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...r}}),_.mount.add(e),n?ve({disabled:h(r.disabled)?r.disabled:t.disabled,name:e}):T(e,!0,r.value),{...i?{disabled:r.disabled||t.disabled}:{},...t.progressive?{required:!!r.required,min:ie(r.min),max:ie(r.max),minLength:ie(r.minLength),maxLength:ie(r.maxLength),pattern:ie(r.pattern)}:{},name:e,onChange:X,onBlur:X,ref:i=>{if(i){be(e,r),n=f(a,e);const t=d(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,o=(e=>Z(e)||s(e))(t),u=n._f.refs||[];if(o?u.find(e=>e===t):t===n._f.ref)return;y(a,e,{_f:{...n._f,...o?{refs:[...u.filter(B),t,...Array.isArray(f(m,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),T(e,!1,void 0,t)}else n=f(a,e,{}),n._f&&(n._f.mount=!1),(t.shouldUnregister||r.shouldUnregister)&&(!((e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)))(_.array,e)||!x.action)&&_.unMount.add(e)}}},xe=()=>t.shouldFocusError&&ce(a,te,_.mount),_e=(e,s)=>async n=>{let i;n&&(n.preventDefault&&n.preventDefault(),n.persist&&n.persist());let o=l(b);if(S.state.next({isSubmitting:!0}),t.resolver){const{errors:e,values:t}=await C();r.errors=e,o=t}else await U(a);if(_.disabled.size)for(const e of _.disabled)y(o,e,void 0);if(Y(r.errors,"root"),R(r.errors)){S.state.next({errors:{}});try{await e(o,n)}catch(u){i=u}}else s&&await s({...r.errors},n),xe(),setTimeout(xe);if(S.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:R(r.errors)&&!i,submitCount:r.submitCount+1,errors:r.errors}),i)throw i},Fe=(e,s={})=>{const n=e?l(e):m,i=l(n),o=R(e),c=o?m:i;if(s.keepDefaultValues||(m=n),!s.keepValues){if(s.keepDirtyValues){const e=new Set([..._.mount,...Object.keys(K(m,b))]);for(const t of Array.from(e))f(r.dirtyFields,t)?y(c,t,f(b,t)):Q(t,f(c,t))}else{if(u&&d(e))for(const e of _.mount){const t=f(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(q(e)){const t=e.closest("form");if(t){t.reset();break}}}}for(const e of _.mount)Q(e,f(c,e))}b=l(c),S.array.next({values:{...c}}),S.state.next({values:{...c}})}_={mount:s.keepDirtyValues?_.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},x.mount=!A.isValid||!!s.keepIsValid||!!s.keepDirtyValues,x.watch=!!t.shouldUnregister,S.state.next({submitCount:s.keepSubmitCount?r.submitCount:0,isDirty:!o&&(s.keepDirty?r.isDirty:!(!s.keepDefaultValues||z(e,m))),isSubmitted:!!s.keepIsSubmitted&&r.isSubmitted,dirtyFields:o?{}:s.keepDirtyValues?s.keepDefaultValues&&b?K(m,b):r.dirtyFields:s.keepDefaultValues&&e?K(m,e):s.keepDirty?r.dirtyFields:{},touchedFields:s.keepTouched?r.touchedFields:{},errors:s.keepErrors?r.errors:{},isSubmitSuccessful:!!s.keepIsSubmitSuccessful&&r.isSubmitSuccessful,isSubmitting:!1})},we=(e,t)=>Fe(L(e)?e(b):e,t),Ae=e=>{r={...r,...e}},ke={control:{register:be,unregister:me,getFieldState:oe,handleSubmit:_e,setError:he,_subscribe:pe,_runSchema:C,_focusError:xe,_getWatch:H,_getDirty:W,_setValid:O,_setFieldArray:(e,s=[],n,i,o=!0,u=!0)=>{if(i&&n&&!t.disabled){if(x.action=!0,u&&Array.isArray(f(a,e))){const t=n(f(a,e),i.argA,i.argB);o&&y(a,e,t)}if(u&&Array.isArray(f(r.errors,e))){const t=n(f(r.errors,e),i.argA,i.argB);o&&y(r.errors,e,t),((e,t)=>{!c(f(e,t)).length&&Y(e,t)})(r.errors,e)}if((A.touchedFields||k.touchedFields)&&u&&Array.isArray(f(r.touchedFields,e))){const t=n(f(r.touchedFields,e),i.argA,i.argB);o&&y(r.touchedFields,e,t)}(A.dirtyFields||k.dirtyFields)&&(r.dirtyFields=K(m,b)),S.state.next({name:e,isDirty:W(e,s),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else y(b,e,s)},_setDisabledField:ve,_setErrors:e=>{r.errors=e,S.state.next({errors:r.errors,isValid:!1})},_getFieldArray:e=>c(f(x.mount?b:m,e,t.shouldUnregister?f(m,e,[]):[])),_reset:Fe,_resetDefaultValues:()=>L(t.defaultValues)&&t.defaultValues().then(e=>{we(e,t.resetOptions),S.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of _.unMount){const t=f(a,e);t&&(t._f.refs?t._f.refs.every(e=>!B(e)):!B(t._f.ref))&&me(e)}_.unMount=new Set},_disableForm:e=>{h(e)&&(S.state.next({disabled:e}),ce(a,(t,r)=>{const s=f(a,r);s&&(t.disabled=s._f.disabled||e,Array.isArray(s._f.refs)&&s._f.refs.forEach(t=>{t.disabled=s._f.disabled||e}))},0,!1))},_subjects:S,_proxyFormState:A,get _fields(){return a},get _formValues(){return b},get _state(){return x},set _state(e){x=e},get _defaultValues(){return m},get _names(){return _},set _names(e){_=e},get _formState(){return r},get _options(){return t},set _options(e){t={...t,...e}}},subscribe:e=>(x.mount=!0,k={...k,...e.formState},pe({...e,formState:k})),trigger:re,register:be,handleSubmit:_e,watch:(e,t)=>L(e)?S.state.subscribe({next:r=>e(H(void 0,t),r)}):H(e,t,!0),setValue:Q,getValues:ne,reset:we,resetField:(e,t={})=>{f(a,e)&&(d(t.defaultValue)?Q(e,l(f(m,e))):(Q(e,t.defaultValue),y(m,e,l(t.defaultValue))),t.keepTouched||Y(r.touchedFields,e),t.keepDirty||(Y(r.dirtyFields,e),r.isDirty=t.defaultValue?W(e,l(f(m,e))):W()),t.keepError||(Y(r.errors,e),A.isValid&&O()),S.state.next({...r}))},clearErrors:e=>{e&&N(e).forEach(e=>Y(r.errors,e)),S.state.next({errors:e?r.errors:{}})},unregister:me,setError:he,setFocus:(e,t={})=>{const r=f(a,e),s=r&&r._f;if(s){const e=s.refs?s.refs[0]:s.ref;e.focus&&(e.focus(),t.shouldSelect&&L(e.select)&&e.select())}},getFieldState:oe};return{...ke,formControl:ke}}var be=()=>{const e="undefined"==typeof performance?Date.now():1e3*performance.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=(16*Math.random()+e)%16|0;return("x"==t?r:3&r|8).toString(16)})},xe=(e,t,r={})=>r.shouldFocus||d(r.shouldFocus)?r.focusName||`${e}.${d(r.focusIndex)?t:r.focusIndex}.`:"",_e=(e,t)=>[...e,...N(t)],Fe=e=>Array.isArray(e)?e.map(()=>{}):void 0;function we(e,t,r){return[...e.slice(0,t),...N(r),...e.slice(t)]}var Ae=(e,t,r)=>Array.isArray(e)?(d(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[],ke=(e,t)=>[...N(t),...N(e)];var Se=(e,t)=>d(t)?[]:function(e,t){let r=0;const s=[...e];for(const n of t)s.splice(n-r,1),r++;return c(s).length?s:[]}(e,N(t).sort((e,t)=>e-t)),Ee=(e,t,r)=>{[e[t],e[r]]=[e[r],e[t]]},Oe=(e,t,r)=>(e[t]=r,e);function Ve(t){const r=e.useContext(D),{control:s=r.control,name:n,keyName:i="id",shouldUnregister:a,rules:o}=t,[u,c]=e.useState(s._getFieldArray(n)),d=e.useRef(s._getFieldArray(n).map(be)),h=e.useRef(u),p=e.useRef(n),m=e.useRef(!1);p.current=n,h.current=u,s._names.array.add(n),o&&s.register(n,o),e.useEffect(()=>s._subjects.array.subscribe({next:({values:e,name:t})=>{if(t===p.current||!t){const t=f(e,p.current);Array.isArray(t)&&(c(t),d.current=t.map(be))}}}).unsubscribe,[s]);const g=e.useCallback(e=>{m.current=!0,s._setFieldArray(n,e)},[s,n]);return e.useEffect(()=>{if(s._state.action=!1,le(n,s._names)&&s._subjects.state.next({...s._formState}),m.current&&(!ae(s._options.mode).isOnSubmit||s._formState.isSubmitted)&&!ae(s._options.reValidateMode).isOnSubmit)if(s._options.resolver)s._runSchema([n]).then(e=>{const t=f(e.errors,n),r=f(s._formState.errors,n);(r?!t&&r.type||t&&(r.type!==t.type||r.message!==t.message):t&&t.type)&&(t?y(s._formState.errors,n,t):Y(s._formState.errors,n),s._subjects.state.next({errors:s._formState.errors}))});else{const e=f(s._fields,n);!e||!e._f||ae(s._options.reValidateMode).isOnSubmit&&ae(s._options.mode).isOnSubmit||ye(e,s._names.disabled,s._formValues,s._options.criteriaMode===w,s._options.shouldUseNativeValidation,!0).then(e=>!R(e)&&s._subjects.state.next({errors:fe(s._formState.errors,e,n)}))}s._subjects.state.next({name:n,values:l(s._formValues)}),s._names.focus&&ce(s._fields,(e,t)=>{if(s._names.focus&&t.startsWith(s._names.focus)&&e.focus)return e.focus(),1}),s._names.focus="",s._setValid(),m.current=!1},[u,n,s]),e.useEffect(()=>(!f(s._formValues,n)&&s._setFieldArray(n),()=>{s._options.shouldUnregister||a?s.unregister(n):((e,t)=>{const r=f(s._fields,e);r&&r._f&&(r._f.mount=t)})(n,!1)}),[n,s,i,a]),{swap:e.useCallback((e,t)=>{const r=s._getFieldArray(n);Ee(r,e,t),Ee(d.current,e,t),g(r),c(r),s._setFieldArray(n,r,Ee,{argA:e,argB:t},!1)},[g,n,s]),move:e.useCallback((e,t)=>{const r=s._getFieldArray(n);Ae(r,e,t),Ae(d.current,e,t),g(r),c(r),s._setFieldArray(n,r,Ae,{argA:e,argB:t},!1)},[g,n,s]),prepend:e.useCallback((e,t)=>{const r=N(l(e)),i=ke(s._getFieldArray(n),r);s._names.focus=xe(n,0,t),d.current=ke(d.current,r.map(be)),g(i),c(i),s._setFieldArray(n,i,ke,{argA:Fe(e)})},[g,n,s]),append:e.useCallback((e,t)=>{const r=N(l(e)),i=_e(s._getFieldArray(n),r);s._names.focus=xe(n,i.length-1,t),d.current=_e(d.current,r.map(be)),g(i),c(i),s._setFieldArray(n,i,_e,{argA:Fe(e)})},[g,n,s]),remove:e.useCallback(e=>{const t=Se(s._getFieldArray(n),e);d.current=Se(d.current,e),g(t),c(t),!Array.isArray(f(s._fields,n))&&y(s._fields,n,void 0),s._setFieldArray(n,t,Se,{argA:e})},[g,n,s]),insert:e.useCallback((e,t,r)=>{const i=N(l(t)),a=we(s._getFieldArray(n),e,i);s._names.focus=xe(n,e,r),d.current=we(d.current,e,i.map(be)),g(a),c(a),s._setFieldArray(n,a,we,{argA:e,argB:Fe(t)})},[g,n,s]),update:e.useCallback((e,t)=>{const r=l(t),i=Oe(s._getFieldArray(n),e,r);d.current=[...i].map((t,r)=>t&&r!==e?d.current[r]:be()),g(i),c([...i]),s._setFieldArray(n,i,Oe,{argA:e,argB:r},!0,!1)},[g,n,s]),replace:e.useCallback(e=>{const t=N(l(e));d.current=t.map(be),g([...t]),c([...t]),s._setFieldArray(n,[...t],e=>e,{},!0,!1)},[g,n,s]),fields:e.useMemo(()=>u.map((e,t)=>({...e,[i]:d.current[t]||be()})),[u,i])}}function Te(t={}){const r=e.useRef(void 0),s=e.useRef(void 0),[n,i]=e.useState({isDirty:!1,isValidating:!1,isLoading:L(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:L(t.defaultValues)?void 0:t.defaultValues});r.current||(r.current={...t.formControl?t.formControl:ve(t),formState:n},t.formControl&&t.defaultValues&&!L(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions));const a=r.current.control;return a._options=t,$(()=>{const e=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i(e=>({...e,isReady:!0})),a._formState.isReady=!0,e},[a]),e.useEffect(()=>a._disableForm(t.disabled),[a,t.disabled]),e.useEffect(()=>{t.mode&&(a._options.mode=t.mode),t.reValidateMode&&(a._options.reValidateMode=t.reValidateMode)},[a,t.mode,t.reValidateMode]),e.useEffect(()=>{t.errors&&(a._setErrors(t.errors),a._focusError())},[a,t.errors]),e.useEffect(()=>{t.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,t.shouldUnregister]),e.useEffect(()=>{if(a._proxyFormState.isDirty){const e=a._getDirty();e!==n.isDirty&&a._subjects.state.next({isDirty:e})}},[a,n.isDirty]),e.useEffect(()=>{t.values&&!z(t.values,s.current)?(a._reset(t.values,a._options.resetOptions),s.current=t.values,i(e=>({...e}))):a._resetDefaultValues()},[a,t.values]),e.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),r.current.formState=((e,t,r,s=!0)=>{const n={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(n,i,{get:()=>{const n=i;return t._proxyFormState[n]!==w&&(t._proxyFormState[n]=!s||w),r&&(r[n]=!0),e[n]}});return n})(n,a),r.current}const De=(e,t,r)=>{if(e&&"reportValidity"in e){const s=f(r,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},$e=(e,t)=>{for(const r in t.fields){const s=t.fields[r];s&&s.ref&&"reportValidity"in s.ref?De(s.ref,r,e):s&&s.refs&&s.refs.forEach(t=>De(t,r,e))}},je=(e,t)=>{t.shouldUseNativeValidation&&$e(e,t);const r={};for(const s in e){const n=f(t.fields,s),i=Object.assign(e[s]||{},{ref:n&&n.ref});if(Ce(t.names||Object.keys(e),s)){const e=Object.assign({},f(r,s));y(e,"root",i),y(r,s,e)}else y(r,s,i)}return r},Ce=(e,t)=>{const r=Ne(t);return e.some(e=>Ne(e).match(`^${r}\\.\\d+`))};function Ne(e){return e.replace(/\]|\[/g,"")}function Me(e){this._maxSize=e,this.clear()}Me.prototype.clear=function(){this._size=0,this._values=Object.create(null)},Me.prototype.get=function(e){return this._values[e]},Me.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var Ue=/[^.^\]^[]+|(?=\[\]|\.\.)/g,ze=/^\d+$/,Re=/^\d/,Pe=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,Le=/^\s*(['"]?)(.*?)(\1)\s*$/,qe=new Me(512),Ie=new Me(512),Ze=new Me(512),Be={Cache:Me,split:We,normalizePath:Ye,setter:function(e){var t=Ye(e);return Ie.get(e)||Ie.set(e,function(e,r){for(var s=0,n=t.length,i=e;se.match(Ke)||[],Qe=(e,t)=>Ge(e).join(t).toLowerCase(),Xe=e=>Ge(e).reduce((e,t)=>`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,"");var et=Xe,tt=e=>Qe(e,"_"),rt={exports:{}};function st(e,t){var r=e.length,s=new Array(r),n={},i=r,a=function(e){for(var t=new Map,r=0,s=e.length;r"",lt=/^Symbol\((.*)\)(.*)$/;function ct(e,t=!1){if(null==e||!0===e||!1===e)return""+e;const r=typeof e;if("number"===r)return function(e){return e!=+e?"NaN":0===e&&1/e<0?"-0":""+e}(e);if("string"===r)return t?`"${e}"`:e;if("function"===r)return"[Function "+(e.name||"anonymous")+"]";if("symbol"===r)return ut.call(e).replace(lt,"Symbol($1)");const s=it.call(e).slice(8,-1);return"Date"===s?isNaN(e.getTime())?""+e:e.toISOString(e):"Error"===s||e instanceof Error?"["+at.call(e)+"]":"RegExp"===s?ot.call(e):null}function dt(e,t){let r=ct(e,t);return null!==r?r:JSON.stringify(e,function(e,r){let s=ct(this[e],t);return null!==s?s:r},2)}function ft(e){return null==e?[]:[].concat(e)}let ht,pt,mt,yt=/\$\{\s*(\w+)\s*\}/g;ht=Symbol.toStringTag;class gt{constructor(e,t,r,s){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[ht]="Error",this.name="ValidationError",this.value=t,this.path=r,this.type=s,this.errors=[],this.inner=[],ft(e).forEach(e=>{if(vt.isError(e)){this.errors.push(...e.errors);const t=e.inner.length?e.inner:[e];this.inner.push(...t)}else this.errors.push(e)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}pt=Symbol.hasInstance,mt=Symbol.toStringTag;class vt extends Error{static formatError(e,t){const r=t.label||t.path||"this";return t=Object.assign({},t,{path:r,originalPath:t.path}),"string"==typeof e?e.replace(yt,(e,r)=>dt(t[r])):"function"==typeof e?e(t):e}static isError(e){return e&&"ValidationError"===e.name}constructor(e,t,r,s,n){const i=new gt(e,t,r,s);if(n)return i;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[mt]="Error",this.name=i.name,this.message=i.message,this.type=i.type,this.value=i.value,this.path=i.path,this.errors=i.errors,this.inner=i.inner,Error.captureStackTrace&&Error.captureStackTrace(this,vt)}static[pt](e){return gt[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let bt={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:r,originalValue:s})=>{const n=null!=s&&s!==r?` (cast from the value \`${dt(s,!0)}\`).`:".";return"mixed"!==t?`${e} must be a \`${t}\` type, but the final value was: \`${dt(r,!0)}\``+n:`${e} must match the configured type. The validated value was: \`${dt(r,!0)}\``+n}},xt={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},_t={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},Ft={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},wt={isValue:"${path} field must be ${value}"},At={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},kt={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},St={notType:e=>{const{path:t,value:r,spec:s}=e,n=s.types.length;if(Array.isArray(r)){if(r.lengthn)return`${t} tuple value has too many items, expected a length of ${n} but got ${r.length} for value: \`${dt(r,!0)}\``}return vt.formatError(bt.notType,e)}};Object.assign(Object.create(null),{mixed:bt,string:xt,number:_t,date:Ft,object:At,array:kt,boolean:wt,tuple:St});const Et=e=>e&&e.__isYupSchema__;class Ot{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:s,otherwise:n}=t,i="function"==typeof r?r:(...e)=>e.every(e=>e===r);return new Ot(e,(e,t)=>{var r;let a=i(...e)?s:n;return null!=(r=null==a?void 0:a(t))?r:t})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let r=this.refs.map(e=>e.getValue(null==t?void 0:t.value,null==t?void 0:t.parent,null==t?void 0:t.context)),s=this.fn(r,e,t);if(void 0===s||s===e)return e;if(!Et(s))throw new TypeError("conditions must return a schema object");return s.resolve(t)}}const Vt="$",Tt=".";class Dt{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,"string"!=typeof e)throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),""===e)throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Vt,this.isValue=this.key[0]===Tt,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Vt:this.isValue?Tt:"";this.path=this.key.slice(r.length),this.getter=this.path&&Be.getter(this.path,!0),this.map=t.map}getValue(e,t,r){let s=this.isContext?r:this.isValue?e:t;return this.getter&&(s=this.getter(s||{})),this.map&&(s=this.map(s)),s}cast(e,t){return this.getValue(e,null==t?void 0:t.parent,null==t?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Dt.prototype.__isYupRef=!0;const $t=e=>null==e;function jt(e){function t({value:t,path:r="",options:s,originalValue:n,schema:i},a,o){const{name:u,test:l,params:c,message:d,skipAbsent:f}=e;let{parent:h,context:p,abortEarly:m=i.spec.abortEarly,disableStackTrace:y=i.spec.disableStackTrace}=s;function g(e){return Dt.isRef(e)?e.getValue(t,h,p):e}function v(e={}){const s=Object.assign({value:t,originalValue:n,label:i.spec.label,path:e.path||r,spec:i.spec,disableStackTrace:e.disableStackTrace||y},c,e.params);for(const t of Object.keys(s))s[t]=g(s[t]);const a=new vt(vt.formatError(e.message||d,s),t,s.path,e.type||u,s.disableStackTrace);return a.params=s,a}const b=m?a:o;let x={path:r,parent:h,type:u,from:s.from,createError:v,resolve:g,options:s,originalValue:n,schema:i};const _=e=>{vt.isError(e)?b(e):e?o(null):b(v())},F=e=>{vt.isError(e)?b(e):a(e)};if(f&&$t(t))return _(!0);let w;try{var A;if(w=l.call(x,t,x),"function"==typeof(null==(A=w)?void 0:A.then)){if(s.sync)throw new Error(`Validation test of type: "${x.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(w).then(_,F)}}catch(k){return void F(k)}_(w)}return t.OPTIONS=e,t}function Ct(e,t,r,s=r){let n,i,a;return t?(Be.forEach(t,(o,u,l)=>{let c=u?o.slice(1,o.length-1):o,d="tuple"===(e=e.resolve({context:s,parent:n,value:r})).type,f=l?parseInt(c,10):0;if(e.innerType||d){if(d&&!l)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${a}" must contain an index to the tuple element, e.g. "${a}[0]"`);if(r&&f>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${o}, in the path: ${t}. because there is no value at that index. `);n=r,r=r&&r[f],e=d?e.spec.types[f]:e.innerType}if(!l){if(!e.fields||!e.fields[c])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${a} which is a type: "${e.type}")`);n=r,r=r&&r[c],e=e.fields[c]}i=c,a=u?"["+o+"]":"."+o}),{schema:e,parent:n,parentPath:i}):{parent:n,parentPath:t,schema:e}}class Nt extends Set{describe(){const e=[];for(const t of this.values())e.push(Dt.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const r of this.values())t.push(e(r));return t}clone(){return new Nt(this.values())}merge(e,t){const r=this.clone();return e.forEach(e=>r.add(e)),t.forEach(e=>r.delete(e)),r}}function Mt(e,t=new Map){if(Et(e)||!e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);let r;if(e instanceof Date)r=new Date(e.getTime()),t.set(e,r);else if(e instanceof RegExp)r=new RegExp(e),t.set(e,r);else if(Array.isArray(e)){r=new Array(e.length),t.set(e,r);for(let s=0;s{this.typeError(bt.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},null==e?void 0:e.spec),this.withMutation(e=>{e.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=Mt(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(0===e.length)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=t,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&"mixed"!==this.type)throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,r=e.clone();const s=Object.assign({},t.spec,r.spec);return r.spec=s,r.internalTests=Object.assign({},t.internalTests,r.internalTests),r._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),r.tests=t.tests,r.exclusiveTests=t.exclusiveTests,r.withMutation(t=>{e.tests.forEach(e=>{t.test(e.OPTIONS)})}),r.transforms=[...t.transforms,...r.transforms],r}isType(e){return null==e?!(!this.spec.nullable||null!==e)||!(!this.spec.optional||void 0!==e):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let r=t.conditions;t=t.clone(),t.conditions=[],t=r.reduce((t,r)=>r.resolve(t,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,r,s,n;return Object.assign({},e,{from:e.from||[],strict:null!=(t=e.strict)?t:this.spec.strict,abortEarly:null!=(r=e.abortEarly)?r:this.spec.abortEarly,recursive:null!=(s=e.recursive)?s:this.spec.recursive,disableStackTrace:null!=(n=e.disableStackTrace)?n:this.spec.disableStackTrace})}cast(e,t={}){let r=this.resolve(Object.assign({value:e},t)),s="ignore-optionality"===t.assert,n=r._cast(e,t);if(!1!==t.assert&&!r.isType(n)){if(s&&$t(n))return n;let i=dt(e),a=dt(n);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}". \n\nattempted value: ${i} \n`+(a!==i?`result of cast: ${a}`:""))}return n}_cast(e,t){let r=void 0===e?e:this.transforms.reduce((t,r)=>r.call(this,t,e,this),e);return void 0===r&&(r=this.getDefault(t)),r}_validate(e,t={},r,s){let{path:n,originalValue:i=e,strict:a=this.spec.strict}=t,o=e;a||(o=this._cast(o,Object.assign({assert:!1},t)));let u=[];for(let l of Object.values(this.internalTests))l&&u.push(l);this.runTests({path:n,value:o,originalValue:i,options:t,tests:u},r,e=>{if(e.length)return s(e,o);this.runTests({path:n,value:o,originalValue:i,options:t,tests:this.tests},r,s)})}runTests(e,t,r){let s=!1,{tests:n,value:i,originalValue:a,path:o,options:u}=e,l=e=>{s||(s=!0,t(e,i))},c=e=>{s||(s=!0,r(e,i))},d=n.length,f=[];if(!d)return c([]);let h={value:i,originalValue:a,path:o,options:u,schema:this};for(let p=0;pthis.resolve(l)._validate(u,l,t,r)}validate(e,t){var r;let s=this.resolve(Object.assign({},t,{value:e})),n=null!=(r=null==t?void 0:t.disableStackTrace)?r:s.spec.disableStackTrace;return new Promise((r,i)=>s._validate(e,t,(e,t)=>{vt.isError(e)&&(e.value=t),i(e)},(e,t)=>{e.length?i(new vt(e,t,void 0,void 0,n)):r(t)}))}validateSync(e,t){var r;let s,n=this.resolve(Object.assign({},t,{value:e})),i=null!=(r=null==t?void 0:t.disableStackTrace)?r:n.spec.disableStackTrace;return n._validate(e,Object.assign({},t,{sync:!0}),(e,t)=>{throw vt.isError(e)&&(e.value=t),e},(t,r)=>{if(t.length)throw new vt(t,e,void 0,void 0,i);s=r}),s}isValid(e,t){return this.validate(e,t).then(()=>!0,e=>{if(vt.isError(e))return!1;throw e})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(r){if(vt.isError(r))return!1;throw r}}_getDefault(e){let t=this.spec.default;return null==t?t:"function"==typeof t?t.call(this,e):Mt(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){if(0===arguments.length)return this._getDefault();return this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const r=this.clone({nullable:e});return r.internalTests.nullable=jt({message:t,name:"nullable",test(e){return null!==e||this.schema.spec.nullable}}),r}optionality(e,t){const r=this.clone({optional:e});return r.internalTests.optionality=jt({message:t,name:"optionality",test(e){return void 0!==e||this.schema.spec.optional}}),r}optional(){return this.optionality(!0)}defined(e=bt.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=bt.notNull){return this.nullability(!1,e)}required(e=bt.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(t=1===e.length?"function"==typeof e[0]?{test:e[0]}:e[0]:2===e.length?{name:e[0],test:e[1]}:{name:e[0],message:e[1],test:e[2]},void 0===t.message&&(t.message=bt.default),"function"!=typeof t.test)throw new TypeError("`test` is a required parameters");let r=this.clone(),s=jt(t),n=t.exclusive||t.name&&!0===r.exclusiveTests[t.name];if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(r.exclusiveTests[t.name]=!!t.exclusive),r.tests=r.tests.filter(e=>{if(e.OPTIONS.name===t.name){if(n)return!1;if(e.OPTIONS.test===s.OPTIONS.test)return!1}return!0}),r.tests.push(s),r}when(e,t){Array.isArray(e)||"string"==typeof e||(t=e,e=".");let r=this.clone(),s=ft(e).map(e=>new Dt(e));return s.forEach(e=>{e.isSibling&&r.deps.push(e.key)}),r.conditions.push("function"==typeof t?new Ot(s,t):Ot.fromOptions(s,t)),r}typeError(e){let t=this.clone();return t.internalTests.typeError=jt({message:e,name:"typeError",skipAbsent:!0,test(e){return!!this.schema._typeCheck(e)||this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=bt.oneOf){let r=this.clone();return e.forEach(e=>{r._whitelist.add(e),r._blacklist.delete(e)}),r.internalTests.whiteList=jt({message:t,name:"oneOf",skipAbsent:!0,test(e){let t=this.schema._whitelist,r=t.resolveAll(this.resolve);return!!r.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:r}})}}),r}notOneOf(e,t=bt.notOneOf){let r=this.clone();return e.forEach(e=>{r._blacklist.add(e),r._whitelist.delete(e)}),r.internalTests.blacklist=jt({message:t,name:"notOneOf",test(e){let t=this.schema._blacklist,r=t.resolveAll(this.resolve);return!r.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:r}})}}),r}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:r,meta:s,optional:n,nullable:i}=t.spec;return{meta:s,label:r,optional:n,nullable:i,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.map(e=>({name:e.OPTIONS.name,params:e.OPTIONS.params})).filter((e,t,r)=>r.findIndex(t=>t.name===e.name)===t)}}}Ut.prototype.__isYupSchema__=!0;for(const fr of["validate","validateSync"])Ut.prototype[`${fr}At`]=function(e,t,r={}){const{parent:s,parentPath:n,schema:i}=Ct(this,e,t,r.context);return i[fr](s&&s[n],Object.assign({},r,{parent:s,path:e}))};for(const fr of["equals","is"])Ut.prototype[fr]=Ut.prototype.oneOf;for(const fr of["not","nope"])Ut.prototype[fr]=Ut.prototype.notOneOf;function zt(){return new Rt}class Rt extends Ut{constructor(){super({type:"boolean",check:e=>(e instanceof Boolean&&(e=e.valueOf()),"boolean"==typeof e)}),this.withMutation(()=>{this.transform((e,t,r)=>{if(r.spec.coerce&&!r.isType(e)){if(/^(true|1)$/i.test(String(e)))return!0;if(/^(false|0)$/i.test(String(e)))return!1}return e})})}isTrue(e=wt.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"true"},test:e=>$t(e)||!0===e})}isFalse(e=wt.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"false"},test:e=>$t(e)||!1===e})}default(e){return super.default(e)}defined(e){return super.defined(e)}optional(){return super.optional()}required(e){return super.required(e)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(e){return super.nonNullable(e)}strip(e){return super.strip(e)}}zt.prototype=Rt.prototype;const Pt=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Lt(e){var t,r;const s=Pt.exec(e);return s?{year:qt(s[1]),month:qt(s[2],1)-1,day:qt(s[3],1),hour:qt(s[4]),minute:qt(s[5]),second:qt(s[6]),millisecond:s[7]?qt(s[7].substring(0,3)):0,precision:null!=(t=null==(r=s[7])?void 0:r.length)?t:void 0,z:s[8]||void 0,plusMinus:s[9]||void 0,hourOffset:qt(s[10]),minuteOffset:qt(s[11])}:null}function qt(e,t=0){return Number(e)||t}let It=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Zt=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Bt=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Yt=new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"),Wt=e=>$t(e)||e===e.trim(),Ht={}.toString();function Jt(){return new Kt}class Kt extends Ut{constructor(){super({type:"string",check:e=>(e instanceof String&&(e=e.valueOf()),"string"==typeof e)}),this.withMutation(()=>{this.transform((e,t,r)=>{if(!r.spec.coerce||r.isType(e))return e;if(Array.isArray(e))return e;const s=null!=e&&e.toString?e.toString():e;return s===Ht?e:s})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||bt.required,name:"required",skipAbsent:!0,test:e=>!!e.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(e=>"required"!==e.OPTIONS.name),e))}length(e,t=xt.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t=xt.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t=xt.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}matches(e,t){let r,s,n=!1;return t&&("object"==typeof t?({excludeEmptyString:n=!1,message:r,name:s}=t):r=t),this.test({name:s||"matches",message:r||xt.matches,params:{regex:e},skipAbsent:!0,test:t=>""===t&&n||-1!==t.search(e)})}email(e=xt.email){return this.matches(It,{name:"email",message:e,excludeEmptyString:!0})}url(e=xt.url){return this.matches(Zt,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=xt.uuid){return this.matches(Bt,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t,r,s="";return e&&("object"==typeof e?({message:s="",allowOffset:t=!1,precision:r}=e):s=e),this.matches(Yt,{name:"datetime",message:s||xt.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:s||xt.datetime_offset,params:{allowOffset:t},skipAbsent:!0,test:e=>{if(!e||t)return!0;const r=Lt(e);return!!r&&!!r.z}}).test({name:"datetime_precision",message:s||xt.datetime_precision,params:{precision:r},skipAbsent:!0,test:e=>{if(!e||null==r)return!0;const t=Lt(e);return!!t&&t.precision===r}})}ensure(){return this.default("").transform(e=>null===e?"":e)}trim(e=xt.trim){return this.transform(e=>null!=e?e.trim():e).test({message:e,name:"trim",test:Wt})}lowercase(e=xt.lowercase){return this.transform(e=>$t(e)?e:e.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>$t(e)||e===e.toLowerCase()})}uppercase(e=xt.uppercase){return this.transform(e=>$t(e)?e:e.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>$t(e)||e===e.toUpperCase()})}}Jt.prototype=Kt.prototype;function Gt(){return new Qt}class Qt extends Ut{constructor(){super({type:"number",check:e=>(e instanceof Number&&(e=e.valueOf()),"number"==typeof e&&!(e=>e!=+e)(e))}),this.withMutation(()=>{this.transform((e,t,r)=>{if(!r.spec.coerce)return e;let s=e;if("string"==typeof s){if(s=s.replace(/\s/g,""),""===s)return NaN;s=+s}return r.isType(s)||null===s?s:parseFloat(s)})})}min(e,t=_t.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t>=this.resolve(e)}})}max(e,t=_t.max){return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(t){return t<=this.resolve(e)}})}lessThan(e,t=_t.lessThan){return this.test({message:t,name:"max",exclusive:!0,params:{less:e},skipAbsent:!0,test(t){return tthis.resolve(e)}})}positive(e=_t.positive){return this.moreThan(0,e)}negative(e=_t.negative){return this.lessThan(0,e)}integer(e=_t.integer){return this.test({name:"integer",message:e,skipAbsent:!0,test:e=>Number.isInteger(e)})}truncate(){return this.transform(e=>$t(e)?e:0|e)}round(e){var t;let r=["ceil","floor","round","trunc"];if("trunc"===(e=(null==(t=e)?void 0:t.toLowerCase())||"round"))return this.truncate();if(-1===r.indexOf(e.toLowerCase()))throw new TypeError("Only valid options for round() are: "+r.join(", "));return this.transform(t=>$t(t)?t:Math[e](t))}}Gt.prototype=Qt.prototype;let Xt=new Date("");class er extends Ut{constructor(){super({type:"date",check(e){return t=e,"[object Date]"===Object.prototype.toString.call(t)&&!isNaN(e.getTime());var t}}),this.withMutation(()=>{this.transform((e,t,r)=>!r.spec.coerce||r.isType(e)||null===e?e:(e=function(e){const t=Lt(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(void 0===t.z&&void 0===t.plusMinus)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let r=0;return"Z"!==t.z&&void 0!==t.plusMinus&&(r=60*t.hourOffset+t.minuteOffset,"+"===t.plusMinus&&(r=0-r)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+r,t.second,t.millisecond)}(e),isNaN(e)?er.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let r;if(Dt.isRef(e))r=e;else{let s=this.cast(e);if(!this._typeCheck(s))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);r=s}return r}min(e,t=Ft.min){let r=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(e){return e>=this.resolve(r)}})}max(e,t=Ft.max){let r=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(e){return e<=this.resolve(r)}})}}function tr(e,t){let r=1/0;return e.some((e,s)=>{var n;if(null!=(n=t.path)&&n.includes(e))return r=s,!0}),r}function rr(e){return(t,r)=>tr(e,t)-tr(e,r)}er.INVALID_DATE=Xt,er.prototype;const sr=(e,t,r)=>{if("string"!=typeof e)return e;let s=e;try{s=JSON.parse(e)}catch(n){}return r.isType(s)?s:e};function nr(e){if("fields"in e){const t={};for(const[r,s]of Object.entries(e.fields))t[r]=nr(s);return e.setFields(t)}if("array"===e.type){const t=e.optional();return t.innerType&&(t.innerType=nr(t.innerType)),t}return"tuple"===e.type?e.optional().clone({types:e.spec.types.map(nr)}):"optional"in e?e.optional():e}let ir=e=>"[object Object]"===Object.prototype.toString.call(e);function ar(e,t){let r=Object.keys(e.fields);return Object.keys(t).filter(e=>-1===r.indexOf(e))}const or=rr([]);function ur(e){return new lr(e)}class lr extends Ut{constructor(e){super({type:"object",check:e=>ir(e)||"function"==typeof e}),this.fields=Object.create(null),this._sortErrors=or,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var r;let s=super._cast(e,t);if(void 0===s)return this.getDefault(t);if(!this._typeCheck(s))return s;let n=this.fields,i=null!=(r=t.stripUnknown)?r:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(s).filter(e=>!this._nodes.includes(e))),o={},u=Object.assign({},t,{parent:o,__validating:t.__validating||!1}),l=!1;for(const c of a){let e=n[c],r=c in s;if(e){let r,n=s[c];u.path=(t.path?`${t.path}.`:"")+c,e=e.resolve({value:n,context:t.context,parent:o});let i=e instanceof Ut?e.spec:void 0,a=null==i?void 0:i.strict;if(null!=i&&i.strip){l=l||c in s;continue}r=t.__validating&&a?s[c]:e.cast(s[c],u),void 0!==r&&(o[c]=r)}else r&&!i&&(o[c]=s[c]);r===c in o&&o[c]===s[c]||(l=!0)}return l?o:s}_validate(e,t={},r,s){let{from:n=[],originalValue:i=e,recursive:a=this.spec.recursive}=t;t.from=[{schema:this,value:i},...n],t.__validating=!0,t.originalValue=i,super._validate(e,t,r,(e,n)=>{if(!a||!ir(n))return void s(e,n);i=i||n;let o=[];for(let r of this._nodes){let e=this.fields[r];e&&!Dt.isRef(e)&&o.push(e.asNestedTest({options:t,key:r,parent:n,parentPath:t.path,originalParent:i}))}this.runTests({tests:o,value:n,originalValue:i,options:t},r,t=>{s(t.sort(this._sortErrors).concat(e),n)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),r=t.fields;for(let[s,n]of Object.entries(this.fields)){const e=r[s];r[s]=void 0===e?n:e}return t.withMutation(t=>t.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(r=>{var s;const n=this.fields[r];let i=e;null!=(s=i)&&s.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[r]})),t[r]=n&&"getDefault"in n?n.getDefault(i):void 0}),t}setFields(e,t){let r=this.clone();return r.fields=e,r._nodes=function(e,t=[]){let r=[],s=new Set,n=new Set(t.map(([e,t])=>`${e}-${t}`));function i(e,t){let i=Be.split(e)[0];s.add(i),n.has(`${t}-${i}`)||r.push([t,i])}for(const a of Object.keys(e)){let t=e[a];s.add(a),Dt.isRef(t)&&t.isSibling?i(t.path,a):Et(t)&&"deps"in t&&t.deps.forEach(e=>i(e,a))}return nt.array(Array.from(s),r).reverse()}(e,t),r._sortErrors=rr(Object.keys(e)),t&&(r._excludedEdges=t),r}shape(e,t=[]){return this.clone().withMutation(r=>{let s=r._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),s=[...r._excludedEdges,...t]),r.setFields(Object.assign(r.fields,e),s)})}partial(){const e={};for(const[t,r]of Object.entries(this.fields))e[t]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return nr(this)}pick(e){const t={};for(const r of e)this.fields[r]&&(t[r]=this.fields[r]);return this.setFields(t,this._excludedEdges.filter(([t,r])=>e.includes(t)&&e.includes(r)))}omit(e){const t=[];for(const r of Object.keys(this.fields))e.includes(r)||t.push(r);return this.pick(t)}from(e,t,r){let s=Be.getter(e,!0);return this.transform(n=>{if(!n)return n;let i=n;return((e,t)=>{const r=[...Be.normalizePath(t)];if(1===r.length)return r[0]in e;let s=r.pop(),n=Be.getter(Be.join(r),!0)(e);return!(!n||!(s in n))})(n,e)&&(i=Object.assign({},n),r||delete i[e],i[t]=s(n)),i})}json(){return this.transform(sr)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||At.exact,test(e){if(null==e)return!0;const t=ar(this.schema,e);return 0===t.length||this.createError({params:{properties:t.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=At.noUnknown){"boolean"!=typeof e&&(t=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:t,test(t){if(null==t)return!0;const r=ar(this.schema,t);return!e||0===r.length||this.createError({params:{unknown:r.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,t=At.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const r={};for(const s of Object.keys(t))r[e(s)]=t[s];return r})}camelCase(){return this.transformKeys(et)}snakeCase(){return this.transformKeys(tt)}constantCase(){return this.transformKeys(e=>tt(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[n,i]of Object.entries(t.fields)){var s;let t=e;null!=(s=t)&&s.value&&(t=Object.assign({},t,{parent:t.value,value:t.value[n]})),r.fields[n]=i.describe(t)}return r}}function cr(e){return new dr(e)}ur.prototype=lr.prototype;class dr extends Ut{constructor(e){super({type:"array",spec:{types:e},check:e=>Array.isArray(e)}),this.innerType=void 0,this.innerType=e}_cast(e,t){const r=super._cast(e,t);if(!this._typeCheck(r)||!this.innerType)return r;let s=!1;const n=r.map((e,r)=>{const n=this.innerType.cast(e,Object.assign({},t,{path:`${t.path||""}[${r}]`}));return n!==e&&(s=!0),n});return s?n:r}_validate(e,t={},r,s){var n;let i=this.innerType,a=null!=(n=t.recursive)?n:this.spec.recursive;null!=t.originalValue&&t.originalValue,super._validate(e,t,r,(n,o)=>{var u;if(!a||!i||!this._typeCheck(o))return void s(n,o);let l=new Array(o.length);for(let r=0;rs(e.concat(n),o))})}clone(e){const t=super.clone(e);return t.innerType=this.innerType,t}json(){return this.transform(sr)}concat(e){let t=super.concat(e);return t.innerType=this.innerType,e.innerType&&(t.innerType=t.innerType?t.innerType.concat(e.innerType):e.innerType),t}of(e){let t=this.clone();if(!Et(e))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+dt(e));return t.innerType=e,t.spec=Object.assign({},t.spec,{types:e}),t}length(e,t=kt.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t){return t=t||kt.min,this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t){return t=t||kt.max,this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}ensure(){return this.default(()=>[]).transform((e,t)=>this._typeCheck(e)?e:null==t?[]:[].concat(t))}compact(e){let t=e?(t,r,s)=>!e(t,r,s):e=>!!e;return this.transform(e=>null!=e?e.filter(t):e)}describe(e){const t=(e?this.resolve(e):this).clone(),r=super.describe(e);if(t.innerType){var s;let n=e;null!=(s=n)&&s.value&&(n=Object.assign({},n,{parent:n.value,value:n.value[0]})),r.innerType=t.innerType.describe(n)}return r}}cr.prototype=dr.prototype;export{Jt as a,cr as b,ur as c,Gt as d,zt as e,Ve as f,C as g,$e as o,je as s,Te as u}; diff --git a/dist/assets/vendor-query-a3e439f2.js b/dist/assets/vendor-query-a3e439f2.js new file mode 100644 index 0000000..5420987 --- /dev/null +++ b/dist/assets/vendor-query-a3e439f2.js @@ -0,0 +1 @@ +var t,e,s,i,n,r,a,o,h,u,l,c,d,f,p,v,y,m,b,g,w,O,S,k,M,C,R,P,E,q,W,F,x,Q,A,D,T,U,_,j,K,L,I,H,G,N,B,$,z,J,Y,V,X,Z,tt,et,st,it,nt,rt,at,ot,ht,ut,lt,ct,dt,ft,pt,vt,yt,mt,bt,gt,wt,Ot,St,kt,Mt,Ct,Rt,Pt,Et,qt,Wt=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},Ft=(t,e,s)=>(Wt(t,e,"read from private field"),s?s.call(t):e.get(t)),xt=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},Qt=(t,e,s,i)=>(Wt(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),At=(t,e,s,i)=>({set _(i){Qt(t,e,i,s)},get _(){return Ft(t,e,i)}}),Dt=(t,e,s)=>(Wt(t,e,"access private method"),s);import{r as Tt}from"./vendor-react-ac1483bd.js";var Ut={exports:{}},_t={},jt=Tt,Kt=Symbol.for("react.element"),Lt=Symbol.for("react.fragment"),It=Object.prototype.hasOwnProperty,Ht=jt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Gt={key:!0,ref:!0,__self:!0,__source:!0};function Nt(t,e,s){var i,n={},r=null,a=null;for(i in void 0!==s&&(r=""+s),void 0!==e.key&&(r=""+e.key),void 0!==e.ref&&(a=e.ref),e)It.call(e,i)&&!Gt.hasOwnProperty(i)&&(n[i]=e[i]);if(t&&t.defaultProps)for(i in e=t.defaultProps)void 0===n[i]&&(n[i]=e[i]);return{$$typeof:Kt,type:t,key:r,ref:a,props:n,_owner:Ht.current}}_t.Fragment=Lt,_t.jsx=Nt,_t.jsxs=Nt,Ut.exports=_t;var Bt=Ut.exports;const $t={},zt=function(t,e,s){if(!e||0===e.length)return t();const i=document.getElementsByTagName("link");return Promise.all(e.map(t=>{if((t=function(t){return"/"+t}(t))in $t)return;$t[t]=!0;const e=t.endsWith(".css"),n=e?'[rel="stylesheet"]':"";if(!!s)for(let s=i.length-1;s>=0;s--){const n=i[s];if(n.href===t&&(!e||"stylesheet"===n.rel))return}else if(document.querySelector(`link[href="${t}"]${n}`))return;const r=document.createElement("link");return r.rel=e?"stylesheet":"modulepreload",e||(r.as="script",r.crossOrigin=""),r.href=t,document.head.appendChild(r),e?new Promise((e,s)=>{r.addEventListener("load",e),r.addEventListener("error",()=>s(new Error(`Unable to preload CSS for ${t}`)))}):void 0})).then(()=>t()).catch(t=>{const e=new Event("vite:preloadError",{cancelable:!0});if(e.payload=t,window.dispatchEvent(e),!e.defaultPrevented)throw t})};var Jt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Yt="undefined"==typeof window||"Deno"in globalThis;function Vt(){}function Xt(t){return"number"==typeof t&&t>=0&&t!==1/0}function Zt(t,e){return Math.max(t+(e||0)-Date.now(),0)}function te(t,e){return"function"==typeof t?t(e):t}function ee(t,e){return"function"==typeof t?t(e):t}function se(t,e){const{type:s="all",exact:i,fetchStatus:n,predicate:r,queryKey:a,stale:o}=t;if(a)if(i){if(e.queryHash!==ne(a,e.options))return!1}else if(!ae(e.queryKey,a))return!1;if("all"!==s){const t=e.isActive();if("active"===s&&!t)return!1;if("inactive"===s&&t)return!1}return("boolean"!=typeof o||e.isStale()===o)&&((!n||n===e.state.fetchStatus)&&!(r&&!r(e)))}function ie(t,e){const{exact:s,status:i,predicate:n,mutationKey:r}=t;if(r){if(!e.options.mutationKey)return!1;if(s){if(re(e.options.mutationKey)!==re(r))return!1}else if(!ae(e.options.mutationKey,r))return!1}return(!i||e.state.status===i)&&!(n&&!n(e))}function ne(t,e){return((null==e?void 0:e.queryKeyHashFn)||re)(t)}function re(t){return JSON.stringify(t,(t,e)=>le(e)?Object.keys(e).sort().reduce((t,s)=>(t[s]=e[s],t),{}):e)}function ae(t,e){return t===e||typeof t==typeof e&&(!(!t||!e||"object"!=typeof t||"object"!=typeof e)&&Object.keys(e).every(s=>ae(t[s],e[s])))}function oe(t,e){if(t===e)return t;const s=ue(t)&&ue(e);if(s||le(t)&&le(e)){const i=s?t:Object.keys(t),n=i.length,r=s?e:Object.keys(e),a=r.length,o=s?[]:{},h=new Set(i);let u=0;for(let l=0;ls?i.slice(1):i}function pe(t,e,s=0){const i=[e,...t];return s&&i.length>s?i.slice(0,-1):i}var ve=Symbol();function ye(t,e){return!t.queryFn&&(null==e?void 0:e.initialPromise)?()=>e.initialPromise:t.queryFn&&t.queryFn!==ve?t.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`))}function me(t,e){return"function"==typeof t?t(...e):!!t}var be=new(i=class extends Jt{constructor(){super(),xt(this,t,void 0),xt(this,e,void 0),xt(this,s,void 0),Qt(this,s,t=>{if(!Yt&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}})}onSubscribe(){Ft(this,e)||this.setEventListener(Ft(this,s))}onUnsubscribe(){var t;this.hasListeners()||(null==(t=Ft(this,e))||t.call(this),Qt(this,e,void 0))}setEventListener(t){var i;Qt(this,s,t),null==(i=Ft(this,e))||i.call(this),Qt(this,e,t(t=>{"boolean"==typeof t?this.setFocused(t):this.onFocus()}))}setFocused(e){Ft(this,t)!==e&&(Qt(this,t,e),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){var e;return"boolean"==typeof Ft(this,t)?Ft(this,t):"hidden"!==(null==(e=globalThis.document)?void 0:e.visibilityState)}},t=new WeakMap,e=new WeakMap,s=new WeakMap,i),ge=new(o=class extends Jt{constructor(){super(),xt(this,n,!0),xt(this,r,void 0),xt(this,a,void 0),Qt(this,a,t=>{if(!Yt&&window.addEventListener){const e=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}})}onSubscribe(){Ft(this,r)||this.setEventListener(Ft(this,a))}onUnsubscribe(){var t;this.hasListeners()||(null==(t=Ft(this,r))||t.call(this),Qt(this,r,void 0))}setEventListener(t){var e;Qt(this,a,t),null==(e=Ft(this,r))||e.call(this),Qt(this,r,t(this.setOnline.bind(this)))}setOnline(t){Ft(this,n)!==t&&(Qt(this,n,t),this.listeners.forEach(e=>{e(t)}))}isOnline(){return Ft(this,n)}},n=new WeakMap,r=new WeakMap,a=new WeakMap,o);function we(){let t,e;const s=new Promise((s,i)=>{t=s,e=i});function i(t){Object.assign(s,t),delete s.resolve,delete s.reject}return s.status="pending",s.catch(()=>{}),s.resolve=e=>{i({status:"fulfilled",value:e}),t(e)},s.reject=t=>{i({status:"rejected",reason:t}),e(t)},s}function Oe(t){return Math.min(1e3*2**t,3e4)}function Se(t){return"online"!==(t??"online")||ge.isOnline()}var ke=class extends Error{constructor(t){super("CancelledError"),this.revert=null==t?void 0:t.revert,this.silent=null==t?void 0:t.silent}};function Me(t){return t instanceof ke}function Ce(t){let e,s=!1,i=0,n=!1;const r=we(),a=()=>be.isFocused()&&("always"===t.networkMode||ge.isOnline())&&t.canRun(),o=()=>Se(t.networkMode)&&t.canRun(),h=s=>{var i;n||(n=!0,null==(i=t.onSuccess)||i.call(t,s),null==e||e(),r.resolve(s))},u=s=>{var i;n||(n=!0,null==(i=t.onError)||i.call(t,s),null==e||e(),r.reject(s))},l=()=>new Promise(s=>{var i;e=t=>{(n||a())&&s(t)},null==(i=t.onPause)||i.call(t)}).then(()=>{var s;e=void 0,n||null==(s=t.onContinue)||s.call(t)}),c=()=>{if(n)return;let e;const r=0===i?t.initialPromise:void 0;try{e=r??t.fn()}catch(o){e=Promise.reject(o)}Promise.resolve(e).then(h).catch(e=>{var r;if(n)return;const o=t.retry??(Yt?0:3),h=t.retryDelay??Oe,d="function"==typeof h?h(i,e):h,f=!0===o||"number"==typeof o&&i{setTimeout(t,p)})).then(()=>a()?void 0:l()).then(()=>{s?u(e):c()})):u(e)})};return{promise:r,cancel:e=>{var s;n||(u(new ke(e)),null==(s=t.abort)||s.call(t))},continue:()=>(null==e||e(),r),cancelRetry:()=>{s=!0},continueRetry:()=>{s=!1},canStart:o,start:()=>(o()?c():l().then(c),r)}}var Re=t=>setTimeout(t,0);var Pe=function(){let t=[],e=0,s=t=>{t()},i=t=>{t()},n=Re;const r=i=>{e?t.push(i):n(()=>{s(i)})};return{batch:r=>{let a;e++;try{a=r()}finally{e--,e||(()=>{const e=t;t=[],e.length&&n(()=>{i(()=>{e.forEach(t=>{s(t)})})})})()}return a},batchCalls:t=>(...e)=>{r(()=>{t(...e)})},schedule:r,setNotifyFunction:t=>{s=t},setBatchNotifyFunction:t=>{i=t},setScheduler:t=>{n=t}}}(),Ee=(u=class{constructor(){xt(this,h,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Xt(this.gcTime)&&Qt(this,h,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Yt?1/0:3e5))}clearGcTimeout(){Ft(this,h)&&(clearTimeout(Ft(this,h)),Qt(this,h,void 0))}},h=new WeakMap,u),qe=(g=class extends Ee{constructor(t){super(),xt(this,m),xt(this,l,void 0),xt(this,c,void 0),xt(this,d,void 0),xt(this,f,void 0),xt(this,p,void 0),xt(this,v,void 0),xt(this,y,void 0),Qt(this,y,!1),Qt(this,v,t.defaultOptions),this.setOptions(t.options),this.observers=[],Qt(this,f,t.client),Qt(this,d,Ft(this,f).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Qt(this,l,function(t){const e="function"==typeof t.initialData?t.initialData():t.initialData,s=void 0!==e,i=s?"function"==typeof t.initialDataUpdatedAt?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}(this.options)),this.state=t.state??Ft(this,l),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return null==(t=Ft(this,p))?void 0:t.promise}setOptions(t){this.options={...Ft(this,v),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||Ft(this,d).remove(this)}setData(t,e){const s=de(this.state.data,t,this.options);return Dt(this,m,b).call(this,{data:s,type:"success",dataUpdatedAt:null==e?void 0:e.updatedAt,manual:null==e?void 0:e.manual}),s}setState(t,e){Dt(this,m,b).call(this,{type:"setState",state:t,setStateOptions:e})}cancel(t){var e,s;const i=null==(e=Ft(this,p))?void 0:e.promise;return null==(s=Ft(this,p))||s.cancel(t),i?i.then(Vt).catch(Vt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Ft(this,l))}isActive(){return this.observers.some(t=>!1!==ee(t.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ve||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(t=>"static"===te(t.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(t=0){return void 0===this.state.data||"static"!==t&&(!!this.state.isInvalidated||!Zt(this.state.dataUpdatedAt,t))}onFocus(){var t;const e=this.observers.find(t=>t.shouldFetchOnWindowFocus());null==e||e.refetch({cancelRefetch:!1}),null==(t=Ft(this,p))||t.continue()}onOnline(){var t;const e=this.observers.find(t=>t.shouldFetchOnReconnect());null==e||e.refetch({cancelRefetch:!1}),null==(t=Ft(this,p))||t.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),Ft(this,d).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(Ft(this,p)&&(Ft(this,y)?Ft(this,p).cancel({revert:!0}):Ft(this,p).cancelRetry()),this.scheduleGc()),Ft(this,d).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Dt(this,m,b).call(this,{type:"invalidate"})}fetch(t,e){var s,i,n;if("idle"!==this.state.fetchStatus)if(void 0!==this.state.data&&(null==e?void 0:e.cancelRefetch))this.cancel({silent:!0});else if(Ft(this,p))return Ft(this,p).continueRetry(),Ft(this,p).promise;if(t&&this.setOptions(t),!this.options.queryFn){const t=this.observers.find(t=>t.options.queryFn);t&&this.setOptions(t.options)}const r=new AbortController,a=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(Qt(this,y,!0),r.signal)})},o=()=>{const t=ye(this.options,e),s=(()=>{const t={client:Ft(this,f),queryKey:this.queryKey,meta:this.meta};return a(t),t})();return Qt(this,y,!1),this.options.persister?this.options.persister(t,s,this):t(s)},h=(()=>{const t={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:Ft(this,f),state:this.state,fetchFn:o};return a(t),t})();null==(s=this.options.behavior)||s.onFetch(h,this),Qt(this,c,this.state),"idle"!==this.state.fetchStatus&&this.state.fetchMeta===(null==(i=h.fetchOptions)?void 0:i.meta)||Dt(this,m,b).call(this,{type:"fetch",meta:null==(n=h.fetchOptions)?void 0:n.meta});const u=t=>{var e,s,i,n;Me(t)&&t.silent||Dt(this,m,b).call(this,{type:"error",error:t}),Me(t)||(null==(s=(e=Ft(this,d).config).onError)||s.call(e,t,this),null==(n=(i=Ft(this,d).config).onSettled)||n.call(i,this.state.data,t,this)),this.scheduleGc()};return Qt(this,p,Ce({initialPromise:null==e?void 0:e.initialPromise,fn:h.fetchFn,abort:r.abort.bind(r),onSuccess:t=>{var e,s,i,n;if(void 0!==t){try{this.setData(t)}catch(r){return void u(r)}null==(s=(e=Ft(this,d).config).onSuccess)||s.call(e,t,this),null==(n=(i=Ft(this,d).config).onSettled)||n.call(i,t,this.state.error,this),this.scheduleGc()}else u(new Error(`${this.queryHash} data is undefined`))},onError:u,onFail:(t,e)=>{Dt(this,m,b).call(this,{type:"failed",failureCount:t,error:e})},onPause:()=>{Dt(this,m,b).call(this,{type:"pause"})},onContinue:()=>{Dt(this,m,b).call(this,{type:"continue"})},retry:h.options.retry,retryDelay:h.options.retryDelay,networkMode:h.options.networkMode,canRun:()=>!0})),Ft(this,p).start()}},l=new WeakMap,c=new WeakMap,d=new WeakMap,f=new WeakMap,p=new WeakMap,v=new WeakMap,y=new WeakMap,m=new WeakSet,b=function(t){this.state=(e=>{switch(t.type){case"failed":return{...e,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...e,fetchStatus:"paused"};case"continue":return{...e,fetchStatus:"fetching"};case"fetch":return{...e,...We(e.data,this.options),fetchMeta:t.meta??null};case"success":return{...e,data:t.data,dataUpdateCount:e.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=t.error;return Me(s)&&s.revert&&Ft(this,c)?{...Ft(this,c),fetchStatus:"idle"}:{...e,error:s,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...e,isInvalidated:!0};case"setState":return{...e,...t.state}}})(this.state),Pe.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),Ft(this,d).notify({query:this,type:"updated",action:t})})},g);function We(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Se(e.networkMode)?"fetching":"paused",...void 0===t&&{error:null,status:"pending"}}}var Fe=(O=class extends Jt{constructor(t={}){super(),xt(this,w,void 0),this.config=t,Qt(this,w,new Map)}build(t,e,s){const i=e.queryKey,n=e.queryHash??ne(i,e);let r=this.get(n);return r||(r=new qe({client:t,queryKey:i,queryHash:n,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(i)}),this.add(r)),r}add(t){Ft(this,w).has(t.queryHash)||(Ft(this,w).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=Ft(this,w).get(t.queryHash);e&&(t.destroy(),e===t&&Ft(this,w).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Pe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return Ft(this,w).get(t)}getAll(){return[...Ft(this,w).values()]}find(t){const e={exact:!0,...t};return this.getAll().find(t=>se(e,t))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(e=>se(t,e)):e}notify(t){Pe.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){Pe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Pe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},w=new WeakMap,O),xe=(P=class extends Ee{constructor(t){super(),xt(this,C),xt(this,S,void 0),xt(this,k,void 0),xt(this,M,void 0),this.mutationId=t.mutationId,Qt(this,k,t.mutationCache),Qt(this,S,[]),this.state=t.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){Ft(this,S).includes(t)||(Ft(this,S).push(t),this.clearGcTimeout(),Ft(this,k).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Qt(this,S,Ft(this,S).filter(e=>e!==t)),this.scheduleGc(),Ft(this,k).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){Ft(this,S).length||("pending"===this.state.status?this.scheduleGc():Ft(this,k).remove(this))}continue(){var t;return(null==(t=Ft(this,M))?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var e,s,i,n,r,a,o,h,u,l,c,d,f,p,v,y,m,b,g,w;const O=()=>{Dt(this,C,R).call(this,{type:"continue"})};Qt(this,M,Ce({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(t,e)=>{Dt(this,C,R).call(this,{type:"failed",failureCount:t,error:e})},onPause:()=>{Dt(this,C,R).call(this,{type:"pause"})},onContinue:O,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Ft(this,k).canRun(this)}));const S="pending"===this.state.status,P=!Ft(this,M).canStart();try{if(S)O();else{Dt(this,C,R).call(this,{type:"pending",variables:t,isPaused:P}),await(null==(s=(e=Ft(this,k).config).onMutate)?void 0:s.call(e,t,this));const r=await(null==(n=(i=this.options).onMutate)?void 0:n.call(i,t));r!==this.state.context&&Dt(this,C,R).call(this,{type:"pending",context:r,variables:t,isPaused:P})}const f=await Ft(this,M).start();return await(null==(a=(r=Ft(this,k).config).onSuccess)?void 0:a.call(r,f,t,this.state.context,this)),await(null==(h=(o=this.options).onSuccess)?void 0:h.call(o,f,t,this.state.context)),await(null==(l=(u=Ft(this,k).config).onSettled)?void 0:l.call(u,f,null,this.state.variables,this.state.context,this)),await(null==(d=(c=this.options).onSettled)?void 0:d.call(c,f,null,t,this.state.context)),Dt(this,C,R).call(this,{type:"success",data:f}),f}catch(E){try{throw await(null==(p=(f=Ft(this,k).config).onError)?void 0:p.call(f,E,t,this.state.context,this)),await(null==(y=(v=this.options).onError)?void 0:y.call(v,E,t,this.state.context)),await(null==(b=(m=Ft(this,k).config).onSettled)?void 0:b.call(m,void 0,E,this.state.variables,this.state.context,this)),await(null==(w=(g=this.options).onSettled)?void 0:w.call(g,void 0,E,t,this.state.context)),E}finally{Dt(this,C,R).call(this,{type:"error",error:E})}}finally{Ft(this,k).runNext(this)}}},S=new WeakMap,k=new WeakMap,M=new WeakMap,C=new WeakSet,R=function(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),Pe.batch(()=>{Ft(this,S).forEach(e=>{e.onMutationUpdate(t)}),Ft(this,k).notify({mutation:this,type:"updated",action:t})})},P);var Qe=(F=class extends Jt{constructor(t={}){super(),xt(this,E,void 0),xt(this,q,void 0),xt(this,W,void 0),this.config=t,Qt(this,E,new Set),Qt(this,q,new Map),Qt(this,W,0)}build(t,e,s){const i=new xe({mutationCache:this,mutationId:++At(this,W)._,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){Ft(this,E).add(t);const e=Ae(t);if("string"==typeof e){const s=Ft(this,q).get(e);s?s.push(t):Ft(this,q).set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(Ft(this,E).delete(t)){const e=Ae(t);if("string"==typeof e){const s=Ft(this,q).get(e);if(s)if(s.length>1){const e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&Ft(this,q).delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=Ae(t);if("string"==typeof e){const s=Ft(this,q).get(e),i=null==s?void 0:s.find(t=>"pending"===t.state.status);return!i||i===t}return!0}runNext(t){var e;const s=Ae(t);if("string"==typeof s){const i=null==(e=Ft(this,q).get(s))?void 0:e.find(e=>e!==t&&e.state.isPaused);return(null==i?void 0:i.continue())??Promise.resolve()}return Promise.resolve()}clear(){Pe.batch(()=>{Ft(this,E).forEach(t=>{this.notify({type:"removed",mutation:t})}),Ft(this,E).clear(),Ft(this,q).clear()})}getAll(){return Array.from(Ft(this,E))}find(t){const e={exact:!0,...t};return this.getAll().find(t=>ie(e,t))}findAll(t={}){return this.getAll().filter(e=>ie(t,e))}notify(t){Pe.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(t=>t.state.isPaused);return Pe.batch(()=>Promise.all(t.map(t=>t.continue().catch(Vt))))}},E=new WeakMap,q=new WeakMap,W=new WeakMap,F);function Ae(t){var e;return null==(e=t.options.scope)?void 0:e.id}function De(t){return{onFetch:(e,s)=>{var i,n,r,a,o;const h=e.options,u=null==(r=null==(n=null==(i=e.fetchOptions)?void 0:i.meta)?void 0:n.fetchMore)?void 0:r.direction,l=(null==(a=e.state.data)?void 0:a.pages)||[],c=(null==(o=e.state.data)?void 0:o.pageParams)||[];let d={pages:[],pageParams:[]},f=0;const p=async()=>{let s=!1;const i=ye(e.options,e.fetchOptions),n=async(t,n,r)=>{if(s)return Promise.reject();if(null==n&&t.pages.length)return Promise.resolve(t);const a=(()=>{const t={client:e.client,queryKey:e.queryKey,pageParam:n,direction:r?"backward":"forward",meta:e.options.meta};var i;return i=t,Object.defineProperty(i,"signal",{enumerable:!0,get:()=>(e.signal.aborted?s=!0:e.signal.addEventListener("abort",()=>{s=!0}),e.signal)}),t})(),o=await i(a),{maxPages:h}=e.options,u=r?pe:fe;return{pages:u(t.pages,o,h),pageParams:u(t.pageParams,n,h)}};if(u&&l.length){const t="backward"===u,e={pages:l,pageParams:c},s=(t?Ue:Te)(h,e);d=await n(e,s,t)}else{const e=t??l.length;do{const t=0===f?c[0]??h.initialPageParam:Te(h,d);if(f>0&&null==t)break;d=await n(d,t),f++}while(f{var t,i;return null==(i=(t=e.options).persister)?void 0:i.call(t,p,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s)}:e.fetchFn=p}}}function Te(t,{pages:e,pageParams:s}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,s[i],s):void 0}function Ue(t,{pages:e,pageParams:s}){var i;return e.length>0?null==(i=t.getPreviousPageParam)?void 0:i.call(t,e[0],e,s[0],s):void 0}var _e=(K=class{constructor(t={}){xt(this,x,void 0),xt(this,Q,void 0),xt(this,A,void 0),xt(this,D,void 0),xt(this,T,void 0),xt(this,U,void 0),xt(this,_,void 0),xt(this,j,void 0),Qt(this,x,t.queryCache||new Fe),Qt(this,Q,t.mutationCache||new Qe),Qt(this,A,t.defaultOptions||{}),Qt(this,D,new Map),Qt(this,T,new Map),Qt(this,U,0)}mount(){At(this,U)._++,1===Ft(this,U)&&(Qt(this,_,be.subscribe(async t=>{t&&(await this.resumePausedMutations(),Ft(this,x).onFocus())})),Qt(this,j,ge.subscribe(async t=>{t&&(await this.resumePausedMutations(),Ft(this,x).onOnline())})))}unmount(){var t,e;At(this,U)._--,0===Ft(this,U)&&(null==(t=Ft(this,_))||t.call(this),Qt(this,_,void 0),null==(e=Ft(this,j))||e.call(this),Qt(this,j,void 0))}isFetching(t){return Ft(this,x).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return Ft(this,Q).findAll({...t,status:"pending"}).length}getQueryData(t){var e;const s=this.defaultQueryOptions({queryKey:t});return null==(e=Ft(this,x).get(s.queryHash))?void 0:e.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=Ft(this,x).build(this,e),i=s.state.data;return void 0===i?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(te(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return Ft(this,x).findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){const i=this.defaultQueryOptions({queryKey:t}),n=Ft(this,x).get(i.queryHash),r=function(t,e){return"function"==typeof t?t(e):t}(e,null==n?void 0:n.state.data);if(void 0!==r)return Ft(this,x).build(this,i).setData(r,{...s,manual:!0})}setQueriesData(t,e,s){return Pe.batch(()=>Ft(this,x).findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){var e;const s=this.defaultQueryOptions({queryKey:t});return null==(e=Ft(this,x).get(s.queryHash))?void 0:e.state}removeQueries(t){const e=Ft(this,x);Pe.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){const s=Ft(this,x);return Pe.batch(()=>(s.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const s={revert:!0,...e},i=Pe.batch(()=>Ft(this,x).findAll(t).map(t=>t.cancel(s)));return Promise.all(i).then(Vt).catch(Vt)}invalidateQueries(t,e={}){return Pe.batch(()=>(Ft(this,x).findAll(t).forEach(t=>{t.invalidate()}),"none"===(null==t?void 0:t.refetchType)?Promise.resolve():this.refetchQueries({...t,type:(null==t?void 0:t.refetchType)??(null==t?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const s={...e,cancelRefetch:e.cancelRefetch??!0},i=Pe.batch(()=>Ft(this,x).findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let e=t.fetch(void 0,s);return s.throwOnError||(e=e.catch(Vt)),"paused"===t.state.fetchStatus?Promise.resolve():e}));return Promise.all(i).then(Vt)}fetchQuery(t){const e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);const s=Ft(this,x).build(this,e);return s.isStaleByTime(te(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Vt).catch(Vt)}fetchInfiniteQuery(t){return t.behavior=De(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Vt).catch(Vt)}ensureInfiniteQueryData(t){return t.behavior=De(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return ge.isOnline()?Ft(this,Q).resumePausedMutations():Promise.resolve()}getQueryCache(){return Ft(this,x)}getMutationCache(){return Ft(this,Q)}getDefaultOptions(){return Ft(this,A)}setDefaultOptions(t){Qt(this,A,t)}setQueryDefaults(t,e){Ft(this,D).set(re(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...Ft(this,D).values()],s={};return e.forEach(e=>{ae(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){Ft(this,T).set(re(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...Ft(this,T).values()],s={};return e.forEach(e=>{ae(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...Ft(this,A).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=ne(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===ve&&(e.enabled=!1),e}defaultMutationOptions(t){return(null==t?void 0:t._defaulted)?t:{...Ft(this,A).mutations,...(null==t?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){Ft(this,x).clear(),Ft(this,Q).clear()}},x=new WeakMap,Q=new WeakMap,A=new WeakMap,D=new WeakMap,T=new WeakMap,U=new WeakMap,_=new WeakMap,j=new WeakMap,K),je=(wt=class extends Jt{constructor(t,e){super(),xt(this,st),xt(this,nt),xt(this,at),xt(this,ht),xt(this,lt),xt(this,dt),xt(this,pt),xt(this,yt),xt(this,bt),xt(this,L,void 0),xt(this,I,void 0),xt(this,H,void 0),xt(this,G,void 0),xt(this,N,void 0),xt(this,B,void 0),xt(this,$,void 0),xt(this,z,void 0),xt(this,J,void 0),xt(this,Y,void 0),xt(this,V,void 0),xt(this,X,void 0),xt(this,Z,void 0),xt(this,tt,void 0),xt(this,et,new Set),this.options=e,Qt(this,L,t),Qt(this,z,null),Qt(this,$,we()),this.options.experimental_prefetchInRender||Ft(this,$).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(Ft(this,I).addObserver(this),Ke(Ft(this,I),this.options)?Dt(this,st,it).call(this):this.updateResult(),Dt(this,lt,ct).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Le(Ft(this,I),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Le(Ft(this,I),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Dt(this,dt,ft).call(this),Dt(this,pt,vt).call(this),Ft(this,I).removeObserver(this)}setOptions(t){const e=this.options,s=Ft(this,I);if(this.options=Ft(this,L).defaultQueryOptions(t),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof ee(this.options.enabled,Ft(this,I)))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Dt(this,yt,mt).call(this),Ft(this,I).setOptions(this.options),e._defaulted&&!he(this.options,e)&&Ft(this,L).getQueryCache().notify({type:"observerOptionsUpdated",query:Ft(this,I),observer:this});const i=this.hasListeners();i&&Ie(Ft(this,I),s,this.options,e)&&Dt(this,st,it).call(this),this.updateResult(),!i||Ft(this,I)===s&&ee(this.options.enabled,Ft(this,I))===ee(e.enabled,Ft(this,I))&&te(this.options.staleTime,Ft(this,I))===te(e.staleTime,Ft(this,I))||Dt(this,nt,rt).call(this);const n=Dt(this,at,ot).call(this);!i||Ft(this,I)===s&&ee(this.options.enabled,Ft(this,I))===ee(e.enabled,Ft(this,I))&&n===Ft(this,tt)||Dt(this,ht,ut).call(this,n)}getOptimisticResult(t){const e=Ft(this,L).getQueryCache().build(Ft(this,L),t),s=this.createResult(e,t);return function(t,e){if(!he(t.getCurrentResult(),e))return!0;return!1}(this,s)&&(Qt(this,G,s),Qt(this,B,this.options),Qt(this,N,Ft(this,I).state)),s}getCurrentResult(){return Ft(this,G)}trackResult(t,e){return new Proxy(t,{get:(t,s)=>(this.trackProp(s),null==e||e(s),Reflect.get(t,s))})}trackProp(t){Ft(this,et).add(t)}getCurrentQuery(){return Ft(this,I)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=Ft(this,L).defaultQueryOptions(t),s=Ft(this,L).getQueryCache().build(Ft(this,L),e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return Dt(this,st,it).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),Ft(this,G)))}createResult(t,e){var s;const i=Ft(this,I),n=this.options,r=Ft(this,G),a=Ft(this,N),o=Ft(this,B),h=t!==i?t.state:Ft(this,H),{state:u}=t;let l,c={...u},d=!1;if(e._optimisticResults){const s=this.hasListeners(),r=!s&&Ke(t,e),a=s&&Ie(t,i,e,n);(r||a)&&(c={...c,...We(u.data,t.options)}),"isRestoring"===e._optimisticResults&&(c.fetchStatus="idle")}let{error:f,errorUpdatedAt:p,status:v}=c;l=c.data;let y=!1;if(void 0!==e.placeholderData&&void 0===l&&"pending"===v){let t;(null==r?void 0:r.isPlaceholderData)&&e.placeholderData===(null==o?void 0:o.placeholderData)?(t=r.data,y=!0):t="function"==typeof e.placeholderData?e.placeholderData(null==(s=Ft(this,V))?void 0:s.state.data,Ft(this,V)):e.placeholderData,void 0!==t&&(v="success",l=de(null==r?void 0:r.data,t,e),d=!0)}if(e.select&&void 0!==l&&!y)if(r&&l===(null==a?void 0:a.data)&&e.select===Ft(this,J))l=Ft(this,Y);else try{Qt(this,J,e.select),l=e.select(l),l=de(null==r?void 0:r.data,l,e),Qt(this,Y,l),Qt(this,z,null)}catch(k){Qt(this,z,k)}Ft(this,z)&&(f=Ft(this,z),l=Ft(this,Y),p=Date.now(),v="error");const m="fetching"===c.fetchStatus,b="pending"===v,g="error"===v,w=b&&m,O=void 0!==l,S={status:v,fetchStatus:c.fetchStatus,isPending:b,isSuccess:"success"===v,isError:g,isInitialLoading:w,isLoading:w,data:l,dataUpdatedAt:c.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>h.dataUpdateCount||c.errorUpdateCount>h.errorUpdateCount,isFetching:m,isRefetching:m&&!b,isLoadingError:g&&!O,isPaused:"paused"===c.fetchStatus,isPlaceholderData:d,isRefetchError:g&&O,isStale:He(t,e),refetch:this.refetch,promise:Ft(this,$)};if(this.options.experimental_prefetchInRender){const e=t=>{"error"===S.status?t.reject(S.error):void 0!==S.data&&t.resolve(S.data)},s=()=>{const t=Qt(this,$,S.promise=we());e(t)},n=Ft(this,$);switch(n.status){case"pending":t.queryHash===i.queryHash&&e(n);break;case"fulfilled":"error"!==S.status&&S.data===n.value||s();break;case"rejected":"error"===S.status&&S.error===n.reason||s()}}return S}updateResult(){const t=Ft(this,G),e=this.createResult(Ft(this,I),this.options);if(Qt(this,N,Ft(this,I).state),Qt(this,B,this.options),void 0!==Ft(this,N).data&&Qt(this,V,Ft(this,I)),he(e,t))return;Qt(this,G,e);Dt(this,bt,gt).call(this,{listeners:(()=>{if(!t)return!0;const{notifyOnChangeProps:e}=this.options,s="function"==typeof e?e():e;if("all"===s||!s&&!Ft(this,et).size)return!0;const i=new Set(s??Ft(this,et));return this.options.throwOnError&&i.add("error"),Object.keys(Ft(this,G)).some(e=>{const s=e;return Ft(this,G)[s]!==t[s]&&i.has(s)})})()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Dt(this,lt,ct).call(this)}},L=new WeakMap,I=new WeakMap,H=new WeakMap,G=new WeakMap,N=new WeakMap,B=new WeakMap,$=new WeakMap,z=new WeakMap,J=new WeakMap,Y=new WeakMap,V=new WeakMap,X=new WeakMap,Z=new WeakMap,tt=new WeakMap,et=new WeakMap,st=new WeakSet,it=function(t){Dt(this,yt,mt).call(this);let e=Ft(this,I).fetch(this.options,t);return(null==t?void 0:t.throwOnError)||(e=e.catch(Vt)),e},nt=new WeakSet,rt=function(){Dt(this,dt,ft).call(this);const t=te(this.options.staleTime,Ft(this,I));if(Yt||Ft(this,G).isStale||!Xt(t))return;const e=Zt(Ft(this,G).dataUpdatedAt,t);Qt(this,X,setTimeout(()=>{Ft(this,G).isStale||this.updateResult()},e+1))},at=new WeakSet,ot=function(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(Ft(this,I)):this.options.refetchInterval)??!1},ht=new WeakSet,ut=function(t){Dt(this,pt,vt).call(this),Qt(this,tt,t),!Yt&&!1!==ee(this.options.enabled,Ft(this,I))&&Xt(Ft(this,tt))&&0!==Ft(this,tt)&&Qt(this,Z,setInterval(()=>{(this.options.refetchIntervalInBackground||be.isFocused())&&Dt(this,st,it).call(this)},Ft(this,tt)))},lt=new WeakSet,ct=function(){Dt(this,nt,rt).call(this),Dt(this,ht,ut).call(this,Dt(this,at,ot).call(this))},dt=new WeakSet,ft=function(){Ft(this,X)&&(clearTimeout(Ft(this,X)),Qt(this,X,void 0))},pt=new WeakSet,vt=function(){Ft(this,Z)&&(clearInterval(Ft(this,Z)),Qt(this,Z,void 0))},yt=new WeakSet,mt=function(){const t=Ft(this,L).getQueryCache().build(Ft(this,L),this.options);if(t===Ft(this,I))return;const e=Ft(this,I);Qt(this,I,t),Qt(this,H,t.state),this.hasListeners()&&(null==e||e.removeObserver(this),t.addObserver(this))},bt=new WeakSet,gt=function(t){Pe.batch(()=>{t.listeners&&this.listeners.forEach(t=>{t(Ft(this,G))}),Ft(this,L).getQueryCache().notify({query:Ft(this,I),type:"observerResultsUpdated"})})},wt);function Ke(t,e){return function(t,e){return!1!==ee(e.enabled,t)&&void 0===t.state.data&&!("error"===t.state.status&&!1===e.retryOnMount)}(t,e)||void 0!==t.state.data&&Le(t,e,e.refetchOnMount)}function Le(t,e,s){if(!1!==ee(e.enabled,t)&&"static"!==te(e.staleTime,t)){const i="function"==typeof s?s(t):s;return"always"===i||!1!==i&&He(t,e)}return!1}function Ie(t,e,s,i){return(t!==e||!1===ee(i.enabled,t))&&(!s.suspense||"error"!==t.state.status)&&He(t,s)}function He(t,e){return!1!==ee(e.enabled,t)&&t.isStaleByTime(te(e.staleTime,t))}var Ge=(qt=class extends Jt{constructor(t,e){super(),xt(this,Ct),xt(this,Pt),xt(this,Ot,void 0),xt(this,St,void 0),xt(this,kt,void 0),xt(this,Mt,void 0),Qt(this,Ot,t),this.setOptions(e),this.bindMethods(),Dt(this,Ct,Rt).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var e;const s=this.options;this.options=Ft(this,Ot).defaultMutationOptions(t),he(this.options,s)||Ft(this,Ot).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Ft(this,kt),observer:this}),(null==s?void 0:s.mutationKey)&&this.options.mutationKey&&re(s.mutationKey)!==re(this.options.mutationKey)?this.reset():"pending"===(null==(e=Ft(this,kt))?void 0:e.state.status)&&Ft(this,kt).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||null==(t=Ft(this,kt))||t.removeObserver(this)}onMutationUpdate(t){Dt(this,Ct,Rt).call(this),Dt(this,Pt,Et).call(this,t)}getCurrentResult(){return Ft(this,St)}reset(){var t;null==(t=Ft(this,kt))||t.removeObserver(this),Qt(this,kt,void 0),Dt(this,Ct,Rt).call(this),Dt(this,Pt,Et).call(this)}mutate(t,e){var s;return Qt(this,Mt,e),null==(s=Ft(this,kt))||s.removeObserver(this),Qt(this,kt,Ft(this,Ot).getMutationCache().build(Ft(this,Ot),this.options)),Ft(this,kt).addObserver(this),Ft(this,kt).execute(t)}},Ot=new WeakMap,St=new WeakMap,kt=new WeakMap,Mt=new WeakMap,Ct=new WeakSet,Rt=function(){var t;const e=(null==(t=Ft(this,kt))?void 0:t.state)??{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0};Qt(this,St,{...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset})},Pt=new WeakSet,Et=function(t){Pe.batch(()=>{var e,s,i,n,r,a,o,h;if(Ft(this,Mt)&&this.hasListeners()){const u=Ft(this,St).variables,l=Ft(this,St).context;"success"===(null==t?void 0:t.type)?(null==(s=(e=Ft(this,Mt)).onSuccess)||s.call(e,t.data,u,l),null==(n=(i=Ft(this,Mt)).onSettled)||n.call(i,t.data,null,u,l)):"error"===(null==t?void 0:t.type)&&(null==(a=(r=Ft(this,Mt)).onError)||a.call(r,t.error,u,l),null==(h=(o=Ft(this,Mt)).onSettled)||h.call(o,void 0,t.error,u,l))}this.listeners.forEach(t=>{t(Ft(this,St))})})},qt),Ne=Tt.createContext(void 0),Be=t=>{const e=Tt.useContext(Ne);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},$e=({client:t,children:e})=>(Tt.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),Bt.jsx(Ne.Provider,{value:t,children:e})),ze=Tt.createContext(!1);ze.Provider;var Je=Tt.createContext(function(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}()),Ye=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function Ve(t,e,s){var i,n,r,a,o;const h=Tt.useContext(ze),u=Tt.useContext(Je),l=Be(s),c=l.defaultQueryOptions(t);null==(n=null==(i=l.getDefaultOptions().queries)?void 0:i._experimental_beforeQuery)||n.call(i,c),c._optimisticResults=h?"isRestoring":"optimistic",(t=>{if(t.suspense){const e=t=>"static"===t?t:Math.max(t??1e3,1e3),s=t.staleTime;t.staleTime="function"==typeof s?(...t)=>e(s(...t)):e(s),"number"==typeof t.gcTime&&(t.gcTime=Math.max(t.gcTime,1e3))}})(c),((t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))})(c,u),(t=>{Tt.useEffect(()=>{t.clearReset()},[t])})(u);const d=!l.getQueryCache().get(c.queryHash),[f]=Tt.useState(()=>new e(l,c)),p=f.getOptimisticResult(c),v=!h&&!1!==t.subscribed;if(Tt.useSyncExternalStore(Tt.useCallback(t=>{const e=v?f.subscribe(Pe.batchCalls(t)):Vt;return f.updateResult(),e},[f,v]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),Tt.useEffect(()=>{f.setOptions(c)},[c,f]),((t,e)=>(null==t?void 0:t.suspense)&&e.isPending)(c,p))throw Ye(c,f,u);if((({result:t,errorResetBoundary:e,throwOnError:s,query:i,suspense:n})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&(n&&void 0===t.data||me(s,[t.error,i])))({result:p,errorResetBoundary:u,throwOnError:c.throwOnError,query:l.getQueryCache().get(c.queryHash),suspense:c.suspense}))throw p.error;if(null==(a=null==(r=l.getDefaultOptions().queries)?void 0:r._experimental_afterQuery)||a.call(r,c,p),c.experimental_prefetchInRender&&!Yt&&((t,e)=>t.isLoading&&t.isFetching&&!e)(p,h)){const t=d?Ye(c,f,u):null==(o=l.getQueryCache().get(c.queryHash))?void 0:o.promise;null==t||t.catch(Vt).finally(()=>{f.updateResult()})}return c.notifyOnChangeProps?p:f.trackResult(p)}function Xe(t,e){return Ve(t,je,e)}function Ze(t,e){const s=Be(e),[i]=Tt.useState(()=>new Ge(s,t));Tt.useEffect(()=>{i.setOptions(t)},[i,t]);const n=Tt.useSyncExternalStore(Tt.useCallback(t=>i.subscribe(Pe.batchCalls(t)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),r=Tt.useCallback((t,e)=>{i.mutate(t,e).catch(Vt)},[i]);if(n.error&&me(i.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:r,mutateAsync:n.mutate}}var ts=function(){return null};export{_e as Q,ts as R,zt as _,$e as a,Xe as b,Be as c,Bt as j,Ze as u}; diff --git a/dist/assets/vendor-react-ac1483bd.js b/dist/assets/vendor-react-ac1483bd.js new file mode 100644 index 0000000..7525aea --- /dev/null +++ b/dist/assets/vendor-react-ac1483bd.js @@ -0,0 +1,51 @@ +function e(e,t){for(var n=0;nr[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r={exports:{}},a={},l=Symbol.for("react.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),v=Symbol.iterator;var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,b={};function w(e,t,n){this.props=e,this.context=t,this.refs=b,this.updater=n||g}function k(){}function S(e,t,n){this.props=e,this.context=t,this.refs=b,this.updater=n||g}w.prototype.isReactComponent={},w.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},w.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},k.prototype=w.prototype;var x=S.prototype=new k;x.constructor=S,y(x,w.prototype),x.isPureReactComponent=!0;var E=Array.isArray,C=Object.prototype.hasOwnProperty,_={current:null},P={key:!0,ref:!0,__self:!0,__source:!0};function N(e,t,n){var r,a={},o=null,i=null;if(null!=t)for(r in void 0!==t.ref&&(i=t.ref),void 0!==t.key&&(o=""+t.key),t)C.call(t,r)&&!P.hasOwnProperty(r)&&(a[r]=t[r]);var u=arguments.length-2;if(1===u)a.children=n;else if(1>>1,l=e[r];if(!(0>>1;ra(u,n))sa(c,u)?(e[r]=c,e[s]=n,r=s):(e[r]=u,e[i]=n,r=i);else{if(!(sa(c,n)))break e;e[r]=c,e[s]=n,r=s}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var l=performance;e.unstable_now=function(){return l.now()}}else{var o=Date,i=o.now();e.unstable_now=function(){return o.now()-i}}var u=[],s=[],c=1,f=null,d=3,p=!1,h=!1,m=!1,v="function"==typeof setTimeout?setTimeout:null,g="function"==typeof clearTimeout?clearTimeout:null,y="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var a=n(s);null!==a;){if(null===a.callback)r(s);else{if(!(a.startTime<=e))break;r(s),a.sortIndex=a.expirationTime,t(u,a)}a=n(s)}}function w(e){if(m=!1,b(e),!h)if(null!==n(u))h=!0,R(k);else{var t=n(s);null!==t&&O(w,t.startTime-e)}}function k(t,a){h=!1,m&&(m=!1,g(C),C=-1),p=!0;var l=d;try{for(b(a),f=n(u);null!==f&&(!(f.expirationTime>a)||t&&!N());){var o=f.callback;if("function"==typeof o){f.callback=null,d=f.priorityLevel;var i=o(f.expirationTime<=a);a=e.unstable_now(),"function"==typeof i?f.callback=i:f===n(u)&&r(u),b(a)}else r(u);f=n(u)}if(null!==f)var c=!0;else{var v=n(s);null!==v&&O(w,v.startTime-a),c=!1}return c}finally{f=null,d=l,p=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var S,x=!1,E=null,C=-1,_=5,P=-1;function N(){return!(e.unstable_now()-P<_)}function z(){if(null!==E){var t=e.unstable_now();P=t;var n=!0;try{n=E(!0,t)}finally{n?S():(x=!1,E=null)}}else x=!1}if("function"==typeof y)S=function(){y(z)};else if("undefined"!=typeof MessageChannel){var L=new MessageChannel,T=L.port2;L.port1.onmessage=z,S=function(){T.postMessage(null)}}else S=function(){v(z,0)};function R(e){E=e,x||(x=!0,S())}function O(t,n){C=v(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){h||p||(h=!0,R(k))},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=l,t(s,r),null===n(u)&&r===n(s)&&(m?(g(C),C=-1):m=!0,O(w,l-o))):(r.sortIndex=i,t(u,r),h||p||(h=!0,R(k))),r},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(e){var t=d;return function(){var n=d;d=t;try{return e.apply(this,arguments)}finally{d=n}}}}(H),W.exports=H;var Q=W.exports,K=j,q=Q; +/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */function Y(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n