This commit is contained in:
shafi54 2026-05-10 16:45:39 +05:30
parent 2759bc1488
commit 396eba7c1b
240 changed files with 65761 additions and 50 deletions

View file

@ -30,6 +30,7 @@
"@trpc/server": "^11.6.0",
"@turf/turf": "^7.2.0",
"@types/bcryptjs": "^2.4.6",
"aws4fetch": "^1.0.20",
"axios": "^1.11.0",
"bcryptjs": "^3.0.2",
"dayjs": "^1.11.18",

View file

@ -14,9 +14,9 @@ export const createApp = () => {
// CORS middleware
app.use(cors({
origin: ['http://localhost:5174', 'https://ui.freshyo.in'],
origin: ['http://localhost:5174', 'http://localhost:4174', 'https://ui.freshyo.in'],
allowMethods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
allowHeaders: ['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization'],
allowHeaders: ['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization', 'Caller-Interface'],
credentials: true,
}))
@ -26,13 +26,31 @@ export const createApp = () => {
// tRPC middleware
app.use('/api/trpc/*', trpcServer({
router: appRouter,
createContext: async ({ req }) => {
createContext: async ({ req, c }) => {
let user = null
let staffUser = null
const authHeader = req.headers.get('authorization')
const callerInterface = req.headers.get('caller-interface')
let token: string | null = null
if (authHeader?.startsWith('Bearer ')) {
const token = authHeader.substring(7)
token = authHeader.substring(7)
} else {
// Fallback: try reading token from cookie
const cookieHeader = req.headers.get('cookie')
if (cookieHeader) {
const cookies = Object.fromEntries(
cookieHeader.split(';').map((pair) => {
const [k, ...v] = pair.trim().split('=')
return [k, v.join('=')]
})
)
token = cookies['auth_token'] || null
}
}
if (token) {
try {
const { payload } = await jwtVerify(token, getEncodedJwtSecret())
const decoded = payload as any
@ -67,7 +85,7 @@ export const createApp = () => {
// Invalid token, both user and staffUser remain null
}
}
return { req, user, staffUser }
return { req, c, user, staffUser, callerInterface }
},
onError({ error, path, type, ctx }) {
console.error('🚨 tRPC Error :', {

View file

@ -48,7 +48,14 @@ const generateToken = async (userId: number): Promise<string> => {
.sign(getEncodedJwtSecret());
};
const setAuthCookie = (ctx: any, token: string) => {
if (ctx.callerInterface === 'web' && ctx.c) {
ctx.c.header(
'Set-Cookie',
`auth_token=${token}; HttpOnly; Secure; SameSite=Lax; Path=/; Max-Age=604800`
)
}
}
export const authRouter = router({
login: publicProcedure
@ -56,7 +63,7 @@ export const authRouter = router({
identifier: z.string().min(1, 'Email/mobile is required'),
password: z.string().min(1, 'Password is required'),
}))
.mutation(async ({ input }): Promise<UserAuthResult> => {
.mutation(async ({ input, ctx }): Promise<UserAuthResult> => {
const { identifier, password }: LoginRequest = input;
if (!identifier || !password) {
@ -99,6 +106,7 @@ export const authRouter = router({
}
const token = await generateToken(foundUser.id);
setAuthCookie(ctx, token);
const response: UserAuthResponse = {
token,
@ -132,7 +140,7 @@ export const authRouter = router({
password: z.string().min(1, 'Password is required'),
profileImageUrl: z.string().nullable().optional(),
}))
.mutation(async ({ input }): Promise<UserAuthResult> => {
.mutation(async ({ input, ctx }): Promise<UserAuthResult> => {
const { name, email, mobile, password, profileImageUrl }: RegisterRequest = input;
if (!name || !email || !mobile || !password) {
@ -178,6 +186,7 @@ export const authRouter = router({
})
const token = await generateToken(newUser.id);
setAuthCookie(ctx, token);
const profileImageSignedUrl = profileImageUrl
? await generateSignedUrlFromS3Url(profileImageUrl)
@ -215,7 +224,7 @@ export const authRouter = router({
mobile: z.string(),
otp: z.string(),
}))
.mutation(async ({ input }): Promise<UserOtpVerifyResponse> => {
.mutation(async ({ input, ctx }): Promise<UserOtpVerifyResponse> => {
const verificationId = getOtpCreds(input.mobile);
if (!verificationId) {
throw new ApiError("OTP not sent or expired", 400);
@ -236,6 +245,7 @@ export const authRouter = router({
// Generate JWT
const token = await generateToken(user.id);
setAuthCookie(ctx, token);
return {
success: true,

View file

@ -57,31 +57,6 @@ export const productRouter = router({
// If not in cache, fetch from database (fallback)
const productData = await getUserProductDetailByIdInDb(productId)
/*
// Old implementation - direct DB queries:
const productData = await db
.select({
id: productInfo.id,
name: productInfo.name,
shortDescription: productInfo.shortDescription,
longDescription: productInfo.longDescription,
price: productInfo.price,
marketPrice: productInfo.marketPrice,
images: productInfo.images,
isOutOfStock: productInfo.isOutOfStock,
storeId: productInfo.storeId,
unitShortNotation: units.shortNotation,
incrementStep: productInfo.incrementStep,
productQuantity: productInfo.productQuantity,
isFlashAvailable: productInfo.isFlashAvailable,
flashPrice: productInfo.flashPrice,
})
.from(productInfo)
.innerJoin(units, eq(productInfo.unitId, units.id))
.where(eq(productInfo.id, productId))
.limit(1);
*/
if (!productData) {
throw new Error('Product not found')
}

View file

@ -3,11 +3,13 @@ import type { Context as HonoContext } from 'hono';
export interface Context {
req: HonoContext['req'];
c: HonoContext;
user?: any;
staffUser?: {
id: number;
name: string;
} | null;
callerInterface?: string | null;
}
const t = initTRPC.context<Context>().create();

View file

@ -23,7 +23,6 @@
"@trpc/client": "^11.6.0",
"@trpc/react-query": "^11.6.0",
"axios": "^1.11.0",
"buffer": "^6.0.3",
"dayjs": "^1.11.18",
"expo": "~53.0.22",
"expo-blur": "~14.1.5",

19
apps/web-ui/.cta.json Normal file
View file

@ -0,0 +1,19 @@
{
"projectName": "web-ui",
"mode": "file-router",
"typescript": true,
"tailwind": true,
"packageManager": "bun",
"git": true,
"install": true,
"intent": true,
"addOnOptions": {},
"includeExamples": false,
"envVarValues": {},
"routerOnly": false,
"version": 1,
"framework": "react",
"chosenAddOns": [
"nitro"
]
}

View file

@ -0,0 +1,17 @@
{
"date": "2026-05-10T09:04:44.879Z",
"preset": "node-server",
"framework": {
"name": "nitro",
"version": "3.0.1-20260508-123613-d2e64906"
},
"versions": {
"nitro": "3.0.1-20260508-123613-d2e64906"
},
"serverEntry": "server/index.mjs",
"publicDir": "public",
"commands": {
"preview": "node ./server/index.mjs"
},
"config": {}
}

View file

@ -0,0 +1 @@
import{t as e}from"./createLucideIcon-7nArgiy8.js";var t=e(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]);export{t};

View file

@ -0,0 +1 @@
import{d as e,l as t,r as n,s as r,t as i,u as a}from"./src-C0xjWfnx.js";import{t as o}from"./useNavigate-VRicZWJI.js";import{t as s}from"./trash-2-B2Qxo_rV.js";import{a as c,i as l,r as u}from"./cart-query-hooks-BCr0eax3.js";import{t as d}from"./prominent-api-hooks-DipwWw0H.js";var f=e();function p(){let e=o(),{data:p}=u(`regular`),{data:m}=d(),h=c(`regular`),g=l(`regular`),_=m?.products||[],v={};_.forEach(e=>{v[e.id]=e});let y=(p?.items||[]).filter(e=>v[e.productId]),b=0;return y.forEach(e=>{let t=v[e.productId];t&&(b+=t.price*e.quantity)}),(0,f.jsxs)(i,{children:[(0,f.jsx)(a,{weight:`bold`,className:`mb-4 text-xl`,children:`Your Cart`}),y.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-20`,children:[(0,f.jsx)(a,{className:`text-gray-500`,children:`Your cart is empty`}),(0,f.jsx)(t,{textContent:`Browse Products`,onClick:()=>e({to:`/home`})})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:`flex flex-col gap-3`,children:y.map(e=>{let t=v[e.productId],i=t.price;return(0,f.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-gray-100 bg-white p-3 shadow-sm`,children:[(0,f.jsx)(`img`,{src:t.images?.[0],alt:t.name,className:`h-16 w-16 rounded-lg object-cover`}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(a,{weight:`semibold`,className:`text-sm`,numberOfLines:1,children:t.name}),(0,f.jsxs)(a,{className:`text-brand-600 text-sm font-bold`,children:[``,i]}),(0,f.jsx)(n,{value:e.quantity,setValue:t=>h.mutate({productId:e.productId,quantity:t})})]}),(0,f.jsx)(r,{onClick:()=>g.mutate(e.productId),children:(0,f.jsx)(s,{className:`h-5 w-5 text-red-500`})})]},e.productId)})}),(0,f.jsxs)(`div`,{className:`fixed bottom-0 left-0 right-0 border-t border-gray-200 bg-white p-4 shadow-lg`,children:[(0,f.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,f.jsx)(a,{weight:`bold`,children:`Total`}),(0,f.jsxs)(a,{weight:`bold`,className:`text-lg text-brand-600`,children:[``,b]})]}),(0,f.jsx)(t,{fullWidth:!0,textContent:`Proceed to Checkout`,onClick:()=>e({to:`/checkout`}),className:`bg-brand-500 text-white`})]})]})]})}export{p as component};

View file

@ -0,0 +1 @@
import{m as e,n as t,t as n}from"./useMutation-DvG2_Fq3.js";function r(e){return`local-cart-${e}`}function i(e){try{let t=localStorage.getItem(r(e));return t?JSON.parse(t):[]}catch{return[]}}function a(e,t){localStorage.setItem(r(e),JSON.stringify(t))}function o(e=`regular`){return t({queryKey:[r(e)],queryFn:()=>{let t=i(e);return{items:t,totalItems:t.reduce((e,t)=>e+t.quantity,0),totalAmount:0}}})}function s(t=`regular`){let o=e();return n({mutationFn:async({productId:e,quantity:n,storeId:r,slotId:o,deliveryDate:s})=>{let c=i(t),l=c.find(t=>t.productId===e);l?(l.quantity+=n,o&&(l.slotId=o),s&&(l.deliveryDate=s)):c.push({id:Date.now(),productId:e,quantity:n,storeId:r,addedAt:Date.now(),slotId:o??null,deliveryDate:s??null}),a(t,c)},onSuccess:()=>{o.invalidateQueries({queryKey:[r(t)]})}})}function c(t=`regular`){let o=e();return n({mutationFn:async({productId:e,quantity:n,slotId:r,deliveryDate:o})=>{let s=i(t),c=s.find(t=>t.productId===e);c&&(c.quantity=n,r!==void 0&&(c.slotId=r),o!==void 0&&(c.deliveryDate=o)),a(t,s)},onSuccess:()=>{o.invalidateQueries({queryKey:[r(t)]})}})}function l(t=`regular`){let o=e();return n({mutationFn:async e=>{let n=i(t);n=n.filter(t=>t.productId!==e),a(t,n)},onSuccess:()=>{o.invalidateQueries({queryKey:[r(t)]})}})}function u(e=`regular`){localStorage.removeItem(r(e))}export{c as a,l as i,s as n,o as r,u as t};

View file

@ -0,0 +1 @@
import{t as e}from"./react-BnURElzN.js";var t=e(e=>({products:[],productsById:{},setProducts:t=>{let n={};t.forEach(e=>{n[e.id]=e}),e({products:t,productsById:n})},refetchProducts:null,setRefetchProducts:t=>e({refetchProducts:t})}));export{t};

View file

@ -0,0 +1 @@
import{d as e,f as t,h as n,l as r,o as i,s as a,t as o,u as s}from"./src-C0xjWfnx.js";import{t as c}from"./useNavigate-VRicZWJI.js";import{m as l}from"./useMutation-DvG2_Fq3.js";import{n as u}from"./trpc-client-QrVjRqP1.js";import{l as d}from"./index-BXnbw4dQ.js";import{r as f,t as p}from"./cart-query-hooks-BCr0eax3.js";import{t as m}from"./prominent-api-hooks-DipwWw0H.js";var h=n(t()),g=e();function _(){let e=c(),t=l(),{isAuthenticated:n}=d(),{data:_}=f(`regular`),{data:v}=m(),[y,b]=(0,h.useState)(!1),x=v?.products||[],S={};x.forEach(e=>{S[e.id]=e});let{data:C}=u.user.address.getUserAddresses.useQuery(void 0,{enabled:n}),[w,T]=(0,h.useState)(null),E=(_?.items||[]).filter(e=>S[e.productId]),D=0;E.forEach(e=>{let t=S[e.productId];t&&(D+=t.price*e.quantity)});let O=u.user.order.placeOrder.useMutation({onSuccess:n=>{let r=n.data?.[0];p(`regular`),t.invalidateQueries({queryKey:[`local-cart-regular`]}),e({to:`/home/order-success`,search:{orderId:r?.id,totalAmount:D}})},onSettled:()=>b(!1)});return(0,g.jsxs)(o,{children:[(0,g.jsx)(s,{weight:`bold`,className:`mb-4 text-xl`,children:`Checkout`}),(0,g.jsxs)(`div`,{className:`mb-6`,children:[(0,g.jsx)(s,{weight:`semibold`,className:`mb-2`,children:`Delivery Address`}),C?.data?.map(e=>(0,g.jsxs)(a,{onClick:()=>T(e.id),className:`mb-2 rounded-xl border p-3 ${w===e.id?`border-brand-500 bg-brand-50`:`border-gray-200`}`,children:[(0,g.jsx)(s,{weight:`semibold`,children:e.name}),(0,g.jsxs)(s,{className:`text-sm text-gray-600`,children:[e.addressLine1,`, `,e.city]}),(0,g.jsx)(s,{className:`text-sm text-gray-500`,children:e.phone})]},e.id))]}),(0,g.jsxs)(`div`,{className:`mb-6`,children:[(0,g.jsx)(s,{weight:`semibold`,className:`mb-2`,children:`Order Summary`}),E.map(e=>{let t=S[e.productId];return t?(0,g.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,g.jsxs)(s,{className:`text-sm`,numberOfLines:1,children:[t.name,` x`,e.quantity]}),(0,g.jsxs)(s,{className:`text-sm font-bold`,children:[``,t.price*e.quantity]})]},e.productId):null}),(0,g.jsx)(`div`,{className:`mt-2 border-t border-gray-200 pt-2`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(s,{weight:`bold`,children:`Total`}),(0,g.jsxs)(s,{weight:`bold`,className:`text-brand-600`,children:[``,D]})]})})]}),(0,g.jsx)(r,{fullWidth:!0,textContent:`Place Order (COD)`,onClick:()=>{w&&(b(!0),O.mutate({selectedItems:E.map(e=>({productId:e.productId,quantity:e.quantity,slotId:null})),addressId:w,paymentMethod:`cod`,isFlashDelivery:!1}))},disabled:!w||O.isPending,className:`bg-brand-500 text-white`}),(0,g.jsx)(i,{open:y,message:`Placing your order...`})]})}export{_ as component};

View file

@ -0,0 +1 @@
import{f as e,h as t}from"./src-C0xjWfnx.js";var n=t(e()),r=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),i=(...e)=>e.filter((e,t,n)=>!!e&&n.indexOf(e)===t).join(` `),a={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},o=(0,n.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:s=``,children:c,iconNode:l,...u},d)=>(0,n.createElement)(`svg`,{ref:d,...a,width:t,height:t,stroke:e,strokeWidth:o?Number(r)*24/Number(t):r,className:i(`lucide`,s),...u},[...l.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(c)?c:[c]])),s=(e,t)=>{let a=(0,n.forwardRef)(({className:a,...s},c)=>(0,n.createElement)(o,{ref:c,iconNode:t,className:i(`lucide-${r(e)}`,a),...s}));return a.displayName=`${e}`,a};export{s as t};

View file

@ -0,0 +1 @@
import{d as e,f as t,h as n,l as r,r as i,t as a,u as o}from"./src-C0xjWfnx.js";import{t as s}from"./useNavigate-VRicZWJI.js";import{t as c}from"./shopping-cart-BBNoSjWE.js";import{t as l}from"./zap-CufcM84a.js";import{n as u}from"./cart-query-hooks-BCr0eax3.js";import{t as d}from"./react-BnURElzN.js";import{t as f}from"./central-product-store-DGoerB5U.js";var p=n(t()),m=d(e=>({slots:[],productSlotsMap:{},setSlots:t=>e({slots:t}),setProductSlotsMap:t=>e({productSlotsMap:t}),refetchSlots:null,setRefetchSlots:t=>e({refetchSlots:t})})),h=e();function g(){let e=s(),t=f(e=>e.products),n=m(e=>e.productSlotsMap),[d,g]=(0,p.useState)({}),_=u(`flash`),v=t.filter(e=>n[e.id]?.isFlashAvailable&&!n[e.id]?.isOutOfStock),y=t=>{let n=d[t.id]||1;_.mutate({productId:t.id,quantity:n,storeId:t.storeId},{onSuccess:()=>e({to:`/flash/cart`})})};return(0,h.jsxs)(a,{children:[(0,h.jsxs)(`div`,{className:`mb-4 flex items-center gap-2`,children:[(0,h.jsx)(l,{className:`h-6 w-6 text-yellow-500`}),(0,h.jsx)(o,{weight:`bold`,className:`text-xl`,children:`1 Hr Delivery`})]}),(0,h.jsx)(`div`,{className:`mb-4 rounded-xl bg-yellow-50 p-3`,children:(0,h.jsx)(o,{className:`text-sm text-yellow-800`,children:`Get these products delivered within 1 hour! Only available for select items.`})}),(0,h.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:v.map(e=>{let t=e.discountedPrice??e.price,n=d[e.id]||1;return(0,h.jsxs)(`div`,{className:`rounded-xl border border-gray-100 bg-white p-3 shadow-sm`,children:[(0,h.jsx)(`div`,{className:`mb-2 aspect-square w-full overflow-hidden rounded-lg bg-gray-100`,children:e.images?.[0]&&(0,h.jsx)(`img`,{src:e.images[0].uri,alt:e.name,className:`h-full w-full object-cover`})}),(0,h.jsx)(o,{weight:`semibold`,className:`text-sm`,numberOfLines:2,children:e.name}),(0,h.jsxs)(o,{weight:`bold`,className:`text-brand-600`,children:[``,t]}),(0,h.jsx)(`div`,{className:`mt-2 flex items-center gap-2`,children:(0,h.jsx)(i,{value:n,setValue:t=>g(n=>({...n,[e.id]:t}))})}),(0,h.jsxs)(r,{fullWidth:!0,onClick:()=>y(e),className:`mt-2 flex items-center justify-center gap-1 bg-brand-500 text-white text-xs`,disabled:_.isPending,children:[(0,h.jsx)(c,{className:`h-3 w-3`}),`Add`]})]},e.id)})}),v.length===0&&(0,h.jsx)(`div`,{className:`py-20 text-center`,children:(0,h.jsx)(o,{className:`text-gray-500`,children:`No flash delivery products available`})})]})}export{g as component};

View file

@ -0,0 +1 @@
import{d as e,l as t,r as n,s as r,t as i,u as a}from"./src-C0xjWfnx.js";import{t as o}from"./useNavigate-VRicZWJI.js";import{t as s}from"./trash-2-B2Qxo_rV.js";import{t as c}from"./zap-CufcM84a.js";import{a as l,i as u,r as d}from"./cart-query-hooks-BCr0eax3.js";import{t as f}from"./central-product-store-DGoerB5U.js";var p=e();function m(){let e=o(),{data:m}=d(`flash`),h=l(`flash`),g=u(`flash`),_=f(e=>e.productsById),v=(m?.items||[]).filter(e=>_[e.productId]),y=0;return v.forEach(e=>{let t=_[e.productId];t&&(y+=(t.discountedPrice??t.price)*e.quantity)}),(0,p.jsxs)(i,{children:[(0,p.jsxs)(`div`,{className:`mb-4 flex items-center gap-2`,children:[(0,p.jsx)(c,{className:`h-5 w-5 text-yellow-500`}),(0,p.jsx)(a,{weight:`bold`,className:`text-xl`,children:`Flash Cart`})]}),v.length===0?(0,p.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-20`,children:[(0,p.jsx)(a,{className:`text-gray-500`,children:`Your flash cart is empty`}),(0,p.jsx)(t,{textContent:`Browse Flash Products`,onClick:()=>e({to:`/flash`})})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`flex flex-col gap-3`,children:v.map(e=>{let t=_[e.productId],i=t.discountedPrice??t.price;return(0,p.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-gray-100 bg-white p-3 shadow-sm`,children:[(0,p.jsx)(`img`,{src:t.images?.[0],alt:t.name,className:`h-16 w-16 rounded-lg object-cover`}),(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(a,{weight:`semibold`,className:`text-sm`,numberOfLines:1,children:t.name}),(0,p.jsxs)(a,{className:`text-brand-600 text-sm font-bold`,children:[``,i]}),(0,p.jsx)(n,{value:e.quantity,setValue:t=>h.mutate({productId:e.productId,quantity:t})})]}),(0,p.jsx)(r,{onClick:()=>g.mutate(e.productId),children:(0,p.jsx)(s,{className:`h-5 w-5 text-red-500`})})]},e.productId)})}),(0,p.jsxs)(`div`,{className:`fixed bottom-0 left-0 right-0 border-t border-gray-200 bg-white p-4 shadow-lg`,children:[(0,p.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,p.jsx)(a,{weight:`bold`,children:`Total`}),(0,p.jsxs)(a,{weight:`bold`,className:`text-lg text-brand-600`,children:[``,y]})]}),(0,p.jsx)(t,{fullWidth:!0,textContent:`Proceed to Checkout`,onClick:()=>e({to:`/flash/checkout`}),className:`bg-brand-500 text-white`})]})]})]})}export{m as component};

View file

@ -0,0 +1 @@
import{d as e,f as t,h as n,l as r,o as i,t as a,u as o}from"./src-C0xjWfnx.js";import{t as s}from"./useNavigate-VRicZWJI.js";import{m as c}from"./useMutation-DvG2_Fq3.js";import{n as l}from"./trpc-client-QrVjRqP1.js";import{l as u}from"./index-BXnbw4dQ.js";import{r as d,t as f}from"./cart-query-hooks-BCr0eax3.js";import{t as p}from"./central-product-store-DGoerB5U.js";var m=n(t()),h=e();function g(){let e=s(),t=c(),{isAuthenticated:n}=u(),{data:g}=d(`flash`),_=p(e=>e.productsById),[v,y]=(0,m.useState)(!1),{data:b}=l.user.address.getUserAddresses.useQuery(void 0,{enabled:n}),[x,S]=(0,m.useState)(null),C=l.user.order.placeOrder.useMutation({onSuccess:n=>{let r=n.data?.[0];f(`flash`),t.invalidateQueries({queryKey:[`local-cart-flash`]}),e({to:`/flash/order-success`,search:{orderId:r?.id,totalAmount:T}})},onSettled:()=>y(!1)}),w=(g?.items||[]).filter(e=>_[e.productId]),T=0;return w.forEach(e=>{let t=_[e.productId];t&&(T+=(t.discountedPrice??t.price)*e.quantity)}),(0,h.jsxs)(a,{children:[(0,h.jsx)(o,{weight:`bold`,className:`mb-4 text-xl`,children:`Flash Checkout`}),(0,h.jsxs)(`div`,{className:`mb-6`,children:[(0,h.jsx)(o,{weight:`semibold`,className:`mb-2`,children:`Delivery Address`}),b?.data?.map(e=>(0,h.jsxs)(`button`,{onClick:()=>S(e.id),className:`mb-2 w-full rounded-xl border p-3 text-left ${x===e.id?`border-brand-500 bg-brand-50`:`border-gray-200`}`,children:[(0,h.jsx)(o,{weight:`semibold`,children:e.name}),(0,h.jsxs)(o,{className:`text-sm text-gray-600`,children:[e.addressLine1,`, `,e.city]}),(0,h.jsx)(o,{className:`text-sm text-gray-500`,children:e.phone})]},e.id))]}),(0,h.jsxs)(`div`,{className:`mb-6`,children:[(0,h.jsx)(o,{weight:`semibold`,className:`mb-2`,children:`Order Summary`}),w.map(e=>{let t=_[e.productId];return t?(0,h.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,h.jsxs)(o,{className:`text-sm`,numberOfLines:1,children:[t.name,` x`,e.quantity]}),(0,h.jsxs)(o,{className:`text-sm font-bold`,children:[``,(t.discountedPrice??t.price)*e.quantity]})]},e.productId):null}),(0,h.jsx)(`div`,{className:`mt-2 border-t border-gray-200 pt-2`,children:(0,h.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,h.jsx)(o,{weight:`bold`,children:`Total`}),(0,h.jsxs)(o,{weight:`bold`,className:`text-brand-600`,children:[``,T]})]})})]}),(0,h.jsx)(r,{fullWidth:!0,textContent:`Place Flash Order (COD)`,onClick:()=>{x&&(y(!0),C.mutate({selectedItems:w.map(e=>({productId:e.productId,quantity:e.quantity,slotId:null})),addressId:x,paymentMethod:`cod`,isFlashDelivery:!0}))},disabled:!x||C.isPending,className:`bg-brand-500 text-white`}),(0,h.jsx)(i,{open:v,message:`Placing flash order...`})]})}export{g as component};

View file

@ -0,0 +1 @@
import{d as e,l as t,u as n}from"./src-C0xjWfnx.js";import{t as r}from"./useNavigate-VRicZWJI.js";import{t as i}from"./zap-CufcM84a.js";import{a}from"./index-BXnbw4dQ.js";var o=e();function s(){let e=r(),{orderId:s,totalAmount:c}=a.useSearch();return(0,o.jsxs)(`div`,{className:`flex min-h-screen flex-col items-center justify-center bg-yellow-50 p-6`,children:[(0,o.jsx)(`div`,{className:`mb-6 flex h-20 w-20 items-center justify-center rounded-full bg-yellow-100`,children:(0,o.jsx)(i,{className:`h-10 w-10 text-yellow-600`})}),(0,o.jsx)(n,{weight:`bold`,className:`mb-2 text-2xl text-gray-900`,children:`1 Hr Order Placed!`}),(0,o.jsxs)(n,{className:`mb-1 text-gray-600`,children:[`Order ID: #`,s]}),(0,o.jsxs)(n,{className:`mb-8 text-gray-600`,children:[`Total: ₹`,c]}),(0,o.jsx)(t,{textContent:`Continue Shopping`,onClick:()=>e({to:`/flash`}),className:`mb-3 bg-brand-500 text-white`}),(0,o.jsx)(t,{textContent:`View My Orders`,onClick:()=>e({to:`/me/orders`}),className:`bg-gray-100 text-gray-700`})]})}export{s as component};

View file

@ -0,0 +1 @@
import{d as e,f as t,h as n,l as r,r as i,t as a,u as o}from"./src-C0xjWfnx.js";import{t as s}from"./useNavigate-VRicZWJI.js";import{t as c}from"./shopping-cart-BBNoSjWE.js";import{t as l}from"./zap-CufcM84a.js";import{n as u}from"./index-BXnbw4dQ.js";import{n as d}from"./cart-query-hooks-BCr0eax3.js";import{t as f}from"./central-product-store-DGoerB5U.js";var p=n(t()),m=e();function h(){let{id:e}=u.useParams(),t=Number(e),n=s(),[h,g]=(0,p.useState)(1),_=f(e=>e.productsById)[t],v=d(`flash`),y=()=>{_&&v.mutate({productId:_.id,quantity:h,storeId:_.storeId},{onSuccess:()=>n({to:`/flash/cart`})})};if(!_)return(0,m.jsx)(a,{children:(0,m.jsx)(o,{children:`Product not found`})});let b=_.discountedPrice??_.price,x=_.images?.[0];return(0,m.jsxs)(a,{children:[(0,m.jsxs)(`div`,{className:`mb-4 flex items-center gap-2`,children:[(0,m.jsx)(l,{className:`h-5 w-5 text-yellow-500`}),(0,m.jsx)(o,{className:`text-sm font-semibold text-yellow-600`,children:`1 Hr Delivery`})]}),x&&(0,m.jsx)(`div`,{className:`mb-4 aspect-square w-full overflow-hidden rounded-xl bg-gray-100`,children:(0,m.jsx)(`img`,{src:x,alt:_.name,className:`h-full w-full object-cover`})}),(0,m.jsx)(o,{weight:`bold`,className:`mb-1 text-xl`,children:_.name}),(0,m.jsxs)(o,{className:`mb-4 text-sm text-gray-500`,children:[_.unitValue,_.unit]}),(0,m.jsxs)(`div`,{className:`mb-4 flex items-baseline gap-2`,children:[(0,m.jsxs)(o,{weight:`bold`,className:`text-2xl text-brand-600`,children:[``,b]}),_.discountedPrice&&(0,m.jsxs)(o,{className:`text-sm text-gray-400 line-through`,children:[``,_.price]})]}),(0,m.jsx)(`div`,{className:`mb-6`,children:(0,m.jsx)(i,{value:h,setValue:g,max:10})}),(0,m.jsxs)(r,{fullWidth:!0,onClick:y,disabled:v.isPending,className:`flex items-center justify-center gap-2 bg-brand-500 text-white`,children:[(0,m.jsx)(c,{className:`h-4 w-4`}),v.isPending?`Adding...`:`Add to Cart`]})]})}export{h as component};

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
import{d as e,l as t,r as n,s as r,t as i,u as a}from"./src-C0xjWfnx.js";import{t as o}from"./useNavigate-VRicZWJI.js";import{t as s}from"./trash-2-B2Qxo_rV.js";import{a as c,i as l,r as u}from"./cart-query-hooks-BCr0eax3.js";import{t as d}from"./prominent-api-hooks-DipwWw0H.js";var f=e();function p(){let e=o(),{data:p}=u(`regular`),{data:m}=d(),h=c(`regular`),g=l(`regular`),_=m?.products||[],v={};_.forEach(e=>{v[e.id]=e});let y=(p?.items||[]).filter(e=>v[e.productId]),b=0;return y.forEach(e=>{let t=v[e.productId];t&&(b+=t.price*e.quantity)}),(0,f.jsxs)(i,{children:[(0,f.jsx)(a,{weight:`bold`,className:`mb-4 text-xl`,children:`Your Cart`}),y.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-20`,children:[(0,f.jsx)(a,{className:`text-gray-500`,children:`Your cart is empty`}),(0,f.jsx)(t,{textContent:`Browse Products`,onClick:()=>e({to:`/home`})})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:`flex flex-col gap-3`,children:y.map(e=>{let t=v[e.productId],i=t.price;return(0,f.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-gray-100 bg-white p-3 shadow-sm`,children:[(0,f.jsx)(`img`,{src:t.images?.[0],alt:t.name,className:`h-16 w-16 rounded-lg object-cover`}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(a,{weight:`semibold`,className:`text-sm`,numberOfLines:1,children:t.name}),(0,f.jsxs)(a,{className:`text-brand-600 text-sm font-bold`,children:[``,i]}),(0,f.jsx)(n,{value:e.quantity,setValue:t=>h.mutate({productId:e.productId,quantity:t})})]}),(0,f.jsx)(r,{onClick:()=>g.mutate(e.productId),children:(0,f.jsx)(s,{className:`h-5 w-5 text-red-500`})})]},e.productId)})}),(0,f.jsxs)(`div`,{className:`fixed bottom-0 left-0 right-0 border-t border-gray-200 bg-white p-4 shadow-lg`,children:[(0,f.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,f.jsx)(a,{weight:`bold`,children:`Total`}),(0,f.jsxs)(a,{weight:`bold`,className:`text-lg text-brand-600`,children:[``,b]})]}),(0,f.jsx)(t,{fullWidth:!0,textContent:`Proceed to Checkout`,onClick:()=>e({to:`/home/checkout`}),className:`bg-brand-500 text-white`})]})]})]})}export{p as component};

View file

@ -0,0 +1 @@
import{d as e,f as t,h as n,l as r,o as i,s as a,t as o,u as s}from"./src-C0xjWfnx.js";import{t as c}from"./useNavigate-VRicZWJI.js";import{m as l}from"./useMutation-DvG2_Fq3.js";import{n as u}from"./trpc-client-QrVjRqP1.js";import{l as d}from"./index-BXnbw4dQ.js";import{r as f,t as p}from"./cart-query-hooks-BCr0eax3.js";import{t as m}from"./central-product-store-DGoerB5U.js";var h=n(t()),g=e();function _(){let e=c(),t=l(),{isAuthenticated:n}=d(),{data:_}=f(`regular`),v=m(e=>e.productsById),[y,b]=(0,h.useState)(!1),{data:x}=u.user.address.getUserAddresses.useQuery(void 0,{enabled:n}),[S,C]=(0,h.useState)(null),w=u.user.order.placeOrder.useMutation({onSuccess:n=>{let r=n.data?.[0];p(`regular`),t.invalidateQueries({queryKey:[`local-cart-regular`]}),e({to:`/home/order-success`,search:{orderId:r?.id,totalAmount:E}})},onSettled:()=>b(!1)}),T=(_?.items||[]).filter(e=>v[e.productId]),E=0;return T.forEach(e=>{let t=v[e.productId];t&&(E+=(t.discountedPrice??t.price)*e.quantity)}),(0,g.jsxs)(o,{children:[(0,g.jsx)(s,{weight:`bold`,className:`mb-4 text-xl`,children:`Checkout`}),(0,g.jsxs)(`div`,{className:`mb-6`,children:[(0,g.jsx)(s,{weight:`semibold`,className:`mb-2`,children:`Delivery Address`}),x?.data?.map(e=>(0,g.jsxs)(a,{onClick:()=>C(e.id),className:`mb-2 rounded-xl border p-3 ${S===e.id?`border-brand-500 bg-brand-50`:`border-gray-200`}`,children:[(0,g.jsx)(s,{weight:`semibold`,children:e.name}),(0,g.jsxs)(s,{className:`text-sm text-gray-600`,children:[e.addressLine1,`, `,e.city]}),(0,g.jsx)(s,{className:`text-sm text-gray-500`,children:e.phone})]},e.id))]}),(0,g.jsxs)(`div`,{className:`mb-6`,children:[(0,g.jsx)(s,{weight:`semibold`,className:`mb-2`,children:`Order Summary`}),T.map(e=>{let t=v[e.productId];return t?(0,g.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,g.jsxs)(s,{className:`text-sm`,numberOfLines:1,children:[t.name,` x`,e.quantity]}),(0,g.jsxs)(s,{className:`text-sm font-bold`,children:[``,(t.discountedPrice??t.price)*e.quantity]})]},e.productId):null}),(0,g.jsx)(`div`,{className:`mt-2 border-t border-gray-200 pt-2`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(s,{weight:`bold`,children:`Total`}),(0,g.jsxs)(s,{weight:`bold`,className:`text-brand-600`,children:[``,E]})]})})]}),(0,g.jsx)(r,{fullWidth:!0,textContent:`Place Order (COD)`,onClick:()=>{S&&(b(!0),w.mutate({selectedItems:T.map(e=>({productId:e.productId,quantity:e.quantity,slotId:null})),addressId:S,paymentMethod:`cod`,isFlashDelivery:!1}))},disabled:!S||w.isPending,className:`bg-brand-500 text-white`}),(0,g.jsx)(i,{open:y,message:`Placing your order...`})]})}export{_ as component};

View file

@ -0,0 +1 @@
import{d as e,l as t,u as n}from"./src-C0xjWfnx.js";import{t as r}from"./useNavigate-VRicZWJI.js";import{t as i}from"./package-CgMILU3n.js";import{o as a}from"./index-BXnbw4dQ.js";var o=e();function s(){let e=r(),{orderId:s,totalAmount:c}=a.useSearch();return(0,o.jsxs)(`div`,{className:`flex min-h-screen flex-col items-center justify-center bg-green-50 p-6`,children:[(0,o.jsx)(`div`,{className:`mb-6 flex h-20 w-20 items-center justify-center rounded-full bg-green-100`,children:(0,o.jsx)(i,{className:`h-10 w-10 text-green-600`})}),(0,o.jsx)(n,{weight:`bold`,className:`mb-2 text-2xl text-gray-900`,children:`Order Placed!`}),(0,o.jsxs)(n,{className:`mb-1 text-gray-600`,children:[`Order ID: #`,s]}),(0,o.jsxs)(n,{className:`mb-8 text-gray-600`,children:[`Total: ₹`,c]}),(0,o.jsx)(t,{textContent:`Continue Shopping`,onClick:()=>e({to:`/home`}),className:`mb-3 bg-brand-500 text-white`}),(0,o.jsx)(t,{textContent:`View My Orders`,onClick:()=>e({to:`/me/orders`}),fillColor:`gray`,className:`bg-gray-100 text-gray-700`})]})}export{s as component};

View file

@ -0,0 +1 @@
import{d as e,f as t,h as n,l as r,r as i,t as a,u as o}from"./src-C0xjWfnx.js";import{t as s}from"./useNavigate-VRicZWJI.js";import{n as c}from"./trpc-client-QrVjRqP1.js";import{t as l}from"./createLucideIcon-7nArgiy8.js";import{t as u}from"./shopping-cart-BBNoSjWE.js";import{r as d}from"./index-BXnbw4dQ.js";import{n as f}from"./cart-query-hooks-BCr0eax3.js";import{t as p}from"./central-product-store-DGoerB5U.js";var m=l(`Star`,[[`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`,key:`8f66p6`}]]),h=n(t()),g=e();function _(){let{id:e}=d.useParams(),t=Number(e),n=s(),[l,_]=(0,h.useState)(1),v=p(e=>e.productsById)[t],y=f(`regular`),{data:b}=c.user.product.getProductReviews.useQuery({productId:t},{enabled:!!t}),x=()=>{v&&y.mutate({productId:v.id,quantity:l,storeId:v.storeId},{onSuccess:()=>n({to:`/cart`})})};if(!v)return(0,g.jsx)(a,{children:(0,g.jsx)(o,{children:`Product not found`})});let S=v.discountedPrice??v.price,C=v.images?.[0];return(0,g.jsxs)(a,{children:[C&&(0,g.jsx)(`div`,{className:`mb-4 aspect-square w-full overflow-hidden rounded-xl bg-gray-100`,children:(0,g.jsx)(`img`,{src:C,alt:v.name,className:`h-full w-full object-cover`})}),(0,g.jsx)(o,{weight:`bold`,className:`mb-1 text-xl`,children:v.name}),(0,g.jsxs)(o,{className:`mb-2 text-sm text-gray-500`,children:[v.unitValue,v.unit]}),(0,g.jsxs)(`div`,{className:`mb-4 flex items-baseline gap-2`,children:[(0,g.jsxs)(o,{weight:`bold`,className:`text-2xl text-brand-600`,children:[``,S]}),v.discountedPrice&&(0,g.jsxs)(o,{className:`text-sm text-gray-400 line-through`,children:[``,v.price]})]}),v.description&&(0,g.jsx)(o,{className:`mb-4 text-gray-600`,children:v.description}),(0,g.jsx)(`div`,{className:`mb-6`,children:(0,g.jsx)(i,{value:l,setValue:_,max:10})}),(0,g.jsxs)(r,{fullWidth:!0,onClick:x,disabled:y.isPending,className:`flex items-center justify-center gap-2 bg-brand-500 text-white`,children:[(0,g.jsx)(u,{className:`h-4 w-4`}),y.isPending?`Adding...`:`Add to Cart`]}),b?.data&&b.data.length>0&&(0,g.jsxs)(`div`,{className:`mt-8`,children:[(0,g.jsx)(o,{weight:`bold`,className:`mb-3 text-lg`,children:`Reviews`}),b.data.map((e,t)=>(0,g.jsxs)(`div`,{className:`mb-3 rounded-lg border border-gray-100 p-3`,children:[(0,g.jsx)(`div`,{className:`mb-1 flex items-center gap-1`,children:Array.from({length:e.rating||5}).map((e,t)=>(0,g.jsx)(m,{className:`h-3 w-3 fill-yellow-400 text-yellow-400`},t))}),(0,g.jsx)(o,{className:`text-sm text-gray-600`,children:e.comment})]},t))]})]})}export{_ as component};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
import{t as e}from"./createLucideIcon-7nArgiy8.js";var t=e(`MapPin`,[[`path`,{d:`M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z`,key:`2oe9fu`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]);export{t};

View file

@ -0,0 +1 @@
import{d as e,l as t,n,s as r,t as i,u as a}from"./src-C0xjWfnx.js";import{t as o}from"./useNavigate-VRicZWJI.js";import{t as s}from"./createLucideIcon-7nArgiy8.js";import{t as c}from"./map-pin-DbTySZl1.js";import{t as l}from"./message-square-BE-hnHXL.js";import{t as u}from"./package-CgMILU3n.js";import{t as d}from"./shopping-cart-BBNoSjWE.js";import{t as f}from"./ticket-DHIzx079.js";import{l as p}from"./index-BXnbw4dQ.js";var m=s(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),h=s(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),g=s(`User`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),_=e();function v(){let e=o(),{user:s,logout:v}=p();if(!s)return(0,_.jsx)(i,{children:(0,_.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-20`,children:[(0,_.jsx)(a,{children:`Please sign in`}),(0,_.jsx)(t,{textContent:`Sign In`,onClick:()=>e({to:`/login`})})]})});let y=[{section:`Shopping & Activity`,items:[{icon:u,label:`My Orders`,to:`/me/orders`},{icon:d,label:`My Cart`,to:`/cart`},{icon:f,label:`Coupons`,to:`/me/coupons`}]},{section:`Saved Information`,items:[{icon:c,label:`Addresses`,to:`/me/addresses`},{icon:g,label:`Profile Settings`,to:`/me/edit-profile`}]},{section:`Support`,items:[{icon:l,label:`Help & Complaints`,to:`/me/complaints`},{icon:m,label:`Terms & Conditions`,to:`/me/terms`}]},{section:`About`,items:[{icon:h,label:`About Us`,to:`/me/about`}]}];return(0,_.jsxs)(i,{children:[(0,_.jsxs)(`div`,{className:`mb-6 flex items-center gap-4 rounded-xl bg-brand-50 p-4`,children:[(0,_.jsx)(n,{uri:s.profileImage,size:64}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(a,{weight:`bold`,className:`text-lg`,children:s.name||`User`}),(0,_.jsx)(a,{className:`text-sm text-gray-500`,children:s.mobile})]})]}),y.map(t=>(0,_.jsxs)(`div`,{className:`mb-6`,children:[(0,_.jsx)(a,{weight:`semibold`,className:`mb-2 text-sm text-gray-500 uppercase tracking-wide`,children:t.section}),(0,_.jsx)(`div`,{className:`rounded-xl border border-gray-100 bg-white shadow-sm`,children:t.items.map(t=>(0,_.jsxs)(r,{onClick:()=>e({to:t.to}),className:`flex w-full items-center gap-3 border-b border-gray-50 px-4 py-3.5 last:border-b-0`,children:[(0,_.jsx)(t.icon,{className:`h-5 w-5 text-gray-400`}),(0,_.jsx)(a,{className:`flex-1 text-left text-sm`,children:t.label})]},t.label))})]},t.section)),(0,_.jsx)(t,{fullWidth:!0,onClick:v,variant:`red`,className:`mb-8`,textContent:`Logout`}),(0,_.jsx)(a,{className:`mb-8 text-center text-xs text-gray-400`,children:`Version 1.0.0`})]})}export{v as component};

View file

@ -0,0 +1 @@
import{d as e,t,u as n}from"./src-C0xjWfnx.js";import{t as r}from"./createLucideIcon-7nArgiy8.js";import{t as i}from"./truck-DbJZ8T2i.js";var a=r(`Heart`,[[`path`,{d:`M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z`,key:`c3ymky`}]]),o=r(`Leaf`,[[`path`,{d:`M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z`,key:`nnexq3`}],[`path`,{d:`M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12`,key:`mt58a7`}]]),s=r(`Shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),c=e();function l(){return(0,c.jsxs)(t,{children:[(0,c.jsx)(n,{weight:`bold`,className:`mb-6 text-2xl`,children:`About Freshyo`}),(0,c.jsx)(`div`,{className:`grid grid-cols-2 gap-4`,children:[{icon:o,title:`Local Roots`,desc:`We source directly from local farmers to bring you the freshest meat.`},{icon:a,title:`Quality First`,desc:`Every cut is inspected for quality and freshness before delivery.`},{icon:i,title:`Fast Delivery`,desc:`Get your order delivered within 1 hour in select areas.`},{icon:s,title:`Farmers First`,desc:`We ensure fair prices and sustainable practices for our farmers.`}].map(e=>(0,c.jsxs)(`div`,{className:`rounded-xl border border-gray-100 bg-white p-4 shadow-sm`,children:[(0,c.jsx)(e.icon,{className:`mb-2 h-8 w-8 text-brand-500`}),(0,c.jsx)(n,{weight:`semibold`,className:`mb-1`,children:e.title}),(0,c.jsx)(n,{className:`text-sm text-gray-600`,children:e.desc})]},e.title))}),(0,c.jsxs)(`div`,{className:`mt-8`,children:[(0,c.jsx)(n,{weight:`bold`,className:`mb-3 text-lg`,children:`Sourcing & Quality`}),(0,c.jsx)(n,{className:`mb-6 text-sm leading-relaxed text-gray-600`,children:`We partner with trusted local farmers who follow ethical and sustainable farming practices. Every product undergoes rigorous quality checks to ensure you receive only the freshest meat.`})]})]})}export{l as component};

View file

@ -0,0 +1 @@
import{d as e,f as t,t as n,u as r}from"./src-C0xjWfnx.js";import{n as i}from"./trpc-client-QrVjRqP1.js";import{t as a}from"./map-pin-DbTySZl1.js";t();var o=e();function s(){let e=i.useUtils(),{data:t}=i.user.address.getUserAddresses.useQuery(),s=i.user.address.deleteAddress.useMutation({onSuccess:()=>e.user.address.getUserAddresses.invalidate()}),c=t?.data||[];return(0,o.jsxs)(n,{children:[(0,o.jsx)(r,{weight:`bold`,className:`mb-4 text-xl`,children:`My Addresses`}),c.length===0?(0,o.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-20`,children:[(0,o.jsx)(a,{className:`h-12 w-12 text-gray-300`}),(0,o.jsx)(r,{className:`text-gray-500`,children:`No addresses saved`})]}):(0,o.jsx)(`div`,{className:`flex flex-col gap-3`,children:c.map(e=>(0,o.jsx)(`div`,{className:`rounded-xl border border-gray-100 bg-white p-4 shadow-sm`,children:(0,o.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,o.jsxs)(`div`,{className:`flex-1`,children:[(0,o.jsx)(r,{weight:`semibold`,children:e.name}),(0,o.jsxs)(r,{className:`text-sm text-gray-600`,children:[e.addressLine1,e.addressLine2?`, ${e.addressLine2}`:``]}),(0,o.jsxs)(r,{className:`text-sm text-gray-600`,children:[e.city,`, `,e.state,` - `,e.pincode]}),(0,o.jsx)(r,{className:`text-sm text-gray-500`,children:e.phone}),e.isDefault&&(0,o.jsx)(`span`,{className:`mt-1 inline-block rounded-full bg-brand-100 px-2 py-0.5 text-xs text-brand-700`,children:`Default`})]}),(0,o.jsx)(`button`,{onClick:()=>s.mutate({id:e.id}),className:`text-sm text-red-500 hover:text-red-700`,children:`Delete`})]})},e.id))})]})}export{s as component};

View file

@ -0,0 +1 @@
import{d as e,f as t,h as n,l as r,s as i,t as a,u as o}from"./src-C0xjWfnx.js";import{n as s}from"./trpc-client-QrVjRqP1.js";import{t as c}from"./createLucideIcon-7nArgiy8.js";import{t as l}from"./message-square-BE-hnHXL.js";var u=c(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),d=n(t()),f=e();function p(){let{data:e}=s.user.complaint.getAll.useQuery(),t=s.user.complaint.raise.useMutation(),n=s.useUtils(),[c,p]=(0,d.useState)(!1),[m,h]=(0,d.useState)(``),g=e?.data||[];return(0,f.jsxs)(a,{children:[(0,f.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,f.jsx)(o,{weight:`bold`,className:`text-xl`,children:`Help & Complaints`}),(0,f.jsxs)(i,{onClick:()=>p(!c),className:`flex items-center gap-1 text-brand-600`,children:[(0,f.jsx)(u,{className:`h-4 w-4`}),(0,f.jsx)(o,{className:`text-sm`,children:`New`})]})]}),c&&(0,f.jsxs)(`div`,{className:`mb-6 rounded-xl border border-gray-100 bg-white p-4 shadow-sm`,children:[(0,f.jsx)(o,{weight:`semibold`,className:`mb-3`,children:`Raise a Complaint`}),(0,f.jsx)(`textarea`,{className:`mb-3 min-h-24 w-full rounded-lg border border-gray-200 p-3 text-sm`,value:m,onChange:e=>h(e.target.value),placeholder:`Describe your issue...`,rows:4}),(0,f.jsx)(r,{onClick:()=>{m.trim()&&t.mutate({body:m.trim()},{onSuccess:()=>{h(``),p(!1),n.user.complaint.getAll.invalidate()}})},disabled:t.isPending||!m.trim(),textContent:t.isPending?`Submitting...`:`Submit`})]}),g.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-20`,children:[(0,f.jsx)(l,{className:`h-12 w-12 text-gray-300`}),(0,f.jsx)(o,{className:`text-gray-500`,children:`No complaints yet`})]}):(0,f.jsx)(`div`,{className:`flex flex-col gap-3`,children:g.map(e=>(0,f.jsxs)(`div`,{className:`rounded-xl border border-gray-100 bg-white p-4 shadow-sm`,children:[(0,f.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,f.jsx)(`span`,{className:`rounded-full px-2 py-0.5 text-xs font-medium ${e.status===`resolved`?`bg-green-100 text-green-700`:`bg-yellow-100 text-yellow-700`}`,children:e.status||`pending`}),(0,f.jsx)(o,{className:`text-xs text-gray-400`,children:e.createdAt?new Date(e.createdAt).toLocaleDateString():``})]}),(0,f.jsx)(o,{className:`text-sm text-gray-700`,children:e.body}),e.adminResponse&&(0,f.jsx)(`div`,{className:`mt-2 rounded-lg bg-blue-50 p-2`,children:(0,f.jsxs)(o,{className:`text-xs text-blue-600`,children:[`Response: `,e.adminResponse]})})]},e.id))})]})}export{p as component};

View file

@ -0,0 +1 @@
import{c as e,d as t,f as n,h as r,l as i,t as a,u as o}from"./src-C0xjWfnx.js";import{n as s}from"./trpc-client-QrVjRqP1.js";import{t as c}from"./ticket-DHIzx079.js";var l=r(n()),u=t();function d(){let[t,n]=(0,l.useState)(``),{data:r}=s.user.coupon.getMyCoupons.useQuery(),d=s.user.coupon.redeemReservedCoupon.useMutation(),f=s.useUtils(),p=r?.data||[];return(0,u.jsxs)(a,{children:[(0,u.jsx)(o,{weight:`bold`,className:`mb-4 text-xl`,children:`My Coupons`}),(0,u.jsxs)(`div`,{className:`mb-6 flex gap-2`,children:[(0,u.jsx)(e,{placeholder:`Enter coupon code`,value:t,onChange:e=>n(e.target.value),className:`flex-1`}),(0,u.jsx)(i,{onClick:()=>{t.trim()&&d.mutate({couponCode:t.trim()},{onSuccess:()=>{n(``),f.user.coupon.getMyCoupons.invalidate()}})},disabled:d.isPending||!t.trim(),textContent:d.isPending?`Redeeming...`:`Redeem`})]}),p.length===0?(0,u.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-20`,children:[(0,u.jsx)(c,{className:`h-12 w-12 text-gray-300`}),(0,u.jsx)(o,{className:`text-gray-500`,children:`No coupons yet`})]}):(0,u.jsx)(`div`,{className:`flex flex-col gap-3`,children:p.map(e=>(0,u.jsxs)(`div`,{className:`rounded-xl border border-dashed border-brand-200 bg-brand-50 p-4`,children:[(0,u.jsx)(o,{weight:`bold`,className:`text-brand-700`,children:e.code}),(0,u.jsx)(o,{className:`text-sm text-gray-600`,children:e.description||`${e.discountPercent||0}% off`}),e.expiresAt&&(0,u.jsxs)(o,{className:`mt-1 text-xs text-gray-400`,children:[`Expires: `,new Date(e.expiresAt).toLocaleDateString()]})]},e.id))})]})}export{d as component};

View file

@ -0,0 +1 @@
import{c as e,d as t,f as n,h as r,l as i,t as a,u as o}from"./src-C0xjWfnx.js";import{t as s}from"./useNavigate-VRicZWJI.js";import{n as c}from"./trpc-client-QrVjRqP1.js";import{l}from"./index-BXnbw4dQ.js";var u=r(n()),d=t();function f(){s();let{user:t,logout:n,loginWithToken:r}=l(),[f,p]=(0,u.useState)(t?.name||``),[m,h]=(0,u.useState)(t?.email||``),g=c.user.auth.updateProfile.useMutation({onSuccess:e=>{e.token&&e.user&&r(e.token,e.user)}}),_=c.user.auth.deleteAccount.useMutation({onSuccess:()=>n()});return(0,d.jsxs)(a,{children:[(0,d.jsx)(o,{weight:`bold`,className:`mb-4 text-xl`,children:`Edit Profile`}),(0,d.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),g.mutate({name:f,email:m})},className:`flex flex-col gap-4`,children:[(0,d.jsx)(e,{placeholder:`Name`,value:f,onChange:e=>p(e.target.value)}),(0,d.jsx)(e,{placeholder:`Email`,type:`email`,value:m,onChange:e=>h(e.target.value)}),(0,d.jsx)(e,{placeholder:`Mobile`,value:t?.mobile||``,disabled:!0,className:`bg-gray-50`}),(0,d.jsx)(i,{type:`submit`,fullWidth:!0,disabled:g.isPending,textContent:g.isPending?`Saving...`:`Save Changes`,className:`bg-brand-500 text-white`})]}),(0,d.jsxs)(`div`,{className:`mt-8 border-t border-gray-200 pt-8`,children:[(0,d.jsx)(i,{fullWidth:!0,variant:`red`,onClick:()=>n(),textContent:`Logout`}),(0,d.jsx)(i,{fullWidth:!0,variant:`red`,onClick:()=>{window.confirm(`Are you sure you want to delete your account?`)&&_.mutate({mobile:t?.mobile||``})},disabled:_.isPending,textContent:_.isPending?`Deleting...`:`Delete My Account`,className:`mt-3 bg-red-600 text-white`})]})]})}export{f as component};

View file

@ -0,0 +1 @@
import{d as e,s as t,t as n,u as r}from"./src-C0xjWfnx.js";import{t as i}from"./useNavigate-VRicZWJI.js";import{n as a}from"./trpc-client-QrVjRqP1.js";import{t as o}from"./createLucideIcon-7nArgiy8.js";import{t as s}from"./package-CgMILU3n.js";var c=o(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),l=e();function u(){let e=i(),{data:o}=a.user.order.getOrders.useQuery({page:0,limit:20}),u=o?.data||[];return(0,l.jsxs)(n,{children:[(0,l.jsx)(r,{weight:`bold`,className:`mb-4 text-xl`,children:`My Orders`}),u.length===0?(0,l.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-20`,children:[(0,l.jsx)(s,{className:`h-12 w-12 text-gray-300`}),(0,l.jsx)(r,{className:`text-gray-500`,children:`No orders yet`})]}):(0,l.jsx)(`div`,{className:`flex flex-col gap-3`,children:u.map(n=>(0,l.jsxs)(t,{onClick:()=>e({to:`/me/orders/$id`,params:{id:String(n.id)}}),className:`rounded-xl border border-gray-100 bg-white p-4 shadow-sm`,children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsxs)(r,{weight:`semibold`,className:`text-sm`,children:[`Order #`,n.id]}),(0,l.jsx)(r,{className:`text-xs text-gray-500`,children:n.createdAt?new Date(n.createdAt).toLocaleDateString():``})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`rounded-full px-2 py-0.5 text-xs font-medium ${n.status===`delivered`?`bg-green-100 text-green-700`:n.status===`cancelled`?`bg-red-100 text-red-700`:`bg-yellow-100 text-yellow-700`}`,children:n.status}),(0,l.jsx)(c,{className:`h-4 w-4 text-gray-400`})]})]}),(0,l.jsxs)(r,{className:`mt-1 text-xs text-gray-400`,children:[`Total: ₹`,n.totalAmount||0]})]},n.id))})]})}export{u as component};

View file

@ -0,0 +1 @@
import{d as e,f as t,h as n,l as r,o as i,s as a,t as o,u as s}from"./src-C0xjWfnx.js";import{t as c}from"./useNavigate-VRicZWJI.js";import{n as l}from"./trpc-client-QrVjRqP1.js";import{t as u}from"./arrow-left-9Wn53Zfu.js";import{i as d}from"./index-BXnbw4dQ.js";var f=n(t()),p=e();function m(){let{id:e}=d.useParams(),t=c(),n=Number(e),[m,h]=(0,f.useState)(!1),{data:g}=l.user.order.getOrderById.useQuery({orderId:n}),_=l.user.order.cancelOrder.useMutation(),v=g?.data;return v?(0,p.jsxs)(o,{children:[(0,p.jsxs)(a,{onClick:()=>t({to:`/me/orders`}),className:`mb-4 flex items-center gap-2`,children:[(0,p.jsx)(u,{className:`h-5 w-5`}),(0,p.jsx)(s,{children:`Back to Orders`})]}),(0,p.jsxs)(`div`,{className:`mb-4`,children:[(0,p.jsxs)(s,{weight:`bold`,className:`text-xl`,children:[`Order #`,v.id]}),(0,p.jsx)(`span`,{className:`mt-1 inline-block rounded-full px-3 py-1 text-xs font-medium ${v.status===`delivered`?`bg-green-100 text-green-700`:v.status===`cancelled`?`bg-red-100 text-red-700`:`bg-yellow-100 text-yellow-700`}`,children:v.status})]}),(0,p.jsxs)(`div`,{className:`mb-6`,children:[(0,p.jsx)(s,{weight:`semibold`,className:`mb-2`,children:`Items`}),(v.items||[]).map((e,t)=>(0,p.jsxs)(`div`,{className:`flex items-center justify-between border-b border-gray-100 py-2`,children:[(0,p.jsxs)(s,{className:`text-sm`,children:[e.product?.name||`Product #${e.productId}`,` x`,e.quantity]}),(0,p.jsxs)(s,{className:`text-sm font-bold`,children:[``,e.price||0]})]},t)),(0,p.jsxs)(`div`,{className:`flex items-center justify-between pt-2`,children:[(0,p.jsx)(s,{weight:`bold`,children:`Total`}),(0,p.jsxs)(s,{weight:`bold`,className:`text-brand-600`,children:[``,v.totalAmount||0]})]})]}),v.address&&(0,p.jsxs)(`div`,{className:`mb-6`,children:[(0,p.jsx)(s,{weight:`semibold`,className:`mb-2`,children:`Delivery Address`}),(0,p.jsxs)(`div`,{className:`rounded-xl border border-gray-100 bg-gray-50 p-3`,children:[(0,p.jsx)(s,{weight:`semibold`,children:v.address.name}),(0,p.jsxs)(s,{className:`text-sm text-gray-600`,children:[v.address.addressLine1,`, `,v.address.city]}),(0,p.jsx)(s,{className:`text-sm text-gray-500`,children:v.address.phone})]})]}),v.status!==`cancelled`&&v.status!==`delivered`&&(0,p.jsx)(r,{variant:`red`,fullWidth:!0,textContent:_.isPending?`Cancelling...`:`Cancel Order`,onClick:()=>h(!0),disabled:_.isPending}),m&&(0,p.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,children:(0,p.jsxs)(`div`,{className:`mx-4 w-full max-w-sm rounded-xl bg-white p-6`,children:[(0,p.jsx)(s,{weight:`bold`,className:`mb-2 text-lg`,children:`Cancel Order?`}),(0,p.jsx)(s,{className:`mb-6 text-sm text-gray-600`,children:`Are you sure you want to cancel this order?`}),(0,p.jsxs)(`div`,{className:`flex gap-3`,children:[(0,p.jsx)(r,{textContent:`No, Keep It`,onClick:()=>h(!1),className:`flex-1 bg-gray-100 text-gray-700`}),(0,p.jsx)(r,{variant:`red`,textContent:`Yes, Cancel`,onClick:()=>{_.mutate({orderId:n},{onSuccess:()=>h(!1)})},className:`flex-1`,disabled:_.isPending})]})]})}),(0,p.jsx)(i,{open:_.isPending,message:`Cancelling order...`})]}):(0,p.jsx)(o,{children:(0,p.jsx)(s,{children:`Loading...`})})}export{m as component};

View file

@ -0,0 +1 @@
import{d as e,t,u as n}from"./src-C0xjWfnx.js";var r=e();function i(){return(0,r.jsxs)(t,{children:[(0,r.jsx)(n,{weight:`bold`,className:`mb-6 text-2xl`,children:`Terms & Conditions`}),(0,r.jsxs)(`div`,{className:`prose prose-sm max-w-none text-gray-600`,children:[(0,r.jsx)(n,{weight:`semibold`,className:`mb-2 mt-4 text-gray-900`,children:`1. Acceptance of Terms`}),(0,r.jsx)(n,{className:`mb-4`,children:`By using Freshyo, you agree to these terms. If you do not agree, please do not use our service.`}),(0,r.jsx)(n,{weight:`semibold`,className:`mb-2 mt-4 text-gray-900`,children:`2. Orders and Payments`}),(0,r.jsx)(n,{className:`mb-4`,children:`All orders are subject to availability. We reserve the right to cancel any order. Payments are collected at the time of delivery (COD).`}),(0,r.jsx)(n,{weight:`semibold`,className:`mb-2 mt-4 text-gray-900`,children:`3. Delivery Policy`}),(0,r.jsx)(n,{className:`mb-4`,children:`Delivery times are estimates. We strive to deliver within the promised time window but delays may occur due to unforeseen circumstances.`}),(0,r.jsx)(n,{weight:`semibold`,className:`mb-2 mt-4 text-gray-900`,children:`4. Returns and Refunds`}),(0,r.jsx)(n,{className:`mb-4`,children:`If you are not satisfied with the quality of your order, please contact us within 24 hours of delivery. Refunds will be processed after quality assessment.`}),(0,r.jsx)(n,{weight:`semibold`,className:`mb-2 mt-4 text-gray-900`,children:`5. Privacy`}),(0,r.jsx)(n,{className:`mb-4`,children:`We respect your privacy. Your personal information is used only for order processing and delivery purposes.`})]})]})}export{i as component};

View file

@ -0,0 +1 @@
import{t as e}from"./createLucideIcon-7nArgiy8.js";var t=e(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]);export{t};

View file

@ -0,0 +1 @@
import{t as e}from"./createLucideIcon-7nArgiy8.js";var t=e(`Package`,[[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]);export{t};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
import{f as e,h as t}from"./src-C0xjWfnx.js";var n=t(e(),1),r=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},i=(e=>e?r(e):r),a=e=>e;function o(e,t=a){let r=n.useSyncExternalStore(e.subscribe,n.useCallback(()=>t(e.getState()),[e,t]),n.useCallback(()=>t(e.getInitialState()),[e,t]));return n.useDebugValue(r),r}var s=e=>{let t=i(e),n=e=>o(t,e);return Object.assign(n,t),n},c=(e=>e?s(e):s);export{c as t};

View file

@ -0,0 +1 @@
import{c as e,d as t,f as n,h as r,l as i,u as a}from"./src-C0xjWfnx.js";import{t as o}from"./useNavigate-VRicZWJI.js";import{n as s}from"./trpc-client-QrVjRqP1.js";import{l as c}from"./index-BXnbw4dQ.js";var l=r(n()),u=t();function d(){let{register:t}=c(),n=o(),[r,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(``),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(``),v=s.user.auth.register.useMutation({onSuccess:e=>{e.token&&e.user&&(t(e.token,e.user),n({to:`/home`}))}});return(0,u.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-gradient-to-b from-brand-400 to-brand-700 p-4`,children:(0,u.jsxs)(`div`,{className:`w-full max-w-md`,children:[(0,u.jsx)(a,{weight:`bold`,className:`mb-2 text-center text-4xl text-white`,children:`Create Account`}),(0,u.jsx)(a,{className:`mb-8 text-center text-lg text-blue-100`,children:`Join Freshyo today`}),(0,u.jsx)(`div`,{className:`rounded-2xl bg-white p-8 shadow-xl`,children:(0,u.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),v.mutate({name:r,email:f,mobile:m,password:g})},className:`flex flex-col gap-4`,children:[(0,u.jsx)(e,{placeholder:`Full Name`,value:r,onChange:e=>d(e.target.value),required:!0}),(0,u.jsx)(e,{placeholder:`Email`,type:`email`,value:f,onChange:e=>p(e.target.value)}),(0,u.jsx)(e,{placeholder:`Mobile Number`,value:m,onChange:e=>{let t=e.target.value.replace(/\D/g,``);t.length<=10&&h(t)},required:!0}),(0,u.jsx)(e,{placeholder:`Password`,type:`password`,value:g,onChange:e=>_(e.target.value),required:!0}),(0,u.jsx)(i,{type:`submit`,fullWidth:!0,className:`mt-2 h-12 rounded-xl bg-brand-600 text-white shadow-lg`,disabled:v.isPending,textContent:v.isPending?`Creating...`:`Register`})]})})]})})}export{d as component};

View file

@ -0,0 +1 @@
import{t as e}from"./createLucideIcon-7nArgiy8.js";var t=e(`ShoppingCart`,[[`circle`,{cx:`8`,cy:`21`,r:`1`,key:`jimo8o`}],[`circle`,{cx:`19`,cy:`21`,r:`1`,key:`13723u`}],[`path`,{d:`M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12`,key:`9zh506`}]]);export{t};

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
import{d as e,s as t,t as n,u as r}from"./src-C0xjWfnx.js";import{t as i}from"./useNavigate-VRicZWJI.js";import{t as a}from"./createLucideIcon-7nArgiy8.js";import{a as o}from"./prominent-api-hooks-DipwWw0H.js";var s=a(`Store`,[[`path`,{d:`m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7`,key:`ztvudi`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}],[`path`,{d:`M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4`,key:`2ebpfo`}],[`path`,{d:`M2 7h20`,key:`1fcdvo`}],[`path`,{d:`M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7`,key:`6c3vgh`}]]),c=e();function l(){let e=i(),{data:a}=o(),l=a?.data||[];return(0,c.jsxs)(n,{children:[(0,c.jsx)(r,{weight:`bold`,className:`mb-4 text-xl`,children:`Our Stores`}),(0,c.jsx)(`div`,{className:`grid grid-cols-2 gap-4`,children:l.map(n=>(0,c.jsxs)(t,{onClick:()=>e({to:`/stores/$storeId`,params:{storeId:String(n.id)}}),className:`rounded-xl border border-gray-100 bg-white p-4 shadow-sm`,children:[(0,c.jsx)(`div`,{className:`mb-3 flex h-32 w-full items-center justify-center overflow-hidden rounded-lg bg-gray-100`,children:n.imageUrl?(0,c.jsx)(`img`,{src:n.imageUrl,alt:n.name,className:`h-full w-full object-cover`}):(0,c.jsx)(s,{className:`h-10 w-10 text-gray-400`})}),(0,c.jsx)(r,{weight:`semibold`,className:`text-sm`,children:n.name}),(0,c.jsxs)(r,{className:`text-xs text-gray-500`,children:[n.productCount||0,` products`]})]},n.id))})]})}export{l as component};

View file

@ -0,0 +1 @@
import{d as e,f as t,h as n,s as r,t as i,u as a}from"./src-C0xjWfnx.js";import{t as o}from"./useNavigate-VRicZWJI.js";import{t as s}from"./arrow-left-9Wn53Zfu.js";import{c}from"./index-BXnbw4dQ.js";import{i as l}from"./prominent-api-hooks-DipwWw0H.js";var u=n(t()),d=e();function f(){let{storeId:e}=c.useParams(),t=o(),{data:n}=l(Number(e)),[f,p]=(0,u.useState)(null),m=n?.store,h=n?.products||[],g=(0,u.useMemo)(()=>{let e=new Set;return h.forEach(t=>{let n=t.category||`All`;e.add(n)}),[`All`,...Array.from(e)]},[h]),_=(0,u.useMemo)(()=>!f||f===`All`?h:h.filter(e=>(e.category||`All`)===f),[h,f]);return(0,d.jsxs)(i,{children:[(0,d.jsxs)(`div`,{className:`mb-4 flex items-center gap-3`,children:[(0,d.jsx)(r,{onClick:()=>t({to:`/stores`}),children:(0,d.jsx)(s,{className:`h-5 w-5`})}),(0,d.jsx)(a,{weight:`bold`,className:`text-xl`,children:m?.name||`Store`})]}),(0,d.jsx)(`div`,{className:`mb-4 flex gap-2 overflow-x-auto pb-2`,children:g.map(e=>(0,d.jsx)(`button`,{onClick:()=>p(e===`All`?null:e),className:`whitespace-nowrap rounded-full px-4 py-1.5 text-sm ${e===`All`&&!f||f===e?`bg-brand-500 text-white`:`bg-gray-100 text-gray-600`}`,children:e},e))}),(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:_.map(n=>(0,d.jsxs)(r,{onClick:()=>t({to:`/stores/$storeId/product/$productId`,params:{storeId:e,productId:String(n.id)}}),className:`rounded-xl border border-gray-100 bg-white p-3 shadow-sm`,children:[(0,d.jsx)(`div`,{className:`mb-2 aspect-square w-full overflow-hidden rounded-lg bg-gray-100`,children:n.images?.[0]&&(0,d.jsx)(`img`,{src:n.images[0].uri,alt:n.name,className:`h-full w-full object-cover`})}),(0,d.jsx)(a,{weight:`semibold`,className:`text-sm`,numberOfLines:2,children:n.name}),(0,d.jsxs)(a,{weight:`bold`,className:`mt-1 text-brand-600`,children:[``,n.discountedPrice??n.price]})]},n.id))})]})}export{f as component};

View file

@ -0,0 +1 @@
import{d as e,f as t,h as n,l as r,r as i,s as a,t as o,u as s}from"./src-C0xjWfnx.js";import{t as c}from"./useNavigate-VRicZWJI.js";import{t as l}from"./arrow-left-9Wn53Zfu.js";import{t as u}from"./shopping-cart-BBNoSjWE.js";import{t as d}from"./index-BXnbw4dQ.js";import{n as f}from"./cart-query-hooks-BCr0eax3.js";import{t as p}from"./central-product-store-DGoerB5U.js";var m=n(t()),h=e();function g(){let{productId:e,storeId:t}=d.useParams(),n=Number(e),g=c(),[_,v]=(0,m.useState)(1),y=p(e=>e.productsById)[n],b=f(`regular`),x=()=>{y&&b.mutate({productId:y.id,quantity:_,storeId:y.storeId},{onSuccess:()=>g({to:`/cart`})})};if(!y)return(0,h.jsx)(o,{children:(0,h.jsx)(s,{children:`Product not found`})});let S=y.discountedPrice??y.price,C=y.images?.[0];return(0,h.jsxs)(o,{children:[(0,h.jsx)(a,{onClick:()=>g({to:`/stores/$storeId`,params:{storeId:t}}),className:`mb-4 flex items-center gap-2`,children:(0,h.jsx)(l,{className:`h-5 w-5`})}),C&&(0,h.jsx)(`div`,{className:`mb-4 aspect-square w-full overflow-hidden rounded-xl bg-gray-100`,children:(0,h.jsx)(`img`,{src:C,alt:y.name,className:`h-full w-full object-cover`})}),(0,h.jsx)(s,{weight:`bold`,className:`mb-1 text-xl`,children:y.name}),(0,h.jsxs)(s,{className:`mb-2 text-sm text-gray-500`,children:[y.unitValue,y.unit]}),(0,h.jsxs)(`div`,{className:`mb-4 flex items-baseline gap-2`,children:[(0,h.jsxs)(s,{weight:`bold`,className:`text-2xl text-brand-600`,children:[``,S]}),y.discountedPrice&&(0,h.jsxs)(s,{className:`text-sm text-gray-400 line-through`,children:[``,y.price]})]}),y.description&&(0,h.jsx)(s,{className:`mb-4 text-gray-600`,children:y.description}),(0,h.jsx)(`div`,{className:`mb-6`,children:(0,h.jsx)(i,{value:_,setValue:v,max:10})}),(0,h.jsxs)(r,{fullWidth:!0,onClick:x,disabled:b.isPending,className:`flex items-center justify-center gap-2 bg-brand-500 text-white`,children:[(0,h.jsx)(u,{className:`h-4 w-4`}),b.isPending?`Adding...`:`Add to Cart`]})]})}export{g as component};

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
import{t as e}from"./createLucideIcon-7nArgiy8.js";var t=e(`Ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]);export{t};

View file

@ -0,0 +1 @@
import{t as e}from"./createLucideIcon-7nArgiy8.js";var t=e(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]);export{t};

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
import{t as e}from"./createLucideIcon-7nArgiy8.js";var t=e(`Truck`,[[`path`,{d:`M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2`,key:`wrbu53`}],[`path`,{d:`M15 18H9`,key:`1lyqi6`}],[`path`,{d:`M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14`,key:`lysw3i`}],[`circle`,{cx:`17`,cy:`18`,r:`2`,key:`332jqn`}],[`circle`,{cx:`7`,cy:`18`,r:`2`,key:`19iecd`}]]);export{t};

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
import{f as e,h as t}from"./src-C0xjWfnx.js";var n=t(e(),1),r=n.use,i=typeof window<`u`?n.useLayoutEffect:n.useEffect;function a(e){let t=n.useRef({value:e,prev:null}),r=t.current.value;return e!==r&&(t.current={value:e,prev:r}),t.current.prev}function o(e,t,r={},i={}){n.useEffect(()=>{if(!e.current||i.disabled||typeof IntersectionObserver!=`function`)return;let n=new IntersectionObserver(([e])=>{t(e)},r);return n.observe(e.current),()=>{n.disconnect()}},[t,r,i.disabled,e])}function s(e){let t=n.useRef(null);return n.useImperativeHandle(e,()=>t.current,[]),t}var c=n.createContext(null);function l(e){return n.useContext(c)}function u(e){let t=l();return n.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}export{s as a,a as c,r as i,l as n,o,c as r,i as s,u as t};

View file

@ -0,0 +1 @@
import{t as e}from"./createLucideIcon-7nArgiy8.js";var t=e(`Zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]);export{t};

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View file

@ -0,0 +1,25 @@
{
"short_name": "TanStack App",
"name": "Create TanStack App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View file

@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

View file

@ -0,0 +1,5 @@
//#region node_modules/.nitro/vite/services/ssr/assets/__23tanstack-start-plugin-adapters-y_fshQDY.js
var pluginSerializationAdapters = [];
var hasPluginAdapters = false;
//#endregion
export { hasPluginAdapters, pluginSerializationAdapters };

View file

@ -0,0 +1,15 @@
import { n as HTTPError, o as toRequest } from "../_libs/h3+rou3+srvx.mjs";
//#region node_modules/nitro/dist/runtime/vite.mjs
function fetchViteEnv(viteEnvName, input, init) {
const viteEnv = (globalThis.__nitro_vite_envs__ || {})[viteEnvName];
if (!viteEnv) throw HTTPError.status(404);
return Promise.resolve(viteEnv.fetch(toRequest(input, init)));
}
//#endregion
//#region node_modules/nitro/dist/runtime/internal/vite/ssr-renderer.mjs
/** @param {{ req: Request }} HTTPEvent */
function ssrRenderer({ req }) {
return fetchViteEnv("ssr", req);
}
//#endregion
export { ssrRenderer as default };

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,259 @@
import { t as __commonJSMin } from "../_runtime.mjs";
//#region node_modules/asynckit/lib/defer.js
var require_defer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
module.exports = defer;
/**
* Runs provided function on next iteration of the event loop
*
* @param {function} fn - function to run
*/
function defer(fn) {
var nextTick = typeof setImmediate == "function" ? setImmediate : typeof process == "object" && typeof process.nextTick == "function" ? process.nextTick : null;
if (nextTick) nextTick(fn);
else setTimeout(fn, 0);
}
}));
//#endregion
//#region node_modules/asynckit/lib/async.js
var require_async = /* @__PURE__ */ __commonJSMin(((exports, module) => {
var defer = require_defer();
module.exports = async;
/**
* Runs provided callback asynchronously
* even if callback itself is not
*
* @param {function} callback - callback to invoke
* @returns {function} - augmented callback
*/
function async(callback) {
var isAsync = false;
defer(function() {
isAsync = true;
});
return function async_callback(err, result) {
if (isAsync) callback(err, result);
else defer(function nextTick_callback() {
callback(err, result);
});
};
}
}));
//#endregion
//#region node_modules/asynckit/lib/abort.js
var require_abort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
module.exports = abort;
/**
* Aborts leftover active jobs
*
* @param {object} state - current state object
*/
function abort(state) {
Object.keys(state.jobs).forEach(clean.bind(state));
state.jobs = {};
}
/**
* Cleans up leftover job by invoking abort function for the provided job id
*
* @this state
* @param {string|number} key - job id to abort
*/
function clean(key) {
if (typeof this.jobs[key] == "function") this.jobs[key]();
}
}));
//#endregion
//#region node_modules/asynckit/lib/iterate.js
var require_iterate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
var async = require_async(), abort = require_abort();
module.exports = iterate;
/**
* Iterates over each job object
*
* @param {array|object} list - array or object (named list) to iterate over
* @param {function} iterator - iterator to run
* @param {object} state - current job status
* @param {function} callback - invoked when all elements processed
*/
function iterate(list, iterator, state, callback) {
var key = state["keyedList"] ? state["keyedList"][state.index] : state.index;
state.jobs[key] = runJob(iterator, key, list[key], function(error, output) {
if (!(key in state.jobs)) return;
delete state.jobs[key];
if (error) abort(state);
else state.results[key] = output;
callback(error, state.results);
});
}
/**
* Runs iterator over provided job element
*
* @param {function} iterator - iterator to invoke
* @param {string|number} key - key/index of the element in the list of jobs
* @param {mixed} item - job description
* @param {function} callback - invoked after iterator is done with the job
* @returns {function|mixed} - job abort function or something else
*/
function runJob(iterator, key, item, callback) {
var aborter;
if (iterator.length == 2) aborter = iterator(item, async(callback));
else aborter = iterator(item, key, async(callback));
return aborter;
}
}));
//#endregion
//#region node_modules/asynckit/lib/state.js
var require_state = /* @__PURE__ */ __commonJSMin(((exports, module) => {
module.exports = state;
/**
* Creates initial state object
* for iteration over list
*
* @param {array|object} list - list to iterate over
* @param {function|null} sortMethod - function to use for keys sort,
* or `null` to keep them as is
* @returns {object} - initial state object
*/
function state(list, sortMethod) {
var isNamedList = !Array.isArray(list), initState = {
index: 0,
keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
jobs: {},
results: isNamedList ? {} : [],
size: isNamedList ? Object.keys(list).length : list.length
};
if (sortMethod) initState.keyedList.sort(isNamedList ? sortMethod : function(a, b) {
return sortMethod(list[a], list[b]);
});
return initState;
}
}));
//#endregion
//#region node_modules/asynckit/lib/terminator.js
var require_terminator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
var abort = require_abort(), async = require_async();
module.exports = terminator;
/**
* Terminates jobs in the attached state context
*
* @this AsyncKitState#
* @param {function} callback - final callback to invoke after termination
*/
function terminator(callback) {
if (!Object.keys(this.jobs).length) return;
this.index = this.size;
abort(this);
async(callback)(null, this.results);
}
}));
//#endregion
//#region node_modules/asynckit/parallel.js
var require_parallel = /* @__PURE__ */ __commonJSMin(((exports, module) => {
var iterate = require_iterate(), initState = require_state(), terminator = require_terminator();
module.exports = parallel;
/**
* Runs iterator over provided array elements in parallel
*
* @param {array|object} list - array or object (named list) to iterate over
* @param {function} iterator - iterator to run
* @param {function} callback - invoked when all elements processed
* @returns {function} - jobs terminator
*/
function parallel(list, iterator, callback) {
var state = initState(list);
while (state.index < (state["keyedList"] || list).length) {
iterate(list, iterator, state, function(error, result) {
if (error) {
callback(error, result);
return;
}
if (Object.keys(state.jobs).length === 0) {
callback(null, state.results);
return;
}
});
state.index++;
}
return terminator.bind(state, callback);
}
}));
//#endregion
//#region node_modules/asynckit/serialOrdered.js
var require_serialOrdered = /* @__PURE__ */ __commonJSMin(((exports, module) => {
var iterate = require_iterate(), initState = require_state(), terminator = require_terminator();
module.exports = serialOrdered;
module.exports.ascending = ascending;
module.exports.descending = descending;
/**
* Runs iterator over provided sorted array elements in series
*
* @param {array|object} list - array or object (named list) to iterate over
* @param {function} iterator - iterator to run
* @param {function} sortMethod - custom sort function
* @param {function} callback - invoked when all elements processed
* @returns {function} - jobs terminator
*/
function serialOrdered(list, iterator, sortMethod, callback) {
var state = initState(list, sortMethod);
iterate(list, iterator, state, function iteratorHandler(error, result) {
if (error) {
callback(error, result);
return;
}
state.index++;
if (state.index < (state["keyedList"] || list).length) {
iterate(list, iterator, state, iteratorHandler);
return;
}
callback(null, state.results);
});
return terminator.bind(state, callback);
}
/**
* sort helper to sort array elements in ascending order
*
* @param {mixed} a - an item to compare
* @param {mixed} b - an item to compare
* @returns {number} - comparison result
*/
function ascending(a, b) {
return a < b ? -1 : a > b ? 1 : 0;
}
/**
* sort helper to sort array elements in descending order
*
* @param {mixed} a - an item to compare
* @param {mixed} b - an item to compare
* @returns {number} - comparison result
*/
function descending(a, b) {
return -1 * ascending(a, b);
}
}));
//#endregion
//#region node_modules/asynckit/serial.js
var require_serial = /* @__PURE__ */ __commonJSMin(((exports, module) => {
var serialOrdered = require_serialOrdered();
module.exports = serial;
/**
* Runs iterator over provided array elements in series
*
* @param {array|object} list - array or object (named list) to iterate over
* @param {function} iterator - iterator to run
* @param {function} callback - invoked when all elements processed
* @returns {function} - jobs terminator
*/
function serial(list, iterator, callback) {
return serialOrdered(list, iterator, null, callback);
}
}));
//#endregion
//#region node_modules/asynckit/index.js
var require_asynckit = /* @__PURE__ */ __commonJSMin(((exports, module) => {
module.exports = {
parallel: require_parallel(),
serial: require_serial(),
serialOrdered: require_serialOrdered()
};
}));
//#endregion
export { require_asynckit as t };

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,16 @@
//#region node_modules/clsx/dist/clsx.mjs
function r(e) {
var t, f, n = "";
if ("string" == typeof e || "number" == typeof e) n += e;
else if ("object" == typeof e) if (Array.isArray(e)) {
var o = e.length;
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
} else for (f in e) e[f] && (n && (n += " "), n += f);
return n;
}
function clsx() {
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
return n;
}
//#endregion
export { clsx as t };

View file

@ -0,0 +1,300 @@
import { t as __commonJSMin } from "../_runtime.mjs";
//#region node_modules/dayjs/dayjs.min.js
var require_dayjs_min = /* @__PURE__ */ __commonJSMin(((exports, module) => {
(function(t, e) {
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
})(exports, (function() {
"use strict";
var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = {
name: "en",
weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
ordinal: function(t) {
var e = [
"th",
"st",
"nd",
"rd"
], n = t % 100;
return "[" + t + (e[(n - 20) % 10] || e[n] || e[0]) + "]";
}
}, m = function(t, e, n) {
var r = String(t);
return !r || r.length >= e ? t : "" + Array(e + 1 - r.length).join(n) + t;
}, v = {
s: m,
z: function(t) {
var e = -t.utcOffset(), n = Math.abs(e), r = Math.floor(n / 60), i = n % 60;
return (e <= 0 ? "+" : "-") + m(r, 2, "0") + ":" + m(i, 2, "0");
},
m: function t(e, n) {
if (e.date() < n.date()) return -t(n, e);
var r = 12 * (n.year() - e.year()) + (n.month() - e.month()), i = e.clone().add(r, c), s = n - i < 0, u = e.clone().add(r + (s ? -1 : 1), c);
return +(-(r + (n - i) / (s ? i - u : u - i)) || 0);
},
a: function(t) {
return t < 0 ? Math.ceil(t) || 0 : Math.floor(t);
},
p: function(t) {
return {
M: c,
y: h,
w: o,
d: a,
D: d,
h: u,
m: s,
s: i,
ms: r,
Q: f
}[t] || String(t || "").toLowerCase().replace(/s$/, "");
},
u: function(t) {
return void 0 === t;
}
}, g = "en", D = {};
D[g] = M;
var p = "$isDayjsObject", S = function(t) {
return t instanceof _ || !(!t || !t[p]);
}, w = function t(e, n, r) {
var i;
if (!e) return g;
if ("string" == typeof e) {
var s = e.toLowerCase();
D[s] && (i = s), n && (D[s] = n, i = s);
var u = e.split("-");
if (!i && u.length > 1) return t(u[0]);
} else {
var a = e.name;
D[a] = e, i = a;
}
return !r && i && (g = i), i || !r && g;
}, O = function(t, e) {
if (S(t)) return t.clone();
var n = "object" == typeof e ? e : {};
return n.date = t, n.args = arguments, new _(n);
}, b = v;
b.l = w, b.i = S, b.w = function(t, e) {
return O(t, {
locale: e.$L,
utc: e.$u,
x: e.$x,
$offset: e.$offset
});
};
var _ = function() {
function M(t) {
this.$L = w(t.locale, null, !0), this.parse(t), this.$x = this.$x || t.x || {}, this[p] = !0;
}
var m = M.prototype;
return m.parse = function(t) {
this.$d = function(t) {
var e = t.date, n = t.utc;
if (null === e) return /* @__PURE__ */ new Date(NaN);
if (b.u(e)) return /* @__PURE__ */ new Date();
if (e instanceof Date) return new Date(e);
if ("string" == typeof e && !/Z$/i.test(e)) {
var r = e.match($);
if (r) {
var i = r[2] - 1 || 0, s = (r[7] || "0").substring(0, 3);
return n ? new Date(Date.UTC(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s)) : new Date(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s);
}
}
return new Date(e);
}(t), this.init();
}, m.init = function() {
var t = this.$d;
this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds();
}, m.$utils = function() {
return b;
}, m.isValid = function() {
return !(this.$d.toString() === l);
}, m.isSame = function(t, e) {
var n = O(t);
return this.startOf(e) <= n && n <= this.endOf(e);
}, m.isAfter = function(t, e) {
return O(t) < this.startOf(e);
}, m.isBefore = function(t, e) {
return this.endOf(e) < O(t);
}, m.$g = function(t, e, n) {
return b.u(t) ? this[e] : this.set(n, t);
}, m.unix = function() {
return Math.floor(this.valueOf() / 1e3);
}, m.valueOf = function() {
return this.$d.getTime();
}, m.startOf = function(t, e) {
var n = this, r = !!b.u(e) || e, f = b.p(t), l = function(t, e) {
var i = b.w(n.$u ? Date.UTC(n.$y, e, t) : new Date(n.$y, e, t), n);
return r ? i : i.endOf(a);
}, $ = function(t, e) {
return b.w(n.toDate()[t].apply(n.toDate("s"), (r ? [
0,
0,
0,
0
] : [
23,
59,
59,
999
]).slice(e)), n);
}, y = this.$W, M = this.$M, m = this.$D, v = "set" + (this.$u ? "UTC" : "");
switch (f) {
case h: return r ? l(1, 0) : l(31, 11);
case c: return r ? l(1, M) : l(0, M + 1);
case o:
var g = this.$locale().weekStart || 0, D = (y < g ? y + 7 : y) - g;
return l(r ? m - D : m + (6 - D), M);
case a:
case d: return $(v + "Hours", 0);
case u: return $(v + "Minutes", 1);
case s: return $(v + "Seconds", 2);
case i: return $(v + "Milliseconds", 3);
default: return this.clone();
}
}, m.endOf = function(t) {
return this.startOf(t, !1);
}, m.$set = function(t, e) {
var n, o = b.p(t), f = "set" + (this.$u ? "UTC" : ""), l = (n = {}, n[a] = f + "Date", n[d] = f + "Date", n[c] = f + "Month", n[h] = f + "FullYear", n[u] = f + "Hours", n[s] = f + "Minutes", n[i] = f + "Seconds", n[r] = f + "Milliseconds", n)[o], $ = o === a ? this.$D + (e - this.$W) : e;
if (o === c || o === h) {
var y = this.clone().set(d, 1);
y.$d[l]($), y.init(), this.$d = y.set(d, Math.min(this.$D, y.daysInMonth())).$d;
} else l && this.$d[l]($);
return this.init(), this;
}, m.set = function(t, e) {
return this.clone().$set(t, e);
}, m.get = function(t) {
return this[b.p(t)]();
}, m.add = function(r, f) {
var d, l = this;
r = Number(r);
var $ = b.p(f), y = function(t) {
var e = O(l);
return b.w(e.date(e.date() + Math.round(t * r)), l);
};
if ($ === c) return this.set(c, this.$M + r);
if ($ === h) return this.set(h, this.$y + r);
if ($ === a) return y(1);
if ($ === o) return y(7);
var M = (d = {}, d[s] = e, d[u] = n, d[i] = t, d)[$] || 1, m = this.$d.getTime() + r * M;
return b.w(m, this);
}, m.subtract = function(t, e) {
return this.add(-1 * t, e);
}, m.format = function(t) {
var e = this, n = this.$locale();
if (!this.isValid()) return n.invalidDate || l;
var r = t || "YYYY-MM-DDTHH:mm:ssZ", i = b.z(this), s = this.$H, u = this.$m, a = this.$M, o = n.weekdays, c = n.months, f = n.meridiem, h = function(t, n, i, s) {
return t && (t[n] || t(e, r)) || i[n].slice(0, s);
}, d = function(t) {
return b.s(s % 12 || 12, t, "0");
}, $ = f || function(t, e, n) {
var r = t < 12 ? "AM" : "PM";
return n ? r.toLowerCase() : r;
};
return r.replace(y, (function(t, r) {
return r || function(t) {
switch (t) {
case "YY": return String(e.$y).slice(-2);
case "YYYY": return b.s(e.$y, 4, "0");
case "M": return a + 1;
case "MM": return b.s(a + 1, 2, "0");
case "MMM": return h(n.monthsShort, a, c, 3);
case "MMMM": return h(c, a);
case "D": return e.$D;
case "DD": return b.s(e.$D, 2, "0");
case "d": return String(e.$W);
case "dd": return h(n.weekdaysMin, e.$W, o, 2);
case "ddd": return h(n.weekdaysShort, e.$W, o, 3);
case "dddd": return o[e.$W];
case "H": return String(s);
case "HH": return b.s(s, 2, "0");
case "h": return d(1);
case "hh": return d(2);
case "a": return $(s, u, !0);
case "A": return $(s, u, !1);
case "m": return String(u);
case "mm": return b.s(u, 2, "0");
case "s": return String(e.$s);
case "ss": return b.s(e.$s, 2, "0");
case "SSS": return b.s(e.$ms, 3, "0");
case "Z": return i;
}
return null;
}(t) || i.replace(":", "");
}));
}, m.utcOffset = function() {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
}, m.diff = function(r, d, l) {
var $, y = this, M = b.p(d), m = O(r), v = (m.utcOffset() - this.utcOffset()) * e, g = this - m, D = function() {
return b.m(y, m);
};
switch (M) {
case h:
$ = D() / 12;
break;
case c:
$ = D();
break;
case f:
$ = D() / 3;
break;
case o:
$ = (g - v) / 6048e5;
break;
case a:
$ = (g - v) / 864e5;
break;
case u:
$ = g / n;
break;
case s:
$ = g / e;
break;
case i:
$ = g / t;
break;
default: $ = g;
}
return l ? $ : b.a($);
}, m.daysInMonth = function() {
return this.endOf(c).$D;
}, m.$locale = function() {
return D[this.$L];
}, m.locale = function(t, e) {
if (!t) return this.$L;
var n = this.clone(), r = w(t, e, !0);
return r && (n.$L = r), n;
}, m.clone = function() {
return b.w(this.$d, this);
}, m.toDate = function() {
return new Date(this.valueOf());
}, m.toJSON = function() {
return this.isValid() ? this.toISOString() : null;
}, m.toISOString = function() {
return this.$d.toISOString();
}, m.toString = function() {
return this.$d.toUTCString();
}, M;
}(), k = _.prototype;
return O.prototype = k, [
["$ms", r],
["$s", i],
["$m", s],
["$H", u],
["$W", a],
["$M", c],
["$y", h],
["$D", d]
].forEach((function(t) {
k[t[1]] = function(e) {
return this.$g(e, t[0], t[1]);
};
})), O.extend = function(t, e) {
return t.$i || (t(e, _, O), t.$i = !0), O;
}, O.locale = w, O.isDayjs = S, O.unix = function(t) {
return O(1e3 * t);
}, O.en = D[g], O.Ls = D, O.p = {}, O;
}));
}));
//#endregion
export { require_dayjs_min as t };

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,285 @@
import { c as NodeResponse, s as NullProtoObj, u as FastURL } from "./h3+rou3+srvx.mjs";
//#region node_modules/h3-v2/dist/h3-Bz4OPZv_.mjs
function decodePathname(pathname) {
return decodeURI(pathname.includes("%25") ? pathname.replace(/%25/g, "%2525") : pathname);
}
var kEventNS = "h3.internal.event.";
var kEventRes = /* @__PURE__ */ Symbol.for(`${kEventNS}res`);
var kEventResHeaders = /* @__PURE__ */ Symbol.for(`${kEventNS}res.headers`);
var kEventResErrHeaders = /* @__PURE__ */ Symbol.for(`${kEventNS}res.err.headers`);
var H3Event = class {
app;
req;
url;
context;
static __is_event__ = true;
constructor(req, context, app) {
this.context = context || req.context || new NullProtoObj();
this.req = req;
this.app = app;
const _url = req._url;
const url = _url && _url instanceof URL ? _url : new FastURL(req.url);
if (url.pathname.includes("%")) url.pathname = decodePathname(url.pathname);
this.url = url;
}
get res() {
return this[kEventRes] ||= new H3EventResponse();
}
get runtime() {
return this.req.runtime;
}
waitUntil(promise) {
this.req.waitUntil?.(promise);
}
toString() {
return `[${this.req.method}] ${this.req.url}`;
}
toJSON() {
return this.toString();
}
get node() {
return this.req.runtime?.node;
}
get headers() {
return this.req.headers;
}
get path() {
return this.url.pathname + this.url.search;
}
get method() {
return this.req.method;
}
};
var H3EventResponse = class {
status;
statusText;
get headers() {
return this[kEventResHeaders] ||= new Headers();
}
get errHeaders() {
return this[kEventResErrHeaders] ||= new Headers();
}
};
var DISALLOWED_STATUS_CHARS = /[^\u0009\u0020-\u007E]/g;
function sanitizeStatusMessage(statusMessage = "") {
return statusMessage.replace(DISALLOWED_STATUS_CHARS, "");
}
function sanitizeStatusCode(statusCode, defaultStatusCode = 200) {
if (!statusCode) return defaultStatusCode;
if (typeof statusCode === "string") statusCode = +statusCode;
if (statusCode < 100 || statusCode > 599) return defaultStatusCode;
return statusCode;
}
var HTTPError = class HTTPError extends Error {
get name() {
return "HTTPError";
}
status;
statusText;
headers;
cause;
data;
body;
unhandled;
static isError(input) {
return input instanceof Error && input?.name === "HTTPError";
}
static status(status, statusText, details) {
return new HTTPError({
...details,
statusText,
status
});
}
constructor(arg1, arg2) {
let messageInput;
let details;
if (typeof arg1 === "string") {
messageInput = arg1;
details = arg2;
} else details = arg1;
const status = sanitizeStatusCode(details?.status || details?.statusCode || (details?.cause)?.status || (details?.cause)?.statusCode, 500);
const statusText = sanitizeStatusMessage(details?.statusText || details?.statusMessage || (details?.cause)?.statusText || (details?.cause)?.statusMessage);
const message = messageInput || details?.message || (details?.cause)?.message || details?.statusText || details?.statusMessage || [
"HTTPError",
status,
statusText
].filter(Boolean).join(" ");
super(message, { cause: details });
this.cause = details;
this.status = status;
this.statusText = statusText || void 0;
const rawHeaders = details?.headers || (details?.cause)?.headers;
this.headers = rawHeaders ? new Headers(rawHeaders) : void 0;
this.unhandled = details?.unhandled ?? (details?.cause)?.unhandled ?? void 0;
this.data = details?.data;
this.body = details?.body;
}
get statusCode() {
return this.status;
}
get statusMessage() {
return this.statusText;
}
toJSON() {
const unhandled = this.unhandled;
return {
status: this.status,
statusText: this.statusText,
unhandled,
message: unhandled ? "HTTPError" : this.message,
data: unhandled ? void 0 : this.data,
...unhandled ? void 0 : this.body
};
}
};
function isJSONSerializable(value, _type) {
if (value === null || value === void 0) return true;
if (_type !== "object") return _type === "boolean" || _type === "number" || _type === "string";
if (typeof value.toJSON === "function") return true;
if (Array.isArray(value)) return true;
if (typeof value.pipe === "function" || typeof value.pipeTo === "function") return false;
if (value instanceof NullProtoObj) return true;
const proto = Object.getPrototypeOf(value);
return proto === Object.prototype || proto === null;
}
var kNotFound = /* @__PURE__ */ Symbol.for("h3.notFound");
var kHandled = /* @__PURE__ */ Symbol.for("h3.handled");
function toResponse(val, event, config = {}) {
if (typeof val?.then === "function") return (val.catch?.((error) => error) || Promise.resolve(val)).then((resolvedVal) => toResponse(resolvedVal, event, config));
const response = prepareResponse(val, event, config);
if (typeof response?.then === "function") return toResponse(response, event, config);
const { onResponse } = config;
return onResponse ? Promise.resolve(onResponse(response, event)).then(() => response) : response;
}
var HTTPResponse = class {
#headers;
#init;
body;
constructor(body, init) {
this.body = body;
this.#init = init;
}
get status() {
return this.#init?.status || 200;
}
get statusText() {
return this.#init?.statusText || "OK";
}
get headers() {
return this.#headers ||= new Headers(this.#init?.headers);
}
};
function prepareResponse(val, event, config, nested) {
if (val === kHandled) return new NodeResponse(null);
if (val === kNotFound) val = new HTTPError({
status: 404,
message: `Cannot find any route matching [${event.req.method}] ${event.url}`
});
if (val && val instanceof Error) {
const isHTTPError = HTTPError.isError(val);
const error = isHTTPError ? val : new HTTPError(val);
if (!isHTTPError) {
error.unhandled = true;
if (val?.stack) error.stack = val.stack;
}
if (error.unhandled && !config.silent) console.error(error);
const { onError } = config;
const errHeaders = event[kEventRes]?.[kEventResErrHeaders];
return onError && !nested ? Promise.resolve(onError(error, event)).catch((error) => error).then((newVal) => prepareResponse(newVal ?? val, event, config, true)) : errorResponse(error, config.debug, errHeaders);
}
const preparedRes = event[kEventRes];
const preparedHeaders = preparedRes?.[kEventResHeaders];
event[kEventRes] = void 0;
if (!(val instanceof Response)) {
const res = prepareResponseBody(val, event, config);
const status = res.status || preparedRes?.status;
return new NodeResponse(nullBody(event.req.method, status) ? null : res.body, {
status,
statusText: res.statusText || preparedRes?.statusText,
headers: res.headers && preparedHeaders ? mergeHeaders$1(res.headers, preparedHeaders) : res.headers || preparedHeaders
});
}
if (!preparedHeaders || nested || !val.ok) return val;
try {
mergeHeaders$1(val.headers, preparedHeaders, val.headers);
return val;
} catch {
return new NodeResponse(nullBody(event.req.method, val.status) ? null : val.body, {
status: val.status,
statusText: val.statusText,
headers: mergeHeaders$1(val.headers, preparedHeaders)
});
}
}
function mergeHeaders$1(base, overrides, target = new Headers(base)) {
for (const [name, value] of overrides) if (name === "set-cookie") target.append(name, value);
else target.set(name, value);
return target;
}
var frozen = (name) => (...args) => {
throw new Error(`Headers are frozen (${name} ${args.join(", ")})`);
};
var FrozenHeaders = class extends Headers {
set = frozen("set");
append = frozen("append");
delete = frozen("delete");
};
var emptyHeaders = /* @__PURE__ */ new FrozenHeaders({ "content-length": "0" });
var jsonHeaders = /* @__PURE__ */ new FrozenHeaders({ "content-type": "application/json;charset=UTF-8" });
function prepareResponseBody(val, event, config) {
if (val === null || val === void 0) return {
body: "",
headers: emptyHeaders
};
const valType = typeof val;
if (valType === "string") return { body: val };
if (val instanceof Uint8Array) {
event.res.headers.set("content-length", val.byteLength.toString());
return { body: val };
}
if (val instanceof HTTPResponse || val?.constructor?.name === "HTTPResponse") return val;
if (isJSONSerializable(val, valType)) return {
body: JSON.stringify(val, void 0, config.debug ? 2 : void 0),
headers: jsonHeaders
};
if (valType === "bigint") return {
body: val.toString(),
headers: jsonHeaders
};
if (val instanceof Blob) {
const headers = new Headers({
"content-type": val.type,
"content-length": val.size.toString()
});
let filename = val.name;
if (filename) {
filename = encodeURIComponent(filename);
headers.set("content-disposition", `filename="${filename}"; filename*=UTF-8''${filename}`);
}
return {
body: val.stream(),
headers
};
}
if (valType === "symbol") return { body: val.toString() };
if (valType === "function") return { body: `${val.name}()` };
return { body: val };
}
function nullBody(method, status) {
return method === "HEAD" || status === 100 || status === 101 || status === 102 || status === 204 || status === 205 || status === 304;
}
function errorResponse(error, debug, errHeaders) {
let headers = error.headers ? mergeHeaders$1(jsonHeaders, error.headers) : new Headers(jsonHeaders);
if (errHeaders) headers = mergeHeaders$1(headers, errHeaders);
return new NodeResponse(JSON.stringify({
...error.toJSON(),
stack: debug && error.stack ? error.stack.split("\n").map((l) => l.trim()) : void 0
}, void 0, debug ? 2 : void 0), {
status: error.status,
statusText: error.statusText,
headers
});
}
//#endregion
export { toResponse as n, H3Event as t };

View file

@ -0,0 +1,500 @@
import { o as __toESM } from "../_runtime.mjs";
import { h as require_react } from "./react+tanstack__react-query.mjs";
//#region node_modules/lucide-react/dist/esm/shared/src/utils.js
var import_react = /* @__PURE__ */ __toESM(require_react());
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
return Boolean(className) && array.indexOf(className) === index;
}).join(" ");
//#endregion
//#region node_modules/lucide-react/dist/esm/defaultAttributes.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var defaultAttributes = {
xmlns: "http://www.w3.org/2000/svg",
width: 24,
height: 24,
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: 2,
strokeLinecap: "round",
strokeLinejoin: "round"
};
//#endregion
//#region node_modules/lucide-react/dist/esm/Icon.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Icon = (0, import_react.forwardRef)(({ color = "currentColor", size = 24, strokeWidth = 2, absoluteStrokeWidth, className = "", children, iconNode, ...rest }, ref) => {
return (0, import_react.createElement)("svg", {
ref,
...defaultAttributes,
width: size,
height: size,
stroke: color,
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
className: mergeClasses("lucide", className),
...rest
}, [...iconNode.map(([tag, attrs]) => (0, import_react.createElement)(tag, attrs)), ...Array.isArray(children) ? children : [children]]);
});
//#endregion
//#region node_modules/lucide-react/dist/esm/createLucideIcon.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var createLucideIcon = (iconName, iconNode) => {
const Component = (0, import_react.forwardRef)(({ className, ...props }, ref) => (0, import_react.createElement)(Icon, {
ref,
iconNode,
className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),
...props
}));
Component.displayName = `${iconName}`;
return Component;
};
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/arrow-left.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var ArrowLeft = createLucideIcon("ArrowLeft", [["path", {
d: "m12 19-7-7 7-7",
key: "1l729n"
}], ["path", {
d: "M19 12H5",
key: "x3x0zl"
}]]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/chevron-right.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var ChevronRight = createLucideIcon("ChevronRight", [["path", {
d: "m9 18 6-6-6-6",
key: "mthhwq"
}]]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/file-text.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var FileText = createLucideIcon("FileText", [
["path", {
d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",
key: "1rqfz7"
}],
["path", {
d: "M14 2v4a2 2 0 0 0 2 2h4",
key: "tnqrlb"
}],
["path", {
d: "M10 9H8",
key: "b1mrlr"
}],
["path", {
d: "M16 13H8",
key: "t4e002"
}],
["path", {
d: "M16 17H8",
key: "z1uh3a"
}]
]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/heart.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Heart = createLucideIcon("Heart", [["path", {
d: "M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",
key: "c3ymky"
}]]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/info.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Info = createLucideIcon("Info", [
["circle", {
cx: "12",
cy: "12",
r: "10",
key: "1mglay"
}],
["path", {
d: "M12 16v-4",
key: "1dtifu"
}],
["path", {
d: "M12 8h.01",
key: "e9boi3"
}]
]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/leaf.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Leaf = createLucideIcon("Leaf", [["path", {
d: "M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z",
key: "nnexq3"
}], ["path", {
d: "M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12",
key: "mt58a7"
}]]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/map-pin.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var MapPin = createLucideIcon("MapPin", [["path", {
d: "M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",
key: "2oe9fu"
}], ["circle", {
cx: "12",
cy: "10",
r: "3",
key: "ilqhr7"
}]]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/message-square.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var MessageSquare = createLucideIcon("MessageSquare", [["path", {
d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",
key: "1lielz"
}]]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/minus.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Minus = createLucideIcon("Minus", [["path", {
d: "M5 12h14",
key: "1ays0h"
}]]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/package.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Package = createLucideIcon("Package", [
["path", {
d: "m7.5 4.27 9 5.15",
key: "1c824w"
}],
["path", {
d: "M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",
key: "hh9hay"
}],
["path", {
d: "m3.3 7 8.7 5 8.7-5",
key: "g66t2b"
}],
["path", {
d: "M12 22V12",
key: "d0xqtd"
}]
]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/plus.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Plus = createLucideIcon("Plus", [["path", {
d: "M5 12h14",
key: "1ays0h"
}], ["path", {
d: "M12 5v14",
key: "s699le"
}]]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/search.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Search = createLucideIcon("Search", [["circle", {
cx: "11",
cy: "11",
r: "8",
key: "4ej97u"
}], ["path", {
d: "m21 21-4.3-4.3",
key: "1qie3q"
}]]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/shield.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Shield = createLucideIcon("Shield", [["path", {
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
key: "oel41y"
}]]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/shopping-cart.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var ShoppingCart = createLucideIcon("ShoppingCart", [
["circle", {
cx: "8",
cy: "21",
r: "1",
key: "jimo8o"
}],
["circle", {
cx: "19",
cy: "21",
r: "1",
key: "13723u"
}],
["path", {
d: "M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",
key: "9zh506"
}]
]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/star.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Star = createLucideIcon("Star", [["polygon", {
points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",
key: "8f66p6"
}]]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/store.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Store = createLucideIcon("Store", [
["path", {
d: "m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",
key: "ztvudi"
}],
["path", {
d: "M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",
key: "1b2hhj"
}],
["path", {
d: "M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",
key: "2ebpfo"
}],
["path", {
d: "M2 7h20",
key: "1fcdvo"
}],
["path", {
d: "M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",
key: "6c3vgh"
}]
]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/ticket.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Ticket = createLucideIcon("Ticket", [
["path", {
d: "M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",
key: "qn84l0"
}],
["path", {
d: "M13 5v2",
key: "dyzc3o"
}],
["path", {
d: "M13 17v2",
key: "1ont0d"
}],
["path", {
d: "M13 11v2",
key: "1wjjxi"
}]
]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/trash-2.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Trash2 = createLucideIcon("Trash2", [
["path", {
d: "M3 6h18",
key: "d0wm0j"
}],
["path", {
d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",
key: "4alrt4"
}],
["path", {
d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",
key: "v07s0e"
}],
["line", {
x1: "10",
x2: "10",
y1: "11",
y2: "17",
key: "1uufr5"
}],
["line", {
x1: "14",
x2: "14",
y1: "11",
y2: "17",
key: "xtxkd"
}]
]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/truck.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Truck = createLucideIcon("Truck", [
["path", {
d: "M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",
key: "wrbu53"
}],
["path", {
d: "M15 18H9",
key: "1lyqi6"
}],
["path", {
d: "M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",
key: "lysw3i"
}],
["circle", {
cx: "17",
cy: "18",
r: "2",
key: "332jqn"
}],
["circle", {
cx: "7",
cy: "18",
r: "2",
key: "19iecd"
}]
]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/user.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var User = createLucideIcon("User", [["path", {
d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",
key: "975kel"
}], ["circle", {
cx: "12",
cy: "7",
r: "4",
key: "17ys0d"
}]]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/x.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var X = createLucideIcon("X", [["path", {
d: "M18 6 6 18",
key: "1bl5f8"
}], ["path", {
d: "m6 6 12 12",
key: "d8bk6v"
}]]);
//#endregion
//#region node_modules/lucide-react/dist/esm/icons/zap.js
/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Zap = createLucideIcon("Zap", [["path", {
d: "M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",
key: "1xq2db"
}]]);
//#endregion
export { ArrowLeft as S, Leaf as _, Trash2 as a, FileText as b, Star as c, Search as d, Plus as f, MapPin as g, MessageSquare as h, Truck as i, ShoppingCart as l, Minus as m, X as n, Ticket as o, Package as p, User as r, Store as s, Zap as t, Shield as u, Info as v, ChevronRight as x, Heart as y };

View file

@ -0,0 +1,663 @@
import { o as __toESM, t as __commonJSMin } from "../_runtime.mjs";
import { a as QueryObserver, i as InfiniteQueryObserver, l as noop, n as QueriesObserver, o as notifyManager, r as MutationObserver, s as environmentManager, u as shouldThrowError } from "./tanstack__query-core.mjs";
//#region node_modules/react/cjs/react.production.js
/**
* @license React
* react.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var require_react_production = /* @__PURE__ */ __commonJSMin(((exports) => {
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
function getIteratorFn(maybeIterable) {
if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
return "function" === typeof maybeIterable ? maybeIterable : null;
}
var ReactNoopUpdateQueue = {
isMounted: function() {
return !1;
},
enqueueForceUpdate: function() {},
enqueueReplaceState: function() {},
enqueueSetState: function() {}
}, assign = Object.assign, emptyObject = {};
function Component(props, context, updater) {
this.props = props;
this.context = context;
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
}
Component.prototype.isReactComponent = {};
Component.prototype.setState = function(partialState, callback) {
if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState) throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
this.updater.enqueueSetState(this, partialState, callback, "setState");
};
Component.prototype.forceUpdate = function(callback) {
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
};
function ComponentDummy() {}
ComponentDummy.prototype = Component.prototype;
function PureComponent(props, context, updater) {
this.props = props;
this.context = context;
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
}
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
pureComponentPrototype.constructor = PureComponent;
assign(pureComponentPrototype, Component.prototype);
pureComponentPrototype.isPureReactComponent = !0;
var isArrayImpl = Array.isArray;
function noop() {}
var ReactSharedInternals = {
H: null,
A: null,
T: null,
S: null
}, hasOwnProperty = Object.prototype.hasOwnProperty;
function ReactElement(type, key, props) {
var refProp = props.ref;
return {
$$typeof: REACT_ELEMENT_TYPE,
type,
key,
ref: void 0 !== refProp ? refProp : null,
props
};
}
function cloneAndReplaceKey(oldElement, newKey) {
return ReactElement(oldElement.type, newKey, oldElement.props);
}
function isValidElement(object) {
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
}
function escape(key) {
var escaperLookup = {
"=": "=0",
":": "=2"
};
return "$" + key.replace(/[=:]/g, function(match) {
return escaperLookup[match];
});
}
var userProvidedKeyEscapeRegex = /\/+/g;
function getElementKey(element, index) {
return "object" === typeof element && null !== element && null != element.key ? escape("" + element.key) : index.toString(36);
}
function resolveThenable(thenable) {
switch (thenable.status) {
case "fulfilled": return thenable.value;
case "rejected": throw thenable.reason;
default: switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(function(fulfilledValue) {
"pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
}, function(error) {
"pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
})), thenable.status) {
case "fulfilled": return thenable.value;
case "rejected": throw thenable.reason;
}
}
throw thenable;
}
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
var type = typeof children;
if ("undefined" === type || "boolean" === type) children = null;
var invokeCallback = !1;
if (null === children) invokeCallback = !0;
else switch (type) {
case "bigint":
case "string":
case "number":
invokeCallback = !0;
break;
case "object": switch (children.$$typeof) {
case REACT_ELEMENT_TYPE:
case REACT_PORTAL_TYPE:
invokeCallback = !0;
break;
case REACT_LAZY_TYPE: return invokeCallback = children._init, mapIntoArray(invokeCallback(children._payload), array, escapedPrefix, nameSoFar, callback);
}
}
if (invokeCallback) return callback = callback(children), invokeCallback = "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar, isArrayImpl(callback) ? (escapedPrefix = "", null != invokeCallback && (escapedPrefix = invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
return c;
})) : null != callback && (isValidElement(callback) && (callback = cloneAndReplaceKey(callback, escapedPrefix + (null == callback.key || children && children.key === callback.key ? "" : ("" + callback.key).replace(userProvidedKeyEscapeRegex, "$&/") + "/") + invokeCallback)), array.push(callback)), 1;
invokeCallback = 0;
var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
if (isArrayImpl(children)) for (var i = 0; i < children.length; i++) nameSoFar = children[i], type = nextNamePrefix + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
else if (i = getIteratorFn(children), "function" === typeof i) for (children = i.call(children), i = 0; !(nameSoFar = children.next()).done;) nameSoFar = nameSoFar.value, type = nextNamePrefix + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
else if ("object" === type) {
if ("function" === typeof children.then) return mapIntoArray(resolveThenable(children), array, escapedPrefix, nameSoFar, callback);
array = String(children);
throw Error("Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead.");
}
return invokeCallback;
}
function mapChildren(children, func, context) {
if (null == children) return children;
var result = [], count = 0;
mapIntoArray(children, result, "", "", function(child) {
return func.call(context, child, count++);
});
return result;
}
function lazyInitializer(payload) {
if (-1 === payload._status) {
var ctor = payload._result;
ctor = ctor();
ctor.then(function(moduleObject) {
if (0 === payload._status || -1 === payload._status) payload._status = 1, payload._result = moduleObject;
}, function(error) {
if (0 === payload._status || -1 === payload._status) payload._status = 2, payload._result = error;
});
-1 === payload._status && (payload._status = 0, payload._result = ctor);
}
if (1 === payload._status) return payload._result.default;
throw payload._result;
}
var reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
var event = new window.ErrorEvent("error", {
bubbles: !0,
cancelable: !0,
message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
error
});
if (!window.dispatchEvent(event)) return;
} else if ("object" === typeof process && "function" === typeof process.emit) {
process.emit("uncaughtException", error);
return;
}
console.error(error);
}, Children = {
map: mapChildren,
forEach: function(children, forEachFunc, forEachContext) {
mapChildren(children, function() {
forEachFunc.apply(this, arguments);
}, forEachContext);
},
count: function(children) {
var n = 0;
mapChildren(children, function() {
n++;
});
return n;
},
toArray: function(children) {
return mapChildren(children, function(child) {
return child;
}) || [];
},
only: function(children) {
if (!isValidElement(children)) throw Error("React.Children.only expected to receive a single React element child.");
return children;
}
};
exports.Activity = REACT_ACTIVITY_TYPE;
exports.Children = Children;
exports.Component = Component;
exports.Fragment = REACT_FRAGMENT_TYPE;
exports.Profiler = REACT_PROFILER_TYPE;
exports.PureComponent = PureComponent;
exports.StrictMode = REACT_STRICT_MODE_TYPE;
exports.Suspense = REACT_SUSPENSE_TYPE;
exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
exports.__COMPILER_RUNTIME = {
__proto__: null,
c: function(size) {
return ReactSharedInternals.H.useMemoCache(size);
}
};
exports.cache = function(fn) {
return function() {
return fn.apply(null, arguments);
};
};
exports.cacheSignal = function() {
return null;
};
exports.cloneElement = function(element, config, children) {
if (null === element || void 0 === element) throw Error("The argument must be a React element, but you passed " + element + ".");
var props = assign({}, element.props), key = element.key;
if (null != config) for (propName in void 0 !== config.key && (key = "" + config.key), config) !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
var propName = arguments.length - 2;
if (1 === propName) props.children = children;
else if (1 < propName) {
for (var childArray = Array(propName), i = 0; i < propName; i++) childArray[i] = arguments[i + 2];
props.children = childArray;
}
return ReactElement(element.type, key, props);
};
exports.createContext = function(defaultValue) {
defaultValue = {
$$typeof: REACT_CONTEXT_TYPE,
_currentValue: defaultValue,
_currentValue2: defaultValue,
_threadCount: 0,
Provider: null,
Consumer: null
};
defaultValue.Provider = defaultValue;
defaultValue.Consumer = {
$$typeof: REACT_CONSUMER_TYPE,
_context: defaultValue
};
return defaultValue;
};
exports.createElement = function(type, config, children) {
var propName, props = {}, key = null;
if (null != config) for (propName in void 0 !== config.key && (key = "" + config.key), config) hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (props[propName] = config[propName]);
var childrenLength = arguments.length - 2;
if (1 === childrenLength) props.children = children;
else if (1 < childrenLength) {
for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 2];
props.children = childArray;
}
if (type && type.defaultProps) for (propName in childrenLength = type.defaultProps, childrenLength) void 0 === props[propName] && (props[propName] = childrenLength[propName]);
return ReactElement(type, key, props);
};
exports.createRef = function() {
return { current: null };
};
exports.forwardRef = function(render) {
return {
$$typeof: REACT_FORWARD_REF_TYPE,
render
};
};
exports.isValidElement = isValidElement;
exports.lazy = function(ctor) {
return {
$$typeof: REACT_LAZY_TYPE,
_payload: {
_status: -1,
_result: ctor
},
_init: lazyInitializer
};
};
exports.memo = function(type, compare) {
return {
$$typeof: REACT_MEMO_TYPE,
type,
compare: void 0 === compare ? null : compare
};
};
exports.startTransition = function(scope) {
var prevTransition = ReactSharedInternals.T, currentTransition = {};
ReactSharedInternals.T = currentTransition;
try {
var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
"object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && returnValue.then(noop, reportGlobalError);
} catch (error) {
reportGlobalError(error);
} finally {
null !== prevTransition && null !== currentTransition.types && (prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
}
};
exports.unstable_useCacheRefresh = function() {
return ReactSharedInternals.H.useCacheRefresh();
};
exports.use = function(usable) {
return ReactSharedInternals.H.use(usable);
};
exports.useActionState = function(action, initialState, permalink) {
return ReactSharedInternals.H.useActionState(action, initialState, permalink);
};
exports.useCallback = function(callback, deps) {
return ReactSharedInternals.H.useCallback(callback, deps);
};
exports.useContext = function(Context) {
return ReactSharedInternals.H.useContext(Context);
};
exports.useDebugValue = function() {};
exports.useDeferredValue = function(value, initialValue) {
return ReactSharedInternals.H.useDeferredValue(value, initialValue);
};
exports.useEffect = function(create, deps) {
return ReactSharedInternals.H.useEffect(create, deps);
};
exports.useEffectEvent = function(callback) {
return ReactSharedInternals.H.useEffectEvent(callback);
};
exports.useId = function() {
return ReactSharedInternals.H.useId();
};
exports.useImperativeHandle = function(ref, create, deps) {
return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
};
exports.useInsertionEffect = function(create, deps) {
return ReactSharedInternals.H.useInsertionEffect(create, deps);
};
exports.useLayoutEffect = function(create, deps) {
return ReactSharedInternals.H.useLayoutEffect(create, deps);
};
exports.useMemo = function(create, deps) {
return ReactSharedInternals.H.useMemo(create, deps);
};
exports.useOptimistic = function(passthrough, reducer) {
return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
};
exports.useReducer = function(reducer, initialArg, init) {
return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
};
exports.useRef = function(initialValue) {
return ReactSharedInternals.H.useRef(initialValue);
};
exports.useState = function(initialState) {
return ReactSharedInternals.H.useState(initialState);
};
exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
return ReactSharedInternals.H.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
};
exports.useTransition = function() {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.2.6";
}));
//#endregion
//#region node_modules/react/index.js
var require_react = /* @__PURE__ */ __commonJSMin(((exports, module) => {
module.exports = require_react_production();
}));
//#endregion
//#region node_modules/react/cjs/react-jsx-runtime.production.js
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var require_react_jsx_runtime_production = /* @__PURE__ */ __commonJSMin(((exports) => {
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
function jsxProd(type, config, maybeKey) {
var key = null;
void 0 !== maybeKey && (key = "" + maybeKey);
void 0 !== config.key && (key = "" + config.key);
if ("key" in config) {
maybeKey = {};
for (var propName in config) "key" !== propName && (maybeKey[propName] = config[propName]);
} else maybeKey = config;
config = maybeKey.ref;
return {
$$typeof: REACT_ELEMENT_TYPE,
type,
key,
ref: void 0 !== config ? config : null,
props: maybeKey
};
}
exports.Fragment = REACT_FRAGMENT_TYPE;
exports.jsx = jsxProd;
exports.jsxs = jsxProd;
}));
//#endregion
//#region node_modules/react/jsx-runtime.js
var require_jsx_runtime = /* @__PURE__ */ __commonJSMin(((exports, module) => {
module.exports = require_react_jsx_runtime_production();
}));
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
var import_jsx_runtime = require_jsx_runtime();
var QueryClientContext = import_react.createContext(void 0);
var useQueryClient = (queryClient) => {
const client = import_react.useContext(QueryClientContext);
if (queryClient) return queryClient;
if (!client) throw new Error("No QueryClient set, use QueryClientProvider to set one");
return client;
};
var QueryClientProvider = ({ client, children }) => {
import_react.useEffect(() => {
client.mount();
return () => {
client.unmount();
};
}, [client]);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryClientContext.Provider, {
value: client,
children
});
};
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
var IsRestoringContext = import_react.createContext(false);
var useIsRestoring = () => import_react.useContext(IsRestoringContext);
IsRestoringContext.Provider;
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
function createValue() {
let isReset = false;
return {
clearReset: () => {
isReset = false;
},
reset: () => {
isReset = true;
},
isReset: () => {
return isReset;
}
};
}
var QueryErrorResetBoundaryContext = import_react.createContext(createValue());
var useQueryErrorResetBoundary = () => import_react.useContext(QueryErrorResetBoundaryContext);
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
if (options.suspense || options.experimental_prefetchInRender || throwOnError) {
if (!errorResetBoundary.isReset()) options.retryOnMount = false;
}
};
var useClearResetErrorBoundary = (errorResetBoundary) => {
import_react.useEffect(() => {
errorResetBoundary.clearReset();
}, [errorResetBoundary]);
};
var getHasError = ({ result, errorResetBoundary, throwOnError, query, suspense }) => {
return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
};
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/suspense.js
var defaultThrowOnError = (_error, query) => query.state.data === void 0;
var ensureSuspenseTimers = (defaultedOptions) => {
if (defaultedOptions.suspense) {
const MIN_SUSPENSE_TIME_MS = 1e3;
const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS);
const originalStaleTime = defaultedOptions.staleTime;
defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);
if (typeof defaultedOptions.gcTime === "number") defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, MIN_SUSPENSE_TIME_MS);
}
};
var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;
var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;
var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
errorResetBoundary.clearReset();
});
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/useQueries.js
function useQueries({ queries, ...options }, queryClient) {
const client = useQueryClient(queryClient);
const isRestoring = useIsRestoring();
const errorResetBoundary = useQueryErrorResetBoundary();
const defaultedQueries = import_react.useMemo(() => queries.map((opts) => {
const defaultedOptions = client.defaultQueryOptions(opts);
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
return defaultedOptions;
}), [
queries,
client,
isRestoring
]);
defaultedQueries.forEach((queryOptions) => {
ensureSuspenseTimers(queryOptions);
ensurePreventErrorBoundaryRetry(queryOptions, errorResetBoundary, client.getQueryCache().get(queryOptions.queryHash));
});
useClearResetErrorBoundary(errorResetBoundary);
const [observer] = import_react.useState(() => new QueriesObserver(client, defaultedQueries, options));
const [optimisticResult, getCombinedResult, trackResult] = observer.getOptimisticResult(defaultedQueries, options.combine);
const shouldSubscribe = !isRestoring && options.subscribed !== false;
import_react.useSyncExternalStore(import_react.useCallback((onStoreChange) => shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop, [observer, shouldSubscribe]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
import_react.useEffect(() => {
observer.setQueries(defaultedQueries, options);
}, [
defaultedQueries,
options,
observer
]);
const suspensePromises = optimisticResult.some((result, index) => shouldSuspend(defaultedQueries[index], result)) ? optimisticResult.flatMap((result, index) => {
const opts = defaultedQueries[index];
if (opts && shouldSuspend(opts, result)) return fetchOptimistic(opts, new QueryObserver(client, opts), errorResetBoundary);
return [];
}) : [];
if (suspensePromises.length > 0) throw Promise.all(suspensePromises);
const firstSingleResultWhichShouldThrow = optimisticResult.find((result, index) => {
const query = defaultedQueries[index];
return query && getHasError({
result,
errorResetBoundary,
throwOnError: query.throwOnError,
query: client.getQueryCache().get(query.queryHash),
suspense: query.suspense
});
});
if (firstSingleResultWhichShouldThrow?.error) throw firstSingleResultWhichShouldThrow.error;
return getCombinedResult(trackResult());
}
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
function useBaseQuery(options, Observer, queryClient) {
const isRestoring = useIsRestoring();
const errorResetBoundary = useQueryErrorResetBoundary();
const client = useQueryClient(queryClient);
const defaultedOptions = client.defaultQueryOptions(options);
client.getDefaultOptions().queries?._experimental_beforeQuery?.(defaultedOptions);
const query = client.getQueryCache().get(defaultedOptions.queryHash);
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
ensureSuspenseTimers(defaultedOptions);
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);
useClearResetErrorBoundary(errorResetBoundary);
const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
const [observer] = import_react.useState(() => new Observer(client, defaultedOptions));
const result = observer.getOptimisticResult(defaultedOptions);
const shouldSubscribe = !isRestoring && options.subscribed !== false;
import_react.useSyncExternalStore(import_react.useCallback((onStoreChange) => {
const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop;
observer.updateResult();
return unsubscribe;
}, [observer, shouldSubscribe]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
import_react.useEffect(() => {
observer.setOptions(defaultedOptions);
}, [defaultedOptions, observer]);
if (shouldSuspend(defaultedOptions, result)) throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
if (getHasError({
result,
errorResetBoundary,
throwOnError: defaultedOptions.throwOnError,
query,
suspense: defaultedOptions.suspense
})) throw result.error;
client.getDefaultOptions().queries?._experimental_afterQuery?.(defaultedOptions, result);
if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) (isNewCacheEntry ? fetchOptimistic(defaultedOptions, observer, errorResetBoundary) : query?.promise)?.catch(noop).finally(() => {
observer.updateResult();
});
return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
}
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/useQuery.js
function useQuery(options, queryClient) {
return useBaseQuery(options, QueryObserver, queryClient);
}
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/useSuspenseQuery.js
function useSuspenseQuery(options, queryClient) {
return useBaseQuery({
...options,
enabled: true,
suspense: true,
throwOnError: defaultThrowOnError,
placeholderData: void 0
}, QueryObserver, queryClient);
}
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/useSuspenseInfiniteQuery.js
function useSuspenseInfiniteQuery(options, queryClient) {
return useBaseQuery({
...options,
enabled: true,
suspense: true,
throwOnError: defaultThrowOnError
}, InfiniteQueryObserver, queryClient);
}
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/useSuspenseQueries.js
function useSuspenseQueries(options, queryClient) {
return useQueries({
...options,
queries: options.queries.map((query) => {
return {
...query,
suspense: true,
throwOnError: defaultThrowOnError,
enabled: true,
placeholderData: void 0
};
})
}, queryClient);
}
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/usePrefetchQuery.js
function usePrefetchQuery(options, queryClient) {
const client = useQueryClient(queryClient);
if (!client.getQueryState(options.queryKey)) client.prefetchQuery(options);
}
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/usePrefetchInfiniteQuery.js
function usePrefetchInfiniteQuery(options, queryClient) {
const client = useQueryClient(queryClient);
if (!client.getQueryState(options.queryKey)) client.prefetchInfiniteQuery(options);
}
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/queryOptions.js
function queryOptions(options) {
return options;
}
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/infiniteQueryOptions.js
function infiniteQueryOptions(options) {
return options;
}
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/useMutation.js
function useMutation(options, queryClient) {
const client = useQueryClient(queryClient);
const [observer] = import_react.useState(() => new MutationObserver(client, options));
import_react.useEffect(() => {
observer.setOptions(options);
}, [observer, options]);
const result = import_react.useSyncExternalStore(import_react.useCallback((onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
const mutate = import_react.useCallback((variables, mutateOptions) => {
observer.mutate(variables, mutateOptions).catch(noop);
}, [observer]);
if (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) throw result.error;
return {
...result,
mutate,
mutateAsync: result.mutate
};
}
//#endregion
//#region node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js
function useInfiniteQuery(options, queryClient) {
return useBaseQuery(options, InfiniteQueryObserver, queryClient);
}
//#endregion
export { usePrefetchInfiniteQuery as a, useSuspenseInfiniteQuery as c, useQueries as d, QueryClientProvider as f, require_react as h, queryOptions as i, useSuspenseQuery as l, require_jsx_runtime as m, useMutation as n, usePrefetchQuery as o, useQueryClient as p, infiniteQueryOptions as r, useSuspenseQueries as s, useInfiniteQuery as t, useQuery as u };

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,385 @@
//#region node_modules/@tanstack/history/dist/esm/index.js
var stateIndexKey = "__TSR_index";
var popStateEvent = "popstate";
var beforeUnloadEvent = "beforeunload";
function createHistory(opts) {
let location = opts.getLocation();
const subscribers = /* @__PURE__ */ new Set();
const notify = (action) => {
location = opts.getLocation();
subscribers.forEach((subscriber) => subscriber({
location,
action
}));
};
const handleIndexChange = (action) => {
if (opts.notifyOnIndexChange ?? true) notify(action);
else location = opts.getLocation();
};
const tryNavigation = async ({ task, navigateOpts, ...actionInfo }) => {
if (navigateOpts?.ignoreBlocker ?? false) {
task();
return;
}
const blockers = opts.getBlockers?.() ?? [];
const isPushOrReplace = actionInfo.type === "PUSH" || actionInfo.type === "REPLACE";
if (typeof document !== "undefined" && blockers.length && isPushOrReplace) for (const blocker of blockers) {
const nextLocation = parseHref(actionInfo.path, actionInfo.state);
if (await blocker.blockerFn({
currentLocation: location,
nextLocation,
action: actionInfo.type
})) {
opts.onBlocked?.();
return;
}
}
task();
};
return {
get location() {
return location;
},
get length() {
return opts.getLength();
},
subscribers,
subscribe: (cb) => {
subscribers.add(cb);
return () => {
subscribers.delete(cb);
};
},
push: (path, state, navigateOpts) => {
const currentIndex = location.state[stateIndexKey];
state = assignKeyAndIndex(currentIndex + 1, state);
tryNavigation({
task: () => {
opts.pushState(path, state);
notify({ type: "PUSH" });
},
navigateOpts,
type: "PUSH",
path,
state
});
},
replace: (path, state, navigateOpts) => {
const currentIndex = location.state[stateIndexKey];
state = assignKeyAndIndex(currentIndex, state);
tryNavigation({
task: () => {
opts.replaceState(path, state);
notify({ type: "REPLACE" });
},
navigateOpts,
type: "REPLACE",
path,
state
});
},
go: (index, navigateOpts) => {
tryNavigation({
task: () => {
opts.go(index);
handleIndexChange({
type: "GO",
index
});
},
navigateOpts,
type: "GO"
});
},
back: (navigateOpts) => {
tryNavigation({
task: () => {
opts.back(navigateOpts?.ignoreBlocker ?? false);
handleIndexChange({ type: "BACK" });
},
navigateOpts,
type: "BACK"
});
},
forward: (navigateOpts) => {
tryNavigation({
task: () => {
opts.forward(navigateOpts?.ignoreBlocker ?? false);
handleIndexChange({ type: "FORWARD" });
},
navigateOpts,
type: "FORWARD"
});
},
canGoBack: () => location.state[stateIndexKey] !== 0,
createHref: (str) => opts.createHref(str),
block: (blocker) => {
if (!opts.setBlockers) return () => {};
const blockers = opts.getBlockers?.() ?? [];
opts.setBlockers([...blockers, blocker]);
return () => {
const blockers = opts.getBlockers?.() ?? [];
opts.setBlockers?.(blockers.filter((b) => b !== blocker));
};
},
flush: () => opts.flush?.(),
destroy: () => opts.destroy?.(),
notify
};
}
function assignKeyAndIndex(index, state) {
if (!state) state = {};
const key = createRandomKey();
return {
...state,
key,
__TSR_key: key,
[stateIndexKey]: index
};
}
/**
* Creates a history object that can be used to interact with the browser's
* navigation. This is a lightweight API wrapping the browser's native methods.
* It is designed to work with TanStack Router, but could be used as a standalone API as well.
* IMPORTANT: This API implements history throttling via a microtask to prevent
* excessive calls to the history API. In some browsers, calling history.pushState or
* history.replaceState in quick succession can cause the browser to ignore subsequent
* calls. This API smooths out those differences and ensures that your application
* state will *eventually* match the browser state. In most cases, this is not a problem,
* but if you need to ensure that the browser state is up to date, you can use the
* `history.flush` method to immediately flush all pending state changes to the browser URL.
* @param opts
* @param opts.getHref A function that returns the current href (path + search + hash)
* @param opts.createHref A function that takes a path and returns a href (path + search + hash)
* @returns A history instance
*/
function createBrowserHistory(opts) {
const win = opts?.window ?? (typeof document !== "undefined" ? window : void 0);
const originalPushState = win.history.pushState;
const originalReplaceState = win.history.replaceState;
let blockers = [];
const _getBlockers = () => blockers;
const _setBlockers = (newBlockers) => blockers = newBlockers;
const createHref = opts?.createHref ?? ((path) => path);
const parseLocation = opts?.parseLocation ?? (() => parseHref(`${win.location.pathname}${win.location.search}${win.location.hash}`, win.history.state));
if (!win.history.state?.__TSR_key && !win.history.state?.key) {
const addedKey = createRandomKey();
win.history.replaceState({
[stateIndexKey]: 0,
key: addedKey,
__TSR_key: addedKey
}, "");
}
let currentLocation = parseLocation();
let rollbackLocation;
let nextPopIsGo = false;
let ignoreNextPop = false;
let skipBlockerNextPop = false;
let ignoreNextBeforeUnload = false;
const getLocation = () => currentLocation;
let next;
let scheduled;
const flush = () => {
if (!next) return;
history._ignoreSubscribers = true;
(next.isPush ? win.history.pushState : win.history.replaceState)(next.state, "", next.href);
history._ignoreSubscribers = false;
next = void 0;
scheduled = void 0;
rollbackLocation = void 0;
};
const queueHistoryAction = (type, destHref, state) => {
const href = createHref(destHref);
if (!scheduled) rollbackLocation = currentLocation;
currentLocation = parseHref(destHref, state);
next = {
href,
state,
isPush: next?.isPush || type === "push"
};
if (!scheduled) scheduled = Promise.resolve().then(() => flush());
};
const onPushPop = (type) => {
currentLocation = parseLocation();
history.notify({ type });
};
const onPushPopEvent = async () => {
if (ignoreNextPop) {
ignoreNextPop = false;
return;
}
const nextLocation = parseLocation();
const delta = nextLocation.state[stateIndexKey] - currentLocation.state[stateIndexKey];
const isForward = delta === 1;
const isBack = delta === -1;
const isGo = !isForward && !isBack || nextPopIsGo;
nextPopIsGo = false;
const action = isGo ? "GO" : isBack ? "BACK" : "FORWARD";
const notify = isGo ? {
type: "GO",
index: delta
} : { type: isBack ? "BACK" : "FORWARD" };
if (skipBlockerNextPop) skipBlockerNextPop = false;
else {
const blockers = _getBlockers();
if (typeof document !== "undefined" && blockers.length) {
for (const blocker of blockers) if (await blocker.blockerFn({
currentLocation,
nextLocation,
action
})) {
ignoreNextPop = true;
win.history.go(1);
history.notify(notify);
return;
}
}
}
currentLocation = parseLocation();
history.notify(notify);
};
const onBeforeUnload = (e) => {
if (ignoreNextBeforeUnload) {
ignoreNextBeforeUnload = false;
return;
}
let shouldBlock = false;
const blockers = _getBlockers();
if (typeof document !== "undefined" && blockers.length) for (const blocker of blockers) {
const shouldHaveBeforeUnload = blocker.enableBeforeUnload ?? true;
if (shouldHaveBeforeUnload === true) {
shouldBlock = true;
break;
}
if (typeof shouldHaveBeforeUnload === "function" && shouldHaveBeforeUnload() === true) {
shouldBlock = true;
break;
}
}
if (shouldBlock) {
e.preventDefault();
return e.returnValue = "";
}
};
const history = createHistory({
getLocation,
getLength: () => win.history.length,
pushState: (href, state) => queueHistoryAction("push", href, state),
replaceState: (href, state) => queueHistoryAction("replace", href, state),
back: (ignoreBlocker) => {
if (ignoreBlocker) skipBlockerNextPop = true;
ignoreNextBeforeUnload = true;
return win.history.back();
},
forward: (ignoreBlocker) => {
if (ignoreBlocker) skipBlockerNextPop = true;
ignoreNextBeforeUnload = true;
win.history.forward();
},
go: (n) => {
nextPopIsGo = true;
win.history.go(n);
},
createHref: (href) => createHref(href),
flush,
destroy: () => {
win.history.pushState = originalPushState;
win.history.replaceState = originalReplaceState;
win.removeEventListener(beforeUnloadEvent, onBeforeUnload, { capture: true });
win.removeEventListener(popStateEvent, onPushPopEvent);
},
onBlocked: () => {
if (rollbackLocation && currentLocation !== rollbackLocation) currentLocation = rollbackLocation;
},
getBlockers: _getBlockers,
setBlockers: _setBlockers,
notifyOnIndexChange: false
});
win.addEventListener(beforeUnloadEvent, onBeforeUnload, { capture: true });
win.addEventListener(popStateEvent, onPushPopEvent);
win.history.pushState = function(...args) {
const res = originalPushState.apply(win.history, args);
if (!history._ignoreSubscribers) onPushPop("PUSH");
return res;
};
win.history.replaceState = function(...args) {
const res = originalReplaceState.apply(win.history, args);
if (!history._ignoreSubscribers) onPushPop("REPLACE");
return res;
};
return history;
}
/**
* Create an in-memory history implementation.
* Ideal for server rendering, tests, and non-DOM environments.
* @link https://tanstack.com/router/latest/docs/framework/react/guide/history-types
*/
function createMemoryHistory(opts = { initialEntries: ["/"] }) {
const entries = opts.initialEntries;
let index = opts.initialIndex ? Math.min(Math.max(opts.initialIndex, 0), entries.length - 1) : entries.length - 1;
const states = entries.map((_entry, index) => assignKeyAndIndex(index, void 0));
const getLocation = () => parseHref(entries[index], states[index]);
let blockers = [];
const _getBlockers = () => blockers;
const _setBlockers = (newBlockers) => blockers = newBlockers;
return createHistory({
getLocation,
getLength: () => entries.length,
pushState: (path, state) => {
if (index < entries.length - 1) {
entries.splice(index + 1);
states.splice(index + 1);
}
states.push(state);
entries.push(path);
index = Math.max(entries.length - 1, 0);
},
replaceState: (path, state) => {
states[index] = state;
entries[index] = path;
},
back: () => {
index = Math.max(index - 1, 0);
},
forward: () => {
index = Math.min(index + 1, entries.length - 1);
},
go: (n) => {
index = Math.min(Math.max(index + n, 0), entries.length - 1);
},
createHref: (path) => path,
getBlockers: _getBlockers,
setBlockers: _setBlockers
});
}
/**
* Sanitize a path to prevent open redirect vulnerabilities.
* Removes control characters and collapses leading double slashes.
*/
function sanitizePath(path) {
let sanitized = path.replace(/[\x00-\x1f\x7f]/g, "");
if (sanitized.startsWith("//")) sanitized = "/" + sanitized.replace(/^\/+/, "");
return sanitized;
}
function parseHref(href, state) {
const sanitizedHref = sanitizePath(href);
const hashIndex = sanitizedHref.indexOf("#");
const searchIndex = sanitizedHref.indexOf("?");
const addedKey = createRandomKey();
return {
href: sanitizedHref,
pathname: sanitizedHref.substring(0, hashIndex > 0 ? searchIndex > 0 ? Math.min(hashIndex, searchIndex) : hashIndex : searchIndex > 0 ? searchIndex : sanitizedHref.length),
hash: hashIndex > -1 ? sanitizedHref.substring(hashIndex) : "",
search: searchIndex > -1 ? sanitizedHref.slice(searchIndex, hashIndex === -1 ? void 0 : hashIndex) : "",
state: state || {
[stateIndexKey]: 0,
key: addedKey,
__TSR_key: addedKey
}
};
}
function createRandomKey() {
return (Math.random() + 1).toString(36).substring(7);
}
//#endregion
export { createMemoryHistory as n, parseHref as r, createBrowserHistory as t };

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
import "../_runtime.mjs";
//#region node_modules/@tanstack/react-query-devtools/build/modern/index.js
var ReactQueryDevtools2 = function() {
return null;
};
//#endregion
export { ReactQueryDevtools2 as t };

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,877 @@
import { o as __toESM$1 } from "../_runtime.mjs";
import { a as usePrefetchInfiniteQuery, c as useSuspenseInfiniteQuery, d as useQueries, h as require_react, i as queryOptions, l as useSuspenseQuery, m as require_jsx_runtime, n as useMutation, o as usePrefetchQuery, r as infiniteQueryOptions, s as useSuspenseQueries, t as useInfiniteQuery, u as useQuery } from "./react+tanstack__react-query.mjs";
import { c as hashKey, d as skipToken } from "./tanstack__query-core.mjs";
import { c as isAsyncIterable, i as getUntypedClient, l as isObject, n as createTRPCClient, o as createFlatProxy, r as createTRPCClientProxy, s as createRecursiveProxy, t as TRPCUntypedClient } from "./trpc__client+trpc__server.mjs";
//#region node_modules/@trpc/react-query/dist/getQueryKey-BY58RNzP.mjs
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
var require_objectWithoutPropertiesLoose = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(exports, module) {
function _objectWithoutPropertiesLoose(r, e) {
if (null == r) return {};
var t = {};
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
if (e.includes(n)) continue;
t[n] = r[n];
}
return t;
}
module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
} });
var require_objectWithoutProperties = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(exports, module) {
var objectWithoutPropertiesLoose = require_objectWithoutPropertiesLoose();
function _objectWithoutProperties$1(e, t) {
if (null == e) return {};
var o, r, i = objectWithoutPropertiesLoose(e, t);
if (Object.getOwnPropertySymbols) {
var s = Object.getOwnPropertySymbols(e);
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
}
return i;
}
module.exports = _objectWithoutProperties$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
} });
var require_typeof = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(exports, module) {
function _typeof$2(o) {
"@babel/helpers - typeof";
return module.exports = _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
return typeof o$1;
} : function(o$1) {
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof$2(o);
}
module.exports = _typeof$2, module.exports.__esModule = true, module.exports["default"] = module.exports;
} });
var require_toPrimitive = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(exports, module) {
var _typeof$1 = require_typeof()["default"];
function toPrimitive$1(t, r) {
if ("object" != _typeof$1(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof$1(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
module.exports = toPrimitive$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
} });
var require_toPropertyKey = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(exports, module) {
var _typeof = require_typeof()["default"];
var toPrimitive = require_toPrimitive();
function toPropertyKey$1(t) {
var i = toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : i + "";
}
module.exports = toPropertyKey$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
} });
var require_defineProperty = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(exports, module) {
var toPropertyKey = require_toPropertyKey();
function _defineProperty(e, r, t) {
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[r] = t, e;
}
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
} });
var require_objectSpread2 = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(exports, module) {
var defineProperty = require_defineProperty();
function ownKeys(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r$1) {
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread2(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
defineProperty(e, r$1, t[r$1]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
});
}
return e;
}
module.exports = _objectSpread2, module.exports.__esModule = true, module.exports["default"] = module.exports;
} });
var import_objectWithoutProperties = __toESM(require_objectWithoutProperties(), 1);
var import_objectSpread2$4 = __toESM(require_objectSpread2(), 1);
var _excluded = ["cursor", "direction"];
/**
* To allow easy interactions with groups of related queries, such as
* invalidating all queries of a router, we use an array as the path when
* storing in tanstack query.
**/
function getQueryKeyInternal(path, input, type) {
const splitPath = path.flatMap((part) => part.split("."));
if (!input && (!type || type === "any")) return splitPath.length ? [splitPath] : [];
if (type === "infinite" && isObject(input) && ("direction" in input || "cursor" in input)) {
const { cursor: _, direction: __ } = input;
return [splitPath, {
input: (0, import_objectWithoutProperties.default)(input, _excluded),
type: "infinite"
}];
}
return [splitPath, (0, import_objectSpread2$4.default)((0, import_objectSpread2$4.default)({}, typeof input !== "undefined" && input !== skipToken && { input }), type && type !== "any" && { type })];
}
function getMutationKeyInternal(path) {
return getQueryKeyInternal(path, void 0, "any");
}
//#endregion
//#region node_modules/@trpc/react-query/dist/shared-JtnEvJvB.mjs
var import_react = /* @__PURE__ */ __toESM$1(require_react(), 1);
var import_jsx_runtime = require_jsx_runtime();
/**
* Create proxy for decorating procedures
* @internal
*/
function createReactDecoration(hooks) {
return createRecursiveProxy(({ path, args }) => {
var _rest$;
const pathCopy = [...path];
const lastArg = pathCopy.pop();
if (lastArg === "useMutation") return hooks[lastArg](pathCopy, ...args);
if (lastArg === "_def") return { path: pathCopy };
const [input, ...rest] = args;
const opts = (_rest$ = rest[0]) !== null && _rest$ !== void 0 ? _rest$ : {};
return hooks[lastArg](pathCopy, input, opts);
});
}
var _React$createContext;
var contextProps = [
"client",
"ssrContext",
"ssrState",
"abortOnUnmount"
];
var TRPCContext = (_React$createContext = import_react.createContext) === null || _React$createContext === void 0 ? void 0 : _React$createContext.call(import_react, null);
var getQueryType = (utilName) => {
switch (utilName) {
case "queryOptions":
case "fetch":
case "ensureData":
case "prefetch":
case "getData":
case "setData":
case "setQueriesData": return "query";
case "infiniteQueryOptions":
case "fetchInfinite":
case "prefetchInfinite":
case "getInfiniteData":
case "setInfiniteData": return "infinite";
case "setMutationDefaults":
case "getMutationDefaults":
case "isMutating":
case "cancel":
case "invalidate":
case "refetch":
case "reset": return "any";
}
};
/**
* @internal
*/
function createRecursiveUtilsProxy(context) {
return createRecursiveProxy((opts) => {
const path = [...opts.path];
const utilName = path.pop();
const args = [...opts.args];
const input = args.shift();
const queryKey = getQueryKeyInternal(path, input, getQueryType(utilName));
return {
infiniteQueryOptions: () => context.infiniteQueryOptions(path, queryKey, args[0]),
queryOptions: () => context.queryOptions(path, queryKey, ...args),
fetch: () => context.fetchQuery(queryKey, ...args),
fetchInfinite: () => context.fetchInfiniteQuery(queryKey, args[0]),
prefetch: () => context.prefetchQuery(queryKey, ...args),
prefetchInfinite: () => context.prefetchInfiniteQuery(queryKey, args[0]),
ensureData: () => context.ensureQueryData(queryKey, ...args),
invalidate: () => context.invalidateQueries(queryKey, ...args),
reset: () => context.resetQueries(queryKey, ...args),
refetch: () => context.refetchQueries(queryKey, ...args),
cancel: () => context.cancelQuery(queryKey, ...args),
setData: () => {
context.setQueryData(queryKey, args[0], args[1]);
},
setQueriesData: () => context.setQueriesData(queryKey, args[0], args[1], args[2]),
setInfiniteData: () => {
context.setInfiniteQueryData(queryKey, args[0], args[1]);
},
getData: () => context.getQueryData(queryKey),
getInfiniteData: () => context.getInfiniteQueryData(queryKey),
setMutationDefaults: () => context.setMutationDefaults(getMutationKeyInternal(path), input),
getMutationDefaults: () => context.getMutationDefaults(getMutationKeyInternal(path)),
isMutating: () => context.isMutating({ mutationKey: getMutationKeyInternal(path) })
}[utilName]();
});
}
/**
* @internal
*/
function createReactQueryUtils(context) {
const clientProxy = createTRPCClientProxy(context.client);
const proxy = createRecursiveUtilsProxy(context);
return createFlatProxy((key) => {
const contextName = key;
if (contextName === "client") return clientProxy;
if (contextProps.includes(contextName)) return context[contextName];
return proxy[key];
});
}
var import_objectSpread2$3 = __toESM(require_objectSpread2(), 1);
/**
* Create proxy for `useQueries` options
* @internal
*/
function createUseQueries(client) {
const untypedClient = client instanceof TRPCUntypedClient ? client : getUntypedClient(client);
return createRecursiveProxy((opts) => {
const arrayPath = opts.path;
const dotPath = arrayPath.join(".");
const [input, _opts] = opts.args;
return (0, import_objectSpread2$3.default)({
queryKey: getQueryKeyInternal(arrayPath, input, "query"),
queryFn: () => {
return untypedClient.query(dotPath, input, _opts === null || _opts === void 0 ? void 0 : _opts.trpc);
}
}, _opts);
});
}
var import_objectSpread2$2 = __toESM(require_objectSpread2(), 1);
/**
* @internal
*/
function getClientArgs(queryKey, opts, infiniteParams) {
var _queryKey$;
const path = queryKey[0];
let input = (_queryKey$ = queryKey[1]) === null || _queryKey$ === void 0 ? void 0 : _queryKey$.input;
if (infiniteParams) {
var _input;
input = (0, import_objectSpread2$2.default)((0, import_objectSpread2$2.default)((0, import_objectSpread2$2.default)({}, (_input = input) !== null && _input !== void 0 ? _input : {}), infiniteParams.pageParam ? { cursor: infiniteParams.pageParam } : {}), {}, { direction: infiniteParams.direction });
}
return [
path.join("."),
input,
opts === null || opts === void 0 ? void 0 : opts.trpc
];
}
var import_asyncIterator = __toESM(__commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(exports, module) {
function _asyncIterator$1(r) {
var n, t, o, e = 2;
for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {
if (t && null != (n = r[t])) return n.call(r);
if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r));
t = "@@asyncIterator", o = "@@iterator";
}
throw new TypeError("Object is not async iterable");
}
function AsyncFromSyncIterator(r) {
function AsyncFromSyncIteratorContinuation(r$1) {
if (Object(r$1) !== r$1) return Promise.reject(/* @__PURE__ */ new TypeError(r$1 + " is not an object."));
var n = r$1.done;
return Promise.resolve(r$1.value).then(function(r$2) {
return {
value: r$2,
done: n
};
});
}
return AsyncFromSyncIterator = function AsyncFromSyncIterator$1(r$1) {
this.s = r$1, this.n = r$1.next;
}, AsyncFromSyncIterator.prototype = {
s: null,
n: null,
next: function next() {
return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
},
"return": function _return(r$1) {
var n = this.s["return"];
return void 0 === n ? Promise.resolve({
value: r$1,
done: !0
}) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
},
"throw": function _throw(r$1) {
var n = this.s["return"];
return void 0 === n ? Promise.reject(r$1) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
}
}, new AsyncFromSyncIterator(r);
}
module.exports = _asyncIterator$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
} })(), 1);
function createTRPCOptionsResult(value) {
return { path: value.path.join(".") };
}
/**
* Makes a stable reference of the `trpc` prop
*/
function useHookResult(value) {
const result = createTRPCOptionsResult(value);
return import_react.useMemo(() => result, [result]);
}
/**
* @internal
*/
async function buildQueryFromAsyncIterable(asyncIterable, queryClient, queryKey) {
const query = queryClient.getQueryCache().build(queryClient, { queryKey });
query.setState({
data: [],
status: "success"
});
const aggregate = [];
var _iteratorAbruptCompletion = false;
var _didIteratorError = false;
var _iteratorError;
try {
for (var _iterator = (0, import_asyncIterator.default)(asyncIterable), _step; _iteratorAbruptCompletion = !(_step = await _iterator.next()).done; _iteratorAbruptCompletion = false) {
const value = _step.value;
aggregate.push(value);
query.setState({ data: [...aggregate] });
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (_iteratorAbruptCompletion && _iterator.return != null) await _iterator.return();
} finally {
if (_didIteratorError) throw _iteratorError;
}
}
return aggregate;
}
var import_objectSpread2$1 = __toESM(require_objectSpread2(), 1);
/**
* Creates a set of utility functions that can be used to interact with `react-query`
* @param opts the `TRPCClient` and `QueryClient` to use
* @returns a set of utility functions that can be used to interact with `react-query`
* @internal
*/
function createUtilityFunctions(opts) {
const { client, queryClient } = opts;
const untypedClient = client instanceof TRPCUntypedClient ? client : getUntypedClient(client);
return {
infiniteQueryOptions: (path, queryKey, opts$1) => {
var _queryKey$, _ref;
const inputIsSkipToken = ((_queryKey$ = queryKey[1]) === null || _queryKey$ === void 0 ? void 0 : _queryKey$.input) === skipToken;
const queryFn = async (queryFnContext) => {
var _opts$trpc;
const actualOpts = (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts$1), {}, { trpc: (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts$1 === null || opts$1 === void 0 ? void 0 : opts$1.trpc), (opts$1 === null || opts$1 === void 0 || (_opts$trpc = opts$1.trpc) === null || _opts$trpc === void 0 ? void 0 : _opts$trpc.abortOnUnmount) ? { signal: queryFnContext.signal } : { signal: null }) });
return await untypedClient.query(...getClientArgs(queryKey, actualOpts, {
direction: queryFnContext.direction,
pageParam: queryFnContext.pageParam
}));
};
return Object.assign(infiniteQueryOptions((0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts$1), {}, {
initialData: opts$1 === null || opts$1 === void 0 ? void 0 : opts$1.initialData,
queryKey,
queryFn: inputIsSkipToken ? skipToken : queryFn,
initialPageParam: (_ref = opts$1 === null || opts$1 === void 0 ? void 0 : opts$1.initialCursor) !== null && _ref !== void 0 ? _ref : null
})), { trpc: createTRPCOptionsResult({ path }) });
},
queryOptions: (path, queryKey, opts$1) => {
var _queryKey$2;
const inputIsSkipToken = ((_queryKey$2 = queryKey[1]) === null || _queryKey$2 === void 0 ? void 0 : _queryKey$2.input) === skipToken;
const queryFn = async (queryFnContext) => {
var _opts$trpc2;
const actualOpts = (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts$1), {}, { trpc: (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts$1 === null || opts$1 === void 0 ? void 0 : opts$1.trpc), (opts$1 === null || opts$1 === void 0 || (_opts$trpc2 = opts$1.trpc) === null || _opts$trpc2 === void 0 ? void 0 : _opts$trpc2.abortOnUnmount) ? { signal: queryFnContext.signal } : { signal: null }) });
const result = await untypedClient.query(...getClientArgs(queryKey, actualOpts));
if (isAsyncIterable(result)) return buildQueryFromAsyncIterable(result, queryClient, queryKey);
return result;
};
return Object.assign(queryOptions((0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts$1), {}, {
initialData: opts$1 === null || opts$1 === void 0 ? void 0 : opts$1.initialData,
queryKey,
queryFn: inputIsSkipToken ? skipToken : queryFn
})), { trpc: createTRPCOptionsResult({ path }) });
},
fetchQuery: (queryKey, opts$1) => {
return queryClient.fetchQuery((0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts$1), {}, {
queryKey,
queryFn: () => untypedClient.query(...getClientArgs(queryKey, opts$1))
}));
},
fetchInfiniteQuery: (queryKey, opts$1) => {
var _opts$initialCursor;
return queryClient.fetchInfiniteQuery((0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts$1), {}, {
queryKey,
queryFn: ({ pageParam, direction }) => {
return untypedClient.query(...getClientArgs(queryKey, opts$1, {
pageParam,
direction
}));
},
initialPageParam: (_opts$initialCursor = opts$1 === null || opts$1 === void 0 ? void 0 : opts$1.initialCursor) !== null && _opts$initialCursor !== void 0 ? _opts$initialCursor : null
}));
},
prefetchQuery: (queryKey, opts$1) => {
return queryClient.prefetchQuery((0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts$1), {}, {
queryKey,
queryFn: () => untypedClient.query(...getClientArgs(queryKey, opts$1))
}));
},
prefetchInfiniteQuery: (queryKey, opts$1) => {
var _opts$initialCursor2;
return queryClient.prefetchInfiniteQuery((0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts$1), {}, {
queryKey,
queryFn: ({ pageParam, direction }) => {
return untypedClient.query(...getClientArgs(queryKey, opts$1, {
pageParam,
direction
}));
},
initialPageParam: (_opts$initialCursor2 = opts$1 === null || opts$1 === void 0 ? void 0 : opts$1.initialCursor) !== null && _opts$initialCursor2 !== void 0 ? _opts$initialCursor2 : null
}));
},
ensureQueryData: (queryKey, opts$1) => {
return queryClient.ensureQueryData((0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, opts$1), {}, {
queryKey,
queryFn: () => untypedClient.query(...getClientArgs(queryKey, opts$1))
}));
},
invalidateQueries: (queryKey, filters, options) => {
return queryClient.invalidateQueries((0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, filters), {}, { queryKey }), options);
},
resetQueries: (queryKey, filters, options) => {
return queryClient.resetQueries((0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, filters), {}, { queryKey }), options);
},
refetchQueries: (queryKey, filters, options) => {
return queryClient.refetchQueries((0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, filters), {}, { queryKey }), options);
},
cancelQuery: (queryKey, options) => {
return queryClient.cancelQueries({ queryKey }, options);
},
setQueryData: (queryKey, updater, options) => {
return queryClient.setQueryData(queryKey, updater, options);
},
setQueriesData: (queryKey, filters, updater, options) => {
return queryClient.setQueriesData((0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, filters), {}, { queryKey }), updater, options);
},
getQueryData: (queryKey) => {
return queryClient.getQueryData(queryKey);
},
setInfiniteQueryData: (queryKey, updater, options) => {
return queryClient.setQueryData(queryKey, updater, options);
},
getInfiniteQueryData: (queryKey) => {
return queryClient.getQueryData(queryKey);
},
setMutationDefaults: (mutationKey, options) => {
const path = mutationKey[0];
const canonicalMutationFn = (input) => {
return untypedClient.mutation(...getClientArgs([path, { input }], opts));
};
return queryClient.setMutationDefaults(mutationKey, typeof options === "function" ? options({ canonicalMutationFn }) : options);
},
getMutationDefaults: (mutationKey) => {
return queryClient.getMutationDefaults(mutationKey);
},
isMutating: (filters) => {
return queryClient.isMutating((0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, filters), {}, { exact: true }));
}
};
}
var import_objectSpread2 = __toESM(require_objectSpread2());
var trackResult = (result, onTrackResult) => {
return new Proxy(result, { get(target, prop) {
onTrackResult(prop);
return target[prop];
} });
};
/**
* @internal
*/
function createRootHooks(config) {
var _config$overrides$use, _config$overrides, _config$context;
const mutationSuccessOverride = (_config$overrides$use = config === null || config === void 0 || (_config$overrides = config.overrides) === null || _config$overrides === void 0 || (_config$overrides = _config$overrides.useMutation) === null || _config$overrides === void 0 ? void 0 : _config$overrides.onSuccess) !== null && _config$overrides$use !== void 0 ? _config$overrides$use : (options) => options.originalFn();
const Context = (_config$context = config === null || config === void 0 ? void 0 : config.context) !== null && _config$context !== void 0 ? _config$context : TRPCContext;
const createClient = createTRPCClient;
const TRPCProvider = (props) => {
var _props$ssrState;
const { abortOnUnmount = false, queryClient, ssrContext } = props;
const [ssrState, setSSRState] = import_react.useState((_props$ssrState = props.ssrState) !== null && _props$ssrState !== void 0 ? _props$ssrState : false);
const client = props.client instanceof TRPCUntypedClient ? props.client : getUntypedClient(props.client);
const fns = import_react.useMemo(() => createUtilityFunctions({
client,
queryClient
}), [client, queryClient]);
const contextValue = import_react.useMemo(() => (0, import_objectSpread2.default)({
abortOnUnmount,
queryClient,
client,
ssrContext: ssrContext !== null && ssrContext !== void 0 ? ssrContext : null,
ssrState
}, fns), [
abortOnUnmount,
client,
fns,
queryClient,
ssrContext,
ssrState
]);
import_react.useEffect(() => {
setSSRState((state) => state ? "mounted" : false);
}, []);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, {
value: contextValue,
children: props.children
});
};
function useContext() {
const context = import_react.useContext(Context);
if (!context) throw new Error("Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?");
return context;
}
/**
* Hack to make sure errors return `status`='error` when doing SSR
* @see https://github.com/trpc/trpc/pull/1645
*/
function useSSRQueryOptionsIfNeeded(queryKey, opts) {
var _queryClient$getQuery;
const { queryClient, ssrState } = useContext();
return ssrState && ssrState !== "mounted" && ((_queryClient$getQuery = queryClient.getQueryCache().find({ queryKey })) === null || _queryClient$getQuery === void 0 ? void 0 : _queryClient$getQuery.state.status) === "error" ? (0, import_objectSpread2.default)({ retryOnMount: false }, opts) : opts;
}
function useQuery$1(path, input, opts) {
var _opts$trpc, _opts$enabled, _ref, _opts$trpc$abortOnUnm, _opts$trpc2;
const { abortOnUnmount, client, ssrState, queryClient, prefetchQuery } = useContext();
const queryKey = getQueryKeyInternal(path, input, "query");
const defaultOpts = queryClient.getQueryDefaults(queryKey);
const isInputSkipToken = input === skipToken;
if (typeof window === "undefined" && ssrState === "prepass" && (opts === null || opts === void 0 || (_opts$trpc = opts.trpc) === null || _opts$trpc === void 0 ? void 0 : _opts$trpc.ssr) !== false && ((_opts$enabled = opts === null || opts === void 0 ? void 0 : opts.enabled) !== null && _opts$enabled !== void 0 ? _opts$enabled : defaultOpts === null || defaultOpts === void 0 ? void 0 : defaultOpts.enabled) !== false && !isInputSkipToken && !queryClient.getQueryCache().find({ queryKey })) prefetchQuery(queryKey, opts);
const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, defaultOpts), opts));
const shouldAbortOnUnmount = (_ref = (_opts$trpc$abortOnUnm = opts === null || opts === void 0 || (_opts$trpc2 = opts.trpc) === null || _opts$trpc2 === void 0 ? void 0 : _opts$trpc2.abortOnUnmount) !== null && _opts$trpc$abortOnUnm !== void 0 ? _opts$trpc$abortOnUnm : config === null || config === void 0 ? void 0 : config.abortOnUnmount) !== null && _ref !== void 0 ? _ref : abortOnUnmount;
const hook = useQuery((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, ssrOpts), {}, {
queryKey,
queryFn: isInputSkipToken ? input : async (queryFunctionContext) => {
const actualOpts = (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, ssrOpts), {}, { trpc: (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, ssrOpts === null || ssrOpts === void 0 ? void 0 : ssrOpts.trpc), shouldAbortOnUnmount ? { signal: queryFunctionContext.signal } : { signal: null }) });
const result = await client.query(...getClientArgs(queryKey, actualOpts));
if (isAsyncIterable(result)) return buildQueryFromAsyncIterable(result, queryClient, queryKey);
return result;
}
}), queryClient);
hook.trpc = useHookResult({ path });
return hook;
}
function usePrefetchQuery$1(path, input, opts) {
var _ref2, _opts$trpc$abortOnUnm2, _opts$trpc3;
const context = useContext();
const queryKey = getQueryKeyInternal(path, input, "query");
const isInputSkipToken = input === skipToken;
const shouldAbortOnUnmount = (_ref2 = (_opts$trpc$abortOnUnm2 = opts === null || opts === void 0 || (_opts$trpc3 = opts.trpc) === null || _opts$trpc3 === void 0 ? void 0 : _opts$trpc3.abortOnUnmount) !== null && _opts$trpc$abortOnUnm2 !== void 0 ? _opts$trpc$abortOnUnm2 : config === null || config === void 0 ? void 0 : config.abortOnUnmount) !== null && _ref2 !== void 0 ? _ref2 : context.abortOnUnmount;
usePrefetchQuery((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, {
queryKey,
queryFn: isInputSkipToken ? input : (queryFunctionContext) => {
const actualOpts = { trpc: (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts === null || opts === void 0 ? void 0 : opts.trpc), shouldAbortOnUnmount ? { signal: queryFunctionContext.signal } : {}) };
return context.client.query(...getClientArgs(queryKey, actualOpts));
}
}));
}
function useSuspenseQuery$1(path, input, opts) {
var _ref3, _opts$trpc$abortOnUnm3, _opts$trpc4;
const context = useContext();
const queryKey = getQueryKeyInternal(path, input, "query");
const shouldAbortOnUnmount = (_ref3 = (_opts$trpc$abortOnUnm3 = opts === null || opts === void 0 || (_opts$trpc4 = opts.trpc) === null || _opts$trpc4 === void 0 ? void 0 : _opts$trpc4.abortOnUnmount) !== null && _opts$trpc$abortOnUnm3 !== void 0 ? _opts$trpc$abortOnUnm3 : config === null || config === void 0 ? void 0 : config.abortOnUnmount) !== null && _ref3 !== void 0 ? _ref3 : context.abortOnUnmount;
const hook = useSuspenseQuery((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, {
queryKey,
queryFn: (queryFunctionContext) => {
const actualOpts = (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, { trpc: (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts === null || opts === void 0 ? void 0 : opts.trpc), shouldAbortOnUnmount ? { signal: queryFunctionContext.signal } : { signal: null }) });
return context.client.query(...getClientArgs(queryKey, actualOpts));
}
}), context.queryClient);
hook.trpc = useHookResult({ path });
return [hook.data, hook];
}
function useMutation$1(path, opts) {
const { client, queryClient } = useContext();
const mutationKey = getMutationKeyInternal(path);
const defaultOpts = queryClient.defaultMutationOptions(queryClient.getMutationDefaults(mutationKey));
const hook = useMutation((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, {
mutationKey,
mutationFn: (input) => {
return client.mutation(...getClientArgs([path, { input }], opts));
},
onSuccess(...args) {
var _ref4, _opts$meta;
const originalFn = () => {
var _opts$onSuccess, _opts$onSuccess2, _defaultOpts$onSucces;
return (_opts$onSuccess = opts === null || opts === void 0 || (_opts$onSuccess2 = opts.onSuccess) === null || _opts$onSuccess2 === void 0 ? void 0 : _opts$onSuccess2.call(opts, ...args)) !== null && _opts$onSuccess !== void 0 ? _opts$onSuccess : defaultOpts === null || defaultOpts === void 0 || (_defaultOpts$onSucces = defaultOpts.onSuccess) === null || _defaultOpts$onSucces === void 0 ? void 0 : _defaultOpts$onSucces.call(defaultOpts, ...args);
};
return mutationSuccessOverride({
originalFn,
queryClient,
meta: (_ref4 = (_opts$meta = opts === null || opts === void 0 ? void 0 : opts.meta) !== null && _opts$meta !== void 0 ? _opts$meta : defaultOpts === null || defaultOpts === void 0 ? void 0 : defaultOpts.meta) !== null && _ref4 !== void 0 ? _ref4 : {}
});
}
}), queryClient);
hook.trpc = useHookResult({ path });
return hook;
}
const initialStateIdle = {
data: void 0,
error: null,
status: "idle"
};
const initialStateConnecting = {
data: void 0,
error: null,
status: "connecting"
};
/* istanbul ignore next -- @preserve */
function useSubscription(path, input, opts) {
var _opts$enabled2;
const enabled = (_opts$enabled2 = opts === null || opts === void 0 ? void 0 : opts.enabled) !== null && _opts$enabled2 !== void 0 ? _opts$enabled2 : input !== skipToken;
const queryKey = hashKey(getQueryKeyInternal(path, input, "any"));
const { client } = useContext();
const optsRef = import_react.useRef(opts);
import_react.useEffect(() => {
optsRef.current = opts;
});
const [trackedProps] = import_react.useState(/* @__PURE__ */ new Set([]));
const addTrackedProp = import_react.useCallback((key) => {
trackedProps.add(key);
}, [trackedProps]);
const currentSubscriptionRef = import_react.useRef(null);
const updateState = import_react.useCallback((callback) => {
const prev = resultRef.current;
const next = resultRef.current = callback(prev);
let shouldUpdate = false;
for (const key of trackedProps) if (prev[key] !== next[key]) {
shouldUpdate = true;
break;
}
if (shouldUpdate) setState(trackResult(next, addTrackedProp));
}, [addTrackedProp, trackedProps]);
const reset = import_react.useCallback(() => {
var _currentSubscriptionR;
(_currentSubscriptionR = currentSubscriptionRef.current) === null || _currentSubscriptionR === void 0 || _currentSubscriptionR.unsubscribe();
if (!enabled) {
updateState(() => (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, initialStateIdle), {}, { reset }));
return;
}
updateState(() => (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, initialStateConnecting), {}, { reset }));
currentSubscriptionRef.current = client.subscription(path.join("."), input !== null && input !== void 0 ? input : void 0, {
onStarted: () => {
var _optsRef$current$onSt, _optsRef$current;
(_optsRef$current$onSt = (_optsRef$current = optsRef.current).onStarted) === null || _optsRef$current$onSt === void 0 || _optsRef$current$onSt.call(_optsRef$current);
updateState((prev) => (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, prev), {}, {
status: "pending",
error: null
}));
},
onData: (data) => {
var _optsRef$current$onDa, _optsRef$current2;
(_optsRef$current$onDa = (_optsRef$current2 = optsRef.current).onData) === null || _optsRef$current$onDa === void 0 || _optsRef$current$onDa.call(_optsRef$current2, data);
updateState((prev) => (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, prev), {}, {
status: "pending",
data,
error: null
}));
},
onError: (error) => {
var _optsRef$current$onEr, _optsRef$current3;
(_optsRef$current$onEr = (_optsRef$current3 = optsRef.current).onError) === null || _optsRef$current$onEr === void 0 || _optsRef$current$onEr.call(_optsRef$current3, error);
updateState((prev) => (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, prev), {}, {
status: "error",
error
}));
},
onConnectionStateChange: (result) => {
updateState((prev) => {
switch (result.state) {
case "idle": return (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, prev), {}, {
status: result.state,
error: null,
data: void 0
});
case "connecting": return (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, prev), {}, {
error: result.error,
status: result.state
});
case "pending": return prev;
}
});
},
onComplete: () => {
var _optsRef$current$onCo, _optsRef$current4;
(_optsRef$current$onCo = (_optsRef$current4 = optsRef.current).onComplete) === null || _optsRef$current$onCo === void 0 || _optsRef$current$onCo.call(_optsRef$current4);
updateState((prev) => (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, prev), {}, {
status: "idle",
error: null,
data: void 0
}));
}
});
}, [
client,
queryKey,
enabled,
updateState
]);
import_react.useEffect(() => {
reset();
return () => {
var _currentSubscriptionR2;
(_currentSubscriptionR2 = currentSubscriptionRef.current) === null || _currentSubscriptionR2 === void 0 || _currentSubscriptionR2.unsubscribe();
};
}, [reset]);
const resultRef = import_react.useRef(enabled ? (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, initialStateConnecting), {}, { reset }) : (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, initialStateIdle), {}, { reset }));
const [state, setState] = import_react.useState(trackResult(resultRef.current, addTrackedProp));
return state;
}
function useInfiniteQuery$1(path, input, opts) {
var _opts$trpc5, _opts$enabled3, _opts$trpc$abortOnUnm4, _opts$trpc6, _opts$initialCursor;
const { client, ssrState, prefetchInfiniteQuery, queryClient, abortOnUnmount } = useContext();
const queryKey = getQueryKeyInternal(path, input, "infinite");
const defaultOpts = queryClient.getQueryDefaults(queryKey);
const isInputSkipToken = input === skipToken;
if (typeof window === "undefined" && ssrState === "prepass" && (opts === null || opts === void 0 || (_opts$trpc5 = opts.trpc) === null || _opts$trpc5 === void 0 ? void 0 : _opts$trpc5.ssr) !== false && ((_opts$enabled3 = opts === null || opts === void 0 ? void 0 : opts.enabled) !== null && _opts$enabled3 !== void 0 ? _opts$enabled3 : defaultOpts === null || defaultOpts === void 0 ? void 0 : defaultOpts.enabled) !== false && !isInputSkipToken && !queryClient.getQueryCache().find({ queryKey })) prefetchInfiniteQuery(queryKey, (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, defaultOpts), opts));
const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, defaultOpts), opts));
const shouldAbortOnUnmount = (_opts$trpc$abortOnUnm4 = opts === null || opts === void 0 || (_opts$trpc6 = opts.trpc) === null || _opts$trpc6 === void 0 ? void 0 : _opts$trpc6.abortOnUnmount) !== null && _opts$trpc$abortOnUnm4 !== void 0 ? _opts$trpc$abortOnUnm4 : abortOnUnmount;
const hook = useInfiniteQuery((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, ssrOpts), {}, {
initialPageParam: (_opts$initialCursor = opts.initialCursor) !== null && _opts$initialCursor !== void 0 ? _opts$initialCursor : null,
persister: opts.persister,
queryKey,
queryFn: isInputSkipToken ? input : (queryFunctionContext) => {
var _queryFunctionContext;
const actualOpts = (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, ssrOpts), {}, { trpc: (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, ssrOpts === null || ssrOpts === void 0 ? void 0 : ssrOpts.trpc), shouldAbortOnUnmount ? { signal: queryFunctionContext.signal } : { signal: null }) });
return client.query(...getClientArgs(queryKey, actualOpts, {
pageParam: (_queryFunctionContext = queryFunctionContext.pageParam) !== null && _queryFunctionContext !== void 0 ? _queryFunctionContext : opts.initialCursor,
direction: queryFunctionContext.direction
}));
}
}), queryClient);
hook.trpc = useHookResult({ path });
return hook;
}
function usePrefetchInfiniteQuery$1(path, input, opts) {
var _opts$trpc$abortOnUnm5, _opts$trpc7, _opts$initialCursor2;
const context = useContext();
const queryKey = getQueryKeyInternal(path, input, "infinite");
const defaultOpts = context.queryClient.getQueryDefaults(queryKey);
const isInputSkipToken = input === skipToken;
const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, defaultOpts), opts));
const shouldAbortOnUnmount = (_opts$trpc$abortOnUnm5 = opts === null || opts === void 0 || (_opts$trpc7 = opts.trpc) === null || _opts$trpc7 === void 0 ? void 0 : _opts$trpc7.abortOnUnmount) !== null && _opts$trpc$abortOnUnm5 !== void 0 ? _opts$trpc$abortOnUnm5 : context.abortOnUnmount;
usePrefetchInfiniteQuery((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, {
initialPageParam: (_opts$initialCursor2 = opts.initialCursor) !== null && _opts$initialCursor2 !== void 0 ? _opts$initialCursor2 : null,
queryKey,
queryFn: isInputSkipToken ? input : (queryFunctionContext) => {
var _queryFunctionContext2;
const actualOpts = (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, ssrOpts), {}, { trpc: (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, ssrOpts === null || ssrOpts === void 0 ? void 0 : ssrOpts.trpc), shouldAbortOnUnmount ? { signal: queryFunctionContext.signal } : {}) });
return context.client.query(...getClientArgs(queryKey, actualOpts, {
pageParam: (_queryFunctionContext2 = queryFunctionContext.pageParam) !== null && _queryFunctionContext2 !== void 0 ? _queryFunctionContext2 : opts.initialCursor,
direction: queryFunctionContext.direction
}));
}
}));
}
function useSuspenseInfiniteQuery$1(path, input, opts) {
var _opts$trpc$abortOnUnm6, _opts$trpc8, _opts$initialCursor3;
const context = useContext();
const queryKey = getQueryKeyInternal(path, input, "infinite");
const defaultOpts = context.queryClient.getQueryDefaults(queryKey);
const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, defaultOpts), opts));
const shouldAbortOnUnmount = (_opts$trpc$abortOnUnm6 = opts === null || opts === void 0 || (_opts$trpc8 = opts.trpc) === null || _opts$trpc8 === void 0 ? void 0 : _opts$trpc8.abortOnUnmount) !== null && _opts$trpc$abortOnUnm6 !== void 0 ? _opts$trpc$abortOnUnm6 : context.abortOnUnmount;
const hook = useSuspenseInfiniteQuery((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, {
initialPageParam: (_opts$initialCursor3 = opts.initialCursor) !== null && _opts$initialCursor3 !== void 0 ? _opts$initialCursor3 : null,
queryKey,
queryFn: (queryFunctionContext) => {
var _queryFunctionContext3;
const actualOpts = (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, ssrOpts), {}, { trpc: (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, ssrOpts === null || ssrOpts === void 0 ? void 0 : ssrOpts.trpc), shouldAbortOnUnmount ? { signal: queryFunctionContext.signal } : {}) });
return context.client.query(...getClientArgs(queryKey, actualOpts, {
pageParam: (_queryFunctionContext3 = queryFunctionContext.pageParam) !== null && _queryFunctionContext3 !== void 0 ? _queryFunctionContext3 : opts.initialCursor,
direction: queryFunctionContext.direction
}));
}
}), context.queryClient);
hook.trpc = useHookResult({ path });
return [hook.data, hook];
}
const useQueries$1 = (queriesCallback, options) => {
const { ssrState, queryClient, prefetchQuery, client } = useContext();
const queries = queriesCallback(createUseQueries(client));
if (typeof window === "undefined" && ssrState === "prepass") for (const query of queries) {
var _queryOption$trpc;
const queryOption = query;
if (((_queryOption$trpc = queryOption.trpc) === null || _queryOption$trpc === void 0 ? void 0 : _queryOption$trpc.ssr) !== false && !queryClient.getQueryCache().find({ queryKey: queryOption.queryKey })) prefetchQuery(queryOption.queryKey, queryOption);
}
return useQueries({
queries: queries.map((query) => (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, query), {}, { queryKey: query.queryKey })),
combine: options === null || options === void 0 ? void 0 : options.combine
}, queryClient);
};
const useSuspenseQueries$1 = (queriesCallback) => {
const { queryClient, client } = useContext();
const hook = useSuspenseQueries({ queries: queriesCallback(createUseQueries(client)).map((query) => (0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, query), {}, {
queryFn: query.queryFn,
queryKey: query.queryKey
})) }, queryClient);
return [hook.map((h) => h.data), hook];
};
return {
Provider: TRPCProvider,
createClient,
useContext,
useUtils: useContext,
useQuery: useQuery$1,
usePrefetchQuery: usePrefetchQuery$1,
useSuspenseQuery: useSuspenseQuery$1,
useQueries: useQueries$1,
useSuspenseQueries: useSuspenseQueries$1,
useMutation: useMutation$1,
useSubscription,
useInfiniteQuery: useInfiniteQuery$1,
usePrefetchInfiniteQuery: usePrefetchInfiniteQuery$1,
useSuspenseInfiniteQuery: useSuspenseInfiniteQuery$1
};
}
//#endregion
//#region node_modules/@trpc/react-query/dist/index.mjs
/**
* @internal
*/
function createHooksInternal(trpc) {
const proxy = createReactDecoration(trpc);
return createFlatProxy((key) => {
if (key === "useContext" || key === "useUtils") return () => {
const context = trpc.useUtils();
return import_react.useMemo(() => {
return createReactQueryUtils(context);
}, [context]);
};
if (trpc.hasOwnProperty(key)) return trpc[key];
return proxy[key];
});
}
function createTRPCReact(opts) {
return createHooksInternal(createRootHooks(opts));
}
//#endregion
export { createTRPCReact as t };

View file

@ -0,0 +1,64 @@
String.fromCharCode;
var ENC_SLASH_RE = /%2f/gi;
function decode(text = "") {
try {
return decodeURIComponent("" + text);
} catch {
return "" + text;
}
}
function decodePath(text) {
return decode(text.replace(ENC_SLASH_RE, "%252F"));
}
var TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
var JOIN_LEADING_SLASH_RE = /^\.?\//;
function hasTrailingSlash(input = "", respectQueryAndFragment) {
if (!respectQueryAndFragment) return input.endsWith("/");
return TRAILING_SLASH_RE.test(input);
}
function withoutTrailingSlash(input = "", respectQueryAndFragment) {
if (!respectQueryAndFragment) return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
if (!hasTrailingSlash(input, true)) return input || "/";
let path = input;
let fragment = "";
const fragmentIndex = input.indexOf("#");
if (fragmentIndex !== -1) {
path = input.slice(0, fragmentIndex);
fragment = input.slice(fragmentIndex);
}
const [s0, ...s] = path.split("?");
return ((s0.endsWith("/") ? s0.slice(0, -1) : s0) || "/") + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
}
function withTrailingSlash(input = "", respectQueryAndFragment) {
if (!respectQueryAndFragment) return input.endsWith("/") ? input : input + "/";
if (hasTrailingSlash(input, true)) return input || "/";
let path = input;
let fragment = "";
const fragmentIndex = input.indexOf("#");
if (fragmentIndex !== -1) {
path = input.slice(0, fragmentIndex);
fragment = input.slice(fragmentIndex);
if (!path) return fragment;
}
const [s0, ...s] = path.split("?");
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
}
function hasLeadingSlash(input = "") {
return input.startsWith("/");
}
function withLeadingSlash(input = "") {
return hasLeadingSlash(input) ? input : "/" + input;
}
function isNonEmptyURL(url) {
return url && url !== "/";
}
function joinURL(base, ...input) {
let url = base || "";
for (const segment of input.filter((url2) => isNonEmptyURL(url2))) if (url) {
const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
url = withTrailingSlash(url) + _segment;
} else url = segment;
return url;
}
//#endregion
export { withoutTrailingSlash as i, joinURL as n, withLeadingSlash as r, decodePath as t };

View file

@ -0,0 +1,48 @@
import { o as __toESM } from "../_runtime.mjs";
import { h as require_react } from "./react+tanstack__react-query.mjs";
//#region node_modules/zustand/esm/vanilla.mjs
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
var createStoreImpl = (createState) => {
let state;
const listeners = /* @__PURE__ */ new Set();
const setState = (partial, replace) => {
const nextState = typeof partial === "function" ? partial(state) : partial;
if (!Object.is(nextState, state)) {
const previousState = state;
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
listeners.forEach((listener) => listener(state, previousState));
}
};
const getState = () => state;
const getInitialState = () => initialState;
const subscribe = (listener) => {
listeners.add(listener);
return () => listeners.delete(listener);
};
const api = {
setState,
getState,
getInitialState,
subscribe
};
const initialState = state = createState(setState, getState, api);
return api;
};
var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
//#endregion
//#region node_modules/zustand/esm/react.mjs
var identity = (arg) => arg;
function useStore(api, selector = identity) {
const slice = import_react.useSyncExternalStore(api.subscribe, import_react.useCallback(() => selector(api.getState()), [api, selector]), import_react.useCallback(() => selector(api.getInitialState()), [api, selector]));
import_react.useDebugValue(slice);
return slice;
}
var createImpl = (createState) => {
const api = createStore(createState);
const useBoundStore = (selector) => useStore(api, selector);
Object.assign(useBoundStore, api);
return useBoundStore;
};
var create = ((createState) => createState ? createImpl(createState) : createImpl);
//#endregion
export { create as t };

View file

@ -0,0 +1,37 @@
import { createRequire } from "node:module";
//#region \0rolldown/runtime.js
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
var __exportAll = (all, no_symbols) => {
let target = {};
for (var name in all) __defProp(target, name, {
get: all[name],
enumerable: true
});
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
return target;
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __require = /* @__PURE__ */ createRequire(import.meta.url);
//#endregion
export { __toCommonJS as a, __require as i, __esmMin as n, __toESM as o, __exportAll as r, __commonJSMin as t };

View file

@ -0,0 +1,104 @@
import { o as __toESM } from "../_runtime.mjs";
import { h as require_react, m as require_jsx_runtime } from "../_libs/react+tanstack__react-query.mjs";
import { n as trpc } from "./trpc-client-CQOIB5UU.mjs";
import { l as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/auth-context-DzjwonUC.js
var import_react = /* @__PURE__ */ __toESM(require_react());
var import_jsx_runtime = require_jsx_runtime();
var AuthContext = (0, import_react.createContext)(void 0);
function AuthProvider({ children }) {
const [state, setState] = (0, import_react.useState)({
user: null,
userDetails: null,
isAuthenticated: false,
isLoading: true,
token: null
});
const navigate = useNavigate();
(0, import_react.useEffect)(() => {
const storedToken = localStorage.getItem("auth_token");
const storedUserId = localStorage.getItem("user_id");
if (storedToken && storedUserId) setState((prev) => ({
...prev,
token: storedToken,
isAuthenticated: true
}));
else setState((prev) => ({
...prev,
isLoading: false
}));
}, []);
const { data: selfData } = trpc.user.user.getSelfData.useQuery(void 0, {
enabled: !!state.token && state.isAuthenticated,
retry: 1
});
(0, import_react.useEffect)(() => {
if (selfData?.data) setState((prev) => ({
...prev,
user: selfData.data,
userDetails: selfData.data,
isLoading: false
}));
else if (selfData === void 0 && state.token) {}
}, [selfData, state.token]);
const login = (0, import_react.useCallback)((token, user) => {
localStorage.setItem("auth_token", token);
localStorage.setItem("user_id", String(user.id));
setState({
user,
userDetails: user,
isAuthenticated: true,
isLoading: false,
token
});
}, []);
const loginWithToken = (0, import_react.useCallback)((token, user) => {
login(token, user);
}, [login]);
const register = (0, import_react.useCallback)((token, user) => {
login(token, user);
}, [login]);
const logout = (0, import_react.useCallback)(() => {
localStorage.removeItem("auth_token");
localStorage.removeItem("user_id");
setState({
user: null,
userDetails: null,
isAuthenticated: false,
isLoading: false,
token: null
});
navigate({ to: "/login" });
}, [navigate]);
const updateUser = (0, import_react.useCallback)((user) => {
setState((prev) => ({
...prev,
user
}));
}, []);
const updateUserDetails = (0, import_react.useCallback)((details) => {
setState((prev) => ({
...prev,
userDetails: details
}));
}, []);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AuthContext.Provider, {
value: {
...state,
login,
loginWithToken,
register,
logout,
updateUser,
updateUserDetails
},
children
});
}
function useAuth() {
const context = (0, import_react.useContext)(AuthContext);
if (!context) throw new Error("useAuth must be used within AuthProvider");
return context;
}
//#endregion
export { useAuth as n, AuthProvider as t };

View file

@ -0,0 +1,102 @@
import { m as require_jsx_runtime } from "../_libs/react+tanstack__react-query.mjs";
import { a as Trash2 } from "../_libs/lucide-react.mjs";
import { a as MyText, i as MyButton, l as Quantifier, s as MyTouchableOpacity, t as AppContainer } from "./src-u_N1opJl.mjs";
import { a as useUpdateCartItem, i as useRemoveFromCart, r as useGetCart } from "./cart-query-hooks-Bz8ID9jY.mjs";
import { t as useAllProducts } from "./prominent-api-hooks-CNVDntUD.mjs";
import { l as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/cart-CHg5Ccyz.js
var import_jsx_runtime = require_jsx_runtime();
function CartPage() {
const navigate = useNavigate();
const { data: cart } = useGetCart("regular");
const { data: productsData } = useAllProducts();
const updateItem = useUpdateCartItem("regular");
const removeItem = useRemoveFromCart("regular");
const products = productsData?.products || [];
const productsById = {};
products.forEach((p) => {
productsById[p.id] = p;
});
const cartItems = (cart?.items || []).filter((item) => productsById[item.productId]);
let total = 0;
cartItems.forEach((item) => {
const product = productsById[item.productId];
if (product) total += product.price * item.quantity;
});
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AppContainer, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
className: "mb-4 text-xl",
children: "Your Cart"
}), cartItems.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex flex-col items-center gap-4 py-20",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
className: "text-gray-500",
children: "Your cart is empty"
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyButton, {
textContent: "Browse Products",
onClick: () => navigate({ to: "/home" })
})]
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "flex flex-col gap-3",
children: cartItems.map((item) => {
const product = productsById[item.productId];
const price = product.price;
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex items-center gap-3 rounded-xl border border-gray-100 bg-white p-3 shadow-sm",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
src: product.images?.[0],
alt: product.name,
className: "h-16 w-16 rounded-lg object-cover"
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex-1",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "semibold",
className: "text-sm",
numberOfLines: 1,
children: product.name
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-brand-600 text-sm font-bold",
children: ["₹", price]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Quantifier, {
value: item.quantity,
setValue: (q) => updateItem.mutate({
productId: item.productId,
quantity: q
})
})
]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyTouchableOpacity, {
onClick: () => removeItem.mutate(item.productId),
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "h-5 w-5 text-red-500" })
})
]
}, item.productId);
})
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "fixed bottom-0 left-0 right-0 border-t border-gray-200 bg-white p-4 shadow-lg",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-3 flex items-center justify-between",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
children: "Total"
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
weight: "bold",
className: "text-lg text-brand-600",
children: ["₹", total]
})]
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyButton, {
fullWidth: true,
textContent: "Proceed to Checkout",
onClick: () => navigate({ to: "/checkout" }),
className: "bg-brand-500 text-white"
})]
})] })] });
}
//#endregion
export { CartPage as component };

View file

@ -0,0 +1,91 @@
import { n as useMutation, p as useQueryClient, u as useQuery } from "../_libs/react+tanstack__react-query.mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/cart-query-hooks-Bz8ID9jY.js
function getCartKey(cartType) {
return `local-cart-${cartType}`;
}
function readCart(cartType) {
try {
const raw = localStorage.getItem(getCartKey(cartType));
return raw ? JSON.parse(raw) : [];
} catch {
return [];
}
}
function writeCart(cartType, items) {
localStorage.setItem(getCartKey(cartType), JSON.stringify(items));
}
function useGetCart(cartType = "regular") {
return useQuery({
queryKey: [getCartKey(cartType)],
queryFn: () => {
const items = readCart(cartType);
return {
items,
totalItems: items.reduce((sum, item) => sum + item.quantity, 0),
totalAmount: 0
};
}
});
}
function useAddToCart(cartType = "regular") {
const queryClient = useQueryClient();
return useMutation({
mutationFn: async ({ productId, quantity, storeId, slotId, deliveryDate }) => {
const items = readCart(cartType);
const existing = items.find((i) => i.productId === productId);
if (existing) {
existing.quantity += quantity;
if (slotId) existing.slotId = slotId;
if (deliveryDate) existing.deliveryDate = deliveryDate;
} else items.push({
id: Date.now(),
productId,
quantity,
storeId,
addedAt: Date.now(),
slotId: slotId ?? null,
deliveryDate: deliveryDate ?? null
});
writeCart(cartType, items);
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: [getCartKey(cartType)] });
}
});
}
function useUpdateCartItem(cartType = "regular") {
const queryClient = useQueryClient();
return useMutation({
mutationFn: async ({ productId, quantity, slotId, deliveryDate }) => {
const items = readCart(cartType);
const existing = items.find((i) => i.productId === productId);
if (existing) {
existing.quantity = quantity;
if (slotId !== void 0) existing.slotId = slotId;
if (deliveryDate !== void 0) existing.deliveryDate = deliveryDate;
}
writeCart(cartType, items);
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: [getCartKey(cartType)] });
}
});
}
function useRemoveFromCart(cartType = "regular") {
const queryClient = useQueryClient();
return useMutation({
mutationFn: async (productId) => {
let items = readCart(cartType);
items = items.filter((i) => i.productId !== productId);
writeCart(cartType, items);
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: [getCartKey(cartType)] });
}
});
}
function clearLocalCart(cartType = "regular") {
localStorage.removeItem(getCartKey(cartType));
}
//#endregion
export { useUpdateCartItem as a, useRemoveFromCart as i, useAddToCart as n, useGetCart as r, clearLocalCart as t };

View file

@ -0,0 +1,20 @@
import { t as create } from "../_libs/zustand.mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/central-product-store-TS-vQ8-V.js
var useCentralProductStore = create((set) => ({
products: [],
productsById: {},
setProducts: (products) => {
const productsById = {};
products.forEach((p) => {
productsById[p.id] = p;
});
set({
products,
productsById
});
},
refetchProducts: null,
setRefetchProducts: (fn) => set({ refetchProducts: fn })
}));
//#endregion
export { useCentralProductStore as t };

View file

@ -0,0 +1,153 @@
import { o as __toESM } from "../_runtime.mjs";
import { h as require_react, m as require_jsx_runtime, p as useQueryClient } from "../_libs/react+tanstack__react-query.mjs";
import { a as MyText, i as MyButton, r as LoadingDialog, s as MyTouchableOpacity, t as AppContainer } from "./src-u_N1opJl.mjs";
import { r as useGetCart, t as clearLocalCart } from "./cart-query-hooks-Bz8ID9jY.mjs";
import { n as trpc } from "./trpc-client-CQOIB5UU.mjs";
import { t as useAllProducts } from "./prominent-api-hooks-CNVDntUD.mjs";
import { l as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
import { n as useAuth } from "./auth-context-DzjwonUC.mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/checkout-CaijlEpv.js
var import_react = /* @__PURE__ */ __toESM(require_react());
var import_jsx_runtime = require_jsx_runtime();
function CheckoutPage() {
const navigate = useNavigate();
const queryClient = useQueryClient();
const { isAuthenticated } = useAuth();
const { data: cart } = useGetCart("regular");
const { data: productsData } = useAllProducts();
const [isLoading, setIsLoading] = (0, import_react.useState)(false);
const products = productsData?.products || [];
const productsById = {};
products.forEach((p) => {
productsById[p.id] = p;
});
const { data: addresses } = trpc.user.address.getUserAddresses.useQuery(void 0, { enabled: isAuthenticated });
const [selectedAddressId, setSelectedAddressId] = (0, import_react.useState)(null);
const cartItems = (cart?.items || []).filter((item) => productsById[item.productId]);
let total = 0;
cartItems.forEach((item) => {
const product = productsById[item.productId];
if (product) total += product.price * item.quantity;
});
const placeOrderMutation = trpc.user.order.placeOrder.useMutation({
onSuccess: (data) => {
const order = data.data?.[0];
clearLocalCart("regular");
queryClient.invalidateQueries({ queryKey: ["local-cart-regular"] });
navigate({
to: "/home/order-success",
search: {
orderId: order?.id,
totalAmount: total
}
});
},
onSettled: () => setIsLoading(false)
});
const handlePlaceOrder = () => {
if (!selectedAddressId) return;
setIsLoading(true);
placeOrderMutation.mutate({
selectedItems: cartItems.map((item) => ({
productId: item.productId,
quantity: item.quantity,
slotId: null
})),
addressId: selectedAddressId,
paymentMethod: "cod",
isFlashDelivery: false
});
};
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AppContainer, { children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
className: "mb-4 text-xl",
children: "Checkout"
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-6",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "semibold",
className: "mb-2",
children: "Delivery Address"
}), addresses?.data?.map((addr) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyTouchableOpacity, {
onClick: () => setSelectedAddressId(addr.id),
className: `mb-2 rounded-xl border p-3 ${selectedAddressId === addr.id ? "border-brand-500 bg-brand-50" : "border-gray-200"}`,
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "semibold",
children: addr.name
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-sm text-gray-600",
children: [
addr.addressLine1,
", ",
addr.city
]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
className: "text-sm text-gray-500",
children: addr.phone
})
]
}, addr.id))]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-6",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "semibold",
className: "mb-2",
children: "Order Summary"
}),
cartItems.map((item) => {
const product = productsById[item.productId];
if (!product) return null;
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex items-center justify-between py-2",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-sm",
numberOfLines: 1,
children: [
product.name,
" x",
item.quantity
]
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-sm font-bold",
children: ["₹", product.price * item.quantity]
})]
}, item.productId);
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "mt-2 border-t border-gray-200 pt-2",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex items-center justify-between",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
children: "Total"
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
weight: "bold",
className: "text-brand-600",
children: ["₹", total]
})]
})
})
]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyButton, {
fullWidth: true,
textContent: "Place Order (COD)",
onClick: handlePlaceOrder,
disabled: !selectedAddressId || placeOrderMutation.isPending,
className: "bg-brand-500 text-white"
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingDialog, {
open: isLoading,
message: "Placing your order..."
})
] });
}
//#endregion
export { CheckoutPage as component };

View file

@ -0,0 +1,109 @@
import { o as __toESM } from "../_runtime.mjs";
import { h as require_react, m as require_jsx_runtime } from "../_libs/react+tanstack__react-query.mjs";
import { l as ShoppingCart, t as Zap } from "../_libs/lucide-react.mjs";
import { a as MyText, i as MyButton, l as Quantifier, t as AppContainer } from "./src-u_N1opJl.mjs";
import { n as useAddToCart } from "./cart-query-hooks-Bz8ID9jY.mjs";
import { l as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
import { t as create } from "../_libs/zustand.mjs";
import { t as useCentralProductStore } from "./central-product-store-TS-vQ8-V.mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/flash-CkaCI73Q.js
var import_react = /* @__PURE__ */ __toESM(require_react());
var import_jsx_runtime = require_jsx_runtime();
var useCentralSlotStore = create((set) => ({
slots: [],
productSlotsMap: {},
setSlots: (slots) => set({ slots }),
setProductSlotsMap: (map) => set({ productSlotsMap: map }),
refetchSlots: null,
setRefetchSlots: (fn) => set({ refetchSlots: fn })
}));
function FlashDeliveryPage() {
const navigate = useNavigate();
const products = useCentralProductStore((s) => s.products);
const productSlotsMap = useCentralSlotStore((s) => s.productSlotsMap);
const [selectedQty, setSelectedQty] = (0, import_react.useState)({});
const addToCart = useAddToCart("flash");
const flashProducts = products.filter((p) => productSlotsMap[p.id]?.isFlashAvailable && !productSlotsMap[p.id]?.isOutOfStock);
const handleAddToCart = (product) => {
const qty = selectedQty[product.id] || 1;
addToCart.mutate({
productId: product.id,
quantity: qty,
storeId: product.storeId
}, { onSuccess: () => navigate({ to: "/flash/cart" }) });
};
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AppContainer, { children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-4 flex items-center gap-2",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Zap, { className: "h-6 w-6 text-yellow-500" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
className: "text-xl",
children: "1 Hr Delivery"
})]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "mb-4 rounded-xl bg-yellow-50 p-3",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
className: "text-sm text-yellow-800",
children: "Get these products delivered within 1 hour! Only available for select items."
})
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "grid grid-cols-2 gap-3",
children: flashProducts.map((product) => {
const price = product.discountedPrice ?? product.price;
const qty = selectedQty[product.id] || 1;
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "rounded-xl border border-gray-100 bg-white p-3 shadow-sm",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "mb-2 aspect-square w-full overflow-hidden rounded-lg bg-gray-100",
children: product.images?.[0] && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
src: product.images[0].uri,
alt: product.name,
className: "h-full w-full object-cover"
})
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "semibold",
className: "text-sm",
numberOfLines: 2,
children: product.name
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
weight: "bold",
className: "text-brand-600",
children: ["₹", price]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "mt-2 flex items-center gap-2",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Quantifier, {
value: qty,
setValue: (v) => setSelectedQty((prev) => ({
...prev,
[product.id]: v
}))
})
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyButton, {
fullWidth: true,
onClick: () => handleAddToCart(product),
className: "mt-2 flex items-center justify-center gap-1 bg-brand-500 text-white text-xs",
disabled: addToCart.isPending,
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShoppingCart, { className: "h-3 w-3" }), "Add"]
})
]
}, product.id);
})
}),
flashProducts.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "py-20 text-center",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
className: "text-gray-500",
children: "No flash delivery products available"
})
})
] });
}
//#endregion
export { FlashDeliveryPage as component };

View file

@ -0,0 +1,100 @@
import { m as require_jsx_runtime } from "../_libs/react+tanstack__react-query.mjs";
import { a as Trash2, t as Zap } from "../_libs/lucide-react.mjs";
import { a as MyText, i as MyButton, l as Quantifier, s as MyTouchableOpacity, t as AppContainer } from "./src-u_N1opJl.mjs";
import { a as useUpdateCartItem, i as useRemoveFromCart, r as useGetCart } from "./cart-query-hooks-Bz8ID9jY.mjs";
import { l as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
import { t as useCentralProductStore } from "./central-product-store-TS-vQ8-V.mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/flash.cart-BCcvG5Yb.js
var import_jsx_runtime = require_jsx_runtime();
function FlashCartPage() {
const navigate = useNavigate();
const { data: cart } = useGetCart("flash");
const updateItem = useUpdateCartItem("flash");
const removeItem = useRemoveFromCart("flash");
const productsById = useCentralProductStore((s) => s.productsById);
const cartItems = (cart?.items || []).filter((item) => productsById[item.productId]);
let total = 0;
cartItems.forEach((item) => {
const product = productsById[item.productId];
if (product) total += (product.discountedPrice ?? product.price) * item.quantity;
});
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AppContainer, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-4 flex items-center gap-2",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Zap, { className: "h-5 w-5 text-yellow-500" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
className: "text-xl",
children: "Flash Cart"
})]
}), cartItems.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex flex-col items-center gap-4 py-20",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
className: "text-gray-500",
children: "Your flash cart is empty"
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyButton, {
textContent: "Browse Flash Products",
onClick: () => navigate({ to: "/flash" })
})]
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "flex flex-col gap-3",
children: cartItems.map((item) => {
const product = productsById[item.productId];
const price = product.discountedPrice ?? product.price;
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex items-center gap-3 rounded-xl border border-gray-100 bg-white p-3 shadow-sm",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
src: product.images?.[0],
alt: product.name,
className: "h-16 w-16 rounded-lg object-cover"
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex-1",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "semibold",
className: "text-sm",
numberOfLines: 1,
children: product.name
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-brand-600 text-sm font-bold",
children: ["₹", price]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Quantifier, {
value: item.quantity,
setValue: (q) => updateItem.mutate({
productId: item.productId,
quantity: q
})
})
]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyTouchableOpacity, {
onClick: () => removeItem.mutate(item.productId),
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "h-5 w-5 text-red-500" })
})
]
}, item.productId);
})
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "fixed bottom-0 left-0 right-0 border-t border-gray-200 bg-white p-4 shadow-lg",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-3 flex items-center justify-between",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
children: "Total"
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
weight: "bold",
className: "text-lg text-brand-600",
children: ["₹", total]
})]
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyButton, {
fullWidth: true,
textContent: "Proceed to Checkout",
onClick: () => navigate({ to: "/flash/checkout" }),
className: "bg-brand-500 text-white"
})]
})] })] });
}
//#endregion
export { FlashCartPage as component };

View file

@ -0,0 +1,148 @@
import { o as __toESM } from "../_runtime.mjs";
import { h as require_react, m as require_jsx_runtime, p as useQueryClient } from "../_libs/react+tanstack__react-query.mjs";
import { a as MyText, i as MyButton, r as LoadingDialog, t as AppContainer } from "./src-u_N1opJl.mjs";
import { r as useGetCart, t as clearLocalCart } from "./cart-query-hooks-Bz8ID9jY.mjs";
import { n as trpc } from "./trpc-client-CQOIB5UU.mjs";
import { l as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
import { n as useAuth } from "./auth-context-DzjwonUC.mjs";
import { t as useCentralProductStore } from "./central-product-store-TS-vQ8-V.mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/flash.checkout-D2UaQnns.js
var import_react = /* @__PURE__ */ __toESM(require_react());
var import_jsx_runtime = require_jsx_runtime();
function FlashCheckoutPage() {
const navigate = useNavigate();
const queryClient = useQueryClient();
const { isAuthenticated } = useAuth();
const { data: cart } = useGetCart("flash");
const productsById = useCentralProductStore((s) => s.productsById);
const [isLoading, setIsLoading] = (0, import_react.useState)(false);
const { data: addresses } = trpc.user.address.getUserAddresses.useQuery(void 0, { enabled: isAuthenticated });
const [selectedAddressId, setSelectedAddressId] = (0, import_react.useState)(null);
const placeOrderMutation = trpc.user.order.placeOrder.useMutation({
onSuccess: (data) => {
const order = data.data?.[0];
clearLocalCart("flash");
queryClient.invalidateQueries({ queryKey: ["local-cart-flash"] });
navigate({
to: "/flash/order-success",
search: {
orderId: order?.id,
totalAmount: total
}
});
},
onSettled: () => setIsLoading(false)
});
const cartItems = (cart?.items || []).filter((item) => productsById[item.productId]);
let total = 0;
cartItems.forEach((item) => {
const product = productsById[item.productId];
if (product) total += (product.discountedPrice ?? product.price) * item.quantity;
});
const handlePlaceOrder = () => {
if (!selectedAddressId) return;
setIsLoading(true);
placeOrderMutation.mutate({
selectedItems: cartItems.map((item) => ({
productId: item.productId,
quantity: item.quantity,
slotId: null
})),
addressId: selectedAddressId,
paymentMethod: "cod",
isFlashDelivery: true
});
};
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AppContainer, { children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
className: "mb-4 text-xl",
children: "Flash Checkout"
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-6",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "semibold",
className: "mb-2",
children: "Delivery Address"
}), addresses?.data?.map((addr) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
onClick: () => setSelectedAddressId(addr.id),
className: `mb-2 w-full rounded-xl border p-3 text-left ${selectedAddressId === addr.id ? "border-brand-500 bg-brand-50" : "border-gray-200"}`,
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "semibold",
children: addr.name
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-sm text-gray-600",
children: [
addr.addressLine1,
", ",
addr.city
]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
className: "text-sm text-gray-500",
children: addr.phone
})
]
}, addr.id))]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-6",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "semibold",
className: "mb-2",
children: "Order Summary"
}),
cartItems.map((item) => {
const product = productsById[item.productId];
if (!product) return null;
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex items-center justify-between py-2",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-sm",
numberOfLines: 1,
children: [
product.name,
" x",
item.quantity
]
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-sm font-bold",
children: ["₹", (product.discountedPrice ?? product.price) * item.quantity]
})]
}, item.productId);
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "mt-2 border-t border-gray-200 pt-2",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex items-center justify-between",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
children: "Total"
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
weight: "bold",
className: "text-brand-600",
children: ["₹", total]
})]
})
})
]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyButton, {
fullWidth: true,
textContent: "Place Flash Order (COD)",
onClick: handlePlaceOrder,
disabled: !selectedAddressId || placeOrderMutation.isPending,
className: "bg-brand-500 text-white"
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingDialog, {
open: isLoading,
message: "Placing flash order..."
})
] });
}
//#endregion
export { FlashCheckoutPage as component };

View file

@ -0,0 +1,12 @@
import { o as lazyRouteComponent, s as createFileRoute } from "../_libs/@tanstack/react-router+[...].mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/flash.order-success-Bs-Lyb2u.js
var $$splitComponentImporter = () => import("./flash.order-success-C9tkVfq7.mjs");
var Route = createFileRoute("/flash/order-success")({
component: lazyRouteComponent($$splitComponentImporter, "component"),
validateSearch: (search) => ({
orderId: search.orderId || "",
totalAmount: search.totalAmount || "0"
})
});
//#endregion
export { Route as t };

View file

@ -0,0 +1,45 @@
import { m as require_jsx_runtime } from "../_libs/react+tanstack__react-query.mjs";
import { t as Zap } from "../_libs/lucide-react.mjs";
import { a as MyText, i as MyButton } from "./src-u_N1opJl.mjs";
import { l as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
import { t as Route } from "./flash.order-success-Bs-Lyb2u.mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/flash.order-success-C9tkVfq7.js
var import_jsx_runtime = require_jsx_runtime();
function FlashOrderSuccessPage() {
const navigate = useNavigate();
const { orderId, totalAmount } = Route.useSearch();
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex min-h-screen flex-col items-center justify-center bg-yellow-50 p-6",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "mb-6 flex h-20 w-20 items-center justify-center rounded-full bg-yellow-100",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Zap, { className: "h-10 w-10 text-yellow-600" })
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
className: "mb-2 text-2xl text-gray-900",
children: "1 Hr Order Placed!"
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "mb-1 text-gray-600",
children: ["Order ID: #", orderId]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "mb-8 text-gray-600",
children: ["Total: ₹", totalAmount]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyButton, {
textContent: "Continue Shopping",
onClick: () => navigate({ to: "/flash" }),
className: "mb-3 bg-brand-500 text-white"
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyButton, {
textContent: "View My Orders",
onClick: () => navigate({ to: "/me/orders" }),
className: "bg-gray-100 text-gray-700"
})
]
});
}
//#endregion
export { FlashOrderSuccessPage as component };

View file

@ -0,0 +1,84 @@
import { o as __toESM } from "../_runtime.mjs";
import { h as require_react, m as require_jsx_runtime } from "../_libs/react+tanstack__react-query.mjs";
import { l as ShoppingCart, t as Zap } from "../_libs/lucide-react.mjs";
import { a as MyText, i as MyButton, l as Quantifier, t as AppContainer } from "./src-u_N1opJl.mjs";
import { n as useAddToCart } from "./cart-query-hooks-Bz8ID9jY.mjs";
import { l as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
import { t as useCentralProductStore } from "./central-product-store-TS-vQ8-V.mjs";
import { t as Route } from "./flash.product._id-ZKApXVIZ.mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/flash.product._id-SS95dT27.js
var import_react = /* @__PURE__ */ __toESM(require_react());
var import_jsx_runtime = require_jsx_runtime();
function FlashProductDetailPage() {
const { id } = Route.useParams();
const productId = Number(id);
const navigate = useNavigate();
const [quantity, setQuantity] = (0, import_react.useState)(1);
const product = useCentralProductStore((s) => s.productsById)[productId];
const addToCart = useAddToCart("flash");
const handleAddToCart = () => {
if (!product) return;
addToCart.mutate({
productId: product.id,
quantity,
storeId: product.storeId
}, { onSuccess: () => navigate({ to: "/flash/cart" }) });
};
if (!product) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, { children: "Product not found" }) });
const price = product.discountedPrice ?? product.price;
const imageUrl = product.images?.[0];
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AppContainer, { children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-4 flex items-center gap-2",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Zap, { className: "h-5 w-5 text-yellow-500" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
className: "text-sm font-semibold text-yellow-600",
children: "1 Hr Delivery"
})]
}),
imageUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "mb-4 aspect-square w-full overflow-hidden rounded-xl bg-gray-100",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
src: imageUrl,
alt: product.name,
className: "h-full w-full object-cover"
})
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
className: "mb-1 text-xl",
children: product.name
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "mb-4 text-sm text-gray-500",
children: [product.unitValue, product.unit]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-4 flex items-baseline gap-2",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
weight: "bold",
className: "text-2xl text-brand-600",
children: ["₹", price]
}), product.discountedPrice && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-sm text-gray-400 line-through",
children: ["₹", product.price]
})]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "mb-6",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Quantifier, {
value: quantity,
setValue: setQuantity,
max: 10
})
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyButton, {
fullWidth: true,
onClick: handleAddToCart,
disabled: addToCart.isPending,
className: "flex items-center justify-center gap-2 bg-brand-500 text-white",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShoppingCart, { className: "h-4 w-4" }), addToCart.isPending ? "Adding..." : "Add to Cart"]
})
] });
}
//#endregion
export { FlashProductDetailPage as component };

View file

@ -0,0 +1,6 @@
import { o as lazyRouteComponent, s as createFileRoute } from "../_libs/@tanstack/react-router+[...].mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/flash.product._id-ZKApXVIZ.js
var $$splitComponentImporter = () => import("./flash.product._id-SS95dT27.mjs");
var Route = createFileRoute("/flash/product/$id")({ component: lazyRouteComponent($$splitComponentImporter, "component") });
//#endregion
export { Route as t };

View file

@ -0,0 +1,557 @@
import { o as __toESM } from "../_runtime.mjs";
import { h as require_react, m as require_jsx_runtime } from "../_libs/react+tanstack__react-query.mjs";
import { i as Truck, l as ShoppingCart, n as X, t as Zap } from "../_libs/lucide-react.mjs";
import { a as MyText, l as Quantifier, n as BottomDialog, s as MyTouchableOpacity, u as SearchBar } from "./src-u_N1opJl.mjs";
import { a as useUpdateCartItem, i as useRemoveFromCart, n as useAddToCart, r as useGetCart } from "./cart-query-hooks-Bz8ID9jY.mjs";
import { a as useStores, n as useBanners, r as useSlots, t as useAllProducts } from "./prominent-api-hooks-CNVDntUD.mjs";
import { l as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
import { t as create } from "../_libs/zustand.mjs";
import { t as require_dayjs_min } from "../_libs/dayjs.mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/home-BxXKVXbQ.js
var import_react = /* @__PURE__ */ __toESM(require_react());
var import_jsx_runtime = require_jsx_runtime();
var import_dayjs_min = /* @__PURE__ */ __toESM(require_dayjs_min());
var useCartStore = create((set) => ({
addedToCartProduct: null,
setAddedToCartProduct: (product) => set({ addedToCartProduct: product }),
clearAddedToCartProduct: () => set({ addedToCartProduct: null })
}));
var formatTimeRange = (deliveryTime) => {
const time = (0, import_dayjs_min.default)(deliveryTime);
const endTime = time.add(1, "hour");
const startPeriod = time.format("A");
const endPeriod = endTime.format("A");
if (startPeriod === endPeriod) return `${time.format("h")}-${endTime.format("h")} ${startPeriod}`;
else return `${time.format("h:mm")} ${startPeriod} - ${endTime.format("h:mm")} ${endPeriod}`;
};
function AddToCartDialog() {
const navigate = useNavigate();
const { addedToCartProduct, clearAddedToCartProduct } = useCartStore();
const [quantity, setQuantity] = (0, import_react.useState)(1);
const [selectedSlotId, setSelectedSlotId] = (0, import_react.useState)(null);
const [selectedFlashDelivery, setSelectedFlashDelivery] = (0, import_react.useState)(false);
const { data: slotsData } = useSlots();
const { data: cartData } = useGetCart();
const isFlashDeliveryEnabled = true;
const addToCart = useAddToCart("regular");
const updateItem = useUpdateCartItem("regular");
const removeItem = useRemoveFromCart("regular");
const isOpen = !!addedToCartProduct;
const product = addedToCartProduct?.product;
(0, import_react.useEffect)(() => {
if (isOpen && product) {
const cartItem = cartData?.items?.find((item) => item.productId === product.id);
const cartQuantity = cartItem?.quantity || 0;
setQuantity(cartQuantity === 0 ? 1 : cartQuantity);
setSelectedSlotId(cartItem?.slotId || null);
}
}, [
isOpen,
cartData,
product
]);
const { slotMap, productSlotIdsMap } = (0, import_react.useMemo)(() => {
const slotMap = {};
const productSlotIdsMap = {};
if (slotsData?.slots) slotsData.slots.forEach((slot) => {
slotMap[slot.id] = slot;
slot.products?.forEach((p) => {
if (!productSlotIdsMap[p.id]) productSlotIdsMap[p.id] = [];
productSlotIdsMap[p.id].push(slot.id);
});
});
return {
slotMap,
productSlotIdsMap
};
}, [slotsData]);
const availableSlotIds = productSlotIdsMap[product?.id] || [];
const availableSlots = availableSlotIds.map((slotId) => slotMap[slotId]).filter(Boolean).filter((slot) => (0, import_dayjs_min.default)(slot.deliveryTime).isAfter((0, import_dayjs_min.default)()));
const cartItem = cartData?.items?.find((item) => item.productId === product?.id);
const isUpdate = (cartItem?.quantity || 0) >= 1;
const showFlashOption = (slotsData?.productAvailability?.find((pa) => pa.id === product?.id))?.isFlashAvailable === true && isFlashDeliveryEnabled;
const handleAddToCart = () => {
if (selectedFlashDelivery) {
navigate({ to: "/flash" });
clearAddedToCartProduct();
return;
}
if (isUpdate && cartItem) updateItem.mutate({
productId: product.id,
quantity,
slotId: selectedSlotId,
deliveryDate: selectedSlotId ? slotMap[selectedSlotId]?.deliveryTime : null
}, { onSuccess: () => clearAddedToCartProduct() });
else {
const slotId = selectedSlotId ?? availableSlotIds[0] ?? 0;
addToCart.mutate({
productId: product.id,
quantity,
storeId: product.storeId || 1,
slotId,
deliveryDate: slotMap[slotId]?.deliveryTime || null
}, { onSuccess: () => clearAddedToCartProduct() });
}
};
const handleRemove = () => {
if (cartItem) removeItem.mutate(product.id, { onSuccess: () => clearAddedToCartProduct() });
else clearAddedToCartProduct();
};
if (!isOpen || !addedToCartProduct) return null;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BottomDialog, {
open: isOpen,
onClose: clearAddedToCartProduct,
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "px-2",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex items-start gap-3 mb-4",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "flex h-10 w-10 items-center justify-center rounded-full bg-blue-50",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Truck, { className: "h-5 w-5 text-blue-500" })
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex-1",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
className: "text-lg",
children: "Select Delivery Slot"
}), product?.name && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-sm text-gray-500",
children: [
product.name,
" (",
product.productQuantity,
product.unitNotation ? ` ${product.unitNotation}` : "",
")"
]
})]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
onClick: clearAddedToCartProduct,
className: "text-gray-400 hover:text-gray-600",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "h-5 w-5" })
})
]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "max-h-[40vh] space-y-3 overflow-y-auto mb-4",
children: availableSlots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyTouchableOpacity, {
onClick: () => {
setSelectedSlotId(slot.id);
setSelectedFlashDelivery(false);
},
className: `flex items-start gap-3 rounded-xl border bg-gray-50 p-4 ${selectedSlotId === slot.id ? "border-brand-500" : "border-gray-100"}`,
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Truck, { className: "mt-0.5 h-5 w-5 shrink-0 text-blue-500" }),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
weight: "bold",
className: "flex-1 text-sm",
children: [(0, import_dayjs_min.default)(slot.deliveryTime).format("ddd, DD MMM • "), formatTimeRange(slot.deliveryTime)]
}),
selectedSlotId === slot.id ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
className: "h-6 w-6 shrink-0 text-brand-500",
fill: "currentColor",
viewBox: "0 0 24 24",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" })
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
className: "h-6 w-6 shrink-0 text-gray-300",
fill: "currentColor",
viewBox: "0 0 24 24",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" })
})
]
}, slot.id))
}),
showFlashOption && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyTouchableOpacity, {
onClick: () => {
setSelectedFlashDelivery(true);
setSelectedSlotId(null);
},
className: `flex items-center gap-3 rounded-xl border p-4 mb-4 ${selectedFlashDelivery ? "border-pink-500 bg-pink-50" : "border-pink-200 bg-pink-50"}`,
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Zap, { className: "h-5 w-5 shrink-0 text-pink-500" }),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
className: "flex-1 text-sm",
children: "1 hr Delivery"
}),
selectedFlashDelivery ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
className: "h-6 w-6 shrink-0 text-pink-500",
fill: "currentColor",
viewBox: "0 0 24 24",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" })
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
className: "h-6 w-6 shrink-0 text-pink-300",
fill: "currentColor",
viewBox: "0 0 24 24",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" })
})
]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-4",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
className: "mb-2 text-sm",
children: "Quantity"
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex items-center gap-3",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Quantifier, {
value: quantity,
setValue: setQuantity,
step: 1,
unit: product?.unitNotation
}), isUpdate && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyTouchableOpacity, {
onClick: handleRemove,
className: "rounded-lg border border-red-200 bg-red-50 p-2",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
className: "h-5 w-5 text-red-500",
fill: "none",
stroke: "currentColor",
viewBox: "0 0 24 24",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: 2,
d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
})
})
})]
})]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex gap-3 pb-4",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
onClick: handleAddToCart,
disabled: !selectedSlotId && !selectedFlashDelivery || addToCart.isPending || updateItem.isPending,
className: `flex flex-1 items-center justify-center gap-2 rounded-xl py-3 font-bold text-white transition-colors ${!selectedSlotId && !selectedFlashDelivery || addToCart.isPending || updateItem.isPending ? "bg-brand-500/50" : "bg-brand-500 hover:bg-brand-600"}`,
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShoppingCart, { className: "h-4 w-4" }), addToCart.isPending || updateItem.isPending ? isUpdate ? "Updating..." : "Adding..." : isUpdate ? "Update Item" : "Add to Cart"]
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
onClick: clearAddedToCartProduct,
className: "flex-1 rounded-xl bg-gray-100 py-3 font-bold text-gray-700 hover:bg-gray-200 transition-colors",
children: "Cancel"
})]
})
]
})
});
}
function HomePage() {
const navigate = useNavigate();
const { data: productsData } = useAllProducts();
const { data: storesData } = useStores();
const { data: bannersData } = useBanners();
const { setAddedToCartProduct } = useCartStore();
const stores = storesData?.stores || [];
const banners = bannersData?.banners || [];
const allProducts = productsData?.products || [];
const handleAddToCart = (product) => {
setAddedToCartProduct({
productId: product.id,
product
});
};
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mx-auto min-h-screen max-w-7xl bg-white",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "sticky top-0 z-10 bg-white/95 backdrop-blur-sm px-4 md:px-6 lg:px-8 pt-4 pb-3 border-b border-gray-100",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SearchBar, {
placeholder: "Search products here...",
onSearch: (q) => navigate({
to: "/home/search",
search: { q }
})
})
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "px-4 md:px-6 lg:px-8",
children: [
banners.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "mt-4 mb-8 overflow-hidden rounded-xl",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BannerCarousel, { banners })
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-8",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "flex items-center justify-between mb-4",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
className: "text-lg md:text-xl",
children: "Our Stores"
})
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-3 md:gap-4",
children: stores.map((store) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StoreCard, {
store,
onClick: () => navigate({
to: "/stores/$storeId",
params: { storeId: String(store.id) }
})
}, store.id))
})]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-24",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "flex items-center justify-between mb-4",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
className: "text-lg md:text-xl",
children: "All Products"
})
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-3 md:gap-4",
children: allProducts.slice(0, 30).map((product) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProductCard, {
product,
onClick: () => navigate({
to: "/home/product/$id",
params: { id: String(product.id) }
}),
onAddToCart: () => handleAddToCart(product)
}, product.id))
})]
})
]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingCartBar, { onClick: () => navigate({ to: "/cart" }) }),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddToCartDialog, {})
]
});
}
function BannerCarousel({ banners }) {
const [index, setIndex] = (0, import_react.useState)(0);
const images = banners.map((b) => b.imageUrl).filter(Boolean);
(0, import_react.useEffect)(() => {
if (images.length <= 1) return;
const timer = setInterval(() => {
setIndex((i) => (i + 1) % images.length);
}, 4e3);
return () => clearInterval(timer);
}, [images.length]);
if (images.length === 0) return null;
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "relative group",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
src: images[index],
alt: "Banner",
className: "h-36 sm:h-44 md:h-52 lg:h-64 w-full rounded-xl object-cover transition-all duration-500"
}), images.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
onClick: () => setIndex((i) => (i - 1 + images.length) % images.length),
className: "absolute left-2 top-1/2 -translate-y-1/2 bg-black/30 hover:bg-black/50 text-white rounded-full p-1.5 opacity-0 group-hover:opacity-100 transition-opacity",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
className: "w-4 h-4",
fill: "none",
stroke: "currentColor",
viewBox: "0 0 24 24",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: 2,
d: "M15 19l-7-7 7-7"
})
})
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
onClick: () => setIndex((i) => (i + 1) % images.length),
className: "absolute right-2 top-1/2 -translate-y-1/2 bg-black/30 hover:bg-black/50 text-white rounded-full p-1.5 opacity-0 group-hover:opacity-100 transition-opacity",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
className: "w-4 h-4",
fill: "none",
stroke: "currentColor",
viewBox: "0 0 24 24",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: 2,
d: "M9 5l7 7-7 7"
})
})
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "absolute bottom-3 left-1/2 flex -translate-x-1/2 gap-1.5",
children: images.map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
onClick: () => setIndex(i),
className: `h-2 rounded-full transition-all ${i === index ? "w-6 bg-white" : "w-2 bg-white/50"}`
}, i))
})
] })]
});
}
function StoreCard({ store, onClick }) {
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyTouchableOpacity, {
onClick,
className: "rounded-xl border border-gray-100 bg-white p-3 shadow-sm hover:shadow-md transition-shadow",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "mb-2 aspect-square w-full overflow-hidden rounded-lg bg-gray-100",
children: store.signedImageUrl ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
src: store.signedImageUrl,
alt: store.name,
className: "h-full w-full object-cover"
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "flex h-full items-center justify-center text-gray-400",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
className: "w-8 h-8",
fill: "none",
stroke: "currentColor",
viewBox: "0 0 24 24",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: 1.5,
d: "M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"
})
})
})
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "semibold",
className: "text-sm truncate",
children: store.name
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-xs text-gray-500",
children: [store.productCount || 0, " products"]
})
]
});
}
function ProductCard({ product, onClick, onAddToCart }) {
const imageUrl = product.images?.[0];
const hasDiscount = product.marketPrice != null && product.marketPrice > product.price;
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "rounded-xl border border-gray-100 bg-white p-3 shadow-sm hover:shadow-md transition-shadow",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyTouchableOpacity, {
onClick,
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "mb-2 aspect-square w-full overflow-hidden rounded-lg bg-gray-100",
children: imageUrl ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
src: imageUrl,
alt: product.name,
className: "h-full w-full object-cover"
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "flex h-full items-center justify-center text-gray-300",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
className: "w-10 h-10",
fill: "none",
stroke: "currentColor",
viewBox: "0 0 24 24",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: 1.5,
d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
})
})
})
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "semibold",
className: "text-sm leading-tight line-clamp-2 mb-1",
children: product.name
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex items-baseline gap-1.5",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
weight: "bold",
className: "text-brand-600 text-sm md:text-base",
children: ["₹", product.price]
}), hasDiscount && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-xs text-gray-400 line-through",
children: ["₹", product.marketPrice]
})]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-[11px] text-gray-400 mb-2",
children: ["/", product.unit]
}),
product.nextDeliveryDate && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-3 flex items-center gap-1 self-start rounded-lg bg-brand-50 px-2 py-1 border border-brand-100",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Truck, { className: "h-3 w-3 text-brand-600" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
className: "text-[10px] font-bold text-brand-700",
children: (0, import_dayjs_min.default)(product.nextDeliveryDate).format("ddd, DD MMM • h:mm A")
})]
})
]
}), onAddToCart && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
onClick: (e) => {
e.stopPropagation();
onAddToCart();
},
className: "flex w-full items-center justify-center gap-2 rounded-lg bg-brand-500 py-2 text-sm font-bold text-white hover:bg-brand-600 transition-colors",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShoppingCart, { className: "h-4 w-4" }), "Add to Cart"]
})]
});
}
function FloatingCartBar({ onClick }) {
const { data: cartData } = useGetCart("regular");
const { data: productsData } = useAllProducts();
const products = productsData?.products || [];
const productsById = {};
products.forEach((p) => {
productsById[p.id] = p;
});
const cartItems = cartData?.items || [];
const itemCount = cartItems.length;
const totalCartValue = cartItems.reduce((sum, item) => {
return sum + (productsById[item.productId]?.price ?? 0) * item.quantity;
}, 0);
const freeDeliveryThreshold = 149;
const remainingForFreeDelivery = Math.max(0, freeDeliveryThreshold - totalCartValue);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "fixed bottom-0 left-0 right-0 z-20 bg-brand-600 px-4 py-2 md:px-6 md:py-3 shadow-lg",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mx-auto flex max-w-7xl items-center justify-between",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex-1",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex items-center gap-2",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
weight: "bold",
className: "text-sm text-white",
children: ["₹", totalCartValue]
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
className: "text-xs text-white/80",
children: itemCount === 0 ? "No items in cart" : `${itemCount} ${itemCount === 1 ? "item" : "items"}`
})]
}), remainingForFreeDelivery > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-[10px] font-bold text-white/70",
children: [
"₹",
remainingForFreeDelivery,
" more for FREE Delivery"
]
}) : itemCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex items-center gap-1",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
className: "h-3 w-3 text-emerald-300",
fill: "currentColor",
viewBox: "0 0 24 24",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" })
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
className: "text-[10px] font-bold text-emerald-300",
children: "Free Delivery Unlocked"
})]
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-[10px] text-white/50",
children: [
"Shop for ₹",
freeDeliveryThreshold,
"+ for free shipping"
]
})]
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
onClick,
className: "rounded-full bg-white px-4 py-2 text-sm font-bold text-brand-600 shadow-md hover:bg-gray-100 transition-colors",
children: "Go to Cart"
})]
})
});
}
//#endregion
export { HomePage as component };

View file

@ -0,0 +1,102 @@
import { m as require_jsx_runtime } from "../_libs/react+tanstack__react-query.mjs";
import { a as Trash2 } from "../_libs/lucide-react.mjs";
import { a as MyText, i as MyButton, l as Quantifier, s as MyTouchableOpacity, t as AppContainer } from "./src-u_N1opJl.mjs";
import { a as useUpdateCartItem, i as useRemoveFromCart, r as useGetCart } from "./cart-query-hooks-Bz8ID9jY.mjs";
import { t as useAllProducts } from "./prominent-api-hooks-CNVDntUD.mjs";
import { l as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/home.cart-Bl_3HSf0.js
var import_jsx_runtime = require_jsx_runtime();
function CartPage() {
const navigate = useNavigate();
const { data: cart } = useGetCart("regular");
const { data: productsData } = useAllProducts();
const updateItem = useUpdateCartItem("regular");
const removeItem = useRemoveFromCart("regular");
const products = productsData?.products || [];
const productsById = {};
products.forEach((p) => {
productsById[p.id] = p;
});
const cartItems = (cart?.items || []).filter((item) => productsById[item.productId]);
let total = 0;
cartItems.forEach((item) => {
const product = productsById[item.productId];
if (product) total += product.price * item.quantity;
});
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AppContainer, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
className: "mb-4 text-xl",
children: "Your Cart"
}), cartItems.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex flex-col items-center gap-4 py-20",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
className: "text-gray-500",
children: "Your cart is empty"
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyButton, {
textContent: "Browse Products",
onClick: () => navigate({ to: "/home" })
})]
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "flex flex-col gap-3",
children: cartItems.map((item) => {
const product = productsById[item.productId];
const price = product.price;
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex items-center gap-3 rounded-xl border border-gray-100 bg-white p-3 shadow-sm",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
src: product.images?.[0],
alt: product.name,
className: "h-16 w-16 rounded-lg object-cover"
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex-1",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "semibold",
className: "text-sm",
numberOfLines: 1,
children: product.name
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-brand-600 text-sm font-bold",
children: ["₹", price]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Quantifier, {
value: item.quantity,
setValue: (q) => updateItem.mutate({
productId: item.productId,
quantity: q
})
})
]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyTouchableOpacity, {
onClick: () => removeItem.mutate(item.productId),
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "h-5 w-5 text-red-500" })
})
]
}, item.productId);
})
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "fixed bottom-0 left-0 right-0 border-t border-gray-200 bg-white p-4 shadow-lg",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-3 flex items-center justify-between",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
children: "Total"
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
weight: "bold",
className: "text-lg text-brand-600",
children: ["₹", total]
})]
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyButton, {
fullWidth: true,
textContent: "Proceed to Checkout",
onClick: () => navigate({ to: "/home/checkout" }),
className: "bg-brand-500 text-white"
})]
})] })] });
}
//#endregion
export { CartPage as component };

View file

@ -0,0 +1,148 @@
import { o as __toESM } from "../_runtime.mjs";
import { h as require_react, m as require_jsx_runtime, p as useQueryClient } from "../_libs/react+tanstack__react-query.mjs";
import { a as MyText, i as MyButton, r as LoadingDialog, s as MyTouchableOpacity, t as AppContainer } from "./src-u_N1opJl.mjs";
import { r as useGetCart, t as clearLocalCart } from "./cart-query-hooks-Bz8ID9jY.mjs";
import { n as trpc } from "./trpc-client-CQOIB5UU.mjs";
import { l as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
import { n as useAuth } from "./auth-context-DzjwonUC.mjs";
import { t as useCentralProductStore } from "./central-product-store-TS-vQ8-V.mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/home.checkout-o3MfvOFR.js
var import_react = /* @__PURE__ */ __toESM(require_react());
var import_jsx_runtime = require_jsx_runtime();
function CheckoutPage() {
const navigate = useNavigate();
const queryClient = useQueryClient();
const { isAuthenticated } = useAuth();
const { data: cart } = useGetCart("regular");
const productsById = useCentralProductStore((s) => s.productsById);
const [isLoading, setIsLoading] = (0, import_react.useState)(false);
const { data: addresses } = trpc.user.address.getUserAddresses.useQuery(void 0, { enabled: isAuthenticated });
const [selectedAddressId, setSelectedAddressId] = (0, import_react.useState)(null);
const placeOrderMutation = trpc.user.order.placeOrder.useMutation({
onSuccess: (data) => {
const order = data.data?.[0];
clearLocalCart("regular");
queryClient.invalidateQueries({ queryKey: ["local-cart-regular"] });
navigate({
to: "/home/order-success",
search: {
orderId: order?.id,
totalAmount: total
}
});
},
onSettled: () => setIsLoading(false)
});
const cartItems = (cart?.items || []).filter((item) => productsById[item.productId]);
let total = 0;
cartItems.forEach((item) => {
const product = productsById[item.productId];
if (product) total += (product.discountedPrice ?? product.price) * item.quantity;
});
const handlePlaceOrder = () => {
if (!selectedAddressId) return;
setIsLoading(true);
placeOrderMutation.mutate({
selectedItems: cartItems.map((item) => ({
productId: item.productId,
quantity: item.quantity,
slotId: null
})),
addressId: selectedAddressId,
paymentMethod: "cod",
isFlashDelivery: false
});
};
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AppContainer, { children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
className: "mb-4 text-xl",
children: "Checkout"
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-6",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "semibold",
className: "mb-2",
children: "Delivery Address"
}), addresses?.data?.map((addr) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyTouchableOpacity, {
onClick: () => setSelectedAddressId(addr.id),
className: `mb-2 rounded-xl border p-3 ${selectedAddressId === addr.id ? "border-brand-500 bg-brand-50" : "border-gray-200"}`,
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "semibold",
children: addr.name
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-sm text-gray-600",
children: [
addr.addressLine1,
", ",
addr.city
]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
className: "text-sm text-gray-500",
children: addr.phone
})
]
}, addr.id))]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "mb-6",
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "semibold",
className: "mb-2",
children: "Order Summary"
}),
cartItems.map((item) => {
const product = productsById[item.productId];
if (!product) return null;
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex items-center justify-between py-2",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-sm",
numberOfLines: 1,
children: [
product.name,
" x",
item.quantity
]
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
className: "text-sm font-bold",
children: ["₹", (product.discountedPrice ?? product.price) * item.quantity]
})]
}, item.productId);
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
className: "mt-2 border-t border-gray-200 pt-2",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
className: "flex items-center justify-between",
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyText, {
weight: "bold",
children: "Total"
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(MyText, {
weight: "bold",
className: "text-brand-600",
children: ["₹", total]
})]
})
})
]
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MyButton, {
fullWidth: true,
textContent: "Place Order (COD)",
onClick: handlePlaceOrder,
disabled: !selectedAddressId || placeOrderMutation.isPending,
className: "bg-brand-500 text-white"
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingDialog, {
open: isLoading,
message: "Placing your order..."
})
] });
}
//#endregion
export { CheckoutPage as component };

Some files were not shown because too many files have changed in this diff Show more