PageSourceSearch

https://pide.comecamila.com/_next/static/chunks/pages/%5B...alias%5D.js

js comecamila.com collected 2026-10-04 10:53:01 UTC 123,382 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="676161de-a3db-4505-9e30-a5c6b7eef1e4",e._sentryDebugIdIdentifier="sentry-dbid-676161de-a3db-4505-9e30-a5c6b7eef1e4")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7306],{21504:(e,t,o)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/[...alias]",function(){return o(32748)}])},11962:(e,t,o)=>{"use strict";o.d(t,{A:()=>u});var a=o(74848),r=o(32862),l=o(18051),n=o.n(l),i=o(29965),s=o.n(i),d=o(96540),c=o(77255);function u(e){var t,o,l,i;let{text:u}=e,{t:m}=(0,c.Bd)(),_=u||m("processing"),[g,v]=(0,d.useState)(null),{restaurantData:p}=(0,r.Lv)(),h=null==p?void 0:null===(t=p.ecom_settings)||void 0===t?void 0:t.theme_settings,f=(null==h?void 0:h.primary_text_color)||"#000000",y=(null==h?void 0:null===(o=h.fonts)||void 0===o?void 0:o.name)||"sans-serif",b=(null==h?void 0:h.background_color)||"#f3f4f6",x=null==p?void 0:null===(i=p.ecom_settings)||void 0===i?void 0:null===(l=i.general_settings)||void 0===l?void 0:l.loader_image;return((0,d.useEffect)(()=>{(async()=>{try{let e=await fetch("https://res.cloudinary.com/http-foodbot-ai/raw/upload/v1752233580/Food_Carousel_agkfib.json"),t=await e.json();v(t)}catch(e){console.error("Failed to load Lottie animation:",e)}})()},[]),p)?(0,a.jsx)("div",{className:"fixed inset-0 flex items-center justify-center z-[1200]",children:"string"==typeof x&&x.trim()?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center w-full h-full bg-gray-500 bg-opacity-50",children:[(0,a.jsx)(s(),{src:x.trim(),alt:"Loading...",unoptimized:!0,width:0,height:0,sizes:"100vw",className:"animate-pulse h-auto w-auto",style:{objectFit:"contain",maxHeight:"50vh",maxWidth:"80vw"}}),(0,a.jsxs)("div",{style:{color:f,fontFamily:"".concat(y,", sans-serif")},className:"text-2xl mt-4 font-bold text-center",children:[_," ..."]})]}):(0,a.jsx)("div",{className:"flex flex-col items-center justify-center w-full h-full bg-gray-500 bg-opacity-50",children:g?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n(),{animationData:g,loop:!0,autoplay:!0,style:{height:200,width:300}}),(0,a.jsxs)("div",{style:{color:f,fontFamily:"".concat(y,", sans-serif")},className:"text-4xl mt-2 font-black text-center",children:[_," ..."]})]}):(0,a.jsx)("div",{className:"text-white text-lg",children:"Loading..."})})}):(0,a.jsx)("div",{className:"fixed inset-0 flex flex-col items-center justify-center z-[1200] bg-gray-500 bg-opacity-50",style:{backgroundColor:b},children:(0,a.jsxs)("div",{className:"animate-pulse flex flex-col items-center space-y-4",children:[(0,a.jsx)("div",{className:"bg-gray-400 h-40 w-40 rounded-full"}),(0,a.jsx)("div",{className:"bg-gray-400 h-6 w-48 rounded"})]})})}},18256:(e,t,o)=>{"use strict";o.d(t,{B:()=>l});var a=o(96540),r=o(67279);let l=()=>{let e=(0,a.useMemo)(()=>["places"],[]),{isLoaded:t,loadError:o}=(0,r.useJsApiLoader)({googleMapsApiKey:"AIzaSyCRQO_eNuogv5K0nJcvj1zMkKHQXa84NTo",libraries:e});return{isGoogleMapsLoaded:t,loadError:o}}},32748:(e,t,o)=>{"use strict";o.r(t),o.d(t,{__N_SSP:()=>eR,default:()=>ez});var a=o(74848),r=o(64251),l=o(32862),n=o(84345),i=o(8083),s=o(6210),d=o(66895),c=o(29965),u=o.n(c),m=o(86715),_=o(96540),g=o(77255),v=o(70255),p=o(27528),h=o(49505);let f=async(e,t,o,a,r,l,n)=>{let i=(null==r?void 0:r.includes("localhost"))||(null==r?void 0:r.includes("127.0.0.1"))||(null==r?void 0:r.includes("::1")),s=(0,h.z)(i?"152.59.184.156":l),d="https://order.foodbot.ai/apiv2";r&&(d=r+"apiv2");
1let c=JSON.stringify({restaurant_alias:e.replace(/\//g,""),restaurant_id:t||"",session_id:a,version:o,ui_request_timestamp:new Date().toISOString(),...n?{user_geo_location:{lat:n.lat,long:n.long}}:{}});console.log("pickupbranches_api raw payload:",c);let u=await fetch("".concat(d,"/ecom/v1/branches-pickup"),{method:"POST",headers:s,body:c,redirect:"follow"});u.ok||console.log("pickupbranches_api: error response",u.status);try{return await u.json()}catch(e){return console.error("pickupbranches_api: JSON parse error",e),null}};var y=o(5595),b=o(24112),x=o(64201),S=o(14953),w=o.n(S),k=o(11804),j=o(26474),N=o(74353),I=o.n(N),C=o(83826),O=o.n(C),A=o(88569),E=o.n(A);I().extend(E());let P=e=>{let t=I()().tz("America/Mexico_City"),o=t.day(),a=t.hour(),r=t.minute();return!e.menu_timing.some(e=>{let[t,l]=e.open_time.split(":").map(Number),[n,i]=e.close_time.split(":").map(Number);return e.day===o.toString()&&(a>t||a===t&&r>=l)&&(a<n||a===n&&r<=i)})},F=e=>e.sort((e,t)=>{let o="top_picks"===e.type&&"000"===e.menu_id,a="top_picks"===t.type&&"000"===t.menu_id;if(o&&!a)return -1;if(!o&&a)return 1;let r=P(e);return r===P(t)?0:r?1:-1}),M=_.forwardRef(function(e,t){let{title:o,titleId:a,...r}=e;return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":a},r),o?_.createElement("title",{id:a},o):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}),_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1 1 15 0Z"}))});var D=o(13762),T=o(63118);let J=w()(()=>o.e(6635).then(o.bind(o,66635)),{loadableGenerated:{webpack:()=>[66635]},ssr:!1}),B=w()(()=>Promise.all([o.e(1430),o.e(9861),o.e(8975)]).then(o.bind(o,18975)),{loadableGenerated:{webpack:()=>[18975]},ssr:!1}),L=w()(()=>Promise.all([o.e(7348),o.e(1430),o.e(4743),o.e(3423),o.e(1764),o.e(6721)]).then(o.bind(o,6721)),{loadableGenerated:{webpack:()=>[6721]},ssr:!1}),R=w()(()=>o.e(9178).then(o.bind(o,79178)),{loadableGenerated:{webpack:()=>[79178]},ssr:!1}),z=w()(()=>o.e(3259).then(o.bind(o,43259)),{loadableGenerated:{webpack:()=>[43259]},ssr:!1}),q=w()(()=>Promise.resolve().then(o.bind(o,67279)).then(e=>e.GoogleMap),{loadableGenerated:{webpack:()=>[67279]},ssr:!1}),Y=w()(()=>Promise.resolve().then(o.bind(o,67279)).then(e=>e.Marker),{loadableGenerated:{webpack:()=>[67279]},ssr:!1}),G=e=>{var t,o,r,l,n,i,s,d,c,u,m,_,v,p,h,f,y,b,x,S,w,k,j;let N;let{t:I}=(0,g.Bd)(),{variant:C,primaryColor:O,fontFamily:A,secondaryColor:E,bgColor:P,ErrorPrimaryColor:F,changeModeBranchId:G,pickupScheduleData:H,formattedDate:U,isDineInTab:W,dineintable:V,localMode:K,effectiveBranches:Z,restaurantOpen:Q,deliveryTime:X,canOpenChangeMode:$,openMode:ee,setOpenMode:et,changeModeModal:eo,setChangeModeModal:ea,secondaryBtnColor:er,secondaryBtnTxtColor:el,fallbackTimingBranch:en,setAddress:ei,containerStyle:es,marker:ed,center:ec,onLoad:eu,onMarkerClick:em,map:e_,setMarker:eg,address:ev,handleLocationSelect:ep,autocompleteRef:eh,alias:ef,getPickupBranches:ey,getClickedBranchId:eb,restaurantSettingsData:ex,triggerError:eS,setOpenLoginModal:ew,paymentMethod:ek,checkItemurl:ej,setCheckItemurl:eN,requestLocationSort:eI,partner:eC,resturant_currency:eO,resturantsettings:eA}=e,eE=null==G?void 0:G.mode,eP="delivery"===eE?I("deliver_to"):"dinein"===eE?I("dine_in"):I("pick_up_at"),eF=(null==H?void 0:H.date)&&(null==H?void 0:H.time)?"".concat(U," - ").concat(H.time):I("today_now");if("pickup"===eE)N=(null==G?void 0:null===(r=G.branch)||void 0===r?void 0:r.branch_name)||I("unknown_branch");else if("dinein"===eE){let e=W?"QSR":V||I("no_table");N="".concat((null==G?void 0:null===(l=G.branch)||void 0===l?void 0:l.branch_name)||I("unknown_branch")," - ").concat(e)}else N="delivery"===eE?(null==K?void 0:null===(n=K.branch)||void 0===n?void 0:n.address_label)||I("unknown_address"):(null==Z?void 0:Z.length)>0?Z[0].branch_name||I("unknown_branch"):I("no_branches_available");if("mobile"===C)return(0,a.jsxs)("div",{className:"px-4 pt-3 pb-2 lg:hidden",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsx)("div",{className:"rounded-lg p-2 flex-shrink-0 flex items-center justify-center",style:{backgroundColor:E},children:(0,a.jsx)(D.A,{mode:"delivery"===eE?"delivery":"dinein"===eE?"dinein":"pickup",isActive:!0,activeColor:"white",className:"!mr-0"})}),(0,a.jsxs)("div",{className:"flex-shrink-0",children:[(0,a.jsx)(J,{type:"secondary",text:I("change"),onClick:()=>$()&&ea(!0)}),(0,a.jsx)(z,{isOpen:eo,setIsOpen:ea,secondaycolor:er,primarycolor:el,setAddress:()=>ei(""),children:eo&&(0,a.jsx)(T.A,{localalias:"".concat(ef),searchAddress:ev,setSearchAddress:ei,map:e_,marker:ed,setMarker:eg,handleLocationSelect:ep,autocompleteRef:eh,getPickupBranches:ey,getClickedBranchId:eb,restaurantSettingsServer:ex,setIsOpen:ea,triggerError:()=>eS(I("we_do_not_deliver")),login:localStorage.getItem("loggedin_".concat(ef)),setOpenLoginModal:ew,schedulesetting:null==ek?void 0:ek.data,validateCartItemsAgainstMenu:"",setIsCartUpdated:"",setSaveCartCal:"",setTaxDetails:"",setCartItemDetails:"",cartpagevalidate:"",saveCartCal:"",checkItemurl:ej,setCheckItemurl:eN,onRequestLocationSort:eI})})]})]}),(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsx)("div",{className:"font-bold text-[15px] leading-tight",style:{color:O,fontFamily:"".concat(A,", sans-serif")},children:eP}),(0,a.jsxs)("div",{className:"flex items-center gap-1 text-[13px] mt-0.5",style:{color:O,fontFamily:"".concat(A,", sans-serif")},children:[(0,a.jsx)("span",{className:"flex-shrink-0",style:{color:"initial"},children:"\uD83D\uDCCD"}),(0,a.jsx)("span",{className:"truncate",children:"pickup"===eE?"".concat((null==G?void 0:null===(i=G.branch)||void 0===i?void 0:i.branch_name)||I("unknown_branch")," \xb7 ").concat(eF):"dinein"===eE?"".concat((null==G?void 0:null===(s=G.branch)||void 0===s?void 0:s.branch_name)||I("unknown_branch")," - ").concat(W?"QSR":V||I("no_table")):"delivery"===eE?"".concat((null==K?void 0:null===(d=K.branch)||void 0===d?void 0:d.address_label)||I("unknown_address")," \xb7 ").concat(eF):"".concat((null==Z?void 0:Z.length)>0?Z[0].branch_name||I("unknown_branch"):I("no_branches_available")," \xb7 ").concat(I("today_now"))})]})]}),"delivery"===eE&&(0,a.jsxs)("div",{className:"flex items-center gap-1 my-0.5 flex-wrap",style:{color:O,fontFamily:"".concat(A,", sans-serif")},children:[(null==eA?void 0:null===(u=eA.ecom_settings)||void 0===u?void 0:null===(c=u.general_settings)||void 0===c?void 0:c.ec
1om_display_deliverypartner)==1&&eC&&Object.keys(eC).length>0&&(0,a.jsxs)("div",{className:"flex items-center gap-1 text-[12px]",children:[(0,a.jsx)("span",{style:{color:"initial"},children:"\uD83D\uDEF5"}),(0,a.jsx)("span",{className:"font-medium",children:I("delivered_by")}),(0,a.jsx)("span",{children:Array.isArray(eC.delivery_partners)?eC.delivery_partners.map(e=>e.partner_name).join(" / "):eC.partner_name||""})]}),(null==ek?void 0:null===(_=ek.data)||void 0===_?void 0:null===(m=_.Charges_details)||void 0===m?void 0:m.minimum_order_amount)!=null&&(0,a.jsxs)(a.Fragment,{children:[(null==eA?void 0:null===(p=eA.ecom_settings)||void 0===p?void 0:null===(v=p.general_settings)||void 0===v?void 0:v.ecom_display_deliverypartner)==1&&eC&&Object.keys(eC).length>0&&(0,a.jsx)("span",{className:"text-gray-300",children:"|"}),(0,a.jsxs)("div",{className:"flex items-center gap-1 text-[12px]",children:[(0,a.jsx)("span",{style:{color:"initial"},children:"\uD83D\uDCB0"}),(0,a.jsx)("span",{className:"font-medium",children:I("minimum_order")}),(0,a.jsxs)("span",{children:[eO,null==ek?void 0:null===(f=ek.data)||void 0===f?void 0:null===(h=f.Charges_details)||void 0===h?void 0:h.minimum_order_amount]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center mt-1",style:{color:O,fontFamily:"".concat(A,", sans-serif")},children:[(0,a.jsx)("div",{className:"flex-1 flex items-center gap-1 text-[13px]",children:"pickup"===eE||"dinein"===eE?Number(null==G?void 0:null===(y=G.branch)||void 0===y?void 0:y.pickup_time_estimate)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{style:{color:"initial"},children:"⏱️"}),"".concat(Number(G.branch.pickup_time_estimate)," - ").concat(Number(G.branch.pickup_time_estimate)+10," ").concat(I("time_unit_min"))]}):null:"delivery"===eE?X?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{style:{color:"initial"},children:"⏱️"}),"".concat(Number(null==X?void 0:X.delivery_time_estimate)," - ").concat(Number(null==X?void 0:X.delivery_time_estimate)+10," ").concat(I("time_unit_min"))]}):null:Number(null==Z?void 0:null===(b=Z[0])||void 0===b?void 0:b.pickup_time_estimate)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{style:{color:"initial"},children:"⏱️"}),"".concat(Number(null==Z?void 0:null===(x=Z[0])||void 0===x?void 0:x.pickup_time_estimate)," - ").concat(Number(null==Z?void 0:null===(S=Z[0])||void 0===S?void 0:S.pickup_time_estimate)+10," ").concat(I("time_unit_min"))]}):null}),"delivery"!==eE&&(0,a.jsx)("span",{className:"text-gray-400 mx-2 select-none",children:"|"}),"delivery"!==eE&&(0,a.jsx)("span",{className:"text-xs font-semibold px-2.5 py-0.5 rounded-full ".concat(Q?"bg-green-50 text-green-600 border border-green-200":"border"),style:Q?{fontFamily:"".concat(A,", sans-serif")}:{backgroundColor:"".concat(F,"18"),borderColor:F,color:F,fontFamily:"".concat(A,", sans-serif")},children:Q?I("open"):I("closed")}),"delivery"!==eE&&(0,a.jsx)("span",{className:"text-gray-400 mx-2 select-none",children:"|"}),"delivery"!==eE&&(0,a.jsx)("div",{className:"flex-1 flex justify-end",children:"pickup"===eE||"dinein"===eE?(0,a.jsx)(R,{timingData:G?null==G?void 0:G.branch:[],primaryColor:O,secondaryColor:E,fontFamily:A,bgColor:P,ErrorPrimaryColor:F}):(0,a.jsx)(R,{timingData:en,primaryColor:O,secondaryColor:E,fontFamily:A,bgColor:P,ErrorPrimaryColor:F})})]})]});let eM=null;if("pickup"===eE||"dinein"===eE){let e=Number(null==G?void 0:null===(w=G.branch)||void 0===w?void 0:w.pickup_time_estimate);eM=(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",style:{color:O,fontFamily:"".concat(A,", sans-serif")},children:[(0,a.jsx)("span",{className:"leading-none",style:{color:"initial"},children:"⏱️"}),"".concat(e," - ").concat(e+10," ").concat(I("time_unit_min"))]})}else if("delivery"===eE&&X){let e=Number(null==X?void 0:X.delivery_time_estimate);eM=(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",style:{color:O,fontFamily:"".concat(A,", sans-serif")},children:[(0,a.jsx)("span",{className:"leading-none",style:{color:"initial"},children:"⏱️"}),"".concat(e," - ").concat(e+10," ").concat(I("time_unit_min"))]})}else if(!eE){let e=Number(null==Z?void 0:null===(k=Z[0])||void 0===k?void 0:k.pickup_time_estimate);eM=(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",style:{color:O,fontFamily:"".concat(A,", sans-serif")},children:[(0,a.jsx)("span",{className:"leading-none",style:{color:"initial"},children:"⏱️"}),"".concat(e," - ").concat(e+10," ").concat(I("time_unit_min"))]})}let eD="delivery"!==eE?(0,a.jsx)("span",{className:"text-sm font-semibold px-3 py-1 rounded-full ".concat(Q?"bg-green-50 text-green-600 border border-green-200":"border"),style:Q?{fontFamily:"".concat(A,", sans-serif")}:{backgroundColor:"".concat(F,"18"),borderColor:F,color:F,fontFamily:"".concat(A,", sans-serif")},children:Q?I("open"):I("closed")}):null,eT="pickup"===eE||"dinein"===eE?null!==(j=null==G?void 0:G.branch)&&void 0!==j?j:[]:null==Z?void 0:Z[0];return(0,a.jsx)("div",{className:"flex justify-center border-b border-[#A4A4A4]",children:(0,a.jsxs)("div",{className:"lg:flex items-stretch min-w-[1024px] my-1 w-fit max-w-[1440px] hidden",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 px-5 py-2 flex-shrink-0 rounded-full my-1.5 ml-2",style:{backgroundColor:E},children:[(0,a.jsx)(D.A,{mode:"delivery"===eE?"delivery":"dinein"===eE?"dinein":"pickup",isActive:!0,activeColor:"white",className:"!mr-0 flex-shrink-0"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-white font-bold text-sm leading-tight",style:{fontFamily:"".concat(A,", sans-serif")},children:eP}),(0,a.jsxs)("div",{className:"text-white font-semibold text-xs mt-0.5 flex items-center gap-1",style:{fontFamily:"".concat(A,", sans-serif")},children:[(0,a.jsx)(M,{className:"h-3 w-3 flex-shrink-0"}),(0,a.jsxs)("span",{className:"truncate",children:[N,"dinein"!==eE&&" \xb7 ".concat(eF)]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center flex-1 justify-between divide-x divide-[#A4A4A4]",children:[(0,a.jsx)("div",{className:"flex items-center justify-center px-6",children:null!=eM?eM:(0,a.jsx)("span",{})}),"delivery"===eE&&(()=>{var e,t;let o=null==ek?void 0:null===(t=ek.data)||void 0===t?void 0:null===(e=t.Charges_details)||void 0===e?void 0:e.minimum_order_amount;return null!=o?(0,a.jsxs)("div",{className:"flex items-center gap-2 px-6",
1style:{color:O,fontFamily:"".concat(A,", sans-serif")},children:[(0,a.jsx)("span",{className:"text-lg leading-none",style:{color:"initial"},children:"\uD83D\uDCB0"}),(0,a.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,a.jsx)("span",{className:"text-[11px] text-gray-400 uppercase tracking-wide leading-tight",children:I("minimum_order")}),(0,a.jsxs)("span",{className:"text-sm font-semibold leading-tight",children:[eO,o]})]})]}):null})(),"delivery"===eE&&(null==eA?void 0:null===(o=eA.ecom_settings)||void 0===o?void 0:null===(t=o.general_settings)||void 0===t?void 0:t.ecom_display_deliverypartner)==1&&eC&&Object.keys(eC).length>0&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-6",style:{color:O,fontFamily:"".concat(A,", sans-serif")},children:[(0,a.jsx)("span",{className:"text-lg leading-none",style:{color:"initial"},children:"\uD83D\uDEF5"}),(0,a.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,a.jsx)("span",{className:"text-[11px] text-gray-400 uppercase tracking-wide leading-tight",children:I("delivered_by")}),(0,a.jsx)("span",{className:"text-sm font-semibold leading-tight",children:Array.isArray(eC.delivery_partners)?eC.delivery_partners.map(e=>e.partner_name).join(" / "):eC.partner_name||""})]})]}),"delivery"!==eE&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex items-center justify-center px-6",children:null!=eD?eD:(0,a.jsx)("span",{})}),(0,a.jsx)("div",{className:"flex items-center justify-center px-6",children:"delivery"!==eE?(0,a.jsx)(L,{timingData:eT,fontFamily:A,secondaryColor:E,primaryColor:O,bgColor:P,ErrorPrimaryColor:F}):(0,a.jsx)("span",{})})]}),(0,a.jsx)("div",{className:"flex items-center justify-center px-6",children:(0,a.jsx)(J,{type:"secondary",text:I("change"),onClick:()=>$()&&et(!0)})})]}),(0,a.jsx)(B,{setAddress:()=>ei(""),open:ee,setOpen:et,setCheckItemurl:eN,children:ee&&(0,a.jsxs)("div",{style:{borderColor:E},className:"flex h-[600px] border-2",children:[(0,a.jsx)("div",{className:"w-auto",children:(0,a.jsx)("div",{className:"w-[100%] sm:w-[600px] xl:w-[750px] mx-auto h-[100%]",children:(0,a.jsx)(q,{mapContainerStyle:es,center:ed||ec,zoom:10,onLoad:eu,onClick:em,children:ed&&(0,a.jsx)(Y,{position:ed})})})}),(0,a.jsx)("div",{className:"w-[600px] overflow-y-auto custom-scrollbar",style:{"--scrollbar-thumb-color":E},children:(0,a.jsx)(T.A,{localalias:"".concat(ef),searchAddress:ev,setSearchAddress:ei,map:e_,marker:ed,setMarker:eg,handleLocationSelect:ep,autocompleteRef:eh,getPickupBranches:ey,getClickedBranchId:eb,setIsOpen:et,restaurantSettingsServer:ex,triggerError:()=>eS(I("we_do_not_deliver")),login:localStorage.getItem("loggedin_".concat(ef)),setOpenLoginModal:ew,schedulesetting:null==ek?void 0:ek.data,validateCartItemsAgainstMenu:"",setIsCartUpdated:"",setSaveCartCal:"",setTaxDetails:"",setCartItemDetails:"",cartpagevalidate:"",saveCartCal:"",checkItemurl:ej,setCheckItemurl:eN,onRequestLocationSort:eI})})]})})]})})};var H=o(18987),U=o(15837);let W=async function(e,t,o){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",n=arguments.length>6?arguments[6]:void 0,i=arguments.length>7?arguments[7]:void 0,s=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,d=arguments.length>9?arguments[9]:void 0,c=(0,h.z)(),u="https://order.foodbot.ai/apiv2";d&&(u=d+"apiv2");let m={restaurant_id:e,branch_id:t,order_type:o,phone_number:a,member_id:r,is_redeem:s,session_id:n,version:i,source:"EcomV2",ui_request_timestamp:new Date().toISOString(),lang:l};console.log("Offer API requestBody",m),console.log("Offer API basePath",u);let _=JSON.stringify(m);try{let e=await fetch("".concat(u,"/ecom/v1/offers"),{method:"POST",headers:c,body:_,redirect:"follow"});if(!e.ok)throw console.log("Offer API error",e),Error("HTTP error! status: ".concat(e.status));let t=await e.json();return console.log("Offer API response",t),t}catch(e){throw console.error("Offer API error:",e),e}};var V=o(57185),K=o(96438),Z=o(11962);let Q=(e,t)=>{let o=e.scrollTop;e.clientHeight;let a=o+e.clientHeight/2,r=null,l=1/0;
1return t.forEach(e=>{let t=e.getBoundingClientRect(),o=Math.abs(a-(t.top+t.height/2));o<l&&(l=o,r=e)}),r.getAttribute("data-category")||null},X=(e,t,o)=>{let a=(0,_.useCallback)(()=>{if(!e.current||!t.current)return;let a=Q(e.current,t.current);a&&o(a)},[e,t,o]);(0,_.useEffect)(()=>{let t=e.current;if(t)return t.addEventListener("scroll",a),a(),()=>{t.removeEventListener("scroll",a)}},[a,e])};var $=o(37644),ee=o(72124),et=o(52790),eo=o(78885);function ea(e){let{primaryColor:t,secondaryColor:o,bgColor:r,descriptionColor:l,fontFamily:n,ErrorPrimaryColor:i,heading:s,subheading:d,ErrorSecondaryColor:c}=e;return(0,a.jsx)("div",{className:"flex h-screen flex-col items-center justify-center px-4 pb-10",style:{backgroundColor:r},children:(0,a.jsxs)("div",{className:"max-w-md text-center mb-[150px]",children:[(0,a.jsx)("div",{style:{backgroundColor:t,borderRadius:"50%",width:"200px",height:"200px"},className:"mb-8 flex items-center justify-center mx-auto",children:(0,a.jsx)(eo.Ztl,{className:"h-28 w-28",color:o})}),(0,a.jsx)("h1",{className:"mb-3 text-3xl font-bold tracking-tight",style:{color:t,fontFamily:"".concat(n,", sans-serif")},children:s}),(0,a.jsx)("p",{className:"mb-8",style:{color:l,fontFamily:"".concat(n,", sans-serif")},children:d})]})})}let er={primary_text_color:"#000000",secondary_text_color:"#FFCD00",secondary_button_color:"#FFCD00",secondary_button_text_color:"#000000",highlight_text_color:"#FFFFFF",font_family:"sans-serif",primary_description_color:"#000000",background_color:"#FFFFFF",highlight_bg_color:"#FF0000",error_primary_color:"#FF0000",error_secondary_color:"#FFFFFF",menu_category_color:"#FFFFFF",primary_button_color:"#000000",primary_button_text_color:"#FFCD00",selectionLimit_text_color:"#000000",item_goback_button_text_color:"#000000",item_goback_button_color:"#FFCD00"},el=e=>({primaryColor:(null==e?void 0:e.primaryColor)||er.primary_text_color,secondaryColor:(null==e?void 0:e.secondaryColor)||er.secondary_text_color,secondaryBtnColor:(null==e?void 0:e.secondaryBtnColor)||er.secondary_button_color,secondaryBtnTxtColor:(null==e?void 0:e.secondaryBtnTxtColor)||er.secondary_button_text_color,highlightTextColor:(null==e?void 0:e.highlightTextColor)||er.highlight_text_color,fontFamily:(null==e?void 0:e.fontFamily)||er.font_family,descriptionColor:(null==e?void 0:e.descriptionColor)||er.primary_description_color,bgColor:(null==e?void 0:e.bgColor)||er.background_color,highlightbgColor:(null==e?void 0:e.highlightbgColor)||er.highlight_bg_color,ErrorPrimaryColor:(null==e?void 0:e.ErrorPrimaryColor)||er.error_primary_color,ErrorSecondaryColor:(null==e?void 0:e.ErrorSecondaryColor)||er.error_secondary_color,MenuCategoryColor:(null==e?void 0:e.MenuCategoryColor)||er.menu_category_color,primaryBtnColor:(null==e?void 0:e.primaryBtnColor)||er.primary_button_color,primaryBtnTxtColor:(null==e?void 0:e.primaryBtnTxtColor)||er.primary_button_text_color,selectionLimit_text_color:(null==e?void 0:e.selectionLimit_text_color)||er.selectionLimit_text_color,item_goback_button_color:(null==e?void 0:e.item_goback_button_color)||er.item_goback_button_color,item_goback_button_text_color:(null==e?void 0:e.item_goback_button_text_color)||er.item_goback_button_text_color});var en=o(24663);let ei=0;function es(e){let t=Date.now();t-ei>1e4?(window.history.replaceState(null,"",e),ei=t):console.warn("Skipped replaceState due to throttle")}var ed=o(82699),ec=o(75538),eu=o(18256);I().extend(O()),I().extend(E());let em=e=>{let{timingData:t,fontFamily:o,primaryColor:r,ErrorPrimaryColor:l}=e,{t:n}=(0,g.Bd)(),[i,s]=(0,_.useState)("");return((0,_.useEffect)(()=>{let e=null==t?void 0:t.timezone,o=null==t?void 0:t.branch_business_hours;if(!e||!o)return;if(o.every(e=>0===e.status)){s(n("we_are_not_available_until_further_notice"));return}let a=I()().tz(e).day(),r=o.find(e=>parseInt(e.day)===a);(null==r?void 0:r.status)===0&&s(n("we_are_not_available_right_now_but_will_be_back_soon"))},[t,n]),i)?(0,a.jsx)("div",{style:{fontFamily:"".concat(o,", sans-serif"),color:l,border:"1px solid ".concat(l),backgroundColor:"#FFF3F3",padding:"12px 16px",borderRadius:"8px",margin:"1rem ",textAlign:"center"},children:(0,a.jsx)("p",{style:{color:l},children:i})}):null},e_=(0,o(73943).A)("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);var eg=o(72635);let ev=e=>{let{primaryColor:t,secondaryColor:o,fontFamily:r,onClick:l}=e,i=(0,m.useRouter)();return(0,a.jsxs)("button",{onClick:()=>
1{if(l)l();else{let e=(0,n.o)();i.push("/".concat(e,"/myorders"))}},style:{fontFamily:r,background:"linear-gradient(60deg, #FFFFFF, ".concat(o,")"),boxShadow:"0 0 10px ".concat(t,", 0 0 5px ").concat(t,"50")},className:"flex items-center gap-2 rounded-full shadow-lg hover:shadow-2xl transform transition-all duration-300 hover:scale-105 px-3 py-4 animate-bounce [animation-duration:2s] sm:px-5 sm:gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-0.5 sm:gap-1",children:[(0,a.jsx)("span",{className:"block w-2 h-0.5 sm:w-3 sm:h-0.5 rounded animate-pulse",style:{backgroundColor:t}}),(0,a.jsx)("span",{className:"block w-3 h-0.5 sm:w-4 sm:h-0.5 rounded animate-pulse delay-75",style:{backgroundColor:t}}),(0,a.jsx)("span",{className:"block w-1.5 h-0.5 sm:w-2 sm:h-0.5 rounded animate-pulse delay-150",style:{backgroundColor:t}})]}),(0,a.jsx)(e_,{className:"w-4 h-4 sm:w-6 sm:h-6 transition-transform duration-300 hover:translate-x-1",style:{color:t}}),(0,a.jsx)("span",{className:"text-xs sm:text-sm md:text-base font-semibold",style:{color:t},children:(0,eg.t)("Track Order")})]})};var ep=o(42422),eh=o(53336),ef=o(95891),ey=o(56981),eb=o(18491);let ex=e=>{let t=new Map,o=new Map;for(let a of e){let e=a.menu_id||"";for(let r of a.menu_category||[]){let a=String(r.category_id||"");for(let l of r.cat_items||[]){let r={...l,menu_id:e};t.set("".concat(String(l.item_id),"|").concat(a),r),o.has(String(l.item_id))||o.set(String(l.item_id),r)}}}return(e,a)=>{var r;return null!==(r=t.get("".concat(e,"|").concat(a)))&&void 0!==r?r:o.get(e)}},eS=(e,t,o)=>{var a,r,l,n,i;let s=null==t?void 0:null===(a=t.cat_items_modifiercat)||void 0===a?void 0:a.find(t=>String(t.modifier_category_id)===String(e.modifier_category_id)),d=null==s?void 0:null===(r=s.cat_items_modifiercat_modifieritems)||void 0===r?void 0:r.find(t=>String(t.modifier_item_id)===String(e.modifier_item_id)),c=null!==(l=null==d?void 0:d.modifer_category_sequence)&&void 0!==l?l:0,u=null!==(n=null==d?void 0:d.modifiersequence)&&void 0!==n?n:0;return{modifer_cat:e.modifier_category_id,modifier_category_id:e.modifier_category_id,modifier_caetgory_name:(null==s?void 0:s.display_text)||e.modifier_category||"",modifier_item_id:e.modifier_item_id||"",modifier_sequence:"".concat(c).concat(u),modifier_item_price:parseFloat(null==d?void 0:d.price)||parseFloat(e.modifier_cost)||0,modifier_item_name:(null==d?void 0:d.modifier_item_name)||e.modifier_item_name||"",modifier_item_name_v1:null==d?void 0:d.modifier_item_name_v1,is_tax_rate_same:null!==(i=null==d?void 0:d.is_tax_rate_same)&&void 0!==i?i:1,ieps_tax:(null==d?void 0:d.ieps_tax)||null,tax_rate:(null==d?void 0:d.tax_rate)||0,quantity:e.quantity||1,item_id:o,tax_id:(null==t?void 0:t.tax_id)||[],modifier_trx_id:(0,ey.NF)(),linked_product:(null==d?void 0:d.linked_product)||"",price_list_id:(null==d?void 0:d.price_list_id)||""}},ew=(e,t)=>{let o=1===e.is_package||Array.isArray(e.package_items)&&e.package_items.length>0,a="".concat(e.item_id,"_callin_").concat(e.order_details_id||Date.now());if(o){let o=(e.modifiers||[]).map(o=>eS(o,t,e.item_id)),r=(e.package_items||[]).map(e=>({...e,promotion_discount:0,promotion_discount_modifier:0})),l=r.reduce((e,t)=>e+(t.modifiers||[]).reduce((e,t)=>e+(parseFloat(t.modifier_item_price)||0)*(t.quantity||1),0),0);return{disabled_item:(null==t?void 0:t.disabled_item)||!1,menu_id:(null==t?void 0:t.menu_id)||0,item_id:e.item_id,item_image:(null==t?void 0:t.item_image)||e.item_image||"",category_id:(null==t?void 0:t.category_id)||e.category_id,quantity:e.quantity||1,item_display_text:(null==t?void 0:t.item_name)||e.item_display_text||"",item_display_text_v1:null==t?void 0:t.item_display_text_v1,item_description_v1:null==t?void 0:t.item_description_v1,item_name:(null==t?void 0:t.item_name)||e.item_display_text||"",tax_rate:parseFloat(null==t?void 0:t.tax_rate)||0,item_modifiers:o,isPackage:1,package_items:r,actual_price:parseFloat(null==t?void 0:t.price)||0,item_event:"new",tax_id:(null==t?void 0:t.tax_id)||[],tax_array:(null==t?void 0:t.tax_array)||[],promotion_discount:0,promotion_discount_modifier:0,special_instruction:e.special_instruction||"",item_price:parseFloat(null==t?void 0:t.price)||0,item_price_with_modifier:parseFloat(((parseFloat(null==t?void 0:t.price)||0)+l).toFixed(2)),item_trx_id:(0,ey.NF)(),item_key:a}}let r=(e.modifiers||[]).map(o=>eS(o,t,e.item_id)),l=r.reduce((e,t)=>
1e+(t.modifier_item_price||0)*(t.quantity||1),0),n=parseFloat(((parseFloat(null==t?void 0:t.price)||0)+l).toFixed(2));return{menu_id:(null==t?void 0:t.menu_id)||0,item_id:e.item_id,item_image:(null==t?void 0:t.item_image)||e.item_image||"",category_id:(null==t?void 0:t.category_id)||e.category_id,item_price:parseFloat(null==t?void 0:t.price)||0,item_price_with_modifier:n,quantity:e.quantity||1,item_modifiers:r,item_display_text:(null==t?void 0:t.item_name)||e.item_display_text||"",item_display_text_v1:null==t?void 0:t.item_display_text_v1,item_description_v1:null==t?void 0:t.item_description_v1,item_name:(null==t?void 0:t.item_name)||e.item_display_text||"",tax_rate:parseFloat(null==t?void 0:t.tax_rate)||0,isPackage:0,package_items:[],actual_price:(null==t?void 0:t.price)||0,item_event:"new",tax_id:(null==t?void 0:t.tax_id)||[],ieps_tax:(null==t?void 0:t.ieps_tax)||{},special_instruction:e.special_instruction||"",item_key:a,item_trx_id:(0,ey.NF)(1),promotion_discount:0,promotion_discount_modifier:0}},ek=async(e,t)=>{var o,a,r,l,i,s,d,c,u,m,_,g,v,f,S,w,k,j,N,I,C,O,A,E,P,F,M,D,T,J,B,L,R,z,q,Y,G,U,V,K;let Z;let{router:Q,props:X,resturantsettings:$,sessionId:ee,version:et,currentDomain:eo,setChangeModeBranchId:ea,setGetBranchMenu:er,setGetUpsellingMenu:el,setPaymentMethod:ei,setCurrentBranch:es,setRestaurantOpen:ed,setProfileCheckdata:ec,setLoginBooleans:eu,setBtnLoading:em,openFailureModalFunc:e_}=t,eg=(0,n.o)($,X.restaurant_settings),ev=(0,h.z)(),ep="".concat(window.location.origin,"/"),eS="https://order.foodbot.ai/apiv2";ep&&(eS=ep+"apiv2");let ek=(null===(a=X.restaurant_settings)||void 0===a?void 0:null===(o=a.data)||void 0===o?void 0:o.restaurant_id)||"",ej=(null==$?void 0:$.bot_language)||(null===(l=X.restaurant_settings)||void 0===l?void 0:null===(r=l.data)||void 0===r?void 0:r.bot_language)||"es",eN=JSON.stringify({order_id:Number(e),restaurant_id:Number(ek),channel_id:1,source:"callin",lang:ej});try{let e=await fetch("".concat("https://api-prod.foodbot.ai","/callin/v1/get-call-in-order-details"),{method:"POST",headers:{"Content-Type":"application/json"},body:eN,redirect:"follow"}),t=await e.json();if((null==t?void 0:t.status)!=="success"&&(null==t?void 0:t.code)!=="SUCCESS"||!(null==t?void 0:t.data)){e_((null==t?void 0:t.message)||"Call-in order not found");return}Z=t.data,console.log("[callin] STEP 1 — callin order API response:",Z)}catch(e){console.error("checkCallInOrder: order fetch failed",e),e_("Something went wrong loading the call-in order");return}let eI=Z.branch_id,eC=(0,ef.oM)(Z.order_type,Z.order_type_label),eO=((null===(s=X.pickupbranches)||void 0===s?void 0:null===(i=s.data)||void 0===i?void 0:i.branches_data)||[]).find(e=>e.branch_id===eI);eO||(eO={branch_id:eI,branch_latitude:0,branch_longitude:0});let eA=eO;if("delivery"===eC){let e={latitude:Z.latitude,longitude:Z.longitude,formatted_address:Z.formatted_address||"",unit_number:Z.unit_number||"",address_type:Z.address_type||"",address_label:Z.address_label||"",external_number:Z.external_number||"",zipcode:Z.zipcode||"",street:Z.street||"",city:Z.city||"",state:Z.state||"",country:Z.country||"",delivery_instruction:Z.delivery_instruction||""},t={branch_id:eO.branch_id,branch_latitude:eO.branch_latitude||0,branch_longitude:eO.branch_longitude||0};localStorage.setItem("branch_delivery_".concat(eg),JSON.stringify(t)),H.A.set("branch_delivery_".concat(eg),JSON.stringify({branch:t}),{sameSite:"None",secure:!0,expires:7}),eA=e}let eE=(Z.customer_name||"").trim().split(/\s+/),eP=eE[0]||"",eF=eE.slice(1).join(" ")||"",eM=JSON.stringify({restaurant_id:ek,phone_number:Z.phone_number||"",user_name:Z.customer_name||"",first_name:eP,last_name:eF,country_code:Z.country_code||"",email:"",dob:"",utm_campaign:"",utm_source:"",http_referrer:"",lang:ej,source:"callin",session_id:ee,version:et,request_timestamp:new Date().toISOString()}),[,eD]=await Promise.allSettled([(0,x.x)(eA,eC,ek,ej,Q,X,ea,er,el,ei,es,e=>(0,y.YA)(e,ed),p._,b.d,null,ee,et,!0,eg,eo,e_,"callin"),fetch("".concat(eS,"/ecom/v1/profilecheck"),{method:"POST",headers:ev,body:eM,redirect:"follow"}).then(e=>e.json())]),eT={member_id:Z.callin_user_id||0,user_name:Z.customer_name||"",first_name:eP,last_name:eF,phone_number:Z.phone_number||"",mobile_number:Z.phone_number||"",email:"",country_code:Z.c
1ountry_code||""};"fulfilled"===eD.status&&(null===(d=eD.value)||void 0===d?void 0:d.status)==="success"&&(null===(c=eD.value)||void 0===c?void 0:c.data)&&(eT=eD.value.data),localStorage.setItem("profile_check_".concat(eg),JSON.stringify(eT)),localStorage.setItem("loggedin_".concat(eg),"true"),H.A.set("loggedin_".concat(eg),"true"),ec(eT),eu(!0);let eJ=ex(await (0,en.KR)("branchMenuDetail_".concat(eg))||[]),eB=((null==Z?void 0:Z.order_items)||[]).map(e=>{let t=eJ(String(e.item_id),String(e.category_id||""));return ew(e,t)});if(0===eB.length){e_("No items found in the call-in order");return}localStorage.setItem("cartItemDetails_".concat(eg),JSON.stringify(eB)),console.log("[callin] STEP 6 — cartItems built from menu:",eB);let eL=Z.redeem_promotion_id&&""!==String(Z.redeem_promotion_id)&&"0"!==String(Z.redeem_promotion_id),eR=parseFloat(Z.points_redeemed)||0,ez=eR>0;localStorage.removeItem("offer_details_".concat(eg)),localStorage.removeItem("callin_use_points_".concat(eg));let eq=null;if(eL||ez){let e=Z.phone_number||"",t=String((null==eT?void 0:eT.member_id)||Z.callin_user_id||"");try{let o=await W(String(ek),String(eI),"pickup"===eC?"takeout":eC,e,t,ej,ee,et,1,ep);if(console.log("[callin] STEP 6b — offers API response:",null==o?void 0:o.status_code),(null==o?void 0:null===(N=o.data)||void 0===N?void 0:N.loyalty_points_details)&&localStorage.setItem("loyalty_points_details_".concat(eg),JSON.stringify(o.data.loyalty_points_details)),(null==o?void 0:null===(I=o.data)||void 0===I?void 0:I.loyalty_plan_details)&&localStorage.setItem("loyalty_plan_details_".concat(eg),JSON.stringify(o.data.loyalty_plan_details)),eL){let e=((null==o?void 0:o.status_code)=="200"||(null==o?void 0:o.status_code)=="204")&&(null==o?void 0:null===(O=o.data)||void 0===O?void 0:null===(C=O.offer_details)||void 0===C?void 0:C.length)>0?o.data.offer_details:[];if(e.length>0){let t=Z.offer_id||Z.redeem_promotion_id||Z.redeemed_offer_id||Z.promotion_id||null,o=null;if(t&&"0"!==String(t)&&(o=e.find(e=>String(e.offer_id)===String(t))||null,console.log("[callin:offer] S1 id:",t,"→",null!==(A=null==o?void 0:o.offer_id)&&void 0!==A?A:"no match")),!o&&Z.en_id&&""!==String(Z.en_id)&&(o=e.find(e=>String(e.en_id)===String(Z.en_id))||null,console.log("[callin:offer] S2 en_id:",Z.en_id,"→",null!==(E=null==o?void 0:o.offer_id)&&void 0!==E?E:"no match")),o||(o=e.find(e=>3===e.oo_status&&e.en_id)||null,console.log("[callin:offer] S3 oo_status=3+en_id →",null!==(P=null==o?void 0:o.offer_id)&&void 0!==P?P:"no match")),!o){let t=parseFloat(Z.discount)||0;o=e.find(e=>parseFloat(e.oo_offer_value)===t)||null,console.log("[callin:offer] S4 value match →",null!==(F=null==o?void 0:o.offer_id)&&void 0!==F?F:"no match")}o?(localStorage.setItem("offer_details_".concat(eg),JSON.stringify(o)),window.dispatchEvent(new Event("promotionUpdated")),eq=o,console.log("[callin:offer] offer applied:",o.offer_id)):console.warn("[callin:offer] no matching offer found")}}}catch(e){console.error("[callin:offer] offers API error:",e)}}let eY=((null==$?void 0:null===(u=$.ecom_settings)||void 0===u?void 0:u.taxes)||(null===(g=X.restaurant_settings)||void 0===g?void 0:null===(_=g.data)||void 0===_?void 0:null===(m=_.ecom_settings)||void 0===m?void 0:m.taxes)||[]).map(e=>({...e,tax_rate:parseFloat(e.tax_rate)||0})),eG=(null==$?void 0:$.tax_type)||(null===(f=X.restaurant_settings)||void 0===f?void 0:null===(v=f.data)||void 0===v?void 0:v.tax_type)||2,eH=(()=>{try{return JSON.parse(localStorage.getItem("payment_method_".concat(eg))||"null")}catch(e){return null}})(),eU=localStorage.getItem("request_id_".concat(eg));eU||(eU=(0,ey.NF)(2),localStorage.setItem("request_id_".concat(eg),eU));let eW={};if(ez){let e=(()=>{try{return JSON.parse(localStorage.getItem("loyalty_points_details_".concat(eg))||"null")}catch(e){return null}})(),t=(()=>{try{return JSON.parse(localStorage.getItem("loyalty_plan_details_".concat(eg))||"null")}catch(e){return null}})();if(e){let o=Number(null!==(Y=null!==(q=null==$?void 0:null===(D=$.ecom_settings)||void 0===D?void 0:null===(M=D.general_settings)||void 0===M?void 0:M.enable_delivery_points_usage)&&void 0!==q?q:null===(L=X.restaurant_settings)||void 0===L?void 0:null===(B=L.data)||void 0===B?void 0:null===(J=B.ecom_settings)||void 0===J?void 0:null===(T=J.general_settings)||void 0===T?void 0:T.enable_delivery_points_usage)&&void 0!==Y?Y:0),a=eB.reduce((e,t)=>
1e+(parseFloat(t.item_price_with_modifier)||0)*(t.quantity||1),0),r=(null==eH?void 0:null===(z=eH.data)||void 0===z?void 0:null===(R=z.Charges_details)||void 0===R?void 0:R.delivery_charges)||parseFloat(Z.delivery_charges)||0,l=a;1===o&&r&&(l+=Number(r));let n=Number(e.store_value)||0,i=n&&e.points?n/Number(e.points):1,s=n>=l?l:Math.min(eR*i,n),d=s>0?Math.min(Number(e.points),Math.ceil(s/i)):0;eW={store_value:s,store_value_without_roundoff:n,loyalty_points_details:{points:Number(e.points),redeemable:e.redeemable,store_value:s,redeem_categories:e.redeem_categories||[],original_store_value:n,status:!0,points_redeemed:d,show_purchase:!1,point_amount:s,full_redemption:s>=a,enable_delivery_points_usage:o,enable_service_charge_usage:1},user_detais:{member_id:null==eT?void 0:eT.member_id,first_name:null==eT?void 0:eT.first_name,last_name:null==eT?void 0:eT.last_name,phone_number:(null==eT?void 0:eT.mobile_number)||(null==eT?void 0:eT.phone_number),country_code:null==eT?void 0:eT.country_code,created_on:new Date().toISOString(),reward_plan_name:null!==(G=null==t?void 0:t.plan_name)&&void 0!==G?G:null,reward_plan_id:null!==(U=null==t?void 0:t.plan_id)&&void 0!==U?U:null,calling_code:null==eT?void 0:eT.country_code,name:(null==eT?void 0:eT.user_name)||"".concat((null==eT?void 0:eT.first_name)||""," ").concat((null==eT?void 0:eT.last_name)||"").trim(),mobile:(null==eT?void 0:eT.mobile_number)||(null==eT?void 0:eT.phone_number)}}}}console.log("[callin] STEP 6c — points debug:",{hasPoints:ez,pointsRedeemedCount:eR,loyaltyPointsDataRaw:(()=>{try{return JSON.parse(localStorage.getItem("loyalty_points_details_".concat(eg))||"null")}catch(e){return null}})(),pointsPayloadKeys:Object.keys(eW),pointsPayload:eW});let eV={order_type:eC,request_id:eU,restaurant_id:ek,brand_id:(null==$?void 0:$.brand_id)||(null===(w=X.restaurant_settings)||void 0===w?void 0:null===(S=w.data)||void 0===S?void 0:S.brand_id)||"",branch_id:eI,order_items:{item_details:eB.map(e=>{var t,o;let{item_display_text_v1:a,item_description_v1:r,...l}=e;return{...l,item_modifiers:null!==(o=null===(t=l.item_modifiers)||void 0===t?void 0:t.map(e=>{let{modifier_item_name_v1:t,...o}=e;return o}))&&void 0!==o?o:l.item_modifiers,points_discount:l.quantity>1?(parseFloat(l.item_price_with_modifier)||0)*l.quantity:parseFloat(l.item_price_with_modifier)||0}})},tax_settings:eY,tip_type:"percentage",tip_value:"0",tip_amount:0,tax_type:eG,delivery_cost:(null==eH?void 0:null===(j=eH.data)||void 0===j?void 0:null===(k=j.Charges_details)||void 0===k?void 0:k.delivery_charges)||parseFloat(Z.delivery_charges)||0,service_amount:0,...Object.keys(eW).length>0?eW:{store_value:0},...eq&&Object.keys(eq).length>0?{promotion_applied:(0,eb.H)(eq)}:{}};console.log("[callin] STEP 6c — calculateTax payload:",JSON.stringify(eV,null,2));try{let e=await (0,eh.calculateTax)(eV);console.log("[callin] STEP 6c — calculateTax response:",JSON.stringify(e,null,2));let t=null!==(V=null==e?void 0:e.data)&&void 0!==V?V:e;t&&"object"==typeof t?(localStorage.setItem("cartData_".concat(eg),JSON.stringify(t)),console.log("[callin] STEP 6c — cartData_ saved:",t)):console.warn("[callin] STEP 6c — calculateTax unexpected response:",e)}catch(e){console.error("checkCallInOrder: calculateTax failed",e)}if(1===Z.is_scheduled_order&&Z.scheduled_date&&Z.scheduled_time){let e={date:Z.scheduled_date,time:Z.scheduled_time,branch:eO,mode:eC};localStorage.setItem("scheduledOrder_".concat(eg),JSON.stringify(e)),localStorage.setItem("current_scheduledOrder__".concat(eg),"true")}localStorage.setItem("callin_order_".concat(eg),JSON.stringify({order_id:Z.order_id,branch_id:eI,payment_method_id:Z.payment_method_id,channel_id:null!==(K=Z.channel_id)&&void 0!==K?K:1,callin_user_id:Z.callin_user_id,expires_at:Date.now()+108e5})),console.log("[callin] FINAL localStorage state —"),console.log("  cartItemDetails_:",localStorage.getItem("cartItemDetails_".concat(eg))),console.log("  offer_details_:",localStorage.getItem("offer_details_".concat(eg))),console.log("  cartData_:",localStorage.getItem("cartData_".concat(eg))),console.log("  callin_order_:",localStorage.getItem("callin_order_".concat(eg))),ez&&Object.keys(eW).length>0&&localStorage.setItem("callin_use_points_".concat(eg),"true"),(0,ef.e5)(eg),localStorage.setItem("callin_open_payment","true"),em(!0),Q.push("/".concat(eg,"/cart"))};var ej=o(69634);I().extend(O()),I().extend(E()),w()(()=>o.e(6635).then(o.bind(o,66635)),{loadableGenerated:{webpack:()=>[66635]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})}),ssr:!1});let eN=w()(()=>Promise.all([o.e(4861),o.e(3659)]).then(o.bind(o,43659)),{loadableGenerated:{webpack:()=>[43659]},loading:()=>(0,a.jsxs)("div",{className:"h-[300px] w-[200px]",children:[(0,a.jsx)(v.A,{height:167,width:200}),(0,a.jsx)(v.A,{count:3})]}),ssr:!1}),eI=w()(()=>o.e(1756).then(o.bind(o,81756)),{loadableGenerated:{webpack:()=>[81756]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})}),ssr:!1});w()(()=>Promise.all([o.e(7348),o.e(1430),o.e(4743),o.e(3423),o.e(1764),o.e(6721)]).then(o.bind(o,6721)),{loadableGenerated:{webpack:()=>[6721]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})}),ssr:!1});let eC=w()(()=>o.e(1245).then(o.bind(o,21245)),{loadableGenerated:{webpack:()=>[21245]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})}),ssr:!1}),eO=w()(()=>Promise.all([o.e(1430),o.e(9861),o.e(8975)]).then(o.bind(o,18975)),{loadableGenerated:{webpack:()=>[18975]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})}),ssr:!1}),eA=w()(()=>Promise.all([o.e(9151),o.e(1430),o.e(9861),o.e(3423),o.e(8886),o.e(1342)]).then(o.bind(o,51342)),{loadableGenerated:{webpack:()=>[51342]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})}),ssr:!1});w()(()=>Promise.resolve().then(o.bind(o,67279)).then(e=>e.GoogleMap),{loadableGenerated:{webpack:()=>[67279]},ssr:!1,loading:()=>(0,a.jsx)(ed.A,{})}),w()(()=>Promise.resolve().then(o.bind(o,67279)).then(e=>e.Marker),{loadableGenerated:{webpack:()=>[67279]},ssr:!1,loading:()=>(0,a.jsx)(ed.A,{})});let eE=w()(()=>Promise.all([o.e(463),o.e(1791),o.e(4743),o.e(6130),o.e(236),o.e(6610),o.e(8774),o.e(518),o.e(6891)]).then(o.bind(o,80518)),{loadableGenerated:{webpack:()=>[80518]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})}),ssr:!1}),eP=w()(()=>o.e(2231).then(o.bind(o,52231)),{loadableGenerated:{webpack:()=>
1[52231]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})}),ssr:!1}),eF=w()(()=>o.e(8179).then(o.bind(o,88179)),{loadableGenerated:{webpack:()=>[88179]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})}),ssr:!1});w()(()=>o.e(3259).then(o.bind(o,43259)),{loadableGenerated:{webpack:()=>[43259]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})}),ssr:!1});let eM=w()(()=>Promise.all([o.e(792),o.e(8563),o.e(1430),o.e(9861),o.e(4743),o.e(6130),o.e(236),o.e(7506),o.e(1459),o.e(2924)]).then(o.bind(o,2924)),{loadableGenerated:{webpack:()=>[2924]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})}),ssr:!1}),eD=w()(()=>Promise.all([o.e(1430),o.e(9861),o.e(9928),o.e(1303)]).then(o.bind(o,89928)),{loadableGenerated:{webpack:()=>[89928]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})}),ssr:!1}),eT=w()(()=>o.e(6305).then(o.bind(o,86305)),{loadableGenerated:{webpack:()=>[86305]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})}),ssr:!1}),eJ=w()(()=>Promise.all([o.e(1430),o.e(9861),o.e(8442)]).then(o.bind(o,98442)),{loadableGenerated:{webpack:()=>[98442]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})}),ssr:!1}),eB=w()(()=>Promise.all([o.e(1430),o.e(9861),o.e(9231)]).then(o.bind(o,39231)),{loadableGenerated:{webpack:()=>[39231]},loading:()=>(0,a.jsx)("p",{children:"Loading Failure Modal..."})});w()(()=>o.e(9178).then(o.bind(o,79178)),{loadableGenerated:{webpack:()=>[79178]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})}),ssr:!1});let eL=w()(()=>Promise.all([o.e(1430),o.e(9861),o.e(7174)]).then(o.bind(o,17174)),{loadableGenerated:{webpack:()=>[17174]},loading:()=>(0,a.jsx)("p",{children:(0,a.jsx)(v.A,{})})});var eR=!0;let ez=e=>{var t,o,c,S,w,N,C,O,A,E,P,M,D,T,J,B,L,R,z,q,Y,Q,eo,er,ei,ed,e_,eg,eh,ef,ey,eb,ex,eS,ew,eR,ez,eq,eY,eG,eH,eU,eW,eV,eK,eZ,eQ,eX,e$,e0,e1,e2,e5,e3,e4,e6,e7,e8,e9,te,tt,to,ta,tr,tl,tn,ti;let[ts,td]=(0,_.useState)(!1),[tc,tu]=(0,_.useState)(!1),[tm,t_]=(0,_.useState)(!1),tg=(0,m.useRouter)(),{t:tv}=(0,g.Bd)(),{currentLang:tp,botLanguage:th}=(0,s.ok)(),[tf,ty]=(0,_.useState)(null),tb=(0,_.useRef)(null),tx=(0,_.useRef)(null);(0,_.useRef)(null);let tS=(0,_.useRef)(!1),tw=(0,_.useRef)(null),tk=(0,_.useRef)(null),tj=(0,_.useContext)(l.ib),[tN,tI]=(0,_.useState)(!1),[tC,tO]=(0,_.useState)({}),[tA,tE]=(0,_.useState)(!1),[tP,tF]=(0,_.useState)(!1),[tM,tD]=(0,_.useState)(""),[tT,tJ]=(0,_.useState)(""),[tB,tL]=(0,_.useState)(""),[tR,tz]=(0,_.useState)(!0),[tq,tY]=(0,_.useState)(null),[tG,tH]=(0,_.useState)(!1),[tU,tW]=(0,_.useState)(""),[tV,tK]=(0,_.useState)(null),tZ=(0,_.useRef)(!1),[tQ,tX]=(0,_.useState)([]),t$=(()=>{var t,o,a;let r=null===(a=e.restaurant_settings)||void 0===a?void 0:null===(o=a.data)||void 0===o?void 0:null===(t=o.ecom_settings)||void 0===t?void 0:t.analytics_settings;return Array.isArray(r)?r:r&&"object"==typeof r?[r]:[]})(),[t0,t1]=(0,_.useState)((null===(t=e.branchMenu)||void 0===t?void 0:t.data)&&(null===(o=e.branchMenu)||void 0===o?void 0:o.data.upselling)?null===(c=e.branchMenu)||void 0===c?void 0:c.data.upselling:[]),t2=(0,n.o)(void 0,e.restaurant_settings);localStorage.setItem("upsellingMenuDetail_".concat(t2),JSON.stringify(t0)),(0,_.useEffect)(()=>{if(null===localStorage.getItem((0,i.bI)(t2))){var t;(0,i.VW)(t2,null===(t=e.branchMenu)||void 0===t?void 0:t.data)}},[]);let[t5,t3]=(0,_.useState)(e.pickupbranches&&(null===(S=e.pickupbranches)||void 0===S?void 0:S.data)?null===(w=e.pickupbranches)||void 0===w?void 0:w.data:[]),t4=(0,_.useMemo)(()=>{var e;return(null==t5?void 0:null===(e=t5.branches_data)||void 0===e?void 0:e.length)>0?t5.branches_data:(null==t5?void 0:t5.dinein_branches)||[]},[t5]),[t6,t7]=(0,_.useState)(null),[t8,t9]=(0,_.useState)(e.paymentMethod&&e.paymentMethod?e.paymentMethod:[]),[oe,ot]=(0,_.useState)(),[oo,oa]=(0,_.useState)(""),[or,ol]=(0,_.useState)({}),[on,oi]=(0,_.useState)(null),[os,od]=(0,_.useState)(!1),[oc,ou]=(0,_.useState)(!1),[om,o_]=(0,_.useState)(null),[og,ov]=(0,_.useState)(!1),op=(null===(N=e.restaurant_settings)||void 0===N?void 0:N.data)&&(null===(A=e.restaurant_settings)||void 0===A?void 0:null===(O=A.data)||void 0===O?void 0:null===(C=O.ecom_settings)||void 0===C?void 0:C.theme_settings)?null===(M=e.restaurant_settings)||void 0===M?void 0:null===(P=M.data)||void 0===P?void 0:null===(E=P.ecom_settings)||void 0===E?void 0:E.theme_settings:[],[oh,of]=(0,_.useState)(!1),[oy,ob]=(0,_.useState)(null),ox=(0,_.useRef)(!1);localStorage.setItem("resturantserversideTheme",JSON.stringify(op)),localStorage.setItem("resturantserversidesettings",JSON.stringify(null===(D=e.restaurant_settings)||void 0===D?void 0:D.data)),localStorage.setItem("HMR_DISABLED","true"),localStorage.setItem("analytics_settings_".concat(t2),JSON.stringify(t$)),localStorage.setItem("getPickupBranches_".concat(t2),JSON.stringify(t5));let oS=()=>"true"===sessionStorage.getItem("isPopupShown"),ow=()=>{oH||oS()||(oG(!0),oU(!0),setTimeout(()=>{sessionStorage.setItem("isPopupShown","true")},1e3))},ok=()=>oG(!1),oj=(0,V.Fe)(window.location.href),{hasUserKey:oN,hasTargetLink:oI,hasTargetLinkRewards:oC,hasPromo:oO,hasRef:oA,hasUtm_campaign:oE,hasOrder:oP,sender_id:oF,hasCart:oM,hasStatus:oD,hastype:oT}=(0,V.zh)(oj),oJ=(0,_.useRef)(oT),oB=localStorage.getItem("selected_branchmode_".concat(t2)),[oL,oR]=(0,_.useState)(""),[oz,oq]=(0,_.useState)([]),[oY,oG]=(0,_.useState)(!1),[oH,oU]=(0,_.useState)(!1),[oW,oV]=(0,_.useState)(!1),[oK,oZ]=(0,_.useState)(!1),[oQ,oX]=(0,_.useState)({shouldShowChangeMode:!1,triggeredByPopupClose:!1,triggeredByLoginClose:!1});localStorage.setItem("alias",t2);let o$="loggedin_".concat(t2),o0="profile_check_".concat(t2),{handleApiError:o1}=(0,K.u)(),[o2,o5]=(0,_.useState)(),[o3,o4]=(0,_.useState)(!0),[o6,o7]=(0,_.useState)(!1),[o8,o9]=(0,_.useState)(!1),[ae,at]=(0,_.useState)(1),[ao,aa]=(0,_.useState)(!1),[ar,al]=(0,_.useState)(""),[an,ai]=(0,_.useState)(""),[as,ad]=(0,_.useState)({}),[ac,au]=(0,_.useState)(0),[am,a_]=(0,_.useState)(!1),[ag,av]=(0,_.useState)(!1),[ap,ah]=(0,_.useState)(!1),[af,ay]=(0,_.useState)(null),[ab,ax]=(0,_.useState)(!1),{containerStyle:aS,center:aw,onLoad:ak,onMarkerClick:aj,marker:aN,autocompleteRef:aI,handleLocationSelect:aC,map:aO,setMarker:aA,address:aE,setAddress:aP,isReadyMap:aF}
1=(0,ec._)(),{isGoogleMapsLoaded:aM,loadError:aD}=(0,eu.B)();if(!tj)throw Error("IndexPage must be used within a MyProvider");(0,$.nn)(t2),(0,ee.r)(t2);let{openRewards:aT,setOpenRewards:aJ,loading:aB,setOpenLoginModal:aL,openLoginModal:aR,setMobileMenuOpen:az,setOpenSuccessModal:aq,openSuccessModal:aY,openFailureModal:aG,setOpenFailureModal:aH,openFailureModalFunc:aU,openSuccessModalFunc:aW,modalMessage:aV,sessionId:aK,appVersion:aZ,restaurantData:aQ,setShowQRCoachMark:aX}=tj,a$=(0,_.useMemo)(()=>!oW||oY||oK&&!oH,[oW,oY,oK,oH]),a0=(0,_.useCallback)(()=>!aR&&!a$,[aR,a$]),[a1,a2]=(0,_.useState)([]),a5=(0,_.useRef)([]),a3=(0,_.useRef)([]),a4=(0,_.useRef)(""),a6=(null===(T=(Array.isArray(null==aQ?void 0:null===(J=aQ.ecom_settings)||void 0===J?void 0:J.analytics_settings)?aQ.ecom_settings.analytics_settings:(null==aQ?void 0:null===(B=aQ.ecom_settings)||void 0===B?void 0:B.analytics_settings)?[aQ.ecom_settings.analytics_settings]:[]).find(e=>"7ef38a2c-42dc-11ed-b878-0242ac120002"===e.platform&&"1"===e.status))||void 0===T?void 0:T.id)||"848451747356230",a7="landing",[a8,a9]=(0,_.useState)("");(0,_.useEffect)(()=>{a9(window.location.href)},[]),(0,_.useEffect)(()=>{tH("true"===localStorage.getItem("is_dinein_tab_".concat(t2)))},[localStorage.getItem("is_dinein_tab_".concat(t2))]);let re=aQ?(null===(L=(Array.isArray(null===(R=aQ.ecom_settings)||void 0===R?void 0:R.analytics_settings)?aQ.ecom_settings.analytics_settings:(null===(z=aQ.ecom_settings)||void 0===z?void 0:z.analytics_settings)?[aQ.ecom_settings.analytics_settings]:[]).find(e=>"db0098c8-42dc-11ed-b878-0242ac120002"===e.platform))||void 0===L?void 0:L.id)||"G-V55PFGDBF9":void 0,[rt,ro]=(0,_.useState)([]),ra=(0,_.useRef)(null),[rr,rl]=(0,_.useState)(!1),{primaryColor:rn,secondaryColor:ri,secondaryBtnColor:rs,secondaryBtnTxtColor:rd,highlightTextColor:rc,fontFamily:ru,descriptionColor:rm,bgColor:r_,highlightbgColor:rg,ErrorPrimaryColor:rv,ErrorSecondaryColor:rp,MenuCategoryColor:rh,primaryBtnColor:rf,primaryBtnTxtColor:ry,selectionLimit_text_color:rb,item_goback_button_color:rx,item_goback_button_text_color:rS}=el(e.initialThemeColors);(0,_.useEffect)(()=>{var t,o,a,r,l;let n=null!==(l=null===(o=e.restaurant_settings)||void 0===o?void 0:null===(t=o.data)||void 0===t?void 0:t.restaurant_id)&&void 0!==l?l:null===(r=e.branchMenu)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.restaurant_id;n&&(0,ej.r)(n)},[null===(Y=e.restaurant_settings)||void 0===Y?void 0:null===(q=Y.data)||void 0===q?void 0:q.restaurant_id,null===(eo=e.branchMenu)||void 0===eo?void 0:null===(Q=eo.data)||void 0===Q?void 0:Q.restaurant_id]),(0,_.useEffect)(()=>{var t,o;if(!(null===(o=e.branchMenu)||void 0===o?void 0:null===(t=o.data)||void 0===t?void 0:t.menu_type)){console.log("Skipping useEffect: menu_type not available");return}let a=!1;return(async()=>{var t,o,r;tX([]);let l="branchMenuDetail_".concat(t2),n=null!==(r=null===(o=e.branchMenu)||void 0===o?void 0:null===(t=o.data)||void 0===t?void 0:t.menu_type)&&void 0!==r?r:[];try{if(await (0,en.tE)(l,n),a)return;tX(n)}catch(e){console.error("Error in fetchMenu:",e),a||tX([])}})(),()=>{a=!0}},[e.branchMenu]),(0,_.useEffect)(()=>{let e=localStorage.getItem("item_url_".concat(t2));Array.isArray(tQ)&&tQ.length>0&&e?(console.log("NEW getBranchMenu (applied):",tQ),rE(),setTimeout(()=>{localStorage.removeItem("item_url_".concat(t2)),ob(null)},5e3)):console.log("getBranchMenu cleared or empty")},[tQ]),(0,_.useEffect)(()=>{var t,o,a,r;if((null===(a=e.pickupbranches)||void 0===a?void 0:null===(o=a.data)||void 0===o?void 0:null===(t=o.branches_data)||void 0===t?void 0:t.length)>0){let t=localStorage.getItem("selected_branchmode_".concat(t2));if(t)try{let o=JSON.parse(t);if(!["dinein","takeout","pickup"].includes(null==o?void 0:o.mode))return;let a=null===(r=o.branch)||void 0===r?void 0:r.branch_id,l=e.pickupbranches.data.branches_data.find(e=>e.branch_id.toString()===a.toString());if(l){let e={...o.branch,pickup_time_estimate:l.pickup_time_estimate,schedule_settings:l.schedule_settings,branch_business_hours:l.branch_business_hours,isOpen:l.isOpen,...l},t={...o,branch:e};localStorage.setItem("selected_branchmode_".concat(t2),JSON.stringify(t)),H.A.set("selected_branchmode_".concat(t2),JSON.stringify(t),{sameSite:"None",secure:!0,expires:7}),ot(t),t7(t),tY(e),(0,y.YA)(e,tz)}}catch(e){console.error("Error updating branch timing:",e)}}},[null===(ei=e.pickupbranches)||void 0===ei?void 0:null===(er=ei.data)||void 0===er?void 0:er.branches_data]),(0,_.useEffect)(()=>{var t,o,a,l;let n=null===(t=(0,V.gm)(window.location.href))||void 0===t?void 0:t.hasCallin;
1if(e.directBranchAccess&&e.directBranchId&&n&&r.wd("callin_direct_branch_access_collision_skipped",{level:"warning",tags:{area:"callin-order-type"},extra:{alias:t2,directBranchId:e.directBranchId,url:window.location.href}}),e.directBranchAccess&&e.directBranchId&&!n){let t=null===(l=e.pickupbranches)||void 0===l?void 0:null===(a=l.data)||void 0===a?void 0:null===(o=a.branches_data)||void 0===o?void 0:o.find(t=>t.branch_id.toString()==e.directBranchId);if(t){let o={mode:"pickup",branch:t};localStorage.setItem("selected_branchmode_".concat(t2),JSON.stringify(o)),H.A.set("selected_branchmode_".concat(t2),JSON.stringify(o),{sameSite:"None",secure:!0,expires:7}),localStorage.removeItem("offer_details_".concat(t2)),H.A.remove("offer_details_".concat(t2)),window.dispatchEvent(new Event("promotionCleared")),ot(o),t7(o),tY(t),(0,y.YA)(t,tz),rJ(t,o.mode),sessionStorage.setItem("direct_branch_id_".concat(t2),e.directBranchId);let a=window.location.pathname.replace(/\/s-\d+/i,"");window.location.pathname!==a&&window.history.replaceState({},"",a)}}},[e.directBranchAccess,e.directBranchId]);let rw=e=>{let t=e.indexOf("/upload")+7,o=e.slice(0,t),a=e.slice(t);return"".concat(o,"/f_auto,q_auto,fl_lossy,q_30,w_512").concat(a).replace("http:","https:")};(0,_.useEffect)(()=>{if(!tZ.current){tZ.current=!0;try{let e=I().tz.guess()||"UTC",t=I()().tz(e).format("YYYY-MM-DD HH:mm:ss"),o={target_path:"ecom/v1/",file_name:"user_access_logs",data:{user_timezone:e,access_time:t,url:window.location.href,userAgent:navigator.userAgent,session_id:aK||"N/A",alias:t2||"N/A",referrer:document.referrer||"N/A"},source:"EcomV2",version:aZ,ui_request_timestamp:new Date().toISOString()};(0,et.f)(o)}catch(e){console.error("Error occurred while logging user data:",e)}}},[]),(0,_.useEffect)(()=>{let e=navigator.userAgent||navigator.vendor||window.opera;if(/WhatsApp/i.test(e)){console.log("WhatsApp WebView detected - Enhanced URL parameter extraction");let e=window.location.href,t=(0,V.Fe)(e);console.log("Extracted URL parameters in WhatsApp:",t),t.promo&&(console.log("Promo code found in WhatsApp WebView:",t.promo),localStorage.setItem("currentPromo",t.promo),t.target_link&&localStorage.setItem("currentPromoTargetLink",t.target_link)),t.userkey&&console.log("User key found in WhatsApp WebView:",t.userkey),t.ref&&localStorage.setItem("ref_".concat(t2),t.ref),t.utm_campaign&&localStorage.setItem("utm_campaign_".concat(t2),t.utm_campaign)}},[]);let rk=e=>e&&Array.isArray(e)?e.map((e,t)=>e&&Array.isArray(e.menu_category)?{...e,menu_id:e.menu_id||"",menu_category:e.menu_category.map((e,o)=>e&&Array.isArray(e.cat_items)?{category_id:e.category_id||"".concat(t,"_").concat(o),category_display_text:e.category_display_text,category_display_text_v1:e.category_display_text_v1,cat_items:e.cat_items.map(e=>e?{item_id:e.item_id,item_display_text:e.item_display_text,item_display_text_v1:e.item_display_text_v1,item_description:e.item_description,item_description_v1:e.item_description_v1,price:e.price,scratched_price:e.scratched_price,disabled_item:e.disabled_item||!1,disabled_type:e.disabled_type||"",menu_timing:e.menu_timing||[],item_image:e.item_image&&""!==e.item_image.trim()?rw(e.item_image):"/ecomv2/noimage.png"}:(console.warn("Invalid catItem:",e),{item_image:"/ecomv2/noimage.png"}))}:(console.warn("Invalid category or cat_items:",e),{category_id:(null==e?void 0:e.category_id)||"".concat(t,"_").concat(o),category_display_text:(null==e?void 0:e.category_display_text)||"",cat_items:[]}))}:(console.warn("Invalid item or menu_category:",e),{...e,menu_category:[]})).filter(e=>e.menu_category.length>0):(console.error("menuData is not an array or is undefined:",e),[]),[rj,rN]=(0,_.useState)(()=>{var t,o;return rk((null===(o=e.branchMenu)||void 0===o?void 0:null===(t=o.data)||void 0===t?void 0:t.menu_type)&&Array.isArray(e.branchMenu.data.menu_type)?e.branchMenu.data.menu_type:[])}),[rI,rC]=(0,_.useState)(!1),rO=(e,t,o)=>{let a=null;(a=tQ.flatMap(e=>e.menu_category).filter(e=>(e.category_id||t)==t).flatMap(e=>e.cat_items).find(t=>t.item_id==e))||(a=tQ.flatMap(e=>e.menu_category).flatMap(e=>e.cat_items).find(t=>t.item_id==e)||null),tK(a),tF(!0),console.log("Selected item:",a,"Category key:",t),rC(o)};(0,_.useEffect)(()=>{let e=document.referrer||"direct",t=window.location.hostname,o=new URLSearchParams(window.location.search).get("utm_source")||"";"direct"===e||e&&!e.includes(t)?localStorage.setItem("http_referrer_".concat(t2),e):console.log("Referrer is from same host or invalid, not saving: ".concat(e)),o?(console.log("Saving utm_source for alias ".concat(t2,": ").concat(o)),localStorage.setItem("utm_source_".concat(t2),o)):localStorage.setItem("utm_source_".concat(t2),"direct")},[]),(0,_.useEffect)(()=>{rN(rk(Array.isArray(tQ)?tQ:[]))},[tQ]),function(){let e=new URLSearchParams(window.location.search).get("ref");e&&localStorage.setItem("ref_".concat(t2),e)}(),(0,_.useEffect)(()=>{let e=!tQ||0===tQ.length,t=!t5||!t5.branches_data||0===t5.branches_data.length;e&&t?ov(!0):ov(!1)},[tQ,t5]),(0,_.useEffect)(()=>{let e=setTimeout(()=>{o4(!1)},2e3);return()=>clearTimeout(e)},[]);let rA="".concat(window.location.origin,"/");(0,_.useEffect)(()=>{let e=localStorage.getItem("resturantserversidesettings");if(aZ?ai(aZ):console.log("version"),(oN||oI||oC||oO||oA||oE||oP||oF||oM)&&(0,et.f)(rW),e)try{let t=JSON.parse(e);a2(t)}catch(e){console.error("Failed to parse resturantserversidesettings:",e)}},[]),(0,_.useEffect)(()=>{let e;if(!(null==a1?void 0:a1.alias))return;let t=window.location.pathname.split("/"),o=t[1];if(o){try{e=decodeURIComponent(o)}catch(t){e=o}if(!/^[a-zA-Z0-9_-]+$/.test(e)){let o=e.match(/([a-zA-Z]\w*=.+)$/),a=window.location.search;
1if(o){let e=o[1];a=a?"".concat(a,"&").concat(e):"?".concat(e)}t[1]=a1.alias,window.history.replaceState(null,"","".concat(t.join("/")).concat(a).concat(window.location.hash))}}},[null==a1?void 0:a1.alias]),(0,_.useEffect)(()=>{aF||console.log("Google Maps is initializing...")},[aF]),(0,_.useEffect)(()=>{let e=(0,V.Fe)(window.location.href),{hasStatus:t}=(0,V.zh)(e);if(t){localStorage.setItem("status_id",e.status);let t=new URL(window.location.href);t.pathname.includes("/status/")&&es(t.pathname.split("/status/")[0]),setTimeout(()=>{tg.push("/".concat(t2,"/myorders"))},100)}let o=e.utm_campaign;o&&localStorage.setItem("utm_campaign_".concat(t2),o)},[oD,tg.asPath]),(0,_.useEffect)(()=>{let e=localStorage.getItem("redirect_to_myorders_".concat(t2)),t=localStorage.getItem("loggedin_".concat(t2));if("true"===e&&"true"===t){localStorage.removeItem("redirect_to_myorders_".concat(t2));let e="/".concat(t2,"/myorders");window.location.href=e}},[rr]);let rE=(0,_.useCallback)(async()=>{if(Array.isArray(tQ)&&tQ.length>0?console.log(tQ,"==??",oy):console.log("getBranchMenu cleared or empty in handleFacebookShopItem"),console.log(!tQ||!Array.isArray(tQ)||0===tQ.length,"==??"),!tQ||!Array.isArray(tQ)||0===tQ.length){console.log("No menu data found for current branch"),setTimeout(()=>{aU("This item is either not available right now or not in the menu.")},3e3);return}let e=null;tQ.forEach(t=>{t&&Array.isArray(t.menu_category)&&t.menu_category.forEach(t=>{t&&Array.isArray(t.cat_items)&&t.cat_items.forEach(t=>{t&&t.item_id==oy&&(e=t)})})}),console.log(e,"foundItem"),e?(tD(e.item_id),tK(e),(0,y.YA)(tq,tz),rC(!0),tF(!0)):setTimeout(()=>{aU("This item is either not available right now or not in the menu.")},3e3)},[tQ,oy,tq,aU]);(0,_.useEffect)(()=>{if(!ox.current){ox.current=!0;let e=(0,V.gm)(window.location.href);if(!e.hasitem){console.log("User did not come from a link with itemUrl");return}let t=window.innerWidth<1024;a0()&&oW&&(!oK||oK&&oH)&&(t?tu(!0):t_(!0)),of(!0),ob(e.item),setTimeout(()=>{let e=new URL(window.location.href);e.searchParams.has("utm_campaign")&&e.searchParams.delete("utm_campaign"),e.searchParams.has("item")&&e.searchParams.delete("item"),es(e.toString())},5e3)}},[tq,tQ,aU,null===(e_=e.branchMenu)||void 0===e_?void 0:null===(ed=e_.data)||void 0===ed?void 0:ed.menu_type,a0,oW,oK,oH]),(0,_.useEffect)(()=>{let e=localStorage.getItem(o0),t=localStorage.getItem("dine_in_table");if(t)try{let e=JSON.parse(t);al(e)}catch(e){console.error("Error parsing dine_in_table:",e)}if(e)try{let t=JSON.parse(e);t?o5(t):console.log("Profile check not found in localStorage.")}catch(e){console.error("Error parsing profileCheck data from localStorage:",e)}},[o0,localStorage.getItem("dine_in_table")]),(0,_.useEffect)(()=>{var t,o,a;if(localStorage.getItem(o0)){oV(!0),oZ(!1);return}let r=null===(o=e.restaurant_settings)||void 0===o?void 0:null===(t=o.data)||void 0===t?void 0:t.restaurant_id,l=null==oe?void 0:null===(a=oe.branch)||void 0===a?void 0:a.branch_id;if(!r||!l){oV(!1);return}(async()=>{try{var e;oV(!1),console.log("User not logged in, calling offer API");let t=(null==oe?void 0:oe.mode)||"pickup",o=await W(r,l,t,"","","en",aK,aZ,0,rA);(null==o?void 0:null===(e=o.data)||void 0===e?void 0:e.offer_details)&&o.data.offer_details.length>0?(oq(o.data.offer_details),oZ(!0),oH||oS()||(oG(!0),oU(!0)),console.log("Offer API response:",o.data.offer_details)):oZ(!1)}catch(e){console.error("Error calling offer API:",e),oZ(!1)}finally{oV(!0)}})()},[o0,null===(eh=e.restaurant_settings)||void 0===eh?void 0:null===(eg=eh.data)||void 0===eg?void 0:eg.restaurant_id,null==oe?void 0:null===(ef=oe.branch)||void 0===ef?void 0:ef.branch_id,null==oe?void 0:oe.mode,oH,aK,aZ]),(0,_.useEffect)(()=>{let e=()=>{let e=localStorage.getItem("scheduledOrder_".concat(t2));if(e)try{let t=JSON.parse(e);o_(t),localStorage.setItem("current_scheduledOrder__".concat(t2),"true")}catch(e){console.error("Error parsing scheduled order:",e),o_(null)}else o_(null)};return e(),window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}},[localStorage.getItem("scheduledOrder_".concat(t2)),localStorage.getItem("selected_branchmode_".concat(t2))]),(0,_.useEffect)(()=>{let e=localStorage.getItem("selected_branchmode_".concat(t2));if(e)try{var t;let o=JSON.parse(e);(null===(t=o.branch)||void 0===t?void 0:t.is_schedule)||(localStorage.removeItem("scheduledOrder_".concat(t2)),o_(null))}catch(e){console.error("Error parsing branch mode:",e)}},[]),(0,_.useEffect)(()=>{let e=localStorage.getItem("analytics_settings_".concat(t2));if(e){console.log("analyticsSettings",e);try{let t=JSON.parse(e),o=Array.isArray(t)?t:t&&"object"==typeof t?[t]:[];a5.current=o.filter(e=>"7ef38a2c-42dc-11ed-b878-0242ac120002"==e.platform&&"1"==e.status),a3.current=o.filter(e=>"db0098c8-42dc-11ed-b878-0242ac120002"==e.platform&&"1"==e.status),ro(a3.current)}catch(e){console.error("Failed to parse analytics settings:",e)}}},[]);let rP=(0,_.useMemo)(()=>rt,[rt]),rF=(0,_.useCallback)(async()=>{try{let e=localStorage.getItem("loggedin_".concat(t2)),t=localStorage.getItem("profile_check_".concat(t2)),o=localStorage.getItem("resturantserversidesettings");if(!e||!t||!o||!aK){ax(!1);return}let a=JSON.parse(t),r=JSON.parse(o),l={restaurant_id:r.restaurant_id,member_id:a.member_id,brand_id:r.brand_id,phone_number:a.phone_number,session_id:aK,version:aZ||"1.0.0"},n=window.location.origin?"".concat(window.location.origin,"/"):"https://order.foodbot.ai/",i=await (0,ep.l)(l,n);if((null==i?void 0:i.orders_info)&&i.orders_info.length>0){let e=i.orders_info.find(e=>5!==e.order_status&&6!==e.order_status);e?(ay(e),ax(!0)):(ay(null),ax(!1))}else ay(null),ax(!1)}catch(e){console.error("Error checking active orders:",e),ax(!1)}},[aK,aZ]);(0,_.useEffect)(()=>{localStorage.getItem("loggedin_".concat(t2))&&aK&&rF()},[rF,aK]);let rM=(0,_.useCallback)((t,o)=>{var a,r,l,n,i,s,d,c,u,m,_,g;if(t&&(t3(t),o&&(null===(a=t.branches_data)||void 0===a?void 0:a.length)>0)){let o=t.branches_data[0];if(localStorage.getItem("scheduledOrder_".concat(t2)))try{let e=localStorage.getItem("selected_branchmode_".concat(t2));if(e){let t=JSON.parse(e),a=null==t?void 0:null===(_=t.branch)||void 0===_?void 0:null===(m=_.branch_id)||void 0===m?void 0:m.toString(),r=null==o?void 0:null===(g=o.branch_id)||void 0===g?void 0:g.toString();a&&r&&a!==r&&(localStorage.removeItem("scheduledOrder_".concat(t2)),localStorage.removeItem("current_scheduledOrder__".concat(t2)),tJ(tv("schedule_cleared_location_change")),tE(!0),setTimeout(()=>tE(!1),7e3))}}catch(e){}let a=null===(i=e.restaurant_settings)||void 0===i?void 0:null===(n=i.data)||void 0===n?void 0:null===(l=n.ecom_settings)||void 0===l?void 0:null===(r=l.general_settings)||void 0===r?void 0:r.ecom_default_ordertype,v="takeout"===a?"pickup":a||"pickup",h={mode:v,branch:o};localStorage.setItem("selected_branchmode_".concat(t2),JSON.stringify(h)),H.A.set("selected_branchmode_".concat(t2),JSON.stringify(h),{sameSite:"None",secure:!0,expires:7}
1),ot(h),t7(h),tY(o),(0,y.YA)(o,tz),localStorage.removeItem("payment_method_".concat(t2)),localStorage.removeItem("payload_".concat(t2)),H.A.remove("payment_method_".concat(t2)),H.A.remove("payload_".concat(t2)),rJ(o,v);let f=null===(d=e.restaurant_settings)||void 0===d?void 0:null===(s=d.data)||void 0===s?void 0:s.restaurant_id,b=null===(u=e.restaurant_settings)||void 0===u?void 0:null===(c=u.data)||void 0===c?void 0:c.brand_id;tX([]),(async()=>{try{var e;let t=await (0,p._)(t2,o.branch_id,f,b,v,aK||"",aZ||"",rA),a=null==t?void 0:null===(e=t.data)||void 0===e?void 0:e.menu_type;Array.isArray(a)&&a.length>0&&(await (0,en.tE)("branchMenuDetail_".concat(t2),a),tX(a))}catch(e){console.error("applyFreshBranches: menu fetch failed",e)}})()}},[t2,null===(eS=e.restaurant_settings)||void 0===eS?void 0:null===(ex=eS.data)||void 0===ex?void 0:null===(eb=ex.ecom_settings)||void 0===eb?void 0:null===(ey=eb.general_settings)||void 0===ey?void 0:ey.ecom_default_ordertype,null===(eR=e.restaurant_settings)||void 0===eR?void 0:null===(ew=eR.data)||void 0===ew?void 0:ew.restaurant_id,null===(eq=e.restaurant_settings)||void 0===eq?void 0:null===(ez=eq.data)||void 0===ez?void 0:ez.brand_id,aK,aZ,rA]);!function(e){let{alias:t,restaurantId:o,sessionId:a,appVersion:r,onBranchesRefreshed:l}=e;(0,_.useEffect)(()=>{if(!navigator.geolocation||!o)return;let e=!1,n=localStorage.getItem("user_gps_coords_".concat(t));if(n)try{let e=JSON.parse(n);if(Date.now()-(e.savedAt||0)<216e5)return;localStorage.removeItem("user_gps_coords_".concat(t))}catch(e){localStorage.removeItem("user_gps_coords_".concat(t))}else e=!0;navigator.geolocation.getCurrentPosition(async n=>{let i={lat:n.coords.latitude,lng:n.coords.longitude,savedAt:Date.now()},s=JSON.stringify(i);localStorage.setItem("user_gps_coords_".concat(t),s),H.A.set("user_gps_coords_".concat(t),JSON.stringify({lat:i.lat,lng:i.lng}),{expires:7,sameSite:"None",secure:!0});try{let n="".concat(window.location.origin,"/"),s=await f(t,o,r,a,n,void 0,{lat:i.lat,long:i.lng});(null==s?void 0:s.data)&&(null==s?void 0:s.status)==="success"&&l(s.data,e)}catch(e){console.error("useLocationSort: failed to refresh branches",e)}},e=>{console.error("useLocationSort: GPS denied or error",e.code,e.message),sessionStorage.setItem("location_denied_".concat(t),"true")},{maximumAge:3e5,enableHighAccuracy:!1})},[t,o])}({alias:t2,restaurantId:null===(eG=e.restaurant_settings)||void 0===eG?void 0:null===(eY=eG.data)||void 0===eY?void 0:eY.restaurant_id,sessionId:aK||"",appVersion:aZ||"",onBranchesRefreshed:(e,t)=>rM(e,t)});let rD=(0,_.useCallback)(()=>new Promise(t=>{if(!navigator.geolocation){t();return}localStorage.removeItem("user_gps_coords_".concat(t2)),navigator.geolocation.getCurrentPosition(async o=>{let a={lat:o.coords.latitude,lng:o.coords.longitude,savedAt:Date.now()}
1,r=JSON.stringify(a);localStorage.setItem("user_gps_coords_".concat(t2),r),H.A.set("user_gps_coords_".concat(t2),JSON.stringify({lat:a.lat,lng:a.lng}),{expires:7,sameSite:"None",secure:!0});try{var l,n;let t=await f(t2,null===(n=e.restaurant_settings)||void 0===n?void 0:null===(l=n.data)||void 0===l?void 0:l.restaurant_id,aZ,aK,rA,void 0,{lat:a.lat,long:a.lng});(null==t?void 0:t.data)&&(null==t?void 0:t.status)==="success"&&rM(null==t?void 0:t.data,!0)}catch(e){console.error("requestLocationSort: failed",e)}finally{t()}},e=>{console.error("requestLocationSort: GPS error",e.code,e.message),t()},{maximumAge:3e5,enableHighAccuracy:!1})}),[t2,aK,aZ,null===(eU=e.restaurant_settings)||void 0===eU?void 0:null===(eH=eU.data)||void 0===eH?void 0:eH.restaurant_id,rM]),rT=(0,_.useCallback)(()=>{af&&(localStorage.setItem("status_id",af.order_id.toString()),localStorage.setItem("TrackOrderData_".concat(t2),JSON.stringify(af)),tg.push("/".concat(t2,"/myorders")))},[af,tg]);(0,_.useEffect)(()=>{let e=e=>{e.key&&e.key.includes("OrderPlacedData_")&&setTimeout(()=>{rF()},1e3)};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[rF]),(0,_.useEffect)(()=>{Array.isArray(a5.current)&&a5.current.length>0&&(a4.current=a5.current[0].id)}),(0,_.useEffect)(()=>{if(e.showChangeModeModal){let e="changeModeModalShown_".concat(t2),t=()=>{let t=sessionStorage.getItem(e),o=!0;if(t)try{let{timestamp:e}=JSON.parse(t);(Date.now()-e)/36e5<12&&(o=!1)}catch(e){console.error("Failed to parse modal shown data:",e)}o&&!oJ.current&&a0()&&oW&&(!oK||oK&&oH)&&(tu(!0),setTimeout(()=>{t_(!(window.innerWidth<1024));let t={value:!0,timestamp:Date.now()};sessionStorage.setItem(e,JSON.stringify(t))},200))};t();let o=setInterval(t,6e5),a=localStorage.getItem("profile_check_".concat(t2));if(a)try{let e=JSON.parse(a);ol(e)}catch(e){console.error("Failed to parse user details:",e)}let r=localStorage.getItem("availablePartner");if(r)try{let e=JSON.parse(r);ad(e)}catch(e){console.error("Error parsing availablePartner:",e)}return()=>clearInterval(o)}},[e.showChangeModeModal,localStorage.getItem("availablePartner"),a0,oW,oK,oH]);let rJ=(t,o)=>{tk.current&&clearTimeout(tk.current),tk.current=setTimeout(async()=>{var a,r,l,n,i;let s=null==t?void 0:t.branch_id,d=localStorage.getItem("payment_method_".concat(t2)),c=localStorage.getItem("selected_branchmode_".concat(t2)),u=localStorage.getItem("payload_".concat(t2)),m=H.A.get("payment_method_".concat(t2)),_=H.A.get("selected_branchmode_".concat(t2)),g=H.A.get("payload_".concat(t2)),v="payload_".concat(t2),p="".concat(window.location.origin,"/"),h=null;if("delivery"===o)try{let e=localStorage.getItem("selecteduserAddress_".concat(t2));e&&(h=JSON.parse(e))}catch(e){}let f={restaurant_id:null===(r=e.restaurant_settings)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.restaurant_id,branch_id:s,is_schedule:!1,order_type:"dinein"===o?"dinein":"pickup"===o?"takeout":"delivery",source:{lat:Number(null==t?void 0:t.branch_latitude),lng:Number(null==t?void 0:t.branch_longitude)},..."delivery"===o&&h?{destination:{lat:(null==h?void 0:h.latitude)||"",lng:(null==h?void 0:h.longitude)||""},address:{formatted_address:(null==h?void 0:h.formatted_address)||"",unit_number:(null==h?void 0:h.unit_number)||"",latitude:(null==h?void 0:h.latitude)||"",longitude:(null==h?void 0:h.longitude)||"",zipcode:(null==h?void 0:h.zipcode)||"",city:(null==h?void 0:h.city)||"",state:(null==h?void 0:h.state)||"",country:(null==h?void 0:h.country)||"",external_number:(null==h?void 0:h.external_number)||"",street:(null==h?void 0:h.street)||"",address_type:(null==h?void 0:h.address_type)||""}}:{},is_callin:!1,lang:tp||(null===(n=e.restaurant_settings)||void 0===n?void 0:null===(l=n.data)||void 0===l?void 0:l.bot_language),api_source:"EcomV2",session_id:aK,version:aZ,currentDomain:p,request_timestamp:new Date().toISOString()};try{if(d&&m&&null!=d&&"undefined"!=u&&null!=m&&"undefined"!=m)try{let e=JSON.parse(d);t9(e)}catch(e){console.error("Error parsing existing payment method:",e)}else{let e=await (0,b.d)(o,f);t9(e),(null==e?void 0:null===(i=e.data)||void 0===i?void 0:i.delivery_partners)&&ad({delivery_partners:e.data.delivery_partners}),localStorage.setItem("payment_method_".concat(t2),JSON.stringify(e)),localStorage.removeItem("selected_delivery_partner_".concat(t2)),H.A.set("payment_method_".concat(t2),JSON.stringify(e),{expires:7})}if(!c||!_||null==c||"undefined"==c||null==_||"undefined"==_){let e={mode:o,branch:"delivery"===o&&h?{...t,...h}:t};localStorage.setItem("selected_branchmode_".concat(t2),JSON.stringify(e)),H.A.set("selected_branchmode_".concat(t2),JSON.stringify(e),{sameSite:"None",secure:!0,expires:7})}if(null==u||"undefined"==u||null==g||"undefined"==g||!u||!g){let e=JSON.stringify(f);localStorage.setItem(v,e),H.A.set(v,e,{sameSite:"None",secure:!0,expires:7})}tY(t),(0,y.YA)(t,tz)}catch(e){console.error("Payment API failed:",e)}},300)};(0,_.useEffect)(()=>{var t,o,a,r,l,n,i,s,d,c,u,m,_,g,v;if((0,V.gm)(window.location.href).hasCallin)return;let p=localStorage.getItem("selected_branchmode_".concat(t2));if(p){let e=JSON.parse(p);t7(e),tY(e.branch)}let h=localStorage.getItem("branch_delivery_".concat(t2)),f=localStorage.getItem("selected_branchmode_".concat(t2))||H.A.get("selected_branchmode_".concat(t2)),b=localStorage.getItem("resturantserversideTheme");if(b?oi(JSON.parse(b)):console.log("No restaurant theme found in localStorage"),h){let e=JSON.parse(h);tL(e),H.A.set("branch_delivery_".concat(t2),JSON.stringify(e),{sameSite:"None",secure:!0,expires:7})}else console.log("No branch_delivery found in localStorage");let x=(null===(a=e.pickupbranches)||void 0===a?void 0:null===(o=a.data)||void 0===o?void 0:null===(t=o.branches_data)||void 0===t?void 0:t.length)>0||(null===(n=e.pickupbranches)||void 0===n?void 0:null===(l=n.data)||void 0===l?void 0:null===(r=l.dinein_branches)||void 0===r?void 0:r.length)>0,S=(null===(s=e.pickupbranches)||void 0===s?void 0:null===(i=s.data)||void 0===i?void 0:i.branches_data)||[],w=(null===(c=e.pickupbranches)||void 0===c?void 0:null===(d=c.data)||void 0===d?void 0:d.dinein_branches)||[],k=null===(g=e.restaurant_settings)||void 0===g?void 0:null===(_=g.data)||void 0===_?void 0:null===(m=_.ecom_settings)||void 0===m?void 0:null===(u=m.general_settings)||void 0===u?void 0:u.ecom_default_ordertype,j="takeout"===k?"pickup":k,N=()=>"dinein"===j&&w.length>0?{mode:"dinein",branch:w[0]}:S.length>0?{mode:"pickup",branch:S[0]}:{mode:"dinein",branch:w[0]},I=e=>{localStorage.setItem("selected_branchmode_".concat(t2),JSON.stringify(e)),H.A.set("selected_branchmode_".concat(t2),JSON.stringify(e),{sameSite:"None",secure:!0,expires:7})};if(f)try{let e=JSON.parse(f);if((null==e?void 0:e.branch)&&"object"==typeof e.branch&&e.branch.branch_id){let t=e.mode,o=String(e.branch.branch_id),a=S.some(e=>String(e.branch_id)===o),r=w.some(e=>String(e.branch_id)===o);if(("pickup"===t&&!a||"dinein"===t&&!r)&&x){let e=N();ot(e),t7(e),tY(e.branch),"dinein"===e.mode&&tH(!0),(0,y.YA)(e.branch,tz),rJ(e.branch,e.mode),I(e);return}if("delivery"===e.mode&&!(null===(v=e.branch)||void 0===v?void 0:v.address_label))try{let t=localStorage.getItem("selecteduserAddress_".concat(t2));if(t){let o=JSON.parse(t);(null==o?void 0:o.address_label)&&(e={...e,branch:{...e.branch,...o}})}}catch(e){}if("pickup"===e.mode||"dinein"===e.mode)ot(e),t7(e),tY(e.branch),(0,y.YA)(e.branch,tz),x&&rJ(e.branch,e.mode);else if("delivery"===e.mode){let t=localStorage.getItem("branch_delivery_".concat(t2));if(t){ot(e);let o=JSON.parse(t);t7({branch:o,mode:"delivery"}),tY(o),(0,y.YA)(o,tz),x&&rJ(o,"delivery")}else{let e=N();ot(e),t7(e),tY(e.branch),(0,y.YA)(e.branch,tz),x&&rJ(e.branch,e.mode),I(e)}}}else if(x){let e=N();ot(e),t7(e),tY(e.branch),"dinein"===e.mode&&tH(!0),(0,y.YA)(e.branch,tz),rJ(e.branch,e.mode),I(e)}else console.log("No branches available, skipping fallback branch selection and payment fetch.")}catch(e){if(console.error("Error parsing localstoredMode:",e),x){let e=N();ot(e),t7(e),tY(e.branch),(0,y.YA)(e.branch,tz),rJ(e.branch,e.mode),I(e)}else console.log("No branches available, skipping error fallback and payment fetch.")}else if(x){let e=N();ot(e),t7(e),tY(e.branch),"dinein"===e.mode&&tH(!0),(0,y.YA)(e.branch,tz),rJ(e.branch,e.mode),I(e)}else console.log("No branches available, skipping branch selection and payment fetch.")},[localStorage.getItem("branch_delivery_".concat(t2)),localStorage.getItem("selected_branchmode_".concat(t2)),null==oe?void 0:null===(eW=oe.branch)||void 0===eW?void 0:eW.address_label,tR,null==tq?void 0:tq.timezone]),(0,_.useEffect)(()=>{let e=tg.asPath;if(e.includes("/widgts")){let e="/".concat(t2);tg.asPath!==e&&tg.replace(e,void 0,{shallow:!0});return}if((0,V.gm)(window.location.href).hasCallin)return;let t=e.match(/^(\/[^&?#]+)/);if(t){let o=t[0];if(e!==o){let e=setTimeout(()=>{tg.asPath!==o&&tg.replace(o,void 0,{shallow:!0})},5e3);return()=>clearTimeout(e)}}},[tg]);let rB=(e,t)=>{let o;if((null==om?void 0:om.date)&&(null==om?void 0:om.time)&&"ASAP"!==om.time){let[e,a]=om.time.replace("AM","").replace("PM","").trim().split(":").map(Number),r=om.time.includes("PM")&&e<12,l=om.time.includes("AM")&&12===e;o=I().tz("".concat(om.date," ").concat(r?e+12:l?0:e,":").concat(a),"YYYY-MM-DD HH:mm",t)}else o=I()().tz(t);let a=o.day(),r=0===a?6:a-1,l=o.format("HH:mm:ss"),n=e.find(e=>parseInt(e.day)===a),i=e.find(e=>parseInt(e.day)===r);
1if(n&&1==n.status){let{open_time:e,close_time:t}=n;if(e<=t){if(l>=e&&l<=t)return!0}else if(l>=e&&l<="23:59:59"||l>="00:00:00"&&l<=t)return!0}if(i&&1===i.status){let{open_time:e,close_time:t}=i;if(e>t&&l>="00:00:00"&&l<=t)return!0}return!1},rL=(e,t)=>!!(e.menu_timing&&Array.isArray(e.menu_timing))&&e.menu_timing.length>0&&rB(e.menu_timing,t);(0,_.useEffect)(()=>{tq&&(0,y.YA)(tq,tz)},[tq]);let rR=async(t,o)=>{var a,r,l,n;ah(!0);let i=null===(r=e.restaurant_settings)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.restaurant_id,s=tp||(null===(n=e.restaurant_settings)||void 0===n?void 0:null===(l=n.data)||void 0===l?void 0:l.bot_language);localStorage.removeItem("offer_details_".concat(t2)),H.A.remove("offer_details_".concat(t2)),window.dispatchEvent(new Event("promotionCleared")),await (0,x.x)(t,o,i,s,tg,e,t7,tX,t1,t9,tY,e=>(0,y.YA)(e,tz),p._,b.d,tB,aK,aZ,!0,t2,rA,aU,"homepage"),ah(!1)};(0,_.useEffect)(()=>{if(t2&&oB)try{let e=JSON.parse(oB);oR(null==e?void 0:e.branch)}catch(e){console.error("Error parsing storedMode:",e)}},[localStorage.getItem("selected_branchmode_".concat(t2))]);let rz=localStorage.getItem("loggedin_".concat(t2));(0,_.useEffect)(()=>{rz&&oG(!1)},[rz]),(0,_.useEffect)(()=>{!oQ.shouldShowChangeMode||!oQ.triggeredByPopupClose||oY||aR||oJ.current||(window.innerWidth<1024?tu(!0):t_(!0),oX({shouldShowChangeMode:!1,triggeredByPopupClose:!1,triggeredByLoginClose:!1}))},[oQ,oY,aR]);let rq=(0,_.useRef)(!1),rY=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let e=(0,V.Fe)(window.location.href),{hasPromo:t}=(0,V.zh)(e),o=()=>{(null==a1?void 0:a1.restaurant_id)&&(null==oL?void 0:oL.branch_id)&&(null==oe?void 0:oe.mode)&&(console.log(">>> Calling Offer API",{loginBooleans:rr,hasPromo:t}),rG())};rr&&!rY.current?(o(),rY.current=!0):!t||rr||rq.current||(o(),rq.current=!0)},[a1,oL,oe,rr,tg.asPath]),(0,_.useEffect)(()=>{(null==on?void 0:on.secondary_text_color)&&(document.documentElement.style.setProperty("--scrollbar-thumb-color",null==on?void 0:on.secondary_text_color),document.documentElement.style.setProperty("--scrollbar-track-color","#f1f1f1"))},[]),(0,_.useEffect)(()=>{JSON.parse(localStorage.getItem("cart_redirect")||"false")&&(localStorage.removeItem("cart_redirect"),od(!0),tg.push("/".concat(t2,"/cart")))},[tg]),(0,_.useEffect)(()=>{let e=(0,V.Fe)(window.location.href),{hasPromo:t}=(0,V.zh)(e),o=e.promo,a=e.target_link;av(t),o&&(localStorage.setItem("currentPromo",o),a&&localStorage.setItem("currentPromoTargetLink",a))},[tg.asPath]);let rG=async()=>{let e=(0,V.Fe)(window.location.href),{promo:t,target_link:o}=e,a=localStorage.getItem("profile_check_".concat(t2)),r=a?JSON.parse(a):null,l=localStorage.getItem("currentPromo")||t,n=!!l,{hasPromo:i,hasTargetLinkRewards:s}=(0,V.zh)(e),d=(0,h.z)(),c=(null==oe?void 0:oe.mode)==="pickup"?"takeout":null==oe?void 0:oe.mode,u=(0,U.l)(null==a1?void 0:a1.restaurant_id,null==oL?void 0:oL.branch_id,c,"","",a1?null==a1?void 0:a1.bot_language:"",aK,an),m=(0,U.l)(null==a1?void 0:a1.restaurant_id,null==oL?void 0:oL.branch_id,c,(null==r?void 0:r.phone_number)||"",(null==r?void 0:r.member_id)||"",a1?null==a1?void 0:a1.bot_language:"",aK,an),_=rr?u:m;console.log(rr,"loginBooleans",or);try{let e="".concat(window.location.origin,"/"),t="https://order.foodbot.ai/apiv2";e&&(t=e+"apiv2");let o=await fetch("".concat(t,"/ecom/v1/offers"),{method:"POST",headers:d,body:JSON.stringify({...JSON.parse(_),...n?{coupon_code:l}:{},...n?{utm_campaign:l}:{},...n?{utm_source:"promo"}:{},...n?{is_loyality_show:1}:{},...rr&&(null==r?void 0:r.phone_number)?{phone_number:r.phone_number}:{},...rr&&(null==r?void 0:r.member_id)?{member_id:r.member_id}:{}}),redirect:"follow"}),a=await o.json();if("200"==a.status_code||"204"==a.status_code&&"success"===a.status){var g,v,p;(i||l)&&rz&&(localStorage.removeItem("currentPromo"),localStorage.removeItem("currentPromoTargetLink"),a_(!0)),(null==a?void 0:null===(g=a.data)||void 0===g?void 0:g.loyalty_points_details)&&localStorage.setItem("loyalty_points_details_".concat(t2),JSON.stringify(null==a?void 0:null===(p=a.data)||void 0===p?void 0:p.loyalty_points_details));let e=a.data.offer_details,t=(null===(v=a.data)||void 0===v?void 0:v.new_message)||"",o=e.find(e=>
1e.coupon_code===l),r={promo_link_invalid:tv("promo_link_invalid"),promo_found_not_redeemed:tv("promo_found_not_reddemed"),offer_invalid:tv("offer_invalid"),coupon_redeem_successfull:tv("coupon_redeem_successfull"),claim_limit_reached:tv("claim_limit_reached"),promo_already_used:tv("promo_found_not_reddemed"),coupon_already_used:tv("promo_found_not_reddemed")},n=(null==o?void 0:o.refined_message)||(null==o?void 0:o.message_key)||(null==o?void 0:o.message);if(rz&&["coupon_redeem_successfull","promo_link_invalid","offer_invalid","promo_already_used","claim_limit_reached","promo_first_time_use_only","coupon_already_used"].includes(n)&&(localStorage.removeItem("currentPromo"),localStorage.removeItem("currentPromoTargetLink")),o&&l){let a=()=>{1==o.popup_status&&(oq(o),oG(!0))};if((null==o?void 0:o.refined_message)==="already_claimed_not_used"){rz&&s&&localStorage.setItem("offer_with_target_".concat(t2),"true"),a(),aW(tv("already_claimed_coupon"));return}if(o.promotion_code===l&&o.coupon_code===l){a(),aW(t||tv("promo_foun
1d_not_reddemed"));return}if(o.promotion_code===l&&o.coupon_code===l&&"promo_first_time_use_only"===o.message_key){a(),aW(t||tv("promo_first_time_use_only"));return}if("claim_limit_reached"===o.refined_message){let r=e.some(e=>e.promotion_code===l);if(r){a(),aW(t||tv("promo_found_not_reddemed"));return}if(!r&&"claim_limit_reached"===o.refined_message){aU(t||"You can't use this coupon. You've already received the reward.");return}}}if((i||l)&&t&&!(null==r?void 0:r[n])){(null==o?void 0:o.offer_id)||(null==o?void 0:o.points_credited)?aW(t):aU(t);return}if(o&&(null==r?void 0:r[o.message_key||o.refined_message||o.message])){aU(t||(null==r?void 0:r[o.message_key||o.refined_message||o.message]));return}console.log(o&&(null==r?void 0:r[o.message_key||o.refined_message||o.message]),"ccccccccccccccccccccccc===");let d=e=>{oq(e),(Array.isArray(e)?e:[e]).some(e=>(null==e?void 0:e.offer_type)==="unclaimed_signupoffer")&&(rz?ok():oS()?ok():ow())};if(i||l){rz||oH||oS()||(oG(!0),oU(!0));let e=localStorage.getItem("currentPromoTargetLink"),t=s||"rewards"===e;rz&&t&&!["promo_link_invalid","promo_already_used","claim_limit_reached","promo_first_time_use_only","offer_invalid","coupon_already_used"].includes(null==o?void 0:o.message)?(localStorage.setItem("offer_with_target_".concat(t2),"true"),localStorage.removeItem("currentPromoTargetLink")):!rz||t||oH||oS()||(oG(!0),oU(!0)),oq(a.data.offer_details);return}d(e);let c=e.find(e=>"unclaimed_signupoffer"==e.offer_type&&1==e.popup_status);if(c)d(c);else{let t=e.find(e=>1==e.popup_status);t&&d(t)}setTimeout(()=>{let e=new URL(window.location.href);e.searchParams.has("promo")&&e.searchParams.delete("promo"),e.searchParams.has("target_link")&&e.searchParams.delete("target_link"),e.searchParams.has("userkey")&&e.searchParams.delete("userkey"),e.searchParams.has("mobile")&&e.searchParams.delete("mobile"),e.searchParams.has("user_name")&&e.searchParams.delete("user_name"),e.searchParams.has("order")&&e.searchParams.delete("order"),es(e.toString()),rz&&localStorage.removeItem("currentPromoTargetLink")},6e3)}else(i||l)&&"Invalid Promo"===a.message&&aU(tv("promo_link_invalid"))}catch(e){console.error("API error:",e)}},rH=(0,_.useMemo)(()=>(0,V.gm)(window.location.href),[]);(0,_.useEffect)(()=>{(rH.hasUserKey||rH.sender_id)&&rU(),rH.hasCart&&rV(),rH.type&&r1(),rH.hasCallin&&rH.callin_order_id&&rK(rH.callin_order_id)},[rH.hasUserKey,rH.sender_id,rH.hasCart,rH.type,rH.hasCallin]),(0,_.useEffect)(()=>{let e=localStorage.getItem("selected_branchmode_".concat(t2));if(e)try{var t;let o=JSON.parse(e);(null==o?void 0:null===(t=o.branch)||void 0===t?void 0:t.branch_id)&&au(e=>e+1)}catch(e){console.error("Error parsing branch mode:",e)}},[localStorage.getItem("selected_branchmode_".concat(t2))]),(0,_.useEffect)(()=>{let e="true"===localStorage.getItem(o$),t=localStorage.getItem("currentPromo");e&&t&&(null==a1?void 0:a1.restaurant_id)&&(null==oL?void 0:oL.branch_id)&&(null==oe?void 0:oe.mode)&&!rY.current&&(rG(),rY.current=!0)},[a1,oL,oe,o$,rG]);let rU=()=>{var t,o,a,r;let l=(0,V.gm)(window.location.href);if(!l.hasUserKey&&!l.sender_id){console.log("User did not come from a link with userkey or sender_id, skipping API call.");return}if(l.sender_id&&!l.mobile){console.log("Sender_id is present, but mobile is missing, skipping API call.");return}let n=void 0!==l.order,i=(0,h.z)(),s="EcomV2",d=l.userkey;l.user_name&&l.mobile&&(d=l.mobile,s="facebook");let c=JSON.stringify({restaurant_id:(null===(o=e.restaurant_settings)||void 0===o?void 0:null===(t=o.data)||void 0===t?void 0:t.restaurant_id)||"",phone_number:d,user_name:l.user_name||"",first_name:l.user_name||"",last_name:"",country_code:"",email:"",dob:"",utm_campaign:"",utm_source:"",http_referrer:"",lang:(null===(r=e.restaurant_settings)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.bot_language)||"",source:s,session_id:aK,version:an,...l.sender_id?{sender_id:l.sender_id}:{},request_timestamp:new Date().toISOString(),...l.hasUserKey?{whatsapp_direct_link:1}:{}}),u="https://order.foodbot.ai/apiv2";rA&&(u=rA+"apiv2"),fetch("".concat(u,"/ecom/v1/profilecheck"),{method:"POST",headers:i,body:c,redirect:"follow"}).then(e=>e.json()).then(e=>{if(200==e.status_code||201==e.status_code&&"success"==e.status){if(localStorage.setItem(o0,JSON.stringify(e.data)),localStorage.setItem(o$,"true"),H.A.set(o$,"true"),ol(e.data),rl(!0),n&&o$){localStorage.setItem("orderId_feedback_".concat(t2),l.order),localStorage.setItem("redirect_to_myorders_".concat(t2),"true");let e="/".concat(t2,"/myorders");setTimeout(()=>{window.location.href=e},1500)}let t=localStorage.getItem("currentPromoTargetLink");("rewards"===l.target_link||"rewards"===t)&&(localStorage.setItem("offer_with_target_".concat(t2),"true"),t&&localStorage.removeItem("currentPromoTargetLink"))}else e.status_code,aU(o1(e.status_code,e.message))}).catch(e=>{console.error("Fetch error:",e)})},rW={target_path:"ecom/v1/",file_name:"ecom_query_string",data:{user_details:or,url:tg.asPath,session_id:aK},lang:null==a1?void 0:a1.bot_language,source:"EcomV2",version:an,ui_request_timestamp:new Date().toISOString()},rV=()=>{var t,o;let a=(0,V.gm)(window.location.href);
1if(!a.hasCart){console.log("User did not come from a link with cart skipping API call.");return}let r=(0,h.z)(),l=JSON.stringify({request_id:a.cart,restaurant_id:(null===(o=e.restaurant_settings)||void 0===o?void 0:null===(t=o.data)||void 0===t?void 0:t.restaurant_id)||"",lang:null==a1?void 0:a1.bot_language,session_id:aK,source:"EcomV2",version:an,ui_request_timestamp:new Date().toISOString()}),n="".concat(window.location.origin,"/"),i="https://order.foodbot.ai/apiv2";n&&(i=n+"apiv2"),fetch("".concat(i,"/ecom/v1/get-cart"),{method:"POST",headers:r,body:l,redirect:"follow"}).then(e=>e.json()).then(e=>{if("success"==e.status&&200==e.status_code){aW(e.message);let t=localStorage.getItem("profile_check_".concat(t2)),o=e.data.cart_json.cart.item_details;localStorage.setItem("cartItemDetails_".concat(t2),JSON.stringify(o)),aW(e.message),t?(localStorage.setItem("cart_redirect",JSON.stringify(!0)),od(!0),tg.push("/".concat(t2,"/cart"))):localStorage.setItem("cart_redirect",JSON.stringify(!0))}else 201===e.status_code?aU("Invalid restaurant_id"):202===e.status_code?aU("no cart for given request_id"):203===e.status_code?aU("Cart status 1 or 3"):aU("Something went wrong")}).catch(e=>{aU("Something went wrong")})},rK=t=>ek(t,{router:tg,props:e,resturantsettings:a1,sessionId:aK,version:an,currentDomain:rA,setChangeModeBranchId:t7,setGetBranchMenu:tX,setGetUpsellingMenu:t1,setPaymentMethod:t9,setCurrentBranch:tY,setRestaurantOpen:tz,setProfileCheckdata:ol,setLoginBooleans:rl,setBtnLoading:od,openFailureModalFunc:aU}).catch(e=>{console.error("[callin] checkCallInOrder threw an unhandled error:",e)});(0,_.useEffect)(()=>{let t=localStorage.getItem("selected_branchmode_".concat(t2));if(t)try{var o,a,r,l,n,i,s,d;let c=JSON.parse(t);if(ot(c),(null==c?void 0:c.mode)==="pickup"||(null==c?void 0:c.mode)==="dinein")(null==c?void 0:c.branch)&&(t7(c),tY(c.branch),(0,y.YA)(c.branch,tz),(0,p._)(t2,c.branch.branch_id,null===(a=e.restaurant_settings)||void 0===a?void 0:null===(o=a.data)||void 0===o?void 0:o.restaurant_id,null===(l=e.restaurant_settings)||void 0===l?void 0:null===(r=l.data)||void 0===r?void 0:r.brand_id,c.mode,aK,an,rA).then(e=>{var t;let o=null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.menu_type;o&&Array.isArray(o)&&o.length>0?tX(o):tX([]),au(e=>e+1)}));else if((null==c?void 0:c.mode)==="delivery"){let t=localStorage.getItem("branch_delivery_".concat(t2));if(t){let o=JSON.parse(t);t7({branch:o,mode:"delivery"}),tY(o),(0,y.YA)(o,tz),(0,p._)(t2,o.branch_id,null===(i=e.restaurant_settings)||void 0===i?void 0:null===(n=i.data)||void 0===n?void 0:n.restaurant_id,null===(d=e.restaurant_settings)||void 0===d?void 0:null===(s=d.data)||void 0===s?void 0:s.brand_id,"delivery",aK,an,rA).then(e=>{var t;let o=null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.menu_type;o&&Array.isArray(o)&&o.length>0?tX(o):tX([]),au(e=>e+1)})}}}catch(e){console.error("Error parsing stored mode:",e)}},[t2,rA,localStorage.getItem("selected_branchmode_".concat(t2)),null===(eK=e.restaurant_settings)||void 0===eK?void 0:null===(eV=eK.data)||void 0===eV?void 0:eV.brand_id,null===(eQ=e.restaurant_settings)||void 0===eQ?void 0:null===(eZ=eQ.data)||void 0===eZ?void 0:eZ.restaurant_id,aK,an]);let rZ=((null==t5?void 0:t5.order_type_status)||[])[0]||{},rQ=(null==rZ?void 0:rZ.delivery_status)==1,rX=(null==rZ?void 0:rZ.pickup_status)==1,r$=(null==rZ?void 0:rZ.dinein_status)==1,r0=(0,_.useMemo)(()=>{switch(null==t6?void 0:t6.mode){case"delivery":return rQ;case"pickup":default:return rX;case"dinein":return r$}},[null==t6?void 0:t6.mode,rQ,rX,r$]),r1=async()=>{var t,o;let a=(0,V.gm)(window.location.href),r=new URL(window.location.href).searchParams.get("type");if(!r||"normal"===r.trim().toLowerCase()){console.log("Skipping dine-in check — invalid type:",r);return}if(!a.type){console.log("User did not come from a link with dine-in, skipping API call.");return}localStorage.getItem("scheduledOrder_".concat(t2))&&(localStorage.removeItem("scheduledOrder_".concat(t2)),console.log("\uD83D\uDDD1️ Removed scheduledOrder from localStorage")),localStorage.getItem("current_scheduledOrder__".concat(t2))&&(localStorage.removeItem("current_scheduledOrder__".concat(t2)),console.log("\uD83D\uDDD1️ Removed current_scheduledOrder__".concat(t2," from localStorage")));let[l,n,i]=new TextDecoder("utf-8").decode(Uint8Array.from(atob(a.type),e=>e.charCodeAt(0))).split("#"),s=(0,h.z)(),d=JSON.stringify({branch_id:n,table_no:i,restaurant_id:(null===(o=e.restaurant_settings)||void 0===o?void 0:null===(t=o.data)||void 0===t?void 0:t.restaurant_id)||"",lang:null==a1?void 0:a1.bot_language,session_id:aK,source:"EcomV2",version:an,ui_request_timestamp:new Date().toISOString()}),c="".concat(window.location.origin,"/"),u="https://order.foodbot.ai/apiv2";
1c&&(u=c+"apiv2"),fetch("".concat(u,"/ecom/v1/check-dinein-branch"),{method:"POST",headers:s,body:d,redirect:"follow"}).then(e=>e.json()).then(t=>{if("success"===t.status&&200===t.status_code){if("yes"===t.data.dinein&&"yes"===t.data.valid_table){localStorage.setItem("dine_in_data",JSON.stringify(t)),localStorage.setItem("dine_in_table",JSON.stringify(i)),aa(!0),localStorage.setItem("is_dinein_tab_".concat(e.alias),"false");let s=Number(n),d=null==t5?void 0:t5.dinein_branches.find(e=>Number(e.branch_id)===s);if(d){var o,a,r,l;let t={restaurant_id:null===(a=e.restaurant_settings)||void 0===a?void 0:null===(o=a.data)||void 0===o?void 0:o.restaurant_id,branch_id:d.branch_id,is_schedule:!1,order_type:"dinein",source:{lat:Number(d.branch_latitude),lng:Number(d.branch_longitude)},is_callin:!1,lang:tp||(null===(l=e.restaurant_settings)||void 0===l?void 0:null===(r=l.data)||void 0===r?void 0:r.bot_language),api_source:"EcomV2",session_id:aK,version:an,currentDomain:c,request_timestamp:new Date().toISOString()};t7({branch:d,mode:"dinein"}),tY(d),rJ(d,"dinein"),localStorage.setItem("selected_branchmode_".concat(t2),JSON.stringify({branch:d,mode:"dinein"})),H.A.set("selected_branchmode_".concat(t2),JSON.stringify({branch:d,mode:"dinein"}),{sameSite:"None",secure:!0,expires:7}),localStorage.setItem("payload_".concat(t2),JSON.stringify(t)),H.A.set("payload_".concat(t2),JSON.stringify(t),{sameSite:"None",secure:!0,expires:7}),setTimeout(async()=>{var t,o,a,r,l,n,i;try{let n=await (0,p._)("".concat(t2),d.branch_id,null===(o=e.restaurant_settings)||void 0===o?void 0:null===(t=o.data)||void 0===t?void 0:t.restaurant_id,null===(r=e.restaurant_settings)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.brand_id,"dinein",aK,an,c),i=null==n?void 0:null===(l=n.data)||void 0===l?void 0:l.menu_type;i&&Array.isArray(i)&&i.length>0?tX(i):tX([]);let s="branchMenuDetail_".concat(t2),u=i&&Array.isArray(i)&&i.length>0?i:[];await (0,en.tE)(s,u),console.log("\uD83C\uDF71 Menu saved to IndexedDB for dine-in under key: ".concat(s))}catch(t){console.error("Error fetching or saving dine-in menu:",t),null===(i=e.context)||void 0===i||null===(n=i.openFailureModalFunc)||void 0===n||n.call(i,tv("Failed to load dine-in menu. Please try again."))}},1e3)}else console.log("No matching branch found for ID:",s)}else console.log("Invalid dine-in or table."),setTimeout(()=>{aU(tv("The dine-in option is not enabled at this store."))},3e3),tu(!0)}else console.log("API call failed or returned unexpected status."),setTimeout(()=>{aU(tv("The dine-in option is not enabled at this store."))},3e3),tu(!0);setTimeout(()=>{let e=new URL(window.location.href);e.searchParams.has("type")&&e.searchParams.delete("type"),es(e.toString())},5e3)}).catch(e=>{console.error("Error during API call:",e),aU("Something went wrong")})},[r2,r5]=(0,_.useState)(""),r3=(0,_.useRef)([]),r4=(0,_.useRef)([]);X(ra,r3,e=>{e&&ty(e)});let r6=(0,_.useCallback)(e=>{e.forEach(e=>{if(e.isIntersecting){let t=e.target.getAttribute("data-category");t&&r5(t)}})},[]);(0,_.useEffect)(()=>{let e=new IntersectionObserver(r6,{root:null,rootMargin:"0px",threshold:.5});return r3.current&&r3.current.forEach(t=>{e.observe(t)}),()=>{r3.current&&r3.current.forEach(t=>{e.unobserve(t)})}},[r6]),(0,_.useEffect)(()=>{o7(!0)},[]),(0,_.useEffect)(()=>{tq&&tq.branch_business_hours&&(0,y.YA)(tq,tz)},[tq]),(0,_.useEffect)(()=>{var e;if(!o6||!tb.current)return;let t=new IntersectionObserver(e=>{e.forEach(e=>{!tS.current&&e.isIntersecting&&ty(e.target.getAttribute("data-category")),1==e.intersectionRatio||0==e.intersectionRatio?at(1):at(.5)})},{threshold:ae}),o=null===(e=tb.current)||void 0===e?void 0:e.querySelectorAll("[data-category]");return null==o||o.forEach(e=>t.observe(e)),()=>{null==o||o.forEach(e=>t.unobserve(e))}}),(0,_.useEffect)(()=>{let e=()=>{var e,t;if(tS.current)return;let o=null!==(t=null===(e=tx.current)||void 0===e?void 0:e.getBoundingClientRect().bottom)&&void 0!==t?t:120,a="";for(let e of r4.current)if(e){if(e.getBoundingClientRect().top<=o+10)a=e.getAttribute("data-category")||"";else break}a&&ty(a)};return window.addEventListener("scroll",e,{passive:!0}),()=>window.removeEventListener("scroll",e)},[]);let r7=(0,_.useCallback)(()=>
1{if(tb.current){let e=tb.current.querySelectorAll("[data-category]");if(e.length>0){let t=null,o=0;e.forEach(e=>{let a=e.getBoundingClientRect(),r=Math.min(a.bottom,window.innerHeight)-Math.max(a.top,0);r>o&&r>0&&(o=r,t=e.getAttribute("data-category"))}),t&&t!==tf&&ty(t)}}},[tf]);(0,_.useEffect)(()=>{let e=tb.current;if(e)return e.addEventListener("scroll",r7),()=>{e.removeEventListener("scroll",r7)}},[r7]);let r8=e=>{tJ(e),tE(!0),setTimeout(()=>{tE(!1)},3e3)},r9=a1&&(null==a1?void 0:null===(e$=a1.ecom_settings)||void 0===e$?void 0:null===(eX=e$.general_settings)||void 0===eX?void 0:eX.loader_image),le=(null===(e0=e.restaurant_settings)||void 0===e0?void 0:e0.data)&&(null===(e2=e.restaurant_settings)||void 0===e2?void 0:null===(e1=e2.data)||void 0===e1?void 0:e1.currency_symbol);null==t8||null===(e5=t8.data)||void 0===e5||e5.delivery_partners;let lt=(e,t)=>{tO(o=>({...o,[e]:t}))},lo=(0,_.useCallback)(e=>{if(oa(e),ty(e),tW(e),window.innerWidth<1024){let a=document.querySelector('[data-category="'.concat(CSS.escape(e),'"]'));if(a){var t,o;let e=70+(null!==(o=null===(t=tx.current)||void 0===t?void 0:t.offsetHeight)&&void 0!==o?o:50);tS.current=!0,tw.current&&clearTimeout(tw.current);let r=()=>{tw.current&&clearTimeout(tw.current),tw.current=setTimeout(()=>{tS.current=!1,window.removeEventListener("scroll",r);let t=a.getBoundingClientRect().top-e;Math.abs(t)>3&&window.scrollBy({top:t,behavior:"instant"})},150)};window.addEventListener("scroll",r,{passive:!0}),tw.current=setTimeout(()=>{tS.current=!1,window.removeEventListener("scroll",r)},3e3),a.style.scrollMarginTop="".concat(e,"px"),a.scrollIntoView({behavior:"smooth",block:"start"})}}else if(tb.current){let t=CSS.escape(e),o=tb.current.querySelector('[data-category="'.concat(t,'"]'));o&&o.scrollIntoView({behavior:"smooth",block:"start"})}td(!1)},[]);if(o3||os)return(0,a.jsx)("div",{className:"flex justify-center",children:(0,a.jsx)(Z.A,{text:tv("processing")})});let la=om&&om.date?I()(om.date).format("DD MMM"):"",lr=()=>{let e;if(console.log("pickupScheduleData",om),!(null==om?void 0:om.date)||!(null==om?void 0:om.time))return!1;if((null==om?void 0:om.mode)==="delivery"){let t=(om.time||"").replace(/(AM|PM)/i,"").trim();if(!t)return!1;e=I()("".concat(om.date," ").concat(t),"YYYY-MM-DD HH:mm")}else{let t=I()(om.time,"hh:mm A").format("HH:mm");e=I()("".concat(om.date," ").concat(t),"YYYY-MM-DD HH:mm")}let t=I()();return console.log("Scheduled:",e.format("YYYY-MM-DD HH:mm")),console.log("Now:",t.format("YYYY-MM-DD HH:mm")),e.isAfter(t)||e.isSame(t,"minute")};return!aM||aD?(0,a.jsx)("div",{className:"min-h-screen bg-gray-100 flex items-center justify-center",children:(0,a.jsxs)("div",{className:"bg-white p-8 rounded-lg shadow-md text-center",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-gray-900 mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-lg font-medium",children:"Loading Maps..."})]})}):(0,a.jsxs)(a.Fragment,{children:[ab&&(0,a.jsx)("div",{className:"fixed bottom-24 lg:bottom-8 right-4 z-50",children:(0,a.jsx)(ev,{primaryColor:rn,secondaryColor:ri,fontFamily:ru,onClick:rT})}),(0,a.jsx)(j.default,{id:a6,resId:a4.current,page:a7,data:{content_ids:[t2],content_type:"product_group",content_name:(null==aQ?void 0:aQ.restaurant_name)||t2,currency:null==aQ?void 0:aQ.currency}}),(0,a.jsx)(k.default,{id:re,settings:rP,page:a7,page_location:a8,data:{}}),ap&&(0,a.jsx)(Z.A,{text:tv("processing")}),aG&&(0,a.jsx)(eB,{open:aG,setOpen:aH,modalMessage:tT,closeModal:()=>aH(!1),redcolor:rv,fontFamily:ru}),og&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-gray-700 bg-opacity-50",children:(0,a.jsx)("div",{className:"relative   ring-1   rounded-lg shadow-2xl w-full max-w-md mx-4 p-6 transform transition-all duration-300 scale-100 hover:scale-105",style:{backgroundColor:r_,fontFamily:"".concat(ru,", sans-serif"),borderColor:ri},onClick:e=>e.stopPropagation(),children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("h2",{className:"text-2xl font-bold mb-4",style:{color:rn},children:tv("no_menu_available")}),(0,a.jsx)("p",{className:"text-lg mb-6",style:{color:rn,opacity:.9},children:tv("no_menu_available_right_now")})]})})}),(0,a.jsxs)("div",{className:"sticky top-0 border-b border-[#D0D0D0] z-30 ",children:[(0,a.jsx)(eA,{setbtnloading:od,restaurantOpen:tR,pickupScheduleData:om,restaurantId:null===(e4=e.restaurant_settings)||void 0===e4?void 0:null===(e3=e4.data)||void 0===e3?void 0:e3.restaurant_id}),aT&&(0,a.jsx)(eE,{onClose:()=>aJ(!1),isNavbar:!1,isArrow:!1,isCart:!1,discountapply:!1,reedemableConditon:"",usePoints:"",sessionId:aK},"promo-slider-".concat(ac,"-").concat((null==t6?void 0:null===(e6=t6.branch)||void 0===e6?void 0:e6.branch_id)||"default"))]}),aY&&(0,a.jsx)(eJ,{open:aY,setOpen:aq,modalMessage:aV,closeModal:()=>aq(!1)}),aG&&(0,a.jsx)(eB,{open:aG,setOpen:aH,modalMessage:aV,closeModal:()=>aH(!1),redcolor:rv,fontFamily:ru}),tA&&(0,a.jsx)(eT,{message:tT,onClose:()=>tE(!1)}),(0,a.jsxs)("div",{style:{backgroundColor:r_},className:"mx-auto lg:max-w-full max-w-7xl",children:[tN&&(0,a.jsx)(eO,{setCheckItemurl:"",setAddress:"",open:tN,setOpen:tI,children:(0,a.jsxs)("div",{className:"relative h-[200px] max-w-max",children:[(0,a.jsx)(u(),{src:"/ecomv2/coupon.png",height:177,width:336,alt:"couponImg",className:"h-[177px] w-[336px] -mt-2"}),(0,a.jsx)("div",{style:{backgroundColor:ri,color:rn,fontFamily:"".concat(ru,", sans-serif")},className:"absolute top-[150px]  w-full text-center text-lg p-3 font-black ",children:tv("use_coupon")})]})}),(0,a.jsx)(eC,{onClick:()=>
1{if(!tR&&!om){console.log("Store is closed"),aU(tv("The restaurant is currently closed. You cannot proceed to the cart."));return}let e="true"==localStorage.getItem("loggedin_".concat(t2));localStorage.removeItem("handleBranchClickCaller_".concat(t2)),e?(od(!0),setTimeout(()=>{tg.push("/".concat(t2,"/cart"))})):(aL(!0),localStorage.setItem("redirectToCart","true"))},primaryColor:rn,secondaryColor:ri,highlightTextColor:rc,highlightbgColor:rg,fontFamily:ru,secondaryBtnColor:rs,secondaryBtnTxtColor:rd}),window.innerWidth<1024&&(0,a.jsx)(G,{variant:"mobile",primaryColor:rn,fontFamily:ru,secondaryColor:ri,bgColor:r_,ErrorPrimaryColor:rv,changeModeBranchId:t6,pickupScheduleData:om,formattedDate:la,isDineInTab:tG,dineintable:ar,localMode:oe,effectiveBranches:t4,restaurantOpen:tR,deliveryTime:tB,canOpenChangeMode:a0,openMode:!1,setOpenMode:()=>{},changeModeModal:tc,setChangeModeModal:tu,secondaryBtnColor:rs,secondaryBtnTxtColor:rd,fallbackTimingBranch:(null===(e9=e.pickupbranches)||void 0===e9?void 0:null===(e8=e9.data)||void 0===e8?void 0:null===(e7=e8.branches_data)||void 0===e7?void 0:e7[0])||(null===(to=e.pickupbranches)||void 0===to?void 0:null===(tt=to.data)||void 0===tt?void 0:null===(te=tt.dinein_branches)||void 0===te?void 0:te[0]),setAddress:aP,containerStyle:aS,marker:aN,center:aw,onLoad:ak,onMarkerClick:aj,map:aO,setMarker:aA,address:aE,handleLocationSelect:aC,autocompleteRef:aI,alias:t2,getPickupBranches:t5,getClickedBranchId:rR,restaurantSettingsData:null==e?void 0:null===(ta=e.restaurant_settings)||void 0===ta?void 0:ta.data,triggerError:r8,setOpenLoginModal:aL,paymentMethod:t8,checkItemurl:oh,setCheckItemurl:of,requestLocationSort:rD,partner:as,resturant_currency:le,resturantsettings:a1}),(0,a.jsxs)("div",{ref:tx,style:{backgroundColor:rc},className:"lg:hidden block  sticky top-[70px] z-10",children:[(0,a.jsxs)("div",{style:{backgroundColor:r_},className:"border-t  border-b border-lineGray  lg:hidden block  ",children:[(0,a.jsx)(eP,{onCategoryChange:e=>{ty(e)},currentCategory:tf,setIsOpen:td,MenuCategory:tQ,primaryColor:rn,fontFamily:ru,handleCategoryClickk:lo,category:oo,bgColor:r_,setActiveCategory:ty,secondaryColor:ri}),(0,a.jsx)("div",{className:" ",children:(0,a.jsx)(eF,{isOpen:ts,setIsOpen:td,isPaymentScreen:!1,primaryColor:rn,secondaryColor:ri,fontFamily:ru,bgColor:r_,loaderImage:r9,children:(0,a.jsxs)("div",{className:" h-[60vh] px-6",children:[(0,a.jsx)("div",{style:{color:rn,fontFamily:"".concat(ru,", sans-serif")},className:"font-black text-lg pl-2 pb-5 ",children:tv("menu")}),tQ&&(null==tQ?void 0:tQ.length)>0&&tQ.map((e,t)=>{var o;return(0,a.jsx)("div",{children:(null===(o=e.menu_category)||void 0===o?void 0:o.length)>0&&e.menu_category.filter(e=>{var t;return(null===(t=e.cat_items)||void 0===t?void 0:t.length)>0}).map((e,t)=>{var o;return(0,a.jsxs)("div",{style:{color:rm,fontFamily:"".concat(ru,", sans-serif")},className:"mx-auto justify-between lg:m-0 pb-5 pl-2 flex items-center cursor-pointer",onClick:()=>lo(e.category_display_text),children:[(0,a.jsx)("span",{children:(0,d.M1)(e,tp,th)}),(0,a.jsx)("span",{style:{backgroundColor:rs,color:rd,fontFamily:"".concat(ru,", sans-serif")},className:"mr-2 w-6 h-6 flex items-center justify-center rounded-full text-xs font-semibold",children:(null===(o=e.cat_items)||void 0===o?void 0:o.length)||0})]},t)})},t)})]})})})]}),om&&om.date&&"ASAP"!==om.time&&lr()&&(0,a.jsxs)("div",{style:{color:rd,backgroundColor:rs,fontFamily:"".concat(ru,", sans-serif")},className:"text-center p-2 m-1 text-xs rounded-lg font-bold shadow-md max-w-full",children:["".concat(tv("Your order for")," "),"".concat(om.date.slice(8,10),"-").concat(om.date.slice(5,7))," ".concat(tv("is scheduled at")," "),(0,a.jsx)("span",{children:om.time})]}),!tR&&!om&&(0,a.jsx)(em,{timingData:(null==t6?void 0:t6.branch)||[],fontFamily:ru,primaryColor:rn,ErrorPrimaryColor:rv})]}),(0,a.jsx)("div",{className:"lg:hidden block pb-[10px]",children:(null==rj?void 0:rj.length)>0?null===(tr=F(rj))||void 0===tr?void 0:tr.map((e,t)=>{var o,r,l,n,i;let s=null!==(i=null==tq?void 0:tq.timezone)&&void 0!==i?i:"Etc/GMT+6";null==e||null===(o=e.menu_category)||void 0===o||o.filter(e=>{var t;return(null==e?void 0:null===(t=e.cat_items)||void 0===t?void 0:t.length)>0});let c=null==e?void 0:null===(l=e.menu_category)||void 0===l?void 0:null===(r=l.filter(e=>{var t;return(null==e?void 0:null===(t=e.cat_items)||void 0===t?void 0:t.length)>0}))||void 0===r?void 0:r.map(t=>{var o,a;let r=!1;return r=(null==e?void 0:e.type)==="top_picks"&&(null==e?void 0:e.menu_id)==="000"?null==t?void 0:null===(o=t.cat_items)||void 0===o?void 0:o.some(e=>rL(e,s)):null==t?void 0:null===(a=t.cat_items)||void 0===a?void 0:a.some(t=>rB((null==t?void 0:t.menu_timing)&&t.menu_timing.length>0?t.menu_timing:null==e?void 0:e.menu_timing,s)),{name:null==t?void 0:t.category_display_text,available:r}});return(0,a.jsx)("div",{children:null==e?void 0:null===(n=e.menu_category)||void 0===n?void 0:n.map((t,o)=>{var r,l;let n=null==c?void 0:c.find(e=>(null==e?void 0:e.name)===(null==t?void 0:t.category_display_text));return(null==t?void 0:null===(r=t.cat_items)||void 0===r?void 0:r.length)>0?(0,a.jsxs)("div",{ref:e=>{r3.current[null==t?void 0:t.category_display_text]=e,e&&!r4.current.includes(e)&&r4.current.push(e)},"data-category":null==t?void 0:t.category_display_text,className:"scroll-mt-[120px]",children:[(0,a.jsx)("div",{style:{color:ri},className:"pt-4 px-4 font-black",children:(0,d.M1)(t,tp,th).toUpperCase()}),(0,a.jsx)("div",{className:"grid md:grid-cols-2 sm:gap-3",children:null==t?void 0:null===(l=t.cat_items)||void 0===l?void 0:l.map((o,r)=>
1{var l;let i=!0;return i=(null==e?void 0:e.type)==="top_picks"&&(null==e?void 0:e.menu_id)==="000"?rL(o,s):null==n?void 0:n.available,(0,a.jsx)("div",{className:"m-0",children:(0,a.jsx)(eI,{primaryColor:rn,secondaryColor:ri,data:o,descriptionColor:rm,fontFamily:ru,loading:aB,Opendrawer:tF,setGetItemId:()=>rO(o.item_id,t.category_id,i),resturant_currency:le,restaurantOpen:tR,bgColor:r_,isMenuAvailableNow:i,ErrorPrimaryColor:rv,ErrorSecondaryColor:rp,menuTiming:(null==o?void 0:o.menu_timing)&&o.menu_timing.length>0?o.menu_timing:null!==(l=null==e?void 0:e.menu_timing)&&void 0!==l?l:[]})},r)})})]},o):null})},t)}):(0,a.jsx)(ea,{primaryColor:rn,secondaryColor:ri,bgColor:r_,descriptionColor:rm,fontFamily:ru,ErrorPrimaryColor:rv,ErrorSecondaryColor:rp,heading:tv("No Menu Available"),subheading:tv("We’re currently updating our menu or there are no items available at this time.")})}),(0,a.jsxs)("div",{className:"",children:[(0,a.jsx)(G,{variant:"desktop",primaryColor:rn,fontFamily:ru,secondaryColor:ri,bgColor:r_,ErrorPrimaryColor:rv,changeModeBranchId:t6,pickupScheduleData:om,formattedDate:la,isDineInTab:tG,dineintable:ar,localMode:oe,effectiveBranches:t4,restaurantOpen:tR,deliveryTime:tB,canOpenChangeMode:a0,openMode:tm,setOpenMode:t_,changeModeModal:!1,setChangeModeModal:()=>{},secondaryBtnColor:rs,secondaryBtnTxtColor:rd,fallbackTimingBranch:null,setAddress:aP,containerStyle:aS,marker:aN,center:aw,onLoad:ak,onMarkerClick:aj,map:aO,setMarker:aA,address:aE,handleLocationSelect:aC,autocompleteRef:aI,alias:t2,getPickupBranches:t5,getClickedBranchId:rR,restaurantSettingsData:null==e?void 0:null===(tl=e.restaurant_settings)||void 0===tl?void 0:tl.data,triggerError:r8,setOpenLoginModal:aL,paymentMethod:t8,checkItemurl:oh,setCheckItemurl:of,requestLocationSort:rD,partner:as,resturant_currency:le,resturantsettings:a1}),(0,a.jsxs)("div",{className:"lg:flex hidden mt-[1px]",children:[(0,a.jsxs)("div",{className:"w-[15%] mt-[1px] border-r  px-6  sticky left-0 top-20 h-screen overflow-y-auto z-0",style:{boxShadow:"2px 0 2px rgba(0, 0, 0, 0.1)",backgroundColor:rh,maxHeight:"calc(100vh - 5rem)"},children:[(0,a.jsx)("div",{style:{color:rn,fontFamily:"".concat(ru,", sans-serif")},className:"py-9 font-black",children:tv("menu")}),(null==tQ?void 0:tQ.length)>0&&(null==tQ?void 0:tQ.map((e,t)=>{var o;return(0,a.jsx)("div",{className:"text-sm",children:null==e?void 0:null===(o=e.menu_category)||void 0===o?void 0:o.filter(e=>{var t;return(null==e?void 0:null===(t=e.cat_items)||void 0===t?void 0:t.length)>0}).map((e,t)=>(0,a.jsx)("div",{style:{color:rn,fontFamily:"".concat(ru,", sans-serif")},className:"cursor-pointer pb-4 ".concat((null==e?void 0:e.category_display_text)===tU?"font-black":""),onClick:()=>lo(null==e?void 0:e.category_display_text),children:aB?(0,a.jsx)(v.A,{width:200}):(0,d.M1)(e,tp,th)},t))},t)}))]}),(0,a.jsxs)("div",{className:"w-[85%]  overflow-y-auto ",ref:tb,children:[om&&om.date&&"ASAP"!==om.time&&lr()&&(0,a.jsxs)("div",{style:{color:rd,backgroundColor:rs,fontFamily:"".concat(ru,", sans-serif")},className:"text-center p-2 m-1 font-bold text-sm rounded-lg shadow-md max-w-full",children:["".concat(tv("Your order for")," "),(0,a.jsx)("span",{className:"mx-2 font-extrabold",children:"".concat(om.date.slice(8,10),"-").concat(om.date.slice(5,7))})," ".concat(tv("is scheduled at")," "),(0,a.jsx)("span",{className:"mx-2 font-extrabold",children:om.time})]}),(0,a.jsx)("div",{children:!tR&&!om&&(0,a.jsx)(em,{timingData:(null==t6?void 0:t6.branch)||[],fontFamily:ru,primaryColor:rn,ErrorPrimaryColor:rv})}),r0&&(null==rj?void 0:rj.length)>0?null==rj?void 0:null===(tn=rj.sort((e,t)=>{let o="top_picks"===e.type&&"000"===e.menu_id,a="top_picks"===t.type&&"000"===t.menu_id;if(o&&!a)return -1;if(!o&&a)return 1;let r=e=>{let t=new Date,o=t.getDay(),a=t.getHours(),r=t.getMinutes();return!e.menu_timing.some(e=>{let[t,l]=e.open_time.split(":").map(Number),[n,i]=e.close_time.split(":").map(Number);return e.day===o.toString()&&(a>t||a===t&&r>=l)&&(a<n||a===n&&r<=i)})},l=r(e);return l===r(t)?0:l?1:-1}))||void 0===tn?void 0:tn.map((e,t)=>{var o,r,l,n;let i=null!==(n=null==tq?void 0:tq.timezone)&&void 0!==n?n:"Etc/GMT+6",s=null==e?void 0:null===(r=e.menu_category)||void 0===r?void 0:null===(o=r.filter(e=>{var t;return(null==e?void 0:null===(t=e.cat_items)||void 0===t?void 0:t.length)>0}))||void 0===o?void 0:o.map(t=>{var o,a;let r=!1;return r=(null==e?void 0:e.type)==="top_picks"&&(null==e?void 0:e.menu_id)==="000"?null==t?void 0:null===(o=t.cat_items)||void 0===o?void 0:o.some(e=>rL(e,i)):null==t?void 0:null===(a=t.cat_items)||void 0===a?void 0:a.some(t=>rB((null==t?void 0:t.menu_timing)&&t.menu_timing.length>0?t.menu_timing:null==e?void 0:e.menu_timing,i)),{name:null==t?void 0:t.category_display_text,available:r}});return(0,a.jsx)("div",{className:"m-auto mt-2  max-w-4xl",children:(0,a.jsx)("div",{children:null==e?void 0:null===(l=e.menu_category)||void 0===l?void 0:l.map((t,o)=>{var r,l;let n=null==s?void 0:s.find(e=>(null==e?void 0:e.name)==(null==t?void 0:t.category_display_text));return(null==t?void 0:null===(r=t.cat_items)||void 0===r?void 0:r.length)>0?(0,a.jsx)("div",{"data-category":(null==t?void 0:t.category_display_text)||"",className:"custom-container pb-8 scroll-mt-20",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{style:{color:ri},className:"py-5 text-[18px] font-black",children:(0,d.M1)(t,tp,th).toUpperCase()||""}),(0,a.jsx)("div",{className:"grid lg:grid-cols-4 gap-3",children:null==t?void 0:null===(l=t.cat_items)||void 0===l?void 0:l.map((o,r)=>
1{var l;let s=!0;return s=(null==e?void 0:e.type)==="top_picks"&&(null==e?void 0:e.menu_id)==="000"?rL(o,i):null==n?void 0:n.available,(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"mx-auto lg:m-0",children:(0,a.jsx)(eN,{descriptionColor:rm,fontFamily:ru,primaryColor:rn,secondaryColor:ri,data:o,loading:aB,setGetItemId:()=>rO(o.item_id,t.category_id,s),Opendrawer:tF,resturant_currency:le,restaurantOpen:tR,isMenuAvailableNow:s,bgColor:r_,ErrorPrimaryColor:rv,ErrorSecondaryColor:rp,menuTiming:(null==o?void 0:o.menu_timing)&&o.menu_timing.length>0?o.menu_timing:null!==(l=null==e?void 0:e.menu_timing)&&void 0!==l?l:[]})})},r)})})]})},o):null})})},t)}):(0,a.jsx)(ea,{primaryColor:rn,secondaryColor:ri,bgColor:r_,descriptionColor:rm,fontFamily:ru,ErrorPrimaryColor:rv,ErrorSecondaryColor:rp,heading:tv("No Menu Available"),subheading:tv("We’re currently updating our menu or there are no items available at this time.")})]})]})]}),aR&&(0,a.jsx)(eM,{descriptionColor:rm,fontFamily:ru,primaryColor:rn,secondaryColor:ri,open:aR,setOpen:aL,bgColor:r_,setMobileMenuOpen:az,restaurantsettings:null==e?void 0:null===(ti=e.restaurant_settings)||void 0===ti?void 0:ti.data,setBtnLoading:od,changeOrderTypeModal:t_,ErrorPrimaryColor:rv,hasPromoLink:am,sessionID:aK,onModalClose:()=>{oX(e=>({...e,triggeredByLoginClose:!0})),window.innerWidth<1024&&aX(!0)}}),tP&&(0,a.jsx)("div",{className:"transition-transform duration-1000 ease-in-out ".concat(tP?"translate-x-0 opacity-100":"translate-x-full opacity-0"),children:(0,a.jsx)(eD,{localalias:"".concat(t2),sessionID:aK,open:tP,setOpen:tF,data:tV,resturant_currency:le,specialInstruction:tC[tM],onSpecialInstructionChange:e=>lt(tM,e),setSpecialInstructions:tO,selectedCartItem:"",secondaryBtnColor:rs,update:"",updateId:"",primaryColor:rn,secondaryColor:ri,fontFamily:ru,descriptionColor:rm,bgColor:r_,primaryBtnColor:rf,primaryBtnTxtColor:ry,secondaryBtnTxtColor:rd,highlightTextColor:rc,highlightbgColor:rg,ErrorPrimaryColor:rv,selectionLimit_text_color:rb,item_goback_button_text_color:rS,item_goback_button_color:rx,restaurantOpen:tR,openFailureModalFunc:aU,pickupScheduleData:om,isMenuAvailabl:rI,pixelId:a6,gMeasurementId:re,page_location:a8})}),oY&&(0,a.jsx)("div",{className:"fixed inset-0 z-90",children:(0,a.jsx)(eL,{descriptionColor:rm,fontFamily:ru,primaryColor:rn,secondaryBtnColor:rs,open:!0,setOpenLoginModal:aL,bgColor:r_,setMobileMenuOpen:az,popupOffer:oz,setIsPopupShow:oG,loginBoolean:rz,hasPromo:oO,secondaryBtnTxtColor:rd,onModalClose:()=>{oX({shouldShowChangeMode:!0,triggeredByPopupClose:!0,triggeredByLoginClose:!1})}})})]})]})}},42422:(e,t,o)=>{"use strict";o.d(t,{_:()=>l,l:()=>r});var a=o(49505);let r=async(e,t)=>{try{let o=(0,a.z)(),r=JSON.stringify({restaurant_id:null==e?void 0:e.restaurant_id,limit:10,member_id:null==e?void 0:e.member_id,brand_id:null==e?void 0:e.brand_id,phone_number:null==e?void 0:e.phone_number,session_id:null==e?void 0:e.session_id,source:"EcomV2",version:null==e?void 0:e.version,ui_request_timestamp:new Date().toISOString()}),l="https://order.foodbot.ai/apiv2";t&&(l="".concat(t.replace(/\/$/,""),"/apiv2"));let n=await fetch("".concat(l,"/ecom/v1/user-order-history"),{method:"POST",headers:o,body:r});return n.ok||console.log("Failed to fetch order history: ".concat(n.status)),await n.json()}catch(e){return console.error("fetchOrderHistory error:",e),{data:[],error:!0}}},l=async(e,t)=>{try{var o;let r=(0,a.z)(),l=JSON.stringify({restaurant_id:e.restaurant_id,branch_id:e.branch_id,order_id:e.order_id,member_id:e.member_id,is_favorite:null!==(o=e.is_favorite)&&void 0!==o?o:1,session_id:e.session_id,lang:e.lang||"es",source:"EcomV2",version:e.version,ui_request_timestamp:new Date().toISOString()}),n="https://order.foodbot.ai/apiv2";t&&(n="".concat(t,"apiv2"));let i=await fetch("".concat(n,"/ecom/v1/add-order-favorite"),{method:"POST",headers:r,body:l});return i.ok||console.log("Failed to add favorite: ".concat(i.status)),await i.json()}catch(e){return console.error("addOrderFavorite error:",e),{data:[],error:!0}}}},85787:(e,t,o)=>{"use strict";o.d(t,{k5:()=>c});var a=o(96540),r={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},l=a.createContext&&a.createContext(r),n=["attr","size","title"];function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(e[a]=o[a])}return e}).apply(this,arguments)}function s(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,a)}return o}function d(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};
1t%2?s(Object(o),!0).forEach(function(t){var a,r;a=t,r=o[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var a=o.call(e,t||"default");if("object"!=typeof a)return a;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in e?Object.defineProperty(e,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[a]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):s(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function c(e){return t=>a.createElement(u,i({attr:d({},e.attr)},t),function e(t){return t&&t.map((t,o)=>a.createElement(t.tag,d({key:o},t.attr),e(t.child)))}(e.child))}function u(e){var t=t=>{var o,{attr:r,size:l,title:s}=e,c=function(e,t){if(null==e)return{};var o,a,r=function(e,t){if(null==e)return{};var o={};for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;o[a]=e[a]}return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)o=l[a],!(t.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,n),u=l||t.size||"1em";return t.className&&(o=t.className),e.className&&(o=(o?o+" ":"")+e.className),a.createElement("svg",i({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,r,c,{className:o,style:d(d({color:e.color||t.color},t.style),e.style),height:u,width:u,xmlns:"http://www.w3.org/2000/svg"}),s&&a.createElement("title",null,s),e.children)};return void 0!==l?a.createElement(l.Consumer,null,e=>t(e)):t(r)}}},e=>{var t=t=>e(e.s=t);e.O(0,[7551,3342,3139,5687,8758,9965,8051,9758,3107,636,6593,8792],()=>t(21504)),_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.