PageSourceSearch

https://automoby.org/_next/static/chunks/app/layout-e0d29d22ed2f883d.js

js automoby.org collected 2026-10-06 21:36:57 UTC 142,793 bytes, 1 lines download raw bytes

1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d86c696b-a2c0-4c90-bcdb-b1dea0f02ce5",e._sentryDebugIdIdentifier="sentry-dbid-d86c696b-a2c0-4c90-bcdb-b1dea0f02ce5")}()}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{945:(e,t,r)=>{"use strict";r.d(t,{R:()=>n});let n="checkout-state"},3401:(e,t,r)=>{"use strict";r.d(t,{CZ:()=>i,Cz:()=>l,wz:()=>a});let n=e=>e.toLowerCase().replace(/^www\./,""),l=e=>{let t=(e=>{if(!e)return null;try{return n(new URL(e).hostname)}catch(e){return null}})(e);return null!==t&&t===n(window.location.hostname)},a=e=>e.toLowerCase().includes("torob"),i=e=>e.toLowerCase().includes("ylad")},6402:(e,t,r)=>{"use strict";r.d(t,{F:()=>s,V:()=>o});var n=r(95155),l=r(12115),a=r(65229),i=r(36591);function s(e){let{isOpen:t,onClose:r,children:l}=e;return(0,n.jsx)(i._s,{isOpen:t,onClose:r,isMobile:!0,className:"!p-5",children:(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("button",{onClick:r,className:"absolute top-0 left-0 z-10 p-2 hover:bg-neutral-lightest rounded-lg transition-colors","aria-label":"بستن",type:"button",children:(0,n.jsx)(a.A,{className:"w-5 h-5 text-neutral-darker"})}),(0,n.jsx)("div",{className:"pt-8",children:l})]})})}function o(e){let{isOpen:t,onClose:r,hasImage:s,children:o}=e,c=(0,l.useRef)(r);return(0,l.useEffect)(()=>{c.current=r}),(0,l.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&c.current()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t]),(0,n.jsx)(i.zs,{isOpen:t,onClick:r,blur:!0,children:(0,n.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"پاپ‌آپ ورود",className:"relative mx-4 w-[min(92vw,440px)] overflow-hidden rounded-2xl bg-white shadow-2xl",children:[(0,n.jsx)("button",{onClick:r,className:"absolute top-3 left-3 z-10 rounded-full bg-white/90 p-2 shadow-sm hover:bg-neutral-lightest transition-colors","aria-label":"بستن",type:"button",children:(0,n.jsx)(a.A,{className:"w-5 h-5 text-neutral-darker"})}),(0,n.jsx)("div",{className:"p-6 ".concat(s?"":"pt-12"),children:o})]})})}},6906:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>o,CO:()=>m,TT:()=>l,_e:()=>i,bo:()=>c,kY:()=>h,kd:()=>s});var n=r(19540);let l=e=>new Date(e).toLocaleDateString("fa-IR",{month:"long",day:"numeric",year:"numeric"}),a="Asia/Tehran",i=e=>new Intl.DateTimeFormat("en-CA",{timeZone:a,year:"numeric",month:"2-digit",day:"2-digit"}).format(e),s=(e,t)=>Math.round((Date.parse("".concat(t,"T00:00:00Z"))-Date.parse("".concat(e,"T00:00:00Z")))/864e5),o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date,r=new Date(e),n=s(i(t),i(r));return 0===n?"امروز":1===n?"فردا":r.toLocaleDateString("fa-IR",{timeZone:a,weekday:"long"})},c=e=>(0,n.T)(new Date(e).toLocaleTimeString("en-GB",{timeZone:a,hour:"2-digit",minute:"2-digit",hourCycle:"h23"})),d=e=>new Intl.DateTimeFormat("fa-IR",{timeZone:a,calendar:"persian",weekday:"long",day:"numeric",month:"long",year:"numeric"}).formatToParts(e),u=(e,t)=>
1{var r,n;return null!=(n=null==(r=e.find(e=>e.type===t))?void 0:r.value)?n:""},m=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date,r=d(new Date(e)),n=u(r,"year"),l=[u(r,"weekday"),u(r,"day"),u(r,"month")].join(" ");return n===u(d(t),"year")?l:"".concat(l," ").concat(n)},h=e=>{let t=[],r=new Map;return e.forEach(e=>{let n=i(new Date(e.startAt)),l=r.get(n);void 0===l?(r.set(n,t.length),t.push({dayKey:n,label:o(e.startAt),slots:[e]})):t[l].slots.push(e)}),t}},7415:(e,t,r)=>{"use strict";r.d(t,{p:()=>a});var n=r(12115),l=r(34207);function a(){let e=(0,n.use)(l.A);return e||{}}},8730:(e,t,r)=>{"use strict";r.d(t,{I:()=>a});var n=r(12115),l=r(14763);let a=()=>{let{isAuthenticated:e}=(0,l.J)();return{createUserActivity:(0,n.useCallback)(e=>{},[e])}}},10102:(e,t,r)=>{"use strict";r.d(t,{default:()=>tS});var n=r(95155),l=r(70228),a=r(12115),i=r(36591),s=r(20063),o=r(97644),c=r(19152),d=r(21522),u=r(55898),m=r(30784);let h=e=>{let{itemsRemoved:t,installationRemoved:r}=e;return(0,n.jsxs)(n.Fragment,{children:[t&&(0,n.jsx)(m.o,{variant:"body-m-medium",className:"text-center text-neutral-darker",children:"ارسال تعدادی از آیتم‌های سبد شما، به شهر انتخاب شده ممکن نبوده و از سبدتان حذف شدند."}),r&&(0,n.jsx)(m.o,{variant:"body-m-medium",className:"text-center text-neutral-darker",children:"امکان نصب تعدادی از خدمات سبد شما در شهر انتخاب‌شده وجود نداشت و از سبدتان حذف شدند."})]})},f=e=>{let{isOpen:t,onClose:r,onButtonClick:l,removedBatteryAmper:a,itemsRemoved:s,installationRemoved:o}=e;return(0,n.jsx)(i.lG,{isOpen:t,onClose:r,showCloseButton:!0,size:"sm",className:"w-[90%] h-fit",children:(0,n.jsxs)("div",{className:"flex flex-col gap-6 p-6",children:[(0,n.jsx)(h,{itemsRemoved:s,installationRemoved:o}),(0,n.jsx)(u.SimilarProductsCarousel,{isInModal:!0,batteryAmperModal:a}),(0,n.jsx)(i.$n,{variant:"primary",textVariant:"body-s-bold",size:"lg",onClick:l,className:"w-full",children:"متوجه شدم"})]})})};var p=r(31628),x=r(26753);let g=e=>{let{isOpen:t,onClose:r,onButtonClick:l,removedBatteryAmper:a,itemsRemoved:i,installationRemoved:s}=e;return(0,n.jsx)(p.Drawer,{isOpen:t,onClose:r,direction:"bottom",isMobile:!0,className:"shadow-[0px_-4px_16px_0px_rgba(0,0,0,0.2)]",children:(0,n.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,n.jsx)("div",{className:"flex justify-between items-center",children:(0,n.jsx)(m.o,{variant:"body-l-bold",className:"text-neutral-darker",children:"تغییر شهر"})}),(0,n.jsx)(h,{itemsRemoved:i,installationRemoved:s}),(0,n.jsx)(u.SimilarProductsCarousel,{isInModal:!0,batteryAmperModal:a}),(0,n.jsx)(x.Button,{variant:"primary",textVariant:"body-s-bold",size:"lg",onClick:l,className:"w-full",children:"متوجه شدم"})]})})};function b(){let e=(0,i.Iu)(),[t,r]=(0,a.useState)(!1),u=(0,s.useRouter)(),{startNavigating:m}=(0,c.y)(),{isCheckoutPage:h}=(0,l.I)(),{userLocation:p,userLocationUpdateFlow:x,setCartAndCityChanges:b}=(0,o.k)(),v=()=>{if(r(!1),b(null,!1,null),h){m(),u.push("/checkout/cart");return}u.refresh()};return((0,a.useEffect)(()=>{if(x.userCartUpdated||x.installationRemoved)r(!0);else if("boolean"==typeof x.userCartUpdated&&x.userLocationUpdated){b(null,!1);let e=(()=>{try{let e=(0,d.kz)();return(null==e?void 0:e.selectedAddress)||null}catch(e){return null}})();if(h&&e&&e.cityId===p.cityId)return void u.push("/checkout/parcels");if(h)return void u.refresh();u.refresh()}},[x,p,h,b,m,u]),e)?(0,n.jsx)(g,{isOpen:t,onClose:v,onButtonClick:v,removedBatteryAmper:x.removedBatteryAmper,itemsRemoved:!!x.userCartUpdated,installationRemoved:x.installationRemoved}):(0,n.jsx)(f,{isOpen:t,onClose:v,onButtonClick:v,removedBatteryAmper:x.removedBatteryAmper,itemsRemoved:!!x.userCartUpdated,installationRemoved:x.installationRemoved})}var v=r(60846);let y=e=>{let{isOpen:t,onClose:r}=e;return(0,n.jsx)(i.lG,{isOpen:t,onClose:r,showCloseButton:!0,size:"sm",className:"w-fit h-fit",children:(0,n.jsxs)("div",{className:"flex flex-col gap-6 p-2",children:[(0,n.jsx)(m.o,{variant:"body-l-bold",className:"text-center text-neutral-darker",children:"تعدادی از محصولات سبد خرید شما به علت اتمام موجودی از سبد حذف شده"}),(0,n.jsx)(i.$n,{variant:"primary",textVariant:"body-s-bold",size:"lg",onClick:r,className:"w-full",children:"متوجه شدم"})]})})},j=e=>{let{isOpen:t,onClose:r}=e;return(0,n.jsx)(p.Drawer,{isOpen:t,onClose:r,direction:"bottom",isMobile:!0,children:(0,n.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,n.jsx)(m.o,{variant:"body-m-medium",className:"text-center text-neutral-darker",children:"تعدادی از محصولات سبد خرید شما به علت اتمام موجودی از سبد حذف شده"}),(0,n.jsx)(x.Button,{variant:"primary",textVariant:"body-s-bold",size:"lg",onClick:r,className:"w-full",children:"متوجه شدم"})]})})};function w(){let e=(0,i.Iu)(),[t,r]=(0,a.useState)(!1),l=(0,s.useRouter)(),{showCartChangeWarningOnItemDisabled:o,setShowCartChangeWarningOnItemDisabled:c}=(0,v._)(),d=()=>{r(!1),c(!1),l.refresh()};return((0,a.useEffect)(()=>{o&&r(!0)},[o]),e)?(0,n.jsx)(j,{isOpen:t,onClose:d}):(0,n.jsx)(y,{isOpen:t,onClose:d})}
1var N=r(78934),k=r(68106),I=r(8730),C=r(83636),S=r(62673),A=r(83047),_=r(22454),E=r(96444);let T=async()=>(0,E.GO)("/constants/sticky",{cache:"no-store",params:{domain:(0,C.p)("DOMAIN_NAME")}});var P=r(75063);function O(e){let t=(0,i.Iu)(),{isLCPImage:r}=e,{createUserActivity:l}=(0,I.I)(),a=(0,s.usePathname)(),o=(0,s.useRouter)(),{startNavigating:d}=(0,c.y)(),{data:u}=(()=>{let e=(0,C.p)("DOMAIN_NAME");return(0,_.I)({queryKey:["sticky-banner",e],queryFn:T,enabled:!!e,staleTime:3e5,gcTime:(0,P.W)(6e5),retry:1})})(),m="1"===((0,C.p)("TOP_BANNER_VISIBILITY")||(0,C.p)("TOP_BANNER_SHARED_VISIBILITY")||"0"),h=null==u?void 0:u.desktopImageUrl,f=null==u?void 0:u.mobileImageUrl,p=null==u?void 0:u.link;return m&&h&&f?(0,n.jsx)("button",{type:"button",id:"top-banner","data-track":A.Dd.STICKY_BANNER_CLICK,"data-prop-url":p,className:"block w-full",onClick:()=>{l({type:k.eP.TOP_BANNER,url:a}),p&&(null==p?void 0:p.startsWith("/"))?(d(),o.push(null!=p?p:"")):p&&(0,S.i)(p)&&window.open(p,"_blank")},children:(0,n.jsx)(N.A,{src:t?f:h,alt:"top-banner",priority:r,fetchPriority:r?"high":"auto",loading:r?"eager":"lazy",width:t?768:1920,height:t?64:80,sizes:"100vw",className:"h-auto w-full"})}):null}var D=r(2821),R=r(60668),L=r(10512),U=r(59865),M=r(43090),B=r(41472),z=r(14763),G=r(83818),H=r(85168),Y=r(4871),F=r(77365),W=r(86651),q=r(65229);let K=e=>{let{searchInput:t,isLoading:r,isFocused:l,inputRef:a,onInputChange:o,onInputFocus:c,onInputBlur:d,onClearInput:u,onSearchIconClick:m}=e,h=(0,s.useRouter)();return(0,n.jsxs)("div",{className:"\n        relative flex items-center w-full h-12 \n        bg-white border border-solid rounded-md\n        transition-all duration-200\n        ".concat(l?"border-primary shadow-lg":"border-neutral-light","\n      "),children:[(0,n.jsx)(i.$n,{variant:"ghost",onClick:m,className:"flex items-center justify-center w-12 h-12 text-neutral-dark hover:text-primary transition-colors",children:(0,n.jsx)(W.A,{size:24})}),(0,n.jsx)("input",{ref:a,type:"text",value:t,onChange:o,onFocus:c,onBlur:d,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),h.replace("/search?q=".concat(encodeURIComponent(t))),setTimeout(()=>{var e;null==(e=a.current)||e.blur(),u()},500))},placeholder:"نام محصول یا برند را بنویسید",className:"flex-1 h-full px-3 text-sm font-medium text-neutral-darker bg-transparent outline-none placeholder:text-neutral-main text-right"}),(0,n.jsx)("div",{className:"flex items-center justify-center w-12 h-12",children:r?(0,n.jsx)("div",{className:"w-5 h-5 border-2 border-primary border-t-transparent rounded-full animate-spin"}):t?(0,n.jsx)(i.$n,{variant:"ghost",onClick:u,className:"flex items-center justify-center w-6 h-6 text-neutral-dark hover:text-primary transition-colors",children:(0,n.jsx)(q.A,{size:16})}):null})]})},Q=()=>{let{searchInput:e,setSearchInput:t,searchResult:r,isLoading:l,clearSearch:i}=(0,H.S)(),{isFocused:s,showDropDown:o,inputRef:c,dropdownRef:d,handleInputFocus:u,handleInputBlur:m,openDropdown:h}=(()=>{let[e,t]=(0,a.useState)(!1),[r,n]=(0,a.useState)(!1),l=(0,a.useRef)(null),i=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=e=>{let r=e.target,a=l.current,s=i.current;a&&s&&!a.contains(r)&&!s.contains(r)&&(t(!1),n(!1))};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]),{isFocused:e,showDropDown:r,inputRef:l,dropdownRef:i,handleInputFocus:()=>{t(!0),n(!0)},handleInputBlur:()=>{setTimeout(()=>{t(!1),n(!1)},550)},openDropdown:()=>{n(!0)}}})(),{openSearch:f,closeSearch:p}=(0,Y.W)({isDesktop:!0,onSearchOpen:()=>{var e;null==(e=c.current)||e.focus()},onSearchClose:()=>{var e;null==(e=c.current)||e.blur()}});return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"relative w-full max-w-[582px] z-40",children:[(0,n.jsx)(K,{searchInput:e,isLoading:l,isFocused:s,inputRef:c,onInputChange:e=>{t(e.target.value),h()},onInputFocus:()=>{f(),u()},onInputBlur:()=>{p(),m()},onClearInput:()=>{var e;i(),null==(e=c.current)||e.focus()},onSearchIconClick:()=>{f()}}),o&&s&&(0,n.jsx)("div",{ref:d,className:"absolute top-full left-0 right-0 mt-2 bg-white border border-neutral-light rounded-md shadow-2xl z-50 max-h-96 overflow-y-auto",children:(0,n.jsx)(F.V,{searchInput:e,searchResult:r,isLoading:l,variant:"desktop"})})]})})};var Z=r(21394),V=r(71815);function J(){let{user:e,isAuthenticated:t,logout:r}=(0,z.J)(),{cartTotalQuantity:l,cart:a}=(0,v._)(),i=(0,s.usePathname)();return(0,n.jsx)("div",{className:"relative py-4",children:(0,n.jsxs)("div",{className:"flex justify-between items-center gap-2.5",children:[(0,n.jsxs)("div",{className:"flex items-center gap-6",children:[(0,n.jsx)(B.default,{href:"/",className:"w-[145px] h-8",children:(0,n.jsx)(N.A,{src:"/assets/images/automoby-text-logo.png",alt:"AUTOMOBY",width:145,height:32,className:"w-full h-full object-contain"})}),(0,n.jsx)("div",{className:"w-[484px] max-xl:w-[400px]",children:(0,n.jsx)(Q,{})})]}),(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsx)(Z.A,{}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(B.default,{href:"/checkout/cart",className:"flex items-center justify-center w-14 h-14 border border-neutral-light rounded-md hover:bg-neutral-lighter transition-all duration-300 ".concat(l>0?"animate-pulse shadow-lg shadow-primary hover:shadow-lg hover:shadow-
1primary-light":""),onClick:()=>(0,V.tN)(V.Y_.Header,a),children:(0,n.jsx)(L.A,{size:24,className:"text-neutral-darker"})}),l>0&&(0,n.jsx)(M.h,{content:l.toString()})]}),t?(0,n.jsx)("div",{className:"relative",children:(0,n.jsx)(G.Menu,{buttonText:"".concat((null==e?void 0:e.firstName)||"کاربر"," ").concat((null==e?void 0:e.lastName)||"اتوموبی"),items:[{id:"profile",label:"پروفایل",href:"/profile/order-history"},{id:"logout",label:"خروج",onClick:()=>r()}],buttonClassName:"flex items-center justify-center  h-14 border border-neutral-light rounded-md hover:bg-neutral-lighter transition-colors text-neutral-darker"})}):(0,n.jsx)(B.default,{href:"/login?source=".concat(encodeURIComponent(i)),type:"button",className:"flex items-center justify-center w-14 h-14 border border-neutral-light rounded-md hover:bg-neutral-lighter transition-colors",children:(0,n.jsx)(U.A,{size:24,className:"text-neutral-darker"})})]})]})})}var $=r(9540),X=r(94460);let ee=()=>{let e=(0,a.useContext)(X.x);if(void 0===e)throw Error("useMenu must be used within a MenuProvider");return e};var et=r(50828);let er=[{id:1,name:"لوازم یدکی فوتون",url:"/cb-foton"},{id:2,name:"لوازم یدکی kmc",url:"/cb-kmc/"},{id:3,name:"لوازم یدکی پراید",url:"/cb-saipa/cm-pride/"},{id:4,name:"لوازم یدکی 206",url:"/cb-peugeot/cm-206/"},{id:5,name:"قیمت لاستیک پراید",url:"/cat-rubber/cm-pride/"},{id:7,name:"لوازم یدکی سمند",url:"/cb-ikd/cm-samand/"}];function en(e){let{showBottomSection:t}=e,{toggleMenu:r,isMenuOpen:l}=ee(),a=(0,i.mW)();return(0,n.jsx)("div",{className:(0,D.A)("border-t border-neutral-light py-4 transition-all duration-300 ease-in-out overflow-hidden",t?"max-h-20 opacity-100":"h-0 opacity-0 hidden"),children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsxs)("button",{type:"button",onClick:r,className:(0,D.A)("flex items-center gap-2 py-2 rounded-md transition-colors",l?"bg-purple-50 text-purple-700":"hover:bg-neutral-lighter text-neutral-darker"),children:[(0,n.jsx)($.A,{size:24}),(0,n.jsx)(i.o5,{variant:"body-m-heavy",children:"دسته‌بندی‌ها"})]}),(0,n.jsx)(i.cG,{orientation:"vertical",width:23,height:1.5,variant:"neutral-light",className:"bg-neutral-light mx-4"}),(0,n.jsx)("div",{className:"flex items-center gap-6",children:(0,n.jsx)("div",{className:"flex items-center gap-6",children:er.slice(0,a?4:7).map(e=>(0,n.jsx)(B.default,{href:e.url,children:(0,n.jsx)("button",{type:"button",className:"hover:text-neutral-darker transition-colors cursor-pointer",children:(0,n.jsx)(i.o5,{variant:a?"body-s-medium":"body-m-medium",className:"text-neutral-main hover:text-neutral-darker transition-colors",children:e.name})})},e.id))})}),!(0,et.t)()&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.cG,{orientation:"vertical",width:23,height:1.5,variant:"neutral-light",className:"bg-neutral-light mx-4"}),(0,n.jsx)(B.default,{href:"https://automoby.ir/supplier/landing/",target:"_blank",className:"hover:text-primary transition-colors",children:(0,n.jsx)(i.o5,{variant:"body-m-heavy",className:"text-neutral-darker hover:text-primary transition-colors",children:"در اتوموبی بفروشید!"})})]})]})})}function el(){let{isScrolled:e,showBottomSection:t,isFixed:r}=(0,R.g)({hideBottomSectionOnScroll:!0}),l=(0,a.useRef)(null),[i,s]=(0,a.useState)(0);return(0,a.useEffect)(()=>{if(l.current&&!r){let{height:e}=l.current.getBoundingClientRect();s(e)}},[r,t]),(0,n.jsxs)(n.Fragment,{children:[r&&(0,n.jsx)("div",{style:{height:i},className:"w-full"}),(0,n.jsxs)("header",{ref:l,className:(0,D.A)("left-0 right-0 z-50 bg-white transition-all duration-300 px-[104px]",r?"fixed":"static",e?"shadow-[0px_2px_4px_0px_rgba(0,0,0,0.08)]":""),style:r?{top:"0px"}:void 0,children:[(0,n.jsx)(J,{}),(0,n.jsx)(en,{showBottomSection:t})]})]})}var ea=r(67909);let ei=()=>(0,n.jsxs)("button",{type:"button",className:"flex items-center w-full h-10 px-3 bg-white border border-neutral-light rounded-md cursor-pointer hover:border-primary transition-colors focus:outline-none focus:ring-2 focus:ring-primary/20","aria-label":"باز کردن جستجو",children:[(0,n.jsx)(W.A,{size:18,className:"w-5 h-5 text-neutral-main  ml-3"}),(0,n.jsx)(m.o,{variant:"body-xs-medium",className:"flex-1 text-right text-neutral-main",children:"نام محصول یا برند را بنویسید"})]}),es=(0,ea.default)(()=>Promise.resolve().then(r.bind(r,82187)).then(e=>e.default),{loadableGenerated:{webpack:()=>[82187]},ssr:!0,loading:()=>(0,n.jsx)(ei,{})});function eo(){let{isScrolled:e,isFixed:t}=(0,R.g)(),r=(0,i.Iu)();return(0,n.jsx)("header",{className:(0,D.A)("left-0 right-0 z-50 bg-white transition-all duration-300 px-4",t?"fixed":"static",e?"shadow-[0px_2px_4px_0px_rgba(0,0,0,0.08)]":""),style:t?{top:"0px"}:void 0,children:(0,n.jsx)("div",{className:"".concat(r?"py-2":"py-3"),children:(0,n.jsx)(es,{trigger:(0,n.jsx)(ei,{})})})})}function ec(){let e=(0,i.Iu)(),{isLoginPage:t,isPdpPage:r,isPlpPage:s}=(0,l.I)();return(console.log("isPlpPage: ",s),(0,a.useMemo)(()=>(!!r||!!s)&&!!e||!!t,[r,s,t,e]))?null:e?(0,n.jsx)(eo,{}):(0,n.jsx)(el,{})}var ed=r(47650);let eu=[{id:"home",title:"خانه",href:"/",icon:"Home"},{id:"category",title:"دسته‌بندی",href:"#",icon:"Grid",isButton:!0},{id:"checkout",title:"سبد خرید",href:"/checkout/cart",icon:"ShoppingCart"},{id:"profile",title:"پروفایل",href:"/profile/order-history",icon:"User"}];var em=r(57378);let eh=e=>{let{iconName:t,isActive:r}=e,l=em[t];return l?(0,n.jsx)(l,{size:24,fill:r?"currentColor":"none"}):null},ef=e=>{let{item:t,isActive:r,onCategoryClick:l}=e,{cart:a,cartTotalQuantity:i}=(0,v._)(),{isAuthenticated:o}=(0,z.J)(),c=(0,s.usePathname)();return t.isButton?(0,n.jsxs)("button",{type:"button",onClick:l,className:(0,D.$)("flex flex-col items-center justify-center gap-1 transition-colors duration-200",r?"text-primary hover:text-primary hover:bg-primary-lightest":"text-neutral-main hover:text-primary hover:bg-primary-lightest"),children:[t.icon&&(0,n.jsx)("div",{className:(0,D.$)("transition-colors duration-200",r?"text-primary":"text-neutral-main"),children:(0,n.jsx)(eh,{iconName:t.icon,isActive:r})}),(0,n.jsx)("span",{className:(0,D.$)("text-xs font-medium leading-tight",r?"text-primary":"text-neutral-main"),children:t.title})]}):(0,n.jsxs)(B.default,{href:"/profile/order-history"!==t.href||o?t.href:"/login?source=".concat(encodeURIComponent(c)),onClick:()=>{"/checkout/cart"===t.href&&(0,V.tN)(V.Y_.Navbar,a)},className:(0,D.$)("flex flex-col items-center justify-center gap-1 transition-colors duration-200",r?"text-primary":"text-neutral-main hover:text-primary hover:bg-primary-lightest"),children:[t.icon&&(0,n.jsx)("div",{className:(0,D.$)("transition-colors duration-200",r?"text-primary":"text-neutral-main"),children:(0,n.jsx)(eh,{iconName:t.icon,isActive:r})}),(0,n.jsx)("span",{className:(0,D.$)("text-xs font-medium leading-tight",r?"text-primary":"text-neutral-main"),children:t.title}),"/checkout/cart"===t.href&&i>0&&(0,n.jsx)(M.h,{content:i.toString(),position:"absolute -top-[2px] right-[58%]"})]})}
1,ep=e=>{let{items:t,currentPath:r,onCategoryClick:l}=e,a=(0,s.usePathname)(),i=r||a,{toggleMenu:o}=ee(),c=()=>{o(),l&&l()};return(0,n.jsx)("nav",{className:(0,D.$)("fixed bottom-0 left-0 right-0 z-[10000]","bg-white border-t border-neutral-light","px-4 pt-2","shadow-[0_-2px_4px_0_rgba(0,0,0,0.08)] z-100"),children:(0,n.jsx)("div",{className:"flex items-center justify-around",children:t.map(e=>{let t=i===e.href;return(0,n.jsx)("div",{className:"flex-1 flex justify-center",children:(0,n.jsx)(ef,{item:e,isActive:t,onCategoryClick:c})},e.id)})})})},ex=e=>{let{items:t=eu,currentPath:r,onCategoryClick:l}=e,[i,s]=(0,a.useState)(!1);(0,a.useEffect)(()=>{s(!0)},[]);let o=(0,n.jsx)(ep,{items:t,currentPath:r,onCategoryClick:l});return i&&1?(0,ed.createPortal)(o,document.body):o},eg=(e,t,r)=>{let[n,l]=(0,a.useState)([]),[i,s]=(0,a.useState)([]);return(0,a.useEffect)(()=>{if(t&&(null==e?void 0:e.length)>0){let t=e[0];t.children&&(l([{items:t.children,childrenType:t.childrenType,seoName:t.seoName,url:t.url}]),s([t.id]))}else l([]),s([])},[t,e]),{menuStack:n,handleItemSelect:(e,t)=>{let r=n.slice(0,t);e.children&&e.children.length>0?l([...r,{items:e.children,childrenType:e.childrenType,seoName:e.seoName,url:e.url}]):l(r),s([...i.slice(0,t),e.id])},isSelected:e=>i.some(t=>t===e.id),handleBackClick:()=>{n.length>1&&(l(n.slice(0,-1)),s(i.slice(0,-1)))},selectedPath:i,handleCloseMenu:()=>{r&&r(!1)}}};var eb=r(90368);let ev=e=>{let{menuData:t,handleItemSelect:r,isSelected:l}=e;return(0,n.jsx)("div",{className:"flex w-[240px] h-[500px] flex-col items-end border-l border-neutral-light overflow-y-auto overflow-x-hidden scrollbar",children:null==t?void 0:t.map(e=>{var t,a;return(0,n.jsxs)("div",{role:"button",tabIndex:0,onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),r(e,0))},onClick:()=>r(e,0),className:"flex w-[240px] h-[56px] px-[24px] py-4 items-center border-b border-neutral-light cursor-pointer justify-between flex-row hover:bg-neutral-lighter ".concat(l(e)?"bg-primary-light text-primary-dark font-bold":""),children:[(null==(t=e.children)?void 0:t.length)!==0?(0,n.jsxs)("div",{className:"flex justify-end items-center gap-3 flex-row text-decoration-none text-black ".concat(l(e)?"bg-primary-light text-primary-dark font-bold":""),children:[e.icon&&(0,n.jsx)(N.A,{src:e.icon||"",alt:e.seoAlt||e.name,width:40,height:40,className:"object-contain",loading:"lazy"}),(0,n.jsx)(i.o5,{variant:l(e)?"body-m-bold":"body-m-medium",children:e.name})]}):(0,n.jsxs)(B.default,{href:e.url,title:e.seoTitle||e.name,className:"flex justify-end items-center gap-3 flex-row text-decoration-none text-black ".concat(l(e)?"bg-primary-light text-primary-dark font-bold":""),children:[e.icon&&(0,n.jsx)(N.A,{src:e.icon||"",alt:e.seoAlt||e.name,width:40,height:40,className:"object-contain",loading:"lazy"}),(0,n.jsx)(i.o5,{variant:l(e)?"body-m-bold":"body-m-medium",children:e.name})]}),(null==(a=e.children)?void 0:a.length)!==0&&(0,n.jsx)(eb.A,{className:"h-6 w-6"})]},e.id)})})};function ey(e){var t;let{subItem:r,handleItemHover:l,level:s,isSelected:o,handleCloseMenu:c}=e,[d,u]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{u(!0)},[]),(0,n.jsx)("div",{onMouseEnter:l,"data-level":s,className:"flex h-14 w-[180px] font-normal px-6 py-4 justify-between items-center border-b border-neutral-light cursor-pointer text-black no-underline flex-row opacity-0 transition-opacity duration-200 ease-out transition-transform duration-200 ease-out hover:bg-neutral-lighter hover:text-primary-dark ".concat(d?"opacity-100":""," ").concat(o?"bg-primary-light text-primary-dark":""),children:(null==(t=r.children)?void 0:t.length)===0?(0,n.jsx)("div",{className:"flex items-center gap-1",children:(0,n.jsx)(B.default,{title:r.seoTitle?r.seoTitle:r.name,href:r.url,onClick:c,rel:"follow",className:"w-full text-right no-underline text-black hover:text-primary-dark hover:w-full hover:text-base hover:font-bold",children:(0,n.jsx)(i.o5,{variant:o?"body-m-bold":"body-m-medium",children:r.name})})}):(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)(i.o5,{variant:o?"body-m-bold":"body-m-medium",children:r.name}),(0,n.jsx)(eb.A,{height:24,width:24,onClick:c})]})})}function ej(e){var t,r,l;let{item:a}=e;return(0,n.jsxs)("div",{className:"flex flex-col w-[200px] gap-3 items-end",children:[(0,n.jsx)("div",{className:"flex w-full items-center justify-between px-3 border-r-2 border-primary-dark hover:text-primary-dark",children:(null==(t=a.children)?void 0:t.length)!==0?(0,n.jsx)(i.o5,{variant:"body-m-bold",children:a.name}):(0,n.jsx)(B.default,{rel:"follow",href:a.url||"/",title:a.seoT
1itle?a.seoTitle:a.name,className:"text-neutral-darker text-right text-base font-bold no-underline",children:a.name})}),(null==(r=a.children)?void 0:r.length)!==0&&(0,n.jsx)("div",{className:"mb-2.5 w-full",children:null==(l=a.children)?void 0:l.map(e=>(0,n.jsx)("div",{children:(0,n.jsx)(B.default,{rel:"follow",title:e.seoTitle||e.name,href:e.url||"/",className:"text-neutral-main text-right text-sm font-normal cursor-pointer no-underline",children:e.name})},e.id))})]})}var ew=r(24142);let eN=e=>{let{menuStack:t,handleItemSelect:r,isSelected:l,handleCloseMenu:a}=e;return(0,n.jsx)(n.Fragment,{children:t.map((e,t)=>0!==e.items.length&&(e.childrenType===ew.l.CIRCULAR?(0,n.jsx)("div",{className:"flex w-[180px] h-[500px] flex-col items-end border-l border-neutral-light overflow-y-auto overflow-x-hidden scrollbar",children:e.items.map(e=>(0,n.jsx)(ey,{handleItemHover:()=>r(e,t+1),subItem:e,level:t,isSelected:l(e),handleCloseMenu:a},e.id))},"".concat(e.childrenType,"-").concat(e.url)):(0,n.jsxs)("div",{className:"overflow-y-auto scrollbar p-[24px]",children:[(0,n.jsxs)("div",{className:"flex items-center cursor-pointer justify-start text-primary-dark flex-row gap-1",children:[(0,n.jsx)(B.default,{rel:"follow",className:"text-primary-dark text-right text-base font-bold text-decoration-none",href:e.url,title:e.seoName,children:(0,n.jsx)(i.o5,{variant:"body-m-bold",children:e.seoName})}),(0,n.jsx)(eb.A,{size:16,className:"text-primary-dark"})]}),(0,n.jsx)("div",{className:"flex flex-wrap h-[504px] flex-row-reverse items-start gap-6 content-start",children:e.items.map(e=>(0,n.jsx)(ej,{item:e},e.id))})]},"".concat(e.childrenType,"-").concat(e.url))))})};function ek(e){let{menuData:t,menuIsOpen:r,setMenuIsOpen:l,menuButtonRef:s}=e,{menuRef:o}=((e,t,r)=>{let n=(0,a.useRef)(null),[l,i]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{i(!0)},[]),(0,a.useEffect)(()=>{if(!l)return;let a=e=>{let l=e.target;n.current&&!n.current.contains(l)&&r.current&&!r.current.contains(l)&&t(!1)};e?document.addEventListener("mousedown",a):document.removeEventListener("mousedown",a)},[e,t,r,l]),(0,a.useEffect)(()=>{l&&(e?document.body.style.overflow="hidden":document.body.style.overflow="")},[e,l]),{menuRef:n}})(r,l,s),{menuStack:c,handleItemSelect:d,isSelected:u}=eg(t,r),[m,h]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=()=>{h(window.scrollY>0)};return e(),window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)},[]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.zs,{isOpen:r,onClick:()=>l(!1),className:m?"mt-[87px]":"mt-[222px]"}),(0,n.jsxs)("div",{ref:o,role:"dialog","aria-modal":"true","aria-hidden":!r,tabIndex:-1,style:{top:m?"87px":"222px"},className:"flex flex-row w-[1235px] h-[500px] bg-white z-[1500] fixed right-0 transition-transform duration-200 ease-out md:w-[1100px] md:top-[265px] ".concat(r?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none hidden"),children:[(0,n.jsx)(ev,{menuData:t,handleItemSelect:d,isSelected:u}),(0,n.jsx)(eN,{menuStack:c,isSelected:u,handleItemSelect:d,handleCloseMenu:()=>l(!1)})]})]})}var eI=r(82187);function eC(e){let{menuData:t,handleItemSelect:r,selectedRootItem:l}=e,a=null==t?void 0:t.sort((e,t)=>e.priority-t.priority);return(0,n.jsx)("div",{className:"h-full w-16 overflow-y-scroll scrollbar bg-primary-lightest",children:null==a?void 0:a.map(e=>{var t;return(null==(t=e.children)?void 0:t.length)!==0?(0,n.jsxs)("div",{role:"button",tabIndex:0,onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),r(e,0))},onClick:()=>r(e,0),className:"w-full h-[74px] flex flex-col justify-center items-center gap-0.5 border-b border-neutral-light no-underline text-neutral-darker text-center text-[11px] font-normal ".concat((null==l?void 0:l.id)===e.id?"bg-white":"bg-primary-lightest"),children:[(0,n.jsx)(N.A,{src:e.icon||"",alt:e.seoAlt||e.name,width:40,height:40,loading:"lazy"}),(0,n.jsx)(i.o5,{variant:"body-t-medium",children:e.name})]},e.id):(0,n.jsxs)(B.default,{href:e.url,rel:"follow",title:e.seoTitle?e.seoTitle:e.name,className:"w-full h-[74px] flex flex-col justify-center items-center gap-0.5 border-b border-neutral-light no-underline text-neutral-darker text-center text-[11px] font-normal ".concat((null==l?void 0:l.id)===e.id?"bg-white":"bg-primary-lightest"),children:[(0,n.jsx)(N.A,{src:e.icon||"",alt:e.seoAlt?e.seoAlt:e.name,width:40,height:40,loading:"lazy"}),(0,n.jsx)(i.o5,{variant:"body-t-medium",children:e.name})]},e.id)})})}var eS=r(27937);function eA(e){let{title:t,link:r,handleBackClick:l,handleCloseMenu:a,isRo
1otMenu:s}=e;return(0,n.jsxs)("div",{className:"w-full h-[5%] flex justify-between items-center text-neutral-black",children:[s?(0,n.jsx)(q.A,{size:24,className:"cursor-pointer",onClick:a}):(0,n.jsx)(eS.A,{size:24,className:"cursor-pointer",onClick:l}),(0,n.jsxs)(B.default,{rel:"follow",href:r||"/",className:"text-primary-dark text-right flex pr-[11px] justify-center items-center gap-1 no-underline",children:[(0,n.jsx)(i.o5,{variant:"body-s-bold",children:t}),(0,n.jsx)(eb.A,{size:12})]})]})}function e_(e){var t;let{subItem:r,handleItemSelect:l,handleCloseMenu:a}=e;return(null==(t=r.children)?void 0:t.length)!==0?(0,n.jsxs)("button",{type:"button",onClick:l,className:"h-[85px] w-[82px] flex flex-col items-center gap-2 cursor-pointer hover:bg-neutral-lighter rounded-lg transition-colors","aria-label":r.seoTitle||r.name,children:[(0,n.jsx)(N.A,{src:r.icon||"",alt:r.seoAlt||r.name,width:53,height:53,className:"object-contain",loading:"lazy"}),(0,n.jsx)(i.o5,{variant:"body-t-medium",children:r.name})]},r.id):(0,n.jsxs)(B.default,{href:r.url,title:r.seoTitle||r.name,rel:"follow",className:"w-[82px] h-[87px] flex flex-col items-center gap-2 cursor-pointer hover:bg-neutral-lighter rounded-lg transition-colors",onClick:a,children:[(0,n.jsx)(N.A,{src:r.icon||"",alt:r.seoAlt||r.name,width:53,height:53,className:"object-contain",loading:"lazy"}),(0,n.jsx)(i.o5,{variant:"body-t-medium",children:r.name})]},r.id)}function eE(e){var t,r;let{item:l,index:a}=e,s=(0,n.jsx)("div",{className:"flex flex-wrap justify-start flex-row gap-1 w-full bg-white",children:null==(t=l.children)?void 0:t.map(e=>(0,n.jsxs)(B.default,{href:e.url||"/",rel:"follow",title:e.seoTitle?e.seoTitle:e.name,className:"w-[82px] h-[87px] flex flex-col items-center text-neutral-darker text-center no-underline p-2",replace:!0,children:[(0,n.jsx)(N.A,{src:e.icon||"",alt:e.seoAlt?e.seoAlt:e.name,width:48,height:48,loading:"lazy"}),(0,n.jsx)(i.o5,{variant:"body-t-medium",children:e.name})]},e.id))});return(0,n.jsx)("div",{className:"w-full border-b border-primary-light",children:(null==(r=l.children)?void 0:r.length)!==0?(0,n.jsx)(i.nD,{defaultExpanded:0===a,title:l.name,body:s,className:"!bg-white",contentBackgroundColor:"white"}):(0,n.jsx)(B.default,{href:l.url||"/",title:l.seoTitle||l.name,rel:"follow",className:"flex p-[10px] items-center gap-[10px] self-stretch text-neutral-darker text-[12px] font-bold no-underline",children:(0,n.jsx)(i.o5,{variant:"body-t-medium",children:l.name})})})}function eT(e){var t;let{menuStack:r,handleItemSelect:l,handleCloseMenu:a}=e,i=r[r.length-1],s=null==i||null==(t=i.items)?void 0:t.sort((e,t)=>e.priority-t.priority);return(0,n.jsx)("div",{className:"w-full h-[95%] flex items-start gap-1 self-stretch flex-row flex-wrap content-start justify-around overflow-y-scroll scrollbar sm:gap-2 ",children:(null==i?void 0:i.childrenType)===ew.l.CIRCULAR?null==s?void 0:s.map(e=>(0,n.jsx)(e_,{subItem:e,handleItemSelect:()=>l(e,r.length),handleCloseMenu:a},e.id)):(0,n.jsx)("div",{className:"w-full",children:null==s?void 0:s.map((e,t)=>(0,n.jsx)(eE,{item:e,index:t},e.id))})})}function eP(e){var t,r;let{menuData:l,handleItemSelect:a,handleBackClick:i,handleCloseMenu:s,isRootMenu:o}=e;return(0,n.jsxs)("div",{className:"w-[calc(100%-64px)] h-full px-[20px] py-[10px] flex flex-col gap-[10px]",children:[(0,n.jsx)(eA,{handleBackClick:i,link:null==(t=l[l.length-1])?void 0:t.url,title:null==(r=l[l.length-1])?void 0:r.seoName,handleCloseMenu:s,isRootMenu:o}),(0,n.jsx)(eT,{menuStack:l,handleItemSelect:a,handleCloseMenu:s})]})}function eO(e){let{menuData:t,menuIsOpen:r,setMenuIsOpen:l}=e,{menuStack:s,handleItemSelect:o,handleBackClick:c,handleCloseMenu:d}=eg(t,r,l),[u,m]=(0,a.useState)(null==t?void 0:t.at(0));return(0,n.jsx)(i._s,{isOpen:r,onClose:()=>l(!1),isMobile:!0,className:"!p-0 h-full",zIndex:9999,children:(0,n.jsxs)("div",{className:"w-screen h-full flex flex-col pb-[57px]",children:[(0,n.jsx)("div",{className:"w-full px-[16px] py-[12px] bg-white shadow-[0_2px_4px_0_rgba(0,0,0,0.08)] z-10",children:(0,n.jsx)(eI.default,{trigger:(0,n.jsx)(ei,{}),onClose:()=>{}})}),(0,n.jsxs)("div",{className:"w-full h-[90%] flex flex-row",children:[(0,n.jsx)(eC,{menuData:t,handleItemSelect:e=>{m(e),o(e,0)},selectedRootItem:u}),(0,n.jsx)(eP,{handleBackClick:c,menuData:s,handleItemSelect:o,handleCloseMenu:d,isRo
1otMenu:1===s.length})]})]})})}function eD(e){let{menuData:t}=e,r=e=>null==e?void 0:e.map(e=>(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsx)(B.default,{href:e.url,className:"text-sm text-gray-600 hover:text-gray-900",title:e.seoTitle,rel:"follow",children:e.name}),e.children&&e.children.length>0&&(0,n.jsx)("div",{className:"ml-5 mt-1",children:r(e.children)})]},e.id));return(0,n.jsx)("div",{className:"hidden",children:r(t)})}function eR(){let[e,t]=(0,a.useState)(!1),r=(0,a.useRef)(null),{isMenuOpen:l,closeMenu:s,menuData:o}=ee();(0,a.useEffect)(()=>{t(!0)},[]);let c=(0,i.Iu)(),d=(0,a.useMemo)(()=>(0,n.jsx)(eD,{menuData:o}),[]);return(0,n.jsxs)("div",{children:[c&&e&&(0,n.jsx)(eO,{menuData:o,menuIsOpen:l,setMenuIsOpen:s}),!c&&e&&(0,n.jsx)(ek,{menuData:o,menuIsOpen:l,setMenuIsOpen:s,menuButtonRef:r}),d]})}var eL=r(23887);let eU=[{image:"/Group.svg",title:"ضمانت اصل بودن",description:"بازگشت بی‌قید و شرط در صورت اصل نبودن کالا"},{image:"/best-price.svg",title:"تکمیل بودن قطعات",description:"هرچی بخوای هست."},{image:"/Framebattery.svg",title:"نصب رایگان باتری",description:"تهران، مشهد، اصفهان، تبریز، کرج"},{image:"/barcodefa.svg",title:"خرید اقساطی",description:"خرید قسطی بدون کارمزد در ۴ قسط"}],eM=[{image:"/Frame%20%282%29.svg",title:"پشتیبانی تخصصی",description:"تماس بگیر، مطمئن خرید کن"},...eU.slice(1)],eB=e=>{let{isMobile:t}=e,r=(0,et.t)()?eM:eU;return t?(0,n.jsx)("div",{className:"px-4 py-6 shadow-sm",children:(0,n.jsx)("div",{className:"bg-white rounded-lg p-6",children:(0,n.jsx)(eL.default,{values:r,variant:"footer"})})}):(0,n.jsx)("div",{className:"px-26 py-8",children:(0,n.jsx)("div",{className:"bg-white rounded-lg p-4",children:(0,n.jsx)(eL.default,{values:r,variant:"footer"})})})};var ez=r(15239),eG=r(67161),eH=r(97378);let eY=e=>{let{isMobile:t}=e,r=[{id:"aparat",icon:"/aparat-icon.svg",name:"Aparat",href:"https://aparat.com/"},{id:"instagram",icon:(0,n.jsx)(eG.A,{size:20,className:"w-full h-full object-contain text-neutral-main"}),name:"Instagram",href:"http://Instagram.com/automoby.ir"},{id:"twitter",icon:(0,n.jsx)(eH.A,{size:20,className:"w-full h-full object-contain text-neutral-main"}),name:"Twitter",href:"https://twitter.com/Automobyir"}];return t?(0,n.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,n.jsx)(i.o5,{variant:"body-xs-bold",color:"neutral-main",children:"ما را در شبکه های اجتماعی دنبال کنید:"}),(0,n.jsx)("div",{className:"flex items-center gap-4",children:r.map(e=>(0,n.jsx)(B.default,{href:e.href,className:"w-5 h-5",target:"_blank",children:"string"==typeof e.icon?(0,n.jsx)(ez.default,{src:e.icon,alt:e.name,width:20,height:20,className:"w-full h-full object-contain"}):e.icon},e.id))})]}):(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,n.jsx)(i.o5,{variant:"body-s-bold",color:"neutral-main",children:"ما را در شبکه های اجتماعی دنبال کنید:"}),(0,n.jsx)("div",{className:"flex items-center gap-4",children:r.map(e=>(0,n.jsx)(B.default,{href:e.href,className:"w-5 h-5",target:"_blank",children:"string"==typeof e.icon?(0,n.jsx)(ez.default,{src:e.icon,alt:e.name,width:20,height:20,className:"w-full h-full object-contain"}):e.icon},e.id))})]})},eF=e=>{let{isMobile:t}=e,r="اتوموبی، بازار آنلاین لوازم یدکی است که با هدف ایجاد بستری مطمئن برای تأمین قطعات خودرو در سال ۱۳۹۸ شکل گرفت. این مجموعه با همکاری تأمین‌کنندگان معتبر، تغییرات مثبتی را برای خرید آنلاین قطعات یدکی از جمله لوازم مصرفی، موتوری، بدنه، الکترونیک، جلوبندی و سایر قطعات ایجاد کرده است. اتوموبی به دنبال آن است تا به‌عنوان یک بازار امن در حوزۀ قطعات خودرو، تجربۀ خرید آنلاین لوازم یدکی را بهبود دهد و به مشتریان عزیز ارزش تازه‌ای ارائه دهد. تضمین کیفیت، اصالت کالا، شفافیت قیمت، دست‌رسی آسان به لوازم یدکی و اتصال به شبکۀ تأمین‌کنندگان مطمئن از ارزش‌های اتوموبی است تا یک تجربۀ امن در خرید لوازم یدکی داشته باشید.\n\n";return t?(0,n.jsx)("div",{className:"px-4 py-6",children:(0,n.jsxs)("div",{className:"mb-6 text-center",children:[(0,n.jsx)("div",{className:"flex justify-center mb-2",children:(0,n.jsx)("div",{className:"w-[202px] h-8 relative",children:(0,n.jsx)(ez.default,{src:"/automoby-logo.png",alt:"Automoby Logo",width:202,height:32,className:"object-contain"})})}),(0,n.jsx)(i.o5,{variant:"body-s-medium",color:"neutral-darker",className:"text-ju
1stify leading-relaxed mb-6",children:r}),(0,n.jsx)(eY,{isMobile:t})]})}):(0,n.jsx)("div",{className:"w-144",children:(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsx)("div",{className:"w-[202px] h-8 mb-1",children:(0,n.jsx)(ez.default,{src:"/automoby-logo.png",alt:"Automoby Logo",width:202,height:32,className:"object-contain"})}),(0,n.jsx)(i.o5,{variant:"body-xl-heavy",color:"neutral-darker",children:"فروشگاه آنلاین لوازم یدکی خودرو | اتوموبی"})]}),(0,n.jsx)(i.o5,{variant:"body-m-medium",color:"neutral-darker",className:"text-justify leading-relaxed",children:r}),(0,n.jsx)(eY,{isMobile:t})]})})},eW=[{id:"brake-pad-pride",text:"لنت ترمز پراید",dot:!0,href:"/cat-brake-pad/cm-pride/",title:"لنت ترمز پراید"},{id:"radiator-pride",text:"رادیاتور پراید",dot:!0,href:"/cat-radiator/cm-pride/",title:"رادیاتور پراید"},{id:"radiator-samand",text:"رادیاتور سمند",dot:!0,href:"/cat-radiator/cm-samand/",title:"رادیاتور سمند"},{id:"radiator-206",text:"رادیاتور ۲۰۶",dot:!0,href:"/cat-radiator/cm-206/",title:"رادیاتور ۲۰۶"},{id:"side-mirror-pride",text:"آینه بغل پراید",dot:!0,href:"/cat-side-mirror/cm-pride/",title:"آینه بغل پراید"},{id:"spark-plugs-pride",text:"شمع پراید",dot:!0,href:"/cat-spark-plugs/cm-pride/",title:"شمع پراید"},{id:"front-lights-pride",text:"چراغ جلو پراید",dot:!0,href:"/cat-front-lights/cm-pride/",title:"چراغ جلو پراید"},{id:"front-lights-samand",text:"چراغ جلو سمند",dot:!0,href:"/cat-front-lights/cm-samand/",title:"چراغ جلو سمند"},{id:"timing-belt-pride",text:"تسمه تایم پراید",dot:!0,href:"/cat-timing-belt/cm-pride/",title:"تسمه تایم پراید"},{id:"timing-belt-206",text:"تسمه تایم ۲۰۶",dot:!0,href:"/cat-timing-belt/cm-206/",title:"تسمه تایم ۲۰۶"},{id:"rubber-pride",text:"لاستیک پراید",dot:!0,href:"/cat-rubber/cm-pride/",title:"لاستیک پراید"}],eq=[{id:"about-us",text:"درباره ما",dot:!0,href:"/about-us",title:"درباره ما"},{id:"contact-us",text:"تماس با ما",dot:!0,href:"/contact-us",title:"تماس با ما"},{id:"faq",text:"سوالات متداول",dot:!0,href:"/faq",title:"سوالات متداول"},{id:"terms-and-condition",text:"قوانین و مقررات",dot:!0,href:"/terms-and-condition",title:"قوانین و مقررات"},{id:"return-policy",text:"شرایط بازگشت کالا",dot:!0,href:"/return-policy",title:"شرایط بازگشت کالا"},{id:"become-seller",text:"فروشنده اتوموبی شو",dot:!0,href:"https://landing.automoby.ir/supplier/",title:"فروشنده اتوموبی شو"},{id:"blog",text:"وبلاگ",dot:!0,href:"https://blog.automoby.ir",title:"وبلاگ"}],eK=e=>{let{isMobile:t}=e,r=(0,et.t)()?eq.filter(e=>"become-seller"!==e.id):eq;return t?(0,n.jsx)("div",{className:"px-4 pb-6",children:(0,n.jsxs)("div",{className:"flex justify-center gap-6",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(i.o5,{variant:"body-m-bold",color:"neutral-main",className:"mb-3 opacity-80",children:"اتوموبی"}),(0,n.jsx)("div",{className:"space-y-2",children:r.map(e=>(0,n.jsxs)(B.default,{className:"flex items-center gap-2",href:e.href,title:e.title,children:[(0,n.jsx)("div",{className:"w-1 h-1 bg-yellow-500 rounded-full"}),(0,n.jsx)(i.o5,{variant:"body-s-medium",color:"neutral-darker",children:e.text})]},e.id))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(i.o5,{variant:"body-m-bold",color:"neutral-main",className:"mb-3 opacity-80",children:"پربازدید"}),(0,n.jsx)("div",{className:"space-y-2",children:eW.map(e=>(0,n.jsxs)(B.default,{className:"flex items-center gap-2",href:e.href,title:e.title,children:[(0,n.jsx)("div",{className:"w-1 h-1 bg-yellow-500 rounded-full"}),(0,n.jsx)(i.o5,{variant:"body-s-medium",color:"neutral-darker",children:e.text})]},e.id))})]})]})}):(0,n.jsxs)("div",{className:"flex gap-14",children:[(0,n.jsx)("div",{className:"w-44",children:(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsx)("div",{className:"pb-1",children:(0,n.jsx)(i.o5,{variant:"body-m-bold",color:"neutral-main",className:"opacity-80",children:"اتوموبی"})}),(0,n.jsx)("div",{className:"space-y-2",children:r.map(e=>(0,n.jsxs)(B.default,{className:"flex items-center gap-3",href:e.href,title:e.title,children:[(0,n.jsx)("div",{className:"w-1 h-1 bg-yellow-500 rounded-full"}),(0,n.jsx)(i.o5,{variant:"body-m-medium",color:"neutral-darker",children:e.text})]},e.id))})]})}),(0,n.jsx)("div",{className:"w-44 text-right",children:(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,n.jsx)("div",{className:"pb-1",children:(0,n.jsx)(i.o5,{variant:"body-m-bold",color:"neutral-main",className:"opacity-80",children:"پربازدید"})}),(0,n.jsx)("div",{className:"space-y-3",children:eW.map(e=>(0,n.jsxs)(B.default,{className:"flex items-center gap-3",href:e.href,title:e.title,children:[(0,n.jsx)("div",{className:"w-1 h-1 bg-yellow-500 rounded-full"}),(0,n.jsx)(i.o5,{variant:"body-m-medium",color:"neutral-darker",children:e.text})]},e.id))})]})})]})},eQ=e=>{let{isMobile:t}=e,r="automoby.org"===(0,C.p)("DOMAIN_NAME"),l=[{src:r?"https://trustseal.enamad.ir/logo.aspx?id=701608&Code=hVPl4aYnbIMU4dkSzT4T31vUCPrkqtRG":"https://trustseal.enamad.ir/logo.aspx?id=139852&Code=jCroThuYyBvhx8bFQnMk8amES2Hfaz8h",alt:"",href:r?"https://trustseal.enamad.ir/?id=701608&Code=hVPl4aYnbIMU4dkSzT4T31vUCPrkqtRG":"https://trustseal.enamad.ir/?id=139852&Code=jCroThuYyBvhx8bFQnMk8amES2Hfaz8h",useNativeAnchor:!0,referrerPolicy:"origin",target:"_blank"},{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQwIiBoZWlnaHQ9IjM2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KCTxwYXRoIGQ9Im0xMjAgMjQzbDk0LTU0IDAtMTA5IC05NCA1NCAwIDEwOSAwIDB6IiBmaWxsPSIjODA4Mjg1Ii8+Cgk8cGF0aCBkPSJtMTIwIDI1NGwtMTAzLTYwIDAtMTE5IDEwMy02MCAxMDMgNjAgMCAxMTkgLTEwMyA2MHoiIHN0eWxlPSJmaWxsOm5vbmU7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS13aWR0aDo1O3N0cm9rZTojMDBhZWVmIi8+Cgk8cGF0aCBkPSJtMjE0IDgwbC05NC01NCAtOTQgNTQgOTQgNTQgOTQtNTR6IiBmaWxsPSIjMDBhZWVmIi8+Cgk8cGF0aCBkPSJtMjYgODBsMCAxMDkgOTQgNTQgMC0xMDkgLTk0LTU0IDAgMHoiIGZpbGw9IiM1ODU5NWIiLz4KCTxwYXRoIGQ9Im0xMjAgMTU3bDQ3LTI3IDAtMjMgLTQ3LTI3IC00NyAyNyAwIDU0IDQ3IDI3IDQ3LTI3IiBzdHlsZT0iZmlsbDpub25lO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2Utd2lkdGg6MTU7c3Ryb2tlOiNmZmYiLz4KCTx0ZXh0IHg9IjE1IiB5PSIzMDAiIGZvbnQtc2l6ZT0iMjVweCIgZm9udC1mYW1pbHk9IidCIFlla2FuJyIgc3R5bGU9ImZpbGw6IzI
15Mjk1Mjtmb250LXdlaWdodDpib2xkIj7Yudi22Ygg2KfYqtit2KfYr9uM2Ycg2qnYtNmI2LHbjDwvdGV4dD4KCTx0ZXh0IHg9IjgiIHk9IjM0MyIgZm9udC1zaXplPSIyNXB4IiBmb250LWZhbWlseT0iJ0IgWWVrYW4nIiBzdHlsZT0iZmlsbDojMjkyOTUyO2ZvbnQtd2VpZ2h0OmJvbGQiPtqp2LPYqCDZiCDaqdin2LHZh9in24wg2YXYrNin2LLbjDwvdGV4dD4KPC9zdmc+",alt:"",onClick:()=>window.open("https://ecunion.ir/verify/automoby.ir?token=171684267e8018211ccc","Popup","toolbar=no, location=no, statusbar=no, menubar=no, scrollbars=1, resizable=0, width=580, height=600, top=30")}];return t?(0,n.jsx)("div",{className:"px-4 py-6 flex justify-center gap-4",children:l.map(e=>e.useNativeAnchor?(0,n.jsx)("a",{href:e.href||"",className:"w-24 h-30",target:e.target,referrerPolicy:e.referrerPolicy,children:(0,n.jsx)(ez.default,{src:e.src,alt:e.alt,width:112,height:96,className:"w-full h-full object-contain"})},e.alt):(0,n.jsx)(B.default,{href:e.href||"",className:"w-24 h-30",onClick:null==e?void 0:e.onClick,children:(0,n.jsx)(ez.default,{src:e.src,alt:e.alt,width:112,height:96,className:"w-full h-full object-contain"})},e.alt))}):(0,n.jsx)("div",{className:"flex justify-center gap-4",children:l.map(e=>e.useNativeAnchor?(0,n.jsx)("a",{href:e.href||"",className:"w-24 h-30",target:e.target,referrerPolicy:e.referrerPolicy,children:(0,n.jsx)(ez.default,{src:e.src,alt:e.alt,width:96,height:120,className:"w-full h-full object-contain"})},e.alt):(0,n.jsx)(B.default,{className:"w-24 h-30",onClick:null==e?void 0:e.onClick,href:e.href||"",children:(0,n.jsx)(ez.default,{src:e.src,alt:e.alt,width:96,height:120,className:"w-full h-full object-contain"})},e.alt))})};var eZ=r(38627);let eV=e=>{let{isMobile:t}=e;return t?(0,n.jsx)("div",{className:"px-4 pb-4",children:(0,n.jsx)("div",{className:"bg-neutral-lighter rounded-md p-4",children:(0,n.jsxs)("div",{className:"text-center space-y-2",children:[(0,n.jsx)("div",{className:"flex items-center justify-center gap-4 text-xs",children:(0,n.jsx)(B.default,{href:"/terms-and-condition/",children:(0,n.jsx)(i.o5,{variant:"body-xs-medium",className:"text-neutral-dark",children:"قوانین و مقررات"})})}),(0,n.jsx)(i.o5,{variant:"body-xs-medium",className:"text-neutral-main opacity-80",children:"تمامی حقوق محفوظ میباشد. | اتوموبی\xa9 ۱۴۰۴ - ۱۳۹۸"})]})})}):(0,n.jsx)("div",{className:"px-26 pb-8",children:(0,n.jsxs)("div",{className:"relative rounded-md py-3 h-10 flex items-center gap-3",children:[(0,n.jsx)("div",{className:"absolute inset-0 gap-3"}),(0,n.jsxs)("button",{type:"button",onClick:()=>{window.scrollTo({top:0,behavior:"smooth"})},className:"relative z-10 flex items-center gap-1.5 bg-neutral-lighter hover:bg-gray-200 transition-colors px-4 py-2.25 rounded-md h-10 w-32",children:[(0,n.jsx)(eZ.A,{size:16,className:"text-neutral-dark",strokeWidth:1.5}),(0,n.jsx)(i.o5,{variant:"body-xs-bold",className:"text-neutral-darker text-xs font-bold leading-[1.8]",children:"بازگشت به بالا"})]}),(0,n.jsxs)("div",{className:"relative z-10 flex rounded-md p-3 bg-neutral-lighter items-center justify-between flex-1",children:[(0,n.jsx)("div",{children:" "}),(0,n.jsx)(i.o5,{variant:"body-xs-medium",className:"text-neutral-main text-xs leading-[1.8]",children:"تمامی حقوق محفوظ میباشد. | اتوموبی\xa9 ۱۴۰۴ - ۱۳۹۸"}),(0,n.jsxs)("div",{className:"flex items-center gap-6",children:[(0,n.jsx)(i.o5,{variant:"body-xs-medium",className:"text-neutral-dark text-xs leading-[1.8]",children:"شرایط استفاده از خدمات"}),(0,n.jsx)(i.o5,{variant:"body-xs-medium",className:"text-neutral-dark text-xs leading-[1.8]",children:"قوانین و مقررات"})]})]})]})})},eJ=()=>{let e=(0,i.Iu)();return e?(0,n.jsxs)("footer",{className:"bg-white w-full",children:[(0,n.jsx)(eB,{isMobile:e}),(0,n.jsx)(eF,{isMobile:e}),(0,n.jsx)(eK,{isMobile:e}),(0,n.jsx)(eQ,{isMobile:e}),(0,n.jsx)(eV,{isMobile:e})]}):(0,n.jsxs)("footer",{className:"bg-white w-full",children:[(0,n.jsx)(eB,{isMobile:e}),(0,n.jsx)("div",{className:"px-26 py-8",children:(0,n.jsxs)("div",{className:"flex items-start gap-14",children:[(0,n.jsx)(eF,{isMobile:e}),(0,n.jsx)(eK,{isMobile:e}),(0,n.jsx)(eQ,{isMobile:e})]})}),(0,n.jsx)(eV,{isMobile:e})]})};var e$=r(28243);let eX=()=>{let e=(0,e$.t)(),{createUserActivity:t}=(0,I.I)();return(0,a.useEffect)(()=>{t({type:k.eP.VIEW_PAGE,url:e})},[e,t]),null},e0={SECTION:"ab_test_login_popup_section",DONT_SHOW_AGAIN:"ab_test_login_popup_dont_show_again",CLOSED_AT:"ab_test_login_popup_closed_at"},e1=(e,t)=>{let r=Number((0,C.p)(e));return Number.isFinite(r)?r:t},e2=(0,C.T)("AB_TEST_LOGIN_POPUP_ENABLED",!0),e5={B1_DELAY:e1("AB_TEST_LOGIN_POPUP_B1_DELAY",2e3),B2_DELAY:e1("AB_TEST_LOGIN_POPUP_B2_DELAY",5e3),RE_SHOW_DELAY:e1("AB_TEST_LOGIN_POPUP_RESHOW_DELAY",36e5)};var e4=function(e){return e.A="A",e.B1="B1",e.B2="B2",e}({}),e3=r(35947),e6=r(69155);let e8=function(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};null==(t=window.eventHorizonTracker)||t.track(e.toUpperCase(),r)},e9=async()=>{try{let e=await (0,E.GO)("/constants/login-popup",{cache:"no-store",params:{domain:(0,C.p)("DOMAIN_NAME")}});return null!=e?e:null}catch(e){return null}},e7=async()=>{try{let e=await (0,E.GO)("/constants/login-popup",{cache:"no-store",params:{domain:(0,C.p)("DOMAIN_NAME"),type:"logged-in"}});return null!=e?e:null}catch(e){return null}};
1var te=r(6402),tt=r(80549),tr=r(69141),tn=r(31930),tl=r(86318),ta=r(19542),ti=r(59853),ts=r(72099),to=r(76348),tc=r(19540);function td(e){let{startsAt:t,endsAt:r}=e,[l,s]=(0,a.useState)(()=>Date.now());(0,a.useEffect)(()=>{let e=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(e)},[]);let o=new Date(r).getTime(),c=t?new Date(t).getTime():null;if(Number.isNaN(o)||null!==c&&Number.isNaN(c)||null!==c&&l<c)return null;let d=o-l;if(d<=0)return null;let u=Math.floor(d/1e3),m=[{label:"روز",value:Math.floor(u/86400)},{label:"ساعت",value:Math.floor(u%86400/3600)},{label:"دقیقه",value:Math.floor(u%3600/60)},{label:"ثانیه",value:u%60}].filter(e=>"روز"!==e.label||e.value>0);return(0,n.jsx)("div",{className:"flex items-center justify-center gap-2",children:m.map(e=>(0,n.jsxs)("div",{className:"flex min-w-[52px] flex-col items-center rounded-lg bg-primary-lightest px-2 py-1.5",children:[(0,n.jsx)(i.o5,{variant:"body-m-bold",className:"tabular-nums text-primary-darkest",children:(0,tc.T)(e.value.toString().padStart(2,"0"))}),(0,n.jsx)(i.o5,{variant:"body-xs-medium",className:"text-neutral-main",children:e.label})]},e.label))})}function tu(e){var t,r;let{config:l}=e,a=(null==l||null==(t=l.title)?void 0:t.trim())||"شماره‌ات رو وارد کن و از تخفیف‌های اتوموبی باخبر شو \uD83C\uDF89",s=null==l||null==(r=l.subtitle)?void 0:r.trim();return(0,n.jsxs)("div",{className:"space-y-3 text-center",children:[(null==l?void 0:l.imageUrl)&&(0,n.jsx)("div",{className:"relative mx-auto aspect-[334/200] w-full max-w-[334px] overflow-hidden rounded-2xl",children:(0,n.jsx)(N.A,{src:l.imageUrl,alt:a,fill:!0,sizes:"334px",className:"object-cover"})}),(0,n.jsx)(i.o5,{variant:"h6",className:"font-bold leading-8 text-primary-darkest",children:a}),(null==l?void 0:l.countdownEnd)&&(0,n.jsx)(td,{startsAt:l.countdownStart,endsAt:l.countdownEnd}),s&&(0,n.jsx)(i.o5,{variant:"body-s-medium",className:"leading-7 text-neutral-main",children:s})]})}function tm(e){let{checked:t,onChange:r}=e;return(0,n.jsxs)("div",{className:"flex items-center gap-2 cursor-pointer",onClick:()=>r(!t),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),r(!t))},role:"button",tabIndex:0,children:[(0,n.jsx)("input",{type:"checkbox",checked:t,onChange:e=>r(e.target.checked),className:"w-4 h-4 accent-primary text-primary border-neutral-light rounded focus:ring-primary pointer-events-none",tabIndex:-1}),(0,n.jsx)(i.o5,{variant:"body-xs-medium",className:"text-neutral-darker",children:"دیگه اینو نشون نده"})]})}function th(e){let{config:t,onPhoneSubmit:r,onCancel:l,onDontShowAgainChange:s,dontShowAgain:o}=e,[c,d]=(0,a.useState)(""),[u,m]=(0,a.useState)(""),h=(0,tl.A)(),{showError:f}=(0,to.d)();(0,a.useEffect)(()=>{let e=(0,ta.xU)(ti.IP);e&&d(e)},[]);let p=(0,tt.n)({mutationFn:e=>(0,tn.fN)(e),onSuccess:()=>{(0,ta.nh)(ti.IP,c),(0,ta.mE)(ti.C4),r()},onError:e=>{f("خطا در ارسال کد تایید. لطفاً دوباره تلاش کنید."),console.error("Error sending OTP:",e)}}),x=async e=>{e.preventDefault(),(0,ts.PK)(A.wK.POPUP);let t=(0,ta.Q7)(c);if(t)return void m(t);if(!p.isPending){if((0,ta.Q2)(ti.IP,c)){(0,ta.Je)(ti.C4),p.mutate(c);return}if((0,ta.kS)(ti.C4)){(0,ta.nh)(ti.IP,c),r();return}p.mutate(c)}};return(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsx)(tu,{config:t}),(0,n.jsxs)("form",{onSubmit:x,className:"space-y-4",children:[(0,n.jsx)(i.pd,{label:"شماره موبایل",value:c,onChange:e=>{d(h(e.target.value)),u&&m("")},startIcon:(0,n.jsx)(tr.A,{className:"w-5 h-5 text-neutral-main"}),state:u||p.isError?"error":"default",helperText:u||(p.isError?"خطا در ارسال کد تایید. لطفاً دوباره تلاش کنید.":""),inputMode:"numeric"}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(i.$n,{type:"submit",variant:"primary",size:"md",className:"flex-[1.6]",disabled:p.isPending,"data-track":A.Dd.SIGNUP_ENTER_PHONE,"data-prop-position":A.wK.POPUP,children:p.isPending?"در حال ارسال...":"تایید"}),(0,n.jsx)(i.$n,{type:"button",variant:"ghost",size:"md",className:"flex-1",onClick:l,children:"انصراف"})]}),(0,n.jsx)(tm,{checked:o,onChange:s})]})]})}var tf=r(35690),tp=r(10892);function tx(e){let{phoneNumber:t,resendTimer:r}=e;return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)(i.o5,{variant:"h6",className:"font-bold text-primary-darkest",children:"کد تایید را وارد کن"}),(0,n.jsxs)(i.o5,{variant:"body-s-medium",className:"text-neutral-main",children:["کد تایید ۵ رقمی ارسال شده به شماره"," ",(0,n.jsx)("span",{className:"font-bold text-neutral-darker",dir:"ltr",children:t})," ","را وارد نمایید."]}),r>0&&(0,n.jsx)("div",{className:"flex items-center justify-center gap-2 py-2 px-4 bg-primary-lightest roun
1ded-lg",children:(0,n.jsxs)(i.o5,{variant:"body-s-medium",className:"text-primary-dark",children:[(e=>{let t=Math.floor(e/60),r="".concat(t.toString().padStart(2,"0"),":").concat((e%60).toString().padStart(2,"0"));return(0,tc.T)(r)})(r)," مانده تا دریافت مجدد کد تایید"]})})]})}function tg(e){let{onEditPhone:t,onSuccess:r}=e,l=(0,ta.xU)(ti.IP)||"",{otpValues:a,setOtpValues:i,resendTimer:s,verifyOtpMutation:o,resendOtpMutation:c,handleSubmit:d,handleResendOtp:u,isOtpComplete:m,hasError:h}=function(e){let{phoneNumber:t,onSuccess:r}=e;return(0,tf.Y)({phoneNumber:t,timestampKey:ti.C4,phoneNumberKey:ti.IP,gtmPosition:A.wK.POPUP,onSuccess:r,enableCallResend:!1,enableEditPhone:!1})}({phoneNumber:l,onSuccess:r});return(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsx)(tx,{phoneNumber:l,resendTimer:s}),(0,n.jsx)(tp.A,{otpValues:a,setOtpValues:i,onSubmit:d,hasError:h,isLoading:o.isPending,isOtpComplete:m,onEditPhone:t,onResendOtp:u,isResending:c.isPending,resendTimer:s})]})}function tb(){let{isPopupOpen:e,isScheduled:t,handleClose:r,handleDontShowAgain:s}=function(){let[e,t]=(0,a.useState)(!1),[r,n]=(0,a.useState)(!1),{isHomePage:i,isPdpPage:s,isPlpPage:c,pageUrl:d}=(0,l.I)(),{isAuthenticated:u,isInitialized:m}=(0,z.J)(),{userLocation:h,isUserLocationReady:f}=(0,o.k)(),p=(0,a.useRef)(null),x=(0,a.useRef)(!1),g=(0,a.useRef)(!1);return(0,a.useEffect)(()=>{if(x.current||!m||u||!f||(0,e3.YI)(h)||(x.current=!0,!e2||!i&&!s&&!c||!(()=>{if((()=>{try{let e=localStorage.getItem(e0.DONT_SHOW_AGAIN);return"true"===e}catch(e){return console.error("Error reading dont show again from localStorage:",e),!1}})())return!1;let e=(()=>{try{let e=localStorage.getItem(e0.CLOSED_AT);return e?Number(e):null}catch(e){return console.error("Error reading popup closed at from localStorage:",e),null}})();return!e||Date.now()-e>=e5.RE_SHOW_DELAY})()))return;let e=function(e,t){try{let r=localStorage.getItem(e);if(r&&t.includes(r))return r}catch(t){console.error("Error reading A/B test section from localStorage (".concat(e,"):"),t)}return null}(e0.SECTION,Object.values(e4));if(e!==e4.B1){let t;t=e=e4.B1,function(e,t){try{localStorage.setItem(e,t)}catch(t){return console.error("Error saving A/B test section to localStorage (".concat(e,"):"),t),!1}}(e0.SECTION,t)}if(e===e4.A){if(!g.current&&d){let e={event:A.Dd.DONT_SHOW_AB_TEST_LOGIN_POPUP,page_url:d};(0,e6.P)(e),e8(A.Dd.DONT_SHOW_AB_TEST_LOGIN_POPUP,{page_url:d}),g.current=!0}return}let r=(e=>{switch(e){case e4.B1:return e5.B1_DELAY;case e4.B2:return e5.B2_DELAY;default:return 0}})(e);return n(!0),p.current=setTimeout(()=>{t(!0)},r),function(){p.current&&clearTimeout(p.current)}},[m,u,i,s,c,f,h]),{isPopupOpen:e,isScheduled:r,handleClose:()=>{t(!1)},handleDontShowAgain:()=>{t(!1)}}}(),[c,d]=(0,a.useState)("phone"),[u,m]=(0,a.useState)(!1),h=(0,i.Iu)(),{pageUrl:f}=(0,l.I)(),p=(0,a.useRef)(!1),{config:x,isConfigFetched:g}=function(e){let{data:t,isFetched:r}=(0,_.I)({queryKey:["login-popup-config"],queryFn:e9,enabled:e,staleTime:3e5,retry:1});return(0,a.useEffect)(()=>{(null==t?void 0:t.imageUrl)&&(new window.Image().src=t.imageUrl)},[null==t?void 0:t.imageUrl]),{config:null!=t?t:null,isConfigFetched:r}}(t||e),b=e&&g&&(null==x?void 0:x.enabled)!==!1;(0,a.useEffect)(()=>{if(b&&(d("phone"),!p.current&&f)){let e={event:A.Dd.VIEW_AB_TEST_LOGIN_POPUP,page_url:f};(0,e6.P)(e),e8(A.Dd.VIEW_AB_TEST_LOGIN_POPUP,{page_url:f}),p.current=!0}},[b,f]);let v=()=>{u?((()=>{try{return localStorage.setItem(e0.DONT_SHOW_AGAIN,"true"),!0}catch(e){return console.error("Error setting dont show again in localStorage:",e),!1}})(),s()):u||(()=>{try{return localStorage.setItem(e0.CLOSED_AT,Date.now().toString()),!0}catch(e){return console.error("Error saving popup closed at to localStorage:",e),!1}})(),f&&((e,t)=>{let r={event:A.Dd.CLICK_AB_TEST_LOGIN_POPUP_CLOSE_BUTTON,page_url:e,dont_show_again:t};(0,e6.P)(r),e8(A.Dd.CLICK_AB_TEST_LOGIN_POPUP_CLOSE_BUTTON,{page_url:e,dont_show_again:t})})(f,u),d("phone"),m(!1),r()},y=()=>{d("otp")},j=()=>{d("phone")},w=()=>{v()},N=e=>{m(e)},k=()=>"phone"===c?(0,n.jsx)(th,{config:null!=x?x:null,onPhoneSubmit:y,onCancel:()=>v(),onDontShowAgainChange:N,dontShowAgain:u}):(0,n.jsx)(tg,{onEditPhone:j,onSuccess:w});return h?(0,n.jsx)(te.F,{isOpen:b,onClose:()=>v(),children:k()}):(0,n.jsx)(te.V,{isOpen:b,onClose:()=>v(),hasImage:!!(null==x?void 0:x.imageUrl),children:k()})}let tv={SHOWN_AT:"logged_in_popup_shown_at"};function ty(){var e,t,r,l;let{isAuthenticated:s,isInitialized:o}=(0,z.J)(),[c,d]=(0,a.useState)(!1),u=(0,i.Iu)(),{config:m,isConfigFetched:h}
1=function(e){let{data:t,isFetched:r}=(0,_.I)({queryKey:["logged-in-popup-config"],queryFn:e7,enabled:e,staleTime:3e5,retry:1});return(0,a.useEffect)(()=>{(null==t?void 0:t.imageUrl)&&(new window.Image().src=t.imageUrl)},[null==t?void 0:t.imageUrl]),{config:null!=t?t:null,isConfigFetched:r}}(!!(o&&s)),f=null!=(r=null==m||null==(e=m.imageUrl)?void 0:e.trim())?r:"",p=null!=(l=null==m||null==(t=m.link)?void 0:t.trim())?l:"",x=(null==m?void 0:m.enabled)!==!1;(0,a.useEffect)(()=>{if(!o||!s||!h||!x||!f)return;let e=localStorage.getItem(tv.SHOWN_AT);e&&Date.now()-parseInt(e,10)<432e5||d(!0)},[o,s,h,x,f]);let g=()=>{localStorage.setItem(tv.SHOWN_AT,Date.now().toString()),d(!1)},b=(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("button",{onClick:g,className:"absolute top-2 left-2 z-10 cursor-pointer rounded-full bg-white/90 p-1.5 shadow-sm hover:bg-neutral-lightest transition-colors","aria-label":"بستن",type:"button",children:(0,n.jsx)(q.A,{className:"".concat(u?"w-4 h-4":"w-5 h-5"," text-neutral-darker")})}),(0,n.jsx)(B.default,{href:p,target:"_blank",className:"block",onClick:g,"data-track":A.Dd.LOGGED_IN_POPUP_CLICK,children:(0,n.jsx)("div",{className:"relative aspect-[500/604] w-[min(84vw,500px,70vh)]",children:(0,n.jsx)(N.A,{src:f,alt:"popup",fill:!0,sizes:"500px",className:"cursor-pointer object-cover"})})})]});return(0,n.jsx)(i.lG,{isOpen:c,onClose:g,size:"xl",className:"logged-in-popup-dialog overflow-hidden [&>div]:!p-0",children:b})}var tj=r(5);let tw=["تهران","مشهد","اصفهان","کرج","شیراز","تبریز","اهواز","قم"];var tN=r(21873);let tk=e=>{let{popularCities:t,filteredCities:r,showPopular:l,onSelect:a}=e;return(0,n.jsxs)(n.Fragment,{children:[l&&(0,n.jsxs)("div",{className:"shrink-0 px-4 pb-3",children:[(0,n.jsx)("p",{className:"mb-2 text-xs font-medium text-neutral-main",children:"شهرهای پرطرفدار"}),(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:t.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>a(e),className:"rounded-full border border-neutral-light px-3 py-1.5 text-sm text-neutral-darker transition-colors hover:border-primary hover:bg-primary/5 hover:text-primary",children:e.name},"popular-".concat(e.id)))})]}),(0,n.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto border-t border-neutral-light px-2 py-2",children:0===r.length?(0,n.jsx)("p",{className:"py-10 text-center text-sm text-neutral-medium",children:"شهری با این نام پیدا نشد."}):(0,n.jsx)("ul",{className:"space-y-0.5",children:r.map(e=>(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",onClick:()=>a(e),className:"flex w-full items-center justify-between rounded-lg px-3 py-2.5 text-right transition-colors hover:bg-neutral-lightest",children:[(0,n.jsx)("span",{className:"text-sm text-neutral-darker",children:e.name}),(0,n.jsxs)("span",{className:"flex items-center gap-1 text-xs text-neutral-main",children:[(0,n.jsx)(tN.A,{size:12}),e.province.name]})]})},e.id))})})]})},tI=e=>{let{onCitySelected:t}=e,[r,l]=(0,a.useState)(""),{updateUserLocation:i}=(0,o.k)(),{data:s=[],isLoading:c,error:d,refetch:u,isFetching:m}=(0,_.I)({queryKey:["citiesWithProvinces"],queryFn:tj.TF,staleTime:6e5,gcTime:(0,P.W)(18e5)}),h=(0,a.useMemo)(()=>tw.map(e=>s.find(t=>t.name===e)).filter(e=>!!e),[s]),f=(0,a.useMemo)(()=>{let e=r.trim().toLowerCase();return e?s.filter(t=>t.name.toLowerCase().includes(e)||t.province.name.toLowerCase().includes(e)):s},[s,r]);if(c)return(0,n.jsx)("div",{className:"flex flex-1 items-center justify-center py-10",children:(0,n.jsx)("div",{className:"h-8 w-8 animate-spin rounded-full border-b-2 border-primary"})});if(d)return(0,n.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 px-6 py-10 text-center",children:[(0,n.jsx)("p",{className:"text-sm text-neutral-dark",children:"بارگذاری فهرست شهرها ناموفق بود."}),(0,n.jsx)("button",{type:"button",onClick:()=>u(),disabled:m,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-primary-dark disabled:opacity-60",children:m?"در حال تلاش…":"تلاش دوباره"})]});let p=!r.trim()&&h.length>0;return(0,n.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,n.jsxs)("div",{className:"relative shrink-0 px-4 pb-3",children:[(0,n.jsx)(W.A,{size:16,className:"absolute right-7 top-1/2 -translate-y-1/2 text-neutral-medium"}),(0,n.jsx)("input",{type:"text",placeholder:"جستجوی شهر یا استان…",value:r,onChange:e=>l(e.target.value),dir:"rtl",className:"w-full rounded-lg border border-neutral-light py-2.5 pr-10 pl-3 text-sm focus:border-transparent focus:outline-none focus:ring-2 focus:ring-primary"})]}),(0,n.jsx)(tk,{popularCities:h,filteredCities:f,showPopular:p,onSelect:e=>{i({province:e.province.name,city:e.name,cityId:e.id,provinceId:e.province.id}),null==t||t(e)}})]})},tC=()=>{let e=(0,i.Iu)(),{isAuthenticated:t,isInitialized:r}=(0,z.J)(),{userLocation:s,isUserLocationReady:c}=(0,o.k)(),{isLoginPage:d}=(0,l.I)(),u=r&&c&&!1===t&&!d&&(0,e3.YI)(s);return((0,a.useEffect)(()=>
1{if(!u)return;let e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[u]),u)?(0,ed.createPortal)((0,n.jsxs)("div",{className:"fixed inset-0 z-[1000] flex justify-center ".concat(e?"items-end":"items-center"),role:"dialog","aria-modal":"true","aria-labelledby":"city-gate-title",children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm","aria-hidden":"true"}),(0,n.jsxs)("div",{className:"relative flex flex-col overflow-hidden bg-white shadow-2xl ".concat(e?"absolute inset-x-0 bottom-0 h-[92vh] rounded-t-2xl":"h-[640px] max-h-[88vh] w-[460px] rounded-2xl"),children:[(0,n.jsxs)("div",{className:"shrink-0 px-5 pb-4 pt-6 text-center",children:[(0,n.jsx)("p",{id:"city-gate-title",className:"text-lg font-bold text-neutral-darker",children:"شهر خود را انتخاب کنید"}),(0,n.jsx)("p",{className:"mx-auto mt-1.5 max-w-[340px] text-sm leading-relaxed text-neutral-main",children:"برای نمایش قیمت، موجودی و زمان ارسال دقیق، لطفاً شهر خود را انتخاب کنید."})]}),(0,n.jsx)(tI,{})]})]}),document.body):null};function tS(e){let{children:t}=e,{isLoginPage:r,isLandingPage:s,isCheckoutPage:o,isServiceCheckoutPage:c,isPlpPage:d,isPdpPage:u,isProfilePage:m,isInvoicePage:h,isWheelPage:f,isPushEnrollPage:p}=(0,l.I)(),x=(0,i.Iu)(),g=(0,a.useMemo)(()=>!!s||!!o&&!!x||!!m&&!!x||!!r||!!d&&!!x||!!u&&!!x||!!c||!!f||!1,[s,o,x,r,u,d,m,c,f]),v=(0,a.useMemo)(()=>!!r||!!o||!!c||!!u||!x||!!s||!!f||!1,[r,o,c,u,x,s,f]),y=(0,a.useMemo)(()=>g&&v,[g,v]),j=(0,a.useMemo)(()=>r||o||c,[r,o,c]),N=(0,a.useMemo)(()=>s||o||f,[r,s,o,c,f]),k=(0,a.useMemo)(()=>!!o||!!r||!!s||!!m||!!f,[o,r,s,m,f]);return h||p?t:(0,n.jsxs)(n.Fragment,{children:[!k&&(0,n.jsx)(O,{isLCPImage:d||u&&!x}),!g&&(0,n.jsx)(ec,{}),t,!v&&(0,n.jsx)(ex,{}),!y&&(0,n.jsx)(eR,{}),!j&&(0,n.jsx)(eJ,{}),!v&&(0,n.jsx)("div",{className:"h-[70px] w-full"}),(0,n.jsx)(b,{}),(0,n.jsx)(w,{}),(0,n.jsx)(eX,{}),(0,n.jsx)(tb,{}),!N&&(0,n.jsx)(ty,{}),!f&&(0,n.jsx)(tC,{})]})}},10892:(e,t,r)=>{"use strict";r.d(t,{A:()=>m});var n=r(95155),l=r(26753),a=r(30784),i=r(21190),s=r(83047),o=r(72099),c=r(12115),d=r(86318);function u(e){let{otpValues:t,setOtpValues:r}=e,l=(0,c.useRef)([]),a=(0,d.A)();(0,c.useEffect)(()=>{l.current[0]&&l.current[0].focus()},[]);let i=e=>{e.preventDefault();let n=a(e.clipboardData.getData("text")).replace(/\D/g,"").slice(0,5);if(n.length>0){var i;let e=[...t];for(let t=0;t<n.length&&t<5;t++)e[t]=n[t];r(e);let a=Math.min(n.length,4);null==(i=l.current[a])||i.focus()}};return(0,n.jsx)("div",{className:"flex justify-center gap-3",dir:"ltr",children:t.map((e,s)=>(0,n.jsx)("input",{ref:e=>{l.current[s]=e},type:"text",inputMode:"numeric",pattern:"[0-9]*",maxLength:1,value:e,onChange:e=>((e,n)=>{let i=a(n).replace(/\D/g,"");if(!i){let n=[...t];n[e]="",r(n);return}let s=i.slice(-1),o=[...t];o[e]=s,r(o),s&&e<4&&setTimeout(()=>{var t;null==(t=l.current[e+1])||t.focus()},0)})(s,e.target.value),onKeyDown:e=>((e,n)=>{var a,i,s;if("Backspace"===n.key){if(t[e])return;let n=[...t];n[e-1]="",r(n),null==(a=l.current[e-1])||a.focus()}"ArrowLeft"===n.key&&e>0?null==(i=l.current[e-1])||i.focus():"ArrowRight"===n.key&&e<4&&(null==(s=l.current[e+1])||s.focus());let o=/^[۰-۹]$/.test(n.key),c=/^[٠-٩]$/.test(n.key),d=/^[0-9]$/.test(n.key);"Backspace"===n.key||"Delete"===n.key||"ArrowLeft"===n.key||"ArrowRight"===n.key||"Tab"===n.key||d||o||c||n.preventDefault()})(s,e),onPaste:i,autoComplete:"one-time-code",className:"w-12 h-12 text-center text-xl font-bold border-2 border-neutral-light rounded-lg focus:border-primary focus:outline-none transition-colors"},"otp-input-".concat(s)))})}function m(e){let{otpValues:t,setOtpValues:r,onSubmit:c,hasError:d,isLoading:m,isOtpComplete:h,onEditPhone:f,onResendOtp:p,isResending:x,resendTimer:g,disableSignupTracking:b=!1}=e;return(0,n.jsxs)("form",{onSubmit:c,className:"space-y-6",children:[(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(u,{otpValues:t,setOtpValues:r}),d&&(0,n.jsx)(a.o,{variant:"body-xs-medium",className:"text-error text-center",children:"کد تایید نادرست است. لطفاً دوباره تلاش کنید."})]}),(0,n.jsxs)("div",{className:"flex gap-4 justify-center items-center",children:[(0,n.jsxs)("button",{type:"button",onClick:f,className:"inline-flex items-center gap-1 text-primary hover:text-primary-dark transition-colors",children:[(0,n.jsx)(i.A,{className:"w-4 h-4"}),(0,n.jsx)(a.o,{variant:"body-s-medium",className:"font-medium",children:"ویرایش شماره"})]}),(0,n.jsx)("div",{role:"button",tabIndex:0,onKeyDown:e=>{b||"Enter"!==e.key&&" "!==e.key||(0,o.Do)(s.wK.POPUP)},onClick:()=>{b||(0,o.Do)(s.wK.POPUP)},children:(0,n.jsx)("button",{type:"button",onClick:p,disabled:!(0===g&&!x),"data-track":b?void 0:s.Dd.RETRY_OTP,"data-prop-position":b?void 0:s.wK.POPUP,className:"text-primary hover:text-primary-dark transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:(0,n.jsx)(a.o,{variant:"body-s-medium",className:"font-medium",children:x?"در حال ارسال...":"کد را دریافت نکردم ارسال مجدد"})})})]}),(0,n.jsx)("div",{className:"border-t border-dashed border-primary-light"}),(0,n.jsx)(l.Button,{variant:"primary",size:"lg",type:"submit",disabled:!h||m,className:"w-full",children:(0,n.jsx)(a.o,{variant:"body-m-medium",children:m?"در حال بررسی...":"ورود"})})]})}},13673:()=>{},19540:(e,t,r)=>{"use strict";r.d(t,{T:()=>n});let n=e=>{let t=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"];return e.toString().replace(/\d/g,e=>t[parseInt(e,10)])}},19542:(e,t,r)=>{"use strict";r.d(t,{Je:()=>i,Q2:()=>m,Q7:()=>l,ee:()=>c,jc:()=>u,kS:()=>d,mE:()=>a,nh:()=>o,xU:()=>s});var n=r(59853);let l=e=>e.trim()?11!==e.length?"شماره موبایل باید ۱۱ رقم باشد.":e.startsWith("09")?/^\d+$/.test(e)?"":"شماره موبایل فقط باید شامل عدد باشد.":"شماره موبایل باید با ۰۹ شروع شود."
1:"شماره موبایل الزامی است.",a=e=>{sessionStorage.setItem(e,Date.now().toString())},i=e=>{sessionStorage.removeItem(e)},s=e=>sessionStorage.getItem(e),o=(e,t)=>{sessionStorage.setItem(e,t)},c=e=>{sessionStorage.removeItem(e)},d=e=>{let t=sessionStorage.getItem(e);return!!t&&Math.floor((Date.now()-Number(t))/1e3)<n.EQ},u=e=>{let t=sessionStorage.getItem(e);if(!t)return n.EQ;let r=Math.floor((Date.now()-Number(t))/1e3),l=n.EQ-r;return l>0?l:0},m=(e,t)=>{let r=s(e);return null!==r&&r!==t}},21522:(e,t,r)=>{"use strict";r.d(t,{O2:()=>a,kz:()=>l});var n=r(945);let l=()=>{try{let e=localStorage.getItem(n.R);return e?JSON.parse(e):null}catch(e){return console.error("Failed to get checkout storage:",e),null}},a=()=>{let e=l();return null!==e&&(null!==e.selectedAddress||null!==e.selectedGateway||null!==e.parcelsData)}},24142:(e,t,r)=>{"use strict";r.d(t,{l:()=>n});var n=function(e){return e.CIRCULAR="CIRCULAR",e.ACCORDION="ACCORDION",e}({})},27928:(e,t,r)=>{"use strict";r.d(t,{default:()=>tu});var n=r(95155),l=r(12115),a=r(36591),i=r(14763),s=r(70228),o=r(99776),c=r(22454);let d="automoby.chatbot.guest",u=[1e3,2e3,5e3,1e4],m=new Set(["image/jpeg","image/png","image/webp","image/heic","image/heif"]),h={launcherAriaLabel:"پشتیبانی",panelTitle:"پشتیبانی اتوموبی",inputPlaceholder:"پیامت رو بنویس…",send:"ارسال",restart:"شروع گفتگوی جدید",connectionLost:"اتصال قطع شد، دوباره تلاش می‌کنیم…",handoffRequested:"در حال وصل شدن به کارشناس…",handoffOpen:"به کارشناس پشتیبانی وصل شدی",headerStatus:"پاسخ‌گویی فوری",close:"بستن",loginLink:"ورود به حساب کاربری",groupMyOrder:"سفارش من",groupShopping:"خرید",groupServices:"خدمات",attachImage:"ارسال عکس",imageUploading:"در حال ارسال عکس…",imageSent:"عکس",imageFailed:"عکس ارسال نشد، دوباره امتحان کن",imageMaybeSent:"ممکنه عکس رسیده باشه؛ قبل از ارسال دوباره از اپراتور بپرس",imageTooLarge:"حجم عکس باید کمتر از ۱۰ مگابایت باشه",imageBadType:"فقط عکس با فرمت jpg، png، webp یا heic",imageNotNow:"الان نمی‌شه عکس فرستاد",imageRateLimited:"چند لحظه صبر کن و دوباره بفرست"},f=[{title:h.groupMyOrder,labels:["پیگیری وضعیت سفارش","ویرایش سفارش","لغو سفارش","نداشتن بارنامه","مرجوعی","پیگیری عودت وجه بعد از لغو"]},{title:h.groupShopping,labels:["راهنمای خرید","خرید اقساطی (اسنپ‌پی)"]},{title:h.groupServices,labels:["اتو سرویس"]}];var p=r(1304);let x=()=>{try{return localStorage.getItem(p.V)}catch(e){return null}};async function g(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x(),t=await fetch("/api/chatbot/session/",{method:"GET",cache:"no-store",headers:e?{Authorization:"Bearer ".concat(e)}:void 0});if(!t.ok)throw Error("Chatbot session request failed (".concat(t.status,")"));return await t.json()}var b=r(75063);let v=["chatbot","session"],y=e=>[...v,e];class j extends Error{constructor(e,t={}){let r=[t.status,t.code].filter(Boolean).join(" ");super("chatbot-service request failed: ".concat(e).concat(r&&" (".concat(r,")"))),this.name="ChatbotApiError",this.kind=e,this.status=t.status,this.code=t.code,this.retryAfterSeconds=t.retryAfterSeconds}}let w=e=>!!(null==e?void 0:e.aborted),N=(e,t)=>401===e?"unauthorized":404===e?"not_found":409===e&&"handoff_not_active"===t?"bad_request":409===e?"ended":429===e?"rate_limited":503===e&&"session_busy"===t?"busy":e>=400&&e<500?"bad_request":"server",k=e=>{if(!e||"object"!=typeof e)return{};let{code:t,retryAfterSeconds:r}=e;return{code:"string"==typeof t?t:void 0,retryAfterSeconds:"number"==typeof r?r:void 0}},I=async e=>{try{return k(await e.json())}catch(e){return{}}},C=(e,t,r)=>{let n={};r&&(n["X-Chatbot-Token"]=r);let l=t?e.getGuest():null;return l&&l.sessionId===t&&(n["X-Chat-Session-Secret"]=l.guestSecret),n},S=(e,t)=>{let r;if(r=e.apiUrl,!/^https?:\/\/[^/]/i.test(r))throw new j("network");return"".concat(e.apiUrl.replace(/\/+$/,"")).concat(t)},A=async(e,t)=>{let r;try{r=await e.refreshToken()}catch(e){r=void 0}if(!r)throw new j("unauthorized",{status:t});return r},_=async(e,t,r)=>{let n=S(e,t.path);try{return await fetch(n,{method:t.method,headers:((e,t,r)=>({...t.headers,...void 0===t.body?{}:{"Content-Type":"application/json"},...C(e,t.sessionId,r)}))(e,t,r),body:void 0===t.body?void 0:JSON.stringify(t.body),credentials:"omit",cache:"no-store",signal:t.signal})}catch(e){if(w(t.signal))throw e;throw new j("network")}},E=async(e,t,r)=>{let n=await _(e,t,r.token);if(n.ok)return n;let{code:l,retryAfterSeconds:a}=await I(n),i=N(n.status,l);if("unauthorized"===i&&!r.refreshed){let l=await A(e,n.status);return E(e,t,{...r,token:l,refreshed:!0})}if("busy"===i&&r.busy<3)return await ((e,t)=>new Promise((r,n)=>{let l;if(null==t?void 0:t.aborted)return void n(t.reason);let a=()=>{clearTimeout(l),n(null==t?void 0:t.reason)};l=setTimeout(()=>{null==t||t.removeEventListener("abort",a),r()},e),null==t||t.addEventListener("abort",a,{once:!0})}))(1e3,t.signal),E(e,t,{...r,busy:r.busy+1});throw new j(i,{status:n.status,code:l,retryAfterSeconds:"rate_limited"===i?a:void 0})};function T(e,t){return E(e,t,{token:e.getToken(),refreshed:!1,busy:0})}async function P(e,t){let r=await T(e,t);try{return await r.json()}catch(e){if(w(t.signal))throw e;throw new j("server",{status:r.status})}}let O=new Set(["none","requested","open","closed","failed"]),D=new Set(["active","handoff","ended"]),R=new Set(["choices","handoff","text","ended"]),L=new Set(["reply","link"]),U=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),M=e=>O.has(e),B=e=>{if(!U(e))return null;let{key:t,label:r,kind:n,href:l}=e;return"string"==typeof t&&"string"==typeof r&&L.has(n)&&(void 0===l||"string"==typeof l)?{key:t,label:r,kind:n,...void 0===l?{}:{href:l}}:null};function z(e){if(!U(e.input))return e;let{variant:t,...r}=e.input;return void 0===t||"rating"===t?e:{...e,input:r}}function G(e,t,r){if(!M(e)||!D.has(t))return;let n=(e=>{let t;if(!U(e))return null;let{mode:r,choices:n,allowText:l,variant:a}=e;if(!R.has(r)||"boolean"!=typeof l||!Array.isArray(n))return null;let i=n.map(B);return i.some(e=>null===e)?null:{mode:r,choices:i,allowText:l,..."rating"===(t=a)?{variant:t}:{}}})(r);if(n)return{status:t,handoff:e,input:n}}let H=e=>!e.pending;function Y(e,t){if(0===t.length)return e;let r=new Map;
1return e.filter(H).forEach(e=>{r.set(e.seq,e)}),t.forEach(e=>{r.set(e.seq,e)}),[...r.values()].sort((e,t)=>e.seq-t.seq).concat(e.filter(e=>e.pending))}function F(e,t){return e.filter(e=>!(e.pending&&e.localId===t))}let W=e=>{var t;return(e.pending?!0===e.image:(null==(t=e.attachment)?void 0:t.kind)==="image")?"image":"text:".concat(e.text)};function q(e,t){if(!e.some(e=>e.pending))return e;let r=new Set(e.filter(H).map(e=>e.seq)),n=t.filter(e=>"user"===e.role&&!r.has(e.seq)).map(W);return 0===n.length?e:e.filter(e=>{if(!e.pending)return!0;let t=n.indexOf(W(e));return -1===t||(n.splice(t,1),!1)})}let K=new Set(["closed","failed"]),Q=e=>K.has(e),Z=e=>"handoff"===e.status&&Q(e.handoff),V=(e,t)=>"ended"===e.status||Q(e.handoff)&&!Q(t.handoff),J=(e,t)=>e.status===t.status&&e.handoff===t.handoff&&((e,t)=>!!e&&e.mode===t.mode&&e.allowText===t.allowText&&e.variant===t.variant&&e.choices.length===t.choices.length&&e.choices.every((e,r)=>((e,t)=>e.key===t.key&&e.label===t.label&&e.kind===t.kind&&e.href===t.href)(e,t.choices[r])))(e.input,t.input),$={sessionId:null,messages:[],input:null,status:null,handoff:null,connectionLost:!1,error:null},X={mode:"ended",choices:[],allowText:!1},ee=new Set(["network","server","busy"]),et=new Set(["handoff","text"]),er=e=>!!e.input&&et.has(e.input.mode)&&!0===e.input.allowText,en=e=>(null==e?void 0:e.enabled)&&e.signedIn?e.token:void 0;function el(){try{let e=window.sessionStorage.getItem(d);if(!e)return null;let t=JSON.parse(e);if(!(e=>{if(!e||"object"!=typeof e)return!1;let{sessionId:t,guestSecret:r}=e;return"string"==typeof t&&t.length>0&&"string"==typeof r&&r.length>0})(t))return null;return{sessionId:t.sessionId,guestSecret:t.guestSecret}}catch(e){return null}}function ea(){try{window.sessionStorage.removeItem(d)}catch(e){}}let ei=(e,t)=>((e,t,r)=>({withToken:!!e,secretFor:t&&r&&t.sessionId===r?t.sessionId:null}))(e,el(),t);function es(e,t,r){var n;let l=(n=el(),t.guestSecret?{type:"write",credentials:{sessionId:t.sessionId,guestSecret:t.guestSecret}}:n&&(e.withToken&&e.secretFor===n.sessionId||r&&n.sessionId!==t.sessionId)?{type:"clear"}:{type:"keep"});"write"===l.type&&function(e){try{window.sessionStorage.setItem(d,JSON.stringify({sessionId:e.sessionId,guestSecret:e.guestSecret}))}catch(e){}}(l.credentials),"clear"===l.type&&ea()}let eo=new Set(["bot","user","agent","system"]);function ec(e){if(!e||"object"!=typeof e)return null;let{seq:t,role:r,text:n,createdAt:l,attachment:a}=e;return Number.isInteger(t)&&"string"==typeof n&&eo.has(r)?{seq:t,role:r,text:n,createdAt:"string"==typeof l?l:"",..."object"==typeof a&&null!==a&&"image"===a.kind?{attachment:{kind:"image"}}:{}}:null}let ed=e=>{try{return JSON.parse(e)}catch(e){return null}},eu=async(e,t,r,n)=>{let{status:l,text:a}=await ((e,t,r)=>new Promise((n,l)=>{let{sessionId:a,file:i,onProgress:s,signal:o}=t;if(o.aborted)return void l(o.reason);let c=S(e,"/v1/sessions/".concat(encodeURIComponent(a),"/attachments")),d=new XMLHttpRequest,u=()=>d.abort(),m=()=>o.removeEventListener("abort",u);d.open("POST",c),d.timeout=18e4,Object.entries({...C(e,a,r),"Content-Type":i.type||"application/octet-stream"}).forEach(e=>{let[t,r]=e;return d.setRequestHeader(t,r)}),d.upload.onprogress=e=>{e.lengthComputable&&!(e.total<=0)&&s(Math.min(100,Math.round(e.loaded/e.total*100)))},d.onload=()=>{m(),n({status:d.status,text:d.responseText})},d.onerror=()=>{m(),l(new j("network"))},d.ontimeout=()=>{m(),l(new j("network"))},d.onabort=()=>{m(),l(o.reason)},o.addEventListener("abort",u,{once:!0}),d.send(i)}))(e,t,r);if(l>=200&&l<300){let e=ed(a);return e&&"object"==typeof e?ec(e.message):null}let{code:i,retryAfterSeconds:s}=k(ed(a)),o=N(l,i);if("unauthorized"===o&&!n){let r=await A(e,l);return eu(e,t,r,!0)}throw new j(o,{status:l,code:i,retryAfterSeconds:"rate_limited"===o?s:void 0})},em=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(e instanceof j))return t?"imageMaybeSent":"imageFailed";let{status:r,code:n,kind:l}=e;return 413===r||"file_too_large"===n?"imageTooLarge":415===r||"unsupported_type"===n?"imageBadType":"handoff_not_active"===n?"imageNotNow":"rate_limited"===l||"uploads_busy"===n?"imageRateLimited":"image_not_recorded"===n||t&&("network"===l||void 0!==r&&r>=500)?"imageMaybeSent":"imageFailed"},eh=async(e,t,r)=>{let n=new TextDecoder;for(;;){let{done:l,value:a}=await e.read();if(l)return;r(),t(n.decode(a,{stream:!0}))}};async function ef(e,t,r,n,l){var a,i;let s=await T(e,{method:"GET",path:"/v1/sessions/".concat(encodeURIComponent(t),"/stream"),headers:{"Last-Event-ID":String(r)},sessionId:t,signal:l}),o=null!=(a=s.headers.get("content-type"))?a:"";if(!s.body||!/^text\/event-stream/i.test(o))throw null==(i=s.body)||i.cancel().catch(()=>void 0),new j("server",{status:s.status});n.onOpen();let c=function(e){let t,r="",n=[],l="",a=r=>{if(""===r){n.length>0&&e({event:l||"message",data:n.join("\n"),id:t}),n=[],l="";return}if(r.startsWith(":"))return;let a=r.indexOf(":"),i=-1===a?r:r.slice(0,a),s=-1===a?"":r.slice(a+1),o=s.startsWith(" ")?s.slice(1):s;"data"===i?n.push(o):"event"===i?l=o:"id"!==i||o.includes("\0")||(t=o)};return e=>{r+=e;let t=0;for(let e=0;e<r.length;e++){let n=r[e];if("\n"===n||"\r"===n){if("\r"===n&&e===r.length-1)break;a(r.slice(t,e)),"\r"===n&&"\n"===r[e+1]&&(e+=1),t=e+1}}r=r.slice(t)}}(e=>((e,t)=>
1{if("ping"===e.event)return void t.onPing();let r=(e=>{try{let t=JSON.parse(e);return t&&"object"==typeof t?t:null}catch(e){return null}})(e.data);if(r){if("message"===e.event){let e=ec(r);e&&t.onMessage(e)}else if("handoff"===e.event){let{state:e}=r;if(!M(e))return;t.onHandoff(e,G(e,r.status,r.input))}}})(e,n));try{await eh(s.body.getReader(),c,n.onActivity)}catch(e){if(l.aborted)throw e;throw new j("network")}n.onEnd()}let ep=e=>e instanceof j?e:new j("network"),ex=(e,t)=>new Promise(r=>{let n,l=()=>{clearTimeout(n),t.removeEventListener("abort",l),r()};if(t.aborted)return void r();n=setTimeout(l,e),t.addEventListener("abort",l,{once:!0})}),eg=async(e,t,r)=>{let n,l=new AbortController,a=()=>l.abort();r.addEventListener("abort",a,{once:!0});let i=!1,s=!1,o=!1,c=!1,d=!1,u=e=>{clearTimeout(n),n=setTimeout(()=>{i=!0,l.abort()},e)},m=()=>c?"data":o?"connected":"failed";u(1e4);try{let{getAuth:r,getAfterSeq:n}=t();await ef(r(),e,n(),{onOpen:()=>void 0,onActivity:()=>{s=!0,u(4e4)},onPing:()=>{c=!0},onMessage:r=>{c=!0,t().onMessages(e,[r])},onHandoff:(r,n)=>{o=!0,d=Q(r)||!!n&&"handoff"!==n.status,t().onHandoff(e,r,n)},onEnd:()=>void 0},l.signal)}catch(l){if(r.aborted||d)return"stop";if(i)return s?m():"silent";let n=ep(l);if(c||o||t().onError(e,n),"not_found"===n.kind)return"stop";if(503===n.status)return"busy";return m()}finally{clearTimeout(n),r.removeEventListener("abort",a)}return d?"stop":m()},eb=async(e,t,r)=>{let n=0,l=0,a=!1;for(;;){let i=await eg(e,t,r);if("stop"===i)return"stop";if("silent"===i&&!a)return"fallback";if("data"===i||"connected"===i)a=!0,n=0,"data"===i&&(l=0);else if("busy"!==i&&(n+=1)>=3)return"fallback";if(await ex(u[l],r),r.aborted)return"stop";l=Math.min(l+1,u.length-1)}},ev=async(e,t,r)=>{let n=3e3;for(;;){let l=null;if(!t().isPaused())try{let{getAuth:n,getAfterSeq:a}=t(),i=await function(e,t,r,n){return P(e,{method:"GET",path:"/v1/sessions/".concat(encodeURIComponent(t),"/messages?afterSeq=").concat(r),sessionId:t,signal:n})}(n(),e,a(),r);if(r.aborted)return;l="ok",t().onMessages(e,i.messages,G(i.handoff,i.status,i.input))}catch(a){if(r.aborted)return;let n=ep(a);l=n.kind,t().onError(e,n)}if(n=function(e,t){return null===t?e:"unauthorized"!==t?3e3:Math.min(2*e,6e4)}(n,l),await ex(n,r),r.aborted)return}};async function ey(e,t,r){"fallback"===await eb(e,t,r)&&await ev(e,t,r)}var ej=r(78934),ew=r(83047),eN=r(77979);let ek=(0,l.createContext)(null),eI=ek.Provider;function eC(){var e;return null!=(e=(0,l.useContext)(ek))?e:void 0}function eS(e){let{onOpen:t,aboveBottomBar:r=!1,signedIn:l}=e,a=eC();return(0,n.jsx)("button",{type:"button",onClick:t,"data-track":ew.Dd.CHATBOT_OPEN,"data-prop-signed_in":String(l),"data-prop-chatbot_session_id":a,"aria-label":h.launcherAriaLabel,className:(0,eN.A)("fixed end-4 z-40 size-14 rounded-full","outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 motion-safe:transition-transform motion-safe:hover:scale-105 lg:bottom-6",r?"bottom-[118px]":"bottom-[76px]"),children:(0,n.jsxs)("picture",{className:"block size-full",children:[(0,n.jsx)("source",{media:"(prefers-reduced-motion: reduce)",srcSet:"https://static.automoby.ir/automoby-banners/chatbot/launcher-v6-static-112.webp"}),(0,n.jsx)(ej.A,{src:"chatbot/gif-launcher-v6-112.webp",baseBannerCDN:!0,alt:"",width:56,height:56,className:"size-full object-contain"})]})})}var eA=r(84926),e_=r(26753),eE=r(30784);function eT(e){let{handoff:t,connectionLost:r,exitChoice:l,isBusy:i,onExit:s}=e,o=(0,a.Iu)(),c=eC(),d="requested"===t,u=d?h.handoffRequested:h.handoffOpen;return(0,n.jsxs)("div",{className:(0,eN.A)("flex items-center gap-2 border-b px-3",l?"py-1":"py-1.5",r?"border-warning bg-warning-light":"border-neutral-light bg-neutral-lighter"),children:[(0,n.jsx)("div",{role:"status",className:(0,eN.A)("flex min-w-0 flex-1 items-center gap-2",!l&&"justify-center"),children:r?(0,n.jsx)(eE.o,{variant:"body-xs-medium",className:(0,eN.A)("min-w-0 text-warning-dark",l?"truncate":"text-center"),children:h.connectionLost}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:(0,eN.A)("size-2 shrink-0 rounded-full motion-safe:animate-pulse",d?"bg-warning":"bg-success"),"aria-hidden":"true"}),u&&(0,n.jsx)(eE.o,{variant:"body-xs-medium",color:"neutral-main",className:"min-w-0 truncate",children:u})]})}),l&&(0,n.jsxs)(e_.Button,{variant:"tertiary",size:"sm",textVariant:"body-xs-bold",disabled:i,onClick:()=>s(l),"data-track":ew.Dd.CHATBOT_CHOICE_CLICK,"data-prop-chatbot_session_id":c,"data-prop-choice_key":l.key,"data-prop-choice_kind":l.kind,className:(0,eN.A)("max-w-[60%] shrink-0 gap-1.5 whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",o?"min-h-11":"min-h-9"),children:[(0,n.jsx)(eA.A,{className:"size-4 shrink-0 -scale-x-100","aria-hidden":"true"}),(0,n.jsx)("span",{className:"min-w-0 truncate",children:l.label})]})]})}let eP="https://chatbot-internal.invalid";function eO(e){try{let t=new URL(e);if("https:"!==t.protocol||t.username||t.password)return null;return t.href}catch(e){return null}}function eD(e){if(!e)return null;if(e.startsWith("/"))try{let t=new URL(e,eP);if(t.origin!==eP)return null;let r=t.pathname+t.search+t.hash;if(r.startsWith("//")||r.startsWith("/\\")||new URL(r,eP).origin!==eP)return null;return{kind:"internal",href:r}}catch(e){return null}let t=eO(e);return t?{kind:"external",href:t}:null}let eR=new Set(["automoby.ir","www.automoby.ir"]);var eL=r(52619),eU=r.n(eL);let eM={primary:"bg-primary text-white hover:bg-primary-dark",highlight:"border border-primary-light bg-primary-lightest text-primary-dark hover:bg-primary-lighter",plain:"border border-primary-light bg-white text-primary hover:bg-neutral-lighter"};function eB(e){let{choice:t,target:r,tone:l,className:a,onChoice:i}=e,s=eC(),o={className:(0,eN.A)("inline-flex items-center justify-center rounded-lg px-4 py-2 transition-colors duration-200",eM[l],(0,eE.O)("body-s-bold"),a),onClick:()=>i(t),"data-track":ew.Dd.CHATBOT_CHOICE_CLICK,"data-prop-chatbot_session_id":s,"data-prop-choice_key":t.key,"data-prop-choice_kind":t.kind};return"internal"===r.kind?(0,n.jsx)(eU(),{href:r.href,...o,children:t.label}):(0,n.jsx)("a",{href:r.href,target:"_blank",rel:"noopener noreferrer",...o,children:t.label})}let ez={primary:"primary",highlight:"secondary",plain:"tertiary"};function eG(e){let{choice:t,tone:r,isWide:l,isCompact:i=!1,onChoice:s}=e,o=(0,a.Iu)(),c=eC(),d=(0,eN.A)("outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",o?"min-h-11":"min-h-10",l&&"col-span-2",i&&"min-w-0 !px-1"),u="link"===t.kind?eD(t.href):null;return u?(0,n.jsx)(eB,{choice:t,target:u,tone:r,className:d,onChoice:s}):(0,n.jsx)(e_.Button,{variant:ez[r],size:"sm",className:(0,eN.A)(d,"highlight"===r&&"border border-primary-light"),onClick:()=>s(t),"data-track":ew.Dd.CHATBOT_CHOICE_CLICK,"data-prop-chatbot_session_id":c,"data-prop-choice_key":t.key,"data-prop-choice_kind":t.kind,children:t.label})}function eH(e){var t;let r,{title:a,choices:i,emphasiseFirst:s,onChoice:o}=e,c=(0,l.useId)(),d=(t=i.map((e,t)=>s&&0===t||e.label.length>22),r=0,t.map((e,n)=>{var l;let a=0===r&&(null==(l=t[n+1])||l),i=e||a;return r=i?0:1-r,i}));return(0,n.jsxs)("div",{role:"group","aria-labelledby":c,children:[(0,n.jsx)(eE.o,{as:"h3",id:c,variant:"body-xs-medium",color:"neutral-main",className:"mb-1.5",children:a}),(0,n.jsx)("div",{className:"grid grid-cols-2 gap-2",children:i.map((e,t)=>(0,n.jsx)(eG,{choice:e,tone:s&&0===t?"highlight":"plain",isWide:d[t],onChoice:o},e.key))})]})}function eY(e){let{choices:t,onChoice:r}=e,l=t.slice(0,-1),a=t[t.length-1];return(0,n.jsxs)("div",{role:"group",className:"mt-3 flex flex-col gap-2",children:[(0,n.jsx)("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(".concat(l.length,", minmax(0, 1fr))")},children:l.map(e=>(0,n.jsx)(eG,{choice:e,tone:"plain",isWide:!1,isCompact:!0,onChoice:r},e.key))}),(0,n.jsx)(eG,{choice:a,tone:"plain",isWide:!1,onChoice:r})]})}function eF(e){let{choices:t,variant:r,onChoice:l}=e;if(0===t.length)return null;if("rating"===r&&t.length>=2)return(0,n.jsx)(eY,{choices:t,onChoice:l});let a=function(e){let t=new Map(f.flatMap(e=>e.labels.map(t=>[t,e.title])));return e.every(e=>t.has(e.label))?f.map(r=>({title:r.title,choices:e.filter(e=>t.get(e.label)===r.title)})).filter(e=>e.choices.length>0):null}(t);if(a)return(0,n.jsx)("div",{className:"mt-3 flex flex-col gap-2.5",children:a.map((e,t)=>(0,n.jsx)(eH,{title:e.title,choices:e.choices,emphasiseFirst:0===t,onChoice:l},e.title))});let i=t.length>3;return(0,n.jsx)("div",{role:"group",className:(0,eN.A)("mt-3",i?"grid grid-cols-2 gap-2":"flex flex-wrap gap-2"),children:t.map((e,t)=>(0,n.jsx)(eG,{choice:e,tone:t>0?"plain":i?"highlight":"primary",isWide:i&&(0===t||e.label.length>22),onChoice:l},e.key))})}var eW=r(79051);let eq=new Intl.DateTimeFormat("fa-IR",{hour:"2-digit",minute:"2-digit"});function eK(e){let{message:t}
1=e,r=t.pending?null:function(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:eq.format(t)}(t.createdAt);return t.pending||r?(0,n.jsx)(eE.o,{as:"span",variant:"body-xs-medium",className:"float-left mt-1.5 mr-2.5 inline-flex items-center opacity-70",children:t.pending?(0,n.jsx)(eW.A,{className:"size-3","aria-hidden":"true"}):r}):null}var eQ=r(42196);function eZ(e){let{value:t}=e;return(0,n.jsxs)("div",{className:"px-2 pt-1.5",children:[(0,n.jsx)(eE.o,{as:"div",variant:"body-xs-medium","aria-hidden":"true",children:h.imageUploading}),(0,n.jsx)("div",{role:"progressbar","aria-label":h.imageUploading,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t,className:"mt-1 h-1 overflow-hidden rounded-full bg-white/30",children:(0,n.jsx)("div",{className:"h-full rounded-full bg-white transition-[width] duration-200",style:{width:"".concat(t,"%")}})})]})}function eV(e){let{message:t,previewUrl:r,progress:a,isGroupEnd:i,onImageLoad:s}=e,[o,c]=(0,l.useState)(null),d=r&&r!==o?r:null;return(0,n.jsxs)(eE.o,{as:"div",variant:"body-s-medium",className:(0,eN.A)("flow-root max-w-[85%] rounded-xl bg-primary text-white",d?"p-1 pb-1.5":"px-3 pt-2 pb-1.5",i&&"rounded-es-sm"),children:[d?(0,n.jsx)("img",{src:d,alt:h.imageSent,onLoad:s,onError:()=>c(d),className:(0,eN.A)("block max-h-[240px] max-w-[200px] rounded-lg object-cover",t.pending&&"opacity-70")}):(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,n.jsx)(eQ.A,{className:"size-4","aria-hidden":"true"}),h.imageSent]}),t.pending&&(0,n.jsx)(eZ,{value:null!=a?a:0}),(i||t.pending)&&(0,n.jsx)(eK,{message:t})]})}var eJ=r(59865),e$=r(93499);let eX=/\[([^\]\n]{1,300})\]\(([^)\s]{1,2048})\)|https:\/\/\S+/g,e0=/[.,;:!?'")\]}\u00AB\u00BB\u060C\u061B\u061F\u06D4\u2026]/,e1=(0,eN.A)("mt-2 flex w-full items-center gap-2 rounded-lg border border-primary-light bg-primary-lightest px-3 py-2 text-primary outline-none transition-colors hover:bg-primary-lighter focus-visible:ring-2 focus-visible:ring-primary",(0,eE.O)("body-s-bold"));function e2(e){let{text:t,linkVariant:r="inline",linkClassName:l}=e;return(0,n.jsx)(n.Fragment,{children:t.split("\n").flatMap((e,t)=>{let r=function(e,t){let r=[],n="",l=0,a=0,i=()=>{n&&r.push({type:"text",key:"".concat(t,":").concat(l),text:n}),n=""},s=(e,t)=>{n||(l=t),n+=e};return Array.from(e.matchAll(eX)).forEach(n=>{var l;let o=null!=(l=n.index)?l:0,[c,d,u]=n;if(s(e.slice(a,o),a),a=o+c.length,void 0!==d){let e=eO(u);e?(i(),r.push({type:"link",key:"".concat(t,":").concat(o),text:d,href:e})):s(c,o);return}let m=function(e){let t=e.length;for(;t>0&&e0.test(e[t-1]);)t-=1;return e.slice(0,t)}(c),h=c.slice(m.length),f=eO(m);f?(i(),r.push({type:"link",key:"".concat(t,":").concat(o),text:m,href:f}),s(h,o+m.length)):s(c,o)}),s(e.slice(a),a),i(),r}(e.replace(/[ \t\r]+$/,""),t);return 0===t?r:[{type:"break",key:"".concat(t,":br")},...r]}).map(e=>{if("break"===e.type)return(0,n.jsx)("br",{},e.key);if("text"===e.type)return(0,n.jsx)("span",{children:e.text},e.key);if("button"===r){let t=function(e){let t=eD(e);if(!t)return!1;let r=new URL(t.href,eP);return("internal"===t.kind||eR.has(r.host))&&/^\/login\/?$/.test(r.pathname)}(e.href),r=!t&&e.text.startsWith("https://"),l=t?eJ.A:e$.A;return(0,n.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:e1,children:[(0,n.jsx)(l,{className:(0,eN.A)("size-4 shrink-0",t&&"-scale-x-100"),"aria-hidden":"true"}),t?(0,n.jsx)("span",{children:h.loginLink}):(0,n.jsx)("span",{dir:r?"ltr":"auto",className:"min-w-0 break-all",children:r?e.text.replace(/^https:\/\//,"").replace(/\/$/,""):e.text})]},e.key)}return(0,n.jsx)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:(0,eN.A)("underline break-all",l),children:e.text},e.key)})})}function e5(e){var t;let{message:r,isGroupStart:l,isGroupEnd:a,previewUrl:i,uploadProgress:s,onImageLoad:o}=e,{role:c,text:d}=r,u=l?"mt-3 first:mt-0":"mt-1";if(r.pending?!0===r.image:"user"===r.role&&(null==(t=r.attachment)?void 0:t.kind)==="image")return(0,n.jsx)("div",{className:(0,eN.A)("flex justify-start",u),children:(0,n.jsx)(eV,{message:r,previewUrl:i,progress:r.pending?s:null,isGroupEnd:a,onImageLoad:o})});if("system"===c)return(0,n.jsx)("div",{className:(0,eN.A)("flex justify-center px-6",u),children:(0,n.jsx)(eE.o,{as:"div",dir:"auto",variant:"body-xs-medium",color:"neutral-main",className:"text-center break-words",children:(0,n.jsx)(e2,{text:d,linkClassName:"text-primary"})})});let m="user"===c;return(0,n.jsx)("div",{className:(0,eN.A)("flex",m?"justify-start":"justify-end",u),children:(0,n.jsx)(eE.o,{as:"div",variant:"body-s-medium",className:(0,eN.A)("flow-root max-w-[85%] rounded-xl px-3 pt-2 pb-1.5 break-words",m&&"bg-primary text-white",m&&a&&"rounded-es-sm",!m&&a&&"rounded-ee-sm","bot"===c&&"border border-neutral-light bg-neutral-lighter text-neutral-darker","agent"===c&&"border border-primary-light bg-primary-lightest text-neutral-darker"),children:(0,n.jsxs)("div",{dir:"auto",className:"text-pretty",children:[(0,n.jsx)(e2,{text:d,linkVariant:m?"inline":"button",linkClassName:"text-white"}),(a||r.pending)&&(0,n.jsx)(eK,{message:r})]})})})}let e4=e=>e.pending?"local-".concat(e.localId):"seq-".concat(e.seq);function e3(){return(0,n.jsx)("div",{className:"mt-3 flex justify-end first:mt-0","aria-hidden":"true",children:(0,n.jsxs)("div",{className:"flex h-11 items-center gap-1.5 rounded-xl rounded-ee-sm border border-neutral-light bg-neutral-lighter px-4",children:[(0,n.jsx)("span",{className:"size-2 roun
1ded-full bg-midnight motion-safe:animate-bounce motion-safe:[animation-delay:-0.3s]"}),(0,n.jsx)("span",{className:"size-2 rounded-full bg-midnight motion-safe:animate-bounce motion-safe:[animation-delay:-0.15s]"}),(0,n.jsx)("span",{className:"size-2 rounded-full bg-midnight motion-safe:animate-bounce"})]})})}function e6(e){let{messages:t,choices:r,variant:a,isBusy:i,previews:s,uploadProgress:o,onChoice:c}=e,d=(0,l.useRef)(null),u=(0,l.useRef)(null),m=(0,l.useRef)(!0),h=(0,l.useRef)(new Set);(0,l.useEffect)(()=>{var e;let r=d.current,n=u.current;if(!r||!n)return;let l=h.current;h.current=new Set(t.map(e4));let a=r.scrollHeight-r.clientHeight;if(i||(null==(e=t[t.length-1])?void 0:e.role)==="user"){r.scrollTop=a;return}if(!m.current)return;let s=t.length;for(;s>0&&"user"!==t[s-1].role&&!l.has(e4(t[s-1]));)s-=1;let o=s<t.length?n.children[s]:void 0;r.scrollTop=o?Math.min(a,o.offsetTop-16):a},[t,r,i]);let f=()=>{let e=d.current;e&&m.current&&(e.scrollTop=e.scrollHeight-e.clientHeight)};return(0,n.jsxs)("div",{ref:d,tabIndex:-1,onScroll:()=>{let e=d.current;e&&(m.current=e.scrollHeight-e.scrollTop-e.clientHeight<=48)},className:"relative flex min-h-0 flex-1 flex-col overflow-y-auto px-4 py-4 outline-none",children:[(0,n.jsxs)("div",{ref:u,role:"log","aria-busy":i,className:"flex flex-col",children:[t.map((e,r)=>{var l,a;return(0,n.jsx)(e5,{message:e,isGroupStart:(null==(l=t[r-1])?void 0:l.role)!==e.role,isGroupEnd:(null==(a=t[r+1])?void 0:a.role)!==e.role,previewUrl:s[e4(e)],uploadProgress:o,onImageLoad:f},e4(e))}),i&&(0,n.jsx)(e3,{})]}),!i&&(0,n.jsx)(eF,{choices:r,variant:a,onChoice:e=>{var t;null==(t=d.current)||t.focus({preventScroll:!0}),c(e)}})]})}var e8=r(87855);function e9(e){let{disabled:t,onPick:r}=e,a=(0,l.useRef)(null),i=eC();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("input",{ref:a,type:"file",accept:"image/*",tabIndex:-1,"aria-hidden":"true",className:"hidden",onChange:e=>{var t;let n=e.currentTarget,l=null==(t=n.files)?void 0:t[0];n.value="",l&&r(l)}}),(0,n.jsx)("button",{type:"button","aria-disabled":t||void 0,onClick:()=>{var e;t||null==(e=a.current)||e.click()}
1,"data-track":t?void 0:ew.Dd.CHATBOT_IMAGE_ATTACH,"data-prop-chatbot_session_id":i,"aria-label":h.attachImage,className:"flex size-11 shrink-0 items-center justify-center rounded-full text-neutral-dark outline-none transition-colors duration-200 hover:bg-neutral-lighter aria-disabled:cursor-not-allowed aria-disabled:hover:bg-transparent aria-disabled:text-neutral-main focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",children:(0,n.jsx)(e8.A,{className:"size-5","aria-hidden":"true"})})]})}var e7=r(17188);function te(e){let{mode:t,disabled:r,onSendText:a,notice:i,accessory:s}=e,[o,c]=(0,l.useState)(""),d=(0,l.useRef)(null),u=(0,l.useRef)(null),m=eC(),f=o.trim(),p=!r&&f.length>0;return(0,l.useLayoutEffect)(()=>{let e=d.current;if(!e)return;e.style.height="auto";let t=e.offsetHeight-e.clientHeight;e.style.height="".concat(e.scrollHeight+t,"px")},[o]),(0,n.jsxs)("form",{onSubmit:e=>{e.preventDefault(),p&&(a(f),c(""))},className:"border-t border-neutral-light px-3 pt-2 pb-[max(0.5rem,env(safe-area-inset-bottom))]",children:[i,(0,n.jsxs)("div",{className:"flex items-end gap-2",children:[(0,n.jsx)("textarea",{ref:d,dir:"auto",value:o,onChange:e=>c(e.target.value),onKeyDown:e=>{var t;"Enter"===e.key&&!e.shiftKey&&(e.nativeEvent.isComposing||229===e.keyCode||(e.preventDefault(),null==(t=u.current)||t.click()))},placeholder:h.inputPlaceholder,"aria-label":h.inputPlaceholder,maxLength:1e3,rows:1,className:"max-h-28 min-h-11 flex-1 resize-none rounded-xl border border-transparent bg-neutral-lighter px-3.5 py-2.5 text-m leading-[22px] font-medium text-neutral-darker outline-none transition-colors duration-200 placeholder:text-neutral-main placeholder-shown:text-right focus:border-primary"}),(0,n.jsx)("button",{ref:u,type:"submit",disabled:!p,"data-track":ew.Dd.CHATBOT_TEXT_SEND,"data-prop-chatbot_session_id":m,"data-prop-mode":t,"data-prop-length":String([...f].length),"aria-label":h.send,className:(0,eN.A)("flex size-11 shrink-0 items-center justify-center rounded-full outline-none transition-colors duration-200 disabled:pointer-events-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",p?"bg-primary text-white hover:bg-primary-dark":"bg-neutral-light text-neutral-main"),children:(0,n.jsx)(e7.A,{className:"size-5 -scale-x-100","aria-hidden":"true"})}),s]})]})}function tt(e){let{error:t,errorKey:r}=e;return(0,n.jsx)(eE.o,{as:"p",variant:"body-xs-medium","aria-live":"polite",className:"text-error",children:t&&(0,n.jsx)("span",{className:"block pb-2",children:h[t]},r)})}function tr(e){let{isBusy:t,onRestart:r}=e,l=eC();return(0,n.jsx)("div",{className:"flex justify-center border-t border-neutral-light px-3 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",children:(0,n.jsx)(e_.Button,{size:"sm",disabled:t,onClick:r,"data-track":ew.Dd.CHATBOT_RESTART,"data-prop-chatbot_session_id":l,className:"outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",children:h.restart})})}let tn=(0,n.jsx)("div",{className:"pb-[env(safe-area-inset-bottom)]"});function tl(e){let{input:t,status:r,isBusy:l,connectionLost:a,canSendText:i,image:s,onSendText:o,onRestart:c}=e;return t?"ended"===t.mode||"ended"===r?(0,n.jsx)(tr,{isBusy:l,onRestart:c}):i?(0,n.jsx)(te,{mode:t.mode,disabled:l,onSendText:o,notice:s.canAttach&&(0,n.jsx)(tt,{error:s.error,errorKey:s.errorKey}),accessory:s.canAttach&&(0,n.jsx)(e9,{disabled:s.isUploading,onPick:s.onAttach})}):tn:a&&null===r?(0,n.jsx)(tr,{isBusy:l,onRestart:c}):tn}var ta=r(48314),ti=r(65229);let ts="flex size-11 shrink-0 items-center justify-center rounded-lg text-neutral-dark outline-none transition-colors hover:bg-neutral-lighter focus-visible:ring-2 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50";function to(e){let{canRestart:t,isBusy:r,onRestart:l,onClose:i}=e,s=(0,a.Iu)(),o=eC();return(0,n.jsx)("div",{className:(0,eN.A)("border-b border-neutral-light bg-white",s&&"pt-[env(safe-area-inset-top)]"),children:(0,n.jsxs)("div",{className:(0,eN.A)("flex items-center gap-3 ps-4",s?"h-14 pe-1":"h-16 pe-1.5"),children:[(0,n.jsx)(ej.A,{src:"chatbot/avatar-v4-80.webp",baseBannerCDN:!0,alt:"",width:40,height:40,className:"size-10 shrink-0 rounded-full bg-primary-lightest"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)(eE.o,{as:"h2",variant:"body-m-bold",color:"neutral-darker",className:"truncate",children:h.panelTitle}),(0,n.jsxs)(eE.o,{as:"p",variant:"body-xs-medium",color:"neutral-main",className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"size-2 shrink-0 rounded-full bg-success","aria-hidden":"true"}),h.headerStatus]})]}),t&&(0,n.jsx)("button",{type:"button",onClick:l,disabled:r,"data-track":ew.Dd.CHATBOT_RESTART,"data-prop-chatbot_session_id":o,"aria-label":h.restart,title:h.restart,className:ts,children:(0,n.jsx)(ta.A,{className:"size-5","aria-hidden":"true"})}),(0,n.jsx)("button",{type:"button",onClick:i,"data-track":ew.Dd.CHATBOT_CLOSE,"data-prop-chatbot_session_id":o,"aria-label":h.close,title:h.close,className:ts,children:(0,n.jsx)(ti.A,{className:"size-5","aria-hidden":"true"})})]})})}let tc=[];function td(e){let{messages:t,input:r,status:i,handoff:s,isBusy:o,connectionLost:c,canSendText:d,image:u,onChoice:m,onSendText:f,onRestart:p,onClose:x}=e,g=(0,a.Iu)(),b="handoff"===i||c,v="ended"===i||(null==r?void 0:r.mode)==="ended",y=r&&!v?r.choices:tc,{exitChoice:j,listChoices:w}=(0,l.useMemo)(()=>(function(e,t,r){var n;let l="handoff"===t&&"handoff"===r&&null!=(n=e[0])?n:null;return{exitChoice:l,listChoices:l?e.filter(e=>e!==l):e}})(y,i,null==r?void 0:r.mode),[y,i,null==r?void 0:r.mode]),N=(0,l.useRef)(null);return(0,l.useEffect)(()=>{var e;null==(e=N.current)||e.focus()},[]),(0,l.useEffect)(()=>
1{if(document.activeElement===document.body){var e;null==(e=N.current)||e.focus({preventScroll:!0})}},[d,u.canAttach]),(0,l.useEffect)(()=>{let e=e=>{"Escape"===e.key&&!e.isComposing&&(e.defaultPrevented||x())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[x]),(0,n.jsxs)("div",{ref:N,tabIndex:-1,dir:"rtl",role:"dialog","aria-modal":g,"aria-label":h.panelTitle,className:(0,eN.A)("fixed flex flex-col overflow-hidden bg-white outline-none",g?"inset-0 z-[10001]":"z-50 end-4 bottom-6 h-[600px] max-h-[calc(100vh-3rem)] w-[380px] rounded-2xl border border-neutral-light shadow-md"),children:[(0,n.jsx)(to,{canRestart:"active"===i&&((null==r?void 0:r.mode)==="choices"||(null==r?void 0:r.mode)==="text"),isBusy:o,onRestart:p,onClose:x}),b&&(0,n.jsx)(eT,{handoff:s,connectionLost:c,exitChoice:j,isBusy:o,onExit:e=>{var t;null==(t=N.current)||t.focus({preventScroll:!0}),m(e)}}),(0,n.jsx)(e6,{messages:t,choices:w,variant:null==r?void 0:r.variant,isBusy:o,previews:u.previews,uploadProgress:u.progress,onChoice:m}),(0,n.jsx)(tl,{input:r,status:i,isBusy:o,connectionLost:c,canSendText:d,image:u,onSendText:f,onRestart:p})]})}function tu(){let{isAuthenticated:e}=(0,i.J)(),{isLandingPage:t,isWheelPage:r,isPdpPage:d,isCheckoutPage:u,isServiceCheckoutPage:f,isInvoicePage:p,isPushEnrollPage:w}=(0,s.I)(),N=(0,a.Iu)(),k=t||r||u||f||p||w,[I,C]=(0,l.useState)(!1),{session:S,refreshSession:A}=(e=>{let t=(0,o.jE)(),r=(0,l.useRef)(void 0),n=(0,l.useCallback)(async()=>{let e=x(),t=await g(e);return r.current=e,t},[]),{data:a}=(0,c.I)({queryKey:y(e),queryFn:n,enabled:null!==e,refetchInterval:72e4,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0,staleTime:72e4,gcTime:(0,b.W)(72e4),retry:1});return(0,l.useEffect)(()=>{let e=()=>{void 0!==r.current&&x()!==r.current&&t.invalidateQueries({queryKey:v},{cancelRefetch:!1})};return window.addEventListener("storage",e),window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("storage",e),window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[t]),{session:a,refreshSession:(0,l.useCallback)(()=>t.fetchQuery({queryKey:y(e),queryFn:n,staleTime:0,gcTime:(0,b.W)(72e4)}),[t,e,n])}})(e),[_,E]=(0,l.useState)(!1);(0,l.useEffect)(()=>{S&&E(S.enabled)},[S]);let T=(S?S.enabled:_)&&!k,O=I&&T,{sessionId:D,messages:R,input:L,status:U,handoff:M,isBusy:B,connectionLost:G,canSendText:W,image:K,start:et,onChoice:eo,onSendText:ec,onRestart:ed}=(e=>{var t,r;let{session:n,refreshSession:a,isOpen:i,isAuthenticated:s}=e,[o,c]=(0,l.useReducer)(function e(t,r){if(((e,t)=>{switch(t.type){case"loaded":return t.from!==e.sessionId;case"answered":case"uploaded":case"polled":case"handoff":case"failed":return t.sessionId!==e.sessionId;default:return!1}})(t,r))return t;switch(r.type){case"reset":return $;case"loaded":return{sessionId:r.state.sessionId,messages:Y([],r.state.messages),input:r.state.input,status:r.state.status,handoff:r.state.handoff,connectionLost:!1,error:null};case"pending":return{...t,messages:[...t.messages,{pending:!0,localId:r.localId,role:"user",text:r.text,...r.image?{image:!0}:{}}]};case"discarded":return{...t,messages:F(t.messages,r.localId)};case"uploaded":return{...t,messages:Y(F(t.messages,r.localId),r.message?[r.message]:[])};case"answered":return{...t,messages:Y(q(F(t.messages,r.localId),r.state.messages),r.state.messages),input:r.state.input,status:r.state.status,handoff:r.state.handoff,connectionLost:!1,error:null};case"polled":{if(r.snapshot&&Z(r.snapshot)){let n=e(t,{...r,snapshot:void 0});return e(n,{type:"handoff",sessionId:r.sessionId,state:r.snapshot.handoff})}let n=r.snapshot&&!V(t,r.snapshot)?r.snapshot:void 0;if(0===r.messages.length&&!t.connectionLost&&(!n||J(t,n)))return t;let l=n?n.handoff:t.handoff;return{...t,messages:Y(q(t.messages,r.messages),r.messages),handoff:"requested"===l&&r.messages.some(e=>"agent"===e.role)?"open":l,status:n?n.status:t.status,input:n?n.input:t.input,connectionLost:!1}}case"handoff":{let e=r.snapshot&&!Z(r.snapshot)?r.snapshot:void 0;if(e){if(V(t,e)||J(t,e))return t.connectionLost?{...t,connectionLost:!1}:t;return{...t,...e,connectionLost:!1}}let n="active"===t.status&&Q(t.handoff),l=Q(r.state)&&!n;if(!l&&r.state===t.handoff&&!t.connectionLost)return t;return{...t,handoff:r.state,status:l?"ended":t.status,input:l?X:t.
1input,connectionLost:!1}}case"failed":{let e=r.localId?F(t.messages,r.localId):t.messages,n="ended"===r.kind;return{...t,messages:e,status:n?"ended":t.status,input:n?X:t.input,connectionLost:ee.has(r.kind),error:r.kind}}default:return t}},$),{isBusy:d,run:u,abort:f,isRunning:p}=(()=>{let[e,t]=(0,l.useState)(!1),r=(0,l.useRef)(!1),n=(0,l.useRef)(null),a=(0,l.useCallback)(async e=>{if(r.current)return;r.current=!0,t(!0);let l=new AbortController;n.current=l;try{await e(l.signal)}finally{n.current===l&&(n.current=null,r.current=!1,t(!1))}},[]);return{isBusy:e,run:a,abort:(0,l.useCallback)(()=>{var e;null==(e=n.current)||e.abort(),n.current=null,r.current=!1,t(!1)},[]),isRunning:(0,l.useCallback)(()=>r.current,[])}})(),{getAuth:g,getToken:b,refreshIfSignedInElsewhere:v}=((e,t)=>{let r=(0,l.useRef)(e),n=(0,l.useRef)(t),a=(0,l.useRef)("");(0,l.useEffect)(()=>{r.current=e,n.current=t,(null==e?void 0:e.enabled)&&(a.current=e.apiUrl)});let i=(0,l.useCallback)(()=>en(r.current),[]),s=(0,l.useCallback)(async()=>{let e=await n.current();return r.current=e,e.enabled&&(a.current=e.apiUrl),en(e)},[]),o=(0,l.useCallback)(()=>({apiUrl:a.current,getToken:i,refreshToken:s,getGuest:el}),[i,s]),c=(0,l.useCallback)(async()=>{if(!i()&&x())try{await s()}catch(e){}},[i,s]);return{getAuth:o,getToken:i,refreshIfSignedInElsewhere:c}})(n,a),y=(0,l.useRef)(o);(0,l.useEffect)(()=>{y.current=o});let w=(0,l.useRef)(0),N=(0,l.useCallback)((e,t,r)=>{let n=e instanceof j?e.kind:"network";return c({type:"failed",kind:n,sessionId:t,localId:r}),"not_found"===n&&!!t&&t===y.current.sessionId&&(ea(),!0)},[]),k=(0,l.useCallback)(async(e,t)=>{var r,n,l,a;let i=y.current.sessionId,s=e?null==(r=el())?void 0:r.sessionId:void 0,o=ei(b(),s);try{let r=await (n=g(),l={resume:e,...s?{sessionId:s}:{}},a=t,P(n,{method:"POST",path:"/v1/sessions",body:l,sessionId:l.sessionId,signal:a}).then(z));if(t.aborted)return;es(o,r,!0),c({type:"loaded",from:i,state:r})}catch(e){if(t.aborted)return;N(e,i)}},[g,b,N]),I=(0,l.useCallback)(()=>u(e=>k(!0,e)),[u,k]),C=(e=>{let{sessionId:t,canAttach:r,getAuth:n,dispatch:a,fail:i,onSessionLost:s}=e,[o,c]=(0,l.useState)(!1),[d,u]=(0,l.useState)(null),[f,p]=(0,l.useState)(null),[x,g]=(0,l.useState)(0),[b,v]=(0,l.useState)({}),y=(0,l.useRef)({}),w=(0,l.useRef)(null),N=(0,l.useRef)(0),k=(0,l.useRef)(r);(0,l.useEffect)(()=>{k.current=r,p(null)},[r]);let I=(0,l.useCallback)(e=>{g(e=>e+1),p(e)},[]),C=(0,l.useCallback)(e=>{y.current=e(y.current),v(y.current)},[]),S=(0,l.useCallback)(e=>C(t=>{let{[e]:r,...n}=t;return r&&URL.revokeObjectURL(r),n}),[C]);return(0,l.useEffect)(()=>()=>{var e;null==(e=w.current)||e.abort(),w.current=null,Object.values(y.current).forEach(e=>URL.revokeObjectURL(e)),C(()=>({})),c(!1),u(null),p(null)},[t,C]),{canAttach:r,isUploading:o,progress:d,error:f,errorKey:x,previews:b,onAttach:(0,l.useCallback)(async e=>{var r,l,o;let d;if(!t||w.current||!k.current)return;let f=(d=r=e,m.has(d.type)||""===d.type&&/\.hei[cf]$/i.test(d.name))?0===r.size?"imageFailed":r.size>0xa00000?"imageTooLarge":null:"imageBadType";if(I(f),f)return;N.current+=1;let p="image-".concat(N.current),x="local-".concat(p),g=URL.createObjectURL(e);C(e=>({...e,[x]:g}));let b=new AbortController;w.current=b,c(!0),u(0);let v=!1;a({type:"pending",localId:p,text:h.imageSent,image:!0});try{let r=await (l=n(),o={sessionId:t,file:e,onProgress:e=>{e>=100&&(v=!0),u(e)},signal:b.signal},eu(l,o,l.getToken(),!1));if(b.signal.aborted)return;a({type:"uploaded",sessionId:t,localId:p,message:r}),r?C(e=>{let{[x]:t,...n}=e;return{...n,["seq-".concat(r.seq)]:g}}):S(x)}catch(r){if(b.signal.aborted)return;S(x);let e=r instanceof j?r.kind:"network";if("ended"===e||"not_found"===e){i(r,t,p)&&s();return}a({type:"discarded",localId:p}),k.current&&I(em(r,v))}finally{w.current===b&&(w.current=null,c(!1),u(null))}},[t,n,a,i,s,C,S,I])}})({sessionId:o.sessionId,canAttach:(null==(r=(t=o).input)?void 0:r.mode)==="handoff"&&"open"===t.handoff,getAuth:g,dispatch:c,fail:N,onSessionLost:I}),S=(0,l.useCallback)(async(e,t)=>{let{sessionId:r}=y.current;if(!r||p())return;w.current+=1;let n="pending-".concat(w.current),l=!1;await u(async a=>{if(c({type:"pending",localId:n,text:t}),await v(),a.aborted)return;let i=ei(b(),r);try{var s,o,d,u;let t=await (s=g(),o=r,d=e,u=a,P(s,{method:"POST",path:"/v1/sessions/".concat(encodeURIComponent(o),"/events"),body:d,sessionId:o,signal:u}).then(z));if(a.aborted)return;es(i,t,!1),c({type:"answered",sessionId:r,localId:n,state:t})}catch(e){if(a.aborted)return;l=N(e,r,n)}}),l&&await I()},[u,p,g,b,v,N,I]),A=!!(null==n?void 0:n.enabled),_=null!==o.sessionId,E=(0,l.useCallback)(async()=>{!A||_||y.current.sessionId||await u(e=>k(!0,e))},[A,_,u,k]),T=(0,l.useCallback)(e=>S({type:"choice",choiceKey:e.key},e.label),[S]),O=(0,l.useCallback)(async e=>{let t=e.trim();t&&!([...t].length>1e3)&&er(y.current)&&await S({type:"text",text:t},t)},[S]),D=(0,l.useCallback)(async()=>{A&&await u(e=>k(!1,e))},[A,u,k]);return((e,t,r)=>{let n=(0,l.useRef)(r);(0,l.useEffect)(()=>{n.current=r});let a=(0,l.useRef)(!1),i=(0,l.useCallback)(()=>{a.current||(a.current=!0,n.current.onLogout())},[]),s=(null==e?void 0:e.enabled)?e.signedIn:null,o=(0,l.useRef)(null);(0,l.useEffect)(()=>
1{if(null===s)return;s&&(a.current=!1);let e=o.current;o.current=s,null!==e&&e!==s&&(s?n.current.onLogin():i())},[s,i]);let c=(0,l.useRef)(t);(0,l.useEffect)(()=>{let e=c.current;c.current=t,!0===e&&!1===t&&i()},[t,i])})(n,s,{onLogin:()=>{y.current.sessionId&&el()&&u(e=>k(!0,e))},onLogout:()=>{f(),ea(),c({type:"reset"})}}),(e=>{let t=(0,l.useRef)(e);(0,l.useEffect)(()=>{t.current=e});let{enabled:r,sessionId:n}=e;(0,l.useEffect)(()=>{if(!r||!n)return;let e=new AbortController;return ey(n,()=>t.current,e.signal).catch(()=>void 0),()=>e.abort()},[r,n])})({enabled:i&&"handoff"===o.status,sessionId:o.sessionId,getAuth:g,getAfterSeq:()=>y.current.messages.reduce((e,t)=>H(t)&&t.seq>e?t.seq:e,0),isPaused:p,onMessages:(e,t,r)=>c({type:"polled",sessionId:e,messages:t,snapshot:r}),onHandoff:(e,t,r)=>c({type:"handoff",sessionId:e,state:t,snapshot:r}),onError:(e,t)=>{N(t,e)&&I()}}),{sessionId:o.sessionId,messages:o.messages,input:o.input,status:o.status,handoff:o.handoff,isBusy:d,connectionLost:o.connectionLost,error:o.error,canSendText:er(o),image:C,start:E,onChoice:T,onSendText:O,onRestart:D}})({session:S,refreshSession:A,isOpen:O,isAuthenticated:e});(0,l.useEffect)(()=>{k&&C(!1)},[k]),(0,l.useEffect)(()=>{O&&et()},[O,et]);let eh=(0,l.useCallback)(()=>C(!0),[]),ef=(0,l.useCallback)(()=>C(!1),[]);return T?(0,n.jsx)(eI,{value:D,children:O?(0,n.jsx)(td,{messages:R,input:L,status:U,handoff:M,isBusy:B,connectionLost:G,canSendText:W,image:K,onChoice:eo,onSendText:ec,onRestart:null===U?et:ed,onClose:ef}):(0,n.jsx)(eS,{onOpen:eh,aboveBottomBar:N&&d,signedIn:!0===e})}):null}},28243:(e,t,r)=>{"use strict";r.d(t,{t:()=>l});var n=r(20063);let l=()=>{let e=(0,n.usePathname)(),t=(0,n.useSearchParams)();return"".concat(e,"?").concat(t.toString())}},34207:(e,t,r)=>{"use strict";r.d(t,{ProductDataProvider:()=>g,A:()=>b});var n=r(95155),l=r(12115),a=r(78150),i=r(86431),s=r(72028),o=r(36351),c=r(10296),d=r(45220),u=r(22454),m=r(96444);let h=async(e,t)=>{try{let r=await (0,m.GO)("/carPart/cdn/".concat(e),{method:"GET",params:{cityId:t.cityId},cache:"no-store"});return null!=r?r:null}catch(e){return null}};var f=r(97644);let p=(0,l.createContext)(null);function x(e){return e.sellState===a.nZ.AVAILABLE&&null==e.supplierDeadline}function g(e){let{product:t,children:r}=e,[a,m]=(0,l.useState)(null),{configs:g,ampts:b,hasDisableCauseOfNoShipping:v,isLoading:y}=function(e){var t,r;let{productId:n,enabled:l=!0}=e,{userLocation:a}=(0,f.k)(),{cityId:i}=a,{data:s,isLoading:o,isError:c,error:d}=(0,u.I)({queryKey:["product-dynamic-configs",n,i],queryFn:async()=>{let e=await h(n,{cityId:i});if(!e)throw Error("Failed to fetch product configs");return e},enabled:l&&!!n,staleTime:0,retry:2,refetchOnWindowFocus:!1,refetchOnMount:!0});return{configs:null!=(t=null==s?void 0:s.configs)?t:null,ampts:null!=(r=null==s?void 0:s.ampts)?r:null,hasDisableCauseOfNoShipping:null==s?void 0:s.hasDisableCauseOfNoShipping,isLoading:o,isError:c,error:d}}({productId:t.id,enabled:!0}),j=(0,l.useMemo)(()=>{if(!g)return[];let e=new Map(t.configs.map(e=>[e.id,e]));return g.map(t=>{var r;let n=e.get(t.id);if(!n)return t;let l={...n,...t};return(!t.supportedPaymentGateways||0===t.supportedPaymentGateways.length)&&(null==(r=n.supportedPaymentGateways)?void 0:r.length)&&(l.supportedPaymentGateways=n.supportedPaymentGateways),l})},[g,t.configs]),w=(0,l.useMemo)(()=>j.map(e=>{let t=(0,i.Q)({deliveryMethod:e.deliveryMethod,collectPeriod:e.collectPeriod,prepTime:e.prepTime,warehouseAvailableStock:e.warehouseAvailableStock});return{...e,capacity:e.warehouseAvailableStock>0?e.warehouseAvailableStock:e.sellerAvailableStock>0?e.sellerAvailableStock:0,sla:t,haveImmediateShipping:(0,c.k)(t),deliveryLabel:(0,s.V)(e.supplierDeadline,e.deliveryMethod,(0,o.Q)(e))}}),[j]),N=(0,l.useMemo)(()=>w.filter(x).map(e=>({configId:e.id,supplierUserId:e.supplierUserId,deliveryMethod:e.deliveryMethod})),[w]);(0,d.Y)({offers:N,location:"pdp",carPartId:t.id});let k=(0,l.useMemo)(()=>w.filter(e=>e.isScrap),[w]),I=(0,l.useMemo)(()=>w.filter(e=>!e.isScrap),[w]),C=k.length>0,[S,A]=(0,l.useState)(!0),_=(0,l.useMemo)(()=>C?S?k:I:w,[w,S,C,k,I]);(0,l.useEffect)(()=>
1{if(_.length>0){let e=_.reduce((e,t)=>Math.min(e,t.price),1/0),t=_[0].price;t>e?m(t-e):m(null)}},[_]);let E=(0,l.useMemo)(()=>({product:{...t,configs:_},isScrap:C,isOnScrapMode:S,setScrapMode:A,diffPrice:a,batteryAmper:Object.keys(t.attributes).includes("آمپر")?t.attributes["آمپر"]:null,ampts:b,hasDisableCauseOfNoShipping:v,isLoadingConfigs:y}),[t,_,C,S,a,b,v,y]);return(0,n.jsx)(p.Provider,{value:E,children:r})}let b=p},35690:(e,t,r)=>{"use strict";r.d(t,{Y:()=>h});var n=r(12115),l=r(20063),a=r(80549),i=r(31930),s=r(14763),o=r(72099),c=r(59853),d=r(19542),u=r(83047);let m={verify:i.oA,resendSms:i.FO,resendCall:i.Eh};function h(e){let{phoneNumber:t,timestampKey:r,phoneNumberKey:h,gtmPosition:f,onSuccess:p,redirectSource:x,enableCallResend:g=!1,enableEditPhone:b=!1,services:v=m,enableSignupTracking:y=!0}=e,[j,w]=(0,n.useState)(["","","","",""]),[N,k]=(0,n.useState)(()=>(0,d.jc)(r)),[I,C]=(0,n.useState)(!1),S=(0,n.useRef)(!1),A=(0,l.useRouter)(),{login:_}=(0,s.J)();(0,n.useEffect)(()=>{if(N<=0)return;let e=setTimeout(()=>{k(e=>e-1)},1e3);return()=>clearTimeout(e)},[N]),(0,n.useEffect)(()=>{I&&j.some(e=>e.length>0)&&C(!1),j.every(e=>1===e.length)||(S.current=!1)},[j,I]);let E=(0,a.n)({mutationFn:async e=>{let{phone:t,code:r}=e,n=await v.verify(t,r);if(n.verified&&void 0!==n.userId){var l;null==(l=window.eventHorizonTracker)||l.identify(n.userId.toString())}return n},onSuccess:e=>{if(e.verified){if((0,d.ee)(h),(0,d.Je)(r),_(e.token),p)p();else if(void 0!==x){let e=x?decodeURIComponent(x):"/";A.push(e)}}else C(!0),w(["","","","",""]),S.current=!1},onError:e=>{console.error("Error verifying OTP:",e),w(["","","","",""]),S.current=!1}}),T=(0,a.n)({mutationFn:e=>v.resendSms(e),onSuccess:()=>{w(["","","","",""]),E.reset(),C(!1),S.current=!1,(0,d.mE)(r),k(c.EQ)},onError:e=>{console.error("Error resending OTP:",e)}}),P=(0,a.n)({mutationFn:e=>{var t;return(null!=(t=v.resendCall)?t:i.Eh)(e)},onSuccess:()=>{w(["","","","",""]),E.reset(),C(!1),S.current=!1,(0,d.mE)(r),k(c.EQ)},onError:e=>{console.error("Error resending OTP via call:",e)}});(0,n.useEffect)(()=>{let e=j.join("");if(5===e.length&&j.every(e=>1===e.length)&&!E.isPending&&!S.current){if(S.current=!0,y){var r;(0,o.VI)(f),null==(r=window.eventHorizonTracker)||r.track(u.Dd.SIGNUP_VERIFY_CODE.toUpperCase(),{position:f})}E.mutate({phone:t,code:e})}},[j,t,E,f,y]);let O=async e=>{if(e.preventDefault(),y){var r;(0,o.VI)(f),null==(r=window.eventHorizonTracker)||r.track(u.Dd.SIGNUP_VERIFY_CODE.toUpperCase(),{position:f})}let n=j.join("");5!==n.length||E.isPending||E.mutate({phone:t,code:n})},D=j.every(e=>1===e.length);return{otpValues:j,setOtpValues:w,resendTimer:N,verificationError:I,verifyOtpMutation:E,resendOtpMutation:T,resendOtpCallMutation:g?P:void 0,handleSubmit:O,handleEditPhoneNumber:b?()=>{if(!b)return;let e=new URL("/login",window.location.origin);x&&e.searchParams.set("source",x),A.push(e.toString())}:void 0,handleResendOtp:()=>{!(0,d.kS)(r)&&(T.isPending||0!==N||T.mutate(t))},handleResendOtpCall:g?()=>{g&&!(0,d.kS)(r)&&(P.isPending||0!==N||P.mutate(t))}:void 0,isOtpComplete:D,hasError:I}}},36351:(e,t,r)=>{"use strict";r.d(t,{Q:()=>l,T:()=>i});var n=r(78150);function l(e){let{deliveryMethod:t,collectPeriod:r,prepTime:l,warehouseAvailableStock:a,isMarketplace:i}=e;return t!==n.dk.SHIPBY_AUTOMOBY?null!=l?l:null:("boolean"==typeof i?i:!((null!=a?a:0)>0))?null!=r?r:null:n.qN.UNDER2HOURS}let a={UNDER0HOURS:1,UNDER1HOURS:1,UNDER2HOURS:2,UNDER3HOURS:3,UNDER4HOURS:4,UNDER5HOURS:5,UNDER6HOURS:6,UNDER24HOURS:24,UNDER48HOURS:48,UNDER72HOURS:72,UNDER96HOURS:96,UNDER120HOURS:120},i=e=>{var t;return e&&null!=(t=a[e])?t:null}},41453:(e,t,r)=>{"use strict";r.d(t,{DS:()=>c,TG:()=>s,YN:()=>d});var n=r(47580),l=r(14330),a=r(3401);let i=()=>(e=>{if(!e)return null;let t=e.lastIndexOf("|");if(-1===t)return null;let r=decodeURIComponent(e.slice(0,t)),n=Number(e.slice(t+1));return r&&Number.isFinite(n)?{token:r,firstSeenAt:n}:null})((0,n.tS)(l.Q.YELLOW_ADDS_TOKEN)),s=()=>{(0,n.Ir)(l.Q.YELLOW_ADDS_TOKEN)},o=e=>{let t=(e=>{let t=Math.floor((Date.now()-e.firstSeenAt)/1e3);return Math.min(l.Q.MAX_AGE.ONE_DAY,l.Q.MAX_AGE.SEVEN_DAYS-t)})(e);if(t<=0)return void s();(0,n.JI)(l.Q.YELLOW_ADDS_TOKEN,(e=>{let{token:t,firstSeenAt:r}=e;return"".concat(encodeURIComponent(t)).concat("|").concat(r)})(e),{maxAge:t})},c=()=>{let e=new URLSearchParams(window.location.search).get("Token");if(e)return void(e=>{let t=i(),r=(null==t?void 0:t.token)===e?t.firstSeenAt:Date.now();o({token:e,firstSeenAt:r})})(e);let t=i();if(!t)return;let{referrer:r}=document;if(r&&!(0,a.Cz)(r)&&!(0,a.CZ)(r))return void s();o(t)},d=()=>{var e,t;return null!=(t=null==(e=i())?void 0:e.token)?t:null}},43090:(e,t,r)=>{"use strict";r.d(t,{h:()=>i});var n=r(95155),l=r(36591),a=r(2821);let i=e=>{let{content:t,className:r,position:i="absolute -top-2 -right-2",variant:s="error",size:o="md"}=e;return(0,n.jsx)("div",{className:(0,a.A)(i,{sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8"}[o],{error:"bg-error",primary:"bg-primary",success:"bg-success",warning:"bg-warning"}[s],"rounded-full border-2 border-white flex items-center justify-center",r),children:(0,n.jsx)(l.o5,{variant:"body-xs-bold",className:"text-white",children:t})})}},43885:(e,t,r)=>{"use strict";r.d(t,{M:()=>n});let n=e=>{let t={coupon:"",discount:0,item_brand:"Unknown",item_category:"Unknown",item_category2:"Unknown",item_category3:"Unknown",item_category4:"Unknown",item_category5:"Unknown",item_list_id:"related_products",item_list_name:"Related Products",location_id:"Unknown"};return e.map((e,r)=>({item_id:"SKU_".concat(e.item_id),item_name:e.item_name,price:e.price||0,affiliation:e.affiliation||"Unknown",quantity:e.quantity||1,item_variant:e.item_variant||"",index:r+1,...t}))}},45220:(e,t,r)=>{"use strict";r.d(t,{Y:()=>a});var n=r(12115),l=r(27122);function a(e){let{offers:t,location:r,carPartId:a}=e,i=(0,n.useRef)(new Set);(0,n.useEffect)(()=>
1{t.filter(e=>!i.current.has(e.configId)).forEach(e=>{i.current.add(e.configId),l.Cp(Error("Delivery estimate missing for offer"),{level:"error",tags:{feature:"delivery-estimate",location:r},extra:{carPartId:a,configId:e.configId,supplierUserId:e.supplierUserId,deliveryMethod:e.deliveryMethod}})})},[t,r,a])}},50828:(e,t,r)=>{"use strict";r.d(t,{t:()=>l});var n=r(83636);let l=()=>"automoby.shop"===(0,n.p)("SITE_BASE_URL")},55898:(e,t,r)=>{"use strict";r.r(t),r.d(t,{SimilarProductsCarousel:()=>u});var n=r(95155),l=r(90154),a=r(97644),i=r(78157),s=r(22454),o=r(7415),c=r(78150),d=r(83443);let u=e=>{var t;let{isInModal:r,batteryAmperModal:u=null}=e,{userLocation:m}=(0,a.k)(),{amp:h}=(0,l.m)(),{batteryAmper:f}=(0,o.p)(),p=r?u:f,{data:x,isFetching:g}=(0,s.I)({queryKey:["products",m.cityId,h],queryFn:()=>{var e;return(0,i.H)(null!=(e=m.cityId)?e:301,null,{page:1,limit:24,amper:null!=p?p:null})},enabled:!!p,retry:2,refetchOnWindowFocus:!1}),b=null!=(t=null==x?void 0:x.products.filter(e=>(e.id!==+h||r)&&e.state!==c.ZG.DISABLE&&e.state!==c.ZG.OUTOFSTOCK&&e.state!==c.ZG.CONTACTUS))?t:[];return g||!p||0===b.length?null:(0,n.jsx)("div",{children:(0,n.jsx)(d.q,{products:b,title:"محصولات مشابه",isLoading:g,backgroundColor:"bg-neutral-lighter"})})}},56198:(e,t,r)=>{"use strict";r.d(t,{default:()=>a});var n=r(12115),l=r(67668);function a(e){let{novaApiBaseUrl:t,vapidPublicKey:r}=e;return(0,n.useEffect)(()=>{t&&r&&((0,l.xs)(t),"undefined"!=typeof Notification&&("granted"===Notification.permission?(0,l.OU)(t,r).then(()=>(0,l.$K)(t)):(0,l.$K)(t)))},[t,r]),null}},59853:(e,t,r)=>{"use strict";r.d(t,{C4:()=>i,EQ:()=>n,IP:()=>s,PL:()=>l,rS:()=>a});let n=90,l="otp_request_timestamp",a="otp_phone_number",i="otp_popup_request_timestamp",s="otp_popup_phone_number"},60668:(e,t,r)=>{"use strict";r.d(t,{g:()=>l});var n=r(12115);function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{hideBottomSectionOnScroll:t=!1}=e,[r,l]=(0,n.useState)(!1),[a,i]=(0,n.useState)(0),[s,o]=(0,n.useState)(!0),[c,d]=(0,n.useState)(0),[u,m]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=document.getElementById("top-banner");if(e){let{height:t}=e.getBoundingClientRect();d(t)}let r=()=>{let{scrollY:e}=window;m(e>=c),l(e>=c),t&&e>=c?e>a&&e>c+100?o(!1):o(!0):t&&o(!0),i(e)};return window.addEventListener("scroll",r,{passive:!0}),()=>window.removeEventListener("scroll",r)},[a,c,t]),{isScrolled:r,showBottomSection:s,topBannerHeight:c,isFixed:u}}},62013:(e,t,r)=>{"use strict";r.d(t,{TorobAttributionInitializer:()=>i});var n=r(12115),l=r(20063),a=r(73282);function i(){let e=(0,l.usePathname)();return(0,n.useEffect)(()=>{(0,a.jE)()},[e]),null}},63953:(e,t,r)=>{"use strict";r.d(t,{default:()=>h});var n=r(14763),l=r(70228),a=r(22454),i=r(27122),s=r(1304);async function o(){let e={enabled:!1};try{let t=localStorage.getItem(s.V),r=await fetch("/api/flowchat/session/",{method:"GET",cache:"no-store",headers:t?{Authorization:"Bearer ".concat(t)}:void 0});if(!r.ok)return i.wd("FlowChat session request failed",{level:"error",tags:{feature:"flowchat",api:"session"},extra:{status:r.status}}),e;return await r.json()}catch(t){return i.Cp(t,{level:"error",tags:{feature:"flowchat",api:"session"}}),e}}var c=r(75063),d=r(12115);let u="flowchat-widget",m=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=(0,d.useRef)(!1);(0,d.useEffect)(()=>{var n,l,a,i,s;if(!e)return;let o=e.enabled?e.signedIn?{chatbot_id:e.chatbotId,session_attributes_jwt:e.sessionAttributesJwt}:{chatbot_id:e.chatbotId}:null;if(!o){if(null==(a=window.flowchatSettings)?void 0:a.session_attributes_jwt){let e={...window.flowchatSettings};delete e.session_attributes_jwt,window.flowchatSettings=e,null==(i=(s=window).FlowChat)||i.call(s,"update",e)}return}if(!r.current&&!document.getElementById(u)){if(t)return;r.current=!0,window.flowchatSettings=o;let e=document.createElement("script");e.id=u,e.src="https://widget.flowchat.tech/assets/script.js",e.async=!0,document.body.appendChild(e);return}window.flowchatSettings=o,null==(n=(l=window).FlowChat)||n.call(l,"update",o)},[e,t]),(0,d.useEffect)(()=>{var e,r;document.getElementById(u)&&(null==(e=(r=window).FlowChat)||e.call(r,t?"hide":"show"))},[t])};function h(){let{isAuthenticated:e}=(0,n.J)(),{isLandingPage:t,isWheelPage:r,isCheckoutPage:i,isServiceCheckoutPage:s,isInvoicePage:d,isPushEnrollPage:u}=(0,l.I)(),{data:h}=(0,a.I)({queryKey:["flowchat","session",e],queryFn:o,enabled:null!==e,refetchInterval:72e4,refetchIntervalInBackgroun
1d:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0,staleTime:72e4,gcTime:(0,c.W)(72e4),retry:1});return m(h,t||r||i||s||d||u),null}},64461:(e,t,r)=>{"use strict";r.d(t,{YellowAddsAttributionInitializer:()=>i});var n=r(12115),l=r(20063),a=r(41453);function i(){let e=(0,l.usePathname)();return(0,n.useEffect)(()=>{(0,a.DS)()},[e]),null}},64639:(e,t,r)=>{"use strict";r.d(t,{SourceGatewayInitializer:()=>a});var n=r(12115),l=r(65788);function a(){return(0,n.useEffect)(()=>{(0,l.S)()},[]),null}},65788:(e,t,r)=>{"use strict";r.d(t,{S:()=>i});var n=function(e){return e.ONLINE="ONLINE",e.SNAPP_PAY="SNAPP_PAY",e.TOROB_PAY="TOROB_PAY",e.SAMAN="SAMAN",e.EWANO="EWANO",e.TARA="TARA",e.ITOL="ITOL",e.DIGI_PAY="DIGI_PAY",e.AZKI="AZKI",e.ZARINPLUS="ZARINPLUS",e.KEEPA="KEEPA",e.VIBE="VIBE",e.GOOGLE="GOOGLE",e.OTHER="OTHER",e.DIRECT="DIRECT",e}({});let l="source_gateway";var a=r(3401);let i=()=>{let e=localStorage.getItem(l),{referrer:t}=document,r=(()=>{var e;if(window.location.href.toLowerCase().includes("amps"))return n.SNAPP_PAY;let t=null==(e=new URLSearchParams(window.location.search).get("utm_source"))?void 0:e.toLowerCase();return t?t.includes("snap")?n.SNAPP_PAY:t.includes("digi")?n.DIGI_PAY:t.includes("torob")?n.TOROB_PAY:t.includes("google")?n.GOOGLE:null:null})();if(r)return r!==e&&localStorage.setItem(l,r),r;if((0,a.Cz)(t))return e;let i=(e=>{if(!e)return n.DIRECT;let t=e.toLowerCase();return t.includes("snap")?n.SNAPP_PAY:t.includes("digi")?n.DIGI_PAY:t.includes("torob")?n.TOROB_PAY:t.includes("google")?n.GOOGLE:n.OTHER})(t);return i!==e&&localStorage.setItem(l,i),i}},66093:(e,t,r)=>{"use strict";r.d(t,{QueryProvider:()=>o});var n=r(95155),l=r(74852),a=r(99776),i=r(12115),s=r(75063);function o(e){let{children:t}=e,[r]=(0,i.useState)(()=>new l.E({defaultOptions:{queries:{staleTime:3e5,gcTime:(0,s.W)(6e5)}}}));return(0,n.jsx)(a.Ht,{client:r,children:t})}},71815:(e,t,r)=>{"use strict";r.d(t,{D4:()=>h,Q$:()=>m,kh:()=>o,tR:()=>c,t2:()=>p,l$:()=>f,IU:()=>x,tN:()=>u,Y_:()=>d});var n=r(83047),l=r(69155),a=r(43885);let i=e=>{let t={coupon:"",discount:0,item_brand:"Unknown",item_category:"Unknown",item_category2:"Unknown",item_category3:"Unknown",item_category4:"Unknown",item_category5:"Unknown",item_list_id:"cart_items",item_list_name:"Cart Items",location_id:"Unknown"};return e.items.map((e,r)=>{var n;return{item_id:"SKU_".concat(e.id),item_name:e.name,price:e.price||0,affiliation:(null==(n=e.supplier)?void 0:n.title)||"Unknown",quantity:e.quantity||1,item_variant:e.size||"",index:r+1,...t}})},s=e=>({items:e}),o=e=>{let t={event:n.Dd.ADD_SHIPPING_INFO,shipping_type:s((0,a.M)(e))};(0,l.P)(t)},c=e=>{let t={event:n.Dd.BEGIN_CHECKOUT,ecommerce:s((0,a.M)(e))};(0,l.P)(t)};var d=function(e){return e.Header="header",e.Popup="popup",e.BottomMobile="Bottom-mobile",e.Navbar="navbar",e}({});let u=(e,t)=>{if(!t)return;let r={event:n.Dd.VIEW_CART,ecommerce:s(i(t)),source_page:e};(0,l.P)(r)},m=(e,t,r,a,i)=>{let s={event:n.Dd.ADD_ADDRESS_INFO,address_description:e,address_title:t,province:r,city:a,postal_code:i};(0,l.P)(s)},h=()=>{let e={event:n.Dd.ADD_ADDRESS};(0,l.P)(e)},f=e=>{let t={event:n.Dd.PARCEL_STEP,ecommerce:s(i(e))};(0,l.P)(t)},p=e=>{let t={event:n.Dd.CHECKOUT_FINISH,gateway_name:e};(0,l.P)(t)},x=(e,t)=>{let r={event:n.Dd.PURCHASE,ecommerce:{...s((0,a.M)(e)),gateway_name:t}};(0,l.P)(r)}},72028:(e,t,r)=>{"use strict";r.d(t,{V:()=>o,y:()=>s});var n=r(78150),l=r(6906),a=r(19540),i=r(36351);function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;if(!e)return null;let r=new Date(e);return Number.isNaN(r.getTime())?null:(0,l.kd)((0,l._e)(t),(0,l._e)(r))}function o(e,t,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Date,c=s(e,o);if(null===c||!e)return null;let d=t===n.dk.SHIPBY_SELLER?" توسط فروشنده":"";if(c<0)return"آماده ارسال".concat(d);if(0===c){let e=(0,i.T)(r);return null!==e&&e<=3?"ارسال زیر ".concat((0,a.T)(e)," ساعت").concat(d):"ارسال امروز".concat(d)}return 1===c?"ارسال فردا".concat(d):"ارسال ".concat((0,l.CO)(e,o)).concat(d)}},72099:(e,t,r)=>{"use strict";r.d(t,{Do:()=>s,PK:()=>a,VI:()=>i,cx:()=>o});var n=r(83047),l=r(69155);let a=e=>{let t={event:n.Dd.SIGNUP_ENTER_PHONE,position:e};(0,l.P)(t)},i=e=>{let t={event:n.Dd.SIGNUP_VERIFY_CODE,position:e};(0,l.P)(t)},s=e=>{let t={event:n.Dd.RETRY_OTP,position:e};(0,l.P)(t)},o=e=>{let t={event:n.Dd.VOICE_OTP_CLICK,position:e};(0,l.P)(t)}},73282:(e,t,r)=>{"use strict";
1r.d(t,{B8:()=>d,Rt:()=>m,jE:()=>u,tZ:()=>o});var n=r(47580),l=r(14330),a=r(3401);let i="torob_clid",s=()=>(e=>{if(!e)return null;let t=e.lastIndexOf("|");if(-1===t)return null;let r=decodeURIComponent(e.slice(0,t)),n=Number(e.slice(t+1));return r&&Number.isFinite(n)?{clid:r,firstSeenAt:n}:null})((0,n.tS)(l.Q.TOROB_CLID)),o=()=>{(0,n.Ir)(l.Q.TOROB_CLID)},c=e=>{let t=(e=>{let t=Math.floor((Date.now()-e.firstSeenAt)/1e3);return Math.min(l.Q.MAX_AGE.ONE_DAY,l.Q.MAX_AGE.SEVEN_DAYS-t)})(e);if(t<=0)return void o();(0,n.JI)(l.Q.TOROB_CLID,(e=>{let{clid:t,firstSeenAt:r}=e;return"".concat(encodeURIComponent(t)).concat("|").concat(r)})(e),{maxAge:t})},d=()=>{let e=new URLSearchParams(window.location.search).get(i);if(!e)return;let t=s(),r=(null==t?void 0:t.clid)===e?t.firstSeenAt:Date.now();c({clid:e,firstSeenAt:r})},u=()=>{if(new URLSearchParams(window.location.search).has(i))return;let e=s();if(!e)return;let{referrer:t}=document;if(t&&!(0,a.Cz)(t)&&!(0,a.wz)(t))return void o();c(e)},m=()=>{var e,t;return null!=(t=null==(e=s())?void 0:e.clid)?t:null}},77979:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var n=r(2821);function l(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.$)(t)}},78157:(e,t,r)=>{"use strict";r.d(t,{H:()=>p});var n=r(96444),l=r(44316),a=r(78150),i=r(67227),s=r(69813),o=r(12115),c=r(41508),d=r(36925),u=r(8475),m=r(78750);let h=c.Ikc({brandUrl:c.YjP().nullable().optional(),modelUrl:c.YjP().nullable().optional(),tipUrl:c.YjP().nullable().optional(),manufacturerUrl:c.YjP().nullable().optional(),categoryUrl:c.YjP().nullable().optional(),mixUrl:c.YjP().nullable().optional(),searchQuery:c.YjP().nullable().optional(),page:c.aig().nullable(),limit:c.aig().nullable(),amper:c.YjP().nullable().optional(),attributeFilters:c.YjP().nullable().optional(),supplierUserId:c.aig().nullable().optional()}),f=(e,t,r)=>r&&e.carModelUrl===r&&(!t||e.carBrandUrl===t)?0:t&&e.carBrandUrl===t?1:2,p=async(e,t,r)=>{if(null===r&&null===t)return null;let o=null;t?o=h.parse((0,d.j)(t,h)):r&&(o=r);try{return await (0,i.I)({upstreamRoute:"/plp/product",method:"POST",pageRoute:s.yS.PLP},async()=>{let t=await (0,n.GO)("/plp/product",{method:"POST",body:JSON.stringify(o),cookies:{city_id:(null==e?void 0:e.toString())||"301"}}),r={OUTOFSTOCK:a.ZG.OUTOFSTOCK,CONTACTUS:a.ZG.CONTACTUS,ENABLE:a.ZG.ENABLE},i=(t.data||[]).map(e=>{var t,n,i,s,c,d,u,m;let h=((e,t,r)=>t||r?e.map((e,t)=>({car:e,index:t})).sort((e,n)=>f(e.car,t,r)-f(n.car,t,r)||e.index-n.index).map(e=>e.car):e)((e.cars||[]).map(e=>{var t,r,n,l,a;return{carBrand:(null==e||null==(t=e.carBrand)?void 0:t.name)||"",carModel:(null==e||null==(r=e.carModel)?void 0:r.name)||"",carTip:(null==e||null==(n=e.carTip)?void 0:n.name)||"",carBrandUrl:(null==e||null==(l=e.carBrand)?void 0:l.url)||"",carModelUrl:(null==e||null==(a=e.carModel)?void 0:a.url)||""}}),null==o?void 0:o.brandUrl,null==o?void 0:o.modelUrl),p=(0,l.c)((null==(n=e.configs)||null==(t=n[0])?void 0:t.supportedPaymentGateways)||[]),x=(null==e?void 0:e.images)&&e.images.length>0&&(null==(i=e.images[0])?void 0:i.image)||"",g=!!(null==e?void 0:e.isTimer),b=(null==e?void 0:e.startDate)||"",v=(null==e?void 0:e.endDate)||"",y=(null==e?void 0:e.url)?"/product/".concat(e.url):"",j=(null==e?void 0:e.state)&&r[e.state]||a.ZG.ENABLE,w=e.collectPeriod,N=e.prepTime,k=e.deliveryMethod;return{id:(null==e?void 0:e.id)||0,productId:(null==e?void 0:e.id)||0,configId:(null==e||null==(c=e.configs)||null==(s=c[0])?void 0:s.id)||0,name:(null==e?void 0:e.name)||"",image:x,realPrice:(null==e?void 0:e.basePrice)||0,discountPrice:(null==e?void 0:e.minPrice)||(null==e?void 0:e.basePrice)||0,supportedCars:h,remainingSellerStock:(null==e?void 0:e.sellerAvailableStock)||0,remainingWarehouseStock:(null==e?void 0:e.warehouseAvailableStock)||0,maxOrderQuantity:(null==e||null==(u=e.configs)||null==(d=u[0])?void 0:d.maxOrderQuantity)||10,state:j,paymentGateways:p,haveTimer:g,timerStartDate:b,timerEndDate:v,pdpUrl:y,isTireeDetail:!1,collectPeriod:w,prepTime:N,deliveryMethod:k,supplierName:(null==e||null==(m=e.manufacturer)?void 0:m.name)||"",isPinned:!!(null==e?void 0:e.isPinned)}}),s=t.pageCount||t.page_count||1;return{products:i,totalPages:s}})}catch(e){return(0,u.t)(m.H.PLP).error({upstream:"/plp/product",err:e instanceof Error?e.message:String(e)},"plp_products_fetch_failed"),null}};(0,o.cache)(p)},80633:(e,t,r)=>{"use strict";r.d(t,{BackendAbTestInitializer:()=>d});var n=r(12115),l=r(99776),a=r(2138),i=r(69155),s=r(1580),o=r(14330),c=r(57541);function d(){let e=(0,l.jE)(),t=(0,s.X)(),{data:r,error:d}=(0,a.x)();return(0,n.useEffect)(()=>{(0,i.O)(e)},[e]),(0,n.useEffect)(()=>{t&&r&&console.log("Backend AB test assignments loaded:",r)},[r,t]),(0,n.useEffect)(()=>{t&&d&&console.error("Backend AB test initialization error:",d)},[d,t]),(0,n.useEffect)(()=>{!t&&(console.log("Backend AB test feature is disabled"),o.a.getCookie(c.mV)&&o.a.clearCookie(c.mV))},[t]),null}},82642:(e,t,r)=>
1{Promise.resolve().then(r.bind(r,68457)),Promise.resolve().then(r.bind(r,71840)),Promise.resolve().then(r.bind(r,26753)),Promise.resolve().then(r.bind(r,70723)),Promise.resolve().then(r.bind(r,76881)),Promise.resolve().then(r.bind(r,31628)),Promise.resolve().then(r.bind(r,91675)),Promise.resolve().then(r.bind(r,83818)),Promise.resolve().then(r.bind(r,36149)),Promise.resolve().then(r.bind(r,77955)),Promise.resolve().then(r.bind(r,6729)),Promise.resolve().then(r.bind(r,18113)),Promise.resolve().then(r.t.bind(r,41402,23)),Promise.resolve().then(r.bind(r,56801)),Promise.resolve().then(r.t.bind(r,13673,23)),Promise.resolve().then(r.bind(r,80633)),Promise.resolve().then(r.bind(r,27928)),Promise.resolve().then(r.bind(r,63953)),Promise.resolve().then(r.bind(r,10102)),Promise.resolve().then(r.bind(r,56198)),Promise.resolve().then(r.bind(r,64639)),Promise.resolve().then(r.bind(r,62013)),Promise.resolve().then(r.bind(r,64461)),Promise.resolve().then(r.bind(r,55721)),Promise.resolve().then(r.bind(r,94460)),Promise.resolve().then(r.bind(r,19152)),Promise.resolve().then(r.bind(r,15232)),Promise.resolve().then(r.bind(r,66093)),Promise.resolve().then(r.bind(r,93960)),Promise.resolve().then(r.bind(r,12704)),Promise.resolve().then(r.bind(r,31572))},86318:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var n=r(12115);function l(){return(0,n.useCallback)(e=>{let t=["Û°","Û±","Û²","Û³","Û´","Ûµ","Û¶","Û·","Û¸","Û¹"],r=["Ù ","Ù¡","Ù¢","Ù£","Ù¤","Ù¥","Ù¦","Ù§","Ù¨","Ù©"];return e.split("").map(e=>{let n=t.indexOf(e);if(-1!==n)return n.toString();let l=r.indexOf(e);return -1!==l?l.toString():e}).join("")},[])}},93960:(e,t,r)=>{"use strict";r.d(t,{SnackbarProvider:()=>a});var n=r(95155),l=r(76348);function a(e){let{children:t}=e;return(0,n.jsx)(l.n,{children:t})}},94460:(e,t,r)=>{"use strict";r.d(t,{MenuProvider:()=>s,x:()=>i});var n=r(95155),l=r(12115),a=r(24142);let i=(0,l.createContext)(void 0),s=e=>{let{children:t,initialMenuData:r}=e,[s,o]=(0,l.useState)(!1),c=(0,l.useMemo)(()=>(function e(t){return Array.isArray(t)?t.map(t=>{var r,n,l,i;let s,o=null!=t?t:{},c=e(Array.isArray(o.children)?o.children:[]);return s="CIRCULAR"===o.childrenType||o.childrenType===a.l.CIRCULAR?a.l.CIRCULAR:"ACCORDION"===o.childrenType||o.childrenType===a.l.ACCORDION?a.l.ACCORDION:a.l.CIRCULAR,{id:Number(o.id),name:String(null!=(r=o.name)?r:""),icon:o.icon?String(o.icon):void 0,url:String(null!=(n=o.url)?n:"/"),seoName:String(null!=(i=null!=(l=o.seoName)?l:o.name)?i:""),seoTitle:o.seoTitle?String(o.seoTitle):void 0,seoAlt:o.seoAlt?String(o.seoAlt):void 0,children:c,childrenType:s,parentId:"number"==typeof o.parentId?o.parentId:void 0,priority:"number"==typeof o.priority?o.priority:1}}):[]})(r),[r]),d=()=>o(!0),u=()=>o(!1),m=()=>o(!s),h=(0,l.useMemo)(()=>({isMenuOpen:s,openMenu:d,closeMenu:u,toggleMenu:m,menuData:c}),[s,c]);return(0,n.jsx)(i.Provider,{value:h,children:t})}}},e=>{e.O(0,[2978,2293,2685,8568,6591,5239,4161,2454,7435,4624,4555,6164,2242,7877,9517,6444,6233,7668,4763,846,8081,3479,3657,2187,8441,3333,7358],()=>e(e.s=82642)),_N_E=e.O()}]);

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.