1/*! For license information please see 8283.231b361a.chunk.js.LICENSE.txt */ 2"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[8283],{1286(e,s,t){t.d(s,{A:()=>a});const a=(0,t(7784).A)("phone",[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]])},1360(e,s,t){t.d(s,{A:()=>a});const a=(0,t(7784).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},1493(e,s,t){t.d(s,{A:()=>j});var a=t(5043),r=t(7874),i=t(3658),n=t(1990),l=t(4918),d=t(8006),o=t(4459),c=t(3946),m=t(614),h=t(9493),u=t(2983),x=t(8326),p=t(9463),b=t(2339),g=t(3716),y=t(579);const v=e=>{let{className:s=""}=e;return(0,y.jsxs)(r.N_,{to:"/",className:"flex items-center group gap-2 ".concat(s),children:[(0,y.jsxs)("div",{className:"relative",children:[(0,y.jsx)("div",{className:"absolute inset-0 bg-primary rounded-lg opacity-90"}),(0,y.jsx)("img",{src:g,alt:"Bagchee Icon",className:"relative h-10 md:h-12 w-auto object-contain p-1",fetchPriority:"high",decoding:"async"})]}),(0,y.jsxs)("div",{className:"flex flex-col leading-none",children:[(0,y.jsx)("span",{className:"text-xl md:text-2xl tracking-[0.2em] text-black uppercase font-bold",children:"Bagchee"}),(0,y.jsx)("div",{className:"h-[1px] bg-white/80 my-0.5 w-full"})," ",(0,y.jsx)("span",{className:"text-[8px] md:text-[10px] tracking-[0.4em] text-black/80 uppercase font-medium",children:"Books That Stick"})]})]})},f=(0,a.memo)(v),j=e=>{let{children:s}=e;const t=(0,r.Zp)(),g=(0,r.zy)(),[v,j]=(0,a.useState)(!1),[N,A]=(0,a.useState)(!1),[w,k]=(0,a.useState)(null);(0,a.useEffect)(()=>{const e=localStorage.getItem("auth");if(!e)return void t("/login");const s=JSON.parse(e);k(s.userDetails)},[t]),(0,a.useEffect)(()=>{A(!1)},[g.pathname]);const S=()=>{localStorage.removeItem("auth"),b.Ay.success("Logged out successfully"),t("/login")},C=[{icon:i.A,label:"Dashboard",hint:"Overview",path:"/account"},{icon:n.A,label:"Orders",hint:"Track purchases",path:"/account/orders"},{icon:l.A,label:"Wishlist",hint:"Saved books",path:"/account/wishlist"},{icon:d.A,label:"Addresses",hint:"Shipping details",path:"/account/address"},{icon:o.A,label:"Profile",hint:"Personal info",path:"/account/profile"},{icon:c.A,label:"Gift Cards",hint:"Redeem & balance",path:"/account/gift-cards"}];if(!w)return(0,y.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-cream",children:(0,y.jsx)("div",{className:"animate-spin rounded-full h-16 w-16 border-b-4 border-primary"})});const M=e=>{var s,t;let{isMobile:a=!1}=e;return(0,y.jsxs)("div",{className:"flex flex-col h-full bg-cream-100/95 backdrop-blur-sm",children:[(0,y.jsxs)("div",{className:"p-6 border-b border-gray-200 bg-gradient-to-r from-cream-100/60 to-cream-100/30",children:[a&&(0,y.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,y.jsx)(r.N_,{to:"/",className:"flex items-center",children:(0,y.jsx)(f,{className:"h-8 w-auto"})}),(0,y.jsx)("button",{onClick:()=>A(!1),className:"lg:hidden p-2 hover:bg-cream-100 rounded-lg transition-colors",children:(0,y.jsx)(m.A,{size:20})})]}),!v&&(0,y.jsx)("div",{className:"space-y-4",children:(0,y.jsxs)("div",{className:"flex items-center gap-3",children:[(0,y.jsx)("div",{className:"w-12 h-12 bg-primary/15 rounded-full flex items-center justify-center text-primary font-bold shadow-sm",children:null===(s=w.name)||void 0===s?void 0:s.charAt(0).toUpperCase()}),(0,y.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,y.jsx)("p",{className:"text-sm font-semibold text-text-main truncate",children:w.name}),(0,y.jsx)("p",{className:"text-xs text-text-muted truncate",children:w.email})]})]})}),v&&(0,y.jsx)("div",{className:"w-10 h-10 bg-primary/15 rounded-full flex items-center justify-center text-primary font-bold mx-auto shadow-sm",children:null===(t=w.name)||void 0===t?void 0:t.charAt(0).toUpperCase()})]}),(0,y.jsx)("nav",{className:"flex-1 p-4 space-y-1.5 overflow-y-auto",children:C.map(e=>{const s=e.icon,t=g.pathname===e.path;return(0,y.jsxs)(r.N_,{to:e.path,className:"flex items-center gap-3 px-4 py-3 rounded-lg transition-all duration-200 ".concat(t?"bg-primary text-white shadow-md":"text-text-main hover:bg-cream-50 hover:text-primary"),children:[(0,y.jsx)(s,{size:20,className:t?"text-white":"text-text-muted"}),!v&&(0,y.jsxs)("div",{className:"min-w-0",children:[(0,y.jsx)("p",{className:"font-medium leading-tight",children:e.label}),(0,y.jsx)("p",{className:"text-[11px] leading-tight truncate ".concat(t?"text-white/85":"text-text-muted"),children:e.hint})]})]},e.path)})}),(0,y.jsxs)("div",{className:"p-4 border-t border-gray-200 space-y-2 bg-cream-50/30",children:[(0,y.jsxs)(r.N_,{to:"/",className:"flex items-center gap-3 px-4 py-3 w-full rounded-lg text-text-main hover:bg-cream-100 hover:text-primary transition-all duration-200",children:[(0,y.jsx)(i.A,{size:20}),!v&&(0,y.jsx)("span",{className:"font-medium",children:"Back to Website"})]}),(0,y.jsxs)("button",{onClick:S,className:"flex items-center gap-3 px-4 py-3 w-full rounded-lg text-red-600 hover:bg-red-50 transition-all duration-200",children:[(0,y.jsx)(h.A,{size:20}),!v&&(0,y.jsx)("span",{className:"font-medium",children:"Logout"})]})]})]})};return(0,y.jsxs)("div",{className:"min-h-screen bg-cream",children:[(0,y.jsx)("header",{className:"fixed top-0 left-0 right-0 bg-cream-100 border-b border-gray-200 z-40",children:(0,y.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,y.jsx)("div",{className:"lg:hidden",children:(0,y.jsx)("button",{onClick:()=>A(!0),className:"p-2 hover:bg-cream-100 rounded-lg",children:(0,y.jsx)(u.A,{size:24})})}),(0,y.jsx)("div",{className:"hidden lg:block w-10"}),(0,y.jsx)(r.N_,{to:"/",className:"flex items-center",children:(0,y.jsx)(f,{className:"h-8 w-auto"})}),(0,y.jsx)("div",{className:"w-10"})]})}),N&&(0,y.jsx)("div",{className:"fixed inset-0 bg-black/50 z-50 lg:hidden",onClick:()=>A(!1)}),(0,y.jsx)("aside",{className:"fixed top-0 left-0 bottom-0 w-72 bg-cream-100 z-50 transform transition-transform duration-300 lg:hidden ".concat(N?"translate-x-0":"-translate-x-full"),children:(0,y.jsx)(M,{isMobile:!0})}),(0,y.jsxs)("aside",{className:"hidden lg:block fixed top-[61px] left-0 bottom-0 bg-cream-100 border-r border-gray-200 transition-all duration-300 z-30 ".concat(v?"w-20":"w-64"),children:[(0,y.jsx)(M,{}),(0,y.jsx)("button",{onClick:()=>j(!v),className:"absolute -right-3 top-4 w-6 h-6 bg-white border border-gray-200 rounded-full flex items-center justify-center hover:bg-gray-50 shadow-sm",children:v?(0,y.jsx)(x.A,{size:14}):(0,y.jsx)(p.A,{size:14})})]}),(0,y.jsx)("main",{className:"transition-all duration-300 pt-[61px] min-h-screen ".concat(v?"lg:ml-20":"lg:ml-64"),children:(0,y.jsx)("div",{className:"max-w-7xl mx-auto p-4 lg:p-8",children:s})})]})}},1990(e,s,t){t.d(s,{A:()=>a});const a=(0,t(7784).A)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]])},3190(e,s,t){t.d(s,{A:()=>a});const a=(0,t(7784).A)("briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]])},3658(e,s,t){t.d(s,{A:()=>a});const a=(0,t(7784).A)("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]])},3946(e,s,t){t.d(s,{A:()=>a});const a=(0,t(7784).A)("gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]])},6210(e,s,t){t.d(s,{A:()=>a});const a=(0,t(7784).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},6533(e,s,t){t.d(s,{A:()=>a});const a=(0,t(7784).A)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]])},7097(e,s,t){t.d(s,{n:()=>A});var a,r,i,n,l,d=t(9379),o=t(5043),c=t(9790),m=t(5149),h=t(8458),u=t
2(6562),x=t(4558),p=t(5239),b=t(1454),g=t(329),y=t(9723),v=(a=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakMap,l=new WeakSet,class extends g.Q{constructor(e,s){super(),(0,c.A)(this,l),(0,m.A)(this,a,void 0),(0,m.A)(this,r,void 0),(0,m.A)(this,i,void 0),(0,m.A)(this,n,void 0),(0,x.A)(a,this,e),this.setOptions(s),this.bindMethods(),(0,u.A)(l,this,f).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var s;const t=this.options;this.options=(0,h.A)(a,this).defaultMutationOptions(e),(0,y.f8)(this.options,t)||(0,h.A)(a,this).getMutationCache().notify({type:"observerOptionsUpdated",mutation:(0,h.A)(i,this),observer:this}),null!==t&&void 0!==t&&t.mutationKey&&this.options.mutationKey&&(0,y.EN)(t.mutationKey)!==(0,y.EN)(this.options.mutationKey)?this.reset():"pending"===(null===(s=(0,h.A)(i,this))||void 0===s?void 0:s.state.status)&&(0,h.A)(i,this).setOptions(this.options)}onUnsubscribe(){var e;this.hasListeners()||(null===(e=(0,h.A)(i,this))||void 0===e||e.removeObserver(this))}onMutationUpdate(e){(0,u.A)(l,this,f).call(this),(0,u.A)(l,this,j).call(this,e)}getCurrentResult(){return(0,h.A)(r,this)}reset(){var e;null===(e=(0,h.A)(i,this))||void 0===e||e.removeObserver(this),(0,x.A)(i,this,void 0),(0,u.A)(l,this,f).call(this),(0,u.A)(l,this,j).call(this)}mutate(e,s){var t;return(0,x.A)(n,this,s),null===(t=(0,h.A)(i,this))||void 0===t||t.removeObserver(this),(0,x.A)(i,this,(0,h.A)(a,this).getMutationCache().build((0,h.A)(a,this),this.options)),(0,h.A)(i,this).addObserver(this),(0,h.A)(i,this).execute(e)}});function f(){var e,s;const t=null!==(e=null===(s=(0,h.A)(i,this))||void 0===s?void 0:s.state)&&void 0!==e?e:(0,p.$)();(0,x.A)(r,this,(0,d.A)((0,d.A)({},t),{},{isPending:"pending"===t.status,isSuccess:"success"===t.status,isError:"error"===t.status,isIdle:"idle"===t.status,mutate:this.mutate,reset:this.reset}))}function j(e){b.jG.batch(()=>{if((0,h.A)(n,this)&&this.hasListeners()){const x=(0,h.A)(r,this).variables,p=(0,h.A)(r,this).context,b={client:(0,h.A)(a,this),meta:this.options.meta,mutationKey:this.options.mutationKey};if("success"===(null===e||void 0===e?void 0:e.type)){try{var s,t;null===(s=(t=(0,h.A)(n,this)).onSuccess)||void 0===s||s.call(t,e.data,x,p,b)}catch(u){Promise.reject(u)}try{var i,l;null===(i=(l=(0,h.A)(n,this)).onSettled)||void 0===i||i.call(l,e.data,null,x,p,b)}catch(u){Promise.reject(u)}}else if("error"===(null===e||void 0===e?void 0:e.type)){try{var d,o;null===(d=(o=(0,h.A)(n,this)).onError)||void 0===d||d.call(o,e.error,x,p,b)}catch(u){Promise.reject(u)}try{var c,m;null===(c=(m=(0,h.A)(n,this)).onSettled)||void 0===c||c.call(m,void 0,e.error,x,p,b)}catch(u){Promise.reject(u)}}}this.listeners.forEach(e=>{e((0,h.A)(r,this))})})}var N=t(3248);function A(e,s){const t=(0,N.jE)(s),[a]=o.useState(()=>new v(t,e));o.useEffect(()=>{a.setOptions(e)},[a,e]);const r=o.useSyncExternalStore(o.useCallback(e=>a.subscribe(b.jG.batchCalls(e)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),i=o.useCallback((e,s)=>{a.mutate(e,s).catch(y.lQ)},[a]);if(r.error&&(0,y.GU)(a.options.throwOnError,[r.error]))throw r.error;return(0,d.A)((0,d.A)({},r),{},{mutate:i,mutateAsync:r.mutate})}},8283(e,s,t){t.r(s),t.d(s,{default:()=>N});var a=t(9379),r=t(5043),i=t(3658),n=t(6533),l=t(3190),d=t(6210),o=t(8006),c=t(1286),m=t(1360),h=t(9855),u=t(614),x=t(2339),p=t(3046),b=t(1493),g=t(2532),y=t(3248),v=t(7097),f=t(579);const j="https://www.bagchee.com/api",N=()=>{const e=(0,y.jE)(),[s,t]=(0,r.useState)({name:"Guest",id:null}),[N,A]=(0,r.useState)(!1),[w,k]=(0,r.useState)(!1),[S,C]=(0,r.useState)(null),M={type:"Home",firstName:"",lastName:"",company:"",houseNo:"",address2:"",city:"",state:"",pincode:"",country:"United States",phone:""},[z,E]=(0,r.useState)(M);(0,r.useEffect)(()=>{const e=localStorage.getItem("auth");if(e){const s=JSON.parse(e).userDetails;t(s)}},[]);const{data:P=[],isLoading:I}=(0,g.I)({queryKey:["addresses",null===s||void 0===s?void 0:s.id],queryFn:async()=>(await p.A.get("".concat(j,"/user/get-addresses?userId=").concat(s.id))).data.addresses||[],enabled:!(null===s||void 0===s||!s.id)}),O=(0,v.n)({mutationFn:async e=>{w&&await p.A.post("".concat(j,"/user/delete-address"),{userId:s.id,addressId:S});return(await p.A.post("".concat(j,"/user/add-address"),(0,a.A)({userId:s.id},e))).data},onSuccess:()=>
2{e.invalidateQueries(["addresses",null===s||void 0===s?void 0:s.id]),x.Ay.success(w?"Address updated successfully!":"New address added!"),A(!1)},onError:e=>{var s,t;x.Ay.error((null===(s=e.response)||void 0===s||null===(t=s.data)||void 0===t?void 0:t.msg)||"Something went wrong")}}),D=(0,v.n)({mutationFn:async e=>(await p.A.post("".concat(j,"/user/delete-address"),{userId:s.id,addressId:e})).data,onSuccess:()=>{e.invalidateQueries(["addresses",null===s||void 0===s?void 0:s.id]),x.Ay.success("Address deleted successfully")},onError:()=>{x.Ay.error("Failed to delete address")}}),U=()=>{E(M),k(!1),A(!0)},B=e=>{E((0,a.A)((0,a.A)({},z),{},{[e.target.name]:e.target.value}))};return(0,f.jsxs)(b.A,{children:[(0,f.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,f.jsxs)("div",{className:"mb-8 flex justify-between items-center",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"My Addresses"}),(0,f.jsx)("p",{className:"text-gray-600",children:"Manage your shipping addresses"})]}),(0,f.jsxs)("button",{onClick:U,className:"flex items-center gap-2 bg-primary text-white px-5 py-2.5 rounded-lg hover:bg-primary-hover transition-colors font-medium shadow-md",children:[(0,f.jsx)(m.A,{size:20}),(0,f.jsx)("span",{className:"hidden sm:inline",children:"Add Address"})]})]}),(0,f.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[!I&&0===P.length&&(0,f.jsxs)("div",{className:"col-span-2 bg-cream-100 rounded-xl border-2 border-dashed border-gray-200 p-12 text-center",children:[(0,f.jsx)("div",{className:"w-20 h-20 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,f.jsx)(o.A,{size:40,className:"text-gray-300"})}),(0,f.jsx)("h3",{className:"text-lg font-bold text-gray-900 mb-2",children:"No addresses saved yet"}),(0,f.jsx)("p",{className:"text-gray-600 mb-6",children:"Add your first shipping address to get started"}),(0,f.jsxs)("button",{onClick:U,className:"inline-flex items-center gap-2 bg-primary text-white px-6 py-3 rounded-lg hover:bg-primary-hover transition-colors font-medium",children:[(0,f.jsx)(m.A,{size:20}),"Add Your First Address"]})]}),P.map(e=>(0,f.jsxs)("div",{className:"bg-cream-100 border border-gray-200 rounded-xl shadow-sm hover:shadow-md transition-all duration-300 flex flex-col overflow-hidden",children:[(0,f.jsxs)("div",{className:"bg-cream-200/40 px-6 py-4 border-b border-gray-200 flex justify-between items-center",children:[(0,f.jsxs)("h3",{className:"font-bold text-sm text-gray-900 uppercase tracking-wide flex items-center gap-2",children:["Home"===e.type?(0,f.jsx)(i.A,{size:16,className:"text-primary"}):(0,f.jsx)(l.A,{size:16,className:"text-primary"}),e.type]}),e.isDefault&&(0,f.jsxs)("span",{className:"bg-green-100 text-green-700 text-xs font-bold px-3 py-1 rounded-full flex items-center gap-1",children:[(0,f.jsx)(d.A,{size:12})," Default"]})]}),(0,f.jsxs)("div",{className:"p-6 flex-grow space-y-3 text-sm",children:[(0,f.jsx)("p",{className:"font-bold text-lg text-gray-900",children:[e.firstName,e.lastName].filter(Boolean).join(" ")||"\u2014"}),e.company&&(0,f.jsx)("p",{className:"text-sm text-gray-500 font-medium",children:e.company}),(0,f.jsx)("div",{className:"space-y-2",children:(0,f.jsxs)("div",{className:"flex gap-3 items-start",children:[(0,f.jsx)(o.A,{size:18,className:"shrink-0 text-primary mt-0.5"}),(0,f.jsxs)("div",{children:[e.houseNo&&(0,f.jsx)("span",{className:"block text-gray-700",children:e.houseNo}),e.street&&(0,f.jsx)("span",{className:"block text-gray-700",children:e.street}),e.address2&&(0,f.jsx)("span",{className:"block text-gray-700",children:e.address2}),(0,f.jsxs)("p",{className:"text-gray-700 mt-1",children:[[e.city,e.state].filter(Boolean).join(", "),e.pincode&&(0,f.jsxs)("span",{className:"font-bold",children:[" ",e.pincode]})]}),e.country&&(0,f.jsx)("p",{className:"uppercase text-xs tracking-wider text-gray-400 pt-0.5",children:e.country})]})]})}),(0,f.jsxs)("p",{className:"flex items-center gap-3 pt-3 border-t border-gray-100",children:[(0,f.jsx)(c.A,{size:16,className:"text-primary"}),(0,f.jsx)("span",{className:"font-bold text-gray-900",children:e.phone})]})]}),(0,f.jsxs)("div",{className:"p-4 border-t border-gray-100 flex gap-3 bg-cream-100",children:[(0,f.jsxs)("button",{onClick:()=>(e=>{E({type:e.type||"Home",firstName:e.firstName||"",lastName:e.lastName||"",company:e.company||"",houseNo:e.houseNo&&e.street?"".concat(e.houseNo,", ").concat(e.street):e.houseNo||e.street||"",address2:e.address2||e.landmark||"",city:e.city||"",state:e.state||"",pincode:e.pincode||"",country:e.country||"United States",phone:e.phone||""}),k(!0),C(e.id||e._id),A(!0)})(e),className:"flex-1 bg-white border-2 border-primary text-primary hover:bg-primary hover:text-white py-2 rounded-lg text-xs font-bold uppercase tracking-wider flex items-center justify-center gap-2 transition-all duration-300",children:[(0,f.jsx)(n.A,{size:16})," Edit"]}),(0,f.jsxs)("button",{onClick:()=>{return s=e.id||e._id,void(window.confirm("Are you sure you want to delete this address?")&&D.mutate(s));var s},disabled:D.isPending,className:"flex-1 bg-red-600 hover:bg-red-700 text-white py-2 rounded-lg text-xs font-bold uppercase tracking-wider flex items-center justify-center gap-2 transition-all duration-300 disabled:opacity-50",children:[(0,f.jsx)(h.A,{size:16})," ",D.isPending?"Deleting...":"Delete"]})]})]},e.id||e._id))]})]}),N&&(0,f.jsx)("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:(0,f.jsxs)("div",{className:"bg-white w-full max-w-2xl rounded-xl shadow-2xl overflow-hidden animate-fadeIn max-h-[90vh] overflow-y-auto",children:[(0,f.jsxs)("div",{className:"bg-primary px-6 py-4 flex justify-between items-center text-white sticky top-0",children:[(0,f.jsx)("h3",{className:"font-bold text-lg tracking-wide",children:w?"EDIT ADDRESS":"ADD NEW ADDRESS"}),(0,f.jsx)("button",{onClick:()=>A(!1),className:"hover:bg-white/20 p-1 rounded-full",children:(0,f.jsx)(u.A,{size:24})})]}),(0,f.jsxs)("form",{onSubmit:e=>{e.preventDefault(),O.mutate(z)},className:"p-6 md:p-8 space-y-5",children:[(0,f.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-xs font-bold text-gray-500 uppercase mb-1",children:"Address Type"}
2),(0,f.jsxs)("select",{name:"type",value:z.type,onChange:B,className:"w-full border border-gray-300 rounded p-2.5 text-sm focus:border-primary bg-gray-50",children:[(0,f.jsx)("option",{children:"Home"}),(0,f.jsx)("option",{children:"Office"}),(0,f.jsx)("option",{children:"Other"})]})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-xs font-bold text-gray-500 uppercase mb-1",children:"First Name *"}),(0,f.jsx)("input",{type:"text",name:"firstName",value:z.firstName,onChange:B,className:"w-full border border-gray-300 rounded p-2.5 text-sm focus:border-primary",required:!0})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-xs font-bold text-gray-500 uppercase mb-1",children:"Last Name"}),(0,f.jsx)("input",{type:"text",name:"lastName",value:z.lastName,onChange:B,className:"w-full border border-gray-300 rounded p-2.5 text-sm focus:border-primary"})]})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-xs font-bold text-gray-500 uppercase mb-1",children:"Company (Optional)"}),(0,f.jsx)("input",{type:"text",name:"company",value:z.company,onChange:B,className:"w-full border border-gray-300 rounded p-2.5 text-sm focus:border-primary"})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-xs font-bold text-gray-500 uppercase mb-1",children:"Address Line 1 *"}),(0,f.jsx)("input",{type:"text",name:"houseNo",value:z.houseNo,onChange:B,placeholder:"Street address, P.O. box, building",className:"w-full border border-gray-300 rounded p-2.5 text-sm focus:border-primary",required:!0})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-xs font-bold text-gray-500 uppercase mb-1",children:"Address Line 2 (Optional)"}),(0,f.jsx)("input",{type:"text",name:"address2",value:z.address2,onChange:B,placeholder:"Apartment, suite, unit, floor, etc.",className:"w-full border border-gray-300 rounded p-2.5 text-sm focus:border-primary"})]}),(0,f.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-xs font-bold text-gray-500 uppercase mb-1",children:"City *"}),(0,f.jsx)("input",{type:"text",name:"city",value:z.city,onChange:B,className:"w-full border border-gray-300 rounded p-2.5 text-sm focus:border-primary",required:!0})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-xs font-bold text-gray-500 uppercase mb-1",children:"State / Province / Region"}),(0,f.jsx)("input",{type:"text",name:"state",value:z.state,onChange:B,className:"w-full border border-gray-300 rounded p-2.5 text-sm focus:border-primary"})]})]}),(0,f.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-xs font-bold text-gray-500 uppercase mb-1",children:"Postal Code / ZIP"}),(0,f.jsx)("input",{type:"text",name:"pincode",value:z.pincode,onChange:B,className:"w-full border border-gray-300 rounded p-2.5 text-sm focus:border-primary"})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-xs font-bold text-gray-500 uppercase mb-1",children:"Country"}),(0,f.jsx)("select",{name:"country",value:z.country,onChange:B,className:"w-full border border-gray-300 rounded p-2.5 text-sm focus:border-primary bg-gray-50",required:!0,children:["Afghanistan","Albania","Algeria","Argentina","Armenia","Australia","Austria","Azerbaijan","Bahrain","Bangladesh","Belarus","Belgium","Bolivia","Bosnia and Herzegovina","Brazil","Bulgaria","Cambodia","Canada","Chile","China","Colombia","Croatia","Czech Republic","Denmark","Ecuador","Egypt","Estonia","Ethiopia","Finland","France","Georgia","Germany","Ghana","Greece","Hungary","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Japan","Jordan","Kazakhstan","Kenya","Kuwait","Latvia","Lebanon","Libya","Lithuania","Malaysia","Mexico","Morocco","Myanmar","Nepal","Netherlands","New Zealand","Nigeria","Norway","Oman","Pakistan","Palestine","Peru","Philippines","Poland","Portugal","Qatar","Romania","Russia","Saudi Arabia","Serbia","Singapore","Slovakia","South Africa","South Korea","Spain","Sri Lanka","Sudan","Sweden","Switzerland","Syria","Taiwan","Tanzania","Thailand","Tunisia","Turkey","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","Uruguay","Uzbekistan","Venezuela","Vietnam","Yemen","Zimbabwe"].map(e=>(0,f.jsx)("option",{value:e,children:e},e))})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-xs font-bold text-gray-500 uppercase mb-1",children:"Phone *"}),(0,f.jsx)("input",{type:"tel",name:"phone",value:z.phone,onChange:B,className:"w-full border border-gray-300 rounded p-2.5 text-sm focus:border-primary",required:!0})]})]}),(0,f.jsxs)("div",{className:"pt-6 flex justify-end gap-4 border-t border-gray-100",children:[(0,f.jsx)("button",{type:"button",onClick:()=>A(!1),className:"px-6 py-2.5 text-gray-600 font-bold text-sm uppercase hover:bg-gray-100 rounded transition-colors",children:"Cancel"}),(0,f.jsx)("button",{type:"submit",disabled:O.isPending,className:"px-8 py-2.5 bg-primary hover:bg-primary-hover text-white font-bold text-sm uppercase rounded shadow-lg transition-all transform active:scale-95 disabled:opacity-50",children:O.isPending?"Saving...":w?"Update Address":"Save Address"})]})]})]})})]})}},9855(e,s,t){t.d(s,{A:()=>a});const a=(0,t(7784).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])}}]); 3//# sourceMappingURL=8283.231b361a.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.