@shophost/react 2.0.9 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin-client.cjs +1 -1
- package/admin-client.js +910 -910
- package/package.json +3 -3
- package/storefront/providers/api-provider.d.ts +1 -0
package/admin-client.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";const e=require("react/jsx-runtime"),F=require("react-hook-form"),A=require("lucide-react"),x=require("react"),ia=require("@vercel/blob/client"),xe=require("next/image.js"),R=require("@tanstack/react-query"),Fe=require("use-debounce"),w=require("classnames"),Ci=require("use-mask-input"),it=require("@headlessui/react"),Q=require("next/navigation.js"),ue=require("@hookform/resolvers/zod"),H=require("next/link.js"),T=require("date-fns"),C=require("@remixicon/react"),na=require("next-themes"),X=require("react-hot-toast"),Ct=require("better-auth/client/plugins"),oa=require("better-auth/react"),Pi=require("@shophost/client"),m=require("@hono/zod-openapi"),ps=require("@radix-ui/react-slot"),Se=require("tailwind-variants"),la=require("clsx"),da=require("tailwind-merge"),V=require("cmdk"),Ti=require("@radix-ui/react-dialog"),Qi=require("@radix-ui/react-popover"),zi=require("react-phone-number-input"),ca=require("react-phone-number-input/flags"),Ii=require("@radix-ui/react-switch"),Li=require("@radix-ui/react-label"),Ei=require("@radix-ui/react-radio-group"),oe=require("recharts"),Di=require("@radix-ui/react-checkbox"),te=require("@internationalized/date"),ua=require("@react-aria/datepicker"),Mi=require("@react-stately/datepicker"),Bi=require("date-fns/locale"),jt=require("react-day-picker"),Ji=require("@radix-ui/react-select"),Oi=require("@radix-ui/react-navigation-menu"),ge=require("@tanstack/react-table"),Fi=require("@radix-ui/react-dropdown-menu");function ke(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const N=ke(x),Z=ke(Ti),_=ke(Qi),Dt=ke(zi),Pt=ke(Ii),pa=ke(Li),ms=ke(Ei),Zs=ke(Di),G=ke(Ji),Tt=ke(Oi),re=ke(Fi),Us="shophost-cart",Vi={items:[],isInitialized:!1,isModifiersModalOpen:!1,selectedProduct:null,onModalAddToCart:void 0,totalAmount:0,itemCount:0,removedItemsAlert:!1},Hi=(t,s)=>t.reduce((a,r)=>{const i=s(r.productId);if(!i)return a;const n=r.quantity||1;let l=Number(i.discountedBasePrice??i.basePrice??0)*n;return r.modifierGroups&&r.modifierGroups.length>0&&r.modifierGroups.forEach(d=>{var u;const c=(u=i.modifierGroups)==null?void 0:u.find(p=>p.id===d.id);c&&d.modifiers.forEach(p=>{const g=c.modifiers.find(h=>h.id===p.id);if(g){const h=p.quantity||1;l+=Number(g.price??0)*h*n}})}),a+l},0),ye=(t,s="USD",a="en-US")=>new Intl.NumberFormat(a,{style:"currency",currency:s}).format(t),Zi=(t,s,a="en-US")=>{const r=s(t.productId);return!r||!t.modifierGroups||t.modifierGroups.length===0?"":t.modifierGroups.filter(i=>i&&i.modifiers).map(i=>{var d,c,u,p;const n=(d=r.modifierGroups)==null?void 0:d.find(g=>g&&g.id===i.id);if(!n||!n.modifiers)return"";const o=((u=(c=n.translations)==null?void 0:c.find(g=>g&&g.locale===a))==null?void 0:u.title)||(n.translations&&n.translations.length>0?(p=n.translations[0])==null?void 0:p.title:"")||"",l=(i.modifiers||[]).filter(g=>g).map(g=>{const h=n.modifiers.find(f=>f&&f.id===g.id);if(!h)return"";const y=h.title||"",b=g.quantity||1;return b>1?`${y} (${b})`:y}).filter(Boolean).join(", ");return o?`${o}: ${l}`:l}).filter(Boolean).join(" | ")},Ui=(t,s,a)=>t.find(r=>r.productId!==s?!1:!a||a.length===0?!r.modifierGroups||r.modifierGroups.length===0:!r.modifierGroups||r.modifierGroups.length===0?!1:ls(r.modifierGroups,a)),ls=(t,s)=>{if(t.length!==s.length)return!1;const a=[...s];return t.every(r=>{const i=a.findIndex(n=>{if(r.id!==n.id||r.modifiers.length!==n.modifiers.length)return!1;const o=[...n.modifiers];return r.modifiers.every(l=>{const d=o.findIndex(c=>l.id===c.id&&(l.quantity||1)===(c.quantity||1));return d>=0?(o.splice(d,1),!0):!1})});return i>=0?(a.splice(i,1),!0):!1})},Wi=t=>!t.modifierGroups||t.modifierGroups.length===0?!1:t.modifierGroups.some(s=>s.selectMin>0),_i=(t,s)=>{var a,r,i,n;if(!t.modifierGroups||t.modifierGroups.length===0)return{valid:!0};for(const o of t.modifierGroups){const l=s.find(c=>c.groupId===o.id),d=(l==null?void 0:l.modifierIds.length)||0;if(o.selectMin>0&&d<o.selectMin){const c=((r=(a=o.translations)==null?void 0:a[0])==null?void 0:r.title)||"Option";return{valid:!1,message:`Please select at least ${o.selectMin} ${c}`}}if(o.selectMax>0&&d>o.selectMax){const c=((n=(i=o.translations)==null?void 0:i[0])==null?void 0:n.title)||"Option";return{valid:!1,message:`You can select at most ${o.selectMax} ${c}`}}}return{valid:!0}},He=t=>t.reduce((s,a)=>s+(a.quantity||1),0),qi=(t,s)=>t.findIndex(a=>{var r,i,n,o,l;return a.productId!==s.productId?!1:!((r=a.modifierGroups)!=null&&r.length)&&!((i=s.modifierGroups)!=null&&i.length)?!0:(((n=a.modifierGroups)==null?void 0:n.length)||0)!==(((o=s.modifierGroups)==null?void 0:o.length)||0)?!1:((l=a.modifierGroups)==null?void 0:l.every(d=>{var u;const c=(u=s.modifierGroups)==null?void 0:u.find(p=>p.id===d.id);return c?d.modifiers.every(p=>c.modifiers.some(g=>g.id===p.id&&g.quantity===p.quantity)):!1}))||!1}),$i=(t,s)=>!t.modifierGroups||t.modifierGroups.length===0?!0:!s.modifierGroups||s.modifierGroups.length===0?!1:t.modifierGroups.every(a=>{var i;const r=(i=s.modifierGroups)==null?void 0:i.find(n=>n.id===a.id);return r?a.modifiers.every(n=>{var l;return!!((l=r.modifiers)==null?void 0:l.find(d=>d.id===n.id))}):!1}),ma=(t,s)=>{switch(s.type){case"INITIALIZE_CART":{const a=s.payload;return{...t,items:a,itemCount:He(a)}}case"SET_INITIALIZED":return{...t,isInitialized:s.payload};case"ADD_ITEM":{const a=s.payload,r=qi(t.items,a);let i;if(r!==-1){i=[...t.items];const n=i[r];i[r]={...n,quantity:(n.quantity||1)+(a.quantity||1)}}else i=[...t.items,a];return{...t,items:i,itemCount:He(i)}}case"UPDATE_ITEM_QUANTITY":{const{productId:a,quantity:r,modifierGroups:i}=s.payload;if(r<=0)return ma(t,{type:"REMOVE_ITEM",payload:{productId:a,modifierGroups:i}});const n=t.items.map(o=>{if(o.productId!==a)return o;if(i&&i.length>0){if(!ls(o.modifierGroups||[],i))return o}else if(!i&&o.modifierGroups&&o.modifierGroups.length>0)return o;return{...o,quantity:r}});return{...t,items:n,itemCount:He(n)}}case"REMOVE_ITEM":{const{productId:a,modifierGroups:r}=s.payload;let i;return!r||r.length===0?i=t.items.filter(n=>n.productId!==a?!0:n.modifierGroups&&n.modifierGroups.length>0):i=t.items.filter(n=>n.productId!==a?!0:n.modifierGroups&&n.modifierGroups.length>0?!ls(n.modifierGroups,r):!0),{...t,items:i,itemCount:He(i)}}case"CLEAR_CART":return{...t,items:[],itemCount:0,totalAmount:0};case"OPEN_MODIFIERS_MODAL":return{...t,isModifiersModalOpen:!0,selectedProduct:s.payload.product,onModalAddToCart:s.payload.onAddToCart};case"CLOSE_MODIFIERS_MODAL":return{...t,isModifiersModalOpen:!1};case"UPDATE_TOTALS":{const{productsData:a}=s.payload,r=t.items.reduce((i,n)=>{const o=a[n.productId];if(!o)return i;const l=Number(o.discountedBasePrice??o.basePrice??0);return i+l*(n.quantity||1)},0);return{...t,totalAmount:r}}case"REMOVE_UNAVAILABLE_PRODUCTS":{const{productsData:a,showAlert:r}=s.payload,i=t.items.length,n=t.items.filter(l=>{const d=a[l.productId];return d?$i(l,d):!1}),o=n.length<i;return{...t,items:n,itemCount:He(n),removedItemsAlert:!!(r&&o)}}case"REMOVE_INVALID_PRODUCTS":{const{invalidProductIds:a}=s.payload,r=t.items.filter(i=>!a.includes(i.productId));return{...t,items:r,itemCount:He(r)}}default:return t}};function ga(t,s,a,r){const i=Number(s.discountedBasePrice??s.basePrice??0),n=ye((t.quantity||1)*i,a,r),o=t.modifierGroups?t.modifierGroups.map(d=>{const c=s.modifierGroups.find(p=>p.id===d.id);if(!c)return null;const u=d.modifiers.map(p=>{var h;const g=(h=c.modifiers)==null?void 0:h.find(y=>y.id===p.id);return g?g.title:""}).filter(Boolean).join(", ");return u?`${c.title}: ${u}`:null}).filter(Boolean):[],l=s.images&&s.images.length>0?s.images[0]:void 0;return{title:s.title??s.slug??"Untitled product",subtitle:o,image:l,price:n,unitPrice:ye(i,a,r),quantity:t.quantity||1}}const ha=x.createContext(null),gs=({baseUrl:t,children:s})=>{const a=x.useMemo(()=>Pi.initClient({baseUrl:t,throwOnUnknownStatus:!0,baseHeaders:{},credentials:"include"}),[t]);return e.jsx(ha.Provider,{value:{client:a},children:s})},E=()=>{const t=x.useContext(ha);if(!t)throw new Error("useAPI must be used within a APIProvider");return t},xa=x.createContext(void 0),Gi=({children:t,organizationId:s})=>{const{client:a}=E(),r=R.useQuery({queryKey:["organization",s],queryFn:async()=>{const i=await a.organization.getOrganization({params:{organizationId:s}});if(i.status!==200)throw new Error("Failed to fetch product data");return i.body},placeholderData:R.keepPreviousData,enabled:!!s});return e.jsx(xa.Provider,{value:{organizationId:s,loading:r.isLoading,organization:r.data,error:r.error},children:t})},ze=()=>{const t=x.useContext(xa);if(t===void 0)throw new Error("useOrganization must be used within a OrganizationProvider");return t},hs=x.createContext(void 0),fa=({children:t,locale:s="en",organizationId:a})=>{const{organization:r}=ze(),i=r==null?void 0:r.configuration.defaultCurrency,{client:n}=E(),[o,l]=x.useState(null),[d,c]=x.useState(null),[{items:u,isInitialized:p,isModifiersModalOpen:g,selectedProduct:h,onModalAddToCart:y,totalAmount:b,itemCount:f,removedItemsAlert:S},k]=x.useReducer(ma,Vi),j=x.useMemo(()=>[...new Set(u.map(B=>B.productId))],[u]),{data:v,isLoading:P,isRefetching:q}=R.useQuery({queryKey:["cartProducts",j,f,d==null?void 0:d.id],queryFn:async()=>{if(j.length===0)return{products:{},total:0,subtotal:0,invalidProductIds:[]};const B=await n.cart.getCartData({params:{organizationId:a},query:{locale:s},body:{items:u,shippingMethodId:d==null?void 0:d.id}});if(B.status!==200)throw new Error("Failed to fetch product data");return B.body},placeholderData:R.keepPreviousData,enabled:j.length>0});x.useEffect(()=>{var B;v&&((B=v.invalidProductIds)==null?void 0:B.length)>0&&(k({type:"REMOVE_INVALID_PRODUCTS",payload:{invalidProductIds:v.invalidProductIds}}),alert("Some items have been removed from your cart because they are no longer available or their options have changed."))},[v,q,u.length]),x.useEffect(()=>{(()=>{const D=localStorage.getItem(Us);if(D)try{const J=JSON.parse(D);k({type:"INITIALIZE_CART",payload:J})}catch(J){console.error("Failed to parse cart from localStorage:",J)}k({type:"SET_INITIALIZED",payload:!0})})()},[]),x.useEffect(()=>{p&&localStorage.setItem(Us,JSON.stringify(u))},[u,p]),x.useEffect(()=>{u.length>0&&v&&k({type:"UPDATE_TOTALS",payload:{productsData:v.products}})},[u,v]);const se=x.useCallback(B=>{k({type:"ADD_ITEM",payload:B})},[]),ee=x.useCallback((B,D,J)=>{k({type:"UPDATE_ITEM_QUANTITY",payload:{productId:B,quantity:D,modifierGroups:J}})},[]),U=x.useCallback((B,D)=>{k({type:"REMOVE_ITEM",payload:{productId:B,modifierGroups:D}})},[]),O=x.useCallback(()=>{k({type:"CLEAR_CART"})},[]),je=x.useCallback(()=>{console.log("Checkout clicked, implement onCheckout handler")},[]),Me=x.useCallback((B,D)=>{k({type:"OPEN_MODIFIERS_MODAL",payload:{product:B,onAddToCart:D}})},[]),Ve=x.useCallback(()=>{k({type:"CLOSE_MODIFIERS_MODAL"})},[]),W=x.useMemo(()=>v!=null&&v.products?u.map(B=>{const D=v.products[B.productId];return D?ga(B,D,i??"USD",s):null}).filter(B=>B!==null):[],[u,v==null?void 0:v.products,i,s]),Re=x.useMemo(()=>({locale:s,items:u,total:(v==null?void 0:v.total)??0,shipping:v==null?void 0:v.shipping,subtotal:(v==null?void 0:v.subtotal)??0,products:(v==null?void 0:v.products)||{},addItem:se,removeItem:U,updateItemQuantity:ee,clearCart:O,itemCount:f,totalAmount:b,onCheckoutClick:je,openModifiersModal:Me,closeModifiersModal:Ve,isModifiersModalOpen:g,selectedProduct:h,onModalAddToCart:y,isProductsLoading:P,paymentMethod:o,setPaymentMethod:l,shippingMethod:d,setShippingMethod:c,formattedCartItems:W}),[s,u,se,U,ee,O,f,b,je,Me,Ve,g,h,y,v,P,o,l,d,c,W]);return e.jsx(hs.Provider,{value:Re,children:t})},Mt=()=>{const t=x.useContext(hs);if(t===void 0)throw new Error("useCart must be used within a CartProvider");const s=x.useCallback(a=>{var r;return(r=a==null?void 0:a.modifierGroups)!=null&&r.length?t.openModifiersModal(a):t.addItem({productId:a.id,quantity:1,modifierGroups:[]})},[t]);return{items:t.items,total:t.total,subtotal:t.subtotal,shipping:t.shipping,loading:t.isProductsLoading,formattedCartItems:t.formattedCartItems,addProductToCart:s,clearCart:t.clearCart,itemCount:t.itemCount,rawCart:t.items,onCheckoutClick:t.onCheckoutClick,totalAmount:t.totalAmount,paymentMethod:t.paymentMethod,setPaymentMethod:t.setPaymentMethod,shippingMethod:t.shippingMethod,setShippingMethod:t.setShippingMethod}},xs=()=>{const t=x.useContext(hs);if(t===void 0)throw new Error("useCart must be used within a CartProvider");return t},ya=(t="en")=>{const[s,a]=x.useState(t),r=x.useCallback((d,c,u="")=>{if(!d||d.length===0)return u;const p=d.find(h=>h.locale===s);if(p&&p[c])return p[c];const g=d[0];return g&&g[c]?g[c]:u},[s]),i=x.useCallback((d,c="Product")=>r(d==null?void 0:d.translations,"title",c),[r]),n=x.useCallback((d,c="")=>r(d==null?void 0:d.translations,"description",c),[r]),o=x.useCallback((d,c="Category")=>r(d==null?void 0:d.translations,"title",c),[r]),l=x.useCallback((d,c="Options")=>d.title,[r]);return{locale:s,setLocale:a,getTranslation:r,getProductName:i,getProductDescription:n,getCategoryName:o,getModifierGroupName:l}},wa=t=>{const[s,a]=x.useState([]),[r,i]=x.useState(null),n=x.useCallback(()=>{if(!t||!t.modifierGroups){a([]);return}const p=t.modifierGroups.map(g=>({groupId:g.id,modifierIds:[]}));a(p),i(null)},[t]),o=x.useCallback((p,g)=>{a(h=>{const y=[...h],b=y.findIndex(f=>f.groupId===p);if(b===-1)y.push({groupId:p,modifierIds:[g]});else{const f=y[b];f.modifierIds.indexOf(g)===-1?y[b]={...f,modifierIds:[...f.modifierIds,g]}:y[b]={...f,modifierIds:f.modifierIds.filter(k=>k!==g)}}return y}),i(null)},[]),l=x.useCallback((p,g)=>{a(h=>{const y=[...h],b=y.findIndex(f=>f.groupId===p);return b===-1?y.push({groupId:p,modifierIds:[g]}):y[b]={...y[b],modifierIds:[g]},y}),i(null)},[]),d=x.useCallback((p,g)=>{const h=s.find(y=>y.groupId===p);return h?h.modifierIds.includes(g):!1},[s]),c=x.useCallback(()=>{if(!t)return!0;const p=_i(t,s);return!p.valid&&p.message?i(p.message):i(null),p.valid},[t,s]),u=x.useCallback(()=>s.filter(p=>p.modifierIds.length>0).map(p=>({id:p.groupId,modifiers:p.modifierIds.map(g=>({id:g,quantity:1}))})),[s]);return{selections:s,initializeSelections:n,toggleModifier:o,selectModifier:l,isModifierSelected:d,validateSelections:c,validationError:r,getCartModifierGroups:u}},ba=x.createContext(null),Sa=({children:t,locale:s="en"})=>{const{selectedProduct:a,isModifiersModalOpen:r,closeModifiersModal:i,onModalAddToCart:n,addItem:o}=xs(),[l,d]=x.useState(1),{initializeSelections:c,toggleModifier:u,selectModifier:p,isModifierSelected:g,validateSelections:h,validationError:y,getCartModifierGroups:b}=wa(a||{}),{getProductName:f,getModifierGroupName:S}=ya(s);x.useEffect(()=>{a&&(c(),d(1))},[a,c]);const k=x.useCallback(()=>{d(O=>O+1)},[]),j=x.useCallback(()=>{d(O=>O>1?O-1:1)},[]),v=x.useCallback(()=>{!h()||!a||(o({productId:a.id,quantity:l,modifierGroups:b()}),d(1),i(),n&&n())},[h,o,a,l,b,i,n]),P=(a==null?void 0:a.modifierGroups)&&a.modifierGroups.length>0,q=(a==null?void 0:a.title)||"",se=x.useCallback(O=>O.selectMax>1||O.selectMax===0,[]),ee=x.useCallback((O,je)=>O.price>0?` (+${ye(O.price,je,s)})`:"",[s]),U={isOpen:r,onClose:i,product:a||{},productName:q,hasModifiers:P,quantity:l,handleIncrement:k,handleDecrement:j,handleAddToCart:v,validationError:y,modifierGroups:P?a.modifierGroups:[],isModifierSelected:g,isMultiSelect:se,toggleModifier:u,selectModifier:p,getModifierGroupName:S,formatModifierPrice:ee,locale:s};return e.jsx(ba.Provider,{value:U,children:t})},ut=()=>{const t=x.useContext(ba);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t},Ki=({className:t,emptyCartComponent:s,renderItem:a,loadingComponent:r})=>{const{organization:i}=ze(),{locale:n,items:o,removeItem:l,updateItemQuantity:d,products:c,isProductsLoading:u}=xs();return!i||u?r:o.length===0?s:e.jsx("div",{className:t||"flex-1 overflow-y-auto",children:c&&o.map(p=>{const g=c[p.productId];if(!g)return null;const h=()=>l(p.productId,p.modifierGroups),y=f=>d(p.productId,f,p.modifierGroups),b=ga(p,g,i.configuration.defaultCurrency,n);return e.jsx(x.Fragment,{children:a({...b,remove:h,updateQuantity:y})},`${p.productId}-${JSON.stringify(p.modifierGroups)}`)})})},qe=(...t)=>(s,a)=>{const{translations:r,defaultLocale:i}=s,n=r.findIndex(o=>o.locale===i);if(n===-1){a.addIssue({code:m.z.ZodIssueCode.custom,message:"Missing translation for the default locale",path:["translations"]});return}t.forEach(o=>{const l=r[n][o];(typeof l!="string"||!l.trim())&&a.addIssue({code:m.z.ZodIssueCode.custom,message:"This field is required",path:["translations",n,o]})})},Bt=new Map([["af","Afrikaans"],["sq","Albanian"],["ar_dz","Arabic (Algeria)"],["ar_bh","Arabic (Bahrain)"],["ar_eg","Arabic (Egypt)"],["ar_iq","Arabic (Iraq)"],["ar_jo","Arabic (Jordan)"],["ar_kw","Arabic (Kuwait)"],["ar_lb","Arabic (Lebanon)"],["ar_ly","Arabic (Libya)"],["ar_ma","Arabic (Morocco)"],["ar_om","Arabic (Oman)"],["ar_qa","Arabic (Qatar)"],["ar_sa","Arabic (Saudi Arabia)"],["ar_sy","Arabic (Syria)"],["ar_tn","Arabic (Tunisia)"],["ar_ae","Arabic (U.A.E.)"],["ar_ye","Arabic (Yemen)"],["eu","Basque"],["be","Belarusian"],["bg","Bulgarian"],["ca","Catalan"],["zh_hk","Chinese (Hong Kong)"],["zh_cn","Chinese (PRC)"],["zh_sg","Chinese (Singapore)"],["zh_tw","Chinese (Taiwan)"],["hr","Croatian"],["cs","Czech"],["da","Danish"],["nl_be","Dutch (Belgium)"],["nl","Dutch (Standard)"],["en","English"],["en_au","English (Australia)"],["en_bz","English (Belize)"],["en_ca","English (Canada)"],["en_ie","English (Ireland)"],["en_jm","English (Jamaica)"],["en_nz","English (New Zealand)"],["en_za","English (South Africa)"],["en_tt","English (Trinidad)"],["en_gb","English (United Kingdom)"],["en_us","English (United States)"],["et","Estonian"],["fo","Faeroese"],["fa","Farsi"],["fi","Finnish"],["fr_be","French (Belgium)"],["fr_ca","French (Canada)"],["fr_lu","French (Luxembourg)"],["fr","French (Standard)"],["fr_ch","French (Switzerland)"],["gd","Gaelic (Scotland)"],["de_at","German (Austria)"],["de_li","German (Liechtenstein)"],["de_lu","German (Luxembourg)"],["de","German (Standard)"],["de_ch","German (Switzerland)"],["el","Greek"],["he","Hebrew"],["hi","Hindi"],["hu","Hungarian"],["is","Icelandic"],["id","Indonesian"],["ga","Irish"],["it","Italian (Standard)"],["it_ch","Italian (Switzerland)"],["ja","Japanese"],["ko","Korean"],["ku","Kurdish"],["lv","Latvian"],["lt","Lithuanian"],["mk","Macedonian (FYROM)"],["ml","Malayalam"],["ms","Malaysian"],["mt","Maltese"],["no","Norwegian"],["nb","Norwegian (Bokmål)"],["nn","Norwegian (Nynorsk)"],["pl","Polish"],["pt_br","Portuguese (Brazil)"],["pt","Portuguese (Portugal)"],["pa","Punjabi"],["rm","Rhaeto-Romanic"],["ro","Romanian"],["ro_md","Romanian (Republic of Moldova)"],["ru","Russian"],["ru_md","Russian (Republic of Moldova)"],["sr","Serbian"],["sk","Slovak"],["sl","Slovenian"],["sb","Sorbian"],["es_ar","Spanish (Argentina)"],["es_bo","Spanish (Bolivia)"],["es_cl","Spanish (Chile)"],["es_co","Spanish (Colombia)"],["es_cr","Spanish (Costa Rica)"],["es_do","Spanish (Dominican Republic)"],["es_ec","Spanish (Ecuador)"],["es_sv","Spanish (El Salvador)"],["es_gt","Spanish (Guatemala)"],["es_hn","Spanish (Honduras)"],["es_mx","Spanish (Mexico)"],["es","Spanish (Spain)"],["sv","Swedish"],["sv_fi","Swedish (Finland)"],["th","Thai"],["tr","Turkish"],["uk","Ukrainian"],["ur","Urdu"],["vi","Vietnamese"],["cy","Welsh"],["ji","Yiddish"],["zu","Zulu"]]),Ws=Array.from(Bt.entries()).map(([t,s])=>({value:t,label:s})),Te=m.z.enum(["af","sq","ar_dz","ar_bh","ar_eg","ar_iq","ar_jo","ar_kw","ar_lb","ar_ly","ar_ma","ar_om","ar_qa","ar_sa","ar_sy","ar_tn","ar_ae","ar_ye","eu","be","bg","ca","zh_hk","zh_cn","zh_sg","zh_tw","hr","cs","da","nl_be","nl","en","en_au","en_bz","en_ca","en_ie","en_jm","en_nz","en_za","en_tt","en_gb","en_us","et","fo","fa","fi","fr_be","fr_ca","fr_lu","fr","fr_ch","gd","de_at","de_li","de_lu","de","de_ch","el","he","hi","hu","is","id","ga","it","it_ch","ja","ko","ku","lv","lt","mk","ml","ms","mt","no","nb","nn","pl","pt_br","pt","pa","rm","ro","ro_md","ru","ru_md","sr","sk","sl","sb","es_ar","es_bo","es_cl","es_co","es_cr","es_do","es_ec","es_sv","es_gt","es_hn","es_mx","es","sv","sv_fi","th","tr","uk","ur","vi","cy","ji","zu"]).openapi({description:"Enum for locale values",example:"en"}),ka=m.z.union([m.z.string(),m.z.number(),m.z.null()]).optional().transform(t=>{if(t==null||t==="")return null;if(typeof t=="number")return t;const s=Number(t);return isNaN(s)?t:s}).pipe(m.z.number().nonnegative({message:"This field must be a positive number"}).nullable().refine(t=>t===null||t>=0,{message:"Price must be positive"})),Qt=m.z.coerce.number().min(.1,"This field must be positive").refine(t=>/^\d+(\.\d{1,2})?$/.test(t.toString()),{message:"This field can have a maximum of two decimal points"}),Xi=m.z.object({type:m.z.literal("blob.generate-client-token"),payload:m.z.object({pathname:m.z.string(),callbackUrl:m.z.string(),multipart:m.z.boolean(),clientPayload:m.z.string().nullable()})}),Yi=m.z.object({type:m.z.literal("blob.upload-completed"),payload:m.z.object({blob:m.z.any(),tokenPayload:m.z.string().nullable().optional()})});m.z.discriminatedUnion("type",[Xi,Yi]);m.z.discriminatedUnion("type",[m.z.object({type:m.z.literal("blob.generate-client-token"),clientToken:m.z.string()}),m.z.object({type:m.z.literal("blob.upload-completed"),response:m.z.literal("ok")})]);m.z.object({mimeType:m.z.string().min(1,"MIME type is required").openapi({example:"image/png",description:"MIME type of the file"}),size:m.z.number().min(1,"Size is required").openapi({example:1024,description:"Size of the file in bytes"}),filename:m.z.string().min(1,"Filename is required").openapi({example:"example.png",description:"Name of the file"}),organizationId:m.z.string().optional().openapi({example:"clm1234567890abcdef",description:"ID of the organization"})});const Ie=m.z.object({id:m.z.string().min(1,"ID is required").openapi({example:"clf9876543210abcdef",description:"ID of the file"}),url:m.z.string().min(1,"Path is required").openapi({example:"/path/to/file",description:"Path of the file"}),mimeType:m.z.string().min(1,"MIME type is required").openapi({example:"image/png",description:"MIME type of the file"}),size:m.z.number().min(1,"Size is required").openapi({example:1024,description:"Size of the file in bytes"}),filename:m.z.string().min(1,"Filename is required").openapi({example:"example.png",description:"Name of the file"})}).openapi("UploadedFile"),Jt=m.z.object({id:m.z.string().openapi({example:"clf9876543210abcdef",description:"ID of the product category"}),slug:m.z.string().openapi({example:"electronics",description:"Slug of the product category"}),image:Ie.nullable().optional().openapi({description:"Image of the product category"}),createdAt:m.z.date(),publishedAt:m.z.date().nullable().optional().openapi({description:"Timestamp when the product category was published"}),translations:m.z.array(m.z.object({locale:m.z.string().min(1,"Locale is required").openapi({example:"en-US",description:"Locale code for the translation"}),title:m.z.string().default("").openapi({example:"Electronics",description:"Name of the product category in the specified locale"}),description:m.z.string().max(6e3,"Maximum character limit is 6000").nullable().default("").optional().openapi({example:"A category for electronic devices.",description:"Description of the product category in the specified locale"})})).openapi({description:"List of translations for the product category"})}).openapi("ProductCategory");Jt.omit({translations:!0}).extend({title:m.z.string().default(""),description:m.z.string().default("")}).openapi("LocalizedProductCategory");const en=Jt.pick({slug:!0,image:!0,translations:!0}).extend({defaultLocale:m.z.string().min(1,"Default locale is required").openapi({description:"The default locale for the product category"}),imageId:m.z.string().cuid().optional().openapi({description:"ID of the image for the product category"})}).superRefine(qe("title")).openapi("CreateProductCategory"),tn=Jt.pick({slug:!0,image:!0,translations:!0}).extend({defaultLocale:m.z.string().min(1,"Default locale is required").openapi({description:"The default locale for the product category"}),imageId:m.z.string().cuid().optional().nullable().openapi({description:"ID of the image for the product category"})}).partial().superRefine(qe("title")).openapi("UpdateProductCategory"),ja=m.z.object({id:m.z.string().cuid().optional(),title:m.z.string().min(1,"This field is required").openapi({example:"Large",description:"Title of the modifier"}),sku:m.z.coerce.string().optional().openapi({example:"csd9876543210abcdef",description:"Stock Keeping Unit identifier"}),price:m.z.coerce.number().optional().default(0).openapi({example:2.5,description:"Price of the modifier"})}).openapi("Modifier"),Aa=m.z.object({id:m.z.string().cuid(),selectMin:m.z.coerce.number().min(0).openapi({example:1,description:"Minimum number of modifiers that can be selected"}),selectMax:m.z.coerce.number().min(0).openapi({example:1,description:"Maximum number of modifiers that can be selected"}),defaultLocale:Te.optional(),modifiers:m.z.array(ja).optional().openapi({}),translations:m.z.array(m.z.object({locale:Te,title:m.z.string().optional().openapi({example:"Size",description:"Title of the modifier group"})}))}).openapi("ModifierGroup"),sn=Aa.extend({title:m.z.string().default("").nullable()}).omit({translations:!0}).openapi("LocalizedModifierGroup"),va=m.z.object({selectMin:m.z.coerce.number().min(0).openapi({example:1,description:"Minimum number of modifiers that can be selected"}),selectMax:m.z.coerce.number().min(0).openapi({example:1,description:"Maximum number of modifiers that can be selected"}),defaultLocale:Te.optional(),modifiers:m.z.array(ja).optional().openapi({}),translations:m.z.array(m.z.object({locale:Te,title:m.z.string().optional().openapi({example:"Size",description:"Title of the modifier group"})}))}).refine(t=>t.selectMax>=t.selectMin,{message:"Maximum selections must be greater than or equal to minimum selections",path:["selectMax"]}).refine(t=>{var a;const s=((a=t.modifiers)==null?void 0:a.length)||0;return t.selectMax<=s},{message:"Maximum selections cannot exceed the total number of modifiers",path:["selectMax"]}).superRefine(qe("title")).openapi("ModifierGroup"),Na=m.z.object({id:m.z.string().cuid().openapi({example:"clf9876543210abcdef",description:"ID of the product"}),slug:m.z.string().optional().openapi({example:"premium-watch",description:"Unique slug for the product"}),sku:m.z.string().optional().openapi({example:"PRM-WATCH-01",description:"Stock Keeping Unit identifier"}),basePrice:Qt,discountedBasePrice:ka,currency:m.z.string().openapi({example:"USD",description:"Currency code for pricing"}),images:m.z.array(Ie).optional().openapi({description:"List of product images"}),modifierGroups:m.z.array(Aa).optional().openapi({description:"List of product modifier groups"}),categories:m.z.array(Jt).openapi({example:["cju0z9k4z0000l1qg5z1z1z"],description:"IDs of associated product categories"}),manufacturerId:m.z.string().cuid().nullable().optional().openapi({description:"ID of associated manufacturer"}),createdAt:m.z.date(),publishedAt:m.z.date().nullable().optional(),translations:m.z.array(m.z.object({locale:Te,title:m.z.coerce.string().optional().openapi({example:"Premium Watch",description:"Product name in specified locale"}),description:m.z.string().nullable().optional().openapi({example:"High-quality premium watch",description:"Product description in specified locale"})})).optional(),metadata:m.z.record(m.z.string().min(1,"Key cannot be empty").max(50,"Key too long").regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/,"Key must start with letter and contain only letters, numbers, underscore, or dash"),m.z.string().min(1,"Value cannot be empty").max(200,"Value too long")).optional().nullable()}).openapi("Product"),an=Na.extend({title:m.z.string().default(""),description:m.z.string().nullable().default(""),modifierGroups:m.z.array(sn),categories:m.z.array(m.z.object({id:m.z.string().cuid().openapi({example:"cju0z9k4z0000l1qg5z1z1z",description:"ID of the product category"})})).default([])}).omit({translations:!0}).openapi("LocalizedProduct"),Ra=Na.pick({slug:!0,sku:!0,basePrice:!0,discountedBasePrice:!0,currency:!0,images:!0,manufacturerId:!0,translations:!0,metadata:!0}).extend({defaultLocale:m.z.string().min(1,"Default locale is required").openapi({example:"en-US",description:"Default translation locale"}),modifierGroups:m.z.array(va).optional().openapi({description:"List of product modifier groups"}),categories:m.z.array(m.z.string()).optional().openapi({example:["cju0z9k4z0000l1qg5z1z1z"],description:"IDs of associated product categories"})}),rn=Ra.superRefine((t,s)=>(t.discountedBasePrice!==null&&t.discountedBasePrice!==void 0&&t.discountedBasePrice>t.basePrice&&s.addIssue({code:m.z.ZodIssueCode.custom,path:["discountedBasePrice"],message:"Discounted price cannot exceed base price"}),qe("title")(t,s))).openapi("CreateProduct"),nn=Ra.partial().superRefine((t,s)=>(t.discountedBasePrice!==null&&t.discountedBasePrice!==void 0&&t.basePrice&&t.discountedBasePrice>t.basePrice&&s.addIssue({code:m.z.ZodIssueCode.custom,path:["discountedBasePrice"],message:"Discounted price cannot exceed base price"}),qe("title")(t,s))).openapi("UpdateProduct");m.z.record(m.z.string().openapi({example:"clf9876543210abcdef",description:"ID of the product in the cart"}),an);const Ca=m.z.object({productId:m.z.string().cuid().openapi({example:"clf9876543210abcdef",description:"ID of the product in the cart"}),quantity:m.z.number().default(1).optional().openapi({example:2,description:"Quantity of this item in the cart"}),modifierGroups:m.z.array(m.z.object({id:m.z.string().cuid().openapi({example:"clg1234567890abcdef",description:"ID of the modifier group"}),modifiers:m.z.array(m.z.object({id:m.z.string().cuid().openapi({example:"clh9876543210abcdef",description:"ID of the selected modifier"}),quantity:m.z.number().default(1).openapi({example:1,description:"Quantity of this modifier"})}))}))}).openapi("CartItem"),on=m.z.object({items:m.z.array(Ca),shippingMethodId:m.z.string().cuid().optional()});m.z.object({status:m.z.number().openapi({example:404,description:"The HTTP status code"}),message:m.z.string().openapi({example:"Not found",description:"The error message"})});m.z.object({"accept-language":m.z.string().optional().openapi({example:"en-US",description:"Accept-Language header",param:{in:"header",name:"accept-language"}}),cookie:m.z.string().optional().openapi({example:"session=1234567890",description:"Cookie header",param:{in:"header",name:"cookie"}})}).openapi("Headers");m.z.object({id:m.z.string().openapi({example:"clm1234567890abcdef",description:"User's ID"}),email:m.z.string().openapi({example:"user@example.com",description:"User's email address",format:"email"}),firstname:m.z.string().openapi({example:"John",description:"User's first name"}),lastname:m.z.string().openapi({example:"Doe",description:"User's last name"}),image:m.z.string().nullable().optional().openapi({example:"https://example.com/image.jpg",description:"User's profile image"}),name:m.z.string().nullable().optional().openapi({description:"User's full name (optional)"})}).openapi("User");m.z.object({page:m.z.coerce.number().optional().default(1).openapi({example:1,description:"Page number"}),limit:m.z.coerce.number().optional().default(10).openapi({example:50,description:"Number of items per page"}),search:m.z.string().optional().openapi({example:"Apple",description:"Search query"}),published:m.z.coerce.boolean().optional().openapi({example:!0,description:"Whether to filter by published items"}),locale:Te.optional()});m.z.object({isFirstPage:m.z.boolean().openapi({example:!0,description:"Whether the current page is the first page"}),isLastPage:m.z.boolean().openapi({example:!1,description:"Whether the current page is the last page"}),currentPage:m.z.number().openapi({example:1,description:"The current page number"}),previousPage:m.z.number().nullable().openapi({example:0,description:"The previous page number"}),nextPage:m.z.number().nullable().openapi({example:2,description:"The next page number"}),pageCount:m.z.number().openapi({example:5,description:"The total number of pages"}),totalCount:m.z.number().openapi({example:50,description:"The total number of items"})}).openapi("PaginationMeta");const $e=m.z.object({id:m.z.string().cuid().openapi({example:"clf9876543210abcdef",description:"The unique identifier of the address"}),firstname:m.z.string().optional().nullable().openapi({example:"John",description:"The first name of the recipient"}),lastname:m.z.string().optional().nullable().openapi({example:"Doe",description:"The last name of the recipient"}),phone:m.z.string().optional().nullable().openapi({example:"+1234567890",description:"Phone number of the recipient"}),addressLineOne:m.z.string().openapi({example:"123 Main Street",description:"The first line of the address"}),doorNumber:m.z.string().nullable().optional().openapi({description:"The door number of the address"}),addressLineTwo:m.z.string().nullable().optional().openapi({example:"Suite 100",description:"The second line of the address"}),zipCode:m.z.string().optional().openapi({example:"12345",description:"The postal code of the address"}),city:m.z.string().openapi({example:"New York",description:"The city of the address"}),country:m.z.string().openapi({example:"USA",description:"The country of the address"}),placeId:m.z.string().openapi({example:"ChIJN1t_tKlj4AR4GeTYWZ7frY",description:"The Google Place ID for the address"}),deliveryInstructions:m.z.string().nullable().optional().openapi({example:"Leave at the door",description:"Delivery instructions for the address"})}).openapi("Address"),Ot=$e.pick({addressLineOne:!0,doorNumber:!0,addressLineTwo:!0,zipCode:!0,city:!0,country:!0,placeId:!0}).openapi("CreateAddress"),Pa=Ot.partial().openapi("UpdateAddress"),ln=$e.extend({firstname:m.z.string().min(2,"First Name must be at least 2 characters").openapi({example:"John",description:"The first name of the recipient"}),lastname:m.z.string().min(1,"Last Name must be at least 2 characters").openapi({example:"Doe",description:"The last name of the recipient"}),phone:m.z.string().min(4).openapi({example:"+1234567890",description:"Phone number of the recepient"})}),Ta=ln.pick({firstname:!0,lastname:!0,phone:!0,addressLineOne:!0,addressLineTwo:!0,doorNumber:!0,zipCode:!0,city:!0,country:!0,placeId:!0,deliveryInstructions:!0});Ta.partial().extend({placeId:m.z.string().min(1,"This field is required").openapi({example:"ChIJN1t_tKlj4AR4GeTYWZ7frY",description:"The Google Place ID for the address"})}).openapi("UpdateShippingAddress");const dn=[{value:"USD",label:"United States Dollar"},{value:"EUR",label:"Euro"},{value:"GBP",label:"British Pound Sterling"},{value:"JPY",label:"Japanese Yen"},{value:"AUD",label:"Australian Dollar"},{value:"CAD",label:"Canadian Dollar"},{value:"CHF",label:"Swiss Franc"},{value:"CNY",label:"Chinese Yuan"},{value:"SEK",label:"Swedish Krona"},{value:"NZD",label:"New Zealand Dollar"},{value:"MXN",label:"Mexican Peso"},{value:"SGD",label:"Singapore Dollar"},{value:"HKD",label:"Hong Kong Dollar"},{value:"NOK",label:"Norwegian Krone"},{value:"KRW",label:"South Korean Won"},{value:"TRY",label:"Turkish Lira"},{value:"RUB",label:"Russian Ruble"},{value:"INR",label:"Indian Rupee"},{value:"BRL",label:"Brazilian Real"},{value:"ZAR",label:"South African Rand"},{value:"DKK",label:"Danish Krone"},{value:"PLN",label:"Polish Złoty"},{value:"THB",label:"Thai Baht"},{value:"IDR",label:"Indonesian Rupiah"},{value:"HUF",label:"Hungarian Forint"},{value:"CZK",label:"Czech Koruna"},{value:"ILS",label:"Israeli New Shekel"},{value:"PHP",label:"Philippine Peso"},{value:"AED",label:"United Arab Emirates Dirham"},{value:"COP",label:"Colombian Peso"},{value:"SAR",label:"Saudi Riyal"},{value:"MYR",label:"Malaysian Ringgit"},{value:"RON",label:"Romanian Leu"}],fs=m.z.enum(["USD","EUR","GBP","JPY","AUD","CAD","CHF","CNY","SEK","NZD","MXN","SGD","HKD","NOK","KRW","TRY","RUB","INR","BRL","ZAR","DKK","PLN","THB","IDR","HUF","CZK","ILS","PHP","AED","COP","SAR","MYR","RON"]).openapi({description:"The currency code for the transaction."}),ys=m.z.enum(["card","blik","cash_on_delivery","paypal"]).openapi({description:"The payment method",example:"card"}),ws=m.z.enum(["stripe","revolut","payu","not_applicable"]).openapi({description:"The payment method",example:"card"}),cn=m.z.enum(["pending","succeeded","refunded","failed","canceled"]).openapi({description:"The payment status",example:"pending"});m.z.object({id:m.z.string().min(1),provider:ws,method:ys,description:m.z.string().min(1)}).openapi({description:"The payment method",example:{provider:"stripe",type:"card"}});const un=m.z.object({id:m.z.string().cuid().min(1),method:ys,provider:ws,status:cn,shipping:m.z.number().min(0).default(0),subtotal:m.z.number().min(0),total:m.z.number().min(0),discount:m.z.number().min(0).default(0),currency:fs}),_s=m.z.object({id:m.z.string().optional().openapi({example:"clf9876543210abcdef",description:"ID of the shipping zone"}),title:m.z.string().min(1,"Title is required").openapi({example:"Zone 1",description:"Title of the shipping zone"}),distanceUpto:Qt.openapi({example:10,description:"Ending distance for the shipping zone"}),price:Qt.openapi({example:5.99,description:"Price for shipping in this zone"}),minimumOrderAmount:ka.openapi({example:50,description:"Minimum order amount for this shipping zone"}),eta:m.z.string().min(1,"ETA is required").openapi({example:"2-3 days",description:"Estimated time of arrival for this shipping zone"})}).openapi("ShippingZone"),Qa=m.z.object({id:m.z.string().openapi({example:"clf9876543210abcdef",description:"ID of the shipping method"}),title:m.z.string().min(1,"Title is required").openapi({example:"Standard Shipping",description:"Title of the shipping method"}),providerName:m.z.string().min(1,"Provider name is required").openapi({example:"FedEx",description:"Name of the shipping provider"}),providerLogo:Ie.nullable().optional().openapi({description:"Logo of the shipping provider"}),requireDateOfDelivery:m.z.coerce.boolean().optional().openapi({example:!0,description:"Whether the delivery time should be selected"}),shippingZones:m.z.array(_s).openapi({description:"List of shipping zones for this shipping method"}),eligibleShippingZone:_s.optional(),createdAt:m.z.date(),updatedAt:m.z.date()}).openapi("ShippingMethod"),za=Qa.pick({title:!0,providerName:!0,providerLogo:!0,requireDateOfDelivery:!0,shippingZones:!0}).extend({providerLogoId:m.z.string().cuid().optional().openapi({example:"clf9876543210abcdef",description:"ID reference to the provider logo file"})}).openapi("CreateShippingMethod"),pn=za.partial().openapi("UpdateShippingMethod"),Ia=m.z.enum(["delivery","pickup"]),mn=m.z.enum(["draft","pending","accepted","ready-for-dispatch","dispatched","completed","cancelled"]).openapi({description:"Status of the order",example:"accepted"}),gn=m.z.object({translations:m.z.array(m.z.object({locale:Te.openapi({description:"Locale of the translation",example:"en-US"}),title:m.z.string().openapi({description:"Title of the ordered product",example:"Premium Watch"}),subtitle:m.z.string().openapi({description:"Additional details about the ordered item, including modifiers",example:"Color: Silver, Size: Large"})})).openapi({description:"Translations for the order item"}),rawData:Ca,unitPrice:m.z.number().min(0).openapi({description:"Price per unit of the item",example:299.99}),image:Ie.nullable().optional(),totalPrice:m.z.number().min(0).openapi({description:"Total price for this item (unitPrice × quantity)",example:599.98}),quantity:m.z.number().min(1).openapi({description:"Number of units ordered",example:2}),productSnapshotId:m.z.string().cuid()}).openapi("OrderItem");m.z.object({id:m.z.string().openapi({description:"Unique identifier for the order",example:"clj1234567890abcdef"}),referenceId:m.z.string().openapi({description:"External reference ID for the order",example:"ORD-12345"}),status:mn.optional(),token:m.z.string().openapi({description:"Security token for order verification",example:"a1b2c3d4e5f6g7h8i9j0"}),expiresAt:m.z.date().openapi({description:"Expiration date for the order",example:"2023-12-31T23:59:59Z"}),items:m.z.array(gn).min(1).openapi({description:"Array of items in the order"}),shippingMethod:Qa.nullable().openapi({description:"Shipping method selected for the order"}),acceptedAt:m.z.date().nullable().optional().openapi({description:"Date when the order was accepted",example:"2023-06-15T14:30:00Z"}),dispatchedAt:m.z.date().nullable().optional().openapi({description:"Date when the order was dispatched",example:"2023-06-16T09:15:00Z"}),readyForDispatchAt:m.z.date().nullable().optional().openapi({description:"Date when the order was ready for dispatch",example:"2023-06-16T09:15:00Z"}),createdAt:m.z.date().openapi({description:"Date when the order was created",example:"2023-06-15T14:30:00Z"}),completedAt:m.z.date().nullable().optional().openapi({description:"Date when the order was completed",example:"2023-06-18T11:45:00Z"}),cancelledAt:m.z.date().nullable().optional().openapi({description:"Date when the order was cancelled",example:"2023-06-14T16:20:00Z"}),shippingAddress:$e.nullable().optional(),fulfilmentMethod:Ia.openapi({description:"Method of order fulfilment (pickup or delivery)",example:"delivery"}),currency:fs.openapi({description:"Currency used for the order",example:"USD"}),payment:un}).transform(t=>{let s;return t.cancelledAt?s="cancelled":t.completedAt?s="completed":t.dispatchedAt?s="dispatched":t.readyForDispatchAt?s="ready-for-dispatch":t.acceptedAt?s="accepted":s="pending",{...t,status:s}}).openapi("Order");on.extend({fulfilmentMethod:Ia.default("delivery"),payment:m.z.object({provider:ws,method:ys}),checkoutBaseUrl:m.z.string().url()}).refine(t=>t.fulfilmentMethod!=="delivery"||t.shippingMethodId!==void 0,{message:"shippingMethodId is required when fulfilmentMethod is 'delivery'",path:["shippingMethodId"]}).openapi("CreateOrder");const qs=m.z.object({monday:m.z.string().nullable().openapi({example:"09:00",description:"Opening time for Monday"}),tuesday:m.z.string().nullable().openapi({example:"09:00",description:"Opening time for Tuesday"}),wednesday:m.z.string().nullable().openapi({example:"09:00",description:"Opening time for Wednesday"}),thursday:m.z.string().nullable().openapi({example:"09:00",description:"Opening time for Thursday"}),friday:m.z.string().nullable().openapi({example:"09:00",description:"Opening time for Friday"}),saturday:m.z.string().nullable().openapi({example:"09:00",description:"Opening time for Saturday"}),sunday:m.z.string().nullable().openapi({example:"09:00",description:"Opening time for Sunday"})}).openapi("TimeSchedule"),La=m.z.object({id:m.z.string().openapi({example:"clm1234567890abcdef",description:"Unique identifier for the organization configuration"}),hostname:m.z.coerce.string().optional().openapi({example:"store.example.com",description:"Hostname associated with the organization"}),countriesShipping:m.z.array(m.z.string()).openapi({example:["US","CA"],description:"List of countries where shipping is available"}),stripeAccountId:m.z.coerce.string().optional().openapi({example:"acct_123456789",description:"Stripe account ID associated with the organization"}),enableHostCheckout:m.z.boolean().openapi({example:!0,description:"Indicates if host checkout is enabled"}),enableHostTracking:m.z.boolean().openapi({example:!0,description:"Indicates if host tracking is enabled"}),isAcceptingOrders:m.z.boolean().openapi({example:!0,description:"Indicates if the organization is currently accepting orders"}),isOpen:m.z.boolean().default(!1).openapi({example:!0,description:"Indicates if the organization is currently open"}),defaultLocale:Te,supportedLocales:m.z.array(Te).openapi({description:"List of supported locales for the organization"}),openingTimes:qs.optional(),closingTimes:qs.optional(),facebookProfile:m.z.string().nullable().optional().openapi({example:"https://www.facebook.com/example",description:"Facebook profile URL for the organization"}),instagramProfile:m.z.string().nullable().optional().openapi({example:"https://www.instagram.com/example",description:"Instagram profile URL for the organization"}),xProfile:m.z.string().nullable().optional().openapi({example:"https://www.x.com/example",description:"X profile URL for the organization"}),defaultCurrency:fs.openapi({example:"USD",description:"Default currency for the organization"}),createdAt:m.z.date().openapi({description:"Timestamp when the organization configuration was created"})}).openapi("OrganizationConfiguration"),hn=La.pick({hostname:!0,countriesShipping:!0,stripeAccountId:!0,enableHostCheckout:!0,enableHostTracking:!0,isAcceptingOrders:!0,defaultLocale:!0,supportedLocales:!0,defaultCurrency:!0,openingTimes:!0,closingTimes:!0,facebookProfile:!0,instagramProfile:!0,xProfile:!0}).partial().openapi("UpdateOrganizationConfiguration"),xn=m.z.object({id:m.z.string().openapi({example:"clm1234567890abcdef",description:"The unique identifier of the organization"}),name:m.z.string().openapi({example:"Acme Store",description:"The name of the organization"}),phone:m.z.string().min(1,"Phone number is required").openapi({example:"+48123456890",description:"The phone number of the organization"}),email:m.z.string().email().optional().openapi({example:"john.doe@example.com",description:"The email address of the organization"}),createdAt:m.z.date().openapi({example:"2022-01-01T00:00:00.000Z",description:"The date and time the organization was created"}),legalEntityId:m.z.string().nullable().openapi({example:"clm1234567890abcdef",description:"The unique identifier of the legal entity associated with the organization"}),address:$e,configuration:La.openapi({description:"The configuration settings for the organization"}),logo:m.z.string().url().optional().nullable().openapi({example:"https://example.com/logo.jpg",description:"The logo of the organization"}),logoFile:Ie.optional().nullable().openapi({description:"The logo of the organization"})}).openapi("Organization"),Ea=xn.pick({name:!0,phone:!0,email:!0,logoFile:!0}).extend({logoId:m.z.string().optional().nullable().openapi({example:"clm1234567890abcdef",description:"The unique identifier of the thumbnail image associated with the organization"}),address:Ot}).openapi("CreateOrganization"),bs=Ea.extend({address:Pa,configuration:hn}).partial().openapi("UpdateOrganization"),fn=m.z.object({id:m.z.string().openapi({example:"clf9876543210abcdef",description:"ID of the manufacturer"}),name:m.z.string().openapi({example:"Tech Innovators Inc.",description:"Name of the manufacturer"}),logo:Ie.nullable().optional().openapi({description:"Logo of the manufacturer"}),createdAt:m.z.date(),translations:m.z.array(m.z.object({locale:m.z.string().min(1,"Locale is required").openapi({example:"en-US",description:"Locale code for the translation"}),about:m.z.string().max(6e3,"Maximum character limit is 6000").nullable().optional().openapi({example:"Tech Innovators Inc. is a technology company.",description:"Description about the manufacturer in the specified locale"})})).optional().openapi({description:"List of translations for the manufacturer"})}).openapi("Manufacturer");fn.omit({translations:!0}).extend({about:m.z.string().nullable().optional().default("")}).openapi("LocalizedManufacturer");const yn=m.z.object({name:m.z.string().min(1,"Name is required").openapi({example:"Apple Inc.",description:"Name of the manufacturer"}),defaultLocale:m.z.string().min(1,"Default locale is required").openapi({example:"en-US",description:"The default locale for the manufacturer"}),logo:Ie.nullable().optional().openapi({description:"Logo of the manufacturer"}),translations:m.z.array(m.z.object({locale:m.z.string().min(1,"Locale is required").openapi({example:"en-US",description:"Locale code for the translation"}),about:m.z.string().max(6e3,"Maximum character limit is 6000").nullable().optional().openapi({example:"Apple Inc. is a multinational technology company.",description:"Description about the manufacturer in the specified locale"})})).min(1,"Translations are required").openapi({description:"List of translations for the manufacturer"}),logoId:m.z.string().optional().openapi({example:"clf9876543210abcdef",description:"ID reference to the manufacturer's logo file"})}).superRefine(qe("about")).openapi("CreateManufacturer"),wn=m.z.object({name:m.z.string().min(1,"Name is required").optional().openapi({example:"Apple Inc. Updated",description:"Name of the manufacturer"}),logo:Ie.nullable().optional().openapi({description:"Logo of the manufacturer"}),defaultLocale:m.z.string().min(1,"Default locale is required").openapi({description:"The default locale for the manufacturer"}),logoId:m.z.string().nullable().optional().openapi({example:"clf9876543210abcdef",description:"ID reference to the manufacturer's logo file"}),translations:m.z.array(m.z.object({locale:m.z.string().min(1,"Locale is required").openapi({example:"en-US",description:"Locale code for the translation"}),about:m.z.string().max(6e3,"Maximum character limit is 6000").nullable().optional().openapi({example:"Apple Inc. is a multinational technology company.",description:"Description about the manufacturer in the specified locale"})})).optional().openapi({description:"List of translations for the manufacturer"})}).openapi("UpdateManufacturer");m.z.object({id:m.z.string().openapi({example:"clm1234567890abcdef",description:"The unique identifier of the legal entity"}),name:m.z.string().openapi({example:"Acme Corporation",description:"The name of the legal entity"}),taxId:m.z.string().min(2).max(20).openapi({example:"PL1234567890",description:"The TAX ID of the legal entity"}),email:m.z.string().email().nullable().openapi({example:"contact@acme.com",description:"The email of the legal entity",format:"email"}),phone:m.z.string().nullable().openapi({example:"+48123456789",description:"The phone number of the legal entity"}),createdAt:m.z.date().openapi({description:"The date and time when the legal entity was created",format:"date-time"}),address:$e.required().openapi({description:"The address of the legal entity"})}).openapi("LegalEntity");m.z.object({name:m.z.string().min(1,"Name is required").openapi({example:"Acme Corporation",description:"The name of the legal entity"}),taxId:m.z.string().min(2).max(20).openapi({example:"PL1234567890",description:"The TAX ID of the legal entity"}),email:m.z.string().email().optional().openapi({example:"contact@acme.com",description:"The email of the legal entity",format:"email"}),phone:m.z.string().optional().openapi({example:"+48123456789",description:"The phone number of the legal entity"}),address:Ot.required().openapi({description:"The address of the legal entity"})}).openapi("CreateLegalEntity");m.z.object({name:m.z.string().min(1,"Name is required").optional().openapi({example:"Acme Corporation",description:"The name of the legal entity"}),taxId:m.z.string().min(2).max(20).openapi({example:"PL1234567890",description:"The TAX ID of the legal entity"}),email:m.z.string().email().optional().openapi({example:"contact@acme.com",description:"The email of the legal entity",format:"email"}),phone:m.z.string().optional().openapi({example:"+48123456789",description:"The phone number of the legal entity"}),address:Pa.required().openapi({description:"The address of the legal entity"})}).openapi("UpdateLegalEntity");const bn=m.z.object({id:m.z.string().openapi({example:"clf9876543210abcdef",description:"ID of the customer"}),firstname:m.z.string().nullable().optional().openapi({example:"John Doe",description:"Name of the customer"}),email:m.z.string().nullable().optional().openapi({example:"john.doe@example.com",description:"Email of the customer"}),phone:m.z.string().nullable().optional().openapi({example:"+1234567890",description:"Phone number of the customer"}),address:$e.nullable().optional().openapi({description:"Address of the customer"}),createdAt:m.z.date(),updatedAt:m.z.date()}).openapi("Customer"),Sn=bn.pick({firstname:!0,email:!0,phone:!0}).extend({address:Ot}).openapi("Customer");Sn.partial().openapi("UpdateCustomer");const Ss=m.z.object({email:m.z.string().min(1,"Email is required").email("Invalid email").openapi({example:"user@example.com",description:"User's email address"}),password:m.z.string().min(1,"Password is required").min(8,"Password must be more than 8 characters").max(32,"Password must be less than 32 characters").openapi({example:"password123",description:"User's password"}),firstname:m.z.string().min(1,"First name is required").max(32,"First name must be less than 32 characters").openapi({example:"John",description:"User's first name"}),lastname:m.z.string().min(1,"Last name is required").max(32,"Last name must be less than 32 characters").openapi({example:"Doe",description:"User's last name"})}).openapi("SignUp"),Da=Ss.pick({email:!0,password:!0}).openapi("SignIn"),kn=m.z.object({organizationId:m.z.string().cuid().min(1,"organizationId is required").openapi({example:"ckel0e8qw00004n5p5w6fznym",description:"The organization ID"})}).openapi("OrganizationParams");kn.extend({id:m.z.string().cuid().min(1,"id is required").openapi({example:"ckel0e8qw00004n5p5w6fznym",description:"The organization ID"})}).openapi("OrganizationWithIdParams");m.z.object({placeId:m.z.string().openapi({example:"ChIJN1t_tKlj4AR4GeTYWZ7frY",description:"The Google Place ID for the address"}),text:m.z.string().openapi({example:"123 Main Street, New York, USA",description:"The description of the place"}),addressLineOne:m.z.string().openapi({example:"123 Main Street",description:"The first line of the address"}),addressLineTwo:m.z.string().optional().openapi({example:"Suite 100",description:"The second line of the address"}),latitude:m.z.number().optional().openapi({example:40.712776,description:"The latitude of the coordinate"}),longitude:m.z.number().optional().openapi({example:-74.005974,description:"The longitude of the coordinate"})}).openapi("Place");m.z.object({addressLineOne:m.z.string().openapi({example:"123 Main Street",description:"The first line of the address"}),zipCode:m.z.string().optional().openapi({example:"12345",description:"The postal code of the address"}),city:m.z.string().openapi({example:"New York",description:"The city of the address"}),country:m.z.string().openapi({example:"USA",description:"The ISO 3166-1 alpha-2 country code"})}).openapi("PlaceDetails");const jn=m.z.object({id:m.z.string().openapi({description:"Unique identifier for the order",example:"clj1234567890abcdef"}),firstname:m.z.string().openapi({description:"Customer's first name",example:"John"}),lastname:m.z.string().openapi({description:"Customer's last name",example:"Doe"}),guests:Qt,phone:m.z.string().openapi({description:"Customer's phone number",example:"+1234567890"}),date:m.z.coerce.date().openapi({description:"Reservation date and time",example:"2023-06-14T16:20:00Z"}),referenceId:m.z.string().openapi({description:"External reference ID for the order",example:"ORD-12345"}),acceptedAt:m.z.date().nullable().optional().openapi({description:"Date when the order was accepted",example:"2023-06-15T14:30:00Z"}),cancelledAt:m.z.date().nullable().optional().openapi({description:"Date when the order was cancelled",example:"2023-06-14T16:20:00Z"}),createdAt:m.z.date().nullable().optional().openapi({description:"Date when the order was created",example:"2023-06-14T16:20:00Z"})}).openapi("Reservation");jn.pick({firstname:!0,lastname:!0,guests:!0,phone:!0,date:!0}).openapi("CreateReservation");function Oe(...t){return da.twMerge(la(...t))}const Ma=["focus:ring-2","focus:ring-blue-200 dark:focus:ring-blue-700/30","focus:border-blue-500 dark:focus:border-blue-700"],Ge=["outline outline-offset-2 outline-0 focus-visible:outline-2","outline-blue-500 dark:outline-blue-500"],An=["ring-2","border-red-500 dark:border-red-700","ring-red-200 dark:ring-red-700/30"],Ba=Se.tv({base:["relative inline-flex items-center justify-center whitespace-nowrap rounded-lg border px-3 py-2 text-center text-sm font-medium shadow-2xs transition-all duration-100 ease-in-out cursor-pointer","disabled:pointer-events-none disabled:shadow-none disabled:cursor-not-allowed",Ge],variants:{variant:{primary:["border-transparent","text-white dark:text-white","bg-teal-500 dark:bg-teal-500","hover:bg-teal-600 dark:hover:bg-teal-600","disabled:bg-teal-100 disabled:text-gray-400","dark:disabled:bg-teal-800 dark:disabled:text-teal-400"],secondary:["border-gray-200 dark:border-gray-800","text-gray-900 dark:text-gray-50","bg-white dark:bg-gray-950","hover:bg-gray-50 dark:hover:bg-gray-900/60","disabled:text-gray-400","dark:disabled:text-gray-600"],light:["shadow-none","border-transparent","text-gray-900 dark:text-gray-50","bg-gray-200 dark:bg-gray-900","hover:bg-gray-300/70 dark:hover:bg-gray-800/80","disabled:bg-gray-100 disabled:text-gray-400","dark:disabled:bg-gray-800 dark:disabled:text-gray-600"],ghost:["shadow-none","border-transparent","text-gray-900 dark:text-gray-50","bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800/80","disabled:text-gray-400","dark:disabled:text-gray-600"],destructive:["text-white","border-transparent","bg-red-600 dark:bg-red-700","hover:bg-red-700 dark:hover:bg-red-600","disabled:bg-red-300 disabled:text-white","dark:disabled:bg-red-950 dark:disabled:text-red-400"]}},defaultVariants:{variant:"primary"}}),de=x.forwardRef(({asChild:t,isLoading:s=!1,loadingText:a,className:r,disabled:i,variant:n,children:o,...l},d)=>{const c=t?ps.Slot:"button";return e.jsx(c,{ref:d,className:w(Ba({variant:n}),r),disabled:i||s,...l,children:s?e.jsxs("span",{className:"pointer-events-none flex shrink-0 items-center justify-center gap-1.5",children:[e.jsx(C.RiLoader2Fill,{className:"size-4 shrink-0 animate-spin","aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:a||"Loading"}),a||"Loading"]}):o})});de.displayName="Button";const $s=[{continent:"America",items:[{value:"US",label:"United States",flag:"🇺🇸"},{value:"CA",label:"Canada",flag:"🇨🇦"},{value:"MX",label:"Mexico",flag:"🇲🇽"},{value:"BR",label:"Brazil",flag:"🇧🇷"},{value:"AR",label:"Argentina",flag:"🇦🇷"},{value:"CO",label:"Colombia",flag:"🇨🇴"},{value:"CL",label:"Chile",flag:"🇨🇱"},{value:"PE",label:"Peru",flag:"🇵🇪"}]},{continent:"Europe",items:[{value:"GB",label:"United Kingdom",flag:"🇬🇧"},{value:"FR",label:"France",flag:"🇫🇷"},{value:"DE",label:"Germany",flag:"🇩🇪"},{value:"PL",label:"Poland",flag:"🇵🇱"},{value:"IT",label:"Italy",flag:"🇮🇹"},{value:"ES",label:"Spain",flag:"🇪🇸"},{value:"NL",label:"Netherlands",flag:"🇳🇱"},{value:"PT",label:"Portugal",flag:"🇵🇹"},{value:"SE",label:"Sweden",flag:"🇸🇪"},{value:"NO",label:"Norway",flag:"🇳🇴"},{value:"DK",label:"Denmark",flag:"🇩🇰"},{value:"FI",label:"Finland",flag:"🇫🇮"},{value:"CH",label:"Switzerland",flag:"🇨🇭"},{value:"IE",label:"Ireland",flag:"🇮🇪"},{value:"BE",label:"Belgium",flag:"🇧🇪"},{value:"AT",label:"Austria",flag:"🇦🇹"},{value:"GR",label:"Greece",flag:"🇬🇷"}]},{continent:"Asia",items:[{value:"CN",label:"China",flag:"🇨🇳"},{value:"JP",label:"Japan",flag:"🇯🇵"},{value:"IN",label:"India",flag:"🇮🇳"},{value:"KR",label:"South Korea",flag:"🇰🇷"},{value:"SG",label:"Singapore",flag:"🇸🇬"},{value:"MY",label:"Malaysia",flag:"🇲🇾"},{value:"ID",label:"Indonesia",flag:"🇮🇩"},{value:"TH",label:"Thailand",flag:"🇹🇭"},{value:"VN",label:"Vietnam",flag:"🇻🇳"},{value:"AE",label:"United Arab Emirates",flag:"🇦🇪"},{value:"SA",label:"Saudi Arabia",flag:"🇸🇦"}]},{continent:"Oceania",items:[{value:"AU",label:"Australia",flag:"🇦🇺"},{value:"NZ",label:"New Zealand",flag:"🇳🇿"},{value:"FJ",label:"Fiji",flag:"🇫🇯"},{value:"PG",label:"Papua New Guinea",flag:"🇵🇬"}]},{continent:"Africa",items:[{value:"ZA",label:"South Africa",flag:"🇿🇦"},{value:"NG",label:"Nigeria",flag:"🇳🇬"},{value:"MA",label:"Morocco",flag:"🇲🇦"},{value:"EG",label:"Egypt",flag:"🇪🇬"},{value:"KE",label:"Kenya",flag:"🇰🇪"},{value:"GH",label:"Ghana",flag:"🇬🇭"},{value:"ET",label:"Ethiopia",flag:"🇪🇹"}]}],Ft=t=>e.jsx(Z.Root,{...t});Ft.displayName="Dialog";const Ja=Z.Trigger;Ja.displayName="DialogTrigger";const Oa=Z.Close;Oa.displayName="DialogClose";const Fa=Z.Portal;Fa.displayName="DialogPortal";const Va=x.forwardRef(({className:t,...s},a)=>e.jsx(Z.Overlay,{ref:a,className:w("fixed inset-0 z-50 overflow-y-auto","bg-black/70","data-[state=open]:animate-dialogOverlayShow",t),...s}));Va.displayName="DialogOverlay";const Vt=x.forwardRef(({className:t,...s},a)=>e.jsx(Fa,{children:e.jsx(Va,{children:e.jsx(Z.Content,{ref:a,className:w("fixed left-1/2 top-1/2 z-50 w-[95vw] max-w-lg -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-md border p-6 shadow-lg","border-gray-200 dark:border-gray-900","bg-white dark:bg-[#090E1A]","data-[state=open]:animate-dialogContentShow",Ge,t),...s})})}));Vt.displayName="DialogContent";const ks=({className:t,...s})=>e.jsx("div",{className:w("flex flex-col gap-y-1",t),...s});ks.displayName="DialogHeader";const js=x.forwardRef(({className:t,...s},a)=>e.jsx(Z.Title,{ref:a,className:w("text-lg font-semibold","text-gray-900 dark:text-gray-50",t),...s}));js.displayName="DialogTitle";const Ha=x.forwardRef(({className:t,...s},a)=>e.jsx(Z.Description,{ref:a,className:w("text-gray-500 dark:text-gray-500",t),...s}));Ha.displayName="DialogDescription";const Za=({className:t,...s})=>e.jsx("div",{className:w("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});Za.displayName="DialogFooter";const pt=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command,{ref:a,className:w("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...s}));pt.displayName=V.Command.displayName;const vn=({children:t,...s})=>e.jsx(Ft,{...s,children:e.jsx(Vt,{className:"overflow-hidden p-0",children:e.jsx(pt,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:t})})}),Ht=N.forwardRef(({className:t,...s},a)=>e.jsxs("div",{className:"flex items-center border-b pl-3","cmdk-input-wrapper":"",children:[e.jsx(A.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(V.Command.Input,{ref:a,className:w("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...s})]}));Ht.displayName=V.Command.Input.displayName;const Zt=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.List,{ref:a,className:w("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...s}));Zt.displayName=V.Command.List.displayName;const Ut=N.forwardRef((t,s)=>e.jsx(V.Command.Empty,{ref:s,className:"py-6 text-center text-sm",...t}));Ut.displayName=V.Command.Empty.displayName;const Wt=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.Group,{ref:a,className:w("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...s}));Wt.displayName=V.Command.Group.displayName;const Ua=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.Separator,{ref:a,className:w("-mx-1 h-px bg-border",t),...s}));Ua.displayName=V.Command.Separator.displayName;const _t=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.Item,{ref:a,className:w("relative flex cursor-default gap-2 select-none items-center rounded-xs px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...s}));_t.displayName=V.Command.Item.displayName;const Wa=({className:t,...s})=>e.jsx("span",{className:w("ml-auto text-xs tracking-widest text-muted-foreground",t),...s});Wa.displayName="CommandShortcut";const Ke=t=>e.jsx(_.Root,{...t});Ke.displayName="Popover";const Xe=N.forwardRef((t,s)=>e.jsx(_.Trigger,{ref:s,...t}));Xe.displayName="PopoverTrigger";const _a=N.forwardRef((t,s)=>e.jsx(_.Anchor,{ref:s,...t}));_a.displayName="PopoverAnchor";const qa=N.forwardRef((t,s)=>e.jsx(_.Close,{ref:s,...t}));qa.displayName="PopoverClose";const Ye=N.forwardRef(({className:t,sideOffset:s=10,side:a="bottom",align:r="center",collisionPadding:i,...n},o)=>e.jsx(_.Portal,{children:e.jsx(_.Content,{ref:o,sideOffset:s,side:a,align:r,collisionPadding:i,avoidCollisions:!0,className:Oe("max-h-[var(--radix-popper-available-height)] min-w-60 overflow-hidden rounded-md border p-2.5 text-sm shadow-md","border-gray-200 dark:border-gray-800","text-gray-900 dark:text-gray-50","bg-white dark:bg-gray-950","will-change-[transform,opacity]","data-[state=closed]:animate-hide","data-[state=open]:data-[side=bottom]:animate-slideDownAndFade data-[state=open]:data-[side=left]:animate-slideLeftAndFade data-[state=open]:data-[side=right]:animate-slideRightAndFade data-[state=open]:data-[side=top]:animate-slideUpAndFade",t),onWheel:l=>{l.stopPropagation(),l.deltaY>0?l.currentTarget.dispatchEvent(new KeyboardEvent("keydown",{key:"ArrowDown"})):l.currentTarget.dispatchEvent(new KeyboardEvent("keydown",{key:"ArrowUp"}))},...n})}));Ye.displayName="PopoverContent";const $a=({value:t,onChange:s,disabled:a})=>{const r=x.useId(),[i,n]=x.useState(!1),o=$s.map(l=>l.items.find(d=>d.value===t)).filter(Boolean)[0];return e.jsx("div",{className:"mt-2",children:e.jsxs(Ke,{open:a?!1:i,onOpenChange:a?void 0:n,children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(de,{id:r,role:"combobox",disabled:a,"aria-expanded":i,variant:"secondary",className:"w-full justify-between shadow-2xs! bg-background px-3 py-2.5 font-normal outline-offset-0 hover:bg-background focus-visible:border-ring focus-visible:outline-[3px] focus-visible:outline-ring/20 disabled:opacity-50 disabled:cursor-not-allowed",children:[t?e.jsxs("span",{className:"flex min-w-0 items-center gap-2 mr-auto",children:[e.jsx("span",{className:"text-lg leading-none",children:o==null?void 0:o.flag}),e.jsx("span",{className:"truncate",children:o==null?void 0:o.label})]}):e.jsx("span",{className:"text-muted-foreground",children:"Select country"}),e.jsx(A.ChevronDown,{size:16,strokeWidth:2,className:"shrink-0 text-muted-foreground/80","aria-hidden":"true"})]})}),e.jsx(Ye,{className:"w-full min-w-[var(--radix-popper-anchor-width)] border-input -mt-1 z-50",align:"start",children:e.jsxs(pt,{className:"p-0",children:[e.jsx(Ht,{className:"w-full border-none",style:{boxShadow:"none"},placeholder:"Search country..."}),e.jsxs(Zt,{children:[e.jsx(Ut,{children:"No country found."}),$s.map(l=>e.jsx(x.Fragment,{children:e.jsx(Wt,{heading:l.continent,children:l.items.map(d=>e.jsxs(_t,{value:d.label,className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800",onSelect:()=>{s(d.value??""),n(!1)},children:[e.jsx("span",{className:"text-lg leading-none",children:d.flag})," ",d.label,t===d.value&&e.jsx(A.Check,{size:16,strokeWidth:2,className:"ml-auto"})]},d.value))})},l.continent))]})]})})]})})},Nn=Se.tv({base:["relative block w-full rounded-lg border px-2.5 py-2.5 shadow-2xs outline-hidden transition sm:text-sm","border-gray-200 dark:border-gray-800","text-gray-900 dark:text-gray-50","placeholder-gray-400 dark:placeholder-gray-500","bg-white dark:bg-gray-950","disabled:border-gray-300 disabled:bg-gray-100 disabled:text-gray-400","dark:disabled:border-gray-700 dark:disabled:bg-gray-800 dark:disabled:text-gray-500",Ma],variants:{hasError:{true:An},enableStepper:{false:"[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none"},multiline:{true:"resize-y min-h-[100px]",false:"truncate appearance-none"}}}),we=x.forwardRef(({className:t,inputClassName:s,hasError:a,enableStepper:r=!0,type:i,multiline:n=!1,prefix:o,suffix:l,...d},c)=>{const[u,p]=x.useState(i),g=i==="password"&&!n,h=i==="search"&&!n,y=i==="textarea"?"textarea":"input";return e.jsxs("div",{className:w("relative w-full",t),children:[o&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center px-3 text-slate-600 dark:text-gray-600 z-10 text-sm border-r border-gray-200",children:o}),e.jsx(y,{ref:c,type:g?u:i,className:w(Nn({hasError:a,enableStepper:n?!1:r,multiline:n}),{"pl-16":o,"pl-8":!o&&h,"pr-10":l||!l&&g},s),...d}),!o&&h&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2 text-gray-400 dark:text-gray-600",children:e.jsx(C.RiSearchLine,{className:"size-[1.125rem]"})}),l&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2 text-gray-400 dark:text-gray-600",children:l}),!l&&g&&e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx("button",{onClick:()=>p(u==="password"?"text":"password"),className:w(Ge,"text-gray-400 hover:text-gray-500 dark:text-gray-600"),children:u==="password"?e.jsx(C.RiEyeFill,{className:"size-5"}):e.jsx(C.RiEyeOffFill,{className:"size-5"})})})]})});we.displayName="Input";const Ga=({...t})=>{const s=x.useId();return e.jsx("div",{className:"mt-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(we,{id:s,type:"email",inputClassName:"peer ps-9",...t}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 start-0 flex items-center justify-center ps-3 text-muted-foreground/80 peer-disabled:opacity-50",children:e.jsx(A.MailIcon,{size:16})})]})})},Ka=t=>{const{client:s}=E(),[a,r]=x.useState(!1),[i,n]=x.useState(0),o=async u=>{const{body:p,status:g}=await s.file.createTemporaryFile({body:{filename:u.name,mimeType:u.type,size:u.size,organizationId:t.organizationId}});if(g!==201)throw new Error("Failed to create temporary file");const h=await ia.upload(u.name,u,{access:"public",handleUploadUrl:`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/files/token/vercel`,clientPayload:JSON.stringify({fileId:p==null?void 0:p.id}),onUploadProgress(y){n(y.percentage)}});return{id:p.id,filename:u.name,mimeType:u.type,size:u.size,url:h.url}},l=async u=>{var p;if((p=u.target.files)!=null&&p[0]){r(!0);try{const g=await o(u.target.files[0]);if(t.multiple){const h=t.value??[];t.onChange([...h,g])}else t.onChange(g)}catch(g){console.error(g)}finally{r(!1)}}},d=u=>{if(t.multiple){if(!t.value)return t.onChange(void 0);const p=t.value.filter(g=>g.id!==u);t.onChange(p.length?p:void 0)}else t.onChange(void 0)},c=()=>{if(t.value){const u=t.multiple?t.value:[t.value];return e.jsxs("div",{className:"flex",children:[u.map(p=>e.jsx("div",{className:"flex flex-col w-40 h-40 mr-3 transition-all rounded-lg relative animate-fade",children:e.jsxs("div",{className:"relative h-full w-40",children:[e.jsx("button",{className:"absolute w-6 h-6 bg-black flex items-center justify-center rounded-md right-1 top-1",onClick:()=>d(p.id),children:e.jsx(A.XIcon,{className:"w-4 h-4 text-white"})}),e.jsx(xe,{src:p.url,alt:p.filename,width:160,height:160,className:"w-40 h-40 rounded-md object-cover"})]})},p.id)),t.multiple&&e.jsxs("div",{className:"group flex relative flex-col w-40 h-40 items-center justify-center cursor-pointer border-2 border-gray-200 border-dashed transition-all rounded-lg hover:bg-gray-100 hover:border-gray-300",children:[e.jsx("div",{className:"flex flex-col items-center justify-center",children:a?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"animate-spin w-4 h-4 fill-current shrink-0 mb-2",viewBox:"0 0 16 16",children:e.jsx("path",{d:"M8 16a7.928 7.928 0 01-3.428-.77l.857-1.807A6.006 6.006 0 0014 8c0-3.309-2.691-6-6-6a6.006 6.006 0 00-5.422 8.572l-1.806.859A7.929 7.929 0 010 8c0-4.411 3.589-8 8-8s8 3.589 8 8-3.589 8-8 8z"})}),e.jsxs("span",{className:"text-sm",children:["Uploading... (",i,"%)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(A.CloudUpload,{className:"w-12 h-12 text-gray-300 group-hover:text-gray-600 transition-all stroke-1"}),e.jsx("p",{className:"pt-1 text-sm font-medium text-gray-400 group-hover:text-gray-600",children:"Upload an image"})]})}),e.jsx("input",{type:"file",className:"opacity-0 w-full h-full absolute cursor-pointer",onChange:l,accept:"image/png, image/gif, image/jpeg"})]},"upload-placeholder")]})}return e.jsxs("div",{className:"group flex relative flex-col items-center justify-center cursor-pointer w-full h-40 border-2 border-gray-200 border-dashed transition-all rounded-lg hover:bg-gray-100 hover:border-gray-300",children:[e.jsx("div",{className:"flex flex-col items-center justify-center",children:a?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"animate-spin w-4 h-4 fill-current shrink-0 mb-2",viewBox:"0 0 16 16",children:e.jsx("path",{d:"M8 16a7.928 7.928 0 01-3.428-.77l.857-1.807A6.006 6.006 0 0014 8c0-3.309-2.691-6-6-6a6.006 6.006 0 00-5.422 8.572l-1.806.859A7.929 7.929 0 010 8c0-4.411 3.589-8 8-8s8 3.589 8 8-3.589 8-8 8z"})}),e.jsxs("span",{className:"text-sm",children:["Uploading... (",i,"%)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(A.CloudUpload,{className:"w-12 h-12 text-gray-300 group-hover:text-gray-600 transition-all stroke-1"}),e.jsx("p",{className:"pt-1 text-sm font-medium text-gray-400 group-hover:text-gray-600",children:"Upload an image"})]})}),e.jsx("input",{type:"file",className:"opacity-0 w-full h-full absolute cursor-pointer",onChange:l,accept:"image/png, image/gif, image/jpeg"})]},"upload-placeholder")};return e.jsx("div",{className:"flex items-center w-full mt-2",children:c()})},qt=({value:t,onChange:s,placeholder:a="Search for a place"})=>{const{client:r}=E(),i=x.useId(),[n,o]=x.useState(!1),[l,d]=x.useState(""),[c,u]=x.useState(null),p=x.useRef(null),[g]=Fe.useDebounce(l,300);x.useEffect(()=>{t&&(c==null?void 0:c.text)!==t&&d(t)},[t,c]);const{data:h=[],error:y,isLoading:b}=R.useQuery({queryKey:["autocomplete",g],queryFn:async()=>{if(!g||g.length<2)return[];const S=await r.location.getPredictions({query:{query:g}});if(S.status!==200)throw new Error("Failed to fetch predictions");return Array.isArray(S.body)?S.body:(console.warn("API did not return an array:",S.body),[])},enabled:g.length>=2,refetchOnWindowFocus:!1}),f=S=>{u(S),d(S.text);const k={placeId:S.placeId,text:S.text,addressLineOne:S.addressLineOne,addressLineTwo:S.addressLineTwo};s(k),o(!1)};return x.useEffect(()=>{n&&p.current&&p.current.focus()},[n]),e.jsxs("div",{className:"mt-2 relative",children:[e.jsxs(Ke,{open:n,onOpenChange:o,children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(de,{id:i,role:"combobox","aria-expanded":n,variant:"secondary",className:"w-full shadow-2xs! bg-background px-2! py-1 min-h-[41.6px] font-normal outline-offset-0 hover:bg-background focus-visible:border-ring focus-visible:outline-[3px] focus-visible:outline-ring/20",onClick:()=>o(!n),children:[t?e.jsx("span",{className:"px-1 text-sm truncate mr-auto",children:t}):e.jsx("span",{className:"px-1 text-sm text-gray-400 mr-auto",children:a}),e.jsx(A.ChevronDown,{size:16,strokeWidth:2,className:"shrink-0 text-muted-foreground/80","aria-hidden":"true"})]})}),e.jsxs(Ye,{className:"w-full min-w-[var(--radix-popper-anchor-width)] border-input -mt-1 z-50 p-0",align:"start",children:[e.jsxs("div",{className:"flex items-center border-b px-3 py-2",children:[e.jsx(A.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx("input",{ref:p,placeholder:"Search places...",className:"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",value:l,onChange:S=>{d(S.target.value),S.target.value.length>=2&&o(!0)}})]}),e.jsxs("div",{className:"max-h-[300px] overflow-y-auto",children:[b&&e.jsxs("div",{className:"py-6 text-center",children:[e.jsx(A.Loader2,{className:"h-4 w-4 animate-spin mx-auto"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Searching places..."})]}),!b&&l.length<2&&e.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"Type at least 2 characters to search"}),!b&&l.length>=2&&h.length===0&&e.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No places found"}),!b&&l.length>=2&&h.length>0&&e.jsxs("div",{className:"py-1",children:[e.jsxs("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:["Found ",h.length," results"]}),h.map((S,k)=>e.jsxs("div",{className:"relative flex cursor-pointer select-none items-center rounded-xs px-2 py-2 text-sm outline-hidden hover:bg-gray-100 dark:hover:bg-gray-800",onClick:()=>f(S),children:[e.jsxs("div",{className:"flex flex-col grow",children:[e.jsx("span",{children:S.addressLineOne||S.text}),S.addressLineTwo&&e.jsx("span",{className:"text-xs text-muted-foreground",children:S.addressLineTwo})]}),(c==null?void 0:c.placeId)===S.placeId&&e.jsx(A.Check,{size:16,strokeWidth:2,className:"ml-auto"})]},`${S.placeId||"place"}-${k}`))]})]})]})]}),y&&e.jsxs("p",{className:"text-xs text-red-500 mt-1",children:["Error fetching results: ",y.message]})]})},Xa=x.forwardRef(({...t},s)=>e.jsx(we,{...t,inputClassName:"border-l-0 rounded-l-none",ref:s,className:""}));Xa.displayName="PhoneInput";const Rn=({disabled:t,value:s,onChange:a,options:r})=>{const i=n=>{a(n.target.value)};return e.jsxs("div",{className:"relative inline-flex items-center self-stretch rounded-s-lg border border-gray-200 dark:border-gray-800 bg-background py-2 pe-2 ps-3 text-muted-foreground transition-shadow focus-within:z-10 focus-within:border-ring focus-within:outline-hidden focus-within:ring-[3px] focus-within:ring-ring/20 hover:bg-accent hover:text-foreground has-disabled:pointer-events-none has-disabled:opacity-50",children:[e.jsxs("div",{className:"inline-flex items-center gap-1","aria-hidden":"true",children:[e.jsx(Ya,{country:s,countryName:s,"aria-hidden":"true"}),e.jsx("span",{className:"text-muted-foreground/80",children:e.jsx(A.ChevronDown,{size:16,strokeWidth:2,"aria-hidden":"true"})})]}),e.jsxs("select",{disabled:t,value:s,onChange:i,className:"absolute inset-0 text-sm opacity-0","aria-label":"Select country",children:[e.jsx("option",{value:"",children:"Select a country"},"default"),r.filter(n=>n.value).map((n,o)=>e.jsxs("option",{value:n.value,children:[n.label," ",n.value&&`+${Dt.getCountryCallingCode(n.value)}`]},n.value??`empty-${o}`))]})]})},Ya=({country:t,countryName:s})=>{const a=ca[t];return e.jsx("span",{className:"w-5 overflow-hidden rounded-xs",children:a?e.jsx(a,{title:s}):e.jsx(A.Phone,{size:16,"aria-hidden":"true"})})},er=({value:t,onChange:s,onBlur:a})=>{const r=x.useId();return e.jsx("div",{className:"mt-2",children:e.jsx(Dt.default,{id:r,className:"flex rounded-lg shadow-2xs shadow-black/5",international:!0,flagComponent:Ya,countrySelectComponent:Rn,inputComponent:Xa,placeholder:"Enter phone number",value:t,onChange:i=>s(i??""),onBlur:a})})},tr=({options:t,value:s,onChange:a,multiple:r=!1,placeholder:i})=>{var u;const n=x.useId(),[o,l]=x.useState(!1),d=p=>{if(r){let g;Array.isArray(s)&&s.includes(p)?g=s.filter(h=>h!==p):g=Array.isArray(s)?[...s,p]:[p],a(g)}else a(p),l(!1)},c=p=>{if(r&&Array.isArray(s)){const g=s.filter(h=>h!==p);a(g)}};return e.jsx("div",{className:"mt-2",children:e.jsxs(Ke,{open:o,onOpenChange:l,children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(de,{id:n,role:"combobox","aria-expanded":o,variant:"secondary",className:"w-full justify-between shadow-2xs! bg-background px-2! py-1 min-h-[41.6px] font-normal outline-offset-0 hover:bg-background focus-visible:border-ring focus-visible:outline-[3px] focus-visible:outline-ring/20",children:[(s==null?void 0:s.length)>0?e.jsx("div",{className:"flex flex-wrap gap-2",children:Array.isArray(s)?s.map(p=>{const g=t.find(h=>h.value===p);return g?e.jsxs("span",{className:"animate-fadeIn relative inline-flex cursor-default items-center rounded-md border border-border bg-background px-2 py-1 text-xs font-medium text-secondary-foreground transition-all hover:bg-background disabled:cursor-not-allowed disabled:opacity-50",children:[g.label,e.jsx(A.X,{size:12,onClick:h=>{h.preventDefault(),c(p)},className:"cursor-pointer ml-1"})]},p):null}):e.jsx("span",{className:"px-1 text-sm",children:(u=t.find(p=>p.value===s))==null?void 0:u.label})}):e.jsx("span",{className:"px-1 text-sm text-gray-400",children:i||(r?"Select options":"Select an option")}),e.jsx(A.ChevronDown,{size:16,strokeWidth:2,className:"shrink-0 text-muted-foreground/80","aria-hidden":"true"})]})}),e.jsx(Ye,{className:"w-full min-w-[var(--radix-popper-anchor-width)] border-input -mt-1 z-50 p-0",align:"start",children:e.jsxs(pt,{className:"p-0",children:[e.jsx(Ht,{className:"w-full border-none pl-0",style:{boxShadow:"none"},placeholder:"Search..."}),e.jsxs(Zt,{children:[e.jsx(Ut,{children:"No options found."}),e.jsx(Wt,{children:t.map(p=>e.jsxs(_t,{value:p.label,className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800",onSelect:()=>d(p.value),children:[p.label,(r?s.includes(p.value):s===p.value)&&e.jsx(A.Check,{size:16,strokeWidth:2,className:"ml-auto"})]},p.value))})]})]})})]})})},Cn=Se.tv({slots:{root:["group relative isolate inline-flex shrink-0 cursor-pointer items-center rounded-full p-0.5 shadow-inner outline-hidden ring-1 ring-inset transition-all","bg-gray-200 dark:bg-gray-950","ring-black/5 dark:ring-gray-800","data-[state=checked]:bg-blue-600 dark:data-[state=checked]:bg-blue-600","data-disabled:cursor-default","data-disabled:data-[state=checked]:bg-blue-200","data-disabled:data-[state=checked]:ring-gray-300","dark:data-disabled:data-[state=checked]:ring-gray-900","dark:data-disabled:data-[state=checked]:bg-blue-900","data-disabled:data-[state=unchecked]:ring-gray-300","data-disabled:data-[state=unchecked]:bg-gray-100","dark:data-disabled:data-[state=unchecked]:ring-gray-700","dark:data-disabled:data-[state=unchecked]:bg-gray-800",Ge],thumb:["pointer-events-none relative inline-block transform appearance-none rounded-full border-none shadow-lg outline-hidden transition-all duration-150 ease-in-out focus:border-none focus:outline-hidden focus:outline-transparent","bg-white dark:bg-gray-50","group-data-disabled:shadow-none","group-data-disabled:bg-gray-50 dark:group-data-disabled:bg-gray-500"]},variants:{size:{default:{root:"h-7 w-14",thumb:"h-4 w-4 data-[state=checked]:translate-x-7 data-[state=unchecked]:translate-x-0"},small:{root:"h-4 w-7",thumb:"h-3 w-3 data-[state=checked]:translate-x-3 data-[state=unchecked]:translate-x-0"}}},defaultVariants:{size:"default"}}),As=x.forwardRef(({className:t,size:s,...a},r)=>{const{root:i,thumb:n}=Cn({size:s});return e.jsx(Pt.Root,{ref:r,className:w(i(),t),...a,children:e.jsx(Pt.Thumb,{className:w(n())})})});As.displayName="Switch";const sr=x.forwardRef(({className:t,type:s,...a},r)=>e.jsx("input",{type:s,className:Oe("flex h-10 w-full rounded-md border border-gray-200 bg-white px-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:outline-hidden focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-50 dark:placeholder:text-gray-500",t),ref:r,...a}));sr.displayName="TextInput";function vs({className:t,...s}){const a=x.useId();return e.jsx(sr,{id:a,placeholder:"00:00",className:w(t,"mt-2"),ref:Ci.withMask("99:99",{placeholder:"-",showMaskOnHover:!1}),...s})}const le=N.forwardRef(({className:t,disabled:s,...a},r)=>e.jsx(pa.Root,{ref:r,className:Oe("text-sm leading-none font-medium","text-gray-900 dark:text-gray-50",{"text-gray-400 dark:text-gray-600":s},t),"aria-disabled":s,...a}));le.displayName="Label";const Pn=({value:t,onChange:s,disabled:a})=>{const r=()=>{const f=new Date,S=new Date(f);return S.setMinutes(f.getMinutes()+30),S},i=x.useMemo(()=>{const f=[],S=new Date;for(let k=0;k<7;k++){const j=new Date(S);j.setDate(S.getDate()+k),j.setHours(0,0,0,0),f.push(j)}return f},[]),n=f=>{const S=r();if(!(f.toDateString()===new Date().toDateString()))return!0;if(S.getHours()>=21&&S.getMinutes()>0)return!1;for(let j=11;j<=21;j++){const v=new Date(f);if(v.setHours(j,0,0,0),v>S)return!0}return!1},o=f=>!n(f),l=x.useMemo(()=>i.find(f=>!o(f))||null,[i]),[d,c]=x.useState(t||l),[u,p]=x.useState(t?`${t.getHours()}:${t.getMinutes()===0?"00":t.getMinutes()}`:null),g=x.useMemo(()=>{if(!d)return[];const f=[],S=r(),k=d.toDateString()===new Date().toDateString();for(let j=11;j<=21;j++){const v=new Date(d);v.setHours(j,0,0,0),(!k||v>S)&&f.push(`${j}:00`)}return f},[d]),h=f=>{const S=f.toLocaleDateString("en-US",{weekday:"short"}),k=f.toLocaleDateString("en-US",{month:"short"}),j=f.getDate();return{weekday:S,month:k,day:j}},y=f=>{c(f),p(null)},b=f=>{if(p(f),d){const[S]=f.split(":").map(Number),k=new Date(d);k.setHours(S,0,0,0),s(k)}};return x.useEffect(()=>{!d&&l&&c(l)},[]),e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"col-span-4 mt-4",children:[e.jsx(le,{htmlFor:"date",children:"Select Date"}),e.jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:i.map((f,S)=>{const{weekday:k,month:j,day:v}=h(f),P=o(f);return e.jsx("button",{type:"button",disabled:P,className:`p-2 text-center border rounded-md ${P?"opacity-50 cursor-not-allowed":"cursor-pointer"} ${d&&d.toDateString()===f.toDateString()?"bg-teal-500 text-white":"bg-white hover:bg-gray-100"}`,onClick:()=>!P&&y(f),children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:"text-xs font-medium",children:k}),e.jsx("span",{className:"text-xl font-black font-red-hat-display",children:v}),e.jsx("span",{className:"text-xs font-medium",children:j})]})},S)})})]}),d&&g.length>0&&e.jsxs("div",{className:"col-span-4 mt-4",children:[e.jsx(le,{htmlFor:"time",children:"Select Time"}),e.jsx("div",{className:"grid grid-cols-5 gap-2 mt-2",children:g.map((f,S)=>e.jsx("button",{type:"button",className:`p-2 text-sm text-center border rounded-md font-medium cursor-pointer ${u===f?"bg-teal-500 text-white":"bg-white hover:bg-gray-100"}`,onClick:()=>b(f),children:f},S))})]})]})},ar=({name:t,type:s,placeholder:a,multiple:r,options:i,disabled:n,prefix:o})=>{const{watch:l,register:d,setFocus:c,setValue:u}=F.useFormContext();switch(s){case"email":return e.jsx(Ga,{...d(t),placeholder:a});case"file":return e.jsx(Ka,{value:l(t),multiple:r,onChange:p=>u(t,p,{shouldValidate:!0,shouldDirty:!0})});case"week-time":return e.jsx(Pn,{value:l(t),onChange:p=>u(t,p,{shouldValidate:!0,shouldDirty:!0})});case"phone-number":return e.jsx(er,{value:l("phone"),onChange:p=>u(t,p,{shouldValidate:!0,shouldDirty:!0}),onBlur:()=>c("phone")});case"country":return e.jsx($a,{value:l(t),onChange:p=>u(t,p,{shouldValidate:!0,shouldDirty:!0}),disabled:n});case"select":{const p=r?l(t)||[]:l(t)||"";if(!i)throw new Error("Options are required for select input");return e.jsx(tr,{options:i,value:p,onChange:g=>u(t,g),placeholder:a,multiple:r})}case"switch":return e.jsx(As,{size:"default",className:"mt-2",value:l(t),onCheckedChange:p=>u(t,p)});case"location":return e.jsx(qt,{value:l(t),onChange:p=>u(t,p.addressLineOne)});case"time":return e.jsx(vs,{value:l(t),...d(t)});default:return e.jsx(we,{...d(t),type:s,rows:s==="textarea"?4:void 0,placeholder:a,className:"mt-2",prefix:o})}},rr=(t,s)=>!t||typeof t!="object"?void 0:s?s.replace(/\[/g,".").replace(/\]/g,"").split(".").filter(Boolean).reduce((r,i)=>{if(r!=null)return r[i]},t):t,ae=({type:t="text",name:s,label:a,className:r,locale:i,placeholder:n,multiple:o,options:l,localizable:d,prefix:c,disabled:u})=>{const{errors:p}=F.useFormState(),g=rr(p,s);return e.jsxs("div",{className:w("w-full",r),children:[typeof a=="string"&&e.jsxs(le,{htmlFor:s,className:"font-medium flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center",children:[a,d&&e.jsx(A.LanguagesIcon,{className:"w-4 h-4 ml-1 text-gray-500"})]}),i&&d&&e.jsxs("span",{className:"flex items-center text-xs text-gray-500 ml-1 bg-gray-100 px-1 py-0.5 rounded-sm",children:[Bt.get(i)," (",i,")"]})]}),e.jsx(ar,{type:t,name:s,placeholder:n,options:l,multiple:o,prefix:c,disabled:u}),(g==null?void 0:g.message)&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:g.message})]})},ir=({isOpen:t,onClose:s,children:a})=>e.jsx(it.Transition,{show:t,as:x.Fragment,children:e.jsx(it.Dialog,{as:"div",className:"fixed inset-0 overflow-hidden",onClose:s,children:e.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[e.jsx(it.TransitionChild,{as:x.Fragment,enter:"ease-in-out duration-500",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in-out duration-500",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:e.jsx("div",{className:"fixed inset-0 bg-black/75 z-20 transition-opacity"})}),e.jsx("div",{className:"fixed h-1/2 top-0 right-0 z-30 max-w-full flex",children:e.jsx(it.TransitionChild,{as:x.Fragment,enter:"transform transition ease-in-out duration-500",enterFrom:"-translate-y-full",enterTo:"translate-y-0",leave:"transform transition ease-in-out duration-500",leaveFrom:"translate-y-0",leaveTo:"-translate-y-full",children:e.jsx(it.DialogPanel,{className:"relative w-screen h-full",children:e.jsx("div",{className:"max-h-screen bg-gray-900 flex flex-col py-6 shadow-xl overflow-y-scroll",children:a})})})})]})})}),Tn=w("hidden h-6 select-none items-center justify-center rounded-md bg-gray-800 px-2 font-mono text-xs text-gray-400 ring-1 ring-inset ring-gray-700 transition sm:flex"),nr=({open:t=!1,onOpenChange:s,defaultOpen:a=!1,disableAutoFocus:r=!0,children:i})=>e.jsxs(_.Root,{open:t,onOpenChange:s,defaultOpen:a,children:[e.jsx(_.Anchor,{className:w("fixed inset-x-0 bottom-8 mx-auto flex w-fit items-center")}),e.jsx(_.Portal,{children:e.jsx(_.Content,{side:"top",sideOffset:0,onOpenAutoFocus:n=>{r&&n.preventDefault()},className:w("z-50","data-[state=closed]:animate-hide","data-[side=top]:animate-slideUpAndFade"),children:i})})]});nr.displayName="CommandBar";const or=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:w("px-3 py-2.5 text-sm tabular-nums text-gray-300",t),...s}));or.displayName="CommandBar.Value";const lr=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:w("relative flex items-center rounded-lg bg-gray-900 px-1 shadow-lg shadow-black/30 dark:ring-1 dark:ring-white/10",t),...s}));lr.displayName="CommandBarBar";const dr=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:w("h-4 w-px bg-gray-700",t),...s}));dr.displayName="CommandBar.Seperator";const cr=N.forwardRef(({className:t,type:s="button",label:a,action:r,shortcut:i,disabled:n,...o},l)=>(N.useEffect(()=>{const d=c=>{c.key===i.shortcut&&(c.preventDefault(),c.stopPropagation(),r())};return n||document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},[r,i,n]),e.jsx("span",{className:w("flex items-center gap-x-2 rounded-lg bg-gray-900 p-1 text-base font-medium text-gray-50 outline-hidden transition focus:z-10 sm:text-sm","sm:last-of-type:-mr-1",t),children:e.jsxs("button",{ref:l,type:s,onClick:r,disabled:n,className:w("flex items-center gap-x-2 rounded-md px-1 py-1 hover:bg-gray-800","focus-visible:bg-gray-800 focus-visible:hover:bg-gray-800","disabled:text-gray-500",Ge),...o,children:[e.jsx("span",{children:a}),e.jsx("span",{className:Tn,children:i.label?i.label.toUpperCase():i.shortcut.toUpperCase()})]})})));cr.displayName="CommandBar.Command";const zt=N.forwardRef(({className:t,...s},a)=>e.jsx(ms.Root,{ref:a,className:Oe("grid gap-2",t),...s}));zt.displayName="RadioCardGroup";const It=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{className:Oe("relative flex size-4 shrink-0 appearance-none items-center justify-center rounded-full border shadow-2xs outline-hidden","border-gray-300 dark:border-gray-800","bg-white dark:bg-gray-950","group-data-[state=checked]:border-0 group-data-[state=checked]:border-transparent group-data-[state=checked]:bg-blue-600","group-data-disabled:border","group-data-disabled:border-gray-300 group-data-disabled:bg-gray-100 group-data-disabled:text-gray-400","dark:group-data-disabled:border-gray-700 dark:group-data-disabled:bg-gray-800",Ge,t),children:e.jsx(ms.Indicator,{ref:a,className:"flex items-center justify-center",...s,children:e.jsx("div",{className:Oe("size size-1.5 shrink-0 rounded-full","bg-white","group-data-disabled:bg-gray-400 dark:group-data-disabled:bg-gray-500")})})}));It.displayName="RadioCardGroupIndicator";const Lt=N.forwardRef(({className:t,children:s,...a},r)=>e.jsx(ms.Item,{ref:r,className:Oe("group relative w-full rounded-lg border p-4 text-left shadow-2xs transition-all focus:outline-hidden","bg-white dark:bg-gray-950","border-gray-200 dark:border-gray-800","data-[state=checked]:border-blue-600 dark:data-[state=checked]:border-blue-600",Ma,t),...a,children:s}));Lt.displayName="RadioCardItem";const ur=Se.tv({base:w("inline-flex items-center gap-x-1 whitespace-nowrap rounded-sm px-1.5 py-0.5 text-xs font-semibold ring-1"),variants:{variant:{default:["bg-blue-50 text-blue-800 ring-blue-500/30","dark:bg-blue-400/10 dark:text-blue-400 dark:ring-blue-400/30"],neutral:["bg-gray-50 text-gray-700 ring-gray-500/30","dark:bg-gray-400/10 dark:text-gray-300 dark:ring-gray-400/20"],success:["bg-emerald-50 text-emerald-800 ring-emerald-600/30","dark:bg-emerald-400/10 dark:text-emerald-400 dark:ring-emerald-400/20"],error:["bg-red-50 text-red-800 ring-red-600/20","dark:bg-red-400/10 dark:text-red-400 dark:ring-red-400/20"],warning:["bg-yellow-50 text-yellow-800 ring-yellow-600/30","dark:bg-yellow-400/10 dark:text-yellow-500 dark:ring-yellow-400/20"]}},defaultVariants:{variant:"default"}}),We=x.forwardRef(({className:t,variant:s,...a},r)=>e.jsx("span",{ref:r,className:w(ur({variant:s}),t),...a}));We.displayName="Badge";const _e=x.forwardRef(({className:t,children:s,...a},r)=>e.jsx("div",{ref:r,className:w("mx-auto my-6 flex w-full items-center justify-between gap-3 text-sm col-span-full","text-gray-500 dark:text-gray-500",t),...a,children:s?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:w("h-[1px] w-full","bg-gray-200 dark:bg-gray-800")}),e.jsx("div",{className:"whitespace-nowrap text-inherit",children:s}),e.jsx("div",{className:w("h-[1px] w-full","bg-gray-200 dark:bg-gray-800")})]}):e.jsx("div",{className:w("h-[0.5px] w-full","bg-gray-200 dark:bg-gray-800")})}));_e.displayName="Divider";const Qn=({initialData:t,shippingAndPaymentPageUrl:s})=>{const{itemCount:a}=Mt(),r=Q.useRouter(),{client:i}=E(),n=F.useForm({resolver:ue.zodResolver(Ta),reValidateMode:"onChange",defaultValues:t?{firstname:t.firstname,lastname:t.lastname,phone:t.phone,addressLineOne:t.addressLineOne,placeId:t.placeId,doorNumber:t.doorNumber,zipCode:t.zipCode,city:t.city,country:t.country,deliveryInstructions:t.deliveryInstructions}:void 0}),o=n.watch("placeId"),l=n.watch("addressLineOne");x.useEffect(()=>{(async()=>{if(o){const{status:p,body:g}=await i.location.getPlaceDetails({params:{placeId:o}});if(p!==200)throw new Error("Failed to fetch place details");n.setValue("zipCode",g.zipCode,{shouldValidate:!0,shouldDirty:!0}),n.setValue("city",g.city,{shouldValidate:!0,shouldDirty:!0}),n.setValue("country",g.country,{shouldValidate:!0,shouldDirty:!0})}})()},[n,o]);const d=R.useMutation({mutationFn:async p=>{const{status:g,body:h}=await i.shipping.createShippingAddress({body:p});if(g!==201)throw new Error("Failed to create shipping address");return h},onSuccess:()=>{r.push(s)}}),c=R.useMutation({mutationFn:async p=>{const{status:g,body:h}=await i.shipping.updateShippingAddress({body:p});if(g!==200)throw new Error("Failed to update shipping address");return h},onSuccess:()=>r.push(s)}),u=p=>{(t?c:d).mutate(p)};return e.jsx("div",{className:"flex flex-col gap-4",children:e.jsx(F.FormProvider,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(u),children:[e.jsxs("div",{className:"grid grid-cols-4 gap-x-4 gap-y-4 mt-3",children:[e.jsx(ae,{name:"firstname",label:"First Name",type:"text",className:"col-span-2",placeholder:"e.g. John"}),e.jsx(ae,{name:"lastname",label:"Last Name",type:"text",className:"col-span-2",placeholder:"e.g. Doe"}),e.jsx(ae,{name:"phone",label:"Phone",type:"phone-number",className:"col-span-4",placeholder:"e.g. +48 123 456 789"}),e.jsxs("div",{className:"col-span-4 md:col-span-3 text-sm text-gray-500",children:[e.jsx(le,{htmlFor:"address.addressLineOne",className:"font-medium flex items-center justify-between",children:"Street Address"}),e.jsx(qt,{onChange:p=>{n.setValue("addressLineOne",p.addressLineOne,{shouldValidate:!0,shouldDirty:!0}),n.setValue("placeId",p.placeId,{shouldValidate:!0,shouldDirty:!0})},value:l}),n.formState.errors.addressLineOne&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:String(n.formState.errors.addressLineOne.message??"")})]}),e.jsx(ae,{name:"doorNumber",label:"Door Number",type:"text",className:"md:col-span-1 col-span-2",placeholder:"e.g. 123"}),e.jsx(ae,{name:"zipCode",label:"Postal Code",type:"text",className:"col-span-2",placeholder:"e.g. 12345"}),e.jsx(ae,{name:"city",label:"City",type:"text",className:"col-span-2",placeholder:"e.g. Kraków"}),e.jsx(ae,{name:"country",label:"Country",type:"country",className:"col-span-2 md:col-span-4",disabled:!0}),e.jsx(ae,{name:"deliveryInstructions",label:"Notes / Instructions",type:"textarea",className:"col-span-4",placeholder:"e.g. 4th floor, code 12345"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-2 w-full mt-8",children:[e.jsx(de,{variant:"secondary",className:"shadow-none",type:"button",onClick:()=>r.push("/"),children:"Back"}),e.jsx(de,{type:"submit",className:"shadow-none bg-teal-500 hover:bg-teal-400 text-white",isLoading:d.isPending||c.isPending,disabled:a===0,loadingText:"Saving...",children:"Save & Continue"})]})]})})})},zn=()=>e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm col-span-2"}),e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm col-span-2"})]}),e.jsx("div",{className:"h-[70px] bg-gray-100 rounded-sm"}),e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm col-span-3"}),e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm col-span-1"})]}),e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm col-span-2"}),e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm col-span-2"})]}),e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm"}),e.jsx("div",{className:"h-[100px] bg-gray-100 rounded-sm"}),e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm mt-8"})]}),ds=({shippingAndPaymentPageUrl:t="/checkout/shipping-and-payment"})=>{const s=Q.useRouter(),{client:a}=E(),{data:r,isLoading:i,error:n}=R.useQuery({queryKey:["shippingAddress"],queryFn:async()=>{const{status:l,body:d}=await a.shipping.getShippingAddress();if(l!==200)throw new Error("Failed to fetch shipping address");return d}}),o=()=>{s.push(t)};return i?e.jsx(zn,{}):n?e.jsxs("div",{className:"p-4 rounded-lg bg-red-50 text-red-700",children:[e.jsx("p",{className:"font-semibold",children:"Failed to load shipping address"}),e.jsx("p",{className:"text-xs",children:"Please try refreshing the page or contact support if the issue persists."})]}):e.jsxs("div",{className:"flex flex-col gap-4 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-col gap-y-1",children:[e.jsx("h1",{className:"text-[32px] font-red-hat-display font-black dark:text-blue-500",children:"Shipping Details"}),e.jsx("p",{className:"text-gray-500",children:"Please fill in the your shipping details to continue."})]}),e.jsx(Qn,{initialData:r??null,onSuccess:o,shippingAndPaymentPageUrl:t},r==null?void 0:r.id)]})},In=()=>e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"animate-pulse space-y-4",children:e.jsx("div",{className:"space-y-2",children:[1,2,3].map(t=>e.jsxs("div",{className:"flex items-center gap-3 p-4 border rounded-lg",children:[e.jsx("div",{className:"h-4 w-4 bg-gray-100 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-5 w-32 bg-gray-100 rounded-sm"}),e.jsx("div",{className:"h-4 w-24 bg-gray-100 rounded-sm"})]})]},t))})}),e.jsx("div",{className:"animate-pulse space-y-4 mt-8",children:e.jsx("div",{className:"space-y-2",children:[1,2].map(t=>e.jsxs("div",{className:"flex items-center gap-3 p-4 border rounded-lg",children:[e.jsx("div",{className:"h-4 w-4 bg-gray-100 rounded-full"}),e.jsx("div",{className:"h-5 w-24 bg-gray-100 rounded-sm"})]},t))})}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-2 w-full mt-4",children:[e.jsx("div",{className:"h-10 bg-gray-100 rounded-sm"}),e.jsx("div",{className:"h-10 bg-gray-100 rounded-sm"})]})]}),Ln=({shippingMethods:t,paymentMethods:s,customerDetailsPageUrl:a})=>{const r=Q.useRouter(),{client:i}=E(),{organizationId:n}=ze(),{items:o,shippingMethod:l,paymentMethod:d,setPaymentMethod:c,setShippingMethod:u}=Mt(),p=R.useMutation({mutationFn:async()=>{if(!l)throw new Error("Please select a shipping method");if(!d)throw new Error("Please select a payment method");const{body:h,status:y}=await i.order.createOrder({params:{organizationId:n},body:{items:o,shippingMethodId:l==null?void 0:l.id,fulfilmentMethod:"delivery",payment:{provider:d.provider,method:d.method},checkoutBaseUrl:`${process.env.NEXT_PUBLIC_APP_DOMAIN}`}});if(y!==201)throw new Error("Failed to fetch shipping methods");return h.redirectUrl&&(window.location.href=h.redirectUrl),h}}),g=()=>{p.mutate()};return x.useEffect(()=>{t.length===1&&u(t[0])},[u,t]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h2",{className:"text-[32px] font-red-hat-display font-black",children:"Shipping Method"}),e.jsx("p",{className:"text-gray-500",children:"Select a shipping method"})]}),e.jsx(zt,{className:"flex flex-col gap-2",value:l==null?void 0:l.id,children:t.map(h=>e.jsx(Lt,{value:h.id,disabled:!h.eligibleShippingZone,onClick:()=>u(h),children:e.jsxs("div",{className:w("flex items-center gap-3",{"opacity-60 cursor-not-allowed":!h.eligibleShippingZone}),children:[e.jsx(It,{}),e.jsx("div",{children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"leading-5 font-red-hat-display font-black mr-2",children:[h.title," (",h.providerName,")"]}),!h.eligibleShippingZone&&e.jsx(We,{variant:"error",children:"Not Available"})]}),h.eligibleShippingZone&&e.jsxs("p",{className:"text-xs font-medium text-gray-500 mt-0.5",children:["Shipping Fee: ",h.eligibleShippingZone.price," zł ",e.jsx("br",{}),"ETA: ",h.eligibleShippingZone.eta]}),!h.eligibleShippingZone&&e.jsxs("p",{className:"mt-0.5 text-xs text-gray-500",children:["Sorry, this address is too far for delivery ",e.jsx("br",{})," from our store."]})]})})]})},h.id))}),e.jsxs("div",{className:"flex flex-col gap-1 mt-3",children:[e.jsx("h2",{className:"text-[32px] font-red-hat-display font-black",children:"Payment Method"}),e.jsx("p",{className:"text-gray-500",children:"Select a payment method"})]}),e.jsx(zt,{className:"flex flex-col gap-3",value:d==null?void 0:d.id,children:s.map(h=>e.jsx(Lt,{value:h.id,onClick:()=>c(h),children:e.jsxs("div",{className:w("flex items-center gap-3"),children:[e.jsx(It,{}),e.jsxs("div",{children:[e.jsx("p",{className:"font-red-hat-display font-black mr-2 capitalize",children:h.method}),e.jsxs("p",{className:"text-xs font-medium text-gray-500 capitalize",children:[h.provider," • ",h.description]})]})]})},h.id))}),p.error&&e.jsx("div",{className:"p-4 mt-2 rounded-lg bg-red-50 text-red-700",children:e.jsx("p",{className:"text-sm",children:p.error.message})}),e.jsx("div",{children:e.jsxs("p",{className:"text-sm text-gray-500 mt-2 block",children:["By confirming this order you agree to our"," ",e.jsx(H,{href:"/terms-and-conditions",className:"text-teal-500 mr-1",children:"Terms & Conditions"}),"and"," ",e.jsx(H,{href:"/privacy-policy",className:"text-teal-500 mr-1",children:"Privacy Policy"})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-2 w-full mt-3",children:[e.jsx(de,{variant:"secondary",className:"shadow-none",onClick:()=>r.push(a),children:"Back"}),e.jsx(de,{className:"shadow-none bg-teal-500 hover:bg-teal-400 text-white",onClick:g,isLoading:p.isPending,children:"Pay & Confirm"})]})]})},pr=({customerDetailsPageUrl:t="/checkout/customer-details"})=>{const{client:s}=E(),{organizationId:a}=ze(),r=Q.useRouter(),i=R.useQuery({queryKey:["shippingAddress"],queryFn:async()=>{const{status:l,body:d}=await s.shipping.getShippingAddress();if(l!==200)throw new Error("Failed to fetch shipping address");return d||r.push(t),d}}),n=R.useQuery({queryKey:["shipping-and-payment-eligibility"],queryFn:async()=>{const{body:l,status:d}=await s.shippingMethod.accessEligibility({params:{organizationId:a}});if(d!==200)throw new Error("Failed to fetch shipping methods");return l}}),o=R.useQuery({queryKey:["payment-methods"],queryFn:async()=>{const{body:l,status:d}=await s.payment.getAvailablePaymentMethods({params:{organizationId:a}});if(d!==200)throw new Error("Failed to fetch shipping methods");return l}});return n.error||i.error?e.jsxs("div",{className:"p-4 rounded-lg bg-red-50 text-red-700",children:[e.jsx("p",{className:"font-semibold",children:"Failed to load shipping methods"}),e.jsx("p",{className:"text-xs",children:"Please try refreshing the page or contact support if the issue persists."})]}):n.isLoading||i.isLoading?e.jsx(In,{}):e.jsx("div",{className:"flex flex-col gap-3 animate-fade-in",children:e.jsx(Ln,{shippingMethods:n.data??[],paymentMethods:o.data??[],customerDetailsPageUrl:t})})},En=t=>oa.createAuthClient({baseURL:t,plugins:[Ct.inferAdditionalFields(),Ct.organizationClient()]}),mr=x.createContext(void 0),Dn=({children:t,baseURL:s})=>{const a=x.useMemo(()=>En(s),[s]);return e.jsx(mr.Provider,{value:a,children:t})},et=()=>{const t=x.useContext(mr);if(t===void 0)throw new Error("useAuth must be used within a AuthProvider");return t},Mn=()=>e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"animate-pulse",children:[1,2].map(t=>e.jsxs("div",{className:"flex items-center w-full mb-5 sm:mb-7",children:[e.jsx("div",{className:"w-14 sm:w-32 h-10 sm:h-24 overflow-hidden rounded-lg bg-white/10"}),e.jsxs("div",{className:"pl-3 md:pl-5 flex-1",children:[e.jsx("div",{className:"h-4 bg-white/10 rounded-sm w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-white/10 rounded-sm w-1/2 mb-2"}),e.jsx("div",{className:"text-white text-xs opacity-50 whitespace-nowrap sm:block hidden",children:e.jsx("div",{className:"h-3 bg-white/10 rounded-sm w-24 mb-2"})}),e.jsx("div",{className:"text-white text-sm font-semibold whitespace-nowrap mt-2 sm:block hidden",children:e.jsx("div",{className:"h-4 bg-white/10 rounded-sm w-16"})})]}),e.jsxs("div",{className:"ml-auto pl-4 text-right sm:hidden",children:[e.jsx("div",{className:"h-4 bg-white/10 rounded-sm w-16 mb-2"}),e.jsx("div",{className:"h-3 bg-white/10 rounded-sm w-20"})]})]},t))}),e.jsx("hr",{className:" md:flex opacity-10 my-4 sm:my-4"}),e.jsxs("div",{className:"mt-3 flex items-center",children:[e.jsx("div",{className:"h-4 w-20 bg-white/10 rounded-sm animate-pulse"}),e.jsx("div",{className:"h-4 w-16 bg-white/10 rounded-sm animate-pulse ml-auto"})]}),e.jsxs("div",{className:"mt-3 flex items-center",children:[e.jsx("div",{className:"h-4 w-20 bg-white/10 rounded-sm animate-pulse"}),e.jsx("div",{className:"h-4 w-16 bg-white/10 rounded-sm animate-pulse ml-auto"})]}),e.jsx("hr",{className:" md:flex opacity-10 my-4 sm:my-4"}),e.jsxs("div",{className:"mt-4 flex justify-between",children:[e.jsx("div",{className:"h-5 w-16 bg-white/10 rounded-sm animate-pulse"}),e.jsx("div",{className:"h-5 w-24 bg-white/10 rounded-sm animate-pulse"})]})]}),Ns=({loading:t=!1,items:s,total:a,subtotal:r,shipping:i,discount:n,currency:o})=>t?e.jsx(Mn,{}):s.length===0?e.jsx("div",{className:"px-7 pt-10 pb-0 md:pt-0 md:px-0",children:e.jsx("div",{className:"my-3 sm:my-6 sm:pb-1",children:e.jsxs("div",{className:"text-center py-6",children:[e.jsx("p",{className:"text-white font-red-hat-display text-xl font-black mb-4",children:"Your shopping cart is empty. Add some products to get started."}),e.jsx(H,{href:"/",className:"text-white hover:text-white/80 underline text-sm",children:"View products"})]})})}):e.jsxs("div",{className:"px-7 pt-10 pb-0 md:pt-0 md:px-0",children:[e.jsx("div",{className:"my-3 sm:my-6 sm:pb-1",children:s.map(({title:l,subtitle:d,image:c,price:u,unitPrice:p,quantity:g},h)=>e.jsx("div",{children:e.jsxs("div",{className:"flex items-center w-full mb-5 sm:mb-7",children:[e.jsx("div",{className:"w-14 sm:min-w-32 h-10 sm:h-24 overflow-hidden rounded-lg",children:c!=null&&c.url?e.jsx(xe,{width:100,height:100,src:c.url,alt:"",className:"w-full h-full object-cover"}):e.jsx("div",{className:"bg-slate-100 w-full h-full flex items-center justify-center",children:e.jsx("span",{className:"text-slate-400 text-xs",children:"No image"})})}),e.jsxs("div",{className:"pl-3 md:pl-5",children:[e.jsxs("div",{className:"flex font-red-hat-display h4 text-white text-sm sm:text-lg items-center",children:[l," ",e.jsxs("span",{className:"text-white text-xs opacity-50 whitespace-nowrap hidden sm:flex items-center ml-1",children:["(x ",g,")"]})]}),d&&d.map((y,b)=>e.jsx("div",{className:"text-white text-xs opacity-50",children:y},b)),e.jsxs("div",{className:"text-white text-xs opacity-50 whitespace-nowrap sm:block hidden",children:["Price: ",p]}),e.jsx("div",{className:"font-red-hat-display h4 text-white text-sm text-sm whitespace-nowrap mt-2 sm:block hidden",children:u})]}),e.jsxs("div",{className:"ml-auto pl-4 text-right sm:hidden",children:[e.jsx("div",{className:"font-red-hat-display h4 text-white text-sm whitespace-nowrap",children:u}),e.jsxs("div",{className:"text-white text-xs opacity-50 whitespace-nowrap",children:["Quantity: ",g]})]})]})},h))}),e.jsx("hr",{className:" md:flex opacity-10 my-4 sm:my-4"}),typeof i=="number"&&e.jsxs("div",{className:"mt-3 flex items-center",children:[e.jsx("h2",{className:"text-xs xl:text-sm text-white opacity-40 font-red-hat-display",children:"Shipping"}),e.jsx("h3",{className:"text-xs xl:text-sm text-white opacity-40 ml-auto font-red-hat-display",children:ye(i,o)})]}),e.jsxs("div",{className:"mt-3 flex items-center",children:[e.jsx("h2",{className:"text-xs xl:text-sm text-white opacity-40 font-red-hat-display",children:"Subtotal"}),e.jsx("h3",{className:"text-xs xl:text-sm text-white opacity-40 ml-auto font-red-hat-display",children:ye(r,o)})]}),n?e.jsxs("div",{className:"mt-3 flex items-center",children:[e.jsx("h2",{className:"text-xs xl:text-sm text-white opacity-40",children:"Discount"}),e.jsxs("h3",{className:"text-xs xl:text-sm text-white opacity-40 ml-auto",children:["- ",ye(r,o)]})]}):null,e.jsx("hr",{className:" md:flex opacity-10 my-4 sm:my-4"}),e.jsxs("div",{className:"mt-4 flex justify-between",children:[e.jsx("h2",{className:"text-sm xl:text-lg text-white font-black font-red-hat-display",children:"Total"}),e.jsx("h3",{className:"xl:text-lg text-white font-black font-red-hat-display",children:ye(a,o)})]})]}),Bn=()=>e.jsxs("header",{className:"fixed flex justify-between px-2 md:px-6 py-4 md:py-12 z-50 bg-gray-900 md:bg-transparent w-full",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{children:e.jsx(A.ChevronLeft,{className:"w-5 h-5 text-white"})}),e.jsx("div",{className:"ml-1.5 w-7 xl:w-8 h-7 xl:h-8 bg-gray-300 animate-pulse rounded-full"}),e.jsx("div",{className:"ml-2 bg-gray-300 animate-pulse h-5 xl:h-6 w-24 xl:w-28 rounded"})]}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs("div",{className:"mr-6 flex items-center",children:[e.jsx("div",{className:"w-8 h-8 bg-gray-300 animate-pulse rounded-full mr-2"}),e.jsx("div",{className:"bg-gray-300 animate-pulse h-4 w-16 rounded"})]}),e.jsxs("div",{className:"flex md:hidden items-center",children:[e.jsx("div",{className:"bg-gray-300 animate-pulse h-3 w-12 rounded mr-1.5"}),e.jsx(A.ShoppingBasketIcon,{className:"w-5 h-5 text-gray-300"})]})]})]}),Jn=()=>{const t=Q.useRouter(),{useSession:s,signOut:a}=et(),{data:r}=s(),i=()=>{var l;if(!((l=r==null?void 0:r.user)!=null&&l.name))return"";const o=r.user.name.split(" ");return o.length===1?o[0].charAt(0):`${o[0].charAt(0)}${o[o.length-1].charAt(0)}`},n=async()=>{await a(),t.push("/account/sign-in")};return e.jsx("div",{className:"hidden md:block",children:e.jsxs(Ke,{children:[e.jsx(Xe,{className:"flex items-center focus:outline-hidden group",children:r!=null&&r.user?e.jsx("div",{className:"w-8 h-8 rounded-full overflow-hidden flex items-center justify-center bg-blue-500 text-white relative transition-transform duration-200 group-hover:scale-110 group-hover:ring-2 group-hover:ring-white/50 group-hover:ring-offset-1 group-hover:cursor-pointer",children:r.user.image?e.jsx("img",{src:r.user.image,alt:r.user.name||"User",className:"w-full h-full object-cover"}):e.jsx("span",{className:"font-medium text-sm",children:i()})}):e.jsxs("div",{className:"flex items-center text-white group-hover:text-blue-300 transition-colors duration-200",children:[e.jsx(A.UserIcon,{className:"w-5 h-5 mr-1 group-hover:scale-110 transition-transform duration-200"}),e.jsx("span",{children:"Guest"})]})}),e.jsx(Ye,{className:"w-32 min-w-32 p-0 py-1 data-[state=open]:animate-slideDownAndFade z-50",align:"end",sideOffset:5,forceMount:!0,children:e.jsxs("button",{onClick:n,className:"block w-full z-50 text-center px-4 cursor-pointer py-1 text-sm text-gray-700 hover:bg-gray-100 flex items-center justify-center font-medium",children:["Logout",e.jsx(A.CircleChevronRightIcon,{className:"w-4 h-4 ml-1"})]})})]})})},Rs=({summary:t})=>{const{organization:s,loading:a}=ze(),[r,i]=x.useState(!1);if(a||!s)return e.jsx(Bn,{});const{name:n,logoFile:o,configuration:l}=s,d=l.defaultCurrency;return e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"fixed flex justify-between px-2 md:px-6 py-4 md:py-12 z-50 bg-gray-900 md:bg-transparent w-full",children:[e.jsxs(H,{href:"/",className:"flex items-center",children:[e.jsx("span",{children:e.jsx(A.ChevronLeft,{className:"w-5 h-5 text-white"})}),o?e.jsx("span",{className:"ml-1.5 w-7 xl:w-8 h-7 xl:h-8 overflow-hidden rounded-full",children:e.jsx(xe,{src:o.url,alt:n,className:"w-full h-full",width:32,height:32})}):e.jsx("div",{className:"flex items-center justify-center w-8 h-8 bg-blue-500 rounded-full text-white text-sm uppercase font-semibold",children:e.jsxs("span",{children:[n[0],n[1]]})}),e.jsx("span",{className:"xl:text-lg font-black text-white ml-2 font-red-hat-display",children:n})]}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"mr-6",children:e.jsx(Jn,{})}),t&&e.jsx("div",{className:"flex md:hidden",children:r?e.jsx("button",{className:"flex items-center text-white mr-2 animate-fade",onClick:()=>i(!1),children:e.jsx(A.XIcon,{className:"w-5 h-5"})},1):e.jsxs("button",{className:"flex items-center text-white mr-2 animate-fade",onClick:()=>i(!0),children:[e.jsx("span",{className:"text-xs text-white font-semibold mr-1.5",children:ye(t.total,d)}),e.jsx(A.ShoppingBasketIcon,{className:"w-5 h-5"})]},2)})]})]}),s&&t&&e.jsx(ir,{isOpen:r,onClose:()=>i(!1),children:e.jsx(Ns,{total:t.total,items:t.items,shipping:t.shipping,subtotal:t.subtotal,currency:d})})]})},Gs=({children:t})=>{const{useSession:s}=et(),a=Q.useRouter(),{data:r,isPending:i}=s();return x.useEffect(()=>{if(!i&&r)return a.push("/checkout/customer-details")},[r,i,a]),i?e.jsx("div",{className:"flex flex-col items-center justify-center h-screen w-screen bg-gray-900",children:e.jsx("div",{className:"mb-4",children:e.jsx("div",{className:"animate-spin rounded-full h-18 w-18 border-b-2 border-teal-500"})})}):e.jsxs(e.Fragment,{children:[e.jsx(Rs,{}),e.jsx("div",{children:e.jsxs("div",{className:"flex flex-col md:flex-row h-screen w-screen relative",children:[e.jsx("div",{className:"hidden md:flex items-center justify-end w-full md:w-1/2 h-full px-16 xl:px-24 relative",children:e.jsx("div",{className:"absolute inset-0 z-0",children:e.jsx(xe,{src:"/images/15750.jpg",alt:"Authentication background",fill:!0,className:"object-cover brightness-50",priority:!0})})}),e.jsx("div",{className:"flex flex-col items-start 2xl:items-start w-full md:w-1/2 h-full px-6 sm:px-12 xl:px-24 py-8 md:overflow-y-auto relative",children:e.jsx("div",{className:"py-10 xl:py-24 md:my-auto animate-fade w-full md:max-w-[432px]",children:t})})]})})]})},Ks=({children:t})=>{const{useSession:s}=et(),a=Q.useRouter(),{data:r,isPending:i}=s();return x.useEffect(()=>{if(!i&&!r)return a.push("/account/sign-in")},[r,i,a]),i?e.jsx("div",{className:"flex flex-col items-center justify-center h-screen w-screen bg-gray-900",children:e.jsx("div",{className:"mb-4"})}):t},On={common:{cart:"Cart",checkout:"Checkout",products:"Products",home:"Home",search:"Search",loading:"Loading...",add:"Add",remove:"Remove",close:"Close",back:"Back",next:"Next",continue:"Continue",submit:"Submit",cancel:"Cancel",apply:"Apply",save:"Save",aboutUs:"About Us",ourStory:"Our Story",menu:"Menu",reservations:"Reservations",orderOnline:"Order Online",checkOurMenu:"Check Our Menu",privacyPolicy:"Privacy Policy",termsAndConditions:"Terms and Conditions",orderNow:"Order Now",makeReservation:"Make a Reservation"},product:{addToCart:"Add to cart",outOfStock:"Out of stock",quantity:"Quantity",price:"Price",total:"Total",description:"Description",options:"Options",modifiers:"Modifiers"},checkout:{yourOrder:"Your Order",orderSummary:"Order Summary",delivery:"Delivery",address:"Address",payment:"Payment",confirmation:"Confirmation",deliveryDetails:"Delivery Details",paymentMethod:"Payment Method",placeOrder:"Place Order",subtotal:"Subtotal",total:"Total"},ourStory:{title:"Our Story",subtitle:"From the shores of South India to the heart of Poland – authentic flavors, unforgettable experiences",by:"By",paragraph1:"When Madras Bistro opened its doors in 2018, it marked a historic moment as Poland's first authentic South Indian restaurant. Our journey began with a simple yet profound vision: to introduce the rich, vibrant flavors of South India to the Polish culinary landscape.",paragraph2:"Our founders, inspired by their deep roots in Tamil Nadu, embarked on this venture after noticing that while North Indian cuisine had found its place in Poland, the diverse and distinctive flavors of South India remained undiscovered territory. They dreamed of creating a space where the aromatic spices, coconut-infused curries, and delicate dosas of their homeland could be experienced in their authentic form.",paragraph3:"The path wasn't always easy. Sourcing traditional ingredients, perfecting recipes that stayed true to their South Indian origins while appealing to Polish palates, and educating diners about a cuisine so different from what they knew – these were challenges we embraced with passion. Our chefs, trained in the time-honored techniques of South Indian cooking, worked tirelessly to ensure every dish that left our kitchen carried the essence of the regions they represented.",paragraph4:"Today, Madras Bistro stands as a cultural bridge between Poland and South India. We take pride in having introduced countless Polish diners to the joy of breaking a crispy dosa, savoring the complex flavors of a well-prepared sambar, and experiencing the unique combination of spices that makes South Indian cuisine so distinctive.",paragraph5:"Our story continues to unfold with each meal we serve, as we remain committed to our founding vision: bringing the authentic taste of South India to Poland, one delicious dish at a time.",paragraph6:"I warmly invite you to join us on this culinary adventure and discover the distinctive tastes of South India – a cuisine still new to many in Poland but certain to delight your palate with its rich traditions and bold flavors.",signature:"- Chef Victor",description:"Learn about Madras Bistro's journey in Krakow, bringing authentic South Indian cuisine with passion and tradition. Discover our story and culinary roots!"},menuSection:{title:"Discover our menu",description:"Our menu is a collection of the most popular dishes from south india."},orderOnline:{title:"Order Online",description:"Craving South Indian food? Order online from Madras Bistro in Krakow for delicious dosas, curries, and more. Fast, fresh, and authentic, delivered to you!"},hero:{title:"Discover South Indian Cuisine that's Beyond Delicious",subtitle:"Embark on a flavorful journey rich in tradition and vibrant spices."},introSection:{title:"Madras Bistro: Five Regions, One Extraordinary Table",paragraph1:"Step into a world where spices whisper ancient secrets and aromas tell tales of distant shores. At Madras Bistro, the diverse culinary heritage of South India comes alive on your plate—a gastronomic tapestry woven from the traditions of Tamil Nadu, Kerala, Andhra Pradesh, Karnataka, and Sri Lanka. Our kitchen celebrates this rich mosaic of regional cuisines, where coastal treasures meet inland specialties in a harmonious expression of flavor.",paragraph2:"In this tropical paradise, the climate nurtures abundant coconut groves and rice fields, giving birth to a culinary tradition that celebrates fresh ingredients and complex flavors. Unlike the heavy, cream-based dishes familiar to many, South Indian cuisine is a delicate dance of spices, featuring iconic dishes like crispy dosas, soft idlis, and tangy sambars that speak to centuries of culinary innovation. Each bite tells a story of coastal markets, family traditions, and a deep connection to the land."},reservationSection:{title:"Reserve Your Table",description:"Experience authentic South Indian cuisine in a warm, inviting atmosphere. Make a reservation for a memorable dining experience."},testimonialsSection:{title:"Google Reviews",description:"See what our customers are saying about us",testimonials:[{name:"Konrad Górski",company:"Appy.com",text:"A bistro worth visiting for fans of Indian flavors. They serve Indian cuisine and from the north of Sri Lanka. I ate delicious milk chicken with aromatic jeera rice. The bistro is small (3 tables) and modest, but you can listen to Indian music hits."},{name:"Sophia Mackney",company:"Nobi Bank",text:"My husband and I chanced upon this restaurant last Thursday whilst on a short break to Krakow from the UK. This small eatery with just 2 or 3 tables is run by the very friendly and obliging owner/chef and is conveniently located facing Ghetto Heroes Square. The Masala Uttapam, Masala Dosa, Kerala Chicken Curry, Chicken Roast and Masala Chai that we had were absolutely delicious. I highly recommend this restaurant to any lovers of South Indian food."},{name:"Sridevi Madbhavi",company:"Sync",text:"Absolutely mouthwatering food! The owner (also the chef) is extremely passionate about the customers experience, and you can feel his expertise in every bite. Highly recommend the ghee dosa (he made it extra crispy for us on request). It tastes like home, is SO authentic. The only downside is that I'll miss the food terribly when I leave Kraków!"},{name:"Bijeesh KB",company:"Appicu",text:"If you're looking for a place that serves real Malabar food, this is definitely the spot. Highly recommended for anyone craving a taste of home!"}]},orderTracking:{orderPlaced:"Order Placed",orderPlacedDesc:"Your order has been received and is waiting to be accepted",orderAccepted:"Order Accepted",orderAcceptedDesc:"Your order has been accepted and is being processed",readyForDispatch:"Ready for Dispatch",readyForDispatchDesc:"Your order is packed and ready to be shipped",orderDispatched:"Order Dispatched",orderDispatchedDesc:"Your order is on its way to you",orderDelivered:"Order Delivered",orderDeliveredDesc:"Your order has been delivered",orderCancelled:"Order Cancelled",orderCancelledDesc:"Your order has been cancelled",price:"Price",quantity:"Quantity",subtotal:"Subtotal",total:"Total",poweredBy:"Powered by",reference:"Reference",status:"Status"},reservation:{reservationDetails:"Reservation Details",name:"Name",phone:"Phone",guests:"Guests",date:"Date",reference:"Reference",status:"Status",notSpecified:"Not specified",invalidDate:"Invalid date",requestSent:"Reservation Request Sent",requestSentDesc:"Your reservation request has been received and is waiting to be confirmed by the restaurant",confirmed:"Reservation Confirmed",confirmedDesc:"Your reservation has been confirmed",cancelled:"Reservation Cancelled",cancelledDesc:"Your reservation has been cancelled",pendingStatus:"Pending",confirmedStatus:"Confirmed",cancelledStatus:"Cancelled",poweredBy:"Powered by"},homepage:{description:"Discover Madras Bistro, Krakow's first South Indian restaurant. Savor authentic flavors, vibrant spices, and traditional dishes in a cozy setting. Visit us today!"},menu:{description:"Explore the Madras Bistro menu featuring authentic South Indian dishes like dosas, curries, and biryanis. Fresh ingredients, bold flavors in Krakow!"},privacyPolicy:{description:"Read Madras Bistro's Privacy Policy to understand how we protect your data and ensure a secure experience while enjoying our South Indian cuisine in Krakow."},termsAndConditions:{description:"Review the Terms and Conditions for using Madras Bistro's website and services in Krakow. Learn about our policies for online orders and dining."}},Fn={common:{cart:"Koszyk",checkout:"Zamówienie",products:"Produkty",home:"Strona główna",search:"Szukaj",loading:"Ładowanie...",add:"Dodaj",remove:"Usuń",close:"Zamknij",back:"Wstecz",next:"Dalej",continue:"Kontynuuj",submit:"Wyślij",cancel:"Anuluj",apply:"Zastosuj",save:"Zapisz",aboutUs:"O nas",ourStory:"O Nas",menu:"Menu",reservations:"Rezerwacje",orderOnline:"Zamów online",checkOurMenu:"Sprawdź nasze menu",privacyPolicy:"Polityka prywatności",termsAndConditions:"Warunki korzystania",orderNow:"Zamów teraz",makeReservation:"Zarezerwuj stolik"},product:{addToCart:"Dodaj do koszyka",outOfStock:"Brak w magazynie",quantity:"Ilość",price:"Cena",total:"Razem",description:"Opis",options:"Opcje",modifiers:"Modyfikatory"},checkout:{yourOrder:"Twoje zamówienie",orderSummary:"Podsumowanie zamówienia",delivery:"Dostawa",address:"Adres",payment:"Płatność",confirmation:"Potwierdzenie",deliveryDetails:"Szczegóły dostawy",paymentMethod:"Metoda płatności",placeOrder:"Złóż zamówienie",subtotal:"Suma częściowa",total:"Razem"},ourStory:{title:"Nasza historia",subtitle:"Z wybrzeży Południowych Indii do serca Polski – autentyczne smaki, niezapomniane doświadczenia",by:"Autor",paragraph1:"Kiedy Madras Bistro otworzyło swoje drzwi w 2018 roku, był to historyczny moment jako pierwsza autentyczna restauracja południowoindyjska w Polsce. Nasza podróż rozpoczęła się od prostej, ale głębokiej wizji: wprowadzenia bogatych, żywych smaków Południowych Indii do polskiego krajobrazu kulinarnego.",paragraph2:"Nasi założyciele, zainspirowani swoimi głębokimi korzeniami w Tamil Nadu, rozpoczęli tę przygodę po zauważeniu, że podczas gdy kuchnia północnoindyjska znalazła swoje miejsce w Polsce, różnorodne i charakterystyczne smaki Południowych Indii pozostały nieodkrytym terytorium. Marzyli o stworzeniu miejsca, gdzie aromatyczne przyprawy, curry nasycone kokosem i delikatne dosa z ich ojczyzny mogłyby być doświadczane w autentycznej formie.",paragraph3:"Droga nie zawsze była łatwa. Pozyskiwanie tradycyjnych składników, doskonalenie przepisów, które pozostały wierne południowoindyjskim korzeniom, a jednocześnie trafiały w gusta polskich podniebień, oraz edukowanie gości o kuchni tak różnej od tego, co znali – to były wyzwania, które przyjęliśmy z pasją. Nasi szefowie kuchni, wyszkoleni w tradycyjnych technikach gotowania południowoindyjskiego, pracowali niestrudzenie, aby zapewnić, że każde danie opuszczające naszą kuchnię niosło w sobie esencję regionów, które reprezentowali.",paragraph4:"Dziś Madras Bistro stoi jako kulturowy most między Polską a Południowymi Indiami. Jesteśmy dumni z tego, że wprowadziliśmy niezliczonych polskich gości w radość przełamywania chrupiącej dosy, smakowania złożonych smaków dobrze przygotowanego sambaru i doświadczania unikalnej kombinacji przypraw, która sprawia, że kuchnia południowoindyjska jest tak wyjątkowa.",paragraph5:"Nasza historia nadal rozwija się z każdym posiłkiem, który serwujemy, ponieważ pozostajemy wierni naszej wizji założycielskiej: przywiezienia autentycznego smaku Południowych Indii do Polski, jedno pyszne danie na raz.",paragraph6:"Serdecznie zapraszam do przyłączenia się do tej kulinarnej przygody i odkrycia charakterystycznych smaków Południowych Indii – kuchni nadal nowej dla wielu w Polsce, ale z pewnością zachwycającej podniebienie bogatymi tradycjami i wyrazistymi smakami.",signature:"- Szef kuchni Victor",description:"Poznaj historię Madras Bistro w Krakowie, które wprowadza autentyczną kuchnię południowoindyjską z pasją i tradycją. Odkryj naszą historię i kulinarne korzenie!"},menuSection:{title:"Odkryj nasze menu",description:"Nasze menu to kolekcja najpopularniejszych dań z południowych Indii."},orderOnline:{title:"Zamów online",description:"Masz ochotę na południowoindyjskie jedzenie? Zamów online z Madras Bistro w Krakowie pyszne dosa, curry i więcej. Szybkie, świeże i autentyczne, dostarczone prosto do Ciebie!"},hero:{title:"Odkryj przepyszną południowo indyjską kuchnie",subtitle:"Wyrusz w pełną smaków podróż bogatą w tradycję i wyraziste przyprawy."},introSection:{title:"Madras Bistro: Pięć regionów, jeden wyjątkowy stół",paragraph1:"Wejdź do świata, gdzie przyprawy szepczą dawne sekrety, a aromaty opowiadają historie z dalekich brzegów. W Madras Bistro różnorodne dziedzictwo kulinarne Południowych Indii ożywa na Twoim talerzu — gastronomiczna tkanina utkana z tradycji Tamil Nadu, Kerali, Andhra Pradesh, Karnataki i Sri Lanki. Nasza kuchnia celebruje tę bogatą mozaikę regionalnych kuchni, gdzie nadmorskie skarby spotykają się z wewnątrznymi specjałami w harmonijnym wyrażeniu smaku.",paragraph2:"W tym tropikalnym raju klimat sprzyja obfitym palmom kokosowym i polom ryżowym, dając początek tradycji kulinarnej, która celebruje świeże składniki i złożone smaki. W przeciwieństwie do ciężkich, kremowych dań znanych wielu osobom, kuchnia południowoindyjska to delikatny taniec przypraw, z takimi ikonicznymi daniami jak chrupiące dosy, miękkie idli i pikantne sambary, które mówią o wiekach kulinarnych innowacji. Każdy kęs opowiada historię nadmorskich targów, rodzinnych tradycji i głębokiego związku z ziemią."},reservationSection:{title:"Zarezerwuj stolik",description:"Doświadcz autentycznej kuchni południowoindyjskiej w ciepłej, przyjaznej atmosferze. Dokonaj rezerwacji na niezapomniane doświadczenie kulinarne."},testimonialsSection:{title:"Opinie Google",description:"Zobacz, co mówią o nas nasi klienci",testimonials:[{name:"Konrad Górski",company:"Appy.com",text:"Bistro warte odwiedzenia dla fanów indyjskich smaków. Serwują kuchnię indyjską i z północy Sri Lanki. Zjadłem pysznego kurczaka w mleku z aromatycznym ryżem jeera. Bistro jest małe (3 stoliki) i skromne, ale można posłuchać indyjskich hitów muzycznych."},{name:"Sophia Mackney",company:"Nobi Bank",text:"Ja i mój mąż przypadkowo trafiliśmy do tej restauracji w zeszły czwartek podczas krótkiego pobytu w Krakowie z Wielkiej Brytanii. Ta mała jadłodajnia z zaledwie 2 lub 3 stolikami jest prowadzona przez bardzo przyjaznego i uczynnego właściciela/szefa kuchni i jest dogodnie zlokalizowana naprzeciwko Placu Bohaterów Getta. Masala Uttapam, Masala Dosa, Curry z Kurczakiem Kerala, Kurczak Pieczony i Masala Chai, które jedliśmy, były absolutnie pyszne. Gorąco polecam tę restaurację wszystkim miłośnikom południowo-indyjskiej kuchni."},{name:"Sridevi Madbhavi",company:"Sync",text:"Absolutnie pyszne jedzenie! Właściciel (również szef kuchni) jest niezwykle zaangażowany w doświadczenia klientów i można poczuć jego doświadczenie w każdym kęsie. Gorąco polecam ghee dosa (zrobił je dla nas ekstra chrupiące na prośbę). Smakuje jak w domu, jest BARDZO autentyczne. Jedynym minusem jest to, że będę tęsknić za tym jedzeniem, gdy opuszczę Kraków!"},{name:"Bijeesh KB",company:"Appicu",text:"Jeśli szukasz miejsca, które serwuje prawdziwe jedzenie Malabar, to zdecydowanie jest to odpowiednie miejsce. Gorąco polecane dla każdego, kto tęskni za smakiem domu!"}]},orderTracking:{orderPlaced:"Zamówienie złożone",orderPlacedDesc:"Twoje zamówienie zostało odebrane i czeka na akceptację",orderAccepted:"Zamówienie zaakceptowane",orderAcceptedDesc:"Twoje zamówienie zostało zaakceptowane i jest przetwarzane",readyForDispatch:"Gotowe do wysyłki",readyForDispatchDesc:"Twoje zamówienie jest spakowane i gotowe do wysyłki",orderDispatched:"Zamówienie wysłane",orderDispatchedDesc:"Twoje zamówienie jest w drodze do Ciebie",orderDelivered:"Zamówienie dostarczone",orderDeliveredDesc:"Twoje zamówienie zostało dostarczone",orderCancelled:"Zamówienie anulowane",orderCancelledDesc:"Twoje zamówienie zostało anulowane",price:"Cena",quantity:"Ilość",subtotal:"Suma częściowa",total:"Razem",poweredBy:"Wspierane przez",reference:"Numer referencyjny",status:"Status"},reservation:{reservationDetails:"Szczegóły rezerwacji",name:"Imię i nazwisko",phone:"Telefon",guests:"Liczba gości",date:"Data",reference:"Numer referencyjny",status:"Status",notSpecified:"Nie określono",invalidDate:"Nieprawidłowa data",requestSent:"Prośba o rezerwację wysłana",requestSentDesc:"Twoja prośba o rezerwację została odebrana i czeka na potwierdzenie przez restaurację",confirmed:"Rezerwacja potwierdzona",confirmedDesc:"Twoja rezerwacja została potwierdzona",cancelled:"Rezerwacja anulowana",cancelledDesc:"Twoja rezerwacja została anulowana",pendingStatus:"Oczekujące",confirmedStatus:"Potwierdzone",cancelledStatus:"Anulowane",poweredBy:"Wspierane przez"},homepage:{description:"Odkryj Madras Bistro, pierwszą restaurację południowoindyjską w Krakowie. Skosztuj autentycznych smaków, żywych przypraw i tradycyjnych dań w przytulnym otoczeniu. Odwiedź nas już dziś!"},menu:{description:"Zapoznaj się z menu Madras Bistro oferującym autentyczne południowoindyjskie dania jak dosa, curry i biryani. Świeże składniki, wyraziste smaki w Krakowie!"},privacyPolicy:{description:"Przeczytaj Politykę Prywatności Madras Bistro, aby zrozumieć, jak chronimy Twoje dane i zapewniamy bezpieczne doświadczenie podczas delektowania się naszą południowoindyjską kuchnią w Krakowie."},termsAndConditions:{description:"Zapoznaj się z Warunkami korzystania ze strony internetowej i usług Madras Bistro w Krakowie. Dowiedz się o naszych zasadach dotyczących zamówień online i dań w restauracji."}},Xs={en:On,pl:Fn},gr=x.createContext(void 0),Vn=({children:t,locale:s})=>{const a=x.useCallback(i=>{const n=i.split(".");let o=Xs[s];for(const l of n)if(o&&typeof o=="object"&&l in o)o=o[l];else return i;return typeof o=="string"?o:i},[s]),r={locale:s,translations:Xs[s],t:a};return e.jsx(gr.Provider,{value:r,children:t})},Hn=()=>{const t=x.useContext(gr);if(t===void 0)throw new Error("useTranslation must be used within a TranslationProvider");return t},Zn=()=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col md:flex-row h-screen w-screen relative",children:[e.jsx("div",{className:"hidden md:flex items-center justify-end w-full md:w-1/2 h-full px-16 xl:px-24 bg-gray-900 md:overflow-y-auto",children:e.jsx("div",{className:"w-96 animate-fade",children:e.jsx("div",{className:"pl-6",children:e.jsxs("div",{className:"px-7 pt-10 pb-0 md:pt-0 md:px-0",children:[[1,2].map(t=>e.jsxs("div",{className:"flex items-center w-full mb-5 sm:mb-7",children:[e.jsx("div",{className:"w-14 sm:w-32 h-10 sm:h-24 overflow-hidden rounded-lg bg-gray-700 animate-pulse"}),e.jsxs("div",{className:"pl-3 md:pl-5 w-full",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded-sm w-3/4 mb-2 animate-pulse"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded-sm w-1/2 mb-2 animate-pulse"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded-sm w-1/4 animate-pulse"})]})]},t)),e.jsx("hr",{className:"opacity-10 my-4 sm:my-4"}),e.jsxs("div",{className:"mt-3 flex items-center",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded-sm w-20 animate-pulse"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded-sm w-16 ml-auto animate-pulse"})]}),e.jsxs("div",{className:"mt-3 flex items-center",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded-sm w-16 animate-pulse"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded-sm w-16 ml-auto animate-pulse"})]}),e.jsx("hr",{className:"opacity-10 my-4 sm:my-4"}),e.jsxs("div",{className:"mt-4 flex justify-between",children:[e.jsx("div",{className:"h-5 bg-gray-700 rounded-sm w-16 animate-pulse"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded-sm w-20 animate-pulse"})]})]})})})}),e.jsx("div",{className:"flex flex-col items-start 2xl:items-start w-full md:w-1/2 h-full px-6 sm:px-12 xl:px-24 py-8 md:overflow-y-auto relative",children:e.jsxs("div",{className:"md:my-auto animate-fade w-full md:max-w-[432px]",children:[e.jsx("div",{className:"h-8 bg-gray-200 rounded-sm w-64 mb-4 animate-pulse"}),e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"h-4 bg-gray-200 rounded-sm w-48 mb-2 animate-pulse"}),e.jsx("div",{className:"h-4 bg-gray-200 rounded-sm w-40 animate-pulse"})]}),e.jsx("div",{className:"mt-8 space-y-4",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-4 top-0 h-full w-0.5 bg-gray-200"}),[1,2,3,4,5].map(t=>e.jsxs("div",{className:"ml-9 mb-8 relative",children:[e.jsx("div",{className:"absolute -left-9 mt-1.5",children:e.jsx("div",{className:"h-8 w-8 rounded-full bg-gray-200 animate-pulse"})}),e.jsx("div",{className:"h-5 bg-gray-200 rounded-sm w-40 mb-2 animate-pulse"}),e.jsx("div",{className:"h-3 bg-gray-200 rounded-sm w-64 mb-2 animate-pulse"}),e.jsx("div",{className:"h-3 bg-gray-200 rounded-sm w-24 animate-pulse"})]},t))]})})]})})]})}),Un=({className:t})=>e.jsx("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 13l4 4L19 7"})}),Wn=({className:t})=>e.jsx("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})}),_n=({className:t})=>e.jsxs("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),e.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),qn=({title:t,description:s,active:a,date:r,cancelled:i=!1,showConfetti:n=!1})=>{const o=c=>{if(!c)return null;const u=new Date(c);return T.isValid(u)?T.format(u,"MMM d, yyyy - h:mm a"):null},l=!!r,d=a&&!r;return e.jsxs("div",{className:"relative flex items-start gap-4 pb-8",children:[e.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-full shrink-0",children:e.jsxs("div",{className:w("w-8 h-8 rounded-full flex items-center justify-center",{"bg-green-100 border-green-500 border-[3px]":l&&!n,"bg-violet-100 border-violet-500 border-[3px]":l&&n,"bg-white":!r,"border-gray-200 border-[3px]":!r&&!a,"bg-red-100 border-red-500 border-[3px]":i}),children:[r&&!n&&!i&&e.jsx(Un,{className:"w-4 h-4 text-green-500"}),l&&n&&e.jsx(A.PartyPopperIcon,{className:"w-4 h-4 text-violet-500"}),i&&e.jsx(Wn,{className:"w-4 h-4 text-red-500"}),d&&e.jsx(_n,{className:"text-gray-200 animate-spin dark:text-gray-600 fill-blue-600 w-full"})]})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:w("font-black font-red-hat-display",{"text-red-500":i,"text-gray-900":l,"text-gray-500":!i&&!l}),children:t}),e.jsx("p",{className:w("text-sm font-medium",{"text-red-500":i,"text-gray-600":l,"text-gray-400":!i&&!l}),children:s}),o(r)&&e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:o(r)})]})]})},$n=({orderId:t})=>{const{client:s}=E(),{organization:a,organizationId:r}=ze(),i=Q.useSearchParams(),n=Q.useRouter(),o=Q.usePathname(),{t:l}=Hn(),d=a==null?void 0:a.configuration.defaultCurrency;x.useEffect(()=>{if((i==null?void 0:i.get("clearCart"))==="true"&&o){localStorage.removeItem("shophost-cart");const b=new URLSearchParams(Array.from(i.entries()));b.delete("clearCart");const f=b.toString()?`${o}?${b.toString()}`:o;n.replace(f)}},[i,n,o]);const{data:c,isLoading:u,error:p}=R.useQuery({queryKey:["order",t],refetchInterval:({state:b})=>{var f,S;return((f=b.data)==null?void 0:f.status)!=="completed"&&((S=b.data)==null?void 0:S.status)!=="cancelled"?30*1e3:!1},queryFn:async()=>{const{status:b,body:f}=await s.order.getOrder({params:{id:t,organizationId:r}});if(b!==200)throw new Error("Failed to fetch shipping address");return f}}),g=x.useMemo(()=>c?c==null?void 0:c.items.map(b=>({title:b.translations[0].title,subtitle:[b.translations[0].subtitle],price:ye(b.unitPrice,d??"USD"),unitPrice:ye(b.unitPrice,d??"USD"),quantity:b.quantity,image:b.image})):[],[c,d]);if(!c||u)return e.jsx(Zn,{});const{status:h}=c,y=[{title:l("orderTracking.orderPlaced"),description:l("orderTracking.orderPlacedDesc"),date:new Date(c.expiresAt),active:!1},{title:l("orderTracking.orderAccepted"),description:l("orderTracking.orderAcceptedDesc"),date:c.acceptedAt,active:!c.acceptedAt},{title:l("orderTracking.readyForDispatch"),description:l("orderTracking.readyForDispatchDesc"),date:c.readyForDispatchAt,active:h==="accepted"},{title:l("orderTracking.orderDispatched"),description:l("orderTracking.orderDispatchedDesc"),date:c.dispatchedAt,active:h==="ready-for-dispatch"},{title:l("orderTracking.orderDelivered"),description:l("orderTracking.orderDeliveredDesc"),date:c.completedAt,active:h==="dispatched",showConfetti:!0}];return c.status==="cancelled"&&y.push({title:l("orderTracking.orderCancelled"),description:l("orderTracking.orderCancelledDesc"),date:c.cancelledAt,active:!!c.cancelledAt,cancelled:!0}),e.jsxs(e.Fragment,{children:[e.jsx(Rs,{summary:{total:c.payment.total,subtotal:c.payment.subtotal,shipping:c.payment.shipping,items:g}}),e.jsx("div",{children:e.jsxs("div",{className:"flex flex-col md:flex-row h-screen w-screen relative",children:[e.jsx("div",{className:"hidden md:flex items-center justify-end w-full md:w-1/2 h-full px-16 xl:px-24 bg-gray-900 md:overflow-y-auto",children:e.jsx("div",{className:"w-96 animate-fade",children:e.jsxs("div",{className:"pl-6",children:[e.jsx(Ns,{items:g,total:c.payment.total,subtotal:c.payment.subtotal,shipping:c.payment.shipping,currency:d??"USD"}),e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 text-center mt-14 w-full",children:[l("orderTracking.poweredBy")," ",e.jsx("a",{href:"https://shophost.io",className:"text-blue-500 hover:text-blue-600 dark:text-blue-500 dark:hover:text-blue-400",children:"shophost.io"})]})]})})}),e.jsx("div",{className:"flex flex-col items-start 2xl:items-start w-full md:w-1/2 h-full px-6 sm:px-12 xl:px-24 py-8 md:overflow-y-auto relative",children:e.jsxs("div",{className:"md:my-auto animate-fade w-full md:max-w-[432px] pt-14 sm:pt-0",children:[e.jsx("h1",{className:"h3 mb-1 font-red-hat-display",children:l("checkout.yourOrder")}),e.jsxs("div",{className:"mb-8",children:[e.jsxs("p",{className:"text-sm font-medium text-gray-500",children:[l("orderTracking.reference"),": ",c.referenceId]}),e.jsxs("p",{className:"text-sm font-medium text-gray-500",children:[l("orderTracking.status"),":"," ",e.jsx("span",{className:`capitalize font-semibold ${c.status==="cancelled"?"text-red-600":"text-green-600"}`,children:c.status})]})]}),e.jsx("div",{className:"mt-8 space-y-4",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-4 top-0 w-0.5 bg-gray-200",style:{height:`calc(100% - ${y.length>1?"4rem":"0rem"})`}}),y.map((b,f)=>e.jsx(qn,{...b},f))]})})]})})]})})]})},Gn=()=>e.jsxs("div",{children:[e.jsx("h1",{children:"All Orders"}),e.jsx("p",{children:"Order history and list will be displayed here"})]}),Kn=()=>{const t=Q.useSearchParams(),{signIn:s}=et(),a=(t==null?void 0:t.get("redirect"))??"/checkout/customer-details",{register:r,handleSubmit:i,formState:{errors:n,isSubmitting:o}}=F.useForm({resolver:ue.zodResolver(Da),shouldFocusError:!0}),l=async c=>{await s.email({email:c.email,password:c.password,callbackURL:`${process.env.NEXT_PUBLIC_APP_DOMAIN}${a}`})},d=async c=>{c.preventDefault(),await s.social({provider:"google",callbackURL:`${process.env.NEXT_PUBLIC_APP_DOMAIN}${a}`})};return e.jsxs("div",{className:"flex w-full flex-col items-start sm:max-w-sm",children:[e.jsxs("div",{className:"mt-6 flex flex-col",children:[e.jsx("h1",{className:"h4 font-black font-red-hat-display",children:"Log in"}),e.jsxs("p",{className:"mt-1 text-sm text-gray-700 dark:text-gray-300",children:["Login or create an account to continue. Don’t have an account?"," ",e.jsx(H,{className:"text-teal-500 hover:text-teal-600 dark:text-teal-500 dark:hover:text-teal-400",href:`/account/sign-up?redirect=${a}`,children:"Sign up"})]})]}),e.jsxs("div",{className:"mt-10 w-full",children:[e.jsx("div",{className:"gap-2 sm:flex sm:flex-row sm:items-center",children:e.jsxs(de,{variant:"secondary",type:"button",className:"mt-2 w-full sm:mt-0 shadow-none inline-flex items-center gap-2",onClick:d,children:[e.jsx(C.RiGoogleFill,{className:"size-4","aria-hidden":"true"}),"Login with Google"]})}),e.jsx(_e,{className:"my-6",children:"or"}),e.jsxs("form",{onSubmit:i(l),className:"flex w-full flex-col gap-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-y-4",children:[e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(le,{htmlFor:"email-form-item",className:"font-medium",children:"Email"}),e.jsx(we,{type:"email",autoComplete:"email",id:"email-form-item",placeholder:"emily.ross@acme.ch",...r("email")}),n.email&&e.jsx("span",{className:"text-sm text-red-500",children:n.email.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(le,{htmlFor:"password-form-item",className:"font-medium",children:"Password"}),e.jsx(we,{type:"password",autoComplete:"current-password",id:"password-form-item",placeholder:"Password",...r("password")}),n.password&&e.jsx("span",{className:"text-sm text-red-500",children:n.password.message})]})]}),e.jsx(de,{type:"submit",className:"shadow-none",isLoading:o,children:o?"Submitting...":"Continue"})]})]}),e.jsx(_e,{}),e.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Forgot your password?"," ",e.jsx("a",{className:"text-teal-500 hover:text-teal-600 dark:text-teal-500 dark:hover:text-teal-400",href:"#",children:"Reset password"})]})]})},Xn=()=>e.jsx(Kn,{}),Yn=()=>{const t=Q.useSearchParams(),{signUp:s,signIn:a}=et(),r=(t==null?void 0:t.get("redirect"))??"/checkout/customer-details",{register:i,handleSubmit:n,formState:{errors:o}}=F.useForm({resolver:ue.zodResolver(Ss),shouldFocusError:!0}),{isPending:l,isError:d,mutate:c}=R.useMutation({onMutate:async p=>s.email({email:p.email,password:p.password,name:`${p.firstname} ${p.lastname}`,firstname:p.firstname,lastname:p.lastname,callbackURL:`${process.env.NEXT_PUBLIC_APP_DOMAIN}${r}`})}),u=async p=>(p.preventDefault(),a.social({provider:"google",callbackURL:`${process.env.NEXT_PUBLIC_APP_DOMAIN}${r}`}));return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex w-full flex-col items-start md:max-w-sm",children:[e.jsxs("div",{className:"mt-6 flex flex-col",children:[e.jsx("h1",{className:"h4 font-black font-red-hat-display",children:"Create an account"}),e.jsxs("p",{className:"mt-1 text-sm text-gray-700 dark:text-gray-300",children:["Already have an account?"," ",e.jsx(H,{className:"text-teal-500 hover:text-teal-600 dark:text-teal-500 dark:hover:text-teal-400",href:"/account/sign-in",children:"Sign in"})]})]}),e.jsxs("div",{className:"mt-10 w-full",children:[e.jsx("div",{className:"gap-2 sm:flex sm:flex-row sm:items-center",children:e.jsxs(de,{variant:"secondary",type:"button",className:"mt-2 w-full sm:mt-0 inline-flex items-center gap-2 shadow-none",onClick:u,children:[e.jsx(C.RiGoogleFill,{className:"size-4","aria-hidden":"true"}),"Signin with Google"]})}),e.jsx(_e,{className:"my-6",children:"or"}),e.jsxs("form",{onSubmit:n(p=>c(p)),className:"flex w-full flex-col gap-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-y-4",children:[e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(le,{htmlFor:"email-form-item",className:"font-medium",children:"First Name"}),e.jsx(we,{type:"text",id:"email-form-item",placeholder:"Emily",...i("firstname")}),o.firstname&&e.jsx("span",{className:"text-sm text-red-500",children:o.firstname.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(le,{htmlFor:"email-form-item",className:"font-medium",children:"Last Name"}),e.jsx(we,{type:"text",id:"email-form-item",placeholder:"Emily",...i("lastname")}),o.lastname&&e.jsx("span",{className:"text-sm text-red-500",children:o.lastname.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(le,{htmlFor:"email-form-item",className:"font-medium",children:"Email"}),e.jsx(we,{type:"email",autoComplete:"email",id:"email-form-item",placeholder:"emily.ross@acme.ch",...i("email")}),o.email&&e.jsx("span",{className:"text-sm text-red-500",children:o.email.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(le,{htmlFor:"password-form-item",className:"font-medium",children:"Password"}),e.jsx(we,{type:"password",autoComplete:"current-password",id:"password-form-item",placeholder:"Password",...i("password")}),o.password&&e.jsx("span",{className:"text-sm text-red-500",children:o.password.message})]})]}),d&&e.jsx("span",{className:"text-sm text-red-500",children:"An error occurred, please try again."}),e.jsx(de,{type:"submit",isLoading:l,children:l?"Submitting...":"Continue"})]})]}),e.jsx(_e,{}),e.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Forgot your password?"," ",e.jsx("a",{className:"text-teal-500 hover:text-teal-600 dark:text-teal-500 dark:hover:text-teal-400",href:"#",children:"Reset password"})]})]})})},eo=()=>e.jsx(Yn,{}),to=()=>{const{segments:t}=Q.useParams(),[s,...a]=t;switch(s){case"sign-in":return a.length!==0?Q.notFound():e.jsx(Gs,{children:e.jsx(Xn,{})});case"sign-up":return a.length!==0?Q.notFound():e.jsx(Gs,{children:e.jsx(eo,{})});case"orders":return a.length>1?Q.notFound():a.length===0?e.jsx(Ks,{children:e.jsx(Gn,{})}):e.jsx(Ks,{children:e.jsx($n,{orderId:a[0]})});default:return Q.notFound()}},so=(t,s)=>t==="reservation"&&!s?e.jsx(ds,{}):s==="customer-details"?e.jsx(ds,{}):s==="shipping-and-payment"?e.jsx(pr,{}):Q.notFound(),ao=()=>{const t=Q.useParams(),{useSession:s}=et(),a=Q.useRouter(),{data:r,isPending:i}=s(),{loading:n,formattedCartItems:o,total:l,subtotal:d,shipping:c}=Mt(),{organization:u,loading:p}=ze(),[g,h,...y]=(t==null?void 0:t.segments)||[];return console.log(g,h),x.useEffect(()=>{!i&&!r&&a.push("/account/sign-in?redirect=/checkout/customer-details")},[r,i,a]),y.length>0?Q.notFound():p||n||i?e.jsx("div",{className:"flex flex-col items-center justify-center h-screen w-screen bg-gray-900",children:e.jsx("div",{className:"mb-4",children:e.jsx("div",{className:"animate-spin rounded-full h-18 w-18 border-b-2 border-teal-500"})})}):u?!u.configuration.isAcceptingOrders||!u.configuration.isOpen?e.jsx("div",{className:"flex flex-col items-center justify-center h-screen w-screen bg-gray-900 text-center animate-fade-in",children:u.configuration.isOpen?e.jsxs("div",{className:"relative z-10 max-w-[800px] px-10",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-black font-red-hat-display text-white",children:"Unfortunately, We're currently not accepting online orders."}),e.jsxs("p",{className:"text-gray-100 font-medium mt-3 text-lg mt-",children:["Please contact us directly for any inquiries. ",e.jsx("br",{})," +48 500 193 738",e.jsx("br",{})," contact@madrasbistro.pl"]}),e.jsx(H,{className:"btn-sm mt-6 text-white bg-teal-500 hover:bg-teal-400 rounded-lg shrink-0",href:"/",children:"Back to Homepage"})]}):e.jsxs("div",{className:"relative z-10",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-black font-red-hat-display text-white",children:"Sorry, we're currently closed"}),e.jsxs("p",{className:"text-gray-100 font-medium mt-3 text-lg mt-",children:["Please contact us directly for any inquiries. ",e.jsx("br",{})," +48 500 193 738",e.jsx("br",{})," contact@madrasbistro.pl"]}),e.jsx(H,{className:"btn-sm mt-6 text-white bg-teal-500 hover:bg-teal-400 rounded-lg shrink-0",href:"/",children:"Back to Homepage"})]})}):e.jsxs(e.Fragment,{children:[e.jsx(Rs,{summary:{total:l,subtotal:d,shipping:c,items:o}}),e.jsx("div",{children:e.jsxs("div",{className:"flex flex-col md:flex-row h-screen w-screen relative",children:[e.jsx("div",{className:"hidden md:flex items-center justify-end w-full md:w-1/2 h-full px-16 xl:px-24 bg-gray-900 md:overflow-y-auto",children:e.jsxs("div",{className:"w-96 animate-fade",children:[e.jsx("div",{className:"pl-6",children:e.jsx(Ns,{items:o,total:l,subtotal:d,shipping:c,currency:u.configuration.defaultCurrency||"USD"})}),e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 text-center mt-14 w-full",children:["Powered by"," ",e.jsx("a",{href:"https://shophost.io",className:"text-teal-500 hover:text-teal-600 dark:text-blue-500 dark:hover:text-blue-400",children:"shophost.io"})]})]})}),e.jsx("div",{className:"flex flex-col items-start 2xl:items-start w-full md:w-1/2 h-full px-6 sm:px-12 xl:px-24 py-8 md:overflow-y-auto relative",children:e.jsx("div",{className:"py-10 xl:py-24 md:my-auto animate-fade w-full md:max-w-[432px]",children:so(g,h)})})]})})]}):e.jsx("div",{className:"flex flex-col items-center justify-center h-screen w-screen bg-gray-900",children:e.jsx("h1",{className:"text-2xl font-bold",children:"Organization not found"})})},ro=({children:t})=>{const{isOpen:s,onClose:a,product:r,modifierGroups:i,hasModifiers:n,productName:o,quantity:l,handleIncrement:d,handleDecrement:c,handleAddToCart:u,validationError:p}=ut();if(!r)return null;const g=l<=1;return t({modifierGroups:i,hasModifiers:n,product:r,isOpen:s,onClose:a,productName:o,quantity:l,onIncrement:d,onDecrement:c,isDecrementDisabled:g,onAddToCart:u,validationError:p})},io=({children:t,minQuantity:s=1})=>{const{quantity:a,handleIncrement:r,handleDecrement:i}=ut(),n=a<=s;return t({quantity:a,onIncrement:r,onDecrement:i,isDecrementDisabled:n})},no=({children:t,group:s,renderOptions:a})=>{const{getModifierGroupName:r}=ut(),i=r(s),n=s.selectMin>0;let o=null;return s.selectMin>0&&s.selectMax>0&&(o=s.selectMin===s.selectMax?`${s.selectMin} option`:`${s.selectMin}-${s.selectMax}`),t({group:s,groupName:i,isRequired:n,selectionRequirements:o,renderOptions:a})},oo=({children:t,modifier:s,groupId:a})=>{const{isModifierSelected:r,isMultiSelect:i,toggleModifier:n,selectModifier:o,formatModifierPrice:l,product:d,locale:c}=ut(),u=r(a,s.id),p=i(d.modifierGroups.find(y=>y.id===a)),g=l(s,d.currency);return t({modifier:s,isSelected:u,onSelect:()=>{p?n(a,s.id):o(a,s.id)},isMultiSelect:p,formattedPrice:g})},lo=({children:t,locale:s="en"})=>e.jsx(Sa,{locale:s,children:t}),co=(t,s=[])=>{const[a,r]=x.useState(null),[i,n]=x.useState(!0),[o,l]=x.useState(null),d=JSON.stringify(s.map(c=>c.id));return x.useEffect(()=>{(async()=>{n(!0);try{const u=s.find(p=>p.id===t);if(u)r(u);else throw new Error(`Product with ID ${t} not found`)}catch(u){l(u instanceof Error?u:new Error("Failed to fetch product"))}finally{n(!1)}})()},[t,d]),{product:a,loading:i,error:o}},uo=(t,s=[])=>{const[a,r]=x.useState({}),[i,n]=x.useState(!0),[o,l]=x.useState(null),d=JSON.stringify(t.sort());return x.useEffect(()=>{const u=async()=>{n(!0);try{const g=s.filter(y=>t.includes(y.id)).reduce((y,b)=>(y[b.id]=b,y),{});r(g);const h=t.filter(y=>!g[y]);h.length>0&&console.warn(`Products with IDs ${h.join(", ")} not found`)}catch(p){l(p instanceof Error?p:new Error("Failed to fetch products"))}finally{n(!1)}};t.length>0?u():(r({}),n(!1))},[d,s]),{products:a,getProduct:u=>a[u]||null,loading:i,error:o}},po=[{id:"product-1",slug:"classic-burger",sku:"BURGER-001",basePrice:12.99,discountedBasePrice:null,currency:"USD",images:[{id:"img-1",url:"https://images.unsplash.com/photo-1568901346375-23c9450c58cd?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1000&q=80",mimeType:"image/jpeg",size:65783,filename:"classic-burger.jpeg"}],modifierGroups:[],categories:[{id:"cat-1",slug:"burgers",createdAt:"2023-01-01T00:00:00.000Z",translations:[{locale:"en",title:"Burgers",description:""},{locale:"pl",title:"Burgery",description:""}]}],manufacturerId:null,createdAt:"2023-01-01T00:00:00.000Z",publishedAt:"2023-01-01T00:00:00.000Z",translations:[{locale:"en",title:"Classic Burger",description:"A juicy beef patty with lettuce, tomato, onion, and our special sauce on a toasted bun."},{locale:"pl",title:"Klasyczny Burger",description:"Soczysta wołowina z sałatą, pomidorem, cebulą i naszym specjalnym sosem na opiekanej bułce."}]},{id:"product-2",slug:"custom-pizza",sku:"PIZZA-001",basePrice:14.99,discountedBasePrice:null,currency:"USD",images:[{id:"img-2",url:"https://images.unsplash.com/photo-1513104890138-7c749659a591?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1000&q=80",mimeType:"image/jpeg",size:75783,filename:"custom-pizza.jpeg"}],modifierGroups:[{id:"mod-group-1",selectMin:1,selectMax:1,modifiers:[{id:"mod-1-1",title:"Thin Crust",sku:null,price:0},{id:"mod-1-2",title:"Regular Crust",sku:null,price:0},{id:"mod-1-3",title:"Thick Crust",sku:null,price:2}],translations:[{locale:"en",title:"Crust Type"},{locale:"pl",title:"Rodzaj Ciasta"}]},{id:"mod-group-2",selectMin:1,selectMax:1,modifiers:[{id:"mod-2-1",title:"Tomato Sauce",sku:null,price:0},{id:"mod-2-2",title:"White Sauce",sku:null,price:0},{id:"mod-2-3",title:"BBQ Sauce",sku:null,price:0}],translations:[{locale:"en",title:"Sauce"},{locale:"pl",title:"Sos"}]}],categories:[{id:"cat-2",slug:"pizza",createdAt:"2023-01-01T00:00:00.000Z",translations:[{locale:"en",title:"Pizza",description:""},{locale:"pl",title:"Pizza",description:""}]}],manufacturerId:null,createdAt:"2023-01-01T00:00:00.000Z",publishedAt:"2023-01-01T00:00:00.000Z",translations:[{locale:"en",title:"Custom Pizza",description:"Build your own pizza with your choice of crust and sauce. Comes with cheese and tomatoes."},{locale:"pl",title:"Pizza Własna",description:"Zbuduj własną pizzę z wybranym rodzajem ciasta i sosu. Zawiera ser i pomidory."}]},{id:"product-3",slug:"build-your-salad",sku:"SALAD-001",basePrice:9.99,discountedBasePrice:null,currency:"USD",images:[{id:"img-3",url:"https://images.unsplash.com/photo-1512621776951-a57141f2eefd?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1000&q=80",mimeType:"image/jpeg",size:55783,filename:"build-your-salad.jpeg"}],modifierGroups:[{id:"mod-group-3",selectMin:0,selectMax:5,modifiers:[{id:"mod-3-1",title:"Grilled Chicken",sku:null,price:2.5},{id:"mod-3-2",title:"Bacon",sku:null,price:1.5},{id:"mod-3-3",title:"Avocado",sku:null,price:2},{id:"mod-3-4",title:"Feta Cheese",sku:null,price:1},{id:"mod-3-5",title:"Boiled Egg",sku:null,price:1}],translations:[{locale:"en",title:"Toppings"},{locale:"pl",title:"Dodatki"}]},{id:"mod-group-4",selectMin:0,selectMax:1,modifiers:[{id:"mod-4-1",title:"Ranch",sku:null,price:0},{id:"mod-4-2",title:"Balsamic Vinaigrette",sku:null,price:0},{id:"mod-4-3",title:"Caesar",sku:null,price:0},{id:"mod-4-4",title:"Olive Oil & Lemon",sku:null,price:0}],translations:[{locale:"en",title:"Dressing"},{locale:"pl",title:"Dressing"}]}],categories:[{id:"cat-3",slug:"salads",createdAt:"2023-01-01T00:00:00.000Z",translations:[{locale:"en",title:"Salads",description:""},{locale:"pl",title:"Sałatki",description:""}]}],manufacturerId:null,createdAt:"2023-01-01T00:00:00.000Z",publishedAt:"2023-01-01T00:00:00.000Z",translations:[{locale:"en",title:"Build Your Salad",description:"Fresh mixed greens with cherry tomatoes, cucumber, and red onion. Add your favorite toppings and dressing."},{locale:"pl",title:"Skomponuj Swoją Sałatkę",description:"Świeże mieszane sałaty z pomidorkami koktajlowymi, ogórkiem i czerwoną cebulą. Dodaj ulubione dodatki i dressing."}]}],mo=new R.QueryClient({defaultOptions:{queries:{retry:!1,refetchInterval:!1,refetchOnWindowFocus:!1}}}),go=({baseUrl:t,children:s,locale:a="en",organizationId:r})=>e.jsx(Vn,{locale:a,children:e.jsx(Dn,{baseURL:t,children:e.jsx(gs,{baseUrl:t,children:e.jsx(R.QueryClientProvider,{client:mo,children:e.jsx(Gi,{organizationId:r,children:e.jsx(fa,{locale:a,organizationId:r,children:e.jsx(Sa,{locale:a,children:s})})})})})})}),hr=x.createContext(null),ho=({client:t,children:s})=>e.jsx(hr.Provider,{value:t,children:s});function mt(){const t=x.useContext(hr);if(!t)throw new Error("useAdminAuth must be used within AdminProvider");return t}const xr=x.createContext(null),xo=({config:t,children:s})=>e.jsx(xr.Provider,{value:t,children:s});function fr(){const t=x.useContext(xr);if(!t)throw new Error("useAdminConfig must be used within AdminProvider");return t}const yr=x.createContext(null),fo=({routes:t,children:s})=>e.jsx(yr.Provider,{value:t,children:s});function Y(){const t=x.useContext(yr);if(!t)throw new Error("useAdminRoutes must be used within AdminProvider");return t}function wr(t){return oa.createAuthClient({baseURL:t,plugins:[Ct.inferAdditionalFields(),Ct.organizationClient()]})}const rs=new Map;function br(t){return rs.has(t)||rs.set(t,wr(t)),rs.get(t)}const Ae=new R.QueryClient({defaultOptions:{queries:{retry:!1,refetchInterval:!1,refetchOnWindowFocus:!1}}});function Sr(t){const s=t.replace(/\/$/,"");return{home:s,signIn:`${s}/auth/sign-in`,signUp:`${s}/auth/sign-up`,organizations:`${s}/organizations`,dashboard:a=>`${s}/${a}/dashboard`,liveOrders:a=>`${s}/${a}/live-orders`,orders:a=>`${s}/${a}/orders`,reservations:a=>`${s}/${a}/reservations`,products:a=>`${s}/${a}/products`,productCreate:a=>`${s}/${a}/products/create`,productEdit:(a,r)=>`${s}/${a}/products/${r}`,productCategories:a=>`${s}/${a}/product-categories`,productCategoryCreate:a=>`${s}/${a}/product-categories/create`,productCategoryEdit:(a,r)=>`${s}/${a}/product-categories/${r}`,manufacturers:a=>`${s}/${a}/manufacturers`,manufacturerCreate:a=>`${s}/${a}/manufacturers/create`,manufacturerEdit:(a,r)=>`${s}/${a}/manufacturers/${r}`,settings:a=>`${s}/${a}/settings`,settingsOpeningTimes:a=>`${s}/${a}/settings/opening-times`,settingsShippingMethods:a=>`${s}/${a}/settings/shipping-methods`,settingsShippingMethodCreate:a=>`${s}/${a}/settings/shipping-methods/create`,settingsShippingMethodEdit:(a,r)=>`${s}/${a}/settings/shipping-methods/${r}`}}function yo({config:t,children:s}){const a=x.useMemo(()=>br(t.apiBaseUrl),[t.apiBaseUrl]),r=x.useMemo(()=>Sr(t.basePath),[t.basePath]);return e.jsxs(R.QueryClientProvider,{client:Ae,children:[e.jsx(na.ThemeProvider,{defaultTheme:"light",attribute:"class",children:e.jsx(gs,{baseUrl:t.apiBaseUrl,children:e.jsx(ho,{client:a,children:e.jsx(xo,{config:t,children:e.jsx(fo,{routes:r,children:s})})})})}),e.jsx(X.Toaster,{})]})}function I(...t){return da.twMerge(la(...t))}const tt=["focus:ring-2","focus:ring-blue-200 dark:focus:ring-blue-700/30","focus:border-blue-500 dark:focus:border-blue-700"],ie=["outline outline-offset-2 outline-0 focus-visible:outline-2","outline-blue-500 dark:outline-blue-500"],$t=["ring-2","border-red-500 dark:border-red-700","ring-red-200 dark:ring-red-700/30"],wo=(t,s=0)=>Intl.NumberFormat("us",{minimumFractionDigits:s,maximumFractionDigits:s}).format(Number(t)).toString(),kr=(t,s=1)=>{const a=new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:s,maximumFractionDigits:s}).format(t);return`${t>0&&t!==1/0?"+":""}${a}`},Ys={currency:(t,s="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:s}).format(t),unit:t=>`${wo(t)}`},bo=Se.tv({base:["relative inline-flex items-center justify-center whitespace-nowrap rounded-lg border px-3 py-2 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out","disabled:pointer-events-none disabled:shadow-none",ie],variants:{variant:{primary:["border-transparent","text-white dark:text-white","bg-blue-600 dark:bg-blue-500","shadow-[0_16px_8px_rgba(31,31,31,0.01),0_12px_6px_rgba(31,31,31,0.04),0_4px_4px_rgba(31,31,31,0.07),0_1.5px_3px_rgba(31,31,31,0.08),0_0_0_1px_#2563eb,inset_0_1px_2px_hsla(0,0%,100%,0.12)] dark:outline-0 outline outline-2 outline-transparent outline-offset-2","hover:bg-blue-500 dark:hover:bg-blue-600","disabled:bg-blue-100 disabled:text-gray-400","dark:disabled:bg-blue-800 dark:disabled:text-blue-400"],secondary:["border-gray-200 dark:border-gray-800","text-gray-900 dark:text-gray-50","bg-white dark:bg-gray-950","shadow-[0_1px_1px_0.5px_rgba(51,51,51,.04),0_3px_3px_-1.5px_rgba(51,51,51,.02),0_6px_6px_-3px_rgba(51,51,51,.04),0_12px_12px_-6px_rgba(51,51,51,.04),0_24px_24px_-12px_rgba(51,51,51,.04),0_48px_48px_-24px_rgba(51,51,51,.04),0_0_0_1px_rgba(51,51,51,.1),inset_0_-1px_1px_-0.5px_rgba(51,51,51,.06)] outline outline-2 dark:outline-0 outline-transparent outline-offset-2","hover:bg-gray-50 dark:hover:bg-gray-900/60","disabled:text-gray-400","dark:disabled:text-gray-600"],light:["shadow-none","border-transparent","text-gray-900 dark:text-gray-50","bg-gray-200 dark:bg-gray-900","hover:bg-gray-300/70 dark:hover:bg-gray-800/80","disabled:bg-gray-100 disabled:text-gray-400","dark:disabled:bg-gray-800 dark:disabled:text-gray-600"],ghost:["shadow-none","border-transparent","text-gray-900 dark:text-gray-50","bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800/80","disabled:text-gray-400","dark:disabled:text-gray-600"],destructive:["text-white","border-transparent","bg-red-600 dark:bg-red-700","hover:bg-red-700 dark:hover:bg-red-600","disabled:bg-red-300 disabled:text-white","dark:disabled:bg-red-950 dark:disabled:text-red-400"]}},defaultVariants:{variant:"primary"}}),z=x.forwardRef(({asChild:t,isLoading:s=!1,loadingText:a,className:r,disabled:i,variant:n,children:o,...l},d)=>{const c=t?ps.Slot:"button";return e.jsx(c,{ref:d,className:w(bo({variant:n}),r),disabled:i||s,...l,children:s?e.jsxs("span",{className:"pointer-events-none flex shrink-0 items-center justify-center gap-1.5",children:[e.jsx(C.RiLoader2Fill,{className:"size-4 shrink-0 animate-spin","aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:a||"Loading"}),a||"Loading"]}):o})});z.displayName="Button";function Cs({onReset:t}){return e.jsx("div",{className:"flex flex-col items-center gap-4 h-screen justify-center",children:e.jsx("div",{className:"py-8 px-4 mx-auto max-w-(--breakpoint-xl) pb-64 lg:px-6",children:e.jsxs("div",{className:"mx-auto max-w-(--breakpoint-sm) text-center",children:[e.jsx("h1",{className:"mb-4 text-7xl tracking-tight font-extrabold lg:text-9xl text-red-500 dark:text-primary-500",children:"500"}),e.jsx("p",{className:"mb-3 text-3xl tracking-tight font-bold text-gray-800 md:text-4xl dark:text-white",children:"Something went wrong"}),e.jsxs("p",{className:"mb-4 text-lg text-gray-500 dark:text-gray-400",children:["We are sorry, but there was an unexpected error. ",e.jsx("br",{}),"Please try reloading the page."]}),t&&e.jsx(z,{className:"mt-3",onClick:t,children:"Reload Page"})]})})})}const So="redirect";function ko(t){return t.startsWith("/")&&!t.startsWith("//")}function jo(t,s){return t===s||t.startsWith(`${s}/`)}function Gt(t,s){return!t||!ko(t)||!jo(t,s.home)||t===s.signIn||t===s.signUp?s.home:t}function Ps(t,s){const a=new URLSearchParams({[So]:s});return`${t}?${a.toString()}`}function jr(t,s,a){const r=Gt(s,a);return new URL(r,t).toString()}const Kt=x.createContext({});function Ao({children:t,organizationId:s,id:a}){return e.jsx(Kt.Provider,{value:{organizationId:s,id:a},children:t})}function vo(){return x.useContext(Kt)}function K(){const{organizationId:t}=x.useContext(Kt);if(!t)throw new Error("useOrgId called outside an org-scoped route");return t}function gt(){const{id:t}=x.useContext(Kt);if(!t)throw new Error("useRouteId called outside a detail route");return t}const No=x.createContext(void 0),Ro=({children:t,initialState:s=!1})=>{const[a,r]=x.useState(s);return e.jsx(No.Provider,{value:{flyoutOpen:a,setFlyoutOpen:r},children:t})},ce=({className:t,...s})=>e.jsxs("svg",{"aria-hidden":"true",className:w("text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",t),viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s,children:[e.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),e.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),Ar=x.createContext(null),ea=({children:t})=>{var l,d,c,u;const{client:s}=E(),{organizationId:a}=vo(),r=R.useQuery({queryKey:["organizations"],queryFn:async()=>{const{body:p,status:g}=await s.organization.getOrganizations();if(g!==200)throw g!==401&&X.error("Failed to update organizations list. Please refresh the page or try again later."),new Error("Failed to fetch organizations");return p},retry:!1}),i=R.useQuery({queryKey:["organization",a],queryFn:async()=>{const{body:p,status:g}=await s.organization.getOrganization({params:{organizationId:a}});if(g!==200)throw g!==401&&X.error("Failed to fetch organization. Please try refreshing the page or try again later."),new Error("Failed to fetch organizations");return p},enabled:!!a}),n=((l=i.data)==null?void 0:l.configuration.defaultLocale)??"en",o=((c=(d=i.data)==null?void 0:d.configuration.supportedLocales)==null?void 0:c.sort(p=>p===n?-1:1))||["en"];return e.jsx(Ar.Provider,{value:{defaultLocale:n,supportedLocales:o,organizations:{loading:r.isLoading,data:((u=r.data)==null?void 0:u.list)??[],error:r.isError},organization:{loading:i.isLoading,data:i.data??null,error:i.isError}},children:i.isLoading||r.isLoading?e.jsx("div",{className:"flex justify-center items-center h-screen mt-5",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(ce,{className:"w-12 h-12"}),e.jsx("p",{className:"text-gray-500 text-sm mt-3",children:"Loading data..."})]})}):t})},pe=()=>{const t=x.useContext(Ar);if(!t)throw new Error("useOrganization must be used within a OrganizationProvider");return t},Co=Se.tv({base:w("inline-flex items-center gap-x-1 whitespace-nowrap rounded px-1.5 py-0.5 text-xs font-semibold ring-1"),variants:{variant:{default:["bg-blue-50 text-blue-800 ring-blue-500/30","dark:bg-blue-400/10 dark:text-blue-400 dark:ring-blue-400/30"],neutral:["bg-gray-50 text-gray-700 ring-gray-500/30","dark:bg-gray-400/10 dark:text-gray-300 dark:ring-gray-400/20"],success:["bg-emerald-50 text-emerald-800 ring-emerald-600/30","dark:bg-emerald-400/10 dark:text-emerald-400 dark:ring-emerald-400/20"],error:["bg-red-50 text-red-800 ring-red-600/20","dark:bg-red-400/10 dark:text-red-400 dark:ring-red-400/20"],warning:["bg-yellow-50 text-yellow-800 ring-yellow-600/30","dark:bg-yellow-400/10 dark:text-yellow-500 dark:ring-yellow-400/20"]}},defaultVariants:{variant:"default"}}),ht=x.forwardRef(({className:t,variant:s,...a},r)=>e.jsx("span",{ref:r,className:w(Co({variant:s}),t),...a}));ht.displayName="Badge";function Po({title:t,change:s,value:a,valueDescription:r,subtitle:i,ctaDescription:n,ctaText:o,ctaLink:l,data:d}){return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-bold text-gray-900 sm:text-sm dark:text-gray-50",children:t}),e.jsx(ht,{variant:"neutral",children:s})]}),e.jsxs("p",{className:"mt-2 flex items-baseline gap-2",children:[e.jsx("span",{className:"text-xl text-gray-900 dark:text-gray-50",children:a}),e.jsx("span",{className:"text-sm text-gray-500",children:r})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:i}),e.jsx("div",{className:"mt-2 flex items-center gap-0.5",children:d.map(c=>e.jsx("div",{className:w(c.color,"h-1.5 rounded-full"),style:{width:`${c.percentage}%`}},c.title))})]}),e.jsx("ul",{role:"list",className:"mt-5 space-y-2",children:d.map(c=>e.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:w(c.color,"size-2.5 rounded-sm"),"aria-hidden":"true"}),e.jsx("span",{className:"text-gray-900 dark:text-gray-50",children:c.title}),e.jsxs("span",{className:"text-gray-600 dark:text-gray-400",children:["(",c.value," / ",c.percentage,"%)"]})]},c.title))})]}),e.jsxs("p",{className:"mt-6 text-xs text-gray-500",children:[n," ",e.jsx("a",{href:l,className:"text-blue-600 dark:text-blue-400",children:o})]})]})})}const cs=[{date:"2023-01-01T00:00:00","Rows written":3093,"Rows read":22633,Queries:448,"Payments completed":71,"Sign ups":60,Logins:1664,"Sign outs":1133,"Support calls":5},{date:"2023-01-02T00:00:00","Rows written":3061,"Rows read":22587,Queries:484,"Payments completed":88,"Sign ups":79,Logins:1642,"Sign outs":1104,"Support calls":5},{date:"2023-01-03T00:00:00","Rows written":3062,"Rows read":22079,Queries:487,"Payments completed":100,"Sign ups":75,Logins:1525,"Sign outs":1083,"Support calls":6},{date:"2023-01-04T00:00:00","Rows written":3076,"Rows read":21412,Queries:487,"Payments completed":122,"Sign ups":61,Logins:1211,"Sign outs":1017,"Support calls":7},{date:"2023-01-05T00:00:00","Rows written":3066,"Rows read":20679,Queries:484,"Payments completed":107,"Sign ups":64,Logins:991,"Sign outs":1070,"Support calls":5},{date:"2023-01-06T00:00:00","Rows written":3043,"Rows read":20048,Queries:479,"Payments completed":124,"Sign ups":64,Logins:855,"Sign outs":1115,"Support calls":3},{date:"2023-01-07T00:00:00","Rows written":3026,"Rows read":19335,Queries:369,"Payments completed":105,"Sign ups":55,Logins:875,"Sign outs":1184,"Support calls":3},{date:"2023-01-08T00:00:00","Rows written":3031,"Rows read":19548,Queries:420,"Payments completed":68,"Sign ups":47,Logins:867,"Sign outs":1191,"Support calls":3},{date:"2023-01-09T00:00:00","Rows written":3030,"Rows read":19431,Queries:489,"Payments completed":87,"Sign ups":66,Logins:853,"Sign outs":1156,"Support calls":3},{date:"2023-01-10T00:00:00","Rows written":3024,"Rows read":18802,Queries:493,"Payments completed":90,"Sign ups":76,Logins:976,"Sign outs":1169,"Support calls":2},{date:"2023-01-11T00:00:00","Rows written":3028,"Rows read":18816,Queries:499,"Payments completed":89,"Sign ups":72,Logins:1191,"Sign outs":1170,"Support calls":2},{date:"2023-01-12T00:00:00","Rows written":3049,"Rows read":19225,Queries:500,"Payments completed":91,"Sign ups":76,Logins:1235,"Sign outs":1129,"Support calls":3},{date:"2023-01-13T00:00:00","Rows written":3066,"Rows read":19467,Queries:505,"Payments completed":123,"Sign ups":64,Logins:1060,"Sign outs":1196,"Support calls":5},{date:"2023-01-14T00:00:00","Rows written":3049,"Rows read":19950,Queries:418,"Payments completed":87,"Sign ups":61,Logins:915,"Sign outs":1174,"Support calls":6},{date:"2023-01-15T00:00:00","Rows written":3018,"Rows read":19814,Queries:422,"Payments completed":103,"Sign ups":46,Logins:1026,"Sign outs":1155,"Support calls":6},{date:"2023-01-16T00:00:00","Rows written":2976,"Rows read":19962,Queries:490,"Payments completed":118,"Sign ups":62,Logins:1199,"Sign outs":1060,"Support calls":7},{date:"2023-01-17T00:00:00","Rows written":2939,"Rows read":19931,Queries:484,"Payments completed":96,"Sign ups":61,Logins:1344,"Sign outs":1076,"Support calls":7},{date:"2023-01-18T00:00:00","Rows written":2931,"Rows read":19650,Queries:480,"Payments completed":124,"Sign ups":64,Logins:1203,"Sign outs":1100,"Support calls":7},{date:"2023-01-19T00:00:00","Rows written":2935,"Rows read":19592,Queries:479,"Payments completed":112,"Sign ups":67,Logins:1351,"Sign outs":1046,"Support calls":5},{date:"2023-01-20T00:00:00","Rows written":2962,"Rows read":19214,Queries:478,"Payments completed":121,"Sign ups":80,Logins:1379,"Sign outs":945,"Support calls":3},{date:"2023-01-21T00:00:00","Rows written":2965,"Rows read":19460,Queries:385,"Payments completed":88,"Sign ups":60,Logins:1460,"Sign outs":912,"Support calls":2},{date:"2023-01-22T00:00:00","Rows written":2969,"Rows read":19151,Queries:373,"Payments completed":77,"Sign ups":70,Logins:1704,"Sign outs":904,"Support calls":2},{date:"2023-01-23T00:00:00","Rows written":2945,"Rows read":19301,Queries:499,"Payments completed":85,"Sign ups":62,Logins:1951,"Sign outs":916,"Support calls":2},{date:"2023-01-24T00:00:00","Rows written":2933,"Rows read":19614,Queries:501,"Payments completed":80,"Sign ups":61,Logins:1768,"Sign outs":914,"Support calls":2},{date:"2023-01-25T00:00:00","Rows written":2910,"Rows read":19470,Queries:497,"Payments completed":100,"Sign ups":66,Logins:1811,"Sign outs":924,"Support calls":2},{date:"2023-01-26T00:00:00","Rows written":2904,"Rows read":19632,Queries:492,"Payments completed":82,"Sign ups":68,Logins:2048,"Sign outs":914,"Support calls":2},{date:"2023-01-27T00:00:00","Rows written":2905,"Rows read":19706,Queries:488,"Payments completed":87,"Sign ups":60,Logins:1853,"Sign outs":958,"Support calls":2},{date:"2023-01-28T00:00:00","Rows written":2881,"Rows read":20284,Queries:422,"Payments completed":77,"Sign ups":63,Logins:1693,"Sign outs":1e3,"Support calls":2},{date:"2023-01-29T00:00:00","Rows written":2851,"Rows read":20142,Queries:418,"Payments completed":74,"Sign ups":54,Logins:1637,"Sign outs":1048,"Support calls":2},{date:"2023-01-30T00:00:00","Rows written":2859,"Rows read":19518,Queries:490,"Payments completed":89,"Sign ups":79,Logins:1847,"Sign outs":1077,"Support calls":3},{date:"2023-01-31T00:00:00","Rows written":2855,"Rows read":19639,Queries:491,"Payments completed":94,"Sign ups":67,Logins:1972,"Sign outs":1036,"Support calls":4},{date:"2023-02-01T00:00:00","Rows written":2839,"Rows read":19806,Queries:494,"Payments completed":82,"Sign ups":60,Logins:1818,"Sign outs":938,"Support calls":3},{date:"2023-02-02T00:00:00","Rows written":2840,"Rows read":19498,Queries:494,"Payments completed":86,"Sign ups":60,Logins:1437,"Sign outs":937,"Support calls":3},{date:"2023-02-03T00:00:00","Rows written":2861,"Rows read":18849,Queries:489,"Payments completed":81,"Sign ups":65,Logins:1420,"Sign outs":1025,"Support calls":4},{date:"2023-02-04T00:00:00","Rows written":2892,"Rows read":19077,Queries:379,"Payments completed":66,"Sign ups":56,Logins:1622,"Sign outs":1124,"Support calls":3},{date:"2023-02-05T00:00:00","Rows written":2892,"Rows read":19313,Queries:398,"Payments completed":69,"Sign ups":52,Logins:1847,"Sign outs":1150,"Support calls":3},{date:"2023-02-06T00:00:00","Rows written":2870,"Rows read":18922,Queries:494,"Payments completed":89,"Sign ups":61,Logins:2020,"Sign outs":1199,"Support calls":4},{date:"2023-02-07T00:00:00","Rows written":2849,"Rows read":18994,Queries:491,"Payments completed":80,"Sign ups":65,Logins:2035,"Sign outs":1198,"Support calls":5},{date:"2023-02-08T00:00:00","Rows written":2826,"Rows read":18675,Queries:493,"Payments completed":85,"Sign ups":61,Logins:2044,"Sign outs":1180,"Support calls":5},{date:"2023-02-09T00:00:00","Rows written":2810,"Rows read":18103,Queries:493,"Payments completed":90,"Sign ups":61,Logins:1899,"Sign outs":1198,"Support calls":4},{date:"2023-02-10T00:00:00","Rows written":2779,"Rows read":18138,Queries:498,"Payments completed":87,"Sign ups":62,Logins:1478,"Sign outs":1196,"Support calls":4},{date:"2023-02-11T00:00:00","Rows written":2739,"Rows read":18141,Queries:414,"Payments completed":71,"Sign ups":63,Logins:1158,"Sign outs":1194,"Support calls":5},{date:"2023-02-12T00:00:00","Rows written":2717,"Rows read":18061,Queries:431,"Payments completed":68,"Sign ups":60,Logins:850,"Sign outs":1197,"Support calls":4},{date:"2023-02-13T00:00:00","Rows written":2698,"Rows read":18111,Queries:487,"Payments completed":81,"Sign ups":70,Logins:871,"Sign outs":1109,"Support calls":5},{date:"2023-02-14T00:00:00","Rows written":2685,"Rows read":18265,Queries:485,"Payments completed":106,"Sign ups":63,Logins:849,"Sign outs":958,"Support calls":6},{date:"2023-02-15T00:00:00","Rows written":2676,"Rows read":18603,Queries:488,"Payments completed":86,"Sign ups":79,Logins:874,"Sign outs":910,"Support calls":7},{date:"2023-02-16T00:00:00","Rows written":2681,"Rows read":18967,Queries:488,"Payments completed":81,"Sign ups":76,Logins:862,"Sign outs":928,"Support calls":10},{date:"2023-02-17T00:00:00","Rows written":2699,"Rows read":19166,Queries:484,"Payments completed":85,"Sign ups":62,Logins:864,"Sign outs":904,"Support calls":13},{date:"2023-02-18T00:00:00","Rows written":2710,"Rows read":18711,Queries:430,"Payments completed":66,"Sign ups":52,Logins:918,"Sign outs":952,"Support calls":16},{date:"2023-02-19T00:00:00","Rows written":2694,"Rows read":18862,Queries:398,"Payments completed":69,"Sign ups":60,Logins:968,"Sign outs":911,"Support calls":15},{date:"2023-02-20T00:00:00","Rows written":2679,"Rows read":18473,Queries:494,"Payments completed":80,"Sign ups":73,Logins:1142,"Sign outs":906,"Support calls":16},{date:"2023-02-21T00:00:00","Rows written":2684,"Rows read":18663,Queries:497,"Payments completed":93,"Sign ups":61,Logins:1360,"Sign outs":911,"Support calls":16},{date:"2023-02-22T00:00:00","Rows written":2678,"Rows read":18562,Queries:498,"Payments completed":83,"Sign ups":72,Logins:1691,"Sign outs":901,"Support calls":18},{date:"2023-02-23T00:00:00","Rows written":2669,"Rows read":18132,Queries:499,"Payments completed":105,"Sign ups":62,Logins:1862,"Sign outs":916,"Support calls":10},{date:"2023-02-24T00:00:00","Rows written":2674,"Rows read":18392,Queries:499,"Payments completed":117,"Sign ups":66,Logins:2003,"Sign outs":906,"Support calls":8},{date:"2023-02-25T00:00:00","Rows written":2667,"Rows read":19037,Queries:386,"Payments completed":94,"Sign ups":67,Logins:2006,"Sign outs":914,"Support calls":7},{date:"2023-02-26T00:00:00","Rows written":2689,"Rows read":19828,Queries:385,"Payments completed":105,"Sign ups":62,Logins:2007,"Sign outs":956,"Support calls":4},{date:"2023-02-27T00:00:00","Rows written":2680,"Rows read":20667,Queries:497,"Payments completed":115,"Sign ups":62,Logins:1742,"Sign outs":903,"Support calls":4},{date:"2023-02-28T00:00:00","Rows written":2686,"Rows read":20929,Queries:494,"Payments completed":84,"Sign ups":66,Logins:1910,"Sign outs":920,"Support calls":3},{date:"2023-03-01T00:00:00","Rows written":2694,"Rows read":20639,Queries:495,"Payments completed":85,"Sign ups":63,Logins:1766,"Sign outs":916,"Support calls":3},{date:"2023-03-02T00:00:00","Rows written":2687,"Rows read":19941,Queries:495,"Payments completed":82,"Sign ups":65,Logins:1674,"Sign outs":924,"Support calls":2},{date:"2023-03-03T00:00:00","Rows written":2708,"Rows read":19420,Queries:491,"Payments completed":102,"Sign ups":66,Logins:1785,"Sign outs":912,"Support calls":2},{date:"2023-03-04T00:00:00","Rows written":2741,"Rows read":18773,Queries:415,"Payments completed":78,"Sign ups":52,Logins:1732,"Sign outs":903,"Support calls":2},{date:"2023-03-05T00:00:00","Rows written":2783,"Rows read":18993,Queries:402,"Payments completed":64,"Sign ups":47,Logins:1813,"Sign outs":912,"Support calls":2},{date:"2023-03-06T00:00:00","Rows written":2819,"Rows read":18895,Queries:493,"Payments completed":80,"Sign ups":67,Logins:1938,"Sign outs":932,"Support calls":2},{date:"2023-03-07T00:00:00","Rows written":2856,"Rows read":19163,Queries:488,"Payments completed":118,"Sign ups":75,Logins:1798,"Sign outs":904,"Support calls":2},{date:"2023-03-08T00:00:00","Rows written":2870,"Rows read":19383,Queries:483,"Payments completed":123,"Sign ups":75,Logins:1866,"Sign outs":901,"Support calls":3},{date:"2023-03-09T00:00:00","Rows written":2855,"Rows read":19523,Queries:483,"Payments completed":118,"Sign ups":61,Logins:1640,"Sign outs":910,"Support calls":5},{date:"2023-03-10T00:00:00","Rows written":2819,"Rows read":19186,Queries:480,"Payments completed":124,"Sign ups":65,Logins:1274,"Sign outs":903,"Support calls":4},{date:"2023-03-11T00:00:00","Rows written":2785,"Rows read":18841,Queries:415,"Payments completed":97,"Sign ups":52,Logins:895,"Sign outs":913,"Support calls":4},{date:"2023-03-12T00:00:00","Rows written":2787,"Rows read":18357,Queries:390,"Payments completed":71,"Sign ups":50,Logins:861,"Sign outs":906,"Support calls":3},{date:"2023-03-13T00:00:00","Rows written":2810,"Rows read":18455,Queries:496,"Payments completed":94,"Sign ups":67,Logins:853,"Sign outs":914,"Support calls":4},{date:"2023-03-14T00:00:00","Rows written":2827,"Rows read":18791,Queries:494,"Payments completed":92,"Sign ups":77,Logins:860,"Sign outs":902,"Support calls":6},{date:"2023-03-15T00:00:00","Rows written":2855,"Rows read":19023,Queries:493,"Payments completed":94,"Sign ups":80,Logins:922,"Sign outs":971,"Support calls":7},{date:"2023-03-16T00:00:00","Rows written":2895,"Rows read":19666,Queries:495,"Payments completed":122,"Sign ups":76,Logins:1127,"Sign outs":1019,"Support calls":5},{date:"2023-03-17T00:00:00","Rows written":2912,"Rows read":20299,Queries:497,"Payments completed":114,"Sign ups":61,Logins:1055,"Sign outs":953,"Support calls":2},{date:"2023-03-18T00:00:00","Rows written":2924,"Rows read":20036,Queries:386,"Payments completed":95,"Sign ups":60,Logins:1158,"Sign outs":988,"Support calls":2},{date:"2023-03-19T00:00:00","Rows written":2953,"Rows read":20010,Queries:408,"Payments completed":71,"Sign ups":58,Logins:1438,"Sign outs":954,"Support calls":2},{date:"2023-03-20T00:00:00","Rows written":2939,"Rows read":19601,Queries:492,"Payments completed":87,"Sign ups":70,Logins:1332,"Sign outs":906,"Support calls":3},{date:"2023-03-21T00:00:00","Rows written":2932,"Rows read":19406,Queries:495,"Payments completed":120,"Sign ups":75,Logins:1102,"Sign outs":918,"Support calls":5},{date:"2023-03-22T00:00:00","Rows written":2951,"Rows read":19742,Queries:497,"Payments completed":110,"Sign ups":75,Logins:951,"Sign outs":922,"Support calls":8},{date:"2023-03-23T00:00:00","Rows written":2937,"Rows read":19329,Queries:503,"Payments completed":103,"Sign ups":75,Logins:846,"Sign outs":921,"Support calls":12},{date:"2023-03-24T00:00:00","Rows written":2945,"Rows read":19646,Queries:511,"Payments completed":118,"Sign ups":71,Logins:850,"Sign outs":926,"Support calls":14},{date:"2023-03-25T00:00:00","Rows written":2947,"Rows read":19271,Queries:426,"Payments completed":97,"Sign ups":67,Logins:878,"Sign outs":923,"Support calls":14},{date:"2023-03-26T00:00:00","Rows written":2945,"Rows read":18842,Queries:382,"Payments completed":98,"Sign ups":67,Logins:851,"Sign outs":924,"Support calls":10},{date:"2023-03-26T00:00:00","Rows written":2926,"Rows read":18999,Queries:498,"Payments completed":118,"Sign ups":73,Logins:872,"Sign outs":1009,"Support calls":13},{date:"2023-03-27T00:00:00","Rows written":2945,"Rows read":19312,Queries:499,"Payments completed":123,"Sign ups":62,Logins:863,"Sign outs":958,"Support calls":15},{date:"2023-03-28T00:00:00","Rows written":2937,"Rows read":19258,Queries:502,"Payments completed":118,"Sign ups":80,Logins:901,"Sign outs":927,"Support calls":12},{date:"2023-03-29T00:00:00","Rows written":2908,"Rows read":19567,Queries:501,"Payments completed":120,"Sign ups":74,Logins:845,"Sign outs":967,"Support calls":11},{date:"2023-03-30T00:00:00","Rows written":2876,"Rows read":19888,Queries:497,"Payments completed":120,"Sign ups":61,Logins:869,"Sign outs":1080,"Support calls":6},{date:"2023-03-31T00:00:00","Rows written":2855,"Rows read":20292,Queries:438,"Payments completed":70,"Sign ups":53,Logins:865,"Sign outs":1057,"Support calls":5},{date:"2023-04-01T00:00:00","Rows written":2845,"Rows read":20739,Queries:403,"Payments completed":61,"Sign ups":60,Logins:860,"Sign outs":987,"Support calls":7},{date:"2023-04-02T00:00:00","Rows written":2838,"Rows read":20633,Queries:493,"Payments completed":81,"Sign ups":66,Logins:867,"Sign outs":905,"Support calls":12},{date:"2023-04-03T00:00:00","Rows written":2832,"Rows read":21003,Queries:496,"Payments completed":82,"Sign ups":60,Logins:867,"Sign outs":934,"Support calls":13},{date:"2023-04-04T00:00:00","Rows written":2825,"Rows read":20648,Queries:500,"Payments completed":81,"Sign ups":66,Logins:963,"Sign outs":1002,"Support calls":14},{date:"2023-04-05T00:00:00","Rows written":2819,"Rows read":20691,Queries:504,"Payments completed":105,"Sign ups":64,Logins:1027,"Sign outs":1046,"Support calls":15},{date:"2023-04-06T00:00:00","Rows written":2823,"Rows read":20393,Queries:510,"Payments completed":121,"Sign ups":64,Logins:1171,"Sign outs":1101,"Support calls":10},{date:"2023-04-07T00:00:00","Rows written":2805,"Rows read":20582,Queries:412,"Payments completed":95,"Sign ups":54,Logins:1199,"Sign outs":1193,"Support calls":9},{date:"2023-04-08T00:00:00","Rows written":2805,"Rows read":20673,Queries:400,"Payments completed":75,"Sign ups":52,Logins:1208,"Sign outs":1168,"Support calls":5},{date:"2023-04-09T00:00:00","Rows written":2794,"Rows read":20134,Queries:494,"Payments completed":107,"Sign ups":64,Logins:1452,"Sign outs":1189,"Support calls":6},{date:"2023-04-10T00:00:00","Rows written":2802,"Rows read":19757,Queries:489,"Payments completed":121,"Sign ups":63,Logins:1464,"Sign outs":1195,"Support calls":6},{date:"2023-04-11T00:00:00","Rows written":2803,"Rows read":20053,Queries:486,"Payments completed":100,"Sign ups":60,Logins:1512,"Sign outs":1199,"Support calls":5},{date:"2023-04-12T00:00:00","Rows written":2812,"Rows read":19604,Queries:483,"Payments completed":120,"Sign ups":61,Logins:1360,"Sign outs":1193,"Support calls":3},{date:"2023-04-13T00:00:00","Rows written":2822,"Rows read":19715,Queries:478,"Payments completed":122,"Sign ups":69,Logins:1038,"Sign outs":1184,"Support calls":3},{date:"2023-04-14T00:00:00","Rows written":2819,"Rows read":20002,Queries:367,"Payments completed":82,"Sign ups":61,Logins:844,"Sign outs":1163,"Support calls":3},{date:"2023-04-15T00:00:00","Rows written":2805,"Rows read":20661,Queries:430,"Payments completed":70,"Sign ups":62,Logins:855,"Sign outs":1044,"Support calls":2},{date:"2023-04-16T00:00:00","Rows written":2826,"Rows read":21525,Queries:487,"Payments completed":81,"Sign ups":63,Logins:973,"Sign outs":1e3,"Support calls":2},{date:"2023-04-17T00:00:00","Rows written":2812,"Rows read":21431,Queries:491,"Payments completed":90,"Sign ups":61,Logins:1065,"Sign outs":908,"Support calls":2},{date:"2023-04-18T00:00:00","Rows written":2825,"Rows read":21171,Queries:493,"Payments completed":122,"Sign ups":64,Logins:1071,"Sign outs":922,"Support calls":2},{date:"2023-04-19T00:00:00","Rows written":2841,"Rows read":20561,Queries:495,"Payments completed":123,"Sign ups":73,Logins:1065,"Sign outs":907,"Support calls":3},{date:"2023-04-20T00:00:00","Rows written":2875,"Rows read":20802,Queries:494,"Payments completed":125,"Sign ups":63,Logins:1191,"Sign outs":906,"Support calls":3},{date:"2023-04-21T00:00:00","Rows written":2873,"Rows read":20844,Queries:408,"Payments completed":92,"Sign ups":51,Logins:1415,"Sign outs":925,"Support calls":2},{date:"2023-04-22T00:00:00","Rows written":2850,"Rows read":20898,Queries:372,"Payments completed":82,"Sign ups":57,Logins:1744,"Sign outs":905,"Support calls":2},{date:"2023-04-23T00:00:00","Rows written":2833,"Rows read":20662,Queries:500,"Payments completed":91,"Sign ups":62,Logins:2017,"Sign outs":908,"Support calls":3},{date:"2023-04-24T00:00:00","Rows written":2820,"Rows read":20361,Queries:494,"Payments completed":124,"Sign ups":79,Logins:1911,"Sign outs":913,"Support calls":4},{date:"2023-04-25T00:00:00","Rows written":2820,"Rows read":19629,Queries:489,"Payments completed":113,"Sign ups":70,Logins:2014,"Sign outs":939,"Support calls":4},{date:"2023-04-26T00:00:00","Rows written":2837,"Rows read":19197,Queries:486,"Payments completed":115,"Sign ups":63,Logins:2004,"Sign outs":963,"Support calls":3},{date:"2023-04-27T00:00:00","Rows written":2852,"Rows read":19201,Queries:481,"Payments completed":113,"Sign ups":63,Logins:2029,"Sign outs":903,"Support calls":3},{date:"2023-04-28T00:00:00","Rows written":2832,"Rows read":19708,Queries:405,"Payments completed":88,"Sign ups":50,Logins:2012,"Sign outs":916,"Support calls":3},{date:"2023-04-29T00:00:00","Rows written":2808,"Rows read":20513,Queries:393,"Payments completed":94,"Sign ups":48,Logins:1745,"Sign outs":983,"Support calls":2},{date:"2023-04-30T00:00:00","Rows written":2815,"Rows read":20545,Queries:495,"Payments completed":82,"Sign ups":64,Logins:1784,"Sign outs":1063,"Support calls":2},{date:"2023-05-01T00:00:00","Rows written":2804,"Rows read":20774,Queries:491,"Payments completed":84,"Sign ups":62,Logins:1883,"Sign outs":1199,"Support calls":2},{date:"2023-05-02T00:00:00","Rows written":2786,"Rows read":21453,Queries:489,"Payments completed":81,"Sign ups":62,Logins:1806,"Sign outs":1188,"Support calls":2},{date:"2023-05-03T00:00:00","Rows written":2786,"Rows read":21543,Queries:484,"Payments completed":106,"Sign ups":61,Logins:1967,"Sign outs":1175,"Support calls":3},{date:"2023-05-04T00:00:00","Rows written":2775,"Rows read":21089,Queries:484,"Payments completed":122,"Sign ups":62,Logins:1956,"Sign outs":1186,"Support calls":4},{date:"2023-05-05T00:00:00","Rows written":2784,"Rows read":20388,Queries:435,"Payments completed":90,"Sign ups":53,Logins:2032,"Sign outs":1179,"Support calls":3},{date:"2023-05-06T00:00:00","Rows written":2779,"Rows read":19678,Queries:386,"Payments completed":99,"Sign ups":47,Logins:1984,"Sign outs":1189,"Support calls":2},{date:"2023-05-07T00:00:00","Rows written":2763,"Rows read":19046,Queries:496,"Payments completed":115,"Sign ups":68,Logins:2021,"Sign outs":1195,"Support calls":2},{date:"2023-05-08T00:00:00","Rows written":2738,"Rows read":19152,Queries:500,"Payments completed":121,"Sign ups":80,Logins:1641,"Sign outs":1197,"Support calls":2},{date:"2023-05-09T00:00:00","Rows written":2738,"Rows read":18656,Queries:506,"Payments completed":81,"Sign ups":75,Logins:1286,"Sign outs":1184,"Support calls":2},{date:"2023-05-10T00:00:00","Rows written":2715,"Rows read":18455,Queries:507,"Payments completed":87,"Sign ups":79,Logins:987,"Sign outs":1195,"Support calls":2},{date:"2023-05-11T00:00:00","Rows written":2714,"Rows read":18037,Queries:505,"Payments completed":87,"Sign ups":79,Logins:953,"Sign outs":1198,"Support calls":2},{date:"2023-05-12T00:00:00","Rows written":2714,"Rows read":18119,Queries:422,"Payments completed":105,"Sign ups":55,Logins:1059,"Sign outs":1180,"Support calls":2},{date:"2023-05-13T00:00:00","Rows written":2717,"Rows read":18102,Queries:436,"Payments completed":94,"Sign ups":52,Logins:1153,"Sign outs":1191,"Support calls":2},{date:"2023-05-14T00:00:00","Rows written":2735,"Rows read":18080,Queries:487,"Payments completed":122,"Sign ups":61,Logins:1033,"Sign outs":1168,"Support calls":2},{date:"2023-05-15T00:00:00","Rows written":2756,"Rows read":18124,Queries:484,"Payments completed":99,"Sign ups":65,Logins:846,"Sign outs":1179,"Support calls":2},{date:"2023-05-16T00:00:00","Rows written":2757,"Rows read":18008,Queries:478,"Payments completed":125,"Sign ups":65,Logins:891,"Sign outs":1132,"Support calls":2},{date:"2023-05-17T00:00:00","Rows written":2752,"Rows read":18076,Queries:478,"Payments completed":113,"Sign ups":63,Logins:923,"Sign outs":1003,"Support calls":2},{date:"2023-05-18T00:00:00","Rows written":2772,"Rows read":18027,Queries:479,"Payments completed":84,"Sign ups":61,Logins:1115,"Sign outs":974,"Support calls":2},{date:"2023-05-19T00:00:00","Rows written":2796,"Rows read":18099,Queries:387,"Payments completed":78,"Sign ups":52,Logins:1374,"Sign outs":1e3,"Support calls":2},{date:"2023-05-20T00:00:00","Rows written":2793,"Rows read":18002,Queries:431,"Payments completed":84,"Sign ups":54,Logins:1622,"Sign outs":1067,"Support calls":2},{date:"2023-05-21T00:00:00","Rows written":2782,"Rows read":18012,Queries:488,"Payments completed":81,"Sign ups":74,Logins:1612,"Sign outs":1182,"Support calls":3},{date:"2023-05-22T00:00:00","Rows written":2794,"Rows read":18004,Queries:485,"Payments completed":87,"Sign ups":74,Logins:1668,"Sign outs":1173,"Support calls":3},{date:"2023-05-23T00:00:00","Rows written":2824,"Rows read":18446,Queries:481,"Payments completed":103,"Sign ups":67,Logins:1579,"Sign outs":1175,"Support calls":4},{date:"2023-05-24T00:00:00","Rows written":2862,"Rows read":18357,Queries:479,"Payments completed":96,"Sign ups":72,Logins:1294,"Sign outs":1188,"Support calls":6},{date:"2023-05-25T00:00:00","Rows written":2910,"Rows read":18021,Queries:478,"Payments completed":83,"Sign ups":79,Logins:1214,"Sign outs":1172,"Support calls":6},{date:"2023-05-26T00:00:00","Rows written":2949,"Rows read":18094,Queries:379,"Payments completed":66,"Sign ups":62,Logins:1054,"Sign outs":1199,"Support calls":4},{date:"2023-05-27T00:00:00","Rows written":2983,"Rows read":18053,Queries:390,"Payments completed":68,"Sign ups":63,Logins:1034,"Sign outs":1178,"Support calls":2},{date:"2023-05-28T00:00:00","Rows written":2978,"Rows read":18022,Queries:496,"Payments completed":92,"Sign ups":61,Logins:845,"Sign outs":1180,"Support calls":2},{date:"2023-05-29T00:00:00","Rows written":2963,"Rows read":18416,Queries:494,"Payments completed":93,"Sign ups":80,Logins:881,"Sign outs":1179,"Support calls":2},{date:"2023-05-30T00:00:00","Rows written":2949,"Rows read":18270,Queries:496,"Payments completed":81,"Sign ups":71,Logins:925,"Sign outs":1194,"Support calls":2},{date:"2023-05-31T00:00:00","Rows written":2965,"Rows read":18034,Queries:500,"Payments completed":80,"Sign ups":70,Logins:879,"Sign outs":1195,"Support calls":2},{date:"2023-06-01T00:00:00","Rows written":2970,"Rows read":18061,Queries:506,"Payments completed":95,"Sign ups":77,Logins:924,"Sign outs":1120,"Support calls":2},{date:"2023-06-02T00:00:00","Rows written":2974,"Rows read":18180,Queries:425,"Payments completed":74,"Sign ups":54,Logins:853,"Sign outs":1146,"Support calls":2},{date:"2023-06-03T00:00:00","Rows written":3004,"Rows read":18022,Queries:384,"Payments completed":74,"Sign ups":48,Logins:877,"Sign outs":1153,"Support calls":2},{date:"2023-06-04T00:00:00","Rows written":3033,"Rows read":18091,Queries:497,"Payments completed":102,"Sign ups":66,Logins:896,"Sign outs":1199,"Support calls":2},{date:"2023-06-05T00:00:00","Rows written":3033,"Rows read":18398,Queries:500,"Payments completed":101,"Sign ups":76,Logins:1053,"Sign outs":1118,"Support calls":2},{date:"2023-06-06T00:00:00","Rows written":3028,"Rows read":18439,Queries:505,"Payments completed":83,"Sign ups":74,Logins:1009,"Sign outs":1029,"Support calls":3},{date:"2023-06-07T00:00:00","Rows written":3008,"Rows read":18750,Queries:505,"Payments completed":82,"Sign ups":72,Logins:884,"Sign outs":997,"Support calls":4},{date:"2023-06-08T00:00:00","Rows written":3e3,"Rows read":19398,Queries:509,"Payments completed":80,"Sign ups":78,Logins:1003,"Sign outs":1069,"Support calls":5},{date:"2023-06-09T00:00:00","Rows written":2975,"Rows read":19233,Queries:442,"Payments completed":68,"Sign ups":54,Logins:1182,"Sign outs":1169,"Support calls":4},{date:"2023-06-10T00:00:00","Rows written":2958,"Rows read":19593,Queries:430,"Payments completed":65,"Sign ups":63,Logins:1129,"Sign outs":1161,"Support calls":4},{date:"2023-06-11T00:00:00","Rows written":2966,"Rows read":20333,Queries:488,"Payments completed":84,"Sign ups":61,Logins:1009,"Sign outs":1199,"Support calls":4},{date:"2023-06-12T00:00:00","Rows written":2988,"Rows read":20156,Queries:491,"Payments completed":98,"Sign ups":64,Logins:924,"Sign outs":1194,"Support calls":3},{date:"2023-06-13T00:00:00","Rows written":2973,"Rows read":19662,Queries:488,"Payments completed":106,"Sign ups":67,Logins:870,"Sign outs":1176,"Support calls":4},{date:"2023-06-14T00:00:00","Rows written":2951,"Rows read":19450,Queries:483,"Payments completed":122,"Sign ups":60,Logins:877,"Sign outs":1167,"Support calls":3},{date:"2023-06-15T00:00:00","Rows written":2917,"Rows read":19681,Queries:478,"Payments completed":97,"Sign ups":66,Logins:853,"Sign outs":1185,"Support calls":4},{date:"2023-06-16T00:00:00","Rows written":2877,"Rows read":19636,Queries:365,"Payments completed":71,"Sign ups":55,Logins:965,"Sign outs":1184,"Support calls":4},{date:"2023-06-17T00:00:00","Rows written":2850,"Rows read":19478,Queries:438,"Payments completed":65,"Sign ups":55,Logins:1101,"Sign outs":1197,"Support calls":2},{date:"2023-06-18T00:00:00","Rows written":2858,"Rows read":19258,Queries:487,"Payments completed":81,"Sign ups":64,Logins:1335,"Sign outs":1106,"Support calls":2},{date:"2023-06-19T00:00:00","Rows written":2880,"Rows read":19348,Queries:487,"Payments completed":118,"Sign ups":73,Logins:1406,"Sign outs":1129,"Support calls":2},{date:"2023-06-20T00:00:00","Rows written":2863,"Rows read":19951,Queries:488,"Payments completed":116,"Sign ups":76,Logins:1378,"Sign outs":1082,"Support calls":2},{date:"2023-06-21T00:00:00","Rows written":2844,"Rows read":20053,Queries:490,"Payments completed":82,"Sign ups":77,Logins:1294,"Sign outs":1073,"Support calls":2},{date:"2023-06-22T00:00:00","Rows written":2830,"Rows read":20493,Queries:489,"Payments completed":83,"Sign ups":61,Logins:1318,"Sign outs":1042,"Support calls":2},{date:"2023-06-23T00:00:00","Rows written":2833,"Rows read":20724,Queries:432,"Payments completed":66,"Sign ups":57,Logins:1076,"Sign outs":1115,"Support calls":2},{date:"2023-06-24T00:00:00","Rows written":2809,"Rows read":20767,Queries:431,"Payments completed":63,"Sign ups":59,Logins:852,"Sign outs":1174,"Support calls":2},{date:"2023-06-25T00:00:00","Rows written":2781,"Rows read":20818,Queries:487,"Payments completed":81,"Sign ups":64,Logins:881,"Sign outs":1173,"Support calls":2},{date:"2023-06-26T00:00:00","Rows written":2748,"Rows read":20673,Queries:490,"Payments completed":95,"Sign ups":78,Logins:914,"Sign outs":1105,"Support calls":2},{date:"2023-06-27T00:00:00","Rows written":2750,"Rows read":19990,Queries:492,"Payments completed":81,"Sign ups":74,Logins:855,"Sign outs":1139,"Support calls":2},{date:"2023-06-28T00:00:00","Rows written":2761,"Rows read":19874,Queries:488,"Payments completed":83,"Sign ups":69,Logins:876,"Sign outs":1073,"Support calls":2},{date:"2023-06-29T00:00:00","Rows written":2787,"Rows read":19812,Queries:486,"Payments completed":83,"Sign ups":76,Logins:900,"Sign outs":1090,"Support calls":3},{date:"2023-06-30T00:00:00","Rows written":2819,"Rows read":19619,Queries:376,"Payments completed":88,"Sign ups":66,Logins:852,"Sign outs":1118,"Support calls":3},{date:"2023-07-01T00:00:00","Rows written":2825,"Rows read":19145,Queries:374,"Payments completed":103,"Sign ups":52,Logins:856,"Sign outs":1153,"Support calls":4},{date:"2023-07-02T00:00:00","Rows written":2825,"Rows read":18490,Queries:499,"Payments completed":120,"Sign ups":64,Logins:878,"Sign outs":1087,"Support calls":3},{date:"2023-07-03T00:00:00","Rows written":2835,"Rows read":18059,Queries:503,"Payments completed":122,"Sign ups":63,Logins:936,"Sign outs":1138,"Support calls":2},{date:"2023-07-04T00:00:00","Rows written":2827,"Rows read":18157,Queries:507,"Payments completed":81,"Sign ups":78,Logins:1006,"Sign outs":1100,"Support calls":2},{date:"2023-07-05T00:00:00","Rows written":2842,"Rows read":18079,Queries:513,"Payments completed":81,"Sign ups":80,Logins:1049,"Sign outs":1090,"Support calls":2},{date:"2023-07-06T00:00:00","Rows written":2834,"Rows read":18317,Queries:515,"Payments completed":86,"Sign ups":62,Logins:1092,"Sign outs":1161,"Support calls":2},{date:"2023-07-07T00:00:00","Rows written":2839,"Rows read":18617,Queries:415,"Payments completed":72,"Sign ups":56,Logins:1210,"Sign outs":1179,"Support calls":2},{date:"2023-07-08T00:00:00","Rows written":2853,"Rows read":19089,Queries:430,"Payments completed":69,"Sign ups":54,Logins:1292,"Sign outs":1155,"Support calls":3},{date:"2023-07-09T00:00:00","Rows written":2850,"Rows read":19081,Queries:488,"Payments completed":89,"Sign ups":63,Logins:1354,"Sign outs":1197,"Support calls":5},{date:"2023-07-10T00:00:00","Rows written":2848,"Rows read":19119,Queries:482,"Payments completed":91,"Sign ups":78,Logins:1513,"Sign outs":1188,"Support calls":7},{date:"2023-07-11T00:00:00","Rows written":2835,"Rows read":19192,Queries:484,"Payments completed":87,"Sign ups":75,Logins:1546,"Sign outs":1195,"Support calls":8},{date:"2023-07-12T00:00:00","Rows written":2833,"Rows read":19322,Queries:484,"Payments completed":85,"Sign ups":78,Logins:1819,"Sign outs":1188,"Support calls":7},{date:"2023-07-13T00:00:00","Rows written":2806,"Rows read":19743,Queries:484,"Payments completed":111,"Sign ups":74,Logins:1954,"Sign outs":1185,"Support calls":6},{date:"2023-07-14T00:00:00","Rows written":2817,"Rows read":19688,Queries:426,"Payments completed":88,"Sign ups":59,Logins:1701,"Sign outs":1194,"Support calls":3},{date:"2023-07-15T00:00:00","Rows written":2795,"Rows read":19641,Queries:367,"Payments completed":101,"Sign ups":55,Logins:1309,"Sign outs":1198,"Support calls":2},{date:"2023-07-16T00:00:00","Rows written":2793,"Rows read":19952,Queries:500,"Payments completed":82,"Sign ups":63,Logins:1329,"Sign outs":1183,"Support calls":2},{date:"2023-07-17T00:00:00","Rows written":2809,"Rows read":20002,Queries:501,"Payments completed":82,"Sign ups":63,Logins:1447,"Sign outs":1118,"Support calls":2},{date:"2023-07-18T00:00:00","Rows written":2798,"Rows read":20051,Queries:497,"Payments completed":88,"Sign ups":74,Logins:1759,"Sign outs":1110,"Support calls":2},{date:"2023-07-19T00:00:00","Rows written":2767,"Rows read":19686,Queries:499,"Payments completed":90,"Sign ups":77,Logins:1931,"Sign outs":1189,"Support calls":2},{date:"2023-07-20T00:00:00","Rows written":2733,"Rows read":19300,Queries:498,"Payments completed":84,"Sign ups":72,Logins:2044,"Sign outs":1196,"Support calls":2},{date:"2023-07-21T00:00:00","Rows written":2704,"Rows read":18593,Queries:440,"Payments completed":66,"Sign ups":67,Logins:2014,"Sign outs":1181,"Support calls":2},{date:"2023-07-22T00:00:00","Rows written":2711,"Rows read":18352,Queries:408,"Payments completed":71,"Sign ups":72,Logins:1729,"Sign outs":1148,"Support calls":2},{date:"2023-07-23T00:00:00","Rows written":2719,"Rows read":18451,Queries:491,"Payments completed":85,"Sign ups":60,Logins:1423,"Sign outs":1027,"Support calls":3},{date:"2023-07-24T00:00:00","Rows written":2708,"Rows read":18006,Queries:490,"Payments completed":109,"Sign ups":66,Logins:1490,"Sign outs":1050,"Support calls":4},{date:"2023-07-25T00:00:00","Rows written":2709,"Rows read":18090,Queries:486,"Payments completed":99,"Sign ups":62,Logins:1458,"Sign outs":1022,"Support calls":6},{date:"2023-07-26T00:00:00","Rows written":2693,"Rows read":18102,Queries:480,"Payments completed":87,"Sign ups":61,Logins:1156,"Sign outs":953,"Support calls":4},{date:"2023-07-27T00:00:00","Rows written":2680,"Rows read":18083,Queries:480,"Payments completed":96,"Sign ups":80,Logins:1031,"Sign outs":907,"Support calls":4},{date:"2023-07-28T00:00:00","Rows written":2663,"Rows read":18029,Queries:370,"Payments completed":93,"Sign ups":60,Logins:966,"Sign outs":903,"Support calls":5},{date:"2023-07-29T00:00:00","Rows written":2630,"Rows read":18005,Queries:383,"Payments completed":99,"Sign ups":57,Logins:896,"Sign outs":918,"Support calls":7},{date:"2023-07-30T00:00:00","Rows written":2606,"Rows read":18020,Queries:496,"Payments completed":124,"Sign ups":66,Logins:1026,"Sign outs":922,"Support calls":9},{date:"2023-07-31T00:00:00","Rows written":2575,"Rows read":18242,Queries:501,"Payments completed":124,"Sign ups":60,Logins:961,"Sign outs":915,"Support calls":10},{date:"2023-08-01T00:00:00","Rows written":2573,"Rows read":18143,Queries:501,"Payments completed":89,"Sign ups":60,Logins:850,"Sign outs":913,"Support calls":15},{date:"2023-08-02T00:00:00","Rows written":2592,"Rows read":18373,Queries:505,"Payments completed":114,"Sign ups":61,Logins:868,"Sign outs":901,"Support calls":18},{date:"2023-08-03T00:00:00","Rows written":2592,"Rows read":19002,Queries:506,"Payments completed":123,"Sign ups":77,Logins:939,"Sign outs":965,"Support calls":17},{date:"2023-08-04T00:00:00","Rows written":2593,"Rows read":19427,Queries:393,"Payments completed":79,"Sign ups":48,Logins:852,"Sign outs":970,"Support calls":16},{date:"2023-08-05T00:00:00","Rows written":2584,"Rows read":19210,Queries:416,"Payments completed":78,"Sign ups":52,Logins:867,"Sign outs":1040,"Support calls":8},{date:"2023-08-06T00:00:00","Rows written":2575,"Rows read":18862,Queries:491,"Payments completed":100,"Sign ups":65,Logins:845,"Sign outs":993,"Support calls":5},{date:"2023-08-07T00:00:00","Rows written":2583,"Rows read":18581,Queries:485,"Payments completed":122,"Sign ups":78,Logins:899,"Sign outs":905,"Support calls":5},{date:"2023-08-08T00:00:00","Rows written":2589,"Rows read":18022,Queries:481,"Payments completed":117,"Sign ups":72,Logins:941,"Sign outs":926,"Support calls":6},{date:"2023-08-09T00:00:00","Rows written":2582,"Rows read":18144,Queries:480,"Payments completed":86,"Sign ups":73,Logins:1132,"Sign outs":903,"Support calls":5},{date:"2023-08-10T00:00:00","Rows written":2558,"Rows read":18725,Queries:478,"Payments completed":83,"Sign ups":80,Logins:1101,"Sign outs":902,"Support calls":4},{date:"2023-08-11T00:00:00","Rows written":2522,"Rows read":18465,Queries:370,"Payments completed":66,"Sign ups":68,Logins:993,"Sign outs":967,"Support calls":4},{date:"2023-08-12T00:00:00","Rows written":2504,"Rows read":18008,Queries:444,"Payments completed":67,"Sign ups":70,Logins:858,"Sign outs":1055,"Support calls":3},{date:"2023-08-13T00:00:00","Rows written":2507,"Rows read":18027,Queries:486,"Payments completed":88,"Sign ups":78,Logins:885,"Sign outs":1120,"Support calls":3},{date:"2023-08-14T00:00:00","Rows written":2506,"Rows read":18071,Queries:482,"Payments completed":107,"Sign ups":77,Logins:912,"Sign outs":1193,"Support calls":4},{date:"2023-08-15T00:00:00","Rows written":2503,"Rows read":18024,Queries:482,"Payments completed":80,"Sign ups":76,Logins:845,"Sign outs":1193,"Support calls":5},{date:"2023-08-16T00:00:00","Rows written":2502,"Rows read":18038,Queries:480,"Payments completed":89,"Sign ups":79,Logins:846,"Sign outs":1161,"Support calls":4},{date:"2023-08-17T00:00:00","Rows written":2503,"Rows read":18118,Queries:478,"Payments completed":83,"Sign ups":72,Logins:867,"Sign outs":1189,"Support calls":3},{date:"2023-08-18T00:00:00","Rows written":2509,"Rows read":18050,Queries:405,"Payments completed":82,"Sign ups":58,Logins:984,"Sign outs":1177,"Support calls":3},{date:"2023-08-19T00:00:00","Rows written":2500,"Rows read":18011,Queries:383,"Payments completed":97,"Sign ups":59,Logins:1006,"Sign outs":1176,"Support calls":3},{date:"2023-08-20T00:00:00","Rows written":2505,"Rows read":18215,Queries:497,"Payments completed":96,"Sign ups":78,Logins:975,"Sign outs":1200,"Support calls":4},{date:"2023-08-21T00:00:00","Rows written":2512,"Rows read":18186,Queries:499,"Payments completed":80,"Sign ups":68,Logins:976,"Sign outs":1148,"Support calls":4},{date:"2023-08-22T00:00:00","Rows written":2501,"Rows read":18401,Queries:501,"Payments completed":80,"Sign ups":74,Logins:1084,"Sign outs":1196,"Support calls":5},{date:"2023-08-23T00:00:00","Rows written":2501,"Rows read":18519,Queries:499,"Payments completed":96,"Sign ups":76,Logins:1130,"Sign outs":1118,"Support calls":6},{date:"2023-08-24T00:00:00","Rows written":2508,"Rows read":18913,Queries:501,"Payments completed":104,"Sign ups":75,Logins:944,"Sign outs":1042,"Support calls":9},{date:"2023-08-25T00:00:00","Rows written":2502,"Rows read":19306,Queries:426,"Payments completed":84,"Sign ups":66,Logins:872,"Sign outs":960,"Support calls":9},{date:"2023-08-26T00:00:00","Rows written":2506,"Rows read":19592,Queries:436,"Payments completed":85,"Sign ups":54,Logins:858,"Sign outs":994,"Support calls":9},{date:"2023-08-27T00:00:00","Rows written":2501,"Rows read":19482,Queries:486,"Payments completed":111,"Sign ups":61,Logins:861,"Sign outs":981,"Support calls":11},{date:"2023-08-28T00:00:00","Rows written":2505,"Rows read":19193,Queries:483,"Payments completed":82,"Sign ups":77,Logins:922,"Sign outs":979,"Support calls":12},{date:"2023-08-29T00:00:00","Rows written":2505,"Rows read":19224,Queries:482,"Payments completed":112,"Sign ups":64,Logins:935,"Sign outs":1026,"Support calls":9},{date:"2023-08-30T00:00:00","Rows written":2515,"Rows read":18795,Queries:482,"Payments completed":123,"Sign ups":62,Logins:845,"Sign outs":1061,"Support calls":10},{date:"2023-08-31T00:00:00","Rows written":2515,"Rows read":18658,Queries:479,"Payments completed":112,"Sign ups":64,Logins:932,"Sign outs":1026,"Support calls":15},{date:"2023-09-01T00:00:00","Rows written":2500,"Rows read":18864,Queries:408,"Payments completed":78,"Sign ups":60,Logins:958,"Sign outs":1054,"Support calls":16},{date:"2023-09-02T00:00:00","Rows written":2506,"Rows read":19030,Queries:416,"Payments completed":71,"Sign ups":49,Logins:943,"Sign outs":1021,"Support calls":12},{date:"2023-09-03T00:00:00","Rows written":2507,"Rows read":18759,Queries:491,"Payments completed":87,"Sign ups":61,Logins:863,"Sign outs":971,"Support calls":10},{date:"2023-09-04T00:00:00","Rows written":2508,"Rows read":19168,Queries:492,"Payments completed":88,"Sign ups":79,Logins:846,"Sign outs":969,"Support calls":8},{date:"2023-09-05T00:00:00","Rows written":2514,"Rows read":19384,Queries:496,"Payments completed":84,"Sign ups":71,Logins:880,"Sign outs":1025,"Support calls":6},{date:"2023-09-06T00:00:00","Rows written":2541,"Rows read":18965,Queries:496,"Payments completed":81,"Sign ups":62,Logins:852,"Sign outs":999,"Support calls":6},{date:"2023-09-07T00:00:00","Rows written":2531,"Rows read":18810,Queries:498,"Payments completed":80,"Sign ups":67,Logins:856,"Sign outs":946,"Support calls":8},{date:"2023-09-08T00:00:00","Rows written":2505,"Rows read":18734,Queries:378,"Payments completed":67,"Sign ups":50,Logins:931,"Sign outs":962,"Support calls":6},{date:"2023-09-09T00:00:00","Rows written":2502,"Rows read":18705,Queries:445,"Payments completed":83,"Sign ups":52,Logins:989,"Sign outs":908,"Support calls":3},{date:"2023-09-10T00:00:00","Rows written":2513,"Rows read":19192,Queries:484,"Payments completed":83,"Sign ups":61,Logins:1148,"Sign outs":901,"Support calls":3},{date:"2023-09-11T00:00:00","Rows written":2540,"Rows read":19588,Queries:484,"Payments completed":92,"Sign ups":79,Logins:1198,"Sign outs":918,"Support calls":3},{date:"2023-09-12T00:00:00","Rows written":2570,"Rows read":20135,Queries:487,"Payments completed":82,"Sign ups":80,Logins:1104,"Sign outs":907,"Support calls":4},{date:"2023-09-13T00:00:00","Rows written":2571,"Rows read":20847,Queries:490,"Payments completed":88,"Sign ups":77,Logins:1082,"Sign outs":916,"Support calls":4},{date:"2023-09-14T00:00:00","Rows written":2549,"Rows read":21778,Queries:494,"Payments completed":85,"Sign ups":79,Logins:1119,"Sign outs":901,"Support calls":4},{date:"2023-09-15T00:00:00","Rows written":2535,"Rows read":21650,Queries:412,"Payments completed":64,"Sign ups":54,Logins:1074,"Sign outs":911,"Support calls":3},{date:"2023-09-16T00:00:00","Rows written":2544,"Rows read":20967,Queries:431,"Payments completed":73,"Sign ups":56,Logins:1132,"Sign outs":913,"Support calls":2},{date:"2023-09-17T00:00:00","Rows written":2547,"Rows read":20966,Queries:489,"Payments completed":115,"Sign ups":67,Logins:1260,"Sign outs":916,"Support calls":2},{date:"2023-09-18T00:00:00","Rows written":2539,"Rows read":21347,Queries:487,"Payments completed":115,"Sign ups":76,Logins:1292,"Sign outs":914,"Support calls":2},{date:"2023-09-19T00:00:00","Rows written":2524,"Rows read":22148,Queries:489,"Payments completed":115,"Sign ups":66,Logins:1128,"Sign outs":903,"Support calls":3},{date:"2023-09-20T00:00:00","Rows written":2519,"Rows read":21947,Queries:488,"Payments completed":118,"Sign ups":68,Logins:1196,"Sign outs":970,"Support calls":4},{date:"2023-09-21T00:00:00","Rows written":2529,"Rows read":22192,Queries:487,"Payments completed":85,"Sign ups":65,Logins:1268,"Sign outs":953,"Support calls":4},{date:"2023-09-22T00:00:00","Rows written":2510,"Rows read":22218,Queries:397,"Payments completed":73,"Sign ups":54,Logins:1184,"Sign outs":927,"Support calls":3},{date:"2023-09-23T00:00:00","Rows written":2522,"Rows read":22302,Queries:374,"Payments completed":70,"Sign ups":55,Logins:931,"Sign outs":998,"Support calls":2},{date:"2023-09-24T00:00:00","Rows written":2547,"Rows read":22352,Queries:498,"Payments completed":103,"Sign ups":80,Logins:950,"Sign outs":1075,"Support calls":2},{date:"2023-09-25T00:00:00","Rows written":2538,"Rows read":22820,Queries:500,"Payments completed":124,"Sign ups":69,Logins:1131,"Sign outs":1099,"Support calls":2},{date:"2023-09-26T00:00:00","Rows written":2514,"Rows read":22707,Queries:499,"Payments completed":112,"Sign ups":67,Logins:1013,"Sign outs":1200,"Support calls":2},{date:"2023-09-27T00:00:00","Rows written":2503,"Rows read":22818,Queries:495,"Payments completed":118,"Sign ups":74,Logins:1053,"Sign outs":1174,"Support calls":2},{date:"2023-09-28T00:00:00","Rows written":2505,"Rows read":22403,Queries:497,"Payments completed":118,"Sign ups":78,Logins:1065,"Sign outs":1181,"Support calls":2},{date:"2023-09-29T00:00:00","Rows written":2501,"Rows read":22182,Queries:435,"Payments completed":71,"Sign ups":61,Logins:916,"Sign outs":1179,"Support calls":2},{date:"2023-09-30T00:00:00","Rows written":2504,"Rows read":22135,Queries:418,"Payments completed":76,"Sign ups":48,Logins:845,"Sign outs":1198,"Support calls":3},{date:"2023-10-01T00:00:00","Rows written":2504,"Rows read":21827,Queries:490,"Payments completed":90,"Sign ups":64,Logins:891,"Sign outs":1189,"Support calls":3},{date:"2023-10-02T00:00:00","Rows written":2511,"Rows read":21733,Queries:489,"Payments completed":86,"Sign ups":62,Logins:889,"Sign outs":1186,"Support calls":4},{date:"2023-10-03T00:00:00","Rows written":2533,"Rows read":21655,Queries:487,"Payments completed":81,"Sign ups":61,Logins:1002,"Sign outs":1173,"Support calls":4},{date:"2023-10-04T00:00:00","Rows written":2551,"Rows read":22072,Queries:490,"Payments completed":103,"Sign ups":64,Logins:887,"Sign outs":1151,"Support calls":6},{date:"2023-10-05T00:00:00","Rows written":2568,"Rows read":22724,Queries:489,"Payments completed":83,"Sign ups":63,Logins:863,"Sign outs":1063,"Support calls":9},{date:"2023-10-06T00:00:00","Rows written":2588,"Rows read":23121,Queries:378,"Payments completed":92,"Sign ups":49,Logins:849,"Sign outs":1117,"Support calls":11},{date:"2023-10-07T00:00:00","Rows written":2609,"Rows read":23546,Queries:447,"Payments completed":68,"Sign ups":54,Logins:924,"Sign outs":1196,"Support calls":13},{date:"2023-10-08T00:00:00","Rows written":2619,"Rows read":23939,Queries:485,"Payments completed":81,"Sign ups":61,Logins:1026,"Sign outs":1180,"Support calls":14},{date:"2023-10-09T00:00:00","Rows written":2613,"Rows read":24842,Queries:487,"Payments completed":121,"Sign ups":64,Logins:1006,"Sign outs":1181,"Support calls":12},{date:"2023-10-10T00:00:00","Rows written":2626,"Rows read":25404,Queries:490,"Payments completed":98,"Sign ups":66,Logins:1027,"Sign outs":1183,"Support calls":13},{date:"2023-10-11T00:00:00","Rows written":2639,"Rows read":25232,Queries:488,"Payments completed":117,"Sign ups":66,Logins:983,"Sign outs":1188,"Support calls":11},{date:"2023-10-12T00:00:00","Rows written":2643,"Rows read":24786,Queries:489,"Payments completed":99,"Sign ups":79,Logins:848,"Sign outs":1187,"Support calls":12},{date:"2023-10-13T00:00:00","Rows written":2666,"Rows read":24905,Queries:381,"Payments completed":67,"Sign ups":59,Logins:857,"Sign outs":1179,"Support calls":7},{date:"2023-10-14T00:00:00","Rows written":2703,"Rows read":24710,Queries:430,"Payments completed":67,"Sign ups":57,Logins:928,"Sign outs":1188,"Support calls":3},{date:"2023-10-15T00:00:00","Rows written":2729,"Rows read":25132,Queries:488,"Payments completed":99,"Sign ups":64,Logins:845,"Sign outs":1179,"Support calls":2},{date:"2023-10-16T00:00:00","Rows written":2737,"Rows read":24724,Queries:487,"Payments completed":119,"Sign ups":64,Logins:879,"Sign outs":1182,"Support calls":2},{date:"2023-10-17T00:00:00","Rows written":2730,"Rows read":25172,Queries:486,"Payments completed":119,"Sign ups":64,Logins:862,"Sign outs":1139,"Support calls":2},{date:"2023-10-18T00:00:00","Rows written":2737,"Rows read":25762,Queries:485,"Payments completed":121,"Sign ups":62,Logins:895,"Sign outs":1057,"Support calls":2},{date:"2023-10-19T00:00:00","Rows written":2738,"Rows read":25469,Queries:487,"Payments completed":97,"Sign ups":64,Logins:998,"Sign outs":1100,"Support calls":2},{date:"2023-10-20T00:00:00","Rows written":2724,"Rows read":25948,Queries:409,"Payments completed":70,"Sign ups":67,Logins:940,"Sign outs":1176,"Support calls":2},{date:"2023-10-21T00:00:00","Rows written":2722,"Rows read":26662,Queries:401,"Payments completed":69,"Sign ups":61,Logins:971,"Sign outs":1101,"Support calls":2},{date:"2023-10-22T00:00:00","Rows written":2737,"Rows read":27288,Queries:493,"Payments completed":98,"Sign ups":69,Logins:924,"Sign outs":1139,"Support calls":2},{date:"2023-10-23T00:00:00","Rows written":2737,"Rows read":26813,Queries:493,"Payments completed":119,"Sign ups":63,Logins:844,"Sign outs":1167,"Support calls":3},{date:"2023-10-24T00:00:00","Rows written":2755,"Rows read":27228,Queries:493,"Payments completed":113,"Sign ups":78,Logins:879,"Sign outs":1193,"Support calls":3},{date:"2023-10-25T00:00:00","Rows written":2742,"Rows read":26723,Queries:494,"Payments completed":102,"Sign ups":75,Logins:871,"Sign outs":1095,"Support calls":2},{date:"2023-10-26T00:00:00","Rows written":2715,"Rows read":26364,Queries:494,"Payments completed":121,"Sign ups":75,Logins:961,"Sign outs":1022,"Support calls":2},{date:"2023-10-27T00:00:00","Rows written":2692,"Rows read":26686,Queries:442,"Payments completed":94,"Sign ups":63,Logins:848,"Sign outs":1015,"Support calls":2},{date:"2023-10-28T00:00:00","Rows written":2690,"Rows read":26161,Queries:389,"Payments completed":108,"Sign ups":48,Logins:857,"Sign outs":1061,"Support calls":2},{date:"2023-10-30T00:00:00","Rows written":2710,"Rows read":25456,Queries:496,"Payments completed":94,"Sign ups":62,Logins:874,"Sign outs":1028,"Support calls":2},{date:"2023-10-31T00:00:00","Rows written":2728,"Rows read":24798,Queries:493,"Payments completed":85,"Sign ups":68,Logins:933,"Sign outs":1044,"Support calls":2},{date:"2023-11-01T00:00:00","Rows written":2756,"Rows read":25010,Queries:496,"Payments completed":90,"Sign ups":71,Logins:845,"Sign outs":955,"Support calls":2},{date:"2023-11-02T00:00:00","Rows written":2744,"Rows read":25796,Queries:493,"Payments completed":81,"Sign ups":64,Logins:861,"Sign outs":908,"Support calls":2},{date:"2023-11-03T00:00:00","Rows written":2730,"Rows read":25748,Queries:490,"Payments completed":85,"Sign ups":77,Logins:984,"Sign outs":931,"Support calls":3},{date:"2023-11-04T00:00:00","Rows written":2745,"Rows read":26054,Queries:412,"Payments completed":81,"Sign ups":64,Logins:955,"Sign outs":911,"Support calls":2},{date:"2023-11-05T00:00:00","Rows written":2760,"Rows read":25986,Queries:436,"Payments completed":96,"Sign ups":58,Logins:920,"Sign outs":985,"Support calls":2},{date:"2023-11-06T00:00:00","Rows written":2769,"Rows read":25393,Queries:486,"Payments completed":95,"Sign ups":64,Logins:855,"Sign outs":1115,"Support calls":2},{date:"2023-11-07T00:00:00","Rows written":2748,"Rows read":24541,Queries:491,"Payments completed":84,"Sign ups":75,Logins:861,"Sign outs":1162,"Support calls":2},{date:"2023-11-08T00:00:00","Rows written":2751,"Rows read":24743,Queries:496,"Payments completed":93,"Sign ups":70,Logins:953,"Sign outs":1187,"Support calls":2},{date:"2023-11-09T00:00:00","Rows written":2754,"Rows read":24904,Queries:503,"Payments completed":121,"Sign ups":63,Logins:861,"Sign outs":1188,"Support calls":2},{date:"2023-11-10T00:00:00","Rows written":2778,"Rows read":24773,Queries:504,"Payments completed":122,"Sign ups":64,Logins:872,"Sign outs":1152,"Support calls":2},{date:"2023-11-11T00:00:00","Rows written":2816,"Rows read":23992,Queries:381,"Payments completed":93,"Sign ups":59,Logins:936,"Sign outs":1087,"Support calls":2},{date:"2023-11-12T00:00:00","Rows written":2823,"Rows read":23135,Queries:401,"Payments completed":65,"Sign ups":54,Logins:987,"Sign outs":1011,"Support calls":2},{date:"2023-11-13T00:00:00","Rows written":2843,"Rows read":22986,Queries:494,"Payments completed":84,"Sign ups":60,Logins:959,"Sign outs":902,"Support calls":2},{date:"2023-11-14T00:00:00","Rows written":2865,"Rows read":22974,Queries:492,"Payments completed":81,"Sign ups":69,Logins:998,"Sign outs":909,"Support calls":2},{date:"2023-11-15T00:00:00","Rows written":2871,"Rows read":23523,Queries:490,"Payments completed":85,"Sign ups":79,Logins:871,"Sign outs":970,"Support calls":2},{date:"2023-11-16T00:00:00","Rows written":2848,"Rows read":23927,Queries:485,"Payments completed":91,"Sign ups":76,Logins:854,"Sign outs":1077,"Support calls":2},{date:"2023-11-17T00:00:00","Rows written":2843,"Rows read":23635,Queries:484,"Payments completed":86,"Sign ups":77,Logins:883,"Sign outs":1060,"Support calls":2},{date:"2023-11-18T00:00:00","Rows written":2857,"Rows read":23801,Queries:423,"Payments completed":73,"Sign ups":61,Logins:844,"Sign outs":960,"Support calls":2},{date:"2023-11-19T00:00:00","Rows written":2890,"Rows read":23932,Queries:410,"Payments completed":70,"Sign ups":51,Logins:881,"Sign outs":935,"Support calls":2},{date:"2023-11-20T00:00:00","Rows written":2928,"Rows read":24512,Queries:492,"Payments completed":91,"Sign ups":69,Logins:891,"Sign outs":911,"Support calls":2},{date:"2023-11-21T00:00:00","Rows written":2929,"Rows read":24943,Queries:487,"Payments completed":85,"Sign ups":61,Logins:865,"Sign outs":917,"Support calls":2},{date:"2023-11-22T00:00:00","Rows written":2927,"Rows read":25053,Queries:484,"Payments completed":108,"Sign ups":61,Logins:859,"Sign outs":904,"Support calls":2},{date:"2023-11-23T00:00:00","Rows written":2936,"Rows read":25126,Queries:479,"Payments completed":116,"Sign ups":64,Logins:863,"Sign outs":934,"Support calls":2},{date:"2023-11-24T00:00:00","Rows written":2939,"Rows read":24528,Queries:479,"Payments completed":93,"Sign ups":60,Logins:869,"Sign outs":982,"Support calls":2},{date:"2023-11-25T00:00:00","Rows written":2917,"Rows read":24379,Queries:366,"Payments completed":64,"Sign ups":50,Logins:870,"Sign outs":927,"Support calls":2},{date:"2023-11-26T00:00:00","Rows written":2923,"Rows read":24301,Queries:437,"Payments completed":64,"Sign ups":52,Logins:866,"Sign outs":904,"Support calls":2},{date:"2023-11-27T00:00:00","Rows written":2907,"Rows read":24537,Queries:486,"Payments completed":81,"Sign ups":64,Logins:876,"Sign outs":903,"Support calls":3},{date:"2023-11-28T00:00:00","Rows written":2919,"Rows read":25358,Queries:486,"Payments completed":124,"Sign ups":68,Logins:1032,"Sign outs":915,"Support calls":4},{date:"2023-11-29T00:00:00","Rows written":2949,"Rows read":25428,Queries:482,"Payments completed":113,"Sign ups":64,Logins:1285,"Sign outs":951,"Support calls":4},{date:"2023-11-30T00:00:00","Rows written":2957,"Rows read":25179,Queries:478,"Payments completed":121,"Sign ups":66,Logins:1697,"Sign outs":977,"Support calls":4},{date:"2023-12-01T00:00:00","Rows written":2937,"Rows read":24846,Queries:478,"Payments completed":117,"Sign ups":63,Logins:2012,"Sign outs":958,"Support calls":5},{date:"2023-12-02T00:00:00","Rows written":2949,"Rows read":24979,Queries:359,"Payments completed":106,"Sign ups":49,Logins:2006,"Sign outs":904,"Support calls":6},{date:"2023-12-03T00:00:00","Rows written":2941,"Rows read":25038,Queries:442,"Payments completed":104,"Sign ups":45,Logins:1794,"Sign outs":921,"Support calls":4},{date:"2023-12-04T00:00:00","Rows written":2951,"Rows read":24652,Queries:486,"Payments completed":116,"Sign ups":66,Logins:1765,"Sign outs":913,"Support calls":4},{date:"2023-12-05T00:00:00","Rows written":2941,"Rows read":23863,Queries:487,"Payments completed":96,"Sign ups":68,Logins:1841,"Sign outs":920,"Support calls":4},{date:"2023-12-06T00:00:00","Rows written":2941,"Rows read":23307,Queries:490,"Payments completed":82,"Sign ups":63,Logins:2022,"Sign outs":905,"Support calls":2},{date:"2023-12-07T00:00:00","Rows written":2950,"Rows read":23317,Queries:489,"Payments completed":84,"Sign ups":76,Logins:1973,"Sign outs":918,"Support calls":2},{date:"2023-12-08T00:00:00","Rows written":2943,"Rows read":23254,Queries:484,"Payments completed":82,"Sign ups":73,Logins:1786,"Sign outs":934,"Support calls":2},{date:"2023-12-09T00:00:00","Rows written":2945,"Rows read":22527,Queries:428,"Payments completed":84,"Sign ups":55,Logins:1533,"Sign outs":970,"Support calls":2},{date:"2023-12-10T00:00:00","Rows written":2960,"Rows read":22319,Queries:409,"Payments completed":106,"Sign ups":48,Logins:1279,"Sign outs":1041,"Support calls":2},{date:"2023-12-11T00:00:00","Rows written":2983,"Rows read":21870,Queries:491,"Payments completed":90,"Sign ups":64,Logins:1018,"Sign outs":986,"Support calls":2},{date:"2023-12-12T00:00:00","Rows written":2991,"Rows read":21482,Queries:492,"Payments completed":80,"Sign ups":78,Logins:973,"Sign outs":933,"Support calls":2},{date:"2023-12-13T00:00:00","Rows written":2991,"Rows read":21630,Queries:497,"Payments completed":84,"Sign ups":73,Logins:857,"Sign outs":973,"Support calls":3},{date:"2023-12-14T00:00:00","Rows written":2970,"Rows read":21774,Queries:500,"Payments completed":96,"Sign ups":80,Logins:868,"Sign outs":1084,"Support calls":5},{date:"2023-12-15T00:00:00","Rows written":2981,"Rows read":21684,Queries:499,"Payments completed":121,"Sign ups":79,Logins:952,"Sign outs":1086,"Support calls":5},{date:"2023-12-16T00:00:00","Rows written":2989,"Rows read":22265,Queries:397,"Payments completed":90,"Sign ups":60,Logins:1118,"Sign outs":1046,"Support calls":2},{date:"2023-12-17T00:00:00","Rows written":2977,"Rows read":22417,Queries:426,"Payments completed":66,"Sign ups":48,Logins:1415,"Sign outs":1115,"Support calls":2},{date:"2023-12-18T00:00:00","Rows written":2960,"Rows read":22538,Queries:488,"Payments completed":83,"Sign ups":67,Logins:1881,"Sign outs":1113,"Support calls":2},{date:"2023-12-19T00:00:00","Rows written":2950,"Rows read":22247,Queries:486,"Payments completed":121,"Sign ups":60,Logins:1911,"Sign outs":1001,"Support calls":2},{date:"2023-12-20T00:00:00","Rows written":2919,"Rows read":22166,Queries:487,"Payments completed":125,"Sign ups":60,Logins:1637,"Sign outs":946,"Support calls":2},{date:"2023-12-21T00:00:00","Rows written":2912,"Rows read":22083,Queries:483,"Payments completed":121,"Sign ups":62,Logins:1519,"Sign outs":907,"Support calls":2},{date:"2023-12-22T00:00:00","Rows written":2933,"Rows read":21697,Queries:480,"Payments completed":119,"Sign ups":61,Logins:1315,"Sign outs":933,"Support calls":2},{date:"2023-12-23T00:00:00","Rows written":2918,"Rows read":21487,Queries:391,"Payments completed":94,"Sign ups":52,Logins:1275,"Sign outs":906,"Support calls":2},{date:"2023-12-24T00:00:00","Rows written":2891,"Rows read":20748,Queries:398,"Payments completed":68,"Sign ups":57,Logins:1138,"Sign outs":908,"Support calls":2},{date:"2023-12-25T00:00:00","Rows written":2858,"Rows read":20147,Queries:495,"Payments completed":89,"Sign ups":65,Logins:1213,"Sign outs":924,"Support calls":2},{date:"2023-12-26T00:00:00","Rows written":2858,"Rows read":20262,Queries:489,"Payments completed":98,"Sign ups":60,Logins:1306,"Sign outs":903,"Support calls":2},{date:"2023-12-27T00:00:00","Rows written":2847,"Rows read":20921,Queries:483,"Payments completed":81,"Sign ups":65,Logins:1536,"Sign outs":900,"Support calls":2},{date:"2023-12-28T00:00:00","Rows written":2845,"Rows read":20830,Queries:482,"Payments completed":87,"Sign ups":63,Logins:1879,"Sign outs":922,"Support calls":3},{date:"2023-12-29T00:00:00","Rows written":2827,"Rows read":21133,Queries:482,"Payments completed":99,"Sign ups":60,Logins:2034,"Sign outs":911,"Support calls":2},{date:"2023-12-30T00:00:00","Rows written":2826,"Rows read":21097,Queries:427,"Payments completed":94,"Sign ups":53,Logins:2009,"Sign outs":924,"Support calls":2},{date:"2023-12-31T00:00:00","Rows written":2808,"Rows read":20776,Queries:399,"Payments completed":81,"Sign ups":49,Logins:2002,"Sign outs":918,"Support calls":2},{date:"2024-01-01T00:00:00","Rows written":2790,"Rows read":20855,Queries:494,"Payments completed":87,"Sign ups":66,Logins:2038,"Sign outs":914,"Support calls":2},{date:"2024-01-02T00:00:00","Rows written":2778,"Rows read":20444,Queries:490,"Payments completed":81,"Sign ups":65,Logins:1994,"Sign outs":951,"Support calls":2},{date:"2024-01-03T00:00:00","Rows written":2788,"Rows read":19651,Queries:491,"Payments completed":86,"Sign ups":60,Logins:1975,"Sign outs":1034,"Support calls":2},{date:"2024-01-04T00:00:00","Rows written":2768,"Rows read":18747,Queries:494,"Payments completed":84,"Sign ups":65,Logins:2012,"Sign outs":1015,"Support calls":2},{date:"2024-01-05T00:00:00","Rows written":2782,"Rows read":18514,Queries:493,"Payments completed":98,"Sign ups":66,Logins:1944,"Sign outs":1042,"Support calls":2},{date:"2024-01-06T00:00:00","Rows written":2777,"Rows read":18686,Queries:379,"Payments completed":106,"Sign ups":55,Logins:1741,"Sign outs":995,"Support calls":2},{date:"2024-01-07T00:00:00","Rows written":2785,"Rows read":18779,Queries:431,"Payments completed":92,"Sign ups":52,Logins:1862,"Sign outs":1065,"Support calls":2},{date:"2024-01-08T00:00:00","Rows written":2783,"Rows read":18994,Queries:488,"Payments completed":119,"Sign ups":65,Logins:2003,"Sign outs":1028,"Support calls":2},{date:"2024-01-09T00:00:00","Rows written":2769,"Rows read":18892,Queries:486,"Payments completed":112,"Sign ups":68,Logins:1975,"Sign outs":1113,"Support calls":2},{date:"2024-01-10T00:00:00","Rows written":2739,"Rows read":18785,Queries:485,"Payments completed":121,"Sign ups":63,Logins:2021,"Sign outs":1060,"Support calls":2},{date:"2024-01-11T00:00:00","Rows written":2708,"Rows read":18323,Queries:489,"Payments completed":112,"Sign ups":64,Logins:2020,"Sign outs":951,"Support calls":2},{date:"2024-01-12T00:00:00","Rows written":2697,"Rows read":18607,Queries:489,"Payments completed":102,"Sign ups":63,Logins:1934,"Sign outs":904,"Support calls":2},{date:"2024-01-13T00:00:00","Rows written":2709,"Rows read":18881,Queries:371,"Payments completed":106,"Sign ups":52,Logins:1908,"Sign outs":913,"Support calls":2},{date:"2024-01-14T00:00:00","Rows written":2734,"Rows read":18941,Queries:393,"Payments completed":82,"Sign ups":50,Logins:1572,"Sign outs":905,"Support calls":2},{date:"2024-01-15T00:00:00","Rows written":2735,"Rows read":19199,Queries:495,"Payments completed":106,"Sign ups":68,Logins:1311,"Sign outs":908,"Support calls":2},{date:"2024-01-16T00:00:00","Rows written":2735,"Rows read":19883,Queries:493,"Payments completed":82,"Sign ups":61,Logins:946,"Sign outs":909,"Support calls":3},{date:"2024-01-17T00:00:00","Rows written":2720,"Rows read":20709,Queries:495,"Payments completed":86,"Sign ups":61,Logins:878,"Sign outs":910,"Support calls":3},{date:"2024-01-18T00:00:00","Rows written":2700,"Rows read":20770,Queries:500,"Payments completed":82,"Sign ups":66,Logins:895,"Sign outs":915,"Support calls":3},{date:"2024-01-19T00:00:00","Rows written":2670,"Rows read":20735,Queries:501,"Payments completed":88,"Sign ups":64,Logins:882,"Sign outs":908,"Support calls":2},{date:"2024-01-20T00:00:00","Rows written":2672,"Rows read":20107,Queries:425,"Payments completed":67,"Sign ups":54,Logins:852,"Sign outs":929,"Support calls":2},{date:"2024-01-21T00:00:00","Rows written":2676,"Rows read":19418,Queries:380,"Payments completed":70,"Sign ups":47,Logins:854,"Sign outs":906,"Support calls":2},{date:"2024-01-22T00:00:00","Rows written":2692,"Rows read":19118,Queries:498,"Payments completed":82,"Sign ups":62,Logins:848,"Sign outs":944,"Support calls":3},{date:"2024-01-23T00:00:00","Rows written":2691,"Rows read":18577,Queries:495,"Payments completed":88,"Sign ups":78,Logins:872,"Sign outs":1027,"Support calls":5},{date:"2024-01-24T00:00:00","Rows written":2703,"Rows read":18052,Queries:493,"Payments completed":109,"Sign ups":69,Logins:875,"Sign outs":1095,"Support calls":5},{date:"2024-01-25T00:00:00","Rows written":2735,"Rows read":18108,Queries:491,"Payments completed":80,"Sign ups":76,Logins:914,"Sign outs":1067,"Support calls":4},{date:"2024-01-26T00:00:00","Rows written":2733,"Rows read":18137,Queries:488,"Payments completed":80,"Sign ups":78,Logins:959,"Sign outs":1115,"Support calls":4},{date:"2024-01-27T00:00:00","Rows written":2724,"Rows read":18116,Queries:432,"Payments completed":65,"Sign ups":53,Logins:1059,"Sign outs":1182,"Support calls":2},{date:"2024-01-28T00:00:00","Rows written":2727,"Rows read":18575,Queries:431,"Payments completed":65,"Sign ups":49,Logins:997,"Sign outs":1180,"Support calls":2},{date:"2024-01-29T00:00:00","Rows written":2755,"Rows read":19197,Queries:488,"Payments completed":83,"Sign ups":64,Logins:950,"Sign outs":1138,"Support calls":2},{date:"2024-01-30T00:00:00","Rows written":2756,"Rows read":19751,Queries:490,"Payments completed":87,"Sign ups":66,Logins:1028,"Sign outs":1108,"Support calls":3},{date:"2024-01-31T00:00:00","Rows written":2783,"Rows read":19767,Queries:491,"Payments completed":102,"Sign ups":79,Logins:1198,"Sign outs":1050,"Support calls":5},{date:"2024-02-01T00:00:00","Rows written":2778,"Rows read":19305,Queries:491,"Payments completed":81,"Sign ups":76,Logins:1458,"Sign outs":1023,"Support calls":6},{date:"2024-02-02T00:00:00","Rows written":2749,"Rows read":19095,Queries:495,"Payments completed":80,"Sign ups":77,Logins:1712,"Sign outs":1052,"Support calls":8},{date:"2024-02-03T00:00:00","Rows written":2711,"Rows read":18932,Queries:425,"Payments completed":68,"Sign ups":70,Logins:1704,"Sign outs":1129,"Support calls":7},{date:"2024-02-04T00:00:00","Rows written":2719,"Rows read":19181,Queries:369,"Payments completed":69,"Sign ups":62,Logins:1393,"Sign outs":1076,"Support calls":6},{date:"2024-02-05T00:00:00","Rows written":2708,"Rows read":19141,Queries:500,"Payments completed":85,"Sign ups":62,Logins:1235,"Sign outs":947,"Support calls":8},{date:"2024-02-06T00:00:00","Rows written":2726,"Rows read":19575,Queries:495,"Payments completed":88,"Sign ups":80,Logins:1100,"Sign outs":921,"Support calls":8},{date:"2024-02-07T00:00:00","Rows written":2752,"Rows read":20265,Queries:491,"Payments completed":87,"Sign ups":71,Logins:932,"Sign outs":904,"Support calls":10},{date:"2024-02-08T00:00:00","Rows written":2754,"Rows read":20236,Queries:485,"Payments completed":83,"Sign ups":75,Logins:868,"Sign outs":917,"Support calls":13},{date:"2024-02-09T00:00:00","Rows written":2776,"Rows read":19659,Queries:478,"Payments completed":89,"Sign ups":77,Logins:878,"Sign outs":900,"Support calls":15},{date:"2024-02-10T00:00:00","Rows written":2794,"Rows read":19108,Queries:392,"Payments completed":72,"Sign ups":58,Logins:1033,"Sign outs":917,"Support calls":8},{date:"2024-02-11T00:00:00","Rows written":2796,"Rows read":18407,Queries:382,"Payments completed":67,"Sign ups":53,Logins:1008,"Sign outs":959,"Support calls":9},{date:"2024-02-12T00:00:00","Rows written":2774,"Rows read":18053,Queries:498,"Payments completed":83,"Sign ups":66,Logins:960,"Sign outs":1040,"Support calls":14},{date:"2024-02-13T00:00:00","Rows written":2747,"Rows read":18058,Queries:493,"Payments completed":80,"Sign ups":63,Logins:858,"Sign outs":1177,"Support calls":13},{date:"2024-02-14T00:00:00","Rows written":2741,"Rows read":18290,Queries:492,"Payments completed":82,"Sign ups":60,Logins:942,"Sign outs":1177,"Support calls":15},{date:"2024-02-15T00:00:00","Rows written":2724,"Rows read":18708,Queries:491,"Payments completed":83,"Sign ups":61,Logins:1015,"Sign outs":1150,"Support calls":9},{date:"2024-02-16T00:00:00","Rows written":2705,"Rows read":18405,Queries:491,"Payments completed":86,"Sign ups":61,Logins:1067,"Sign outs":1114,"Support calls":5},{date:"2024-02-17T00:00:00","Rows written":2699,"Rows read":18713,Queries:372,"Payments completed":73,"Sign ups":53,Logins:1175,"Sign outs":1004,"Support calls":2},{date:"2024-02-18T00:00:00","Rows written":2693,"Rows read":18576,Queries:393,"Payments completed":75,"Sign ups":56,Logins:1411,"Sign outs":959,"Support calls":2},{date:"2024-02-19T00:00:00","Rows written":2704,"Rows read":18344,Queries:495,"Payments completed":90,"Sign ups":65,Logins:1586,"Sign outs":902,"Support calls":2},{date:"2024-02-20T00:00:00","Rows written":2728,"Rows read":18769,Queries:500,"Payments completed":83,"Sign ups":78,Logins:1792,"Sign outs":902,"Support calls":2},{date:"2024-02-21T00:00:00","Rows written":2756,"Rows read":19252,Queries:507,"Payments completed":82,"Sign ups":61,Logins:1837,"Sign outs":917,"Support calls":2},{date:"2024-02-22T00:00:00","Rows written":2792,"Rows read":19917,Queries:509,"Payments completed":83,"Sign ups":65,Logins:1818,"Sign outs":911,"Support calls":2},{date:"2024-02-23T00:00:00","Rows written":2827,"Rows read":20473,Queries:509,"Payments completed":86,"Sign ups":68,Logins:1460,"Sign outs":903,"Support calls":2},{date:"2024-02-24T00:00:00","Rows written":2822,"Rows read":21263,Queries:402,"Payments completed":76,"Sign ups":67,Logins:1232,"Sign outs":926,"Support calls":2},{date:"2024-02-25T00:00:00","Rows written":2825,"Rows read":22081,Queries:432,"Payments completed":75,"Sign ups":49,Logins:1122,"Sign outs":903,"Support calls":2},{date:"2024-02-26T00:00:00","Rows written":2849,"Rows read":22955,Queries:487,"Payments completed":84,"Sign ups":62,Logins:1118,"Sign outs":964,"Support calls":2},{date:"2024-02-27T00:00:00","Rows written":2841,"Rows read":23908,Queries:484,"Payments completed":110,"Sign ups":79,Logins:1247,"Sign outs":1048,"Support calls":2},{date:"2024-02-28T00:00:00","Rows written":2857,"Rows read":23777,Queries:481,"Payments completed":91,"Sign ups":64,Logins:1231,"Sign outs":1166,"Support calls":2},{date:"2024-02-29T00:00:00","Rows written":2878,"Rows read":23296,Queries:484,"Payments completed":89,"Sign ups":79,Logins:991,"Sign outs":1153,"Support calls":2},{date:"2024-03-01T00:00:00","Rows written":2881,"Rows read":22647,Queries:483,"Payments completed":110,"Sign ups":71,Logins:865,"Sign outs":1166,"Support calls":3},{date:"2024-03-02T00:00:00","Rows written":2887,"Rows read":22725,Queries:363,"Payments completed":100,"Sign ups":65,Logins:855,"Sign outs":1194,"Support calls":3},{date:"2024-03-03T00:00:00","Rows written":2869,"Rows read":22226,Queries:393,"Payments completed":91,"Sign ups":64,Logins:859,"Sign outs":1172,"Support calls":2},{date:"2024-03-04T00:00:00","Rows written":2877,"Rows read":22120,Queries:495,"Payments completed":122,"Sign ups":61,Logins:867,"Sign outs":1181,"Support calls":2},{date:"2024-03-05T00:00:00","Rows written":2875,"Rows read":22533,Queries:494,"Payments completed":109,"Sign ups":60,Logins:879,"Sign outs":1150,"Support calls":2},{date:"2024-03-06T00:00:00","Rows written":2860,"Rows read":22166,Queries:489,"Payments completed":98,"Sign ups":65,Logins:869,"Sign outs":1088,"Support calls":2},{date:"2024-03-07T00:00:00","Rows written":2872,"Rows read":21895,Queries:482,"Payments completed":104,"Sign ups":77,Logins:877,"Sign outs":1145,"Support calls":2},{date:"2024-03-08T00:00:00","Rows written":2852,"Rows read":21563,Queries:479,"Payments completed":82,"Sign ups":73,Logins:852,"Sign outs":1123,"Support calls":2},{date:"2024-03-09T00:00:00","Rows written":2822,"Rows read":20981,Queries:409,"Payments completed":76,"Sign ups":49,Logins:979,"Sign outs":1140,"Support calls":2},{date:"2024-03-10T00:00:00","Rows written":2835,"Rows read":21256,Queries:387,"Payments completed":68,"Sign ups":50,Logins:1138,"Sign outs":1150,"Support calls":2},{date:"2024-03-11T00:00:00","Rows written":2831,"Rows read":21702,Queries:497,"Payments completed":83,"Sign ups":60,Logins:1026,"Sign outs":1084,"Support calls":2},{date:"2024-03-12T00:00:00","Rows written":2807,"Rows read":22104,Queries:494,"Payments completed":81,"Sign ups":70,Logins:858,"Sign outs":952,"Support calls":2},{date:"2024-03-13T00:00:00","Rows written":2803,"Rows read":22714,Queries:489,"Payments completed":106,"Sign ups":74,Logins:879,"Sign outs":908,"Support calls":2},{date:"2024-03-14T00:00:00","Rows written":2825,"Rows read":22484,Queries:483,"Payments completed":116,"Sign ups":72,Logins:844,"Sign outs":917,"Support calls":2},{date:"2024-03-15T00:00:00","Rows written":2811,"Rows read":22589,Queries:480,"Payments completed":120,"Sign ups":73,Logins:852,"Sign outs":907,"Support calls":2},{date:"2024-03-16T00:00:00","Rows written":2815,"Rows read":21999,Queries:391,"Payments completed":94,"Sign ups":60,Logins:860,"Sign outs":907,"Support calls":2},{date:"2024-03-17T00:00:00","Rows written":2842,"Rows read":21627,Queries:440,"Payments completed":92,"Sign ups":69,Logins:920,"Sign outs":932,"Support calls":2},{date:"2024-03-18T00:00:00","Rows written":2864,"Rows read":21708,Queries:486,"Payments completed":82,"Sign ups":75,Logins:856,"Sign outs":900,"Support calls":2},{date:"2024-03-19T00:00:00","Rows written":2877,"Rows read":21501,Queries:489,"Payments completed":114,"Sign ups":70,Logins:845,"Sign outs":943,"Support calls":2},{date:"2024-03-20T00:00:00","Rows written":2900,"Rows read":21927,Queries:489,"Payments completed":107,"Sign ups":80,Logins:848,"Sign outs":903,"Support calls":2},{date:"2024-03-21T00:00:00","Rows written":2887,"Rows read":22358,Queries:490,"Payments completed":81,"Sign ups":61,Logins:847,"Sign outs":912,"Support calls":3},{date:"2024-03-22T00:00:00","Rows written":2903,"Rows read":22301,Queries:488,"Payments completed":84,"Sign ups":63,Logins:847,"Sign outs":907,"Support calls":3},{date:"2024-03-23T00:00:00","Rows written":2920,"Rows read":21875,Queries:420,"Payments completed":66,"Sign ups":61,Logins:852,"Sign outs":903,"Support calls":4},{date:"2024-03-24T00:00:00","Rows written":2951,"Rows read":21585,Queries:370,"Payments completed":66,"Sign ups":51,Logins:952,"Sign outs":943,"Support calls":2},{date:"2024-03-25T00:00:00","Rows written":2944,"Rows read":20899,Queries:499,"Payments completed":101,"Sign ups":63,Logins:1030,"Sign outs":982,"Support calls":2},{date:"2024-03-26T00:00:00","Rows written":2923,"Rows read":20352,Queries:504,"Payments completed":124,"Sign ups":78,Logins:1009,"Sign outs":1087,"Support calls":2},{date:"2024-03-27T00:00:00","Rows written":2894,"Rows read":19832,Queries:510,"Payments completed":100,"Sign ups":70,Logins:868,"Sign outs":1190,"Support calls":2},{date:"2024-03-28T00:00:00","Rows written":2886,"Rows read":19542,Queries:510,"Payments completed":92,"Sign ups":76,Logins:852,"Sign outs":1199,"Support calls":2},{date:"2024-03-29T00:00:00","Rows written":2874,"Rows read":19368,Queries:507,"Payments completed":83,"Sign ups":71,Logins:906,"Sign outs":1103,"Support calls":2},{date:"2024-03-30T00:00:00","Rows written":2869,"Rows read":19312,Queries:383,"Payments completed":75,"Sign ups":66,Logins:866,"Sign outs":996,"Support calls":2},{date:"2024-03-31T00:00:00","Rows written":2848,"Rows read":19578,Queries:410,"Payments completed":83,"Sign ups":68,Logins:1e3,"Sign outs":910,"Support calls":2},{date:"2024-03-31T00:00:00","Rows written":2854,"Rows read":19837,Queries:492,"Payments completed":119,"Sign ups":74,Logins:1204,"Sign outs":903,"Support calls":2},{date:"2024-04-01T00:00:00","Rows written":2837,"Rows read":19406,Queries:486,"Payments completed":124,"Sign ups":73,Logins:1374,"Sign outs":918,"Support calls":2},{date:"2024-04-02T00:00:00","Rows written":2826,"Rows read":19050,Queries:480,"Payments completed":103,"Sign ups":71,Logins:1649,"Sign outs":930,"Support calls":3},{date:"2024-04-03T00:00:00","Rows written":2821,"Rows read":18973,Queries:481,"Payments completed":117,"Sign ups":76,Logins:1686,"Sign outs":911,"Support calls":5},{date:"2024-04-04T00:00:00","Rows written":2806,"Rows read":18537,Queries:485,"Payments completed":102,"Sign ups":70,Logins:1373,"Sign outs":950,"Support calls":7},{date:"2024-04-05T00:00:00","Rows written":2774,"Rows read":18124,Queries:379,"Payments completed":70,"Sign ups":53,Logins:1512,"Sign outs":973,"Support calls":9},{date:"2024-04-06T00:00:00","Rows written":2734,"Rows read":18031,Queries:436,"Payments completed":82,"Sign ups":63,Logins:1593,"Sign outs":900,"Support calls":9},{date:"2024-04-07T00:00:00","Rows written":2738,"Rows read":18081,Queries:485,"Payments completed":93,"Sign ups":61,Logins:1926,"Sign outs":932,"Support calls":13},{date:"2024-04-08T00:00:00","Rows written":2765,"Rows read":18042,Queries:491,"Payments completed":123,"Sign ups":67,Logins:2001,"Sign outs":971,"Support calls":14},{date:"2024-04-09T00:00:00","Rows written":2756,"Rows read":18006,Queries:490,"Payments completed":112,"Sign ups":78,Logins:1983,"Sign outs":913,"Support calls":9},{date:"2024-04-10T00:00:00","Rows written":2726,"Rows read":18097,Queries:493,"Payments completed":118,"Sign ups":74,Logins:1946,"Sign outs":900,"Support calls":10},{date:"2024-04-11T00:00:00","Rows written":2691,"Rows read":18124,Queries:494,"Payments completed":114,"Sign ups":71,Logins:1956,"Sign outs":915,"Support calls":10},{date:"2024-04-12T00:00:00","Rows written":2699,"Rows read":18115,Queries:431,"Payments completed":85,"Sign ups":69,Logins:1991,"Sign outs":926,"Support calls":5},{date:"2024-04-13T00:00:00","Rows written":2696,"Rows read":18096,Queries:387,"Payments completed":75,"Sign ups":64,Logins:1795,"Sign outs":906,"Support calls":3},{date:"2024-04-14T00:00:00","Rows written":2673,"Rows read":18251,Queries:496,"Payments completed":82,"Sign ups":77,Logins:1687,"Sign outs":965,"Support calls":4},{date:"2024-04-15T00:00:00","Rows written":2669,"Rows read":18003,Queries:491,"Payments completed":81,"Sign ups":79,Logins:1440,"Sign outs":1023,"Support calls":7},{date:"2024-04-16T00:00:00","Rows written":2676,"Rows read":18017,Queries:485,"Payments completed":87,"Sign ups":73,Logins:1589,"Sign outs":1149,"Support calls":11},{date:"2024-04-17T00:00:00","Rows written":2654,"Rows read":18088,Queries:485,"Payments completed":81,"Sign ups":75,Logins:1949,"Sign outs":1135,"Support calls":9},{date:"2024-04-18T00:00:00","Rows written":2635,"Rows read":18115,Queries:483,"Payments completed":106,"Sign ups":71,Logins:2028,"Sign outs":1159,"Support calls":7},{date:"2024-04-19T00:00:00","Rows written":2644,"Rows read":18138,Queries:379,"Payments completed":98,"Sign ups":65,Logins:2036,"Sign outs":1187,"Support calls":3},{date:"2024-04-20T00:00:00","Rows written":2672,"Rows read":18004,Queries:441,"Payments completed":101,"Sign ups":68,Logins:1991,"Sign outs":1176,"Support calls":3},{date:"2024-04-21T00:00:00","Rows written":2700,"Rows read":18113,Queries:485,"Payments completed":97,"Sign ups":60,Logins:2006,"Sign outs":1174,"Support calls":4},{date:"2024-04-22T00:00:00","Rows written":2729,"Rows read":18033,Queries:485,"Payments completed":85,"Sign ups":61,Logins:2006,"Sign outs":1169,"Support calls":6},{date:"2024-04-23T00:00:00","Rows written":2735,"Rows read":18083,Queries:486,"Payments completed":85,"Sign ups":80,Logins:1882,"Sign outs":1159,"Support calls":7},{date:"2024-04-24T00:00:00","Rows written":2734,"Rows read":18028,Queries:486,"Payments completed":112,"Sign ups":74,Logins:1801,"Sign outs":1040,"Support calls":8},{date:"2024-04-25T00:00:00","Rows written":2745,"Rows read":18037,Queries:486,"Payments completed":120,"Sign ups":72,Logins:1453,"Sign outs":944,"Support calls":6},{date:"2024-04-26T00:00:00","Rows written":2742,"Rows read":18006,Queries:380,"Payments completed":99,"Sign ups":56,Logins:1264,"Sign outs":992,"Support calls":3},{date:"2024-04-27T00:00:00","Rows written":2717,"Rows read":18439,Queries:446,"Payments completed":85,"Sign ups":65,Logins:938,"Sign outs":996,"Support calls":3},{date:"2024-04-28T00:00:00","Rows written":2707,"Rows read":18285,Queries:484,"Payments completed":85,"Sign ups":62,Logins:942,"Sign outs":1061,"Support calls":3},{date:"2024-04-29T00:00:00","Rows written":2677,"Rows read":18258,Queries:481,"Payments completed":84,"Sign ups":63,Logins:1061,"Sign outs":1089,"Support calls":3},{date:"2024-04-30T00:00:00","Rows written":2685,"Rows read":18298,Queries:479,"Payments completed":88,"Sign ups":71,Logins:1289,"Sign outs":1119,"Support calls":2},{date:"2024-05-01T00:00:00","Rows written":2687,"Rows read":18361,Queries:479,"Payments completed":88,"Sign ups":78,Logins:1339,"Sign outs":1198,"Support calls":2},{date:"2024-05-02T00:00:00","Rows written":2670,"Rows read":18576,Queries:480,"Payments completed":90,"Sign ups":76,Logins:1142,"Sign outs":1145,"Support calls":2},{date:"2024-05-03T00:00:00","Rows written":2635,"Rows read":19046,Queries:396,"Payments completed":71,"Sign ups":51,Logins:948,"Sign outs":1049,"Support calls":2},{date:"2024-05-04T00:00:00","Rows written":2617,"Rows read":19808,Queries:375,"Payments completed":82,"Sign ups":51,Logins:1018,"Sign outs":1012,"Support calls":2},{date:"2024-05-05T00:00:00","Rows written":2627,"Rows read":20325,Queries:498,"Payments completed":90,"Sign ups":64,Logins:1137,"Sign outs":1095,"Support calls":2},{date:"2024-05-06T00:00:00","Rows written":2624,"Rows read":20838,Queries:503,"Payments completed":119,"Sign ups":78,Logins:1047,"Sign outs":1196,"Support calls":2},{date:"2024-05-07T00:00:00","Rows written":2596,"Rows read":21694,Queries:503,"Payments completed":111,"Sign ups":72,Logins:848,"Sign outs":1199,"Support calls":2},{date:"2024-05-08T00:00:00","Rows written":2607,"Rows read":22529,Queries:499,"Payments completed":106,"Sign ups":70,Logins:861,"Sign outs":1102,"Support calls":2},{date:"2024-05-09T00:00:00","Rows written":2637,"Rows read":23550,Queries:493,"Payments completed":120,"Sign ups":76,Logins:979,"Sign outs":1126,"Support calls":3},{date:"2024-05-10T00:00:00","Rows written":2675,"Rows read":24491,Queries:379,"Payments completed":67,"Sign ups":65,Logins:928,"Sign outs":1070,"Support calls":3},{date:"2024-05-11T00:00:00","Rows written":2718,"Rows read":25709,Queries:428,"Payments completed":65,"Sign ups":48,Logins:990,"Sign outs":1068,"Support calls":4},{date:"2024-05-12T00:00:00","Rows written":2723,"Rows read":26600,Queries:488,"Payments completed":82,"Sign ups":63,Logins:1122,"Sign outs":1063,"Support calls":5},{date:"2024-05-13T00:00:00","Rows written":2715,"Rows read":27252,Queries:490,"Payments completed":83,"Sign ups":64,Logins:1285,"Sign outs":1126,"Support calls":7},{date:"2024-05-14T00:00:00","Rows written":2715,"Rows read":27298,Queries:489,"Payments completed":86,"Sign ups":79,Logins:1516,"Sign outs":1200,"Support calls":5},{date:"2024-05-15T00:00:00","Rows written":2734,"Rows read":27457,Queries:490,"Payments completed":89,"Sign ups":74,Logins:1803,"Sign outs":1122,"Support calls":4},{date:"2024-05-16T00:00:00","Rows written":2765,"Rows read":27539,Queries:486,"Payments completed":88,"Sign ups":73,Logins:2045,"Sign outs":997,"Support calls":2}],vr={blue:{bg:"bg-blue-500",stroke:"stroke-blue-500",fill:"fill-blue-500",text:"text-blue-500"},emerald:{bg:"bg-emerald-500",stroke:"stroke-emerald-500",fill:"fill-emerald-500",text:"text-emerald-500"},violet:{bg:"bg-violet-500",stroke:"stroke-violet-500",fill:"fill-violet-500",text:"text-violet-500"},amber:{bg:"bg-amber-500",stroke:"stroke-amber-500",fill:"fill-amber-500",text:"text-amber-500"},gray:{bg:"bg-gray-500",stroke:"stroke-gray-500",fill:"fill-gray-500",text:"text-gray-500"},cyan:{bg:"bg-cyan-500",stroke:"stroke-cyan-500",fill:"fill-cyan-500",text:"text-cyan-500"},pink:{bg:"bg-pink-500",stroke:"stroke-pink-500",fill:"fill-pink-500",text:"text-pink-500"},lime:{bg:"bg-lime-500",stroke:"stroke-lime-500",fill:"fill-lime-500",text:"text-lime-500"},fuchsia:{bg:"bg-fuchsia-500",stroke:"stroke-fuchsia-500",fill:"fill-fuchsia-500",text:"text-fuchsia-500"}},Nr=Object.keys(vr),To=(t,s)=>{const a=new Map;return t.forEach((r,i)=>{a.set(r,s[i%s.length])}),a},dt=(t,s)=>{var r;const a={bg:"bg-gray-500",stroke:"stroke-gray-500",fill:"fill-gray-500",text:"text-gray-500"};return((r=vr[t])==null?void 0:r[s])??a[s]},Qo=(t,s,a)=>[t?"auto":s??0,a??"auto"];function is(t,s){const a=[];for(const r of t)if(Object.prototype.hasOwnProperty.call(r,s)&&(a.push(r[s]),a.length>1))return!1;return!0}const zo=t=>{N.useEffect(()=>{const s=()=>{t()};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[t])},Io=({name:t,color:s,onClick:a,activeLegend:r})=>{const i=!!a;return e.jsxs("li",{className:I("group inline-flex flex-nowrap items-center gap-1.5 whitespace-nowrap rounded px-2 py-1 transition",i?"bg-transpaent cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800":"cursor-default"),onClick:n=>{n.stopPropagation(),a==null||a(t,s)},children:[e.jsx("span",{className:I("h-[3px] w-3.5 shrink-0 rounded-full",dt(s,"bg"),r&&r!==t?"opacity-40":"opacity-100"),"aria-hidden":"true"}),e.jsx("p",{className:I("truncate whitespace-nowrap text-xs","text-gray-700 dark:text-gray-300",i&&"group-hover:text-gray-900 dark:group-hover:text-gray-50",r&&r!==t?"opacity-40":"opacity-100"),children:t})]})},ta=({icon:t,onClick:s,disabled:a})=>{const r=t,[i,n]=x.useState(!1),o=x.useRef(null);return x.useEffect(()=>(i?o.current=setInterval(()=>{s==null||s()},300):clearInterval(o.current),()=>clearInterval(o.current)),[i,s]),x.useEffect(()=>{a&&(clearInterval(o.current),n(!1))},[a]),e.jsx("button",{type:"button",className:I("group inline-flex size-5 items-center truncate rounded transition",a?"cursor-not-allowed text-gray-400 dark:text-gray-600":"cursor-pointer text-gray-700 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-50"),disabled:a,onClick:l=>{l.stopPropagation(),s==null||s()},onMouseDown:l=>{l.stopPropagation(),n(!0)},onMouseUp:l=>{l.stopPropagation(),n(!1)},children:e.jsx(r,{className:"size-full","aria-hidden":"true"})})},Rr=x.forwardRef((t,s)=>{const{categories:a,colors:r=Nr,className:i,onClickLegendItem:n,activeLegend:o,enableLegendSlider:l=!1,...d}=t,c=x.useRef(null),[u,p]=x.useState(null),[g,h]=x.useState(null),y=x.useRef(null),b=x.useCallback(()=>{const j=c==null?void 0:c.current;if(!j)return;const v=j.scrollLeft>0,P=j.scrollWidth-j.clientWidth>j.scrollLeft;p({left:v,right:P})},[p]),f=x.useCallback(j=>{const v=c==null?void 0:c.current,P=(v==null?void 0:v.clientWidth)??0;v&&l&&(v.scrollTo({left:j==="left"?v.scrollLeft-P:v.scrollLeft+P,behavior:"smooth"}),setTimeout(()=>{b()},400))},[l,b]);x.useEffect(()=>{const j=v=>{v==="ArrowLeft"?f("left"):v==="ArrowRight"&&f("right")};return g?(j(g),y.current=setInterval(()=>{j(g)},300)):clearInterval(y.current),()=>clearInterval(y.current)},[g,f]);const S=j=>{j.stopPropagation(),(j.key==="ArrowLeft"||j.key==="ArrowRight")&&(j.preventDefault(),h(j.key))},k=j=>{j.stopPropagation(),h(null)};return x.useEffect(()=>{const j=c==null?void 0:c.current;return l&&(b(),j==null||j.addEventListener("keydown",S),j==null||j.addEventListener("keyup",k)),()=>{j==null||j.removeEventListener("keydown",S),j==null||j.removeEventListener("keyup",k)}},[b,l]),e.jsxs("ol",{ref:s,className:I("relative overflow-hidden",i),...d,children:[e.jsx("div",{ref:c,tabIndex:0,className:I("flex h-full",l?u!=null&&u.right||u!=null&&u.left?"snap-mandatory items-center overflow-auto pl-4 pr-12 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"":"flex-wrap"),children:a.map((j,v)=>e.jsx(Io,{name:j,color:r[v],onClick:n,activeLegend:o},`item-${v}`))}),l&&(u!=null&&u.right||u!=null&&u.left)?e.jsx(e.Fragment,{children:e.jsxs("div",{className:I("absolute bottom-0 right-0 top-0 flex h-full items-center justify-center pr-1","bg-white dark:bg-gray-950"),children:[e.jsx(ta,{icon:C.RiArrowLeftSLine,onClick:()=>{h(null),f("left")},disabled:!(u!=null&&u.left)}),e.jsx(ta,{icon:C.RiArrowRightSLine,onClick:()=>{h(null),f("right")},disabled:!(u!=null&&u.right)})]})}):null]})});Rr.displayName="Legend";const Lo=({payload:t},s,a,r,i,n)=>{const o=x.useRef(null);zo(()=>{var c;a((u=>u?Number(u)+15:60)((c=o.current)==null?void 0:c.clientHeight))});const l=t.filter(d=>d.type!=="none");return e.jsx("div",{ref:o,className:"flex items-center justify-end",children:e.jsx(Rr,{categories:l.map(d=>d.value),colors:l.map(d=>s.get(d.value)),onClickLegendItem:i,activeLegend:r,enableLegendSlider:n})})},Eo=({value:t,name:s,color:a})=>e.jsxs("div",{className:"flex items-center justify-between space-x-8",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("span",{"aria-hidden":"true",className:I("h-[3px] w-3.5 shrink-0 rounded-full",a)}),e.jsx("p",{className:I("whitespace-nowrap text-right","text-gray-700 dark:text-gray-300"),children:s})]}),e.jsx("p",{className:I("whitespace-nowrap text-right font-medium tabular-nums","text-gray-900 dark:text-gray-50"),children:t})]}),Do=({active:t,payload:s,categoryColors:a,valueFormatter:r})=>{if(t&&s){const i=s.filter(l=>l.type!=="none");if(!t||!s)return null;const n=s[0].payload.title,o=s[0].payload.evolution;return n?e.jsxs("div",{className:I("rounded-md border text-sm shadow-md","border-gray-200 dark:border-gray-800","bg-white dark:bg-gray-950"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 border-b border-inherit p-2",children:[e.jsx("p",{className:I("font-medium","text-gray-900 dark:text-gray-50"),children:n}),o!==void 0&&e.jsx(ht,{variant:Ur(o),children:kr(o)})]}),e.jsx("div",{className:I("space-y-1 p-2"),children:i.map((l,d)=>{const c=l.payload;return e.jsx(Eo,{value:r(l.value),name:d===0?c.formattedDate:c.previousFormattedDate,color:dt(a.get(l.name),"bg")},`id-${d}`)})})]}):null}return null},Cr=x.forwardRef((t,s)=>{const{data:a=[],categories:r=[],index:i,colors:n=Nr,valueFormatter:o=M=>M.toString(),startEndOnly:l=!1,showXAxis:d=!0,showYAxis:c=!0,showGridLines:u=!0,yAxisWidth:p=56,intervalType:g="equidistantPreserveStart",showTooltip:h=!0,showLegend:y=!0,autoMinValue:b=!1,minValue:f,maxValue:S,allowDecimals:k=!0,connectNulls:j=!1,className:v,onValueChange:P,enableLegendSlider:q=!1,tickGap:se=5,xAxisLabel:ee,yAxisLabel:U,...O}=t,je=!d&&!c?0:20,[Me,Ve]=x.useState(60),[W,Re]=x.useState(void 0),[B,D]=x.useState(void 0),J=To(r,n),ne=Qo(b,f,S),St=!!P;function Ni(M,me){me.stopPropagation(),St&&(M.index===(W==null?void 0:W.index)&&M.dataKey===(W==null?void 0:W.dataKey)||is(a,M.dataKey)&&B&&B===M.dataKey?(D(void 0),Re(void 0),P==null||P(null)):(D(M.dataKey),Re({index:M.index,dataKey:M.dataKey}),P==null||P({eventType:"dot",categoryClicked:M.dataKey,...M.payload})))}function Hs(M){St&&(M===B&&!W||is(a,M)&&W&&W.dataKey===M?(D(void 0),P==null||P(null)):(D(M),P==null||P({eventType:"category",categoryClicked:M})),Re(void 0))}return e.jsx("div",{ref:s,className:I("h-80 w-full",v),...O,children:e.jsx(oe.ResponsiveContainer,{children:e.jsxs(oe.LineChart,{data:a,onClick:St&&(B||W)?()=>{Re(void 0),D(void 0),P==null||P(null)}:void 0,margin:{bottom:ee?30:void 0,left:U?20:void 0,right:U?5:void 0,top:0},children:[u?e.jsx(oe.CartesianGrid,{className:I("stroke-gray-200 stroke-1 dark:stroke-gray-800"),horizontal:!0,vertical:!1}):null,e.jsx(oe.XAxis,{padding:{left:je,right:je},hide:!d,dataKey:i,interval:l?"preserveStartEnd":g,tick:{transform:"translate(0, 6)"},ticks:l?[a[0][i],a[a.length-1][i]]:void 0,fill:"",stroke:"",className:I("text-xs","fill-gray-500 dark:fill-gray-500"),tickLine:!1,axisLine:!1,minTickGap:se,children:ee&&e.jsx(oe.Label,{position:"insideBottom",offset:-20,className:"fill-gray-800 text-sm font-medium dark:fill-gray-200",children:ee})}),e.jsx(oe.YAxis,{width:p,hide:!c,axisLine:!1,tickLine:!1,type:"number",domain:ne,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:I("text-xs","fill-gray-500 dark:fill-gray-500"),tickFormatter:o,allowDecimals:k,children:U&&e.jsx(oe.Label,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-gray-800 text-sm font-medium dark:fill-gray-200",children:U})}),e.jsx(oe.Tooltip,{wrapperStyle:{outline:"none"},isAnimationActive:!0,animationDuration:100,cursor:{stroke:"#d1d5db",strokeWidth:1},offset:20,position:{y:0},content:h?({active:M,payload:me,label:Be})=>e.jsx(Do,{active:M,payload:me,label:Be,valueFormatter:o,categoryColors:J}):e.jsx(e.Fragment,{})}),y?e.jsx(oe.Legend,{verticalAlign:"top",height:Me,content:({payload:M})=>Lo({payload:M},J,Ve,B,St?me=>Hs(me):void 0,q)}):null,r.map(M=>e.jsx(oe.Line,{className:I(dt(J.get(M),"stroke")),strokeOpacity:W||B&&B!==M?.3:1,activeDot:me=>{const{cx:Be,cy:rt,stroke:Yt,strokeLinecap:es,strokeLinejoin:ts,strokeWidth:ss,dataKey:as}=me;return e.jsx(oe.Dot,{className:I("stroke-white dark:stroke-gray-950",P?"cursor-pointer":"",dt(J.get(as),"fill")),cx:Be,cy:rt,r:5,fill:"",stroke:Yt,strokeLinecap:es,strokeLinejoin:ts,strokeWidth:ss,onClick:(kt,Ri)=>Ni(me,Ri)})},dot:me=>{const{stroke:Be,strokeLinecap:rt,strokeLinejoin:Yt,strokeWidth:es,cx:ts,cy:ss,dataKey:as,index:kt}=me;return is(a,M)&&!(W||B&&B!==M)||(W==null?void 0:W.index)===kt&&(W==null?void 0:W.dataKey)===M?e.jsx(oe.Dot,{cx:ts,cy:ss,r:5,stroke:Be,fill:"",strokeLinecap:rt,strokeLinejoin:Yt,strokeWidth:es,className:I("stroke-white dark:stroke-gray-950",P?"cursor-pointer":"",dt(J.get(as),"fill"))},kt):e.jsx(x.Fragment,{},kt)},name:M,type:"linear",dataKey:M,stroke:"",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:!1,connectNulls:j},M)),P?r.map(M=>e.jsx(oe.Line,{className:I("cursor-pointer"),strokeOpacity:0,name:M,type:"linear",dataKey:M,stroke:"transparent",fill:"transparent",legendType:"none",tooltipType:"none",strokeWidth:12,connectNulls:j,onClick:(me,Be)=>{Be.stopPropagation();const{name:rt}=me;Hs(rt)}},M)):null]})})})});Cr.displayName="LineChart";const ve=x.forwardRef(({className:t,checked:s,...a},r)=>e.jsx(Zs.Root,{ref:r,...a,checked:s,className:w("relative inline-flex size-4 shrink-0 appearance-none items-center justify-center rounded shadow-xs outline-hidden ring-1 ring-inset transition duration-100 enabled:cursor-pointer","text-white dark:text-gray-50","bg-white dark:bg-gray-950","ring-gray-300 dark:ring-gray-800","data-disabled:bg-gray-100 data-disabled:text-gray-400 data-disabled:ring-gray-300","dark:data-disabled:bg-gray-800 dark:data-disabled:text-gray-500 dark:data-disabled:ring-gray-700","enabled:data-[state=checked]:bg-blue-600 enabled:data-[state=checked]:ring-0 enabled:data-[state=checked]:ring-transparent","enabled:data-[state=indeterminate]:bg-blue-600 enabled:data-[state=indeterminate]:ring-0 enabled:data-[state=indeterminate]:ring-transparent",ie,t),children:e.jsx(Zs.Indicator,{asChild:!0,className:"flex size-full items-center justify-center",children:s==="indeterminate"?e.jsx("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("line",{stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",x1:"4",x2:"12",y1:"8",y2:"8"})}):e.jsx("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M11.2 5.59998L6.79999 9.99998L4.79999 7.99998",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})})}));ve.displayName="Checkbox";const ot=N.forwardRef(({onClick:t,icon:s,disabled:a,...r},i)=>{const n=s;return e.jsx("button",{ref:i,type:"button",disabled:a,className:w("flex size-8 shrink-0 select-none items-center justify-center rounded border p-1 outline-hidden transition sm:size-[30px]","text-gray-600 hover:text-gray-800","dark:text-gray-400 dark:hover:text-gray-200","border-gray-300 dark:border-gray-800","hover:bg-gray-50 active:bg-gray-100","dark:hover:bg-gray-900 dark:active:bg-gray-800","disabled:pointer-events-none","disabled:border-gray-200 dark:disabled:border-gray-800","disabled:text-gray-400 dark:disabled:text-gray-600",ie),onClick:t,...r,children:e.jsx(n,{className:"size-full shrink-0"})})});ot.displayName="NavigationButton";const Pr=({mode:t="single",weekStartsOn:s=1,numberOfMonths:a=1,enableYearNavigation:r=!1,disableNavigation:i,locale:n,className:o,classNames:l,...d})=>e.jsx(jt.DayPicker,{mode:t,weekStartsOn:s,numberOfMonths:a,locale:n,showOutsideDays:a===1,className:w(o),classNames:{months:"flex space-y-0",month:"space-y-4 p-3",nav:"gap-1 flex items-center rounded-full size-full justify-between p-4",table:"w-full border-collapse space-y-1",head_cell:"w-9 font-medium text-sm sm:text-xs text-center text-gray-400 dark:text-gray-600 pb-2",row:"w-full mt-0.5",cell:w("relative p-0 text-center focus-within:relative","text-gray-900 dark:text-gray-50"),day:w("size-9 rounded text-sm text-gray-900 focus:z-10 dark:text-gray-50","hover:bg-gray-200 dark:hover:bg-gray-700",ie),day_today:"font-semibold",day_selected:w("rounded","aria-selected:bg-blue-600 aria-selected:text-gray-50","dark:aria-selected:bg-blue-500 dark:aria-selected:text-gray-50"),day_disabled:"text-gray-300! dark:text-gray-700! line-through disabled:hover:bg-transparent",day_outside:"text-gray-400 dark:text-gray-600",day_range_middle:w("rounded-none!","aria-selected:bg-gray-100! aria-selected:text-gray-900!","dark:aria-selected:bg-gray-900! dark:aria-selected:text-gray-50!"),day_range_start:"rounded-r-none rounded-l!",day_range_end:"rounded-l-none rounded-r!",day_hidden:"invisible",...l},components:{IconLeft:()=>e.jsx(C.RiArrowLeftSLine,{"aria-hidden":"true",className:"size-4"}),IconRight:()=>e.jsx(C.RiArrowRightSLine,{"aria-hidden":"true",className:"size-4"}),Caption:({...c})=>{const{goToMonth:u,nextMonth:p,previousMonth:g,currentMonth:h,displayMonths:y}=jt.useNavigation(),{numberOfMonths:b,fromDate:f,toDate:S}=jt.useDayPicker(),k=y.findIndex(U=>T.isSameMonth(c.displayMonth,U)),j=k===0,v=k===y.length-1,P=b>1&&(j||!v),q=b>1&&(v||!j),se=()=>{const U=T.addYears(h,-1);g&&(!f||U.getTime()>=f.getTime())&&u(U)},ee=()=>{const U=T.addYears(h,1);p&&(!S||U.getTime()<=S.getTime())&&u(U)};return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[r&&!q&&e.jsx(ot,{disabled:i||!g||f&&T.addYears(h,-1).getTime()<f.getTime(),"aria-label":"Go to previous year",onClick:se,icon:C.RiArrowLeftDoubleLine}),!q&&e.jsx(ot,{disabled:i||!g,"aria-label":"Go to previous month",onClick:()=>g&&u(g),icon:C.RiArrowLeftSLine})]}),e.jsx("div",{role:"presentation","aria-live":"polite",className:"text-sm font-medium capitalize tabular-nums text-gray-900 dark:text-gray-50",children:T.format(c.displayMonth,"LLLL yyy",{locale:n})}),e.jsxs("div",{className:"flex items-center gap-1",children:[!P&&e.jsx(ot,{disabled:i||!p,"aria-label":"Go to next month",onClick:()=>p&&u(p),icon:C.RiArrowRightSLine}),r&&!P&&e.jsx(ot,{disabled:i||!p||S&&T.addYears(h,1).getTime()>S.getTime(),"aria-label":"Go to next year",onClick:ee,icon:C.RiArrowRightDoubleLine})]})]})},Day:({date:c,displayMonth:u})=>{const p=N.useRef(null),{activeModifiers:g,buttonProps:h,divProps:y,isButton:b,isHidden:f}=jt.useDayRender(c,u,p),{selected:S,today:k,disabled:j,range_middle:v}=g;if(f)return e.jsx(e.Fragment,{});if(!b)return e.jsx("div",{...y,className:w("flex items-center justify-center",y.className)});const{children:P,className:q,...se}=h;return e.jsxs("button",{ref:p,...se,type:"button",className:w("relative",q),children:[P,k&&e.jsx("span",{className:w("absolute inset-x-1/2 bottom-1.5 h-0.5 w-4 -translate-x-1/2 rounded-[2px]",{"bg-blue-500 dark:bg-blue-500":!S,"bg-white! dark:bg-gray-950!":S,"bg-gray-400! dark:bg-gray-600!":S&&v,"bg-gray-400 text-gray-400 dark:bg-gray-400 dark:text-gray-600":j})})]})}},...d});Pr.displayName="Calendar";const Mo=()=>{const t=typeof window<"u"?window.navigator.language:"en-US",s=new Intl.DateTimeFormat(t,{hour:"numeric"}).format();return Number.isInteger(Number(s))},Bo=({segment:t,state:s})=>{const a=N.useRef(null),{segmentProps:r}=ua.useDateSegment(t,s,a),i=t.type==="literal"&&t.text===":",n=t.type==="literal"&&t.text===" ",o=i||n;return e.jsxs("div",{...r,ref:a,className:I("relative block w-full appearance-none rounded-md border px-2.5 py-1.5 text-left uppercase tabular-nums shadow-xs outline-hidden transition sm:text-sm","border-gray-300 dark:border-gray-800","text-gray-900 dark:text-gray-50","bg-white dark:bg-gray-950",tt,"invalid:border-red-500 invalid:ring-2 invalid:ring-red-200 group-aria-invalid/time-input:border-red-500 group-aria-invalid/time-input:ring-2 group-aria-invalid/time-input:ring-red-200 dark:group-aria-invalid/time-input:ring-red-400/20",{"w-fit! border-none bg-transparent px-0 text-gray-400 shadow-none":o,hidden:n,"border-gray-300 bg-gray-100 text-gray-400 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-500":s.isDisabled,"bg-transparent! text-gray-400!":!t.isEditable}),children:[e.jsx("span",{"aria-hidden":"true",className:I("pointer-events-none block w-full text-left text-gray-700 sm:text-sm",{hidden:!t.isPlaceholder,"h-0":!t.isPlaceholder}),children:t.placeholder}),t.isPlaceholder?" ":t.text]})},us=N.forwardRef(({hourCycle:t,...s},a)=>{const r=N.useRef(null);N.useImperativeHandle(a,()=>r==null?void 0:r.current);const i=window!==void 0?window.navigator.language:"en-US",n=Mi.useTimeFieldState({hourCycle:t,locale:i,shouldForceLeadingZeros:!0,autoFocus:!0,...s}),{fieldProps:o}=ua.useTimeField({...s,hourCycle:t,shouldForceLeadingZeros:!0},n,r);return e.jsx("div",{...o,ref:r,className:"group/time-input inline-flex w-full gap-x-2",children:n.segments.map((l,d)=>e.jsx(Bo,{segment:l,state:n},d))})});us.displayName="TimeInput";const Jo=Se.tv({base:["peer flex w-full cursor-pointer appearance-none items-center gap-x-2 truncate rounded-md border px-3 py-2 shadow-xs outline-hidden transition-all sm:text-sm","bg-white dark:bg-gray-950","border-gray-300 dark:border-gray-800","text-gray-900 dark:text-gray-50","placeholder-gray-400 dark:placeholder-gray-500","hover:bg-gray-50 dark:hover:bg-gray-950/50","disabled:pointer-events-none","disabled:bg-gray-100 disabled:text-gray-400","dark:disabled:border-gray-800 dark:disabled:bg-gray-800 dark:disabled:text-gray-500",tt],variants:{hasError:{true:$t}}}),Tr=N.forwardRef(({className:t,children:s,placeholder:a,hasError:r,...i},n)=>e.jsx(_.Trigger,{asChild:!0,children:e.jsxs("button",{ref:n,className:I(Jo({hasError:r}),t),...i,children:[e.jsx(C.RiCalendar2Fill,{className:"size-5 shrink-0 text-gray-400 dark:text-gray-600"}),e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left text-gray-900 dark:text-gray-50",children:s||(a?e.jsx("span",{className:"text-gray-400 dark:text-gray-600",children:a}):null)})]})}));Tr.displayName="DatePicker.Trigger";const Qr=N.forwardRef(({align:t,className:s,children:a,...r},i)=>e.jsx(_.Portal,{children:e.jsx(_.Content,{ref:i,sideOffset:10,side:"bottom",align:t,avoidCollisions:!0,onOpenAutoFocus:n=>n.preventDefault(),className:I("relative z-50 w-fit rounded-md border text-sm shadow-xl shadow-black/[2.5%]","min-w-[calc(var(--radix-select-trigger-width)-2px)] max-w-[95vw]","border-gray-200 dark:border-gray-800","bg-white dark:bg-gray-950","will-change-[transform,opacity]","data-[state=closed]:animate-hide","data-[state=open]:data-[side=bottom]:animate-slideDownAndFade data-[state=open]:data-[side=left]:animate-slideLeftAndFade data-[state=open]:data-[side=right]:animate-slideRightAndFade data-[state=open]:data-[side=top]:animate-slideUpAndFade",s),...r,children:a})}));Qr.displayName="DatePicker.CalendarPopover";const zr=({presets:t,onSelect:s,currentValue:a})=>{const r=c=>"dateRange"in c,i=c=>"date"in c,n=c=>{r(c)?s(c.dateRange):i(c)&&s(c.date)},o=(c,u)=>c.getDate()===u.getDate()&&c.getMonth()===u.getMonth()&&c.getFullYear()===u.getFullYear(),l=(c,u)=>{const p=c.from,g=u.from;let h=!1;p&&g&&o(p,g)&&(h=!0);const y=c.to,b=u.to;let f=!1;return y&&b&&o(y,b)&&(f=!0),h&&f},d=c=>{if(r(c)){const u=a;return u&&l(u,c.dateRange)}else if(i(c)){const u=a;return u&&o(u,c.date)}return!1};return e.jsx("ul",{className:"flex items-start gap-x-2 sm:flex-col",children:t.map((c,u)=>e.jsx("li",{className:"sm:w-full sm:py-px",children:e.jsx("button",{title:c.label,className:I("relative w-full overflow-hidden text-ellipsis whitespace-nowrap rounded border px-2.5 py-1.5 text-left text-base shadow-xs outline-hidden transition-all sm:border-none sm:py-2 sm:text-sm sm:shadow-none","text-gray-700 dark:text-gray-300","border-gray-200 dark:border-gray-800",ie,"focus-visible:bg-gray-100 dark:focus-visible:bg-gray-900","hover:bg-gray-100 dark:hover:bg-gray-900",{"bg-gray-100 dark:bg-gray-900":d(c)}),onClick:()=>n(c),"aria-label":`Select ${c.label}`,children:e.jsx("span",{children:c.label})})},u))})};zr.displayName="DatePicker.PresetContainer";const sa=(t,s,a)=>{const r=!Mo();let i;return a?i=r?T.format(t,"dd MMM, yyyy h:mm a",{locale:s}):T.format(t,"dd MMM, yyyy HH:mm",{locale:s}):i=T.format(t,"dd MMM, yyyy",{locale:s}),i},Oo=({defaultValue:t,value:s,onChange:a,presets:r,disabled:i,disableNavigation:n,disabledDays:o,enableYearNavigation:l=!1,locale:d=Bi.enUS,showTimePicker:c,placeholder:u="Select date range",hasError:p,translations:g,align:h="center",className:y,...b})=>{const[f,S]=N.useState(!1),[k,j]=N.useState(s??t??void 0),[v,P]=N.useState(k==null?void 0:k.from),[q,se]=N.useState(s!=null&&s.from?new te.Time(s.from.getHours(),s.from.getMinutes()):t!=null&&t.from?new te.Time(t.from.getHours(),t.from.getMinutes()):new te.Time(0,0)),[ee,U]=N.useState(s!=null&&s.to?new te.Time(s.to.getHours(),s.to.getMinutes()):t!=null&&t.to?new te.Time(t.to.getHours(),t.to.getMinutes()):new te.Time(0,0)),O=N.useMemo(()=>k,[f]);N.useEffect(()=>{j(s??t??void 0)},[s,t]),N.useEffect(()=>{k&&P(k.from)},[k]),N.useEffect(()=>{f||P(k==null?void 0:k.from)},[f]);const je=D=>{const J=D;c&&(J!=null&&J.from&&!q&&se(new te.Time(0,0)),J!=null&&J.to&&!ee&&U(new te.Time(0,0)),J!=null&&J.from&&q&&(J.from.setHours(q.hour),J.from.setMinutes(q.minute)),J!=null&&J.to&&ee&&(J.to.setHours(ee.hour),J.to.setMinutes(ee.minute))),j(J)},Me=()=>{j(O),se(O!=null&&O.from?new te.Time(O.from.getHours(),O.from.getMinutes()):new te.Time(0,0)),U(O!=null&&O.to?new te.Time(O.to.getHours(),O.to.getMinutes()):new te.Time(0,0)),S(!1)},Ve=D=>{D||Me(),S(D)},W=(D,J)=>{switch(J){case"start":se(D);break;case"end":U(D);break}if(k){if(J==="start"){if(!k.from)return;const ne=new Date(k.from.getTime());D?(ne.setHours(D.hour),ne.setMinutes(D.minute)):(ne.setHours(0),ne.setMinutes(0)),j({...k,from:ne})}if(J==="end"){if(!k.to)return;const ne=new Date(k.to.getTime());D?(ne.setHours(D.hour),ne.setMinutes(D.minute)):(ne.setHours(0),ne.setMinutes(0)),j({...k,to:ne})}}};N.useEffect(()=>{j(s??t??void 0),se(s!=null&&s.from?new te.Time(s.from.getHours(),s.from.getMinutes()):t!=null&&t.from?new te.Time(t.from.getHours(),t.from.getMinutes()):new te.Time(0,0)),U(s!=null&&s.to?new te.Time(s.to.getHours(),s.to.getMinutes()):t!=null&&t.to?new te.Time(t.to.getHours(),t.to.getMinutes()):new te.Time(0,0))},[s,t]);const Re=N.useMemo(()=>k?`${k.from?sa(k.from,d,c):""} - ${k.to?sa(k.to,d,c):""}`:null,[k,d,c]),B=()=>{S(!1),a==null||a(k)};return e.jsxs(_.Root,{"tremor-id":"tremor-raw",open:f,onOpenChange:Ve,children:[e.jsx(Tr,{placeholder:u,disabled:i,className:y,hasError:p,"aria-required":b.required||b["aria-required"],"aria-invalid":b["aria-invalid"],"aria-label":b["aria-label"],"aria-labelledby":b["aria-labelledby"],children:Re}),e.jsx(Qr,{align:h,children:e.jsx("div",{className:"flex",children:e.jsxs("div",{className:"flex flex-col overflow-x-auto sm:flex-row sm:items-start",children:[r&&r.length>0&&e.jsx("div",{className:I("relative flex h-16 w-full items-center sm:h-full sm:w-40","border-b border-gray-200 sm:border-b-0 sm:border-r dark:border-gray-800","overflow-auto"),children:e.jsx("div",{className:"absolute px-3 sm:inset-0 sm:left-0 sm:p-2",children:e.jsx(zr,{currentValue:k,presets:r,onSelect:je})})}),e.jsxs("div",{className:"overflow-x-auto",children:[e.jsx(Pr,{mode:"range",selected:k,onSelect:je,month:v,onMonthChange:P,numberOfMonths:2,disabled:o,disableNavigation:n,enableYearNavigation:l,locale:d,initialFocus:!0,classNames:{months:"flex flex-row divide-x divide-gray-200 dark:divide-gray-800 overflow-x-auto"},...b}),c&&e.jsxs("div",{className:"flex items-center justify-evenly gap-x-3 border-t border-gray-200 p-3 dark:border-gray-800",children:[e.jsxs("div",{className:"flex flex-1 items-center gap-x-2",children:[e.jsxs("span",{className:"dark:text-gray-30 text-gray-700",children:[(g==null?void 0:g.start)??"Start",":"]}),e.jsx(us,{value:q,onChange:D=>W(D,"start"),"aria-label":"Start date time",isDisabled:!(k!=null&&k.from),isRequired:b.required})]}),e.jsx(C.RiSubtractFill,{className:"size-4 shrink-0 text-gray-400"}),e.jsxs("div",{className:"flex flex-1 items-center gap-x-2",children:[e.jsxs("span",{className:"dark:text-gray-30 text-gray-700",children:[(g==null?void 0:g.end)??"End",":"]}),e.jsx(us,{value:ee,onChange:D=>W(D,"end"),"aria-label":"End date time",isDisabled:!(k!=null&&k.to),isRequired:b.required})]})]}),e.jsxs("div",{className:"border-t border-gray-200 p-3 sm:flex sm:items-center sm:justify-between dark:border-gray-800",children:[e.jsxs("p",{className:"tabular-nums text-gray-900 dark:text-gray-50",children:[e.jsxs("span",{className:"text-gray-700 dark:text-gray-300",children:[(g==null?void 0:g.range)??"Range",":"]})," ",e.jsx("span",{className:"font-medium",children:Re})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-x-2 sm:mt-0",children:[e.jsx(z,{variant:"secondary",className:"h-8 w-full sm:w-fit",type:"button",onClick:Me,children:(g==null?void 0:g.cancel)??"Cancel"}),e.jsx(z,{variant:"primary",className:"h-8 w-full sm:w-fit",type:"button",onClick:B,children:(g==null?void 0:g.apply)??"Apply"})]})]})]})]})})})]})},Fo=(t,s)=>{const{toYear:a,fromYear:r,fromMonth:i,toMonth:n,fromDay:o,toDay:l}=s;if(t&&t.length>0){const d=r,c=a;t.forEach(u=>{var p,g,h,y,b,f;if("date"in u){const S=u.date.getFullYear();if(r&&S<r)throw new Error(`Preset ${u.label} is before fromYear ${d}.`);if(a&&S>a)throw new Error(`Preset ${u.label} is after toYear ${c}.`);if(i&&u.date.getMonth()<i.getMonth())throw new Error(`Preset ${u.label} is before fromMonth ${i}.`);if(n&&u.date.getMonth()>n.getMonth())throw new Error(`Preset ${u.label} is after toMonth ${n}.`);if(o&&u.date.getDate()<o.getDate())throw new Error(`Preset ${u.label} is before fromDay ${o}.`);if(l&&u.date.getDate()>l.getDate())throw new Error(`Preset ${u.label} is after toDay ${T.format(l,"MMM dd, yyyy")}.`)}if("dateRange"in u){const S=(p=u.dateRange.from)==null?void 0:p.getFullYear(),k=(g=u.dateRange.to)==null?void 0:g.getFullYear();if(S&&r&&S<r)throw new Error(`Preset ${u.label}'s 'from' is before fromYear ${d}.`);if(k&&a&&k>a)throw new Error(`Preset ${u.label}'s 'to' is after toYear ${c}.`);if(i){const j=(h=u.dateRange.from)==null?void 0:h.getMonth();if(j&&j<i.getMonth())throw new Error(`Preset ${u.label}'s 'from' is before fromMonth ${T.format(i,"MMM, yyyy")}.`)}if(n){const j=(y=u.dateRange.to)==null?void 0:y.getMonth();if(j&&j>n.getMonth())throw new Error(`Preset ${u.label}'s 'to' is after toMonth ${T.format(n,"MMM, yyyy")}.`)}if(o){const j=(b=u.dateRange.from)==null?void 0:b.getDate();if(j&&j<o.getDate())throw new Error(`Preset ${u.dateRange.from}'s 'from' is before fromDay ${T.format(o,"MMM dd, yyyy")}.`)}if(l){const j=(f=u.dateRange.to)==null?void 0:f.getDate();if(j&&j>l.getDate())throw new Error(`Preset ${u.label}'s 'to' is after toDay ${T.format(l,"MMM dd, yyyy")}.`)}}})}},Ir=({presets:t,...s})=>(t&&Fo(t,s),e.jsx(Oo,{presets:t,...s}));Ir.displayName="DateRangePicker";const xt=t=>e.jsx(Z.Root,{...t});xt.displayName="Dialog";const Ts=Z.Trigger;Ts.displayName="DialogTrigger";const Et=Z.Close;Et.displayName="DialogClose";const Lr=Z.Portal;Lr.displayName="DialogPortal";const Er=x.forwardRef(({className:t,...s},a)=>e.jsx(Z.Overlay,{ref:a,className:w("fixed inset-0 z-50 overflow-y-auto","bg-black/70","data-[state=open]:animate-dialogOverlayShow",t),...s}));Er.displayName="DialogOverlay";const ft=x.forwardRef(({className:t,...s},a)=>e.jsx(Lr,{children:e.jsx(Er,{children:e.jsx(Z.Content,{ref:a,className:w("fixed left-1/2 top-1/2 z-50 w-[95vw] max-w-lg -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-md border p-6 shadow-lg","border-gray-200 dark:border-gray-900","bg-white dark:bg-[#090E1A]","data-[state=open]:animate-dialogContentShow",ie,t),...s})})}));ft.displayName="DialogContent";const yt=({className:t,...s})=>e.jsx("div",{className:w("flex flex-col gap-y-1",t),...s});yt.displayName="DialogHeader";const wt=x.forwardRef(({className:t,...s},a)=>e.jsx(Z.Title,{ref:a,className:w("text-lg font-semibold","text-gray-900 dark:text-gray-50",t),...s}));wt.displayName="DialogTitle";const bt=x.forwardRef(({className:t,...s},a)=>e.jsx(Z.Description,{ref:a,className:w("text-gray-500 dark:text-gray-500",t),...s}));bt.displayName="DialogDescription";const Dr=({className:t,...s})=>e.jsx("div",{className:w("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});Dr.displayName="DialogFooter";const be=N.forwardRef(({className:t,disabled:s,...a},r)=>e.jsx(pa.Root,{ref:r,className:I("text-sm leading-none","text-gray-900 dark:text-gray-50",{"text-gray-400 dark:text-gray-600":s},t),"aria-disabled":s,...a}));be.displayName="Label";const Mr=G.Root;Mr.displayName="Select";const Vo=G.Group;Vo.displayName="SelectGroup";const Br=G.Value;Br.displayName="SelectValue";const Ho=[w("group/trigger flex w-full select-none items-center justify-between gap-2 truncate rounded-md border px-3 py-2 shadow-xs outline-hidden transition sm:text-sm","border-gray-300 dark:border-gray-800","text-gray-900 dark:text-gray-50","data-placeholder:text-gray-500 dark:data-placeholder:text-gray-500","bg-white dark:bg-gray-950","hover:bg-gray-50 dark:hover:bg-gray-950/50","data-disabled:bg-gray-100 data-disabled:text-gray-400","dark:data-disabled:border-gray-700 dark:data-disabled:bg-gray-800 dark:data-disabled:text-gray-500",tt)],Jr=x.forwardRef(({className:t,hasError:s,children:a,...r},i)=>e.jsxs(G.Trigger,{ref:i,className:w(Ho,s?$t:"",t),...r,children:[e.jsx("span",{className:"truncate",children:a}),e.jsx(G.Icon,{asChild:!0,children:e.jsx(C.RiArrowDownSLine,{className:w("-mr-1 size-5 shrink-0","text-gray-400 dark:text-gray-600","group-data-disabled/trigger:text-gray-300 dark:group-data-disabled/trigger:text-gray-600")})})]}));Jr.displayName="SelectTrigger";const Or=x.forwardRef(({className:t,...s},a)=>e.jsx(G.ScrollUpButton,{ref:a,className:w("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(C.RiArrowUpSLine,{className:"size-3 shrink-0","aria-hidden":"true"})}));Or.displayName=G.ScrollUpButton.displayName;const Fr=x.forwardRef(({className:t,...s},a)=>e.jsx(G.ScrollDownButton,{ref:a,className:w("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(C.RiArrowDownSLine,{className:"size-3 shrink-0","aria-hidden":"true"})}));Fr.displayName=G.ScrollDownButton.displayName;const Vr=x.forwardRef(({className:t,position:s="popper",children:a,sideOffset:r=8,collisionPadding:i=10,...n},o)=>e.jsx(G.Portal,{children:e.jsxs(G.Content,{ref:o,className:w("relative z-50 overflow-hidden rounded-md border shadow-xl shadow-black/[2.5%]","min-w-[calc(var(--radix-select-trigger-width)-2px)] max-w-[95vw]","max-h-(--radix-select-content-available-height)","bg-white dark:bg-gray-950","text-gray-900 dark:text-gray-50","border-gray-200 dark:border-gray-800","will-change-[transform,opacity]","data-[state=closed]:animate-hide","data-[side=bottom]:animate-slideDownAndFade data-[side=left]:animate-slideLeftAndFade data-[side=right]:animate-slideRightAndFade data-[side=top]:animate-slideUpAndFade",t),sideOffset:r,position:s,collisionPadding:i,...n,children:[e.jsx(Or,{}),e.jsx(G.Viewport,{className:w("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[calc(var(--radix-select-trigger-width))]"),children:a}),e.jsx(Fr,{})]})}));Vr.displayName="SelectContent";const Zo=x.forwardRef(({className:t,...s},a)=>e.jsx(G.Label,{ref:a,className:w("px-3 py-2 text-xs font-medium tracking-wide","text-gray-500 dark:text-gray-500",t),...s}));Zo.displayName="SelectGroupLabel";const Uo=x.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(G.Item,{ref:r,className:w("grid cursor-pointer grid-cols-[1fr_20px] gap-x-2 rounded px-3 py-2 outline-hidden transition-colors data-[state=checked]:font-semibold sm:text-sm","text-gray-900 dark:text-gray-50","data-disabled:pointer-events-none data-disabled:text-gray-400 data-disabled:hover:bg-none dark:data-disabled:text-gray-600","focus-visible:bg-gray-100 dark:focus-visible:bg-gray-900","hover:bg-gray-100 dark:hover:bg-gray-900",t),...a,children:[e.jsx(G.ItemText,{className:"flex-1 truncate",children:s}),e.jsx(G.ItemIndicator,{children:e.jsx(C.RiCheckLine,{className:"size-5 shrink-0 text-gray-800 dark:text-gray-200","aria-hidden":"true"})})]}));Uo.displayName="SelectItem";const Hr=x.forwardRef(({className:t,children:s,period:a,...r},i)=>e.jsxs(G.Item,{ref:i,className:w("relative flex cursor-pointer items-center rounded py-2 pl-8 pr-3 outline-hidden transition-colors data-[state=checked]:font-semibold sm:text-sm","text-gray-900 dark:text-gray-50","data-disabled:pointer-events-none data-disabled:text-gray-400 data-disabled:hover:bg-none dark:data-disabled:text-gray-600","focus-visible:bg-gray-100 dark:focus-visible:bg-gray-900","hover:bg-gray-100 dark:hover:bg-gray-900",t),...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(G.ItemIndicator,{children:e.jsx(C.RiCheckLine,{className:"size-5 shrink-0 text-gray-800 dark:text-gray-200","aria-hidden":"true"})})}),e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx("span",{className:"w-40 sm:w-32",children:e.jsx(G.ItemText,{children:s})}),e.jsx("span",{children:(a==null?void 0:a.from)&&(a==null?void 0:a.to)&&e.jsxs("span",{className:"whitespace-nowrap font-normal text-gray-400",children:[T.format(a.from,"MMM d, yyyy")," –"," ",T.format(a.to,"MMM d, yyyy")]})})]})]}));Hr.displayName="SelectItemPeriod";const Wo=x.forwardRef(({className:t,...s},a)=>e.jsx(G.Separator,{ref:a,className:w("-mx-1 my-1 h-px","bg-gray-300 dark:bg-gray-700",t),...s}));Wo.displayName="SelectSeparator";const _o=[{value:"previous-period",label:"Previous period"},{value:"last-year",label:"Last year"},{value:"no-comparison",label:"No comparison"}],Zr=(t,s)=>{const{from:a,to:r}=t||{};switch(s){case"previous-period":{let i,n;if(a&&r){const o=T.interval(a,r),l=T.eachDayOfInterval(o).length;n=T.subDays(a,1),i=T.subDays(n,l)}return{from:i,to:n}}case"last-year":{let i,n;return a&&(i=T.subYears(a,1)),r&&(n=T.subYears(r,1)),{from:i,to:n}}default:return t}};function qo({maxDate:t,minDate:s,selectedDates:a,onDatesChange:r,selectedPeriod:i,onPeriodChange:n,categories:o,setSelectedCategories:l,selectedCategories:d}){const[c,u]=x.useState(d),p=h=>{u(y=>y.includes(h)?y.filter(b=>b!==h):[...y,h])},g=()=>{l(c)};return e.jsxs("div",{className:"flex w-full justify-between",children:[e.jsxs("div",{className:"w-full sm:flex sm:items-center sm:gap-2",children:[e.jsx(Ir,{value:a,onChange:r,className:"w-full sm:w-fit",toDate:t,fromDate:s,align:"start"}),e.jsx("span",{className:"hidden text-sm font-medium text-gray-500 sm:block",children:"compared to"}),e.jsxs(Mr,{defaultValue:"no-comparison",value:i,onValueChange:h=>{n(h)},children:[e.jsx(Jr,{className:"mt-2 w-full sm:mt-0 sm:w-fit",children:e.jsx(Br,{})}),e.jsx(Vr,{children:_o.map(h=>e.jsx(Hr,{value:h.value,period:Zr(a,h.value),children:h.label},h.value))})]})]}),e.jsxs(xt,{children:[e.jsx(Ts,{asChild:!0,children:e.jsxs(z,{variant:"secondary",className:"hidden gap-2 px-2 py-1 sm:flex",children:[e.jsx(C.RiSettings5Line,{className:"-ml-0.5 size-4 shrink-0","aria-hidden":"true"}),e.jsx("span",{children:"Edit"})]})}),e.jsxs(ft,{className:"max-w-5xl",children:[e.jsxs(yt,{children:[e.jsx(wt,{children:"Customise overview charts"}),e.jsx(bt,{className:"sr-only",children:"Add or remove the charts for the overview panel."})]}),e.jsx("div",{className:w("mt-8 grid max-h-[70vh] grid-cols-1 gap-4 overflow-y-scroll sm:grid-cols-1 md:grid-cols-2 xl:grid-cols-3"),children:o.map(h=>e.jsxs(be,{htmlFor:h.title,className:"relative cursor-pointer rounded-md border border-gray-200 p-4 shadow-xs dark:border-gray-800",children:[e.jsx(ve,{id:h.title,className:"absolute right-4",checked:c.includes(h.title),onCheckedChange:()=>p(h.title)}),e.jsx("div",{className:"pointer-events-none",children:e.jsx(Wr,{title:h.title,type:h.type,selectedDates:a,selectedPeriod:i,isThumbnail:!0})})]},h.title))}),e.jsxs(Dr,{className:"mt-6",children:[e.jsx(Et,{asChild:!0,children:e.jsx(z,{className:"mt-2 w-full sm:mt-0 sm:w-fit",variant:"secondary",children:"Cancel"})}),e.jsx(Et,{asChild:!0,children:e.jsx(z,{className:"w-full sm:w-fit",onClick:g,children:"Apply"})})]})]})]})]})}const $o={currency:Ys.currency,unit:Ys.unit},Ur=t=>t>0?"success":t<0?t<-50?"warning":"error":"neutral";function Wr({title:t,type:s,selectedDates:a,selectedPeriod:r,isThumbnail:i}){const n=$o[s],o=a!=null&&a.from&&(a!=null&&a.to)?T.interval(a.from,a.to):null,l=a!=null&&a.from&&(a!=null&&a.to)?T.eachDayOfInterval(T.interval(a.from,a.to)):null,d=Zr(a,r),c=d!=null&&d.from&&(d!=null&&d.to)?T.interval(d.from,d.to):null,u=cs.filter(S=>o?T.isWithinInterval(S.date,o):!0).sort((S,k)=>new Date(S.date).getTime()-new Date(k.date).getTime()),p=cs.filter(S=>c?T.isWithinInterval(S.date,c):!1).sort((S,k)=>new Date(S.date).getTime()-new Date(k.date).getTime()),g=l==null?void 0:l.map((S,k)=>{const j=u[k],v=p[k],P=(j==null?void 0:j[t])||null,q=(v==null?void 0:v[t])||null;return{title:t,date:S,formattedDate:T.formatDate(S,"dd/MM/yyyy"),value:P,previousDate:v==null?void 0:v.date,previousFormattedDate:v?T.formatDate(v.date,"dd/MM/yyyy"):null,previousValue:r!=="no-comparison"?q:null,evolution:r!=="no-comparison"&&P&&q?(P-q)/q:void 0}}).sort((S,k)=>new Date(S.date).getTime()-new Date(k.date).getTime()),h=r==="no-comparison"?["value"]:["value","previousValue"],y=(g==null?void 0:g.reduce((S,k)=>S+(k.value||0),0))||0,b=(g==null?void 0:g.reduce((S,k)=>S+(k.previousValue||0),0))||0,f=r!=="no-comparison"?(y-b)/b:0;return e.jsxs("div",{className:I("transition"),children:[e.jsx("div",{className:"flex items-center justify-between gap-x-2",children:e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx("dt",{className:"font-bold text-gray-900 sm:text-sm dark:text-gray-50",children:t}),r!=="no-comparison"&&e.jsx(ht,{variant:Ur(f),children:kr(f)})]})}),e.jsxs("div",{className:"mt-2 flex items-baseline justify-between",children:[e.jsx("dd",{className:"text-xl text-gray-900 dark:text-gray-50",children:n(y)}),r!=="no-comparison"&&e.jsxs("dd",{className:"text-sm text-gray-500",children:["from ",n(b)]})]}),e.jsx(Cr,{className:"mt-6 h-32",data:g||[],index:"formattedDate",colors:["fuchsia","gray"],startEndOnly:!0,valueFormatter:S=>n(S),showYAxis:!1,showLegend:!1,categories:h,showTooltip:!i,autoMinValue:!0})]})}const Go=Se.tv({slots:{background:"",bar:""},variants:{variant:{default:{background:"bg-blue-100 dark:bg-blue-500/30",bar:"bg-blue-600 dark:bg-blue-500"},neutral:{background:"bg-gray-200 dark:bg-gray-500/40",bar:"bg-gray-500 dark:bg-gray-500"},warning:{background:"bg-yellow-200 dark:bg-yellow-500/30",bar:"bg-yellow-500 dark:bg-yellow-500"},error:{background:"bg-red-200 dark:bg-red-500/30",bar:"bg-red-500 dark:bg-red-500"},success:{background:"bg-emerald-200 dark:bg-emerald-500/30",bar:"bg-emerald-500 dark:bg-emerald-500"}}},defaultVariants:{variant:"default"}}),_r=x.forwardRef(({value:t=0,max:s=100,label:a,showAnimation:r=!1,variant:i,className:n,...o},l)=>{const d=Math.min(s,Math.max(t,0)),{background:c,bar:u}=Go({variant:i});return e.jsxs("div",{ref:l,className:w("flex w-full items-center",n),...o,children:[e.jsx("div",{className:w("relative flex h-2 w-full items-center rounded-full",c()),"aria-label":"progress bar","aria-valuenow":t,"aria-valuemax":s,children:e.jsx("div",{className:w("h-full flex-col rounded-full",u(),r&&"transform-gpu transition-all duration-300 ease-in-out"),style:{width:s?`${d/s*100}%`:`${d}%`}})}),a?e.jsx("span",{className:w("ml-2 whitespace-nowrap text-sm font-medium leading-none","text-gray-900 dark:text-gray-50"),children:a}):null]})});_r.displayName="ProgressBar";function aa({title:t,change:s,value:a,valueDescription:r,ctaDescription:i,ctaText:n,ctaLink:o,data:l}){return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("dt",{className:"font-bold text-gray-900 sm:text-sm dark:text-gray-50",children:t}),e.jsx(ht,{variant:"neutral",children:s})]}),e.jsxs("dd",{className:"mt-2 flex items-baseline gap-2",children:[e.jsx("span",{className:"text-xl text-gray-900 dark:text-gray-50",children:a}),e.jsx("span",{className:"text-sm text-gray-500",children:r})]}),e.jsx("ul",{role:"list",className:"mt-4 space-y-5",children:l.map(d=>e.jsxs("li",{children:[e.jsxs("p",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-50",children:d.title}),e.jsxs("span",{className:"font-medium text-gray-900 dark:text-gray-50",children:[d.current,e.jsxs("span",{className:"font-normal text-gray-500",children:["/",d.allowed,d.unit]})]})]}),e.jsx(_r,{value:d.percentage,className:"mt-2 *:h-1.5"})]},d.title))})]}),e.jsx("div",{children:e.jsxs("p",{className:"mt-6 text-xs text-gray-500",children:[i," ",e.jsx("a",{href:o,className:"text-blue-600 dark:text-blue-400",children:n})]})})]})})}const ns=[{title:"Rows read",type:"unit"},{title:"Rows written",type:"unit"},{title:"Queries",type:"unit"},{title:"Payments completed",type:"currency"},{title:"Sign ups",type:"unit"},{title:"Logins",type:"unit"},{title:"Sign outs",type:"unit"},{title:"Support calls",type:"unit"}],Ko=[{title:"Rows read",percentage:48.1,current:48.1,allowed:100,unit:"M"},{title:"Rows written",percentage:78.3,current:78.3,allowed:100,unit:"M"},{title:"Storage",percentage:26,current:5.2,allowed:20,unit:"GB"}],Xo=[{title:"Weekly active users",percentage:21.7,current:21.7,allowed:100,unit:"%"},{title:"Total users",percentage:70,current:28,allowed:40},{title:"Uptime",percentage:98.3,current:98.3,allowed:100,unit:"%"}],Yo=[{title:"Base tier",percentage:68.1,value:"$200",color:"bg-blue-600 dark:bg-blue-500"},{title:"On-demand charges",percentage:20.8,value:"$61.1",color:"bg-purple-600 dark:bg-purple-500"},{title:"Caching",percentage:11.1,value:"$31.9",color:"bg-gray-400 dark:bg-gray-600"}],el=cs.map(t=>T.toDate(t.date).getTime()),os=T.toDate(Math.max(...el));function tl(){const[t,s]=x.useState({from:T.subDays(os,30),to:os}),[a,r]=x.useState("last-year"),[i,n]=x.useState(ns.map(o=>o.title));return e.jsxs(e.Fragment,{children:[e.jsxs("section",{"aria-labelledby":"current-billing-cycle",children:[e.jsx("h1",{id:"current-billing-cycle",className:"scroll-mt-10 text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Current billing cycle"}),e.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-14 sm:mt-8 sm:grid-cols-2 lg:mt-10 xl:grid-cols-3",children:[e.jsx(aa,{title:"Usage",change:"+0.2%",value:"68.1%",valueDescription:"of allowed capacity",ctaDescription:"Monthly usage resets in 12 days.",ctaText:"Manage plan.",ctaLink:"#",data:Ko}),e.jsx(aa,{title:"Workspace",change:"+2.9%",value:"21.7%",valueDescription:"weekly active users",ctaDescription:"Add up to 20 members in free plan.",ctaText:"Invite users.",ctaLink:"#",data:Xo}),e.jsx(Po,{title:"Costs",change:"-1.4%",value:"$293.5",valueDescription:"current billing cycle",subtitle:"Current costs",ctaDescription:"Set hard caps in",ctaText:"cost spend management.",ctaLink:"#",data:Yo})]})]}),e.jsxs("section",{"aria-labelledby":"usage-overview",children:[e.jsx("h1",{id:"usage-overview",className:"mt-16 scroll-mt-8 text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Overview"}),e.jsx("div",{className:"sticky top-16 z-20 flex items-center justify-between border-b border-gray-200 bg-white pb-4 pt-4 sm:pt-6 lg:top-0 lg:mx-0 lg:px-0 lg:pt-8 dark:border-gray-800 dark:bg-gray-950",children:e.jsx(qo,{maxDate:os,minDate:new Date(2024,0,1),selectedDates:t,onDatesChange:o=>s(o),selectedPeriod:a,onPeriodChange:o=>r(o),categories:ns,setSelectedCategories:n,selectedCategories:i})}),e.jsx("dl",{className:w("mt-10 grid grid-cols-1 gap-14 sm:grid-cols-1 md:grid-cols-2 xl:grid-cols-3"),children:ns.filter(o=>i.includes(o.title)).map(o=>e.jsx(Wr,{title:o.title,type:o.type,selectedDates:t,selectedPeriod:a},o.title))})]})]})}const qr=(t,s,a)=>{if(t==null)return a;const r=Array.isArray(s)?s:s.replace(/\[(\d+)\]/g,".$1").split(".").filter(Boolean);let i=t;for(let n=0;n<r.length;n++){const o=r[n];if(i==null||!(o in i))return a;i=i[o]}return i===void 0?a:i},$=x.forwardRef(({className:t,children:s,...a},r)=>e.jsx("div",{ref:r,className:w("mx-auto my-6 flex w-full items-center justify-between gap-3 text-sm col-span-full","text-gray-500 dark:text-gray-500",t),...a,children:s?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:w("h-[1px] w-full","bg-gray-200 dark:bg-gray-800")}),e.jsx("div",{className:"whitespace-nowrap text-inherit",children:s}),e.jsx("div",{className:w("h-[1px] w-full","bg-gray-200 dark:bg-gray-800")})]}):e.jsx("div",{className:w("h-[0.5px] w-full","bg-gray-200 dark:bg-gray-800")})}));$.displayName="Divider";const ra=[{continent:"America",items:[{value:"US",label:"United States",flag:"🇺🇸"},{value:"CA",label:"Canada",flag:"🇨🇦"},{value:"MX",label:"Mexico",flag:"🇲🇽"},{value:"BR",label:"Brazil",flag:"🇧🇷"},{value:"AR",label:"Argentina",flag:"🇦🇷"},{value:"CO",label:"Colombia",flag:"🇨🇴"},{value:"CL",label:"Chile",flag:"🇨🇱"},{value:"PE",label:"Peru",flag:"🇵🇪"}]},{continent:"Europe",items:[{value:"GB",label:"United Kingdom",flag:"🇬🇧"},{value:"FR",label:"France",flag:"🇫🇷"},{value:"DE",label:"Germany",flag:"🇩🇪"},{value:"PL",label:"Poland",flag:"🇵🇱"},{value:"IT",label:"Italy",flag:"🇮🇹"},{value:"ES",label:"Spain",flag:"🇪🇸"},{value:"NL",label:"Netherlands",flag:"🇳🇱"},{value:"PT",label:"Portugal",flag:"🇵🇹"},{value:"SE",label:"Sweden",flag:"🇸🇪"},{value:"NO",label:"Norway",flag:"🇳🇴"},{value:"DK",label:"Denmark",flag:"🇩🇰"},{value:"FI",label:"Finland",flag:"🇫🇮"},{value:"CH",label:"Switzerland",flag:"🇨🇭"},{value:"IE",label:"Ireland",flag:"🇮🇪"},{value:"BE",label:"Belgium",flag:"🇧🇪"},{value:"AT",label:"Austria",flag:"🇦🇹"},{value:"GR",label:"Greece",flag:"🇬🇷"}]},{continent:"Asia",items:[{value:"CN",label:"China",flag:"🇨🇳"},{value:"JP",label:"Japan",flag:"🇯🇵"},{value:"IN",label:"India",flag:"🇮🇳"},{value:"KR",label:"South Korea",flag:"🇰🇷"},{value:"SG",label:"Singapore",flag:"🇸🇬"},{value:"MY",label:"Malaysia",flag:"🇲🇾"},{value:"ID",label:"Indonesia",flag:"🇮🇩"},{value:"TH",label:"Thailand",flag:"🇹🇭"},{value:"VN",label:"Vietnam",flag:"🇻🇳"},{value:"AE",label:"United Arab Emirates",flag:"🇦🇪"},{value:"SA",label:"Saudi Arabia",flag:"🇸🇦"}]},{continent:"Oceania",items:[{value:"AU",label:"Australia",flag:"🇦🇺"},{value:"NZ",label:"New Zealand",flag:"🇳🇿"},{value:"FJ",label:"Fiji",flag:"🇫🇯"},{value:"PG",label:"Papua New Guinea",flag:"🇵🇬"}]},{continent:"Africa",items:[{value:"ZA",label:"South Africa",flag:"🇿🇦"},{value:"NG",label:"Nigeria",flag:"🇳🇬"},{value:"MA",label:"Morocco",flag:"🇲🇦"},{value:"EG",label:"Egypt",flag:"🇪🇬"},{value:"KE",label:"Kenya",flag:"🇰🇪"},{value:"GH",label:"Ghana",flag:"🇬🇭"},{value:"ET",label:"Ethiopia",flag:"🇪🇹"}]}],Qs=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command,{ref:a,className:w("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...s}));Qs.displayName=V.Command.displayName;const zs=N.forwardRef(({className:t,...s},a)=>e.jsxs("div",{className:"flex items-center border-b pl-3","cmdk-input-wrapper":"",children:[e.jsx(A.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(V.Command.Input,{ref:a,className:w("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...s})]}));zs.displayName=V.Command.Input.displayName;const Is=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.List,{ref:a,className:w("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...s}));Is.displayName=V.Command.List.displayName;const Ls=N.forwardRef((t,s)=>e.jsx(V.Command.Empty,{ref:s,className:"py-6 text-center text-sm",...t}));Ls.displayName=V.Command.Empty.displayName;const Es=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.Group,{ref:a,className:w("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...s}));Es.displayName=V.Command.Group.displayName;const sl=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.Separator,{ref:a,className:w("-mx-1 h-px bg-border",t),...s}));sl.displayName=V.Command.Separator.displayName;const Ds=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.Item,{ref:a,className:w("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...s}));Ds.displayName=V.Command.Item.displayName;const Ms=t=>e.jsx(_.Root,{...t});Ms.displayName="Popover";const Bs=N.forwardRef((t,s)=>e.jsx(_.Trigger,{ref:s,...t}));Bs.displayName="PopoverTrigger";const al=N.forwardRef((t,s)=>e.jsx(_.Anchor,{ref:s,...t}));al.displayName="PopoverAnchor";const rl=N.forwardRef((t,s)=>e.jsx(_.Close,{ref:s,...t}));rl.displayName="PopoverClose";const Js=N.forwardRef(({className:t,sideOffset:s=10,side:a="bottom",align:r="center",collisionPadding:i,...n},o)=>e.jsx(_.Portal,{children:e.jsx(_.Content,{ref:o,sideOffset:s,side:a,align:r,collisionPadding:i,avoidCollisions:!0,className:I("max-h-[var(--radix-popper-available-height)] min-w-60 overflow-hidden rounded-md border p-2.5 text-sm shadow-md","border-gray-200 dark:border-gray-800","text-gray-900 dark:text-gray-50","bg-white dark:bg-gray-950","will-change-[transform,opacity]","data-[state=closed]:animate-hide","data-[state=open]:data-[side=bottom]:animate-slideDownAndFade data-[state=open]:data-[side=left]:animate-slideLeftAndFade data-[state=open]:data-[side=right]:animate-slideRightAndFade data-[state=open]:data-[side=top]:animate-slideUpAndFade",t),onWheel:l=>{l.stopPropagation(),l.deltaY>0?l.currentTarget.dispatchEvent(new KeyboardEvent("keydown",{key:"ArrowDown"})):l.currentTarget.dispatchEvent(new KeyboardEvent("keydown",{key:"ArrowUp"}))},...n})}));Js.displayName="PopoverContent";const il=({value:t,onChange:s})=>{const a=x.useId(),[r,i]=x.useState(!1),n=ra.map(o=>o.items.find(l=>l.value===t)).filter(Boolean)[0];return e.jsx("div",{className:"mt-2",children:e.jsxs(Ms,{open:r,onOpenChange:i,children:[e.jsx(Bs,{asChild:!0,children:e.jsxs(z,{id:a,role:"combobox","aria-expanded":r,variant:"secondary",className:"w-full justify-between shadow-xs! bg-background px-3 py-2.5 font-normal outline-offset-0 hover:bg-background focus-visible:border-ring focus-visible:outline-[3px] focus-visible:outline-ring/20",children:[t?e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"text-lg leading-none",children:n==null?void 0:n.flag}),e.jsx("span",{className:"truncate",children:n==null?void 0:n.label})]}):e.jsx("span",{className:"text-muted-foreground",children:"Select country"}),e.jsx(A.ChevronDown,{size:16,strokeWidth:2,className:"shrink-0 text-muted-foreground/80","aria-hidden":"true"})]})}),e.jsx(Js,{className:"w-full min-w-[var(--radix-popper-anchor-width)] border-input -mt-1 z-50",align:"start",children:e.jsxs(Qs,{className:"p-0",children:[e.jsx(zs,{className:"w-full border-none",style:{boxShadow:"none"},placeholder:"Search country..."}),e.jsxs(Is,{children:[e.jsx(Ls,{children:"No country found."}),ra.map(o=>e.jsx(x.Fragment,{children:e.jsx(Es,{heading:o.continent,children:o.items.map(l=>e.jsxs(Ds,{value:l.label,className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800",onSelect:()=>{s(l.value??""),i(!1)},children:[e.jsx("span",{className:"text-lg leading-none",children:l.flag})," ",l.label,t===l.value&&e.jsx(A.Check,{size:16,strokeWidth:2,className:"ml-auto"})]},l.value))})},o.continent))]})]})})]})})},nl=Se.tv({base:["relative block w-full rounded-lg border px-2.5 py-2.5 shadow-xs outline-hidden transition sm:text-sm","border-gray-200 dark:border-gray-800","text-gray-900 dark:text-gray-50","placeholder-gray-400 dark:placeholder-gray-500","bg-white dark:bg-gray-950","disabled:border-gray-300 disabled:bg-gray-100 disabled:text-gray-400","dark:disabled:border-gray-700 dark:disabled:bg-gray-800 dark:disabled:text-gray-500",tt],variants:{hasError:{true:$t},enableStepper:{false:"[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none"},multiline:{true:"resize-y min-h-[100px]",false:"truncate appearance-none"}}}),he=x.forwardRef(({className:t,inputClassName:s,hasError:a,enableStepper:r=!0,type:i,multiline:n=!1,prefix:o,suffix:l,...d},c)=>{const[u,p]=x.useState(i),g=i==="password"&&!n,h=i==="search"&&!n,y=i==="textarea"?"textarea":"input";return e.jsxs("div",{className:w("relative w-full",t),children:[o&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center px-3 text-slate-600 dark:text-gray-600 z-10 text-sm border-r border-gray-200",children:o}),e.jsx(y,{ref:c,type:g?u:i,className:w(nl({hasError:a,enableStepper:n?!1:r,multiline:n}),{"pl-16":o,"pl-8":!o&&h,"pr-10":l||!l&&g},s),...d}),!o&&h&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2 text-gray-400 dark:text-gray-600",children:e.jsx(C.RiSearchLine,{className:"size-[1.125rem]"})}),l&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2 text-gray-400 dark:text-gray-600",children:l}),!l&&g&&e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx("button",{onClick:()=>p(u==="password"?"text":"password"),className:w(ie,"text-gray-400 hover:text-gray-500 dark:text-gray-600"),children:u==="password"?e.jsx(C.RiEyeFill,{className:"size-5"}):e.jsx(C.RiEyeOffFill,{className:"size-5"})})})]})});he.displayName="Input";const ol=({...t})=>{const s=x.useId();return e.jsx("div",{className:"mt-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(he,{id:s,type:"email",inputClassName:"peer ps-9",...t}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 start-0 flex items-center justify-center ps-3 text-muted-foreground/80 peer-disabled:opacity-50",children:e.jsx(A.AtSign,{size:16,strokeWidth:2,"aria-hidden":"true"})})]})})},ll=t=>{const{client:s}=E(),[a,r]=x.useState(!1),[i,n]=x.useState(0),o=async u=>{const{body:p,status:g}=await s.file.createTemporaryFile({body:{filename:u.name,mimeType:u.type,size:u.size,organizationId:t.organizationId}});if(g!==201)throw new Error("Failed to create temporary file");const h=await ia.upload(u.name,u,{access:"public",handleUploadUrl:`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/files/token/vercel`,clientPayload:JSON.stringify({fileId:p==null?void 0:p.id}),onUploadProgress(y){n(y.percentage)}});return{id:p.id,filename:u.name,mimeType:u.type,size:u.size,url:h.url}},l=async u=>{var p;if((p=u.target.files)!=null&&p[0]){r(!0);try{const g=await o(u.target.files[0]);if(t.multiple){const h=t.value??[];t.onChange([...h,g])}else t.onChange(g)}catch(g){console.error(g)}finally{r(!1)}}},d=u=>{if(t.multiple){if(!t.value)return t.onChange(void 0);const p=t.value.filter(g=>g.id!==u);t.onChange(p.length?p:void 0)}else t.onChange(void 0)},c=()=>{if(t.value){const u=t.multiple?t.value:[t.value];return e.jsxs("div",{className:"flex",children:[u.map(p=>e.jsx("div",{className:"flex flex-col w-40 h-40 mr-3 transition-all rounded-lg relative animate-fade",children:e.jsxs("div",{className:"relative h-full w-40",children:[e.jsx("button",{className:"absolute w-6 h-6 bg-black flex items-center justify-center rounded-md right-1 top-1",onClick:()=>d(p.id),children:e.jsx(A.XIcon,{className:"w-4 h-4 text-white"})}),e.jsx(xe,{src:p.url,alt:p.filename,width:160,height:160,className:"w-40 h-40 rounded-md object-cover"})]})},p.id)),t.multiple&&e.jsxs("div",{className:"group flex relative flex-col w-40 h-40 items-center justify-center cursor-pointer border-2 border-gray-200 border-dashed transition-all rounded-lg hover:bg-gray-100 hover:border-gray-300",children:[e.jsx("div",{className:"flex flex-col items-center justify-center",children:a?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"animate-spin w-4 h-4 fill-current shrink-0 mb-2",viewBox:"0 0 16 16",children:e.jsx("path",{d:"M8 16a7.928 7.928 0 01-3.428-.77l.857-1.807A6.006 6.006 0 0014 8c0-3.309-2.691-6-6-6a6.006 6.006 0 00-5.422 8.572l-1.806.859A7.929 7.929 0 010 8c0-4.411 3.589-8 8-8s8 3.589 8 8-3.589 8-8 8z"})}),e.jsxs("span",{className:"text-sm",children:["Uploading... (",i,"%)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(A.CloudUpload,{className:"w-12 h-12 text-gray-300 group-hover:text-gray-600 transition-all stroke-1"}),e.jsx("p",{className:"pt-1 text-sm font-medium text-gray-400 group-hover:text-gray-600",children:"Upload an image"})]})}),e.jsx("input",{type:"file",className:"opacity-0 w-full h-full absolute cursor-pointer",onChange:l,accept:"image/png, image/gif, image/jpeg"})]},"upload-placeholder")]})}return e.jsxs("div",{className:"group flex relative flex-col items-center justify-center cursor-pointer w-full h-40 border-2 border-gray-200 border-dashed transition-all rounded-lg hover:bg-gray-100 hover:border-gray-300",children:[e.jsx("div",{className:"flex flex-col items-center justify-center",children:a?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"animate-spin w-4 h-4 fill-current shrink-0 mb-2",viewBox:"0 0 16 16",children:e.jsx("path",{d:"M8 16a7.928 7.928 0 01-3.428-.77l.857-1.807A6.006 6.006 0 0014 8c0-3.309-2.691-6-6-6a6.006 6.006 0 00-5.422 8.572l-1.806.859A7.929 7.929 0 010 8c0-4.411 3.589-8 8-8s8 3.589 8 8-3.589 8-8 8z"})}),e.jsxs("span",{className:"text-sm",children:["Uploading... (",i,"%)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(A.CloudUpload,{className:"w-12 h-12 text-gray-300 group-hover:text-gray-600 transition-all stroke-1"}),e.jsx("p",{className:"pt-1 text-sm font-medium text-gray-400 group-hover:text-gray-600",children:"Upload an image"})]})}),e.jsx("input",{type:"file",className:"opacity-0 w-full h-full absolute cursor-pointer",onChange:l,accept:"image/png, image/gif, image/jpeg"})]},"upload-placeholder")};return e.jsx("div",{className:"flex items-center w-full mt-2",children:c()})},$r=x.forwardRef(({...t},s)=>e.jsx(he,{...t,inputClassName:"border-l-0 rounded-l-none",ref:s,className:""}));$r.displayName="PhoneInput";const dl=({disabled:t,value:s,onChange:a,options:r})=>{const i=n=>{a(n.target.value)};return e.jsxs("div",{className:"relative inline-flex items-center self-stretch rounded-s-lg border border-gray-200 dark:border-gray-800 bg-background py-2 pe-2 ps-3 text-muted-foreground transition-shadow focus-within:z-10 focus-within:border-ring focus-within:outline-hidden focus-within:ring-[3px] focus-within:ring-ring/20 hover:bg-accent hover:text-foreground has-disabled:pointer-events-none has-disabled:opacity-50",children:[e.jsxs("div",{className:"inline-flex items-center gap-1","aria-hidden":"true",children:[e.jsx(Gr,{country:s,countryName:s,"aria-hidden":"true"}),e.jsx("span",{className:"text-muted-foreground/80",children:e.jsx(A.ChevronDown,{size:16,strokeWidth:2,"aria-hidden":"true"})})]}),e.jsxs("select",{disabled:t,value:s,onChange:i,className:"absolute inset-0 text-sm opacity-0","aria-label":"Select country",children:[e.jsx("option",{value:"",children:"Select a country"},"default"),r.filter(n=>n.value).map((n,o)=>e.jsxs("option",{value:n.value,children:[n.label," ",n.value&&`+${Dt.getCountryCallingCode(n.value)}`]},n.value??`empty-${o}`))]})]})},Gr=({country:t,countryName:s})=>{const a=ca[t];return e.jsx("span",{className:"w-5 overflow-hidden rounded-sm",children:a?e.jsx(a,{title:s}):e.jsx(A.Phone,{size:16,"aria-hidden":"true"})})},cl=({value:t,onChange:s,onBlur:a})=>{const r=x.useId();return e.jsx("div",{className:"mt-2",children:e.jsx(Dt.default,{id:r,className:"flex rounded-lg shadow-xs shadow-black/5",international:!0,flagComponent:Gr,countrySelectComponent:dl,inputComponent:$r,placeholder:"Enter phone number",value:t,onChange:i=>s(i??""),onBlur:a})})},ul=({options:t,value:s,onChange:a,multiple:r=!1,placeholder:i})=>{var u;const n=x.useId(),[o,l]=x.useState(!1),d=p=>{if(r){let g;Array.isArray(s)&&s.includes(p)?g=s.filter(h=>h!==p):g=Array.isArray(s)?[...s,p]:[p],a(g)}else a(p),l(!1)},c=p=>{if(r&&Array.isArray(s)){const g=s.filter(h=>h!==p);a(g)}};return e.jsx("div",{className:"mt-2",children:e.jsxs(Ms,{open:o,onOpenChange:l,children:[e.jsx(Bs,{asChild:!0,children:e.jsxs(z,{id:n,role:"combobox","aria-expanded":o,variant:"secondary",className:"w-full justify-between shadow-xs! bg-background px-2! py-1 min-h-[41.6px] font-normal outline-offset-0 hover:bg-background focus-visible:border-ring focus-visible:outline-[3px] focus-visible:outline-ring/20",children:[(s==null?void 0:s.length)>0?e.jsx("div",{className:"flex flex-wrap gap-2",children:Array.isArray(s)?s.map(p=>{const g=t.find(h=>h.value===p);return g?e.jsxs("span",{className:"animate-fadeIn relative inline-flex cursor-default items-center rounded-md border border-border bg-background px-2 py-1 text-xs font-medium text-secondary-foreground transition-all hover:bg-background disabled:cursor-not-allowed disabled:opacity-50",children:[g.label,e.jsx(A.X,{size:12,onClick:h=>{h.preventDefault(),c(p)},className:"cursor-pointer ml-1"})]},p):null}):e.jsx("span",{className:"px-1 text-sm",children:(u=t.find(p=>p.value===s))==null?void 0:u.label})}):e.jsx("span",{className:"px-1 text-sm text-gray-400",children:i||(r?"Select options":"Select an option")}),e.jsx(A.ChevronDown,{size:16,strokeWidth:2,className:"shrink-0 text-muted-foreground/80","aria-hidden":"true"})]})}),e.jsx(Js,{className:"w-full min-w-[var(--radix-popper-anchor-width)] border-input -mt-1 z-50 p-0",align:"start",children:e.jsxs(Qs,{className:"p-0",children:[e.jsx(zs,{className:"w-full border-none pl-0",style:{boxShadow:"none"},placeholder:"Search..."}),e.jsxs(Is,{children:[e.jsx(Ls,{children:"No options found."}),e.jsx(Es,{children:t.map(p=>e.jsxs(Ds,{value:p.label,className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800",onSelect:()=>d(p.value),children:[p.label,(r?s.includes(p.value):s===p.value)&&e.jsx(A.Check,{size:16,strokeWidth:2,className:"ml-auto"})]},p.value))})]})]})})]})})},pl=Se.tv({slots:{root:["group relative isolate inline-flex shrink-0 cursor-pointer items-center rounded-full p-0.5 shadow-inner outline-hidden ring-1 ring-inset transition-all","bg-gray-200 dark:bg-gray-950","ring-black/5 dark:ring-gray-800","data-[state=checked]:bg-blue-600 dark:data-[state=checked]:bg-blue-600","data-disabled:cursor-default","data-disabled:data-[state=checked]:bg-blue-200","data-disabled:data-[state=checked]:ring-gray-300","dark:data-disabled:data-[state=checked]:ring-gray-900","dark:data-disabled:data-[state=checked]:bg-blue-900","data-disabled:data-[state=unchecked]:ring-gray-300","data-disabled:data-[state=unchecked]:bg-gray-100","dark:data-disabled:data-[state=unchecked]:ring-gray-700","dark:data-disabled:data-[state=unchecked]:bg-gray-800",ie],thumb:["pointer-events-none relative inline-block transform appearance-none rounded-full border-none shadow-lg outline-hidden transition-all duration-150 ease-in-out focus:border-none focus:outline-hidden focus:outline-transparent","bg-white dark:bg-gray-50","group-data-disabled:shadow-none","group-data-disabled:bg-gray-50 dark:group-data-disabled:bg-gray-500"]},variants:{size:{default:{root:"h-7 w-14",thumb:"h-4 w-4 data-[state=checked]:translate-x-7 data-[state=unchecked]:translate-x-0"},small:{root:"h-4 w-7",thumb:"h-3 w-3 data-[state=checked]:translate-x-3 data-[state=unchecked]:translate-x-0"}}},defaultVariants:{size:"default"}}),Kr=x.forwardRef(({className:t,size:s,...a},r)=>{const{root:i,thumb:n}=pl({size:s});return e.jsx(Pt.Root,{ref:r,className:w(i(),t),...a,children:e.jsx(Pt.Thumb,{className:w(n())})})});Kr.displayName="Switch";const ml=({name:t,type:s,placeholder:a,multiple:r,options:i,prefix:n})=>{const{watch:o,register:l,setFocus:d,setValue:c}=F.useFormContext();switch(s){case"email":return e.jsx(ol,{...l(t),placeholder:a});case"file":return e.jsx(ll,{value:o(t),multiple:r,onChange:u=>c(t,u)});case"phone-number":return e.jsx(cl,{value:o("phone"),onChange:u=>c("phone",u),onBlur:()=>d("phone")});case"country":return e.jsx(il,{value:o(t),onChange:u=>c(t,u)});case"select":{const u=r?o(t)||[]:o(t)||"";if(!i)throw new Error("Options are required for select input");return e.jsx(ul,{options:i,value:u,onChange:p=>c(t,p),placeholder:a,multiple:r})}case"switch":return e.jsx(Kr,{size:"default",className:"mr-2",checked:o(t),onCheckedChange:u=>c(t,u)});case"time":return e.jsx(vs,{value:o(t),onChange:u=>c(t,u.target.value),className:"mt-2"});default:return e.jsx(he,{...l(t),type:s,rows:s==="textarea"?4:void 0,placeholder:a,className:"mt-2",prefix:n})}},gl=(t,s)=>!t||typeof t!="object"?void 0:s?s.replace(/\[/g,".").replace(/\]/g,"").split(".").filter(Boolean).reduce((r,i)=>{if(r!=null)return r[i]},t):t,Os=({type:t="text",name:s,label:a,className:r,locale:i,placeholder:n,multiple:o,options:l,localizable:d,prefix:c})=>{const{errors:u}=F.useFormState(),p=gl(u,s);return e.jsxs("div",{className:w("w-full",{"flex items-center flex-row-reverse justify-end":t==="switch"},r),children:[typeof a=="string"&&e.jsxs(be,{htmlFor:s,className:"font-medium flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center",children:[a,d&&e.jsx(A.LanguagesIcon,{className:"w-4 h-4 ml-1 text-gray-500"})]}),i&&d&&e.jsxs("span",{className:"flex items-center text-xs text-gray-500 ml-1 bg-gray-100 px-1 py-0.5 rounded",children:[Bt.get(i)," (",i,")"]})]}),e.jsx(ml,{type:t,name:s,placeholder:n,options:l,multiple:o,prefix:c}),(p==null?void 0:p.message)&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:p.message})]})},hl=({form:t,config:s,columns:a=2})=>{var d;const{errors:r}=F.useFormState(),i=qr(r,s.name),{fields:n,append:o,remove:l}=F.useFieldArray({control:t.control,name:s.name});return(d=s.fields)!=null&&d.length?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"w-full col-span-full",children:[s.label&&e.jsx("h4",{className:"text-2xl flex items-center justify-between font-semibold",children:s.label}),s.description&&e.jsx("p",{className:"text-sm text-gray-500",children:s.description}),n.map((c,u)=>{var p;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:w("grid gap-5 w-full border-l-[8px] border-blue-500 pl-5 py-3 mt-6",{"grid-cols-1":a===1,"grid-cols-2":a===2,"grid-cols-3":a===3,"grid-cols-4":a===4}),children:(p=s.fields)==null?void 0:p.map(({name:g,label:h,type:y,colspan:b,localizable:f,multiple:S,options:k,placeholder:j,prefix:v})=>e.jsx(Os,{name:`${s.name}[${u}].${g}`,label:h,type:y??"text",localizable:f,className:w({"col-span-1":b===1,"col-span-2":b===2,"col-span-3":b===3,"col-span-4":b===4}),placeholder:j,multiple:S,options:k,prefix:v},s.name+g))},c.id),u<n.length-1&&e.jsx($,{})]})}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsxs("button",{type:"button",className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600",onClick:()=>o({}),children:[e.jsx(A.PlusCircleIcon,{className:"w-4 h-4 text-blue-500"}),"Add New"]}),n.length>1&&e.jsxs("button",{type:"button",className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600",onClick:()=>l(n.length-1),children:[e.jsx(A.XCircleIcon,{className:"w-4 h-4 text-red-500"}),"Remove"]})]}),(i==null?void 0:i.message)&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:i.message})]})}):null},xl=({config:t,columns:s=2})=>{var i;const{errors:a}=F.useFormState(),r=qr(a,t.name);return(i=t.fields)!=null&&i.length?e.jsxs("div",{className:"w-full col-span-full",children:[t.label&&e.jsx("h4",{className:"text-2xl font-semibold mb-2",children:t.label}),t.description&&e.jsx("p",{className:"text-sm text-gray-500 mb-3",children:t.description}),e.jsx("div",{className:w("grid gap-5",{"grid-cols-1":s===1,"grid-cols-2":s===2,"grid-cols-3":s===3,"grid-cols-4":s===4}),children:t.fields.map(({name:n,label:o,type:l,colspan:d,localizable:c,multiple:u,options:p,placeholder:g,prefix:h})=>e.jsx(Os,{name:`${t.name}.${n}`,label:o,type:l??"text",localizable:c,className:w({"col-span-1":d===1,"col-span-2":d===2,"col-span-3":d===3,"col-span-4":d===4}),placeholder:g,multiple:u,options:p,prefix:h},`${t.name}.${n}`))}),(r==null?void 0:r.message)&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:r.message})]}):null};function fl(t,s){const{asChild:a,children:r}=t;if(!a)return typeof s=="function"?s(r):s;const i=x.Children.only(r);return x.cloneElement(i,{children:typeof s=="function"?s(i.props.children):s})}const Fs=x.forwardRef(({className:t,children:s,...a},r)=>e.jsx(Tt.Root,{ref:r,...a,asChild:!1,children:e.jsx(Tt.List,{className:w("flex items-center justify-start whitespace-nowrap border-b [scrollbar-width:none] [&::-webkit-scrollbar]:hidden","border-gray-200 dark:border-gray-800",t),children:s})}));Fs.displayName="TabNavigation";const Vs=x.forwardRef(({asChild:t,disabled:s,className:a,children:r,...i},n)=>e.jsx(Tt.Item,{className:"flex","aria-disabled":s,children:e.jsx(Tt.Link,{"aria-disabled":s,className:w("group relative flex shrink-0 select-none items-center justify-center",s?"pointer-events-none":""),ref:n,onSelect:()=>{},asChild:t,...i,children:fl({asChild:t,children:r},o=>e.jsx("span",{className:w("-mb-px flex items-center justify-center whitespace-nowrap border-b-2 border-transparent px-3 pb-2 text-sm font-medium transition-all","text-gray-500 dark:text-gray-500","group-hover:text-gray-700 dark:group-hover:text-gray-400","group-hover:border-gray-300 dark:group-hover:border-gray-400","group-data-active:border-blue-600 group-data-active:text-blue-600","dark:group-data-active:border-blue-500 dark:group-data-active:text-blue-500",s?"pointer-events-none text-gray-300 dark:text-gray-700":"",ie,a),children:o}))})}));Vs.displayName="TabNavigationLink";const Ne=({form:t,okText:s,config:a,loading:r,onCancel:i,cancelText:n,columns:o=2,onSubmit:l})=>{const d=t.watch("translations"),{organization:c,defaultLocale:u,supportedLocales:p}=pe(),[g,h]=x.useState(),y=x.useMemo(()=>a.some(f=>f.localizable),[a]);x.useEffect(()=>{c.data&&h(u)},[c.data,u,t,p,d]),x.useEffect(()=>{t.formState.errors.translations&&h(u)},[u,t.formState.errors.translations]);const b=e.jsxs("div",{className:I("grid gap-5 w-full",{"grid-cols-1":o===1,"grid-cols-2":o===2,"grid-cols-3":o===3,"grid-cols-4":o===4}),children:[y&&e.jsx("div",{className:"col-span-full",children:e.jsx(Fs,{className:"col-span-full mb-3",children:p.map(f=>{const S=f===u;return e.jsx(Vs,{active:f===g,onClick:()=>h(f),className:"cursor-pointer",children:e.jsxs(e.Fragment,{children:[Bt.get(f)," ",S&&"(Default)"]})},f)})})}),a.map(f=>{const{name:S,label:k,type:j,colspan:v,localizable:P,multiple:q,options:se,placeholder:ee,prefix:U}=f,O=!P||!g?S:`translations[${p==null?void 0:p.indexOf(g)}].${S}`;return j==="object"?e.jsx(xl,{config:f},S):j==="array"?e.jsx(hl,{form:t,config:f},S):e.jsx(Os,{name:O,label:k,type:j??"text",localizable:P,className:I({"col-span-1":v===1,"col-span-2":v===2,"col-span-3":v===3,"col-span-4":v===4}),placeholder:ee,multiple:q,options:se,locale:g,prefix:U},O)}),l&&e.jsxs("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 mt-6 col-span-full border-t pt-7",children:[i&&e.jsx(z,{type:"button",className:"w-full sm:w-fit",variant:"secondary",onClick:i,children:n??"Cancel"}),e.jsx(z,{type:"submit",className:"w-full sm:w-fit",isLoading:r,loadingText:"Saving...",children:s??"Save Data"})]})]});return l?e.jsx(F.FormProvider,{...t,children:e.jsx("form",{onSubmit:t.handleSubmit(f=>l(f)),children:b})}):e.jsx("div",{className:"w-full",children:b})},yl=[{name:"name",label:"Manufacturer Name",type:"text",placeholder:"Acme Inc.",colspan:2},{name:"about",label:"About",type:"textarea",placeholder:"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",colspan:2,localizable:!0},{name:"logo",label:"Logo",type:"file"}],Xr=({initialData:t})=>{const{client:s}=E(),a=Q.useRouter(),r=Y(),i=K(),{defaultLocale:n,supportedLocales:o}=pe(),l=t?wn:yn,d=F.useForm({resolver:ue.zodResolver(l),defaultValues:t?{defaultLocale:n,name:t.name,logo:t.logo,translations:t.translations}:{defaultLocale:n,translations:o.map(h=>({locale:h}))}}),c=R.useMutation({mutationFn:async h=>{var f;const y={name:h.name,defaultLocale:h.defaultLocale,translations:h.translations,logoId:(f=h.logo)==null?void 0:f.id},{status:b}=await s.manufacturer.createManufacturer({params:{organizationId:i},body:y});if(b!==201)throw X.error("Failed to create manufacturer. Please try again later."),new Error("Failed to create manufacturer")}}),u=R.useMutation({mutationFn:async h=>{var f;const y={name:h.name,defaultLocale:h.defaultLocale,translations:h.translations,logoId:((f=h.logo)==null?void 0:f.id)||null},{status:b}=await s.manufacturer.updateManufacturer({params:{organizationId:i,id:t.id},body:y});if(b!==200)throw X.error("Failed to update manufacturer. Please try again later."),new Error("Failed to update manufacturer")}}),p=async()=>{X.success("Manufacturer saved successfully"),a.push(r.manufacturers(i)),await Ae.invalidateQueries({queryKey:["manufacturers"]})},g=h=>{t?u.mutate(h,{onSuccess:p}):c.mutate(h,{onSuccess:p})};return e.jsx(Ne,{form:d,config:yl,onSubmit:g,loading:c.isPending||u.isPending,cancelText:"Go back",okText:t?"Update Manufacturer":"Create Manufacturer"})};function wl(){return e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Create Manufacturer"}),e.jsx($,{}),e.jsx("div",{className:"pt-6",children:e.jsx("div",{className:"space-y-10",children:e.jsx("section",{"aria-labelledby":"manufacturer-info",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"manufacturer-info",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Manufacturer Information"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Enter the information about the manufacturer."})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(Xr,{})})]})})})})]})}function bl(){const t=K(),s=gt(),{client:a}=E(),{isLoading:r,data:i}=R.useQuery({queryKey:["manufacturers",t,s],queryFn:async()=>{const{status:n,body:o}=await a.manufacturer.getManufacturer({params:{id:s,organizationId:t}});if(n!==200)throw X.error("Failed to fetch manufacturer. Please refresh or try again later."),new Error("Failed to fetch manufacturer");return o},throwOnError:!0,placeholderData:R.keepPreviousData});return e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Edit Manufacturer"}),e.jsx($,{}),e.jsx("div",{className:"pt-6",children:e.jsx("div",{className:"space-y-10",children:e.jsx("section",{"aria-labelledby":"manufacturer-info",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"manufacturer-info",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Manufacturer Information"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Enter the information about the manufacturer."})]}),e.jsx("div",{className:"md:col-span-2",children:r||!i?e.jsx("div",{className:"flex justify-center items-center h-screen mt-5",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(ce,{className:"w-12 h-12"}),e.jsx("p",{className:"text-gray-500 text-sm mt-3",children:"Loading data..."})]})}):e.jsx(Xr,{initialData:i})})]})})})})]})}const Sl=x.forwardRef(({className:t,children:s,...a},r)=>e.jsx("div",{ref:r,children:e.jsx("div",{className:I("w-full overflow-auto whitespace-nowrap",t),...a,children:s})}));Sl.displayName="TableRoot";const Yr=x.forwardRef(({className:t,...s},a)=>e.jsx("table",{ref:a,className:I("w-full caption-bottom border-b","border-gray-200 dark:border-gray-800",t),...s}));Yr.displayName="Table";const ei=x.forwardRef(({className:t,...s},a)=>e.jsx("thead",{ref:a,className:I(t),...s}));ei.displayName="TableHead";const ti=x.forwardRef(({className:t,...s},a)=>e.jsx("th",{ref:a,className:I("border-b px-4 py-3.5 text-left text-sm font-semibold","text-gray-900 dark:text-gray-50","border-gray-200 dark:border-gray-800",t),...s}));ti.displayName="TableHeaderCell";const si=x.forwardRef(({className:t,...s},a)=>e.jsx("tbody",{ref:a,className:I("divide-y","divide-gray-200 dark:divide-gray-800",t),...s}));si.displayName="TableBody";const lt=x.forwardRef(({className:t,...s},a)=>e.jsx("tr",{ref:a,className:I("[&_td:last-child]:pr-4 [&_th:last-child]:pr-4","[&_td:first-child]:pl-4 [&_th:first-child]:pl-4",t),...s}));lt.displayName="TableRow";const At=x.forwardRef(({className:t,...s},a)=>e.jsx("td",{ref:a,className:I("p-4 text-sm","text-gray-600 dark:text-gray-400",t),...s}));At.displayName="TableCell";const kl=x.forwardRef(({className:t,...s},a)=>e.jsx("tfoot",{ref:a,className:I("border-t text-left font-medium","text-gray-900 dark:text-gray-50","border-gray-200 dark:border-gray-800",t),...s}));kl.displayName="TableFoot";const jl=x.forwardRef(({className:t,...s},a)=>e.jsx("caption",{ref:a,className:I("mt-3 px-3 text-center text-sm","text-gray-500 dark:text-gray-500",t),...s}));jl.displayName="TableCaption";const Al=w("hidden h-6 select-none items-center justify-center rounded-md bg-gray-800 px-2 font-mono text-xs text-gray-400 ring-1 ring-inset ring-gray-700 transition sm:flex"),ai=({open:t=!1,onOpenChange:s,defaultOpen:a=!1,disableAutoFocus:r=!0,children:i})=>e.jsxs(_.Root,{open:t,onOpenChange:s,defaultOpen:a,children:[e.jsx(_.Anchor,{className:w("fixed inset-x-0 bottom-8 mx-auto flex w-fit items-center")}),e.jsx(_.Portal,{children:e.jsx(_.Content,{side:"top",sideOffset:0,onOpenAutoFocus:n=>{r&&n.preventDefault()},className:w("z-50","data-[state=closed]:animate-hide","data-[side=top]:animate-slideUpAndFade"),children:i})})]});ai.displayName="CommandBar";const ri=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:w("px-3 py-2.5 text-sm tabular-nums text-gray-300",t),...s}));ri.displayName="CommandBar.Value";const ii=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:w("relative flex items-center rounded-lg bg-gray-900 px-1 shadow-lg shadow-black/30 dark:ring-1 dark:ring-white/10",t),...s}));ii.displayName="CommandBarBar";const vt=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:w("h-4 w-px bg-gray-700",t),...s}));vt.displayName="CommandBar.Seperator";const Nt=N.forwardRef(({className:t,type:s="button",label:a,action:r,shortcut:i,disabled:n,...o},l)=>(N.useEffect(()=>{const d=c=>{c.key===i.shortcut&&(c.preventDefault(),c.stopPropagation(),r())};return n||document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},[r,i,n]),e.jsx("span",{className:w("flex items-center gap-x-2 rounded-lg bg-gray-900 p-1 text-base font-medium text-gray-50 outline-hidden transition focus:z-10 sm:text-sm","sm:last-of-type:-mr-1",t),children:e.jsxs("button",{ref:l,type:s,onClick:r,disabled:n,className:w("flex items-center gap-x-2 rounded-md px-1 py-1 hover:bg-gray-800","focus-visible:bg-gray-800 focus-visible:hover:bg-gray-800","disabled:text-gray-500",ie),...o,children:[e.jsx("span",{children:a}),e.jsx("span",{className:Al,children:i.label?i.label.toUpperCase():i.shortcut.toUpperCase()})]})})));Nt.displayName="CommandBar.Command";function vl({table:t,rowSelection:s}){const a=Object.keys(s).length>0;return e.jsx(ai,{open:a,children:e.jsxs(ii,{children:[e.jsxs(ri,{children:[Object.keys(s).length," selected"]}),e.jsx(vt,{}),e.jsx(Nt,{label:"Edit",action:()=>{console.log("Edit")},shortcut:{shortcut:"e"}}),e.jsx(vt,{}),e.jsx(Nt,{label:"Delete",action:()=>{console.log("Delete")},shortcut:{shortcut:"d"}}),e.jsx(vt,{}),e.jsx(Nt,{label:"Reset",action:()=>{t.resetRowSelection()},shortcut:{shortcut:"Escape",label:"esc"}})]})})}function Nl({meta:t,table:s}){const r=Q.useSearchParams(),i=Q.useRouter(),n=Q.usePathname(),o=Number((r==null?void 0:r.get("page"))||"1"),l=(y,b)=>{const f=new URLSearchParams(r==null?void 0:r.toString());return f.set(y,b),f.toString()},d=y=>{i.push(`${n}?${l("page",y.toString())}`)},c=[{icon:C.RiArrowLeftDoubleLine,onClick:()=>d(1),disabled:!(t!=null&&t.previousPage),srText:"First page",mobileView:"hidden sm:block"},{icon:C.RiArrowLeftSLine,onClick:()=>d(o-1),disabled:!(t!=null&&t.previousPage),srText:"Previous page",mobileView:""},{icon:C.RiArrowRightSLine,onClick:()=>d(o+1),disabled:!(t!=null&&t.nextPage),srText:"Next page",mobileView:""},{icon:C.RiArrowRightDoubleLine,onClick:()=>d(t.pageCount),disabled:!(t!=null&&t.nextPage),srText:"Last page",mobileView:"hidden sm:block"}],u=s.getFilteredRowModel().rows.length,g=s.getState().pagination.pageIndex*15+1,h=Math.min(u,g+15-1);return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm tabular-nums text-gray-500",children:[s.getFilteredSelectedRowModel().rows.length," of ",u," row(s) selected."]}),e.jsxs("div",{className:"flex items-center gap-x-6 lg:gap-x-8",children:[e.jsxs("p",{className:"hidden text-sm tabular-nums text-gray-500 sm:block",children:["Showing"," ",e.jsxs("span",{className:"font-medium text-gray-900 dark:text-gray-50",children:[g,"-",h]})," ","of"," ",e.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-50",children:u})]}),e.jsx("div",{className:"flex items-center gap-x-1.5",children:c.map((y,b)=>e.jsxs(z,{variant:"secondary",className:w(y.mobileView,"p-1.5"),onClick:()=>{y.onClick(),s.resetRowSelection()},disabled:y.disabled,children:[e.jsx("span",{className:"sr-only",children:y.srText}),e.jsx(y.icon,{className:"size-4 shrink-0","aria-hidden":"true"})]},b))})]})]})}function st({meta:t,columns:s,error:a,data:r,loading:i,className:n,refetch:o}){var g,h;const l=K(),d=Y(),[c,u]=N.useState({}),p=ge.useReactTable({data:r,columns:s,state:{rowSelection:c},enableRowSelection:!0,getFilteredRowModel:ge.getFilteredRowModel(),onRowSelectionChange:u,getCoreRowModel:ge.getCoreRowModel(),getSortedRowModel:ge.getSortedRowModel(),manualPagination:!0,meta:{organizationId:l,refetch:o,routes:d}});return e.jsx(e.Fragment,{children:e.jsxs("div",{className:w("space-y-6 relative",n),children:[e.jsxs("div",{className:"relative overflow-hidden overflow-x-auto",children:[i&&!r?e.jsx("div",{className:"flex items-center justify-center h-48",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(ce,{className:"w-10 h-10"}),e.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"Loading..."})]})}):e.jsxs(e.Fragment,{children:[e.jsxs(Yr,{children:[e.jsx(ei,{children:p.getHeaderGroups().map(y=>e.jsx(lt,{className:"border-y border-gray-200 dark:border-gray-800 back",children:y.headers.map(b=>{var f;return e.jsx(ti,{className:w("whitespace-nowrap py-1 text-sm sm:text-xs",(f=b.column.columnDef.meta)==null?void 0:f.className),children:ge.flexRender(b.column.columnDef.header,b.getContext())},b.id)})},y.id))}),e.jsxs(si,{children:[a&&e.jsx(lt,{children:e.jsx(At,{colSpan:s.length,className:"h-24 text-center text-red-500",children:"An error occurred while fetching data. Please refresh the site and try again."})}),((g=p.getRowModel().rows)==null?void 0:g.length)>0&&p.getRowModel().rows.map(y=>e.jsx(lt,{className:"group select-none hover:bg-gray-50 dark:hover:bg-gray-900",children:y.getVisibleCells().map((b,f)=>{var S;return e.jsxs(At,{className:w(y.getIsSelected()?"bg-gray-50 dark:bg-gray-900":"","relative whitespace-nowrap py-1 text-gray-600 first:w-10 dark:text-gray-400",(S=b.column.columnDef.meta)==null?void 0:S.className),children:[f===0&&y.getIsSelected()&&e.jsx("div",{className:"absolute inset-y-0 left-0 w-0.5 bg-blue-600 dark:bg-blue-500"}),ge.flexRender(b.column.columnDef.cell,b.getContext())]},b.id)})},y.id)),((h=p.getRowModel().rows)==null?void 0:h.length)===0&&!i&&e.jsx(lt,{children:e.jsx(At,{colSpan:s.length,className:"h-24 text-center",children:"No results."})})]})]}),i&&r&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-white bg-opacity-75 dark:bg-gray-900 dark:bg-opacity-75",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(ce,{className:"w-10 h-10"}),e.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"Loading..."})]})})]}),e.jsx(vl,{table:p,rowSelection:c})]}),t&&e.jsx(Nl,{meta:t,table:p})]})})}const Rl=Se.tv({base:["relative block w-full appearance-none rounded-md border px-2.5 py-1.5 outline-hidden transition sm:text-sm","border-transparent dark:border-gray-800","text-gray-900 dark:text-gray-50","placeholder-gray-400 dark:placeholder-gray-500","bg-gray-100 dark:bg-gray-950","disabled:border-gray-300 disabled:bg-gray-100 disabled:text-gray-400","dark:disabled:border-gray-700 dark:disabled:bg-gray-800 dark:disabled:text-gray-500",tt,"[&::--webkit-search-cancel-button]:hidden [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden"],variants:{hasError:{true:$t},enableStepper:{true:"[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"}}}),at=N.forwardRef(({className:t,inputClassName:s,hasError:a,enableStepper:r,type:i="search",...n},o)=>e.jsxs("div",{className:w("relative w-full",t),children:[e.jsx("input",{ref:o,type:i,className:w(Rl({hasError:a,enableStepper:r}),"pl-8",s),...n}),e.jsx("div",{className:w("pointer-events-none absolute bottom-0 left-2 flex h-full items-center justify-center","text-gray-400 dark:text-gray-600"),children:e.jsx(C.RiSearchLine,{className:"size-[1.125rem] shrink-0","aria-hidden":"true"})})]}));at.displayName="Searchbar";function L({column:t,title:s,className:a}){return t.getCanSort()?e.jsxs("div",{onClick:t.getToggleSortingHandler(),className:w(t.columnDef.enableSorting===!0?"-mx-2 inline-flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1 hover:bg-gray-50 dark:hover:bg-gray-900":""),children:[e.jsx("span",{children:s}),t.getCanSort()?e.jsxs("div",{className:"-space-y-2",children:[e.jsx(C.RiArrowUpSLine,{className:w("size-3.5 text-gray-900 dark:text-gray-50",t.getIsSorted()==="desc"?"opacity-30":""),"aria-hidden":"true"}),e.jsx(C.RiArrowDownSLine,{className:w("size-3.5 text-gray-900 dark:text-gray-50",t.getIsSorted()==="asc"?"opacity-30":""),"aria-hidden":"true"})]}):null]}):e.jsx("div",{className:w(a),children:s})}const Le=re.Root;Le.displayName="DropdownMenu";const Ee=re.Trigger;Ee.displayName="DropdownMenuTrigger";const ct=re.Group;ct.displayName="DropdownMenuGroup";const ni=re.Sub;ni.displayName="DropdownMenuSubMenu";const oi=re.RadioGroup;oi.displayName="DropdownMenuRadioGroup";const li=N.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(re.SubTrigger,{ref:r,className:w("relative flex cursor-default select-none items-center rounded py-1.5 pl-2 pr-1 outline-hidden transition-colors data-[state=checked]:font-semibold sm:text-sm","text-gray-900 dark:text-gray-50","data-disabled:pointer-events-none data-disabled:text-gray-400 data-disabled:hover:bg-none dark:data-disabled:text-gray-600","focus-visible:bg-gray-100 data-[state=open]:bg-gray-100 dark:focus-visible:bg-gray-900 dark:data-[state=open]:bg-gray-900","hover:bg-gray-100 dark:hover:bg-gray-900",t),...a,children:[s,e.jsx(C.RiArrowRightSLine,{className:"ml-auto size-4 shrink-0 text-gray-500","aria-hidden":"true"})]}));li.displayName="DropdownMenuSubMenuTrigger";const di=N.forwardRef(({className:t,collisionPadding:s=8,...a},r)=>e.jsx(re.Portal,{children:e.jsx(re.SubContent,{ref:r,collisionPadding:s,className:w("relative z-50 overflow-hidden rounded-md border p-1 shadow-xl shadow-black/[2.5%]","min-w-32","max-h-[var(--radix-popper-available-height)]","bg-white dark:bg-gray-950","text-gray-900 dark:text-gray-50","border-gray-200 dark:border-gray-800","will-change-[transform,opacity]","data-[state=closed]:animate-hide","data-[side=bottom]:animate-slideDownAndFade data-[side=left]:animate-slideLeftAndFade data-[side=right]:animate-slideRightAndFade data-[side=top]:animate-slideUpAndFade",t),...a})}));di.displayName="DropdownMenuSubMenuContent";const De=N.forwardRef(({className:t,sideOffset:s=8,collisionPadding:a=8,align:r="center",loop:i=!0,...n},o)=>e.jsx(re.Portal,{children:e.jsx(re.Content,{ref:o,className:w("relative z-50 overflow-hidden rounded-md border p-1 shadow-xl shadow-black/[2.5%]","min-w-[calc(var(--radix-dropdown-menu-trigger-width))]","max-h-[var(--radix-popper-available-height)]","bg-white dark:bg-gray-950","text-gray-900 dark:text-gray-50","border-gray-200 dark:border-gray-800","will-change-[transform,opacity]","data-[state=closed]:animate-hide","data-[side=bottom]:animate-slideDownAndFade data-[side=left]:animate-slideLeftAndFade data-[side=right]:animate-slideRightAndFade data-[side=top]:animate-slideUpAndFade",t),sideOffset:s,align:r,collisionPadding:a,loop:i,...n})}));De.displayName="DropdownMenuContent";const fe=N.forwardRef(({className:t,shortcut:s,hint:a,children:r,...i},n)=>e.jsxs(re.Item,{ref:n,className:w("group/DropdownMenuItem relative flex cursor-pointer select-none items-center rounded py-1.5 pl-2 pr-1 outline-hidden transition-colors data-[state=checked]:font-semibold sm:text-sm","text-gray-900 dark:text-gray-50","data-disabled:pointer-events-none data-disabled:text-gray-400 data-disabled:hover:bg-none dark:data-disabled:text-gray-600","focus-visible:bg-gray-100 dark:focus-visible:bg-gray-900","hover:bg-gray-100 dark:hover:bg-gray-900",t),...i,children:[r,a&&e.jsx("span",{className:w("ml-auto pl-2 text-sm text-gray-400 dark:text-gray-600"),children:a}),s&&e.jsx("span",{className:w("ml-auto pl-2 text-sm text-gray-400 dark:text-gray-600"),children:s})]}));fe.displayName="DropdownMenuItem";const Cl=N.forwardRef(({className:t,hint:s,shortcut:a,children:r,checked:i,...n},o)=>e.jsxs(re.CheckboxItem,{ref:o,className:w("relative flex cursor-pointer select-none items-center gap-x-2 rounded py-1.5 pl-8 pr-1 outline-hidden transition-colors data-[state=checked]:font-semibold sm:text-sm","text-gray-900 dark:text-gray-50","data-disabled:pointer-events-none data-disabled:text-gray-400 data-disabled:hover:bg-none dark:data-disabled:text-gray-600","focus-visible:bg-gray-100 dark:focus-visible:bg-gray-900","hover:bg-gray-100 dark:hover:bg-gray-900",t),checked:i,...n,children:[e.jsx("span",{className:"absolute left-2 flex size-4 items-center justify-center",children:e.jsx(re.ItemIndicator,{children:e.jsx(C.RiCheckLine,{"aria-hidden":"true",className:"size-full shrink-0 text-gray-800 dark:text-gray-200"})})}),r,s&&e.jsx("span",{className:w("ml-auto text-sm font-normal text-gray-400 dark:text-gray-600"),children:s}),a&&e.jsx("span",{className:w("ml-auto text-sm font-normal tracking-widest text-gray-400 dark:border-gray-800 dark:text-gray-600"),children:a})]}));Cl.displayName="DropdownMenuCheckboxItem";const Rt=N.forwardRef(({className:t,hint:s,shortcut:a,children:r,iconType:i="radio",...n},o)=>e.jsxs(re.RadioItem,{ref:o,className:w("group/DropdownMenuRadioItem relative flex cursor-pointer select-none items-center gap-x-2 rounded py-1.5 pl-8 pr-1 outline-hidden transition-colors data-[state=checked]:font-semibold sm:text-sm","text-gray-900 dark:text-gray-50","data-disabled:pointer-events-none data-disabled:text-gray-400 data-disabled:hover:bg-none dark:data-disabled:text-gray-600","focus-visible:bg-gray-100 dark:focus-visible:bg-gray-900","hover:bg-gray-100 dark:hover:bg-gray-900",t),...n,children:[i==="radio"?e.jsxs("span",{className:"absolute left-2 flex size-4 items-center justify-center",children:[e.jsx(C.RiRadioButtonFill,{"aria-hidden":"true",className:"size-full shrink-0 text-blue-500 group-data-[state=checked]/DropdownMenuRadioItem:flex group-data-[state=unchecked]/DropdownMenuRadioItem:hidden dark:text-blue-500"}),e.jsx(C.RiCheckboxBlankCircleLine,{"aria-hidden":"true",className:"size-full shrink-0 text-gray-300 group-data-[state=unchecked]/DropdownMenuRadioItem:flex group-data-[state=checked]/DropdownMenuRadioItem:hidden dark:text-gray-700"})]}):i==="check"?e.jsx("span",{className:"absolute left-2 flex size-4 items-center justify-center",children:e.jsx(C.RiCheckLine,{"aria-hidden":"true",className:"size-full shrink-0 text-gray-800 group-data-[state=checked]/DropdownMenuRadioItem:flex group-data-[state=unchecked]/DropdownMenuRadioItem:hidden dark:text-gray-200"})}):null,r,s&&e.jsx("span",{className:w("ml-auto text-sm font-normal text-gray-400 dark:text-gray-600"),children:s}),a&&e.jsx("span",{className:w("ml-auto text-sm font-normal tracking-widest text-gray-400 dark:border-gray-800 dark:text-gray-600"),children:a})]}));Rt.displayName="DropdownMenuRadioItem";const Xt=N.forwardRef(({className:t,...s},a)=>e.jsx(re.Label,{ref:a,className:w("px-2 py-2 text-xs font-medium tracking-wide","text-gray-500 dark:text-gray-500",t),...s}));Xt.displayName="DropdownMenuLabel";const Pl=N.forwardRef(({className:t,...s},a)=>e.jsx(re.Separator,{ref:a,className:w("-mx-1 my-1 h-px border-t border-gray-200 dark:border-gray-800",t),...s}));Pl.displayName="DropdownMenuSeparator";const Ze=ge.createColumnHelper(),Tl=[Ze.display({id:"select",header:({table:t})=>e.jsx(ve,{checked:t.getIsAllPageRowsSelected()?!0:t.getIsSomeRowsSelected()?"indeterminate":!1,onCheckedChange:()=>t.toggleAllPageRowsSelected(),className:"translate-y-0.5","aria-label":"Select all"}),cell:({row:t})=>e.jsx(ve,{checked:t.getIsSelected(),onCheckedChange:()=>t.toggleSelected(),className:"translate-y-0.5","aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,meta:{displayName:"Select"}}),Ze.accessor("id",{header:({column:t})=>e.jsx(L,{column:t,title:"Id"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"ID"},cell:({row:t,table:s})=>{var r,i,n;const a=(r=s.options.meta)==null?void 0:r.organizationId;return e.jsx(H,{href:((n=(i=s.options.meta)==null?void 0:i.routes)==null?void 0:n.manufacturerEdit(a,t.getValue("id")))??`/admin/${a}/manufacturers/${t.getValue("id")}`,className:"text-blue-500",children:t.getValue("id")})}}),Ze.accessor("name",{header:({column:t})=>e.jsx(L,{column:t,title:"Name"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Owner"}}),Ze.accessor("translations",{header:({column:t})=>e.jsx(L,{column:t,title:"About"}),enableSorting:!1,meta:{className:"text-left",displayName:"Status"},cell:({row:t})=>{var a;return((a=t.getValue("translations").find(r=>r.about))==null?void 0:a.about)||"-"}}),Ze.accessor("createdAt",{header:({column:t})=>e.jsx(L,{column:t,title:"Created At"}),enableSorting:!1,meta:{className:"text-left",displayName:"Status"},cell:({row:t})=>{const s=t.getValue("createdAt");return new Date(s).toLocaleDateString()}}),Ze.display({id:"edit",header:"Edit",enableSorting:!1,enableHiding:!1,meta:{className:"text-right",displayName:"Edit"},cell:({row:t,table:s})=>{var r,i,n;const a=(r=s.options.meta)==null?void 0:r.organizationId;return e.jsxs(Le,{children:[e.jsx(Ee,{asChild:!0,children:e.jsx(z,{variant:"ghost",className:"group aspect-square px-1.5 py-0! h-8! hover:border hover:border-gray-300 data-[state=open]:border-gray-300 data-[state=open]:bg-gray-50 dark:hover:border-gray-700 dark:data-[state=open]:border-gray-700 dark:data-[state=open]:bg-gray-900",children:e.jsx(C.RiMoreFill,{className:"size-4 shrink-0 text-gray-500 group-hover:text-gray-700 group-data-[state=open]:text-gray-700 dark:group-hover:text-gray-300 dark:group-data-[state=open]:text-gray-300","aria-hidden":"true"})})}),e.jsxs(De,{align:"end",className:"min-w-40",children:[e.jsx(fe,{children:e.jsx(H,{href:((n=(i=s.options.meta)==null?void 0:i.routes)==null?void 0:n.manufacturerEdit(a,t.getValue("id")))??`/admin/${a}/manufacturers/${t.getValue("id")}`,className:"block",children:"Edit"})}),e.jsx(fe,{className:"text-red-600 dark:text-red-500",children:"Delete"})]})]})}})],Ql=()=>{const{client:t}=E(),s=Y(),a=K(),r=Q.useSearchParams(),[i,n]=x.useState(""),[o]=Fe.useDebounce(i,300),l=Number((r==null?void 0:r.get("page"))||"1"),{isLoading:d,isRefetching:c,isError:u,data:p}=R.useQuery({queryKey:["manufacturers",a,l,o],queryFn:async()=>{const{body:g,status:h}=await t.manufacturer.getManufacturers({params:{organizationId:a},query:{page:l,limit:10,search:o}});if(h!==200)throw new Error("Failed to fetch organizations");return g},placeholderData:R.keepPreviousData});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 sm:gap-x-6",children:[e.jsx("div",{className:"flex w-full flex-col gap-2 sm:w-fit sm:flex-row sm:items-center",children:e.jsx(at,{type:"search",placeholder:"Search by manufaturer...",value:i,onChange:g=>n(g.target.value),className:"w-full sm:max-w-[250px] sm:[&>input]:h-[40px]"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(z,{asChild:!0,className:"hidden gap-x-2 px-2 py-1.5 text-sm sm:text-xs lg:flex",children:e.jsxs(H,{href:s.manufacturerCreate(a),children:["Create Manufacturer",e.jsx(A.PlusIcon,{className:"size-4 shrink-0","aria-hidden":"true"})]})})})]}),e.jsx(st,{error:u,loading:d||c,meta:p!=null&&p.meta?{...p==null?void 0:p.meta,currentPage:l}:void 0,data:(p==null?void 0:p.list)||[],columns:Tl,className:"mt-8"})]})};function zl(){return e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 sm:text-2xl dark:text-gray-50",children:"Manufacturers List"}),e.jsx("div",{className:"mt-4 sm:mt-6 lg:mt-10",children:e.jsx(Ql,{})})]})}const Il=({organizationId:t,id:s,status:a,refetch:r})=>{var y;const{client:i}=E(),n=R.useMutation({mutationFn:async({operation:b})=>{if((await i.order.updateStatus({params:{id:s,organizationId:t,operation:b}})).status!==200)throw new Error("Failed to update order status");return r()}}),o=(()=>{switch(a){case"pending":return"Accept";case"accepted":return"Ready";case"ready-for-dispatch":return"Dispatch";case"dispatched":return"Complete";case"completed":return"Completed";case"cancelled":return"Cancelled";default:return"Unknown"}})(),l=()=>{const b=(()=>{switch(a){case"pending":return"accepted";case"accepted":return"ready-for-dispatch";case"ready-for-dispatch":return"dispatched";case"dispatched":return"completed";default:return null}})();b&&n.mutate({operation:b})},d=()=>{n.mutate({operation:"cancelled"})},c=n.isPending,u=(y=n.variables)==null?void 0:y.operation,p=c&&u==="cancelled",g=c&&u!=="cancelled",h=a!=="completed"&&a!=="cancelled";return e.jsxs("div",{className:"flex items-center gap-2 min-w-28",children:[e.jsxs("button",{onClick:d,disabled:c||a==="cancelled"||a==="completed",className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600","tremor-id":"tremor-raw",children:[p?"Loading...":"Cancel",e.jsx(A.X,{className:"w-4 h-4 text-red-600 dark:text-red-500"})]}),h&&e.jsxs("button",{onClick:l,disabled:c,className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600","tremor-id":"tremor-raw",children:[g?"Loading...":o,e.jsx(A.CheckCircle,{className:"w-4 h-4 text-emerald-600 dark:text-emerald-500"})]})]})},Ll=({open:t,onOpenChange:s,order:a})=>{var n,o,l,d,c,u,p;if(!a)return null;const r=g=>new Intl.NumberFormat("en-US",{style:"currency",currency:a.currency||"PLN"}).format(g),i=g=>{switch(g){case"pending":return"yellow";case"accepted":return"blue";case"ready-for-dispatch":return"purple";case"dispatched":return"orange";case"completed":return"green";case"cancelled":return"red";default:return"gray"}};return e.jsx(xt,{open:t,onOpenChange:s,children:e.jsxs(ft,{className:"sm:max-w-3xl overflow-y-auto max-h-[85vh]",children:[e.jsxs(yt,{children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs(wt,{children:["Order Details #",a.referenceId]}),e.jsx(Et,{className:"rounded-full hover:bg-gray-200 p-1 dark:hover:bg-gray-800",children:e.jsx(A.X,{className:"h-5 w-5"})})]}),e.jsx(bt,{children:a.acceptedAt?`Ordered on ${T.format(new Date(a.acceptedAt),"MMMM dd, yyyy")}`:"Order details"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mt-4",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100 mb-3",children:"Order Status"}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Status"}),e.jsx(We,{color:i(a.status||"pending"),variant:"neutral",children:a.status||"Pending"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Accepted At"}),e.jsx("span",{children:a.acceptedAt?T.format(new Date(a.acceptedAt),"dd.MM.yyyy HH:mm"):"N/A"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Ready For Dispatch"}),e.jsx("span",{children:a.readyForDispatchAt?T.format(new Date(a.readyForDispatchAt),"dd.MM.yyyy HH:mm"):"N/A"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Dispatched At"}),e.jsx("span",{children:a.dispatchedAt?T.format(new Date(a.dispatchedAt),"dd.MM.yyyy HH:mm"):"N/A"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Completed At"}),e.jsx("span",{children:a.completedAt?T.format(new Date(a.completedAt),"dd.MM.yyyy HH:mm"):"N/A"})]})]})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100 mb-3",children:"Payment Information"}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Method"}),e.jsx("span",{className:"font-medium",children:((n=a.payment)==null?void 0:n.method)||"N/A"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Provider"}),e.jsx("span",{children:((o=a.payment)==null?void 0:o.provider)||"N/A"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Status"}),e.jsx(We,{color:((l=a.payment)==null?void 0:l.status)==="succeeded"?"green":"yellow",variant:"neutral",children:((d=a.payment)==null?void 0:d.status)||"Pending"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Total Amount"}),e.jsx("span",{className:"font-bold",children:r(Number((c=a.payment)==null?void 0:c.total)||0)})]})]})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100 mb-3",children:a.fulfilmentMethod==="pickup"?"Pickup Details":"Shipping Address"}),a.shippingAddress?e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("p",{className:"font-medium",children:[a.shippingAddress.firstname," ",a.shippingAddress.lastname]}),e.jsxs("p",{children:[a.shippingAddress.addressLineOne,a.shippingAddress.doorNumber?`, ${a.shippingAddress.doorNumber}`:""]}),e.jsxs("p",{children:[a.shippingAddress.zipCode,", ",a.shippingAddress.city]}),e.jsx("p",{children:a.shippingAddress.country}),a.shippingAddress.phone&&e.jsxs("p",{className:"mt-2",children:["Phone: ",a.shippingAddress.phone]})]}):e.jsx("p",{className:"text-gray-500",children:"No address information available"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100 mb-3",children:"Fulfilment Details"}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Fulfilment Method"}),e.jsx(We,{color:"blue",variant:"neutral",children:a.fulfilmentMethod||"N/A"})]}),a.fulfilmentMethod==="delivery"&&e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Shipping Method"}),e.jsx("span",{children:((u=a.shippingMethod)==null?void 0:u.title)||"Standard Shipping"})]})]})]})]}),e.jsxs("div",{className:"mt-6 bg-gray-50 dark:bg-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100 mb-3",children:"Order Items"}),e.jsx("div",{className:"divide-y divide-gray-200 dark:divide-gray-800",children:a.items.map((g,h)=>{const y=g.translations.find(b=>b.locale==="en")||g.translations[0];return e.jsxs("div",{className:"py-3 flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[g.image&&e.jsx("div",{className:"h-16 w-16 rounded overflow-hidden shrink-0",children:e.jsx("img",{src:g.image.url,alt:(y==null?void 0:y.title)||"Product",className:"h-full w-full object-cover"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:(y==null?void 0:y.title)||"Product"}),(y==null?void 0:y.subtitle)&&e.jsx("p",{className:"text-sm text-gray-500",children:y.subtitle}),e.jsxs("p",{className:"text-sm mt-1",children:[r(g.unitPrice)," × ",g.quantity]})]})]}),e.jsx("div",{className:"font-medium",children:r(g.totalPrice)})]},h)})}),e.jsx("div",{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-800",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"font-medium",children:"Total"}),e.jsx("span",{className:"font-bold text-lg",children:r(Number((p=a.payment)==null?void 0:p.total)||0)})]})})]})]})})},El=({order:t})=>{const[s,a]=x.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>a(!0),className:"text-blue-500 hover:underline",children:String(t.id).slice(-5)}),e.jsx(Ll,{open:s,onOpenChange:a,order:t})]})},Dl=({order:t,table:s})=>{const a=s.options.meta,r=(a==null?void 0:a.organizationId)||"",i=typeof(a==null?void 0:a.refetch)=="function"?a.refetch:()=>{};return e.jsx(Il,{organizationId:r,id:t.id,status:t.status,refetch:i})},Qe=ge.createColumnHelper(),Ml=[Qe.accessor("id",{header:({column:t})=>e.jsx(L,{column:t,title:"ID"}),meta:{className:"text-left",displayName:"ID"},cell:({row:t})=>e.jsx(El,{order:t.original}),enableSorting:!0,enableHiding:!1}),Qe.accessor("referenceId",{header:({column:t})=>e.jsx(L,{column:t,title:"Reference ID"}),cell:({row:t})=>e.jsx("div",{className:"w-[100px]",children:t.getValue("referenceId")}),meta:{className:"text-left",displayName:"ID"},enableSorting:!1,enableHiding:!1}),Qe.display({id:"customer",meta:{className:"text-left",displayName:"ID"},header:({column:t})=>e.jsx(L,{column:t,title:"Customer"}),cell:({row:t})=>{var r,i;const s=((r=t.original.shippingAddress)==null?void 0:r.firstname)||"",a=((i=t.original.shippingAddress)==null?void 0:i.lastname)||"";return e.jsx("div",{children:`${s} ${a}`.trim()||"N/A"})}}),Qe.accessor("payment.total",{meta:{className:"text-left",displayName:"ID"},enableSorting:!0,enableHiding:!1,header:({column:t})=>e.jsx(L,{column:t,title:"Total"}),cell:({row:t})=>{const s=parseFloat(t.original.payment.total.toString()),a=new Intl.NumberFormat("en-US",{style:"currency",currency:t.original.currency||"PLN"}).format(s);return e.jsx("div",{className:"font-medium",children:a})}}),Qe.accessor("createdAt",{meta:{className:"text-left",displayName:"ID"},enableSorting:!0,enableHiding:!1,header:({column:t})=>e.jsx(L,{column:t,title:"Date & Time"}),cell:({row:t})=>{const s=t.getValue("createdAt");return s?T.format(new Date(s),"dd.MM.yyyy HH:mm"):"N/A"}}),Qe.display({id:"paymentMethod",header:({column:t})=>e.jsx(L,{column:t,title:"Payment Method"}),cell:({row:t})=>{var a;const s=(a=t.original.payment)==null?void 0:a.method;return e.jsx("div",{children:s||"N/A"})}}),Qe.display({id:"address",meta:{className:"text-left",displayName:"ID"},header:({column:t})=>e.jsx(L,{column:t,title:"Address"}),cell:({row:t})=>{var n,o,l,d;const s=((n=t.original.shippingAddress)==null?void 0:n.addressLineOne)||"",a=((o=t.original.shippingAddress)==null?void 0:o.city)||"",r=((l=t.original.shippingAddress)==null?void 0:l.doorNumber)||"",i=((d=t.original.shippingAddress)==null?void 0:d.zipCode)||"";return e.jsxs("div",{children:[e.jsxs("div",{children:[s," ",r?` / ${r}`:""]}),e.jsxs("div",{children:[i?`${i}, `:"",a]})]})}}),Qe.display({id:"status",header:({column:t})=>e.jsx(L,{column:t,title:"Actions"}),cell:({row:t,table:s})=>e.jsx(Dl,{order:t.original,table:s})})],Bl=()=>{const{client:t}=E(),s=K(),a=Q.useSearchParams(),[r,i]=x.useState(""),[n]=Fe.useDebounce(r,300),o=Number((a==null?void 0:a.get("page"))||"1"),{isLoading:l,isRefetching:d,isError:c,data:u,refetch:p}=R.useQuery({queryKey:["orders",s,o,n],queryFn:async()=>{const{body:g,status:h}=await t.order.getOrders({params:{organizationId:s},query:{page:o,limit:10,search:n}});if(h!==200)throw new Error("Failed to fetch orders");return g},placeholderData:R.keepPreviousData});return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 sm:gap-x-6",children:e.jsx("div",{className:"flex w-full flex-col gap-2 sm:w-fit sm:flex-row sm:items-center",children:e.jsx(at,{type:"search",placeholder:"Search by order reference...",value:r,onChange:g=>i(g.target.value),className:"w-full sm:max-w-[250px] sm:[&>input]:h-[40px]"})})}),e.jsx(st,{error:c,loading:l||d,meta:u!=null&&u.meta?{...u==null?void 0:u.meta,currentPage:o}:void 0,data:(u==null?void 0:u.list)||[],columns:Ml,className:"mt-8",refetch:p})]})};function Jl(){return e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 sm:text-2xl dark:text-gray-50",children:"Orders List"}),e.jsx("div",{className:"mt-4 sm:mt-6 lg:mt-10",children:e.jsx(Bl,{})})]})}const ci=({onClose:t,initialData:s})=>{var c;const{client:a}=E(),r=F.useForm({resolver:ue.zodResolver(s?bs:Ea),defaultValues:{...s}}),i=r.watch("address.placeId"),n=r.watch("address.addressLineOne");x.useEffect(()=>{(async()=>{if(i){const{status:u,body:p}=await a.location.getPlaceDetails({params:{placeId:i}});if(u!==200)throw new Error("Failed to fetch place details");r.setValue("address.zipCode",p.zipCode,{shouldValidate:!0}),r.setValue("address.city",p.city,{shouldValidate:!0}),r.setValue("address.country",p.country,{shouldValidate:!0})}})()},[r,i]);const o=R.useMutation({mutationFn:async u=>{const{logoFile:p,...g}=u;return await a.organization.createOrganization({body:{...g,logoId:p==null?void 0:p.id}})},onSuccess:async()=>{await Ae.invalidateQueries({queryKey:["organizations"]}),t&&t()}}),l=R.useMutation({mutationFn:async u=>{const{logoFile:p,...g}=u;return await a.organization.updateOrganization({params:{organizationId:s.id},body:{...g,logoId:p==null?void 0:p.id}})},onSuccess:async()=>{await Ae.invalidateQueries({queryKey:["organizations"]}),t&&t()}}),d=u=>{s?l.mutate(u):o.mutate(u)};return e.jsx("div",{className:"mt-6",children:e.jsx(F.FormProvider,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(u=>d(u)),className:"grid gap-5 grid-cols-4",children:[e.jsx(ae,{name:"name",label:"Organization Name",placeholder:"Acme Inc.",className:"col-span-2"}),e.jsx(ae,{name:"email",type:"email",label:"Support Email",placeholder:"john.doe@example.com",className:"col-span-2"}),e.jsx(ae,{name:"phone",type:"phone-number",label:"Phone Number",placeholder:"Enter phone number",className:"col-span-4"}),e.jsxs("div",{className:"col-span-4 text-sm text-gray-500",children:[e.jsx(le,{htmlFor:"address.addressLineOne",className:"font-medium flex items-center justify-between",children:"Street / Address Line 1"}),e.jsx(qt,{onChange:u=>{r.setValue("address.addressLineOne",u.addressLineOne,{shouldValidate:!0}),r.setValue("address.placeId",u.placeId,{shouldValidate:!0})},value:n??""}),((c=r.formState.errors.address)==null?void 0:c.addressLineOne)&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:r.formState.errors.address.addressLineOne.message})]}),e.jsx(ae,{name:"address.addressLineTwo",label:"Door / Address Line 2",placeholder:"Apt 123",className:"col-span-2"}),e.jsx(ae,{name:"address.zipCode",label:"Postal Code",placeholder:"12345",className:"col-span-2"}),e.jsx(ae,{name:"address.city",label:"City",placeholder:"New York",className:"col-span-2"}),e.jsx(ae,{name:"address.country",label:"Country",placeholder:"United States",className:"col-span-2",type:"country"}),e.jsx(ae,{name:"logoFile",label:"Logo",type:"file",className:"col-span-2"}),e.jsxs("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 mt-5 col-span-full border-t pt-7",children:[t&&e.jsx(z,{type:"button",className:"w-full sm:w-fit",variant:"secondary",onClick:t,children:"Cancel"}),e.jsx(z,{type:"submit",className:"w-full sm:w-fit",isLoading:o.isPending||l.isPending,loadingText:"Saving...",children:s?"Update Data":"Create Organization"})]})]})})})},Ol=()=>{const[t,s]=x.useState(!1),a=Y(),{organizations:r}=pe(),i=()=>s(!1);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"max-w-4xl mx-auto py-8 px-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-900 dark:text-gray-50",children:"Organizations"}),e.jsx("p",{className:"text-gray-500 sm:text-sm/6 dark:text-gray-500",children:"Select a organization to get started."})]}),e.jsx("div",{className:"w-min h-min",children:e.jsxs(z,{onClick:()=>s(!0),variant:"primary",children:[e.jsx(A.PlusIcon,{className:"w-4 h-4 mr-1"})," Add New"]})})]}),r.loading?e.jsx("div",{className:"flex justify-center items-center h-32 mt-5",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsxs("svg",{"aria-hidden":"true",className:"w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),e.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),e.jsx("p",{className:"text-gray-500 text-sm mt-2",children:"Loading organizations..."})]})}):e.jsx("div",{className:"grid grid-cols-1 gap-y-3 gap-x-4 animate-fade-in mt-5",children:r.data.map(n=>{var o,l;return e.jsxs("div",{className:"relative flex items-center rounded-md border border-gray-200 bg-white px-4 py-3 shadow-xs dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("span",{className:"absolute inset-x-0 top-1/2 h-10 w-1 -translate-y-1/2 rounded-r-md bg-blue-500 dark:bg-blue-500","aria-hidden":"true"}),n.logoFile?e.jsx(xe,{src:n.logoFile.url,alt:n.name,width:100,height:100,className:"rounded-lg ml-2 h-16 w-16 object-cover"}):e.jsx("div",{className:"rounded-full ml-2",children:e.jsxs("div",{className:"rounded-full h-14 w-14 bg-blue-500 text-white text-xl flex items-center justify-center",children:[n.name.charAt(0).toUpperCase(),n.name.charAt(1).toUpperCase()]})}),e.jsxs("div",{className:"border-l ml-6 pl-6 flex justify-between items-center w-full",children:[e.jsxs("div",{children:[e.jsx("p",{className:"flex items-center justify-between gap-2",children:e.jsx("span",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:n.name})}),e.jsx("p",{className:"flex items-center justify-between gap-2",children:e.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-500",children:[(o=n.address)==null?void 0:o.addressLineOne,","," ",(l=n.address)==null?void 0:l.city]})})]}),e.jsx("div",{children:e.jsx(H,{className:"block rounded-full text-blue-500 p-2 hover:bg-blue-500 hover:text-white hover:translate-y-[-2px] hover:shadow-lg transition mr-2 border border-gray-200 dark:border-gray-700/60 hover:border-blue-500",href:a.dashboard(n.id),children:e.jsx(A.ArrowRight,{className:"w-5 h-5"})})})]})]},n.id)})})]}),e.jsxs(xt,{onOpenChange:i,open:t,children:[e.jsx(Ts,{className:"w-full text-left"}),e.jsxs(ft,{className:"sm:max-w-xl",children:[e.jsxs(yt,{children:[e.jsx(wt,{children:"Create a Organization"}),e.jsx(bt,{className:"mt-1 text-sm leading-6",children:"Fill in the details below to create a new organization"})]}),e.jsx(ci,{onClose:i})]})]})]})};function Fl(){const{appearance:t}=fr(),s=t==null?void 0:t.organizationImage;return e.jsxs("div",{className:"flex w-full min-h-screen",children:[s&&e.jsx("div",{className:"hidden lg:block relative w-1/2 overflow-hidden",children:e.jsx(xe,{src:s,alt:"Organization Visual",width:4e3,height:2250,className:"w-full h-full object-cover min-h-screen"})}),e.jsx("div",{className:`w-full ${s?"lg:w-1/2":""} flex items-center justify-center p-8`,children:e.jsx("div",{className:"w-full max-w-md space-y-8",children:e.jsx(Ol,{})})})]})}const Je=ge.createColumnHelper(),Vl=({row:t,table:s})=>{var d,c;const{client:a}=E(),r=t.getValue("publishedAt"),i=(d=s.options.meta)==null?void 0:d.organizationId,n=(c=s.options.meta)==null?void 0:c.refetch,o=R.useMutation({mutationFn:async()=>{if((await a.productCategory.updateStatus({params:{id:t.getValue("id"),organizationId:i,operation:r?"unpublish":"publish"}})).status!==200)throw new Error("Failed to update product category status");n&&await n()}}),l=()=>{o.mutate()};return o.isPending?e.jsx("div",{className:"min-w-28",children:e.jsxs("button",{className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600","tremor-id":"tremor-raw",disabled:!0,children:[e.jsx(ce,{className:"w-4 h-4"})," Saving..."]})}):e.jsx("div",{className:"min-w-28",children:e.jsxs("button",{onClick:l,className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600","tremor-id":"tremor-raw",children:[r?e.jsx(A.CheckCircle,{className:"w-4 h-4 text-emerald-600 dark:text-emerald-500"}):e.jsx(A.EyeOffIcon,{className:"w-4 h-4 text-red-600 dark:text-red-500"}),r?"Published":"Draft"]})})},Hl=({row:t,table:s})=>{var l,d,c,u;const{client:a}=E(),r=(l=s.options.meta)==null?void 0:l.organizationId,i=(d=s.options.meta)==null?void 0:d.refetch,n=R.useMutation({mutationFn:async()=>{if((await a.productCategory.deleteProductCategory({params:{id:t.getValue("id"),organizationId:r}})).status!==204)throw new Error("Failed to delete product category");i&&await i()}}),o=()=>{window.confirm("Are you sure you want to delete this product category? This action cannot be undone.")&&n.mutate()};return e.jsxs(Le,{children:[e.jsx(Ee,{asChild:!0,children:e.jsx(z,{variant:"ghost",className:"group aspect-square px-1.5 py-0! h-8! hover:border hover:border-gray-300 data-[state=open]:border-gray-300 data-[state=open]:bg-gray-50 dark:hover:border-gray-700 dark:data-[state=open]:border-gray-700 dark:data-[state=open]:bg-gray-900",disabled:n.isPending,children:n.isPending?e.jsx(ce,{className:"size-4 shrink-0"}):e.jsx(C.RiMoreFill,{className:"size-4 shrink-0 text-gray-500 group-hover:text-gray-700 group-data-[state=open]:text-gray-700 dark:group-hover:text-gray-300 dark:group-data-[state=open]:text-gray-300","aria-hidden":"true"})})}),e.jsxs(De,{align:"end",className:"min-w-40",children:[e.jsx(fe,{children:e.jsxs(H,{href:((u=(c=s.options.meta)==null?void 0:c.routes)==null?void 0:u.productCategoryEdit(r,t.getValue("id")))??`/admin/${r}/product-categories/${t.getValue("id")}`,className:"block flex items-center gap-2",children:[e.jsx(A.PencilIcon,{className:"w-4 h-4"}),"Edit"]})}),e.jsx(fe,{className:"text-red-600 dark:text-red-500 cursor-pointer",onClick:o,disabled:n.isPending,children:e.jsxs("div",{className:"flex items-center gap-2",children:[n.isPending?e.jsx(ce,{className:"w-4 h-4"}):e.jsx(A.Trash2,{className:"w-4 h-4"}),n.isPending?"Deleting...":"Delete"]})})]})]})},Zl=[Je.display({id:"select",header:({table:t})=>e.jsx(ve,{checked:t.getIsAllPageRowsSelected()?!0:t.getIsSomeRowsSelected()?"indeterminate":!1,onCheckedChange:()=>t.toggleAllPageRowsSelected(),className:"translate-y-0.5","aria-label":"Select all"}),cell:({row:t})=>e.jsx(ve,{checked:t.getIsSelected(),onCheckedChange:()=>t.toggleSelected(),className:"translate-y-0.5","aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,meta:{displayName:"Select"}}),Je.accessor("id",{header:({column:t})=>e.jsx(L,{column:t,title:"Id"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"ID"},cell:({row:t,table:s})=>{var r,i,n;const a=(r=s.options.meta)==null?void 0:r.organizationId;return e.jsx(H,{href:((n=(i=s.options.meta)==null?void 0:i.routes)==null?void 0:n.productCategoryEdit(a,t.getValue("id")))??`/admin/${a}/product-categories/${t.getValue("id")}`,className:"text-blue-500",children:t.getValue("id")})}}),Je.accessor("slug",{header:({column:t})=>e.jsx(L,{column:t,title:"Slug"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Slug"}}),Je.accessor("title",{header:({column:t})=>e.jsx(L,{column:t,title:"Title"}),enableSorting:!1,meta:{className:"text-left",displayName:"Name"}}),Je.accessor("publishedAt",{header:({column:t})=>e.jsx(L,{column:t,title:"Status"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Status"},cell:({row:t,table:s})=>e.jsx(Vl,{row:t,table:s})}),Je.accessor("createdAt",{header:({column:t})=>e.jsx(L,{column:t,title:"Created At"}),enableSorting:!1,meta:{className:"text-left",displayName:"Created At"},cell:({row:t})=>{const s=t.getValue("createdAt");return new Date(s).toLocaleDateString()}}),Je.display({id:"edit",header:"Edit",enableSorting:!1,enableHiding:!1,meta:{className:"text-right",displayName:"Edit"},cell:({row:t,table:s})=>e.jsx(Hl,{row:t,table:s})})],Ul=()=>{const{client:t}=E(),s=Y(),{defaultLocale:a}=pe(),r=K(),i=Q.useSearchParams(),[n,o]=x.useState(""),l=Number((i==null?void 0:i.get("page"))||"1"),[d]=Fe.useDebounce(n,300),{isLoading:c,isRefetching:u,isError:p,data:g,refetch:h}=R.useQuery({queryKey:["productCategories",r,l,d,a],queryFn:async()=>{const{body:y,status:b}=await t.productCategory.getProductCategories({params:{organizationId:r},query:{page:l,limit:10,search:d,locale:a}});if(b!==200)throw new Error("Failed to fetch product categories");return y},placeholderData:R.keepPreviousData});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 sm:gap-x-6",children:[e.jsx("div",{className:"flex w-full flex-col gap-2 sm:w-fit sm:flex-row sm:items-center",children:e.jsx(at,{type:"search",placeholder:"Search by product category...",value:n,onChange:y=>o(y.target.value),className:"w-full sm:max-w-[250px] sm:[&>input]:h-[40px]"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(z,{asChild:!0,className:"hidden gap-x-2 px-2 py-1.5 text-sm sm:text-xs lg:flex",children:e.jsxs(H,{href:s.productCategoryCreate(r),children:["Create Product Category",e.jsx(A.PlusIcon,{className:"size-4 shrink-0","aria-hidden":"true"})]})})})]}),e.jsx(st,{error:p,loading:c||u,meta:g==null?void 0:g.meta,data:(g==null?void 0:g.list)||[],columns:Zl,className:"mt-8",refetch:h})]})};function Wl(){return e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 sm:text-2xl dark:text-gray-50",children:"Product Categories List"}),e.jsx("div",{className:"mt-4 sm:mt-6 lg:mt-10",children:e.jsx(Ul,{})})]})}const _l=[{name:"slug",label:"Slug",type:"text",placeholder:"electronics",colspan:2},{name:"title",label:"Title",type:"text",placeholder:"Electronics",colspan:2,localizable:!0},{name:"description",label:"Description",type:"textarea",placeholder:"All electronic devices and accessories.",colspan:2,localizable:!0},{name:"image",label:"Image",type:"file"}],ui=({initialData:t})=>{const{client:s}=E(),a=Q.useRouter(),r=Y(),i=K(),{defaultLocale:n,supportedLocales:o}=pe(),l=t?tn:en,d=F.useForm({resolver:ue.zodResolver(l),defaultValues:t?{defaultLocale:n,slug:t.slug,image:t.image,translations:t.translations}:{defaultLocale:n,translations:o.map(h=>({locale:h}))}}),c=R.useMutation({mutationFn:async h=>{var f;const y={slug:h.slug,defaultLocale:h.defaultLocale,translations:h.translations,imageId:(f=h.image)==null?void 0:f.id},{status:b}=await s.productCategory.createProductCategory({params:{organizationId:i},body:y});if(b!==201)throw X.error("Failed to create product category. Please try again later."),new Error("Failed to create product category")}}),u=R.useMutation({mutationFn:async h=>{var f;const y={slug:h.slug,defaultLocale:h.defaultLocale,translations:h.translations,imageId:((f=h.image)==null?void 0:f.id)||null},{status:b}=await s.productCategory.updateProductCategory({params:{organizationId:i,id:t.id},body:y});if(b!==200)throw X.error("Failed to update product category. Please try again later."),new Error("Failed to update product category")}}),p=async()=>{X.success("Product category saved successfully"),a.push(r.productCategories(i)),await Ae.invalidateQueries({queryKey:["productCategories"]})},g=h=>{t?u.mutate(h,{onSuccess:p}):c.mutate(h,{onSuccess:p})};return e.jsx(Ne,{form:d,config:_l,onSubmit:g,loading:c.isPending||u.isPending,cancelText:"Go back",okText:t?"Update Product Category":"Create Product Category"})};function ql(){return e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Create Product Category"}),e.jsx($,{}),e.jsx("div",{className:"pt-6",children:e.jsx("div",{className:"space-y-10",children:e.jsx("section",{"aria-labelledby":"product-category-info",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-category-info",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Product Category Information"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Enter the information about the product category."})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(ui,{})})]})})})})]})}function $l(){const t=K(),s=gt(),{client:a}=E(),{isLoading:r,data:i}=R.useQuery({queryKey:["productCategories",t,s],queryFn:async()=>{const{status:n,body:o}=await a.productCategory.getProductCategory({params:{id:s,organizationId:t}});if(n!==200)throw X.error("Failed to fetch product category. Please refresh or try again later."),new Error("Failed to fetch product category");return o},throwOnError:!0,placeholderData:R.keepPreviousData});return e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Edit Product Category"}),e.jsx($,{}),e.jsx("div",{className:"pt-6",children:e.jsx("div",{className:"space-y-10",children:e.jsx("section",{"aria-labelledby":"product-category-info",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-category-info",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Product Category Information"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Enter the information about the product category."})]}),e.jsx("div",{className:"md:col-span-2",children:r||!i?e.jsx("div",{className:"flex justify-center items-center h-[500px] mt-5",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(ce,{className:"w-12 h-12"}),e.jsx("p",{className:"text-gray-500 text-sm mt-3",children:"Loading data..."})]})}):e.jsx(ui,{initialData:i})})]})})})})]})}const Gl=({form:t})=>{const{client:s}=E(),a=K(),{data:r}=R.useQuery({queryKey:["product-categories",a],queryFn:async()=>{const o=await s.productCategory.getProductCategories({params:{organizationId:a},query:{limit:100}});if(o.status!==200)throw new Error("Failed to fetch product categories");return o.body.list.map(l=>({label:l.translations[0].title||"",value:l.id}))},throwOnError:!0}),{data:i}=R.useQuery({queryKey:["manufacturers",a],queryFn:async()=>{const o=await s.manufacturer.getManufacturers({params:{organizationId:a},query:{limit:100}});if(o.status!==200)throw new Error("Failed to fetch product categories");return o.body.list.map(l=>({label:l.name,value:l.id}))},throwOnError:!0}),n=[{name:"title",label:"Title",type:"text",placeholder:"Enter product name",colspan:2,localizable:!0},{name:"description",label:"Description",type:"textarea",placeholder:"Enter product description",colspan:2,localizable:!0},{name:"slug",label:"Slug",type:"text",placeholder:"Enter a URL-friendly slug"},{name:"sku",label:"SKU (Stock Keeping Unit)",type:"text",placeholder:"Enter SKU"},{name:"categories",label:"Categories",type:"select",options:r||[],multiple:!0},{name:"manufacturerId",label:"Manufacturer",type:"select",options:i||[]},{name:"images",label:"Images",type:"file",multiple:!0,colspan:2}];return e.jsx("section",{"aria-labelledby":"product-information",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-information",className:"text-lg scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Basic Information"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Enter the basic information of your product, including the name, description, base price, and other essential details."})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(Ne,{form:t,config:n})})]})})},Kl=({form:t})=>{const[s,a]=x.useState([]);x.useEffect(()=>{const l=t.getValues("metadata")||{},d=Object.entries(l);d.length>0&&a(d.map(([c,u],p)=>({id:`metadata-${p}-${Date.now()}`,key:c,value:u})))},[t]);const r=x.useCallback(l=>{const d={};l.forEach(c=>{c.key&&c.value&&(d[c.key]=c.value)}),t.setValue("metadata",Object.keys(d).length>0?d:void 0)},[t]),i=()=>{const l={id:`metadata-${Date.now()}`,key:"",value:""},d=[...s,l];a(d)},n=l=>{const d=s.filter((c,u)=>u!==l);a(d),r(d)},o=(l,d,c)=>{const u=[...s];u[l][d]=c,a(u),r(u)};return e.jsx("section",{"aria-labelledby":"product-metadata",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-metadata",className:"text-lg scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Metadata"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Add custom key-value pairs to store additional information about your product. Keys must start with a letter and contain only letters, numbers, underscores, or dashes."})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsxs("div",{className:"space-y-4",children:[s.map((l,d)=>e.jsxs("div",{className:"flex gap-4 items-start",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(be,{htmlFor:`metadata-key-${d}`,className:"font-medium",children:"Key"}),e.jsx(he,{id:`metadata-key-${d}`,type:"text",value:l.key,onChange:c=>o(d,"key",c.target.value),placeholder:"e.g., color, size, weight",className:"mt-2"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx(be,{htmlFor:`metadata-value-${d}`,className:"font-medium",children:"Value"}),e.jsx(he,{id:`metadata-value-${d}`,type:"text",value:l.value,onChange:c=>o(d,"value",c.target.value),placeholder:"e.g., red, large, 2.5kg",className:"mt-2"})]}),e.jsx(z,{type:"button",variant:"destructive",className:"mt-8 min-w-[42px] h-[42px] p-0",onClick:()=>n(d),children:e.jsx(A.TrashIcon,{className:"w-4 h-4"})})]},l.id)),s.length===0&&e.jsx("p",{className:"text-sm text-gray-500 italic",children:"No metadata added yet. Click the button below to add key-value pairs."}),e.jsxs(z,{type:"button",variant:"secondary",onClick:i,className:"w-full shadow-none mt-2",children:[e.jsx(A.PlusIcon,{className:"w-4 h-4 mr-2"}),"Add Row"]})]})})]})})},Xl=({open:t,onClose:s,initialData:a,onSubmit:r})=>{const{defaultLocale:i,supportedLocales:n}=pe(),o=F.useForm({resolver:ue.zodResolver(va),defaultValues:a?{...a,defaultLocale:i}:{defaultLocale:i,translations:n.map(p=>({locale:p,title:""})),modifiers:[{title:"",price:0}]}}),{fields:l,append:d,remove:c}=F.useFieldArray({control:o.control,name:"modifiers"}),u=p=>{r(p),s(),o.reset({defaultLocale:i,translations:n.map(g=>({locale:g,title:""})),modifiers:[{title:"",price:0}]})};return e.jsx(xt,{open:t,onOpenChange:s,children:e.jsxs(ft,{className:"max-w-[710px]",children:[e.jsxs(yt,{children:[e.jsx(wt,{children:"New Modifier Group"}),e.jsx(bt,{className:"text-sm mb-5",children:"Modifiers allow you to create different variants of the same product. Create or choose existing modifiers for your product."})]}),e.jsxs(F.FormProvider,{...o,children:[e.jsx(Ne,{form:o,config:[{name:"title",label:"Group Title",type:"text",placeholder:'For example: "Spice Level" or "Select toppings".',colspan:2,localizable:!0},{name:"selectMin",label:"Select Min",type:"number",placeholder:"Minimum selections",colspan:1},{name:"selectMax",label:"Select Max",type:"number",placeholder:"Maximum selections",colspan:1}]}),e.jsx("h3",{className:"text-lg font-semibold mt-6",children:"Modifier Options"}),e.jsx("p",{className:"text-sm text-gray-500 mb-6 mt-1",children:"Add options to this modifier group. Modifier options are the different variants of the product. The price adds to the base price of the product. Leave the price as 0 if it's free."}),l.map((p,g)=>e.jsxs("div",{className:"mb-4 flex",children:[e.jsx(Ne,{form:o,columns:2,config:[{name:`modifiers.${g}.title`,label:"Title",type:"text",placeholder:'eg: "Mild" or "Pepperoni"',colspan:1},{name:`modifiers.${g}.price`,label:"Price",type:"number",placeholder:"Price for this modifier",colspan:1,prefix:"USD"}]}),l.length>1&&e.jsx(z,{type:"button",variant:"destructive",className:"mt-auto ml-4 min-w-[42px] h-[42px] p-0! shadow-none!",onClick:()=>c(g),children:e.jsx(A.XIcon,{className:"w-4 h-4"})})]},p.id)),e.jsx(z,{type:"button",variant:"secondary",className:"mb-4 mt-4 ml-auto w-full shadow-none",onClick:()=>d({title:"",price:0}),children:"Add Another Option"}),e.jsx($,{className:"mt-8 mb-6"}),e.jsxs("div",{className:"flex justify-end space-x-3 mt-6 col-span-full",children:[e.jsx(z,{type:"button",className:"w-full sm:w-fit",variant:"secondary",onClick:s,children:"Cancel"}),e.jsx(z,{type:"button",className:"w-full sm:w-fit",onClick:o.handleSubmit(u),children:a?"Save Modifier Group":"Create Modifier Group"})]})]})]})})},Yl=({form:t})=>{const{control:s}=t,{defaultLocale:a}=pe(),{fields:r,append:i,remove:n,update:o}=F.useFieldArray({control:s,name:"modifierGroups"}),[l,d]=x.useState(!1),[c,u]=x.useState(null),p=()=>crypto.randomUUID(),g=S=>{var k;return{...S,id:S.id??p(),defaultLocale:S.defaultLocale??a,modifiers:((k=S.modifiers)==null?void 0:k.map(j=>({...j,id:j.id??p()})))??[]}},h=S=>{S.preventDefault(),u(null),d(!0)},y=S=>{u(S),d(!0)},b=S=>{if(c===null){i(g(S)),d(!1);return}o(c,g(S)),d(!1)},f=()=>{i({id:p(),defaultLocale:a,selectMin:1,selectMax:1,modifiers:[{id:p(),title:"Łagodny (Mild)",sku:"null",price:0},{id:p(),title:"Średni (Medium)",sku:"null",price:0},{id:p(),title:"Ostry (Spicy)",sku:"null",price:0}],translations:[{locale:"en",title:"Spice Level"},{locale:"pl",title:"Ostrość"}]})};return e.jsxs("section",{"aria-labelledby":"product-modifiers",className:"min-h-[200px]",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-modifiers",className:"text-lg scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Product Modifiers (Optional)"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Modifiers allow you to create different variants of the same product. Create or choose existing modifiers for your product."})]}),e.jsx("div",{className:"md:col-span-2",children:r.length===0?e.jsxs("div",{className:"text-center flex-col justify-center items-center",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"No Modifier Groups"}),e.jsx("p",{className:"text-gray-500 max-w-[500px] mx-auto mt-1",children:"If your product has different options or variants, you can add modifier groups to manage them."}),e.jsxs("div",{className:"flex space-x-3 mx-auto w-min mt-6",children:[e.jsxs(z,{type:"button",variant:"secondary",className:"shadow-none",onClick:f,children:[e.jsx(A.BookCopyIcon,{className:"w-4 h-4 mr-2"})," Add From Template"]}),e.jsxs(z,{type:"button",variant:"secondary",className:"shadow-none",onClick:h,children:[e.jsx(A.PlusIcon,{className:"w-4 h-4 mr-2"})," Create Modifier Group"]})]})]}):e.jsxs("div",{className:"space-y-10",children:[e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsxs(z,{type:"button",variant:"secondary",className:"shadow-none",onClick:f,children:[e.jsx(A.BookCopyIcon,{className:"w-4 h-4 mr-2"})," Add From Template"]}),e.jsxs(z,{type:"button",variant:"secondary",className:"shadow-none",onClick:h,children:[e.jsx(A.PlusIcon,{className:"w-4 h-4 mr-2"})," Create Modifier Group"]})]}),e.jsx("div",{className:"space-y-4",children:r.map((S,k)=>{var j;return e.jsxs("div",{className:"p-4 border rounded-md",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold",children:S.translations[0].title||"Unnamed Group"}),e.jsxs("div",{children:[e.jsx("button",{type:"button",onClick:()=>y(k),className:"text-blue-500 font-medium hover:underline text-sm mr-4",children:"Edit"}),e.jsx("button",{type:"button",onClick:()=>n(k),className:"text-red-500 font-medium hover:underline text-sm p-0!",children:"Remove"})]})]}),e.jsxs("p",{className:"text-sm text-gray-500 mt-3",children:["Min: ",S.selectMin," | Max: ",S.selectMax]}),e.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["Available Options:"," ",(j=S.modifiers)==null?void 0:j.map(v=>v==null?void 0:v.title).join(",")]})]},S.id)})})]})})]}),e.jsx(Xl,{open:l,initialData:c===null?null:r[c],onSubmit:b,onClose:()=>{d(!1),u(null)}},c)]})},ed=({form:t,loading:s})=>{const a=[{name:"basePrice",label:"Base Price",type:"number",placeholder:"Enter base price",prefix:"USD"},{name:"discountedBasePrice",label:"Discounted Price",type:"number",placeholder:"Enter discounted price",prefix:"USD"}];return e.jsx("section",{"aria-labelledby":"product-information",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-information",className:"text-lg scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Pricing"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Enter the pricing details of your product, including the base price and discounted price."})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(Ne,{form:t,config:a,loading:s})})]})})},pi=({initialData:t})=>{var y,b;const{client:s}=E(),a=Q.useRouter(),r=Y(),i=K(),n=gt(),{defaultLocale:o,supportedLocales:l}=pe(),d=t?nn:rn,c=F.useForm({resolver:ue.zodResolver(d),defaultValues:t?{...t,defaultLocale:o,categories:(y=t.categories)==null?void 0:y.map(f=>f.id),translations:t.translations,images:t.images,metadata:t.metadata,modifierGroups:(b=t.modifierGroups)==null?void 0:b.map(f=>({...f,defaultLocale:o,translations:f.translations,modifiers:f.modifiers}))}:{defaultLocale:o,translations:l.map(f=>({locale:f})),currency:"USD"}}),u=R.useMutation({mutationFn:async f=>{const{status:S}=await s.product.createProduct({params:{organizationId:i},body:f});if(S!==201)throw new Error("Failed to create product")}}),p=R.useMutation({mutationFn:async f=>{const{status:S}=await s.product.updateProduct({params:{organizationId:i,id:n},body:f});if(S!==200)throw new Error("Failed to update product")}}),g=async()=>{X.success("Product saved successfully"),a.push(r.products(i)),await Ae.invalidateQueries({queryKey:["products"]}),await Ae.invalidateQueries({queryKey:["product",i,n]})},h=f=>{t?p.mutate(f,{onSuccess:g}):u.mutate(f,{onSuccess:g})};return console.log(c.watch()),e.jsx(F.FormProvider,{...c,children:e.jsxs("form",{onSubmit:c.handleSubmit(f=>h(f)),className:"space-y-14",children:[e.jsx(Gl,{form:c}),e.jsx($,{}),e.jsx(ed,{form:c}),e.jsx($,{}),e.jsx(Yl,{form:c}),e.jsx($,{}),e.jsx(Kl,{form:c}),e.jsx($,{}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsxs(z,{type:"button",variant:"secondary",onClick:()=>a.push(r.products(i)),children:[e.jsx(A.ChevronLeft,{className:"w-4 h-4 mr-2"})," Cancel"]}),e.jsxs(z,{type:"submit",isLoading:u.isPending||p.isPending,loadingText:"Saving...",children:[e.jsx(A.CheckIcon,{className:"w-4 h-4 mr-2"})," ",t?"Save Product":"Create Product"]})]})]})})};function td(){return e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Create Product"}),e.jsx($,{}),e.jsx("div",{className:"pt-6",children:e.jsx("div",{className:"space-y-10",children:e.jsx(pi,{})})})]})}function sd(){const t=K(),s=gt(),{client:a}=E(),{data:r,isLoading:i}=R.useQuery({queryKey:["product",t,s],queryFn:async()=>{const{status:n,body:o}=await a.product.getProduct({params:{organizationId:t,id:s}});if(n!==200)throw X.error("Failed to load product"),new Error("Failed to fetch product");return o}});return e.jsxs("div",{className:"space-y-6",children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 sm:text-2xl dark:text-gray-50",children:"Edit Product"}),e.jsx($,{}),i?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(ce,{className:"w-8 h-8"})}):e.jsx("div",{className:"pt-6",children:e.jsx(pi,{initialData:r})})]})}const Ce=ge.createColumnHelper(),ad=({row:t,table:s})=>{var d;const{client:a}=E(),r=t.getValue("publishedAt"),i=(d=s.options.meta)==null?void 0:d.organizationId,n=s.options.meta.refetch,o=R.useMutation({mutationFn:async()=>{if((await a.product.updateStatus({params:{id:t.getValue("id"),organizationId:i,operation:r?"unpublish":"publish"}})).status!==200)throw new Error("Failed to update product status");await n()}}),l=()=>{o.mutate()};return o.isPending?e.jsx("div",{className:"min-w-28",children:e.jsxs("button",{className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600","tremor-id":"tremor-raw",disabled:!0,children:[e.jsx(ce,{className:"w-4 h-4"})," Saving..."]})}):e.jsx("div",{className:"min-w-28",children:e.jsxs("button",{onClick:l,className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600","tremor-id":"tremor-raw",children:[r?e.jsx(A.CheckCircle,{className:"w-4 h-4 text-emerald-600 dark:text-emerald-500"}):e.jsx(A.EyeOffIcon,{className:"w-4 h-4 text-red-600 dark:text-red-500"}),r?"Published":"Draft"]})})},rd=({row:t,table:s})=>{var l,d,c;const{client:a}=E(),r=(l=s.options.meta)==null?void 0:l.organizationId,i=s.options.meta.refetch,n=R.useMutation({mutationFn:async()=>{if((await a.product.deleteProduct({params:{id:t.getValue("id"),organizationId:r}})).status!==204)throw new Error("Failed to delete product");await i()}}),o=()=>{window.confirm("Are you sure you want to delete this product? This action cannot be undone.")&&n.mutate()};return e.jsxs(Le,{children:[e.jsx(Ee,{asChild:!0,children:e.jsx(z,{variant:"ghost",className:"group aspect-square px-1.5 py-0! h-8! hover:border hover:border-gray-300 data-[state=open]:border-gray-300 data-[state=open]:bg-gray-50 dark:hover:border-gray-700 dark:data-[state=open]:border-gray-700 dark:data-[state=open]:bg-gray-900",disabled:n.isPending,children:n.isPending?e.jsx(ce,{className:"size-4 shrink-0"}):e.jsx(C.RiMoreFill,{className:"size-4 shrink-0 text-gray-500 group-hover:text-gray-700 group-data-[state=open]:text-gray-700 dark:group-hover:text-gray-300 dark:group-data-[state=open]:text-gray-300","aria-hidden":"true"})})}),e.jsxs(De,{align:"end",className:"min-w-40",children:[e.jsx(fe,{children:e.jsxs(H,{href:((c=(d=s.options.meta)==null?void 0:d.routes)==null?void 0:c.productEdit(r,t.getValue("id")))??`/admin/${r}/products/${t.getValue("id")}`,className:"block flex items-center gap-2",children:[e.jsx(A.PencilIcon,{className:"w-4 h-4"}),"Edit"]})}),e.jsx(fe,{className:"text-red-600 dark:text-red-500 cursor-pointer",onClick:o,disabled:n.isPending,children:e.jsxs("div",{className:"flex items-center gap-2",children:[n.isPending?e.jsx(ce,{className:"w-4 h-4"}):e.jsx(A.Trash2,{className:"w-4 h-4"}),n.isPending?"Deleting...":"Delete"]})})]})]})},id=[Ce.display({id:"select",header:({table:t})=>e.jsx(ve,{checked:t.getIsAllPageRowsSelected()?!0:t.getIsSomeRowsSelected()?"indeterminate":!1,onCheckedChange:()=>t.toggleAllPageRowsSelected(),className:"translate-y-0.5","aria-label":"Select all"}),cell:({row:t})=>e.jsx(ve,{checked:t.getIsSelected(),onCheckedChange:()=>t.toggleSelected(),className:"translate-y-0.5","aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,meta:{displayName:"Select"}}),Ce.accessor("id",{header:({column:t})=>e.jsx(L,{column:t,title:"Id"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"ID"},cell:({row:t,table:s})=>{var r,i,n;const a=(r=s.options.meta)==null?void 0:r.organizationId;return e.jsx(H,{href:((n=(i=s.options.meta)==null?void 0:i.routes)==null?void 0:n.productEdit(a,t.getValue("id")))??`/admin/${a}/products/${t.getValue("id")}`,className:"text-blue-500",children:t.getValue("id")})}}),Ce.accessor("title",{header:({column:t})=>e.jsx(L,{column:t,title:"Title"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Slug"}}),Ce.accessor("sku",{header:({column:t})=>e.jsx(L,{column:t,title:"SKU"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"SKU"},cell:({row:t})=>t.getValue("sku")||"-"}),Ce.accessor("basePrice",{header:({column:t})=>e.jsx(L,{column:t,title:"Base Price"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Base Price"},cell:({row:t})=>`$${t.getValue("basePrice").toFixed(2)}`}),Ce.accessor("discountedBasePrice",{header:({column:t})=>e.jsx(L,{column:t,title:"Discounted Price"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Discounted Price"},cell:({row:t})=>{const s=t.getValue("discountedBasePrice");return s?`$${s.toFixed(2)}`:"-"}}),Ce.accessor("publishedAt",{header:({column:t})=>e.jsx(L,{column:t,title:"Status"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Slug"},cell:({row:t,table:s})=>e.jsx(ad,{row:t,table:s})}),Ce.accessor("createdAt",{header:({column:t})=>e.jsx(L,{column:t,title:"Created At"}),enableSorting:!1,meta:{className:"text-left",displayName:"Created At"},cell:({row:t})=>{const s=t.getValue("createdAt");return new Date(s).toLocaleDateString()}}),Ce.display({id:"edit",header:"Edit",enableSorting:!1,enableHiding:!1,meta:{className:"text-right",displayName:"Edit"},cell:({row:t,table:s})=>e.jsx(rd,{row:t,table:s})})],nd=()=>{const{client:t}=E(),s=Y(),{defaultLocale:a}=pe(),r=K(),i=Q.useSearchParams(),[n,o]=x.useState(""),[l]=Fe.useDebounce(n,300),d=Number((i==null?void 0:i.get("page"))||"1"),{isLoading:c,isRefetching:u,isError:p,data:g,refetch:h}=R.useQuery({queryKey:["products",r,d,l],queryFn:async()=>{const{body:y,status:b}=await t.product.getProducts({params:{organizationId:r},query:{page:d,limit:10,search:l,locale:a}});if(b!==200)throw new Error("Failed to fetch products");return y},placeholderData:R.keepPreviousData});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 sm:gap-x-6",children:[e.jsx("div",{className:"flex w-full flex-col gap-2 sm:w-fit sm:flex-row sm:items-center",children:e.jsx(at,{type:"search",placeholder:"Search products...",value:n,onChange:y=>o(y.target.value),className:"w-full sm:max-w-[250px] sm:[&>input]:h-[40px]"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(z,{asChild:!0,className:"hidden gap-x-2 px-2 py-1.5 text-sm sm:text-xs lg:flex",children:e.jsxs(H,{href:s.productCreate(r),children:["Create Product",e.jsx(A.PlusIcon,{className:"size-4 shrink-0","aria-hidden":"true"})]})})})]}),e.jsx(st,{error:p,loading:c||u,meta:g!=null&&g.meta?{...g==null?void 0:g.meta,currentPage:d}:void 0,data:(g==null?void 0:g.list)||[],columns:id,className:"mt-8",refetch:h})]})};function od(){return e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 sm:text-2xl dark:text-gray-50",children:"Products List"}),e.jsx("div",{className:"mt-4 sm:mt-6 lg:mt-10",children:e.jsx(nd,{})})]})}const ld=({organizationId:t,id:s,acceptedAt:a,cancelledAt:r,refetch:i})=>{var b;const{client:n}=E(),o=R.useMutation({mutationFn:async({operation:f})=>{if((await n.reservation.updateReservationStatus({params:{organizationId:t,reservationId:s,operation:f},body:{}})).status!==200)throw new Error("Failed to update reservation status");return i()}}),l=()=>{o.mutate({operation:"accept"})},d=()=>{o.mutate({operation:"cancel"})},c=o.isPending,u=(b=o.variables)==null?void 0:b.operation,p=c&&u==="cancel",g=c&&u==="accept",h=!a&&!r,y=!r;return e.jsxs("div",{className:"flex items-center gap-2 min-w-28 min-h-[45px]",children:[y&&e.jsxs("button",{onClick:d,disabled:c,className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600",children:[p?"Loading...":"Cancel",e.jsx(A.X,{className:"w-4 h-4 text-red-600 dark:text-red-500"})]}),h&&e.jsxs("button",{onClick:l,disabled:c,className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600",children:[g?"Loading...":"Accept",e.jsx(A.CheckCircle,{className:"w-4 h-4 text-emerald-600 dark:text-emerald-500"})]})]})},dd=({open:t,onOpenChange:s,reservation:a})=>e.jsx(Ft,{open:t,onOpenChange:s,children:e.jsxs(Vt,{className:"sm:max-w-[500px] overflow-y-auto max-h-[85vh]",children:[e.jsx(ks,{children:e.jsx(js,{children:"Reservation Details"})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 py-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Reference ID"}),e.jsx("p",{className:"text-sm font-medium",children:a.referenceId})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Status"}),e.jsx("p",{className:"text-sm font-medium",children:a.cancelledAt?"Cancelled":a.acceptedAt?"Accepted":"Pending"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Customer Name"}),e.jsx("p",{className:"text-sm font-medium",children:`${a.firstname} ${a.lastname}`})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Phone"}),e.jsx("p",{className:"text-sm font-medium",children:a.phone||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Number of Guests"}),e.jsx("p",{className:"text-sm font-medium",children:a.guests})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Reservation Date"}),e.jsx("p",{className:"text-sm font-medium",children:a.date?T.format(new Date(a.date),"PPpp"):"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Created At"}),e.jsx("p",{className:"text-sm font-medium",children:a.createdAt?T.format(new Date(a.createdAt),"PPpp"):"N/A"})]}),a.acceptedAt&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Accepted At"}),e.jsx("p",{className:"text-sm font-medium",children:T.format(new Date(a.acceptedAt),"PPpp")})]}),a.cancelledAt&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Cancelled At"}),e.jsx("p",{className:"text-sm font-medium",children:T.format(new Date(a.cancelledAt),"PPpp")})]})]})]})}),cd=({reservation:t})=>{const[s,a]=x.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>a(!0),className:"text-blue-500 hover:underline",children:String(t.id).slice(-5)}),e.jsx(dd,{open:s,onOpenChange:a,reservation:t})]})},ud=({reservation:t,table:s})=>{const a=s.options.meta,r=(a==null?void 0:a.organizationId)||"",i=typeof(a==null?void 0:a.refetch)=="function"?a.refetch:()=>{};return e.jsx(ld,{organizationId:r,id:t.id,acceptedAt:t.acceptedAt,cancelledAt:t.cancelledAt,refetch:i})},Pe=ge.createColumnHelper(),pd=[Pe.accessor("id",{header:({column:t})=>e.jsx(L,{column:t,title:"ID"}),meta:{className:"text-left",displayName:"ID"},cell:({row:t})=>e.jsx(cd,{reservation:t.original}),enableSorting:!0,enableHiding:!1}),Pe.accessor("referenceId",{header:({column:t})=>e.jsx(L,{column:t,title:"Reference ID"}),cell:({row:t})=>e.jsx("div",{className:"w-[100px]",children:t.getValue("referenceId")}),meta:{className:"text-left",displayName:"Reference ID"},enableSorting:!1,enableHiding:!1}),Pe.display({id:"customer",meta:{className:"text-left",displayName:"Customer"},header:({column:t})=>e.jsx(L,{column:t,title:"Customer"}),cell:({row:t})=>{const s=t.original.firstname||"",a=t.original.lastname||"";return e.jsx("div",{children:`${s} ${a}`.trim()||"N/A"})}}),Pe.accessor("guests",{meta:{className:"text-left",displayName:"Guests"},enableSorting:!0,enableHiding:!1,header:({column:t})=>e.jsx(L,{column:t,title:"Guests"}),cell:({row:t})=>e.jsx("div",{className:"font-medium",children:t.original.guests})}),Pe.accessor("phone",{meta:{className:"text-left",displayName:"Phone"},enableSorting:!1,enableHiding:!1,header:({column:t})=>e.jsx(L,{column:t,title:"Phone"}),cell:({row:t})=>e.jsx("div",{children:t.original.phone||"N/A"})}),Pe.accessor("date",{meta:{className:"text-left",displayName:"Reservation Date"},enableSorting:!0,enableHiding:!1,header:({column:t})=>e.jsx(L,{column:t,title:"Reservation Date"}),cell:({row:t})=>{const s=t.getValue("date");return s?T.format(new Date(s),"dd.MM.yyyy HH:mm"):"N/A"}}),Pe.accessor("createdAt",{meta:{className:"text-left",displayName:"Created At"},enableSorting:!0,enableHiding:!1,header:({column:t})=>e.jsx(L,{column:t,title:"Created At"}),cell:({row:t})=>{const s=t.getValue("createdAt");return s?T.format(new Date(s),"dd.MM.yyyy HH:mm"):"N/A"}}),Pe.display({id:"status",meta:{className:"text-left",displayName:"Status"},header:({column:t})=>e.jsx(L,{column:t,title:"Status"}),cell:({row:t})=>{const s=t.original.acceptedAt;return t.original.cancelledAt?e.jsx("div",{className:"text-red-600 font-medium",children:"Cancelled"}):s?e.jsx("div",{className:"text-green-600 font-medium",children:"Accepted"}):e.jsx("div",{className:"text-yellow-600 font-medium",children:"Pending"})}}),Pe.display({id:"actions",header:({column:t})=>e.jsx(L,{column:t,title:"Actions"}),cell:({row:t,table:s})=>e.jsx(ud,{reservation:t.original,table:s})})],md=()=>{const{client:t}=E(),s=K(),a=Q.useSearchParams(),[r,i]=x.useState(""),[n]=Fe.useDebounce(r,300),o=Number((a==null?void 0:a.get("page"))||"1"),{isLoading:l,isRefetching:d,isError:c,data:u,refetch:p}=R.useQuery({queryKey:["reservations",s,o,n],queryFn:async()=>{const{body:g,status:h}=await t.reservation.getReservations({params:{organizationId:s},query:{page:o,limit:10,search:n}});if(h!==200)throw new Error("Failed to fetch reservations");return g},placeholderData:R.keepPreviousData});return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 sm:gap-x-6",children:e.jsx("div",{className:"flex w-full flex-col gap-2 sm:w-fit sm:flex-row sm:items-center",children:e.jsx(at,{type:"search",placeholder:"Search by name or reference...",value:r,onChange:g=>i(g.target.value),className:"w-full sm:max-w-[250px] sm:[&>input]:h-[40px]"})})}),e.jsx(st,{error:c,loading:l||d,meta:u!=null&&u.meta?{...u==null?void 0:u.meta,currentPage:o}:void 0,data:(u==null?void 0:u.list)||[],columns:pd,className:"mt-8",refetch:p})]})};function gd(){return e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 sm:text-2xl dark:text-gray-50",children:"Reservations List"}),e.jsx("div",{className:"mt-4 sm:mt-6 lg:mt-10",children:e.jsx(md,{})})]})}const hd=()=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:451,zoomAndPan:"magnify",viewBox:"0 0 338.25 101.249998",height:135,preserveAspectRatio:"xMidYMid meet",className:"h-auto w-3/4 mr-5 text-[#15203a] dark:text-white",children:[e.jsxs("defs",{children:[e.jsx("filter",{x:"0%",y:"0%",width:"100%",height:"100%",id:"e96f145012",children:e.jsx("feColorMatrix",{values:"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0",colorInterpolationFilters:"sRGB"})}),e.jsx("g",{}),e.jsx("clipPath",{id:"2854c0f5ba",children:e.jsx("path",{d:"M 280.070312 29.789062 L 335.910156 29.789062 L 335.910156 85.628906 L 280.070312 85.628906 Z M 280.070312 29.789062 ",clipRule:"nonzero"})}),e.jsx("clipPath",{id:"a2b4eafd05",children:e.jsx("path",{d:"M 312.023438 83.421875 L 333.382812 62.0625 C 335.910156 59.535156 335.910156 55.460938 333.382812 52.933594 L 312.285156 31.835938 C 310.859375 30.410156 308.949219 29.632812 306.941406 29.632812 L 280.46875 29.632812 L 303.773438 52.933594 C 306.296875 55.460938 306.296875 59.535156 303.773438 62.0625 L 280.210938 85.621094 L 306.683594 85.621094 C 308.691406 85.621094 310.601562 84.8125 312.023438 83.421875 Z M 312.023438 83.421875 ",clipRule:"nonzero"})}),e.jsx("image",{x:0,y:0,width:57,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADkAAAA5CAYAAACMGIOFAAAABmJLR0QA/wD/AP+gvaeTAAAAdElEQVRoge3PMQqEQBAAwXVB//9kEwMD9eAwKrthYGBgoJZx3xxjrMdsp/1qft3f+PHvfc4HJFNIpZBKIZVCKoVUCqkUUimkUkilkEohlUIqhVQKqRRSKaRSSKWQSiGVQiqFVAqpFFIppFJIpZBKIZU+gdwB24gBccg7AIAAAAAASUVORK5CYII=",id:"c594f9d06d",height:57,preserveAspectRatio:"xMidYMid meet"}),e.jsx("mask",{id:"1f1a4971c6",children:e.jsx("g",{filter:"url(#e96f145012)",children:e.jsx("g",{children:e.jsx("image",{x:0,y:0,width:57,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADkAAAA5CAYAAACMGIOFAAAABmJLR0QA/wD/AP+gvaeTAAAAdElEQVRoge3PMQqEQBAAwXVB//9kEwMD9eAwKrthYGBgoJZx3xxjrMdsp/1qft3f+PHvfc4HJFNIpZBKIZVCKoVUCqkUUimkUkilkEohlUIqhVQKqRRSKaRSSKWQSiGVQiqFVAqpFFIppFJIpZBKIZU+gdwB24gBccg7AIAAAAAASUVORK5CYII=",height:57,preserveAspectRatio:"xMidYMid meet"})})})}),e.jsx("clipPath",{id:"d584d4a10b",children:e.jsx("rect",{x:0,width:57,y:0,height:57})}),e.jsx("pattern",{id:"ca59399d09",patternUnits:"userSpaceOnUse",width:57,patternTransform:"matrix(0.992647, 0, 0, -0.992647, 279.805145, 86.320587)",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 57 57",height:57,x:0,y:0,children:e.jsx("g",{children:e.jsx("g",{clipPath:"url(#d584d4a10b)",children:e.jsx("g",{mask:"url(#1f1a4971c6)",children:e.jsx("rect",{x:"-356.844005",width:"490.68801",fill:"#8c52ff",height:"146.88",y:"-37.48",fillOpacity:1})})})})}),e.jsx("clipPath",{id:"058149a1c1",children:e.jsx("path",{d:"M 271.277344 20.996094 L 327 20.996094 L 327 76.832031 L 271.277344 76.832031 Z M 271.277344 20.996094 ",clipRule:"nonzero"})}),e.jsx("clipPath",{id:"3a8b0dae6b",children:e.jsx("path",{d:"M 303.230469 74.625 L 324.589844 53.265625 C 327.113281 50.742188 327.113281 46.664062 324.589844 44.140625 L 303.488281 23.039062 C 302.0625 21.613281 300.15625 20.839844 298.148438 20.839844 L 271.675781 20.839844 L 294.976562 44.140625 C 297.5 46.664062 297.5 50.742188 294.976562 53.265625 L 271.414062 76.824219 L 297.890625 76.824219 C 299.894531 76.824219 301.804688 76.015625 303.230469 74.625 Z M 303.230469 74.625 ",clipRule:"nonzero"})}),e.jsx("image",{x:0,y:0,width:57,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADkAAAA5CAYAAACMGIOFAAAABmJLR0QA/wD/AP+gvaeTAAAAbklEQVRoge3PwQmAAAwEwaho/yVbgfrQ17gLeR0EZpnrlpk5Zma/ubf7Fz+e9m29QTKFVAqpFFIppFJIpZBKIZVCKoVUCqkUUimkUkilkEohlUIqhVQKqRRSKaRSSKWQSiGVQiqFVAqpFFLpF8gT2vQBcSod/NEAAAAASUVORK5CYII=",id:"85d98eb3ed",height:57,preserveAspectRatio:"xMidYMid meet"}),e.jsx("mask",{id:"712d9ec0cc",children:e.jsx("g",{filter:"url(#e96f145012)",children:e.jsx("g",{children:e.jsx("image",{x:0,y:0,width:57,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADkAAAA5CAYAAACMGIOFAAAABmJLR0QA/wD/AP+gvaeTAAAAbklEQVRoge3PwQmAAAwEwaho/yVbgfrQ17gLeR0EZpnrlpk5Zma/ubf7Fz+e9m29QTKFVAqpFFIppFJIpZBKIZVCKoVUCqkUUimkUkilkEohlUIqhVQKqRRSKaRSSKWQSiGVQiqFVAqpFFLpF8gT2vQBcSod/NEAAAAASUVORK5CYII=",height:57,preserveAspectRatio:"xMidYMid meet"})})})}),e.jsx("clipPath",{id:"66291c0f48",children:e.jsx("rect",{x:0,width:57,y:0,height:57})}),e.jsx("pattern",{id:"82194e6edc",patternUnits:"userSpaceOnUse",width:57,patternTransform:"matrix(0.992647, 0, 0, -0.992647, 270.871322, 77.386763)",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 57 57",height:57,x:0,y:0,children:e.jsx("g",{children:e.jsx("g",{clipPath:"url(#66291c0f48)",children:e.jsx("g",{mask:"url(#712d9ec0cc)",children:e.jsx("rect",{x:"-347.844005",width:"490.68801",fill:"#8c52ff",height:"146.88",y:"-46.48",fillOpacity:1})})})})})]}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(19.705917, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 16.359375 0.0625 C 13.921875 0.0625 11.773438 -0.289062 9.921875 -1 C 8.441406 -1.59375 6.925781 -2.570312 5.375 -3.9375 C 3.601562 -5.5625 2.476562 -7.578125 2 -9.984375 C 1.8125 -10.753906 1.71875 -11.53125 1.71875 -12.3125 C 1.675781 -12.570312 1.675781 -12.832031 1.71875 -13.09375 L 1.71875 -13.46875 L 9.3125 -13.359375 L 9.3125 -13.421875 C 9.3125 -12.054688 9.609375 -10.925781 10.203125 -10.03125 C 11.304688 -8.375 13.359375 -7.546875 16.359375 -7.546875 C 21.160156 -7.546875 23.5625 -8.671875 23.5625 -10.921875 C 23.5625 -13.109375 21.085938 -14.476562 16.140625 -15.03125 C 13.285156 -15.363281 10.84375 -15.953125 8.8125 -16.796875 C 6.925781 -17.578125 5.394531 -18.613281 4.21875 -19.90625 C 2.550781 -21.757812 1.71875 -23.90625 1.71875 -26.34375 C 1.71875 -27.851562 1.992188 -29.273438 2.546875 -30.609375 C 2.953125 -31.609375 3.507812 -32.515625 4.21875 -33.328125 C 6.800781 -36.242188 10.90625 -37.703125 16.53125 -37.703125 C 19.894531 -37.703125 22.738281 -37.039062 25.0625 -35.71875 C 26.832031 -34.71875 28.273438 -33.382812 29.390625 -31.71875 C 30.203125 -30.457031 30.773438 -29.015625 31.109375 -27.390625 C 31.222656 -26.835938 31.296875 -26.285156 31.328125 -25.734375 C 31.367188 -25.546875 31.390625 -25.359375 31.390625 -25.171875 L 31.390625 -24.84375 L 23.796875 -24.84375 L 23.796875 -24.78125 C 23.828125 -25.894531 23.546875 -26.835938 22.953125 -27.609375 C 21.773438 -29.273438 19.632812 -30.109375 16.53125 -30.109375 C 14.644531 -30.109375 13.085938 -29.867188 11.859375 -29.390625 C 10.347656 -28.796875 9.59375 -27.945312 9.59375 -26.84375 C 9.59375 -24.550781 12.050781 -23.125 16.96875 -22.5625 C 22.507812 -21.9375 26.503906 -20.21875 28.953125 -17.40625 C 30.578125 -15.488281 31.390625 -13.328125 31.390625 -10.921875 L 31.390625 -10.421875 C 31.390625 -10.203125 31.367188 -9.984375 31.328125 -9.765625 C 31.296875 -9.171875 31.222656 -8.613281 31.109375 -8.09375 C 30.734375 -6.613281 30.03125 -5.300781 29 -4.15625 C 27.78125 -2.789062 26.132812 -1.738281 24.0625 -1 C 22 -0.289062 19.429688 0.0625 16.359375 0.0625 Z M 16.359375 0.0625 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(52.748732, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 30.78125 0 L 23.5625 0 L 23.5625 -14.078125 L 23.515625 -14.078125 L 23.515625 -14.25 C 23.515625 -16.175781 22.828125 -17.820312 21.453125 -19.1875 C 20.085938 -20.550781 18.425781 -21.234375 16.46875 -21.234375 C 14.550781 -21.234375 12.890625 -20.53125 11.484375 -19.125 C 10.078125 -17.726562 9.410156 -16.066406 9.484375 -14.140625 L 9.484375 -14.078125 L 9.421875 -14.078125 L 9.421875 0 L 1.65625 0 L 1.65625 -36.046875 L 9.421875 -36.046875 L 9.421875 -24.953125 C 11.160156 -27.023438 13.492188 -28.191406 16.421875 -28.453125 C 20.484375 -28.785156 23.84375 -27.726562 26.5 -25.28125 C 29.351562 -22.65625 30.78125 -18.976562 30.78125 -14.25 Z M 30.78125 0 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(85.181699, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 14.8125 -28.5625 C 18.757812 -28.59375 22.117188 -27.222656 24.890625 -24.453125 C 27.703125 -21.640625 29.109375 -18.273438 29.109375 -14.359375 C 29.148438 -10.398438 27.785156 -7.035156 25.015625 -4.265625 C 22.234375 -1.460938 18.882812 -0.0390625 14.96875 0 C 11.007812 0.0390625 7.628906 -1.328125 4.828125 -4.109375 C 2.015625 -6.878906 0.609375 -10.242188 0.609375 -14.203125 C 0.566406 -18.148438 1.9375 -21.507812 4.71875 -24.28125 C 7.488281 -27.09375 10.851562 -28.519531 14.8125 -28.5625 Z M 19.859375 -9.3125 C 21.222656 -10.6875 21.90625 -12.351562 21.90625 -14.3125 C 21.90625 -16.226562 21.203125 -17.890625 19.796875 -19.296875 C 18.390625 -20.628906 16.726562 -21.296875 14.8125 -21.296875 C 12.882812 -21.296875 11.238281 -20.613281 9.875 -19.25 C 8.5 -17.800781 7.8125 -16.132812 7.8125 -14.25 C 7.8125 -12.332031 8.515625 -10.671875 9.921875 -9.265625 C 11.296875 -7.890625 12.960938 -7.203125 14.921875 -7.203125 C 16.910156 -7.273438 18.554688 -7.976562 19.859375 -9.3125 Z M 19.859375 -9.3125 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(114.89805, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 16.53125 -28.5625 C 20.445312 -28.59375 23.8125 -27.222656 26.625 -24.453125 C 29.425781 -21.679688 30.847656 -18.316406 30.890625 -14.359375 C 30.921875 -10.441406 29.550781 -7.078125 26.78125 -4.265625 C 24.007812 -1.460938 20.644531 -0.0390625 16.6875 0 C 13.46875 0 11.046875 -1.015625 9.421875 -3.046875 L 9.421875 10.640625 L 1.65625 10.640625 L 1.65625 -28.5 L 9.421875 -28.5 L 9.421875 -25.515625 C 10.941406 -27.472656 13.3125 -28.488281 16.53125 -28.5625 Z M 21.625 -9.3125 C 23.03125 -10.71875 23.695312 -12.382812 23.625 -14.3125 C 23.625 -16.269531 22.941406 -17.929688 21.578125 -19.296875 C 20.171875 -20.628906 18.503906 -21.296875 16.578125 -21.296875 C 14.617188 -21.296875 12.957031 -20.613281 11.59375 -19.25 C 10.21875 -17.800781 9.53125 -16.132812 9.53125 -14.25 C 9.613281 -12.25 10.316406 -10.585938 11.640625 -9.265625 C 13.015625 -7.890625 14.679688 -7.203125 16.640625 -7.203125 C 18.628906 -7.273438 20.289062 -7.976562 21.625 -9.3125 Z M 21.625 -9.3125 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(146.665722, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 30.78125 0 L 23.5625 0 L 23.5625 -14.078125 L 23.515625 -14.078125 L 23.515625 -14.25 C 23.515625 -16.175781 22.828125 -17.820312 21.453125 -19.1875 C 20.085938 -20.550781 18.425781 -21.234375 16.46875 -21.234375 C 14.550781 -21.234375 12.890625 -20.53125 11.484375 -19.125 C 10.078125 -17.726562 9.410156 -16.066406 9.484375 -14.140625 L 9.484375 -14.078125 L 9.421875 -14.078125 L 9.421875 0 L 1.65625 0 L 1.65625 -36.046875 L 9.421875 -36.046875 L 9.421875 -24.953125 C 11.160156 -27.023438 13.492188 -28.191406 16.421875 -28.453125 C 20.484375 -28.785156 23.84375 -27.726562 26.5 -25.28125 C 29.351562 -22.65625 30.78125 -18.976562 30.78125 -14.25 Z M 30.78125 0 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(179.09869, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 14.8125 -28.5625 C 18.757812 -28.59375 22.117188 -27.222656 24.890625 -24.453125 C 27.703125 -21.640625 29.109375 -18.273438 29.109375 -14.359375 C 29.148438 -10.398438 27.785156 -7.035156 25.015625 -4.265625 C 22.234375 -1.460938 18.882812 -0.0390625 14.96875 0 C 11.007812 0.0390625 7.628906 -1.328125 4.828125 -4.109375 C 2.015625 -6.878906 0.609375 -10.242188 0.609375 -14.203125 C 0.566406 -18.148438 1.9375 -21.507812 4.71875 -24.28125 C 7.488281 -27.09375 10.851562 -28.519531 14.8125 -28.5625 Z M 19.859375 -9.3125 C 21.222656 -10.6875 21.90625 -12.351562 21.90625 -14.3125 C 21.90625 -16.226562 21.203125 -17.890625 19.796875 -19.296875 C 18.390625 -20.628906 16.726562 -21.296875 14.8125 -21.296875 C 12.882812 -21.296875 11.238281 -20.613281 9.875 -19.25 C 8.5 -17.800781 7.8125 -16.132812 7.8125 -14.25 C 7.8125 -12.332031 8.515625 -10.671875 9.921875 -9.265625 C 11.296875 -7.890625 12.960938 -7.203125 14.921875 -7.203125 C 16.910156 -7.273438 18.554688 -7.976562 19.859375 -9.3125 Z M 19.859375 -9.3125 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(208.81504, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 13.203125 0 C 11.273438 0 9.59375 -0.296875 8.15625 -0.890625 C 7.007812 -1.296875 5.828125 -2.050781 4.609375 -3.15625 C 2.492188 -5.113281 1.53125 -7.59375 1.71875 -10.59375 L 1.71875 -11.203125 L 7.9375 -11.09375 L 8.421875 -11.09375 L 8.421875 -10.640625 C 8.460938 -9.722656 8.664062 -8.96875 9.03125 -8.375 C 9.664062 -7.300781 11.054688 -6.765625 13.203125 -6.765625 C 14.972656 -6.765625 16.25 -6.96875 17.03125 -7.375 C 17.4375 -7.5625 17.710938 -7.800781 17.859375 -8.09375 C 17.929688 -8.207031 17.96875 -8.316406 17.96875 -8.421875 L 18.015625 -8.703125 C 18.015625 -9.484375 17.40625 -10.113281 16.1875 -10.59375 C 15.707031 -10.78125 15.15625 -10.925781 14.53125 -11.03125 C 14.050781 -11.144531 13.515625 -11.238281 12.921875 -11.3125 C 10.703125 -11.53125 8.851562 -11.972656 7.375 -12.640625 C 5.894531 -13.234375 4.675781 -14.046875 3.71875 -15.078125 C 2.382812 -16.597656 1.71875 -18.335938 1.71875 -20.296875 C 1.71875 -21.515625 1.941406 -22.640625 2.390625 -23.671875 C 2.722656 -24.484375 3.164062 -25.207031 3.71875 -25.84375 C 5.707031 -28.132812 8.90625 -29.28125 13.3125 -29.28125 C 15.9375 -29.28125 18.15625 -28.757812 19.96875 -27.71875 C 21.375 -26.945312 22.5 -25.894531 23.34375 -24.5625 C 24.007812 -23.5625 24.472656 -22.398438 24.734375 -21.078125 C 24.804688 -20.628906 24.859375 -20.203125 24.890625 -19.796875 L 24.890625 -18.625 L 18.1875 -18.625 L 18.1875 -19.46875 C 18.15625 -19.613281 18.140625 -19.757812 18.140625 -19.90625 C 18.023438 -20.3125 17.875 -20.644531 17.6875 -20.90625 C 16.875 -22.007812 15.414062 -22.5625 13.3125 -22.5625 C 10.207031 -22.5625 8.65625 -21.914062 8.65625 -20.625 C 8.65625 -19.957031 9.023438 -19.421875 9.765625 -19.015625 C 10.535156 -18.535156 11.847656 -18.1875 13.703125 -17.96875 C 17.953125 -17.519531 21.035156 -16.171875 22.953125 -13.921875 C 24.242188 -12.398438 24.890625 -10.660156 24.890625 -8.703125 L 24.890625 -8.3125 L 24.84375 -7.8125 C 24.84375 -7.332031 24.785156 -6.890625 24.671875 -6.484375 C 24.378906 -5.304688 23.828125 -4.253906 23.015625 -3.328125 C 22.085938 -2.210938 20.789062 -1.378906 19.125 -0.828125 C 17.46875 -0.273438 15.492188 0 13.203125 0 Z M 13.203125 0 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(235.371259, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 22.234375 -28.5625 L 22.234375 -20.796875 L 15.859375 -20.796875 L 15.859375 0 L 8.09375 0 L 8.09375 -20.796875 L 1.65625 -20.796875 L 1.65625 -28.5625 L 8.09375 -28.5625 L 8.09375 -38.546875 L 15.859375 -38.546875 L 15.859375 -28.5625 Z M 22.234375 -28.5625 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(259.266309, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 9.421875 0 L 1.65625 0 L 1.65625 -7.765625 L 9.421875 -7.765625 Z M 9.421875 0 "})})})}),e.jsx("g",{clipPath:"url(#2854c0f5ba)",children:e.jsx("g",{clipPath:"url(#a2b4eafd05)",children:e.jsx("path",{fill:"url(#ca59399d09)",d:"M 335.910156 85.621094 L 280.214844 85.621094 L 280.214844 29.789062 L 335.910156 29.789062 Z M 335.910156 85.621094 ",fillRule:"nonzero"})})}),e.jsx("g",{clipPath:"url(#058149a1c1)",children:e.jsx("g",{clipPath:"url(#3a8b0dae6b)",children:e.jsx("path",{fill:"url(#82194e6edc)",d:"M 327.113281 76.824219 L 271.417969 76.824219 L 271.417969 20.992188 L 327.113281 20.992188 Z M 327.113281 76.824219 ",fillRule:"nonzero"})})})]}),mi=t=>e.jsx(Z.Root,{...t});mi.displayName="Drawer";const gi=N.forwardRef(({className:t,...s},a)=>e.jsx(Z.Trigger,{ref:a,className:w(t),...s}));gi.displayName="Drawer.Trigger";const hi=N.forwardRef(({className:t,...s},a)=>e.jsx(Z.Close,{ref:a,className:w(t),...s}));hi.displayName="Drawer.Close";const xi=Z.Portal;xi.displayName="DrawerPortal";const fi=N.forwardRef(({className:t,...s},a)=>e.jsx(Z.Overlay,{ref:a,className:w("fixed inset-0 z-50 overflow-y-auto","bg-black/30","data-[state=closed]:animate-hide data-[state=open]:animate-dialogOverlayShow",t),...s,style:{animationDuration:"400ms",animationFillMode:"backwards"}}));fi.displayName="DrawerOverlay";const yi=N.forwardRef(({className:t,...s},a)=>e.jsx(xi,{children:e.jsx(fi,{children:e.jsx(Z.Content,{ref:a,className:w("fixed inset-y-2 mx-auto flex w-[95vw] flex-1 flex-col overflow-y-auto rounded-md border p-4 shadow-lg focus:outline-hidden max-sm:inset-x-2 sm:inset-y-2 sm:right-2 sm:max-w-lg sm:p-6","border-gray-200 dark:border-gray-900","bg-white dark:bg-[#090E1A]","data-[state=closed]:animate-drawerSlideRightAndFade data-[state=open]:animate-drawerSlideLeftAndFade",ie,t),...s})})}));yi.displayName="DrawerContent";const wi=N.forwardRef(({children:t,className:s,...a},r)=>e.jsxs("div",{ref:r,className:"flex items-start justify-between gap-x-4 border-b border-gray-200 pb-4 dark:border-gray-900",...a,children:[e.jsx("div",{className:w("mt-1 flex flex-col gap-y-1",s),children:t}),e.jsx(Z.Close,{asChild:!0,children:e.jsx(z,{variant:"ghost",className:"aspect-square p-1 hover:bg-gray-100 dark:hover:bg-gray-400/10",children:e.jsx(C.RiCloseLine,{className:"size-6","aria-hidden":"true"})})})]}));wi.displayName="Drawer.Header";const bi=N.forwardRef(({className:t,...s},a)=>e.jsx(Z.Title,{ref:a,className:w("text-base font-semibold","text-gray-900 dark:text-gray-50",t),...s}));bi.displayName="DrawerTitle";const Si=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:w("flex-1 py-4",t),...s}));Si.displayName="Drawer.Body";const xd=N.forwardRef(({className:t,...s},a)=>e.jsx(Z.Description,{ref:a,className:w("text-gray-500 dark:text-gray-500",t),...s}));xd.displayName="DrawerDescription";function fd(){const t=Q.usePathname(),s=K(),a=Y();if(!s)return null;const r=[{name:"Dashboard",href:a.dashboard(s),icon:A.HomeIcon},{name:"Live Orders",href:a.liveOrders(s),icon:A.RadioIcon},{name:"Orders",href:a.orders(s),icon:A.LogsIcon},{name:"Reservations",href:a.reservations(s),icon:A.CalendarCheckIcon},{name:"Products",href:a.products(s),icon:A.PackageIcon},{name:"Categories",href:a.productCategories(s),icon:A.BoxesIcon},{name:"Manufacturers",href:a.manufacturers(s),icon:A.FactoryIcon},{name:"Settings",href:a.settings(s),icon:C.RiSettings5Line}];return e.jsxs(mi,{children:[e.jsx(gi,{asChild:!0,children:e.jsx(z,{variant:"ghost","aria-label":"open sidebar",className:"group flex items-center rounded-md p-2 text-sm font-medium hover:bg-gray-100 data-[state=open]:bg-gray-100 data-[state=open]:bg-gray-400/10 dark:hover:bg-gray-400/10",children:e.jsx(C.RiMenuLine,{className:"size-6 shrink-0 sm:size-5","aria-hidden":"true"})})}),e.jsxs(yi,{className:"sm:max-w-lg",children:[e.jsx(wi,{children:e.jsx(bi,{children:"Navigation"})}),e.jsx(Si,{children:e.jsx("nav",{"aria-label":"mobile navigation links",className:"flex flex-1 flex-col space-y-10",children:e.jsx("ul",{role:"list",className:"space-y-1.5",children:r.map(i=>e.jsx("li",{children:e.jsx(hi,{asChild:!0,children:e.jsxs(H,{href:i.href,className:I(t===i.href||t!=null&&t.startsWith(i.href)?"text-blue-600 dark:text-blue-400":"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-50","flex items-center gap-x-2.5 rounded-md px-2 py-1.5 text-base font-medium transition hover:bg-gray-100 sm:text-sm dark:hover:bg-gray-900",ie),children:[e.jsx(i.icon,{className:"size-5 shrink-0","aria-hidden":"true"}),i.name]})})},i.name))})})})]})]})}const yd=()=>{var l;const[t,s]=x.useState(!1),a=x.useRef(null),{organizations:r,organization:i}=pe(),n=Q.useRouter(),o=Y();return e.jsx(e.Fragment,{children:e.jsxs(Le,{open:t,onOpenChange:s,modal:!1,children:[e.jsx(Ee,{asChild:!0,children:i.data&&e.jsxs("button",{className:w("flex w-full items-center gap-x-2.5 rounded-md border border-gray-300 bg-white p-2 text-sm shadow-xs transition-all hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950 dark:hover:bg-gray-900",tt),children:[i.data.logoFile?e.jsx(xe,{src:i.data.logoFile.url,alt:i.data.name,width:40,height:40,className:"flex aspect-square size-8 items-center justify-center rounded"}):e.jsxs("span",{className:"flex aspect-square size-8 items-center justify-center rounded bg-blue-600 p-2 text-xs font-medium text-white dark:bg-blue-500 uppercase","aria-hidden":"true",children:[i.data.name[0],i.data.name[1]]}),e.jsxs("div",{className:"flex w-full items-center justify-between gap-x-4 truncate",children:[e.jsxs("div",{className:"truncate text-left",children:[e.jsx("p",{className:"truncate whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-50",children:i.data.name}),e.jsx("p",{className:"whitespace-nowrap text-left text-xs text-gray-700 dark:text-gray-300",children:(l=i.data.address)==null?void 0:l.addressLineOne})]}),e.jsx(C.RiExpandUpDownLine,{className:"size-5 shrink-0 text-gray-500","aria-hidden":"true"})]})]})}),e.jsx(De,{hidden:!1,onCloseAutoFocus:d=>{a.current&&(a.current.focus(),a.current=null,d.preventDefault())},children:e.jsxs(ct,{children:[e.jsxs(Xt,{children:["Workspaces (",r.data.length,")"]}),r.data.map(d=>{var c;return e.jsx(fe,{onClick:()=>n.push(o.dashboard(d.id)),children:e.jsxs("div",{className:"flex w-full items-center gap-x-2.5",children:[d.logoFile?e.jsx(xe,{src:d.logoFile.url,alt:d.name,width:40,height:40,className:"flex aspect-square size-8 items-center justify-center rounded"}):e.jsxs("span",{className:"flex aspect-square size-8 items-center justify-center rounded bg-blue-600 p-2 text-xs font-medium text-white dark:bg-blue-500 uppercase","aria-hidden":"true",children:[d.name[0],d.name[1]]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:d.name}),e.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-400",children:(c=d.address)==null?void 0:c.addressLineOne})]})]})},d.id)})]})})]})})},wd=()=>{const[t,s]=x.useState(!1),a=x.useRef(null),{organizations:r,organization:i}=pe(),n=Q.useRouter(),o=Y();return e.jsxs(Le,{open:t,onOpenChange:s,modal:!1,children:[e.jsx(Ee,{asChild:!0,children:i.data&&e.jsxs("button",{className:"flex items-center gap-x-1.5 rounded-md p-2 hover:bg-gray-100 focus:outline-hidden dark:hover:bg-gray-900",children:[i.data.logoFile?e.jsx(xe,{src:i.data.logoFile.url,alt:i.data.name,width:28,height:28,className:"flex aspect-square size-7 items-center justify-center rounded"}):e.jsxs("span",{className:"flex aspect-square size-7 items-center justify-center rounded bg-blue-600 p-2 text-xs font-medium text-white dark:bg-blue-500 uppercase","aria-hidden":"true",children:[i.data.name[0],i.data.name[1]]}),e.jsx(C.RiArrowRightSLine,{className:"size-4 shrink-0 text-gray-500","aria-hidden":"true"}),e.jsxs("div",{className:"flex w-full items-center justify-between gap-x-3 truncate",children:[e.jsx("p",{className:"truncate whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-50",children:i.data.name}),e.jsx(C.RiExpandUpDownLine,{className:"size-4 shrink-0 text-gray-500","aria-hidden":"true"})]})]})}),e.jsx(De,{className:"min-w-72!",onCloseAutoFocus:l=>{a.current&&(a.current.focus(),a.current=null,l.preventDefault())},children:e.jsxs(ct,{children:[e.jsxs(Xt,{children:["Workspaces (",r.data.length,")"]}),r.data.map(l=>{var d;return e.jsx(fe,{onClick:()=>n.push(o.dashboard(l.id)),children:e.jsxs("div",{className:"flex w-full items-center gap-x-2.5",children:[l.logoFile?e.jsx(xe,{src:l.logoFile.url,alt:l.name,width:28,height:28,className:"flex aspect-square size-7 items-center justify-center rounded"}):e.jsxs("span",{className:"flex aspect-square size-7 items-center justify-center rounded bg-blue-600 p-2 text-xs font-medium text-white dark:bg-blue-500 uppercase","aria-hidden":"true",children:[l.name[0],l.name[1]]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:l.name}),e.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-400",children:(d=l.address)==null?void 0:d.addressLineOne})]})]})},l.id)})]})})]})};function ki({children:t,align:s="start"}){var p,g;const a=Q.useRouter(),[r,i]=N.useState(!1),{theme:n,setTheme:o}=na.useTheme(),l=mt(),d=Y(),c=l.useSession();N.useEffect(()=>{i(!0)},[]);const u=()=>l.signOut({fetchOptions:{onSuccess:()=>a.push(d.signIn)}});return r?e.jsx(e.Fragment,{children:e.jsxs(Le,{children:[e.jsx(Ee,{asChild:!0,children:t}),e.jsxs(De,{align:s,children:[e.jsx(Xt,{children:(g=(p=c.data)==null?void 0:p.user)==null?void 0:g.email}),e.jsx(ct,{children:e.jsxs(ni,{children:[e.jsx(li,{children:"Theme"}),e.jsx(di,{children:e.jsxs(oi,{value:n,onValueChange:h=>{o(h)},children:[e.jsxs(Rt,{"aria-label":"Switch to Light Mode",value:"light",iconType:"check",children:[e.jsx(C.RiSunLine,{className:"size-4 shrink-0","aria-hidden":"true"}),"Light"]}),e.jsxs(Rt,{"aria-label":"Switch to Dark Mode",value:"dark",iconType:"check",children:[e.jsx(C.RiMoonLine,{className:"size-4 shrink-0","aria-hidden":"true"}),"Dark"]}),e.jsxs(Rt,{"aria-label":"Switch to System Mode",value:"system",iconType:"check",children:[e.jsx(C.RiComputerLine,{className:"size-4 shrink-0","aria-hidden":"true"}),"System"]})]})}),e.jsx(ct,{children:e.jsx(fe,{onClick:u,className:"text-red-500",children:"Sign out"})})]})})]})]})}):null}const bd=()=>{var i;const s=mt().useSession(),{firstname:a,lastname:r}=((i=s.data)==null?void 0:i.user)||{};return e.jsx(ki,{children:e.jsxs(z,{"aria-label":"User settings",variant:"ghost",className:I(ie,"group flex w-full items-center justify-between rounded-md p-2 text-sm font-medium text-gray-900 hover:bg-gray-100 data-[state=open]:bg-gray-100 data-[state=open]:bg-gray-400/10 dark:hover:bg-gray-400/10"),children:[e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-full border border-gray-300 bg-white text-xs text-gray-700 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-300","aria-hidden":"true",children:[a==null?void 0:a.charAt(0),r==null?void 0:r.charAt(0)]}),e.jsxs("span",{children:[a," ",r]})]}),e.jsx(C.RiMore2Fill,{className:"size-4 shrink-0 text-gray-500 group-hover:text-gray-700 dark:group-hover:text-gray-400","aria-hidden":"true"})]})})},Sd=()=>e.jsx(ki,{align:"end",children:e.jsx(z,{"aria-label":"User settings",variant:"ghost",className:I("group flex items-center rounded-md p-1 text-sm font-medium text-gray-900 hover:bg-gray-100 data-[state=open]:bg-gray-100 data-[state=open]:bg-gray-400/10 dark:hover:bg-gray-400/10"),children:e.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-full border border-gray-300 bg-white text-xs text-gray-700 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-300","aria-hidden":"true",children:"ES"})})});function kd(){const t=Q.usePathname(),s=K(),a=Y(),r=[{name:"Home",href:a.dashboard(s),icon:A.HomeIcon},{name:"Live Orders",href:a.liveOrders(s),icon:A.RadioIcon},{name:"Orders List",href:a.orders(s),icon:A.LogsIcon},{name:"Reservations",href:a.reservations(s),icon:A.CalendarCheckIcon},{name:"Products",href:a.products(s),icon:A.PackageIcon},{name:"Product Categories",href:a.productCategories(s),icon:A.BoxesIcon},{name:"Manufacturers",href:a.manufacturers(s),icon:A.FactoryIcon},{name:"Customers",href:`${a.dashboard(s)}/customers`,icon:A.UserCircleIcon},{name:"Settings",href:a.settings(s),icon:C.RiSettings5Line}],i=n=>t===n||(t==null?void 0:t.startsWith(n));return e.jsxs(e.Fragment,{children:[e.jsx("nav",{className:"hidden lg:fixed lg:inset-y-0 lg:z-50 lg:flex lg:w-72 lg:flex-col",children:e.jsxs("aside",{className:"flex grow flex-col gap-y-6 overflow-y-auto border-r border-gray-200 bg-slate-50 p-4 dark:border-gray-800 dark:bg-gray-950",children:[e.jsx(H,{href:a.home,className:"-ml-2",children:e.jsx(hd,{})}),e.jsx("hr",{className:"block border-t border-gray-200 dark:border-gray-800 -mt-3 mb-1"}),e.jsx(yd,{}),e.jsx("nav",{"aria-label":"core navigation links",className:"flex flex-1 flex-col space-y-10",children:e.jsx("ul",{role:"list",className:"space-y-0.5",children:r.map(n=>e.jsx("li",{children:e.jsxs(H,{href:n.href,className:w(i(n.href)?"text-blue-600 dark:text-blue-400":"text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-50","flex items-center gap-x-2.5 rounded-md px-2 py-1.5 text-sm font-medium transition hover:bg-gray-100 dark:hover:bg-gray-900",ie),children:[e.jsx(n.icon,{className:"size-4 shrink-0","aria-hidden":"true"}),n.name]})},n.name))})}),e.jsx("div",{className:"mt-auto",children:e.jsx(bd,{})})]})}),e.jsxs("div",{className:"sticky top-0 z-40 flex h-16 shrink-0 items-center justify-between border-b border-gray-200 bg-white px-2 shadow-xs sm:gap-x-6 sm:px-4 lg:hidden dark:border-gray-800 dark:bg-gray-950",children:[e.jsx(wd,{}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[e.jsx(Sd,{}),e.jsx(fd,{})]})]})]})}function jd({children:t}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-slate-50 dark:hidden w-1/2 absolute top-0 left-0 h-screen"}),e.jsxs("div",{className:"mx-auto max-w-(--breakpoint-2xl)",children:[e.jsx(kd,{}),e.jsx("main",{className:"lg:pl-72 bg-white dark:bg-gray-950 z-10 relative min-h-screen",children:e.jsx("div",{className:"relative",children:e.jsx("div",{className:"p-4 sm:px-6 sm:pb-10 sm:pt-10 lg:px-10 lg:pt-[34px]",children:t})})})]})]})}const Ad=[{name:"configuration.openingTimes.monday",label:"Monday",type:"time"},{name:"configuration.closingTimes.monday",label:"",type:"time"},{name:"configuration.openingTimes.tuesday",label:"Tuesday",type:"time"},{name:"configuration.closingTimes.tuesday",label:"",type:"time"},{name:"configuration.openingTimes.wednesday",label:"Wednesday",type:"time"},{name:"configuration.closingTimes.wednesday",label:"",type:"time"},{name:"configuration.openingTimes.thursday",label:"Thursday",type:"time"},{name:"configuration.closingTimes.thursday",label:"",type:"time"},{name:"configuration.openingTimes.friday",label:"Friday",type:"time"},{name:"configuration.closingTimes.friday",label:"",type:"time"},{name:"configuration.openingTimes.saturday",label:"Saturday",type:"time"},{name:"configuration.closingTimes.saturday",label:"",type:"time"},{name:"configuration.openingTimes.sunday",label:"Sunday",type:"time"},{name:"configuration.closingTimes.sunday",label:"",type:"time"},{name:"configuration.isAcceptingOrders",label:"Accepting Orders",type:"switch"}],vd=({onClose:t,initialData:s})=>{var o,l,d,c,u,p;const{client:a}=E(),r=F.useForm({resolver:ue.zodResolver(bs),defaultValues:{configuration:{defaultLocale:(o=s==null?void 0:s.configuration)==null?void 0:o.defaultLocale,supportedLocales:(l=s==null?void 0:s.configuration)==null?void 0:l.supportedLocales,defaultCurrency:(d=s==null?void 0:s.configuration)==null?void 0:d.defaultCurrency,openingTimes:(c=s==null?void 0:s.configuration)==null?void 0:c.openingTimes,closingTimes:(u=s==null?void 0:s.configuration)==null?void 0:u.closingTimes,isAcceptingOrders:(p=s==null?void 0:s.configuration)==null?void 0:p.isAcceptingOrders}}});console.log(r.watch());const{isPending:i,mutate:n}=R.useMutation({mutationFn:async({configuration:g})=>{const{status:h}=await a.organization.updateOrganization({params:{organizationId:s==null?void 0:s.id},body:{configuration:g}});if(h!==200)throw X.error("Failed to update organization. Please try again later."),new Error("Failed to update organization");return await Ae.invalidateQueries({queryKey:["organizations"]}),t&&t()}});return e.jsx(Ne,{form:r,config:Ad,onSubmit:g=>n(g),onCancel:t,loading:i,cancelText:"Go back",okText:"Save Schedule"})};function Nd(){const{organization:t}=pe();return t.data?e.jsx("div",{className:"space-y-10",children:e.jsx("section",{"aria-labelledby":"opening-times",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"opening-times",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Opening and Closing Times"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Set the opening and closing times for your organization"})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(vd,{initialData:t.data})})]})})}):e.jsx("div",{children:"Loading..."})}function nt({children:t}){const s=Q.usePathname(),a=K(),r=Y(),i=[{name:"General",href:r.settings(a)},{name:"Shipping Methods",href:r.settingsShippingMethods(a)},{name:"Opening Times",href:r.settingsOpeningTimes(a)},{name:"Access",href:`${r.settings(a)}/access`},{name:"API Keys",href:`${r.settings(a)}/api-keys`}];return(s==null?void 0:s.match(/\/settings\/shipping-methods\/[^/]+$/))?e.jsx("div",{children:t}):e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-2xl dark:text-gray-50",children:"Settings"}),e.jsx(Fs,{className:"mt-4 sm:mt-6 lg:mt-10",children:i.map(o=>e.jsx(Vs,{asChild:!0,active:s===o.href,children:e.jsx(H,{href:o.href,children:o.name})},o.name))}),e.jsx("div",{className:"pt-6",children:t})]})}const Rd=[{name:"configuration.defaultLocale",label:"Default Locale",type:"select",placeholder:"",options:Ws},{name:"configuration.supportedLocales",label:"Supported Locales",type:"select",placeholder:"Select locales",multiple:!0,options:Ws},{name:"configuration.defaultCurrency",label:"Currency",type:"select",placeholder:"Acme Inc.",options:dn}],Cd=({onClose:t,initialData:s})=>{var o,l,d;const{client:a}=E(),r=F.useForm({resolver:ue.zodResolver(bs),defaultValues:{configuration:{defaultLocale:(o=s==null?void 0:s.configuration)==null?void 0:o.defaultLocale,supportedLocales:(l=s==null?void 0:s.configuration)==null?void 0:l.supportedLocales,defaultCurrency:(d=s==null?void 0:s.configuration)==null?void 0:d.defaultCurrency}}}),{isPending:i,mutate:n}=R.useMutation({mutationFn:async({configuration:c})=>{const{status:u}=await a.organization.updateOrganization({params:{organizationId:s==null?void 0:s.id},body:{configuration:c}});if(u!==200)throw X.error("Failed to update organization. Please try again later."),new Error("Failed to update organization");return await Ae.invalidateQueries({queryKey:["organizations"]}),t&&t()}});return e.jsx(Ne,{form:r,config:Rd,onSubmit:c=>n(c),onCancel:t,loading:i,cancelText:"Go back",okText:"Save Settings"})},ji=x.forwardRef(({className:t,asChild:s,...a},r)=>{const i=s?ps.Slot:"div";return e.jsx(i,{ref:r,className:w("relative w-full rounded-lg border p-6 text-left shadow-xs","bg-white dark:bg-[#090E1A]","border-gray-200 dark:border-gray-900",t),...a})});ji.displayName="Card";function Pd(){const{organization:t}=pe();return t.data?e.jsxs("div",{className:"space-y-10",children:[e.jsx("section",{"aria-labelledby":"org-information",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"org-information",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Organization Information"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Manage your organization information."})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(ci,{initialData:t.data})})]})}),e.jsx($,{}),e.jsx("section",{"aria-labelledby":"locale-settings",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"locale-settings",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Currency and Locale"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Set the currency and languages you support"})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(Cd,{initialData:t.data})})]})}),e.jsx($,{}),e.jsx("section",{"aria-labelledby":"danger-zone",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"danger-zone",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Danger zone"}),e.jsxs("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:["Manage general workspace. Contact system admin for more information."," ",e.jsxs("a",{href:"#",className:"inline-flex items-center gap-1 text-indigo-600 hover:underline hover:underline-offset-4 dark:text-indigo-400",children:["Learn more",e.jsx(A.ExternalLinkIcon,{className:"size-4 shrink-0","aria-hidden":"true"})]})]})]}),e.jsx("div",{className:"space-y-6 md:col-span-2",children:e.jsx(ji,{className:"p-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-10",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:"Leave workspace"}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-gray-500",children:"Revoke your access to this team. Other people you have added to the workspace will remain."})]}),e.jsx(z,{variant:"secondary",className:"text-red-600 dark:text-red-500",children:"Leave"})]})})})]})})]}):e.jsx("div",{children:"Loading..."})}const Ai=({initialData:t})=>{var p;const{client:s}=E(),a=Q.useRouter(),r=Y(),i=K(),n=t?pn:za,o=F.useForm({resolver:ue.zodResolver(n),defaultValues:t?{title:t.title,providerName:t.providerName,providerLogoId:(p=t.providerLogo)==null?void 0:p.id,requireDateOfDelivery:t.requireDateOfDelivery,shippingZones:t.shippingZones}:{shippingZones:[{}]}}),l=R.useMutation({mutationFn:async g=>{const{status:h}=await s.shippingMethod.createShippingMethod({params:{organizationId:i},body:g});if(h!==201)throw X.error("Failed to create shipping method. Please try again later."),new Error("Failed to create shipping method")}}),d=R.useMutation({mutationFn:async g=>{const{status:h}=await s.shippingMethod.updateShippingMethod({params:{organizationId:i,id:t.id},body:g});if(h!==200)throw X.error("Failed to update shipping method. Please try again later."),new Error("Failed to update shipping method")}}),c=async()=>{X.success("Shipping method saved successfully"),a.push(r.settingsShippingMethods(i)),await Ae.invalidateQueries({queryKey:["shipping-and-payment"]})},u=g=>{t?d.mutate(g,{onSuccess:c}):l.mutate(g,{onSuccess:c})};return e.jsx(F.FormProvider,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(g=>u(g)),className:"space-y-14",children:[e.jsx("section",{"aria-labelledby":"Basic Information",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-information",className:"text-lg scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Basic Information"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Enter the information about your shipping method including title, shipping provider's name and logo"})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(Ne,{form:o,config:[{name:"title",label:"Title",type:"text",placeholder:"Standard Shipping",colspan:2},{name:"providerName",label:"Provider Name",type:"text",placeholder:"FedEx",colspan:2},{name:"providerLogoId",label:"Provider Logo",type:"file"},{name:"requireDateOfDelivery",label:"Require Date of Delivery?",type:"switch",colspan:2}]})})]})}),e.jsx($,{}),e.jsx("section",{"aria-labelledby":"product-information",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-information",className:"text-lg scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Shipping Zones"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Set pricing and minimum order based on delivery zones"})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(Ne,{form:o,config:[{name:"shippingZones",type:"array",fields:[{name:"title",label:"Title",type:"text",placeholder:"Zone 1"},{name:"distanceUpto",label:"Distance To (km)",type:"number",placeholder:"10"},{name:"price",label:"Shipping Price",type:"number",placeholder:"5.99",prefix:"USD"},{name:"minimumOrderAmount",label:"Minimum Order Amount",type:"number",placeholder:"50",prefix:"USD"},{name:"eta",label:"Estimated Time of Arrival",type:"text",placeholder:"2-3 days"}]}]})})]})}),e.jsx($,{}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsxs(z,{type:"button",variant:"secondary",onClick:()=>a.push(r.settingsShippingMethods(i)),children:[e.jsx(A.ChevronLeft,{className:"w-4 h-4 mr-2"})," Cancel"]}),e.jsxs(z,{type:"submit",isLoading:l.isPending||d.isPending,loadingText:"Saving...",children:[e.jsx(A.CheckIcon,{className:"w-4 h-4 mr-2"})," ",t?"Save Product":"Create Shipping Method"]})]})]})})};function Td(){return e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Create Shipping Method"}),e.jsx($,{}),e.jsx("div",{className:"pt-6",children:e.jsx("div",{className:"space-y-10",children:e.jsx(Ai,{})})})]})}function Qd(){const t=K(),s=gt(),{client:a}=E(),{isLoading:r,data:i}=R.useQuery({queryKey:["shipping-and-payment",t,s],queryFn:async()=>{const{status:n,body:o}=await a.shippingMethod.getShippingMethod({params:{id:s,organizationId:t}});if(n!==200)throw X.error("Failed to fetch shipping method. Please refresh or try again later."),new Error("Failed to fetch shipping method");return o},throwOnError:!0,placeholderData:R.keepPreviousData});return e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Edit Shipping Method"}),e.jsx($,{}),e.jsx("div",{className:"pt-6",children:e.jsx("div",{className:"space-y-10",children:r||!i?e.jsx("div",{className:"flex justify-center items-center h-screen mt-5",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(ce,{className:"w-12 h-12"}),e.jsx("p",{className:"text-gray-500 text-sm mt-3",children:"Loading data..."})]})}):e.jsx(Ai,{initialData:i})})})]})}const Ue=ge.createColumnHelper(),zd=[Ue.display({id:"select",header:({table:t})=>e.jsx(ve,{checked:t.getIsAllPageRowsSelected()?!0:t.getIsSomeRowsSelected()?"indeterminate":!1,onCheckedChange:()=>t.toggleAllPageRowsSelected(),className:"translate-y-0.5","aria-label":"Select all"}),cell:({row:t})=>e.jsx(ve,{checked:t.getIsSelected(),onCheckedChange:()=>t.toggleSelected(),className:"translate-y-0.5","aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,meta:{displayName:"Select"}}),Ue.accessor("id",{header:({column:t})=>e.jsx(L,{column:t,title:"Id"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"ID"},cell:({row:t,table:s})=>{var r,i,n;const a=(r=s.options.meta)==null?void 0:r.organizationId;return e.jsx(H,{href:((n=(i=s.options.meta)==null?void 0:i.routes)==null?void 0:n.settingsShippingMethodEdit(a,t.getValue("id")))??`/admin/${a}/settings/shipping-methods/${t.getValue("id")}`,className:"text-blue-500",children:t.getValue("id")})}}),Ue.accessor("title",{header:({column:t})=>e.jsx(L,{column:t,title:"Title"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Title"}}),Ue.accessor("providerName",{header:({column:t})=>e.jsx(L,{column:t,title:"Provider Name"}),enableSorting:!0,meta:{className:"text-left",displayName:"Provider Name"}}),Ue.accessor("shippingZones",{header:({column:t})=>e.jsx(L,{column:t,title:"Shipping Zones"}),enableSorting:!1,meta:{className:"text-left",displayName:"Shipping Zones"},cell:({row:t})=>t.getValue("shippingZones").map(a=>a.title).join(", ")||"-"}),Ue.display({id:"edit",header:"Edit",enableSorting:!1,enableHiding:!1,meta:{className:"text-right",displayName:"Edit"},cell:({row:t,table:s})=>{var r,i,n;const a=(r=s.options.meta)==null?void 0:r.organizationId;return e.jsxs(Le,{children:[e.jsx(Ee,{asChild:!0,children:e.jsx(z,{variant:"ghost",className:"group aspect-square px-1.5 py-0! h-8! hover:border hover:border-gray-300 data-[state=open]:border-gray-300 data-[state=open]:bg-gray-50 dark:hover:border-gray-700 dark:data-[state=open]:border-gray-700 dark:data-[state=open]:bg-gray-900",children:e.jsx(C.RiMoreFill,{className:"size-4 shrink-0 text-gray-500 group-hover:text-gray-700 group-data-[state=open]:text-gray-700 dark:group-hover:text-gray-300 dark:group-data-[state=open]:text-gray-300","aria-hidden":"true"})})}),e.jsxs(De,{align:"end",className:"min-w-40",children:[e.jsx(fe,{children:e.jsx(H,{href:((n=(i=s.options.meta)==null?void 0:i.routes)==null?void 0:n.settingsShippingMethodEdit(a,t.getValue("id")))??`/admin/${a}/settings/shipping-methods/${t.getValue("id")}`,className:"block",children:"Edit"})}),e.jsx(fe,{className:"text-red-600 dark:text-red-500",children:"Delete"})]})]})}})],Id=()=>{const{client:t}=E(),s=K(),a=Q.useSearchParams(),[r]=x.useState(""),[i]=Fe.useDebounce(r,300),n=Number((a==null?void 0:a.get("page"))||"1"),{isLoading:o,isRefetching:l,isError:d,data:c}=R.useQuery({queryKey:["shipping-and-payment",s,n,i],queryFn:async()=>{const{body:u,status:p}=await t.shippingMethod.getShippingMethods({params:{organizationId:s},query:{page:n,limit:10,search:i}});if(p!==200)throw new Error("Failed to fetch shipping methods");return u},placeholderData:R.keepPreviousData});return e.jsx("div",{children:e.jsx(st,{error:d,loading:o||l,meta:c!=null&&c.meta?{...c==null?void 0:c.meta,currentPage:n}:void 0,data:(c==null?void 0:c.list)||[],columns:zd,className:"mt-8"})})};function Ld(){const t=K(),s=Y();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"sm:flex sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"existing-users",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Shipping Methods"}),e.jsx("p",{className:"text-sm leading-6 text-gray-500",children:"Set up delivery zones, pricing based on distance, and manage shipping methods and providers for your organization."})]}),e.jsx(z,{asChild:!0,className:"hidden gap-x-2 px-2 py-1.5 text-sm sm:text-xs lg:flex",children:e.jsxs(H,{href:s.settingsShippingMethodCreate(t),children:["Create Shipping Method",e.jsx(A.PlusIcon,{className:"size-4 shrink-0","aria-hidden":"true"})]})})]}),e.jsx(Id,{})]})}const Ed=()=>{const t=Q.useRouter(),s=Q.useSearchParams(),a=mt(),r=Y(),i=a.signIn,n=Gt(s==null?void 0:s.get("redirect"),r),{register:o,handleSubmit:l,formState:{errors:d,isSubmitting:c}}=F.useForm({resolver:ue.zodResolver(Da),shouldFocusError:!0}),u=()=>t.push(n),p=async h=>{await i.email({email:h.email,password:h.password,fetchOptions:{onSuccess:u}})},g=async()=>{await i.social({provider:"google",callbackURL:jr(window.location.origin,n,r)})};return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex w-full flex-col items-start sm:max-w-sm",children:[e.jsx("div",{className:"relative flex items-center justify-center rounded-lg bg-white p-3 shadow-lg ring-1 ring-black/5",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:481,zoomAndPan:"magnify",viewBox:"0 0 360.75 362.250002",height:483,preserveAspectRatio:"xMidYMid meet",className:"size-8 text-blue-500 dark:text-blue-500",children:[e.jsxs("defs",{children:[e.jsx("filter",{x:"0%",y:"0%",width:"100%",height:"100%",id:"2330832e18",children:e.jsx("feColorMatrix",{values:"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0",colorInterpolationFilters:"sRGB"})}),e.jsx("clipPath",{id:"5855bcb1c8",children:e.jsx("path",{d:"M 49 49.945312 L 357 49.945312 L 357 361.257812 L 49 361.257812 Z M 49 49.945312 ",clipRule:"nonzero"})}),e.jsx("clipPath",{id:"2af377de26",children:e.jsx("path",{d:"M 226.65625 348.957031 L 345.746094 229.867188 C 359.820312 215.792969 359.820312 193.058594 345.746094 178.984375 L 228.101562 61.339844 C 220.160156 53.398438 209.515625 49.070312 198.328125 49.070312 L 50.730469 49.070312 L 180.644531 178.984375 C 194.71875 193.058594 194.71875 215.792969 180.644531 229.867188 L 49.285156 361.226562 L 196.882812 361.226562 C 208.070312 361.226562 218.71875 356.714844 226.65625 348.957031 Z M 226.65625 348.957031 ",clipRule:"nonzero"})}),e.jsx("image",{x:0,y:0,width:313,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATkAAAE5CAYAAADr4VfxAAAABmJLR0QA/wD/AP+gvaeTAAAEKklEQVR4nO3UMQqAMBQFQeP9D51aUYSAIssM/CbwSLdj+4dxcXfvT7eys7Gx+Xbz5l8H+/kBoETkgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSJsw7gNx2VB9PQAAAABJRU5ErkJggg==",id:"dfad2cd726",height:313,preserveAspectRatio:"xMidYMid meet"}),e.jsx("mask",{id:"161eaca8d9",children:e.jsx("g",{filter:"url(#2330832e18)",children:e.jsx("g",{children:e.jsx("image",{x:0,y:0,width:313,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATkAAAE5CAYAAADr4VfxAAAABmJLR0QA/wD/AP+gvaeTAAAEKklEQVR4nO3UMQqAMBQFQeP9D51aUYSAIssM/CbwSLdj+4dxcXfvT7eys7Gx+Xbz5l8H+/kBoETkgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSJsw7gNx2VB9PQAAAABJRU5ErkJggg==",height:313,preserveAspectRatio:"xMidYMid meet"})})})}),e.jsx("clipPath",{id:"5d3dc395e3",children:e.jsx("rect",{x:0,width:313,y:0,height:313})}),e.jsx("pattern",{id:"2569dd48be",patternUnits:"userSpaceOnUse",width:313,patternTransform:"matrix(0.997934, 0, 0, -0.997934, 48.148759, 361.331903)",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 313 313",height:313,x:0,y:0,children:e.jsx("g",{children:e.jsx("g",{clipPath:"url(#5d3dc395e3)",children:e.jsx("g",{mask:"url(#161eaca8d9)",children:e.jsx("rect",{x:"-127.777762",width:"520.555524",fill:"#8c52ff",height:"522.72",y:"-80.78",fillOpacity:1})})})})}),e.jsx("clipPath",{id:"2302aeb2c7",children:e.jsx("path",{d:"M 0.246094 0.90625 L 308 0.90625 L 308 312.21875 L 0.246094 312.21875 Z M 0.246094 0.90625 ",clipRule:"nonzero"})}),e.jsx("clipPath",{id:"d6b3633872",children:e.jsx("path",{d:"M 177.617188 299.917969 L 296.707031 180.828125 C 310.78125 166.753906 310.78125 144.019531 296.707031 129.945312 L 179.0625 12.300781 C 171.121094 4.363281 160.476562 0.03125 149.289062 0.03125 L 1.691406 0.03125 L 131.605469 129.945312 C 145.679688 144.019531 145.679688 166.753906 131.605469 180.828125 L 0.246094 312.1875 L 147.84375 312.1875 C 159.03125 312.1875 169.679688 307.675781 177.617188 299.917969 Z M 177.617188 299.917969 ",clipRule:"nonzero"})}),e.jsx("image",{x:0,y:0,width:312,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE5CAYAAAAEIzzPAAAABmJLR0QA/wD/AP+gvaeTAAAEKElEQVR4nO3UMQ6AIAAEQfH/j7bGQhqVZDOT0EAudDuO/cbDWb3bvLf76x8bmy83k/N+AVAhcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2RdVgkDcV9ZT24AAAAASUVORK5CYII=",id:"f9fee20a49",height:313,preserveAspectRatio:"xMidYMid meet"}),e.jsx("mask",{id:"8bb974956b",children:e.jsx("g",{filter:"url(#2330832e18)",children:e.jsx("g",{children:e.jsx("image",{x:0,y:0,width:312,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE5CAYAAAAEIzzPAAAABmJLR0QA/wD/AP+gvaeTAAAEKElEQVR4nO3UMQ6AIAAEQfH/j7bGQhqVZDOT0EAudDuO/cbDWb3bvLf76x8bmy83k/N+AVAhcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2RdVgkDcV9ZT24AAAAASUVORK5CYII=",height:313,preserveAspectRatio:"xMidYMid meet"})})})}),e.jsx("clipPath",{id:"4f6b6cd058",children:e.jsx("rect",{x:0,width:312,y:0,height:313})}),e.jsx("pattern",{id:"80e461df2c",patternUnits:"userSpaceOnUse",width:312,patternTransform:"matrix(0.997934, 0, 0, -0.997934, 0.247933, 312.433143)",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 312 313",height:313,x:0,y:0,children:e.jsx("g",{children:e.jsx("g",{clipPath:"url(#4f6b6cd058)",children:e.jsx("g",{mask:"url(#8bb974956b)",children:e.jsx("rect",{x:"-79.777762",width:"520.555524",fill:"#8c52ff",height:"522.72",y:"-129.78",fillOpacity:1})})})})})]}),e.jsx("g",{clipPath:"url(#5855bcb1c8)",children:e.jsx("g",{clipPath:"url(#2af377de26)",children:e.jsx("path",{fill:"url(#2569dd48be)",d:"M 359.820312 361.226562 L 49.289062 361.226562 L 49.289062 49.945312 L 359.820312 49.945312 Z M 359.820312 361.226562 ",fillRule:"nonzero"})})}),e.jsx("g",{clipPath:"url(#2302aeb2c7)",children:e.jsx("g",{clipPath:"url(#d6b3633872)",children:e.jsx("path",{fill:"url(#80e461df2c)",d:"M 310.78125 312.1875 L 0.25 312.1875 L 0.25 0.90625 L 310.78125 0.90625 Z M 310.78125 312.1875 ",fillRule:"nonzero"})})})]})}),e.jsxs("div",{className:"mt-6 flex flex-col",children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:"Log in to Shophost"}),e.jsxs("p",{className:"mt-1 text-sm text-gray-700 dark:text-gray-300",children:["Don’t have an account?"," ",e.jsx(H,{className:"text-blue-500 hover:text-blue-600 dark:text-blue-500 dark:hover:text-blue-400",href:Ps(r.signUp,n),children:"Sign up"})]})]}),e.jsxs("div",{className:"mt-10 w-full",children:[e.jsx("div",{className:"gap-2 sm:flex sm:flex-row sm:items-center",children:e.jsxs(z,{variant:"secondary",type:"button",className:"mt-2 w-full sm:mt-0 shadow-none inline-flex items-center gap-2",onClick:g,children:[e.jsx(C.RiGoogleFill,{className:"size-4","aria-hidden":"true"}),"Login with Google"]})}),e.jsx($,{className:"my-6",children:"or"}),e.jsxs("form",{onSubmit:l(p),className:"flex w-full flex-col gap-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-y-4",children:[e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(be,{htmlFor:"email-form-item",className:"font-medium",children:"Email"}),e.jsx(he,{type:"email",autoComplete:"email",id:"email-form-item",placeholder:"emily.ross@acme.ch",...o("email")}),d.email&&e.jsx("span",{className:"text-sm text-red-500",children:d.email.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(be,{htmlFor:"password-form-item",className:"font-medium",children:"Password"}),e.jsx(he,{type:"password",autoComplete:"current-password",id:"password-form-item",placeholder:"Password",...o("password")}),d.password&&e.jsx("span",{className:"text-sm text-red-500",children:d.password.message})]})]}),e.jsx(z,{type:"submit",isLoading:c,children:c?"Submitting...":"Continue"})]})]}),e.jsx($,{}),e.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Forgot your password?"," ",e.jsx("a",{className:"text-blue-500 hover:text-blue-600 dark:text-blue-500 dark:hover:text-blue-400",href:"#",children:"Reset password"})]})]})})};function vi({children:t}){const{appearance:s}=fr(),a=s==null?void 0:s.loginImage;return e.jsxs("div",{className:"flex w-full min-h-screen",children:[a&&e.jsx("div",{className:"hidden lg:block relative w-1/2 overflow-hidden",children:e.jsx(xe,{src:a,alt:"Login Visual",width:4e3,height:2250,className:"w-full h-full object-cover min-h-screen"})}),e.jsx("div",{className:`w-full ${a?"lg:w-1/2":""} flex items-center justify-center p-8`,children:e.jsx("div",{className:"w-full max-w-md space-y-8",children:t})})]})}function Dd(){return e.jsx(vi,{children:e.jsx(Ed,{})})}const Md=()=>{const t=Q.useRouter(),s=Q.useSearchParams(),a=mt(),r=Y(),{signIn:i,signUp:n}=a,o=Gt(s==null?void 0:s.get("redirect"),r),{register:l,handleSubmit:d,formState:{errors:c}}=F.useForm({resolver:ue.zodResolver(Ss),shouldFocusError:!0}),u=()=>t.push(o),{isPending:p,isError:g,mutate:h}=R.useMutation({onMutate:async b=>n.email({email:b.email,password:b.password,name:`${b.firstname} ${b.lastname}`,firstname:b.firstname,lastname:b.lastname,fetchOptions:{onSuccess:u}})}),y=async()=>i.social({provider:"google",callbackURL:jr(window.location.origin,o,r)});return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex w-full flex-col items-start sm:max-w-sm",children:[e.jsx("div",{className:"relative flex items-center justify-center rounded-lg bg-white p-3 shadow-lg ring-1 ring-black/5",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:481,zoomAndPan:"magnify",viewBox:"0 0 360.75 362.250002",height:483,preserveAspectRatio:"xMidYMid meet",className:"size-8 text-blue-500 dark:text-blue-500",children:[e.jsxs("defs",{children:[e.jsx("filter",{x:"0%",y:"0%",width:"100%",height:"100%",id:"2330832e18",children:e.jsx("feColorMatrix",{values:"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0",colorInterpolationFilters:"sRGB"})}),e.jsx("clipPath",{id:"5855bcb1c8",children:e.jsx("path",{d:"M 49 49.945312 L 357 49.945312 L 357 361.257812 L 49 361.257812 Z M 49 49.945312 ",clipRule:"nonzero"})}),e.jsx("clipPath",{id:"2af377de26",children:e.jsx("path",{d:"M 226.65625 348.957031 L 345.746094 229.867188 C 359.820312 215.792969 359.820312 193.058594 345.746094 178.984375 L 228.101562 61.339844 C 220.160156 53.398438 209.515625 49.070312 198.328125 49.070312 L 50.730469 49.070312 L 180.644531 178.984375 C 194.71875 193.058594 194.71875 215.792969 180.644531 229.867188 L 49.285156 361.226562 L 196.882812 361.226562 C 208.070312 361.226562 218.71875 356.714844 226.65625 348.957031 Z M 226.65625 348.957031 ",clipRule:"nonzero"})}),e.jsx("image",{x:0,y:0,width:313,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATkAAAE5CAYAAADr4VfxAAAABmJLR0QA/wD/AP+gvaeTAAAEKklEQVR4nO3UMQqAMBQFQeP9D51aUYSAIssM/CbwSLdj+4dxcXfvT7eys7Gx+Xbz5l8H+/kBoETkgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSJsw7gNx2VB9PQAAAABJRU5ErkJggg==",id:"dfad2cd726",height:313,preserveAspectRatio:"xMidYMid meet"}),e.jsx("mask",{id:"161eaca8d9",children:e.jsx("g",{filter:"url(#2330832e18)",children:e.jsx("g",{children:e.jsx("image",{x:0,y:0,width:313,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATkAAAE5CAYAAADr4VfxAAAABmJLR0QA/wD/AP+gvaeTAAAEKklEQVR4nO3UMQqAMBQFQeP9D51aUYSAIssM/CbwSLdj+4dxcXfvT7eys7Gx+Xbz5l8H+/kBoETkgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSJsw7gNx2VB9PQAAAABJRU5ErkJggg==",height:313,preserveAspectRatio:"xMidYMid meet"})})})}),e.jsx("clipPath",{id:"5d3dc395e3",children:e.jsx("rect",{x:0,width:313,y:0,height:313})}),e.jsx("pattern",{id:"2569dd48be",patternUnits:"userSpaceOnUse",width:313,patternTransform:"matrix(0.997934, 0, 0, -0.997934, 48.148759, 361.331903)",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 313 313",height:313,x:0,y:0,children:e.jsx("g",{children:e.jsx("g",{clipPath:"url(#5d3dc395e3)",children:e.jsx("g",{mask:"url(#161eaca8d9)",children:e.jsx("rect",{x:"-127.777762",width:"520.555524",fill:"#8c52ff",height:"522.72",y:"-80.78",fillOpacity:1})})})})}),e.jsx("clipPath",{id:"2302aeb2c7",children:e.jsx("path",{d:"M 0.246094 0.90625 L 308 0.90625 L 308 312.21875 L 0.246094 312.21875 Z M 0.246094 0.90625 ",clipRule:"nonzero"})}),e.jsx("clipPath",{id:"d6b3633872",children:e.jsx("path",{d:"M 177.617188 299.917969 L 296.707031 180.828125 C 310.78125 166.753906 310.78125 144.019531 296.707031 129.945312 L 179.0625 12.300781 C 171.121094 4.363281 160.476562 0.03125 149.289062 0.03125 L 1.691406 0.03125 L 131.605469 129.945312 C 145.679688 144.019531 145.679688 166.753906 131.605469 180.828125 L 0.246094 312.1875 L 147.84375 312.1875 C 159.03125 312.1875 169.679688 307.675781 177.617188 299.917969 Z M 177.617188 299.917969 ",clipRule:"nonzero"})}),e.jsx("image",{x:0,y:0,width:312,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE5CAYAAAAEIzzPAAAABmJLR0QA/wD/AP+gvaeTAAAEKElEQVR4nO3UMQ6AIAAEQfH/j7bGQhqVZDOT0EAudDuO/cbDWb3bvLf76x8bmy83k/N+AVAhcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2RdVgkDcV9ZT24AAAAASUVORK5CYII=",id:"f9fee20a49",height:313,preserveAspectRatio:"xMidYMid meet"}),e.jsx("mask",{id:"8bb974956b",children:e.jsx("g",{filter:"url(#2330832e18)",children:e.jsx("g",{children:e.jsx("image",{x:0,y:0,width:312,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE5CAYAAAAEIzzPAAAABmJLR0QA/wD/AP+gvaeTAAAEKElEQVR4nO3UMQ6AIAAEQfH/j7bGQhqVZDOT0EAudDuO/cbDWb3bvLf76x8bmy83k/N+AVAhcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2RdVgkDcV9ZT24AAAAASUVORK5CYII=",height:313,preserveAspectRatio:"xMidYMid meet"})})})}),e.jsx("clipPath",{id:"4f6b6cd058",children:e.jsx("rect",{x:0,width:312,y:0,height:313})}),e.jsx("pattern",{id:"80e461df2c",patternUnits:"userSpaceOnUse",width:312,patternTransform:"matrix(0.997934, 0, 0, -0.997934, 0.247933, 312.433143)",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 312 313",height:313,x:0,y:0,children:e.jsx("g",{children:e.jsx("g",{clipPath:"url(#4f6b6cd058)",children:e.jsx("g",{mask:"url(#8bb974956b)",children:e.jsx("rect",{x:"-79.777762",width:"520.555524",fill:"#8c52ff",height:"522.72",y:"-129.78",fillOpacity:1})})})})})]}),e.jsx("g",{clipPath:"url(#5855bcb1c8)",children:e.jsx("g",{clipPath:"url(#2af377de26)",children:e.jsx("path",{fill:"url(#2569dd48be)",d:"M 359.820312 361.226562 L 49.289062 361.226562 L 49.289062 49.945312 L 359.820312 49.945312 Z M 359.820312 361.226562 ",fillRule:"nonzero"})})}),e.jsx("g",{clipPath:"url(#2302aeb2c7)",children:e.jsx("g",{clipPath:"url(#d6b3633872)",children:e.jsx("path",{fill:"url(#80e461df2c)",d:"M 310.78125 312.1875 L 0.25 312.1875 L 0.25 0.90625 L 310.78125 0.90625 Z M 310.78125 312.1875 ",fillRule:"nonzero"})})})]})}),e.jsxs("div",{className:"mt-6 flex flex-col",children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:"Log in to Shophost"}),e.jsxs("p",{className:"mt-1 text-sm text-gray-700 dark:text-gray-300",children:["Already have an account?"," ",e.jsx(H,{className:"text-blue-500 hover:text-blue-600 dark:text-blue-500 dark:hover:text-blue-400",href:Ps(r.signIn,o),children:"Sign in"})]})]}),e.jsxs("div",{className:"mt-10 w-full",children:[e.jsx("div",{className:"gap-2 sm:flex sm:flex-row sm:items-center",children:e.jsx(z,{asChild:!0,variant:"secondary",className:"mt-2 w-full sm:mt-0",children:e.jsxs("button",{className:"inline-flex items-center gap-2",onClick:y,children:[e.jsx(C.RiGoogleFill,{className:"size-4","aria-hidden":"true"}),"Signin with Google"]})})}),e.jsx($,{className:"my-6",children:"or"}),e.jsxs("form",{onSubmit:d(b=>h(b)),className:"flex w-full flex-col gap-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-y-4",children:[e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(be,{htmlFor:"email-form-item",className:"font-medium",children:"First Name"}),e.jsx(he,{type:"text",id:"email-form-item",placeholder:"Emily",...l("firstname")}),c.firstname&&e.jsx("span",{className:"text-sm text-red-500",children:c.firstname.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(be,{htmlFor:"email-form-item",className:"font-medium",children:"Last Name"}),e.jsx(he,{type:"text",id:"email-form-item",placeholder:"Emily",...l("lastname")}),c.lastname&&e.jsx("span",{className:"text-sm text-red-500",children:c.lastname.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(be,{htmlFor:"email-form-item",className:"font-medium",children:"Email"}),e.jsx(he,{type:"email",autoComplete:"email",id:"email-form-item",placeholder:"emily.ross@acme.ch",...l("email")}),c.email&&e.jsx("span",{className:"text-sm text-red-500",children:c.email.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(be,{htmlFor:"password-form-item",className:"font-medium",children:"Password"}),e.jsx(he,{type:"password",autoComplete:"current-password",id:"password-form-item",placeholder:"Password",...l("password")}),c.password&&e.jsx("span",{className:"text-sm text-red-500",children:c.password.message})]})]}),g&&e.jsx("span",{className:"text-sm text-red-500",children:"An error occurred, please try again."}),e.jsx(z,{type:"submit",isLoading:p,children:p?"Submitting...":"Continue"})]})]}),e.jsx($,{}),e.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Forgot your password?"," ",e.jsx("a",{className:"text-blue-500 hover:text-blue-600 dark:text-blue-500 dark:hover:text-blue-400",href:"#",children:"Reset password"})]})]})})};function Bd(){return e.jsx(vi,{children:e.jsx(Md,{})})}function Jd(t){if(t.length===0)return{type:"home"};const[s,a,r,i,n]=t;if(s==="auth")return a==="sign-in"?{type:"sign-in"}:a==="sign-up"?{type:"sign-up"}:{type:"not-found"};if(s==="organizations")return{type:"organizations"};const o=s;return a?a==="dashboard"?{type:"dashboard",orgId:o}:a==="orders"?{type:"orders",orgId:o}:a==="reservations"?{type:"reservations",orgId:o}:a==="products"?r?r==="create"?{type:"product-create",orgId:o}:{type:"product-edit",orgId:o,id:r}:{type:"products-list",orgId:o}:a==="product-categories"?r?r==="create"?{type:"product-category-create",orgId:o}:{type:"product-category-edit",orgId:o,id:r}:{type:"product-categories-list",orgId:o}:a==="manufacturers"?r?r==="create"?{type:"manufacturer-create",orgId:o}:{type:"manufacturer-edit",orgId:o,id:r}:{type:"manufacturers-list",orgId:o}:a==="settings"?r?r==="opening-times"?{type:"settings-opening-times",orgId:o}:r==="shipping-methods"?i?i==="create"?{type:"shipping-method-create",orgId:o}:{type:"shipping-method-edit",orgId:o,id:i}:{type:"shipping-methods-list",orgId:o}:{type:"settings",orgId:o}:{type:"settings",orgId:o}:{type:"not-found"}:{type:"not-found"}}function Od({segments:t}){const s=mt(),a=Y(),r=Q.useRouter(),i=Q.usePathname(),n=Q.useSearchParams(),{data:o,isPending:l}=s.useSession(),d=Jd(t),c=d.type==="sign-in"||d.type==="sign-up",u=d.type==="home"||d.type==="organizations",p=n==null?void 0:n.get("redirect"),g=n==null?void 0:n.toString(),h=i?`${i}${g?`?${g}`:""}`:a.home,y=c?Gt(p,a):h;if(x.useEffect(()=>{if(!l){if(!o&&!c){r.replace(Ps(a.signIn,y));return}o&&c&&r.replace(y)}},[o,l,c,r,a.signIn,y]),l)return e.jsx("div",{className:"flex justify-center items-center h-screen",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"})});if(c){if(d.type==="sign-in")return e.jsx(Dd,{});if(d.type==="sign-up")return e.jsx(Bd,{})}if(!o)return null;if(u)return e.jsx(ea,{children:e.jsx(Fl,{})});if(d.type==="not-found")return e.jsx(Cs,{});const b="orgId"in d?d.orgId:void 0,f="id"in d?d.id:void 0;return e.jsx(Ao,{organizationId:b,id:f,children:e.jsx(ea,{children:e.jsx(Ro,{children:e.jsx(jd,{children:Fd(d)})})})})}function Fd(t){switch(t.type){case"dashboard":return e.jsx(tl,{});case"orders":return e.jsx(Jl,{});case"reservations":return e.jsx(gd,{});case"products-list":return e.jsx(od,{});case"product-create":return e.jsx(td,{});case"product-edit":return e.jsx(sd,{});case"product-categories-list":return e.jsx(Wl,{});case"product-category-create":return e.jsx(ql,{});case"product-category-edit":return e.jsx($l,{});case"manufacturers-list":return e.jsx(zl,{});case"manufacturer-create":return e.jsx(wl,{});case"manufacturer-edit":return e.jsx(bl,{});case"settings":return e.jsx(nt,{children:e.jsx(Pd,{})});case"settings-opening-times":return e.jsx(nt,{children:e.jsx(Nd,{})});case"shipping-methods-list":return e.jsx(nt,{children:e.jsx(Ld,{})});case"shipping-method-create":return e.jsx(nt,{children:e.jsx(Td,{})});case"shipping-method-edit":return e.jsx(nt,{children:e.jsx(Qd,{})});default:return e.jsx(Cs,{})}}exports.APIProvider=gs;exports.AdminProvider=yo;exports.AdminRouter=Od;exports.AuthPages=to;exports.Badge=We;exports.Button=de;exports.CartItems=Ki;exports.CartProvider=fa;exports.CheckoutPages=ao;exports.Command=pt;exports.CommandBar=nr;exports.CommandBarBar=lr;exports.CommandBarCommand=cr;exports.CommandBarSeperator=dr;exports.CommandBarValue=or;exports.CommandDialog=vn;exports.CommandEmpty=Ut;exports.CommandGroup=Wt;exports.CommandInput=Ht;exports.CommandItem=_t;exports.CommandList=Zt;exports.CommandSeparator=Ua;exports.CommandShortcut=Wa;exports.CountryInput=$a;exports.CustomerDetailsPage=ds;exports.Dialog=Ft;exports.DialogClose=Oa;exports.DialogContent=Vt;exports.DialogDescription=Ha;exports.DialogFooter=Za;exports.DialogHeader=ks;exports.DialogTitle=js;exports.DialogTrigger=Ja;exports.Divider=_e;exports.EmailInput=Ga;exports.ErrorView=Cs;exports.ImageUploadInput=Ka;exports.Input=ar;exports.InputGroup=ae;exports.Label=le;exports.LocationInput=qt;exports.ModifierContainer=ro;exports.ModifiersGroup=no;exports.ModifiersModal=lo;exports.ModifiersOption=oo;exports.PhoneNumberInput=er;exports.Popover=Ke;exports.PopoverAnchor=_a;exports.PopoverClose=qa;exports.PopoverContent=Ye;exports.PopoverTrigger=Xe;exports.QuantityControl=io;exports.RadioCardGroup=zt;exports.RadioCardGroupIndicator=It;exports.RadioCardItem=Lt;exports.SelectInput=tr;exports.ShippingAndPaymentPage=pr;exports.ShophostProvider=go;exports.SliderOver=ir;exports.Switch=As;exports.TextInput=we;exports.TimeInput=vs;exports.badgeVariants=ur;exports.buttonVariants=Ba;exports.calculateCartTotal=Hi;exports.createAdminAuthClient=wr;exports.createRoutes=Sr;exports.findCartItem=Ui;exports.formatPrice=ye;exports.getAdminAuthClient=br;exports.getFieldError=rr;exports.getFormattedModifiers=Zi;exports.mockProducts=po;exports.productRequiresModifiers=Wi;exports.useAPI=E;exports.useCart=Mt;exports.useCartContext=xs;exports.useLocalization=ya;exports.useModifierSelection=wa;exports.useModifiers=ut;exports.useMultipleProductDetails=uo;exports.useOrganization=ze;exports.useProductDetails=co;
|
|
2
|
+
"use strict";const e=require("react/jsx-runtime"),F=require("react-hook-form"),A=require("lucide-react"),h=require("react"),ia=require("@vercel/blob/client"),xe=require("next/image.js"),R=require("@tanstack/react-query"),Fe=require("use-debounce"),w=require("classnames"),Ci=require("use-mask-input"),it=require("@headlessui/react"),Q=require("next/navigation.js"),ue=require("@hookform/resolvers/zod"),H=require("next/link.js"),T=require("date-fns"),C=require("@remixicon/react"),na=require("next-themes"),X=require("react-hot-toast"),Ct=require("better-auth/client/plugins"),oa=require("better-auth/react"),Pi=require("@shophost/client"),p=require("@hono/zod-openapi"),ps=require("@radix-ui/react-slot"),Se=require("tailwind-variants"),la=require("clsx"),da=require("tailwind-merge"),V=require("cmdk"),Ti=require("@radix-ui/react-dialog"),Qi=require("@radix-ui/react-popover"),zi=require("react-phone-number-input"),ca=require("react-phone-number-input/flags"),Ii=require("@radix-ui/react-switch"),Li=require("@radix-ui/react-label"),Ei=require("@radix-ui/react-radio-group"),oe=require("recharts"),Di=require("@radix-ui/react-checkbox"),te=require("@internationalized/date"),ua=require("@react-aria/datepicker"),Mi=require("@react-stately/datepicker"),Bi=require("date-fns/locale"),jt=require("react-day-picker"),Ji=require("@radix-ui/react-select"),Oi=require("@radix-ui/react-navigation-menu"),ge=require("@tanstack/react-table"),Fi=require("@radix-ui/react-dropdown-menu");function ke(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const N=ke(h),Z=ke(Ti),q=ke(Qi),Dt=ke(zi),Pt=ke(Ii),pa=ke(Li),ms=ke(Ei),Zs=ke(Di),G=ke(Ji),Tt=ke(Oi),re=ke(Fi),Us="shophost-cart",Vi={items:[],isInitialized:!1,isModifiersModalOpen:!1,selectedProduct:null,onModalAddToCart:void 0,totalAmount:0,itemCount:0,removedItemsAlert:!1},Hi=(t,s)=>t.reduce((a,r)=>{const i=s(r.productId);if(!i)return a;const n=r.quantity||1;let l=Number(i.discountedBasePrice??i.basePrice??0)*n;return r.modifierGroups&&r.modifierGroups.length>0&&r.modifierGroups.forEach(d=>{var u;const c=(u=i.modifierGroups)==null?void 0:u.find(m=>m.id===d.id);c&&d.modifiers.forEach(m=>{const g=c.modifiers.find(x=>x.id===m.id);if(g){const x=m.quantity||1;l+=Number(g.price??0)*x*n}})}),a+l},0),ye=(t,s="USD",a="en-US")=>new Intl.NumberFormat(a,{style:"currency",currency:s}).format(t),Zi=(t,s,a="en-US")=>{const r=s(t.productId);return!r||!t.modifierGroups||t.modifierGroups.length===0?"":t.modifierGroups.filter(i=>i&&i.modifiers).map(i=>{var d,c,u,m;const n=(d=r.modifierGroups)==null?void 0:d.find(g=>g&&g.id===i.id);if(!n||!n.modifiers)return"";const o=((u=(c=n.translations)==null?void 0:c.find(g=>g&&g.locale===a))==null?void 0:u.title)||(n.translations&&n.translations.length>0?(m=n.translations[0])==null?void 0:m.title:"")||"",l=(i.modifiers||[]).filter(g=>g).map(g=>{const x=n.modifiers.find(y=>y&&y.id===g.id);if(!x)return"";const f=x.title||"",b=g.quantity||1;return b>1?`${f} (${b})`:f}).filter(Boolean).join(", ");return o?`${o}: ${l}`:l}).filter(Boolean).join(" | ")},Ui=(t,s,a)=>t.find(r=>r.productId!==s?!1:!a||a.length===0?!r.modifierGroups||r.modifierGroups.length===0:!r.modifierGroups||r.modifierGroups.length===0?!1:ls(r.modifierGroups,a)),ls=(t,s)=>{if(t.length!==s.length)return!1;const a=[...s];return t.every(r=>{const i=a.findIndex(n=>{if(r.id!==n.id||r.modifiers.length!==n.modifiers.length)return!1;const o=[...n.modifiers];return r.modifiers.every(l=>{const d=o.findIndex(c=>l.id===c.id&&(l.quantity||1)===(c.quantity||1));return d>=0?(o.splice(d,1),!0):!1})});return i>=0?(a.splice(i,1),!0):!1})},Wi=t=>!t.modifierGroups||t.modifierGroups.length===0?!1:t.modifierGroups.some(s=>s.selectMin>0),qi=(t,s)=>{var a,r,i,n;if(!t.modifierGroups||t.modifierGroups.length===0)return{valid:!0};for(const o of t.modifierGroups){const l=s.find(c=>c.groupId===o.id),d=(l==null?void 0:l.modifierIds.length)||0;if(o.selectMin>0&&d<o.selectMin){const c=((r=(a=o.translations)==null?void 0:a[0])==null?void 0:r.title)||"Option";return{valid:!1,message:`Please select at least ${o.selectMin} ${c}`}}if(o.selectMax>0&&d>o.selectMax){const c=((n=(i=o.translations)==null?void 0:i[0])==null?void 0:n.title)||"Option";return{valid:!1,message:`You can select at most ${o.selectMax} ${c}`}}}return{valid:!0}},He=t=>t.reduce((s,a)=>s+(a.quantity||1),0),$i=(t,s)=>t.findIndex(a=>{var r,i,n,o,l;return a.productId!==s.productId?!1:!((r=a.modifierGroups)!=null&&r.length)&&!((i=s.modifierGroups)!=null&&i.length)?!0:(((n=a.modifierGroups)==null?void 0:n.length)||0)!==(((o=s.modifierGroups)==null?void 0:o.length)||0)?!1:((l=a.modifierGroups)==null?void 0:l.every(d=>{var u;const c=(u=s.modifierGroups)==null?void 0:u.find(m=>m.id===d.id);return c?d.modifiers.every(m=>c.modifiers.some(g=>g.id===m.id&&g.quantity===m.quantity)):!1}))||!1}),_i=(t,s)=>!t.modifierGroups||t.modifierGroups.length===0?!0:!s.modifierGroups||s.modifierGroups.length===0?!1:t.modifierGroups.every(a=>{var i;const r=(i=s.modifierGroups)==null?void 0:i.find(n=>n.id===a.id);return r?a.modifiers.every(n=>{var l;return!!((l=r.modifiers)==null?void 0:l.find(d=>d.id===n.id))}):!1}),ma=(t,s)=>{switch(s.type){case"INITIALIZE_CART":{const a=s.payload;return{...t,items:a,itemCount:He(a)}}case"SET_INITIALIZED":return{...t,isInitialized:s.payload};case"ADD_ITEM":{const a=s.payload,r=$i(t.items,a);let i;if(r!==-1){i=[...t.items];const n=i[r];i[r]={...n,quantity:(n.quantity||1)+(a.quantity||1)}}else i=[...t.items,a];return{...t,items:i,itemCount:He(i)}}case"UPDATE_ITEM_QUANTITY":{const{productId:a,quantity:r,modifierGroups:i}=s.payload;if(r<=0)return ma(t,{type:"REMOVE_ITEM",payload:{productId:a,modifierGroups:i}});const n=t.items.map(o=>{if(o.productId!==a)return o;if(i&&i.length>0){if(!ls(o.modifierGroups||[],i))return o}else if(!i&&o.modifierGroups&&o.modifierGroups.length>0)return o;return{...o,quantity:r}});return{...t,items:n,itemCount:He(n)}}case"REMOVE_ITEM":{const{productId:a,modifierGroups:r}=s.payload;let i;return!r||r.length===0?i=t.items.filter(n=>n.productId!==a?!0:n.modifierGroups&&n.modifierGroups.length>0):i=t.items.filter(n=>n.productId!==a?!0:n.modifierGroups&&n.modifierGroups.length>0?!ls(n.modifierGroups,r):!0),{...t,items:i,itemCount:He(i)}}case"CLEAR_CART":return{...t,items:[],itemCount:0,totalAmount:0};case"OPEN_MODIFIERS_MODAL":return{...t,isModifiersModalOpen:!0,selectedProduct:s.payload.product,onModalAddToCart:s.payload.onAddToCart};case"CLOSE_MODIFIERS_MODAL":return{...t,isModifiersModalOpen:!1};case"UPDATE_TOTALS":{const{productsData:a}=s.payload,r=t.items.reduce((i,n)=>{const o=a[n.productId];if(!o)return i;const l=Number(o.discountedBasePrice??o.basePrice??0);return i+l*(n.quantity||1)},0);return{...t,totalAmount:r}}case"REMOVE_UNAVAILABLE_PRODUCTS":{const{productsData:a,showAlert:r}=s.payload,i=t.items.length,n=t.items.filter(l=>{const d=a[l.productId];return d?_i(l,d):!1}),o=n.length<i;return{...t,items:n,itemCount:He(n),removedItemsAlert:!!(r&&o)}}case"REMOVE_INVALID_PRODUCTS":{const{invalidProductIds:a}=s.payload,r=t.items.filter(i=>!a.includes(i.productId));return{...t,items:r,itemCount:He(r)}}default:return t}};function ga(t,s,a,r){const i=Number(s.discountedBasePrice??s.basePrice??0),n=ye((t.quantity||1)*i,a,r),o=t.modifierGroups?t.modifierGroups.map(d=>{const c=s.modifierGroups.find(m=>m.id===d.id);if(!c)return null;const u=d.modifiers.map(m=>{var x;const g=(x=c.modifiers)==null?void 0:x.find(f=>f.id===m.id);return g?g.title:""}).filter(Boolean).join(", ");return u?`${c.title}: ${u}`:null}).filter(Boolean):[],l=s.images&&s.images.length>0?s.images[0]:void 0;return{title:s.title??s.slug??"Untitled product",subtitle:o,image:l,price:n,unitPrice:ye(i,a,r),quantity:t.quantity||1}}const ha=h.createContext(null),gs=({baseUrl:t,children:s})=>{const a=h.useMemo(()=>Pi.initClient({baseUrl:t,throwOnUnknownStatus:!0,baseHeaders:{},credentials:"include"}),[t]);return e.jsx(ha.Provider,{value:{client:a,baseUrl:t},children:s})},L=()=>{const t=h.useContext(ha);if(!t)throw new Error("useAPI must be used within a APIProvider");return t},xa=h.createContext(void 0),Gi=({children:t,organizationId:s})=>{const{client:a}=L(),r=R.useQuery({queryKey:["organization",s],queryFn:async()=>{const i=await a.organization.getOrganization({params:{organizationId:s}});if(i.status!==200)throw new Error("Failed to fetch product data");return i.body},placeholderData:R.keepPreviousData,enabled:!!s});return e.jsx(xa.Provider,{value:{organizationId:s,loading:r.isLoading,organization:r.data,error:r.error},children:t})},ze=()=>{const t=h.useContext(xa);if(t===void 0)throw new Error("useOrganization must be used within a OrganizationProvider");return t},hs=h.createContext(void 0),fa=({children:t,locale:s="en",organizationId:a})=>{const{organization:r}=ze(),i=r==null?void 0:r.configuration.defaultCurrency,{client:n}=L(),[o,l]=h.useState(null),[d,c]=h.useState(null),[{items:u,isInitialized:m,isModifiersModalOpen:g,selectedProduct:x,onModalAddToCart:f,totalAmount:b,itemCount:y,removedItemsAlert:S},k]=h.useReducer(ma,Vi),j=h.useMemo(()=>[...new Set(u.map(B=>B.productId))],[u]),{data:v,isLoading:P,isRefetching:$}=R.useQuery({queryKey:["cartProducts",j,y,d==null?void 0:d.id],queryFn:async()=>{if(j.length===0)return{products:{},total:0,subtotal:0,invalidProductIds:[]};const B=await n.cart.getCartData({params:{organizationId:a},query:{locale:s},body:{items:u,shippingMethodId:d==null?void 0:d.id}});if(B.status!==200)throw new Error("Failed to fetch product data");return B.body},placeholderData:R.keepPreviousData,enabled:j.length>0});h.useEffect(()=>{var B;v&&((B=v.invalidProductIds)==null?void 0:B.length)>0&&(k({type:"REMOVE_INVALID_PRODUCTS",payload:{invalidProductIds:v.invalidProductIds}}),alert("Some items have been removed from your cart because they are no longer available or their options have changed."))},[v,$,u.length]),h.useEffect(()=>{(()=>{const D=localStorage.getItem(Us);if(D)try{const J=JSON.parse(D);k({type:"INITIALIZE_CART",payload:J})}catch(J){console.error("Failed to parse cart from localStorage:",J)}k({type:"SET_INITIALIZED",payload:!0})})()},[]),h.useEffect(()=>{m&&localStorage.setItem(Us,JSON.stringify(u))},[u,m]),h.useEffect(()=>{u.length>0&&v&&k({type:"UPDATE_TOTALS",payload:{productsData:v.products}})},[u,v]);const se=h.useCallback(B=>{k({type:"ADD_ITEM",payload:B})},[]),ee=h.useCallback((B,D,J)=>{k({type:"UPDATE_ITEM_QUANTITY",payload:{productId:B,quantity:D,modifierGroups:J}})},[]),U=h.useCallback((B,D)=>{k({type:"REMOVE_ITEM",payload:{productId:B,modifierGroups:D}})},[]),O=h.useCallback(()=>{k({type:"CLEAR_CART"})},[]),je=h.useCallback(()=>{console.log("Checkout clicked, implement onCheckout handler")},[]),Me=h.useCallback((B,D)=>{k({type:"OPEN_MODIFIERS_MODAL",payload:{product:B,onAddToCart:D}})},[]),Ve=h.useCallback(()=>{k({type:"CLOSE_MODIFIERS_MODAL"})},[]),W=h.useMemo(()=>v!=null&&v.products?u.map(B=>{const D=v.products[B.productId];return D?ga(B,D,i??"USD",s):null}).filter(B=>B!==null):[],[u,v==null?void 0:v.products,i,s]),Re=h.useMemo(()=>({locale:s,items:u,total:(v==null?void 0:v.total)??0,shipping:v==null?void 0:v.shipping,subtotal:(v==null?void 0:v.subtotal)??0,products:(v==null?void 0:v.products)||{},addItem:se,removeItem:U,updateItemQuantity:ee,clearCart:O,itemCount:y,totalAmount:b,onCheckoutClick:je,openModifiersModal:Me,closeModifiersModal:Ve,isModifiersModalOpen:g,selectedProduct:x,onModalAddToCart:f,isProductsLoading:P,paymentMethod:o,setPaymentMethod:l,shippingMethod:d,setShippingMethod:c,formattedCartItems:W}),[s,u,se,U,ee,O,y,b,je,Me,Ve,g,x,f,v,P,o,l,d,c,W]);return e.jsx(hs.Provider,{value:Re,children:t})},Mt=()=>{const t=h.useContext(hs);if(t===void 0)throw new Error("useCart must be used within a CartProvider");const s=h.useCallback(a=>{var r;return(r=a==null?void 0:a.modifierGroups)!=null&&r.length?t.openModifiersModal(a):t.addItem({productId:a.id,quantity:1,modifierGroups:[]})},[t]);return{items:t.items,total:t.total,subtotal:t.subtotal,shipping:t.shipping,loading:t.isProductsLoading,formattedCartItems:t.formattedCartItems,addProductToCart:s,clearCart:t.clearCart,itemCount:t.itemCount,rawCart:t.items,onCheckoutClick:t.onCheckoutClick,totalAmount:t.totalAmount,paymentMethod:t.paymentMethod,setPaymentMethod:t.setPaymentMethod,shippingMethod:t.shippingMethod,setShippingMethod:t.setShippingMethod}},xs=()=>{const t=h.useContext(hs);if(t===void 0)throw new Error("useCart must be used within a CartProvider");return t},ya=(t="en")=>{const[s,a]=h.useState(t),r=h.useCallback((d,c,u="")=>{if(!d||d.length===0)return u;const m=d.find(x=>x.locale===s);if(m&&m[c])return m[c];const g=d[0];return g&&g[c]?g[c]:u},[s]),i=h.useCallback((d,c="Product")=>r(d==null?void 0:d.translations,"title",c),[r]),n=h.useCallback((d,c="")=>r(d==null?void 0:d.translations,"description",c),[r]),o=h.useCallback((d,c="Category")=>r(d==null?void 0:d.translations,"title",c),[r]),l=h.useCallback((d,c="Options")=>d.title,[r]);return{locale:s,setLocale:a,getTranslation:r,getProductName:i,getProductDescription:n,getCategoryName:o,getModifierGroupName:l}},wa=t=>{const[s,a]=h.useState([]),[r,i]=h.useState(null),n=h.useCallback(()=>{if(!t||!t.modifierGroups){a([]);return}const m=t.modifierGroups.map(g=>({groupId:g.id,modifierIds:[]}));a(m),i(null)},[t]),o=h.useCallback((m,g)=>{a(x=>{const f=[...x],b=f.findIndex(y=>y.groupId===m);if(b===-1)f.push({groupId:m,modifierIds:[g]});else{const y=f[b];y.modifierIds.indexOf(g)===-1?f[b]={...y,modifierIds:[...y.modifierIds,g]}:f[b]={...y,modifierIds:y.modifierIds.filter(k=>k!==g)}}return f}),i(null)},[]),l=h.useCallback((m,g)=>{a(x=>{const f=[...x],b=f.findIndex(y=>y.groupId===m);return b===-1?f.push({groupId:m,modifierIds:[g]}):f[b]={...f[b],modifierIds:[g]},f}),i(null)},[]),d=h.useCallback((m,g)=>{const x=s.find(f=>f.groupId===m);return x?x.modifierIds.includes(g):!1},[s]),c=h.useCallback(()=>{if(!t)return!0;const m=qi(t,s);return!m.valid&&m.message?i(m.message):i(null),m.valid},[t,s]),u=h.useCallback(()=>s.filter(m=>m.modifierIds.length>0).map(m=>({id:m.groupId,modifiers:m.modifierIds.map(g=>({id:g,quantity:1}))})),[s]);return{selections:s,initializeSelections:n,toggleModifier:o,selectModifier:l,isModifierSelected:d,validateSelections:c,validationError:r,getCartModifierGroups:u}},ba=h.createContext(null),Sa=({children:t,locale:s="en"})=>{const{selectedProduct:a,isModifiersModalOpen:r,closeModifiersModal:i,onModalAddToCart:n,addItem:o}=xs(),[l,d]=h.useState(1),{initializeSelections:c,toggleModifier:u,selectModifier:m,isModifierSelected:g,validateSelections:x,validationError:f,getCartModifierGroups:b}=wa(a||{}),{getProductName:y,getModifierGroupName:S}=ya(s);h.useEffect(()=>{a&&(c(),d(1))},[a,c]);const k=h.useCallback(()=>{d(O=>O+1)},[]),j=h.useCallback(()=>{d(O=>O>1?O-1:1)},[]),v=h.useCallback(()=>{!x()||!a||(o({productId:a.id,quantity:l,modifierGroups:b()}),d(1),i(),n&&n())},[x,o,a,l,b,i,n]),P=(a==null?void 0:a.modifierGroups)&&a.modifierGroups.length>0,$=(a==null?void 0:a.title)||"",se=h.useCallback(O=>O.selectMax>1||O.selectMax===0,[]),ee=h.useCallback((O,je)=>O.price>0?` (+${ye(O.price,je,s)})`:"",[s]),U={isOpen:r,onClose:i,product:a||{},productName:$,hasModifiers:P,quantity:l,handleIncrement:k,handleDecrement:j,handleAddToCart:v,validationError:f,modifierGroups:P?a.modifierGroups:[],isModifierSelected:g,isMultiSelect:se,toggleModifier:u,selectModifier:m,getModifierGroupName:S,formatModifierPrice:ee,locale:s};return e.jsx(ba.Provider,{value:U,children:t})},ut=()=>{const t=h.useContext(ba);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t},Ki=({className:t,emptyCartComponent:s,renderItem:a,loadingComponent:r})=>{const{organization:i}=ze(),{locale:n,items:o,removeItem:l,updateItemQuantity:d,products:c,isProductsLoading:u}=xs();return!i||u?r:o.length===0?s:e.jsx("div",{className:t||"flex-1 overflow-y-auto",children:c&&o.map(m=>{const g=c[m.productId];if(!g)return null;const x=()=>l(m.productId,m.modifierGroups),f=y=>d(m.productId,y,m.modifierGroups),b=ga(m,g,i.configuration.defaultCurrency,n);return e.jsx(h.Fragment,{children:a({...b,remove:x,updateQuantity:f})},`${m.productId}-${JSON.stringify(m.modifierGroups)}`)})})},$e=(...t)=>(s,a)=>{const{translations:r,defaultLocale:i}=s,n=r.findIndex(o=>o.locale===i);if(n===-1){a.addIssue({code:p.z.ZodIssueCode.custom,message:"Missing translation for the default locale",path:["translations"]});return}t.forEach(o=>{const l=r[n][o];(typeof l!="string"||!l.trim())&&a.addIssue({code:p.z.ZodIssueCode.custom,message:"This field is required",path:["translations",n,o]})})},Bt=new Map([["af","Afrikaans"],["sq","Albanian"],["ar_dz","Arabic (Algeria)"],["ar_bh","Arabic (Bahrain)"],["ar_eg","Arabic (Egypt)"],["ar_iq","Arabic (Iraq)"],["ar_jo","Arabic (Jordan)"],["ar_kw","Arabic (Kuwait)"],["ar_lb","Arabic (Lebanon)"],["ar_ly","Arabic (Libya)"],["ar_ma","Arabic (Morocco)"],["ar_om","Arabic (Oman)"],["ar_qa","Arabic (Qatar)"],["ar_sa","Arabic (Saudi Arabia)"],["ar_sy","Arabic (Syria)"],["ar_tn","Arabic (Tunisia)"],["ar_ae","Arabic (U.A.E.)"],["ar_ye","Arabic (Yemen)"],["eu","Basque"],["be","Belarusian"],["bg","Bulgarian"],["ca","Catalan"],["zh_hk","Chinese (Hong Kong)"],["zh_cn","Chinese (PRC)"],["zh_sg","Chinese (Singapore)"],["zh_tw","Chinese (Taiwan)"],["hr","Croatian"],["cs","Czech"],["da","Danish"],["nl_be","Dutch (Belgium)"],["nl","Dutch (Standard)"],["en","English"],["en_au","English (Australia)"],["en_bz","English (Belize)"],["en_ca","English (Canada)"],["en_ie","English (Ireland)"],["en_jm","English (Jamaica)"],["en_nz","English (New Zealand)"],["en_za","English (South Africa)"],["en_tt","English (Trinidad)"],["en_gb","English (United Kingdom)"],["en_us","English (United States)"],["et","Estonian"],["fo","Faeroese"],["fa","Farsi"],["fi","Finnish"],["fr_be","French (Belgium)"],["fr_ca","French (Canada)"],["fr_lu","French (Luxembourg)"],["fr","French (Standard)"],["fr_ch","French (Switzerland)"],["gd","Gaelic (Scotland)"],["de_at","German (Austria)"],["de_li","German (Liechtenstein)"],["de_lu","German (Luxembourg)"],["de","German (Standard)"],["de_ch","German (Switzerland)"],["el","Greek"],["he","Hebrew"],["hi","Hindi"],["hu","Hungarian"],["is","Icelandic"],["id","Indonesian"],["ga","Irish"],["it","Italian (Standard)"],["it_ch","Italian (Switzerland)"],["ja","Japanese"],["ko","Korean"],["ku","Kurdish"],["lv","Latvian"],["lt","Lithuanian"],["mk","Macedonian (FYROM)"],["ml","Malayalam"],["ms","Malaysian"],["mt","Maltese"],["no","Norwegian"],["nb","Norwegian (Bokmål)"],["nn","Norwegian (Nynorsk)"],["pl","Polish"],["pt_br","Portuguese (Brazil)"],["pt","Portuguese (Portugal)"],["pa","Punjabi"],["rm","Rhaeto-Romanic"],["ro","Romanian"],["ro_md","Romanian (Republic of Moldova)"],["ru","Russian"],["ru_md","Russian (Republic of Moldova)"],["sr","Serbian"],["sk","Slovak"],["sl","Slovenian"],["sb","Sorbian"],["es_ar","Spanish (Argentina)"],["es_bo","Spanish (Bolivia)"],["es_cl","Spanish (Chile)"],["es_co","Spanish (Colombia)"],["es_cr","Spanish (Costa Rica)"],["es_do","Spanish (Dominican Republic)"],["es_ec","Spanish (Ecuador)"],["es_sv","Spanish (El Salvador)"],["es_gt","Spanish (Guatemala)"],["es_hn","Spanish (Honduras)"],["es_mx","Spanish (Mexico)"],["es","Spanish (Spain)"],["sv","Swedish"],["sv_fi","Swedish (Finland)"],["th","Thai"],["tr","Turkish"],["uk","Ukrainian"],["ur","Urdu"],["vi","Vietnamese"],["cy","Welsh"],["ji","Yiddish"],["zu","Zulu"]]),Ws=Array.from(Bt.entries()).map(([t,s])=>({value:t,label:s})),Te=p.z.enum(["af","sq","ar_dz","ar_bh","ar_eg","ar_iq","ar_jo","ar_kw","ar_lb","ar_ly","ar_ma","ar_om","ar_qa","ar_sa","ar_sy","ar_tn","ar_ae","ar_ye","eu","be","bg","ca","zh_hk","zh_cn","zh_sg","zh_tw","hr","cs","da","nl_be","nl","en","en_au","en_bz","en_ca","en_ie","en_jm","en_nz","en_za","en_tt","en_gb","en_us","et","fo","fa","fi","fr_be","fr_ca","fr_lu","fr","fr_ch","gd","de_at","de_li","de_lu","de","de_ch","el","he","hi","hu","is","id","ga","it","it_ch","ja","ko","ku","lv","lt","mk","ml","ms","mt","no","nb","nn","pl","pt_br","pt","pa","rm","ro","ro_md","ru","ru_md","sr","sk","sl","sb","es_ar","es_bo","es_cl","es_co","es_cr","es_do","es_ec","es_sv","es_gt","es_hn","es_mx","es","sv","sv_fi","th","tr","uk","ur","vi","cy","ji","zu"]).openapi({description:"Enum for locale values",example:"en"}),ka=p.z.union([p.z.string(),p.z.number(),p.z.null()]).optional().transform(t=>{if(t==null||t==="")return null;if(typeof t=="number")return t;const s=Number(t);return isNaN(s)?t:s}).pipe(p.z.number().nonnegative({message:"This field must be a positive number"}).nullable().refine(t=>t===null||t>=0,{message:"Price must be positive"})),Qt=p.z.coerce.number().min(.1,"This field must be positive").refine(t=>/^\d+(\.\d{1,2})?$/.test(t.toString()),{message:"This field can have a maximum of two decimal points"}),Xi=p.z.object({type:p.z.literal("blob.generate-client-token"),payload:p.z.object({pathname:p.z.string(),callbackUrl:p.z.string(),multipart:p.z.boolean(),clientPayload:p.z.string().nullable()})}),Yi=p.z.object({type:p.z.literal("blob.upload-completed"),payload:p.z.object({blob:p.z.any(),tokenPayload:p.z.string().nullable().optional()})});p.z.discriminatedUnion("type",[Xi,Yi]);p.z.discriminatedUnion("type",[p.z.object({type:p.z.literal("blob.generate-client-token"),clientToken:p.z.string()}),p.z.object({type:p.z.literal("blob.upload-completed"),response:p.z.literal("ok")})]);p.z.object({mimeType:p.z.string().min(1,"MIME type is required").openapi({example:"image/png",description:"MIME type of the file"}),size:p.z.number().min(1,"Size is required").openapi({example:1024,description:"Size of the file in bytes"}),filename:p.z.string().min(1,"Filename is required").openapi({example:"example.png",description:"Name of the file"}),organizationId:p.z.string().optional().openapi({example:"clm1234567890abcdef",description:"ID of the organization"})});const Ie=p.z.object({id:p.z.string().min(1,"ID is required").openapi({example:"clf9876543210abcdef",description:"ID of the file"}),url:p.z.string().min(1,"Path is required").openapi({example:"/path/to/file",description:"Path of the file"}),mimeType:p.z.string().min(1,"MIME type is required").openapi({example:"image/png",description:"MIME type of the file"}),size:p.z.number().min(1,"Size is required").openapi({example:1024,description:"Size of the file in bytes"}),filename:p.z.string().min(1,"Filename is required").openapi({example:"example.png",description:"Name of the file"})}).openapi("UploadedFile"),Jt=p.z.object({id:p.z.string().openapi({example:"clf9876543210abcdef",description:"ID of the product category"}),slug:p.z.string().openapi({example:"electronics",description:"Slug of the product category"}),image:Ie.nullable().optional().openapi({description:"Image of the product category"}),createdAt:p.z.date(),publishedAt:p.z.date().nullable().optional().openapi({description:"Timestamp when the product category was published"}),translations:p.z.array(p.z.object({locale:p.z.string().min(1,"Locale is required").openapi({example:"en-US",description:"Locale code for the translation"}),title:p.z.string().default("").openapi({example:"Electronics",description:"Name of the product category in the specified locale"}),description:p.z.string().max(6e3,"Maximum character limit is 6000").nullable().default("").optional().openapi({example:"A category for electronic devices.",description:"Description of the product category in the specified locale"})})).openapi({description:"List of translations for the product category"})}).openapi("ProductCategory");Jt.omit({translations:!0}).extend({title:p.z.string().default(""),description:p.z.string().default("")}).openapi("LocalizedProductCategory");const en=Jt.pick({slug:!0,image:!0,translations:!0}).extend({defaultLocale:p.z.string().min(1,"Default locale is required").openapi({description:"The default locale for the product category"}),imageId:p.z.string().cuid().optional().openapi({description:"ID of the image for the product category"})}).superRefine($e("title")).openapi("CreateProductCategory"),tn=Jt.pick({slug:!0,image:!0,translations:!0}).extend({defaultLocale:p.z.string().min(1,"Default locale is required").openapi({description:"The default locale for the product category"}),imageId:p.z.string().cuid().optional().nullable().openapi({description:"ID of the image for the product category"})}).partial().superRefine($e("title")).openapi("UpdateProductCategory"),ja=p.z.object({id:p.z.string().cuid().optional(),title:p.z.string().min(1,"This field is required").openapi({example:"Large",description:"Title of the modifier"}),sku:p.z.coerce.string().optional().openapi({example:"csd9876543210abcdef",description:"Stock Keeping Unit identifier"}),price:p.z.coerce.number().optional().default(0).openapi({example:2.5,description:"Price of the modifier"})}).openapi("Modifier"),Aa=p.z.object({id:p.z.string().cuid(),selectMin:p.z.coerce.number().min(0).openapi({example:1,description:"Minimum number of modifiers that can be selected"}),selectMax:p.z.coerce.number().min(0).openapi({example:1,description:"Maximum number of modifiers that can be selected"}),defaultLocale:Te.optional(),modifiers:p.z.array(ja).optional().openapi({}),translations:p.z.array(p.z.object({locale:Te,title:p.z.string().optional().openapi({example:"Size",description:"Title of the modifier group"})}))}).openapi("ModifierGroup"),sn=Aa.extend({title:p.z.string().default("").nullable()}).omit({translations:!0}).openapi("LocalizedModifierGroup"),va=p.z.object({selectMin:p.z.coerce.number().min(0).openapi({example:1,description:"Minimum number of modifiers that can be selected"}),selectMax:p.z.coerce.number().min(0).openapi({example:1,description:"Maximum number of modifiers that can be selected"}),defaultLocale:Te.optional(),modifiers:p.z.array(ja).optional().openapi({}),translations:p.z.array(p.z.object({locale:Te,title:p.z.string().optional().openapi({example:"Size",description:"Title of the modifier group"})}))}).refine(t=>t.selectMax>=t.selectMin,{message:"Maximum selections must be greater than or equal to minimum selections",path:["selectMax"]}).refine(t=>{var a;const s=((a=t.modifiers)==null?void 0:a.length)||0;return t.selectMax<=s},{message:"Maximum selections cannot exceed the total number of modifiers",path:["selectMax"]}).superRefine($e("title")).openapi("ModifierGroup"),Na=p.z.object({id:p.z.string().cuid().openapi({example:"clf9876543210abcdef",description:"ID of the product"}),slug:p.z.string().optional().openapi({example:"premium-watch",description:"Unique slug for the product"}),sku:p.z.string().optional().openapi({example:"PRM-WATCH-01",description:"Stock Keeping Unit identifier"}),basePrice:Qt,discountedBasePrice:ka,currency:p.z.string().openapi({example:"USD",description:"Currency code for pricing"}),images:p.z.array(Ie).optional().openapi({description:"List of product images"}),modifierGroups:p.z.array(Aa).optional().openapi({description:"List of product modifier groups"}),categories:p.z.array(Jt).openapi({example:["cju0z9k4z0000l1qg5z1z1z"],description:"IDs of associated product categories"}),manufacturerId:p.z.string().cuid().nullable().optional().openapi({description:"ID of associated manufacturer"}),createdAt:p.z.date(),publishedAt:p.z.date().nullable().optional(),translations:p.z.array(p.z.object({locale:Te,title:p.z.coerce.string().optional().openapi({example:"Premium Watch",description:"Product name in specified locale"}),description:p.z.string().nullable().optional().openapi({example:"High-quality premium watch",description:"Product description in specified locale"})})).optional(),metadata:p.z.record(p.z.string().min(1,"Key cannot be empty").max(50,"Key too long").regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/,"Key must start with letter and contain only letters, numbers, underscore, or dash"),p.z.string().min(1,"Value cannot be empty").max(200,"Value too long")).optional().nullable()}).openapi("Product"),an=Na.extend({title:p.z.string().default(""),description:p.z.string().nullable().default(""),modifierGroups:p.z.array(sn),categories:p.z.array(p.z.object({id:p.z.string().cuid().openapi({example:"cju0z9k4z0000l1qg5z1z1z",description:"ID of the product category"})})).default([])}).omit({translations:!0}).openapi("LocalizedProduct"),Ra=Na.pick({slug:!0,sku:!0,basePrice:!0,discountedBasePrice:!0,currency:!0,images:!0,manufacturerId:!0,translations:!0,metadata:!0}).extend({defaultLocale:p.z.string().min(1,"Default locale is required").openapi({example:"en-US",description:"Default translation locale"}),modifierGroups:p.z.array(va).optional().openapi({description:"List of product modifier groups"}),categories:p.z.array(p.z.string()).optional().openapi({example:["cju0z9k4z0000l1qg5z1z1z"],description:"IDs of associated product categories"})}),rn=Ra.superRefine((t,s)=>(t.discountedBasePrice!==null&&t.discountedBasePrice!==void 0&&t.discountedBasePrice>t.basePrice&&s.addIssue({code:p.z.ZodIssueCode.custom,path:["discountedBasePrice"],message:"Discounted price cannot exceed base price"}),$e("title")(t,s))).openapi("CreateProduct"),nn=Ra.partial().superRefine((t,s)=>(t.discountedBasePrice!==null&&t.discountedBasePrice!==void 0&&t.basePrice&&t.discountedBasePrice>t.basePrice&&s.addIssue({code:p.z.ZodIssueCode.custom,path:["discountedBasePrice"],message:"Discounted price cannot exceed base price"}),$e("title")(t,s))).openapi("UpdateProduct");p.z.record(p.z.string().openapi({example:"clf9876543210abcdef",description:"ID of the product in the cart"}),an);const Ca=p.z.object({productId:p.z.string().cuid().openapi({example:"clf9876543210abcdef",description:"ID of the product in the cart"}),quantity:p.z.number().default(1).optional().openapi({example:2,description:"Quantity of this item in the cart"}),modifierGroups:p.z.array(p.z.object({id:p.z.string().cuid().openapi({example:"clg1234567890abcdef",description:"ID of the modifier group"}),modifiers:p.z.array(p.z.object({id:p.z.string().cuid().openapi({example:"clh9876543210abcdef",description:"ID of the selected modifier"}),quantity:p.z.number().default(1).openapi({example:1,description:"Quantity of this modifier"})}))}))}).openapi("CartItem"),on=p.z.object({items:p.z.array(Ca),shippingMethodId:p.z.string().cuid().optional()});p.z.object({status:p.z.number().openapi({example:404,description:"The HTTP status code"}),message:p.z.string().openapi({example:"Not found",description:"The error message"})});p.z.object({"accept-language":p.z.string().optional().openapi({example:"en-US",description:"Accept-Language header",param:{in:"header",name:"accept-language"}}),cookie:p.z.string().optional().openapi({example:"session=1234567890",description:"Cookie header",param:{in:"header",name:"cookie"}})}).openapi("Headers");p.z.object({id:p.z.string().openapi({example:"clm1234567890abcdef",description:"User's ID"}),email:p.z.string().openapi({example:"user@example.com",description:"User's email address",format:"email"}),firstname:p.z.string().openapi({example:"John",description:"User's first name"}),lastname:p.z.string().openapi({example:"Doe",description:"User's last name"}),image:p.z.string().nullable().optional().openapi({example:"https://example.com/image.jpg",description:"User's profile image"}),name:p.z.string().nullable().optional().openapi({description:"User's full name (optional)"})}).openapi("User");p.z.object({page:p.z.coerce.number().optional().default(1).openapi({example:1,description:"Page number"}),limit:p.z.coerce.number().optional().default(10).openapi({example:50,description:"Number of items per page"}),search:p.z.string().optional().openapi({example:"Apple",description:"Search query"}),published:p.z.coerce.boolean().optional().openapi({example:!0,description:"Whether to filter by published items"}),locale:Te.optional()});p.z.object({isFirstPage:p.z.boolean().openapi({example:!0,description:"Whether the current page is the first page"}),isLastPage:p.z.boolean().openapi({example:!1,description:"Whether the current page is the last page"}),currentPage:p.z.number().openapi({example:1,description:"The current page number"}),previousPage:p.z.number().nullable().openapi({example:0,description:"The previous page number"}),nextPage:p.z.number().nullable().openapi({example:2,description:"The next page number"}),pageCount:p.z.number().openapi({example:5,description:"The total number of pages"}),totalCount:p.z.number().openapi({example:50,description:"The total number of items"})}).openapi("PaginationMeta");const _e=p.z.object({id:p.z.string().cuid().openapi({example:"clf9876543210abcdef",description:"The unique identifier of the address"}),firstname:p.z.string().optional().nullable().openapi({example:"John",description:"The first name of the recipient"}),lastname:p.z.string().optional().nullable().openapi({example:"Doe",description:"The last name of the recipient"}),phone:p.z.string().optional().nullable().openapi({example:"+1234567890",description:"Phone number of the recipient"}),addressLineOne:p.z.string().openapi({example:"123 Main Street",description:"The first line of the address"}),doorNumber:p.z.string().nullable().optional().openapi({description:"The door number of the address"}),addressLineTwo:p.z.string().nullable().optional().openapi({example:"Suite 100",description:"The second line of the address"}),zipCode:p.z.string().optional().openapi({example:"12345",description:"The postal code of the address"}),city:p.z.string().openapi({example:"New York",description:"The city of the address"}),country:p.z.string().openapi({example:"USA",description:"The country of the address"}),placeId:p.z.string().openapi({example:"ChIJN1t_tKlj4AR4GeTYWZ7frY",description:"The Google Place ID for the address"}),deliveryInstructions:p.z.string().nullable().optional().openapi({example:"Leave at the door",description:"Delivery instructions for the address"})}).openapi("Address"),Ot=_e.pick({addressLineOne:!0,doorNumber:!0,addressLineTwo:!0,zipCode:!0,city:!0,country:!0,placeId:!0}).openapi("CreateAddress"),Pa=Ot.partial().openapi("UpdateAddress"),ln=_e.extend({firstname:p.z.string().min(2,"First Name must be at least 2 characters").openapi({example:"John",description:"The first name of the recipient"}),lastname:p.z.string().min(1,"Last Name must be at least 2 characters").openapi({example:"Doe",description:"The last name of the recipient"}),phone:p.z.string().min(4).openapi({example:"+1234567890",description:"Phone number of the recepient"})}),Ta=ln.pick({firstname:!0,lastname:!0,phone:!0,addressLineOne:!0,addressLineTwo:!0,doorNumber:!0,zipCode:!0,city:!0,country:!0,placeId:!0,deliveryInstructions:!0});Ta.partial().extend({placeId:p.z.string().min(1,"This field is required").openapi({example:"ChIJN1t_tKlj4AR4GeTYWZ7frY",description:"The Google Place ID for the address"})}).openapi("UpdateShippingAddress");const dn=[{value:"USD",label:"United States Dollar"},{value:"EUR",label:"Euro"},{value:"GBP",label:"British Pound Sterling"},{value:"JPY",label:"Japanese Yen"},{value:"AUD",label:"Australian Dollar"},{value:"CAD",label:"Canadian Dollar"},{value:"CHF",label:"Swiss Franc"},{value:"CNY",label:"Chinese Yuan"},{value:"SEK",label:"Swedish Krona"},{value:"NZD",label:"New Zealand Dollar"},{value:"MXN",label:"Mexican Peso"},{value:"SGD",label:"Singapore Dollar"},{value:"HKD",label:"Hong Kong Dollar"},{value:"NOK",label:"Norwegian Krone"},{value:"KRW",label:"South Korean Won"},{value:"TRY",label:"Turkish Lira"},{value:"RUB",label:"Russian Ruble"},{value:"INR",label:"Indian Rupee"},{value:"BRL",label:"Brazilian Real"},{value:"ZAR",label:"South African Rand"},{value:"DKK",label:"Danish Krone"},{value:"PLN",label:"Polish Złoty"},{value:"THB",label:"Thai Baht"},{value:"IDR",label:"Indonesian Rupiah"},{value:"HUF",label:"Hungarian Forint"},{value:"CZK",label:"Czech Koruna"},{value:"ILS",label:"Israeli New Shekel"},{value:"PHP",label:"Philippine Peso"},{value:"AED",label:"United Arab Emirates Dirham"},{value:"COP",label:"Colombian Peso"},{value:"SAR",label:"Saudi Riyal"},{value:"MYR",label:"Malaysian Ringgit"},{value:"RON",label:"Romanian Leu"}],fs=p.z.enum(["USD","EUR","GBP","JPY","AUD","CAD","CHF","CNY","SEK","NZD","MXN","SGD","HKD","NOK","KRW","TRY","RUB","INR","BRL","ZAR","DKK","PLN","THB","IDR","HUF","CZK","ILS","PHP","AED","COP","SAR","MYR","RON"]).openapi({description:"The currency code for the transaction."}),ys=p.z.enum(["card","blik","cash_on_delivery","paypal"]).openapi({description:"The payment method",example:"card"}),ws=p.z.enum(["stripe","revolut","payu","not_applicable"]).openapi({description:"The payment method",example:"card"}),cn=p.z.enum(["pending","succeeded","refunded","failed","canceled"]).openapi({description:"The payment status",example:"pending"});p.z.object({id:p.z.string().min(1),provider:ws,method:ys,description:p.z.string().min(1)}).openapi({description:"The payment method",example:{provider:"stripe",type:"card"}});const un=p.z.object({id:p.z.string().cuid().min(1),method:ys,provider:ws,status:cn,shipping:p.z.number().min(0).default(0),subtotal:p.z.number().min(0),total:p.z.number().min(0),discount:p.z.number().min(0).default(0),currency:fs}),qs=p.z.object({id:p.z.string().optional().openapi({example:"clf9876543210abcdef",description:"ID of the shipping zone"}),title:p.z.string().min(1,"Title is required").openapi({example:"Zone 1",description:"Title of the shipping zone"}),distanceUpto:Qt.openapi({example:10,description:"Ending distance for the shipping zone"}),price:Qt.openapi({example:5.99,description:"Price for shipping in this zone"}),minimumOrderAmount:ka.openapi({example:50,description:"Minimum order amount for this shipping zone"}),eta:p.z.string().min(1,"ETA is required").openapi({example:"2-3 days",description:"Estimated time of arrival for this shipping zone"})}).openapi("ShippingZone"),Qa=p.z.object({id:p.z.string().openapi({example:"clf9876543210abcdef",description:"ID of the shipping method"}),title:p.z.string().min(1,"Title is required").openapi({example:"Standard Shipping",description:"Title of the shipping method"}),providerName:p.z.string().min(1,"Provider name is required").openapi({example:"FedEx",description:"Name of the shipping provider"}),providerLogo:Ie.nullable().optional().openapi({description:"Logo of the shipping provider"}),requireDateOfDelivery:p.z.coerce.boolean().optional().openapi({example:!0,description:"Whether the delivery time should be selected"}),shippingZones:p.z.array(qs).openapi({description:"List of shipping zones for this shipping method"}),eligibleShippingZone:qs.optional(),createdAt:p.z.date(),updatedAt:p.z.date()}).openapi("ShippingMethod"),za=Qa.pick({title:!0,providerName:!0,providerLogo:!0,requireDateOfDelivery:!0,shippingZones:!0}).extend({providerLogoId:p.z.string().cuid().optional().openapi({example:"clf9876543210abcdef",description:"ID reference to the provider logo file"})}).openapi("CreateShippingMethod"),pn=za.partial().openapi("UpdateShippingMethod"),Ia=p.z.enum(["delivery","pickup"]),mn=p.z.enum(["draft","pending","accepted","ready-for-dispatch","dispatched","completed","cancelled"]).openapi({description:"Status of the order",example:"accepted"}),gn=p.z.object({translations:p.z.array(p.z.object({locale:Te.openapi({description:"Locale of the translation",example:"en-US"}),title:p.z.string().openapi({description:"Title of the ordered product",example:"Premium Watch"}),subtitle:p.z.string().openapi({description:"Additional details about the ordered item, including modifiers",example:"Color: Silver, Size: Large"})})).openapi({description:"Translations for the order item"}),rawData:Ca,unitPrice:p.z.number().min(0).openapi({description:"Price per unit of the item",example:299.99}),image:Ie.nullable().optional(),totalPrice:p.z.number().min(0).openapi({description:"Total price for this item (unitPrice × quantity)",example:599.98}),quantity:p.z.number().min(1).openapi({description:"Number of units ordered",example:2}),productSnapshotId:p.z.string().cuid()}).openapi("OrderItem");p.z.object({id:p.z.string().openapi({description:"Unique identifier for the order",example:"clj1234567890abcdef"}),referenceId:p.z.string().openapi({description:"External reference ID for the order",example:"ORD-12345"}),status:mn.optional(),token:p.z.string().openapi({description:"Security token for order verification",example:"a1b2c3d4e5f6g7h8i9j0"}),expiresAt:p.z.date().openapi({description:"Expiration date for the order",example:"2023-12-31T23:59:59Z"}),items:p.z.array(gn).min(1).openapi({description:"Array of items in the order"}),shippingMethod:Qa.nullable().openapi({description:"Shipping method selected for the order"}),acceptedAt:p.z.date().nullable().optional().openapi({description:"Date when the order was accepted",example:"2023-06-15T14:30:00Z"}),dispatchedAt:p.z.date().nullable().optional().openapi({description:"Date when the order was dispatched",example:"2023-06-16T09:15:00Z"}),readyForDispatchAt:p.z.date().nullable().optional().openapi({description:"Date when the order was ready for dispatch",example:"2023-06-16T09:15:00Z"}),createdAt:p.z.date().openapi({description:"Date when the order was created",example:"2023-06-15T14:30:00Z"}),completedAt:p.z.date().nullable().optional().openapi({description:"Date when the order was completed",example:"2023-06-18T11:45:00Z"}),cancelledAt:p.z.date().nullable().optional().openapi({description:"Date when the order was cancelled",example:"2023-06-14T16:20:00Z"}),shippingAddress:_e.nullable().optional(),fulfilmentMethod:Ia.openapi({description:"Method of order fulfilment (pickup or delivery)",example:"delivery"}),currency:fs.openapi({description:"Currency used for the order",example:"USD"}),payment:un}).transform(t=>{let s;return t.cancelledAt?s="cancelled":t.completedAt?s="completed":t.dispatchedAt?s="dispatched":t.readyForDispatchAt?s="ready-for-dispatch":t.acceptedAt?s="accepted":s="pending",{...t,status:s}}).openapi("Order");on.extend({fulfilmentMethod:Ia.default("delivery"),payment:p.z.object({provider:ws,method:ys}),checkoutBaseUrl:p.z.string().url()}).refine(t=>t.fulfilmentMethod!=="delivery"||t.shippingMethodId!==void 0,{message:"shippingMethodId is required when fulfilmentMethod is 'delivery'",path:["shippingMethodId"]}).openapi("CreateOrder");const $s=p.z.object({monday:p.z.string().nullable().openapi({example:"09:00",description:"Opening time for Monday"}),tuesday:p.z.string().nullable().openapi({example:"09:00",description:"Opening time for Tuesday"}),wednesday:p.z.string().nullable().openapi({example:"09:00",description:"Opening time for Wednesday"}),thursday:p.z.string().nullable().openapi({example:"09:00",description:"Opening time for Thursday"}),friday:p.z.string().nullable().openapi({example:"09:00",description:"Opening time for Friday"}),saturday:p.z.string().nullable().openapi({example:"09:00",description:"Opening time for Saturday"}),sunday:p.z.string().nullable().openapi({example:"09:00",description:"Opening time for Sunday"})}).openapi("TimeSchedule"),La=p.z.object({id:p.z.string().openapi({example:"clm1234567890abcdef",description:"Unique identifier for the organization configuration"}),hostname:p.z.coerce.string().optional().openapi({example:"store.example.com",description:"Hostname associated with the organization"}),countriesShipping:p.z.array(p.z.string()).openapi({example:["US","CA"],description:"List of countries where shipping is available"}),stripeAccountId:p.z.coerce.string().optional().openapi({example:"acct_123456789",description:"Stripe account ID associated with the organization"}),enableHostCheckout:p.z.boolean().openapi({example:!0,description:"Indicates if host checkout is enabled"}),enableHostTracking:p.z.boolean().openapi({example:!0,description:"Indicates if host tracking is enabled"}),isAcceptingOrders:p.z.boolean().openapi({example:!0,description:"Indicates if the organization is currently accepting orders"}),isOpen:p.z.boolean().default(!1).openapi({example:!0,description:"Indicates if the organization is currently open"}),defaultLocale:Te,supportedLocales:p.z.array(Te).openapi({description:"List of supported locales for the organization"}),openingTimes:$s.optional(),closingTimes:$s.optional(),facebookProfile:p.z.string().nullable().optional().openapi({example:"https://www.facebook.com/example",description:"Facebook profile URL for the organization"}),instagramProfile:p.z.string().nullable().optional().openapi({example:"https://www.instagram.com/example",description:"Instagram profile URL for the organization"}),xProfile:p.z.string().nullable().optional().openapi({example:"https://www.x.com/example",description:"X profile URL for the organization"}),defaultCurrency:fs.openapi({example:"USD",description:"Default currency for the organization"}),createdAt:p.z.date().openapi({description:"Timestamp when the organization configuration was created"})}).openapi("OrganizationConfiguration"),hn=La.pick({hostname:!0,countriesShipping:!0,stripeAccountId:!0,enableHostCheckout:!0,enableHostTracking:!0,isAcceptingOrders:!0,defaultLocale:!0,supportedLocales:!0,defaultCurrency:!0,openingTimes:!0,closingTimes:!0,facebookProfile:!0,instagramProfile:!0,xProfile:!0}).partial().openapi("UpdateOrganizationConfiguration"),xn=p.z.object({id:p.z.string().openapi({example:"clm1234567890abcdef",description:"The unique identifier of the organization"}),name:p.z.string().openapi({example:"Acme Store",description:"The name of the organization"}),phone:p.z.string().min(1,"Phone number is required").openapi({example:"+48123456890",description:"The phone number of the organization"}),email:p.z.string().email().optional().openapi({example:"john.doe@example.com",description:"The email address of the organization"}),createdAt:p.z.date().openapi({example:"2022-01-01T00:00:00.000Z",description:"The date and time the organization was created"}),legalEntityId:p.z.string().nullable().openapi({example:"clm1234567890abcdef",description:"The unique identifier of the legal entity associated with the organization"}),address:_e,configuration:La.openapi({description:"The configuration settings for the organization"}),logo:p.z.string().url().optional().nullable().openapi({example:"https://example.com/logo.jpg",description:"The logo of the organization"}),logoFile:Ie.optional().nullable().openapi({description:"The logo of the organization"})}).openapi("Organization"),Ea=xn.pick({name:!0,phone:!0,email:!0,logoFile:!0}).extend({logoId:p.z.string().optional().nullable().openapi({example:"clm1234567890abcdef",description:"The unique identifier of the thumbnail image associated with the organization"}),address:Ot}).openapi("CreateOrganization"),bs=Ea.extend({address:Pa,configuration:hn}).partial().openapi("UpdateOrganization"),fn=p.z.object({id:p.z.string().openapi({example:"clf9876543210abcdef",description:"ID of the manufacturer"}),name:p.z.string().openapi({example:"Tech Innovators Inc.",description:"Name of the manufacturer"}),logo:Ie.nullable().optional().openapi({description:"Logo of the manufacturer"}),createdAt:p.z.date(),translations:p.z.array(p.z.object({locale:p.z.string().min(1,"Locale is required").openapi({example:"en-US",description:"Locale code for the translation"}),about:p.z.string().max(6e3,"Maximum character limit is 6000").nullable().optional().openapi({example:"Tech Innovators Inc. is a technology company.",description:"Description about the manufacturer in the specified locale"})})).optional().openapi({description:"List of translations for the manufacturer"})}).openapi("Manufacturer");fn.omit({translations:!0}).extend({about:p.z.string().nullable().optional().default("")}).openapi("LocalizedManufacturer");const yn=p.z.object({name:p.z.string().min(1,"Name is required").openapi({example:"Apple Inc.",description:"Name of the manufacturer"}),defaultLocale:p.z.string().min(1,"Default locale is required").openapi({example:"en-US",description:"The default locale for the manufacturer"}),logo:Ie.nullable().optional().openapi({description:"Logo of the manufacturer"}),translations:p.z.array(p.z.object({locale:p.z.string().min(1,"Locale is required").openapi({example:"en-US",description:"Locale code for the translation"}),about:p.z.string().max(6e3,"Maximum character limit is 6000").nullable().optional().openapi({example:"Apple Inc. is a multinational technology company.",description:"Description about the manufacturer in the specified locale"})})).min(1,"Translations are required").openapi({description:"List of translations for the manufacturer"}),logoId:p.z.string().optional().openapi({example:"clf9876543210abcdef",description:"ID reference to the manufacturer's logo file"})}).superRefine($e("about")).openapi("CreateManufacturer"),wn=p.z.object({name:p.z.string().min(1,"Name is required").optional().openapi({example:"Apple Inc. Updated",description:"Name of the manufacturer"}),logo:Ie.nullable().optional().openapi({description:"Logo of the manufacturer"}),defaultLocale:p.z.string().min(1,"Default locale is required").openapi({description:"The default locale for the manufacturer"}),logoId:p.z.string().nullable().optional().openapi({example:"clf9876543210abcdef",description:"ID reference to the manufacturer's logo file"}),translations:p.z.array(p.z.object({locale:p.z.string().min(1,"Locale is required").openapi({example:"en-US",description:"Locale code for the translation"}),about:p.z.string().max(6e3,"Maximum character limit is 6000").nullable().optional().openapi({example:"Apple Inc. is a multinational technology company.",description:"Description about the manufacturer in the specified locale"})})).optional().openapi({description:"List of translations for the manufacturer"})}).openapi("UpdateManufacturer");p.z.object({id:p.z.string().openapi({example:"clm1234567890abcdef",description:"The unique identifier of the legal entity"}),name:p.z.string().openapi({example:"Acme Corporation",description:"The name of the legal entity"}),taxId:p.z.string().min(2).max(20).openapi({example:"PL1234567890",description:"The TAX ID of the legal entity"}),email:p.z.string().email().nullable().openapi({example:"contact@acme.com",description:"The email of the legal entity",format:"email"}),phone:p.z.string().nullable().openapi({example:"+48123456789",description:"The phone number of the legal entity"}),createdAt:p.z.date().openapi({description:"The date and time when the legal entity was created",format:"date-time"}),address:_e.required().openapi({description:"The address of the legal entity"})}).openapi("LegalEntity");p.z.object({name:p.z.string().min(1,"Name is required").openapi({example:"Acme Corporation",description:"The name of the legal entity"}),taxId:p.z.string().min(2).max(20).openapi({example:"PL1234567890",description:"The TAX ID of the legal entity"}),email:p.z.string().email().optional().openapi({example:"contact@acme.com",description:"The email of the legal entity",format:"email"}),phone:p.z.string().optional().openapi({example:"+48123456789",description:"The phone number of the legal entity"}),address:Ot.required().openapi({description:"The address of the legal entity"})}).openapi("CreateLegalEntity");p.z.object({name:p.z.string().min(1,"Name is required").optional().openapi({example:"Acme Corporation",description:"The name of the legal entity"}),taxId:p.z.string().min(2).max(20).openapi({example:"PL1234567890",description:"The TAX ID of the legal entity"}),email:p.z.string().email().optional().openapi({example:"contact@acme.com",description:"The email of the legal entity",format:"email"}),phone:p.z.string().optional().openapi({example:"+48123456789",description:"The phone number of the legal entity"}),address:Pa.required().openapi({description:"The address of the legal entity"})}).openapi("UpdateLegalEntity");const bn=p.z.object({id:p.z.string().openapi({example:"clf9876543210abcdef",description:"ID of the customer"}),firstname:p.z.string().nullable().optional().openapi({example:"John Doe",description:"Name of the customer"}),email:p.z.string().nullable().optional().openapi({example:"john.doe@example.com",description:"Email of the customer"}),phone:p.z.string().nullable().optional().openapi({example:"+1234567890",description:"Phone number of the customer"}),address:_e.nullable().optional().openapi({description:"Address of the customer"}),createdAt:p.z.date(),updatedAt:p.z.date()}).openapi("Customer"),Sn=bn.pick({firstname:!0,email:!0,phone:!0}).extend({address:Ot}).openapi("Customer");Sn.partial().openapi("UpdateCustomer");const Ss=p.z.object({email:p.z.string().min(1,"Email is required").email("Invalid email").openapi({example:"user@example.com",description:"User's email address"}),password:p.z.string().min(1,"Password is required").min(8,"Password must be more than 8 characters").max(32,"Password must be less than 32 characters").openapi({example:"password123",description:"User's password"}),firstname:p.z.string().min(1,"First name is required").max(32,"First name must be less than 32 characters").openapi({example:"John",description:"User's first name"}),lastname:p.z.string().min(1,"Last name is required").max(32,"Last name must be less than 32 characters").openapi({example:"Doe",description:"User's last name"})}).openapi("SignUp"),Da=Ss.pick({email:!0,password:!0}).openapi("SignIn"),kn=p.z.object({organizationId:p.z.string().cuid().min(1,"organizationId is required").openapi({example:"ckel0e8qw00004n5p5w6fznym",description:"The organization ID"})}).openapi("OrganizationParams");kn.extend({id:p.z.string().cuid().min(1,"id is required").openapi({example:"ckel0e8qw00004n5p5w6fznym",description:"The organization ID"})}).openapi("OrganizationWithIdParams");p.z.object({placeId:p.z.string().openapi({example:"ChIJN1t_tKlj4AR4GeTYWZ7frY",description:"The Google Place ID for the address"}),text:p.z.string().openapi({example:"123 Main Street, New York, USA",description:"The description of the place"}),addressLineOne:p.z.string().openapi({example:"123 Main Street",description:"The first line of the address"}),addressLineTwo:p.z.string().optional().openapi({example:"Suite 100",description:"The second line of the address"}),latitude:p.z.number().optional().openapi({example:40.712776,description:"The latitude of the coordinate"}),longitude:p.z.number().optional().openapi({example:-74.005974,description:"The longitude of the coordinate"})}).openapi("Place");p.z.object({addressLineOne:p.z.string().openapi({example:"123 Main Street",description:"The first line of the address"}),zipCode:p.z.string().optional().openapi({example:"12345",description:"The postal code of the address"}),city:p.z.string().openapi({example:"New York",description:"The city of the address"}),country:p.z.string().openapi({example:"USA",description:"The ISO 3166-1 alpha-2 country code"})}).openapi("PlaceDetails");const jn=p.z.object({id:p.z.string().openapi({description:"Unique identifier for the order",example:"clj1234567890abcdef"}),firstname:p.z.string().openapi({description:"Customer's first name",example:"John"}),lastname:p.z.string().openapi({description:"Customer's last name",example:"Doe"}),guests:Qt,phone:p.z.string().openapi({description:"Customer's phone number",example:"+1234567890"}),date:p.z.coerce.date().openapi({description:"Reservation date and time",example:"2023-06-14T16:20:00Z"}),referenceId:p.z.string().openapi({description:"External reference ID for the order",example:"ORD-12345"}),acceptedAt:p.z.date().nullable().optional().openapi({description:"Date when the order was accepted",example:"2023-06-15T14:30:00Z"}),cancelledAt:p.z.date().nullable().optional().openapi({description:"Date when the order was cancelled",example:"2023-06-14T16:20:00Z"}),createdAt:p.z.date().nullable().optional().openapi({description:"Date when the order was created",example:"2023-06-14T16:20:00Z"})}).openapi("Reservation");jn.pick({firstname:!0,lastname:!0,guests:!0,phone:!0,date:!0}).openapi("CreateReservation");function Oe(...t){return da.twMerge(la(...t))}const Ma=["focus:ring-2","focus:ring-blue-200 dark:focus:ring-blue-700/30","focus:border-blue-500 dark:focus:border-blue-700"],Ge=["outline outline-offset-2 outline-0 focus-visible:outline-2","outline-blue-500 dark:outline-blue-500"],An=["ring-2","border-red-500 dark:border-red-700","ring-red-200 dark:ring-red-700/30"],Ba=Se.tv({base:["relative inline-flex items-center justify-center whitespace-nowrap rounded-lg border px-3 py-2 text-center text-sm font-medium shadow-2xs transition-all duration-100 ease-in-out cursor-pointer","disabled:pointer-events-none disabled:shadow-none disabled:cursor-not-allowed",Ge],variants:{variant:{primary:["border-transparent","text-white dark:text-white","bg-teal-500 dark:bg-teal-500","hover:bg-teal-600 dark:hover:bg-teal-600","disabled:bg-teal-100 disabled:text-gray-400","dark:disabled:bg-teal-800 dark:disabled:text-teal-400"],secondary:["border-gray-200 dark:border-gray-800","text-gray-900 dark:text-gray-50","bg-white dark:bg-gray-950","hover:bg-gray-50 dark:hover:bg-gray-900/60","disabled:text-gray-400","dark:disabled:text-gray-600"],light:["shadow-none","border-transparent","text-gray-900 dark:text-gray-50","bg-gray-200 dark:bg-gray-900","hover:bg-gray-300/70 dark:hover:bg-gray-800/80","disabled:bg-gray-100 disabled:text-gray-400","dark:disabled:bg-gray-800 dark:disabled:text-gray-600"],ghost:["shadow-none","border-transparent","text-gray-900 dark:text-gray-50","bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800/80","disabled:text-gray-400","dark:disabled:text-gray-600"],destructive:["text-white","border-transparent","bg-red-600 dark:bg-red-700","hover:bg-red-700 dark:hover:bg-red-600","disabled:bg-red-300 disabled:text-white","dark:disabled:bg-red-950 dark:disabled:text-red-400"]}},defaultVariants:{variant:"primary"}}),de=h.forwardRef(({asChild:t,isLoading:s=!1,loadingText:a,className:r,disabled:i,variant:n,children:o,...l},d)=>{const c=t?ps.Slot:"button";return e.jsx(c,{ref:d,className:w(Ba({variant:n}),r),disabled:i||s,...l,children:s?e.jsxs("span",{className:"pointer-events-none flex shrink-0 items-center justify-center gap-1.5",children:[e.jsx(C.RiLoader2Fill,{className:"size-4 shrink-0 animate-spin","aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:a||"Loading"}),a||"Loading"]}):o})});de.displayName="Button";const _s=[{continent:"America",items:[{value:"US",label:"United States",flag:"🇺🇸"},{value:"CA",label:"Canada",flag:"🇨🇦"},{value:"MX",label:"Mexico",flag:"🇲🇽"},{value:"BR",label:"Brazil",flag:"🇧🇷"},{value:"AR",label:"Argentina",flag:"🇦🇷"},{value:"CO",label:"Colombia",flag:"🇨🇴"},{value:"CL",label:"Chile",flag:"🇨🇱"},{value:"PE",label:"Peru",flag:"🇵🇪"}]},{continent:"Europe",items:[{value:"GB",label:"United Kingdom",flag:"🇬🇧"},{value:"FR",label:"France",flag:"🇫🇷"},{value:"DE",label:"Germany",flag:"🇩🇪"},{value:"PL",label:"Poland",flag:"🇵🇱"},{value:"IT",label:"Italy",flag:"🇮🇹"},{value:"ES",label:"Spain",flag:"🇪🇸"},{value:"NL",label:"Netherlands",flag:"🇳🇱"},{value:"PT",label:"Portugal",flag:"🇵🇹"},{value:"SE",label:"Sweden",flag:"🇸🇪"},{value:"NO",label:"Norway",flag:"🇳🇴"},{value:"DK",label:"Denmark",flag:"🇩🇰"},{value:"FI",label:"Finland",flag:"🇫🇮"},{value:"CH",label:"Switzerland",flag:"🇨🇭"},{value:"IE",label:"Ireland",flag:"🇮🇪"},{value:"BE",label:"Belgium",flag:"🇧🇪"},{value:"AT",label:"Austria",flag:"🇦🇹"},{value:"GR",label:"Greece",flag:"🇬🇷"}]},{continent:"Asia",items:[{value:"CN",label:"China",flag:"🇨🇳"},{value:"JP",label:"Japan",flag:"🇯🇵"},{value:"IN",label:"India",flag:"🇮🇳"},{value:"KR",label:"South Korea",flag:"🇰🇷"},{value:"SG",label:"Singapore",flag:"🇸🇬"},{value:"MY",label:"Malaysia",flag:"🇲🇾"},{value:"ID",label:"Indonesia",flag:"🇮🇩"},{value:"TH",label:"Thailand",flag:"🇹🇭"},{value:"VN",label:"Vietnam",flag:"🇻🇳"},{value:"AE",label:"United Arab Emirates",flag:"🇦🇪"},{value:"SA",label:"Saudi Arabia",flag:"🇸🇦"}]},{continent:"Oceania",items:[{value:"AU",label:"Australia",flag:"🇦🇺"},{value:"NZ",label:"New Zealand",flag:"🇳🇿"},{value:"FJ",label:"Fiji",flag:"🇫🇯"},{value:"PG",label:"Papua New Guinea",flag:"🇵🇬"}]},{continent:"Africa",items:[{value:"ZA",label:"South Africa",flag:"🇿🇦"},{value:"NG",label:"Nigeria",flag:"🇳🇬"},{value:"MA",label:"Morocco",flag:"🇲🇦"},{value:"EG",label:"Egypt",flag:"🇪🇬"},{value:"KE",label:"Kenya",flag:"🇰🇪"},{value:"GH",label:"Ghana",flag:"🇬🇭"},{value:"ET",label:"Ethiopia",flag:"🇪🇹"}]}],Ft=t=>e.jsx(Z.Root,{...t});Ft.displayName="Dialog";const Ja=Z.Trigger;Ja.displayName="DialogTrigger";const Oa=Z.Close;Oa.displayName="DialogClose";const Fa=Z.Portal;Fa.displayName="DialogPortal";const Va=h.forwardRef(({className:t,...s},a)=>e.jsx(Z.Overlay,{ref:a,className:w("fixed inset-0 z-50 overflow-y-auto","bg-black/70","data-[state=open]:animate-dialogOverlayShow",t),...s}));Va.displayName="DialogOverlay";const Vt=h.forwardRef(({className:t,...s},a)=>e.jsx(Fa,{children:e.jsx(Va,{children:e.jsx(Z.Content,{ref:a,className:w("fixed left-1/2 top-1/2 z-50 w-[95vw] max-w-lg -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-md border p-6 shadow-lg","border-gray-200 dark:border-gray-900","bg-white dark:bg-[#090E1A]","data-[state=open]:animate-dialogContentShow",Ge,t),...s})})}));Vt.displayName="DialogContent";const ks=({className:t,...s})=>e.jsx("div",{className:w("flex flex-col gap-y-1",t),...s});ks.displayName="DialogHeader";const js=h.forwardRef(({className:t,...s},a)=>e.jsx(Z.Title,{ref:a,className:w("text-lg font-semibold","text-gray-900 dark:text-gray-50",t),...s}));js.displayName="DialogTitle";const Ha=h.forwardRef(({className:t,...s},a)=>e.jsx(Z.Description,{ref:a,className:w("text-gray-500 dark:text-gray-500",t),...s}));Ha.displayName="DialogDescription";const Za=({className:t,...s})=>e.jsx("div",{className:w("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});Za.displayName="DialogFooter";const pt=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command,{ref:a,className:w("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...s}));pt.displayName=V.Command.displayName;const vn=({children:t,...s})=>e.jsx(Ft,{...s,children:e.jsx(Vt,{className:"overflow-hidden p-0",children:e.jsx(pt,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:t})})}),Ht=N.forwardRef(({className:t,...s},a)=>e.jsxs("div",{className:"flex items-center border-b pl-3","cmdk-input-wrapper":"",children:[e.jsx(A.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(V.Command.Input,{ref:a,className:w("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...s})]}));Ht.displayName=V.Command.Input.displayName;const Zt=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.List,{ref:a,className:w("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...s}));Zt.displayName=V.Command.List.displayName;const Ut=N.forwardRef((t,s)=>e.jsx(V.Command.Empty,{ref:s,className:"py-6 text-center text-sm",...t}));Ut.displayName=V.Command.Empty.displayName;const Wt=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.Group,{ref:a,className:w("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...s}));Wt.displayName=V.Command.Group.displayName;const Ua=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.Separator,{ref:a,className:w("-mx-1 h-px bg-border",t),...s}));Ua.displayName=V.Command.Separator.displayName;const qt=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.Item,{ref:a,className:w("relative flex cursor-default gap-2 select-none items-center rounded-xs px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...s}));qt.displayName=V.Command.Item.displayName;const Wa=({className:t,...s})=>e.jsx("span",{className:w("ml-auto text-xs tracking-widest text-muted-foreground",t),...s});Wa.displayName="CommandShortcut";const Ke=t=>e.jsx(q.Root,{...t});Ke.displayName="Popover";const Xe=N.forwardRef((t,s)=>e.jsx(q.Trigger,{ref:s,...t}));Xe.displayName="PopoverTrigger";const qa=N.forwardRef((t,s)=>e.jsx(q.Anchor,{ref:s,...t}));qa.displayName="PopoverAnchor";const $a=N.forwardRef((t,s)=>e.jsx(q.Close,{ref:s,...t}));$a.displayName="PopoverClose";const Ye=N.forwardRef(({className:t,sideOffset:s=10,side:a="bottom",align:r="center",collisionPadding:i,...n},o)=>e.jsx(q.Portal,{children:e.jsx(q.Content,{ref:o,sideOffset:s,side:a,align:r,collisionPadding:i,avoidCollisions:!0,className:Oe("max-h-[var(--radix-popper-available-height)] min-w-60 overflow-hidden rounded-md border p-2.5 text-sm shadow-md","border-gray-200 dark:border-gray-800","text-gray-900 dark:text-gray-50","bg-white dark:bg-gray-950","will-change-[transform,opacity]","data-[state=closed]:animate-hide","data-[state=open]:data-[side=bottom]:animate-slideDownAndFade data-[state=open]:data-[side=left]:animate-slideLeftAndFade data-[state=open]:data-[side=right]:animate-slideRightAndFade data-[state=open]:data-[side=top]:animate-slideUpAndFade",t),onWheel:l=>{l.stopPropagation(),l.deltaY>0?l.currentTarget.dispatchEvent(new KeyboardEvent("keydown",{key:"ArrowDown"})):l.currentTarget.dispatchEvent(new KeyboardEvent("keydown",{key:"ArrowUp"}))},...n})}));Ye.displayName="PopoverContent";const _a=({value:t,onChange:s,disabled:a})=>{const r=h.useId(),[i,n]=h.useState(!1),o=_s.map(l=>l.items.find(d=>d.value===t)).filter(Boolean)[0];return e.jsx("div",{className:"mt-2",children:e.jsxs(Ke,{open:a?!1:i,onOpenChange:a?void 0:n,children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(de,{id:r,role:"combobox",disabled:a,"aria-expanded":i,variant:"secondary",className:"w-full justify-between shadow-2xs! bg-background px-3 py-2.5 font-normal outline-offset-0 hover:bg-background focus-visible:border-ring focus-visible:outline-[3px] focus-visible:outline-ring/20 disabled:opacity-50 disabled:cursor-not-allowed",children:[t?e.jsxs("span",{className:"flex min-w-0 items-center gap-2 mr-auto",children:[e.jsx("span",{className:"text-lg leading-none",children:o==null?void 0:o.flag}),e.jsx("span",{className:"truncate",children:o==null?void 0:o.label})]}):e.jsx("span",{className:"text-muted-foreground",children:"Select country"}),e.jsx(A.ChevronDown,{size:16,strokeWidth:2,className:"shrink-0 text-muted-foreground/80","aria-hidden":"true"})]})}),e.jsx(Ye,{className:"w-full min-w-[var(--radix-popper-anchor-width)] border-input -mt-1 z-50",align:"start",children:e.jsxs(pt,{className:"p-0",children:[e.jsx(Ht,{className:"w-full border-none",style:{boxShadow:"none"},placeholder:"Search country..."}),e.jsxs(Zt,{children:[e.jsx(Ut,{children:"No country found."}),_s.map(l=>e.jsx(h.Fragment,{children:e.jsx(Wt,{heading:l.continent,children:l.items.map(d=>e.jsxs(qt,{value:d.label,className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800",onSelect:()=>{s(d.value??""),n(!1)},children:[e.jsx("span",{className:"text-lg leading-none",children:d.flag})," ",d.label,t===d.value&&e.jsx(A.Check,{size:16,strokeWidth:2,className:"ml-auto"})]},d.value))})},l.continent))]})]})})]})})},Nn=Se.tv({base:["relative block w-full rounded-lg border px-2.5 py-2.5 shadow-2xs outline-hidden transition sm:text-sm","border-gray-200 dark:border-gray-800","text-gray-900 dark:text-gray-50","placeholder-gray-400 dark:placeholder-gray-500","bg-white dark:bg-gray-950","disabled:border-gray-300 disabled:bg-gray-100 disabled:text-gray-400","dark:disabled:border-gray-700 dark:disabled:bg-gray-800 dark:disabled:text-gray-500",Ma],variants:{hasError:{true:An},enableStepper:{false:"[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none"},multiline:{true:"resize-y min-h-[100px]",false:"truncate appearance-none"}}}),we=h.forwardRef(({className:t,inputClassName:s,hasError:a,enableStepper:r=!0,type:i,multiline:n=!1,prefix:o,suffix:l,...d},c)=>{const[u,m]=h.useState(i),g=i==="password"&&!n,x=i==="search"&&!n,f=i==="textarea"?"textarea":"input";return e.jsxs("div",{className:w("relative w-full",t),children:[o&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center px-3 text-slate-600 dark:text-gray-600 z-10 text-sm border-r border-gray-200",children:o}),e.jsx(f,{ref:c,type:g?u:i,className:w(Nn({hasError:a,enableStepper:n?!1:r,multiline:n}),{"pl-16":o,"pl-8":!o&&x,"pr-10":l||!l&&g},s),...d}),!o&&x&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2 text-gray-400 dark:text-gray-600",children:e.jsx(C.RiSearchLine,{className:"size-[1.125rem]"})}),l&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2 text-gray-400 dark:text-gray-600",children:l}),!l&&g&&e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx("button",{onClick:()=>m(u==="password"?"text":"password"),className:w(Ge,"text-gray-400 hover:text-gray-500 dark:text-gray-600"),children:u==="password"?e.jsx(C.RiEyeFill,{className:"size-5"}):e.jsx(C.RiEyeOffFill,{className:"size-5"})})})]})});we.displayName="Input";const Ga=({...t})=>{const s=h.useId();return e.jsx("div",{className:"mt-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(we,{id:s,type:"email",inputClassName:"peer ps-9",...t}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 start-0 flex items-center justify-center ps-3 text-muted-foreground/80 peer-disabled:opacity-50",children:e.jsx(A.MailIcon,{size:16})})]})})},Ka=t=>{const{client:s}=L(),[a,r]=h.useState(!1),[i,n]=h.useState(0),o=async u=>{const{body:m,status:g}=await s.file.createTemporaryFile({body:{filename:u.name,mimeType:u.type,size:u.size,organizationId:t.organizationId}});if(g!==201)throw new Error("Failed to create temporary file");const x=await ia.upload(u.name,u,{access:"public",handleUploadUrl:`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/files/token/vercel`,clientPayload:JSON.stringify({fileId:m==null?void 0:m.id}),onUploadProgress(f){n(f.percentage)}});return{id:m.id,filename:u.name,mimeType:u.type,size:u.size,url:x.url}},l=async u=>{var m;if((m=u.target.files)!=null&&m[0]){r(!0);try{const g=await o(u.target.files[0]);if(t.multiple){const x=t.value??[];t.onChange([...x,g])}else t.onChange(g)}catch(g){console.error(g)}finally{r(!1)}}},d=u=>{if(t.multiple){if(!t.value)return t.onChange(void 0);const m=t.value.filter(g=>g.id!==u);t.onChange(m.length?m:void 0)}else t.onChange(void 0)},c=()=>{if(t.value){const u=t.multiple?t.value:[t.value];return e.jsxs("div",{className:"flex",children:[u.map(m=>e.jsx("div",{className:"flex flex-col w-40 h-40 mr-3 transition-all rounded-lg relative animate-fade",children:e.jsxs("div",{className:"relative h-full w-40",children:[e.jsx("button",{className:"absolute w-6 h-6 bg-black flex items-center justify-center rounded-md right-1 top-1",onClick:()=>d(m.id),children:e.jsx(A.XIcon,{className:"w-4 h-4 text-white"})}),e.jsx(xe,{src:m.url,alt:m.filename,width:160,height:160,className:"w-40 h-40 rounded-md object-cover"})]})},m.id)),t.multiple&&e.jsxs("div",{className:"group flex relative flex-col w-40 h-40 items-center justify-center cursor-pointer border-2 border-gray-200 border-dashed transition-all rounded-lg hover:bg-gray-100 hover:border-gray-300",children:[e.jsx("div",{className:"flex flex-col items-center justify-center",children:a?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"animate-spin w-4 h-4 fill-current shrink-0 mb-2",viewBox:"0 0 16 16",children:e.jsx("path",{d:"M8 16a7.928 7.928 0 01-3.428-.77l.857-1.807A6.006 6.006 0 0014 8c0-3.309-2.691-6-6-6a6.006 6.006 0 00-5.422 8.572l-1.806.859A7.929 7.929 0 010 8c0-4.411 3.589-8 8-8s8 3.589 8 8-3.589 8-8 8z"})}),e.jsxs("span",{className:"text-sm",children:["Uploading... (",i,"%)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(A.CloudUpload,{className:"w-12 h-12 text-gray-300 group-hover:text-gray-600 transition-all stroke-1"}),e.jsx("p",{className:"pt-1 text-sm font-medium text-gray-400 group-hover:text-gray-600",children:"Upload an image"})]})}),e.jsx("input",{type:"file",className:"opacity-0 w-full h-full absolute cursor-pointer",onChange:l,accept:"image/png, image/gif, image/jpeg"})]},"upload-placeholder")]})}return e.jsxs("div",{className:"group flex relative flex-col items-center justify-center cursor-pointer w-full h-40 border-2 border-gray-200 border-dashed transition-all rounded-lg hover:bg-gray-100 hover:border-gray-300",children:[e.jsx("div",{className:"flex flex-col items-center justify-center",children:a?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"animate-spin w-4 h-4 fill-current shrink-0 mb-2",viewBox:"0 0 16 16",children:e.jsx("path",{d:"M8 16a7.928 7.928 0 01-3.428-.77l.857-1.807A6.006 6.006 0 0014 8c0-3.309-2.691-6-6-6a6.006 6.006 0 00-5.422 8.572l-1.806.859A7.929 7.929 0 010 8c0-4.411 3.589-8 8-8s8 3.589 8 8-3.589 8-8 8z"})}),e.jsxs("span",{className:"text-sm",children:["Uploading... (",i,"%)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(A.CloudUpload,{className:"w-12 h-12 text-gray-300 group-hover:text-gray-600 transition-all stroke-1"}),e.jsx("p",{className:"pt-1 text-sm font-medium text-gray-400 group-hover:text-gray-600",children:"Upload an image"})]})}),e.jsx("input",{type:"file",className:"opacity-0 w-full h-full absolute cursor-pointer",onChange:l,accept:"image/png, image/gif, image/jpeg"})]},"upload-placeholder")};return e.jsx("div",{className:"flex items-center w-full mt-2",children:c()})},$t=({value:t,onChange:s,placeholder:a="Search for a place"})=>{const{client:r}=L(),i=h.useId(),[n,o]=h.useState(!1),[l,d]=h.useState(""),[c,u]=h.useState(null),m=h.useRef(null),[g]=Fe.useDebounce(l,300);h.useEffect(()=>{t&&(c==null?void 0:c.text)!==t&&d(t)},[t,c]);const{data:x=[],error:f,isLoading:b}=R.useQuery({queryKey:["autocomplete",g],queryFn:async()=>{if(!g||g.length<2)return[];const S=await r.location.getPredictions({query:{query:g}});if(S.status!==200)throw new Error("Failed to fetch predictions");return Array.isArray(S.body)?S.body:(console.warn("API did not return an array:",S.body),[])},enabled:g.length>=2,refetchOnWindowFocus:!1}),y=S=>{u(S),d(S.text);const k={placeId:S.placeId,text:S.text,addressLineOne:S.addressLineOne,addressLineTwo:S.addressLineTwo};s(k),o(!1)};return h.useEffect(()=>{n&&m.current&&m.current.focus()},[n]),e.jsxs("div",{className:"mt-2 relative",children:[e.jsxs(Ke,{open:n,onOpenChange:o,children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(de,{id:i,role:"combobox","aria-expanded":n,variant:"secondary",className:"w-full shadow-2xs! bg-background px-2! py-1 min-h-[41.6px] font-normal outline-offset-0 hover:bg-background focus-visible:border-ring focus-visible:outline-[3px] focus-visible:outline-ring/20",onClick:()=>o(!n),children:[t?e.jsx("span",{className:"px-1 text-sm truncate mr-auto",children:t}):e.jsx("span",{className:"px-1 text-sm text-gray-400 mr-auto",children:a}),e.jsx(A.ChevronDown,{size:16,strokeWidth:2,className:"shrink-0 text-muted-foreground/80","aria-hidden":"true"})]})}),e.jsxs(Ye,{className:"w-full min-w-[var(--radix-popper-anchor-width)] border-input -mt-1 z-50 p-0",align:"start",children:[e.jsxs("div",{className:"flex items-center border-b px-3 py-2",children:[e.jsx(A.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx("input",{ref:m,placeholder:"Search places...",className:"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",value:l,onChange:S=>{d(S.target.value),S.target.value.length>=2&&o(!0)}})]}),e.jsxs("div",{className:"max-h-[300px] overflow-y-auto",children:[b&&e.jsxs("div",{className:"py-6 text-center",children:[e.jsx(A.Loader2,{className:"h-4 w-4 animate-spin mx-auto"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Searching places..."})]}),!b&&l.length<2&&e.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"Type at least 2 characters to search"}),!b&&l.length>=2&&x.length===0&&e.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No places found"}),!b&&l.length>=2&&x.length>0&&e.jsxs("div",{className:"py-1",children:[e.jsxs("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:["Found ",x.length," results"]}),x.map((S,k)=>e.jsxs("div",{className:"relative flex cursor-pointer select-none items-center rounded-xs px-2 py-2 text-sm outline-hidden hover:bg-gray-100 dark:hover:bg-gray-800",onClick:()=>y(S),children:[e.jsxs("div",{className:"flex flex-col grow",children:[e.jsx("span",{children:S.addressLineOne||S.text}),S.addressLineTwo&&e.jsx("span",{className:"text-xs text-muted-foreground",children:S.addressLineTwo})]}),(c==null?void 0:c.placeId)===S.placeId&&e.jsx(A.Check,{size:16,strokeWidth:2,className:"ml-auto"})]},`${S.placeId||"place"}-${k}`))]})]})]})]}),f&&e.jsxs("p",{className:"text-xs text-red-500 mt-1",children:["Error fetching results: ",f.message]})]})},Xa=h.forwardRef(({...t},s)=>e.jsx(we,{...t,inputClassName:"border-l-0 rounded-l-none",ref:s,className:""}));Xa.displayName="PhoneInput";const Rn=({disabled:t,value:s,onChange:a,options:r})=>{const i=n=>{a(n.target.value)};return e.jsxs("div",{className:"relative inline-flex items-center self-stretch rounded-s-lg border border-gray-200 dark:border-gray-800 bg-background py-2 pe-2 ps-3 text-muted-foreground transition-shadow focus-within:z-10 focus-within:border-ring focus-within:outline-hidden focus-within:ring-[3px] focus-within:ring-ring/20 hover:bg-accent hover:text-foreground has-disabled:pointer-events-none has-disabled:opacity-50",children:[e.jsxs("div",{className:"inline-flex items-center gap-1","aria-hidden":"true",children:[e.jsx(Ya,{country:s,countryName:s,"aria-hidden":"true"}),e.jsx("span",{className:"text-muted-foreground/80",children:e.jsx(A.ChevronDown,{size:16,strokeWidth:2,"aria-hidden":"true"})})]}),e.jsxs("select",{disabled:t,value:s,onChange:i,className:"absolute inset-0 text-sm opacity-0","aria-label":"Select country",children:[e.jsx("option",{value:"",children:"Select a country"},"default"),r.filter(n=>n.value).map((n,o)=>e.jsxs("option",{value:n.value,children:[n.label," ",n.value&&`+${Dt.getCountryCallingCode(n.value)}`]},n.value??`empty-${o}`))]})]})},Ya=({country:t,countryName:s})=>{const a=ca[t];return e.jsx("span",{className:"w-5 overflow-hidden rounded-xs",children:a?e.jsx(a,{title:s}):e.jsx(A.Phone,{size:16,"aria-hidden":"true"})})},er=({value:t,onChange:s,onBlur:a})=>{const r=h.useId();return e.jsx("div",{className:"mt-2",children:e.jsx(Dt.default,{id:r,className:"flex rounded-lg shadow-2xs shadow-black/5",international:!0,flagComponent:Ya,countrySelectComponent:Rn,inputComponent:Xa,placeholder:"Enter phone number",value:t,onChange:i=>s(i??""),onBlur:a})})},tr=({options:t,value:s,onChange:a,multiple:r=!1,placeholder:i})=>{var u;const n=h.useId(),[o,l]=h.useState(!1),d=m=>{if(r){let g;Array.isArray(s)&&s.includes(m)?g=s.filter(x=>x!==m):g=Array.isArray(s)?[...s,m]:[m],a(g)}else a(m),l(!1)},c=m=>{if(r&&Array.isArray(s)){const g=s.filter(x=>x!==m);a(g)}};return e.jsx("div",{className:"mt-2",children:e.jsxs(Ke,{open:o,onOpenChange:l,children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(de,{id:n,role:"combobox","aria-expanded":o,variant:"secondary",className:"w-full justify-between shadow-2xs! bg-background px-2! py-1 min-h-[41.6px] font-normal outline-offset-0 hover:bg-background focus-visible:border-ring focus-visible:outline-[3px] focus-visible:outline-ring/20",children:[(s==null?void 0:s.length)>0?e.jsx("div",{className:"flex flex-wrap gap-2",children:Array.isArray(s)?s.map(m=>{const g=t.find(x=>x.value===m);return g?e.jsxs("span",{className:"animate-fadeIn relative inline-flex cursor-default items-center rounded-md border border-border bg-background px-2 py-1 text-xs font-medium text-secondary-foreground transition-all hover:bg-background disabled:cursor-not-allowed disabled:opacity-50",children:[g.label,e.jsx(A.X,{size:12,onClick:x=>{x.preventDefault(),c(m)},className:"cursor-pointer ml-1"})]},m):null}):e.jsx("span",{className:"px-1 text-sm",children:(u=t.find(m=>m.value===s))==null?void 0:u.label})}):e.jsx("span",{className:"px-1 text-sm text-gray-400",children:i||(r?"Select options":"Select an option")}),e.jsx(A.ChevronDown,{size:16,strokeWidth:2,className:"shrink-0 text-muted-foreground/80","aria-hidden":"true"})]})}),e.jsx(Ye,{className:"w-full min-w-[var(--radix-popper-anchor-width)] border-input -mt-1 z-50 p-0",align:"start",children:e.jsxs(pt,{className:"p-0",children:[e.jsx(Ht,{className:"w-full border-none pl-0",style:{boxShadow:"none"},placeholder:"Search..."}),e.jsxs(Zt,{children:[e.jsx(Ut,{children:"No options found."}),e.jsx(Wt,{children:t.map(m=>e.jsxs(qt,{value:m.label,className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800",onSelect:()=>d(m.value),children:[m.label,(r?s.includes(m.value):s===m.value)&&e.jsx(A.Check,{size:16,strokeWidth:2,className:"ml-auto"})]},m.value))})]})]})})]})})},Cn=Se.tv({slots:{root:["group relative isolate inline-flex shrink-0 cursor-pointer items-center rounded-full p-0.5 shadow-inner outline-hidden ring-1 ring-inset transition-all","bg-gray-200 dark:bg-gray-950","ring-black/5 dark:ring-gray-800","data-[state=checked]:bg-blue-600 dark:data-[state=checked]:bg-blue-600","data-disabled:cursor-default","data-disabled:data-[state=checked]:bg-blue-200","data-disabled:data-[state=checked]:ring-gray-300","dark:data-disabled:data-[state=checked]:ring-gray-900","dark:data-disabled:data-[state=checked]:bg-blue-900","data-disabled:data-[state=unchecked]:ring-gray-300","data-disabled:data-[state=unchecked]:bg-gray-100","dark:data-disabled:data-[state=unchecked]:ring-gray-700","dark:data-disabled:data-[state=unchecked]:bg-gray-800",Ge],thumb:["pointer-events-none relative inline-block transform appearance-none rounded-full border-none shadow-lg outline-hidden transition-all duration-150 ease-in-out focus:border-none focus:outline-hidden focus:outline-transparent","bg-white dark:bg-gray-50","group-data-disabled:shadow-none","group-data-disabled:bg-gray-50 dark:group-data-disabled:bg-gray-500"]},variants:{size:{default:{root:"h-7 w-14",thumb:"h-4 w-4 data-[state=checked]:translate-x-7 data-[state=unchecked]:translate-x-0"},small:{root:"h-4 w-7",thumb:"h-3 w-3 data-[state=checked]:translate-x-3 data-[state=unchecked]:translate-x-0"}}},defaultVariants:{size:"default"}}),As=h.forwardRef(({className:t,size:s,...a},r)=>{const{root:i,thumb:n}=Cn({size:s});return e.jsx(Pt.Root,{ref:r,className:w(i(),t),...a,children:e.jsx(Pt.Thumb,{className:w(n())})})});As.displayName="Switch";const sr=h.forwardRef(({className:t,type:s,...a},r)=>e.jsx("input",{type:s,className:Oe("flex h-10 w-full rounded-md border border-gray-200 bg-white px-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:outline-hidden focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-50 dark:placeholder:text-gray-500",t),ref:r,...a}));sr.displayName="TextInput";function vs({className:t,...s}){const a=h.useId();return e.jsx(sr,{id:a,placeholder:"00:00",className:w(t,"mt-2"),ref:Ci.withMask("99:99",{placeholder:"-",showMaskOnHover:!1}),...s})}const le=N.forwardRef(({className:t,disabled:s,...a},r)=>e.jsx(pa.Root,{ref:r,className:Oe("text-sm leading-none font-medium","text-gray-900 dark:text-gray-50",{"text-gray-400 dark:text-gray-600":s},t),"aria-disabled":s,...a}));le.displayName="Label";const Pn=({value:t,onChange:s,disabled:a})=>{const r=()=>{const y=new Date,S=new Date(y);return S.setMinutes(y.getMinutes()+30),S},i=h.useMemo(()=>{const y=[],S=new Date;for(let k=0;k<7;k++){const j=new Date(S);j.setDate(S.getDate()+k),j.setHours(0,0,0,0),y.push(j)}return y},[]),n=y=>{const S=r();if(!(y.toDateString()===new Date().toDateString()))return!0;if(S.getHours()>=21&&S.getMinutes()>0)return!1;for(let j=11;j<=21;j++){const v=new Date(y);if(v.setHours(j,0,0,0),v>S)return!0}return!1},o=y=>!n(y),l=h.useMemo(()=>i.find(y=>!o(y))||null,[i]),[d,c]=h.useState(t||l),[u,m]=h.useState(t?`${t.getHours()}:${t.getMinutes()===0?"00":t.getMinutes()}`:null),g=h.useMemo(()=>{if(!d)return[];const y=[],S=r(),k=d.toDateString()===new Date().toDateString();for(let j=11;j<=21;j++){const v=new Date(d);v.setHours(j,0,0,0),(!k||v>S)&&y.push(`${j}:00`)}return y},[d]),x=y=>{const S=y.toLocaleDateString("en-US",{weekday:"short"}),k=y.toLocaleDateString("en-US",{month:"short"}),j=y.getDate();return{weekday:S,month:k,day:j}},f=y=>{c(y),m(null)},b=y=>{if(m(y),d){const[S]=y.split(":").map(Number),k=new Date(d);k.setHours(S,0,0,0),s(k)}};return h.useEffect(()=>{!d&&l&&c(l)},[]),e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"col-span-4 mt-4",children:[e.jsx(le,{htmlFor:"date",children:"Select Date"}),e.jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:i.map((y,S)=>{const{weekday:k,month:j,day:v}=x(y),P=o(y);return e.jsx("button",{type:"button",disabled:P,className:`p-2 text-center border rounded-md ${P?"opacity-50 cursor-not-allowed":"cursor-pointer"} ${d&&d.toDateString()===y.toDateString()?"bg-teal-500 text-white":"bg-white hover:bg-gray-100"}`,onClick:()=>!P&&f(y),children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:"text-xs font-medium",children:k}),e.jsx("span",{className:"text-xl font-black font-red-hat-display",children:v}),e.jsx("span",{className:"text-xs font-medium",children:j})]})},S)})})]}),d&&g.length>0&&e.jsxs("div",{className:"col-span-4 mt-4",children:[e.jsx(le,{htmlFor:"time",children:"Select Time"}),e.jsx("div",{className:"grid grid-cols-5 gap-2 mt-2",children:g.map((y,S)=>e.jsx("button",{type:"button",className:`p-2 text-sm text-center border rounded-md font-medium cursor-pointer ${u===y?"bg-teal-500 text-white":"bg-white hover:bg-gray-100"}`,onClick:()=>b(y),children:y},S))})]})]})},ar=({name:t,type:s,placeholder:a,multiple:r,options:i,disabled:n,prefix:o})=>{const{watch:l,register:d,setFocus:c,setValue:u}=F.useFormContext();switch(s){case"email":return e.jsx(Ga,{...d(t),placeholder:a});case"file":return e.jsx(Ka,{value:l(t),multiple:r,onChange:m=>u(t,m,{shouldValidate:!0,shouldDirty:!0})});case"week-time":return e.jsx(Pn,{value:l(t),onChange:m=>u(t,m,{shouldValidate:!0,shouldDirty:!0})});case"phone-number":return e.jsx(er,{value:l("phone"),onChange:m=>u(t,m,{shouldValidate:!0,shouldDirty:!0}),onBlur:()=>c("phone")});case"country":return e.jsx(_a,{value:l(t),onChange:m=>u(t,m,{shouldValidate:!0,shouldDirty:!0}),disabled:n});case"select":{const m=r?l(t)||[]:l(t)||"";if(!i)throw new Error("Options are required for select input");return e.jsx(tr,{options:i,value:m,onChange:g=>u(t,g),placeholder:a,multiple:r})}case"switch":return e.jsx(As,{size:"default",className:"mt-2",value:l(t),onCheckedChange:m=>u(t,m)});case"location":return e.jsx($t,{value:l(t),onChange:m=>u(t,m.addressLineOne)});case"time":return e.jsx(vs,{value:l(t),...d(t)});default:return e.jsx(we,{...d(t),type:s,rows:s==="textarea"?4:void 0,placeholder:a,className:"mt-2",prefix:o})}},rr=(t,s)=>!t||typeof t!="object"?void 0:s?s.replace(/\[/g,".").replace(/\]/g,"").split(".").filter(Boolean).reduce((r,i)=>{if(r!=null)return r[i]},t):t,ae=({type:t="text",name:s,label:a,className:r,locale:i,placeholder:n,multiple:o,options:l,localizable:d,prefix:c,disabled:u})=>{const{errors:m}=F.useFormState(),g=rr(m,s);return e.jsxs("div",{className:w("w-full",r),children:[typeof a=="string"&&e.jsxs(le,{htmlFor:s,className:"font-medium flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center",children:[a,d&&e.jsx(A.LanguagesIcon,{className:"w-4 h-4 ml-1 text-gray-500"})]}),i&&d&&e.jsxs("span",{className:"flex items-center text-xs text-gray-500 ml-1 bg-gray-100 px-1 py-0.5 rounded-sm",children:[Bt.get(i)," (",i,")"]})]}),e.jsx(ar,{type:t,name:s,placeholder:n,options:l,multiple:o,prefix:c,disabled:u}),(g==null?void 0:g.message)&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:g.message})]})},ir=({isOpen:t,onClose:s,children:a})=>e.jsx(it.Transition,{show:t,as:h.Fragment,children:e.jsx(it.Dialog,{as:"div",className:"fixed inset-0 overflow-hidden",onClose:s,children:e.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[e.jsx(it.TransitionChild,{as:h.Fragment,enter:"ease-in-out duration-500",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in-out duration-500",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:e.jsx("div",{className:"fixed inset-0 bg-black/75 z-20 transition-opacity"})}),e.jsx("div",{className:"fixed h-1/2 top-0 right-0 z-30 max-w-full flex",children:e.jsx(it.TransitionChild,{as:h.Fragment,enter:"transform transition ease-in-out duration-500",enterFrom:"-translate-y-full",enterTo:"translate-y-0",leave:"transform transition ease-in-out duration-500",leaveFrom:"translate-y-0",leaveTo:"-translate-y-full",children:e.jsx(it.DialogPanel,{className:"relative w-screen h-full",children:e.jsx("div",{className:"max-h-screen bg-gray-900 flex flex-col py-6 shadow-xl overflow-y-scroll",children:a})})})})]})})}),Tn=w("hidden h-6 select-none items-center justify-center rounded-md bg-gray-800 px-2 font-mono text-xs text-gray-400 ring-1 ring-inset ring-gray-700 transition sm:flex"),nr=({open:t=!1,onOpenChange:s,defaultOpen:a=!1,disableAutoFocus:r=!0,children:i})=>e.jsxs(q.Root,{open:t,onOpenChange:s,defaultOpen:a,children:[e.jsx(q.Anchor,{className:w("fixed inset-x-0 bottom-8 mx-auto flex w-fit items-center")}),e.jsx(q.Portal,{children:e.jsx(q.Content,{side:"top",sideOffset:0,onOpenAutoFocus:n=>{r&&n.preventDefault()},className:w("z-50","data-[state=closed]:animate-hide","data-[side=top]:animate-slideUpAndFade"),children:i})})]});nr.displayName="CommandBar";const or=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:w("px-3 py-2.5 text-sm tabular-nums text-gray-300",t),...s}));or.displayName="CommandBar.Value";const lr=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:w("relative flex items-center rounded-lg bg-gray-900 px-1 shadow-lg shadow-black/30 dark:ring-1 dark:ring-white/10",t),...s}));lr.displayName="CommandBarBar";const dr=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:w("h-4 w-px bg-gray-700",t),...s}));dr.displayName="CommandBar.Seperator";const cr=N.forwardRef(({className:t,type:s="button",label:a,action:r,shortcut:i,disabled:n,...o},l)=>(N.useEffect(()=>{const d=c=>{c.key===i.shortcut&&(c.preventDefault(),c.stopPropagation(),r())};return n||document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},[r,i,n]),e.jsx("span",{className:w("flex items-center gap-x-2 rounded-lg bg-gray-900 p-1 text-base font-medium text-gray-50 outline-hidden transition focus:z-10 sm:text-sm","sm:last-of-type:-mr-1",t),children:e.jsxs("button",{ref:l,type:s,onClick:r,disabled:n,className:w("flex items-center gap-x-2 rounded-md px-1 py-1 hover:bg-gray-800","focus-visible:bg-gray-800 focus-visible:hover:bg-gray-800","disabled:text-gray-500",Ge),...o,children:[e.jsx("span",{children:a}),e.jsx("span",{className:Tn,children:i.label?i.label.toUpperCase():i.shortcut.toUpperCase()})]})})));cr.displayName="CommandBar.Command";const zt=N.forwardRef(({className:t,...s},a)=>e.jsx(ms.Root,{ref:a,className:Oe("grid gap-2",t),...s}));zt.displayName="RadioCardGroup";const It=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{className:Oe("relative flex size-4 shrink-0 appearance-none items-center justify-center rounded-full border shadow-2xs outline-hidden","border-gray-300 dark:border-gray-800","bg-white dark:bg-gray-950","group-data-[state=checked]:border-0 group-data-[state=checked]:border-transparent group-data-[state=checked]:bg-blue-600","group-data-disabled:border","group-data-disabled:border-gray-300 group-data-disabled:bg-gray-100 group-data-disabled:text-gray-400","dark:group-data-disabled:border-gray-700 dark:group-data-disabled:bg-gray-800",Ge,t),children:e.jsx(ms.Indicator,{ref:a,className:"flex items-center justify-center",...s,children:e.jsx("div",{className:Oe("size size-1.5 shrink-0 rounded-full","bg-white","group-data-disabled:bg-gray-400 dark:group-data-disabled:bg-gray-500")})})}));It.displayName="RadioCardGroupIndicator";const Lt=N.forwardRef(({className:t,children:s,...a},r)=>e.jsx(ms.Item,{ref:r,className:Oe("group relative w-full rounded-lg border p-4 text-left shadow-2xs transition-all focus:outline-hidden","bg-white dark:bg-gray-950","border-gray-200 dark:border-gray-800","data-[state=checked]:border-blue-600 dark:data-[state=checked]:border-blue-600",Ma,t),...a,children:s}));Lt.displayName="RadioCardItem";const ur=Se.tv({base:w("inline-flex items-center gap-x-1 whitespace-nowrap rounded-sm px-1.5 py-0.5 text-xs font-semibold ring-1"),variants:{variant:{default:["bg-blue-50 text-blue-800 ring-blue-500/30","dark:bg-blue-400/10 dark:text-blue-400 dark:ring-blue-400/30"],neutral:["bg-gray-50 text-gray-700 ring-gray-500/30","dark:bg-gray-400/10 dark:text-gray-300 dark:ring-gray-400/20"],success:["bg-emerald-50 text-emerald-800 ring-emerald-600/30","dark:bg-emerald-400/10 dark:text-emerald-400 dark:ring-emerald-400/20"],error:["bg-red-50 text-red-800 ring-red-600/20","dark:bg-red-400/10 dark:text-red-400 dark:ring-red-400/20"],warning:["bg-yellow-50 text-yellow-800 ring-yellow-600/30","dark:bg-yellow-400/10 dark:text-yellow-500 dark:ring-yellow-400/20"]}},defaultVariants:{variant:"default"}}),We=h.forwardRef(({className:t,variant:s,...a},r)=>e.jsx("span",{ref:r,className:w(ur({variant:s}),t),...a}));We.displayName="Badge";const qe=h.forwardRef(({className:t,children:s,...a},r)=>e.jsx("div",{ref:r,className:w("mx-auto my-6 flex w-full items-center justify-between gap-3 text-sm col-span-full","text-gray-500 dark:text-gray-500",t),...a,children:s?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:w("h-[1px] w-full","bg-gray-200 dark:bg-gray-800")}),e.jsx("div",{className:"whitespace-nowrap text-inherit",children:s}),e.jsx("div",{className:w("h-[1px] w-full","bg-gray-200 dark:bg-gray-800")})]}):e.jsx("div",{className:w("h-[0.5px] w-full","bg-gray-200 dark:bg-gray-800")})}));qe.displayName="Divider";const Qn=({initialData:t,shippingAndPaymentPageUrl:s})=>{const{itemCount:a}=Mt(),r=Q.useRouter(),{client:i}=L(),n=F.useForm({resolver:ue.zodResolver(Ta),reValidateMode:"onChange",defaultValues:t?{firstname:t.firstname,lastname:t.lastname,phone:t.phone,addressLineOne:t.addressLineOne,placeId:t.placeId,doorNumber:t.doorNumber,zipCode:t.zipCode,city:t.city,country:t.country,deliveryInstructions:t.deliveryInstructions}:void 0}),o=n.watch("placeId"),l=n.watch("addressLineOne");h.useEffect(()=>{(async()=>{if(o){const{status:m,body:g}=await i.location.getPlaceDetails({params:{placeId:o}});if(m!==200)throw new Error("Failed to fetch place details");n.setValue("zipCode",g.zipCode,{shouldValidate:!0,shouldDirty:!0}),n.setValue("city",g.city,{shouldValidate:!0,shouldDirty:!0}),n.setValue("country",g.country,{shouldValidate:!0,shouldDirty:!0})}})()},[n,o]);const d=R.useMutation({mutationFn:async m=>{const{status:g,body:x}=await i.shipping.createShippingAddress({body:m});if(g!==201)throw new Error("Failed to create shipping address");return x},onSuccess:()=>{r.push(s)}}),c=R.useMutation({mutationFn:async m=>{const{status:g,body:x}=await i.shipping.updateShippingAddress({body:m});if(g!==200)throw new Error("Failed to update shipping address");return x},onSuccess:()=>r.push(s)}),u=m=>{(t?c:d).mutate(m)};return e.jsx("div",{className:"flex flex-col gap-4",children:e.jsx(F.FormProvider,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(u),children:[e.jsxs("div",{className:"grid grid-cols-4 gap-x-4 gap-y-4 mt-3",children:[e.jsx(ae,{name:"firstname",label:"First Name",type:"text",className:"col-span-2",placeholder:"e.g. John"}),e.jsx(ae,{name:"lastname",label:"Last Name",type:"text",className:"col-span-2",placeholder:"e.g. Doe"}),e.jsx(ae,{name:"phone",label:"Phone",type:"phone-number",className:"col-span-4",placeholder:"e.g. +48 123 456 789"}),e.jsxs("div",{className:"col-span-4 md:col-span-3 text-sm text-gray-500",children:[e.jsx(le,{htmlFor:"address.addressLineOne",className:"font-medium flex items-center justify-between",children:"Street Address"}),e.jsx($t,{onChange:m=>{n.setValue("addressLineOne",m.addressLineOne,{shouldValidate:!0,shouldDirty:!0}),n.setValue("placeId",m.placeId,{shouldValidate:!0,shouldDirty:!0})},value:l}),n.formState.errors.addressLineOne&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:String(n.formState.errors.addressLineOne.message??"")})]}),e.jsx(ae,{name:"doorNumber",label:"Door Number",type:"text",className:"md:col-span-1 col-span-2",placeholder:"e.g. 123"}),e.jsx(ae,{name:"zipCode",label:"Postal Code",type:"text",className:"col-span-2",placeholder:"e.g. 12345"}),e.jsx(ae,{name:"city",label:"City",type:"text",className:"col-span-2",placeholder:"e.g. Kraków"}),e.jsx(ae,{name:"country",label:"Country",type:"country",className:"col-span-2 md:col-span-4",disabled:!0}),e.jsx(ae,{name:"deliveryInstructions",label:"Notes / Instructions",type:"textarea",className:"col-span-4",placeholder:"e.g. 4th floor, code 12345"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-2 w-full mt-8",children:[e.jsx(de,{variant:"secondary",className:"shadow-none",type:"button",onClick:()=>r.push("/"),children:"Back"}),e.jsx(de,{type:"submit",className:"shadow-none bg-teal-500 hover:bg-teal-400 text-white",isLoading:d.isPending||c.isPending,disabled:a===0,loadingText:"Saving...",children:"Save & Continue"})]})]})})})},zn=()=>e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm col-span-2"}),e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm col-span-2"})]}),e.jsx("div",{className:"h-[70px] bg-gray-100 rounded-sm"}),e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm col-span-3"}),e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm col-span-1"})]}),e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm col-span-2"}),e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm col-span-2"})]}),e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm"}),e.jsx("div",{className:"h-[100px] bg-gray-100 rounded-sm"}),e.jsx("div",{className:"h-[40px] bg-gray-100 rounded-sm mt-8"})]}),ds=({shippingAndPaymentPageUrl:t="/checkout/shipping-and-payment"})=>{const s=Q.useRouter(),{client:a}=L(),{data:r,isLoading:i,error:n}=R.useQuery({queryKey:["shippingAddress"],queryFn:async()=>{const{status:l,body:d}=await a.shipping.getShippingAddress();if(l!==200)throw new Error("Failed to fetch shipping address");return d}}),o=()=>{s.push(t)};return i?e.jsx(zn,{}):n?e.jsxs("div",{className:"p-4 rounded-lg bg-red-50 text-red-700",children:[e.jsx("p",{className:"font-semibold",children:"Failed to load shipping address"}),e.jsx("p",{className:"text-xs",children:"Please try refreshing the page or contact support if the issue persists."})]}):e.jsxs("div",{className:"flex flex-col gap-4 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-col gap-y-1",children:[e.jsx("h1",{className:"text-[32px] font-red-hat-display font-black dark:text-blue-500",children:"Shipping Details"}),e.jsx("p",{className:"text-gray-500",children:"Please fill in the your shipping details to continue."})]}),e.jsx(Qn,{initialData:r??null,onSuccess:o,shippingAndPaymentPageUrl:t},r==null?void 0:r.id)]})},In=()=>e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"animate-pulse space-y-4",children:e.jsx("div",{className:"space-y-2",children:[1,2,3].map(t=>e.jsxs("div",{className:"flex items-center gap-3 p-4 border rounded-lg",children:[e.jsx("div",{className:"h-4 w-4 bg-gray-100 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-5 w-32 bg-gray-100 rounded-sm"}),e.jsx("div",{className:"h-4 w-24 bg-gray-100 rounded-sm"})]})]},t))})}),e.jsx("div",{className:"animate-pulse space-y-4 mt-8",children:e.jsx("div",{className:"space-y-2",children:[1,2].map(t=>e.jsxs("div",{className:"flex items-center gap-3 p-4 border rounded-lg",children:[e.jsx("div",{className:"h-4 w-4 bg-gray-100 rounded-full"}),e.jsx("div",{className:"h-5 w-24 bg-gray-100 rounded-sm"})]},t))})}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-2 w-full mt-4",children:[e.jsx("div",{className:"h-10 bg-gray-100 rounded-sm"}),e.jsx("div",{className:"h-10 bg-gray-100 rounded-sm"})]})]}),Ln=({shippingMethods:t,paymentMethods:s,customerDetailsPageUrl:a})=>{const r=Q.useRouter(),{client:i,baseUrl:n}=L(),{organizationId:o}=ze(),{items:l,shippingMethod:d,paymentMethod:c,setPaymentMethod:u,setShippingMethod:m}=Mt(),g=R.useMutation({mutationFn:async()=>{if(!d)throw new Error("Please select a shipping method");if(!c)throw new Error("Please select a payment method");const{body:f,status:b}=await i.order.createOrder({params:{organizationId:o},body:{items:l,shippingMethodId:d==null?void 0:d.id,fulfilmentMethod:"delivery",payment:{provider:c.provider,method:c.method},checkoutBaseUrl:n}});if(b!==201)throw new Error("Failed to fetch shipping methods");return f.redirectUrl&&(window.location.href=f.redirectUrl),f}}),x=()=>{g.mutate()};return h.useEffect(()=>{t.length===1&&m(t[0])},[m,t]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h2",{className:"text-[32px] font-red-hat-display font-black",children:"Shipping Method"}),e.jsx("p",{className:"text-gray-500",children:"Select a shipping method"})]}),e.jsx(zt,{className:"flex flex-col gap-2",value:d==null?void 0:d.id,children:t.map(f=>e.jsx(Lt,{value:f.id,disabled:!f.eligibleShippingZone,onClick:()=>m(f),children:e.jsxs("div",{className:w("flex items-center gap-3",{"opacity-60 cursor-not-allowed":!f.eligibleShippingZone}),children:[e.jsx(It,{}),e.jsx("div",{children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"leading-5 font-red-hat-display font-black mr-2",children:[f.title," (",f.providerName,")"]}),!f.eligibleShippingZone&&e.jsx(We,{variant:"error",children:"Not Available"})]}),f.eligibleShippingZone&&e.jsxs("p",{className:"text-xs font-medium text-gray-500 mt-0.5",children:["Shipping Fee: ",f.eligibleShippingZone.price," zł ",e.jsx("br",{}),"ETA: ",f.eligibleShippingZone.eta]}),!f.eligibleShippingZone&&e.jsxs("p",{className:"mt-0.5 text-xs text-gray-500",children:["Sorry, this address is too far for delivery ",e.jsx("br",{})," from our store."]})]})})]})},f.id))}),e.jsxs("div",{className:"flex flex-col gap-1 mt-3",children:[e.jsx("h2",{className:"text-[32px] font-red-hat-display font-black",children:"Payment Method"}),e.jsx("p",{className:"text-gray-500",children:"Select a payment method"})]}),e.jsx(zt,{className:"flex flex-col gap-3",value:c==null?void 0:c.id,children:s.map(f=>e.jsx(Lt,{value:f.id,onClick:()=>u(f),children:e.jsxs("div",{className:w("flex items-center gap-3"),children:[e.jsx(It,{}),e.jsxs("div",{children:[e.jsx("p",{className:"font-red-hat-display font-black mr-2 capitalize",children:f.method}),e.jsxs("p",{className:"text-xs font-medium text-gray-500 capitalize",children:[f.provider," • ",f.description]})]})]})},f.id))}),g.error&&e.jsx("div",{className:"p-4 mt-2 rounded-lg bg-red-50 text-red-700",children:e.jsx("p",{className:"text-sm",children:g.error.message})}),e.jsx("div",{children:e.jsxs("p",{className:"text-sm text-gray-500 mt-2 block",children:["By confirming this order you agree to our"," ",e.jsx(H,{href:"/terms-and-conditions",className:"text-teal-500 mr-1",children:"Terms & Conditions"}),"and"," ",e.jsx(H,{href:"/privacy-policy",className:"text-teal-500 mr-1",children:"Privacy Policy"})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-2 w-full mt-3",children:[e.jsx(de,{variant:"secondary",className:"shadow-none",onClick:()=>r.push(a),children:"Back"}),e.jsx(de,{className:"shadow-none bg-teal-500 hover:bg-teal-400 text-white",onClick:x,isLoading:g.isPending,children:"Pay & Confirm"})]})]})},pr=({customerDetailsPageUrl:t="/checkout/customer-details"})=>{const{client:s}=L(),{organizationId:a}=ze(),r=Q.useRouter(),i=R.useQuery({queryKey:["shippingAddress"],queryFn:async()=>{const{status:l,body:d}=await s.shipping.getShippingAddress();if(l!==200)throw new Error("Failed to fetch shipping address");return d||r.push(t),d}}),n=R.useQuery({queryKey:["shipping-and-payment-eligibility"],queryFn:async()=>{const{body:l,status:d}=await s.shippingMethod.accessEligibility({params:{organizationId:a}});if(d!==200)throw new Error("Failed to fetch shipping methods");return l}}),o=R.useQuery({queryKey:["payment-methods"],queryFn:async()=>{const{body:l,status:d}=await s.payment.getAvailablePaymentMethods({params:{organizationId:a}});if(d!==200)throw new Error("Failed to fetch shipping methods");return l}});return n.error||i.error?e.jsxs("div",{className:"p-4 rounded-lg bg-red-50 text-red-700",children:[e.jsx("p",{className:"font-semibold",children:"Failed to load shipping methods"}),e.jsx("p",{className:"text-xs",children:"Please try refreshing the page or contact support if the issue persists."})]}):n.isLoading||i.isLoading?e.jsx(In,{}):e.jsx("div",{className:"flex flex-col gap-3 animate-fade-in",children:e.jsx(Ln,{shippingMethods:n.data??[],paymentMethods:o.data??[],customerDetailsPageUrl:t})})},En=t=>oa.createAuthClient({baseURL:t,plugins:[Ct.inferAdditionalFields(),Ct.organizationClient()]}),mr=h.createContext(void 0),Dn=({children:t,baseURL:s})=>{const a=h.useMemo(()=>En(s),[s]);return e.jsx(mr.Provider,{value:a,children:t})},et=()=>{const t=h.useContext(mr);if(t===void 0)throw new Error("useAuth must be used within a AuthProvider");return t},Mn=()=>e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"animate-pulse",children:[1,2].map(t=>e.jsxs("div",{className:"flex items-center w-full mb-5 sm:mb-7",children:[e.jsx("div",{className:"w-14 sm:w-32 h-10 sm:h-24 overflow-hidden rounded-lg bg-white/10"}),e.jsxs("div",{className:"pl-3 md:pl-5 flex-1",children:[e.jsx("div",{className:"h-4 bg-white/10 rounded-sm w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-white/10 rounded-sm w-1/2 mb-2"}),e.jsx("div",{className:"text-white text-xs opacity-50 whitespace-nowrap sm:block hidden",children:e.jsx("div",{className:"h-3 bg-white/10 rounded-sm w-24 mb-2"})}),e.jsx("div",{className:"text-white text-sm font-semibold whitespace-nowrap mt-2 sm:block hidden",children:e.jsx("div",{className:"h-4 bg-white/10 rounded-sm w-16"})})]}),e.jsxs("div",{className:"ml-auto pl-4 text-right sm:hidden",children:[e.jsx("div",{className:"h-4 bg-white/10 rounded-sm w-16 mb-2"}),e.jsx("div",{className:"h-3 bg-white/10 rounded-sm w-20"})]})]},t))}),e.jsx("hr",{className:" md:flex opacity-10 my-4 sm:my-4"}),e.jsxs("div",{className:"mt-3 flex items-center",children:[e.jsx("div",{className:"h-4 w-20 bg-white/10 rounded-sm animate-pulse"}),e.jsx("div",{className:"h-4 w-16 bg-white/10 rounded-sm animate-pulse ml-auto"})]}),e.jsxs("div",{className:"mt-3 flex items-center",children:[e.jsx("div",{className:"h-4 w-20 bg-white/10 rounded-sm animate-pulse"}),e.jsx("div",{className:"h-4 w-16 bg-white/10 rounded-sm animate-pulse ml-auto"})]}),e.jsx("hr",{className:" md:flex opacity-10 my-4 sm:my-4"}),e.jsxs("div",{className:"mt-4 flex justify-between",children:[e.jsx("div",{className:"h-5 w-16 bg-white/10 rounded-sm animate-pulse"}),e.jsx("div",{className:"h-5 w-24 bg-white/10 rounded-sm animate-pulse"})]})]}),Ns=({loading:t=!1,items:s,total:a,subtotal:r,shipping:i,discount:n,currency:o})=>t?e.jsx(Mn,{}):s.length===0?e.jsx("div",{className:"px-7 pt-10 pb-0 md:pt-0 md:px-0",children:e.jsx("div",{className:"my-3 sm:my-6 sm:pb-1",children:e.jsxs("div",{className:"text-center py-6",children:[e.jsx("p",{className:"text-white font-red-hat-display text-xl font-black mb-4",children:"Your shopping cart is empty. Add some products to get started."}),e.jsx(H,{href:"/",className:"text-white hover:text-white/80 underline text-sm",children:"View products"})]})})}):e.jsxs("div",{className:"px-7 pt-10 pb-0 md:pt-0 md:px-0",children:[e.jsx("div",{className:"my-3 sm:my-6 sm:pb-1",children:s.map(({title:l,subtitle:d,image:c,price:u,unitPrice:m,quantity:g},x)=>e.jsx("div",{children:e.jsxs("div",{className:"flex items-center w-full mb-5 sm:mb-7",children:[e.jsx("div",{className:"w-14 sm:min-w-32 h-10 sm:h-24 overflow-hidden rounded-lg",children:c!=null&&c.url?e.jsx(xe,{width:100,height:100,src:c.url,alt:"",className:"w-full h-full object-cover"}):e.jsx("div",{className:"bg-slate-100 w-full h-full flex items-center justify-center",children:e.jsx("span",{className:"text-slate-400 text-xs",children:"No image"})})}),e.jsxs("div",{className:"pl-3 md:pl-5",children:[e.jsxs("div",{className:"flex font-red-hat-display h4 text-white text-sm sm:text-lg items-center",children:[l," ",e.jsxs("span",{className:"text-white text-xs opacity-50 whitespace-nowrap hidden sm:flex items-center ml-1",children:["(x ",g,")"]})]}),d&&d.map((f,b)=>e.jsx("div",{className:"text-white text-xs opacity-50",children:f},b)),e.jsxs("div",{className:"text-white text-xs opacity-50 whitespace-nowrap sm:block hidden",children:["Price: ",m]}),e.jsx("div",{className:"font-red-hat-display h4 text-white text-sm text-sm whitespace-nowrap mt-2 sm:block hidden",children:u})]}),e.jsxs("div",{className:"ml-auto pl-4 text-right sm:hidden",children:[e.jsx("div",{className:"font-red-hat-display h4 text-white text-sm whitespace-nowrap",children:u}),e.jsxs("div",{className:"text-white text-xs opacity-50 whitespace-nowrap",children:["Quantity: ",g]})]})]})},x))}),e.jsx("hr",{className:" md:flex opacity-10 my-4 sm:my-4"}),typeof i=="number"&&e.jsxs("div",{className:"mt-3 flex items-center",children:[e.jsx("h2",{className:"text-xs xl:text-sm text-white opacity-40 font-red-hat-display",children:"Shipping"}),e.jsx("h3",{className:"text-xs xl:text-sm text-white opacity-40 ml-auto font-red-hat-display",children:ye(i,o)})]}),e.jsxs("div",{className:"mt-3 flex items-center",children:[e.jsx("h2",{className:"text-xs xl:text-sm text-white opacity-40 font-red-hat-display",children:"Subtotal"}),e.jsx("h3",{className:"text-xs xl:text-sm text-white opacity-40 ml-auto font-red-hat-display",children:ye(r,o)})]}),n?e.jsxs("div",{className:"mt-3 flex items-center",children:[e.jsx("h2",{className:"text-xs xl:text-sm text-white opacity-40",children:"Discount"}),e.jsxs("h3",{className:"text-xs xl:text-sm text-white opacity-40 ml-auto",children:["- ",ye(r,o)]})]}):null,e.jsx("hr",{className:" md:flex opacity-10 my-4 sm:my-4"}),e.jsxs("div",{className:"mt-4 flex justify-between",children:[e.jsx("h2",{className:"text-sm xl:text-lg text-white font-black font-red-hat-display",children:"Total"}),e.jsx("h3",{className:"xl:text-lg text-white font-black font-red-hat-display",children:ye(a,o)})]})]}),Bn=()=>e.jsxs("header",{className:"fixed flex justify-between px-2 md:px-6 py-4 md:py-12 z-50 bg-gray-900 md:bg-transparent w-full",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{children:e.jsx(A.ChevronLeft,{className:"w-5 h-5 text-white"})}),e.jsx("div",{className:"ml-1.5 w-7 xl:w-8 h-7 xl:h-8 bg-gray-300 animate-pulse rounded-full"}),e.jsx("div",{className:"ml-2 bg-gray-300 animate-pulse h-5 xl:h-6 w-24 xl:w-28 rounded"})]}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs("div",{className:"mr-6 flex items-center",children:[e.jsx("div",{className:"w-8 h-8 bg-gray-300 animate-pulse rounded-full mr-2"}),e.jsx("div",{className:"bg-gray-300 animate-pulse h-4 w-16 rounded"})]}),e.jsxs("div",{className:"flex md:hidden items-center",children:[e.jsx("div",{className:"bg-gray-300 animate-pulse h-3 w-12 rounded mr-1.5"}),e.jsx(A.ShoppingBasketIcon,{className:"w-5 h-5 text-gray-300"})]})]})]}),Jn=()=>{const t=Q.useRouter(),{useSession:s,signOut:a}=et(),{data:r}=s(),i=()=>{var l;if(!((l=r==null?void 0:r.user)!=null&&l.name))return"";const o=r.user.name.split(" ");return o.length===1?o[0].charAt(0):`${o[0].charAt(0)}${o[o.length-1].charAt(0)}`},n=async()=>{await a(),t.push("/account/sign-in")};return e.jsx("div",{className:"hidden md:block",children:e.jsxs(Ke,{children:[e.jsx(Xe,{className:"flex items-center focus:outline-hidden group",children:r!=null&&r.user?e.jsx("div",{className:"w-8 h-8 rounded-full overflow-hidden flex items-center justify-center bg-blue-500 text-white relative transition-transform duration-200 group-hover:scale-110 group-hover:ring-2 group-hover:ring-white/50 group-hover:ring-offset-1 group-hover:cursor-pointer",children:r.user.image?e.jsx("img",{src:r.user.image,alt:r.user.name||"User",className:"w-full h-full object-cover"}):e.jsx("span",{className:"font-medium text-sm",children:i()})}):e.jsxs("div",{className:"flex items-center text-white group-hover:text-blue-300 transition-colors duration-200",children:[e.jsx(A.UserIcon,{className:"w-5 h-5 mr-1 group-hover:scale-110 transition-transform duration-200"}),e.jsx("span",{children:"Guest"})]})}),e.jsx(Ye,{className:"w-32 min-w-32 p-0 py-1 data-[state=open]:animate-slideDownAndFade z-50",align:"end",sideOffset:5,forceMount:!0,children:e.jsxs("button",{onClick:n,className:"block w-full z-50 text-center px-4 cursor-pointer py-1 text-sm text-gray-700 hover:bg-gray-100 flex items-center justify-center font-medium",children:["Logout",e.jsx(A.CircleChevronRightIcon,{className:"w-4 h-4 ml-1"})]})})]})})},Rs=({summary:t})=>{const{organization:s,loading:a}=ze(),[r,i]=h.useState(!1);if(a||!s)return e.jsx(Bn,{});const{name:n,logoFile:o,configuration:l}=s,d=l.defaultCurrency;return e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"fixed flex justify-between px-2 md:px-6 py-4 md:py-12 z-50 bg-gray-900 md:bg-transparent w-full",children:[e.jsxs(H,{href:"/",className:"flex items-center",children:[e.jsx("span",{children:e.jsx(A.ChevronLeft,{className:"w-5 h-5 text-white"})}),o?e.jsx("span",{className:"ml-1.5 w-7 xl:w-8 h-7 xl:h-8 overflow-hidden rounded-full",children:e.jsx(xe,{src:o.url,alt:n,className:"w-full h-full",width:32,height:32})}):e.jsx("div",{className:"flex items-center justify-center w-8 h-8 bg-blue-500 rounded-full text-white text-sm uppercase font-semibold",children:e.jsxs("span",{children:[n[0],n[1]]})}),e.jsx("span",{className:"xl:text-lg font-black text-white ml-2 font-red-hat-display",children:n})]}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"mr-6",children:e.jsx(Jn,{})}),t&&e.jsx("div",{className:"flex md:hidden",children:r?e.jsx("button",{className:"flex items-center text-white mr-2 animate-fade",onClick:()=>i(!1),children:e.jsx(A.XIcon,{className:"w-5 h-5"})},1):e.jsxs("button",{className:"flex items-center text-white mr-2 animate-fade",onClick:()=>i(!0),children:[e.jsx("span",{className:"text-xs text-white font-semibold mr-1.5",children:ye(t.total,d)}),e.jsx(A.ShoppingBasketIcon,{className:"w-5 h-5"})]},2)})]})]}),s&&t&&e.jsx(ir,{isOpen:r,onClose:()=>i(!1),children:e.jsx(Ns,{total:t.total,items:t.items,shipping:t.shipping,subtotal:t.subtotal,currency:d})})]})},Gs=({children:t})=>{const{useSession:s}=et(),a=Q.useRouter(),{data:r,isPending:i}=s();return h.useEffect(()=>{if(!i&&r)return a.push("/checkout/customer-details")},[r,i,a]),i?e.jsx("div",{className:"flex flex-col items-center justify-center h-screen w-screen bg-gray-900",children:e.jsx("div",{className:"mb-4",children:e.jsx("div",{className:"animate-spin rounded-full h-18 w-18 border-b-2 border-teal-500"})})}):e.jsxs(e.Fragment,{children:[e.jsx(Rs,{}),e.jsx("div",{children:e.jsxs("div",{className:"flex flex-col md:flex-row h-screen w-screen relative",children:[e.jsx("div",{className:"hidden md:flex items-center justify-end w-full md:w-1/2 h-full px-16 xl:px-24 relative",children:e.jsx("div",{className:"absolute inset-0 z-0",children:e.jsx(xe,{src:"/images/15750.jpg",alt:"Authentication background",fill:!0,className:"object-cover brightness-50",priority:!0})})}),e.jsx("div",{className:"flex flex-col items-start 2xl:items-start w-full md:w-1/2 h-full px-6 sm:px-12 xl:px-24 py-8 md:overflow-y-auto relative",children:e.jsx("div",{className:"py-10 xl:py-24 md:my-auto animate-fade w-full md:max-w-[432px]",children:t})})]})})]})},Ks=({children:t})=>{const{useSession:s}=et(),a=Q.useRouter(),{data:r,isPending:i}=s();return h.useEffect(()=>{if(!i&&!r)return a.push("/account/sign-in")},[r,i,a]),i?e.jsx("div",{className:"flex flex-col items-center justify-center h-screen w-screen bg-gray-900",children:e.jsx("div",{className:"mb-4"})}):t},On={common:{cart:"Cart",checkout:"Checkout",products:"Products",home:"Home",search:"Search",loading:"Loading...",add:"Add",remove:"Remove",close:"Close",back:"Back",next:"Next",continue:"Continue",submit:"Submit",cancel:"Cancel",apply:"Apply",save:"Save",aboutUs:"About Us",ourStory:"Our Story",menu:"Menu",reservations:"Reservations",orderOnline:"Order Online",checkOurMenu:"Check Our Menu",privacyPolicy:"Privacy Policy",termsAndConditions:"Terms and Conditions",orderNow:"Order Now",makeReservation:"Make a Reservation"},product:{addToCart:"Add to cart",outOfStock:"Out of stock",quantity:"Quantity",price:"Price",total:"Total",description:"Description",options:"Options",modifiers:"Modifiers"},checkout:{yourOrder:"Your Order",orderSummary:"Order Summary",delivery:"Delivery",address:"Address",payment:"Payment",confirmation:"Confirmation",deliveryDetails:"Delivery Details",paymentMethod:"Payment Method",placeOrder:"Place Order",subtotal:"Subtotal",total:"Total"},ourStory:{title:"Our Story",subtitle:"From the shores of South India to the heart of Poland – authentic flavors, unforgettable experiences",by:"By",paragraph1:"When Madras Bistro opened its doors in 2018, it marked a historic moment as Poland's first authentic South Indian restaurant. Our journey began with a simple yet profound vision: to introduce the rich, vibrant flavors of South India to the Polish culinary landscape.",paragraph2:"Our founders, inspired by their deep roots in Tamil Nadu, embarked on this venture after noticing that while North Indian cuisine had found its place in Poland, the diverse and distinctive flavors of South India remained undiscovered territory. They dreamed of creating a space where the aromatic spices, coconut-infused curries, and delicate dosas of their homeland could be experienced in their authentic form.",paragraph3:"The path wasn't always easy. Sourcing traditional ingredients, perfecting recipes that stayed true to their South Indian origins while appealing to Polish palates, and educating diners about a cuisine so different from what they knew – these were challenges we embraced with passion. Our chefs, trained in the time-honored techniques of South Indian cooking, worked tirelessly to ensure every dish that left our kitchen carried the essence of the regions they represented.",paragraph4:"Today, Madras Bistro stands as a cultural bridge between Poland and South India. We take pride in having introduced countless Polish diners to the joy of breaking a crispy dosa, savoring the complex flavors of a well-prepared sambar, and experiencing the unique combination of spices that makes South Indian cuisine so distinctive.",paragraph5:"Our story continues to unfold with each meal we serve, as we remain committed to our founding vision: bringing the authentic taste of South India to Poland, one delicious dish at a time.",paragraph6:"I warmly invite you to join us on this culinary adventure and discover the distinctive tastes of South India – a cuisine still new to many in Poland but certain to delight your palate with its rich traditions and bold flavors.",signature:"- Chef Victor",description:"Learn about Madras Bistro's journey in Krakow, bringing authentic South Indian cuisine with passion and tradition. Discover our story and culinary roots!"},menuSection:{title:"Discover our menu",description:"Our menu is a collection of the most popular dishes from south india."},orderOnline:{title:"Order Online",description:"Craving South Indian food? Order online from Madras Bistro in Krakow for delicious dosas, curries, and more. Fast, fresh, and authentic, delivered to you!"},hero:{title:"Discover South Indian Cuisine that's Beyond Delicious",subtitle:"Embark on a flavorful journey rich in tradition and vibrant spices."},introSection:{title:"Madras Bistro: Five Regions, One Extraordinary Table",paragraph1:"Step into a world where spices whisper ancient secrets and aromas tell tales of distant shores. At Madras Bistro, the diverse culinary heritage of South India comes alive on your plate—a gastronomic tapestry woven from the traditions of Tamil Nadu, Kerala, Andhra Pradesh, Karnataka, and Sri Lanka. Our kitchen celebrates this rich mosaic of regional cuisines, where coastal treasures meet inland specialties in a harmonious expression of flavor.",paragraph2:"In this tropical paradise, the climate nurtures abundant coconut groves and rice fields, giving birth to a culinary tradition that celebrates fresh ingredients and complex flavors. Unlike the heavy, cream-based dishes familiar to many, South Indian cuisine is a delicate dance of spices, featuring iconic dishes like crispy dosas, soft idlis, and tangy sambars that speak to centuries of culinary innovation. Each bite tells a story of coastal markets, family traditions, and a deep connection to the land."},reservationSection:{title:"Reserve Your Table",description:"Experience authentic South Indian cuisine in a warm, inviting atmosphere. Make a reservation for a memorable dining experience."},testimonialsSection:{title:"Google Reviews",description:"See what our customers are saying about us",testimonials:[{name:"Konrad Górski",company:"Appy.com",text:"A bistro worth visiting for fans of Indian flavors. They serve Indian cuisine and from the north of Sri Lanka. I ate delicious milk chicken with aromatic jeera rice. The bistro is small (3 tables) and modest, but you can listen to Indian music hits."},{name:"Sophia Mackney",company:"Nobi Bank",text:"My husband and I chanced upon this restaurant last Thursday whilst on a short break to Krakow from the UK. This small eatery with just 2 or 3 tables is run by the very friendly and obliging owner/chef and is conveniently located facing Ghetto Heroes Square. The Masala Uttapam, Masala Dosa, Kerala Chicken Curry, Chicken Roast and Masala Chai that we had were absolutely delicious. I highly recommend this restaurant to any lovers of South Indian food."},{name:"Sridevi Madbhavi",company:"Sync",text:"Absolutely mouthwatering food! The owner (also the chef) is extremely passionate about the customers experience, and you can feel his expertise in every bite. Highly recommend the ghee dosa (he made it extra crispy for us on request). It tastes like home, is SO authentic. The only downside is that I'll miss the food terribly when I leave Kraków!"},{name:"Bijeesh KB",company:"Appicu",text:"If you're looking for a place that serves real Malabar food, this is definitely the spot. Highly recommended for anyone craving a taste of home!"}]},orderTracking:{orderPlaced:"Order Placed",orderPlacedDesc:"Your order has been received and is waiting to be accepted",orderAccepted:"Order Accepted",orderAcceptedDesc:"Your order has been accepted and is being processed",readyForDispatch:"Ready for Dispatch",readyForDispatchDesc:"Your order is packed and ready to be shipped",orderDispatched:"Order Dispatched",orderDispatchedDesc:"Your order is on its way to you",orderDelivered:"Order Delivered",orderDeliveredDesc:"Your order has been delivered",orderCancelled:"Order Cancelled",orderCancelledDesc:"Your order has been cancelled",price:"Price",quantity:"Quantity",subtotal:"Subtotal",total:"Total",poweredBy:"Powered by",reference:"Reference",status:"Status"},reservation:{reservationDetails:"Reservation Details",name:"Name",phone:"Phone",guests:"Guests",date:"Date",reference:"Reference",status:"Status",notSpecified:"Not specified",invalidDate:"Invalid date",requestSent:"Reservation Request Sent",requestSentDesc:"Your reservation request has been received and is waiting to be confirmed by the restaurant",confirmed:"Reservation Confirmed",confirmedDesc:"Your reservation has been confirmed",cancelled:"Reservation Cancelled",cancelledDesc:"Your reservation has been cancelled",pendingStatus:"Pending",confirmedStatus:"Confirmed",cancelledStatus:"Cancelled",poweredBy:"Powered by"},homepage:{description:"Discover Madras Bistro, Krakow's first South Indian restaurant. Savor authentic flavors, vibrant spices, and traditional dishes in a cozy setting. Visit us today!"},menu:{description:"Explore the Madras Bistro menu featuring authentic South Indian dishes like dosas, curries, and biryanis. Fresh ingredients, bold flavors in Krakow!"},privacyPolicy:{description:"Read Madras Bistro's Privacy Policy to understand how we protect your data and ensure a secure experience while enjoying our South Indian cuisine in Krakow."},termsAndConditions:{description:"Review the Terms and Conditions for using Madras Bistro's website and services in Krakow. Learn about our policies for online orders and dining."}},Fn={common:{cart:"Koszyk",checkout:"Zamówienie",products:"Produkty",home:"Strona główna",search:"Szukaj",loading:"Ładowanie...",add:"Dodaj",remove:"Usuń",close:"Zamknij",back:"Wstecz",next:"Dalej",continue:"Kontynuuj",submit:"Wyślij",cancel:"Anuluj",apply:"Zastosuj",save:"Zapisz",aboutUs:"O nas",ourStory:"O Nas",menu:"Menu",reservations:"Rezerwacje",orderOnline:"Zamów online",checkOurMenu:"Sprawdź nasze menu",privacyPolicy:"Polityka prywatności",termsAndConditions:"Warunki korzystania",orderNow:"Zamów teraz",makeReservation:"Zarezerwuj stolik"},product:{addToCart:"Dodaj do koszyka",outOfStock:"Brak w magazynie",quantity:"Ilość",price:"Cena",total:"Razem",description:"Opis",options:"Opcje",modifiers:"Modyfikatory"},checkout:{yourOrder:"Twoje zamówienie",orderSummary:"Podsumowanie zamówienia",delivery:"Dostawa",address:"Adres",payment:"Płatność",confirmation:"Potwierdzenie",deliveryDetails:"Szczegóły dostawy",paymentMethod:"Metoda płatności",placeOrder:"Złóż zamówienie",subtotal:"Suma częściowa",total:"Razem"},ourStory:{title:"Nasza historia",subtitle:"Z wybrzeży Południowych Indii do serca Polski – autentyczne smaki, niezapomniane doświadczenia",by:"Autor",paragraph1:"Kiedy Madras Bistro otworzyło swoje drzwi w 2018 roku, był to historyczny moment jako pierwsza autentyczna restauracja południowoindyjska w Polsce. Nasza podróż rozpoczęła się od prostej, ale głębokiej wizji: wprowadzenia bogatych, żywych smaków Południowych Indii do polskiego krajobrazu kulinarnego.",paragraph2:"Nasi założyciele, zainspirowani swoimi głębokimi korzeniami w Tamil Nadu, rozpoczęli tę przygodę po zauważeniu, że podczas gdy kuchnia północnoindyjska znalazła swoje miejsce w Polsce, różnorodne i charakterystyczne smaki Południowych Indii pozostały nieodkrytym terytorium. Marzyli o stworzeniu miejsca, gdzie aromatyczne przyprawy, curry nasycone kokosem i delikatne dosa z ich ojczyzny mogłyby być doświadczane w autentycznej formie.",paragraph3:"Droga nie zawsze była łatwa. Pozyskiwanie tradycyjnych składników, doskonalenie przepisów, które pozostały wierne południowoindyjskim korzeniom, a jednocześnie trafiały w gusta polskich podniebień, oraz edukowanie gości o kuchni tak różnej od tego, co znali – to były wyzwania, które przyjęliśmy z pasją. Nasi szefowie kuchni, wyszkoleni w tradycyjnych technikach gotowania południowoindyjskiego, pracowali niestrudzenie, aby zapewnić, że każde danie opuszczające naszą kuchnię niosło w sobie esencję regionów, które reprezentowali.",paragraph4:"Dziś Madras Bistro stoi jako kulturowy most między Polską a Południowymi Indiami. Jesteśmy dumni z tego, że wprowadziliśmy niezliczonych polskich gości w radość przełamywania chrupiącej dosy, smakowania złożonych smaków dobrze przygotowanego sambaru i doświadczania unikalnej kombinacji przypraw, która sprawia, że kuchnia południowoindyjska jest tak wyjątkowa.",paragraph5:"Nasza historia nadal rozwija się z każdym posiłkiem, który serwujemy, ponieważ pozostajemy wierni naszej wizji założycielskiej: przywiezienia autentycznego smaku Południowych Indii do Polski, jedno pyszne danie na raz.",paragraph6:"Serdecznie zapraszam do przyłączenia się do tej kulinarnej przygody i odkrycia charakterystycznych smaków Południowych Indii – kuchni nadal nowej dla wielu w Polsce, ale z pewnością zachwycającej podniebienie bogatymi tradycjami i wyrazistymi smakami.",signature:"- Szef kuchni Victor",description:"Poznaj historię Madras Bistro w Krakowie, które wprowadza autentyczną kuchnię południowoindyjską z pasją i tradycją. Odkryj naszą historię i kulinarne korzenie!"},menuSection:{title:"Odkryj nasze menu",description:"Nasze menu to kolekcja najpopularniejszych dań z południowych Indii."},orderOnline:{title:"Zamów online",description:"Masz ochotę na południowoindyjskie jedzenie? Zamów online z Madras Bistro w Krakowie pyszne dosa, curry i więcej. Szybkie, świeże i autentyczne, dostarczone prosto do Ciebie!"},hero:{title:"Odkryj przepyszną południowo indyjską kuchnie",subtitle:"Wyrusz w pełną smaków podróż bogatą w tradycję i wyraziste przyprawy."},introSection:{title:"Madras Bistro: Pięć regionów, jeden wyjątkowy stół",paragraph1:"Wejdź do świata, gdzie przyprawy szepczą dawne sekrety, a aromaty opowiadają historie z dalekich brzegów. W Madras Bistro różnorodne dziedzictwo kulinarne Południowych Indii ożywa na Twoim talerzu — gastronomiczna tkanina utkana z tradycji Tamil Nadu, Kerali, Andhra Pradesh, Karnataki i Sri Lanki. Nasza kuchnia celebruje tę bogatą mozaikę regionalnych kuchni, gdzie nadmorskie skarby spotykają się z wewnątrznymi specjałami w harmonijnym wyrażeniu smaku.",paragraph2:"W tym tropikalnym raju klimat sprzyja obfitym palmom kokosowym i polom ryżowym, dając początek tradycji kulinarnej, która celebruje świeże składniki i złożone smaki. W przeciwieństwie do ciężkich, kremowych dań znanych wielu osobom, kuchnia południowoindyjska to delikatny taniec przypraw, z takimi ikonicznymi daniami jak chrupiące dosy, miękkie idli i pikantne sambary, które mówią o wiekach kulinarnych innowacji. Każdy kęs opowiada historię nadmorskich targów, rodzinnych tradycji i głębokiego związku z ziemią."},reservationSection:{title:"Zarezerwuj stolik",description:"Doświadcz autentycznej kuchni południowoindyjskiej w ciepłej, przyjaznej atmosferze. Dokonaj rezerwacji na niezapomniane doświadczenie kulinarne."},testimonialsSection:{title:"Opinie Google",description:"Zobacz, co mówią o nas nasi klienci",testimonials:[{name:"Konrad Górski",company:"Appy.com",text:"Bistro warte odwiedzenia dla fanów indyjskich smaków. Serwują kuchnię indyjską i z północy Sri Lanki. Zjadłem pysznego kurczaka w mleku z aromatycznym ryżem jeera. Bistro jest małe (3 stoliki) i skromne, ale można posłuchać indyjskich hitów muzycznych."},{name:"Sophia Mackney",company:"Nobi Bank",text:"Ja i mój mąż przypadkowo trafiliśmy do tej restauracji w zeszły czwartek podczas krótkiego pobytu w Krakowie z Wielkiej Brytanii. Ta mała jadłodajnia z zaledwie 2 lub 3 stolikami jest prowadzona przez bardzo przyjaznego i uczynnego właściciela/szefa kuchni i jest dogodnie zlokalizowana naprzeciwko Placu Bohaterów Getta. Masala Uttapam, Masala Dosa, Curry z Kurczakiem Kerala, Kurczak Pieczony i Masala Chai, które jedliśmy, były absolutnie pyszne. Gorąco polecam tę restaurację wszystkim miłośnikom południowo-indyjskiej kuchni."},{name:"Sridevi Madbhavi",company:"Sync",text:"Absolutnie pyszne jedzenie! Właściciel (również szef kuchni) jest niezwykle zaangażowany w doświadczenia klientów i można poczuć jego doświadczenie w każdym kęsie. Gorąco polecam ghee dosa (zrobił je dla nas ekstra chrupiące na prośbę). Smakuje jak w domu, jest BARDZO autentyczne. Jedynym minusem jest to, że będę tęsknić za tym jedzeniem, gdy opuszczę Kraków!"},{name:"Bijeesh KB",company:"Appicu",text:"Jeśli szukasz miejsca, które serwuje prawdziwe jedzenie Malabar, to zdecydowanie jest to odpowiednie miejsce. Gorąco polecane dla każdego, kto tęskni za smakiem domu!"}]},orderTracking:{orderPlaced:"Zamówienie złożone",orderPlacedDesc:"Twoje zamówienie zostało odebrane i czeka na akceptację",orderAccepted:"Zamówienie zaakceptowane",orderAcceptedDesc:"Twoje zamówienie zostało zaakceptowane i jest przetwarzane",readyForDispatch:"Gotowe do wysyłki",readyForDispatchDesc:"Twoje zamówienie jest spakowane i gotowe do wysyłki",orderDispatched:"Zamówienie wysłane",orderDispatchedDesc:"Twoje zamówienie jest w drodze do Ciebie",orderDelivered:"Zamówienie dostarczone",orderDeliveredDesc:"Twoje zamówienie zostało dostarczone",orderCancelled:"Zamówienie anulowane",orderCancelledDesc:"Twoje zamówienie zostało anulowane",price:"Cena",quantity:"Ilość",subtotal:"Suma częściowa",total:"Razem",poweredBy:"Wspierane przez",reference:"Numer referencyjny",status:"Status"},reservation:{reservationDetails:"Szczegóły rezerwacji",name:"Imię i nazwisko",phone:"Telefon",guests:"Liczba gości",date:"Data",reference:"Numer referencyjny",status:"Status",notSpecified:"Nie określono",invalidDate:"Nieprawidłowa data",requestSent:"Prośba o rezerwację wysłana",requestSentDesc:"Twoja prośba o rezerwację została odebrana i czeka na potwierdzenie przez restaurację",confirmed:"Rezerwacja potwierdzona",confirmedDesc:"Twoja rezerwacja została potwierdzona",cancelled:"Rezerwacja anulowana",cancelledDesc:"Twoja rezerwacja została anulowana",pendingStatus:"Oczekujące",confirmedStatus:"Potwierdzone",cancelledStatus:"Anulowane",poweredBy:"Wspierane przez"},homepage:{description:"Odkryj Madras Bistro, pierwszą restaurację południowoindyjską w Krakowie. Skosztuj autentycznych smaków, żywych przypraw i tradycyjnych dań w przytulnym otoczeniu. Odwiedź nas już dziś!"},menu:{description:"Zapoznaj się z menu Madras Bistro oferującym autentyczne południowoindyjskie dania jak dosa, curry i biryani. Świeże składniki, wyraziste smaki w Krakowie!"},privacyPolicy:{description:"Przeczytaj Politykę Prywatności Madras Bistro, aby zrozumieć, jak chronimy Twoje dane i zapewniamy bezpieczne doświadczenie podczas delektowania się naszą południowoindyjską kuchnią w Krakowie."},termsAndConditions:{description:"Zapoznaj się z Warunkami korzystania ze strony internetowej i usług Madras Bistro w Krakowie. Dowiedz się o naszych zasadach dotyczących zamówień online i dań w restauracji."}},Xs={en:On,pl:Fn},gr=h.createContext(void 0),Vn=({children:t,locale:s})=>{const a=h.useCallback(i=>{const n=i.split(".");let o=Xs[s];for(const l of n)if(o&&typeof o=="object"&&l in o)o=o[l];else return i;return typeof o=="string"?o:i},[s]),r={locale:s,translations:Xs[s],t:a};return e.jsx(gr.Provider,{value:r,children:t})},Hn=()=>{const t=h.useContext(gr);if(t===void 0)throw new Error("useTranslation must be used within a TranslationProvider");return t},Zn=()=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col md:flex-row h-screen w-screen relative",children:[e.jsx("div",{className:"hidden md:flex items-center justify-end w-full md:w-1/2 h-full px-16 xl:px-24 bg-gray-900 md:overflow-y-auto",children:e.jsx("div",{className:"w-96 animate-fade",children:e.jsx("div",{className:"pl-6",children:e.jsxs("div",{className:"px-7 pt-10 pb-0 md:pt-0 md:px-0",children:[[1,2].map(t=>e.jsxs("div",{className:"flex items-center w-full mb-5 sm:mb-7",children:[e.jsx("div",{className:"w-14 sm:w-32 h-10 sm:h-24 overflow-hidden rounded-lg bg-gray-700 animate-pulse"}),e.jsxs("div",{className:"pl-3 md:pl-5 w-full",children:[e.jsx("div",{className:"h-4 bg-gray-700 rounded-sm w-3/4 mb-2 animate-pulse"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded-sm w-1/2 mb-2 animate-pulse"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded-sm w-1/4 animate-pulse"})]})]},t)),e.jsx("hr",{className:"opacity-10 my-4 sm:my-4"}),e.jsxs("div",{className:"mt-3 flex items-center",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded-sm w-20 animate-pulse"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded-sm w-16 ml-auto animate-pulse"})]}),e.jsxs("div",{className:"mt-3 flex items-center",children:[e.jsx("div",{className:"h-3 bg-gray-700 rounded-sm w-16 animate-pulse"}),e.jsx("div",{className:"h-3 bg-gray-700 rounded-sm w-16 ml-auto animate-pulse"})]}),e.jsx("hr",{className:"opacity-10 my-4 sm:my-4"}),e.jsxs("div",{className:"mt-4 flex justify-between",children:[e.jsx("div",{className:"h-5 bg-gray-700 rounded-sm w-16 animate-pulse"}),e.jsx("div",{className:"h-5 bg-gray-700 rounded-sm w-20 animate-pulse"})]})]})})})}),e.jsx("div",{className:"flex flex-col items-start 2xl:items-start w-full md:w-1/2 h-full px-6 sm:px-12 xl:px-24 py-8 md:overflow-y-auto relative",children:e.jsxs("div",{className:"md:my-auto animate-fade w-full md:max-w-[432px]",children:[e.jsx("div",{className:"h-8 bg-gray-200 rounded-sm w-64 mb-4 animate-pulse"}),e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"h-4 bg-gray-200 rounded-sm w-48 mb-2 animate-pulse"}),e.jsx("div",{className:"h-4 bg-gray-200 rounded-sm w-40 animate-pulse"})]}),e.jsx("div",{className:"mt-8 space-y-4",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-4 top-0 h-full w-0.5 bg-gray-200"}),[1,2,3,4,5].map(t=>e.jsxs("div",{className:"ml-9 mb-8 relative",children:[e.jsx("div",{className:"absolute -left-9 mt-1.5",children:e.jsx("div",{className:"h-8 w-8 rounded-full bg-gray-200 animate-pulse"})}),e.jsx("div",{className:"h-5 bg-gray-200 rounded-sm w-40 mb-2 animate-pulse"}),e.jsx("div",{className:"h-3 bg-gray-200 rounded-sm w-64 mb-2 animate-pulse"}),e.jsx("div",{className:"h-3 bg-gray-200 rounded-sm w-24 animate-pulse"})]},t))]})})]})})]})}),Un=({className:t})=>e.jsx("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 13l4 4L19 7"})}),Wn=({className:t})=>e.jsx("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})}),qn=({className:t})=>e.jsxs("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),e.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),$n=({title:t,description:s,active:a,date:r,cancelled:i=!1,showConfetti:n=!1})=>{const o=c=>{if(!c)return null;const u=new Date(c);return T.isValid(u)?T.format(u,"MMM d, yyyy - h:mm a"):null},l=!!r,d=a&&!r;return e.jsxs("div",{className:"relative flex items-start gap-4 pb-8",children:[e.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-full shrink-0",children:e.jsxs("div",{className:w("w-8 h-8 rounded-full flex items-center justify-center",{"bg-green-100 border-green-500 border-[3px]":l&&!n,"bg-violet-100 border-violet-500 border-[3px]":l&&n,"bg-white":!r,"border-gray-200 border-[3px]":!r&&!a,"bg-red-100 border-red-500 border-[3px]":i}),children:[r&&!n&&!i&&e.jsx(Un,{className:"w-4 h-4 text-green-500"}),l&&n&&e.jsx(A.PartyPopperIcon,{className:"w-4 h-4 text-violet-500"}),i&&e.jsx(Wn,{className:"w-4 h-4 text-red-500"}),d&&e.jsx(qn,{className:"text-gray-200 animate-spin dark:text-gray-600 fill-blue-600 w-full"})]})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:w("font-black font-red-hat-display",{"text-red-500":i,"text-gray-900":l,"text-gray-500":!i&&!l}),children:t}),e.jsx("p",{className:w("text-sm font-medium",{"text-red-500":i,"text-gray-600":l,"text-gray-400":!i&&!l}),children:s}),o(r)&&e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:o(r)})]})]})},_n=({orderId:t})=>{const{client:s}=L(),{organization:a,organizationId:r}=ze(),i=Q.useSearchParams(),n=Q.useRouter(),o=Q.usePathname(),{t:l}=Hn(),d=a==null?void 0:a.configuration.defaultCurrency;h.useEffect(()=>{if((i==null?void 0:i.get("clearCart"))==="true"&&o){localStorage.removeItem("shophost-cart");const b=new URLSearchParams(Array.from(i.entries()));b.delete("clearCart");const y=b.toString()?`${o}?${b.toString()}`:o;n.replace(y)}},[i,n,o]);const{data:c,isLoading:u,error:m}=R.useQuery({queryKey:["order",t],refetchInterval:({state:b})=>{var y,S;return((y=b.data)==null?void 0:y.status)!=="completed"&&((S=b.data)==null?void 0:S.status)!=="cancelled"?30*1e3:!1},queryFn:async()=>{const{status:b,body:y}=await s.order.getOrder({params:{id:t,organizationId:r}});if(b!==200)throw new Error("Failed to fetch shipping address");return y}}),g=h.useMemo(()=>c?c==null?void 0:c.items.map(b=>({title:b.translations[0].title,subtitle:[b.translations[0].subtitle],price:ye(b.unitPrice,d??"USD"),unitPrice:ye(b.unitPrice,d??"USD"),quantity:b.quantity,image:b.image})):[],[c,d]);if(!c||u)return e.jsx(Zn,{});const{status:x}=c,f=[{title:l("orderTracking.orderPlaced"),description:l("orderTracking.orderPlacedDesc"),date:new Date(c.expiresAt),active:!1},{title:l("orderTracking.orderAccepted"),description:l("orderTracking.orderAcceptedDesc"),date:c.acceptedAt,active:!c.acceptedAt},{title:l("orderTracking.readyForDispatch"),description:l("orderTracking.readyForDispatchDesc"),date:c.readyForDispatchAt,active:x==="accepted"},{title:l("orderTracking.orderDispatched"),description:l("orderTracking.orderDispatchedDesc"),date:c.dispatchedAt,active:x==="ready-for-dispatch"},{title:l("orderTracking.orderDelivered"),description:l("orderTracking.orderDeliveredDesc"),date:c.completedAt,active:x==="dispatched",showConfetti:!0}];return c.status==="cancelled"&&f.push({title:l("orderTracking.orderCancelled"),description:l("orderTracking.orderCancelledDesc"),date:c.cancelledAt,active:!!c.cancelledAt,cancelled:!0}),e.jsxs(e.Fragment,{children:[e.jsx(Rs,{summary:{total:c.payment.total,subtotal:c.payment.subtotal,shipping:c.payment.shipping,items:g}}),e.jsx("div",{children:e.jsxs("div",{className:"flex flex-col md:flex-row h-screen w-screen relative",children:[e.jsx("div",{className:"hidden md:flex items-center justify-end w-full md:w-1/2 h-full px-16 xl:px-24 bg-gray-900 md:overflow-y-auto",children:e.jsx("div",{className:"w-96 animate-fade",children:e.jsxs("div",{className:"pl-6",children:[e.jsx(Ns,{items:g,total:c.payment.total,subtotal:c.payment.subtotal,shipping:c.payment.shipping,currency:d??"USD"}),e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 text-center mt-14 w-full",children:[l("orderTracking.poweredBy")," ",e.jsx("a",{href:"https://shophost.io",className:"text-blue-500 hover:text-blue-600 dark:text-blue-500 dark:hover:text-blue-400",children:"shophost.io"})]})]})})}),e.jsx("div",{className:"flex flex-col items-start 2xl:items-start w-full md:w-1/2 h-full px-6 sm:px-12 xl:px-24 py-8 md:overflow-y-auto relative",children:e.jsxs("div",{className:"md:my-auto animate-fade w-full md:max-w-[432px] pt-14 sm:pt-0",children:[e.jsx("h1",{className:"h3 mb-1 font-red-hat-display",children:l("checkout.yourOrder")}),e.jsxs("div",{className:"mb-8",children:[e.jsxs("p",{className:"text-sm font-medium text-gray-500",children:[l("orderTracking.reference"),": ",c.referenceId]}),e.jsxs("p",{className:"text-sm font-medium text-gray-500",children:[l("orderTracking.status"),":"," ",e.jsx("span",{className:`capitalize font-semibold ${c.status==="cancelled"?"text-red-600":"text-green-600"}`,children:c.status})]})]}),e.jsx("div",{className:"mt-8 space-y-4",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-4 top-0 w-0.5 bg-gray-200",style:{height:`calc(100% - ${f.length>1?"4rem":"0rem"})`}}),f.map((b,y)=>e.jsx($n,{...b},y))]})})]})})]})})]})},Gn=()=>e.jsxs("div",{children:[e.jsx("h1",{children:"All Orders"}),e.jsx("p",{children:"Order history and list will be displayed here"})]}),Kn=()=>{const t=Q.useSearchParams(),{signIn:s}=et(),{baseUrl:a}=L(),r=(t==null?void 0:t.get("redirect"))??"/checkout/customer-details",{register:i,handleSubmit:n,formState:{errors:o,isSubmitting:l}}=F.useForm({resolver:ue.zodResolver(Da),shouldFocusError:!0}),d=async u=>{await s.email({email:u.email,password:u.password,callbackURL:`${a}${r}`})},c=async u=>{u.preventDefault(),await s.social({provider:"google",callbackURL:`${a}${r}`})};return e.jsxs("div",{className:"flex w-full flex-col items-start sm:max-w-sm",children:[e.jsxs("div",{className:"mt-6 flex flex-col",children:[e.jsx("h1",{className:"h4 font-black font-red-hat-display",children:"Log in"}),e.jsxs("p",{className:"mt-1 text-sm text-gray-700 dark:text-gray-300",children:["Login or create an account to continue. Don’t have an account?"," ",e.jsx(H,{className:"text-teal-500 hover:text-teal-600 dark:text-teal-500 dark:hover:text-teal-400",href:`/account/sign-up?redirect=${r}`,children:"Sign up"})]})]}),e.jsxs("div",{className:"mt-10 w-full",children:[e.jsx("div",{className:"gap-2 sm:flex sm:flex-row sm:items-center",children:e.jsxs(de,{variant:"secondary",type:"button",className:"mt-2 w-full sm:mt-0 shadow-none inline-flex items-center gap-2",onClick:c,children:[e.jsx(C.RiGoogleFill,{className:"size-4","aria-hidden":"true"}),"Login with Google"]})}),e.jsx(qe,{className:"my-6",children:"or"}),e.jsxs("form",{onSubmit:n(d),className:"flex w-full flex-col gap-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-y-4",children:[e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(le,{htmlFor:"email-form-item",className:"font-medium",children:"Email"}),e.jsx(we,{type:"email",autoComplete:"email",id:"email-form-item",placeholder:"emily.ross@acme.ch",...i("email")}),o.email&&e.jsx("span",{className:"text-sm text-red-500",children:o.email.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(le,{htmlFor:"password-form-item",className:"font-medium",children:"Password"}),e.jsx(we,{type:"password",autoComplete:"current-password",id:"password-form-item",placeholder:"Password",...i("password")}),o.password&&e.jsx("span",{className:"text-sm text-red-500",children:o.password.message})]})]}),e.jsx(de,{type:"submit",className:"shadow-none",isLoading:l,children:l?"Submitting...":"Continue"})]})]}),e.jsx(qe,{}),e.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Forgot your password?"," ",e.jsx("a",{className:"text-teal-500 hover:text-teal-600 dark:text-teal-500 dark:hover:text-teal-400",href:"#",children:"Reset password"})]})]})},Xn=()=>e.jsx(Kn,{}),Yn=()=>{const t=Q.useSearchParams(),{signUp:s,signIn:a}=et(),{baseUrl:r}=L(),i=(t==null?void 0:t.get("redirect"))??"/checkout/customer-details",{register:n,handleSubmit:o,formState:{errors:l}}=F.useForm({resolver:ue.zodResolver(Ss),shouldFocusError:!0}),{isPending:d,isError:c,mutate:u}=R.useMutation({onMutate:async g=>s.email({email:g.email,password:g.password,name:`${g.firstname} ${g.lastname}`,firstname:g.firstname,lastname:g.lastname,callbackURL:`${r}${i}`})}),m=async g=>(g.preventDefault(),a.social({provider:"google",callbackURL:`${r}${i}`}));return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex w-full flex-col items-start md:max-w-sm",children:[e.jsxs("div",{className:"mt-6 flex flex-col",children:[e.jsx("h1",{className:"h4 font-black font-red-hat-display",children:"Create an account"}),e.jsxs("p",{className:"mt-1 text-sm text-gray-700 dark:text-gray-300",children:["Already have an account?"," ",e.jsx(H,{className:"text-teal-500 hover:text-teal-600 dark:text-teal-500 dark:hover:text-teal-400",href:"/account/sign-in",children:"Sign in"})]})]}),e.jsxs("div",{className:"mt-10 w-full",children:[e.jsx("div",{className:"gap-2 sm:flex sm:flex-row sm:items-center",children:e.jsxs(de,{variant:"secondary",type:"button",className:"mt-2 w-full sm:mt-0 inline-flex items-center gap-2 shadow-none",onClick:m,children:[e.jsx(C.RiGoogleFill,{className:"size-4","aria-hidden":"true"}),"Signin with Google"]})}),e.jsx(qe,{className:"my-6",children:"or"}),e.jsxs("form",{onSubmit:o(g=>u(g)),className:"flex w-full flex-col gap-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-y-4",children:[e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(le,{htmlFor:"email-form-item",className:"font-medium",children:"First Name"}),e.jsx(we,{type:"text",id:"email-form-item",placeholder:"Emily",...n("firstname")}),l.firstname&&e.jsx("span",{className:"text-sm text-red-500",children:l.firstname.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(le,{htmlFor:"email-form-item",className:"font-medium",children:"Last Name"}),e.jsx(we,{type:"text",id:"email-form-item",placeholder:"Emily",...n("lastname")}),l.lastname&&e.jsx("span",{className:"text-sm text-red-500",children:l.lastname.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(le,{htmlFor:"email-form-item",className:"font-medium",children:"Email"}),e.jsx(we,{type:"email",autoComplete:"email",id:"email-form-item",placeholder:"emily.ross@acme.ch",...n("email")}),l.email&&e.jsx("span",{className:"text-sm text-red-500",children:l.email.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(le,{htmlFor:"password-form-item",className:"font-medium",children:"Password"}),e.jsx(we,{type:"password",autoComplete:"current-password",id:"password-form-item",placeholder:"Password",...n("password")}),l.password&&e.jsx("span",{className:"text-sm text-red-500",children:l.password.message})]})]}),c&&e.jsx("span",{className:"text-sm text-red-500",children:"An error occurred, please try again."}),e.jsx(de,{type:"submit",isLoading:d,children:d?"Submitting...":"Continue"})]})]}),e.jsx(qe,{}),e.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Forgot your password?"," ",e.jsx("a",{className:"text-teal-500 hover:text-teal-600 dark:text-teal-500 dark:hover:text-teal-400",href:"#",children:"Reset password"})]})]})})},eo=()=>e.jsx(Yn,{}),to=()=>{const{segments:t}=Q.useParams(),[s,...a]=t;switch(s){case"sign-in":return a.length!==0?Q.notFound():e.jsx(Gs,{children:e.jsx(Xn,{})});case"sign-up":return a.length!==0?Q.notFound():e.jsx(Gs,{children:e.jsx(eo,{})});case"orders":return a.length>1?Q.notFound():a.length===0?e.jsx(Ks,{children:e.jsx(Gn,{})}):e.jsx(Ks,{children:e.jsx(_n,{orderId:a[0]})});default:return Q.notFound()}},so=(t,s)=>t==="reservation"&&!s?e.jsx(ds,{}):s==="customer-details"?e.jsx(ds,{}):s==="shipping-and-payment"?e.jsx(pr,{}):Q.notFound(),ao=()=>{const t=Q.useParams(),{useSession:s}=et(),a=Q.useRouter(),{data:r,isPending:i}=s(),{loading:n,formattedCartItems:o,total:l,subtotal:d,shipping:c}=Mt(),{organization:u,loading:m}=ze(),[g,x,...f]=(t==null?void 0:t.segments)||[];return console.log(g,x),h.useEffect(()=>{!i&&!r&&a.push("/account/sign-in?redirect=/checkout/customer-details")},[r,i,a]),f.length>0?Q.notFound():m||n||i?e.jsx("div",{className:"flex flex-col items-center justify-center h-screen w-screen bg-gray-900",children:e.jsx("div",{className:"mb-4",children:e.jsx("div",{className:"animate-spin rounded-full h-18 w-18 border-b-2 border-teal-500"})})}):u?!u.configuration.isAcceptingOrders||!u.configuration.isOpen?e.jsx("div",{className:"flex flex-col items-center justify-center h-screen w-screen bg-gray-900 text-center animate-fade-in",children:u.configuration.isOpen?e.jsxs("div",{className:"relative z-10 max-w-[800px] px-10",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-black font-red-hat-display text-white",children:"Unfortunately, We're currently not accepting online orders."}),e.jsxs("p",{className:"text-gray-100 font-medium mt-3 text-lg mt-",children:["Please contact us directly for any inquiries. ",e.jsx("br",{})," +48 500 193 738",e.jsx("br",{})," contact@madrasbistro.pl"]}),e.jsx(H,{className:"btn-sm mt-6 text-white bg-teal-500 hover:bg-teal-400 rounded-lg shrink-0",href:"/",children:"Back to Homepage"})]}):e.jsxs("div",{className:"relative z-10",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-black font-red-hat-display text-white",children:"Sorry, we're currently closed"}),e.jsxs("p",{className:"text-gray-100 font-medium mt-3 text-lg mt-",children:["Please contact us directly for any inquiries. ",e.jsx("br",{})," +48 500 193 738",e.jsx("br",{})," contact@madrasbistro.pl"]}),e.jsx(H,{className:"btn-sm mt-6 text-white bg-teal-500 hover:bg-teal-400 rounded-lg shrink-0",href:"/",children:"Back to Homepage"})]})}):e.jsxs(e.Fragment,{children:[e.jsx(Rs,{summary:{total:l,subtotal:d,shipping:c,items:o}}),e.jsx("div",{children:e.jsxs("div",{className:"flex flex-col md:flex-row h-screen w-screen relative",children:[e.jsx("div",{className:"hidden md:flex items-center justify-end w-full md:w-1/2 h-full px-16 xl:px-24 bg-gray-900 md:overflow-y-auto",children:e.jsxs("div",{className:"w-96 animate-fade",children:[e.jsx("div",{className:"pl-6",children:e.jsx(Ns,{items:o,total:l,subtotal:d,shipping:c,currency:u.configuration.defaultCurrency||"USD"})}),e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 text-center mt-14 w-full",children:["Powered by"," ",e.jsx("a",{href:"https://shophost.io",className:"text-teal-500 hover:text-teal-600 dark:text-blue-500 dark:hover:text-blue-400",children:"shophost.io"})]})]})}),e.jsx("div",{className:"flex flex-col items-start 2xl:items-start w-full md:w-1/2 h-full px-6 sm:px-12 xl:px-24 py-8 md:overflow-y-auto relative",children:e.jsx("div",{className:"py-10 xl:py-24 md:my-auto animate-fade w-full md:max-w-[432px]",children:so(g,x)})})]})})]}):e.jsx("div",{className:"flex flex-col items-center justify-center h-screen w-screen bg-gray-900",children:e.jsx("h1",{className:"text-2xl font-bold",children:"Organization not found"})})},ro=({children:t})=>{const{isOpen:s,onClose:a,product:r,modifierGroups:i,hasModifiers:n,productName:o,quantity:l,handleIncrement:d,handleDecrement:c,handleAddToCart:u,validationError:m}=ut();if(!r)return null;const g=l<=1;return t({modifierGroups:i,hasModifiers:n,product:r,isOpen:s,onClose:a,productName:o,quantity:l,onIncrement:d,onDecrement:c,isDecrementDisabled:g,onAddToCart:u,validationError:m})},io=({children:t,minQuantity:s=1})=>{const{quantity:a,handleIncrement:r,handleDecrement:i}=ut(),n=a<=s;return t({quantity:a,onIncrement:r,onDecrement:i,isDecrementDisabled:n})},no=({children:t,group:s,renderOptions:a})=>{const{getModifierGroupName:r}=ut(),i=r(s),n=s.selectMin>0;let o=null;return s.selectMin>0&&s.selectMax>0&&(o=s.selectMin===s.selectMax?`${s.selectMin} option`:`${s.selectMin}-${s.selectMax}`),t({group:s,groupName:i,isRequired:n,selectionRequirements:o,renderOptions:a})},oo=({children:t,modifier:s,groupId:a})=>{const{isModifierSelected:r,isMultiSelect:i,toggleModifier:n,selectModifier:o,formatModifierPrice:l,product:d,locale:c}=ut(),u=r(a,s.id),m=i(d.modifierGroups.find(f=>f.id===a)),g=l(s,d.currency);return t({modifier:s,isSelected:u,onSelect:()=>{m?n(a,s.id):o(a,s.id)},isMultiSelect:m,formattedPrice:g})},lo=({children:t,locale:s="en"})=>e.jsx(Sa,{locale:s,children:t}),co=(t,s=[])=>{const[a,r]=h.useState(null),[i,n]=h.useState(!0),[o,l]=h.useState(null),d=JSON.stringify(s.map(c=>c.id));return h.useEffect(()=>{(async()=>{n(!0);try{const u=s.find(m=>m.id===t);if(u)r(u);else throw new Error(`Product with ID ${t} not found`)}catch(u){l(u instanceof Error?u:new Error("Failed to fetch product"))}finally{n(!1)}})()},[t,d]),{product:a,loading:i,error:o}},uo=(t,s=[])=>{const[a,r]=h.useState({}),[i,n]=h.useState(!0),[o,l]=h.useState(null),d=JSON.stringify(t.sort());return h.useEffect(()=>{const u=async()=>{n(!0);try{const g=s.filter(f=>t.includes(f.id)).reduce((f,b)=>(f[b.id]=b,f),{});r(g);const x=t.filter(f=>!g[f]);x.length>0&&console.warn(`Products with IDs ${x.join(", ")} not found`)}catch(m){l(m instanceof Error?m:new Error("Failed to fetch products"))}finally{n(!1)}};t.length>0?u():(r({}),n(!1))},[d,s]),{products:a,getProduct:u=>a[u]||null,loading:i,error:o}},po=[{id:"product-1",slug:"classic-burger",sku:"BURGER-001",basePrice:12.99,discountedBasePrice:null,currency:"USD",images:[{id:"img-1",url:"https://images.unsplash.com/photo-1568901346375-23c9450c58cd?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1000&q=80",mimeType:"image/jpeg",size:65783,filename:"classic-burger.jpeg"}],modifierGroups:[],categories:[{id:"cat-1",slug:"burgers",createdAt:"2023-01-01T00:00:00.000Z",translations:[{locale:"en",title:"Burgers",description:""},{locale:"pl",title:"Burgery",description:""}]}],manufacturerId:null,createdAt:"2023-01-01T00:00:00.000Z",publishedAt:"2023-01-01T00:00:00.000Z",translations:[{locale:"en",title:"Classic Burger",description:"A juicy beef patty with lettuce, tomato, onion, and our special sauce on a toasted bun."},{locale:"pl",title:"Klasyczny Burger",description:"Soczysta wołowina z sałatą, pomidorem, cebulą i naszym specjalnym sosem na opiekanej bułce."}]},{id:"product-2",slug:"custom-pizza",sku:"PIZZA-001",basePrice:14.99,discountedBasePrice:null,currency:"USD",images:[{id:"img-2",url:"https://images.unsplash.com/photo-1513104890138-7c749659a591?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1000&q=80",mimeType:"image/jpeg",size:75783,filename:"custom-pizza.jpeg"}],modifierGroups:[{id:"mod-group-1",selectMin:1,selectMax:1,modifiers:[{id:"mod-1-1",title:"Thin Crust",sku:null,price:0},{id:"mod-1-2",title:"Regular Crust",sku:null,price:0},{id:"mod-1-3",title:"Thick Crust",sku:null,price:2}],translations:[{locale:"en",title:"Crust Type"},{locale:"pl",title:"Rodzaj Ciasta"}]},{id:"mod-group-2",selectMin:1,selectMax:1,modifiers:[{id:"mod-2-1",title:"Tomato Sauce",sku:null,price:0},{id:"mod-2-2",title:"White Sauce",sku:null,price:0},{id:"mod-2-3",title:"BBQ Sauce",sku:null,price:0}],translations:[{locale:"en",title:"Sauce"},{locale:"pl",title:"Sos"}]}],categories:[{id:"cat-2",slug:"pizza",createdAt:"2023-01-01T00:00:00.000Z",translations:[{locale:"en",title:"Pizza",description:""},{locale:"pl",title:"Pizza",description:""}]}],manufacturerId:null,createdAt:"2023-01-01T00:00:00.000Z",publishedAt:"2023-01-01T00:00:00.000Z",translations:[{locale:"en",title:"Custom Pizza",description:"Build your own pizza with your choice of crust and sauce. Comes with cheese and tomatoes."},{locale:"pl",title:"Pizza Własna",description:"Zbuduj własną pizzę z wybranym rodzajem ciasta i sosu. Zawiera ser i pomidory."}]},{id:"product-3",slug:"build-your-salad",sku:"SALAD-001",basePrice:9.99,discountedBasePrice:null,currency:"USD",images:[{id:"img-3",url:"https://images.unsplash.com/photo-1512621776951-a57141f2eefd?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1000&q=80",mimeType:"image/jpeg",size:55783,filename:"build-your-salad.jpeg"}],modifierGroups:[{id:"mod-group-3",selectMin:0,selectMax:5,modifiers:[{id:"mod-3-1",title:"Grilled Chicken",sku:null,price:2.5},{id:"mod-3-2",title:"Bacon",sku:null,price:1.5},{id:"mod-3-3",title:"Avocado",sku:null,price:2},{id:"mod-3-4",title:"Feta Cheese",sku:null,price:1},{id:"mod-3-5",title:"Boiled Egg",sku:null,price:1}],translations:[{locale:"en",title:"Toppings"},{locale:"pl",title:"Dodatki"}]},{id:"mod-group-4",selectMin:0,selectMax:1,modifiers:[{id:"mod-4-1",title:"Ranch",sku:null,price:0},{id:"mod-4-2",title:"Balsamic Vinaigrette",sku:null,price:0},{id:"mod-4-3",title:"Caesar",sku:null,price:0},{id:"mod-4-4",title:"Olive Oil & Lemon",sku:null,price:0}],translations:[{locale:"en",title:"Dressing"},{locale:"pl",title:"Dressing"}]}],categories:[{id:"cat-3",slug:"salads",createdAt:"2023-01-01T00:00:00.000Z",translations:[{locale:"en",title:"Salads",description:""},{locale:"pl",title:"Sałatki",description:""}]}],manufacturerId:null,createdAt:"2023-01-01T00:00:00.000Z",publishedAt:"2023-01-01T00:00:00.000Z",translations:[{locale:"en",title:"Build Your Salad",description:"Fresh mixed greens with cherry tomatoes, cucumber, and red onion. Add your favorite toppings and dressing."},{locale:"pl",title:"Skomponuj Swoją Sałatkę",description:"Świeże mieszane sałaty z pomidorkami koktajlowymi, ogórkiem i czerwoną cebulą. Dodaj ulubione dodatki i dressing."}]}],mo=new R.QueryClient({defaultOptions:{queries:{retry:!1,refetchInterval:!1,refetchOnWindowFocus:!1}}}),go=({baseUrl:t,children:s,locale:a="en",organizationId:r})=>e.jsx(Vn,{locale:a,children:e.jsx(Dn,{baseURL:t,children:e.jsx(gs,{baseUrl:t,children:e.jsx(R.QueryClientProvider,{client:mo,children:e.jsx(Gi,{organizationId:r,children:e.jsx(fa,{locale:a,organizationId:r,children:e.jsx(Sa,{locale:a,children:s})})})})})})}),hr=h.createContext(null),ho=({client:t,children:s})=>e.jsx(hr.Provider,{value:t,children:s});function mt(){const t=h.useContext(hr);if(!t)throw new Error("useAdminAuth must be used within AdminProvider");return t}const xr=h.createContext(null),xo=({config:t,children:s})=>e.jsx(xr.Provider,{value:t,children:s});function fr(){const t=h.useContext(xr);if(!t)throw new Error("useAdminConfig must be used within AdminProvider");return t}const yr=h.createContext(null),fo=({routes:t,children:s})=>e.jsx(yr.Provider,{value:t,children:s});function Y(){const t=h.useContext(yr);if(!t)throw new Error("useAdminRoutes must be used within AdminProvider");return t}function wr(t){return oa.createAuthClient({baseURL:t,plugins:[Ct.inferAdditionalFields(),Ct.organizationClient()]})}const rs=new Map;function br(t){return rs.has(t)||rs.set(t,wr(t)),rs.get(t)}const Ae=new R.QueryClient({defaultOptions:{queries:{retry:!1,refetchInterval:!1,refetchOnWindowFocus:!1}}});function Sr(t){const s=t.replace(/\/$/,"");return{home:s,signIn:`${s}/auth/sign-in`,signUp:`${s}/auth/sign-up`,organizations:`${s}/organizations`,dashboard:a=>`${s}/${a}/dashboard`,liveOrders:a=>`${s}/${a}/live-orders`,orders:a=>`${s}/${a}/orders`,reservations:a=>`${s}/${a}/reservations`,products:a=>`${s}/${a}/products`,productCreate:a=>`${s}/${a}/products/create`,productEdit:(a,r)=>`${s}/${a}/products/${r}`,productCategories:a=>`${s}/${a}/product-categories`,productCategoryCreate:a=>`${s}/${a}/product-categories/create`,productCategoryEdit:(a,r)=>`${s}/${a}/product-categories/${r}`,manufacturers:a=>`${s}/${a}/manufacturers`,manufacturerCreate:a=>`${s}/${a}/manufacturers/create`,manufacturerEdit:(a,r)=>`${s}/${a}/manufacturers/${r}`,settings:a=>`${s}/${a}/settings`,settingsOpeningTimes:a=>`${s}/${a}/settings/opening-times`,settingsShippingMethods:a=>`${s}/${a}/settings/shipping-methods`,settingsShippingMethodCreate:a=>`${s}/${a}/settings/shipping-methods/create`,settingsShippingMethodEdit:(a,r)=>`${s}/${a}/settings/shipping-methods/${r}`}}function yo({config:t,children:s}){const a=h.useMemo(()=>br(t.apiBaseUrl),[t.apiBaseUrl]),r=h.useMemo(()=>Sr(t.basePath),[t.basePath]);return e.jsxs(R.QueryClientProvider,{client:Ae,children:[e.jsx(na.ThemeProvider,{defaultTheme:"light",attribute:"class",children:e.jsx(gs,{baseUrl:t.apiBaseUrl,children:e.jsx(ho,{client:a,children:e.jsx(xo,{config:t,children:e.jsx(fo,{routes:r,children:s})})})})}),e.jsx(X.Toaster,{})]})}function I(...t){return da.twMerge(la(...t))}const tt=["focus:ring-2","focus:ring-blue-200 dark:focus:ring-blue-700/30","focus:border-blue-500 dark:focus:border-blue-700"],ie=["outline outline-offset-2 outline-0 focus-visible:outline-2","outline-blue-500 dark:outline-blue-500"],_t=["ring-2","border-red-500 dark:border-red-700","ring-red-200 dark:ring-red-700/30"],wo=(t,s=0)=>Intl.NumberFormat("us",{minimumFractionDigits:s,maximumFractionDigits:s}).format(Number(t)).toString(),kr=(t,s=1)=>{const a=new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:s,maximumFractionDigits:s}).format(t);return`${t>0&&t!==1/0?"+":""}${a}`},Ys={currency:(t,s="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:s}).format(t),unit:t=>`${wo(t)}`},bo=Se.tv({base:["relative inline-flex items-center justify-center whitespace-nowrap rounded-lg border px-3 py-2 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out","disabled:pointer-events-none disabled:shadow-none",ie],variants:{variant:{primary:["border-transparent","text-white dark:text-white","bg-blue-600 dark:bg-blue-500","shadow-[0_16px_8px_rgba(31,31,31,0.01),0_12px_6px_rgba(31,31,31,0.04),0_4px_4px_rgba(31,31,31,0.07),0_1.5px_3px_rgba(31,31,31,0.08),0_0_0_1px_#2563eb,inset_0_1px_2px_hsla(0,0%,100%,0.12)] dark:outline-0 outline outline-2 outline-transparent outline-offset-2","hover:bg-blue-500 dark:hover:bg-blue-600","disabled:bg-blue-100 disabled:text-gray-400","dark:disabled:bg-blue-800 dark:disabled:text-blue-400"],secondary:["border-gray-200 dark:border-gray-800","text-gray-900 dark:text-gray-50","bg-white dark:bg-gray-950","shadow-[0_1px_1px_0.5px_rgba(51,51,51,.04),0_3px_3px_-1.5px_rgba(51,51,51,.02),0_6px_6px_-3px_rgba(51,51,51,.04),0_12px_12px_-6px_rgba(51,51,51,.04),0_24px_24px_-12px_rgba(51,51,51,.04),0_48px_48px_-24px_rgba(51,51,51,.04),0_0_0_1px_rgba(51,51,51,.1),inset_0_-1px_1px_-0.5px_rgba(51,51,51,.06)] outline outline-2 dark:outline-0 outline-transparent outline-offset-2","hover:bg-gray-50 dark:hover:bg-gray-900/60","disabled:text-gray-400","dark:disabled:text-gray-600"],light:["shadow-none","border-transparent","text-gray-900 dark:text-gray-50","bg-gray-200 dark:bg-gray-900","hover:bg-gray-300/70 dark:hover:bg-gray-800/80","disabled:bg-gray-100 disabled:text-gray-400","dark:disabled:bg-gray-800 dark:disabled:text-gray-600"],ghost:["shadow-none","border-transparent","text-gray-900 dark:text-gray-50","bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800/80","disabled:text-gray-400","dark:disabled:text-gray-600"],destructive:["text-white","border-transparent","bg-red-600 dark:bg-red-700","hover:bg-red-700 dark:hover:bg-red-600","disabled:bg-red-300 disabled:text-white","dark:disabled:bg-red-950 dark:disabled:text-red-400"]}},defaultVariants:{variant:"primary"}}),z=h.forwardRef(({asChild:t,isLoading:s=!1,loadingText:a,className:r,disabled:i,variant:n,children:o,...l},d)=>{const c=t?ps.Slot:"button";return e.jsx(c,{ref:d,className:w(bo({variant:n}),r),disabled:i||s,...l,children:s?e.jsxs("span",{className:"pointer-events-none flex shrink-0 items-center justify-center gap-1.5",children:[e.jsx(C.RiLoader2Fill,{className:"size-4 shrink-0 animate-spin","aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:a||"Loading"}),a||"Loading"]}):o})});z.displayName="Button";function Cs({onReset:t}){return e.jsx("div",{className:"flex flex-col items-center gap-4 h-screen justify-center",children:e.jsx("div",{className:"py-8 px-4 mx-auto max-w-(--breakpoint-xl) pb-64 lg:px-6",children:e.jsxs("div",{className:"mx-auto max-w-(--breakpoint-sm) text-center",children:[e.jsx("h1",{className:"mb-4 text-7xl tracking-tight font-extrabold lg:text-9xl text-red-500 dark:text-primary-500",children:"500"}),e.jsx("p",{className:"mb-3 text-3xl tracking-tight font-bold text-gray-800 md:text-4xl dark:text-white",children:"Something went wrong"}),e.jsxs("p",{className:"mb-4 text-lg text-gray-500 dark:text-gray-400",children:["We are sorry, but there was an unexpected error. ",e.jsx("br",{}),"Please try reloading the page."]}),t&&e.jsx(z,{className:"mt-3",onClick:t,children:"Reload Page"})]})})})}const So="redirect";function ko(t){return t.startsWith("/")&&!t.startsWith("//")}function jo(t,s){return t===s||t.startsWith(`${s}/`)}function Gt(t,s){return!t||!ko(t)||!jo(t,s.home)||t===s.signIn||t===s.signUp?s.home:t}function Ps(t,s){const a=new URLSearchParams({[So]:s});return`${t}?${a.toString()}`}function jr(t,s,a){const r=Gt(s,a);return new URL(r,t).toString()}const Kt=h.createContext({});function Ao({children:t,organizationId:s,id:a}){return e.jsx(Kt.Provider,{value:{organizationId:s,id:a},children:t})}function vo(){return h.useContext(Kt)}function K(){const{organizationId:t}=h.useContext(Kt);if(!t)throw new Error("useOrgId called outside an org-scoped route");return t}function gt(){const{id:t}=h.useContext(Kt);if(!t)throw new Error("useRouteId called outside a detail route");return t}const No=h.createContext(void 0),Ro=({children:t,initialState:s=!1})=>{const[a,r]=h.useState(s);return e.jsx(No.Provider,{value:{flyoutOpen:a,setFlyoutOpen:r},children:t})},ce=({className:t,...s})=>e.jsxs("svg",{"aria-hidden":"true",className:w("text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",t),viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s,children:[e.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),e.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),Ar=h.createContext(null),ea=({children:t})=>{var l,d,c,u;const{client:s}=L(),{organizationId:a}=vo(),r=R.useQuery({queryKey:["organizations"],queryFn:async()=>{const{body:m,status:g}=await s.organization.getOrganizations();if(g!==200)throw g!==401&&X.error("Failed to update organizations list. Please refresh the page or try again later."),new Error("Failed to fetch organizations");return m},retry:!1}),i=R.useQuery({queryKey:["organization",a],queryFn:async()=>{const{body:m,status:g}=await s.organization.getOrganization({params:{organizationId:a}});if(g!==200)throw g!==401&&X.error("Failed to fetch organization. Please try refreshing the page or try again later."),new Error("Failed to fetch organizations");return m},enabled:!!a}),n=((l=i.data)==null?void 0:l.configuration.defaultLocale)??"en",o=((c=(d=i.data)==null?void 0:d.configuration.supportedLocales)==null?void 0:c.sort(m=>m===n?-1:1))||["en"];return e.jsx(Ar.Provider,{value:{defaultLocale:n,supportedLocales:o,organizations:{loading:r.isLoading,data:((u=r.data)==null?void 0:u.list)??[],error:r.isError},organization:{loading:i.isLoading,data:i.data??null,error:i.isError}},children:i.isLoading||r.isLoading?e.jsx("div",{className:"flex justify-center items-center h-screen mt-5",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(ce,{className:"w-12 h-12"}),e.jsx("p",{className:"text-gray-500 text-sm mt-3",children:"Loading data..."})]})}):t})},pe=()=>{const t=h.useContext(Ar);if(!t)throw new Error("useOrganization must be used within a OrganizationProvider");return t},Co=Se.tv({base:w("inline-flex items-center gap-x-1 whitespace-nowrap rounded px-1.5 py-0.5 text-xs font-semibold ring-1"),variants:{variant:{default:["bg-blue-50 text-blue-800 ring-blue-500/30","dark:bg-blue-400/10 dark:text-blue-400 dark:ring-blue-400/30"],neutral:["bg-gray-50 text-gray-700 ring-gray-500/30","dark:bg-gray-400/10 dark:text-gray-300 dark:ring-gray-400/20"],success:["bg-emerald-50 text-emerald-800 ring-emerald-600/30","dark:bg-emerald-400/10 dark:text-emerald-400 dark:ring-emerald-400/20"],error:["bg-red-50 text-red-800 ring-red-600/20","dark:bg-red-400/10 dark:text-red-400 dark:ring-red-400/20"],warning:["bg-yellow-50 text-yellow-800 ring-yellow-600/30","dark:bg-yellow-400/10 dark:text-yellow-500 dark:ring-yellow-400/20"]}},defaultVariants:{variant:"default"}}),ht=h.forwardRef(({className:t,variant:s,...a},r)=>e.jsx("span",{ref:r,className:w(Co({variant:s}),t),...a}));ht.displayName="Badge";function Po({title:t,change:s,value:a,valueDescription:r,subtitle:i,ctaDescription:n,ctaText:o,ctaLink:l,data:d}){return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-bold text-gray-900 sm:text-sm dark:text-gray-50",children:t}),e.jsx(ht,{variant:"neutral",children:s})]}),e.jsxs("p",{className:"mt-2 flex items-baseline gap-2",children:[e.jsx("span",{className:"text-xl text-gray-900 dark:text-gray-50",children:a}),e.jsx("span",{className:"text-sm text-gray-500",children:r})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:i}),e.jsx("div",{className:"mt-2 flex items-center gap-0.5",children:d.map(c=>e.jsx("div",{className:w(c.color,"h-1.5 rounded-full"),style:{width:`${c.percentage}%`}},c.title))})]}),e.jsx("ul",{role:"list",className:"mt-5 space-y-2",children:d.map(c=>e.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:w(c.color,"size-2.5 rounded-sm"),"aria-hidden":"true"}),e.jsx("span",{className:"text-gray-900 dark:text-gray-50",children:c.title}),e.jsxs("span",{className:"text-gray-600 dark:text-gray-400",children:["(",c.value," / ",c.percentage,"%)"]})]},c.title))})]}),e.jsxs("p",{className:"mt-6 text-xs text-gray-500",children:[n," ",e.jsx("a",{href:l,className:"text-blue-600 dark:text-blue-400",children:o})]})]})})}const cs=[{date:"2023-01-01T00:00:00","Rows written":3093,"Rows read":22633,Queries:448,"Payments completed":71,"Sign ups":60,Logins:1664,"Sign outs":1133,"Support calls":5},{date:"2023-01-02T00:00:00","Rows written":3061,"Rows read":22587,Queries:484,"Payments completed":88,"Sign ups":79,Logins:1642,"Sign outs":1104,"Support calls":5},{date:"2023-01-03T00:00:00","Rows written":3062,"Rows read":22079,Queries:487,"Payments completed":100,"Sign ups":75,Logins:1525,"Sign outs":1083,"Support calls":6},{date:"2023-01-04T00:00:00","Rows written":3076,"Rows read":21412,Queries:487,"Payments completed":122,"Sign ups":61,Logins:1211,"Sign outs":1017,"Support calls":7},{date:"2023-01-05T00:00:00","Rows written":3066,"Rows read":20679,Queries:484,"Payments completed":107,"Sign ups":64,Logins:991,"Sign outs":1070,"Support calls":5},{date:"2023-01-06T00:00:00","Rows written":3043,"Rows read":20048,Queries:479,"Payments completed":124,"Sign ups":64,Logins:855,"Sign outs":1115,"Support calls":3},{date:"2023-01-07T00:00:00","Rows written":3026,"Rows read":19335,Queries:369,"Payments completed":105,"Sign ups":55,Logins:875,"Sign outs":1184,"Support calls":3},{date:"2023-01-08T00:00:00","Rows written":3031,"Rows read":19548,Queries:420,"Payments completed":68,"Sign ups":47,Logins:867,"Sign outs":1191,"Support calls":3},{date:"2023-01-09T00:00:00","Rows written":3030,"Rows read":19431,Queries:489,"Payments completed":87,"Sign ups":66,Logins:853,"Sign outs":1156,"Support calls":3},{date:"2023-01-10T00:00:00","Rows written":3024,"Rows read":18802,Queries:493,"Payments completed":90,"Sign ups":76,Logins:976,"Sign outs":1169,"Support calls":2},{date:"2023-01-11T00:00:00","Rows written":3028,"Rows read":18816,Queries:499,"Payments completed":89,"Sign ups":72,Logins:1191,"Sign outs":1170,"Support calls":2},{date:"2023-01-12T00:00:00","Rows written":3049,"Rows read":19225,Queries:500,"Payments completed":91,"Sign ups":76,Logins:1235,"Sign outs":1129,"Support calls":3},{date:"2023-01-13T00:00:00","Rows written":3066,"Rows read":19467,Queries:505,"Payments completed":123,"Sign ups":64,Logins:1060,"Sign outs":1196,"Support calls":5},{date:"2023-01-14T00:00:00","Rows written":3049,"Rows read":19950,Queries:418,"Payments completed":87,"Sign ups":61,Logins:915,"Sign outs":1174,"Support calls":6},{date:"2023-01-15T00:00:00","Rows written":3018,"Rows read":19814,Queries:422,"Payments completed":103,"Sign ups":46,Logins:1026,"Sign outs":1155,"Support calls":6},{date:"2023-01-16T00:00:00","Rows written":2976,"Rows read":19962,Queries:490,"Payments completed":118,"Sign ups":62,Logins:1199,"Sign outs":1060,"Support calls":7},{date:"2023-01-17T00:00:00","Rows written":2939,"Rows read":19931,Queries:484,"Payments completed":96,"Sign ups":61,Logins:1344,"Sign outs":1076,"Support calls":7},{date:"2023-01-18T00:00:00","Rows written":2931,"Rows read":19650,Queries:480,"Payments completed":124,"Sign ups":64,Logins:1203,"Sign outs":1100,"Support calls":7},{date:"2023-01-19T00:00:00","Rows written":2935,"Rows read":19592,Queries:479,"Payments completed":112,"Sign ups":67,Logins:1351,"Sign outs":1046,"Support calls":5},{date:"2023-01-20T00:00:00","Rows written":2962,"Rows read":19214,Queries:478,"Payments completed":121,"Sign ups":80,Logins:1379,"Sign outs":945,"Support calls":3},{date:"2023-01-21T00:00:00","Rows written":2965,"Rows read":19460,Queries:385,"Payments completed":88,"Sign ups":60,Logins:1460,"Sign outs":912,"Support calls":2},{date:"2023-01-22T00:00:00","Rows written":2969,"Rows read":19151,Queries:373,"Payments completed":77,"Sign ups":70,Logins:1704,"Sign outs":904,"Support calls":2},{date:"2023-01-23T00:00:00","Rows written":2945,"Rows read":19301,Queries:499,"Payments completed":85,"Sign ups":62,Logins:1951,"Sign outs":916,"Support calls":2},{date:"2023-01-24T00:00:00","Rows written":2933,"Rows read":19614,Queries:501,"Payments completed":80,"Sign ups":61,Logins:1768,"Sign outs":914,"Support calls":2},{date:"2023-01-25T00:00:00","Rows written":2910,"Rows read":19470,Queries:497,"Payments completed":100,"Sign ups":66,Logins:1811,"Sign outs":924,"Support calls":2},{date:"2023-01-26T00:00:00","Rows written":2904,"Rows read":19632,Queries:492,"Payments completed":82,"Sign ups":68,Logins:2048,"Sign outs":914,"Support calls":2},{date:"2023-01-27T00:00:00","Rows written":2905,"Rows read":19706,Queries:488,"Payments completed":87,"Sign ups":60,Logins:1853,"Sign outs":958,"Support calls":2},{date:"2023-01-28T00:00:00","Rows written":2881,"Rows read":20284,Queries:422,"Payments completed":77,"Sign ups":63,Logins:1693,"Sign outs":1e3,"Support calls":2},{date:"2023-01-29T00:00:00","Rows written":2851,"Rows read":20142,Queries:418,"Payments completed":74,"Sign ups":54,Logins:1637,"Sign outs":1048,"Support calls":2},{date:"2023-01-30T00:00:00","Rows written":2859,"Rows read":19518,Queries:490,"Payments completed":89,"Sign ups":79,Logins:1847,"Sign outs":1077,"Support calls":3},{date:"2023-01-31T00:00:00","Rows written":2855,"Rows read":19639,Queries:491,"Payments completed":94,"Sign ups":67,Logins:1972,"Sign outs":1036,"Support calls":4},{date:"2023-02-01T00:00:00","Rows written":2839,"Rows read":19806,Queries:494,"Payments completed":82,"Sign ups":60,Logins:1818,"Sign outs":938,"Support calls":3},{date:"2023-02-02T00:00:00","Rows written":2840,"Rows read":19498,Queries:494,"Payments completed":86,"Sign ups":60,Logins:1437,"Sign outs":937,"Support calls":3},{date:"2023-02-03T00:00:00","Rows written":2861,"Rows read":18849,Queries:489,"Payments completed":81,"Sign ups":65,Logins:1420,"Sign outs":1025,"Support calls":4},{date:"2023-02-04T00:00:00","Rows written":2892,"Rows read":19077,Queries:379,"Payments completed":66,"Sign ups":56,Logins:1622,"Sign outs":1124,"Support calls":3},{date:"2023-02-05T00:00:00","Rows written":2892,"Rows read":19313,Queries:398,"Payments completed":69,"Sign ups":52,Logins:1847,"Sign outs":1150,"Support calls":3},{date:"2023-02-06T00:00:00","Rows written":2870,"Rows read":18922,Queries:494,"Payments completed":89,"Sign ups":61,Logins:2020,"Sign outs":1199,"Support calls":4},{date:"2023-02-07T00:00:00","Rows written":2849,"Rows read":18994,Queries:491,"Payments completed":80,"Sign ups":65,Logins:2035,"Sign outs":1198,"Support calls":5},{date:"2023-02-08T00:00:00","Rows written":2826,"Rows read":18675,Queries:493,"Payments completed":85,"Sign ups":61,Logins:2044,"Sign outs":1180,"Support calls":5},{date:"2023-02-09T00:00:00","Rows written":2810,"Rows read":18103,Queries:493,"Payments completed":90,"Sign ups":61,Logins:1899,"Sign outs":1198,"Support calls":4},{date:"2023-02-10T00:00:00","Rows written":2779,"Rows read":18138,Queries:498,"Payments completed":87,"Sign ups":62,Logins:1478,"Sign outs":1196,"Support calls":4},{date:"2023-02-11T00:00:00","Rows written":2739,"Rows read":18141,Queries:414,"Payments completed":71,"Sign ups":63,Logins:1158,"Sign outs":1194,"Support calls":5},{date:"2023-02-12T00:00:00","Rows written":2717,"Rows read":18061,Queries:431,"Payments completed":68,"Sign ups":60,Logins:850,"Sign outs":1197,"Support calls":4},{date:"2023-02-13T00:00:00","Rows written":2698,"Rows read":18111,Queries:487,"Payments completed":81,"Sign ups":70,Logins:871,"Sign outs":1109,"Support calls":5},{date:"2023-02-14T00:00:00","Rows written":2685,"Rows read":18265,Queries:485,"Payments completed":106,"Sign ups":63,Logins:849,"Sign outs":958,"Support calls":6},{date:"2023-02-15T00:00:00","Rows written":2676,"Rows read":18603,Queries:488,"Payments completed":86,"Sign ups":79,Logins:874,"Sign outs":910,"Support calls":7},{date:"2023-02-16T00:00:00","Rows written":2681,"Rows read":18967,Queries:488,"Payments completed":81,"Sign ups":76,Logins:862,"Sign outs":928,"Support calls":10},{date:"2023-02-17T00:00:00","Rows written":2699,"Rows read":19166,Queries:484,"Payments completed":85,"Sign ups":62,Logins:864,"Sign outs":904,"Support calls":13},{date:"2023-02-18T00:00:00","Rows written":2710,"Rows read":18711,Queries:430,"Payments completed":66,"Sign ups":52,Logins:918,"Sign outs":952,"Support calls":16},{date:"2023-02-19T00:00:00","Rows written":2694,"Rows read":18862,Queries:398,"Payments completed":69,"Sign ups":60,Logins:968,"Sign outs":911,"Support calls":15},{date:"2023-02-20T00:00:00","Rows written":2679,"Rows read":18473,Queries:494,"Payments completed":80,"Sign ups":73,Logins:1142,"Sign outs":906,"Support calls":16},{date:"2023-02-21T00:00:00","Rows written":2684,"Rows read":18663,Queries:497,"Payments completed":93,"Sign ups":61,Logins:1360,"Sign outs":911,"Support calls":16},{date:"2023-02-22T00:00:00","Rows written":2678,"Rows read":18562,Queries:498,"Payments completed":83,"Sign ups":72,Logins:1691,"Sign outs":901,"Support calls":18},{date:"2023-02-23T00:00:00","Rows written":2669,"Rows read":18132,Queries:499,"Payments completed":105,"Sign ups":62,Logins:1862,"Sign outs":916,"Support calls":10},{date:"2023-02-24T00:00:00","Rows written":2674,"Rows read":18392,Queries:499,"Payments completed":117,"Sign ups":66,Logins:2003,"Sign outs":906,"Support calls":8},{date:"2023-02-25T00:00:00","Rows written":2667,"Rows read":19037,Queries:386,"Payments completed":94,"Sign ups":67,Logins:2006,"Sign outs":914,"Support calls":7},{date:"2023-02-26T00:00:00","Rows written":2689,"Rows read":19828,Queries:385,"Payments completed":105,"Sign ups":62,Logins:2007,"Sign outs":956,"Support calls":4},{date:"2023-02-27T00:00:00","Rows written":2680,"Rows read":20667,Queries:497,"Payments completed":115,"Sign ups":62,Logins:1742,"Sign outs":903,"Support calls":4},{date:"2023-02-28T00:00:00","Rows written":2686,"Rows read":20929,Queries:494,"Payments completed":84,"Sign ups":66,Logins:1910,"Sign outs":920,"Support calls":3},{date:"2023-03-01T00:00:00","Rows written":2694,"Rows read":20639,Queries:495,"Payments completed":85,"Sign ups":63,Logins:1766,"Sign outs":916,"Support calls":3},{date:"2023-03-02T00:00:00","Rows written":2687,"Rows read":19941,Queries:495,"Payments completed":82,"Sign ups":65,Logins:1674,"Sign outs":924,"Support calls":2},{date:"2023-03-03T00:00:00","Rows written":2708,"Rows read":19420,Queries:491,"Payments completed":102,"Sign ups":66,Logins:1785,"Sign outs":912,"Support calls":2},{date:"2023-03-04T00:00:00","Rows written":2741,"Rows read":18773,Queries:415,"Payments completed":78,"Sign ups":52,Logins:1732,"Sign outs":903,"Support calls":2},{date:"2023-03-05T00:00:00","Rows written":2783,"Rows read":18993,Queries:402,"Payments completed":64,"Sign ups":47,Logins:1813,"Sign outs":912,"Support calls":2},{date:"2023-03-06T00:00:00","Rows written":2819,"Rows read":18895,Queries:493,"Payments completed":80,"Sign ups":67,Logins:1938,"Sign outs":932,"Support calls":2},{date:"2023-03-07T00:00:00","Rows written":2856,"Rows read":19163,Queries:488,"Payments completed":118,"Sign ups":75,Logins:1798,"Sign outs":904,"Support calls":2},{date:"2023-03-08T00:00:00","Rows written":2870,"Rows read":19383,Queries:483,"Payments completed":123,"Sign ups":75,Logins:1866,"Sign outs":901,"Support calls":3},{date:"2023-03-09T00:00:00","Rows written":2855,"Rows read":19523,Queries:483,"Payments completed":118,"Sign ups":61,Logins:1640,"Sign outs":910,"Support calls":5},{date:"2023-03-10T00:00:00","Rows written":2819,"Rows read":19186,Queries:480,"Payments completed":124,"Sign ups":65,Logins:1274,"Sign outs":903,"Support calls":4},{date:"2023-03-11T00:00:00","Rows written":2785,"Rows read":18841,Queries:415,"Payments completed":97,"Sign ups":52,Logins:895,"Sign outs":913,"Support calls":4},{date:"2023-03-12T00:00:00","Rows written":2787,"Rows read":18357,Queries:390,"Payments completed":71,"Sign ups":50,Logins:861,"Sign outs":906,"Support calls":3},{date:"2023-03-13T00:00:00","Rows written":2810,"Rows read":18455,Queries:496,"Payments completed":94,"Sign ups":67,Logins:853,"Sign outs":914,"Support calls":4},{date:"2023-03-14T00:00:00","Rows written":2827,"Rows read":18791,Queries:494,"Payments completed":92,"Sign ups":77,Logins:860,"Sign outs":902,"Support calls":6},{date:"2023-03-15T00:00:00","Rows written":2855,"Rows read":19023,Queries:493,"Payments completed":94,"Sign ups":80,Logins:922,"Sign outs":971,"Support calls":7},{date:"2023-03-16T00:00:00","Rows written":2895,"Rows read":19666,Queries:495,"Payments completed":122,"Sign ups":76,Logins:1127,"Sign outs":1019,"Support calls":5},{date:"2023-03-17T00:00:00","Rows written":2912,"Rows read":20299,Queries:497,"Payments completed":114,"Sign ups":61,Logins:1055,"Sign outs":953,"Support calls":2},{date:"2023-03-18T00:00:00","Rows written":2924,"Rows read":20036,Queries:386,"Payments completed":95,"Sign ups":60,Logins:1158,"Sign outs":988,"Support calls":2},{date:"2023-03-19T00:00:00","Rows written":2953,"Rows read":20010,Queries:408,"Payments completed":71,"Sign ups":58,Logins:1438,"Sign outs":954,"Support calls":2},{date:"2023-03-20T00:00:00","Rows written":2939,"Rows read":19601,Queries:492,"Payments completed":87,"Sign ups":70,Logins:1332,"Sign outs":906,"Support calls":3},{date:"2023-03-21T00:00:00","Rows written":2932,"Rows read":19406,Queries:495,"Payments completed":120,"Sign ups":75,Logins:1102,"Sign outs":918,"Support calls":5},{date:"2023-03-22T00:00:00","Rows written":2951,"Rows read":19742,Queries:497,"Payments completed":110,"Sign ups":75,Logins:951,"Sign outs":922,"Support calls":8},{date:"2023-03-23T00:00:00","Rows written":2937,"Rows read":19329,Queries:503,"Payments completed":103,"Sign ups":75,Logins:846,"Sign outs":921,"Support calls":12},{date:"2023-03-24T00:00:00","Rows written":2945,"Rows read":19646,Queries:511,"Payments completed":118,"Sign ups":71,Logins:850,"Sign outs":926,"Support calls":14},{date:"2023-03-25T00:00:00","Rows written":2947,"Rows read":19271,Queries:426,"Payments completed":97,"Sign ups":67,Logins:878,"Sign outs":923,"Support calls":14},{date:"2023-03-26T00:00:00","Rows written":2945,"Rows read":18842,Queries:382,"Payments completed":98,"Sign ups":67,Logins:851,"Sign outs":924,"Support calls":10},{date:"2023-03-26T00:00:00","Rows written":2926,"Rows read":18999,Queries:498,"Payments completed":118,"Sign ups":73,Logins:872,"Sign outs":1009,"Support calls":13},{date:"2023-03-27T00:00:00","Rows written":2945,"Rows read":19312,Queries:499,"Payments completed":123,"Sign ups":62,Logins:863,"Sign outs":958,"Support calls":15},{date:"2023-03-28T00:00:00","Rows written":2937,"Rows read":19258,Queries:502,"Payments completed":118,"Sign ups":80,Logins:901,"Sign outs":927,"Support calls":12},{date:"2023-03-29T00:00:00","Rows written":2908,"Rows read":19567,Queries:501,"Payments completed":120,"Sign ups":74,Logins:845,"Sign outs":967,"Support calls":11},{date:"2023-03-30T00:00:00","Rows written":2876,"Rows read":19888,Queries:497,"Payments completed":120,"Sign ups":61,Logins:869,"Sign outs":1080,"Support calls":6},{date:"2023-03-31T00:00:00","Rows written":2855,"Rows read":20292,Queries:438,"Payments completed":70,"Sign ups":53,Logins:865,"Sign outs":1057,"Support calls":5},{date:"2023-04-01T00:00:00","Rows written":2845,"Rows read":20739,Queries:403,"Payments completed":61,"Sign ups":60,Logins:860,"Sign outs":987,"Support calls":7},{date:"2023-04-02T00:00:00","Rows written":2838,"Rows read":20633,Queries:493,"Payments completed":81,"Sign ups":66,Logins:867,"Sign outs":905,"Support calls":12},{date:"2023-04-03T00:00:00","Rows written":2832,"Rows read":21003,Queries:496,"Payments completed":82,"Sign ups":60,Logins:867,"Sign outs":934,"Support calls":13},{date:"2023-04-04T00:00:00","Rows written":2825,"Rows read":20648,Queries:500,"Payments completed":81,"Sign ups":66,Logins:963,"Sign outs":1002,"Support calls":14},{date:"2023-04-05T00:00:00","Rows written":2819,"Rows read":20691,Queries:504,"Payments completed":105,"Sign ups":64,Logins:1027,"Sign outs":1046,"Support calls":15},{date:"2023-04-06T00:00:00","Rows written":2823,"Rows read":20393,Queries:510,"Payments completed":121,"Sign ups":64,Logins:1171,"Sign outs":1101,"Support calls":10},{date:"2023-04-07T00:00:00","Rows written":2805,"Rows read":20582,Queries:412,"Payments completed":95,"Sign ups":54,Logins:1199,"Sign outs":1193,"Support calls":9},{date:"2023-04-08T00:00:00","Rows written":2805,"Rows read":20673,Queries:400,"Payments completed":75,"Sign ups":52,Logins:1208,"Sign outs":1168,"Support calls":5},{date:"2023-04-09T00:00:00","Rows written":2794,"Rows read":20134,Queries:494,"Payments completed":107,"Sign ups":64,Logins:1452,"Sign outs":1189,"Support calls":6},{date:"2023-04-10T00:00:00","Rows written":2802,"Rows read":19757,Queries:489,"Payments completed":121,"Sign ups":63,Logins:1464,"Sign outs":1195,"Support calls":6},{date:"2023-04-11T00:00:00","Rows written":2803,"Rows read":20053,Queries:486,"Payments completed":100,"Sign ups":60,Logins:1512,"Sign outs":1199,"Support calls":5},{date:"2023-04-12T00:00:00","Rows written":2812,"Rows read":19604,Queries:483,"Payments completed":120,"Sign ups":61,Logins:1360,"Sign outs":1193,"Support calls":3},{date:"2023-04-13T00:00:00","Rows written":2822,"Rows read":19715,Queries:478,"Payments completed":122,"Sign ups":69,Logins:1038,"Sign outs":1184,"Support calls":3},{date:"2023-04-14T00:00:00","Rows written":2819,"Rows read":20002,Queries:367,"Payments completed":82,"Sign ups":61,Logins:844,"Sign outs":1163,"Support calls":3},{date:"2023-04-15T00:00:00","Rows written":2805,"Rows read":20661,Queries:430,"Payments completed":70,"Sign ups":62,Logins:855,"Sign outs":1044,"Support calls":2},{date:"2023-04-16T00:00:00","Rows written":2826,"Rows read":21525,Queries:487,"Payments completed":81,"Sign ups":63,Logins:973,"Sign outs":1e3,"Support calls":2},{date:"2023-04-17T00:00:00","Rows written":2812,"Rows read":21431,Queries:491,"Payments completed":90,"Sign ups":61,Logins:1065,"Sign outs":908,"Support calls":2},{date:"2023-04-18T00:00:00","Rows written":2825,"Rows read":21171,Queries:493,"Payments completed":122,"Sign ups":64,Logins:1071,"Sign outs":922,"Support calls":2},{date:"2023-04-19T00:00:00","Rows written":2841,"Rows read":20561,Queries:495,"Payments completed":123,"Sign ups":73,Logins:1065,"Sign outs":907,"Support calls":3},{date:"2023-04-20T00:00:00","Rows written":2875,"Rows read":20802,Queries:494,"Payments completed":125,"Sign ups":63,Logins:1191,"Sign outs":906,"Support calls":3},{date:"2023-04-21T00:00:00","Rows written":2873,"Rows read":20844,Queries:408,"Payments completed":92,"Sign ups":51,Logins:1415,"Sign outs":925,"Support calls":2},{date:"2023-04-22T00:00:00","Rows written":2850,"Rows read":20898,Queries:372,"Payments completed":82,"Sign ups":57,Logins:1744,"Sign outs":905,"Support calls":2},{date:"2023-04-23T00:00:00","Rows written":2833,"Rows read":20662,Queries:500,"Payments completed":91,"Sign ups":62,Logins:2017,"Sign outs":908,"Support calls":3},{date:"2023-04-24T00:00:00","Rows written":2820,"Rows read":20361,Queries:494,"Payments completed":124,"Sign ups":79,Logins:1911,"Sign outs":913,"Support calls":4},{date:"2023-04-25T00:00:00","Rows written":2820,"Rows read":19629,Queries:489,"Payments completed":113,"Sign ups":70,Logins:2014,"Sign outs":939,"Support calls":4},{date:"2023-04-26T00:00:00","Rows written":2837,"Rows read":19197,Queries:486,"Payments completed":115,"Sign ups":63,Logins:2004,"Sign outs":963,"Support calls":3},{date:"2023-04-27T00:00:00","Rows written":2852,"Rows read":19201,Queries:481,"Payments completed":113,"Sign ups":63,Logins:2029,"Sign outs":903,"Support calls":3},{date:"2023-04-28T00:00:00","Rows written":2832,"Rows read":19708,Queries:405,"Payments completed":88,"Sign ups":50,Logins:2012,"Sign outs":916,"Support calls":3},{date:"2023-04-29T00:00:00","Rows written":2808,"Rows read":20513,Queries:393,"Payments completed":94,"Sign ups":48,Logins:1745,"Sign outs":983,"Support calls":2},{date:"2023-04-30T00:00:00","Rows written":2815,"Rows read":20545,Queries:495,"Payments completed":82,"Sign ups":64,Logins:1784,"Sign outs":1063,"Support calls":2},{date:"2023-05-01T00:00:00","Rows written":2804,"Rows read":20774,Queries:491,"Payments completed":84,"Sign ups":62,Logins:1883,"Sign outs":1199,"Support calls":2},{date:"2023-05-02T00:00:00","Rows written":2786,"Rows read":21453,Queries:489,"Payments completed":81,"Sign ups":62,Logins:1806,"Sign outs":1188,"Support calls":2},{date:"2023-05-03T00:00:00","Rows written":2786,"Rows read":21543,Queries:484,"Payments completed":106,"Sign ups":61,Logins:1967,"Sign outs":1175,"Support calls":3},{date:"2023-05-04T00:00:00","Rows written":2775,"Rows read":21089,Queries:484,"Payments completed":122,"Sign ups":62,Logins:1956,"Sign outs":1186,"Support calls":4},{date:"2023-05-05T00:00:00","Rows written":2784,"Rows read":20388,Queries:435,"Payments completed":90,"Sign ups":53,Logins:2032,"Sign outs":1179,"Support calls":3},{date:"2023-05-06T00:00:00","Rows written":2779,"Rows read":19678,Queries:386,"Payments completed":99,"Sign ups":47,Logins:1984,"Sign outs":1189,"Support calls":2},{date:"2023-05-07T00:00:00","Rows written":2763,"Rows read":19046,Queries:496,"Payments completed":115,"Sign ups":68,Logins:2021,"Sign outs":1195,"Support calls":2},{date:"2023-05-08T00:00:00","Rows written":2738,"Rows read":19152,Queries:500,"Payments completed":121,"Sign ups":80,Logins:1641,"Sign outs":1197,"Support calls":2},{date:"2023-05-09T00:00:00","Rows written":2738,"Rows read":18656,Queries:506,"Payments completed":81,"Sign ups":75,Logins:1286,"Sign outs":1184,"Support calls":2},{date:"2023-05-10T00:00:00","Rows written":2715,"Rows read":18455,Queries:507,"Payments completed":87,"Sign ups":79,Logins:987,"Sign outs":1195,"Support calls":2},{date:"2023-05-11T00:00:00","Rows written":2714,"Rows read":18037,Queries:505,"Payments completed":87,"Sign ups":79,Logins:953,"Sign outs":1198,"Support calls":2},{date:"2023-05-12T00:00:00","Rows written":2714,"Rows read":18119,Queries:422,"Payments completed":105,"Sign ups":55,Logins:1059,"Sign outs":1180,"Support calls":2},{date:"2023-05-13T00:00:00","Rows written":2717,"Rows read":18102,Queries:436,"Payments completed":94,"Sign ups":52,Logins:1153,"Sign outs":1191,"Support calls":2},{date:"2023-05-14T00:00:00","Rows written":2735,"Rows read":18080,Queries:487,"Payments completed":122,"Sign ups":61,Logins:1033,"Sign outs":1168,"Support calls":2},{date:"2023-05-15T00:00:00","Rows written":2756,"Rows read":18124,Queries:484,"Payments completed":99,"Sign ups":65,Logins:846,"Sign outs":1179,"Support calls":2},{date:"2023-05-16T00:00:00","Rows written":2757,"Rows read":18008,Queries:478,"Payments completed":125,"Sign ups":65,Logins:891,"Sign outs":1132,"Support calls":2},{date:"2023-05-17T00:00:00","Rows written":2752,"Rows read":18076,Queries:478,"Payments completed":113,"Sign ups":63,Logins:923,"Sign outs":1003,"Support calls":2},{date:"2023-05-18T00:00:00","Rows written":2772,"Rows read":18027,Queries:479,"Payments completed":84,"Sign ups":61,Logins:1115,"Sign outs":974,"Support calls":2},{date:"2023-05-19T00:00:00","Rows written":2796,"Rows read":18099,Queries:387,"Payments completed":78,"Sign ups":52,Logins:1374,"Sign outs":1e3,"Support calls":2},{date:"2023-05-20T00:00:00","Rows written":2793,"Rows read":18002,Queries:431,"Payments completed":84,"Sign ups":54,Logins:1622,"Sign outs":1067,"Support calls":2},{date:"2023-05-21T00:00:00","Rows written":2782,"Rows read":18012,Queries:488,"Payments completed":81,"Sign ups":74,Logins:1612,"Sign outs":1182,"Support calls":3},{date:"2023-05-22T00:00:00","Rows written":2794,"Rows read":18004,Queries:485,"Payments completed":87,"Sign ups":74,Logins:1668,"Sign outs":1173,"Support calls":3},{date:"2023-05-23T00:00:00","Rows written":2824,"Rows read":18446,Queries:481,"Payments completed":103,"Sign ups":67,Logins:1579,"Sign outs":1175,"Support calls":4},{date:"2023-05-24T00:00:00","Rows written":2862,"Rows read":18357,Queries:479,"Payments completed":96,"Sign ups":72,Logins:1294,"Sign outs":1188,"Support calls":6},{date:"2023-05-25T00:00:00","Rows written":2910,"Rows read":18021,Queries:478,"Payments completed":83,"Sign ups":79,Logins:1214,"Sign outs":1172,"Support calls":6},{date:"2023-05-26T00:00:00","Rows written":2949,"Rows read":18094,Queries:379,"Payments completed":66,"Sign ups":62,Logins:1054,"Sign outs":1199,"Support calls":4},{date:"2023-05-27T00:00:00","Rows written":2983,"Rows read":18053,Queries:390,"Payments completed":68,"Sign ups":63,Logins:1034,"Sign outs":1178,"Support calls":2},{date:"2023-05-28T00:00:00","Rows written":2978,"Rows read":18022,Queries:496,"Payments completed":92,"Sign ups":61,Logins:845,"Sign outs":1180,"Support calls":2},{date:"2023-05-29T00:00:00","Rows written":2963,"Rows read":18416,Queries:494,"Payments completed":93,"Sign ups":80,Logins:881,"Sign outs":1179,"Support calls":2},{date:"2023-05-30T00:00:00","Rows written":2949,"Rows read":18270,Queries:496,"Payments completed":81,"Sign ups":71,Logins:925,"Sign outs":1194,"Support calls":2},{date:"2023-05-31T00:00:00","Rows written":2965,"Rows read":18034,Queries:500,"Payments completed":80,"Sign ups":70,Logins:879,"Sign outs":1195,"Support calls":2},{date:"2023-06-01T00:00:00","Rows written":2970,"Rows read":18061,Queries:506,"Payments completed":95,"Sign ups":77,Logins:924,"Sign outs":1120,"Support calls":2},{date:"2023-06-02T00:00:00","Rows written":2974,"Rows read":18180,Queries:425,"Payments completed":74,"Sign ups":54,Logins:853,"Sign outs":1146,"Support calls":2},{date:"2023-06-03T00:00:00","Rows written":3004,"Rows read":18022,Queries:384,"Payments completed":74,"Sign ups":48,Logins:877,"Sign outs":1153,"Support calls":2},{date:"2023-06-04T00:00:00","Rows written":3033,"Rows read":18091,Queries:497,"Payments completed":102,"Sign ups":66,Logins:896,"Sign outs":1199,"Support calls":2},{date:"2023-06-05T00:00:00","Rows written":3033,"Rows read":18398,Queries:500,"Payments completed":101,"Sign ups":76,Logins:1053,"Sign outs":1118,"Support calls":2},{date:"2023-06-06T00:00:00","Rows written":3028,"Rows read":18439,Queries:505,"Payments completed":83,"Sign ups":74,Logins:1009,"Sign outs":1029,"Support calls":3},{date:"2023-06-07T00:00:00","Rows written":3008,"Rows read":18750,Queries:505,"Payments completed":82,"Sign ups":72,Logins:884,"Sign outs":997,"Support calls":4},{date:"2023-06-08T00:00:00","Rows written":3e3,"Rows read":19398,Queries:509,"Payments completed":80,"Sign ups":78,Logins:1003,"Sign outs":1069,"Support calls":5},{date:"2023-06-09T00:00:00","Rows written":2975,"Rows read":19233,Queries:442,"Payments completed":68,"Sign ups":54,Logins:1182,"Sign outs":1169,"Support calls":4},{date:"2023-06-10T00:00:00","Rows written":2958,"Rows read":19593,Queries:430,"Payments completed":65,"Sign ups":63,Logins:1129,"Sign outs":1161,"Support calls":4},{date:"2023-06-11T00:00:00","Rows written":2966,"Rows read":20333,Queries:488,"Payments completed":84,"Sign ups":61,Logins:1009,"Sign outs":1199,"Support calls":4},{date:"2023-06-12T00:00:00","Rows written":2988,"Rows read":20156,Queries:491,"Payments completed":98,"Sign ups":64,Logins:924,"Sign outs":1194,"Support calls":3},{date:"2023-06-13T00:00:00","Rows written":2973,"Rows read":19662,Queries:488,"Payments completed":106,"Sign ups":67,Logins:870,"Sign outs":1176,"Support calls":4},{date:"2023-06-14T00:00:00","Rows written":2951,"Rows read":19450,Queries:483,"Payments completed":122,"Sign ups":60,Logins:877,"Sign outs":1167,"Support calls":3},{date:"2023-06-15T00:00:00","Rows written":2917,"Rows read":19681,Queries:478,"Payments completed":97,"Sign ups":66,Logins:853,"Sign outs":1185,"Support calls":4},{date:"2023-06-16T00:00:00","Rows written":2877,"Rows read":19636,Queries:365,"Payments completed":71,"Sign ups":55,Logins:965,"Sign outs":1184,"Support calls":4},{date:"2023-06-17T00:00:00","Rows written":2850,"Rows read":19478,Queries:438,"Payments completed":65,"Sign ups":55,Logins:1101,"Sign outs":1197,"Support calls":2},{date:"2023-06-18T00:00:00","Rows written":2858,"Rows read":19258,Queries:487,"Payments completed":81,"Sign ups":64,Logins:1335,"Sign outs":1106,"Support calls":2},{date:"2023-06-19T00:00:00","Rows written":2880,"Rows read":19348,Queries:487,"Payments completed":118,"Sign ups":73,Logins:1406,"Sign outs":1129,"Support calls":2},{date:"2023-06-20T00:00:00","Rows written":2863,"Rows read":19951,Queries:488,"Payments completed":116,"Sign ups":76,Logins:1378,"Sign outs":1082,"Support calls":2},{date:"2023-06-21T00:00:00","Rows written":2844,"Rows read":20053,Queries:490,"Payments completed":82,"Sign ups":77,Logins:1294,"Sign outs":1073,"Support calls":2},{date:"2023-06-22T00:00:00","Rows written":2830,"Rows read":20493,Queries:489,"Payments completed":83,"Sign ups":61,Logins:1318,"Sign outs":1042,"Support calls":2},{date:"2023-06-23T00:00:00","Rows written":2833,"Rows read":20724,Queries:432,"Payments completed":66,"Sign ups":57,Logins:1076,"Sign outs":1115,"Support calls":2},{date:"2023-06-24T00:00:00","Rows written":2809,"Rows read":20767,Queries:431,"Payments completed":63,"Sign ups":59,Logins:852,"Sign outs":1174,"Support calls":2},{date:"2023-06-25T00:00:00","Rows written":2781,"Rows read":20818,Queries:487,"Payments completed":81,"Sign ups":64,Logins:881,"Sign outs":1173,"Support calls":2},{date:"2023-06-26T00:00:00","Rows written":2748,"Rows read":20673,Queries:490,"Payments completed":95,"Sign ups":78,Logins:914,"Sign outs":1105,"Support calls":2},{date:"2023-06-27T00:00:00","Rows written":2750,"Rows read":19990,Queries:492,"Payments completed":81,"Sign ups":74,Logins:855,"Sign outs":1139,"Support calls":2},{date:"2023-06-28T00:00:00","Rows written":2761,"Rows read":19874,Queries:488,"Payments completed":83,"Sign ups":69,Logins:876,"Sign outs":1073,"Support calls":2},{date:"2023-06-29T00:00:00","Rows written":2787,"Rows read":19812,Queries:486,"Payments completed":83,"Sign ups":76,Logins:900,"Sign outs":1090,"Support calls":3},{date:"2023-06-30T00:00:00","Rows written":2819,"Rows read":19619,Queries:376,"Payments completed":88,"Sign ups":66,Logins:852,"Sign outs":1118,"Support calls":3},{date:"2023-07-01T00:00:00","Rows written":2825,"Rows read":19145,Queries:374,"Payments completed":103,"Sign ups":52,Logins:856,"Sign outs":1153,"Support calls":4},{date:"2023-07-02T00:00:00","Rows written":2825,"Rows read":18490,Queries:499,"Payments completed":120,"Sign ups":64,Logins:878,"Sign outs":1087,"Support calls":3},{date:"2023-07-03T00:00:00","Rows written":2835,"Rows read":18059,Queries:503,"Payments completed":122,"Sign ups":63,Logins:936,"Sign outs":1138,"Support calls":2},{date:"2023-07-04T00:00:00","Rows written":2827,"Rows read":18157,Queries:507,"Payments completed":81,"Sign ups":78,Logins:1006,"Sign outs":1100,"Support calls":2},{date:"2023-07-05T00:00:00","Rows written":2842,"Rows read":18079,Queries:513,"Payments completed":81,"Sign ups":80,Logins:1049,"Sign outs":1090,"Support calls":2},{date:"2023-07-06T00:00:00","Rows written":2834,"Rows read":18317,Queries:515,"Payments completed":86,"Sign ups":62,Logins:1092,"Sign outs":1161,"Support calls":2},{date:"2023-07-07T00:00:00","Rows written":2839,"Rows read":18617,Queries:415,"Payments completed":72,"Sign ups":56,Logins:1210,"Sign outs":1179,"Support calls":2},{date:"2023-07-08T00:00:00","Rows written":2853,"Rows read":19089,Queries:430,"Payments completed":69,"Sign ups":54,Logins:1292,"Sign outs":1155,"Support calls":3},{date:"2023-07-09T00:00:00","Rows written":2850,"Rows read":19081,Queries:488,"Payments completed":89,"Sign ups":63,Logins:1354,"Sign outs":1197,"Support calls":5},{date:"2023-07-10T00:00:00","Rows written":2848,"Rows read":19119,Queries:482,"Payments completed":91,"Sign ups":78,Logins:1513,"Sign outs":1188,"Support calls":7},{date:"2023-07-11T00:00:00","Rows written":2835,"Rows read":19192,Queries:484,"Payments completed":87,"Sign ups":75,Logins:1546,"Sign outs":1195,"Support calls":8},{date:"2023-07-12T00:00:00","Rows written":2833,"Rows read":19322,Queries:484,"Payments completed":85,"Sign ups":78,Logins:1819,"Sign outs":1188,"Support calls":7},{date:"2023-07-13T00:00:00","Rows written":2806,"Rows read":19743,Queries:484,"Payments completed":111,"Sign ups":74,Logins:1954,"Sign outs":1185,"Support calls":6},{date:"2023-07-14T00:00:00","Rows written":2817,"Rows read":19688,Queries:426,"Payments completed":88,"Sign ups":59,Logins:1701,"Sign outs":1194,"Support calls":3},{date:"2023-07-15T00:00:00","Rows written":2795,"Rows read":19641,Queries:367,"Payments completed":101,"Sign ups":55,Logins:1309,"Sign outs":1198,"Support calls":2},{date:"2023-07-16T00:00:00","Rows written":2793,"Rows read":19952,Queries:500,"Payments completed":82,"Sign ups":63,Logins:1329,"Sign outs":1183,"Support calls":2},{date:"2023-07-17T00:00:00","Rows written":2809,"Rows read":20002,Queries:501,"Payments completed":82,"Sign ups":63,Logins:1447,"Sign outs":1118,"Support calls":2},{date:"2023-07-18T00:00:00","Rows written":2798,"Rows read":20051,Queries:497,"Payments completed":88,"Sign ups":74,Logins:1759,"Sign outs":1110,"Support calls":2},{date:"2023-07-19T00:00:00","Rows written":2767,"Rows read":19686,Queries:499,"Payments completed":90,"Sign ups":77,Logins:1931,"Sign outs":1189,"Support calls":2},{date:"2023-07-20T00:00:00","Rows written":2733,"Rows read":19300,Queries:498,"Payments completed":84,"Sign ups":72,Logins:2044,"Sign outs":1196,"Support calls":2},{date:"2023-07-21T00:00:00","Rows written":2704,"Rows read":18593,Queries:440,"Payments completed":66,"Sign ups":67,Logins:2014,"Sign outs":1181,"Support calls":2},{date:"2023-07-22T00:00:00","Rows written":2711,"Rows read":18352,Queries:408,"Payments completed":71,"Sign ups":72,Logins:1729,"Sign outs":1148,"Support calls":2},{date:"2023-07-23T00:00:00","Rows written":2719,"Rows read":18451,Queries:491,"Payments completed":85,"Sign ups":60,Logins:1423,"Sign outs":1027,"Support calls":3},{date:"2023-07-24T00:00:00","Rows written":2708,"Rows read":18006,Queries:490,"Payments completed":109,"Sign ups":66,Logins:1490,"Sign outs":1050,"Support calls":4},{date:"2023-07-25T00:00:00","Rows written":2709,"Rows read":18090,Queries:486,"Payments completed":99,"Sign ups":62,Logins:1458,"Sign outs":1022,"Support calls":6},{date:"2023-07-26T00:00:00","Rows written":2693,"Rows read":18102,Queries:480,"Payments completed":87,"Sign ups":61,Logins:1156,"Sign outs":953,"Support calls":4},{date:"2023-07-27T00:00:00","Rows written":2680,"Rows read":18083,Queries:480,"Payments completed":96,"Sign ups":80,Logins:1031,"Sign outs":907,"Support calls":4},{date:"2023-07-28T00:00:00","Rows written":2663,"Rows read":18029,Queries:370,"Payments completed":93,"Sign ups":60,Logins:966,"Sign outs":903,"Support calls":5},{date:"2023-07-29T00:00:00","Rows written":2630,"Rows read":18005,Queries:383,"Payments completed":99,"Sign ups":57,Logins:896,"Sign outs":918,"Support calls":7},{date:"2023-07-30T00:00:00","Rows written":2606,"Rows read":18020,Queries:496,"Payments completed":124,"Sign ups":66,Logins:1026,"Sign outs":922,"Support calls":9},{date:"2023-07-31T00:00:00","Rows written":2575,"Rows read":18242,Queries:501,"Payments completed":124,"Sign ups":60,Logins:961,"Sign outs":915,"Support calls":10},{date:"2023-08-01T00:00:00","Rows written":2573,"Rows read":18143,Queries:501,"Payments completed":89,"Sign ups":60,Logins:850,"Sign outs":913,"Support calls":15},{date:"2023-08-02T00:00:00","Rows written":2592,"Rows read":18373,Queries:505,"Payments completed":114,"Sign ups":61,Logins:868,"Sign outs":901,"Support calls":18},{date:"2023-08-03T00:00:00","Rows written":2592,"Rows read":19002,Queries:506,"Payments completed":123,"Sign ups":77,Logins:939,"Sign outs":965,"Support calls":17},{date:"2023-08-04T00:00:00","Rows written":2593,"Rows read":19427,Queries:393,"Payments completed":79,"Sign ups":48,Logins:852,"Sign outs":970,"Support calls":16},{date:"2023-08-05T00:00:00","Rows written":2584,"Rows read":19210,Queries:416,"Payments completed":78,"Sign ups":52,Logins:867,"Sign outs":1040,"Support calls":8},{date:"2023-08-06T00:00:00","Rows written":2575,"Rows read":18862,Queries:491,"Payments completed":100,"Sign ups":65,Logins:845,"Sign outs":993,"Support calls":5},{date:"2023-08-07T00:00:00","Rows written":2583,"Rows read":18581,Queries:485,"Payments completed":122,"Sign ups":78,Logins:899,"Sign outs":905,"Support calls":5},{date:"2023-08-08T00:00:00","Rows written":2589,"Rows read":18022,Queries:481,"Payments completed":117,"Sign ups":72,Logins:941,"Sign outs":926,"Support calls":6},{date:"2023-08-09T00:00:00","Rows written":2582,"Rows read":18144,Queries:480,"Payments completed":86,"Sign ups":73,Logins:1132,"Sign outs":903,"Support calls":5},{date:"2023-08-10T00:00:00","Rows written":2558,"Rows read":18725,Queries:478,"Payments completed":83,"Sign ups":80,Logins:1101,"Sign outs":902,"Support calls":4},{date:"2023-08-11T00:00:00","Rows written":2522,"Rows read":18465,Queries:370,"Payments completed":66,"Sign ups":68,Logins:993,"Sign outs":967,"Support calls":4},{date:"2023-08-12T00:00:00","Rows written":2504,"Rows read":18008,Queries:444,"Payments completed":67,"Sign ups":70,Logins:858,"Sign outs":1055,"Support calls":3},{date:"2023-08-13T00:00:00","Rows written":2507,"Rows read":18027,Queries:486,"Payments completed":88,"Sign ups":78,Logins:885,"Sign outs":1120,"Support calls":3},{date:"2023-08-14T00:00:00","Rows written":2506,"Rows read":18071,Queries:482,"Payments completed":107,"Sign ups":77,Logins:912,"Sign outs":1193,"Support calls":4},{date:"2023-08-15T00:00:00","Rows written":2503,"Rows read":18024,Queries:482,"Payments completed":80,"Sign ups":76,Logins:845,"Sign outs":1193,"Support calls":5},{date:"2023-08-16T00:00:00","Rows written":2502,"Rows read":18038,Queries:480,"Payments completed":89,"Sign ups":79,Logins:846,"Sign outs":1161,"Support calls":4},{date:"2023-08-17T00:00:00","Rows written":2503,"Rows read":18118,Queries:478,"Payments completed":83,"Sign ups":72,Logins:867,"Sign outs":1189,"Support calls":3},{date:"2023-08-18T00:00:00","Rows written":2509,"Rows read":18050,Queries:405,"Payments completed":82,"Sign ups":58,Logins:984,"Sign outs":1177,"Support calls":3},{date:"2023-08-19T00:00:00","Rows written":2500,"Rows read":18011,Queries:383,"Payments completed":97,"Sign ups":59,Logins:1006,"Sign outs":1176,"Support calls":3},{date:"2023-08-20T00:00:00","Rows written":2505,"Rows read":18215,Queries:497,"Payments completed":96,"Sign ups":78,Logins:975,"Sign outs":1200,"Support calls":4},{date:"2023-08-21T00:00:00","Rows written":2512,"Rows read":18186,Queries:499,"Payments completed":80,"Sign ups":68,Logins:976,"Sign outs":1148,"Support calls":4},{date:"2023-08-22T00:00:00","Rows written":2501,"Rows read":18401,Queries:501,"Payments completed":80,"Sign ups":74,Logins:1084,"Sign outs":1196,"Support calls":5},{date:"2023-08-23T00:00:00","Rows written":2501,"Rows read":18519,Queries:499,"Payments completed":96,"Sign ups":76,Logins:1130,"Sign outs":1118,"Support calls":6},{date:"2023-08-24T00:00:00","Rows written":2508,"Rows read":18913,Queries:501,"Payments completed":104,"Sign ups":75,Logins:944,"Sign outs":1042,"Support calls":9},{date:"2023-08-25T00:00:00","Rows written":2502,"Rows read":19306,Queries:426,"Payments completed":84,"Sign ups":66,Logins:872,"Sign outs":960,"Support calls":9},{date:"2023-08-26T00:00:00","Rows written":2506,"Rows read":19592,Queries:436,"Payments completed":85,"Sign ups":54,Logins:858,"Sign outs":994,"Support calls":9},{date:"2023-08-27T00:00:00","Rows written":2501,"Rows read":19482,Queries:486,"Payments completed":111,"Sign ups":61,Logins:861,"Sign outs":981,"Support calls":11},{date:"2023-08-28T00:00:00","Rows written":2505,"Rows read":19193,Queries:483,"Payments completed":82,"Sign ups":77,Logins:922,"Sign outs":979,"Support calls":12},{date:"2023-08-29T00:00:00","Rows written":2505,"Rows read":19224,Queries:482,"Payments completed":112,"Sign ups":64,Logins:935,"Sign outs":1026,"Support calls":9},{date:"2023-08-30T00:00:00","Rows written":2515,"Rows read":18795,Queries:482,"Payments completed":123,"Sign ups":62,Logins:845,"Sign outs":1061,"Support calls":10},{date:"2023-08-31T00:00:00","Rows written":2515,"Rows read":18658,Queries:479,"Payments completed":112,"Sign ups":64,Logins:932,"Sign outs":1026,"Support calls":15},{date:"2023-09-01T00:00:00","Rows written":2500,"Rows read":18864,Queries:408,"Payments completed":78,"Sign ups":60,Logins:958,"Sign outs":1054,"Support calls":16},{date:"2023-09-02T00:00:00","Rows written":2506,"Rows read":19030,Queries:416,"Payments completed":71,"Sign ups":49,Logins:943,"Sign outs":1021,"Support calls":12},{date:"2023-09-03T00:00:00","Rows written":2507,"Rows read":18759,Queries:491,"Payments completed":87,"Sign ups":61,Logins:863,"Sign outs":971,"Support calls":10},{date:"2023-09-04T00:00:00","Rows written":2508,"Rows read":19168,Queries:492,"Payments completed":88,"Sign ups":79,Logins:846,"Sign outs":969,"Support calls":8},{date:"2023-09-05T00:00:00","Rows written":2514,"Rows read":19384,Queries:496,"Payments completed":84,"Sign ups":71,Logins:880,"Sign outs":1025,"Support calls":6},{date:"2023-09-06T00:00:00","Rows written":2541,"Rows read":18965,Queries:496,"Payments completed":81,"Sign ups":62,Logins:852,"Sign outs":999,"Support calls":6},{date:"2023-09-07T00:00:00","Rows written":2531,"Rows read":18810,Queries:498,"Payments completed":80,"Sign ups":67,Logins:856,"Sign outs":946,"Support calls":8},{date:"2023-09-08T00:00:00","Rows written":2505,"Rows read":18734,Queries:378,"Payments completed":67,"Sign ups":50,Logins:931,"Sign outs":962,"Support calls":6},{date:"2023-09-09T00:00:00","Rows written":2502,"Rows read":18705,Queries:445,"Payments completed":83,"Sign ups":52,Logins:989,"Sign outs":908,"Support calls":3},{date:"2023-09-10T00:00:00","Rows written":2513,"Rows read":19192,Queries:484,"Payments completed":83,"Sign ups":61,Logins:1148,"Sign outs":901,"Support calls":3},{date:"2023-09-11T00:00:00","Rows written":2540,"Rows read":19588,Queries:484,"Payments completed":92,"Sign ups":79,Logins:1198,"Sign outs":918,"Support calls":3},{date:"2023-09-12T00:00:00","Rows written":2570,"Rows read":20135,Queries:487,"Payments completed":82,"Sign ups":80,Logins:1104,"Sign outs":907,"Support calls":4},{date:"2023-09-13T00:00:00","Rows written":2571,"Rows read":20847,Queries:490,"Payments completed":88,"Sign ups":77,Logins:1082,"Sign outs":916,"Support calls":4},{date:"2023-09-14T00:00:00","Rows written":2549,"Rows read":21778,Queries:494,"Payments completed":85,"Sign ups":79,Logins:1119,"Sign outs":901,"Support calls":4},{date:"2023-09-15T00:00:00","Rows written":2535,"Rows read":21650,Queries:412,"Payments completed":64,"Sign ups":54,Logins:1074,"Sign outs":911,"Support calls":3},{date:"2023-09-16T00:00:00","Rows written":2544,"Rows read":20967,Queries:431,"Payments completed":73,"Sign ups":56,Logins:1132,"Sign outs":913,"Support calls":2},{date:"2023-09-17T00:00:00","Rows written":2547,"Rows read":20966,Queries:489,"Payments completed":115,"Sign ups":67,Logins:1260,"Sign outs":916,"Support calls":2},{date:"2023-09-18T00:00:00","Rows written":2539,"Rows read":21347,Queries:487,"Payments completed":115,"Sign ups":76,Logins:1292,"Sign outs":914,"Support calls":2},{date:"2023-09-19T00:00:00","Rows written":2524,"Rows read":22148,Queries:489,"Payments completed":115,"Sign ups":66,Logins:1128,"Sign outs":903,"Support calls":3},{date:"2023-09-20T00:00:00","Rows written":2519,"Rows read":21947,Queries:488,"Payments completed":118,"Sign ups":68,Logins:1196,"Sign outs":970,"Support calls":4},{date:"2023-09-21T00:00:00","Rows written":2529,"Rows read":22192,Queries:487,"Payments completed":85,"Sign ups":65,Logins:1268,"Sign outs":953,"Support calls":4},{date:"2023-09-22T00:00:00","Rows written":2510,"Rows read":22218,Queries:397,"Payments completed":73,"Sign ups":54,Logins:1184,"Sign outs":927,"Support calls":3},{date:"2023-09-23T00:00:00","Rows written":2522,"Rows read":22302,Queries:374,"Payments completed":70,"Sign ups":55,Logins:931,"Sign outs":998,"Support calls":2},{date:"2023-09-24T00:00:00","Rows written":2547,"Rows read":22352,Queries:498,"Payments completed":103,"Sign ups":80,Logins:950,"Sign outs":1075,"Support calls":2},{date:"2023-09-25T00:00:00","Rows written":2538,"Rows read":22820,Queries:500,"Payments completed":124,"Sign ups":69,Logins:1131,"Sign outs":1099,"Support calls":2},{date:"2023-09-26T00:00:00","Rows written":2514,"Rows read":22707,Queries:499,"Payments completed":112,"Sign ups":67,Logins:1013,"Sign outs":1200,"Support calls":2},{date:"2023-09-27T00:00:00","Rows written":2503,"Rows read":22818,Queries:495,"Payments completed":118,"Sign ups":74,Logins:1053,"Sign outs":1174,"Support calls":2},{date:"2023-09-28T00:00:00","Rows written":2505,"Rows read":22403,Queries:497,"Payments completed":118,"Sign ups":78,Logins:1065,"Sign outs":1181,"Support calls":2},{date:"2023-09-29T00:00:00","Rows written":2501,"Rows read":22182,Queries:435,"Payments completed":71,"Sign ups":61,Logins:916,"Sign outs":1179,"Support calls":2},{date:"2023-09-30T00:00:00","Rows written":2504,"Rows read":22135,Queries:418,"Payments completed":76,"Sign ups":48,Logins:845,"Sign outs":1198,"Support calls":3},{date:"2023-10-01T00:00:00","Rows written":2504,"Rows read":21827,Queries:490,"Payments completed":90,"Sign ups":64,Logins:891,"Sign outs":1189,"Support calls":3},{date:"2023-10-02T00:00:00","Rows written":2511,"Rows read":21733,Queries:489,"Payments completed":86,"Sign ups":62,Logins:889,"Sign outs":1186,"Support calls":4},{date:"2023-10-03T00:00:00","Rows written":2533,"Rows read":21655,Queries:487,"Payments completed":81,"Sign ups":61,Logins:1002,"Sign outs":1173,"Support calls":4},{date:"2023-10-04T00:00:00","Rows written":2551,"Rows read":22072,Queries:490,"Payments completed":103,"Sign ups":64,Logins:887,"Sign outs":1151,"Support calls":6},{date:"2023-10-05T00:00:00","Rows written":2568,"Rows read":22724,Queries:489,"Payments completed":83,"Sign ups":63,Logins:863,"Sign outs":1063,"Support calls":9},{date:"2023-10-06T00:00:00","Rows written":2588,"Rows read":23121,Queries:378,"Payments completed":92,"Sign ups":49,Logins:849,"Sign outs":1117,"Support calls":11},{date:"2023-10-07T00:00:00","Rows written":2609,"Rows read":23546,Queries:447,"Payments completed":68,"Sign ups":54,Logins:924,"Sign outs":1196,"Support calls":13},{date:"2023-10-08T00:00:00","Rows written":2619,"Rows read":23939,Queries:485,"Payments completed":81,"Sign ups":61,Logins:1026,"Sign outs":1180,"Support calls":14},{date:"2023-10-09T00:00:00","Rows written":2613,"Rows read":24842,Queries:487,"Payments completed":121,"Sign ups":64,Logins:1006,"Sign outs":1181,"Support calls":12},{date:"2023-10-10T00:00:00","Rows written":2626,"Rows read":25404,Queries:490,"Payments completed":98,"Sign ups":66,Logins:1027,"Sign outs":1183,"Support calls":13},{date:"2023-10-11T00:00:00","Rows written":2639,"Rows read":25232,Queries:488,"Payments completed":117,"Sign ups":66,Logins:983,"Sign outs":1188,"Support calls":11},{date:"2023-10-12T00:00:00","Rows written":2643,"Rows read":24786,Queries:489,"Payments completed":99,"Sign ups":79,Logins:848,"Sign outs":1187,"Support calls":12},{date:"2023-10-13T00:00:00","Rows written":2666,"Rows read":24905,Queries:381,"Payments completed":67,"Sign ups":59,Logins:857,"Sign outs":1179,"Support calls":7},{date:"2023-10-14T00:00:00","Rows written":2703,"Rows read":24710,Queries:430,"Payments completed":67,"Sign ups":57,Logins:928,"Sign outs":1188,"Support calls":3},{date:"2023-10-15T00:00:00","Rows written":2729,"Rows read":25132,Queries:488,"Payments completed":99,"Sign ups":64,Logins:845,"Sign outs":1179,"Support calls":2},{date:"2023-10-16T00:00:00","Rows written":2737,"Rows read":24724,Queries:487,"Payments completed":119,"Sign ups":64,Logins:879,"Sign outs":1182,"Support calls":2},{date:"2023-10-17T00:00:00","Rows written":2730,"Rows read":25172,Queries:486,"Payments completed":119,"Sign ups":64,Logins:862,"Sign outs":1139,"Support calls":2},{date:"2023-10-18T00:00:00","Rows written":2737,"Rows read":25762,Queries:485,"Payments completed":121,"Sign ups":62,Logins:895,"Sign outs":1057,"Support calls":2},{date:"2023-10-19T00:00:00","Rows written":2738,"Rows read":25469,Queries:487,"Payments completed":97,"Sign ups":64,Logins:998,"Sign outs":1100,"Support calls":2},{date:"2023-10-20T00:00:00","Rows written":2724,"Rows read":25948,Queries:409,"Payments completed":70,"Sign ups":67,Logins:940,"Sign outs":1176,"Support calls":2},{date:"2023-10-21T00:00:00","Rows written":2722,"Rows read":26662,Queries:401,"Payments completed":69,"Sign ups":61,Logins:971,"Sign outs":1101,"Support calls":2},{date:"2023-10-22T00:00:00","Rows written":2737,"Rows read":27288,Queries:493,"Payments completed":98,"Sign ups":69,Logins:924,"Sign outs":1139,"Support calls":2},{date:"2023-10-23T00:00:00","Rows written":2737,"Rows read":26813,Queries:493,"Payments completed":119,"Sign ups":63,Logins:844,"Sign outs":1167,"Support calls":3},{date:"2023-10-24T00:00:00","Rows written":2755,"Rows read":27228,Queries:493,"Payments completed":113,"Sign ups":78,Logins:879,"Sign outs":1193,"Support calls":3},{date:"2023-10-25T00:00:00","Rows written":2742,"Rows read":26723,Queries:494,"Payments completed":102,"Sign ups":75,Logins:871,"Sign outs":1095,"Support calls":2},{date:"2023-10-26T00:00:00","Rows written":2715,"Rows read":26364,Queries:494,"Payments completed":121,"Sign ups":75,Logins:961,"Sign outs":1022,"Support calls":2},{date:"2023-10-27T00:00:00","Rows written":2692,"Rows read":26686,Queries:442,"Payments completed":94,"Sign ups":63,Logins:848,"Sign outs":1015,"Support calls":2},{date:"2023-10-28T00:00:00","Rows written":2690,"Rows read":26161,Queries:389,"Payments completed":108,"Sign ups":48,Logins:857,"Sign outs":1061,"Support calls":2},{date:"2023-10-30T00:00:00","Rows written":2710,"Rows read":25456,Queries:496,"Payments completed":94,"Sign ups":62,Logins:874,"Sign outs":1028,"Support calls":2},{date:"2023-10-31T00:00:00","Rows written":2728,"Rows read":24798,Queries:493,"Payments completed":85,"Sign ups":68,Logins:933,"Sign outs":1044,"Support calls":2},{date:"2023-11-01T00:00:00","Rows written":2756,"Rows read":25010,Queries:496,"Payments completed":90,"Sign ups":71,Logins:845,"Sign outs":955,"Support calls":2},{date:"2023-11-02T00:00:00","Rows written":2744,"Rows read":25796,Queries:493,"Payments completed":81,"Sign ups":64,Logins:861,"Sign outs":908,"Support calls":2},{date:"2023-11-03T00:00:00","Rows written":2730,"Rows read":25748,Queries:490,"Payments completed":85,"Sign ups":77,Logins:984,"Sign outs":931,"Support calls":3},{date:"2023-11-04T00:00:00","Rows written":2745,"Rows read":26054,Queries:412,"Payments completed":81,"Sign ups":64,Logins:955,"Sign outs":911,"Support calls":2},{date:"2023-11-05T00:00:00","Rows written":2760,"Rows read":25986,Queries:436,"Payments completed":96,"Sign ups":58,Logins:920,"Sign outs":985,"Support calls":2},{date:"2023-11-06T00:00:00","Rows written":2769,"Rows read":25393,Queries:486,"Payments completed":95,"Sign ups":64,Logins:855,"Sign outs":1115,"Support calls":2},{date:"2023-11-07T00:00:00","Rows written":2748,"Rows read":24541,Queries:491,"Payments completed":84,"Sign ups":75,Logins:861,"Sign outs":1162,"Support calls":2},{date:"2023-11-08T00:00:00","Rows written":2751,"Rows read":24743,Queries:496,"Payments completed":93,"Sign ups":70,Logins:953,"Sign outs":1187,"Support calls":2},{date:"2023-11-09T00:00:00","Rows written":2754,"Rows read":24904,Queries:503,"Payments completed":121,"Sign ups":63,Logins:861,"Sign outs":1188,"Support calls":2},{date:"2023-11-10T00:00:00","Rows written":2778,"Rows read":24773,Queries:504,"Payments completed":122,"Sign ups":64,Logins:872,"Sign outs":1152,"Support calls":2},{date:"2023-11-11T00:00:00","Rows written":2816,"Rows read":23992,Queries:381,"Payments completed":93,"Sign ups":59,Logins:936,"Sign outs":1087,"Support calls":2},{date:"2023-11-12T00:00:00","Rows written":2823,"Rows read":23135,Queries:401,"Payments completed":65,"Sign ups":54,Logins:987,"Sign outs":1011,"Support calls":2},{date:"2023-11-13T00:00:00","Rows written":2843,"Rows read":22986,Queries:494,"Payments completed":84,"Sign ups":60,Logins:959,"Sign outs":902,"Support calls":2},{date:"2023-11-14T00:00:00","Rows written":2865,"Rows read":22974,Queries:492,"Payments completed":81,"Sign ups":69,Logins:998,"Sign outs":909,"Support calls":2},{date:"2023-11-15T00:00:00","Rows written":2871,"Rows read":23523,Queries:490,"Payments completed":85,"Sign ups":79,Logins:871,"Sign outs":970,"Support calls":2},{date:"2023-11-16T00:00:00","Rows written":2848,"Rows read":23927,Queries:485,"Payments completed":91,"Sign ups":76,Logins:854,"Sign outs":1077,"Support calls":2},{date:"2023-11-17T00:00:00","Rows written":2843,"Rows read":23635,Queries:484,"Payments completed":86,"Sign ups":77,Logins:883,"Sign outs":1060,"Support calls":2},{date:"2023-11-18T00:00:00","Rows written":2857,"Rows read":23801,Queries:423,"Payments completed":73,"Sign ups":61,Logins:844,"Sign outs":960,"Support calls":2},{date:"2023-11-19T00:00:00","Rows written":2890,"Rows read":23932,Queries:410,"Payments completed":70,"Sign ups":51,Logins:881,"Sign outs":935,"Support calls":2},{date:"2023-11-20T00:00:00","Rows written":2928,"Rows read":24512,Queries:492,"Payments completed":91,"Sign ups":69,Logins:891,"Sign outs":911,"Support calls":2},{date:"2023-11-21T00:00:00","Rows written":2929,"Rows read":24943,Queries:487,"Payments completed":85,"Sign ups":61,Logins:865,"Sign outs":917,"Support calls":2},{date:"2023-11-22T00:00:00","Rows written":2927,"Rows read":25053,Queries:484,"Payments completed":108,"Sign ups":61,Logins:859,"Sign outs":904,"Support calls":2},{date:"2023-11-23T00:00:00","Rows written":2936,"Rows read":25126,Queries:479,"Payments completed":116,"Sign ups":64,Logins:863,"Sign outs":934,"Support calls":2},{date:"2023-11-24T00:00:00","Rows written":2939,"Rows read":24528,Queries:479,"Payments completed":93,"Sign ups":60,Logins:869,"Sign outs":982,"Support calls":2},{date:"2023-11-25T00:00:00","Rows written":2917,"Rows read":24379,Queries:366,"Payments completed":64,"Sign ups":50,Logins:870,"Sign outs":927,"Support calls":2},{date:"2023-11-26T00:00:00","Rows written":2923,"Rows read":24301,Queries:437,"Payments completed":64,"Sign ups":52,Logins:866,"Sign outs":904,"Support calls":2},{date:"2023-11-27T00:00:00","Rows written":2907,"Rows read":24537,Queries:486,"Payments completed":81,"Sign ups":64,Logins:876,"Sign outs":903,"Support calls":3},{date:"2023-11-28T00:00:00","Rows written":2919,"Rows read":25358,Queries:486,"Payments completed":124,"Sign ups":68,Logins:1032,"Sign outs":915,"Support calls":4},{date:"2023-11-29T00:00:00","Rows written":2949,"Rows read":25428,Queries:482,"Payments completed":113,"Sign ups":64,Logins:1285,"Sign outs":951,"Support calls":4},{date:"2023-11-30T00:00:00","Rows written":2957,"Rows read":25179,Queries:478,"Payments completed":121,"Sign ups":66,Logins:1697,"Sign outs":977,"Support calls":4},{date:"2023-12-01T00:00:00","Rows written":2937,"Rows read":24846,Queries:478,"Payments completed":117,"Sign ups":63,Logins:2012,"Sign outs":958,"Support calls":5},{date:"2023-12-02T00:00:00","Rows written":2949,"Rows read":24979,Queries:359,"Payments completed":106,"Sign ups":49,Logins:2006,"Sign outs":904,"Support calls":6},{date:"2023-12-03T00:00:00","Rows written":2941,"Rows read":25038,Queries:442,"Payments completed":104,"Sign ups":45,Logins:1794,"Sign outs":921,"Support calls":4},{date:"2023-12-04T00:00:00","Rows written":2951,"Rows read":24652,Queries:486,"Payments completed":116,"Sign ups":66,Logins:1765,"Sign outs":913,"Support calls":4},{date:"2023-12-05T00:00:00","Rows written":2941,"Rows read":23863,Queries:487,"Payments completed":96,"Sign ups":68,Logins:1841,"Sign outs":920,"Support calls":4},{date:"2023-12-06T00:00:00","Rows written":2941,"Rows read":23307,Queries:490,"Payments completed":82,"Sign ups":63,Logins:2022,"Sign outs":905,"Support calls":2},{date:"2023-12-07T00:00:00","Rows written":2950,"Rows read":23317,Queries:489,"Payments completed":84,"Sign ups":76,Logins:1973,"Sign outs":918,"Support calls":2},{date:"2023-12-08T00:00:00","Rows written":2943,"Rows read":23254,Queries:484,"Payments completed":82,"Sign ups":73,Logins:1786,"Sign outs":934,"Support calls":2},{date:"2023-12-09T00:00:00","Rows written":2945,"Rows read":22527,Queries:428,"Payments completed":84,"Sign ups":55,Logins:1533,"Sign outs":970,"Support calls":2},{date:"2023-12-10T00:00:00","Rows written":2960,"Rows read":22319,Queries:409,"Payments completed":106,"Sign ups":48,Logins:1279,"Sign outs":1041,"Support calls":2},{date:"2023-12-11T00:00:00","Rows written":2983,"Rows read":21870,Queries:491,"Payments completed":90,"Sign ups":64,Logins:1018,"Sign outs":986,"Support calls":2},{date:"2023-12-12T00:00:00","Rows written":2991,"Rows read":21482,Queries:492,"Payments completed":80,"Sign ups":78,Logins:973,"Sign outs":933,"Support calls":2},{date:"2023-12-13T00:00:00","Rows written":2991,"Rows read":21630,Queries:497,"Payments completed":84,"Sign ups":73,Logins:857,"Sign outs":973,"Support calls":3},{date:"2023-12-14T00:00:00","Rows written":2970,"Rows read":21774,Queries:500,"Payments completed":96,"Sign ups":80,Logins:868,"Sign outs":1084,"Support calls":5},{date:"2023-12-15T00:00:00","Rows written":2981,"Rows read":21684,Queries:499,"Payments completed":121,"Sign ups":79,Logins:952,"Sign outs":1086,"Support calls":5},{date:"2023-12-16T00:00:00","Rows written":2989,"Rows read":22265,Queries:397,"Payments completed":90,"Sign ups":60,Logins:1118,"Sign outs":1046,"Support calls":2},{date:"2023-12-17T00:00:00","Rows written":2977,"Rows read":22417,Queries:426,"Payments completed":66,"Sign ups":48,Logins:1415,"Sign outs":1115,"Support calls":2},{date:"2023-12-18T00:00:00","Rows written":2960,"Rows read":22538,Queries:488,"Payments completed":83,"Sign ups":67,Logins:1881,"Sign outs":1113,"Support calls":2},{date:"2023-12-19T00:00:00","Rows written":2950,"Rows read":22247,Queries:486,"Payments completed":121,"Sign ups":60,Logins:1911,"Sign outs":1001,"Support calls":2},{date:"2023-12-20T00:00:00","Rows written":2919,"Rows read":22166,Queries:487,"Payments completed":125,"Sign ups":60,Logins:1637,"Sign outs":946,"Support calls":2},{date:"2023-12-21T00:00:00","Rows written":2912,"Rows read":22083,Queries:483,"Payments completed":121,"Sign ups":62,Logins:1519,"Sign outs":907,"Support calls":2},{date:"2023-12-22T00:00:00","Rows written":2933,"Rows read":21697,Queries:480,"Payments completed":119,"Sign ups":61,Logins:1315,"Sign outs":933,"Support calls":2},{date:"2023-12-23T00:00:00","Rows written":2918,"Rows read":21487,Queries:391,"Payments completed":94,"Sign ups":52,Logins:1275,"Sign outs":906,"Support calls":2},{date:"2023-12-24T00:00:00","Rows written":2891,"Rows read":20748,Queries:398,"Payments completed":68,"Sign ups":57,Logins:1138,"Sign outs":908,"Support calls":2},{date:"2023-12-25T00:00:00","Rows written":2858,"Rows read":20147,Queries:495,"Payments completed":89,"Sign ups":65,Logins:1213,"Sign outs":924,"Support calls":2},{date:"2023-12-26T00:00:00","Rows written":2858,"Rows read":20262,Queries:489,"Payments completed":98,"Sign ups":60,Logins:1306,"Sign outs":903,"Support calls":2},{date:"2023-12-27T00:00:00","Rows written":2847,"Rows read":20921,Queries:483,"Payments completed":81,"Sign ups":65,Logins:1536,"Sign outs":900,"Support calls":2},{date:"2023-12-28T00:00:00","Rows written":2845,"Rows read":20830,Queries:482,"Payments completed":87,"Sign ups":63,Logins:1879,"Sign outs":922,"Support calls":3},{date:"2023-12-29T00:00:00","Rows written":2827,"Rows read":21133,Queries:482,"Payments completed":99,"Sign ups":60,Logins:2034,"Sign outs":911,"Support calls":2},{date:"2023-12-30T00:00:00","Rows written":2826,"Rows read":21097,Queries:427,"Payments completed":94,"Sign ups":53,Logins:2009,"Sign outs":924,"Support calls":2},{date:"2023-12-31T00:00:00","Rows written":2808,"Rows read":20776,Queries:399,"Payments completed":81,"Sign ups":49,Logins:2002,"Sign outs":918,"Support calls":2},{date:"2024-01-01T00:00:00","Rows written":2790,"Rows read":20855,Queries:494,"Payments completed":87,"Sign ups":66,Logins:2038,"Sign outs":914,"Support calls":2},{date:"2024-01-02T00:00:00","Rows written":2778,"Rows read":20444,Queries:490,"Payments completed":81,"Sign ups":65,Logins:1994,"Sign outs":951,"Support calls":2},{date:"2024-01-03T00:00:00","Rows written":2788,"Rows read":19651,Queries:491,"Payments completed":86,"Sign ups":60,Logins:1975,"Sign outs":1034,"Support calls":2},{date:"2024-01-04T00:00:00","Rows written":2768,"Rows read":18747,Queries:494,"Payments completed":84,"Sign ups":65,Logins:2012,"Sign outs":1015,"Support calls":2},{date:"2024-01-05T00:00:00","Rows written":2782,"Rows read":18514,Queries:493,"Payments completed":98,"Sign ups":66,Logins:1944,"Sign outs":1042,"Support calls":2},{date:"2024-01-06T00:00:00","Rows written":2777,"Rows read":18686,Queries:379,"Payments completed":106,"Sign ups":55,Logins:1741,"Sign outs":995,"Support calls":2},{date:"2024-01-07T00:00:00","Rows written":2785,"Rows read":18779,Queries:431,"Payments completed":92,"Sign ups":52,Logins:1862,"Sign outs":1065,"Support calls":2},{date:"2024-01-08T00:00:00","Rows written":2783,"Rows read":18994,Queries:488,"Payments completed":119,"Sign ups":65,Logins:2003,"Sign outs":1028,"Support calls":2},{date:"2024-01-09T00:00:00","Rows written":2769,"Rows read":18892,Queries:486,"Payments completed":112,"Sign ups":68,Logins:1975,"Sign outs":1113,"Support calls":2},{date:"2024-01-10T00:00:00","Rows written":2739,"Rows read":18785,Queries:485,"Payments completed":121,"Sign ups":63,Logins:2021,"Sign outs":1060,"Support calls":2},{date:"2024-01-11T00:00:00","Rows written":2708,"Rows read":18323,Queries:489,"Payments completed":112,"Sign ups":64,Logins:2020,"Sign outs":951,"Support calls":2},{date:"2024-01-12T00:00:00","Rows written":2697,"Rows read":18607,Queries:489,"Payments completed":102,"Sign ups":63,Logins:1934,"Sign outs":904,"Support calls":2},{date:"2024-01-13T00:00:00","Rows written":2709,"Rows read":18881,Queries:371,"Payments completed":106,"Sign ups":52,Logins:1908,"Sign outs":913,"Support calls":2},{date:"2024-01-14T00:00:00","Rows written":2734,"Rows read":18941,Queries:393,"Payments completed":82,"Sign ups":50,Logins:1572,"Sign outs":905,"Support calls":2},{date:"2024-01-15T00:00:00","Rows written":2735,"Rows read":19199,Queries:495,"Payments completed":106,"Sign ups":68,Logins:1311,"Sign outs":908,"Support calls":2},{date:"2024-01-16T00:00:00","Rows written":2735,"Rows read":19883,Queries:493,"Payments completed":82,"Sign ups":61,Logins:946,"Sign outs":909,"Support calls":3},{date:"2024-01-17T00:00:00","Rows written":2720,"Rows read":20709,Queries:495,"Payments completed":86,"Sign ups":61,Logins:878,"Sign outs":910,"Support calls":3},{date:"2024-01-18T00:00:00","Rows written":2700,"Rows read":20770,Queries:500,"Payments completed":82,"Sign ups":66,Logins:895,"Sign outs":915,"Support calls":3},{date:"2024-01-19T00:00:00","Rows written":2670,"Rows read":20735,Queries:501,"Payments completed":88,"Sign ups":64,Logins:882,"Sign outs":908,"Support calls":2},{date:"2024-01-20T00:00:00","Rows written":2672,"Rows read":20107,Queries:425,"Payments completed":67,"Sign ups":54,Logins:852,"Sign outs":929,"Support calls":2},{date:"2024-01-21T00:00:00","Rows written":2676,"Rows read":19418,Queries:380,"Payments completed":70,"Sign ups":47,Logins:854,"Sign outs":906,"Support calls":2},{date:"2024-01-22T00:00:00","Rows written":2692,"Rows read":19118,Queries:498,"Payments completed":82,"Sign ups":62,Logins:848,"Sign outs":944,"Support calls":3},{date:"2024-01-23T00:00:00","Rows written":2691,"Rows read":18577,Queries:495,"Payments completed":88,"Sign ups":78,Logins:872,"Sign outs":1027,"Support calls":5},{date:"2024-01-24T00:00:00","Rows written":2703,"Rows read":18052,Queries:493,"Payments completed":109,"Sign ups":69,Logins:875,"Sign outs":1095,"Support calls":5},{date:"2024-01-25T00:00:00","Rows written":2735,"Rows read":18108,Queries:491,"Payments completed":80,"Sign ups":76,Logins:914,"Sign outs":1067,"Support calls":4},{date:"2024-01-26T00:00:00","Rows written":2733,"Rows read":18137,Queries:488,"Payments completed":80,"Sign ups":78,Logins:959,"Sign outs":1115,"Support calls":4},{date:"2024-01-27T00:00:00","Rows written":2724,"Rows read":18116,Queries:432,"Payments completed":65,"Sign ups":53,Logins:1059,"Sign outs":1182,"Support calls":2},{date:"2024-01-28T00:00:00","Rows written":2727,"Rows read":18575,Queries:431,"Payments completed":65,"Sign ups":49,Logins:997,"Sign outs":1180,"Support calls":2},{date:"2024-01-29T00:00:00","Rows written":2755,"Rows read":19197,Queries:488,"Payments completed":83,"Sign ups":64,Logins:950,"Sign outs":1138,"Support calls":2},{date:"2024-01-30T00:00:00","Rows written":2756,"Rows read":19751,Queries:490,"Payments completed":87,"Sign ups":66,Logins:1028,"Sign outs":1108,"Support calls":3},{date:"2024-01-31T00:00:00","Rows written":2783,"Rows read":19767,Queries:491,"Payments completed":102,"Sign ups":79,Logins:1198,"Sign outs":1050,"Support calls":5},{date:"2024-02-01T00:00:00","Rows written":2778,"Rows read":19305,Queries:491,"Payments completed":81,"Sign ups":76,Logins:1458,"Sign outs":1023,"Support calls":6},{date:"2024-02-02T00:00:00","Rows written":2749,"Rows read":19095,Queries:495,"Payments completed":80,"Sign ups":77,Logins:1712,"Sign outs":1052,"Support calls":8},{date:"2024-02-03T00:00:00","Rows written":2711,"Rows read":18932,Queries:425,"Payments completed":68,"Sign ups":70,Logins:1704,"Sign outs":1129,"Support calls":7},{date:"2024-02-04T00:00:00","Rows written":2719,"Rows read":19181,Queries:369,"Payments completed":69,"Sign ups":62,Logins:1393,"Sign outs":1076,"Support calls":6},{date:"2024-02-05T00:00:00","Rows written":2708,"Rows read":19141,Queries:500,"Payments completed":85,"Sign ups":62,Logins:1235,"Sign outs":947,"Support calls":8},{date:"2024-02-06T00:00:00","Rows written":2726,"Rows read":19575,Queries:495,"Payments completed":88,"Sign ups":80,Logins:1100,"Sign outs":921,"Support calls":8},{date:"2024-02-07T00:00:00","Rows written":2752,"Rows read":20265,Queries:491,"Payments completed":87,"Sign ups":71,Logins:932,"Sign outs":904,"Support calls":10},{date:"2024-02-08T00:00:00","Rows written":2754,"Rows read":20236,Queries:485,"Payments completed":83,"Sign ups":75,Logins:868,"Sign outs":917,"Support calls":13},{date:"2024-02-09T00:00:00","Rows written":2776,"Rows read":19659,Queries:478,"Payments completed":89,"Sign ups":77,Logins:878,"Sign outs":900,"Support calls":15},{date:"2024-02-10T00:00:00","Rows written":2794,"Rows read":19108,Queries:392,"Payments completed":72,"Sign ups":58,Logins:1033,"Sign outs":917,"Support calls":8},{date:"2024-02-11T00:00:00","Rows written":2796,"Rows read":18407,Queries:382,"Payments completed":67,"Sign ups":53,Logins:1008,"Sign outs":959,"Support calls":9},{date:"2024-02-12T00:00:00","Rows written":2774,"Rows read":18053,Queries:498,"Payments completed":83,"Sign ups":66,Logins:960,"Sign outs":1040,"Support calls":14},{date:"2024-02-13T00:00:00","Rows written":2747,"Rows read":18058,Queries:493,"Payments completed":80,"Sign ups":63,Logins:858,"Sign outs":1177,"Support calls":13},{date:"2024-02-14T00:00:00","Rows written":2741,"Rows read":18290,Queries:492,"Payments completed":82,"Sign ups":60,Logins:942,"Sign outs":1177,"Support calls":15},{date:"2024-02-15T00:00:00","Rows written":2724,"Rows read":18708,Queries:491,"Payments completed":83,"Sign ups":61,Logins:1015,"Sign outs":1150,"Support calls":9},{date:"2024-02-16T00:00:00","Rows written":2705,"Rows read":18405,Queries:491,"Payments completed":86,"Sign ups":61,Logins:1067,"Sign outs":1114,"Support calls":5},{date:"2024-02-17T00:00:00","Rows written":2699,"Rows read":18713,Queries:372,"Payments completed":73,"Sign ups":53,Logins:1175,"Sign outs":1004,"Support calls":2},{date:"2024-02-18T00:00:00","Rows written":2693,"Rows read":18576,Queries:393,"Payments completed":75,"Sign ups":56,Logins:1411,"Sign outs":959,"Support calls":2},{date:"2024-02-19T00:00:00","Rows written":2704,"Rows read":18344,Queries:495,"Payments completed":90,"Sign ups":65,Logins:1586,"Sign outs":902,"Support calls":2},{date:"2024-02-20T00:00:00","Rows written":2728,"Rows read":18769,Queries:500,"Payments completed":83,"Sign ups":78,Logins:1792,"Sign outs":902,"Support calls":2},{date:"2024-02-21T00:00:00","Rows written":2756,"Rows read":19252,Queries:507,"Payments completed":82,"Sign ups":61,Logins:1837,"Sign outs":917,"Support calls":2},{date:"2024-02-22T00:00:00","Rows written":2792,"Rows read":19917,Queries:509,"Payments completed":83,"Sign ups":65,Logins:1818,"Sign outs":911,"Support calls":2},{date:"2024-02-23T00:00:00","Rows written":2827,"Rows read":20473,Queries:509,"Payments completed":86,"Sign ups":68,Logins:1460,"Sign outs":903,"Support calls":2},{date:"2024-02-24T00:00:00","Rows written":2822,"Rows read":21263,Queries:402,"Payments completed":76,"Sign ups":67,Logins:1232,"Sign outs":926,"Support calls":2},{date:"2024-02-25T00:00:00","Rows written":2825,"Rows read":22081,Queries:432,"Payments completed":75,"Sign ups":49,Logins:1122,"Sign outs":903,"Support calls":2},{date:"2024-02-26T00:00:00","Rows written":2849,"Rows read":22955,Queries:487,"Payments completed":84,"Sign ups":62,Logins:1118,"Sign outs":964,"Support calls":2},{date:"2024-02-27T00:00:00","Rows written":2841,"Rows read":23908,Queries:484,"Payments completed":110,"Sign ups":79,Logins:1247,"Sign outs":1048,"Support calls":2},{date:"2024-02-28T00:00:00","Rows written":2857,"Rows read":23777,Queries:481,"Payments completed":91,"Sign ups":64,Logins:1231,"Sign outs":1166,"Support calls":2},{date:"2024-02-29T00:00:00","Rows written":2878,"Rows read":23296,Queries:484,"Payments completed":89,"Sign ups":79,Logins:991,"Sign outs":1153,"Support calls":2},{date:"2024-03-01T00:00:00","Rows written":2881,"Rows read":22647,Queries:483,"Payments completed":110,"Sign ups":71,Logins:865,"Sign outs":1166,"Support calls":3},{date:"2024-03-02T00:00:00","Rows written":2887,"Rows read":22725,Queries:363,"Payments completed":100,"Sign ups":65,Logins:855,"Sign outs":1194,"Support calls":3},{date:"2024-03-03T00:00:00","Rows written":2869,"Rows read":22226,Queries:393,"Payments completed":91,"Sign ups":64,Logins:859,"Sign outs":1172,"Support calls":2},{date:"2024-03-04T00:00:00","Rows written":2877,"Rows read":22120,Queries:495,"Payments completed":122,"Sign ups":61,Logins:867,"Sign outs":1181,"Support calls":2},{date:"2024-03-05T00:00:00","Rows written":2875,"Rows read":22533,Queries:494,"Payments completed":109,"Sign ups":60,Logins:879,"Sign outs":1150,"Support calls":2},{date:"2024-03-06T00:00:00","Rows written":2860,"Rows read":22166,Queries:489,"Payments completed":98,"Sign ups":65,Logins:869,"Sign outs":1088,"Support calls":2},{date:"2024-03-07T00:00:00","Rows written":2872,"Rows read":21895,Queries:482,"Payments completed":104,"Sign ups":77,Logins:877,"Sign outs":1145,"Support calls":2},{date:"2024-03-08T00:00:00","Rows written":2852,"Rows read":21563,Queries:479,"Payments completed":82,"Sign ups":73,Logins:852,"Sign outs":1123,"Support calls":2},{date:"2024-03-09T00:00:00","Rows written":2822,"Rows read":20981,Queries:409,"Payments completed":76,"Sign ups":49,Logins:979,"Sign outs":1140,"Support calls":2},{date:"2024-03-10T00:00:00","Rows written":2835,"Rows read":21256,Queries:387,"Payments completed":68,"Sign ups":50,Logins:1138,"Sign outs":1150,"Support calls":2},{date:"2024-03-11T00:00:00","Rows written":2831,"Rows read":21702,Queries:497,"Payments completed":83,"Sign ups":60,Logins:1026,"Sign outs":1084,"Support calls":2},{date:"2024-03-12T00:00:00","Rows written":2807,"Rows read":22104,Queries:494,"Payments completed":81,"Sign ups":70,Logins:858,"Sign outs":952,"Support calls":2},{date:"2024-03-13T00:00:00","Rows written":2803,"Rows read":22714,Queries:489,"Payments completed":106,"Sign ups":74,Logins:879,"Sign outs":908,"Support calls":2},{date:"2024-03-14T00:00:00","Rows written":2825,"Rows read":22484,Queries:483,"Payments completed":116,"Sign ups":72,Logins:844,"Sign outs":917,"Support calls":2},{date:"2024-03-15T00:00:00","Rows written":2811,"Rows read":22589,Queries:480,"Payments completed":120,"Sign ups":73,Logins:852,"Sign outs":907,"Support calls":2},{date:"2024-03-16T00:00:00","Rows written":2815,"Rows read":21999,Queries:391,"Payments completed":94,"Sign ups":60,Logins:860,"Sign outs":907,"Support calls":2},{date:"2024-03-17T00:00:00","Rows written":2842,"Rows read":21627,Queries:440,"Payments completed":92,"Sign ups":69,Logins:920,"Sign outs":932,"Support calls":2},{date:"2024-03-18T00:00:00","Rows written":2864,"Rows read":21708,Queries:486,"Payments completed":82,"Sign ups":75,Logins:856,"Sign outs":900,"Support calls":2},{date:"2024-03-19T00:00:00","Rows written":2877,"Rows read":21501,Queries:489,"Payments completed":114,"Sign ups":70,Logins:845,"Sign outs":943,"Support calls":2},{date:"2024-03-20T00:00:00","Rows written":2900,"Rows read":21927,Queries:489,"Payments completed":107,"Sign ups":80,Logins:848,"Sign outs":903,"Support calls":2},{date:"2024-03-21T00:00:00","Rows written":2887,"Rows read":22358,Queries:490,"Payments completed":81,"Sign ups":61,Logins:847,"Sign outs":912,"Support calls":3},{date:"2024-03-22T00:00:00","Rows written":2903,"Rows read":22301,Queries:488,"Payments completed":84,"Sign ups":63,Logins:847,"Sign outs":907,"Support calls":3},{date:"2024-03-23T00:00:00","Rows written":2920,"Rows read":21875,Queries:420,"Payments completed":66,"Sign ups":61,Logins:852,"Sign outs":903,"Support calls":4},{date:"2024-03-24T00:00:00","Rows written":2951,"Rows read":21585,Queries:370,"Payments completed":66,"Sign ups":51,Logins:952,"Sign outs":943,"Support calls":2},{date:"2024-03-25T00:00:00","Rows written":2944,"Rows read":20899,Queries:499,"Payments completed":101,"Sign ups":63,Logins:1030,"Sign outs":982,"Support calls":2},{date:"2024-03-26T00:00:00","Rows written":2923,"Rows read":20352,Queries:504,"Payments completed":124,"Sign ups":78,Logins:1009,"Sign outs":1087,"Support calls":2},{date:"2024-03-27T00:00:00","Rows written":2894,"Rows read":19832,Queries:510,"Payments completed":100,"Sign ups":70,Logins:868,"Sign outs":1190,"Support calls":2},{date:"2024-03-28T00:00:00","Rows written":2886,"Rows read":19542,Queries:510,"Payments completed":92,"Sign ups":76,Logins:852,"Sign outs":1199,"Support calls":2},{date:"2024-03-29T00:00:00","Rows written":2874,"Rows read":19368,Queries:507,"Payments completed":83,"Sign ups":71,Logins:906,"Sign outs":1103,"Support calls":2},{date:"2024-03-30T00:00:00","Rows written":2869,"Rows read":19312,Queries:383,"Payments completed":75,"Sign ups":66,Logins:866,"Sign outs":996,"Support calls":2},{date:"2024-03-31T00:00:00","Rows written":2848,"Rows read":19578,Queries:410,"Payments completed":83,"Sign ups":68,Logins:1e3,"Sign outs":910,"Support calls":2},{date:"2024-03-31T00:00:00","Rows written":2854,"Rows read":19837,Queries:492,"Payments completed":119,"Sign ups":74,Logins:1204,"Sign outs":903,"Support calls":2},{date:"2024-04-01T00:00:00","Rows written":2837,"Rows read":19406,Queries:486,"Payments completed":124,"Sign ups":73,Logins:1374,"Sign outs":918,"Support calls":2},{date:"2024-04-02T00:00:00","Rows written":2826,"Rows read":19050,Queries:480,"Payments completed":103,"Sign ups":71,Logins:1649,"Sign outs":930,"Support calls":3},{date:"2024-04-03T00:00:00","Rows written":2821,"Rows read":18973,Queries:481,"Payments completed":117,"Sign ups":76,Logins:1686,"Sign outs":911,"Support calls":5},{date:"2024-04-04T00:00:00","Rows written":2806,"Rows read":18537,Queries:485,"Payments completed":102,"Sign ups":70,Logins:1373,"Sign outs":950,"Support calls":7},{date:"2024-04-05T00:00:00","Rows written":2774,"Rows read":18124,Queries:379,"Payments completed":70,"Sign ups":53,Logins:1512,"Sign outs":973,"Support calls":9},{date:"2024-04-06T00:00:00","Rows written":2734,"Rows read":18031,Queries:436,"Payments completed":82,"Sign ups":63,Logins:1593,"Sign outs":900,"Support calls":9},{date:"2024-04-07T00:00:00","Rows written":2738,"Rows read":18081,Queries:485,"Payments completed":93,"Sign ups":61,Logins:1926,"Sign outs":932,"Support calls":13},{date:"2024-04-08T00:00:00","Rows written":2765,"Rows read":18042,Queries:491,"Payments completed":123,"Sign ups":67,Logins:2001,"Sign outs":971,"Support calls":14},{date:"2024-04-09T00:00:00","Rows written":2756,"Rows read":18006,Queries:490,"Payments completed":112,"Sign ups":78,Logins:1983,"Sign outs":913,"Support calls":9},{date:"2024-04-10T00:00:00","Rows written":2726,"Rows read":18097,Queries:493,"Payments completed":118,"Sign ups":74,Logins:1946,"Sign outs":900,"Support calls":10},{date:"2024-04-11T00:00:00","Rows written":2691,"Rows read":18124,Queries:494,"Payments completed":114,"Sign ups":71,Logins:1956,"Sign outs":915,"Support calls":10},{date:"2024-04-12T00:00:00","Rows written":2699,"Rows read":18115,Queries:431,"Payments completed":85,"Sign ups":69,Logins:1991,"Sign outs":926,"Support calls":5},{date:"2024-04-13T00:00:00","Rows written":2696,"Rows read":18096,Queries:387,"Payments completed":75,"Sign ups":64,Logins:1795,"Sign outs":906,"Support calls":3},{date:"2024-04-14T00:00:00","Rows written":2673,"Rows read":18251,Queries:496,"Payments completed":82,"Sign ups":77,Logins:1687,"Sign outs":965,"Support calls":4},{date:"2024-04-15T00:00:00","Rows written":2669,"Rows read":18003,Queries:491,"Payments completed":81,"Sign ups":79,Logins:1440,"Sign outs":1023,"Support calls":7},{date:"2024-04-16T00:00:00","Rows written":2676,"Rows read":18017,Queries:485,"Payments completed":87,"Sign ups":73,Logins:1589,"Sign outs":1149,"Support calls":11},{date:"2024-04-17T00:00:00","Rows written":2654,"Rows read":18088,Queries:485,"Payments completed":81,"Sign ups":75,Logins:1949,"Sign outs":1135,"Support calls":9},{date:"2024-04-18T00:00:00","Rows written":2635,"Rows read":18115,Queries:483,"Payments completed":106,"Sign ups":71,Logins:2028,"Sign outs":1159,"Support calls":7},{date:"2024-04-19T00:00:00","Rows written":2644,"Rows read":18138,Queries:379,"Payments completed":98,"Sign ups":65,Logins:2036,"Sign outs":1187,"Support calls":3},{date:"2024-04-20T00:00:00","Rows written":2672,"Rows read":18004,Queries:441,"Payments completed":101,"Sign ups":68,Logins:1991,"Sign outs":1176,"Support calls":3},{date:"2024-04-21T00:00:00","Rows written":2700,"Rows read":18113,Queries:485,"Payments completed":97,"Sign ups":60,Logins:2006,"Sign outs":1174,"Support calls":4},{date:"2024-04-22T00:00:00","Rows written":2729,"Rows read":18033,Queries:485,"Payments completed":85,"Sign ups":61,Logins:2006,"Sign outs":1169,"Support calls":6},{date:"2024-04-23T00:00:00","Rows written":2735,"Rows read":18083,Queries:486,"Payments completed":85,"Sign ups":80,Logins:1882,"Sign outs":1159,"Support calls":7},{date:"2024-04-24T00:00:00","Rows written":2734,"Rows read":18028,Queries:486,"Payments completed":112,"Sign ups":74,Logins:1801,"Sign outs":1040,"Support calls":8},{date:"2024-04-25T00:00:00","Rows written":2745,"Rows read":18037,Queries:486,"Payments completed":120,"Sign ups":72,Logins:1453,"Sign outs":944,"Support calls":6},{date:"2024-04-26T00:00:00","Rows written":2742,"Rows read":18006,Queries:380,"Payments completed":99,"Sign ups":56,Logins:1264,"Sign outs":992,"Support calls":3},{date:"2024-04-27T00:00:00","Rows written":2717,"Rows read":18439,Queries:446,"Payments completed":85,"Sign ups":65,Logins:938,"Sign outs":996,"Support calls":3},{date:"2024-04-28T00:00:00","Rows written":2707,"Rows read":18285,Queries:484,"Payments completed":85,"Sign ups":62,Logins:942,"Sign outs":1061,"Support calls":3},{date:"2024-04-29T00:00:00","Rows written":2677,"Rows read":18258,Queries:481,"Payments completed":84,"Sign ups":63,Logins:1061,"Sign outs":1089,"Support calls":3},{date:"2024-04-30T00:00:00","Rows written":2685,"Rows read":18298,Queries:479,"Payments completed":88,"Sign ups":71,Logins:1289,"Sign outs":1119,"Support calls":2},{date:"2024-05-01T00:00:00","Rows written":2687,"Rows read":18361,Queries:479,"Payments completed":88,"Sign ups":78,Logins:1339,"Sign outs":1198,"Support calls":2},{date:"2024-05-02T00:00:00","Rows written":2670,"Rows read":18576,Queries:480,"Payments completed":90,"Sign ups":76,Logins:1142,"Sign outs":1145,"Support calls":2},{date:"2024-05-03T00:00:00","Rows written":2635,"Rows read":19046,Queries:396,"Payments completed":71,"Sign ups":51,Logins:948,"Sign outs":1049,"Support calls":2},{date:"2024-05-04T00:00:00","Rows written":2617,"Rows read":19808,Queries:375,"Payments completed":82,"Sign ups":51,Logins:1018,"Sign outs":1012,"Support calls":2},{date:"2024-05-05T00:00:00","Rows written":2627,"Rows read":20325,Queries:498,"Payments completed":90,"Sign ups":64,Logins:1137,"Sign outs":1095,"Support calls":2},{date:"2024-05-06T00:00:00","Rows written":2624,"Rows read":20838,Queries:503,"Payments completed":119,"Sign ups":78,Logins:1047,"Sign outs":1196,"Support calls":2},{date:"2024-05-07T00:00:00","Rows written":2596,"Rows read":21694,Queries:503,"Payments completed":111,"Sign ups":72,Logins:848,"Sign outs":1199,"Support calls":2},{date:"2024-05-08T00:00:00","Rows written":2607,"Rows read":22529,Queries:499,"Payments completed":106,"Sign ups":70,Logins:861,"Sign outs":1102,"Support calls":2},{date:"2024-05-09T00:00:00","Rows written":2637,"Rows read":23550,Queries:493,"Payments completed":120,"Sign ups":76,Logins:979,"Sign outs":1126,"Support calls":3},{date:"2024-05-10T00:00:00","Rows written":2675,"Rows read":24491,Queries:379,"Payments completed":67,"Sign ups":65,Logins:928,"Sign outs":1070,"Support calls":3},{date:"2024-05-11T00:00:00","Rows written":2718,"Rows read":25709,Queries:428,"Payments completed":65,"Sign ups":48,Logins:990,"Sign outs":1068,"Support calls":4},{date:"2024-05-12T00:00:00","Rows written":2723,"Rows read":26600,Queries:488,"Payments completed":82,"Sign ups":63,Logins:1122,"Sign outs":1063,"Support calls":5},{date:"2024-05-13T00:00:00","Rows written":2715,"Rows read":27252,Queries:490,"Payments completed":83,"Sign ups":64,Logins:1285,"Sign outs":1126,"Support calls":7},{date:"2024-05-14T00:00:00","Rows written":2715,"Rows read":27298,Queries:489,"Payments completed":86,"Sign ups":79,Logins:1516,"Sign outs":1200,"Support calls":5},{date:"2024-05-15T00:00:00","Rows written":2734,"Rows read":27457,Queries:490,"Payments completed":89,"Sign ups":74,Logins:1803,"Sign outs":1122,"Support calls":4},{date:"2024-05-16T00:00:00","Rows written":2765,"Rows read":27539,Queries:486,"Payments completed":88,"Sign ups":73,Logins:2045,"Sign outs":997,"Support calls":2}],vr={blue:{bg:"bg-blue-500",stroke:"stroke-blue-500",fill:"fill-blue-500",text:"text-blue-500"},emerald:{bg:"bg-emerald-500",stroke:"stroke-emerald-500",fill:"fill-emerald-500",text:"text-emerald-500"},violet:{bg:"bg-violet-500",stroke:"stroke-violet-500",fill:"fill-violet-500",text:"text-violet-500"},amber:{bg:"bg-amber-500",stroke:"stroke-amber-500",fill:"fill-amber-500",text:"text-amber-500"},gray:{bg:"bg-gray-500",stroke:"stroke-gray-500",fill:"fill-gray-500",text:"text-gray-500"},cyan:{bg:"bg-cyan-500",stroke:"stroke-cyan-500",fill:"fill-cyan-500",text:"text-cyan-500"},pink:{bg:"bg-pink-500",stroke:"stroke-pink-500",fill:"fill-pink-500",text:"text-pink-500"},lime:{bg:"bg-lime-500",stroke:"stroke-lime-500",fill:"fill-lime-500",text:"text-lime-500"},fuchsia:{bg:"bg-fuchsia-500",stroke:"stroke-fuchsia-500",fill:"fill-fuchsia-500",text:"text-fuchsia-500"}},Nr=Object.keys(vr),To=(t,s)=>{const a=new Map;return t.forEach((r,i)=>{a.set(r,s[i%s.length])}),a},dt=(t,s)=>{var r;const a={bg:"bg-gray-500",stroke:"stroke-gray-500",fill:"fill-gray-500",text:"text-gray-500"};return((r=vr[t])==null?void 0:r[s])??a[s]},Qo=(t,s,a)=>[t?"auto":s??0,a??"auto"];function is(t,s){const a=[];for(const r of t)if(Object.prototype.hasOwnProperty.call(r,s)&&(a.push(r[s]),a.length>1))return!1;return!0}const zo=t=>{N.useEffect(()=>{const s=()=>{t()};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[t])},Io=({name:t,color:s,onClick:a,activeLegend:r})=>{const i=!!a;return e.jsxs("li",{className:I("group inline-flex flex-nowrap items-center gap-1.5 whitespace-nowrap rounded px-2 py-1 transition",i?"bg-transpaent cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800":"cursor-default"),onClick:n=>{n.stopPropagation(),a==null||a(t,s)},children:[e.jsx("span",{className:I("h-[3px] w-3.5 shrink-0 rounded-full",dt(s,"bg"),r&&r!==t?"opacity-40":"opacity-100"),"aria-hidden":"true"}),e.jsx("p",{className:I("truncate whitespace-nowrap text-xs","text-gray-700 dark:text-gray-300",i&&"group-hover:text-gray-900 dark:group-hover:text-gray-50",r&&r!==t?"opacity-40":"opacity-100"),children:t})]})},ta=({icon:t,onClick:s,disabled:a})=>{const r=t,[i,n]=h.useState(!1),o=h.useRef(null);return h.useEffect(()=>(i?o.current=setInterval(()=>{s==null||s()},300):clearInterval(o.current),()=>clearInterval(o.current)),[i,s]),h.useEffect(()=>{a&&(clearInterval(o.current),n(!1))},[a]),e.jsx("button",{type:"button",className:I("group inline-flex size-5 items-center truncate rounded transition",a?"cursor-not-allowed text-gray-400 dark:text-gray-600":"cursor-pointer text-gray-700 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-50"),disabled:a,onClick:l=>{l.stopPropagation(),s==null||s()},onMouseDown:l=>{l.stopPropagation(),n(!0)},onMouseUp:l=>{l.stopPropagation(),n(!1)},children:e.jsx(r,{className:"size-full","aria-hidden":"true"})})},Rr=h.forwardRef((t,s)=>{const{categories:a,colors:r=Nr,className:i,onClickLegendItem:n,activeLegend:o,enableLegendSlider:l=!1,...d}=t,c=h.useRef(null),[u,m]=h.useState(null),[g,x]=h.useState(null),f=h.useRef(null),b=h.useCallback(()=>{const j=c==null?void 0:c.current;if(!j)return;const v=j.scrollLeft>0,P=j.scrollWidth-j.clientWidth>j.scrollLeft;m({left:v,right:P})},[m]),y=h.useCallback(j=>{const v=c==null?void 0:c.current,P=(v==null?void 0:v.clientWidth)??0;v&&l&&(v.scrollTo({left:j==="left"?v.scrollLeft-P:v.scrollLeft+P,behavior:"smooth"}),setTimeout(()=>{b()},400))},[l,b]);h.useEffect(()=>{const j=v=>{v==="ArrowLeft"?y("left"):v==="ArrowRight"&&y("right")};return g?(j(g),f.current=setInterval(()=>{j(g)},300)):clearInterval(f.current),()=>clearInterval(f.current)},[g,y]);const S=j=>{j.stopPropagation(),(j.key==="ArrowLeft"||j.key==="ArrowRight")&&(j.preventDefault(),x(j.key))},k=j=>{j.stopPropagation(),x(null)};return h.useEffect(()=>{const j=c==null?void 0:c.current;return l&&(b(),j==null||j.addEventListener("keydown",S),j==null||j.addEventListener("keyup",k)),()=>{j==null||j.removeEventListener("keydown",S),j==null||j.removeEventListener("keyup",k)}},[b,l]),e.jsxs("ol",{ref:s,className:I("relative overflow-hidden",i),...d,children:[e.jsx("div",{ref:c,tabIndex:0,className:I("flex h-full",l?u!=null&&u.right||u!=null&&u.left?"snap-mandatory items-center overflow-auto pl-4 pr-12 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"":"flex-wrap"),children:a.map((j,v)=>e.jsx(Io,{name:j,color:r[v],onClick:n,activeLegend:o},`item-${v}`))}),l&&(u!=null&&u.right||u!=null&&u.left)?e.jsx(e.Fragment,{children:e.jsxs("div",{className:I("absolute bottom-0 right-0 top-0 flex h-full items-center justify-center pr-1","bg-white dark:bg-gray-950"),children:[e.jsx(ta,{icon:C.RiArrowLeftSLine,onClick:()=>{x(null),y("left")},disabled:!(u!=null&&u.left)}),e.jsx(ta,{icon:C.RiArrowRightSLine,onClick:()=>{x(null),y("right")},disabled:!(u!=null&&u.right)})]})}):null]})});Rr.displayName="Legend";const Lo=({payload:t},s,a,r,i,n)=>{const o=h.useRef(null);zo(()=>{var c;a((u=>u?Number(u)+15:60)((c=o.current)==null?void 0:c.clientHeight))});const l=t.filter(d=>d.type!=="none");return e.jsx("div",{ref:o,className:"flex items-center justify-end",children:e.jsx(Rr,{categories:l.map(d=>d.value),colors:l.map(d=>s.get(d.value)),onClickLegendItem:i,activeLegend:r,enableLegendSlider:n})})},Eo=({value:t,name:s,color:a})=>e.jsxs("div",{className:"flex items-center justify-between space-x-8",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("span",{"aria-hidden":"true",className:I("h-[3px] w-3.5 shrink-0 rounded-full",a)}),e.jsx("p",{className:I("whitespace-nowrap text-right","text-gray-700 dark:text-gray-300"),children:s})]}),e.jsx("p",{className:I("whitespace-nowrap text-right font-medium tabular-nums","text-gray-900 dark:text-gray-50"),children:t})]}),Do=({active:t,payload:s,categoryColors:a,valueFormatter:r})=>{if(t&&s){const i=s.filter(l=>l.type!=="none");if(!t||!s)return null;const n=s[0].payload.title,o=s[0].payload.evolution;return n?e.jsxs("div",{className:I("rounded-md border text-sm shadow-md","border-gray-200 dark:border-gray-800","bg-white dark:bg-gray-950"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 border-b border-inherit p-2",children:[e.jsx("p",{className:I("font-medium","text-gray-900 dark:text-gray-50"),children:n}),o!==void 0&&e.jsx(ht,{variant:Ur(o),children:kr(o)})]}),e.jsx("div",{className:I("space-y-1 p-2"),children:i.map((l,d)=>{const c=l.payload;return e.jsx(Eo,{value:r(l.value),name:d===0?c.formattedDate:c.previousFormattedDate,color:dt(a.get(l.name),"bg")},`id-${d}`)})})]}):null}return null},Cr=h.forwardRef((t,s)=>{const{data:a=[],categories:r=[],index:i,colors:n=Nr,valueFormatter:o=M=>M.toString(),startEndOnly:l=!1,showXAxis:d=!0,showYAxis:c=!0,showGridLines:u=!0,yAxisWidth:m=56,intervalType:g="equidistantPreserveStart",showTooltip:x=!0,showLegend:f=!0,autoMinValue:b=!1,minValue:y,maxValue:S,allowDecimals:k=!0,connectNulls:j=!1,className:v,onValueChange:P,enableLegendSlider:$=!1,tickGap:se=5,xAxisLabel:ee,yAxisLabel:U,...O}=t,je=!d&&!c?0:20,[Me,Ve]=h.useState(60),[W,Re]=h.useState(void 0),[B,D]=h.useState(void 0),J=To(r,n),ne=Qo(b,y,S),St=!!P;function Ni(M,me){me.stopPropagation(),St&&(M.index===(W==null?void 0:W.index)&&M.dataKey===(W==null?void 0:W.dataKey)||is(a,M.dataKey)&&B&&B===M.dataKey?(D(void 0),Re(void 0),P==null||P(null)):(D(M.dataKey),Re({index:M.index,dataKey:M.dataKey}),P==null||P({eventType:"dot",categoryClicked:M.dataKey,...M.payload})))}function Hs(M){St&&(M===B&&!W||is(a,M)&&W&&W.dataKey===M?(D(void 0),P==null||P(null)):(D(M),P==null||P({eventType:"category",categoryClicked:M})),Re(void 0))}return e.jsx("div",{ref:s,className:I("h-80 w-full",v),...O,children:e.jsx(oe.ResponsiveContainer,{children:e.jsxs(oe.LineChart,{data:a,onClick:St&&(B||W)?()=>{Re(void 0),D(void 0),P==null||P(null)}:void 0,margin:{bottom:ee?30:void 0,left:U?20:void 0,right:U?5:void 0,top:0},children:[u?e.jsx(oe.CartesianGrid,{className:I("stroke-gray-200 stroke-1 dark:stroke-gray-800"),horizontal:!0,vertical:!1}):null,e.jsx(oe.XAxis,{padding:{left:je,right:je},hide:!d,dataKey:i,interval:l?"preserveStartEnd":g,tick:{transform:"translate(0, 6)"},ticks:l?[a[0][i],a[a.length-1][i]]:void 0,fill:"",stroke:"",className:I("text-xs","fill-gray-500 dark:fill-gray-500"),tickLine:!1,axisLine:!1,minTickGap:se,children:ee&&e.jsx(oe.Label,{position:"insideBottom",offset:-20,className:"fill-gray-800 text-sm font-medium dark:fill-gray-200",children:ee})}),e.jsx(oe.YAxis,{width:m,hide:!c,axisLine:!1,tickLine:!1,type:"number",domain:ne,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:I("text-xs","fill-gray-500 dark:fill-gray-500"),tickFormatter:o,allowDecimals:k,children:U&&e.jsx(oe.Label,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-gray-800 text-sm font-medium dark:fill-gray-200",children:U})}),e.jsx(oe.Tooltip,{wrapperStyle:{outline:"none"},isAnimationActive:!0,animationDuration:100,cursor:{stroke:"#d1d5db",strokeWidth:1},offset:20,position:{y:0},content:x?({active:M,payload:me,label:Be})=>e.jsx(Do,{active:M,payload:me,label:Be,valueFormatter:o,categoryColors:J}):e.jsx(e.Fragment,{})}),f?e.jsx(oe.Legend,{verticalAlign:"top",height:Me,content:({payload:M})=>Lo({payload:M},J,Ve,B,St?me=>Hs(me):void 0,$)}):null,r.map(M=>e.jsx(oe.Line,{className:I(dt(J.get(M),"stroke")),strokeOpacity:W||B&&B!==M?.3:1,activeDot:me=>{const{cx:Be,cy:rt,stroke:Yt,strokeLinecap:es,strokeLinejoin:ts,strokeWidth:ss,dataKey:as}=me;return e.jsx(oe.Dot,{className:I("stroke-white dark:stroke-gray-950",P?"cursor-pointer":"",dt(J.get(as),"fill")),cx:Be,cy:rt,r:5,fill:"",stroke:Yt,strokeLinecap:es,strokeLinejoin:ts,strokeWidth:ss,onClick:(kt,Ri)=>Ni(me,Ri)})},dot:me=>{const{stroke:Be,strokeLinecap:rt,strokeLinejoin:Yt,strokeWidth:es,cx:ts,cy:ss,dataKey:as,index:kt}=me;return is(a,M)&&!(W||B&&B!==M)||(W==null?void 0:W.index)===kt&&(W==null?void 0:W.dataKey)===M?e.jsx(oe.Dot,{cx:ts,cy:ss,r:5,stroke:Be,fill:"",strokeLinecap:rt,strokeLinejoin:Yt,strokeWidth:es,className:I("stroke-white dark:stroke-gray-950",P?"cursor-pointer":"",dt(J.get(as),"fill"))},kt):e.jsx(h.Fragment,{},kt)},name:M,type:"linear",dataKey:M,stroke:"",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:!1,connectNulls:j},M)),P?r.map(M=>e.jsx(oe.Line,{className:I("cursor-pointer"),strokeOpacity:0,name:M,type:"linear",dataKey:M,stroke:"transparent",fill:"transparent",legendType:"none",tooltipType:"none",strokeWidth:12,connectNulls:j,onClick:(me,Be)=>{Be.stopPropagation();const{name:rt}=me;Hs(rt)}},M)):null]})})})});Cr.displayName="LineChart";const ve=h.forwardRef(({className:t,checked:s,...a},r)=>e.jsx(Zs.Root,{ref:r,...a,checked:s,className:w("relative inline-flex size-4 shrink-0 appearance-none items-center justify-center rounded shadow-xs outline-hidden ring-1 ring-inset transition duration-100 enabled:cursor-pointer","text-white dark:text-gray-50","bg-white dark:bg-gray-950","ring-gray-300 dark:ring-gray-800","data-disabled:bg-gray-100 data-disabled:text-gray-400 data-disabled:ring-gray-300","dark:data-disabled:bg-gray-800 dark:data-disabled:text-gray-500 dark:data-disabled:ring-gray-700","enabled:data-[state=checked]:bg-blue-600 enabled:data-[state=checked]:ring-0 enabled:data-[state=checked]:ring-transparent","enabled:data-[state=indeterminate]:bg-blue-600 enabled:data-[state=indeterminate]:ring-0 enabled:data-[state=indeterminate]:ring-transparent",ie,t),children:e.jsx(Zs.Indicator,{asChild:!0,className:"flex size-full items-center justify-center",children:s==="indeterminate"?e.jsx("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("line",{stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",x1:"4",x2:"12",y1:"8",y2:"8"})}):e.jsx("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M11.2 5.59998L6.79999 9.99998L4.79999 7.99998",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})})}));ve.displayName="Checkbox";const ot=N.forwardRef(({onClick:t,icon:s,disabled:a,...r},i)=>{const n=s;return e.jsx("button",{ref:i,type:"button",disabled:a,className:w("flex size-8 shrink-0 select-none items-center justify-center rounded border p-1 outline-hidden transition sm:size-[30px]","text-gray-600 hover:text-gray-800","dark:text-gray-400 dark:hover:text-gray-200","border-gray-300 dark:border-gray-800","hover:bg-gray-50 active:bg-gray-100","dark:hover:bg-gray-900 dark:active:bg-gray-800","disabled:pointer-events-none","disabled:border-gray-200 dark:disabled:border-gray-800","disabled:text-gray-400 dark:disabled:text-gray-600",ie),onClick:t,...r,children:e.jsx(n,{className:"size-full shrink-0"})})});ot.displayName="NavigationButton";const Pr=({mode:t="single",weekStartsOn:s=1,numberOfMonths:a=1,enableYearNavigation:r=!1,disableNavigation:i,locale:n,className:o,classNames:l,...d})=>e.jsx(jt.DayPicker,{mode:t,weekStartsOn:s,numberOfMonths:a,locale:n,showOutsideDays:a===1,className:w(o),classNames:{months:"flex space-y-0",month:"space-y-4 p-3",nav:"gap-1 flex items-center rounded-full size-full justify-between p-4",table:"w-full border-collapse space-y-1",head_cell:"w-9 font-medium text-sm sm:text-xs text-center text-gray-400 dark:text-gray-600 pb-2",row:"w-full mt-0.5",cell:w("relative p-0 text-center focus-within:relative","text-gray-900 dark:text-gray-50"),day:w("size-9 rounded text-sm text-gray-900 focus:z-10 dark:text-gray-50","hover:bg-gray-200 dark:hover:bg-gray-700",ie),day_today:"font-semibold",day_selected:w("rounded","aria-selected:bg-blue-600 aria-selected:text-gray-50","dark:aria-selected:bg-blue-500 dark:aria-selected:text-gray-50"),day_disabled:"text-gray-300! dark:text-gray-700! line-through disabled:hover:bg-transparent",day_outside:"text-gray-400 dark:text-gray-600",day_range_middle:w("rounded-none!","aria-selected:bg-gray-100! aria-selected:text-gray-900!","dark:aria-selected:bg-gray-900! dark:aria-selected:text-gray-50!"),day_range_start:"rounded-r-none rounded-l!",day_range_end:"rounded-l-none rounded-r!",day_hidden:"invisible",...l},components:{IconLeft:()=>e.jsx(C.RiArrowLeftSLine,{"aria-hidden":"true",className:"size-4"}),IconRight:()=>e.jsx(C.RiArrowRightSLine,{"aria-hidden":"true",className:"size-4"}),Caption:({...c})=>{const{goToMonth:u,nextMonth:m,previousMonth:g,currentMonth:x,displayMonths:f}=jt.useNavigation(),{numberOfMonths:b,fromDate:y,toDate:S}=jt.useDayPicker(),k=f.findIndex(U=>T.isSameMonth(c.displayMonth,U)),j=k===0,v=k===f.length-1,P=b>1&&(j||!v),$=b>1&&(v||!j),se=()=>{const U=T.addYears(x,-1);g&&(!y||U.getTime()>=y.getTime())&&u(U)},ee=()=>{const U=T.addYears(x,1);m&&(!S||U.getTime()<=S.getTime())&&u(U)};return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[r&&!$&&e.jsx(ot,{disabled:i||!g||y&&T.addYears(x,-1).getTime()<y.getTime(),"aria-label":"Go to previous year",onClick:se,icon:C.RiArrowLeftDoubleLine}),!$&&e.jsx(ot,{disabled:i||!g,"aria-label":"Go to previous month",onClick:()=>g&&u(g),icon:C.RiArrowLeftSLine})]}),e.jsx("div",{role:"presentation","aria-live":"polite",className:"text-sm font-medium capitalize tabular-nums text-gray-900 dark:text-gray-50",children:T.format(c.displayMonth,"LLLL yyy",{locale:n})}),e.jsxs("div",{className:"flex items-center gap-1",children:[!P&&e.jsx(ot,{disabled:i||!m,"aria-label":"Go to next month",onClick:()=>m&&u(m),icon:C.RiArrowRightSLine}),r&&!P&&e.jsx(ot,{disabled:i||!m||S&&T.addYears(x,1).getTime()>S.getTime(),"aria-label":"Go to next year",onClick:ee,icon:C.RiArrowRightDoubleLine})]})]})},Day:({date:c,displayMonth:u})=>{const m=N.useRef(null),{activeModifiers:g,buttonProps:x,divProps:f,isButton:b,isHidden:y}=jt.useDayRender(c,u,m),{selected:S,today:k,disabled:j,range_middle:v}=g;if(y)return e.jsx(e.Fragment,{});if(!b)return e.jsx("div",{...f,className:w("flex items-center justify-center",f.className)});const{children:P,className:$,...se}=x;return e.jsxs("button",{ref:m,...se,type:"button",className:w("relative",$),children:[P,k&&e.jsx("span",{className:w("absolute inset-x-1/2 bottom-1.5 h-0.5 w-4 -translate-x-1/2 rounded-[2px]",{"bg-blue-500 dark:bg-blue-500":!S,"bg-white! dark:bg-gray-950!":S,"bg-gray-400! dark:bg-gray-600!":S&&v,"bg-gray-400 text-gray-400 dark:bg-gray-400 dark:text-gray-600":j})})]})}},...d});Pr.displayName="Calendar";const Mo=()=>{const t=typeof window<"u"?window.navigator.language:"en-US",s=new Intl.DateTimeFormat(t,{hour:"numeric"}).format();return Number.isInteger(Number(s))},Bo=({segment:t,state:s})=>{const a=N.useRef(null),{segmentProps:r}=ua.useDateSegment(t,s,a),i=t.type==="literal"&&t.text===":",n=t.type==="literal"&&t.text===" ",o=i||n;return e.jsxs("div",{...r,ref:a,className:I("relative block w-full appearance-none rounded-md border px-2.5 py-1.5 text-left uppercase tabular-nums shadow-xs outline-hidden transition sm:text-sm","border-gray-300 dark:border-gray-800","text-gray-900 dark:text-gray-50","bg-white dark:bg-gray-950",tt,"invalid:border-red-500 invalid:ring-2 invalid:ring-red-200 group-aria-invalid/time-input:border-red-500 group-aria-invalid/time-input:ring-2 group-aria-invalid/time-input:ring-red-200 dark:group-aria-invalid/time-input:ring-red-400/20",{"w-fit! border-none bg-transparent px-0 text-gray-400 shadow-none":o,hidden:n,"border-gray-300 bg-gray-100 text-gray-400 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-500":s.isDisabled,"bg-transparent! text-gray-400!":!t.isEditable}),children:[e.jsx("span",{"aria-hidden":"true",className:I("pointer-events-none block w-full text-left text-gray-700 sm:text-sm",{hidden:!t.isPlaceholder,"h-0":!t.isPlaceholder}),children:t.placeholder}),t.isPlaceholder?" ":t.text]})},us=N.forwardRef(({hourCycle:t,...s},a)=>{const r=N.useRef(null);N.useImperativeHandle(a,()=>r==null?void 0:r.current);const i=window!==void 0?window.navigator.language:"en-US",n=Mi.useTimeFieldState({hourCycle:t,locale:i,shouldForceLeadingZeros:!0,autoFocus:!0,...s}),{fieldProps:o}=ua.useTimeField({...s,hourCycle:t,shouldForceLeadingZeros:!0},n,r);return e.jsx("div",{...o,ref:r,className:"group/time-input inline-flex w-full gap-x-2",children:n.segments.map((l,d)=>e.jsx(Bo,{segment:l,state:n},d))})});us.displayName="TimeInput";const Jo=Se.tv({base:["peer flex w-full cursor-pointer appearance-none items-center gap-x-2 truncate rounded-md border px-3 py-2 shadow-xs outline-hidden transition-all sm:text-sm","bg-white dark:bg-gray-950","border-gray-300 dark:border-gray-800","text-gray-900 dark:text-gray-50","placeholder-gray-400 dark:placeholder-gray-500","hover:bg-gray-50 dark:hover:bg-gray-950/50","disabled:pointer-events-none","disabled:bg-gray-100 disabled:text-gray-400","dark:disabled:border-gray-800 dark:disabled:bg-gray-800 dark:disabled:text-gray-500",tt],variants:{hasError:{true:_t}}}),Tr=N.forwardRef(({className:t,children:s,placeholder:a,hasError:r,...i},n)=>e.jsx(q.Trigger,{asChild:!0,children:e.jsxs("button",{ref:n,className:I(Jo({hasError:r}),t),...i,children:[e.jsx(C.RiCalendar2Fill,{className:"size-5 shrink-0 text-gray-400 dark:text-gray-600"}),e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left text-gray-900 dark:text-gray-50",children:s||(a?e.jsx("span",{className:"text-gray-400 dark:text-gray-600",children:a}):null)})]})}));Tr.displayName="DatePicker.Trigger";const Qr=N.forwardRef(({align:t,className:s,children:a,...r},i)=>e.jsx(q.Portal,{children:e.jsx(q.Content,{ref:i,sideOffset:10,side:"bottom",align:t,avoidCollisions:!0,onOpenAutoFocus:n=>n.preventDefault(),className:I("relative z-50 w-fit rounded-md border text-sm shadow-xl shadow-black/[2.5%]","min-w-[calc(var(--radix-select-trigger-width)-2px)] max-w-[95vw]","border-gray-200 dark:border-gray-800","bg-white dark:bg-gray-950","will-change-[transform,opacity]","data-[state=closed]:animate-hide","data-[state=open]:data-[side=bottom]:animate-slideDownAndFade data-[state=open]:data-[side=left]:animate-slideLeftAndFade data-[state=open]:data-[side=right]:animate-slideRightAndFade data-[state=open]:data-[side=top]:animate-slideUpAndFade",s),...r,children:a})}));Qr.displayName="DatePicker.CalendarPopover";const zr=({presets:t,onSelect:s,currentValue:a})=>{const r=c=>"dateRange"in c,i=c=>"date"in c,n=c=>{r(c)?s(c.dateRange):i(c)&&s(c.date)},o=(c,u)=>c.getDate()===u.getDate()&&c.getMonth()===u.getMonth()&&c.getFullYear()===u.getFullYear(),l=(c,u)=>{const m=c.from,g=u.from;let x=!1;m&&g&&o(m,g)&&(x=!0);const f=c.to,b=u.to;let y=!1;return f&&b&&o(f,b)&&(y=!0),x&&y},d=c=>{if(r(c)){const u=a;return u&&l(u,c.dateRange)}else if(i(c)){const u=a;return u&&o(u,c.date)}return!1};return e.jsx("ul",{className:"flex items-start gap-x-2 sm:flex-col",children:t.map((c,u)=>e.jsx("li",{className:"sm:w-full sm:py-px",children:e.jsx("button",{title:c.label,className:I("relative w-full overflow-hidden text-ellipsis whitespace-nowrap rounded border px-2.5 py-1.5 text-left text-base shadow-xs outline-hidden transition-all sm:border-none sm:py-2 sm:text-sm sm:shadow-none","text-gray-700 dark:text-gray-300","border-gray-200 dark:border-gray-800",ie,"focus-visible:bg-gray-100 dark:focus-visible:bg-gray-900","hover:bg-gray-100 dark:hover:bg-gray-900",{"bg-gray-100 dark:bg-gray-900":d(c)}),onClick:()=>n(c),"aria-label":`Select ${c.label}`,children:e.jsx("span",{children:c.label})})},u))})};zr.displayName="DatePicker.PresetContainer";const sa=(t,s,a)=>{const r=!Mo();let i;return a?i=r?T.format(t,"dd MMM, yyyy h:mm a",{locale:s}):T.format(t,"dd MMM, yyyy HH:mm",{locale:s}):i=T.format(t,"dd MMM, yyyy",{locale:s}),i},Oo=({defaultValue:t,value:s,onChange:a,presets:r,disabled:i,disableNavigation:n,disabledDays:o,enableYearNavigation:l=!1,locale:d=Bi.enUS,showTimePicker:c,placeholder:u="Select date range",hasError:m,translations:g,align:x="center",className:f,...b})=>{const[y,S]=N.useState(!1),[k,j]=N.useState(s??t??void 0),[v,P]=N.useState(k==null?void 0:k.from),[$,se]=N.useState(s!=null&&s.from?new te.Time(s.from.getHours(),s.from.getMinutes()):t!=null&&t.from?new te.Time(t.from.getHours(),t.from.getMinutes()):new te.Time(0,0)),[ee,U]=N.useState(s!=null&&s.to?new te.Time(s.to.getHours(),s.to.getMinutes()):t!=null&&t.to?new te.Time(t.to.getHours(),t.to.getMinutes()):new te.Time(0,0)),O=N.useMemo(()=>k,[y]);N.useEffect(()=>{j(s??t??void 0)},[s,t]),N.useEffect(()=>{k&&P(k.from)},[k]),N.useEffect(()=>{y||P(k==null?void 0:k.from)},[y]);const je=D=>{const J=D;c&&(J!=null&&J.from&&!$&&se(new te.Time(0,0)),J!=null&&J.to&&!ee&&U(new te.Time(0,0)),J!=null&&J.from&&$&&(J.from.setHours($.hour),J.from.setMinutes($.minute)),J!=null&&J.to&&ee&&(J.to.setHours(ee.hour),J.to.setMinutes(ee.minute))),j(J)},Me=()=>{j(O),se(O!=null&&O.from?new te.Time(O.from.getHours(),O.from.getMinutes()):new te.Time(0,0)),U(O!=null&&O.to?new te.Time(O.to.getHours(),O.to.getMinutes()):new te.Time(0,0)),S(!1)},Ve=D=>{D||Me(),S(D)},W=(D,J)=>{switch(J){case"start":se(D);break;case"end":U(D);break}if(k){if(J==="start"){if(!k.from)return;const ne=new Date(k.from.getTime());D?(ne.setHours(D.hour),ne.setMinutes(D.minute)):(ne.setHours(0),ne.setMinutes(0)),j({...k,from:ne})}if(J==="end"){if(!k.to)return;const ne=new Date(k.to.getTime());D?(ne.setHours(D.hour),ne.setMinutes(D.minute)):(ne.setHours(0),ne.setMinutes(0)),j({...k,to:ne})}}};N.useEffect(()=>{j(s??t??void 0),se(s!=null&&s.from?new te.Time(s.from.getHours(),s.from.getMinutes()):t!=null&&t.from?new te.Time(t.from.getHours(),t.from.getMinutes()):new te.Time(0,0)),U(s!=null&&s.to?new te.Time(s.to.getHours(),s.to.getMinutes()):t!=null&&t.to?new te.Time(t.to.getHours(),t.to.getMinutes()):new te.Time(0,0))},[s,t]);const Re=N.useMemo(()=>k?`${k.from?sa(k.from,d,c):""} - ${k.to?sa(k.to,d,c):""}`:null,[k,d,c]),B=()=>{S(!1),a==null||a(k)};return e.jsxs(q.Root,{"tremor-id":"tremor-raw",open:y,onOpenChange:Ve,children:[e.jsx(Tr,{placeholder:u,disabled:i,className:f,hasError:m,"aria-required":b.required||b["aria-required"],"aria-invalid":b["aria-invalid"],"aria-label":b["aria-label"],"aria-labelledby":b["aria-labelledby"],children:Re}),e.jsx(Qr,{align:x,children:e.jsx("div",{className:"flex",children:e.jsxs("div",{className:"flex flex-col overflow-x-auto sm:flex-row sm:items-start",children:[r&&r.length>0&&e.jsx("div",{className:I("relative flex h-16 w-full items-center sm:h-full sm:w-40","border-b border-gray-200 sm:border-b-0 sm:border-r dark:border-gray-800","overflow-auto"),children:e.jsx("div",{className:"absolute px-3 sm:inset-0 sm:left-0 sm:p-2",children:e.jsx(zr,{currentValue:k,presets:r,onSelect:je})})}),e.jsxs("div",{className:"overflow-x-auto",children:[e.jsx(Pr,{mode:"range",selected:k,onSelect:je,month:v,onMonthChange:P,numberOfMonths:2,disabled:o,disableNavigation:n,enableYearNavigation:l,locale:d,initialFocus:!0,classNames:{months:"flex flex-row divide-x divide-gray-200 dark:divide-gray-800 overflow-x-auto"},...b}),c&&e.jsxs("div",{className:"flex items-center justify-evenly gap-x-3 border-t border-gray-200 p-3 dark:border-gray-800",children:[e.jsxs("div",{className:"flex flex-1 items-center gap-x-2",children:[e.jsxs("span",{className:"dark:text-gray-30 text-gray-700",children:[(g==null?void 0:g.start)??"Start",":"]}),e.jsx(us,{value:$,onChange:D=>W(D,"start"),"aria-label":"Start date time",isDisabled:!(k!=null&&k.from),isRequired:b.required})]}),e.jsx(C.RiSubtractFill,{className:"size-4 shrink-0 text-gray-400"}),e.jsxs("div",{className:"flex flex-1 items-center gap-x-2",children:[e.jsxs("span",{className:"dark:text-gray-30 text-gray-700",children:[(g==null?void 0:g.end)??"End",":"]}),e.jsx(us,{value:ee,onChange:D=>W(D,"end"),"aria-label":"End date time",isDisabled:!(k!=null&&k.to),isRequired:b.required})]})]}),e.jsxs("div",{className:"border-t border-gray-200 p-3 sm:flex sm:items-center sm:justify-between dark:border-gray-800",children:[e.jsxs("p",{className:"tabular-nums text-gray-900 dark:text-gray-50",children:[e.jsxs("span",{className:"text-gray-700 dark:text-gray-300",children:[(g==null?void 0:g.range)??"Range",":"]})," ",e.jsx("span",{className:"font-medium",children:Re})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-x-2 sm:mt-0",children:[e.jsx(z,{variant:"secondary",className:"h-8 w-full sm:w-fit",type:"button",onClick:Me,children:(g==null?void 0:g.cancel)??"Cancel"}),e.jsx(z,{variant:"primary",className:"h-8 w-full sm:w-fit",type:"button",onClick:B,children:(g==null?void 0:g.apply)??"Apply"})]})]})]})]})})})]})},Fo=(t,s)=>{const{toYear:a,fromYear:r,fromMonth:i,toMonth:n,fromDay:o,toDay:l}=s;if(t&&t.length>0){const d=r,c=a;t.forEach(u=>{var m,g,x,f,b,y;if("date"in u){const S=u.date.getFullYear();if(r&&S<r)throw new Error(`Preset ${u.label} is before fromYear ${d}.`);if(a&&S>a)throw new Error(`Preset ${u.label} is after toYear ${c}.`);if(i&&u.date.getMonth()<i.getMonth())throw new Error(`Preset ${u.label} is before fromMonth ${i}.`);if(n&&u.date.getMonth()>n.getMonth())throw new Error(`Preset ${u.label} is after toMonth ${n}.`);if(o&&u.date.getDate()<o.getDate())throw new Error(`Preset ${u.label} is before fromDay ${o}.`);if(l&&u.date.getDate()>l.getDate())throw new Error(`Preset ${u.label} is after toDay ${T.format(l,"MMM dd, yyyy")}.`)}if("dateRange"in u){const S=(m=u.dateRange.from)==null?void 0:m.getFullYear(),k=(g=u.dateRange.to)==null?void 0:g.getFullYear();if(S&&r&&S<r)throw new Error(`Preset ${u.label}'s 'from' is before fromYear ${d}.`);if(k&&a&&k>a)throw new Error(`Preset ${u.label}'s 'to' is after toYear ${c}.`);if(i){const j=(x=u.dateRange.from)==null?void 0:x.getMonth();if(j&&j<i.getMonth())throw new Error(`Preset ${u.label}'s 'from' is before fromMonth ${T.format(i,"MMM, yyyy")}.`)}if(n){const j=(f=u.dateRange.to)==null?void 0:f.getMonth();if(j&&j>n.getMonth())throw new Error(`Preset ${u.label}'s 'to' is after toMonth ${T.format(n,"MMM, yyyy")}.`)}if(o){const j=(b=u.dateRange.from)==null?void 0:b.getDate();if(j&&j<o.getDate())throw new Error(`Preset ${u.dateRange.from}'s 'from' is before fromDay ${T.format(o,"MMM dd, yyyy")}.`)}if(l){const j=(y=u.dateRange.to)==null?void 0:y.getDate();if(j&&j>l.getDate())throw new Error(`Preset ${u.label}'s 'to' is after toDay ${T.format(l,"MMM dd, yyyy")}.`)}}})}},Ir=({presets:t,...s})=>(t&&Fo(t,s),e.jsx(Oo,{presets:t,...s}));Ir.displayName="DateRangePicker";const xt=t=>e.jsx(Z.Root,{...t});xt.displayName="Dialog";const Ts=Z.Trigger;Ts.displayName="DialogTrigger";const Et=Z.Close;Et.displayName="DialogClose";const Lr=Z.Portal;Lr.displayName="DialogPortal";const Er=h.forwardRef(({className:t,...s},a)=>e.jsx(Z.Overlay,{ref:a,className:w("fixed inset-0 z-50 overflow-y-auto","bg-black/70","data-[state=open]:animate-dialogOverlayShow",t),...s}));Er.displayName="DialogOverlay";const ft=h.forwardRef(({className:t,...s},a)=>e.jsx(Lr,{children:e.jsx(Er,{children:e.jsx(Z.Content,{ref:a,className:w("fixed left-1/2 top-1/2 z-50 w-[95vw] max-w-lg -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-md border p-6 shadow-lg","border-gray-200 dark:border-gray-900","bg-white dark:bg-[#090E1A]","data-[state=open]:animate-dialogContentShow",ie,t),...s})})}));ft.displayName="DialogContent";const yt=({className:t,...s})=>e.jsx("div",{className:w("flex flex-col gap-y-1",t),...s});yt.displayName="DialogHeader";const wt=h.forwardRef(({className:t,...s},a)=>e.jsx(Z.Title,{ref:a,className:w("text-lg font-semibold","text-gray-900 dark:text-gray-50",t),...s}));wt.displayName="DialogTitle";const bt=h.forwardRef(({className:t,...s},a)=>e.jsx(Z.Description,{ref:a,className:w("text-gray-500 dark:text-gray-500",t),...s}));bt.displayName="DialogDescription";const Dr=({className:t,...s})=>e.jsx("div",{className:w("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});Dr.displayName="DialogFooter";const be=N.forwardRef(({className:t,disabled:s,...a},r)=>e.jsx(pa.Root,{ref:r,className:I("text-sm leading-none","text-gray-900 dark:text-gray-50",{"text-gray-400 dark:text-gray-600":s},t),"aria-disabled":s,...a}));be.displayName="Label";const Mr=G.Root;Mr.displayName="Select";const Vo=G.Group;Vo.displayName="SelectGroup";const Br=G.Value;Br.displayName="SelectValue";const Ho=[w("group/trigger flex w-full select-none items-center justify-between gap-2 truncate rounded-md border px-3 py-2 shadow-xs outline-hidden transition sm:text-sm","border-gray-300 dark:border-gray-800","text-gray-900 dark:text-gray-50","data-placeholder:text-gray-500 dark:data-placeholder:text-gray-500","bg-white dark:bg-gray-950","hover:bg-gray-50 dark:hover:bg-gray-950/50","data-disabled:bg-gray-100 data-disabled:text-gray-400","dark:data-disabled:border-gray-700 dark:data-disabled:bg-gray-800 dark:data-disabled:text-gray-500",tt)],Jr=h.forwardRef(({className:t,hasError:s,children:a,...r},i)=>e.jsxs(G.Trigger,{ref:i,className:w(Ho,s?_t:"",t),...r,children:[e.jsx("span",{className:"truncate",children:a}),e.jsx(G.Icon,{asChild:!0,children:e.jsx(C.RiArrowDownSLine,{className:w("-mr-1 size-5 shrink-0","text-gray-400 dark:text-gray-600","group-data-disabled/trigger:text-gray-300 dark:group-data-disabled/trigger:text-gray-600")})})]}));Jr.displayName="SelectTrigger";const Or=h.forwardRef(({className:t,...s},a)=>e.jsx(G.ScrollUpButton,{ref:a,className:w("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(C.RiArrowUpSLine,{className:"size-3 shrink-0","aria-hidden":"true"})}));Or.displayName=G.ScrollUpButton.displayName;const Fr=h.forwardRef(({className:t,...s},a)=>e.jsx(G.ScrollDownButton,{ref:a,className:w("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(C.RiArrowDownSLine,{className:"size-3 shrink-0","aria-hidden":"true"})}));Fr.displayName=G.ScrollDownButton.displayName;const Vr=h.forwardRef(({className:t,position:s="popper",children:a,sideOffset:r=8,collisionPadding:i=10,...n},o)=>e.jsx(G.Portal,{children:e.jsxs(G.Content,{ref:o,className:w("relative z-50 overflow-hidden rounded-md border shadow-xl shadow-black/[2.5%]","min-w-[calc(var(--radix-select-trigger-width)-2px)] max-w-[95vw]","max-h-(--radix-select-content-available-height)","bg-white dark:bg-gray-950","text-gray-900 dark:text-gray-50","border-gray-200 dark:border-gray-800","will-change-[transform,opacity]","data-[state=closed]:animate-hide","data-[side=bottom]:animate-slideDownAndFade data-[side=left]:animate-slideLeftAndFade data-[side=right]:animate-slideRightAndFade data-[side=top]:animate-slideUpAndFade",t),sideOffset:r,position:s,collisionPadding:i,...n,children:[e.jsx(Or,{}),e.jsx(G.Viewport,{className:w("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[calc(var(--radix-select-trigger-width))]"),children:a}),e.jsx(Fr,{})]})}));Vr.displayName="SelectContent";const Zo=h.forwardRef(({className:t,...s},a)=>e.jsx(G.Label,{ref:a,className:w("px-3 py-2 text-xs font-medium tracking-wide","text-gray-500 dark:text-gray-500",t),...s}));Zo.displayName="SelectGroupLabel";const Uo=h.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(G.Item,{ref:r,className:w("grid cursor-pointer grid-cols-[1fr_20px] gap-x-2 rounded px-3 py-2 outline-hidden transition-colors data-[state=checked]:font-semibold sm:text-sm","text-gray-900 dark:text-gray-50","data-disabled:pointer-events-none data-disabled:text-gray-400 data-disabled:hover:bg-none dark:data-disabled:text-gray-600","focus-visible:bg-gray-100 dark:focus-visible:bg-gray-900","hover:bg-gray-100 dark:hover:bg-gray-900",t),...a,children:[e.jsx(G.ItemText,{className:"flex-1 truncate",children:s}),e.jsx(G.ItemIndicator,{children:e.jsx(C.RiCheckLine,{className:"size-5 shrink-0 text-gray-800 dark:text-gray-200","aria-hidden":"true"})})]}));Uo.displayName="SelectItem";const Hr=h.forwardRef(({className:t,children:s,period:a,...r},i)=>e.jsxs(G.Item,{ref:i,className:w("relative flex cursor-pointer items-center rounded py-2 pl-8 pr-3 outline-hidden transition-colors data-[state=checked]:font-semibold sm:text-sm","text-gray-900 dark:text-gray-50","data-disabled:pointer-events-none data-disabled:text-gray-400 data-disabled:hover:bg-none dark:data-disabled:text-gray-600","focus-visible:bg-gray-100 dark:focus-visible:bg-gray-900","hover:bg-gray-100 dark:hover:bg-gray-900",t),...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(G.ItemIndicator,{children:e.jsx(C.RiCheckLine,{className:"size-5 shrink-0 text-gray-800 dark:text-gray-200","aria-hidden":"true"})})}),e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx("span",{className:"w-40 sm:w-32",children:e.jsx(G.ItemText,{children:s})}),e.jsx("span",{children:(a==null?void 0:a.from)&&(a==null?void 0:a.to)&&e.jsxs("span",{className:"whitespace-nowrap font-normal text-gray-400",children:[T.format(a.from,"MMM d, yyyy")," –"," ",T.format(a.to,"MMM d, yyyy")]})})]})]}));Hr.displayName="SelectItemPeriod";const Wo=h.forwardRef(({className:t,...s},a)=>e.jsx(G.Separator,{ref:a,className:w("-mx-1 my-1 h-px","bg-gray-300 dark:bg-gray-700",t),...s}));Wo.displayName="SelectSeparator";const qo=[{value:"previous-period",label:"Previous period"},{value:"last-year",label:"Last year"},{value:"no-comparison",label:"No comparison"}],Zr=(t,s)=>{const{from:a,to:r}=t||{};switch(s){case"previous-period":{let i,n;if(a&&r){const o=T.interval(a,r),l=T.eachDayOfInterval(o).length;n=T.subDays(a,1),i=T.subDays(n,l)}return{from:i,to:n}}case"last-year":{let i,n;return a&&(i=T.subYears(a,1)),r&&(n=T.subYears(r,1)),{from:i,to:n}}default:return t}};function $o({maxDate:t,minDate:s,selectedDates:a,onDatesChange:r,selectedPeriod:i,onPeriodChange:n,categories:o,setSelectedCategories:l,selectedCategories:d}){const[c,u]=h.useState(d),m=x=>{u(f=>f.includes(x)?f.filter(b=>b!==x):[...f,x])},g=()=>{l(c)};return e.jsxs("div",{className:"flex w-full justify-between",children:[e.jsxs("div",{className:"w-full sm:flex sm:items-center sm:gap-2",children:[e.jsx(Ir,{value:a,onChange:r,className:"w-full sm:w-fit",toDate:t,fromDate:s,align:"start"}),e.jsx("span",{className:"hidden text-sm font-medium text-gray-500 sm:block",children:"compared to"}),e.jsxs(Mr,{defaultValue:"no-comparison",value:i,onValueChange:x=>{n(x)},children:[e.jsx(Jr,{className:"mt-2 w-full sm:mt-0 sm:w-fit",children:e.jsx(Br,{})}),e.jsx(Vr,{children:qo.map(x=>e.jsx(Hr,{value:x.value,period:Zr(a,x.value),children:x.label},x.value))})]})]}),e.jsxs(xt,{children:[e.jsx(Ts,{asChild:!0,children:e.jsxs(z,{variant:"secondary",className:"hidden gap-2 px-2 py-1 sm:flex",children:[e.jsx(C.RiSettings5Line,{className:"-ml-0.5 size-4 shrink-0","aria-hidden":"true"}),e.jsx("span",{children:"Edit"})]})}),e.jsxs(ft,{className:"max-w-5xl",children:[e.jsxs(yt,{children:[e.jsx(wt,{children:"Customise overview charts"}),e.jsx(bt,{className:"sr-only",children:"Add or remove the charts for the overview panel."})]}),e.jsx("div",{className:w("mt-8 grid max-h-[70vh] grid-cols-1 gap-4 overflow-y-scroll sm:grid-cols-1 md:grid-cols-2 xl:grid-cols-3"),children:o.map(x=>e.jsxs(be,{htmlFor:x.title,className:"relative cursor-pointer rounded-md border border-gray-200 p-4 shadow-xs dark:border-gray-800",children:[e.jsx(ve,{id:x.title,className:"absolute right-4",checked:c.includes(x.title),onCheckedChange:()=>m(x.title)}),e.jsx("div",{className:"pointer-events-none",children:e.jsx(Wr,{title:x.title,type:x.type,selectedDates:a,selectedPeriod:i,isThumbnail:!0})})]},x.title))}),e.jsxs(Dr,{className:"mt-6",children:[e.jsx(Et,{asChild:!0,children:e.jsx(z,{className:"mt-2 w-full sm:mt-0 sm:w-fit",variant:"secondary",children:"Cancel"})}),e.jsx(Et,{asChild:!0,children:e.jsx(z,{className:"w-full sm:w-fit",onClick:g,children:"Apply"})})]})]})]})]})}const _o={currency:Ys.currency,unit:Ys.unit},Ur=t=>t>0?"success":t<0?t<-50?"warning":"error":"neutral";function Wr({title:t,type:s,selectedDates:a,selectedPeriod:r,isThumbnail:i}){const n=_o[s],o=a!=null&&a.from&&(a!=null&&a.to)?T.interval(a.from,a.to):null,l=a!=null&&a.from&&(a!=null&&a.to)?T.eachDayOfInterval(T.interval(a.from,a.to)):null,d=Zr(a,r),c=d!=null&&d.from&&(d!=null&&d.to)?T.interval(d.from,d.to):null,u=cs.filter(S=>o?T.isWithinInterval(S.date,o):!0).sort((S,k)=>new Date(S.date).getTime()-new Date(k.date).getTime()),m=cs.filter(S=>c?T.isWithinInterval(S.date,c):!1).sort((S,k)=>new Date(S.date).getTime()-new Date(k.date).getTime()),g=l==null?void 0:l.map((S,k)=>{const j=u[k],v=m[k],P=(j==null?void 0:j[t])||null,$=(v==null?void 0:v[t])||null;return{title:t,date:S,formattedDate:T.formatDate(S,"dd/MM/yyyy"),value:P,previousDate:v==null?void 0:v.date,previousFormattedDate:v?T.formatDate(v.date,"dd/MM/yyyy"):null,previousValue:r!=="no-comparison"?$:null,evolution:r!=="no-comparison"&&P&&$?(P-$)/$:void 0}}).sort((S,k)=>new Date(S.date).getTime()-new Date(k.date).getTime()),x=r==="no-comparison"?["value"]:["value","previousValue"],f=(g==null?void 0:g.reduce((S,k)=>S+(k.value||0),0))||0,b=(g==null?void 0:g.reduce((S,k)=>S+(k.previousValue||0),0))||0,y=r!=="no-comparison"?(f-b)/b:0;return e.jsxs("div",{className:I("transition"),children:[e.jsx("div",{className:"flex items-center justify-between gap-x-2",children:e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx("dt",{className:"font-bold text-gray-900 sm:text-sm dark:text-gray-50",children:t}),r!=="no-comparison"&&e.jsx(ht,{variant:Ur(y),children:kr(y)})]})}),e.jsxs("div",{className:"mt-2 flex items-baseline justify-between",children:[e.jsx("dd",{className:"text-xl text-gray-900 dark:text-gray-50",children:n(f)}),r!=="no-comparison"&&e.jsxs("dd",{className:"text-sm text-gray-500",children:["from ",n(b)]})]}),e.jsx(Cr,{className:"mt-6 h-32",data:g||[],index:"formattedDate",colors:["fuchsia","gray"],startEndOnly:!0,valueFormatter:S=>n(S),showYAxis:!1,showLegend:!1,categories:x,showTooltip:!i,autoMinValue:!0})]})}const Go=Se.tv({slots:{background:"",bar:""},variants:{variant:{default:{background:"bg-blue-100 dark:bg-blue-500/30",bar:"bg-blue-600 dark:bg-blue-500"},neutral:{background:"bg-gray-200 dark:bg-gray-500/40",bar:"bg-gray-500 dark:bg-gray-500"},warning:{background:"bg-yellow-200 dark:bg-yellow-500/30",bar:"bg-yellow-500 dark:bg-yellow-500"},error:{background:"bg-red-200 dark:bg-red-500/30",bar:"bg-red-500 dark:bg-red-500"},success:{background:"bg-emerald-200 dark:bg-emerald-500/30",bar:"bg-emerald-500 dark:bg-emerald-500"}}},defaultVariants:{variant:"default"}}),qr=h.forwardRef(({value:t=0,max:s=100,label:a,showAnimation:r=!1,variant:i,className:n,...o},l)=>{const d=Math.min(s,Math.max(t,0)),{background:c,bar:u}=Go({variant:i});return e.jsxs("div",{ref:l,className:w("flex w-full items-center",n),...o,children:[e.jsx("div",{className:w("relative flex h-2 w-full items-center rounded-full",c()),"aria-label":"progress bar","aria-valuenow":t,"aria-valuemax":s,children:e.jsx("div",{className:w("h-full flex-col rounded-full",u(),r&&"transform-gpu transition-all duration-300 ease-in-out"),style:{width:s?`${d/s*100}%`:`${d}%`}})}),a?e.jsx("span",{className:w("ml-2 whitespace-nowrap text-sm font-medium leading-none","text-gray-900 dark:text-gray-50"),children:a}):null]})});qr.displayName="ProgressBar";function aa({title:t,change:s,value:a,valueDescription:r,ctaDescription:i,ctaText:n,ctaLink:o,data:l}){return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("dt",{className:"font-bold text-gray-900 sm:text-sm dark:text-gray-50",children:t}),e.jsx(ht,{variant:"neutral",children:s})]}),e.jsxs("dd",{className:"mt-2 flex items-baseline gap-2",children:[e.jsx("span",{className:"text-xl text-gray-900 dark:text-gray-50",children:a}),e.jsx("span",{className:"text-sm text-gray-500",children:r})]}),e.jsx("ul",{role:"list",className:"mt-4 space-y-5",children:l.map(d=>e.jsxs("li",{children:[e.jsxs("p",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-50",children:d.title}),e.jsxs("span",{className:"font-medium text-gray-900 dark:text-gray-50",children:[d.current,e.jsxs("span",{className:"font-normal text-gray-500",children:["/",d.allowed,d.unit]})]})]}),e.jsx(qr,{value:d.percentage,className:"mt-2 *:h-1.5"})]},d.title))})]}),e.jsx("div",{children:e.jsxs("p",{className:"mt-6 text-xs text-gray-500",children:[i," ",e.jsx("a",{href:o,className:"text-blue-600 dark:text-blue-400",children:n})]})})]})})}const ns=[{title:"Rows read",type:"unit"},{title:"Rows written",type:"unit"},{title:"Queries",type:"unit"},{title:"Payments completed",type:"currency"},{title:"Sign ups",type:"unit"},{title:"Logins",type:"unit"},{title:"Sign outs",type:"unit"},{title:"Support calls",type:"unit"}],Ko=[{title:"Rows read",percentage:48.1,current:48.1,allowed:100,unit:"M"},{title:"Rows written",percentage:78.3,current:78.3,allowed:100,unit:"M"},{title:"Storage",percentage:26,current:5.2,allowed:20,unit:"GB"}],Xo=[{title:"Weekly active users",percentage:21.7,current:21.7,allowed:100,unit:"%"},{title:"Total users",percentage:70,current:28,allowed:40},{title:"Uptime",percentage:98.3,current:98.3,allowed:100,unit:"%"}],Yo=[{title:"Base tier",percentage:68.1,value:"$200",color:"bg-blue-600 dark:bg-blue-500"},{title:"On-demand charges",percentage:20.8,value:"$61.1",color:"bg-purple-600 dark:bg-purple-500"},{title:"Caching",percentage:11.1,value:"$31.9",color:"bg-gray-400 dark:bg-gray-600"}],el=cs.map(t=>T.toDate(t.date).getTime()),os=T.toDate(Math.max(...el));function tl(){const[t,s]=h.useState({from:T.subDays(os,30),to:os}),[a,r]=h.useState("last-year"),[i,n]=h.useState(ns.map(o=>o.title));return e.jsxs(e.Fragment,{children:[e.jsxs("section",{"aria-labelledby":"current-billing-cycle",children:[e.jsx("h1",{id:"current-billing-cycle",className:"scroll-mt-10 text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Current billing cycle"}),e.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-14 sm:mt-8 sm:grid-cols-2 lg:mt-10 xl:grid-cols-3",children:[e.jsx(aa,{title:"Usage",change:"+0.2%",value:"68.1%",valueDescription:"of allowed capacity",ctaDescription:"Monthly usage resets in 12 days.",ctaText:"Manage plan.",ctaLink:"#",data:Ko}),e.jsx(aa,{title:"Workspace",change:"+2.9%",value:"21.7%",valueDescription:"weekly active users",ctaDescription:"Add up to 20 members in free plan.",ctaText:"Invite users.",ctaLink:"#",data:Xo}),e.jsx(Po,{title:"Costs",change:"-1.4%",value:"$293.5",valueDescription:"current billing cycle",subtitle:"Current costs",ctaDescription:"Set hard caps in",ctaText:"cost spend management.",ctaLink:"#",data:Yo})]})]}),e.jsxs("section",{"aria-labelledby":"usage-overview",children:[e.jsx("h1",{id:"usage-overview",className:"mt-16 scroll-mt-8 text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Overview"}),e.jsx("div",{className:"sticky top-16 z-20 flex items-center justify-between border-b border-gray-200 bg-white pb-4 pt-4 sm:pt-6 lg:top-0 lg:mx-0 lg:px-0 lg:pt-8 dark:border-gray-800 dark:bg-gray-950",children:e.jsx($o,{maxDate:os,minDate:new Date(2024,0,1),selectedDates:t,onDatesChange:o=>s(o),selectedPeriod:a,onPeriodChange:o=>r(o),categories:ns,setSelectedCategories:n,selectedCategories:i})}),e.jsx("dl",{className:w("mt-10 grid grid-cols-1 gap-14 sm:grid-cols-1 md:grid-cols-2 xl:grid-cols-3"),children:ns.filter(o=>i.includes(o.title)).map(o=>e.jsx(Wr,{title:o.title,type:o.type,selectedDates:t,selectedPeriod:a},o.title))})]})]})}const $r=(t,s,a)=>{if(t==null)return a;const r=Array.isArray(s)?s:s.replace(/\[(\d+)\]/g,".$1").split(".").filter(Boolean);let i=t;for(let n=0;n<r.length;n++){const o=r[n];if(i==null||!(o in i))return a;i=i[o]}return i===void 0?a:i},_=h.forwardRef(({className:t,children:s,...a},r)=>e.jsx("div",{ref:r,className:w("mx-auto my-6 flex w-full items-center justify-between gap-3 text-sm col-span-full","text-gray-500 dark:text-gray-500",t),...a,children:s?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:w("h-[1px] w-full","bg-gray-200 dark:bg-gray-800")}),e.jsx("div",{className:"whitespace-nowrap text-inherit",children:s}),e.jsx("div",{className:w("h-[1px] w-full","bg-gray-200 dark:bg-gray-800")})]}):e.jsx("div",{className:w("h-[0.5px] w-full","bg-gray-200 dark:bg-gray-800")})}));_.displayName="Divider";const ra=[{continent:"America",items:[{value:"US",label:"United States",flag:"🇺🇸"},{value:"CA",label:"Canada",flag:"🇨🇦"},{value:"MX",label:"Mexico",flag:"🇲🇽"},{value:"BR",label:"Brazil",flag:"🇧🇷"},{value:"AR",label:"Argentina",flag:"🇦🇷"},{value:"CO",label:"Colombia",flag:"🇨🇴"},{value:"CL",label:"Chile",flag:"🇨🇱"},{value:"PE",label:"Peru",flag:"🇵🇪"}]},{continent:"Europe",items:[{value:"GB",label:"United Kingdom",flag:"🇬🇧"},{value:"FR",label:"France",flag:"🇫🇷"},{value:"DE",label:"Germany",flag:"🇩🇪"},{value:"PL",label:"Poland",flag:"🇵🇱"},{value:"IT",label:"Italy",flag:"🇮🇹"},{value:"ES",label:"Spain",flag:"🇪🇸"},{value:"NL",label:"Netherlands",flag:"🇳🇱"},{value:"PT",label:"Portugal",flag:"🇵🇹"},{value:"SE",label:"Sweden",flag:"🇸🇪"},{value:"NO",label:"Norway",flag:"🇳🇴"},{value:"DK",label:"Denmark",flag:"🇩🇰"},{value:"FI",label:"Finland",flag:"🇫🇮"},{value:"CH",label:"Switzerland",flag:"🇨🇭"},{value:"IE",label:"Ireland",flag:"🇮🇪"},{value:"BE",label:"Belgium",flag:"🇧🇪"},{value:"AT",label:"Austria",flag:"🇦🇹"},{value:"GR",label:"Greece",flag:"🇬🇷"}]},{continent:"Asia",items:[{value:"CN",label:"China",flag:"🇨🇳"},{value:"JP",label:"Japan",flag:"🇯🇵"},{value:"IN",label:"India",flag:"🇮🇳"},{value:"KR",label:"South Korea",flag:"🇰🇷"},{value:"SG",label:"Singapore",flag:"🇸🇬"},{value:"MY",label:"Malaysia",flag:"🇲🇾"},{value:"ID",label:"Indonesia",flag:"🇮🇩"},{value:"TH",label:"Thailand",flag:"🇹🇭"},{value:"VN",label:"Vietnam",flag:"🇻🇳"},{value:"AE",label:"United Arab Emirates",flag:"🇦🇪"},{value:"SA",label:"Saudi Arabia",flag:"🇸🇦"}]},{continent:"Oceania",items:[{value:"AU",label:"Australia",flag:"🇦🇺"},{value:"NZ",label:"New Zealand",flag:"🇳🇿"},{value:"FJ",label:"Fiji",flag:"🇫🇯"},{value:"PG",label:"Papua New Guinea",flag:"🇵🇬"}]},{continent:"Africa",items:[{value:"ZA",label:"South Africa",flag:"🇿🇦"},{value:"NG",label:"Nigeria",flag:"🇳🇬"},{value:"MA",label:"Morocco",flag:"🇲🇦"},{value:"EG",label:"Egypt",flag:"🇪🇬"},{value:"KE",label:"Kenya",flag:"🇰🇪"},{value:"GH",label:"Ghana",flag:"🇬🇭"},{value:"ET",label:"Ethiopia",flag:"🇪🇹"}]}],Qs=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command,{ref:a,className:w("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...s}));Qs.displayName=V.Command.displayName;const zs=N.forwardRef(({className:t,...s},a)=>e.jsxs("div",{className:"flex items-center border-b pl-3","cmdk-input-wrapper":"",children:[e.jsx(A.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(V.Command.Input,{ref:a,className:w("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...s})]}));zs.displayName=V.Command.Input.displayName;const Is=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.List,{ref:a,className:w("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...s}));Is.displayName=V.Command.List.displayName;const Ls=N.forwardRef((t,s)=>e.jsx(V.Command.Empty,{ref:s,className:"py-6 text-center text-sm",...t}));Ls.displayName=V.Command.Empty.displayName;const Es=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.Group,{ref:a,className:w("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...s}));Es.displayName=V.Command.Group.displayName;const sl=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.Separator,{ref:a,className:w("-mx-1 h-px bg-border",t),...s}));sl.displayName=V.Command.Separator.displayName;const Ds=N.forwardRef(({className:t,...s},a)=>e.jsx(V.Command.Item,{ref:a,className:w("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...s}));Ds.displayName=V.Command.Item.displayName;const Ms=t=>e.jsx(q.Root,{...t});Ms.displayName="Popover";const Bs=N.forwardRef((t,s)=>e.jsx(q.Trigger,{ref:s,...t}));Bs.displayName="PopoverTrigger";const al=N.forwardRef((t,s)=>e.jsx(q.Anchor,{ref:s,...t}));al.displayName="PopoverAnchor";const rl=N.forwardRef((t,s)=>e.jsx(q.Close,{ref:s,...t}));rl.displayName="PopoverClose";const Js=N.forwardRef(({className:t,sideOffset:s=10,side:a="bottom",align:r="center",collisionPadding:i,...n},o)=>e.jsx(q.Portal,{children:e.jsx(q.Content,{ref:o,sideOffset:s,side:a,align:r,collisionPadding:i,avoidCollisions:!0,className:I("max-h-[var(--radix-popper-available-height)] min-w-60 overflow-hidden rounded-md border p-2.5 text-sm shadow-md","border-gray-200 dark:border-gray-800","text-gray-900 dark:text-gray-50","bg-white dark:bg-gray-950","will-change-[transform,opacity]","data-[state=closed]:animate-hide","data-[state=open]:data-[side=bottom]:animate-slideDownAndFade data-[state=open]:data-[side=left]:animate-slideLeftAndFade data-[state=open]:data-[side=right]:animate-slideRightAndFade data-[state=open]:data-[side=top]:animate-slideUpAndFade",t),onWheel:l=>{l.stopPropagation(),l.deltaY>0?l.currentTarget.dispatchEvent(new KeyboardEvent("keydown",{key:"ArrowDown"})):l.currentTarget.dispatchEvent(new KeyboardEvent("keydown",{key:"ArrowUp"}))},...n})}));Js.displayName="PopoverContent";const il=({value:t,onChange:s})=>{const a=h.useId(),[r,i]=h.useState(!1),n=ra.map(o=>o.items.find(l=>l.value===t)).filter(Boolean)[0];return e.jsx("div",{className:"mt-2",children:e.jsxs(Ms,{open:r,onOpenChange:i,children:[e.jsx(Bs,{asChild:!0,children:e.jsxs(z,{id:a,role:"combobox","aria-expanded":r,variant:"secondary",className:"w-full justify-between shadow-xs! bg-background px-3 py-2.5 font-normal outline-offset-0 hover:bg-background focus-visible:border-ring focus-visible:outline-[3px] focus-visible:outline-ring/20",children:[t?e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"text-lg leading-none",children:n==null?void 0:n.flag}),e.jsx("span",{className:"truncate",children:n==null?void 0:n.label})]}):e.jsx("span",{className:"text-muted-foreground",children:"Select country"}),e.jsx(A.ChevronDown,{size:16,strokeWidth:2,className:"shrink-0 text-muted-foreground/80","aria-hidden":"true"})]})}),e.jsx(Js,{className:"w-full min-w-[var(--radix-popper-anchor-width)] border-input -mt-1 z-50",align:"start",children:e.jsxs(Qs,{className:"p-0",children:[e.jsx(zs,{className:"w-full border-none",style:{boxShadow:"none"},placeholder:"Search country..."}),e.jsxs(Is,{children:[e.jsx(Ls,{children:"No country found."}),ra.map(o=>e.jsx(h.Fragment,{children:e.jsx(Es,{heading:o.continent,children:o.items.map(l=>e.jsxs(Ds,{value:l.label,className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800",onSelect:()=>{s(l.value??""),i(!1)},children:[e.jsx("span",{className:"text-lg leading-none",children:l.flag})," ",l.label,t===l.value&&e.jsx(A.Check,{size:16,strokeWidth:2,className:"ml-auto"})]},l.value))})},o.continent))]})]})})]})})},nl=Se.tv({base:["relative block w-full rounded-lg border px-2.5 py-2.5 shadow-xs outline-hidden transition sm:text-sm","border-gray-200 dark:border-gray-800","text-gray-900 dark:text-gray-50","placeholder-gray-400 dark:placeholder-gray-500","bg-white dark:bg-gray-950","disabled:border-gray-300 disabled:bg-gray-100 disabled:text-gray-400","dark:disabled:border-gray-700 dark:disabled:bg-gray-800 dark:disabled:text-gray-500",tt],variants:{hasError:{true:_t},enableStepper:{false:"[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none"},multiline:{true:"resize-y min-h-[100px]",false:"truncate appearance-none"}}}),he=h.forwardRef(({className:t,inputClassName:s,hasError:a,enableStepper:r=!0,type:i,multiline:n=!1,prefix:o,suffix:l,...d},c)=>{const[u,m]=h.useState(i),g=i==="password"&&!n,x=i==="search"&&!n,f=i==="textarea"?"textarea":"input";return e.jsxs("div",{className:w("relative w-full",t),children:[o&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center px-3 text-slate-600 dark:text-gray-600 z-10 text-sm border-r border-gray-200",children:o}),e.jsx(f,{ref:c,type:g?u:i,className:w(nl({hasError:a,enableStepper:n?!1:r,multiline:n}),{"pl-16":o,"pl-8":!o&&x,"pr-10":l||!l&&g},s),...d}),!o&&x&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2 text-gray-400 dark:text-gray-600",children:e.jsx(C.RiSearchLine,{className:"size-[1.125rem]"})}),l&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2 text-gray-400 dark:text-gray-600",children:l}),!l&&g&&e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx("button",{onClick:()=>m(u==="password"?"text":"password"),className:w(ie,"text-gray-400 hover:text-gray-500 dark:text-gray-600"),children:u==="password"?e.jsx(C.RiEyeFill,{className:"size-5"}):e.jsx(C.RiEyeOffFill,{className:"size-5"})})})]})});he.displayName="Input";const ol=({...t})=>{const s=h.useId();return e.jsx("div",{className:"mt-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(he,{id:s,type:"email",inputClassName:"peer ps-9",...t}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 start-0 flex items-center justify-center ps-3 text-muted-foreground/80 peer-disabled:opacity-50",children:e.jsx(A.AtSign,{size:16,strokeWidth:2,"aria-hidden":"true"})})]})})},ll=t=>{const{client:s}=L(),[a,r]=h.useState(!1),[i,n]=h.useState(0),o=async u=>{const{body:m,status:g}=await s.file.createTemporaryFile({body:{filename:u.name,mimeType:u.type,size:u.size,organizationId:t.organizationId}});if(g!==201)throw new Error("Failed to create temporary file");const x=await ia.upload(u.name,u,{access:"public",handleUploadUrl:`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/files/token/vercel`,clientPayload:JSON.stringify({fileId:m==null?void 0:m.id}),onUploadProgress(f){n(f.percentage)}});return{id:m.id,filename:u.name,mimeType:u.type,size:u.size,url:x.url}},l=async u=>{var m;if((m=u.target.files)!=null&&m[0]){r(!0);try{const g=await o(u.target.files[0]);if(t.multiple){const x=t.value??[];t.onChange([...x,g])}else t.onChange(g)}catch(g){console.error(g)}finally{r(!1)}}},d=u=>{if(t.multiple){if(!t.value)return t.onChange(void 0);const m=t.value.filter(g=>g.id!==u);t.onChange(m.length?m:void 0)}else t.onChange(void 0)},c=()=>{if(t.value){const u=t.multiple?t.value:[t.value];return e.jsxs("div",{className:"flex",children:[u.map(m=>e.jsx("div",{className:"flex flex-col w-40 h-40 mr-3 transition-all rounded-lg relative animate-fade",children:e.jsxs("div",{className:"relative h-full w-40",children:[e.jsx("button",{className:"absolute w-6 h-6 bg-black flex items-center justify-center rounded-md right-1 top-1",onClick:()=>d(m.id),children:e.jsx(A.XIcon,{className:"w-4 h-4 text-white"})}),e.jsx(xe,{src:m.url,alt:m.filename,width:160,height:160,className:"w-40 h-40 rounded-md object-cover"})]})},m.id)),t.multiple&&e.jsxs("div",{className:"group flex relative flex-col w-40 h-40 items-center justify-center cursor-pointer border-2 border-gray-200 border-dashed transition-all rounded-lg hover:bg-gray-100 hover:border-gray-300",children:[e.jsx("div",{className:"flex flex-col items-center justify-center",children:a?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"animate-spin w-4 h-4 fill-current shrink-0 mb-2",viewBox:"0 0 16 16",children:e.jsx("path",{d:"M8 16a7.928 7.928 0 01-3.428-.77l.857-1.807A6.006 6.006 0 0014 8c0-3.309-2.691-6-6-6a6.006 6.006 0 00-5.422 8.572l-1.806.859A7.929 7.929 0 010 8c0-4.411 3.589-8 8-8s8 3.589 8 8-3.589 8-8 8z"})}),e.jsxs("span",{className:"text-sm",children:["Uploading... (",i,"%)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(A.CloudUpload,{className:"w-12 h-12 text-gray-300 group-hover:text-gray-600 transition-all stroke-1"}),e.jsx("p",{className:"pt-1 text-sm font-medium text-gray-400 group-hover:text-gray-600",children:"Upload an image"})]})}),e.jsx("input",{type:"file",className:"opacity-0 w-full h-full absolute cursor-pointer",onChange:l,accept:"image/png, image/gif, image/jpeg"})]},"upload-placeholder")]})}return e.jsxs("div",{className:"group flex relative flex-col items-center justify-center cursor-pointer w-full h-40 border-2 border-gray-200 border-dashed transition-all rounded-lg hover:bg-gray-100 hover:border-gray-300",children:[e.jsx("div",{className:"flex flex-col items-center justify-center",children:a?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"animate-spin w-4 h-4 fill-current shrink-0 mb-2",viewBox:"0 0 16 16",children:e.jsx("path",{d:"M8 16a7.928 7.928 0 01-3.428-.77l.857-1.807A6.006 6.006 0 0014 8c0-3.309-2.691-6-6-6a6.006 6.006 0 00-5.422 8.572l-1.806.859A7.929 7.929 0 010 8c0-4.411 3.589-8 8-8s8 3.589 8 8-3.589 8-8 8z"})}),e.jsxs("span",{className:"text-sm",children:["Uploading... (",i,"%)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(A.CloudUpload,{className:"w-12 h-12 text-gray-300 group-hover:text-gray-600 transition-all stroke-1"}),e.jsx("p",{className:"pt-1 text-sm font-medium text-gray-400 group-hover:text-gray-600",children:"Upload an image"})]})}),e.jsx("input",{type:"file",className:"opacity-0 w-full h-full absolute cursor-pointer",onChange:l,accept:"image/png, image/gif, image/jpeg"})]},"upload-placeholder")};return e.jsx("div",{className:"flex items-center w-full mt-2",children:c()})},_r=h.forwardRef(({...t},s)=>e.jsx(he,{...t,inputClassName:"border-l-0 rounded-l-none",ref:s,className:""}));_r.displayName="PhoneInput";const dl=({disabled:t,value:s,onChange:a,options:r})=>{const i=n=>{a(n.target.value)};return e.jsxs("div",{className:"relative inline-flex items-center self-stretch rounded-s-lg border border-gray-200 dark:border-gray-800 bg-background py-2 pe-2 ps-3 text-muted-foreground transition-shadow focus-within:z-10 focus-within:border-ring focus-within:outline-hidden focus-within:ring-[3px] focus-within:ring-ring/20 hover:bg-accent hover:text-foreground has-disabled:pointer-events-none has-disabled:opacity-50",children:[e.jsxs("div",{className:"inline-flex items-center gap-1","aria-hidden":"true",children:[e.jsx(Gr,{country:s,countryName:s,"aria-hidden":"true"}),e.jsx("span",{className:"text-muted-foreground/80",children:e.jsx(A.ChevronDown,{size:16,strokeWidth:2,"aria-hidden":"true"})})]}),e.jsxs("select",{disabled:t,value:s,onChange:i,className:"absolute inset-0 text-sm opacity-0","aria-label":"Select country",children:[e.jsx("option",{value:"",children:"Select a country"},"default"),r.filter(n=>n.value).map((n,o)=>e.jsxs("option",{value:n.value,children:[n.label," ",n.value&&`+${Dt.getCountryCallingCode(n.value)}`]},n.value??`empty-${o}`))]})]})},Gr=({country:t,countryName:s})=>{const a=ca[t];return e.jsx("span",{className:"w-5 overflow-hidden rounded-sm",children:a?e.jsx(a,{title:s}):e.jsx(A.Phone,{size:16,"aria-hidden":"true"})})},cl=({value:t,onChange:s,onBlur:a})=>{const r=h.useId();return e.jsx("div",{className:"mt-2",children:e.jsx(Dt.default,{id:r,className:"flex rounded-lg shadow-xs shadow-black/5",international:!0,flagComponent:Gr,countrySelectComponent:dl,inputComponent:_r,placeholder:"Enter phone number",value:t,onChange:i=>s(i??""),onBlur:a})})},ul=({options:t,value:s,onChange:a,multiple:r=!1,placeholder:i})=>{var u;const n=h.useId(),[o,l]=h.useState(!1),d=m=>{if(r){let g;Array.isArray(s)&&s.includes(m)?g=s.filter(x=>x!==m):g=Array.isArray(s)?[...s,m]:[m],a(g)}else a(m),l(!1)},c=m=>{if(r&&Array.isArray(s)){const g=s.filter(x=>x!==m);a(g)}};return e.jsx("div",{className:"mt-2",children:e.jsxs(Ms,{open:o,onOpenChange:l,children:[e.jsx(Bs,{asChild:!0,children:e.jsxs(z,{id:n,role:"combobox","aria-expanded":o,variant:"secondary",className:"w-full justify-between shadow-xs! bg-background px-2! py-1 min-h-[41.6px] font-normal outline-offset-0 hover:bg-background focus-visible:border-ring focus-visible:outline-[3px] focus-visible:outline-ring/20",children:[(s==null?void 0:s.length)>0?e.jsx("div",{className:"flex flex-wrap gap-2",children:Array.isArray(s)?s.map(m=>{const g=t.find(x=>x.value===m);return g?e.jsxs("span",{className:"animate-fadeIn relative inline-flex cursor-default items-center rounded-md border border-border bg-background px-2 py-1 text-xs font-medium text-secondary-foreground transition-all hover:bg-background disabled:cursor-not-allowed disabled:opacity-50",children:[g.label,e.jsx(A.X,{size:12,onClick:x=>{x.preventDefault(),c(m)},className:"cursor-pointer ml-1"})]},m):null}):e.jsx("span",{className:"px-1 text-sm",children:(u=t.find(m=>m.value===s))==null?void 0:u.label})}):e.jsx("span",{className:"px-1 text-sm text-gray-400",children:i||(r?"Select options":"Select an option")}),e.jsx(A.ChevronDown,{size:16,strokeWidth:2,className:"shrink-0 text-muted-foreground/80","aria-hidden":"true"})]})}),e.jsx(Js,{className:"w-full min-w-[var(--radix-popper-anchor-width)] border-input -mt-1 z-50 p-0",align:"start",children:e.jsxs(Qs,{className:"p-0",children:[e.jsx(zs,{className:"w-full border-none pl-0",style:{boxShadow:"none"},placeholder:"Search..."}),e.jsxs(Is,{children:[e.jsx(Ls,{children:"No options found."}),e.jsx(Es,{children:t.map(m=>e.jsxs(Ds,{value:m.label,className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800",onSelect:()=>d(m.value),children:[m.label,(r?s.includes(m.value):s===m.value)&&e.jsx(A.Check,{size:16,strokeWidth:2,className:"ml-auto"})]},m.value))})]})]})})]})})},pl=Se.tv({slots:{root:["group relative isolate inline-flex shrink-0 cursor-pointer items-center rounded-full p-0.5 shadow-inner outline-hidden ring-1 ring-inset transition-all","bg-gray-200 dark:bg-gray-950","ring-black/5 dark:ring-gray-800","data-[state=checked]:bg-blue-600 dark:data-[state=checked]:bg-blue-600","data-disabled:cursor-default","data-disabled:data-[state=checked]:bg-blue-200","data-disabled:data-[state=checked]:ring-gray-300","dark:data-disabled:data-[state=checked]:ring-gray-900","dark:data-disabled:data-[state=checked]:bg-blue-900","data-disabled:data-[state=unchecked]:ring-gray-300","data-disabled:data-[state=unchecked]:bg-gray-100","dark:data-disabled:data-[state=unchecked]:ring-gray-700","dark:data-disabled:data-[state=unchecked]:bg-gray-800",ie],thumb:["pointer-events-none relative inline-block transform appearance-none rounded-full border-none shadow-lg outline-hidden transition-all duration-150 ease-in-out focus:border-none focus:outline-hidden focus:outline-transparent","bg-white dark:bg-gray-50","group-data-disabled:shadow-none","group-data-disabled:bg-gray-50 dark:group-data-disabled:bg-gray-500"]},variants:{size:{default:{root:"h-7 w-14",thumb:"h-4 w-4 data-[state=checked]:translate-x-7 data-[state=unchecked]:translate-x-0"},small:{root:"h-4 w-7",thumb:"h-3 w-3 data-[state=checked]:translate-x-3 data-[state=unchecked]:translate-x-0"}}},defaultVariants:{size:"default"}}),Kr=h.forwardRef(({className:t,size:s,...a},r)=>{const{root:i,thumb:n}=pl({size:s});return e.jsx(Pt.Root,{ref:r,className:w(i(),t),...a,children:e.jsx(Pt.Thumb,{className:w(n())})})});Kr.displayName="Switch";const ml=({name:t,type:s,placeholder:a,multiple:r,options:i,prefix:n})=>{const{watch:o,register:l,setFocus:d,setValue:c}=F.useFormContext();switch(s){case"email":return e.jsx(ol,{...l(t),placeholder:a});case"file":return e.jsx(ll,{value:o(t),multiple:r,onChange:u=>c(t,u)});case"phone-number":return e.jsx(cl,{value:o("phone"),onChange:u=>c("phone",u),onBlur:()=>d("phone")});case"country":return e.jsx(il,{value:o(t),onChange:u=>c(t,u)});case"select":{const u=r?o(t)||[]:o(t)||"";if(!i)throw new Error("Options are required for select input");return e.jsx(ul,{options:i,value:u,onChange:m=>c(t,m),placeholder:a,multiple:r})}case"switch":return e.jsx(Kr,{size:"default",className:"mr-2",checked:o(t),onCheckedChange:u=>c(t,u)});case"time":return e.jsx(vs,{value:o(t),onChange:u=>c(t,u.target.value),className:"mt-2"});default:return e.jsx(he,{...l(t),type:s,rows:s==="textarea"?4:void 0,placeholder:a,className:"mt-2",prefix:n})}},gl=(t,s)=>!t||typeof t!="object"?void 0:s?s.replace(/\[/g,".").replace(/\]/g,"").split(".").filter(Boolean).reduce((r,i)=>{if(r!=null)return r[i]},t):t,Os=({type:t="text",name:s,label:a,className:r,locale:i,placeholder:n,multiple:o,options:l,localizable:d,prefix:c})=>{const{errors:u}=F.useFormState(),m=gl(u,s);return e.jsxs("div",{className:w("w-full",{"flex items-center flex-row-reverse justify-end":t==="switch"},r),children:[typeof a=="string"&&e.jsxs(be,{htmlFor:s,className:"font-medium flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center",children:[a,d&&e.jsx(A.LanguagesIcon,{className:"w-4 h-4 ml-1 text-gray-500"})]}),i&&d&&e.jsxs("span",{className:"flex items-center text-xs text-gray-500 ml-1 bg-gray-100 px-1 py-0.5 rounded",children:[Bt.get(i)," (",i,")"]})]}),e.jsx(ml,{type:t,name:s,placeholder:n,options:l,multiple:o,prefix:c}),(m==null?void 0:m.message)&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:m.message})]})},hl=({form:t,config:s,columns:a=2})=>{var d;const{errors:r}=F.useFormState(),i=$r(r,s.name),{fields:n,append:o,remove:l}=F.useFieldArray({control:t.control,name:s.name});return(d=s.fields)!=null&&d.length?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"w-full col-span-full",children:[s.label&&e.jsx("h4",{className:"text-2xl flex items-center justify-between font-semibold",children:s.label}),s.description&&e.jsx("p",{className:"text-sm text-gray-500",children:s.description}),n.map((c,u)=>{var m;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:w("grid gap-5 w-full border-l-[8px] border-blue-500 pl-5 py-3 mt-6",{"grid-cols-1":a===1,"grid-cols-2":a===2,"grid-cols-3":a===3,"grid-cols-4":a===4}),children:(m=s.fields)==null?void 0:m.map(({name:g,label:x,type:f,colspan:b,localizable:y,multiple:S,options:k,placeholder:j,prefix:v})=>e.jsx(Os,{name:`${s.name}[${u}].${g}`,label:x,type:f??"text",localizable:y,className:w({"col-span-1":b===1,"col-span-2":b===2,"col-span-3":b===3,"col-span-4":b===4}),placeholder:j,multiple:S,options:k,prefix:v},s.name+g))},c.id),u<n.length-1&&e.jsx(_,{})]})}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsxs("button",{type:"button",className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600",onClick:()=>o({}),children:[e.jsx(A.PlusCircleIcon,{className:"w-4 h-4 text-blue-500"}),"Add New"]}),n.length>1&&e.jsxs("button",{type:"button",className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600",onClick:()=>l(n.length-1),children:[e.jsx(A.XCircleIcon,{className:"w-4 h-4 text-red-500"}),"Remove"]})]}),(i==null?void 0:i.message)&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:i.message})]})}):null},xl=({config:t,columns:s=2})=>{var i;const{errors:a}=F.useFormState(),r=$r(a,t.name);return(i=t.fields)!=null&&i.length?e.jsxs("div",{className:"w-full col-span-full",children:[t.label&&e.jsx("h4",{className:"text-2xl font-semibold mb-2",children:t.label}),t.description&&e.jsx("p",{className:"text-sm text-gray-500 mb-3",children:t.description}),e.jsx("div",{className:w("grid gap-5",{"grid-cols-1":s===1,"grid-cols-2":s===2,"grid-cols-3":s===3,"grid-cols-4":s===4}),children:t.fields.map(({name:n,label:o,type:l,colspan:d,localizable:c,multiple:u,options:m,placeholder:g,prefix:x})=>e.jsx(Os,{name:`${t.name}.${n}`,label:o,type:l??"text",localizable:c,className:w({"col-span-1":d===1,"col-span-2":d===2,"col-span-3":d===3,"col-span-4":d===4}),placeholder:g,multiple:u,options:m,prefix:x},`${t.name}.${n}`))}),(r==null?void 0:r.message)&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:r.message})]}):null};function fl(t,s){const{asChild:a,children:r}=t;if(!a)return typeof s=="function"?s(r):s;const i=h.Children.only(r);return h.cloneElement(i,{children:typeof s=="function"?s(i.props.children):s})}const Fs=h.forwardRef(({className:t,children:s,...a},r)=>e.jsx(Tt.Root,{ref:r,...a,asChild:!1,children:e.jsx(Tt.List,{className:w("flex items-center justify-start whitespace-nowrap border-b [scrollbar-width:none] [&::-webkit-scrollbar]:hidden","border-gray-200 dark:border-gray-800",t),children:s})}));Fs.displayName="TabNavigation";const Vs=h.forwardRef(({asChild:t,disabled:s,className:a,children:r,...i},n)=>e.jsx(Tt.Item,{className:"flex","aria-disabled":s,children:e.jsx(Tt.Link,{"aria-disabled":s,className:w("group relative flex shrink-0 select-none items-center justify-center",s?"pointer-events-none":""),ref:n,onSelect:()=>{},asChild:t,...i,children:fl({asChild:t,children:r},o=>e.jsx("span",{className:w("-mb-px flex items-center justify-center whitespace-nowrap border-b-2 border-transparent px-3 pb-2 text-sm font-medium transition-all","text-gray-500 dark:text-gray-500","group-hover:text-gray-700 dark:group-hover:text-gray-400","group-hover:border-gray-300 dark:group-hover:border-gray-400","group-data-active:border-blue-600 group-data-active:text-blue-600","dark:group-data-active:border-blue-500 dark:group-data-active:text-blue-500",s?"pointer-events-none text-gray-300 dark:text-gray-700":"",ie,a),children:o}))})}));Vs.displayName="TabNavigationLink";const Ne=({form:t,okText:s,config:a,loading:r,onCancel:i,cancelText:n,columns:o=2,onSubmit:l})=>{const d=t.watch("translations"),{organization:c,defaultLocale:u,supportedLocales:m}=pe(),[g,x]=h.useState(),f=h.useMemo(()=>a.some(y=>y.localizable),[a]);h.useEffect(()=>{c.data&&x(u)},[c.data,u,t,m,d]),h.useEffect(()=>{t.formState.errors.translations&&x(u)},[u,t.formState.errors.translations]);const b=e.jsxs("div",{className:I("grid gap-5 w-full",{"grid-cols-1":o===1,"grid-cols-2":o===2,"grid-cols-3":o===3,"grid-cols-4":o===4}),children:[f&&e.jsx("div",{className:"col-span-full",children:e.jsx(Fs,{className:"col-span-full mb-3",children:m.map(y=>{const S=y===u;return e.jsx(Vs,{active:y===g,onClick:()=>x(y),className:"cursor-pointer",children:e.jsxs(e.Fragment,{children:[Bt.get(y)," ",S&&"(Default)"]})},y)})})}),a.map(y=>{const{name:S,label:k,type:j,colspan:v,localizable:P,multiple:$,options:se,placeholder:ee,prefix:U}=y,O=!P||!g?S:`translations[${m==null?void 0:m.indexOf(g)}].${S}`;return j==="object"?e.jsx(xl,{config:y},S):j==="array"?e.jsx(hl,{form:t,config:y},S):e.jsx(Os,{name:O,label:k,type:j??"text",localizable:P,className:I({"col-span-1":v===1,"col-span-2":v===2,"col-span-3":v===3,"col-span-4":v===4}),placeholder:ee,multiple:$,options:se,locale:g,prefix:U},O)}),l&&e.jsxs("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 mt-6 col-span-full border-t pt-7",children:[i&&e.jsx(z,{type:"button",className:"w-full sm:w-fit",variant:"secondary",onClick:i,children:n??"Cancel"}),e.jsx(z,{type:"submit",className:"w-full sm:w-fit",isLoading:r,loadingText:"Saving...",children:s??"Save Data"})]})]});return l?e.jsx(F.FormProvider,{...t,children:e.jsx("form",{onSubmit:t.handleSubmit(y=>l(y)),children:b})}):e.jsx("div",{className:"w-full",children:b})},yl=[{name:"name",label:"Manufacturer Name",type:"text",placeholder:"Acme Inc.",colspan:2},{name:"about",label:"About",type:"textarea",placeholder:"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",colspan:2,localizable:!0},{name:"logo",label:"Logo",type:"file"}],Xr=({initialData:t})=>{const{client:s}=L(),a=Q.useRouter(),r=Y(),i=K(),{defaultLocale:n,supportedLocales:o}=pe(),l=t?wn:yn,d=F.useForm({resolver:ue.zodResolver(l),defaultValues:t?{defaultLocale:n,name:t.name,logo:t.logo,translations:t.translations}:{defaultLocale:n,translations:o.map(x=>({locale:x}))}}),c=R.useMutation({mutationFn:async x=>{var y;const f={name:x.name,defaultLocale:x.defaultLocale,translations:x.translations,logoId:(y=x.logo)==null?void 0:y.id},{status:b}=await s.manufacturer.createManufacturer({params:{organizationId:i},body:f});if(b!==201)throw X.error("Failed to create manufacturer. Please try again later."),new Error("Failed to create manufacturer")}}),u=R.useMutation({mutationFn:async x=>{var y;const f={name:x.name,defaultLocale:x.defaultLocale,translations:x.translations,logoId:((y=x.logo)==null?void 0:y.id)||null},{status:b}=await s.manufacturer.updateManufacturer({params:{organizationId:i,id:t.id},body:f});if(b!==200)throw X.error("Failed to update manufacturer. Please try again later."),new Error("Failed to update manufacturer")}}),m=async()=>{X.success("Manufacturer saved successfully"),a.push(r.manufacturers(i)),await Ae.invalidateQueries({queryKey:["manufacturers"]})},g=x=>{t?u.mutate(x,{onSuccess:m}):c.mutate(x,{onSuccess:m})};return e.jsx(Ne,{form:d,config:yl,onSubmit:g,loading:c.isPending||u.isPending,cancelText:"Go back",okText:t?"Update Manufacturer":"Create Manufacturer"})};function wl(){return e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Create Manufacturer"}),e.jsx(_,{}),e.jsx("div",{className:"pt-6",children:e.jsx("div",{className:"space-y-10",children:e.jsx("section",{"aria-labelledby":"manufacturer-info",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"manufacturer-info",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Manufacturer Information"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Enter the information about the manufacturer."})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(Xr,{})})]})})})})]})}function bl(){const t=K(),s=gt(),{client:a}=L(),{isLoading:r,data:i}=R.useQuery({queryKey:["manufacturers",t,s],queryFn:async()=>{const{status:n,body:o}=await a.manufacturer.getManufacturer({params:{id:s,organizationId:t}});if(n!==200)throw X.error("Failed to fetch manufacturer. Please refresh or try again later."),new Error("Failed to fetch manufacturer");return o},throwOnError:!0,placeholderData:R.keepPreviousData});return e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Edit Manufacturer"}),e.jsx(_,{}),e.jsx("div",{className:"pt-6",children:e.jsx("div",{className:"space-y-10",children:e.jsx("section",{"aria-labelledby":"manufacturer-info",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"manufacturer-info",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Manufacturer Information"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Enter the information about the manufacturer."})]}),e.jsx("div",{className:"md:col-span-2",children:r||!i?e.jsx("div",{className:"flex justify-center items-center h-screen mt-5",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(ce,{className:"w-12 h-12"}),e.jsx("p",{className:"text-gray-500 text-sm mt-3",children:"Loading data..."})]})}):e.jsx(Xr,{initialData:i})})]})})})})]})}const Sl=h.forwardRef(({className:t,children:s,...a},r)=>e.jsx("div",{ref:r,children:e.jsx("div",{className:I("w-full overflow-auto whitespace-nowrap",t),...a,children:s})}));Sl.displayName="TableRoot";const Yr=h.forwardRef(({className:t,...s},a)=>e.jsx("table",{ref:a,className:I("w-full caption-bottom border-b","border-gray-200 dark:border-gray-800",t),...s}));Yr.displayName="Table";const ei=h.forwardRef(({className:t,...s},a)=>e.jsx("thead",{ref:a,className:I(t),...s}));ei.displayName="TableHead";const ti=h.forwardRef(({className:t,...s},a)=>e.jsx("th",{ref:a,className:I("border-b px-4 py-3.5 text-left text-sm font-semibold","text-gray-900 dark:text-gray-50","border-gray-200 dark:border-gray-800",t),...s}));ti.displayName="TableHeaderCell";const si=h.forwardRef(({className:t,...s},a)=>e.jsx("tbody",{ref:a,className:I("divide-y","divide-gray-200 dark:divide-gray-800",t),...s}));si.displayName="TableBody";const lt=h.forwardRef(({className:t,...s},a)=>e.jsx("tr",{ref:a,className:I("[&_td:last-child]:pr-4 [&_th:last-child]:pr-4","[&_td:first-child]:pl-4 [&_th:first-child]:pl-4",t),...s}));lt.displayName="TableRow";const At=h.forwardRef(({className:t,...s},a)=>e.jsx("td",{ref:a,className:I("p-4 text-sm","text-gray-600 dark:text-gray-400",t),...s}));At.displayName="TableCell";const kl=h.forwardRef(({className:t,...s},a)=>e.jsx("tfoot",{ref:a,className:I("border-t text-left font-medium","text-gray-900 dark:text-gray-50","border-gray-200 dark:border-gray-800",t),...s}));kl.displayName="TableFoot";const jl=h.forwardRef(({className:t,...s},a)=>e.jsx("caption",{ref:a,className:I("mt-3 px-3 text-center text-sm","text-gray-500 dark:text-gray-500",t),...s}));jl.displayName="TableCaption";const Al=w("hidden h-6 select-none items-center justify-center rounded-md bg-gray-800 px-2 font-mono text-xs text-gray-400 ring-1 ring-inset ring-gray-700 transition sm:flex"),ai=({open:t=!1,onOpenChange:s,defaultOpen:a=!1,disableAutoFocus:r=!0,children:i})=>e.jsxs(q.Root,{open:t,onOpenChange:s,defaultOpen:a,children:[e.jsx(q.Anchor,{className:w("fixed inset-x-0 bottom-8 mx-auto flex w-fit items-center")}),e.jsx(q.Portal,{children:e.jsx(q.Content,{side:"top",sideOffset:0,onOpenAutoFocus:n=>{r&&n.preventDefault()},className:w("z-50","data-[state=closed]:animate-hide","data-[side=top]:animate-slideUpAndFade"),children:i})})]});ai.displayName="CommandBar";const ri=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:w("px-3 py-2.5 text-sm tabular-nums text-gray-300",t),...s}));ri.displayName="CommandBar.Value";const ii=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:w("relative flex items-center rounded-lg bg-gray-900 px-1 shadow-lg shadow-black/30 dark:ring-1 dark:ring-white/10",t),...s}));ii.displayName="CommandBarBar";const vt=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:w("h-4 w-px bg-gray-700",t),...s}));vt.displayName="CommandBar.Seperator";const Nt=N.forwardRef(({className:t,type:s="button",label:a,action:r,shortcut:i,disabled:n,...o},l)=>(N.useEffect(()=>{const d=c=>{c.key===i.shortcut&&(c.preventDefault(),c.stopPropagation(),r())};return n||document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},[r,i,n]),e.jsx("span",{className:w("flex items-center gap-x-2 rounded-lg bg-gray-900 p-1 text-base font-medium text-gray-50 outline-hidden transition focus:z-10 sm:text-sm","sm:last-of-type:-mr-1",t),children:e.jsxs("button",{ref:l,type:s,onClick:r,disabled:n,className:w("flex items-center gap-x-2 rounded-md px-1 py-1 hover:bg-gray-800","focus-visible:bg-gray-800 focus-visible:hover:bg-gray-800","disabled:text-gray-500",ie),...o,children:[e.jsx("span",{children:a}),e.jsx("span",{className:Al,children:i.label?i.label.toUpperCase():i.shortcut.toUpperCase()})]})})));Nt.displayName="CommandBar.Command";function vl({table:t,rowSelection:s}){const a=Object.keys(s).length>0;return e.jsx(ai,{open:a,children:e.jsxs(ii,{children:[e.jsxs(ri,{children:[Object.keys(s).length," selected"]}),e.jsx(vt,{}),e.jsx(Nt,{label:"Edit",action:()=>{console.log("Edit")},shortcut:{shortcut:"e"}}),e.jsx(vt,{}),e.jsx(Nt,{label:"Delete",action:()=>{console.log("Delete")},shortcut:{shortcut:"d"}}),e.jsx(vt,{}),e.jsx(Nt,{label:"Reset",action:()=>{t.resetRowSelection()},shortcut:{shortcut:"Escape",label:"esc"}})]})})}function Nl({meta:t,table:s}){const r=Q.useSearchParams(),i=Q.useRouter(),n=Q.usePathname(),o=Number((r==null?void 0:r.get("page"))||"1"),l=(f,b)=>{const y=new URLSearchParams(r==null?void 0:r.toString());return y.set(f,b),y.toString()},d=f=>{i.push(`${n}?${l("page",f.toString())}`)},c=[{icon:C.RiArrowLeftDoubleLine,onClick:()=>d(1),disabled:!(t!=null&&t.previousPage),srText:"First page",mobileView:"hidden sm:block"},{icon:C.RiArrowLeftSLine,onClick:()=>d(o-1),disabled:!(t!=null&&t.previousPage),srText:"Previous page",mobileView:""},{icon:C.RiArrowRightSLine,onClick:()=>d(o+1),disabled:!(t!=null&&t.nextPage),srText:"Next page",mobileView:""},{icon:C.RiArrowRightDoubleLine,onClick:()=>d(t.pageCount),disabled:!(t!=null&&t.nextPage),srText:"Last page",mobileView:"hidden sm:block"}],u=s.getFilteredRowModel().rows.length,g=s.getState().pagination.pageIndex*15+1,x=Math.min(u,g+15-1);return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm tabular-nums text-gray-500",children:[s.getFilteredSelectedRowModel().rows.length," of ",u," row(s) selected."]}),e.jsxs("div",{className:"flex items-center gap-x-6 lg:gap-x-8",children:[e.jsxs("p",{className:"hidden text-sm tabular-nums text-gray-500 sm:block",children:["Showing"," ",e.jsxs("span",{className:"font-medium text-gray-900 dark:text-gray-50",children:[g,"-",x]})," ","of"," ",e.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-50",children:u})]}),e.jsx("div",{className:"flex items-center gap-x-1.5",children:c.map((f,b)=>e.jsxs(z,{variant:"secondary",className:w(f.mobileView,"p-1.5"),onClick:()=>{f.onClick(),s.resetRowSelection()},disabled:f.disabled,children:[e.jsx("span",{className:"sr-only",children:f.srText}),e.jsx(f.icon,{className:"size-4 shrink-0","aria-hidden":"true"})]},b))})]})]})}function st({meta:t,columns:s,error:a,data:r,loading:i,className:n,refetch:o}){var g,x;const l=K(),d=Y(),[c,u]=N.useState({}),m=ge.useReactTable({data:r,columns:s,state:{rowSelection:c},enableRowSelection:!0,getFilteredRowModel:ge.getFilteredRowModel(),onRowSelectionChange:u,getCoreRowModel:ge.getCoreRowModel(),getSortedRowModel:ge.getSortedRowModel(),manualPagination:!0,meta:{organizationId:l,refetch:o,routes:d}});return e.jsx(e.Fragment,{children:e.jsxs("div",{className:w("space-y-6 relative",n),children:[e.jsxs("div",{className:"relative overflow-hidden overflow-x-auto",children:[i&&!r?e.jsx("div",{className:"flex items-center justify-center h-48",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(ce,{className:"w-10 h-10"}),e.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"Loading..."})]})}):e.jsxs(e.Fragment,{children:[e.jsxs(Yr,{children:[e.jsx(ei,{children:m.getHeaderGroups().map(f=>e.jsx(lt,{className:"border-y border-gray-200 dark:border-gray-800 back",children:f.headers.map(b=>{var y;return e.jsx(ti,{className:w("whitespace-nowrap py-1 text-sm sm:text-xs",(y=b.column.columnDef.meta)==null?void 0:y.className),children:ge.flexRender(b.column.columnDef.header,b.getContext())},b.id)})},f.id))}),e.jsxs(si,{children:[a&&e.jsx(lt,{children:e.jsx(At,{colSpan:s.length,className:"h-24 text-center text-red-500",children:"An error occurred while fetching data. Please refresh the site and try again."})}),((g=m.getRowModel().rows)==null?void 0:g.length)>0&&m.getRowModel().rows.map(f=>e.jsx(lt,{className:"group select-none hover:bg-gray-50 dark:hover:bg-gray-900",children:f.getVisibleCells().map((b,y)=>{var S;return e.jsxs(At,{className:w(f.getIsSelected()?"bg-gray-50 dark:bg-gray-900":"","relative whitespace-nowrap py-1 text-gray-600 first:w-10 dark:text-gray-400",(S=b.column.columnDef.meta)==null?void 0:S.className),children:[y===0&&f.getIsSelected()&&e.jsx("div",{className:"absolute inset-y-0 left-0 w-0.5 bg-blue-600 dark:bg-blue-500"}),ge.flexRender(b.column.columnDef.cell,b.getContext())]},b.id)})},f.id)),((x=m.getRowModel().rows)==null?void 0:x.length)===0&&!i&&e.jsx(lt,{children:e.jsx(At,{colSpan:s.length,className:"h-24 text-center",children:"No results."})})]})]}),i&&r&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-white bg-opacity-75 dark:bg-gray-900 dark:bg-opacity-75",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(ce,{className:"w-10 h-10"}),e.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"Loading..."})]})})]}),e.jsx(vl,{table:m,rowSelection:c})]}),t&&e.jsx(Nl,{meta:t,table:m})]})})}const Rl=Se.tv({base:["relative block w-full appearance-none rounded-md border px-2.5 py-1.5 outline-hidden transition sm:text-sm","border-transparent dark:border-gray-800","text-gray-900 dark:text-gray-50","placeholder-gray-400 dark:placeholder-gray-500","bg-gray-100 dark:bg-gray-950","disabled:border-gray-300 disabled:bg-gray-100 disabled:text-gray-400","dark:disabled:border-gray-700 dark:disabled:bg-gray-800 dark:disabled:text-gray-500",tt,"[&::--webkit-search-cancel-button]:hidden [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden"],variants:{hasError:{true:_t},enableStepper:{true:"[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"}}}),at=N.forwardRef(({className:t,inputClassName:s,hasError:a,enableStepper:r,type:i="search",...n},o)=>e.jsxs("div",{className:w("relative w-full",t),children:[e.jsx("input",{ref:o,type:i,className:w(Rl({hasError:a,enableStepper:r}),"pl-8",s),...n}),e.jsx("div",{className:w("pointer-events-none absolute bottom-0 left-2 flex h-full items-center justify-center","text-gray-400 dark:text-gray-600"),children:e.jsx(C.RiSearchLine,{className:"size-[1.125rem] shrink-0","aria-hidden":"true"})})]}));at.displayName="Searchbar";function E({column:t,title:s,className:a}){return t.getCanSort()?e.jsxs("div",{onClick:t.getToggleSortingHandler(),className:w(t.columnDef.enableSorting===!0?"-mx-2 inline-flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1 hover:bg-gray-50 dark:hover:bg-gray-900":""),children:[e.jsx("span",{children:s}),t.getCanSort()?e.jsxs("div",{className:"-space-y-2",children:[e.jsx(C.RiArrowUpSLine,{className:w("size-3.5 text-gray-900 dark:text-gray-50",t.getIsSorted()==="desc"?"opacity-30":""),"aria-hidden":"true"}),e.jsx(C.RiArrowDownSLine,{className:w("size-3.5 text-gray-900 dark:text-gray-50",t.getIsSorted()==="asc"?"opacity-30":""),"aria-hidden":"true"})]}):null]}):e.jsx("div",{className:w(a),children:s})}const Le=re.Root;Le.displayName="DropdownMenu";const Ee=re.Trigger;Ee.displayName="DropdownMenuTrigger";const ct=re.Group;ct.displayName="DropdownMenuGroup";const ni=re.Sub;ni.displayName="DropdownMenuSubMenu";const oi=re.RadioGroup;oi.displayName="DropdownMenuRadioGroup";const li=N.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(re.SubTrigger,{ref:r,className:w("relative flex cursor-default select-none items-center rounded py-1.5 pl-2 pr-1 outline-hidden transition-colors data-[state=checked]:font-semibold sm:text-sm","text-gray-900 dark:text-gray-50","data-disabled:pointer-events-none data-disabled:text-gray-400 data-disabled:hover:bg-none dark:data-disabled:text-gray-600","focus-visible:bg-gray-100 data-[state=open]:bg-gray-100 dark:focus-visible:bg-gray-900 dark:data-[state=open]:bg-gray-900","hover:bg-gray-100 dark:hover:bg-gray-900",t),...a,children:[s,e.jsx(C.RiArrowRightSLine,{className:"ml-auto size-4 shrink-0 text-gray-500","aria-hidden":"true"})]}));li.displayName="DropdownMenuSubMenuTrigger";const di=N.forwardRef(({className:t,collisionPadding:s=8,...a},r)=>e.jsx(re.Portal,{children:e.jsx(re.SubContent,{ref:r,collisionPadding:s,className:w("relative z-50 overflow-hidden rounded-md border p-1 shadow-xl shadow-black/[2.5%]","min-w-32","max-h-[var(--radix-popper-available-height)]","bg-white dark:bg-gray-950","text-gray-900 dark:text-gray-50","border-gray-200 dark:border-gray-800","will-change-[transform,opacity]","data-[state=closed]:animate-hide","data-[side=bottom]:animate-slideDownAndFade data-[side=left]:animate-slideLeftAndFade data-[side=right]:animate-slideRightAndFade data-[side=top]:animate-slideUpAndFade",t),...a})}));di.displayName="DropdownMenuSubMenuContent";const De=N.forwardRef(({className:t,sideOffset:s=8,collisionPadding:a=8,align:r="center",loop:i=!0,...n},o)=>e.jsx(re.Portal,{children:e.jsx(re.Content,{ref:o,className:w("relative z-50 overflow-hidden rounded-md border p-1 shadow-xl shadow-black/[2.5%]","min-w-[calc(var(--radix-dropdown-menu-trigger-width))]","max-h-[var(--radix-popper-available-height)]","bg-white dark:bg-gray-950","text-gray-900 dark:text-gray-50","border-gray-200 dark:border-gray-800","will-change-[transform,opacity]","data-[state=closed]:animate-hide","data-[side=bottom]:animate-slideDownAndFade data-[side=left]:animate-slideLeftAndFade data-[side=right]:animate-slideRightAndFade data-[side=top]:animate-slideUpAndFade",t),sideOffset:s,align:r,collisionPadding:a,loop:i,...n})}));De.displayName="DropdownMenuContent";const fe=N.forwardRef(({className:t,shortcut:s,hint:a,children:r,...i},n)=>e.jsxs(re.Item,{ref:n,className:w("group/DropdownMenuItem relative flex cursor-pointer select-none items-center rounded py-1.5 pl-2 pr-1 outline-hidden transition-colors data-[state=checked]:font-semibold sm:text-sm","text-gray-900 dark:text-gray-50","data-disabled:pointer-events-none data-disabled:text-gray-400 data-disabled:hover:bg-none dark:data-disabled:text-gray-600","focus-visible:bg-gray-100 dark:focus-visible:bg-gray-900","hover:bg-gray-100 dark:hover:bg-gray-900",t),...i,children:[r,a&&e.jsx("span",{className:w("ml-auto pl-2 text-sm text-gray-400 dark:text-gray-600"),children:a}),s&&e.jsx("span",{className:w("ml-auto pl-2 text-sm text-gray-400 dark:text-gray-600"),children:s})]}));fe.displayName="DropdownMenuItem";const Cl=N.forwardRef(({className:t,hint:s,shortcut:a,children:r,checked:i,...n},o)=>e.jsxs(re.CheckboxItem,{ref:o,className:w("relative flex cursor-pointer select-none items-center gap-x-2 rounded py-1.5 pl-8 pr-1 outline-hidden transition-colors data-[state=checked]:font-semibold sm:text-sm","text-gray-900 dark:text-gray-50","data-disabled:pointer-events-none data-disabled:text-gray-400 data-disabled:hover:bg-none dark:data-disabled:text-gray-600","focus-visible:bg-gray-100 dark:focus-visible:bg-gray-900","hover:bg-gray-100 dark:hover:bg-gray-900",t),checked:i,...n,children:[e.jsx("span",{className:"absolute left-2 flex size-4 items-center justify-center",children:e.jsx(re.ItemIndicator,{children:e.jsx(C.RiCheckLine,{"aria-hidden":"true",className:"size-full shrink-0 text-gray-800 dark:text-gray-200"})})}),r,s&&e.jsx("span",{className:w("ml-auto text-sm font-normal text-gray-400 dark:text-gray-600"),children:s}),a&&e.jsx("span",{className:w("ml-auto text-sm font-normal tracking-widest text-gray-400 dark:border-gray-800 dark:text-gray-600"),children:a})]}));Cl.displayName="DropdownMenuCheckboxItem";const Rt=N.forwardRef(({className:t,hint:s,shortcut:a,children:r,iconType:i="radio",...n},o)=>e.jsxs(re.RadioItem,{ref:o,className:w("group/DropdownMenuRadioItem relative flex cursor-pointer select-none items-center gap-x-2 rounded py-1.5 pl-8 pr-1 outline-hidden transition-colors data-[state=checked]:font-semibold sm:text-sm","text-gray-900 dark:text-gray-50","data-disabled:pointer-events-none data-disabled:text-gray-400 data-disabled:hover:bg-none dark:data-disabled:text-gray-600","focus-visible:bg-gray-100 dark:focus-visible:bg-gray-900","hover:bg-gray-100 dark:hover:bg-gray-900",t),...n,children:[i==="radio"?e.jsxs("span",{className:"absolute left-2 flex size-4 items-center justify-center",children:[e.jsx(C.RiRadioButtonFill,{"aria-hidden":"true",className:"size-full shrink-0 text-blue-500 group-data-[state=checked]/DropdownMenuRadioItem:flex group-data-[state=unchecked]/DropdownMenuRadioItem:hidden dark:text-blue-500"}),e.jsx(C.RiCheckboxBlankCircleLine,{"aria-hidden":"true",className:"size-full shrink-0 text-gray-300 group-data-[state=unchecked]/DropdownMenuRadioItem:flex group-data-[state=checked]/DropdownMenuRadioItem:hidden dark:text-gray-700"})]}):i==="check"?e.jsx("span",{className:"absolute left-2 flex size-4 items-center justify-center",children:e.jsx(C.RiCheckLine,{"aria-hidden":"true",className:"size-full shrink-0 text-gray-800 group-data-[state=checked]/DropdownMenuRadioItem:flex group-data-[state=unchecked]/DropdownMenuRadioItem:hidden dark:text-gray-200"})}):null,r,s&&e.jsx("span",{className:w("ml-auto text-sm font-normal text-gray-400 dark:text-gray-600"),children:s}),a&&e.jsx("span",{className:w("ml-auto text-sm font-normal tracking-widest text-gray-400 dark:border-gray-800 dark:text-gray-600"),children:a})]}));Rt.displayName="DropdownMenuRadioItem";const Xt=N.forwardRef(({className:t,...s},a)=>e.jsx(re.Label,{ref:a,className:w("px-2 py-2 text-xs font-medium tracking-wide","text-gray-500 dark:text-gray-500",t),...s}));Xt.displayName="DropdownMenuLabel";const Pl=N.forwardRef(({className:t,...s},a)=>e.jsx(re.Separator,{ref:a,className:w("-mx-1 my-1 h-px border-t border-gray-200 dark:border-gray-800",t),...s}));Pl.displayName="DropdownMenuSeparator";const Ze=ge.createColumnHelper(),Tl=[Ze.display({id:"select",header:({table:t})=>e.jsx(ve,{checked:t.getIsAllPageRowsSelected()?!0:t.getIsSomeRowsSelected()?"indeterminate":!1,onCheckedChange:()=>t.toggleAllPageRowsSelected(),className:"translate-y-0.5","aria-label":"Select all"}),cell:({row:t})=>e.jsx(ve,{checked:t.getIsSelected(),onCheckedChange:()=>t.toggleSelected(),className:"translate-y-0.5","aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,meta:{displayName:"Select"}}),Ze.accessor("id",{header:({column:t})=>e.jsx(E,{column:t,title:"Id"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"ID"},cell:({row:t,table:s})=>{var r,i,n;const a=(r=s.options.meta)==null?void 0:r.organizationId;return e.jsx(H,{href:((n=(i=s.options.meta)==null?void 0:i.routes)==null?void 0:n.manufacturerEdit(a,t.getValue("id")))??`/admin/${a}/manufacturers/${t.getValue("id")}`,className:"text-blue-500",children:t.getValue("id")})}}),Ze.accessor("name",{header:({column:t})=>e.jsx(E,{column:t,title:"Name"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Owner"}}),Ze.accessor("translations",{header:({column:t})=>e.jsx(E,{column:t,title:"About"}),enableSorting:!1,meta:{className:"text-left",displayName:"Status"},cell:({row:t})=>{var a;return((a=t.getValue("translations").find(r=>r.about))==null?void 0:a.about)||"-"}}),Ze.accessor("createdAt",{header:({column:t})=>e.jsx(E,{column:t,title:"Created At"}),enableSorting:!1,meta:{className:"text-left",displayName:"Status"},cell:({row:t})=>{const s=t.getValue("createdAt");return new Date(s).toLocaleDateString()}}),Ze.display({id:"edit",header:"Edit",enableSorting:!1,enableHiding:!1,meta:{className:"text-right",displayName:"Edit"},cell:({row:t,table:s})=>{var r,i,n;const a=(r=s.options.meta)==null?void 0:r.organizationId;return e.jsxs(Le,{children:[e.jsx(Ee,{asChild:!0,children:e.jsx(z,{variant:"ghost",className:"group aspect-square px-1.5 py-0! h-8! hover:border hover:border-gray-300 data-[state=open]:border-gray-300 data-[state=open]:bg-gray-50 dark:hover:border-gray-700 dark:data-[state=open]:border-gray-700 dark:data-[state=open]:bg-gray-900",children:e.jsx(C.RiMoreFill,{className:"size-4 shrink-0 text-gray-500 group-hover:text-gray-700 group-data-[state=open]:text-gray-700 dark:group-hover:text-gray-300 dark:group-data-[state=open]:text-gray-300","aria-hidden":"true"})})}),e.jsxs(De,{align:"end",className:"min-w-40",children:[e.jsx(fe,{children:e.jsx(H,{href:((n=(i=s.options.meta)==null?void 0:i.routes)==null?void 0:n.manufacturerEdit(a,t.getValue("id")))??`/admin/${a}/manufacturers/${t.getValue("id")}`,className:"block",children:"Edit"})}),e.jsx(fe,{className:"text-red-600 dark:text-red-500",children:"Delete"})]})]})}})],Ql=()=>{const{client:t}=L(),s=Y(),a=K(),r=Q.useSearchParams(),[i,n]=h.useState(""),[o]=Fe.useDebounce(i,300),l=Number((r==null?void 0:r.get("page"))||"1"),{isLoading:d,isRefetching:c,isError:u,data:m}=R.useQuery({queryKey:["manufacturers",a,l,o],queryFn:async()=>{const{body:g,status:x}=await t.manufacturer.getManufacturers({params:{organizationId:a},query:{page:l,limit:10,search:o}});if(x!==200)throw new Error("Failed to fetch organizations");return g},placeholderData:R.keepPreviousData});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 sm:gap-x-6",children:[e.jsx("div",{className:"flex w-full flex-col gap-2 sm:w-fit sm:flex-row sm:items-center",children:e.jsx(at,{type:"search",placeholder:"Search by manufaturer...",value:i,onChange:g=>n(g.target.value),className:"w-full sm:max-w-[250px] sm:[&>input]:h-[40px]"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(z,{asChild:!0,className:"hidden gap-x-2 px-2 py-1.5 text-sm sm:text-xs lg:flex",children:e.jsxs(H,{href:s.manufacturerCreate(a),children:["Create Manufacturer",e.jsx(A.PlusIcon,{className:"size-4 shrink-0","aria-hidden":"true"})]})})})]}),e.jsx(st,{error:u,loading:d||c,meta:m!=null&&m.meta?{...m==null?void 0:m.meta,currentPage:l}:void 0,data:(m==null?void 0:m.list)||[],columns:Tl,className:"mt-8"})]})};function zl(){return e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 sm:text-2xl dark:text-gray-50",children:"Manufacturers List"}),e.jsx("div",{className:"mt-4 sm:mt-6 lg:mt-10",children:e.jsx(Ql,{})})]})}const Il=({organizationId:t,id:s,status:a,refetch:r})=>{var f;const{client:i}=L(),n=R.useMutation({mutationFn:async({operation:b})=>{if((await i.order.updateStatus({params:{id:s,organizationId:t,operation:b}})).status!==200)throw new Error("Failed to update order status");return r()}}),o=(()=>{switch(a){case"pending":return"Accept";case"accepted":return"Ready";case"ready-for-dispatch":return"Dispatch";case"dispatched":return"Complete";case"completed":return"Completed";case"cancelled":return"Cancelled";default:return"Unknown"}})(),l=()=>{const b=(()=>{switch(a){case"pending":return"accepted";case"accepted":return"ready-for-dispatch";case"ready-for-dispatch":return"dispatched";case"dispatched":return"completed";default:return null}})();b&&n.mutate({operation:b})},d=()=>{n.mutate({operation:"cancelled"})},c=n.isPending,u=(f=n.variables)==null?void 0:f.operation,m=c&&u==="cancelled",g=c&&u!=="cancelled",x=a!=="completed"&&a!=="cancelled";return e.jsxs("div",{className:"flex items-center gap-2 min-w-28",children:[e.jsxs("button",{onClick:d,disabled:c||a==="cancelled"||a==="completed",className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600","tremor-id":"tremor-raw",children:[m?"Loading...":"Cancel",e.jsx(A.X,{className:"w-4 h-4 text-red-600 dark:text-red-500"})]}),x&&e.jsxs("button",{onClick:l,disabled:c,className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600","tremor-id":"tremor-raw",children:[g?"Loading...":o,e.jsx(A.CheckCircle,{className:"w-4 h-4 text-emerald-600 dark:text-emerald-500"})]})]})},Ll=({open:t,onOpenChange:s,order:a})=>{var n,o,l,d,c,u,m;if(!a)return null;const r=g=>new Intl.NumberFormat("en-US",{style:"currency",currency:a.currency||"PLN"}).format(g),i=g=>{switch(g){case"pending":return"yellow";case"accepted":return"blue";case"ready-for-dispatch":return"purple";case"dispatched":return"orange";case"completed":return"green";case"cancelled":return"red";default:return"gray"}};return e.jsx(xt,{open:t,onOpenChange:s,children:e.jsxs(ft,{className:"sm:max-w-3xl overflow-y-auto max-h-[85vh]",children:[e.jsxs(yt,{children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs(wt,{children:["Order Details #",a.referenceId]}),e.jsx(Et,{className:"rounded-full hover:bg-gray-200 p-1 dark:hover:bg-gray-800",children:e.jsx(A.X,{className:"h-5 w-5"})})]}),e.jsx(bt,{children:a.acceptedAt?`Ordered on ${T.format(new Date(a.acceptedAt),"MMMM dd, yyyy")}`:"Order details"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mt-4",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100 mb-3",children:"Order Status"}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Status"}),e.jsx(We,{color:i(a.status||"pending"),variant:"neutral",children:a.status||"Pending"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Accepted At"}),e.jsx("span",{children:a.acceptedAt?T.format(new Date(a.acceptedAt),"dd.MM.yyyy HH:mm"):"N/A"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Ready For Dispatch"}),e.jsx("span",{children:a.readyForDispatchAt?T.format(new Date(a.readyForDispatchAt),"dd.MM.yyyy HH:mm"):"N/A"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Dispatched At"}),e.jsx("span",{children:a.dispatchedAt?T.format(new Date(a.dispatchedAt),"dd.MM.yyyy HH:mm"):"N/A"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Completed At"}),e.jsx("span",{children:a.completedAt?T.format(new Date(a.completedAt),"dd.MM.yyyy HH:mm"):"N/A"})]})]})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100 mb-3",children:"Payment Information"}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Method"}),e.jsx("span",{className:"font-medium",children:((n=a.payment)==null?void 0:n.method)||"N/A"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Provider"}),e.jsx("span",{children:((o=a.payment)==null?void 0:o.provider)||"N/A"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Status"}),e.jsx(We,{color:((l=a.payment)==null?void 0:l.status)==="succeeded"?"green":"yellow",variant:"neutral",children:((d=a.payment)==null?void 0:d.status)||"Pending"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Total Amount"}),e.jsx("span",{className:"font-bold",children:r(Number((c=a.payment)==null?void 0:c.total)||0)})]})]})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100 mb-3",children:a.fulfilmentMethod==="pickup"?"Pickup Details":"Shipping Address"}),a.shippingAddress?e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("p",{className:"font-medium",children:[a.shippingAddress.firstname," ",a.shippingAddress.lastname]}),e.jsxs("p",{children:[a.shippingAddress.addressLineOne,a.shippingAddress.doorNumber?`, ${a.shippingAddress.doorNumber}`:""]}),e.jsxs("p",{children:[a.shippingAddress.zipCode,", ",a.shippingAddress.city]}),e.jsx("p",{children:a.shippingAddress.country}),a.shippingAddress.phone&&e.jsxs("p",{className:"mt-2",children:["Phone: ",a.shippingAddress.phone]})]}):e.jsx("p",{className:"text-gray-500",children:"No address information available"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100 mb-3",children:"Fulfilment Details"}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Fulfilment Method"}),e.jsx(We,{color:"blue",variant:"neutral",children:a.fulfilmentMethod||"N/A"})]}),a.fulfilmentMethod==="delivery"&&e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Shipping Method"}),e.jsx("span",{children:((u=a.shippingMethod)==null?void 0:u.title)||"Standard Shipping"})]})]})]})]}),e.jsxs("div",{className:"mt-6 bg-gray-50 dark:bg-gray-900 rounded-lg p-4 border border-gray-200 dark:border-gray-800",children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100 mb-3",children:"Order Items"}),e.jsx("div",{className:"divide-y divide-gray-200 dark:divide-gray-800",children:a.items.map((g,x)=>{const f=g.translations.find(b=>b.locale==="en")||g.translations[0];return e.jsxs("div",{className:"py-3 flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[g.image&&e.jsx("div",{className:"h-16 w-16 rounded overflow-hidden shrink-0",children:e.jsx("img",{src:g.image.url,alt:(f==null?void 0:f.title)||"Product",className:"h-full w-full object-cover"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:(f==null?void 0:f.title)||"Product"}),(f==null?void 0:f.subtitle)&&e.jsx("p",{className:"text-sm text-gray-500",children:f.subtitle}),e.jsxs("p",{className:"text-sm mt-1",children:[r(g.unitPrice)," × ",g.quantity]})]})]}),e.jsx("div",{className:"font-medium",children:r(g.totalPrice)})]},x)})}),e.jsx("div",{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-800",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"font-medium",children:"Total"}),e.jsx("span",{className:"font-bold text-lg",children:r(Number((m=a.payment)==null?void 0:m.total)||0)})]})})]})]})})},El=({order:t})=>{const[s,a]=h.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>a(!0),className:"text-blue-500 hover:underline",children:String(t.id).slice(-5)}),e.jsx(Ll,{open:s,onOpenChange:a,order:t})]})},Dl=({order:t,table:s})=>{const a=s.options.meta,r=(a==null?void 0:a.organizationId)||"",i=typeof(a==null?void 0:a.refetch)=="function"?a.refetch:()=>{};return e.jsx(Il,{organizationId:r,id:t.id,status:t.status,refetch:i})},Qe=ge.createColumnHelper(),Ml=[Qe.accessor("id",{header:({column:t})=>e.jsx(E,{column:t,title:"ID"}),meta:{className:"text-left",displayName:"ID"},cell:({row:t})=>e.jsx(El,{order:t.original}),enableSorting:!0,enableHiding:!1}),Qe.accessor("referenceId",{header:({column:t})=>e.jsx(E,{column:t,title:"Reference ID"}),cell:({row:t})=>e.jsx("div",{className:"w-[100px]",children:t.getValue("referenceId")}),meta:{className:"text-left",displayName:"ID"},enableSorting:!1,enableHiding:!1}),Qe.display({id:"customer",meta:{className:"text-left",displayName:"ID"},header:({column:t})=>e.jsx(E,{column:t,title:"Customer"}),cell:({row:t})=>{var r,i;const s=((r=t.original.shippingAddress)==null?void 0:r.firstname)||"",a=((i=t.original.shippingAddress)==null?void 0:i.lastname)||"";return e.jsx("div",{children:`${s} ${a}`.trim()||"N/A"})}}),Qe.accessor("payment.total",{meta:{className:"text-left",displayName:"ID"},enableSorting:!0,enableHiding:!1,header:({column:t})=>e.jsx(E,{column:t,title:"Total"}),cell:({row:t})=>{const s=parseFloat(t.original.payment.total.toString()),a=new Intl.NumberFormat("en-US",{style:"currency",currency:t.original.currency||"PLN"}).format(s);return e.jsx("div",{className:"font-medium",children:a})}}),Qe.accessor("createdAt",{meta:{className:"text-left",displayName:"ID"},enableSorting:!0,enableHiding:!1,header:({column:t})=>e.jsx(E,{column:t,title:"Date & Time"}),cell:({row:t})=>{const s=t.getValue("createdAt");return s?T.format(new Date(s),"dd.MM.yyyy HH:mm"):"N/A"}}),Qe.display({id:"paymentMethod",header:({column:t})=>e.jsx(E,{column:t,title:"Payment Method"}),cell:({row:t})=>{var a;const s=(a=t.original.payment)==null?void 0:a.method;return e.jsx("div",{children:s||"N/A"})}}),Qe.display({id:"address",meta:{className:"text-left",displayName:"ID"},header:({column:t})=>e.jsx(E,{column:t,title:"Address"}),cell:({row:t})=>{var n,o,l,d;const s=((n=t.original.shippingAddress)==null?void 0:n.addressLineOne)||"",a=((o=t.original.shippingAddress)==null?void 0:o.city)||"",r=((l=t.original.shippingAddress)==null?void 0:l.doorNumber)||"",i=((d=t.original.shippingAddress)==null?void 0:d.zipCode)||"";return e.jsxs("div",{children:[e.jsxs("div",{children:[s," ",r?` / ${r}`:""]}),e.jsxs("div",{children:[i?`${i}, `:"",a]})]})}}),Qe.display({id:"status",header:({column:t})=>e.jsx(E,{column:t,title:"Actions"}),cell:({row:t,table:s})=>e.jsx(Dl,{order:t.original,table:s})})],Bl=()=>{const{client:t}=L(),s=K(),a=Q.useSearchParams(),[r,i]=h.useState(""),[n]=Fe.useDebounce(r,300),o=Number((a==null?void 0:a.get("page"))||"1"),{isLoading:l,isRefetching:d,isError:c,data:u,refetch:m}=R.useQuery({queryKey:["orders",s,o,n],queryFn:async()=>{const{body:g,status:x}=await t.order.getOrders({params:{organizationId:s},query:{page:o,limit:10,search:n}});if(x!==200)throw new Error("Failed to fetch orders");return g},placeholderData:R.keepPreviousData});return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 sm:gap-x-6",children:e.jsx("div",{className:"flex w-full flex-col gap-2 sm:w-fit sm:flex-row sm:items-center",children:e.jsx(at,{type:"search",placeholder:"Search by order reference...",value:r,onChange:g=>i(g.target.value),className:"w-full sm:max-w-[250px] sm:[&>input]:h-[40px]"})})}),e.jsx(st,{error:c,loading:l||d,meta:u!=null&&u.meta?{...u==null?void 0:u.meta,currentPage:o}:void 0,data:(u==null?void 0:u.list)||[],columns:Ml,className:"mt-8",refetch:m})]})};function Jl(){return e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 sm:text-2xl dark:text-gray-50",children:"Orders List"}),e.jsx("div",{className:"mt-4 sm:mt-6 lg:mt-10",children:e.jsx(Bl,{})})]})}const ci=({onClose:t,initialData:s})=>{var c;const{client:a}=L(),r=F.useForm({resolver:ue.zodResolver(s?bs:Ea),defaultValues:{...s}}),i=r.watch("address.placeId"),n=r.watch("address.addressLineOne");h.useEffect(()=>{(async()=>{if(i){const{status:u,body:m}=await a.location.getPlaceDetails({params:{placeId:i}});if(u!==200)throw new Error("Failed to fetch place details");r.setValue("address.zipCode",m.zipCode,{shouldValidate:!0}),r.setValue("address.city",m.city,{shouldValidate:!0}),r.setValue("address.country",m.country,{shouldValidate:!0})}})()},[r,i]);const o=R.useMutation({mutationFn:async u=>{const{logoFile:m,...g}=u;return await a.organization.createOrganization({body:{...g,logoId:m==null?void 0:m.id}})},onSuccess:async()=>{await Ae.invalidateQueries({queryKey:["organizations"]}),t&&t()}}),l=R.useMutation({mutationFn:async u=>{const{logoFile:m,...g}=u;return await a.organization.updateOrganization({params:{organizationId:s.id},body:{...g,logoId:m==null?void 0:m.id}})},onSuccess:async()=>{await Ae.invalidateQueries({queryKey:["organizations"]}),t&&t()}}),d=u=>{s?l.mutate(u):o.mutate(u)};return e.jsx("div",{className:"mt-6",children:e.jsx(F.FormProvider,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(u=>d(u)),className:"grid gap-5 grid-cols-4",children:[e.jsx(ae,{name:"name",label:"Organization Name",placeholder:"Acme Inc.",className:"col-span-2"}),e.jsx(ae,{name:"email",type:"email",label:"Support Email",placeholder:"john.doe@example.com",className:"col-span-2"}),e.jsx(ae,{name:"phone",type:"phone-number",label:"Phone Number",placeholder:"Enter phone number",className:"col-span-4"}),e.jsxs("div",{className:"col-span-4 text-sm text-gray-500",children:[e.jsx(le,{htmlFor:"address.addressLineOne",className:"font-medium flex items-center justify-between",children:"Street / Address Line 1"}),e.jsx($t,{onChange:u=>{r.setValue("address.addressLineOne",u.addressLineOne,{shouldValidate:!0}),r.setValue("address.placeId",u.placeId,{shouldValidate:!0})},value:n??""}),((c=r.formState.errors.address)==null?void 0:c.addressLineOne)&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:r.formState.errors.address.addressLineOne.message})]}),e.jsx(ae,{name:"address.addressLineTwo",label:"Door / Address Line 2",placeholder:"Apt 123",className:"col-span-2"}),e.jsx(ae,{name:"address.zipCode",label:"Postal Code",placeholder:"12345",className:"col-span-2"}),e.jsx(ae,{name:"address.city",label:"City",placeholder:"New York",className:"col-span-2"}),e.jsx(ae,{name:"address.country",label:"Country",placeholder:"United States",className:"col-span-2",type:"country"}),e.jsx(ae,{name:"logoFile",label:"Logo",type:"file",className:"col-span-2"}),e.jsxs("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 mt-5 col-span-full border-t pt-7",children:[t&&e.jsx(z,{type:"button",className:"w-full sm:w-fit",variant:"secondary",onClick:t,children:"Cancel"}),e.jsx(z,{type:"submit",className:"w-full sm:w-fit",isLoading:o.isPending||l.isPending,loadingText:"Saving...",children:s?"Update Data":"Create Organization"})]})]})})})},Ol=()=>{const[t,s]=h.useState(!1),a=Y(),{organizations:r}=pe(),i=()=>s(!1);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"max-w-4xl mx-auto py-8 px-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-900 dark:text-gray-50",children:"Organizations"}),e.jsx("p",{className:"text-gray-500 sm:text-sm/6 dark:text-gray-500",children:"Select a organization to get started."})]}),e.jsx("div",{className:"w-min h-min",children:e.jsxs(z,{onClick:()=>s(!0),variant:"primary",children:[e.jsx(A.PlusIcon,{className:"w-4 h-4 mr-1"})," Add New"]})})]}),r.loading?e.jsx("div",{className:"flex justify-center items-center h-32 mt-5",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsxs("svg",{"aria-hidden":"true",className:"w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),e.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),e.jsx("p",{className:"text-gray-500 text-sm mt-2",children:"Loading organizations..."})]})}):e.jsx("div",{className:"grid grid-cols-1 gap-y-3 gap-x-4 animate-fade-in mt-5",children:r.data.map(n=>{var o,l;return e.jsxs("div",{className:"relative flex items-center rounded-md border border-gray-200 bg-white px-4 py-3 shadow-xs dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("span",{className:"absolute inset-x-0 top-1/2 h-10 w-1 -translate-y-1/2 rounded-r-md bg-blue-500 dark:bg-blue-500","aria-hidden":"true"}),n.logoFile?e.jsx(xe,{src:n.logoFile.url,alt:n.name,width:100,height:100,className:"rounded-lg ml-2 h-16 w-16 object-cover"}):e.jsx("div",{className:"rounded-full ml-2",children:e.jsxs("div",{className:"rounded-full h-14 w-14 bg-blue-500 text-white text-xl flex items-center justify-center",children:[n.name.charAt(0).toUpperCase(),n.name.charAt(1).toUpperCase()]})}),e.jsxs("div",{className:"border-l ml-6 pl-6 flex justify-between items-center w-full",children:[e.jsxs("div",{children:[e.jsx("p",{className:"flex items-center justify-between gap-2",children:e.jsx("span",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:n.name})}),e.jsx("p",{className:"flex items-center justify-between gap-2",children:e.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-500",children:[(o=n.address)==null?void 0:o.addressLineOne,","," ",(l=n.address)==null?void 0:l.city]})})]}),e.jsx("div",{children:e.jsx(H,{className:"block rounded-full text-blue-500 p-2 hover:bg-blue-500 hover:text-white hover:translate-y-[-2px] hover:shadow-lg transition mr-2 border border-gray-200 dark:border-gray-700/60 hover:border-blue-500",href:a.dashboard(n.id),children:e.jsx(A.ArrowRight,{className:"w-5 h-5"})})})]})]},n.id)})})]}),e.jsxs(xt,{onOpenChange:i,open:t,children:[e.jsx(Ts,{className:"w-full text-left"}),e.jsxs(ft,{className:"sm:max-w-xl",children:[e.jsxs(yt,{children:[e.jsx(wt,{children:"Create a Organization"}),e.jsx(bt,{className:"mt-1 text-sm leading-6",children:"Fill in the details below to create a new organization"})]}),e.jsx(ci,{onClose:i})]})]})]})};function Fl(){const{appearance:t}=fr(),s=t==null?void 0:t.organizationImage;return e.jsxs("div",{className:"flex w-full min-h-screen",children:[s&&e.jsx("div",{className:"hidden lg:block relative w-1/2 overflow-hidden",children:e.jsx(xe,{src:s,alt:"Organization Visual",width:4e3,height:2250,className:"w-full h-full object-cover min-h-screen"})}),e.jsx("div",{className:`w-full ${s?"lg:w-1/2":""} flex items-center justify-center p-8`,children:e.jsx("div",{className:"w-full max-w-md space-y-8",children:e.jsx(Ol,{})})})]})}const Je=ge.createColumnHelper(),Vl=({row:t,table:s})=>{var d,c;const{client:a}=L(),r=t.getValue("publishedAt"),i=(d=s.options.meta)==null?void 0:d.organizationId,n=(c=s.options.meta)==null?void 0:c.refetch,o=R.useMutation({mutationFn:async()=>{if((await a.productCategory.updateStatus({params:{id:t.getValue("id"),organizationId:i,operation:r?"unpublish":"publish"}})).status!==200)throw new Error("Failed to update product category status");n&&await n()}}),l=()=>{o.mutate()};return o.isPending?e.jsx("div",{className:"min-w-28",children:e.jsxs("button",{className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600","tremor-id":"tremor-raw",disabled:!0,children:[e.jsx(ce,{className:"w-4 h-4"})," Saving..."]})}):e.jsx("div",{className:"min-w-28",children:e.jsxs("button",{onClick:l,className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600","tremor-id":"tremor-raw",children:[r?e.jsx(A.CheckCircle,{className:"w-4 h-4 text-emerald-600 dark:text-emerald-500"}):e.jsx(A.EyeOffIcon,{className:"w-4 h-4 text-red-600 dark:text-red-500"}),r?"Published":"Draft"]})})},Hl=({row:t,table:s})=>{var l,d,c,u;const{client:a}=L(),r=(l=s.options.meta)==null?void 0:l.organizationId,i=(d=s.options.meta)==null?void 0:d.refetch,n=R.useMutation({mutationFn:async()=>{if((await a.productCategory.deleteProductCategory({params:{id:t.getValue("id"),organizationId:r}})).status!==204)throw new Error("Failed to delete product category");i&&await i()}}),o=()=>{window.confirm("Are you sure you want to delete this product category? This action cannot be undone.")&&n.mutate()};return e.jsxs(Le,{children:[e.jsx(Ee,{asChild:!0,children:e.jsx(z,{variant:"ghost",className:"group aspect-square px-1.5 py-0! h-8! hover:border hover:border-gray-300 data-[state=open]:border-gray-300 data-[state=open]:bg-gray-50 dark:hover:border-gray-700 dark:data-[state=open]:border-gray-700 dark:data-[state=open]:bg-gray-900",disabled:n.isPending,children:n.isPending?e.jsx(ce,{className:"size-4 shrink-0"}):e.jsx(C.RiMoreFill,{className:"size-4 shrink-0 text-gray-500 group-hover:text-gray-700 group-data-[state=open]:text-gray-700 dark:group-hover:text-gray-300 dark:group-data-[state=open]:text-gray-300","aria-hidden":"true"})})}),e.jsxs(De,{align:"end",className:"min-w-40",children:[e.jsx(fe,{children:e.jsxs(H,{href:((u=(c=s.options.meta)==null?void 0:c.routes)==null?void 0:u.productCategoryEdit(r,t.getValue("id")))??`/admin/${r}/product-categories/${t.getValue("id")}`,className:"block flex items-center gap-2",children:[e.jsx(A.PencilIcon,{className:"w-4 h-4"}),"Edit"]})}),e.jsx(fe,{className:"text-red-600 dark:text-red-500 cursor-pointer",onClick:o,disabled:n.isPending,children:e.jsxs("div",{className:"flex items-center gap-2",children:[n.isPending?e.jsx(ce,{className:"w-4 h-4"}):e.jsx(A.Trash2,{className:"w-4 h-4"}),n.isPending?"Deleting...":"Delete"]})})]})]})},Zl=[Je.display({id:"select",header:({table:t})=>e.jsx(ve,{checked:t.getIsAllPageRowsSelected()?!0:t.getIsSomeRowsSelected()?"indeterminate":!1,onCheckedChange:()=>t.toggleAllPageRowsSelected(),className:"translate-y-0.5","aria-label":"Select all"}),cell:({row:t})=>e.jsx(ve,{checked:t.getIsSelected(),onCheckedChange:()=>t.toggleSelected(),className:"translate-y-0.5","aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,meta:{displayName:"Select"}}),Je.accessor("id",{header:({column:t})=>e.jsx(E,{column:t,title:"Id"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"ID"},cell:({row:t,table:s})=>{var r,i,n;const a=(r=s.options.meta)==null?void 0:r.organizationId;return e.jsx(H,{href:((n=(i=s.options.meta)==null?void 0:i.routes)==null?void 0:n.productCategoryEdit(a,t.getValue("id")))??`/admin/${a}/product-categories/${t.getValue("id")}`,className:"text-blue-500",children:t.getValue("id")})}}),Je.accessor("slug",{header:({column:t})=>e.jsx(E,{column:t,title:"Slug"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Slug"}}),Je.accessor("title",{header:({column:t})=>e.jsx(E,{column:t,title:"Title"}),enableSorting:!1,meta:{className:"text-left",displayName:"Name"}}),Je.accessor("publishedAt",{header:({column:t})=>e.jsx(E,{column:t,title:"Status"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Status"},cell:({row:t,table:s})=>e.jsx(Vl,{row:t,table:s})}),Je.accessor("createdAt",{header:({column:t})=>e.jsx(E,{column:t,title:"Created At"}),enableSorting:!1,meta:{className:"text-left",displayName:"Created At"},cell:({row:t})=>{const s=t.getValue("createdAt");return new Date(s).toLocaleDateString()}}),Je.display({id:"edit",header:"Edit",enableSorting:!1,enableHiding:!1,meta:{className:"text-right",displayName:"Edit"},cell:({row:t,table:s})=>e.jsx(Hl,{row:t,table:s})})],Ul=()=>{const{client:t}=L(),s=Y(),{defaultLocale:a}=pe(),r=K(),i=Q.useSearchParams(),[n,o]=h.useState(""),l=Number((i==null?void 0:i.get("page"))||"1"),[d]=Fe.useDebounce(n,300),{isLoading:c,isRefetching:u,isError:m,data:g,refetch:x}=R.useQuery({queryKey:["productCategories",r,l,d,a],queryFn:async()=>{const{body:f,status:b}=await t.productCategory.getProductCategories({params:{organizationId:r},query:{page:l,limit:10,search:d,locale:a}});if(b!==200)throw new Error("Failed to fetch product categories");return f},placeholderData:R.keepPreviousData});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 sm:gap-x-6",children:[e.jsx("div",{className:"flex w-full flex-col gap-2 sm:w-fit sm:flex-row sm:items-center",children:e.jsx(at,{type:"search",placeholder:"Search by product category...",value:n,onChange:f=>o(f.target.value),className:"w-full sm:max-w-[250px] sm:[&>input]:h-[40px]"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(z,{asChild:!0,className:"hidden gap-x-2 px-2 py-1.5 text-sm sm:text-xs lg:flex",children:e.jsxs(H,{href:s.productCategoryCreate(r),children:["Create Product Category",e.jsx(A.PlusIcon,{className:"size-4 shrink-0","aria-hidden":"true"})]})})})]}),e.jsx(st,{error:m,loading:c||u,meta:g==null?void 0:g.meta,data:(g==null?void 0:g.list)||[],columns:Zl,className:"mt-8",refetch:x})]})};function Wl(){return e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 sm:text-2xl dark:text-gray-50",children:"Product Categories List"}),e.jsx("div",{className:"mt-4 sm:mt-6 lg:mt-10",children:e.jsx(Ul,{})})]})}const ql=[{name:"slug",label:"Slug",type:"text",placeholder:"electronics",colspan:2},{name:"title",label:"Title",type:"text",placeholder:"Electronics",colspan:2,localizable:!0},{name:"description",label:"Description",type:"textarea",placeholder:"All electronic devices and accessories.",colspan:2,localizable:!0},{name:"image",label:"Image",type:"file"}],ui=({initialData:t})=>{const{client:s}=L(),a=Q.useRouter(),r=Y(),i=K(),{defaultLocale:n,supportedLocales:o}=pe(),l=t?tn:en,d=F.useForm({resolver:ue.zodResolver(l),defaultValues:t?{defaultLocale:n,slug:t.slug,image:t.image,translations:t.translations}:{defaultLocale:n,translations:o.map(x=>({locale:x}))}}),c=R.useMutation({mutationFn:async x=>{var y;const f={slug:x.slug,defaultLocale:x.defaultLocale,translations:x.translations,imageId:(y=x.image)==null?void 0:y.id},{status:b}=await s.productCategory.createProductCategory({params:{organizationId:i},body:f});if(b!==201)throw X.error("Failed to create product category. Please try again later."),new Error("Failed to create product category")}}),u=R.useMutation({mutationFn:async x=>{var y;const f={slug:x.slug,defaultLocale:x.defaultLocale,translations:x.translations,imageId:((y=x.image)==null?void 0:y.id)||null},{status:b}=await s.productCategory.updateProductCategory({params:{organizationId:i,id:t.id},body:f});if(b!==200)throw X.error("Failed to update product category. Please try again later."),new Error("Failed to update product category")}}),m=async()=>{X.success("Product category saved successfully"),a.push(r.productCategories(i)),await Ae.invalidateQueries({queryKey:["productCategories"]})},g=x=>{t?u.mutate(x,{onSuccess:m}):c.mutate(x,{onSuccess:m})};return e.jsx(Ne,{form:d,config:ql,onSubmit:g,loading:c.isPending||u.isPending,cancelText:"Go back",okText:t?"Update Product Category":"Create Product Category"})};function $l(){return e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Create Product Category"}),e.jsx(_,{}),e.jsx("div",{className:"pt-6",children:e.jsx("div",{className:"space-y-10",children:e.jsx("section",{"aria-labelledby":"product-category-info",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-category-info",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Product Category Information"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Enter the information about the product category."})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(ui,{})})]})})})})]})}function _l(){const t=K(),s=gt(),{client:a}=L(),{isLoading:r,data:i}=R.useQuery({queryKey:["productCategories",t,s],queryFn:async()=>{const{status:n,body:o}=await a.productCategory.getProductCategory({params:{id:s,organizationId:t}});if(n!==200)throw X.error("Failed to fetch product category. Please refresh or try again later."),new Error("Failed to fetch product category");return o},throwOnError:!0,placeholderData:R.keepPreviousData});return e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Edit Product Category"}),e.jsx(_,{}),e.jsx("div",{className:"pt-6",children:e.jsx("div",{className:"space-y-10",children:e.jsx("section",{"aria-labelledby":"product-category-info",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-category-info",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Product Category Information"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Enter the information about the product category."})]}),e.jsx("div",{className:"md:col-span-2",children:r||!i?e.jsx("div",{className:"flex justify-center items-center h-[500px] mt-5",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(ce,{className:"w-12 h-12"}),e.jsx("p",{className:"text-gray-500 text-sm mt-3",children:"Loading data..."})]})}):e.jsx(ui,{initialData:i})})]})})})})]})}const Gl=({form:t})=>{const{client:s}=L(),a=K(),{data:r}=R.useQuery({queryKey:["product-categories",a],queryFn:async()=>{const o=await s.productCategory.getProductCategories({params:{organizationId:a},query:{limit:100}});if(o.status!==200)throw new Error("Failed to fetch product categories");return o.body.list.map(l=>({label:l.translations[0].title||"",value:l.id}))},throwOnError:!0}),{data:i}=R.useQuery({queryKey:["manufacturers",a],queryFn:async()=>{const o=await s.manufacturer.getManufacturers({params:{organizationId:a},query:{limit:100}});if(o.status!==200)throw new Error("Failed to fetch product categories");return o.body.list.map(l=>({label:l.name,value:l.id}))},throwOnError:!0}),n=[{name:"title",label:"Title",type:"text",placeholder:"Enter product name",colspan:2,localizable:!0},{name:"description",label:"Description",type:"textarea",placeholder:"Enter product description",colspan:2,localizable:!0},{name:"slug",label:"Slug",type:"text",placeholder:"Enter a URL-friendly slug"},{name:"sku",label:"SKU (Stock Keeping Unit)",type:"text",placeholder:"Enter SKU"},{name:"categories",label:"Categories",type:"select",options:r||[],multiple:!0},{name:"manufacturerId",label:"Manufacturer",type:"select",options:i||[]},{name:"images",label:"Images",type:"file",multiple:!0,colspan:2}];return e.jsx("section",{"aria-labelledby":"product-information",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-information",className:"text-lg scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Basic Information"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Enter the basic information of your product, including the name, description, base price, and other essential details."})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(Ne,{form:t,config:n})})]})})},Kl=({form:t})=>{const[s,a]=h.useState([]);h.useEffect(()=>{const l=t.getValues("metadata")||{},d=Object.entries(l);d.length>0&&a(d.map(([c,u],m)=>({id:`metadata-${m}-${Date.now()}`,key:c,value:u})))},[t]);const r=h.useCallback(l=>{const d={};l.forEach(c=>{c.key&&c.value&&(d[c.key]=c.value)}),t.setValue("metadata",Object.keys(d).length>0?d:void 0)},[t]),i=()=>{const l={id:`metadata-${Date.now()}`,key:"",value:""},d=[...s,l];a(d)},n=l=>{const d=s.filter((c,u)=>u!==l);a(d),r(d)},o=(l,d,c)=>{const u=[...s];u[l][d]=c,a(u),r(u)};return e.jsx("section",{"aria-labelledby":"product-metadata",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-metadata",className:"text-lg scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Metadata"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Add custom key-value pairs to store additional information about your product. Keys must start with a letter and contain only letters, numbers, underscores, or dashes."})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsxs("div",{className:"space-y-4",children:[s.map((l,d)=>e.jsxs("div",{className:"flex gap-4 items-start",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(be,{htmlFor:`metadata-key-${d}`,className:"font-medium",children:"Key"}),e.jsx(he,{id:`metadata-key-${d}`,type:"text",value:l.key,onChange:c=>o(d,"key",c.target.value),placeholder:"e.g., color, size, weight",className:"mt-2"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx(be,{htmlFor:`metadata-value-${d}`,className:"font-medium",children:"Value"}),e.jsx(he,{id:`metadata-value-${d}`,type:"text",value:l.value,onChange:c=>o(d,"value",c.target.value),placeholder:"e.g., red, large, 2.5kg",className:"mt-2"})]}),e.jsx(z,{type:"button",variant:"destructive",className:"mt-8 min-w-[42px] h-[42px] p-0",onClick:()=>n(d),children:e.jsx(A.TrashIcon,{className:"w-4 h-4"})})]},l.id)),s.length===0&&e.jsx("p",{className:"text-sm text-gray-500 italic",children:"No metadata added yet. Click the button below to add key-value pairs."}),e.jsxs(z,{type:"button",variant:"secondary",onClick:i,className:"w-full shadow-none mt-2",children:[e.jsx(A.PlusIcon,{className:"w-4 h-4 mr-2"}),"Add Row"]})]})})]})})},Xl=({open:t,onClose:s,initialData:a,onSubmit:r})=>{const{defaultLocale:i,supportedLocales:n}=pe(),o=F.useForm({resolver:ue.zodResolver(va),defaultValues:a?{...a,defaultLocale:i}:{defaultLocale:i,translations:n.map(m=>({locale:m,title:""})),modifiers:[{title:"",price:0}]}}),{fields:l,append:d,remove:c}=F.useFieldArray({control:o.control,name:"modifiers"}),u=m=>{r(m),s(),o.reset({defaultLocale:i,translations:n.map(g=>({locale:g,title:""})),modifiers:[{title:"",price:0}]})};return e.jsx(xt,{open:t,onOpenChange:s,children:e.jsxs(ft,{className:"max-w-[710px]",children:[e.jsxs(yt,{children:[e.jsx(wt,{children:"New Modifier Group"}),e.jsx(bt,{className:"text-sm mb-5",children:"Modifiers allow you to create different variants of the same product. Create or choose existing modifiers for your product."})]}),e.jsxs(F.FormProvider,{...o,children:[e.jsx(Ne,{form:o,config:[{name:"title",label:"Group Title",type:"text",placeholder:'For example: "Spice Level" or "Select toppings".',colspan:2,localizable:!0},{name:"selectMin",label:"Select Min",type:"number",placeholder:"Minimum selections",colspan:1},{name:"selectMax",label:"Select Max",type:"number",placeholder:"Maximum selections",colspan:1}]}),e.jsx("h3",{className:"text-lg font-semibold mt-6",children:"Modifier Options"}),e.jsx("p",{className:"text-sm text-gray-500 mb-6 mt-1",children:"Add options to this modifier group. Modifier options are the different variants of the product. The price adds to the base price of the product. Leave the price as 0 if it's free."}),l.map((m,g)=>e.jsxs("div",{className:"mb-4 flex",children:[e.jsx(Ne,{form:o,columns:2,config:[{name:`modifiers.${g}.title`,label:"Title",type:"text",placeholder:'eg: "Mild" or "Pepperoni"',colspan:1},{name:`modifiers.${g}.price`,label:"Price",type:"number",placeholder:"Price for this modifier",colspan:1,prefix:"USD"}]}),l.length>1&&e.jsx(z,{type:"button",variant:"destructive",className:"mt-auto ml-4 min-w-[42px] h-[42px] p-0! shadow-none!",onClick:()=>c(g),children:e.jsx(A.XIcon,{className:"w-4 h-4"})})]},m.id)),e.jsx(z,{type:"button",variant:"secondary",className:"mb-4 mt-4 ml-auto w-full shadow-none",onClick:()=>d({title:"",price:0}),children:"Add Another Option"}),e.jsx(_,{className:"mt-8 mb-6"}),e.jsxs("div",{className:"flex justify-end space-x-3 mt-6 col-span-full",children:[e.jsx(z,{type:"button",className:"w-full sm:w-fit",variant:"secondary",onClick:s,children:"Cancel"}),e.jsx(z,{type:"button",className:"w-full sm:w-fit",onClick:o.handleSubmit(u),children:a?"Save Modifier Group":"Create Modifier Group"})]})]})]})})},Yl=({form:t})=>{const{control:s}=t,{defaultLocale:a}=pe(),{fields:r,append:i,remove:n,update:o}=F.useFieldArray({control:s,name:"modifierGroups"}),[l,d]=h.useState(!1),[c,u]=h.useState(null),m=()=>crypto.randomUUID(),g=S=>{var k;return{...S,id:S.id??m(),defaultLocale:S.defaultLocale??a,modifiers:((k=S.modifiers)==null?void 0:k.map(j=>({...j,id:j.id??m()})))??[]}},x=S=>{S.preventDefault(),u(null),d(!0)},f=S=>{u(S),d(!0)},b=S=>{if(c===null){i(g(S)),d(!1);return}o(c,g(S)),d(!1)},y=()=>{i({id:m(),defaultLocale:a,selectMin:1,selectMax:1,modifiers:[{id:m(),title:"Łagodny (Mild)",sku:"null",price:0},{id:m(),title:"Średni (Medium)",sku:"null",price:0},{id:m(),title:"Ostry (Spicy)",sku:"null",price:0}],translations:[{locale:"en",title:"Spice Level"},{locale:"pl",title:"Ostrość"}]})};return e.jsxs("section",{"aria-labelledby":"product-modifiers",className:"min-h-[200px]",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-modifiers",className:"text-lg scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Product Modifiers (Optional)"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Modifiers allow you to create different variants of the same product. Create or choose existing modifiers for your product."})]}),e.jsx("div",{className:"md:col-span-2",children:r.length===0?e.jsxs("div",{className:"text-center flex-col justify-center items-center",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"No Modifier Groups"}),e.jsx("p",{className:"text-gray-500 max-w-[500px] mx-auto mt-1",children:"If your product has different options or variants, you can add modifier groups to manage them."}),e.jsxs("div",{className:"flex space-x-3 mx-auto w-min mt-6",children:[e.jsxs(z,{type:"button",variant:"secondary",className:"shadow-none",onClick:y,children:[e.jsx(A.BookCopyIcon,{className:"w-4 h-4 mr-2"})," Add From Template"]}),e.jsxs(z,{type:"button",variant:"secondary",className:"shadow-none",onClick:x,children:[e.jsx(A.PlusIcon,{className:"w-4 h-4 mr-2"})," Create Modifier Group"]})]})]}):e.jsxs("div",{className:"space-y-10",children:[e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsxs(z,{type:"button",variant:"secondary",className:"shadow-none",onClick:y,children:[e.jsx(A.BookCopyIcon,{className:"w-4 h-4 mr-2"})," Add From Template"]}),e.jsxs(z,{type:"button",variant:"secondary",className:"shadow-none",onClick:x,children:[e.jsx(A.PlusIcon,{className:"w-4 h-4 mr-2"})," Create Modifier Group"]})]}),e.jsx("div",{className:"space-y-4",children:r.map((S,k)=>{var j;return e.jsxs("div",{className:"p-4 border rounded-md",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-semibold",children:S.translations[0].title||"Unnamed Group"}),e.jsxs("div",{children:[e.jsx("button",{type:"button",onClick:()=>f(k),className:"text-blue-500 font-medium hover:underline text-sm mr-4",children:"Edit"}),e.jsx("button",{type:"button",onClick:()=>n(k),className:"text-red-500 font-medium hover:underline text-sm p-0!",children:"Remove"})]})]}),e.jsxs("p",{className:"text-sm text-gray-500 mt-3",children:["Min: ",S.selectMin," | Max: ",S.selectMax]}),e.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["Available Options:"," ",(j=S.modifiers)==null?void 0:j.map(v=>v==null?void 0:v.title).join(",")]})]},S.id)})})]})})]}),e.jsx(Xl,{open:l,initialData:c===null?null:r[c],onSubmit:b,onClose:()=>{d(!1),u(null)}},c)]})},ed=({form:t,loading:s})=>{const a=[{name:"basePrice",label:"Base Price",type:"number",placeholder:"Enter base price",prefix:"USD"},{name:"discountedBasePrice",label:"Discounted Price",type:"number",placeholder:"Enter discounted price",prefix:"USD"}];return e.jsx("section",{"aria-labelledby":"product-information",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-information",className:"text-lg scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Pricing"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Enter the pricing details of your product, including the base price and discounted price."})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(Ne,{form:t,config:a,loading:s})})]})})},pi=({initialData:t})=>{var f,b;const{client:s}=L(),a=Q.useRouter(),r=Y(),i=K(),n=gt(),{defaultLocale:o,supportedLocales:l}=pe(),d=t?nn:rn,c=F.useForm({resolver:ue.zodResolver(d),defaultValues:t?{...t,defaultLocale:o,categories:(f=t.categories)==null?void 0:f.map(y=>y.id),translations:t.translations,images:t.images,metadata:t.metadata,modifierGroups:(b=t.modifierGroups)==null?void 0:b.map(y=>({...y,defaultLocale:o,translations:y.translations,modifiers:y.modifiers}))}:{defaultLocale:o,translations:l.map(y=>({locale:y})),currency:"USD"}}),u=R.useMutation({mutationFn:async y=>{const{status:S}=await s.product.createProduct({params:{organizationId:i},body:y});if(S!==201)throw new Error("Failed to create product")}}),m=R.useMutation({mutationFn:async y=>{const{status:S}=await s.product.updateProduct({params:{organizationId:i,id:n},body:y});if(S!==200)throw new Error("Failed to update product")}}),g=async()=>{X.success("Product saved successfully"),a.push(r.products(i)),await Ae.invalidateQueries({queryKey:["products"]}),await Ae.invalidateQueries({queryKey:["product",i,n]})},x=y=>{t?m.mutate(y,{onSuccess:g}):u.mutate(y,{onSuccess:g})};return console.log(c.watch()),e.jsx(F.FormProvider,{...c,children:e.jsxs("form",{onSubmit:c.handleSubmit(y=>x(y)),className:"space-y-14",children:[e.jsx(Gl,{form:c}),e.jsx(_,{}),e.jsx(ed,{form:c}),e.jsx(_,{}),e.jsx(Yl,{form:c}),e.jsx(_,{}),e.jsx(Kl,{form:c}),e.jsx(_,{}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsxs(z,{type:"button",variant:"secondary",onClick:()=>a.push(r.products(i)),children:[e.jsx(A.ChevronLeft,{className:"w-4 h-4 mr-2"})," Cancel"]}),e.jsxs(z,{type:"submit",isLoading:u.isPending||m.isPending,loadingText:"Saving...",children:[e.jsx(A.CheckIcon,{className:"w-4 h-4 mr-2"})," ",t?"Save Product":"Create Product"]})]})]})})};function td(){return e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Create Product"}),e.jsx(_,{}),e.jsx("div",{className:"pt-6",children:e.jsx("div",{className:"space-y-10",children:e.jsx(pi,{})})})]})}function sd(){const t=K(),s=gt(),{client:a}=L(),{data:r,isLoading:i}=R.useQuery({queryKey:["product",t,s],queryFn:async()=>{const{status:n,body:o}=await a.product.getProduct({params:{organizationId:t,id:s}});if(n!==200)throw X.error("Failed to load product"),new Error("Failed to fetch product");return o}});return e.jsxs("div",{className:"space-y-6",children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 sm:text-2xl dark:text-gray-50",children:"Edit Product"}),e.jsx(_,{}),i?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(ce,{className:"w-8 h-8"})}):e.jsx("div",{className:"pt-6",children:e.jsx(pi,{initialData:r})})]})}const Ce=ge.createColumnHelper(),ad=({row:t,table:s})=>{var d;const{client:a}=L(),r=t.getValue("publishedAt"),i=(d=s.options.meta)==null?void 0:d.organizationId,n=s.options.meta.refetch,o=R.useMutation({mutationFn:async()=>{if((await a.product.updateStatus({params:{id:t.getValue("id"),organizationId:i,operation:r?"unpublish":"publish"}})).status!==200)throw new Error("Failed to update product status");await n()}}),l=()=>{o.mutate()};return o.isPending?e.jsx("div",{className:"min-w-28",children:e.jsxs("button",{className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600","tremor-id":"tremor-raw",disabled:!0,children:[e.jsx(ce,{className:"w-4 h-4"})," Saving..."]})}):e.jsx("div",{className:"min-w-28",children:e.jsxs("button",{onClick:l,className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600","tremor-id":"tremor-raw",children:[r?e.jsx(A.CheckCircle,{className:"w-4 h-4 text-emerald-600 dark:text-emerald-500"}):e.jsx(A.EyeOffIcon,{className:"w-4 h-4 text-red-600 dark:text-red-500"}),r?"Published":"Draft"]})})},rd=({row:t,table:s})=>{var l,d,c;const{client:a}=L(),r=(l=s.options.meta)==null?void 0:l.organizationId,i=s.options.meta.refetch,n=R.useMutation({mutationFn:async()=>{if((await a.product.deleteProduct({params:{id:t.getValue("id"),organizationId:r}})).status!==204)throw new Error("Failed to delete product");await i()}}),o=()=>{window.confirm("Are you sure you want to delete this product? This action cannot be undone.")&&n.mutate()};return e.jsxs(Le,{children:[e.jsx(Ee,{asChild:!0,children:e.jsx(z,{variant:"ghost",className:"group aspect-square px-1.5 py-0! h-8! hover:border hover:border-gray-300 data-[state=open]:border-gray-300 data-[state=open]:bg-gray-50 dark:hover:border-gray-700 dark:data-[state=open]:border-gray-700 dark:data-[state=open]:bg-gray-900",disabled:n.isPending,children:n.isPending?e.jsx(ce,{className:"size-4 shrink-0"}):e.jsx(C.RiMoreFill,{className:"size-4 shrink-0 text-gray-500 group-hover:text-gray-700 group-data-[state=open]:text-gray-700 dark:group-hover:text-gray-300 dark:group-data-[state=open]:text-gray-300","aria-hidden":"true"})})}),e.jsxs(De,{align:"end",className:"min-w-40",children:[e.jsx(fe,{children:e.jsxs(H,{href:((c=(d=s.options.meta)==null?void 0:d.routes)==null?void 0:c.productEdit(r,t.getValue("id")))??`/admin/${r}/products/${t.getValue("id")}`,className:"block flex items-center gap-2",children:[e.jsx(A.PencilIcon,{className:"w-4 h-4"}),"Edit"]})}),e.jsx(fe,{className:"text-red-600 dark:text-red-500 cursor-pointer",onClick:o,disabled:n.isPending,children:e.jsxs("div",{className:"flex items-center gap-2",children:[n.isPending?e.jsx(ce,{className:"w-4 h-4"}):e.jsx(A.Trash2,{className:"w-4 h-4"}),n.isPending?"Deleting...":"Delete"]})})]})]})},id=[Ce.display({id:"select",header:({table:t})=>e.jsx(ve,{checked:t.getIsAllPageRowsSelected()?!0:t.getIsSomeRowsSelected()?"indeterminate":!1,onCheckedChange:()=>t.toggleAllPageRowsSelected(),className:"translate-y-0.5","aria-label":"Select all"}),cell:({row:t})=>e.jsx(ve,{checked:t.getIsSelected(),onCheckedChange:()=>t.toggleSelected(),className:"translate-y-0.5","aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,meta:{displayName:"Select"}}),Ce.accessor("id",{header:({column:t})=>e.jsx(E,{column:t,title:"Id"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"ID"},cell:({row:t,table:s})=>{var r,i,n;const a=(r=s.options.meta)==null?void 0:r.organizationId;return e.jsx(H,{href:((n=(i=s.options.meta)==null?void 0:i.routes)==null?void 0:n.productEdit(a,t.getValue("id")))??`/admin/${a}/products/${t.getValue("id")}`,className:"text-blue-500",children:t.getValue("id")})}}),Ce.accessor("title",{header:({column:t})=>e.jsx(E,{column:t,title:"Title"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Slug"}}),Ce.accessor("sku",{header:({column:t})=>e.jsx(E,{column:t,title:"SKU"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"SKU"},cell:({row:t})=>t.getValue("sku")||"-"}),Ce.accessor("basePrice",{header:({column:t})=>e.jsx(E,{column:t,title:"Base Price"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Base Price"},cell:({row:t})=>`$${t.getValue("basePrice").toFixed(2)}`}),Ce.accessor("discountedBasePrice",{header:({column:t})=>e.jsx(E,{column:t,title:"Discounted Price"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Discounted Price"},cell:({row:t})=>{const s=t.getValue("discountedBasePrice");return s?`$${s.toFixed(2)}`:"-"}}),Ce.accessor("publishedAt",{header:({column:t})=>e.jsx(E,{column:t,title:"Status"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Slug"},cell:({row:t,table:s})=>e.jsx(ad,{row:t,table:s})}),Ce.accessor("createdAt",{header:({column:t})=>e.jsx(E,{column:t,title:"Created At"}),enableSorting:!1,meta:{className:"text-left",displayName:"Created At"},cell:({row:t})=>{const s=t.getValue("createdAt");return new Date(s).toLocaleDateString()}}),Ce.display({id:"edit",header:"Edit",enableSorting:!1,enableHiding:!1,meta:{className:"text-right",displayName:"Edit"},cell:({row:t,table:s})=>e.jsx(rd,{row:t,table:s})})],nd=()=>{const{client:t}=L(),s=Y(),{defaultLocale:a}=pe(),r=K(),i=Q.useSearchParams(),[n,o]=h.useState(""),[l]=Fe.useDebounce(n,300),d=Number((i==null?void 0:i.get("page"))||"1"),{isLoading:c,isRefetching:u,isError:m,data:g,refetch:x}=R.useQuery({queryKey:["products",r,d,l],queryFn:async()=>{const{body:f,status:b}=await t.product.getProducts({params:{organizationId:r},query:{page:d,limit:10,search:l,locale:a}});if(b!==200)throw new Error("Failed to fetch products");return f},placeholderData:R.keepPreviousData});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 sm:gap-x-6",children:[e.jsx("div",{className:"flex w-full flex-col gap-2 sm:w-fit sm:flex-row sm:items-center",children:e.jsx(at,{type:"search",placeholder:"Search products...",value:n,onChange:f=>o(f.target.value),className:"w-full sm:max-w-[250px] sm:[&>input]:h-[40px]"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(z,{asChild:!0,className:"hidden gap-x-2 px-2 py-1.5 text-sm sm:text-xs lg:flex",children:e.jsxs(H,{href:s.productCreate(r),children:["Create Product",e.jsx(A.PlusIcon,{className:"size-4 shrink-0","aria-hidden":"true"})]})})})]}),e.jsx(st,{error:m,loading:c||u,meta:g!=null&&g.meta?{...g==null?void 0:g.meta,currentPage:d}:void 0,data:(g==null?void 0:g.list)||[],columns:id,className:"mt-8",refetch:x})]})};function od(){return e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 sm:text-2xl dark:text-gray-50",children:"Products List"}),e.jsx("div",{className:"mt-4 sm:mt-6 lg:mt-10",children:e.jsx(nd,{})})]})}const ld=({organizationId:t,id:s,acceptedAt:a,cancelledAt:r,refetch:i})=>{var b;const{client:n}=L(),o=R.useMutation({mutationFn:async({operation:y})=>{if((await n.reservation.updateReservationStatus({params:{organizationId:t,reservationId:s,operation:y},body:{}})).status!==200)throw new Error("Failed to update reservation status");return i()}}),l=()=>{o.mutate({operation:"accept"})},d=()=>{o.mutate({operation:"cancel"})},c=o.isPending,u=(b=o.variables)==null?void 0:b.operation,m=c&&u==="cancel",g=c&&u==="accept",x=!a&&!r,f=!r;return e.jsxs("div",{className:"flex items-center gap-2 min-w-28 min-h-[45px]",children:[f&&e.jsxs("button",{onClick:d,disabled:c,className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600",children:[m?"Loading...":"Cancel",e.jsx(A.X,{className:"w-4 h-4 text-red-600 dark:text-red-500"})]}),x&&e.jsxs("button",{onClick:l,disabled:c,className:"relative my-2 inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 text-center text-sm font-medium shadow-xs transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 dark:disabled:text-gray-600",children:[g?"Loading...":"Accept",e.jsx(A.CheckCircle,{className:"w-4 h-4 text-emerald-600 dark:text-emerald-500"})]})]})},dd=({open:t,onOpenChange:s,reservation:a})=>e.jsx(Ft,{open:t,onOpenChange:s,children:e.jsxs(Vt,{className:"sm:max-w-[500px] overflow-y-auto max-h-[85vh]",children:[e.jsx(ks,{children:e.jsx(js,{children:"Reservation Details"})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 py-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Reference ID"}),e.jsx("p",{className:"text-sm font-medium",children:a.referenceId})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Status"}),e.jsx("p",{className:"text-sm font-medium",children:a.cancelledAt?"Cancelled":a.acceptedAt?"Accepted":"Pending"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Customer Name"}),e.jsx("p",{className:"text-sm font-medium",children:`${a.firstname} ${a.lastname}`})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Phone"}),e.jsx("p",{className:"text-sm font-medium",children:a.phone||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Number of Guests"}),e.jsx("p",{className:"text-sm font-medium",children:a.guests})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Reservation Date"}),e.jsx("p",{className:"text-sm font-medium",children:a.date?T.format(new Date(a.date),"PPpp"):"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Created At"}),e.jsx("p",{className:"text-sm font-medium",children:a.createdAt?T.format(new Date(a.createdAt),"PPpp"):"N/A"})]}),a.acceptedAt&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Accepted At"}),e.jsx("p",{className:"text-sm font-medium",children:T.format(new Date(a.acceptedAt),"PPpp")})]}),a.cancelledAt&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Cancelled At"}),e.jsx("p",{className:"text-sm font-medium",children:T.format(new Date(a.cancelledAt),"PPpp")})]})]})]})}),cd=({reservation:t})=>{const[s,a]=h.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>a(!0),className:"text-blue-500 hover:underline",children:String(t.id).slice(-5)}),e.jsx(dd,{open:s,onOpenChange:a,reservation:t})]})},ud=({reservation:t,table:s})=>{const a=s.options.meta,r=(a==null?void 0:a.organizationId)||"",i=typeof(a==null?void 0:a.refetch)=="function"?a.refetch:()=>{};return e.jsx(ld,{organizationId:r,id:t.id,acceptedAt:t.acceptedAt,cancelledAt:t.cancelledAt,refetch:i})},Pe=ge.createColumnHelper(),pd=[Pe.accessor("id",{header:({column:t})=>e.jsx(E,{column:t,title:"ID"}),meta:{className:"text-left",displayName:"ID"},cell:({row:t})=>e.jsx(cd,{reservation:t.original}),enableSorting:!0,enableHiding:!1}),Pe.accessor("referenceId",{header:({column:t})=>e.jsx(E,{column:t,title:"Reference ID"}),cell:({row:t})=>e.jsx("div",{className:"w-[100px]",children:t.getValue("referenceId")}),meta:{className:"text-left",displayName:"Reference ID"},enableSorting:!1,enableHiding:!1}),Pe.display({id:"customer",meta:{className:"text-left",displayName:"Customer"},header:({column:t})=>e.jsx(E,{column:t,title:"Customer"}),cell:({row:t})=>{const s=t.original.firstname||"",a=t.original.lastname||"";return e.jsx("div",{children:`${s} ${a}`.trim()||"N/A"})}}),Pe.accessor("guests",{meta:{className:"text-left",displayName:"Guests"},enableSorting:!0,enableHiding:!1,header:({column:t})=>e.jsx(E,{column:t,title:"Guests"}),cell:({row:t})=>e.jsx("div",{className:"font-medium",children:t.original.guests})}),Pe.accessor("phone",{meta:{className:"text-left",displayName:"Phone"},enableSorting:!1,enableHiding:!1,header:({column:t})=>e.jsx(E,{column:t,title:"Phone"}),cell:({row:t})=>e.jsx("div",{children:t.original.phone||"N/A"})}),Pe.accessor("date",{meta:{className:"text-left",displayName:"Reservation Date"},enableSorting:!0,enableHiding:!1,header:({column:t})=>e.jsx(E,{column:t,title:"Reservation Date"}),cell:({row:t})=>{const s=t.getValue("date");return s?T.format(new Date(s),"dd.MM.yyyy HH:mm"):"N/A"}}),Pe.accessor("createdAt",{meta:{className:"text-left",displayName:"Created At"},enableSorting:!0,enableHiding:!1,header:({column:t})=>e.jsx(E,{column:t,title:"Created At"}),cell:({row:t})=>{const s=t.getValue("createdAt");return s?T.format(new Date(s),"dd.MM.yyyy HH:mm"):"N/A"}}),Pe.display({id:"status",meta:{className:"text-left",displayName:"Status"},header:({column:t})=>e.jsx(E,{column:t,title:"Status"}),cell:({row:t})=>{const s=t.original.acceptedAt;return t.original.cancelledAt?e.jsx("div",{className:"text-red-600 font-medium",children:"Cancelled"}):s?e.jsx("div",{className:"text-green-600 font-medium",children:"Accepted"}):e.jsx("div",{className:"text-yellow-600 font-medium",children:"Pending"})}}),Pe.display({id:"actions",header:({column:t})=>e.jsx(E,{column:t,title:"Actions"}),cell:({row:t,table:s})=>e.jsx(ud,{reservation:t.original,table:s})})],md=()=>{const{client:t}=L(),s=K(),a=Q.useSearchParams(),[r,i]=h.useState(""),[n]=Fe.useDebounce(r,300),o=Number((a==null?void 0:a.get("page"))||"1"),{isLoading:l,isRefetching:d,isError:c,data:u,refetch:m}=R.useQuery({queryKey:["reservations",s,o,n],queryFn:async()=>{const{body:g,status:x}=await t.reservation.getReservations({params:{organizationId:s},query:{page:o,limit:10,search:n}});if(x!==200)throw new Error("Failed to fetch reservations");return g},placeholderData:R.keepPreviousData});return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 sm:gap-x-6",children:e.jsx("div",{className:"flex w-full flex-col gap-2 sm:w-fit sm:flex-row sm:items-center",children:e.jsx(at,{type:"search",placeholder:"Search by name or reference...",value:r,onChange:g=>i(g.target.value),className:"w-full sm:max-w-[250px] sm:[&>input]:h-[40px]"})})}),e.jsx(st,{error:c,loading:l||d,meta:u!=null&&u.meta?{...u==null?void 0:u.meta,currentPage:o}:void 0,data:(u==null?void 0:u.list)||[],columns:pd,className:"mt-8",refetch:m})]})};function gd(){return e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 sm:text-2xl dark:text-gray-50",children:"Reservations List"}),e.jsx("div",{className:"mt-4 sm:mt-6 lg:mt-10",children:e.jsx(md,{})})]})}const hd=()=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:451,zoomAndPan:"magnify",viewBox:"0 0 338.25 101.249998",height:135,preserveAspectRatio:"xMidYMid meet",className:"h-auto w-3/4 mr-5 text-[#15203a] dark:text-white",children:[e.jsxs("defs",{children:[e.jsx("filter",{x:"0%",y:"0%",width:"100%",height:"100%",id:"e96f145012",children:e.jsx("feColorMatrix",{values:"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0",colorInterpolationFilters:"sRGB"})}),e.jsx("g",{}),e.jsx("clipPath",{id:"2854c0f5ba",children:e.jsx("path",{d:"M 280.070312 29.789062 L 335.910156 29.789062 L 335.910156 85.628906 L 280.070312 85.628906 Z M 280.070312 29.789062 ",clipRule:"nonzero"})}),e.jsx("clipPath",{id:"a2b4eafd05",children:e.jsx("path",{d:"M 312.023438 83.421875 L 333.382812 62.0625 C 335.910156 59.535156 335.910156 55.460938 333.382812 52.933594 L 312.285156 31.835938 C 310.859375 30.410156 308.949219 29.632812 306.941406 29.632812 L 280.46875 29.632812 L 303.773438 52.933594 C 306.296875 55.460938 306.296875 59.535156 303.773438 62.0625 L 280.210938 85.621094 L 306.683594 85.621094 C 308.691406 85.621094 310.601562 84.8125 312.023438 83.421875 Z M 312.023438 83.421875 ",clipRule:"nonzero"})}),e.jsx("image",{x:0,y:0,width:57,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADkAAAA5CAYAAACMGIOFAAAABmJLR0QA/wD/AP+gvaeTAAAAdElEQVRoge3PMQqEQBAAwXVB//9kEwMD9eAwKrthYGBgoJZx3xxjrMdsp/1qft3f+PHvfc4HJFNIpZBKIZVCKoVUCqkUUimkUkilkEohlUIqhVQKqRRSKaRSSKWQSiGVQiqFVAqpFFIppFJIpZBKIZU+gdwB24gBccg7AIAAAAAASUVORK5CYII=",id:"c594f9d06d",height:57,preserveAspectRatio:"xMidYMid meet"}),e.jsx("mask",{id:"1f1a4971c6",children:e.jsx("g",{filter:"url(#e96f145012)",children:e.jsx("g",{children:e.jsx("image",{x:0,y:0,width:57,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADkAAAA5CAYAAACMGIOFAAAABmJLR0QA/wD/AP+gvaeTAAAAdElEQVRoge3PMQqEQBAAwXVB//9kEwMD9eAwKrthYGBgoJZx3xxjrMdsp/1qft3f+PHvfc4HJFNIpZBKIZVCKoVUCqkUUimkUkilkEohlUIqhVQKqRRSKaRSSKWQSiGVQiqFVAqpFFIppFJIpZBKIZU+gdwB24gBccg7AIAAAAAASUVORK5CYII=",height:57,preserveAspectRatio:"xMidYMid meet"})})})}),e.jsx("clipPath",{id:"d584d4a10b",children:e.jsx("rect",{x:0,width:57,y:0,height:57})}),e.jsx("pattern",{id:"ca59399d09",patternUnits:"userSpaceOnUse",width:57,patternTransform:"matrix(0.992647, 0, 0, -0.992647, 279.805145, 86.320587)",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 57 57",height:57,x:0,y:0,children:e.jsx("g",{children:e.jsx("g",{clipPath:"url(#d584d4a10b)",children:e.jsx("g",{mask:"url(#1f1a4971c6)",children:e.jsx("rect",{x:"-356.844005",width:"490.68801",fill:"#8c52ff",height:"146.88",y:"-37.48",fillOpacity:1})})})})}),e.jsx("clipPath",{id:"058149a1c1",children:e.jsx("path",{d:"M 271.277344 20.996094 L 327 20.996094 L 327 76.832031 L 271.277344 76.832031 Z M 271.277344 20.996094 ",clipRule:"nonzero"})}),e.jsx("clipPath",{id:"3a8b0dae6b",children:e.jsx("path",{d:"M 303.230469 74.625 L 324.589844 53.265625 C 327.113281 50.742188 327.113281 46.664062 324.589844 44.140625 L 303.488281 23.039062 C 302.0625 21.613281 300.15625 20.839844 298.148438 20.839844 L 271.675781 20.839844 L 294.976562 44.140625 C 297.5 46.664062 297.5 50.742188 294.976562 53.265625 L 271.414062 76.824219 L 297.890625 76.824219 C 299.894531 76.824219 301.804688 76.015625 303.230469 74.625 Z M 303.230469 74.625 ",clipRule:"nonzero"})}),e.jsx("image",{x:0,y:0,width:57,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADkAAAA5CAYAAACMGIOFAAAABmJLR0QA/wD/AP+gvaeTAAAAbklEQVRoge3PwQmAAAwEwaho/yVbgfrQ17gLeR0EZpnrlpk5Zma/ubf7Fz+e9m29QTKFVAqpFFIppFJIpZBKIZVCKoVUCqkUUimkUkilkEohlUIqhVQKqRRSKaRSSKWQSiGVQiqFVAqpFFLpF8gT2vQBcSod/NEAAAAASUVORK5CYII=",id:"85d98eb3ed",height:57,preserveAspectRatio:"xMidYMid meet"}),e.jsx("mask",{id:"712d9ec0cc",children:e.jsx("g",{filter:"url(#e96f145012)",children:e.jsx("g",{children:e.jsx("image",{x:0,y:0,width:57,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADkAAAA5CAYAAACMGIOFAAAABmJLR0QA/wD/AP+gvaeTAAAAbklEQVRoge3PwQmAAAwEwaho/yVbgfrQ17gLeR0EZpnrlpk5Zma/ubf7Fz+e9m29QTKFVAqpFFIppFJIpZBKIZVCKoVUCqkUUimkUkilkEohlUIqhVQKqRRSKaRSSKWQSiGVQiqFVAqpFFLpF8gT2vQBcSod/NEAAAAASUVORK5CYII=",height:57,preserveAspectRatio:"xMidYMid meet"})})})}),e.jsx("clipPath",{id:"66291c0f48",children:e.jsx("rect",{x:0,width:57,y:0,height:57})}),e.jsx("pattern",{id:"82194e6edc",patternUnits:"userSpaceOnUse",width:57,patternTransform:"matrix(0.992647, 0, 0, -0.992647, 270.871322, 77.386763)",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 57 57",height:57,x:0,y:0,children:e.jsx("g",{children:e.jsx("g",{clipPath:"url(#66291c0f48)",children:e.jsx("g",{mask:"url(#712d9ec0cc)",children:e.jsx("rect",{x:"-347.844005",width:"490.68801",fill:"#8c52ff",height:"146.88",y:"-46.48",fillOpacity:1})})})})})]}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(19.705917, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 16.359375 0.0625 C 13.921875 0.0625 11.773438 -0.289062 9.921875 -1 C 8.441406 -1.59375 6.925781 -2.570312 5.375 -3.9375 C 3.601562 -5.5625 2.476562 -7.578125 2 -9.984375 C 1.8125 -10.753906 1.71875 -11.53125 1.71875 -12.3125 C 1.675781 -12.570312 1.675781 -12.832031 1.71875 -13.09375 L 1.71875 -13.46875 L 9.3125 -13.359375 L 9.3125 -13.421875 C 9.3125 -12.054688 9.609375 -10.925781 10.203125 -10.03125 C 11.304688 -8.375 13.359375 -7.546875 16.359375 -7.546875 C 21.160156 -7.546875 23.5625 -8.671875 23.5625 -10.921875 C 23.5625 -13.109375 21.085938 -14.476562 16.140625 -15.03125 C 13.285156 -15.363281 10.84375 -15.953125 8.8125 -16.796875 C 6.925781 -17.578125 5.394531 -18.613281 4.21875 -19.90625 C 2.550781 -21.757812 1.71875 -23.90625 1.71875 -26.34375 C 1.71875 -27.851562 1.992188 -29.273438 2.546875 -30.609375 C 2.953125 -31.609375 3.507812 -32.515625 4.21875 -33.328125 C 6.800781 -36.242188 10.90625 -37.703125 16.53125 -37.703125 C 19.894531 -37.703125 22.738281 -37.039062 25.0625 -35.71875 C 26.832031 -34.71875 28.273438 -33.382812 29.390625 -31.71875 C 30.203125 -30.457031 30.773438 -29.015625 31.109375 -27.390625 C 31.222656 -26.835938 31.296875 -26.285156 31.328125 -25.734375 C 31.367188 -25.546875 31.390625 -25.359375 31.390625 -25.171875 L 31.390625 -24.84375 L 23.796875 -24.84375 L 23.796875 -24.78125 C 23.828125 -25.894531 23.546875 -26.835938 22.953125 -27.609375 C 21.773438 -29.273438 19.632812 -30.109375 16.53125 -30.109375 C 14.644531 -30.109375 13.085938 -29.867188 11.859375 -29.390625 C 10.347656 -28.796875 9.59375 -27.945312 9.59375 -26.84375 C 9.59375 -24.550781 12.050781 -23.125 16.96875 -22.5625 C 22.507812 -21.9375 26.503906 -20.21875 28.953125 -17.40625 C 30.578125 -15.488281 31.390625 -13.328125 31.390625 -10.921875 L 31.390625 -10.421875 C 31.390625 -10.203125 31.367188 -9.984375 31.328125 -9.765625 C 31.296875 -9.171875 31.222656 -8.613281 31.109375 -8.09375 C 30.734375 -6.613281 30.03125 -5.300781 29 -4.15625 C 27.78125 -2.789062 26.132812 -1.738281 24.0625 -1 C 22 -0.289062 19.429688 0.0625 16.359375 0.0625 Z M 16.359375 0.0625 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(52.748732, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 30.78125 0 L 23.5625 0 L 23.5625 -14.078125 L 23.515625 -14.078125 L 23.515625 -14.25 C 23.515625 -16.175781 22.828125 -17.820312 21.453125 -19.1875 C 20.085938 -20.550781 18.425781 -21.234375 16.46875 -21.234375 C 14.550781 -21.234375 12.890625 -20.53125 11.484375 -19.125 C 10.078125 -17.726562 9.410156 -16.066406 9.484375 -14.140625 L 9.484375 -14.078125 L 9.421875 -14.078125 L 9.421875 0 L 1.65625 0 L 1.65625 -36.046875 L 9.421875 -36.046875 L 9.421875 -24.953125 C 11.160156 -27.023438 13.492188 -28.191406 16.421875 -28.453125 C 20.484375 -28.785156 23.84375 -27.726562 26.5 -25.28125 C 29.351562 -22.65625 30.78125 -18.976562 30.78125 -14.25 Z M 30.78125 0 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(85.181699, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 14.8125 -28.5625 C 18.757812 -28.59375 22.117188 -27.222656 24.890625 -24.453125 C 27.703125 -21.640625 29.109375 -18.273438 29.109375 -14.359375 C 29.148438 -10.398438 27.785156 -7.035156 25.015625 -4.265625 C 22.234375 -1.460938 18.882812 -0.0390625 14.96875 0 C 11.007812 0.0390625 7.628906 -1.328125 4.828125 -4.109375 C 2.015625 -6.878906 0.609375 -10.242188 0.609375 -14.203125 C 0.566406 -18.148438 1.9375 -21.507812 4.71875 -24.28125 C 7.488281 -27.09375 10.851562 -28.519531 14.8125 -28.5625 Z M 19.859375 -9.3125 C 21.222656 -10.6875 21.90625 -12.351562 21.90625 -14.3125 C 21.90625 -16.226562 21.203125 -17.890625 19.796875 -19.296875 C 18.390625 -20.628906 16.726562 -21.296875 14.8125 -21.296875 C 12.882812 -21.296875 11.238281 -20.613281 9.875 -19.25 C 8.5 -17.800781 7.8125 -16.132812 7.8125 -14.25 C 7.8125 -12.332031 8.515625 -10.671875 9.921875 -9.265625 C 11.296875 -7.890625 12.960938 -7.203125 14.921875 -7.203125 C 16.910156 -7.273438 18.554688 -7.976562 19.859375 -9.3125 Z M 19.859375 -9.3125 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(114.89805, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 16.53125 -28.5625 C 20.445312 -28.59375 23.8125 -27.222656 26.625 -24.453125 C 29.425781 -21.679688 30.847656 -18.316406 30.890625 -14.359375 C 30.921875 -10.441406 29.550781 -7.078125 26.78125 -4.265625 C 24.007812 -1.460938 20.644531 -0.0390625 16.6875 0 C 13.46875 0 11.046875 -1.015625 9.421875 -3.046875 L 9.421875 10.640625 L 1.65625 10.640625 L 1.65625 -28.5 L 9.421875 -28.5 L 9.421875 -25.515625 C 10.941406 -27.472656 13.3125 -28.488281 16.53125 -28.5625 Z M 21.625 -9.3125 C 23.03125 -10.71875 23.695312 -12.382812 23.625 -14.3125 C 23.625 -16.269531 22.941406 -17.929688 21.578125 -19.296875 C 20.171875 -20.628906 18.503906 -21.296875 16.578125 -21.296875 C 14.617188 -21.296875 12.957031 -20.613281 11.59375 -19.25 C 10.21875 -17.800781 9.53125 -16.132812 9.53125 -14.25 C 9.613281 -12.25 10.316406 -10.585938 11.640625 -9.265625 C 13.015625 -7.890625 14.679688 -7.203125 16.640625 -7.203125 C 18.628906 -7.273438 20.289062 -7.976562 21.625 -9.3125 Z M 21.625 -9.3125 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(146.665722, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 30.78125 0 L 23.5625 0 L 23.5625 -14.078125 L 23.515625 -14.078125 L 23.515625 -14.25 C 23.515625 -16.175781 22.828125 -17.820312 21.453125 -19.1875 C 20.085938 -20.550781 18.425781 -21.234375 16.46875 -21.234375 C 14.550781 -21.234375 12.890625 -20.53125 11.484375 -19.125 C 10.078125 -17.726562 9.410156 -16.066406 9.484375 -14.140625 L 9.484375 -14.078125 L 9.421875 -14.078125 L 9.421875 0 L 1.65625 0 L 1.65625 -36.046875 L 9.421875 -36.046875 L 9.421875 -24.953125 C 11.160156 -27.023438 13.492188 -28.191406 16.421875 -28.453125 C 20.484375 -28.785156 23.84375 -27.726562 26.5 -25.28125 C 29.351562 -22.65625 30.78125 -18.976562 30.78125 -14.25 Z M 30.78125 0 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(179.09869, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 14.8125 -28.5625 C 18.757812 -28.59375 22.117188 -27.222656 24.890625 -24.453125 C 27.703125 -21.640625 29.109375 -18.273438 29.109375 -14.359375 C 29.148438 -10.398438 27.785156 -7.035156 25.015625 -4.265625 C 22.234375 -1.460938 18.882812 -0.0390625 14.96875 0 C 11.007812 0.0390625 7.628906 -1.328125 4.828125 -4.109375 C 2.015625 -6.878906 0.609375 -10.242188 0.609375 -14.203125 C 0.566406 -18.148438 1.9375 -21.507812 4.71875 -24.28125 C 7.488281 -27.09375 10.851562 -28.519531 14.8125 -28.5625 Z M 19.859375 -9.3125 C 21.222656 -10.6875 21.90625 -12.351562 21.90625 -14.3125 C 21.90625 -16.226562 21.203125 -17.890625 19.796875 -19.296875 C 18.390625 -20.628906 16.726562 -21.296875 14.8125 -21.296875 C 12.882812 -21.296875 11.238281 -20.613281 9.875 -19.25 C 8.5 -17.800781 7.8125 -16.132812 7.8125 -14.25 C 7.8125 -12.332031 8.515625 -10.671875 9.921875 -9.265625 C 11.296875 -7.890625 12.960938 -7.203125 14.921875 -7.203125 C 16.910156 -7.273438 18.554688 -7.976562 19.859375 -9.3125 Z M 19.859375 -9.3125 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(208.81504, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 13.203125 0 C 11.273438 0 9.59375 -0.296875 8.15625 -0.890625 C 7.007812 -1.296875 5.828125 -2.050781 4.609375 -3.15625 C 2.492188 -5.113281 1.53125 -7.59375 1.71875 -10.59375 L 1.71875 -11.203125 L 7.9375 -11.09375 L 8.421875 -11.09375 L 8.421875 -10.640625 C 8.460938 -9.722656 8.664062 -8.96875 9.03125 -8.375 C 9.664062 -7.300781 11.054688 -6.765625 13.203125 -6.765625 C 14.972656 -6.765625 16.25 -6.96875 17.03125 -7.375 C 17.4375 -7.5625 17.710938 -7.800781 17.859375 -8.09375 C 17.929688 -8.207031 17.96875 -8.316406 17.96875 -8.421875 L 18.015625 -8.703125 C 18.015625 -9.484375 17.40625 -10.113281 16.1875 -10.59375 C 15.707031 -10.78125 15.15625 -10.925781 14.53125 -11.03125 C 14.050781 -11.144531 13.515625 -11.238281 12.921875 -11.3125 C 10.703125 -11.53125 8.851562 -11.972656 7.375 -12.640625 C 5.894531 -13.234375 4.675781 -14.046875 3.71875 -15.078125 C 2.382812 -16.597656 1.71875 -18.335938 1.71875 -20.296875 C 1.71875 -21.515625 1.941406 -22.640625 2.390625 -23.671875 C 2.722656 -24.484375 3.164062 -25.207031 3.71875 -25.84375 C 5.707031 -28.132812 8.90625 -29.28125 13.3125 -29.28125 C 15.9375 -29.28125 18.15625 -28.757812 19.96875 -27.71875 C 21.375 -26.945312 22.5 -25.894531 23.34375 -24.5625 C 24.007812 -23.5625 24.472656 -22.398438 24.734375 -21.078125 C 24.804688 -20.628906 24.859375 -20.203125 24.890625 -19.796875 L 24.890625 -18.625 L 18.1875 -18.625 L 18.1875 -19.46875 C 18.15625 -19.613281 18.140625 -19.757812 18.140625 -19.90625 C 18.023438 -20.3125 17.875 -20.644531 17.6875 -20.90625 C 16.875 -22.007812 15.414062 -22.5625 13.3125 -22.5625 C 10.207031 -22.5625 8.65625 -21.914062 8.65625 -20.625 C 8.65625 -19.957031 9.023438 -19.421875 9.765625 -19.015625 C 10.535156 -18.535156 11.847656 -18.1875 13.703125 -17.96875 C 17.953125 -17.519531 21.035156 -16.171875 22.953125 -13.921875 C 24.242188 -12.398438 24.890625 -10.660156 24.890625 -8.703125 L 24.890625 -8.3125 L 24.84375 -7.8125 C 24.84375 -7.332031 24.785156 -6.890625 24.671875 -6.484375 C 24.378906 -5.304688 23.828125 -4.253906 23.015625 -3.328125 C 22.085938 -2.210938 20.789062 -1.378906 19.125 -0.828125 C 17.46875 -0.273438 15.492188 0 13.203125 0 Z M 13.203125 0 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(235.371259, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 22.234375 -28.5625 L 22.234375 -20.796875 L 15.859375 -20.796875 L 15.859375 0 L 8.09375 0 L 8.09375 -20.796875 L 1.65625 -20.796875 L 1.65625 -28.5625 L 8.09375 -28.5625 L 8.09375 -38.546875 L 15.859375 -38.546875 L 15.859375 -28.5625 Z M 22.234375 -28.5625 "})})})}),e.jsx("g",{fill:"currentColor",fillOpacity:1,children:e.jsx("g",{transform:"translate(259.266309, 70.793676)",children:e.jsx("g",{children:e.jsx("path",{d:"M 9.421875 0 L 1.65625 0 L 1.65625 -7.765625 L 9.421875 -7.765625 Z M 9.421875 0 "})})})}),e.jsx("g",{clipPath:"url(#2854c0f5ba)",children:e.jsx("g",{clipPath:"url(#a2b4eafd05)",children:e.jsx("path",{fill:"url(#ca59399d09)",d:"M 335.910156 85.621094 L 280.214844 85.621094 L 280.214844 29.789062 L 335.910156 29.789062 Z M 335.910156 85.621094 ",fillRule:"nonzero"})})}),e.jsx("g",{clipPath:"url(#058149a1c1)",children:e.jsx("g",{clipPath:"url(#3a8b0dae6b)",children:e.jsx("path",{fill:"url(#82194e6edc)",d:"M 327.113281 76.824219 L 271.417969 76.824219 L 271.417969 20.992188 L 327.113281 20.992188 Z M 327.113281 76.824219 ",fillRule:"nonzero"})})})]}),mi=t=>e.jsx(Z.Root,{...t});mi.displayName="Drawer";const gi=N.forwardRef(({className:t,...s},a)=>e.jsx(Z.Trigger,{ref:a,className:w(t),...s}));gi.displayName="Drawer.Trigger";const hi=N.forwardRef(({className:t,...s},a)=>e.jsx(Z.Close,{ref:a,className:w(t),...s}));hi.displayName="Drawer.Close";const xi=Z.Portal;xi.displayName="DrawerPortal";const fi=N.forwardRef(({className:t,...s},a)=>e.jsx(Z.Overlay,{ref:a,className:w("fixed inset-0 z-50 overflow-y-auto","bg-black/30","data-[state=closed]:animate-hide data-[state=open]:animate-dialogOverlayShow",t),...s,style:{animationDuration:"400ms",animationFillMode:"backwards"}}));fi.displayName="DrawerOverlay";const yi=N.forwardRef(({className:t,...s},a)=>e.jsx(xi,{children:e.jsx(fi,{children:e.jsx(Z.Content,{ref:a,className:w("fixed inset-y-2 mx-auto flex w-[95vw] flex-1 flex-col overflow-y-auto rounded-md border p-4 shadow-lg focus:outline-hidden max-sm:inset-x-2 sm:inset-y-2 sm:right-2 sm:max-w-lg sm:p-6","border-gray-200 dark:border-gray-900","bg-white dark:bg-[#090E1A]","data-[state=closed]:animate-drawerSlideRightAndFade data-[state=open]:animate-drawerSlideLeftAndFade",ie,t),...s})})}));yi.displayName="DrawerContent";const wi=N.forwardRef(({children:t,className:s,...a},r)=>e.jsxs("div",{ref:r,className:"flex items-start justify-between gap-x-4 border-b border-gray-200 pb-4 dark:border-gray-900",...a,children:[e.jsx("div",{className:w("mt-1 flex flex-col gap-y-1",s),children:t}),e.jsx(Z.Close,{asChild:!0,children:e.jsx(z,{variant:"ghost",className:"aspect-square p-1 hover:bg-gray-100 dark:hover:bg-gray-400/10",children:e.jsx(C.RiCloseLine,{className:"size-6","aria-hidden":"true"})})})]}));wi.displayName="Drawer.Header";const bi=N.forwardRef(({className:t,...s},a)=>e.jsx(Z.Title,{ref:a,className:w("text-base font-semibold","text-gray-900 dark:text-gray-50",t),...s}));bi.displayName="DrawerTitle";const Si=N.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:w("flex-1 py-4",t),...s}));Si.displayName="Drawer.Body";const xd=N.forwardRef(({className:t,...s},a)=>e.jsx(Z.Description,{ref:a,className:w("text-gray-500 dark:text-gray-500",t),...s}));xd.displayName="DrawerDescription";function fd(){const t=Q.usePathname(),s=K(),a=Y();if(!s)return null;const r=[{name:"Dashboard",href:a.dashboard(s),icon:A.HomeIcon},{name:"Live Orders",href:a.liveOrders(s),icon:A.RadioIcon},{name:"Orders",href:a.orders(s),icon:A.LogsIcon},{name:"Reservations",href:a.reservations(s),icon:A.CalendarCheckIcon},{name:"Products",href:a.products(s),icon:A.PackageIcon},{name:"Categories",href:a.productCategories(s),icon:A.BoxesIcon},{name:"Manufacturers",href:a.manufacturers(s),icon:A.FactoryIcon},{name:"Settings",href:a.settings(s),icon:C.RiSettings5Line}];return e.jsxs(mi,{children:[e.jsx(gi,{asChild:!0,children:e.jsx(z,{variant:"ghost","aria-label":"open sidebar",className:"group flex items-center rounded-md p-2 text-sm font-medium hover:bg-gray-100 data-[state=open]:bg-gray-100 data-[state=open]:bg-gray-400/10 dark:hover:bg-gray-400/10",children:e.jsx(C.RiMenuLine,{className:"size-6 shrink-0 sm:size-5","aria-hidden":"true"})})}),e.jsxs(yi,{className:"sm:max-w-lg",children:[e.jsx(wi,{children:e.jsx(bi,{children:"Navigation"})}),e.jsx(Si,{children:e.jsx("nav",{"aria-label":"mobile navigation links",className:"flex flex-1 flex-col space-y-10",children:e.jsx("ul",{role:"list",className:"space-y-1.5",children:r.map(i=>e.jsx("li",{children:e.jsx(hi,{asChild:!0,children:e.jsxs(H,{href:i.href,className:I(t===i.href||t!=null&&t.startsWith(i.href)?"text-blue-600 dark:text-blue-400":"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-50","flex items-center gap-x-2.5 rounded-md px-2 py-1.5 text-base font-medium transition hover:bg-gray-100 sm:text-sm dark:hover:bg-gray-900",ie),children:[e.jsx(i.icon,{className:"size-5 shrink-0","aria-hidden":"true"}),i.name]})})},i.name))})})})]})]})}const yd=()=>{var l;const[t,s]=h.useState(!1),a=h.useRef(null),{organizations:r,organization:i}=pe(),n=Q.useRouter(),o=Y();return e.jsx(e.Fragment,{children:e.jsxs(Le,{open:t,onOpenChange:s,modal:!1,children:[e.jsx(Ee,{asChild:!0,children:i.data&&e.jsxs("button",{className:w("flex w-full items-center gap-x-2.5 rounded-md border border-gray-300 bg-white p-2 text-sm shadow-xs transition-all hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-950 dark:hover:bg-gray-900",tt),children:[i.data.logoFile?e.jsx(xe,{src:i.data.logoFile.url,alt:i.data.name,width:40,height:40,className:"flex aspect-square size-8 items-center justify-center rounded"}):e.jsxs("span",{className:"flex aspect-square size-8 items-center justify-center rounded bg-blue-600 p-2 text-xs font-medium text-white dark:bg-blue-500 uppercase","aria-hidden":"true",children:[i.data.name[0],i.data.name[1]]}),e.jsxs("div",{className:"flex w-full items-center justify-between gap-x-4 truncate",children:[e.jsxs("div",{className:"truncate text-left",children:[e.jsx("p",{className:"truncate whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-50",children:i.data.name}),e.jsx("p",{className:"whitespace-nowrap text-left text-xs text-gray-700 dark:text-gray-300",children:(l=i.data.address)==null?void 0:l.addressLineOne})]}),e.jsx(C.RiExpandUpDownLine,{className:"size-5 shrink-0 text-gray-500","aria-hidden":"true"})]})]})}),e.jsx(De,{hidden:!1,onCloseAutoFocus:d=>{a.current&&(a.current.focus(),a.current=null,d.preventDefault())},children:e.jsxs(ct,{children:[e.jsxs(Xt,{children:["Workspaces (",r.data.length,")"]}),r.data.map(d=>{var c;return e.jsx(fe,{onClick:()=>n.push(o.dashboard(d.id)),children:e.jsxs("div",{className:"flex w-full items-center gap-x-2.5",children:[d.logoFile?e.jsx(xe,{src:d.logoFile.url,alt:d.name,width:40,height:40,className:"flex aspect-square size-8 items-center justify-center rounded"}):e.jsxs("span",{className:"flex aspect-square size-8 items-center justify-center rounded bg-blue-600 p-2 text-xs font-medium text-white dark:bg-blue-500 uppercase","aria-hidden":"true",children:[d.name[0],d.name[1]]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:d.name}),e.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-400",children:(c=d.address)==null?void 0:c.addressLineOne})]})]})},d.id)})]})})]})})},wd=()=>{const[t,s]=h.useState(!1),a=h.useRef(null),{organizations:r,organization:i}=pe(),n=Q.useRouter(),o=Y();return e.jsxs(Le,{open:t,onOpenChange:s,modal:!1,children:[e.jsx(Ee,{asChild:!0,children:i.data&&e.jsxs("button",{className:"flex items-center gap-x-1.5 rounded-md p-2 hover:bg-gray-100 focus:outline-hidden dark:hover:bg-gray-900",children:[i.data.logoFile?e.jsx(xe,{src:i.data.logoFile.url,alt:i.data.name,width:28,height:28,className:"flex aspect-square size-7 items-center justify-center rounded"}):e.jsxs("span",{className:"flex aspect-square size-7 items-center justify-center rounded bg-blue-600 p-2 text-xs font-medium text-white dark:bg-blue-500 uppercase","aria-hidden":"true",children:[i.data.name[0],i.data.name[1]]}),e.jsx(C.RiArrowRightSLine,{className:"size-4 shrink-0 text-gray-500","aria-hidden":"true"}),e.jsxs("div",{className:"flex w-full items-center justify-between gap-x-3 truncate",children:[e.jsx("p",{className:"truncate whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-50",children:i.data.name}),e.jsx(C.RiExpandUpDownLine,{className:"size-4 shrink-0 text-gray-500","aria-hidden":"true"})]})]})}),e.jsx(De,{className:"min-w-72!",onCloseAutoFocus:l=>{a.current&&(a.current.focus(),a.current=null,l.preventDefault())},children:e.jsxs(ct,{children:[e.jsxs(Xt,{children:["Workspaces (",r.data.length,")"]}),r.data.map(l=>{var d;return e.jsx(fe,{onClick:()=>n.push(o.dashboard(l.id)),children:e.jsxs("div",{className:"flex w-full items-center gap-x-2.5",children:[l.logoFile?e.jsx(xe,{src:l.logoFile.url,alt:l.name,width:28,height:28,className:"flex aspect-square size-7 items-center justify-center rounded"}):e.jsxs("span",{className:"flex aspect-square size-7 items-center justify-center rounded bg-blue-600 p-2 text-xs font-medium text-white dark:bg-blue-500 uppercase","aria-hidden":"true",children:[l.name[0],l.name[1]]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:l.name}),e.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-400",children:(d=l.address)==null?void 0:d.addressLineOne})]})]})},l.id)})]})})]})};function ki({children:t,align:s="start"}){var m,g;const a=Q.useRouter(),[r,i]=N.useState(!1),{theme:n,setTheme:o}=na.useTheme(),l=mt(),d=Y(),c=l.useSession();N.useEffect(()=>{i(!0)},[]);const u=()=>l.signOut({fetchOptions:{onSuccess:()=>a.push(d.signIn)}});return r?e.jsx(e.Fragment,{children:e.jsxs(Le,{children:[e.jsx(Ee,{asChild:!0,children:t}),e.jsxs(De,{align:s,children:[e.jsx(Xt,{children:(g=(m=c.data)==null?void 0:m.user)==null?void 0:g.email}),e.jsx(ct,{children:e.jsxs(ni,{children:[e.jsx(li,{children:"Theme"}),e.jsx(di,{children:e.jsxs(oi,{value:n,onValueChange:x=>{o(x)},children:[e.jsxs(Rt,{"aria-label":"Switch to Light Mode",value:"light",iconType:"check",children:[e.jsx(C.RiSunLine,{className:"size-4 shrink-0","aria-hidden":"true"}),"Light"]}),e.jsxs(Rt,{"aria-label":"Switch to Dark Mode",value:"dark",iconType:"check",children:[e.jsx(C.RiMoonLine,{className:"size-4 shrink-0","aria-hidden":"true"}),"Dark"]}),e.jsxs(Rt,{"aria-label":"Switch to System Mode",value:"system",iconType:"check",children:[e.jsx(C.RiComputerLine,{className:"size-4 shrink-0","aria-hidden":"true"}),"System"]})]})}),e.jsx(ct,{children:e.jsx(fe,{onClick:u,className:"text-red-500",children:"Sign out"})})]})})]})]})}):null}const bd=()=>{var i;const s=mt().useSession(),{firstname:a,lastname:r}=((i=s.data)==null?void 0:i.user)||{};return e.jsx(ki,{children:e.jsxs(z,{"aria-label":"User settings",variant:"ghost",className:I(ie,"group flex w-full items-center justify-between rounded-md p-2 text-sm font-medium text-gray-900 hover:bg-gray-100 data-[state=open]:bg-gray-100 data-[state=open]:bg-gray-400/10 dark:hover:bg-gray-400/10"),children:[e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-full border border-gray-300 bg-white text-xs text-gray-700 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-300","aria-hidden":"true",children:[a==null?void 0:a.charAt(0),r==null?void 0:r.charAt(0)]}),e.jsxs("span",{children:[a," ",r]})]}),e.jsx(C.RiMore2Fill,{className:"size-4 shrink-0 text-gray-500 group-hover:text-gray-700 dark:group-hover:text-gray-400","aria-hidden":"true"})]})})},Sd=()=>e.jsx(ki,{align:"end",children:e.jsx(z,{"aria-label":"User settings",variant:"ghost",className:I("group flex items-center rounded-md p-1 text-sm font-medium text-gray-900 hover:bg-gray-100 data-[state=open]:bg-gray-100 data-[state=open]:bg-gray-400/10 dark:hover:bg-gray-400/10"),children:e.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-full border border-gray-300 bg-white text-xs text-gray-700 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-300","aria-hidden":"true",children:"ES"})})});function kd(){const t=Q.usePathname(),s=K(),a=Y(),r=[{name:"Home",href:a.dashboard(s),icon:A.HomeIcon},{name:"Live Orders",href:a.liveOrders(s),icon:A.RadioIcon},{name:"Orders List",href:a.orders(s),icon:A.LogsIcon},{name:"Reservations",href:a.reservations(s),icon:A.CalendarCheckIcon},{name:"Products",href:a.products(s),icon:A.PackageIcon},{name:"Product Categories",href:a.productCategories(s),icon:A.BoxesIcon},{name:"Manufacturers",href:a.manufacturers(s),icon:A.FactoryIcon},{name:"Customers",href:`${a.dashboard(s)}/customers`,icon:A.UserCircleIcon},{name:"Settings",href:a.settings(s),icon:C.RiSettings5Line}],i=n=>t===n||(t==null?void 0:t.startsWith(n));return e.jsxs(e.Fragment,{children:[e.jsx("nav",{className:"hidden lg:fixed lg:inset-y-0 lg:z-50 lg:flex lg:w-72 lg:flex-col",children:e.jsxs("aside",{className:"flex grow flex-col gap-y-6 overflow-y-auto border-r border-gray-200 bg-slate-50 p-4 dark:border-gray-800 dark:bg-gray-950",children:[e.jsx(H,{href:a.home,className:"-ml-2",children:e.jsx(hd,{})}),e.jsx("hr",{className:"block border-t border-gray-200 dark:border-gray-800 -mt-3 mb-1"}),e.jsx(yd,{}),e.jsx("nav",{"aria-label":"core navigation links",className:"flex flex-1 flex-col space-y-10",children:e.jsx("ul",{role:"list",className:"space-y-0.5",children:r.map(n=>e.jsx("li",{children:e.jsxs(H,{href:n.href,className:w(i(n.href)?"text-blue-600 dark:text-blue-400":"text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-50","flex items-center gap-x-2.5 rounded-md px-2 py-1.5 text-sm font-medium transition hover:bg-gray-100 dark:hover:bg-gray-900",ie),children:[e.jsx(n.icon,{className:"size-4 shrink-0","aria-hidden":"true"}),n.name]})},n.name))})}),e.jsx("div",{className:"mt-auto",children:e.jsx(bd,{})})]})}),e.jsxs("div",{className:"sticky top-0 z-40 flex h-16 shrink-0 items-center justify-between border-b border-gray-200 bg-white px-2 shadow-xs sm:gap-x-6 sm:px-4 lg:hidden dark:border-gray-800 dark:bg-gray-950",children:[e.jsx(wd,{}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[e.jsx(Sd,{}),e.jsx(fd,{})]})]})]})}function jd({children:t}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-slate-50 dark:hidden w-1/2 absolute top-0 left-0 h-screen"}),e.jsxs("div",{className:"mx-auto max-w-(--breakpoint-2xl)",children:[e.jsx(kd,{}),e.jsx("main",{className:"lg:pl-72 bg-white dark:bg-gray-950 z-10 relative min-h-screen",children:e.jsx("div",{className:"relative",children:e.jsx("div",{className:"p-4 sm:px-6 sm:pb-10 sm:pt-10 lg:px-10 lg:pt-[34px]",children:t})})})]})]})}const Ad=[{name:"configuration.openingTimes.monday",label:"Monday",type:"time"},{name:"configuration.closingTimes.monday",label:"",type:"time"},{name:"configuration.openingTimes.tuesday",label:"Tuesday",type:"time"},{name:"configuration.closingTimes.tuesday",label:"",type:"time"},{name:"configuration.openingTimes.wednesday",label:"Wednesday",type:"time"},{name:"configuration.closingTimes.wednesday",label:"",type:"time"},{name:"configuration.openingTimes.thursday",label:"Thursday",type:"time"},{name:"configuration.closingTimes.thursday",label:"",type:"time"},{name:"configuration.openingTimes.friday",label:"Friday",type:"time"},{name:"configuration.closingTimes.friday",label:"",type:"time"},{name:"configuration.openingTimes.saturday",label:"Saturday",type:"time"},{name:"configuration.closingTimes.saturday",label:"",type:"time"},{name:"configuration.openingTimes.sunday",label:"Sunday",type:"time"},{name:"configuration.closingTimes.sunday",label:"",type:"time"},{name:"configuration.isAcceptingOrders",label:"Accepting Orders",type:"switch"}],vd=({onClose:t,initialData:s})=>{var o,l,d,c,u,m;const{client:a}=L(),r=F.useForm({resolver:ue.zodResolver(bs),defaultValues:{configuration:{defaultLocale:(o=s==null?void 0:s.configuration)==null?void 0:o.defaultLocale,supportedLocales:(l=s==null?void 0:s.configuration)==null?void 0:l.supportedLocales,defaultCurrency:(d=s==null?void 0:s.configuration)==null?void 0:d.defaultCurrency,openingTimes:(c=s==null?void 0:s.configuration)==null?void 0:c.openingTimes,closingTimes:(u=s==null?void 0:s.configuration)==null?void 0:u.closingTimes,isAcceptingOrders:(m=s==null?void 0:s.configuration)==null?void 0:m.isAcceptingOrders}}});console.log(r.watch());const{isPending:i,mutate:n}=R.useMutation({mutationFn:async({configuration:g})=>{const{status:x}=await a.organization.updateOrganization({params:{organizationId:s==null?void 0:s.id},body:{configuration:g}});if(x!==200)throw X.error("Failed to update organization. Please try again later."),new Error("Failed to update organization");return await Ae.invalidateQueries({queryKey:["organizations"]}),t&&t()}});return e.jsx(Ne,{form:r,config:Ad,onSubmit:g=>n(g),onCancel:t,loading:i,cancelText:"Go back",okText:"Save Schedule"})};function Nd(){const{organization:t}=pe();return t.data?e.jsx("div",{className:"space-y-10",children:e.jsx("section",{"aria-labelledby":"opening-times",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"opening-times",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Opening and Closing Times"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Set the opening and closing times for your organization"})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(vd,{initialData:t.data})})]})})}):e.jsx("div",{children:"Loading..."})}function nt({children:t}){const s=Q.usePathname(),a=K(),r=Y(),i=[{name:"General",href:r.settings(a)},{name:"Shipping Methods",href:r.settingsShippingMethods(a)},{name:"Opening Times",href:r.settingsOpeningTimes(a)},{name:"Access",href:`${r.settings(a)}/access`},{name:"API Keys",href:`${r.settings(a)}/api-keys`}];return(s==null?void 0:s.match(/\/settings\/shipping-methods\/[^/]+$/))?e.jsx("div",{children:t}):e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-2xl dark:text-gray-50",children:"Settings"}),e.jsx(Fs,{className:"mt-4 sm:mt-6 lg:mt-10",children:i.map(o=>e.jsx(Vs,{asChild:!0,active:s===o.href,children:e.jsx(H,{href:o.href,children:o.name})},o.name))}),e.jsx("div",{className:"pt-6",children:t})]})}const Rd=[{name:"configuration.defaultLocale",label:"Default Locale",type:"select",placeholder:"",options:Ws},{name:"configuration.supportedLocales",label:"Supported Locales",type:"select",placeholder:"Select locales",multiple:!0,options:Ws},{name:"configuration.defaultCurrency",label:"Currency",type:"select",placeholder:"Acme Inc.",options:dn}],Cd=({onClose:t,initialData:s})=>{var o,l,d;const{client:a}=L(),r=F.useForm({resolver:ue.zodResolver(bs),defaultValues:{configuration:{defaultLocale:(o=s==null?void 0:s.configuration)==null?void 0:o.defaultLocale,supportedLocales:(l=s==null?void 0:s.configuration)==null?void 0:l.supportedLocales,defaultCurrency:(d=s==null?void 0:s.configuration)==null?void 0:d.defaultCurrency}}}),{isPending:i,mutate:n}=R.useMutation({mutationFn:async({configuration:c})=>{const{status:u}=await a.organization.updateOrganization({params:{organizationId:s==null?void 0:s.id},body:{configuration:c}});if(u!==200)throw X.error("Failed to update organization. Please try again later."),new Error("Failed to update organization");return await Ae.invalidateQueries({queryKey:["organizations"]}),t&&t()}});return e.jsx(Ne,{form:r,config:Rd,onSubmit:c=>n(c),onCancel:t,loading:i,cancelText:"Go back",okText:"Save Settings"})},ji=h.forwardRef(({className:t,asChild:s,...a},r)=>{const i=s?ps.Slot:"div";return e.jsx(i,{ref:r,className:w("relative w-full rounded-lg border p-6 text-left shadow-xs","bg-white dark:bg-[#090E1A]","border-gray-200 dark:border-gray-900",t),...a})});ji.displayName="Card";function Pd(){const{organization:t}=pe();return t.data?e.jsxs("div",{className:"space-y-10",children:[e.jsx("section",{"aria-labelledby":"org-information",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"org-information",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Organization Information"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Manage your organization information."})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(ci,{initialData:t.data})})]})}),e.jsx(_,{}),e.jsx("section",{"aria-labelledby":"locale-settings",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"locale-settings",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Currency and Locale"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Set the currency and languages you support"})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(Cd,{initialData:t.data})})]})}),e.jsx(_,{}),e.jsx("section",{"aria-labelledby":"danger-zone",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"danger-zone",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Danger zone"}),e.jsxs("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:["Manage general workspace. Contact system admin for more information."," ",e.jsxs("a",{href:"#",className:"inline-flex items-center gap-1 text-indigo-600 hover:underline hover:underline-offset-4 dark:text-indigo-400",children:["Learn more",e.jsx(A.ExternalLinkIcon,{className:"size-4 shrink-0","aria-hidden":"true"})]})]})]}),e.jsx("div",{className:"space-y-6 md:col-span-2",children:e.jsx(ji,{className:"p-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-10",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:"Leave workspace"}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-gray-500",children:"Revoke your access to this team. Other people you have added to the workspace will remain."})]}),e.jsx(z,{variant:"secondary",className:"text-red-600 dark:text-red-500",children:"Leave"})]})})})]})})]}):e.jsx("div",{children:"Loading..."})}const Ai=({initialData:t})=>{var m;const{client:s}=L(),a=Q.useRouter(),r=Y(),i=K(),n=t?pn:za,o=F.useForm({resolver:ue.zodResolver(n),defaultValues:t?{title:t.title,providerName:t.providerName,providerLogoId:(m=t.providerLogo)==null?void 0:m.id,requireDateOfDelivery:t.requireDateOfDelivery,shippingZones:t.shippingZones}:{shippingZones:[{}]}}),l=R.useMutation({mutationFn:async g=>{const{status:x}=await s.shippingMethod.createShippingMethod({params:{organizationId:i},body:g});if(x!==201)throw X.error("Failed to create shipping method. Please try again later."),new Error("Failed to create shipping method")}}),d=R.useMutation({mutationFn:async g=>{const{status:x}=await s.shippingMethod.updateShippingMethod({params:{organizationId:i,id:t.id},body:g});if(x!==200)throw X.error("Failed to update shipping method. Please try again later."),new Error("Failed to update shipping method")}}),c=async()=>{X.success("Shipping method saved successfully"),a.push(r.settingsShippingMethods(i)),await Ae.invalidateQueries({queryKey:["shipping-and-payment"]})},u=g=>{t?d.mutate(g,{onSuccess:c}):l.mutate(g,{onSuccess:c})};return e.jsx(F.FormProvider,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(g=>u(g)),className:"space-y-14",children:[e.jsx("section",{"aria-labelledby":"Basic Information",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-information",className:"text-lg scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Basic Information"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Enter the information about your shipping method including title, shipping provider's name and logo"})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(Ne,{form:o,config:[{name:"title",label:"Title",type:"text",placeholder:"Standard Shipping",colspan:2},{name:"providerName",label:"Provider Name",type:"text",placeholder:"FedEx",colspan:2},{name:"providerLogoId",label:"Provider Logo",type:"file"},{name:"requireDateOfDelivery",label:"Require Date of Delivery?",type:"switch",colspan:2}]})})]})}),e.jsx(_,{}),e.jsx("section",{"aria-labelledby":"product-information",children:e.jsxs("div",{className:"grid grid-cols-1 gap-x-14 gap-y-8 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"product-information",className:"text-lg scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Shipping Zones"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-500",children:"Set pricing and minimum order based on delivery zones"})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(Ne,{form:o,config:[{name:"shippingZones",type:"array",fields:[{name:"title",label:"Title",type:"text",placeholder:"Zone 1"},{name:"distanceUpto",label:"Distance To (km)",type:"number",placeholder:"10"},{name:"price",label:"Shipping Price",type:"number",placeholder:"5.99",prefix:"USD"},{name:"minimumOrderAmount",label:"Minimum Order Amount",type:"number",placeholder:"50",prefix:"USD"},{name:"eta",label:"Estimated Time of Arrival",type:"text",placeholder:"2-3 days"}]}]})})]})}),e.jsx(_,{}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsxs(z,{type:"button",variant:"secondary",onClick:()=>a.push(r.settingsShippingMethods(i)),children:[e.jsx(A.ChevronLeft,{className:"w-4 h-4 mr-2"})," Cancel"]}),e.jsxs(z,{type:"submit",isLoading:l.isPending||d.isPending,loadingText:"Saving...",children:[e.jsx(A.CheckIcon,{className:"w-4 h-4 mr-2"})," ",t?"Save Product":"Create Shipping Method"]})]})]})})};function Td(){return e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Create Shipping Method"}),e.jsx(_,{}),e.jsx("div",{className:"pt-6",children:e.jsx("div",{className:"space-y-10",children:e.jsx(Ai,{})})})]})}function Qd(){const t=K(),s=gt(),{client:a}=L(),{isLoading:r,data:i}=R.useQuery({queryKey:["shipping-and-payment",t,s],queryFn:async()=>{const{status:n,body:o}=await a.shippingMethod.getShippingMethod({params:{id:s,organizationId:t}});if(n!==200)throw X.error("Failed to fetch shipping method. Please refresh or try again later."),new Error("Failed to fetch shipping method");return o},throwOnError:!0,placeholderData:R.keepPreviousData});return e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 sm:text-xl dark:text-gray-50",children:"Edit Shipping Method"}),e.jsx(_,{}),e.jsx("div",{className:"pt-6",children:e.jsx("div",{className:"space-y-10",children:r||!i?e.jsx("div",{className:"flex justify-center items-center h-screen mt-5",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(ce,{className:"w-12 h-12"}),e.jsx("p",{className:"text-gray-500 text-sm mt-3",children:"Loading data..."})]})}):e.jsx(Ai,{initialData:i})})})]})}const Ue=ge.createColumnHelper(),zd=[Ue.display({id:"select",header:({table:t})=>e.jsx(ve,{checked:t.getIsAllPageRowsSelected()?!0:t.getIsSomeRowsSelected()?"indeterminate":!1,onCheckedChange:()=>t.toggleAllPageRowsSelected(),className:"translate-y-0.5","aria-label":"Select all"}),cell:({row:t})=>e.jsx(ve,{checked:t.getIsSelected(),onCheckedChange:()=>t.toggleSelected(),className:"translate-y-0.5","aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,meta:{displayName:"Select"}}),Ue.accessor("id",{header:({column:t})=>e.jsx(E,{column:t,title:"Id"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"ID"},cell:({row:t,table:s})=>{var r,i,n;const a=(r=s.options.meta)==null?void 0:r.organizationId;return e.jsx(H,{href:((n=(i=s.options.meta)==null?void 0:i.routes)==null?void 0:n.settingsShippingMethodEdit(a,t.getValue("id")))??`/admin/${a}/settings/shipping-methods/${t.getValue("id")}`,className:"text-blue-500",children:t.getValue("id")})}}),Ue.accessor("title",{header:({column:t})=>e.jsx(E,{column:t,title:"Title"}),enableSorting:!0,enableHiding:!1,meta:{className:"text-left",displayName:"Title"}}),Ue.accessor("providerName",{header:({column:t})=>e.jsx(E,{column:t,title:"Provider Name"}),enableSorting:!0,meta:{className:"text-left",displayName:"Provider Name"}}),Ue.accessor("shippingZones",{header:({column:t})=>e.jsx(E,{column:t,title:"Shipping Zones"}),enableSorting:!1,meta:{className:"text-left",displayName:"Shipping Zones"},cell:({row:t})=>t.getValue("shippingZones").map(a=>a.title).join(", ")||"-"}),Ue.display({id:"edit",header:"Edit",enableSorting:!1,enableHiding:!1,meta:{className:"text-right",displayName:"Edit"},cell:({row:t,table:s})=>{var r,i,n;const a=(r=s.options.meta)==null?void 0:r.organizationId;return e.jsxs(Le,{children:[e.jsx(Ee,{asChild:!0,children:e.jsx(z,{variant:"ghost",className:"group aspect-square px-1.5 py-0! h-8! hover:border hover:border-gray-300 data-[state=open]:border-gray-300 data-[state=open]:bg-gray-50 dark:hover:border-gray-700 dark:data-[state=open]:border-gray-700 dark:data-[state=open]:bg-gray-900",children:e.jsx(C.RiMoreFill,{className:"size-4 shrink-0 text-gray-500 group-hover:text-gray-700 group-data-[state=open]:text-gray-700 dark:group-hover:text-gray-300 dark:group-data-[state=open]:text-gray-300","aria-hidden":"true"})})}),e.jsxs(De,{align:"end",className:"min-w-40",children:[e.jsx(fe,{children:e.jsx(H,{href:((n=(i=s.options.meta)==null?void 0:i.routes)==null?void 0:n.settingsShippingMethodEdit(a,t.getValue("id")))??`/admin/${a}/settings/shipping-methods/${t.getValue("id")}`,className:"block",children:"Edit"})}),e.jsx(fe,{className:"text-red-600 dark:text-red-500",children:"Delete"})]})]})}})],Id=()=>{const{client:t}=L(),s=K(),a=Q.useSearchParams(),[r]=h.useState(""),[i]=Fe.useDebounce(r,300),n=Number((a==null?void 0:a.get("page"))||"1"),{isLoading:o,isRefetching:l,isError:d,data:c}=R.useQuery({queryKey:["shipping-and-payment",s,n,i],queryFn:async()=>{const{body:u,status:m}=await t.shippingMethod.getShippingMethods({params:{organizationId:s},query:{page:n,limit:10,search:i}});if(m!==200)throw new Error("Failed to fetch shipping methods");return u},placeholderData:R.keepPreviousData});return e.jsx("div",{children:e.jsx(st,{error:d,loading:o||l,meta:c!=null&&c.meta?{...c==null?void 0:c.meta,currentPage:n}:void 0,data:(c==null?void 0:c.list)||[],columns:zd,className:"mt-8"})})};function Ld(){const t=K(),s=Y();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"sm:flex sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"existing-users",className:"scroll-mt-10 font-semibold text-gray-900 dark:text-gray-50",children:"Shipping Methods"}),e.jsx("p",{className:"text-sm leading-6 text-gray-500",children:"Set up delivery zones, pricing based on distance, and manage shipping methods and providers for your organization."})]}),e.jsx(z,{asChild:!0,className:"hidden gap-x-2 px-2 py-1.5 text-sm sm:text-xs lg:flex",children:e.jsxs(H,{href:s.settingsShippingMethodCreate(t),children:["Create Shipping Method",e.jsx(A.PlusIcon,{className:"size-4 shrink-0","aria-hidden":"true"})]})})]}),e.jsx(Id,{})]})}const Ed=()=>{const t=Q.useRouter(),s=Q.useSearchParams(),a=mt(),r=Y(),i=a.signIn,n=Gt(s==null?void 0:s.get("redirect"),r),{register:o,handleSubmit:l,formState:{errors:d,isSubmitting:c}}=F.useForm({resolver:ue.zodResolver(Da),shouldFocusError:!0}),u=()=>t.push(n),m=async x=>{await i.email({email:x.email,password:x.password,fetchOptions:{onSuccess:u}})},g=async()=>{await i.social({provider:"google",callbackURL:jr(window.location.origin,n,r)})};return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex w-full flex-col items-start sm:max-w-sm",children:[e.jsx("div",{className:"relative flex items-center justify-center rounded-lg bg-white p-3 shadow-lg ring-1 ring-black/5",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:481,zoomAndPan:"magnify",viewBox:"0 0 360.75 362.250002",height:483,preserveAspectRatio:"xMidYMid meet",className:"size-8 text-blue-500 dark:text-blue-500",children:[e.jsxs("defs",{children:[e.jsx("filter",{x:"0%",y:"0%",width:"100%",height:"100%",id:"2330832e18",children:e.jsx("feColorMatrix",{values:"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0",colorInterpolationFilters:"sRGB"})}),e.jsx("clipPath",{id:"5855bcb1c8",children:e.jsx("path",{d:"M 49 49.945312 L 357 49.945312 L 357 361.257812 L 49 361.257812 Z M 49 49.945312 ",clipRule:"nonzero"})}),e.jsx("clipPath",{id:"2af377de26",children:e.jsx("path",{d:"M 226.65625 348.957031 L 345.746094 229.867188 C 359.820312 215.792969 359.820312 193.058594 345.746094 178.984375 L 228.101562 61.339844 C 220.160156 53.398438 209.515625 49.070312 198.328125 49.070312 L 50.730469 49.070312 L 180.644531 178.984375 C 194.71875 193.058594 194.71875 215.792969 180.644531 229.867188 L 49.285156 361.226562 L 196.882812 361.226562 C 208.070312 361.226562 218.71875 356.714844 226.65625 348.957031 Z M 226.65625 348.957031 ",clipRule:"nonzero"})}),e.jsx("image",{x:0,y:0,width:313,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATkAAAE5CAYAAADr4VfxAAAABmJLR0QA/wD/AP+gvaeTAAAEKklEQVR4nO3UMQqAMBQFQeP9D51aUYSAIssM/CbwSLdj+4dxcXfvT7eys7Gx+Xbz5l8H+/kBoETkgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSJsw7gNx2VB9PQAAAABJRU5ErkJggg==",id:"dfad2cd726",height:313,preserveAspectRatio:"xMidYMid meet"}),e.jsx("mask",{id:"161eaca8d9",children:e.jsx("g",{filter:"url(#2330832e18)",children:e.jsx("g",{children:e.jsx("image",{x:0,y:0,width:313,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATkAAAE5CAYAAADr4VfxAAAABmJLR0QA/wD/AP+gvaeTAAAEKklEQVR4nO3UMQqAMBQFQeP9D51aUYSAIssM/CbwSLdj+4dxcXfvT7eys7Gx+Xbz5l8H+/kBoETkgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSJsw7gNx2VB9PQAAAABJRU5ErkJggg==",height:313,preserveAspectRatio:"xMidYMid meet"})})})}),e.jsx("clipPath",{id:"5d3dc395e3",children:e.jsx("rect",{x:0,width:313,y:0,height:313})}),e.jsx("pattern",{id:"2569dd48be",patternUnits:"userSpaceOnUse",width:313,patternTransform:"matrix(0.997934, 0, 0, -0.997934, 48.148759, 361.331903)",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 313 313",height:313,x:0,y:0,children:e.jsx("g",{children:e.jsx("g",{clipPath:"url(#5d3dc395e3)",children:e.jsx("g",{mask:"url(#161eaca8d9)",children:e.jsx("rect",{x:"-127.777762",width:"520.555524",fill:"#8c52ff",height:"522.72",y:"-80.78",fillOpacity:1})})})})}),e.jsx("clipPath",{id:"2302aeb2c7",children:e.jsx("path",{d:"M 0.246094 0.90625 L 308 0.90625 L 308 312.21875 L 0.246094 312.21875 Z M 0.246094 0.90625 ",clipRule:"nonzero"})}),e.jsx("clipPath",{id:"d6b3633872",children:e.jsx("path",{d:"M 177.617188 299.917969 L 296.707031 180.828125 C 310.78125 166.753906 310.78125 144.019531 296.707031 129.945312 L 179.0625 12.300781 C 171.121094 4.363281 160.476562 0.03125 149.289062 0.03125 L 1.691406 0.03125 L 131.605469 129.945312 C 145.679688 144.019531 145.679688 166.753906 131.605469 180.828125 L 0.246094 312.1875 L 147.84375 312.1875 C 159.03125 312.1875 169.679688 307.675781 177.617188 299.917969 Z M 177.617188 299.917969 ",clipRule:"nonzero"})}),e.jsx("image",{x:0,y:0,width:312,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE5CAYAAAAEIzzPAAAABmJLR0QA/wD/AP+gvaeTAAAEKElEQVR4nO3UMQ6AIAAEQfH/j7bGQhqVZDOT0EAudDuO/cbDWb3bvLf76x8bmy83k/N+AVAhcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2RdVgkDcV9ZT24AAAAASUVORK5CYII=",id:"f9fee20a49",height:313,preserveAspectRatio:"xMidYMid meet"}),e.jsx("mask",{id:"8bb974956b",children:e.jsx("g",{filter:"url(#2330832e18)",children:e.jsx("g",{children:e.jsx("image",{x:0,y:0,width:312,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE5CAYAAAAEIzzPAAAABmJLR0QA/wD/AP+gvaeTAAAEKElEQVR4nO3UMQ6AIAAEQfH/j7bGQhqVZDOT0EAudDuO/cbDWb3bvLf76x8bmy83k/N+AVAhcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2RdVgkDcV9ZT24AAAAASUVORK5CYII=",height:313,preserveAspectRatio:"xMidYMid meet"})})})}),e.jsx("clipPath",{id:"4f6b6cd058",children:e.jsx("rect",{x:0,width:312,y:0,height:313})}),e.jsx("pattern",{id:"80e461df2c",patternUnits:"userSpaceOnUse",width:312,patternTransform:"matrix(0.997934, 0, 0, -0.997934, 0.247933, 312.433143)",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 312 313",height:313,x:0,y:0,children:e.jsx("g",{children:e.jsx("g",{clipPath:"url(#4f6b6cd058)",children:e.jsx("g",{mask:"url(#8bb974956b)",children:e.jsx("rect",{x:"-79.777762",width:"520.555524",fill:"#8c52ff",height:"522.72",y:"-129.78",fillOpacity:1})})})})})]}),e.jsx("g",{clipPath:"url(#5855bcb1c8)",children:e.jsx("g",{clipPath:"url(#2af377de26)",children:e.jsx("path",{fill:"url(#2569dd48be)",d:"M 359.820312 361.226562 L 49.289062 361.226562 L 49.289062 49.945312 L 359.820312 49.945312 Z M 359.820312 361.226562 ",fillRule:"nonzero"})})}),e.jsx("g",{clipPath:"url(#2302aeb2c7)",children:e.jsx("g",{clipPath:"url(#d6b3633872)",children:e.jsx("path",{fill:"url(#80e461df2c)",d:"M 310.78125 312.1875 L 0.25 312.1875 L 0.25 0.90625 L 310.78125 0.90625 Z M 310.78125 312.1875 ",fillRule:"nonzero"})})})]})}),e.jsxs("div",{className:"mt-6 flex flex-col",children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:"Log in to Shophost"}),e.jsxs("p",{className:"mt-1 text-sm text-gray-700 dark:text-gray-300",children:["Don’t have an account?"," ",e.jsx(H,{className:"text-blue-500 hover:text-blue-600 dark:text-blue-500 dark:hover:text-blue-400",href:Ps(r.signUp,n),children:"Sign up"})]})]}),e.jsxs("div",{className:"mt-10 w-full",children:[e.jsx("div",{className:"gap-2 sm:flex sm:flex-row sm:items-center",children:e.jsxs(z,{variant:"secondary",type:"button",className:"mt-2 w-full sm:mt-0 shadow-none inline-flex items-center gap-2",onClick:g,children:[e.jsx(C.RiGoogleFill,{className:"size-4","aria-hidden":"true"}),"Login with Google"]})}),e.jsx(_,{className:"my-6",children:"or"}),e.jsxs("form",{onSubmit:l(m),className:"flex w-full flex-col gap-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-y-4",children:[e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(be,{htmlFor:"email-form-item",className:"font-medium",children:"Email"}),e.jsx(he,{type:"email",autoComplete:"email",id:"email-form-item",placeholder:"emily.ross@acme.ch",...o("email")}),d.email&&e.jsx("span",{className:"text-sm text-red-500",children:d.email.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(be,{htmlFor:"password-form-item",className:"font-medium",children:"Password"}),e.jsx(he,{type:"password",autoComplete:"current-password",id:"password-form-item",placeholder:"Password",...o("password")}),d.password&&e.jsx("span",{className:"text-sm text-red-500",children:d.password.message})]})]}),e.jsx(z,{type:"submit",isLoading:c,children:c?"Submitting...":"Continue"})]})]}),e.jsx(_,{}),e.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Forgot your password?"," ",e.jsx("a",{className:"text-blue-500 hover:text-blue-600 dark:text-blue-500 dark:hover:text-blue-400",href:"#",children:"Reset password"})]})]})})};function vi({children:t}){const{appearance:s}=fr(),a=s==null?void 0:s.loginImage;return e.jsxs("div",{className:"flex w-full min-h-screen",children:[a&&e.jsx("div",{className:"hidden lg:block relative w-1/2 overflow-hidden",children:e.jsx(xe,{src:a,alt:"Login Visual",width:4e3,height:2250,className:"w-full h-full object-cover min-h-screen"})}),e.jsx("div",{className:`w-full ${a?"lg:w-1/2":""} flex items-center justify-center p-8`,children:e.jsx("div",{className:"w-full max-w-md space-y-8",children:t})})]})}function Dd(){return e.jsx(vi,{children:e.jsx(Ed,{})})}const Md=()=>{const t=Q.useRouter(),s=Q.useSearchParams(),a=mt(),r=Y(),{signIn:i,signUp:n}=a,o=Gt(s==null?void 0:s.get("redirect"),r),{register:l,handleSubmit:d,formState:{errors:c}}=F.useForm({resolver:ue.zodResolver(Ss),shouldFocusError:!0}),u=()=>t.push(o),{isPending:m,isError:g,mutate:x}=R.useMutation({onMutate:async b=>n.email({email:b.email,password:b.password,name:`${b.firstname} ${b.lastname}`,firstname:b.firstname,lastname:b.lastname,fetchOptions:{onSuccess:u}})}),f=async()=>i.social({provider:"google",callbackURL:jr(window.location.origin,o,r)});return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex w-full flex-col items-start sm:max-w-sm",children:[e.jsx("div",{className:"relative flex items-center justify-center rounded-lg bg-white p-3 shadow-lg ring-1 ring-black/5",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:481,zoomAndPan:"magnify",viewBox:"0 0 360.75 362.250002",height:483,preserveAspectRatio:"xMidYMid meet",className:"size-8 text-blue-500 dark:text-blue-500",children:[e.jsxs("defs",{children:[e.jsx("filter",{x:"0%",y:"0%",width:"100%",height:"100%",id:"2330832e18",children:e.jsx("feColorMatrix",{values:"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0",colorInterpolationFilters:"sRGB"})}),e.jsx("clipPath",{id:"5855bcb1c8",children:e.jsx("path",{d:"M 49 49.945312 L 357 49.945312 L 357 361.257812 L 49 361.257812 Z M 49 49.945312 ",clipRule:"nonzero"})}),e.jsx("clipPath",{id:"2af377de26",children:e.jsx("path",{d:"M 226.65625 348.957031 L 345.746094 229.867188 C 359.820312 215.792969 359.820312 193.058594 345.746094 178.984375 L 228.101562 61.339844 C 220.160156 53.398438 209.515625 49.070312 198.328125 49.070312 L 50.730469 49.070312 L 180.644531 178.984375 C 194.71875 193.058594 194.71875 215.792969 180.644531 229.867188 L 49.285156 361.226562 L 196.882812 361.226562 C 208.070312 361.226562 218.71875 356.714844 226.65625 348.957031 Z M 226.65625 348.957031 ",clipRule:"nonzero"})}),e.jsx("image",{x:0,y:0,width:313,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATkAAAE5CAYAAADr4VfxAAAABmJLR0QA/wD/AP+gvaeTAAAEKklEQVR4nO3UMQqAMBQFQeP9D51aUYSAIssM/CbwSLdj+4dxcXfvT7eys7Gx+Xbz5l8H+/kBoETkgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSJsw7gNx2VB9PQAAAABJRU5ErkJggg==",id:"dfad2cd726",height:313,preserveAspectRatio:"xMidYMid meet"}),e.jsx("mask",{id:"161eaca8d9",children:e.jsx("g",{filter:"url(#2330832e18)",children:e.jsx("g",{children:e.jsx("image",{x:0,y:0,width:313,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATkAAAE5CAYAAADr4VfxAAAABmJLR0QA/wD/AP+gvaeTAAAEKklEQVR4nO3UMQqAMBQFQeP9D51aUYSAIssM/CbwSLdj+4dxcXfvT7eys7Gx+Xbz5l8H+/kBoETkgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSBM5IE3kgDSRA9JEDkgTOSBN5IA0kQPSRA5IEzkgTeSANJED0kQOSJsw7gNx2VB9PQAAAABJRU5ErkJggg==",height:313,preserveAspectRatio:"xMidYMid meet"})})})}),e.jsx("clipPath",{id:"5d3dc395e3",children:e.jsx("rect",{x:0,width:313,y:0,height:313})}),e.jsx("pattern",{id:"2569dd48be",patternUnits:"userSpaceOnUse",width:313,patternTransform:"matrix(0.997934, 0, 0, -0.997934, 48.148759, 361.331903)",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 313 313",height:313,x:0,y:0,children:e.jsx("g",{children:e.jsx("g",{clipPath:"url(#5d3dc395e3)",children:e.jsx("g",{mask:"url(#161eaca8d9)",children:e.jsx("rect",{x:"-127.777762",width:"520.555524",fill:"#8c52ff",height:"522.72",y:"-80.78",fillOpacity:1})})})})}),e.jsx("clipPath",{id:"2302aeb2c7",children:e.jsx("path",{d:"M 0.246094 0.90625 L 308 0.90625 L 308 312.21875 L 0.246094 312.21875 Z M 0.246094 0.90625 ",clipRule:"nonzero"})}),e.jsx("clipPath",{id:"d6b3633872",children:e.jsx("path",{d:"M 177.617188 299.917969 L 296.707031 180.828125 C 310.78125 166.753906 310.78125 144.019531 296.707031 129.945312 L 179.0625 12.300781 C 171.121094 4.363281 160.476562 0.03125 149.289062 0.03125 L 1.691406 0.03125 L 131.605469 129.945312 C 145.679688 144.019531 145.679688 166.753906 131.605469 180.828125 L 0.246094 312.1875 L 147.84375 312.1875 C 159.03125 312.1875 169.679688 307.675781 177.617188 299.917969 Z M 177.617188 299.917969 ",clipRule:"nonzero"})}),e.jsx("image",{x:0,y:0,width:312,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE5CAYAAAAEIzzPAAAABmJLR0QA/wD/AP+gvaeTAAAEKElEQVR4nO3UMQ6AIAAEQfH/j7bGQhqVZDOT0EAudDuO/cbDWb3bvLf76x8bmy83k/N+AVAhcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2RdVgkDcV9ZT24AAAAASUVORK5CYII=",id:"f9fee20a49",height:313,preserveAspectRatio:"xMidYMid meet"}),e.jsx("mask",{id:"8bb974956b",children:e.jsx("g",{filter:"url(#2330832e18)",children:e.jsx("g",{children:e.jsx("image",{x:0,y:0,width:312,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE5CAYAAAAEIzzPAAAABmJLR0QA/wD/AP+gvaeTAAAEKElEQVR4nO3UMQ6AIAAEQfH/j7bGQhqVZDOT0EAudDuO/cbDWb3bvLf76x8bmy83k/N+AVAhcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2QJHJAlcECWwAFZAgdkCRyQJXBAlsABWQIHZAkckCVwQJbAAVkCB2RdVgkDcV9ZT24AAAAASUVORK5CYII=",height:313,preserveAspectRatio:"xMidYMid meet"})})})}),e.jsx("clipPath",{id:"4f6b6cd058",children:e.jsx("rect",{x:0,width:312,y:0,height:313})}),e.jsx("pattern",{id:"80e461df2c",patternUnits:"userSpaceOnUse",width:312,patternTransform:"matrix(0.997934, 0, 0, -0.997934, 0.247933, 312.433143)",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 312 313",height:313,x:0,y:0,children:e.jsx("g",{children:e.jsx("g",{clipPath:"url(#4f6b6cd058)",children:e.jsx("g",{mask:"url(#8bb974956b)",children:e.jsx("rect",{x:"-79.777762",width:"520.555524",fill:"#8c52ff",height:"522.72",y:"-129.78",fillOpacity:1})})})})})]}),e.jsx("g",{clipPath:"url(#5855bcb1c8)",children:e.jsx("g",{clipPath:"url(#2af377de26)",children:e.jsx("path",{fill:"url(#2569dd48be)",d:"M 359.820312 361.226562 L 49.289062 361.226562 L 49.289062 49.945312 L 359.820312 49.945312 Z M 359.820312 361.226562 ",fillRule:"nonzero"})})}),e.jsx("g",{clipPath:"url(#2302aeb2c7)",children:e.jsx("g",{clipPath:"url(#d6b3633872)",children:e.jsx("path",{fill:"url(#80e461df2c)",d:"M 310.78125 312.1875 L 0.25 312.1875 L 0.25 0.90625 L 310.78125 0.90625 Z M 310.78125 312.1875 ",fillRule:"nonzero"})})})]})}),e.jsxs("div",{className:"mt-6 flex flex-col",children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:"Log in to Shophost"}),e.jsxs("p",{className:"mt-1 text-sm text-gray-700 dark:text-gray-300",children:["Already have an account?"," ",e.jsx(H,{className:"text-blue-500 hover:text-blue-600 dark:text-blue-500 dark:hover:text-blue-400",href:Ps(r.signIn,o),children:"Sign in"})]})]}),e.jsxs("div",{className:"mt-10 w-full",children:[e.jsx("div",{className:"gap-2 sm:flex sm:flex-row sm:items-center",children:e.jsx(z,{asChild:!0,variant:"secondary",className:"mt-2 w-full sm:mt-0",children:e.jsxs("button",{className:"inline-flex items-center gap-2",onClick:f,children:[e.jsx(C.RiGoogleFill,{className:"size-4","aria-hidden":"true"}),"Signin with Google"]})})}),e.jsx(_,{className:"my-6",children:"or"}),e.jsxs("form",{onSubmit:d(b=>x(b)),className:"flex w-full flex-col gap-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-y-4",children:[e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(be,{htmlFor:"email-form-item",className:"font-medium",children:"First Name"}),e.jsx(he,{type:"text",id:"email-form-item",placeholder:"Emily",...l("firstname")}),c.firstname&&e.jsx("span",{className:"text-sm text-red-500",children:c.firstname.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(be,{htmlFor:"email-form-item",className:"font-medium",children:"Last Name"}),e.jsx(he,{type:"text",id:"email-form-item",placeholder:"Emily",...l("lastname")}),c.lastname&&e.jsx("span",{className:"text-sm text-red-500",children:c.lastname.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(be,{htmlFor:"email-form-item",className:"font-medium",children:"Email"}),e.jsx(he,{type:"email",autoComplete:"email",id:"email-form-item",placeholder:"emily.ross@acme.ch",...l("email")}),c.email&&e.jsx("span",{className:"text-sm text-red-500",children:c.email.message})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(be,{htmlFor:"password-form-item",className:"font-medium",children:"Password"}),e.jsx(he,{type:"password",autoComplete:"current-password",id:"password-form-item",placeholder:"Password",...l("password")}),c.password&&e.jsx("span",{className:"text-sm text-red-500",children:c.password.message})]})]}),g&&e.jsx("span",{className:"text-sm text-red-500",children:"An error occurred, please try again."}),e.jsx(z,{type:"submit",isLoading:m,children:m?"Submitting...":"Continue"})]})]}),e.jsx(_,{}),e.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Forgot your password?"," ",e.jsx("a",{className:"text-blue-500 hover:text-blue-600 dark:text-blue-500 dark:hover:text-blue-400",href:"#",children:"Reset password"})]})]})})};function Bd(){return e.jsx(vi,{children:e.jsx(Md,{})})}function Jd(t){if(t.length===0)return{type:"home"};const[s,a,r,i,n]=t;if(s==="auth")return a==="sign-in"?{type:"sign-in"}:a==="sign-up"?{type:"sign-up"}:{type:"not-found"};if(s==="organizations")return{type:"organizations"};const o=s;return a?a==="dashboard"?{type:"dashboard",orgId:o}:a==="orders"?{type:"orders",orgId:o}:a==="reservations"?{type:"reservations",orgId:o}:a==="products"?r?r==="create"?{type:"product-create",orgId:o}:{type:"product-edit",orgId:o,id:r}:{type:"products-list",orgId:o}:a==="product-categories"?r?r==="create"?{type:"product-category-create",orgId:o}:{type:"product-category-edit",orgId:o,id:r}:{type:"product-categories-list",orgId:o}:a==="manufacturers"?r?r==="create"?{type:"manufacturer-create",orgId:o}:{type:"manufacturer-edit",orgId:o,id:r}:{type:"manufacturers-list",orgId:o}:a==="settings"?r?r==="opening-times"?{type:"settings-opening-times",orgId:o}:r==="shipping-methods"?i?i==="create"?{type:"shipping-method-create",orgId:o}:{type:"shipping-method-edit",orgId:o,id:i}:{type:"shipping-methods-list",orgId:o}:{type:"settings",orgId:o}:{type:"settings",orgId:o}:{type:"not-found"}:{type:"not-found"}}function Od({segments:t}){const s=mt(),a=Y(),r=Q.useRouter(),i=Q.usePathname(),n=Q.useSearchParams(),{data:o,isPending:l}=s.useSession(),d=Jd(t),c=d.type==="sign-in"||d.type==="sign-up",u=d.type==="home"||d.type==="organizations",m=n==null?void 0:n.get("redirect"),g=n==null?void 0:n.toString(),x=i?`${i}${g?`?${g}`:""}`:a.home,f=c?Gt(m,a):x;if(h.useEffect(()=>{if(!l){if(!o&&!c){r.replace(Ps(a.signIn,f));return}o&&c&&r.replace(f)}},[o,l,c,r,a.signIn,f]),l)return e.jsx("div",{className:"flex justify-center items-center h-screen",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"})});if(c){if(d.type==="sign-in")return e.jsx(Dd,{});if(d.type==="sign-up")return e.jsx(Bd,{})}if(!o)return null;if(u)return e.jsx(ea,{children:e.jsx(Fl,{})});if(d.type==="not-found")return e.jsx(Cs,{});const b="orgId"in d?d.orgId:void 0,y="id"in d?d.id:void 0;return e.jsx(Ao,{organizationId:b,id:y,children:e.jsx(ea,{children:e.jsx(Ro,{children:e.jsx(jd,{children:Fd(d)})})})})}function Fd(t){switch(t.type){case"dashboard":return e.jsx(tl,{});case"orders":return e.jsx(Jl,{});case"reservations":return e.jsx(gd,{});case"products-list":return e.jsx(od,{});case"product-create":return e.jsx(td,{});case"product-edit":return e.jsx(sd,{});case"product-categories-list":return e.jsx(Wl,{});case"product-category-create":return e.jsx($l,{});case"product-category-edit":return e.jsx(_l,{});case"manufacturers-list":return e.jsx(zl,{});case"manufacturer-create":return e.jsx(wl,{});case"manufacturer-edit":return e.jsx(bl,{});case"settings":return e.jsx(nt,{children:e.jsx(Pd,{})});case"settings-opening-times":return e.jsx(nt,{children:e.jsx(Nd,{})});case"shipping-methods-list":return e.jsx(nt,{children:e.jsx(Ld,{})});case"shipping-method-create":return e.jsx(nt,{children:e.jsx(Td,{})});case"shipping-method-edit":return e.jsx(nt,{children:e.jsx(Qd,{})});default:return e.jsx(Cs,{})}}exports.APIProvider=gs;exports.AdminProvider=yo;exports.AdminRouter=Od;exports.AuthPages=to;exports.Badge=We;exports.Button=de;exports.CartItems=Ki;exports.CartProvider=fa;exports.CheckoutPages=ao;exports.Command=pt;exports.CommandBar=nr;exports.CommandBarBar=lr;exports.CommandBarCommand=cr;exports.CommandBarSeperator=dr;exports.CommandBarValue=or;exports.CommandDialog=vn;exports.CommandEmpty=Ut;exports.CommandGroup=Wt;exports.CommandInput=Ht;exports.CommandItem=qt;exports.CommandList=Zt;exports.CommandSeparator=Ua;exports.CommandShortcut=Wa;exports.CountryInput=_a;exports.CustomerDetailsPage=ds;exports.Dialog=Ft;exports.DialogClose=Oa;exports.DialogContent=Vt;exports.DialogDescription=Ha;exports.DialogFooter=Za;exports.DialogHeader=ks;exports.DialogTitle=js;exports.DialogTrigger=Ja;exports.Divider=qe;exports.EmailInput=Ga;exports.ErrorView=Cs;exports.ImageUploadInput=Ka;exports.Input=ar;exports.InputGroup=ae;exports.Label=le;exports.LocationInput=$t;exports.ModifierContainer=ro;exports.ModifiersGroup=no;exports.ModifiersModal=lo;exports.ModifiersOption=oo;exports.PhoneNumberInput=er;exports.Popover=Ke;exports.PopoverAnchor=qa;exports.PopoverClose=$a;exports.PopoverContent=Ye;exports.PopoverTrigger=Xe;exports.QuantityControl=io;exports.RadioCardGroup=zt;exports.RadioCardGroupIndicator=It;exports.RadioCardItem=Lt;exports.SelectInput=tr;exports.ShippingAndPaymentPage=pr;exports.ShophostProvider=go;exports.SliderOver=ir;exports.Switch=As;exports.TextInput=we;exports.TimeInput=vs;exports.badgeVariants=ur;exports.buttonVariants=Ba;exports.calculateCartTotal=Hi;exports.createAdminAuthClient=wr;exports.createRoutes=Sr;exports.findCartItem=Ui;exports.formatPrice=ye;exports.getAdminAuthClient=br;exports.getFieldError=rr;exports.getFormattedModifiers=Zi;exports.mockProducts=po;exports.productRequiresModifiers=Wi;exports.useAPI=L;exports.useCart=Mt;exports.useCartContext=xs;exports.useLocalization=ya;exports.useModifierSelection=wa;exports.useModifiers=ut;exports.useMultipleProductDetails=uo;exports.useOrganization=ze;exports.useProductDetails=co;
|