-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
2 lines (2 loc) · 148 KB
/
script.js
File metadata and controls
2 lines (2 loc) · 148 KB
1
2
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/profile-CQtOP2ll.js","assets/engagement-CLGf70us.js","assets/core-C5bEFvMT.js","assets/badges-C5OTwEu_.js","assets/group-CyGAM4ft.js","assets/chatbot-BddtVMnH.js","assets/splitbill-BQZMlXKW.js","assets/subscriptions-BHqqHuLd.js","assets/seasonal-C9cQEumV.js","assets/worldclass-qouaMUhU.js","assets/worldclass2-B_2sGT2K.js"])))=>i.map(i=>d[i]);
function e(){import.meta.url,import("_").catch(()=>1),async function*(){}().next()}import{u as t,a as n,D as a,F as o,s as r,l as i,R as s,M as c,L as l,W as d,I as u,c as m,T as p,H as f,d as v}from"./assets/core-C5bEFvMT.js";import{a as y,g,b as h,s as w,c as b,i as E,d as I}from"./assets/engagement-CLGf70us.js";const L={},C=function(e,t,n){let a=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const e=document.querySelector("meta[property=csp-nonce]"),n=(null==e?void 0:e.nonce)||(null==e?void 0:e.getAttribute("nonce"));a=Promise.allSettled(t.map(e=>{if((e=function(e){return"/"+e}(e))in L)return;L[e]=!0;const t=e.endsWith(".css"),a=t?'[rel="stylesheet"]':"";if(document.querySelector('link[href="'.concat(e,'"]').concat(a)))return;const o=document.createElement("link");return o.rel=t?"stylesheet":"modulepreload",t||(o.as="script"),o.crossOrigin="",o.href=e,n&&o.setAttribute("nonce",n),document.head.appendChild(o),t?new Promise((t,n)=>{o.addEventListener("load",t),o.addEventListener("error",()=>n(new Error("Unable to preload CSS for ".concat(e))))}):void 0}))}function o(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return a.then(t=>{for(const e of t||[])"rejected"===e.status&&o(e.reason);return e().catch(o)})};function S(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}let x=[];var k=[],B=null,A=[];function M(){n("amoghaCart",JSON.stringify(x))}function _(){const e=x.reduce((e,t)=>e+t.quantity,0);var t=document.getElementById("cart-count");t&&(t.hasAttribute("role")||(t.setAttribute("role","status"),t.setAttribute("aria-live","polite")),t.textContent=e,t.classList.remove("bump"),t.offsetWidth,t.classList.add("bump"),setTimeout(function(){t.classList.remove("bump")},300))}function q(e,t,n){if(e&&e.trim()){0!==x.length||y()||((i=document.getElementById("signin-prompt"))||((i=document.createElement("div")).id="signin-prompt",i.innerHTML='<div class="signin-prompt-content"><span class="signin-prompt-icon">🎉</span><div class="signin-prompt-text"><strong>Sign up & get 25% OFF!</strong><span>Create an account to unlock your welcome bonus</span></div><button class="signin-prompt-btn" onclick="closeSignInPrompt(); openAuthModal();">Sign Up</button><button class="signin-prompt-close" onclick="closeSignInPrompt()">×</button></div>',document.body.appendChild(i)),i.classList.remove("visible"),i.offsetWidth,i.classList.add("visible"),setTimeout(function(){O()},8e3));var a="medium";if(n){var o=n.closest(".menu-item-card");if(o){var r=o.querySelector(".spice-level.active");r&&(a=r.textContent.trim().toLowerCase())}}if(k.length>0)return B={name:e,price:parseFloat(t),spiceLevel:a,btnEl:n},A.length=0,void function(e,t){var n=document.getElementById("addon-picker-overlay"),a=document.getElementById("addon-item-name"),o=document.getElementById("addon-sheet-list");n&&a&&o&&(a.textContent=e+" — ₹"+t,o.innerHTML=k.map(function(e,t){return'<div class="addon-option" data-idx="'+t+'" onclick="toggleAddonOption(this, '+t+')"><div class="addon-checkbox"></div><div class="addon-option-info"><div class="addon-option-name">'+S(e.name)+'</div><div class="addon-option-cat">'+S(e.category||"")+'</div></div><div class="addon-option-price">+₹'+Number(e.price||0)+"</div></div>"}).join(""),P(),n.style.display="flex")}(e,parseFloat(t));T(e,parseFloat(t),a,[],n)}var i}function T(e,t,n,a,o){var r=a.map(function(e){return e.name}).sort().join(","),i=x.find(function(t){var a=(t.addons||[]).map(function(e){return e.name}).sort().join(",");return t.name===e&&t.spiceLevel===n&&a===r});if(i?i.quantity++:x.push({name:e,price:t,quantity:1,spiceLevel:n,addons:a||[]}),o&&(o.classList.remove("cart-adding"),o.offsetWidth,o.classList.add("cart-adding"),function(e){var t=document.getElementById("cart-icon");if(e&&t){var n=e.getBoundingClientRect(),a=t.getBoundingClientRect(),o=document.createElement("div");o.className="cart-fly-item",o.style.left=n.left+n.width/2-6+"px",o.style.top=n.top+n.height/2-6+"px",document.body.appendChild(o),requestAnimationFrame(function(){o.style.transition="left 0.55s cubic-bezier(0.4,0,0.2,1), top 0.55s cubic-bezier(0.4,0,0.2,1), opacity 0.55s, transform 0.55s",o.style.left=a.left+a.width/2-6+"px",o.style.top=a.top+a.height/2-6+"px",o.style.opacity="0",o.style.transform="scale(0.3)"}),setTimeout(function(){o.remove()},600),t.classList.remove("cart-jiggle"),t.offsetWidth,t.classList.add("cart-jiggle"),setTimeout(function(){t.classList.remove("cart-jiggle")},400)}}(o)),_(),M(),N(e),D(),R(),window.dispatchEvent(new CustomEvent("amogha-cart-updated",{detail:{items:x}})),window._ariaAnnounce){var s=i?i.quantity:1;window._ariaAnnounce(e+" added to cart. Quantity: "+s)}try{window.analytics&&window.analytics.logEvent("add_to_cart",{item_name:e,value:t})}catch(c){}}function P(){if(B){var e=A.reduce(function(e,t){return e+t.price},0),t=B.price+e,n=document.getElementById("addon-total");n&&(n.textContent="Total: ₹"+t)}}function O(){var e=document.getElementById("signin-prompt");e&&e.classList.remove("visible")}function N(e){document.querySelectorAll(".add-to-cart").forEach(t=>{if(t.dataset.item===e){const a=x.find(t=>t.name===e),o=a?a.quantity:0;if(o>0&&!t.classList.contains("has-qty"))t.classList.add("has-qty"),t.innerHTML='<span class="qty-minus" data-item="'.concat(S(e),'" aria-label="Decrease quantity">−</span><span class="qty-count" aria-live="polite" aria-label="Quantity: ').concat(o,'">').concat(o,'</span><span class="qty-plus" data-item="').concat(S(e),'" aria-label="Increase quantity">+</span>');else if(o>0){var n=t.querySelector(".qty-count");n&&(n.textContent=o,n.setAttribute("aria-label","Quantity: "+o),n.classList.remove("qty-bump"),n.offsetWidth,n.classList.add("qty-bump"))}else t.classList.remove("has-qty"),t.innerHTML="Add to Order"}})}function D(){let e=document.getElementById("floating-cart");e||(e=document.createElement("div"),e.id="floating-cart",e.innerHTML='\n <div class="fc-header">\n <span class="fc-title">Your Order</span>\n <span class="fc-close" onclick="closeFloatingCart()">×</span>\n </div>\n <div class="fc-items"></div>\n <div class="fc-footer">\n <span class="fc-total"></span>\n <button class="fc-checkout" onclick="document.getElementById(\'cart-icon\').click(); closeFloatingCart();">View Cart</button>\n </div>\n ',document.body.appendChild(e));const t=e.querySelector(".fc-items"),n=e.querySelector(".fc-total");if(0===x.length)return e.classList.remove("visible"),void H();let a="",o=0;x.forEach(e=>{const t=(e.addons||[]).reduce((e,t)=>e+t.price,0),n=(e.price+t)*e.quantity;o+=n,a+='<div class="fc-item"><span>'.concat(S(e.name)," x").concat(e.quantity,"</span><span>₹").concat(n,"</span></div>")}),t.innerHTML=a,n.textContent="Total: ₹".concat(o),e.classList.add("visible"),H()}function R(){var e=document.getElementById("floating-cart-bar");if(e){var t=x.reduce(function(e,t){return e+t.quantity},0),n=x.reduce(function(e,t){var n=(t.addons||[]).reduce(function(e,t){return e+t.price},0);return e+(t.price+n)*t.quantity},0);if(0!==t){var a=e.querySelector(".floating-cart-count"),o=e.querySelector(".floating-cart-total"),r=e.querySelector(".floating-cart-label");a&&(a.textContent=t),o&&(o.textContent="₹"+n),r&&(r.textContent=1===t?"1 item":t+" items"),e.classList.add("visible")}else e.classList.remove("visible")}}function H(e){var t=document.getElementById("cart-fab");t||((t=document.createElement("div")).id="cart-fab",t.className="cart-fab",t.innerHTML='<svg viewBox="0 0 24 24"><path d="M6 2L3 6v14a2 2 0 002 2h14a2 2 0 002-2V6l-3-4z"/><line x1="3" y1="6" x2="21" y2="6"/><path d="M16 10a4 4 0 01-8 0"/></svg><span class="cart-fab-badge">0</span>',t.addEventListener("click",function(){var e=document.getElementById("cart-icon");e&&e.click()}),document.body.appendChild(t));var n=t.querySelector(".cart-fab-badge"),a=x.reduce(function(e,t){return e+t.quantity},0);a>0?(n.textContent=a,t.classList.add("visible"),t.classList.remove("pop"),t.offsetWidth,t.classList.add("pop")):t.classList.remove("visible")}function j(){const e=document.getElementById("cart-items");if(!e)return;if(0===x.length){e.innerHTML='<div class="empty-cart" role="status" aria-label="Your cart is empty"><svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="empty-cart-icon"><circle cx="9" cy="21" r="1"/><circle cx="20" cy="21" r="1"/><path d="M1 1h4l2.68 13.39a2 2 0 002 1.61h9.72a2 2 0 002-1.61L23 6H6"/></svg><span class="empty-cart-title">Your cart is empty</span><span class="empty-cart-sub">Explore our menu and discover your next favourite dish</span><a href="#menu" class="empty-cart-cta" onclick="var cm=document.getElementById(\'cart-modal\');if(cm)cm.style.display=\'none\';unlockScroll();document.getElementById(\'menu\')&&document.getElementById(\'menu\').scrollIntoView({behavior:\'smooth\'})" role="button">Browse Menu</a></div>';var t=document.getElementById("subtotal-amount"),n=document.getElementById("total-amount");return t&&(t.textContent="0.00"),void(n&&(n.textContent="0.00"))}let r="",i=0;x.forEach((e,t)=>{const n=(e.addons||[]).reduce((e,t)=>e+t.price,0),a=(e.price+n)*e.quantity;i+=a;const o=e.spiceLevel&&"medium"!==e.spiceLevel?' <span class="spice-tag">('+S(e.spiceLevel)+")</span>":"",s=(e.addons||[]).map(e=>'<span class="addon-tag">+ '+S(e.name)+" ₹"+Number(e.price||0)+"</span>").join(" "),c=S(e.name);r+='\n <div class="cart-item">\n <div class="cart-item-info">\n <div class="cart-item-name">'.concat(c).concat(o,"</div>\n ").concat(s?'<div style="margin-top:2px">'+s+"</div>":"",'\n <div class="cart-item-price">₹').concat((e.price+n).toFixed(2),'</div>\n </div>\n <div class="cart-item-quantity">\n <button class="qty-btn" onclick="updateQuantity(').concat(t,', -1)" aria-label="Decrease quantity of ').concat(c,'">-</button>\n <span>').concat(e.quantity,'</span>\n <button class="qty-btn" onclick="updateQuantity(').concat(t,', 1)" aria-label="Increase quantity of ').concat(c,'">+</button>\n </div>\n <button class="remove-item" onclick="removeItem(').concat(t,')" aria-label="Remove ').concat(c,' from cart">Remove</button>\n </div>\n ')}),e.innerHTML=r;const s=i>=o?0:a,c=i+s;var l=document.getElementById("subtotal-amount"),d=document.getElementById("total-amount");l&&(l.textContent=i.toFixed(2)),d&&(d.textContent=c.toFixed(2));var u=document.querySelector(".delivery-note");u&&(u.textContent=0===s?"Delivery fee: FREE ✓":"Delivery fee: ₹"+a+" (Free over ₹"+o+")")}function F(){if(confirm("Are you sure you want to clear your cart?")){const n=x.map(e=>e.name);x.length=0,_(),M(),j(),n.forEach(e=>N(e)),D(),R();var e=document.getElementById("cart-modal");e&&(e.style.display="none"),t(),window._ariaAnnounce&&window._ariaAnnounce("Cart cleared")}}function V(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML}function G(e){return(e||"").replace(/<[^>]*>/g,"").trim()}window._cartGlobalsSet||(window._cartGlobalsSet=!0,Object.assign(window,{addToCart:q,finalizeAddToCart:T,updateQuantity:function(e,t){if(!x[e])return;const n=x[e].name;var a=x[e].quantity+t;a>50?window._ariaAnnounce&&window._ariaAnnounce("Maximum quantity is 50"):(a<=0?(x.splice(e,1),window._ariaAnnounce&&window._ariaAnnounce(n+" removed from cart")):(x[e].quantity=a,window._ariaAnnounce&&window._ariaAnnounce(n+" quantity: "+x[e].quantity)),_(),M(),j(),N(n),D(),R())},removeItem:function(e){if(!x[e])return;const t=x[e].name;x.splice(e,1),_(),M(),j(),N(t),D(),R(),window._ariaAnnounce&&window._ariaAnnounce(t+" removed from cart")},clearCart:F,closeAddonPicker:function(){var e=document.getElementById("addon-picker-overlay");e&&(e.style.display="none"),B=null,A.length=0},toggleAddonOption:function(e,t){e.classList.toggle("selected");var n=k[t],a=e.querySelector(".addon-checkbox");if(e.classList.contains("selected"))A.push({name:n.name,price:n.price}),a.textContent="✓";else{var o=A.findIndex(function(e){return e.name===n.name});-1!==o&&A.splice(o,1),a.textContent=""}P()},confirmAddonSelection:function(){if(B){var e=B,t=A.slice();B=null,A.length=0;var n=document.getElementById("addon-picker-overlay");n&&(n.style.display="none"),T(e.name,e.price,e.spiceLevel,t,e.btnEl)}},closeFloatingCart:function(){const e=document.getElementById("floating-cart");e&&e.classList.remove("visible")},closeSignInPrompt:O,updateFloatingCartBar:R}));var z=null,W=null,U="",Y=500;function J(){window._appliedCoupon=z}function X(e){var t=(e.addons||[]).reduce(function(e,t){return e+("number"==typeof t.price?t.price:0)},0);return(e.price+t)*e.quantity}function K(){var e=x.reduce(function(e,t){return e+X(t)},0),t=e>=o?0:a,n=0,r=0,i=e+t,s=y();if(s){for(var c=s.loyaltyPoints||0,d=null,u=l.length-1;u>=0;u--)if(c>=l[u].min){d=l[u];break}d&&(d.freeDelivery&&(t=0),d.discount>0&&(r=Math.floor(e*d.discount/100)))}z&&("percent"===z.type?n=Math.floor(e*z.discount/100):"flat"===z.type&&(n=z.discount),n=Math.min(n,e));var m=Math.max(n,r);if(i=e-m+t,W&&"number"==typeof W.balance&&W.balance>0){var p=Math.min(W.balance,i);i=Math.max(0,i-p)}return{subtotal:e,deliveryFee:t,discount:m,loyaltyDiscount:r,total:i}}function Q(e,t){if(!e)return 0;var n="percent"===e.type?t*e.discount/100:e.discount;return e.maxDiscount&&"percent"===e.type&&(n=Math.min(n,e.maxDiscount)),Math.min(n,t)}function $(){if(0!==x.length){var e=x.reduce(function(e,t){return e+X(t)},0),t=e>=o?0:a,n=e+t,r="";x.forEach(function(e){var t=(e.addons||[]).reduce(function(e,t){return e+("number"==typeof t.price?t.price:0)},0),n=(e.price+t)*e.quantity,a=t>0?" (+₹"+t+")":"";r+='<div class="co-item"><span>'+V(e.name)+a+" x"+e.quantity+"</span><span>₹"+n+"</span></div>"});var i="";if("function"==typeof window.getUpsellItems){var s=window.getUpsellItems(x);s&&s.length>0&&(i='<div class="upsell-section" id="upsell-section"><div class="upsell-title">Customers also ordered</div><div class="upsell-items">',s.forEach(function(e){var t=V(e.name),n=V(e.name).replace(/"/g,"""),a=parseInt(e.price,10)||0;i+='<div class="upsell-card"><div class="upsell-info"><div class="upsell-name">'+t+'</div><div class="upsell-reason">'+V(e.reason||"")+'</div></div><span class="upsell-price">₹'+a+'</span><button class="upsell-add-btn" data-upsell-name="'+n+'" data-upsell-price="'+a+'">+ Add</button></div>'}),i+="</div></div>")}var c=document.getElementById("checkout-items");c&&(c.innerHTML=r+i,c.querySelectorAll(".upsell-add-btn[data-upsell-name]").forEach(function(e){e.addEventListener("click",function(){oe(e.getAttribute("data-upsell-name"),parseInt(e.getAttribute("data-upsell-price"),10)||0)})}));var l=document.getElementById("co-subtotal");l&&(l.textContent="₹"+e);var d=document.getElementById("co-delivery");d&&(d.textContent=0===t?"FREE":"₹"+t);var u=document.getElementById("co-total");u&&(u.textContent="₹"+n);var m=document.getElementById("loyalty-redeem-btn");if(m){var p=y();if(p&&p.loyaltyPoints>=100){var f=10*Math.floor(p.loyaltyPoints/100);m.textContent="Redeem "+p.loyaltyPoints+" pts (₹"+f+" off)",m.style.display="block"}else m.style.display="none"}var v=document.getElementById("co-name"),b=document.getElementById("co-phone"),E=document.getElementById("co-address");v&&v.setAttribute("aria-required","true"),b&&(b.setAttribute("aria-required","true"),b.setAttribute("inputmode","numeric"),b.setAttribute("pattern","[0-9]*")),E&&E.setAttribute("aria-required","true"),Z(1);var I=document.getElementById("checkout-modal");I&&(I.style.display="block");var L=y();L&&(v&&!v.value&&(v.value=L.name||""),b&&!b.value&&(b.value=L.phone||""),E&&!E.value&&L.address&&(E.value=L.address));var C=document.getElementById("checkout-step-2");C&&!document.getElementById("order-type-selector")&&C.insertAdjacentHTML("afterbegin",'<div class="order-type-selector" id="order-type-selector" role="radiogroup" aria-label="Order type"><button type="button" class="order-type-btn active" data-type="delivery" role="radio" aria-checked="true" onclick="selectOrderType(this,\'delivery\')"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 18H3a2 2 0 01-2-2V8a2 2 0 012-2h3.93a2 2 0 011.66.9l.82 1.2a2 2 0 001.66.9H21a2 2 0 012 2v2"/><circle cx="7" cy="18" r="2"/><path d="M15 18h2"/><circle cx="20" cy="18" r="2"/></svg> Delivery</button><button type="button" class="order-type-btn" data-type="pickup" role="radio" aria-checked="false" onclick="selectOrderType(this,\'pickup\')"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 2L3 6v14a2 2 0 002 2h14a2 2 0 002-2V6l-3-4z"/><line x1="3" y1="6" x2="21" y2="6"/><path d="M16 10a4 4 0 01-8 0"/></svg> Pickup</button></div>');var S=document.getElementById("co-notes");if(S&&!document.getElementById("delivery-time-estimate")){var k=document.createElement("div");k.className="delivery-time-estimate",k.id="delivery-time-estimate",k.setAttribute("aria-live","polite"),k.innerHTML='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/></svg><span>Estimated delivery: 30 - 45 mins</span>',S.parentNode.insertBefore(k,S.nextSibling)}var B=document.getElementById("coupon-code"),A=document.getElementById("coupon-msg");if(L&&!L.usedWelcomeBonus){z={discount:25,type:"percent",label:"25% off (Welcome Bonus!)"},U="WELCOME25",B&&(B.value="WELCOME25"),A&&(A.textContent="Welcome bonus applied! You get 25% off!",A.className="coupon-msg success");var M=Math.floor(.25*e),_=e-(M=Math.min(M,e))+t,q=document.getElementById("co-total");q&&(q.textContent="₹"+_);var T=document.getElementById("co-discount-row"),P=document.getElementById("co-discount"),O=document.getElementById("co-discount-label");T&&(T.style.display=""),P&&(P.textContent="-₹"+M),O&&(O.textContent="Welcome Bonus (25% off)");var N=g();N&&L.phone&&N.collection("users").doc(L.phone).get().then(function(e){e.exists&&e.data().usedWelcomeBonus&&(z=null,U="",J(),L.usedWelcomeBonus=!0,w(L),B&&(B.value=""),A&&(A.textContent="",A.className="coupon-msg"),ee())}).catch(function(e){console.error("Welcome bonus re-verify error:",e)})}else{z=null,U="",B&&(B.value=""),A&&(A.textContent="",A.className="coupon-msg");var D=document.getElementById("co-discount-row");D&&(D.style.display="none")}J()}else"function"==typeof h&&h("Your cart is empty. Add items before checkout.")}function Z(e){document.querySelectorAll(".checkout-step").forEach(function(e){e.classList.remove("active")});var t=document.getElementById("checkout-step-"+e);t&&(t.classList.add("active"),t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0}));var n={1:"Order Summary",2:"Customer Details",3:"Payment",4:"Order Confirmation"};window._ariaAnnounce&&n[e]&&window._ariaAnnounce("Checkout step "+e+": "+n[e]),3===e&&ee()}function ee(){var e=K().total,t="₹"+Math.round(e),n=document.getElementById("pay-total");n&&(n.textContent=t);var a=document.getElementById("cod-total");a&&(a.textContent=t),te("razorpay")}function te(e){var t={razorpay:"Pay with Razorpay (UPI, Cards, Net Banking)",cod:"Pay with Cash on Delivery"};["razorpay","cod"].forEach(function(n){var a=document.getElementById("tab-"+n),o=document.getElementById("pay-panel-"+n);a&&(a.classList.toggle("active",n===e),a.setAttribute("aria-selected",n===e?"true":"false"),a.hasAttribute("aria-label")||a.setAttribute("aria-label",t[n]||n)),o&&o.classList.toggle("active",n===e)});var n={razorpay:"Razorpay (UPI, Cards, Net Banking)",cod:"Cash on Delivery"};window._ariaAnnounce&&n[e]&&window._ariaAnnounce("Payment method: "+n[e])}var ne=!1;function ae(e,t,n){if(!ne){var a=g();if(void 0===a||!a)return h("Service unavailable. Please refresh and try again."),void(window._hidePaymentProcessing&&window._hidePaymentProcessing());ne=!0,window._showPaymentProcessing&&window._showPaymentProcessing();var o=G(document.getElementById("co-name").value.trim()),r=document.getElementById("co-phone").value.trim(),i=G(document.getElementById("co-address").value.trim()),s=G(document.getElementById("co-notes").value.trim()),c=K(),l=document.getElementById("schedule-order-check"),u=null;if(l&&l.checked){var m=document.getElementById("schedule-date"),p=document.getElementById("schedule-time");m&&p&&m.value&&p.value&&(u=m.value+"T"+p.value+":00")}var f=document.getElementById("confirm-detail");f&&(f.textContent="Payment: "+e+(t?" (Ref: "+t+")":"")+" | Total: ₹"+c.total.toFixed(0));var v="*New Order - Amogha Cafe*\n\n";v+="*Customer:* "+o+"\n*Phone:* "+r+"\n*Address:* "+i+"\n",s&&(v+="*Notes:* "+s+"\n"),v+="\n*Items:*\n",x.forEach(function(e){var t=(e.addons||[]).reduce(function(e,t){return e+t.price},0);v+="- "+e.name+" x"+e.quantity+" = ₹"+(e.price+t)*e.quantity+"\n"}),v+="\n*Subtotal:* ₹"+c.subtotal,v+="\n*Delivery:* "+(0===c.deliveryFee?"FREE":"₹"+c.deliveryFee),v+="\n*Total:* ₹"+c.total.toFixed(0),v+="\n*Payment:* "+e,t&&(v+="\n*Payment Ref:* "+t);var E="https://wa.me/"+d+"?text="+encodeURIComponent(v),I=document.getElementById("whatsapp-link");I&&(I.href=E),Z(4);var L=y(),C={customer:o,phone:r,address:i,notes:s,items:x.map(function(e){return{name:e.name,qty:e.quantity,price:e.price,spiceLevel:e.spiceLevel||"medium",addons:e.addons||[]}}),subtotal:c.subtotal,deliveryFee:c.deliveryFee,total:c.total,payment:e,paymentRef:t||null,paymentStatus:n,paymentVerifiedAt:t?(new Date).toISOString():null,status:u?"scheduled":"pending",createdAt:(new Date).toISOString(),scheduledFor:u||null,userId:L?L.phone:null},S=x.map(function(e){return e.name});a.collection("orders").add(C).then(function(t){ne=!1,window._hidePaymentProcessing&&window._hidePaymentProcessing(),"function"==typeof window.launchConfetti&&window.launchConfetti(),window._ariaAnnounce&&window._ariaAnnounce("Order placed successfully! Thank you for your order."),window._showToast&&window._showToast("Order placed successfully!","success");try{window.analytics&&window.analytics.logEvent("purchase",{transaction_id:t.id,value:C.total,payment_type:e})}catch(h){}window._lastOrderId=t.id,window._lastOrderTotal=C.total;var n=window.location.origin+"/track/index.html?id="+t.id,i=document.getElementById("order-tracking-link");if(i&&(i.innerHTML='<div class="order-track-card"><p class="order-track-label">Track your order in real-time:</p><a href="'+n+'" target="_blank" rel="noopener noreferrer" class="order-track-link">'+n+"</a><br><button onclick=\"safeCopy('"+n+'\',this)" class="cta-button order-track-copy">Copy Link</button></div>'),U){var s=b();s&&a.collection("coupons").doc(U).update({usedCount:s.increment(1)}).catch(function(e){console.error("Coupon usage update error:",e)})}if(L&&!L.usedWelcomeBonus&&z&&z.label&&-1!==z.label.indexOf("Welcome")&&(L.usedWelcomeBonus=!0,w(L),a.collection("users").doc(L.phone).update({usedWelcomeBonus:!0}).catch(function(e){console.error("Bonus update error:",e)})),z&&z._loyaltyPointsToDeduct){var l=y();l&&a.collection("users").doc(l.phone).update({loyaltyPoints:l.loyaltyPoints}).catch(function(e){console.error("Loyalty deduction error:",e)})}if(W&&W.code&&"number"==typeof W.balance){var d=c.subtotal-c.discount+c.deliveryFee,u=Math.min(W.balance,d),m=b();m&&a.collection("giftCards").doc(W.code).update({balance:m.increment(-u),redeemedAt:(new Date).toISOString()}).catch(function(e){console.error("Gift card deduction error:",e)}),W=null}if(z=null,U="",J(),x.length=0,_(),M(),S.forEach(function(e){N(e)}),D(),"function"==typeof window.awardLoyaltyPoints&&window.awardLoyaltyPoints(C.total),"function"==typeof window.checkAndAwardBadges){var p=y();p&&window.checkAndAwardBadges(p,C)}if(L&&a&&a.collection("referrals").where("refereePhone","==",L.phone).where("redeemed","==",!1).limit(1).get().then(function(e){if(!e.empty){var t=e.docs[0],n=t.data().referrerPhone;t.ref.update({redeemed:!0}).then(function(){var e=b();e&&a.collection("users").doc(n).update({loyaltyPoints:e.increment(100)}).catch(function(e){console.error("Referrer points error:",e)})}).catch(function(e){console.error("Referral redeem error:",e)})}}).catch(function(e){console.error("Referral lookup error:",e)}),"function"==typeof window.scheduleReviewPrompt&&window.scheduleReviewPrompt(C.items.map(function(e){return{name:e.name}})),"function"==typeof window.sendPushNotification&&window.sendPushNotification("Order Placed!","Your order from Amogha has been placed successfully."),"function"==typeof window.awardSpin&&window.awardSpin(),"function"==typeof window.showOrderTracker&&setTimeout(function(){window.showOrderTracker(t.id)},2e3),"function"==typeof window.checkMilestones&&window.checkMilestones(y(),C),"function"==typeof window.schedulePostOrderFeedback&&window.schedulePostOrderFeedback(t.id,C.total),"function"==typeof window.updateChallengeProgress&&(window.updateChallengeProgress("spend",C.total),(new Date).getHours()<12&&window.updateChallengeProgress("morning_orders",1)),window._lastOrderItems=C.items,window._lastOrderTotalForShare=C.total,r){var f=r.replace(/\D/g,"");10===f.length&&(f="91"+f);var v="Hi "+o+"! 🙏\n\nYour order at *Amogha Cafe & Restaurant* has been placed successfully!\n\n";v+="*Order ID:* "+t.id+"\n",v+="*Items:* "+C.items.map(function(e){return e.name+" x"+e.qty}).join(", ")+"\n",v+="*Total:* ₹"+c.total.toFixed(0)+"\n\n",v+="📍 Track your order: "+window.location.origin+"/track/?id="+t.id+"\n\n",v+="Thank you for dining with us! 🍛",window.open("https://wa.me/"+f+"?text="+encodeURIComponent(v),"_blank")}var g=b();g&&a.collection("inventory").get().then(function(e){var t={};e.forEach(function(e){var n=e.data();t[(n.name||"").toLowerCase()]={id:e.id}});var n=a.batch(),o=!1;C.items.forEach(function(e){var r=e.name.toLowerCase(),i=parseInt(e.qty)||0;if(t[r]&&i>0){var s=a.collection("inventory").doc(t[r].id);n.update(s,{quantity:g.increment(-i)}),o=!0}}),o&&n.commit().catch(function(e){console.error("Inventory deduction error:",e)})}).catch(function(e){console.error("Inventory fetch error:",e)})}).catch(function(e){if(ne=!1,window._hidePaymentProcessing&&window._hidePaymentProcessing(),console.error("Order save error:",e),z&&z._loyaltyPointsToDeduct){var t=y();t&&(t.loyaltyPoints=(t.loyaltyPoints||0)+z._loyaltyPointsToDeduct,w(t))}h("Order failed to save. Please try again or check your connection.")})}}function oe(e,t){for(var n=!1,a=0;a<x.length;a++)if(x[a].name===e){x[a].quantity++,n=!0;break}n||x.push({name:e,price:t,quantity:1,spiceLevel:"medium",addons:[]}),_(),M(),D(),h(e+" added to your order!"),$()}function re(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML}function ie(e,t,n,a,o,r){var i=g();if(void 0!==i&&i){try{var s=localStorage.getItem(t);if(s){var c=JSON.parse(s);if(c.ts&&Date.now()-c.ts<1e3*n)return void o(c.data)}}catch(d){}var l=i.collection(e);r&&r.orderBy&&(l=l.orderBy(r.orderBy[0])),r&&r.where&&(l=l.where(r.where[0],r.where[1],r.where[2])),l.get().then(function(e){var n=a(e);o(n);try{localStorage.setItem(t,JSON.stringify({ts:Date.now(),data:n}))}catch(d){}}).catch(function(n){console.error("cachedGet "+e+" error:",n);try{var a=localStorage.getItem(t);if(a)return void o(JSON.parse(a).data)}catch(d){}if("menu"===e){var r=document.getElementById("dynamic-menu-container");r&&(r.innerHTML='<div class="menu-error" style="text-align:center;padding:2rem;color:#ccc"><p style="font-size:1.1rem;margin-bottom:1rem">Unable to load menu. Please check your connection.</p><button onclick="location.reload()" style="padding:.6rem 1.5rem;background:#D4A017;color:#1e140e;border:none;border-radius:8px;font-weight:600;cursor:pointer">Retry</button></div>')}})}}function se(e){var t,n=document.querySelector(".specials-grid");n&&(0!==e.length?((t=n.closest(".specials"))&&(t.style.display=""),n.innerHTML=e.map(function(e){var t=e.available?"":" item-unavailable",n=re(e.name||""),a=re(e.description||""),o=re(e.badge||"Special"),r=parseInt(e.price,10)||0;return'<div class="special-card'+t+'" data-id="'+n.replace(/"/g,""")+'"><div class="glow-border"></div><div class="special-badge">'+o+"</div><h3>"+n+"</h3><p>"+a+'</p><div class="special-price"><span class="new-price">₹'+r+'</span></div><button class="add-to-cart" data-item="'+n.replace(/"/g,""")+'" data-price="'+r+'">Order Now</button></div>'}).join("")):(t=n.closest(".specials"))&&(t.style.display="none"))}window._paymentGlobalsSet||(window._paymentGlobalsSet=!0,Object.assign(window,{checkout:function(){if(0!==x.length){if(!y()){var e=document.getElementById("cart-modal");return e&&(e.style.display="none"),t(),"function"==typeof window.openAuthModal&&window.openAuthModal(),void h("Please sign in to continue with your order")}var n=document.getElementById("cart-modal");n&&(n.style.display="none"),i(),"function"==typeof window.checkAllergenWarning?window.checkAllergenWarning(x,function(e){e?$():t()}):$()}else h("Your cart is empty!")},openCheckout:$,closeCheckout:function(){var e=document.getElementById("checkout-modal");e&&(e.style.display="none"),t(),z=null,U="",W=null,J(),["co-name","co-phone","co-address","co-notes"].forEach(function(e){var t=document.getElementById(e);t&&(t.value="")});var n=document.getElementById("coupon-code"),a=document.getElementById("coupon-msg");n&&(n.value=""),a&&(a.textContent="",a.className="coupon-msg")},goToStep:Z,setupPayment:ee,switchPayTab:te,validateAndPay:function(){var e=document.getElementById("co-name"),t=document.getElementById("co-phone"),n=document.getElementById("co-address");if(e&&t&&n){var a=e.value.trim(),o=t.value.trim(),r=n.value.trim(),i="pickup"===window._selectedOrderType;if(!a||!o||!i&&!r)return h("Please fill in all required fields."),void(a?o?i||n.focus():t.focus():e.focus());if(a.length>100)return h("Name is too long (max 100 characters)."),void document.getElementById("co-name").focus();if(!/^\d{10}$/.test(o))return h("Please enter a valid 10-digit phone number."),void document.getElementById("co-phone").focus();if(!i&&r.length<10)return h("Please enter a complete delivery address."),void document.getElementById("co-address").focus();if(!i&&r.length>500)return h("Address is too long (max 500 characters)."),void document.getElementById("co-address").focus();var s=window.getScheduleInfo?window.getScheduleInfo():null;!s||s.date&&s.time?Z(3):h("Please select both date and time for scheduled order.")}else h("Form error. Please refresh the page.")},openRazorpay:function(){if("undefined"!=typeof Razorpay){var e=K();if(isNaN(e.total)||e.total<0)h("Invalid order total. Please try again.");else if(0!==e.total){var t=document.getElementById("co-name").value.trim(),n=document.getElementById("co-phone").value.trim(),a={key:s,amount:Math.round(100*e.total),currency:"INR",name:c,description:"Food Order - Amogha Cafe",image:window.location.origin+"/amogha-logo.png",handler:function(e){ae("Razorpay",e.razorpay_payment_id,"paid")},prefill:{name:t,contact:n,method:"upi"},method:{upi:!0,card:!0,netbanking:!0,wallet:!0},config:{display:{blocks:{upi:{name:"Pay via UPI",instruments:[{method:"upi",flows:["qrcode","collect","intent"]}]}},sequence:["block.upi"],preferences:{show_default_blocks:!0}}},notes:{items:x.map(function(e){return e.name+" x"+e.quantity}).join(", ")},theme:{color:"#D4A017",backdrop_color:"rgba(8,6,4,0.85)"},modal:{ondismiss:function(){var e=document.getElementById("razorpay-pay-btn");e&&(e.disabled=!1,e.innerHTML='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M12 2L2 7l10 5 10-5-10-5z"/><path d="M2 17l10 5 10-5"/><path d="M2 12l10 5 10-5"/></svg> Pay Now')}}},o=document.getElementById("razorpay-pay-btn");o&&(o.disabled=!0,o.innerHTML="Opening payment..."),window._showPaymentProcessing&&window._showPaymentProcessing();try{var r=new Razorpay(a);r.on("payment.failed",function(e){window._hidePaymentProcessing&&window._hidePaymentProcessing(),h("Payment failed: "+(e.error.description||"Please try again"));var t=document.getElementById("razorpay-pay-btn");t&&(t.disabled=!1,t.innerHTML='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M12 2L2 7l10 5 10-5-10-5z"/><path d="M2 17l10 5 10-5"/><path d="M2 12l10 5 10-5"/></svg> Retry Payment')}),r.open(),setTimeout(function(){window._hidePaymentProcessing&&window._hidePaymentProcessing()},1500)}catch(i){window._hidePaymentProcessing&&window._hidePaymentProcessing(),h("Error opening payment: "+i.message),o&&(o.disabled=!1,o.innerHTML='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M12 2L2 7l10 5 10-5-10-5z"/><path d="M2 17l10 5 10-5"/><path d="M2 12l10 5 10-5"/></svg> Pay Now')}}else ae("Gift Card (Full)",null,"paid")}else h("Payment gateway loading... please try again")},placeCodOrder:function(){ae("Cash on Delivery",null,"cod-pending")},placeOrderToFirestore:ae,applyCoupon:function(){var e=document.getElementById("coupon-code"),t=document.getElementById("coupon-msg");if(e&&t){var n=e.value.trim().toUpperCase(),r={AMOGHA20:{discount:20,type:"percent",label:"20% off"},WELCOME50:{discount:50,type:"flat",label:"₹50 off"},FIRST10:{discount:10,type:"percent",label:"10% off"},WELCOME25:{discount:25,type:"percent",label:"25% off (Welcome Bonus!)"}},i=g();i?i.collection("coupons").doc(n).get().then(function(e){if(e.exists){var a=e.data(),o=(i=a,c=x.reduce(function(e,t){return e+X(t)},0),i?i.active?i.expiresAt&&new Date(i.expiresAt)<new Date?{valid:!1,reason:"This coupon has expired."}:i.usageLimit&&i.usedCount>=i.usageLimit?{valid:!1,reason:"This coupon has reached its usage limit."}:i.minOrder&&c<i.minOrder?{valid:!1,reason:"Minimum order ₹"+i.minOrder+" required."}:{valid:!0}:{valid:!1,reason:"This coupon is no longer active."}:{valid:!1,reason:"No coupon"});if(!o.valid)return t.textContent=o.reason,t.className="coupon-msg error",z=null,void(U="");s(a,n)}else r[n]?s(r[n],n):(z=null,U="",t.textContent="Invalid coupon code. Please check and try again.",t.className="coupon-msg error");var i,c}).catch(function(){r[n]?s(r[n],n):(z=null,U="",t.textContent="Invalid coupon code.",t.className="coupon-msg error")}):r[n]?s(r[n],n):(z=null,U="",t.textContent="Invalid coupon code. Please check and try again.",t.className="coupon-msg error")}function s(e,n){z=e,U=n||"",J(),t.textContent="Coupon applied! "+e.label,t.className="coupon-msg success";var r=x.reduce(function(e,t){return e+X(t)},0),i=r>=o?0:a,s=Q(e,r),c=r-s+i,l=document.getElementById("co-total");l&&(l.textContent="₹"+c);var d=document.getElementById("co-discount-row"),u=document.getElementById("co-discount"),m=document.getElementById("co-discount-label");s>0&&d&&(d.style.display="",u&&(u.textContent="-₹"+s),m&&(m.textContent=e.label||"Discount"))}},removeCoupon:function(){z=null,U="";var e=document.getElementById("coupon-code"),t=document.getElementById("coupon-msg");e&&(e.value=""),t&&(t.textContent="",t.className="coupon-msg");var n=document.getElementById("co-discount-row");n&&(n.style.display="none"),ee()},applyGiftCard:function(){var e=document.getElementById("giftcard-code"),t=document.getElementById("giftcard-msg");if(e&&t){var n=e.value.trim().toUpperCase();if(!n)return t.textContent="Please enter a gift card code",void(t.className="coupon-msg error");var r=g();if(!r)return t.textContent="Service unavailable",void(t.className="coupon-msg error");r.collection("giftCards").doc(n).get().then(function(e){if(!e.exists)return t.textContent="Invalid gift card code",t.className="coupon-msg error",void(W=null);var r=e.data();if(!r.active)return t.textContent="This gift card is no longer active",t.className="coupon-msg error",void(W=null);if(r.balance<=0)return t.textContent="This gift card has no remaining balance",t.className="coupon-msg error",void(W=null);W={code:n,balance:r.balance},t.textContent="Gift card applied! Balance: ₹"+r.balance,t.className="coupon-msg success";var i=x.reduce(function(e,t){return e+X(t)},0),s=i>=o?0:a,c=i-(z?Q(z,i):0)+s,l=c-Math.min(r.balance,c),d=document.getElementById("co-total");d&&(d.textContent="₹"+l.toFixed(0))}).catch(function(e){t.textContent="Error: "+e.message,t.className="coupon-msg error"})}},removeGiftCard:function(){W=null;var e=document.getElementById("giftcard-code"),t=document.getElementById("giftcard-msg");e&&(e.value=""),t&&(t.textContent="",t.className="coupon-msg"),ee()},openGiftCardModal:function(){var e=document.getElementById("giftcard-modal");e&&(e.style.display="block",i())},closeGiftCardModal:function(){var e=document.getElementById("giftcard-modal");e&&(e.style.display="none",t())},buyGiftCard:function(){var e=document.getElementById("gc-recipient-phone").value.trim(),t=document.getElementById("gc-msg");if(!e||!/^\d{10}$/.test(e))return t.textContent="Please enter a valid 10-digit phone number",void(t.className="coupon-msg error");var n=y(),a=n?n.phone:"guest",o=Y,r="GC-"+Date.now().toString(36).toUpperCase().slice(-4)+"-"+Math.random().toString(36).toUpperCase().slice(2,6);if("undefined"==typeof Razorpay)return t.textContent="Payment system loading. Please try again.",void(t.className="coupon-msg error");var i=g();if(!i)return t.textContent="Service unavailable. Please try again.",void(t.className="coupon-msg error");var c={key:s,amount:100*o,currency:"INR",name:"Amogha Cafe",description:"Gift Card - "+r,image:"https://amogha-cafe.web.app/amogha-logo.png",handler:function(n){i.collection("giftCards").doc(r).set({code:r,amount:o,balance:o,purchaserPhone:a,recipientPhone:e,paymentRef:n.razorpay_payment_id,active:!0,createdAt:(new Date).toISOString()}).then(function(){t.textContent="Gift card "+r+" created successfully! Share this code with the recipient.",t.className="coupon-msg success",document.getElementById("gc-recipient-phone").value=""}).catch(function(e){t.textContent="Payment received but error saving: "+e.message,t.className="coupon-msg error"})},prefill:{name:n?n.name:"",contact:a},theme:{color:"#D4A017"}};new Razorpay(c).open()},selectGcAmount:function(e,t){Y=e,document.querySelectorAll(".gc-amount-btn").forEach(function(e){e.classList.remove("active")}),t&&t.classList.add("active")},redeemLoyaltyAtCheckout:function(){var e=y();if(e&&e.loyaltyPoints&&!(e.loyaltyPoints<100)){var t=10*Math.floor(e.loyaltyPoints/100),n=100*Math.floor(e.loyaltyPoints/100),r=x.reduce(function(e,t){return e+X(t)},0),i=Math.min(t,r);if(!(i<=0)){var s=r-i+(r>=o?0:a);z={discount:i,type:"flat",label:"Rs."+i+" (Loyalty Points)",_loyaltyPointsToDeduct:n};var c=document.getElementById("co-total");c&&(c.textContent="Rs."+s.toFixed(0));var l=document.getElementById("coupon-msg");l&&(l.textContent="Redeemed "+n+" points for Rs."+i+" off!",l.className="coupon-msg success");var d=document.getElementById("coupon-code");d&&(d.value="LOYALTY"),e.loyaltyPoints=(e.loyaltyPoints||0)-n,e.loyaltyPoints<0&&(e.loyaltyPoints=0),w(e),"function"==typeof window.updateLoyaltyWidget&&window.updateLoyaltyWidget()}}},shareOrder:function(){var e="I just ordered from Amogha Cafe & Restaurant! 🍽️ Check them out at https://amoghahotels.com";function t(){var e=y();if(e){var t=[];try{t=JSON.parse(localStorage.getItem("amoghaSharedOrders")||"[]")}catch(o){}Date.now().toString();var n=t.length>0?t[t.length-1]:0;if(!(Date.now()-n<3e5)){t.push(Date.now());try{localStorage.setItem("amoghaSharedOrders",JSON.stringify(t))}catch(o){}e.loyaltyPoints=(e.loyaltyPoints||0)+10,w(e);var a=g();a&&a.collection("users").doc(e.phone).update({loyaltyPoints:e.loyaltyPoints}).catch(function(e){console.error("Share loyalty update error:",e)}),h("Thanks for sharing! +10 loyalty points")}}}navigator.share?navigator.share({text:e}).then(function(){t()}).catch(function(){}):(window.open("https://wa.me/?text="+encodeURIComponent(e),"_blank"),t())},addUpsellItem:oe,selectOrderType:function(e,t){var n=document.getElementById("order-type-selector");if(n){n.querySelectorAll(".order-type-btn").forEach(function(e){e.classList.remove("active"),e.setAttribute("aria-checked","false")}),e.classList.add("active"),e.setAttribute("aria-checked","true");var a=document.getElementById("co-address"),o=a?a.closest(".form-group")||a.parentElement:null,r=document.getElementById("delivery-time-estimate");"pickup"===t?(o&&(o.style.display="none"),a&&a.removeAttribute("aria-required"),r&&(r.innerHTML='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/></svg><span>Ready for pickup in: 20 - 30 mins</span>')):(o&&(o.style.display=""),a&&a.setAttribute("aria-required","true"),r&&(r.innerHTML='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/></svg><span>Estimated delivery: 30 - 45 mins</span>')),window._selectedOrderType=t}}}));var ce=["Tiffins","Non-veg Biryani","Veg Biryani","Biryanis","Non-veg Starters","Veg Starters","Starters","Non-veg Curries","Veg Curries","Curries","Non-veg Rice","Veg Rice","Non-veg Noodles","Veg Noodles","Noodles & Fried Rice","Non-veg Pulao","Veg Pulao","Non-veg Soups","Veg Soups","Rice Bowls","Non-veg Rolls","Veg Rolls","Kebabs & Grill","Rotis & Naan","Rotis/Naans","French Fries","Omelette","Fried Egg","Boiled Egg","Beverages","Sweets","Extras","Others"],le={Tiffins:"🍱","Non-veg Biryani":"🍛","Veg Biryani":"🍚",Biryanis:"🍛","Non-veg Starters":"🍗","Veg Starters":"🥗",Starters:"🍢","Non-veg Curries":"🍲","Veg Curries":"🫕",Curries:"🍲","Non-veg Rice":"🍛","Veg Rice":"🍚","Non-veg Noodles":"🍜","Veg Noodles":"🍜","Noodles & Fried Rice":"🍜","Non-veg Pulao":"🍛","Veg Pulao":"🍚","Non-veg Soups":"🍲","Veg Soups":"🥣","Rice Bowls":"🫙","Non-veg Rolls":"🌯","Veg Rolls":"🌯","Kebabs & Grill":"🔥","Rotis & Naan":"🫓","Rotis/Naans":"🫓","French Fries":"🍟",Omelette:"🍳","Fried Egg":"🍳","Boiled Egg":"🥚",Beverages:"🧃",Sweets:"🍬",Extras:"🫙",Others:"🍽️"},de={Starters:"pics/Gemini_Generated_Image_wnzsqxwnzsqxwnzs.png",Curries:"pics/Gemini_Generated_Image_tu348stu348stu34.png",Biryanis:"pics/Gemini_Generated_Image_h1vezgh1vezgh1ve.png","Kebabs & Grill":"pics/Gemini_Generated_Image_5jdcgq5jdcgq5jdc.png","Noodles & Fried Rice":"pics/Gemini_Generated_Image_1ojbou1ojbou1ojb.png","Rotis & Naan":"pics/Gemini_Generated_Image_6lqqu6lqqu6lqqu6.png"};function ue(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function me(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function pe(e){var t="veg"===e.type||!0===e.isVeg,n=t?'<span class="veg-badge" aria-label="Vegetarian">🟢</span>':'<span class="nonveg-badge" aria-label="Non-Vegetarian">🔴</span>',a=e.imageUrl;a&&-1!==a.indexOf("res.cloudinary.com")&&-1!==a.indexOf("/upload/")&&-1===a.indexOf("f_auto")&&(a=a.replace("/upload/","/upload/f_auto,q_auto,w_400/"));var o=a?'<div class="menu-item-img-wrap has-image"><img class="menu-item-img loaded" src="'+ue(a)+'" alt="'+ue(e.name)+'" loading="lazy" decoding="async"></div>':"",r=(e.allergens||[]).join(","),i=t?"veg":"non-veg",s=!1===e.available?" item-unavailable":"",c=!1===e.available?' style="opacity:.45;pointer-events:none;filter:grayscale(.3)"':"",l=e.description?'<p class="item-description">'+ue(e.description)+"</p>":"",d={nuts:"🥜",dairy:"🥛",gluten:"🌾",eggs:"🥚",soy:"🫘",shellfish:"🦐",sesame:"⚪",fish:"🐟"},u="";return e.allergens&&e.allergens.length&&(u='<div class="menu-allergen-icons">'+e.allergens.map(function(e){return'<span class="allergen-icon">'+(d[e]||"")+" "+ue(e)+"</span>"}).join("")+"</div>"),'<div class="menu-item-card'+s+'" data-id="'+ue(e.name)+'" data-allergens="'+ue(r)+'" data-type="'+i+'"'+c+">"+o+'<div class="item-header">'+n+"<h4>"+ue(e.name)+'</h4><span class="price">₹'+(e.price||0)+"</span></div>"+l+u+'<div class="spice-selector"><span class="label">Spice:</span><span class="spice-level" onclick="selectSpice(this)">Mild</span><span class="spice-level active" onclick="selectSpice(this)">Medium</span><span class="spice-level" onclick="selectSpice(this)">Spicy</span></div><button class="add-to-cart" data-item="'+ue(e.name)+'" data-price="'+(e.price||0)+'" aria-label="Add '+ue(e.name)+' to order. Use the spice selector above to choose your preferred spice level.">Add to Order</button></div>'}function fe(){var e=null;try{var t=localStorage.getItem("amoghaUser");t&&(e=JSON.parse(t))}catch(a){}var n=e&&e.allergenAlerts||[];document.querySelectorAll(".menu-item-card[data-id]").forEach(function(e){if(!window._safeForMeActive||0===n.length)return e.classList.remove("allergen-hidden"),void(e.classList.contains("item-unavailable")||(e.style.display=""));(e.dataset.allergens||"").split(",").filter(Boolean).some(function(e){return-1!==n.indexOf(e)})?(e.classList.add("allergen-hidden"),e.style.display="none"):(e.classList.remove("allergen-hidden"),e.classList.contains("item-unavailable")||(e.style.display=""))})}window._safeForMeActive=!1;var ve=[];function ye(){var e=document.querySelectorAll(".menu-item-card");e.forEach(function(e){if(0!==ve.length){var t=!0,n=(e.dataset.allergens||"").split(",").filter(Boolean),a=e.dataset.type||"";ve.forEach(function(e){"veg"===e&&"veg"!==a&&(t=!1),"jain"===e&&"veg"!==a&&(t=!1),"nut-free"===e&&n.indexOf("nuts")>=0&&(t=!1),"dairy-free"===e&&n.indexOf("dairy")>=0&&(t=!1),"gluten-free"===e&&n.indexOf("gluten")>=0&&(t=!1)}),e.style.display=t?"":"none"}else e.style.display=""});var t=Array.prototype.filter.call(e,function(e){return"none"!==e.style.display}).length,n=e.length;if(ve.length>0&&t<n)!function(e,t){var n=document.getElementById("filterCount");if(!n){(n=document.createElement("div")).id="filterCount",n.className="filter-count";var a=document.getElementById("allergenFilterBar");a&&a.appendChild(n)}n.textContent="Showing "+e+" of "+t+" items"}(t,n);else{var a=document.getElementById("filterCount");a&&a.remove()}}function ge(e){var n=document.getElementById("nav-links"),a=document.getElementById("mobile-menu-overlay"),o=document.getElementById("mobile-menu-toggle");n&&n.classList.remove("active"),a&&a.classList.remove("active"),o&&(o.textContent="☰",o.setAttribute("aria-expanded","false")),e?(document.body.classList.remove("modal-open"),document.body.style.top=""):t()}function he(){if("Notification"in window)if("granted"!==Notification.permission){if("denied"!==Notification.permission){var e=document.getElementById("notif-banner");e||r("amoghaNotifDismissed")||((e=document.createElement("div")).id="notif-banner",e.className="notif-banner",e.innerHTML='<span class="notif-icon">🔔</span><span class="notif-text">Get notified when your order is ready!</span><button class="notif-allow" onclick="enableNotifications()">Enable</button><button class="notif-dismiss" onclick="dismissNotifBanner()">×</button>',document.body.appendChild(e),setTimeout(function(){e.classList.add("visible")},3e3))}}else n("amoghaNotifPerm","granted")}function we(){var e=document.getElementById("notif-banner");e&&(e.classList.remove("visible"),setTimeout(function(){e.remove()},400)),n("amoghaNotifDismissed","true")}function be(e,t){if("Notification"in window&&"granted"===Notification.permission)try{new Notification(e,{body:t,icon:"amogha-logo.png",badge:"amogha-logo.png",tag:"amogha-order"})}catch(n){navigator.serviceWorker&&navigator.serviceWorker.ready&&navigator.serviceWorker.ready.then(function(n){n.showNotification(e,{body:t,icon:"amogha-logo.png",tag:"amogha-order"})}).catch(function(){})}}function Ee(){if("undefined"!=typeof firebase&&firebase.messaging)try{var e=firebase.messaging();e.getToken({vapidKey:"BAmoghaVapidKeyPlaceholder"}).then(function(e){e&&function(e){try{var t=JSON.parse(localStorage.getItem("amoghaUser")),a=g();t&&t.phone&&a&&a.collection("users").doc(t.phone).update({fcmToken:e,fcmUpdatedAt:(new Date).toISOString()}).catch(function(e){console.error("FCM token save error:",e)})}catch(o){}n("amoghaFcmToken",e)}(e)}).catch(function(e){console.warn("FCM token error (expected on some browsers):",e.message)}),e.onMessage(function(e){var t=e.notification?e.notification.title:"Amogha Cafe",n=e.notification?e.notification.body:"";be(t,n),h(n||t)})}catch(t){}}window.toggleAllergenFilter=function(e){var t=ve.indexOf(e);t>=0?ve.splice(t,1):ve.push(e),document.querySelectorAll(".allergen-filter-btn").forEach(function(e){var t=e.dataset.filter;t&&e.classList.toggle("active",ve.indexOf(t)>=0)});var n=document.getElementById("clearFiltersBtn");n&&(n.style.display=ve.length>0?"":"none"),ye()},window.clearAllergenFilters=function(){ve=[],document.querySelectorAll(".allergen-filter-btn").forEach(function(e){e.classList.remove("active")});var e=document.getElementById("clearFiltersBtn");e&&(e.style.display="none"),ye()},window.toggleSafeForMe=function(){window._safeForMeActive=!window._safeForMeActive;var e=document.getElementById("safe-for-me-btn");e&&e.classList.toggle("active",window._safeForMeActive),fe()},window.checkAllergenWarning=function(e,t){var n=null;try{var a=localStorage.getItem("amoghaUser");a&&(n=JSON.parse(a))}catch(s){}var o=n&&n.allergenAlerts||[];if(0!==o.length){var r=[];if(document.querySelectorAll(".menu-item-card[data-id]").forEach(function(t){var n=(t.dataset.allergens||"").split(",").filter(Boolean),a=t.querySelector("h4"),i=a?a.textContent.replace(/Bestseller|Must Try|New/gi,"").trim():t.dataset.id;e.forEach(function(e){if(e.name===i||e.name===t.dataset.id){var a=n.filter(function(e){return-1!==o.indexOf(e)});a.length>0&&r.push({name:e.name,allergens:a})}})}),0!==r.length){var i='<div class="allergen-warning-popup" id="allergen-warning-popup"><div class="allergen-warning-box"><h3>Allergen Warning</h3><div class="allergen-list">';r.forEach(function(e){i+="<p><strong>"+ue(e.name)+"</strong> contains: "+e.allergens.map(ue).join(", ")+"</p>"}),i+='</div><button class="btn-proceed" onclick="document.getElementById(\'allergen-warning-popup\').remove();window._allergenCb(true)">Proceed Anyway</button><button class="btn-cancel" onclick="document.getElementById(\'allergen-warning-popup\').remove();window._allergenCb(false)">Go Back</button></div></div>',window._allergenCb=t,document.body.insertAdjacentHTML("beforeend",i)}else t(!0)}else t(!0)},window._uiGlobalsSet||(window._uiGlobalsSet=!0,Object.assign(window,{closeMobileMenu:ge,launchConfetti:function(){const e=document.getElementById("confetti-canvas");if(!e)return;const t=e.getContext("2d");e.width=window.innerWidth,e.height=window.innerHeight;const n=[],a=["#EFB31A","#8B1A1A","#27ae60","#e74c3c","#3498db","#f39c12","#9b59b6"];for(let r=0;r<150;r++)n.push({x:Math.random()*e.width,y:Math.random()*e.height-e.height,w:10*Math.random()+5,h:6*Math.random()+3,color:a[Math.floor(Math.random()*a.length)],vy:3*Math.random()+2,vx:2*Math.random()-1,rot:360*Math.random(),rotSpeed:6*Math.random()-3});let o=0;!function a(){t.clearRect(0,0,e.width,e.height),n.forEach(e=>{e.y+=e.vy,e.x+=e.vx,e.rot+=e.rotSpeed,t.save(),t.translate(e.x,e.y),t.rotate(e.rot*Math.PI/180),t.fillStyle=e.color,t.fillRect(-e.w/2,-e.h/2,e.w,e.h),t.restore()}),o++,o<200?requestAnimationFrame(a):t.clearRect(0,0,e.width,e.height)}()},toggleFaq:function(e){const t=e.classList.toggle("open");e.setAttribute("aria-expanded",t?"true":"false")}}));var Ie=null;function Le(e){Ie&&Ie();var t=g();if(t&&e){var n=null;Ie=t.collection("orders").doc(e).onSnapshot(function(e){if(e.exists){var t=e.data(),a=t.status;if(n&&a!==n){var o={preparing:{title:"👨🍳 Order Being Prepared",body:"Your order is now being freshly prepared in our kitchen!"},ready:{title:"✅ Order Ready!",body:"delivery"===t.orderType?"Your order is ready and will be picked up soon!":"Your order is ready for pickup!"},out_for_delivery:{title:"🛵 Out for Delivery",body:"Your order is on its way! Estimated arrival: "+(t.etaMinutes||30)+" mins"},delivered:{title:"🎉 Order Delivered!",body:"Enjoy your meal! Don't forget to rate your experience."},cancelled:{title:"❌ Order Cancelled",body:"Your order has been cancelled. Contact us for help."}}[a];o&&(be(o.title,o.body),h(o.body))}n=a}})}}function Ce(){var e=document.getElementById("reservation-modal");if(e){var t=document.getElementById("reservation-form");if(t&&"true"!==t.dataset.enhanced){t.dataset.enhanced="true";var n=(new Date).toISOString().split("T")[0],a=new Date(Date.now()+6048e5).toISOString().split("T")[0];t.innerHTML='<input type="text" id="res-name" placeholder="Your Name" required><input type="tel" id="res-phone" placeholder="Phone Number (10 digits)" required maxlength="10"><input type="date" id="res-date" min="'+n+'" max="'+a+'" required><div class="res-time-slots" id="res-time-slots"></div><input type="hidden" id="res-time" value=""><div class="res-party-size"><label>Party Size</label><div class="party-btns" id="party-btns"></div></div><textarea id="res-requests" placeholder="Special Requests (Optional)" rows="2"></textarea><div id="res-msg" class="auth-msg"></div><button type="submit" class="cta-button">Confirm Reservation</button>';for(var o=document.getElementById("party-btns"),r=1;r<=12;r++){var i=document.createElement("button");i.type="button",i.className="party-btn",i.textContent=r,i.dataset.size=r,i.onclick=function(){document.querySelectorAll(".party-btn").forEach(function(e){e.classList.remove("active")}),this.classList.add("active")},o.appendChild(i)}document.getElementById("res-date").addEventListener("change",function(){!function(e){var t=document.getElementById("res-time-slots");if(t){t.innerHTML='<label>Select Time</label><div class="time-grid" id="time-grid"></div>';for(var n=document.getElementById("time-grid"),a=e.split("-"),o=new Date(parseInt(a[0]),parseInt(a[1])-1,parseInt(a[2])).getDay(),r=5===o||6===o?22:21,i=0===o?12:11;i<=r;i++)for(var s=0;s<60&&!(i===r&&s>0);s+=30){var c=String(i).padStart(2,"0")+":"+String(s).padStart(2,"0"),l=(0===i?12:i>12?i-12:i)+":"+String(s).padStart(2,"0")+(i>=12?" PM":" AM"),d=document.createElement("button");d.type="button",d.className="time-slot-btn",d.textContent=l,d.dataset.time=c,d.onclick=function(){document.querySelectorAll(".time-slot-btn").forEach(function(e){e.classList.remove("active")}),this.classList.add("active"),document.getElementById("res-time").value=this.dataset.time},n.appendChild(d)}}}(this.value)}),t.onsubmit=function(e){e.preventDefault(),Se()};var s=y();s&&(document.getElementById("res-name").value=s.name||"",document.getElementById("res-phone").value=s.phone||""),e.style.display="block"}else e.style.display="block"}}function Se(){var e=document.getElementById("res-name").value.trim(),t=document.getElementById("res-phone").value.trim(),n=document.getElementById("res-date").value,a=document.getElementById("res-time").value,o=document.querySelector(".party-btn.active"),r=o?parseInt(o.dataset.size):0,i=document.getElementById("res-requests").value.trim(),s=document.getElementById("res-msg");if(!(e&&t&&n&&a&&r))return s.textContent="Please fill in all required fields.",void(s.className="auth-msg error");if(!/^\d{10}$/.test(t))return s.textContent="Please enter a valid 10-digit phone number.",void(s.className="auth-msg error");var c=document.querySelector('#reservation-form button[type="submit"], #reservation-form .cta-button');if(c){if(c.disabled)return;c.disabled=!0}s.textContent="Booking your table...",s.className="auth-msg";var l=g();if(!l)return s.textContent="Service unavailable. Please refresh and try again.",void(s.className="auth-msg error");var d={name:e,phone:t,date:n,time:a,partySize:r,requests:i,status:"pending",createdAt:(new Date).toISOString()};l.collection("reservations").add(d).then(function(t){var o,i=document.getElementById("reservation-form"),s=new Date(n+"T12:00:00").toLocaleDateString("en-IN",{weekday:"long",day:"numeric",month:"long"}),c=parseInt(a.split(":")[0]);o=(0===c?12:c>12?c-12:c)+":"+a.split(":")[1]+(c>=12?" PM":" AM"),i.innerHTML='<div class="res-confirmed"><div class="res-check">✓</div><h3>Reservation Confirmed!</h3><p class="res-id">Booking #'+t.id.slice(-6).toUpperCase()+'</p><div class="res-details"><p>'+s+" at "+o+"</p><p>"+r+" Guest"+(r>1?"s":"")+'</p></div><a class="whatsapp-btn" href="https://wa.me/919121004999?text='+encodeURIComponent("Hi Amogha! I have a reservation:\nDate: "+s+"\nTime: "+o+"\nGuests: "+r+"\nName: "+e+"\nBooking: #"+t.id.slice(-6).toUpperCase())+'" target="_blank">Confirm via WhatsApp</a><button class="cta-button" onclick="document.getElementById(\'reservation-modal\').style.display=\'none\'" style="margin-top:1rem">Done</button></div>'}).catch(function(){s.textContent="Failed to book. Please try again.",s.className="auth-msg error",c&&(c.disabled=!1)})}function xe(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function ke(e){e.parentElement.querySelectorAll(".spice-level").forEach(e=>e.classList.remove("active")),e.classList.add("active")}function Be(e){if(y()){var t=document.getElementById("review-modal");t||((t=document.createElement("div")).id="review-modal",t.className="modal",t.innerHTML='<div class="modal-content review-modal-content"></div>',document.body.appendChild(t),t.addEventListener("click",function(e){e.target===t&&(t.style.display="none")}));var n=e||x.map(function(e){return{name:e.name}}),a="<span class=\"close\" onclick=\"document.getElementById('review-modal').style.display='none'\">×</span>";a+='<h2>Rate Your Order</h2><p class="review-subtitle">Help us serve you better!</p>',a+='<div id="review-items">',n.forEach(function(e,t){a+='<div class="review-item" data-item="'+xe(e.name)+'"><span class="review-item-name">'+xe(e.name)+'</span><div class="review-stars" data-idx="'+t+'">';for(var n=1;n<=5;n++)a+='<span class="review-star" data-star="'+n+'" onclick="setReviewStar(this, '+t+", "+n+')">☆</span>';a+="</div></div>"}),a+="</div>",a+='<textarea id="review-text" class="review-textarea" placeholder="Share your thoughts (optional)" maxlength="200"></textarea>',a+='<button class="cta-button" onclick="submitReviews()">Submit Review</button><span style="color:#D4A017;font-size:0.75rem;margin-left:8px">Earn 25 pts</span>';var o=t.querySelector(".review-modal-content");o&&(o.innerHTML=a,t.style.display="block",window._reviewRatings=new Array(n.length).fill(0),window._reviewItems=n)}}function Ae(){for(var e=new Date,t=e.getDay(),n=e.getHours(),a=0;a<f.length;a++){var o=f[a];if(-1!==o.days.indexOf(t)&&n>=o.startHour&&n<o.endHour)return o}return null}function Me(){var e=Ae(),t=document.getElementById("happy-hour-banner");if(!e)return t&&(t.style.display="none"),document.querySelectorAll(".hh-price").forEach(function(e){e.remove()}),void document.querySelectorAll(".price.hh-crossed").forEach(function(e){e.classList.remove("hh-crossed")});if(!t){(t=document.createElement("div")).id="happy-hour-banner",t.className="happy-hour-banner";var n=document.getElementById("menu");n&&n.insertBefore(t,n.firstChild)}var a=new Date;a.setHours(e.endHour,0,0,0);var o=Math.max(0,a-new Date),r=Math.floor(o/6e4),i=Math.floor(o%6e4/1e3);t.innerHTML='<span class="hh-icon">🔥</span> <strong class="hh-text">'+e.label+'</strong> <span class="hh-timer">Ends in '+r+"m "+i+"s</span>",t.style.display="flex",document.querySelectorAll(".menu-item-card").forEach(function(t){var n=t.querySelector(".price");if(n){var a=t.closest(".menu-category");if(a){var o=(a.id||"").toLowerCase(),r=-1!==e.categories.indexOf("all");if(r||e.categories.forEach(function(e){-1!==o.indexOf(e)&&(r=!0)}),r){var i=parseInt(n.textContent.replace(/[^\d]/g,"")),s=Math.round(i*(1-e.discount/100));n.classList.add("hh-crossed");var c=t.querySelector(".hh-price");if(c)c.textContent="₹"+s;else{var l=document.createElement("span");l.className="hh-price",l.textContent="₹"+s,n.after(l)}}}}})}function _e(){if(0===x.length)return[];var e={},t=x.map(function(e){return e.name});return t.forEach(function(n){(u[n]||[]).forEach(function(n){-1===t.indexOf(n)&&m[n]&&(e[n]=(e[n]||0)+1)})}),Object.keys(e).sort(function(t,n){return e[n]-e[t]}).slice(0,4).map(function(e){return{name:e,price:m[e]}})}function qe(){var e=document.getElementById("cart-recommendations");if(e){var t=_e();if(0!==t.length){var n='<p class="rec-title">You might also like:</p><div class="rec-items">';t.forEach(function(e){var t=(e.name||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),a=parseInt(e.price,10)||0;n+='<button class="rec-item" data-rec-name="'+t+'" data-rec-price="'+a+'"><span class="rec-name">'+t+'</span><span class="rec-price">₹'+a+'</span><span class="rec-add">+</span></button>'}),n+="</div>",e.innerHTML=n,e.querySelectorAll(".rec-item[data-rec-name]").forEach(function(e){e.addEventListener("click",function(){var t=e.getAttribute("data-rec-name"),n=parseInt(e.getAttribute("data-rec-price"),10)||0;"function"==typeof window.addToCart&&window.addToCart(t,n),"function"==typeof window.displayCart&&window.displayCart(),qe()})}),e.style.display="block"}else e.style.display="none"}}Object.assign(window,{enableNotifications:function(){Notification.requestPermission().then(function(e){n("amoghaNotifPerm",e),we(),"granted"===e&&h("Notifications enabled!")})},dismissNotifBanner:we,sendPushNotification:be,initFCM:Ee,sendSmartNotification:async function(e){var t=null;try{t=JSON.parse(localStorage.getItem("amoghaUser"))}catch(i){}if(t){var n=[];try{var a=JSON.parse(localStorage.getItem("amoghaMyOrders"));a&&(n=a.map(function(e){return e.data}))}catch(i){}try{var o=await fetch("/api/smart-notify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:t.phone,context:e||"general",orderHistory:n.slice(0,5)})});if(!o.ok)throw new Error("Server error");var r=await o.json();be(r.title||"Amogha Cafe",r.body||"Something delicious awaits!")}catch(i){be("Amogha Cafe","We have something delicious waiting for you!")}}},watchOrderStatus:Le,stopWatchingOrder:function(){Ie&&(Ie(),Ie=null)}}),window._reservationsGlobalsSet||(window._reservationsGlobalsSet=!0,Object.assign(window,{openReservationModal:Ce,closeReservationModal:function(){var e=document.getElementById("reservation-modal");e&&(e.style.display="none")},submitReservation:Se})),window.selectSpice=ke;var Te=!1,Pe=null;function Oe(){var e=window.SpeechRecognition||window.webkitSpeechRecognition;if(e){(Pe=new e).continuous=!1,Pe.interimResults=!0,Pe.lang={en:"en-IN",hi:"hi-IN",te:"te-IN"}[He]||"en-IN",Pe.onresult=function(e){for(var t,n,a="",o=e.resultIndex;o<e.results.length;o++)a+=e.results[o][0].transcript;t=a,(n=document.getElementById("voice-transcript"))&&(n.textContent=t),e.results[e.resultIndex].isFinal&&function(e){if(-1!==(e=e.toLowerCase().trim()).indexOf("my usual")||-1!==e.indexOf("same as last")||-1!==e.indexOf("last order")){var t=null;try{t=JSON.parse(localStorage.getItem("amoghaMyOrders"))}catch(c){}if(t&&t.length>0&&t[0].id)return"function"==typeof window.reorderFromHistory&&window.reorderFromHistory(t[0].id),h("Reordering your last order!"),void Re()}var n=e.match(/^(?:add\s+)?(\d+)\s+/),a=n?parseInt(n[1]):1,o=e.replace(/^(?:add\s+)?(\d+\s+)?/,"").replace(/^add\s+/,""),r=null,i=0;if(Object.keys(m).forEach(function(e){var t=e.toLowerCase(),n=0;t===o?n=100:-1!==t.indexOf(o)?n=80:-1!==o.indexOf(t)?n=70:o.split(" ").forEach(function(e){e.length>2&&-1!==t.indexOf(e)&&(n+=20)}),n>i&&(i=n,r=e)}),r&&i>=20){for(var s=0;s<a;s++)q(r,m[r]);h("Added "+a+"x "+r+" to cart"),Re()}else-1!==e.indexOf("checkout")||-1!==e.indexOf("check out")?("function"==typeof window.checkout&&window.checkout(),Re()):-1!==e.indexOf("clear")?("function"==typeof window.clearCart&&window.clearCart(),Re()):(Re(),h("AI is interpreting your request..."),fetch("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e,cart:[]})}).then(function(e){if(!e.ok)throw new Error("chat responded "+e.status);return e.json()}).then(function(e){e.suggestedItems&&e.suggestedItems.length>0?(e.suggestedItems.forEach(function(e){q(e.name,e.price)}),h("Added "+e.suggestedItems.length+" item(s) via AI")):h(e.reply||"Could not understand. Try again.")}).catch(function(){h('Could not find: "'+o+'". Try again.')}))}(a)},Pe.onend=function(){Te&&(Te=!1,Re())},Pe.onerror=function(){Te=!1,Re()};var t=document.createElement("button");t.id="voice-order-btn",t.className="voice-order-btn",t.innerHTML='<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" y1="19" x2="12" y2="23"/><line x1="8" y1="23" x2="16" y2="23"/></svg>',t.title="Voice Order",t.onclick=Ne,document.body.appendChild(t)}}function Ne(){Te?(Pe.stop(),Te=!1,Re()):(Te=!0,De(),Pe.start())}function De(){var e=document.getElementById("voice-overlay");e||((e=document.createElement("div")).id="voice-overlay",e.className="voice-overlay",e.innerHTML='<div class="voice-content"><div class="voice-waves"><span></span><span></span><span></span><span></span><span></span></div><p class="voice-status">Listening...</p><p class="voice-transcript" id="voice-transcript"></p><p class="voice-hint">Say "Add chicken biryani" or "2 butter naan"</p><button class="voice-close" onclick="toggleVoice()">Cancel</button></div>',document.body.appendChild(e)),e.classList.add("active"),document.getElementById("voice-transcript").textContent=""}function Re(){var e=document.getElementById("voice-overlay");e&&e.classList.remove("active")}var He=r("amoghaLang")||"en";function je(){var e=p[He]||p.en;document.querySelectorAll("[data-i18n]").forEach(function(t){var n=t.dataset.i18n;e[n]&&("INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName||void 0===t.placeholder?t.textContent=e[n]:t.placeholder=e[n])})}function Fe(e){return e?(e.name||"USER").replace(/[^A-Za-z]/g,"").toUpperCase().slice(0,4)+(e.phone||"0000").slice(-4):""}function Ve(){(function(){const e=document.getElementById("reviews-carousel")||document.querySelector(".reviews-carousel");if(!e)return window.moveCarousel=window.moveCarousel||function(){},window.moveCarousel;let t,n=0;function a(){return window.innerWidth<=768?1:window.innerWidth<=1024?2:3}function o(){const t=function(){const t=e.querySelector(".review-card");if(!t)return 0;const n=window.getComputedStyle(t),a=t.offsetWidth+parseFloat(n.marginLeft)+parseFloat(n.marginRight);return isNaN(a)?0:a}();e.style.transform="translateX(-".concat(n*t,"px)")}var r=function(t){const r=e.querySelectorAll(".review-card"),i=a(),c=Math.max(0,r.length-i);n=Math.max(0,Math.min(n+t,c)),o(),s()};function i(){const t=e.querySelectorAll(".review-card"),r=a(),i=Math.max(0,t.length-r);n++,n>i&&(n=0),o()}function s(){clearInterval(t),t=setInterval(i,4e3)}window.moveCarousel=r;const c=document.querySelector(".reviews-carousel-wrapper");c&&(c.addEventListener("mouseenter",()=>{clearInterval(t)}),c.addEventListener("mouseleave",()=>{s()})),window.addEventListener("resize",()=>{n=0,o(),s()}),t=setInterval(i,4e3)})(),function(){var e=Array.prototype.slice.call(document.querySelectorAll(".gallery-slide"));0===e.length&&(e=Array.prototype.slice.call(document.body.children).filter(function(e){return e.classList&&e.classList.contains("gallery-slide")}));const t=document.getElementById("gallery-dots");let n=0;if(window.moveGallerySlide=function(){},!e||0===e.length)return window.moveGallerySlide;function a(t){e.forEach(e=>e.classList.remove("active")),e[t]&&e[t].classList.add("active"),n=t,document.querySelectorAll(".gallery-dot").forEach((e,n)=>e.classList.toggle("active",n===t))}if(t&&e.length>1&&e.forEach((e,n)=>{const o=document.createElement("button");o.className="gallery-dot"+(0===n?" active":""),o.addEventListener("click",()=>a(n)),t.appendChild(o)}),window.moveGallerySlide=function(t){0!==e.length&&a((n+t+e.length)%e.length)},e.length>1){var o=setInterval(()=>{window.moveGallerySlide(1)},5e3);window._galleryAutoSlide=o}window.moveGallerySlide}(),function(){window.closeLightbox=function(){},window.navigateLightbox=function(){};const e=document.querySelectorAll(".gallery-item img"),n=document.querySelectorAll(".gallery-slide-item img"),a=document.querySelectorAll("img[data-lightbox], #gallery img"),o=[...e,...n],r=document.getElementById("lightbox"),s=document.getElementById("lightbox-img");let c=0;0===o.length&&a.length>0&&a.forEach(function(e){o.push(e)}),0===o.length&&document.querySelectorAll("img").forEach(function(e){"lightbox-img"!==e.id&&o.push(e)}),r&&s&&0!==o.length&&(o.forEach((e,t)=>{e.addEventListener("click",()=>{c=t,s.src=e.src,r.classList.add("active"),i()})}),window.closeLightbox=function(){r.classList.remove("active"),t()},window.navigateLightbox=function(e){if(o.length){c=(c+e+o.length)%o.length;var t=o[c];t&&s&&(s.src=t.src)}},document.addEventListener("keydown",e=>{r.classList.contains("active")&&("Escape"===e.key&&window.closeLightbox(),"ArrowLeft"===e.key&&window.navigateLightbox(-1),"ArrowRight"===e.key&&window.navigateLightbox(1))}))}(),function(){var e=[{name:"Veg Dum Biryani",price:179},{name:"Paneer Biryani",price:219},{name:"Egg Biryani",price:189},{name:"Chicken Fry Piece Biryani",price:219},{name:"Chicken 65 Biryani",price:249},{name:"Boneless Chicken Biryani",price:219}],n=[{name:"Veg Manchurian",price:169},{name:"Paneer 65",price:189},{name:"Chicken 65",price:200},{name:"Chicken Hot Wings",price:220},{name:"Chilli Chicken",price:200}],a=[{name:"Tea",price:30},{name:"Coffee",price:40},{name:"Lassi",price:50},{name:"Buttermilk",price:35},{name:"Fresh Lime Soda",price:45}],o={biryani:null,starter:null,drink:null};function r(e,t,n){var a=document.getElementById(e);a&&(a.innerHTML=t.map(function(e){return'<button class="combo-option" data-category="'+n+'" data-name="'+e.name+'" data-price="'+e.price+'"><span class="combo-opt-name">'+e.name+'</span><span class="combo-opt-price">₹'+e.price+"</span></button>"}).join(""))}function s(){var e=document.getElementById("combo-selected"),t=document.getElementById("combo-original"),n=document.getElementById("combo-total"),a=document.getElementById("combo-add-btn");if(e){var r=[],i=0;if(o.biryani&&(r.push(o.biryani.name),i+=o.biryani.price),o.starter&&(r.push(o.starter.name),i+=o.starter.price),o.drink&&(r.push(o.drink.name),i+=o.drink.price),e.textContent=r.length>0?r.join(" + "):"Select items above",i>0){var s=Math.round(.85*i);t.textContent="₹"+i,t.style.textDecoration="line-through",n.textContent="₹"+s}else t.textContent="",n.textContent="";a&&(a.disabled=!(o.biryani&&o.starter&&o.drink))}}document.addEventListener("click",function(e){var t=e.target.closest(".combo-option");if(t){var n=t.dataset.category,a=t.dataset.name,r=parseInt(t.dataset.price);t.parentElement.querySelectorAll(".combo-option").forEach(function(e){e.classList.remove("selected")}),t.classList.add("selected"),o[n]={name:a,price:r},s()}}),window.openComboModal=function(){r("combo-biryanis",e,"biryani"),r("combo-starters",n,"starter"),r("combo-drinks",a,"drink"),o={biryani:null,starter:null,drink:null},s();var t=document.getElementById("combo-modal");t&&(t.style.display="block",i())},window.closeComboModal=function(){var e=document.getElementById("combo-modal");e&&(e.style.display="none",t())};var c=document.getElementById("combo-modal");c&&c.addEventListener("click",function(e){e.target===c&&window.closeComboModal()}),window.addComboToCart=function(){if(o.biryani&&o.starter&&o.drink){var e=o.biryani.price+o.starter.price+o.drink.price,t=Math.round(.85*e),n="Combo: "+o.biryani.name+" + "+o.starter.name+" + "+o.drink.name,a=x.find(function(e){return e.name===n});a?a.quantity++:x.push({name:n,price:t,quantity:1}),_(),M(),D(),H(),h("Combo added! You saved ₹"+(e-t)),window.closeComboModal()}}}(),Me(),window._happyHourInterval&&clearInterval(window._happyHourInterval),window._happyHourInterval=setInterval(Me,6e4),setTimeout(Oe,1e3),setTimeout(function(){var e=document.querySelector(".nav-links");if(e&&!e.querySelector(".lang-switcher")){var t=document.createElement("li");t.className="lang-switcher",t.innerHTML='<button class="lang-btn'+("en"===He?" active":"")+'" data-lang="en" onclick="switchLanguage(\'en\')">EN</button><button class="lang-btn'+("hi"===He?" active":"")+'" data-lang="hi" onclick="switchLanguage(\'hi\')">हि</button><button class="lang-btn'+("te"===He?" active":"")+'" data-lang="te" onclick="switchLanguage(\'te\')">తె</button>';var n=e.querySelector(".theme-toggle");n?e.insertBefore(t,n.parentElement):e.appendChild(t),je()}},500),setTimeout(function(){"function"==typeof window.loadMenuRatings&&window.loadMenuRatings()},2e3),function(){window.getScheduleInfo=function(){var e=document.getElementById("schedule-order-check")||document.getElementById("schedChk"),t=document.getElementById("schedule-date")||document.getElementById("schedDate"),n=document.getElementById("schedule-time")||document.getElementById("schedTime");return e&&t&&n&&e.checked?{date:t.value,time:n.value}:null};var e=document.getElementById("schedule-order-check")||document.getElementById("schedChk"),t=document.getElementById("schedule-fields"),n=document.getElementById("schedule-date")||document.getElementById("schedDate"),a=document.getElementById("schedule-time")||document.getElementById("schedTime");e&&n&&a&&e.addEventListener("change",function(){var e;t&&(t.style.display=this.checked?"block":"none"),this.checked&&(function(){var e=new Date,t=e.toISOString().split("T")[0],a=new Date(e);a.setDate(a.getDate()+3);var o=a.toISOString().split("T")[0];n.min=t,n.max=o,n.value=t}(),e=["11:00 AM","11:30 AM","12:00 PM","12:30 PM","1:00 PM","1:30 PM","2:00 PM","2:30 PM","3:00 PM","3:30 PM","4:00 PM","4:30 PM","5:00 PM","5:30 PM","6:00 PM","6:30 PM","7:00 PM","7:30 PM","8:00 PM","8:30 PM","9:00 PM"],a.innerHTML='<option value="">Select Time</option>',e.forEach(function(e){a.innerHTML+='<option value="'+e+'">'+e+"</option>"}))})}(),setTimeout(Je,1500);var e=window.displayCart;"function"==typeof e&&(window.displayCart=function(){e(),qe()})}function Ge(){var e=document.getElementById("daily-special-section");if(e){var t=g();t?t.collection("settings").doc("dailySpecial").get().then(function(t){if(t.exists&&t.data().active){var n=t.data();e.style.display="";var a=e.querySelector(".daily-special-img"),o=e.querySelector(".daily-special-img-placeholder"),r=e.querySelector(".daily-special-title"),i=e.querySelector(".daily-special-desc"),s=e.querySelector(".daily-special-price"),c=e.querySelector(".daily-special-add-btn"),l=n.imageUrl;l&&-1!==l.indexOf("res.cloudinary.com")&&-1!==l.indexOf("/upload/")&&-1===l.indexOf("f_auto")&&(l=l.replace("/upload/","/upload/f_auto,q_auto,w_600/")),l&&a&&(a.src=l,a.style.display="block",o&&(o.style.display="none")),r&&(r.textContent=n.title||"Chef's Special"),i&&(i.textContent=n.description||""),s&&(s.innerHTML="₹"+(n.price||"")),c&&n.title&&(c.dataset.item=n.title,c.dataset.price=n.price||0),d(),window._countdownInterval&&clearInterval(window._countdownInterval),window._countdownInterval=setInterval(d,1e3)}else e.style.display="none";function d(){var t=new Date,n=new Date;n.setHours(24,0,0,0);var a=Math.max(0,n-t),o=Math.floor(a/36e5),r=Math.floor(a%36e5/6e4),i=Math.floor(a%6e4/1e3),s=e.querySelector(".cd-h"),c=e.querySelector(".cd-m"),l=e.querySelector(".cd-s");s&&(s.textContent=String(o).padStart(2,"0")),c&&(c.textContent=String(r).padStart(2,"0")),l&&(l.textContent=String(i).padStart(2,"0"))}}).catch(function(){e.style.display="none"}):e.style.display="none"}}function ze(){var e=document.getElementById("combo-builder-section");if(e){var t={};try{document.querySelectorAll(".menu-item-card[data-id]").forEach(function(e){var n=e.querySelector(".add-to-cart");n&&(t[e.dataset.id]=parseFloat(n.dataset.price)||0)})}catch(i){}var n={"Veg Manchurian":169,"Paneer 65":189,"Chicken 65":200,"Chicken Hot Wings":220,"Veg Spring Rolls":149,"Chicken Lollipop":230,"Paneer Tikka":209,"Chicken Seekh Kebab":229,"Tandoori Chicken":269,"Paneer Butter Masala":199,"Dal Tadka":149,"Butter Chicken":249,"Chicken Curry":219,"Mutton Curry":319,"Gongura Chicken":239,"Veg Dum Biryani":199,"Chicken Dum Biryani":249,"Mutton Dum Biryani":349,"Butter Naan":40,"Garlic Naan":50,"Tandoori Roti":30,"Butter Roti":35,"Laccha Paratha":45,Tea:30,Coffee:40,Lassi:50,Buttermilk:35,"Fresh Lime Soda":45,"Hot Chocolate":60};Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),o("combo-starter",["Veg Manchurian","Paneer 65","Chicken 65","Chicken Hot Wings","Veg Spring Rolls","Chicken Lollipop","Paneer Tikka","Chicken Seekh Kebab","Tandoori Chicken"]),o("combo-main",["Paneer Butter Masala","Dal Tadka","Butter Chicken","Chicken Curry","Mutton Curry","Gongura Chicken","Veg Dum Biryani","Chicken Dum Biryani","Mutton Dum Biryani"]),o("combo-bread",["Butter Naan","Garlic Naan","Tandoori Roti","Butter Roti","Laccha Paratha"]),o("combo-drink",["Tea","Coffee","Lassi","Buttermilk","Fresh Lime Soda","Hot Chocolate"]),e.querySelectorAll("select").forEach(function(e){e.addEventListener("change",r)}),r();var a=e.querySelector(".combo-add-btn");a&&a.addEventListener("click",function(){var t=0;["combo-starter","combo-main","combo-bread","combo-drink"].forEach(function(n){var a=e.querySelector("#"+n);if(a&&a.value){var o=a.options[a.selectedIndex],r=parseFloat(o.dataset.price)||0,i=Math.round(.85*r);"function"==typeof window.finalizeAddToCart&&window.finalizeAddToCart(a.value,i,"medium",[]),t++}}),t>0&&(a.textContent="✓ Added to Cart!",a.style.background="linear-gradient(135deg,#27ae60,#2ecc71)",setTimeout(function(){a.textContent="Add Combo to Cart",a.style.background=""},2e3))})}function o(n,a){var o=e.querySelector("#"+n);o&&(o.innerHTML='<option value="">— Choose —</option>'+a.map(function(e){var n=t[e]||0;return'<option value="'+e+'" data-price="'+n+'">'+e+" (₹"+n+")</option>"}).join(""))}function r(){var t=0;["combo-starter","combo-main","combo-bread","combo-drink"].forEach(function(n){var a=e.querySelector("#"+n);if(a&&a.value){var o=a.options[a.selectedIndex];t+=parseFloat(o.dataset.price)||0}});var n=Math.round(.85*t),a=t-n,o=e.querySelector(".combo-original"),r=e.querySelector(".combo-discounted"),i=e.querySelector(".combo-savings"),s=e.querySelector(".combo-add-btn");o&&(o.textContent=t>0?"₹"+t:""),r&&(r.textContent=t>0?"₹"+n:"₹0"),i&&(i.textContent=t>0?"Save ₹"+a:""),s&&(s.disabled=0===t)}}function We(){const e=g();if(!e)return;const t=document.querySelector(".bar-ticker-track");t&&e.collection("orders").orderBy("createdAt","desc").limit(6).get().then(function(e){const n=[];if(e.forEach(function(e){const t=e.data(),a=t.items&&t.items[0]&&t.items[0].name?t.items[0].name:null,o=(t.customerName||t.userName||"").split(" ")[0]||"Someone";a&&n.push({firstName:o,itemName:a})}),n.length<3)return;const a=n.map(function(e){return'<div class="bar-ticker-item"><span>🍛</span><span>'+(xe(e.firstName)+" just ordered "+xe(e.itemName))+'</span></div><span class="bar-dot"></span>'}).join("");t.innerHTML=a+a}).catch(function(){})}function Ue(){const e=document.getElementById("catering-modal");e&&(e.classList.remove("active"),t())}function Ye(){var e=document.getElementById("reorder-section"),t=document.getElementById("reorder-cards");if(e&&t)if(y()){var n=null;try{n=JSON.parse(localStorage.getItem("amoghaMyOrders"))}catch(r){}if(n&&n.length){var a=n.slice(0,3),o="";a.forEach(function(e){var t=e.data,n=(t.createdAt?new Date(t.createdAt):new Date).toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"}),a=(t.items||[]).reduce(function(e,t){return e+(t.qty||1)},0),r=t.total||0;o+='<div class="reorder-card" style="min-width:220px;background:rgba(212,160,23,0.06);border:1px solid rgba(212,160,23,0.15);border-radius:14px;padding:1rem;scroll-snap-align:start;flex-shrink:0"><div style="font-size:0.8rem;color:var(--text-muted);margin-bottom:0.4rem">'+n+'</div><div style="font-size:0.95rem;font-weight:600;color:var(--text-primary,#1a0f08);margin-bottom:0.3rem">'+a+" item"+(1!==a?"s":"")+'</div><div style="font-size:1.05rem;font-weight:700;color:#D4A017;margin-bottom:0.7rem">Rs.'+r+"</div><button onclick=\"reorderFromHistory('"+e.id+'\')" style="width:100%;padding:0.5rem;background:linear-gradient(135deg,#D4A017,#B8860B);color:#1a0f08;border:none;border-radius:8px;font-weight:700;cursor:pointer;font-size:0.85rem">Reorder</button></div>'}),t.innerHTML=o,e.style.display="block"}else e.style.display="none"}else e.style.display="none"}function Je(){var e=g();e&&e.collection("settings").doc("dynamicPricing").get().then(function(e){e.exists&&e.data().rules&&(v.length=0,e.data().rules.forEach(function(e){v.push(e)}),Ke())}).catch(function(e){console.error("Dynamic pricing load error:",e)})}function Xe(e,t){if(!v||0===v.length)return e;for(var n=new Date,a=n.getDay(),o=n.getHours(),r=(t||"").toLowerCase(),i=0;i<v.length;i++){var s=v[i];if(("all"===s.day||parseInt(s.day)===a)&&!(o<parseInt(s.startHour)||o>=parseInt(s.endHour))){for(var c=s.categories||[],l=!1,d=0;d<c.length;d++)if(c[d].toLowerCase()===r){l=!0;break}if(l)return Math.round(e*parseFloat(s.multiplier))}}return e}function Ke(){v&&0!==v.length&&document.querySelectorAll(".menu-item-card").forEach(function(e){var t=e.querySelector(".price");if(t&&!t.classList.contains("hh-crossed")){var n=e.closest(".menu-category");if(n){var a="",o=n.querySelector("h2, h3, .category-title");o&&(a=o.textContent.trim()),a||(a=(n.id||"").replace("cat-",""));var r=parseInt(t.textContent.replace(/[^\d]/g,""));if(r){var i=Xe(r,a);if(i===r){var s=e.querySelector(".dp-price");return s&&s.remove(),void t.classList.remove("dp-crossed")}t.classList.add("dp-crossed");var c=e.querySelector(".dp-price");if(c)c.textContent="₹"+i;else{var l=document.createElement("span");l.className="dp-price",l.textContent="₹"+i,t.after(l)}}}}})}function Qe(e,t,n){var a="";n.forEach(function(e){var t=(e.name||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),n=(e.reason||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),o=parseInt(e.price,10)||0;a+='<div class="ai-rec-card"><div class="ai-rec-name">'+t+'</div><div class="ai-rec-reason">'+n+'</div><div class="ai-rec-price">₹'+o+'</div><button class="add-to-cart" data-rec-name="'+t+'" data-rec-price="'+o+'">Add to Order</button></div>'}),t.innerHTML=a,t.querySelectorAll(".add-to-cart[data-rec-name]").forEach(function(e){e.addEventListener("click",function(){var t=e.getAttribute("data-rec-name"),n=parseInt(e.getAttribute("data-rec-price"),10)||0;"function"==typeof window.addToCart&&window.addToCart(t,n,e)})}),e.style.display="block"}function $e(){var e=(new Date).getHours();return e>=5&&e<11?"morning":e>=11&&e<15?"lunch":e>=15&&e<19?"evening":e>=19&&e<23?"night":"late"}window._featuresGlobalsSet||(window._featuresGlobalsSet=!0,Object.assign(window,{selectSpice:ke,moveCarousel:window.moveCarousel,moveGallerySlide:window.moveGallerySlide,closeLightbox:window.closeLightbox,navigateLightbox:window.navigateLightbox,openVideoLightbox:function(e){if(e){var t=document.getElementById("video-lightbox"),n=document.getElementById("lightbox-video");t&&n&&(n.src=e,t.style.display="flex",n.play().catch(function(){}))}},closeVideoLightbox:function(){var e=document.getElementById("video-lightbox"),t=document.getElementById("lightbox-video");e&&(e.style.display="none"),t&&(t.pause(),t.src="")},openReviewModal:Be,setReviewStar:function(e,t,n){window._reviewRatings[t]=n,e.parentElement.querySelectorAll(".review-star").forEach(function(e,t){e.innerHTML=t<n?"★":"☆",e.classList.toggle("active",t<n)})},submitReviews:function(){var e=y();if(e){var t=document.getElementById("review-text").value.trim(),n=g();if(n){var a=n.batch(),o=!1;window._reviewItems.forEach(function(r,i){var s=window._reviewRatings[i];if(s>0){o=!0;var c=n.collection("reviews").doc();a.set(c,{itemName:r.name,rating:s,text:t,userName:e.name,userPhone:e.phone,createdAt:(new Date).toISOString()})}}),o?a.commit().then(function(){var e=document.getElementById("review-modal");e&&(e.style.display="none"),h("Thank you for your review!");var t=y();if(t){t.loyaltyPoints=(t.loyaltyPoints||0)+25,w(t);var n=g();n&&n.collection("users").doc(t.phone).update({loyaltyPoints:t.loyaltyPoints}).catch(function(e){console.error("Review loyalty update error:",e)}),setTimeout(function(){h("+25 loyalty points for your review!")},1500)}setTimeout(function(){"function"==typeof window.loadMenuRatings&&window.loadMenuRatings()},1e3)}).catch(function(){h("Failed to submit review. Please try again.")}):h("Please rate at least one item")}}},scheduleReviewPrompt:function(e){setTimeout(function(){y()&&Be(e)},6e4)},openComboModal:window.openComboModal,closeComboModal:window.closeComboModal,addComboToCart:window.addComboToCart,getActiveHappyHour:Ae,getRecommendations:_e,showRecommendations:qe,initVoiceOrdering:Oe,toggleVoice:Ne,showVoiceOverlay:De,switchLanguage:function(e){He=e,n("amoghaLang",e),je(),document.querySelectorAll(".lang-btn").forEach(function(t){t.classList.toggle("active",t.dataset.lang===e)})},applyTranslations:je,openReferralModal:function(){var e=y();if(e){var t=e.referralCode||Fe(e);if(!e.referralCode){e.referralCode=t,w(e);var n=g();n&&n.collection("users").doc(e.phone).update({referralCode:t}).catch(function(e){console.error("Referral code save error:",e)})}var a=document.getElementById("referral-modal");a||((a=document.createElement("div")).id="referral-modal",a.className="modal",a.innerHTML='<div class="modal-content referral-content"></div>',document.body.appendChild(a),a.addEventListener("click",function(e){e.target===a&&(a.style.display="none")}));var o="Order from Amogha Cafe & get Rs.50 off your first order! Use my referral code: "+t+" when signing up. Order at "+window.location.origin;a.querySelector(".referral-content").innerHTML='<span class="close" onclick="document.getElementById(\'referral-modal\').style.display=\'none\'">×</span><h2>Refer a Friend</h2><p class="referral-subtitle">Share your code and both get rewarded!</p><div class="referral-code-box"><span class="referral-code">'+t+'</span><button class="referral-copy" onclick="safeCopy(\''+String(t).replace(/[\\'"]/g,"")+'\',this)">Copy</button></div><div class="referral-rewards"><div class="referral-reward"><span class="referral-reward-icon">🎁</span><span>Your friend gets <strong>Rs.50 off</strong> first order</span></div><div class="referral-reward"><span class="referral-reward-icon">⭐</span><span>You get <strong>100 loyalty points</strong></span></div></div><a class="whatsapp-btn referral-share" href="https://wa.me/?text='+encodeURIComponent(o)+'" target="_blank">Share via WhatsApp</a>',a.style.display="block"}else"function"==typeof window.openAuthModal&&window.openAuthModal()},closeReferralModal:function(){var e=document.getElementById("referral-modal");e&&(e.style.display="none")},generateReferralCode:Fe,applyReferralAtSignup:function(e){if(e){var t=g();t&&(e=e.toUpperCase().trim(),t.collection("users").where("referralCode","==",e).limit(1).get().then(function(e){if(!e.empty){var n=e.docs[0].data(),a=y();a&&n.phone!==a.phone&&(t.collection("referrals").add({referrerPhone:n.phone,refereePhone:a.phone,redeemed:!1,createdAt:(new Date).toISOString()}).catch(function(e){console.error("Referral save error:",e)}),a.referralDiscount=50,w(a),h("Referral applied! Rs.50 off your first order!"))}}))}},openMyOrders:function(){var e=y();if(e){var t=document.getElementById("myorders-modal");t||((t=document.createElement("div")).id="myorders-modal",t.className="modal",t.innerHTML='<div class="modal-content myorders-content"><span class="close" onclick="document.getElementById(\'myorders-modal\').style.display=\'none\';if(typeof unlockScroll===\'function\')unlockScroll()">×</span><h2>My Orders</h2><div id="myorders-list" class="myorders-list"><p>Loading...</p></div></div>',document.body.appendChild(t),t.addEventListener("click",function(e){e.target===t&&(t.style.display="none","function"==typeof window.unlockScroll&&window.unlockScroll())})),t.style.display="block";var a=document.getElementById("myorders-list");a.innerHTML='<p style="text-align:center;color:var(--text-muted)">Loading orders...</p>';var o=g();o?o.collection("orders").where("userId","==",e.phone).orderBy("createdAt","desc").limit(10).get().then(function(e){if(e.empty)a.innerHTML='<p style="text-align:center;color:var(--text-muted);padding:2rem">No orders yet. Place your first order!</p>';else{var t="";e.forEach(function(e){var n=e.data(),a=(n.createdAt?new Date(n.createdAt):new Date).toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"}),o="status-badge status-badge--"+(n.status||"pending"),r=(n.items||[]).map(function(e){return xe(e.name)+" x"+e.qty}).join(", ");t+='<div class="myorder-card"><div class="myorder-header"><span class="myorder-date">'+xe(a)+'</span><span class="'+o+'">'+xe(n.status||"pending")+'</span></div><p class="myorder-items">'+r+'</p><div class="myorder-footer"><span class="myorder-total">Rs.'+(n.total||0)+'</span><button class="myorder-reorder-btn" onclick="reorderFromHistory(\''+e.id+"')\">Order Again</button></div></div>"}),a.innerHTML=t,n("amoghaMyOrders",JSON.stringify(e.docs.map(function(e){return{id:e.id,data:e.data()}})))}}).catch(function(e){console.error("Load orders error:",e);var t=r("amoghaMyOrders");if(t){var n;try{n=JSON.parse(t)}catch(i){n=null}if(!n||!Array.isArray(n))return void(a.innerHTML='<p style="text-align:center;color:#e74c3c">Failed to load orders. Please try again.</p>');var o="";n.forEach(function(e){var t=e.data,n=(t.createdAt?new Date(t.createdAt):new Date).toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"}),a=(t.items||[]).map(function(e){return xe(e.name)+" x"+e.qty}).join(", ");o+='<div class="myorder-card"><div class="myorder-header"><span class="myorder-date">'+xe(n)+'</span><span class="myorder-status">'+xe((t.status||"").toUpperCase())+'</span></div><p class="myorder-items">'+a+'</p><div class="myorder-footer"><span class="myorder-total">Rs.'+(t.total||0)+'</span><button class="myorder-reorder-btn" onclick="reorderFromHistory(\''+e.id+"')\">Order Again</button></div></div>"}),a.innerHTML=o}else a.innerHTML='<p style="text-align:center;color:#e74c3c">Failed to load orders. Please try again.</p>'}):a.innerHTML='<p style="text-align:center;color:var(--text-muted);padding:2rem">Service unavailable. Please refresh.</p>'}else"function"==typeof window.openAuthModal&&window.openAuthModal()},closeMyOrders:function(){var e=document.getElementById("myorders-modal");e&&(e.style.display="none")},reorderFromHistory:function(e){var t=r("amoghaMyOrders");if(t){var n;try{n=JSON.parse(t)}catch(s){return void h("Could not load order history.")}var a=n.find(function(t){return t.id===e});if(a&&a.data.items){a.data.items.forEach(function(e){for(var t=0;t<e.qty;t++)q(e.name,e.price)});var o=document.getElementById("myorders-modal");return o&&(o.style.display="none"),void h("Items added to cart! Review and checkout.")}}var i=g();i&&i.collection("orders").doc(e).get().then(function(e){if(e.exists&&e.data().items){e.data().items.forEach(function(e){for(var t=0;t<e.qty;t++)q(e.name,e.price)});var t=document.getElementById("myorders-modal");t&&(t.style.display="none"),h("Items added to cart! Review and checkout.")}})},loadDailySpecial:Ge,initComboBuilder:ze,getUpsellItems:function(e){var t,n=[];for(t=0;t<e.length;t++)n.push(e[t].name);var a=[],o={};for(t=0;t<e.length;t++){var r=e[t].name,i=u[r];if(i)for(var s=0;s<i.length;s++){var c=i[s];if(-1===n.indexOf(c)&&!o[c]){var l=m[c];if(l&&(o[c]=!0,a.push({name:c,price:l,reason:"Goes great with "+r}),a.length>=3))return a}}}return a}})),window.initLiveOrderTicker=We,window.openCateringModal=function(){const e=document.getElementById("catering-modal");e&&(e.classList.add("active"),i())},window.closeCateringModal=Ue,window.submitCateringEnquiry=function(){var e,t,n,a,o,r;const i=g(),s=null==(e=document.getElementById("catering-name"))?void 0:e.value.trim(),c=null==(t=document.getElementById("catering-phone"))?void 0:t.value.trim(),l=null==(n=document.getElementById("catering-event"))?void 0:n.value,d=null==(a=document.getElementById("catering-guests"))?void 0:a.value,u=null==(o=document.getElementById("catering-date"))?void 0:o.value,m=null==(r=document.getElementById("catering-message"))?void 0:r.value.trim(),p=document.getElementById("catering-submit-btn");function f(e,t){const n=document.createElement("div");n.className="catering-toast"+(t?" is-error":""),n.setAttribute("role",t?"alert":"status"),n.textContent=e,document.body.appendChild(n),setTimeout(()=>n.classList.add("show"),10),setTimeout(()=>{n.classList.remove("show"),setTimeout(()=>n.remove(),400)},4e3)}if(!(s&&c&&l&&d&&u))return void f("Please fill in all required fields.",!0);p&&(p.disabled=!0,p.textContent="Submitting…");const v={name:s,phone:c,eventType:l,guestCount:parseInt(d)||0,date:u,message:m||"",createdAt:(new Date).toISOString()};(i?i.collection("cateringInquiries").add(v):Promise.reject("no db")).then(function(){Ue(),f("✅ Catering enquiry received! We'll contact you within 24 hours.")}).catch(function(){f("Could not submit. Please call us at +91 91210 04999.",!0),p&&(p.disabled=!1,p.textContent="Submit Enquiry")})},window.initOrderAgainSection=Ye,window.loadDynamicPricingRules=Je,window.getAdjustedPrice=Xe,window.applyDynamicPricing=Ke,window.openMealPlannerModal=function(){var e=document.getElementById("meal-planner-overlay");e&&e.remove();var t=document.createElement("div");t.id="meal-planner-overlay",t.className="meal-planner-overlay",t.onclick=function(e){e.target===t&&t.remove()},t.innerHTML='<div class="meal-planner-card"><div class="meal-planner-header"><h2><span class="ai-badge">AI</span> 7-Day Meal Planner</h2><button onclick="closeMealPlanner()" style="background:none;border:none;color:var(--text-muted);font-size:1.5rem;cursor:pointer">×</button></div><div class="meal-planner-controls"><select id="mp-dietary"><option value="all">All</option><option value="veg">Veg Only</option><option value="non-veg">Non-Veg Only</option></select><input type="number" id="mp-budget" placeholder="Daily budget (Rs.)" min="100" max="5000" style="width:140px"><input type="number" id="mp-people" placeholder="People" min="1" max="10" value="1" style="width:80px"></div><button class="meal-planner-generate" onclick="generateMealPlan()">Generate AI Meal Plan</button><div id="meal-plan-result"></div></div>',document.body.appendChild(t)},window.closeMealPlanner=function(){var e=document.getElementById("meal-planner-overlay");e&&e.remove()},window.generateMealPlan=async function(){var e=document.getElementById("meal-plan-result");if(e){e.innerHTML='<div class="insights-loading">Generating your personalized meal plan...</div>';try{var t=await fetch("/api/meal-plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dietary:document.getElementById("mp-dietary").value,budget:parseInt(document.getElementById("mp-budget").value)||0,people:parseInt(document.getElementById("mp-people").value)||1})});if(!t.ok)throw new Error("meal-plan responded "+t.status);var n=await t.json(),a='<div class="meal-plan-grid">';n.days&&n.days.forEach(function(e){a+='<div class="meal-day-card"><h4>'+e.day+"</h4>",(e.meals||[]).forEach(function(e){a+='<div style="font-size:.68rem;color:#D4A017;font-weight:600;text-transform:uppercase;margin-top:6px">'+e.mealType+"</div>",(e.items||[]).forEach(function(e){a+='<div class="meal-item">'+e.name+" x"+(e.qty||1)+" — ₹"+e.price+"</div>"})}),a+="</div>"}),a+="</div>",n.totalCost&&(a+='<div class="meal-plan-summary"><span>Total: ₹'+n.totalCost+"</span><span>Daily avg: ₹"+(n.dailyAverage||Math.round(n.totalCost/7))+"</span></div>"),n.tips&&n.tips.length>0&&(a+='<ul class="meal-plan-tips">',n.tips.forEach(function(e){a+="<li>"+e+"</li>"}),a+="</ul>"),e.innerHTML=a}catch(o){e.innerHTML='<p style="color:#e74c3c;font-size:.85rem;text-align:center">Failed to generate meal plan. Please try again.</p>'}}};var Ze={morning:{emoji:"☀️",text:"Good Morning! Start your day with our breakfast picks"},lunch:{emoji:"🍛",text:"Lunchtime! Fresh biryanis and meals ready for you"},evening:{emoji:"🍵",text:"Good Evening! Time for chai and snacks"},night:{emoji:"🌙",text:"Dinner Time! End your day with something special"},late:{emoji:"🌃",text:"Late Night Cravings? We've got you covered"}},et={morning:["Tiffins","Beverages"],lunch:["Biryanis","Rice","Curries"],evening:["Starters","Beverages","Snacks"],night:["Biryanis","Curries","Noodles"]};function tt(){var e=null;try{e=JSON.parse(localStorage.getItem("amoghaUser"))}catch(l){}if(e){var t=null;try{t=JSON.parse(localStorage.getItem("amoghaMyOrders"))}catch(l){}if(t&&t.length){for(var n={},a=Math.min(t.length,3),o=0;o<a;o++){var r=t[o].data;r&&r.items&&r.items.forEach(function(e){var t=e.name;t&&(n[t]=(n[t]||0)+(e.qty||1))})}var i=Object.keys(n).sort(function(e,t){return n[t]-n[e]}).slice(0,3);if(0!==i.length){var s=(e.name||"Friend").split(" ")[0],c=document.createElement("div");c.id="reorder-bar",c.className="reorder-bar",c.innerHTML='<div class="reorder-bar-inner"><span class="reorder-bar-label">Welcome back, '+s+'! 🔄 Reorder:</span><div class="reorder-bar-chips">'+i.map(function(e){var t=m[e]||0;return'<button class="reorder-chip" data-item="'+e.replace(/"/g,""")+'" data-price="'+t+'">'+e+(t?" ₹"+t:"")+"</button>"}).join("")+'</div><button class="reorder-bar-close" aria-label="Close">×</button></div>',document.body.appendChild(c),c.addEventListener("click",function(e){var t=e.target.closest(".reorder-chip");if(t){var n=t.getAttribute("data-item"),a=parseFloat(t.getAttribute("data-price"))||0;"function"==typeof window.addToCart?window.addToCart(n,a):q(n,a),t.classList.add("reorder-chip--added"),t.textContent="✓ Added",setTimeout(function(){t.classList.remove("reorder-chip--added")},1500)}e.target.closest(".reorder-bar-close")&&nt(c)}),requestAnimationFrame(function(){setTimeout(function(){c.classList.add("reorder-bar--visible")},300)}),setTimeout(function(){nt(c)},1e4)}}}}function nt(e){e&&!e._hiding&&(e._hiding=!0,e.classList.remove("reorder-bar--visible"),setTimeout(function(){e.parentNode&&e.remove()},500))}function at(e,t,n){return e.then(function(e){n&&"function"==typeof e[n]&&e[n]()}).catch(function(e){console.error("[Amogha] Module load failed: "+t,e.message||e)})}function ot(e,t,n){var a=!1;function o(){a||(a=!0,t())}var r=setTimeout(o,n);if("undefined"!=typeof IntersectionObserver)for(var i=0;i<e.length;i++){var s=document.getElementById(e[i]);if(s){var c=new IntersectionObserver(function(e){e[0].isIntersecting&&(clearTimeout(r),o(),c.disconnect())},{rootMargin:"400px"});c.observe(s);break}}}function rt(){var e=document.getElementById("offline-banner");e&&(e.style.display=navigator.onLine?"none":"flex");var t=document.getElementById("aria-live-region");t&&(t.textContent=navigator.onLine?"":"You are currently offline. Some features may be limited.")}if(function(){"scrollRestoration"in history&&(history.scrollRestoration="manual"),window.scrollTo(0,0);var e=document.getElementById("page-transition");e&&requestAnimationFrame(function(){e.classList.add("loaded")});var a=document.getElementById("preloader");a&&setTimeout(function(){a.classList.add("hidden")},800),function(){const e=document.getElementById("theme-toggle");e&&(e.setAttribute("aria-label","Toggle dark mode"),"true"===r("amogha-dark-mode")&&(document.body.classList.add("dark-mode"),e.textContent="☀️"),e.addEventListener("click",()=>{document.body.classList.toggle("dark-mode");const t=document.body.classList.contains("dark-mode");e.textContent=t?"☀️":"🌙",n("amogha-dark-mode",t)}))}(),function(){const e=document.querySelectorAll(".stat-number"),t=document.querySelector(".stats-section");if(t){let n=!1;const a=new IntersectionObserver(o=>{o[0].isIntersecting&&!n&&(n=!0,function(){if(window.innerWidth<=768)e.forEach(function(e){var t=parseFloat(e.dataset.target);e.textContent=t%1!=0?t.toFixed(1):t.toLocaleString()});else{var t=[];e.forEach(function(e){t.push({el:e,target:parseFloat(e.dataset.target),isDecimal:parseFloat(e.dataset.target)%1!=0,lastValue:-1})});var n=performance.now();requestAnimationFrame(function e(a){for(var o=a-n,r=Math.min(o/2e3,1),i=1-Math.pow(1-r,3),s=0;s<t.length;s++){var c=t[s],l=c.isDecimal?+(c.target*i).toFixed(1):Math.floor(c.target*i);l!==c.lastValue&&(c.el.textContent=c.isDecimal?l.toFixed(1):l.toLocaleString(),c.lastValue=l)}r<1&&requestAnimationFrame(e)})}}(),a.unobserve(t))},{threshold:.3});a.observe(t)}}(),function(){var e=document.querySelectorAll(".reveal");if(e.length&&"undefined"!=typeof IntersectionObserver){var t=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&(e.target.classList.add("in-view"),t.unobserve(e.target))})},{threshold:.12,rootMargin:"0px 0px -40px 0px"});e.forEach(function(e){t.observe(e)})}}(),function(){var e=document.getElementById("nav-links"),n=document.getElementById("mobile-menu-toggle"),a=document.getElementById("mobile-menu-overlay");if(e&&n){var o,r=e.parentElement;s(),window.addEventListener("resize",function(){clearTimeout(o),o=setTimeout(s,100)}),n.addEventListener("click",function(o){o&&(o.preventDefault(),o.stopPropagation());var r=e.classList.toggle("active");a&&a.classList.toggle("active",r),n.textContent=r?"✕":"☰",n.setAttribute("aria-expanded",r?"true":"false"),r?i():t()}),a&&a.addEventListener("click",ge),e.querySelectorAll("a").forEach(function(t){t.addEventListener("click",function(o){var r=t.getAttribute("href");if("signin-btn"===t.id||t.closest("#signin-btn"))return e.classList.remove("active"),a&&a.classList.remove("active"),n.textContent="☰",void n.setAttribute("aria-expanded","false");if(r&&r.startsWith("#")&&r.length>1){o.preventDefault(),ge(!0);var i=null;try{i=document.querySelector(r)}catch(s){}i&&"function"==typeof i.scrollIntoView&&setTimeout(function(){i.scrollIntoView({behavior:"smooth",block:"start"})},50)}else ge()})})}function s(){window.innerWidth<=768?e.parentElement!==document.body&&document.body.appendChild(e):e.parentElement===document.body&&r.appendChild(e)}}(),document.querySelectorAll('a[href^="#"]').forEach(e=>{e.addEventListener("click",function(e){if("cart-icon"!==this.id){var t=this.getAttribute("href");if(t&&"#"!==t){e.preventDefault();var n=null;try{n=document.querySelector(t)}catch(o){}if(n&&"function"==typeof n.scrollIntoView){ge(!0),n.scrollIntoView({behavior:"smooth",block:"start"});var a="#home"===t?"":t;history.pushState(null,"",a||window.location.pathname)}}}})}),window.addEventListener("popstate",function(){var e=(window.location.hash||"").split("?")[0];if(e&&e.length>1){var t=null;try{t=document.querySelector(e)}catch(n){}t&&t.scrollIntoView({behavior:"smooth",block:"start"})}else window.scrollTo({top:0,behavior:"smooth"})});const o=document.getElementById("back-to-top");o&&o.addEventListener("click",()=>{window.scrollTo({top:0,behavior:"smooth"})});const s=document.querySelector(".hero-slideshow"),c=document.querySelectorAll("section[id]"),l=document.querySelectorAll('.nav-links a[href^="#"]'),d=document.querySelector("header");var u=0,m=document.querySelector(".hero-scroll-indicator"),p=document.getElementById("btt-ring-fill"),f=document.getElementById("sticky-order-bar"),v=document.querySelector(".hero"),y=2*Math.PI*16,g=v?v.offsetHeight:600,h=[];c.forEach(function(e){h.push({id:e.getAttribute("id"),top:e.offsetTop})});var w=document.querySelector(".about"),b=document.querySelector(".chef-content"),E=document.querySelector(".stats-grid"),I=w?w.offsetTop:0,L=b?b.closest("section")||b.closest(".chef-section"):null,C=L?L.offsetTop:0,S=E?E.closest(".stats-section"):null,x=S?S.offsetTop:0;window.addEventListener("resize",function(){g=v?v.offsetHeight:600,h=[],c.forEach(function(e){h.push({id:e.getAttribute("id"),top:e.offsetTop})}),I=w?w.offsetTop:0,C=L?L.offsetTop:0,x=S?S.offsetTop:0});var k,B=!1;window.addEventListener("scroll",function(){B||(B=!0,requestAnimationFrame(function(){var e=window.pageYOffset,t=window.innerWidth>768;if(s&&t&&(s.style.transform="translate3d(0,"+.15*e+"px,0)"),t){var n=window.innerHeight;if(w&&e>I-n&&e<I+w.offsetHeight){var a=.03*(e-I+n);w.style.setProperty("--section-parallax",a+"px")}b&&e>C-n&&e<C+800&&(b.style.transform="translate3d(0,"+.02*(e-C+n)+"px,0)"),E&&e>x-n&&e<x+600&&(E.style.transform="translate3d(0,"+.015*(e-x+n)+"px,0)")}if(m&&e<300?m.style.opacity=Math.max(0,1-e/300):m&&"0"!==m.style.opacity&&(m.style.opacity=0),d&&t&&(d.style.transform=e>u&&e>100?"translate3d(0,-100%,0)":"translate3d(0,0,0)"),u=e,o){var r=e>400,i=o.classList.contains("visible");r&&!i?o.classList.add("visible"):!r&&i&&o.classList.remove("visible")}if(p){var c=document.documentElement.scrollHeight-document.documentElement.clientHeight,v=c>0?e/c:0;p.style.strokeDashoffset=y*(1-v)}if(f){var L=e>g,S=f.classList.contains("visible");L&&!S?f.classList.add("visible"):!L&&S&&f.classList.remove("visible")}for(var k="",A=0;A<h.length;A++)e>=h[A].top-150&&(k=h[A].id);t&&l.forEach(function(e){e.classList.remove("active"),e.getAttribute("href")==="#"+k&&e.classList.add("active")});var M=k&&"home"!==k?"#"+k:"";window.location.hash!==M&&(M||window.location.hash)&&history.replaceState(null,"",M||window.location.pathname),B=!1}))},{passive:!0}),function(){document.querySelectorAll(".about-text, .special-card, .menu-category, .gallery-item, .review-card, .faq-item, .info-block, .contact-form-section, .stat-item, .chef-content, .trust-badge").forEach(e=>{e.classList.add("reveal");const t=(e.parentElement?Array.from(e.parentElement.children).filter(t=>t.classList.contains(e.classList[0])):[]).indexOf(e);if(t>0){var n=.07*t+.04*Math.sin(t*Math.PI/4);e.style.transitionDelay=Math.max(0,n).toFixed(3)+"s"}}),document.querySelectorAll(".menu-item-card").forEach(e=>{e.classList.add("reveal");const t=(e.parentElement?Array.from(e.parentElement.children):[]).indexOf(e);var n=Math.floor(t/2),a=t%2;e.style.transitionDelay=(.12*n+.06*a).toFixed(3)+"s"}),document.querySelectorAll(".about, .specials, .menu, .gallery, .reviews, .contact, .faq").forEach(e=>{e.classList.add("section-reveal")});const e=document.querySelector(".chef-image"),t=document.querySelector("#chef-info");e&&e.classList.add("reveal-left"),t&&t.classList.add("reveal-right"),document.querySelectorAll(".stat-item").forEach(e=>{e.classList.remove("reveal"),e.classList.add("reveal-scale")});const n=document.querySelectorAll(".reveal, .reveal-left, .reveal-right, .reveal-scale, .section-reveal"),a=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&e.target&&e.target.classList&&e.target.classList.add("visible")})},{threshold:.01,rootMargin:"0px 0px -30px 0px"});n.forEach(e=>a.observe(e))}(),function(){var e=document.querySelectorAll("#chef-slideshow .chef-slide"),t=document.querySelectorAll(".chef-info-slide");if(!(e.length<=1)){var n=0,a=Math.min(e.length,t.length);setInterval(function(){!function(n){for(var o=0;o<a;o++)e[o].classList.remove("active"),t[o].classList.remove("active");e[n].classList.add("active"),t[n].classList.add("active")}(n=(n+1)%a)},5e3)}}(),function(){const e=document.getElementById("category-carousel"),t=document.getElementById("cat-arrow-left"),n=document.getElementById("cat-arrow-right");function a(){t.disabled=e.scrollLeft<=5,n.disabled=e.scrollLeft>=e.scrollWidth-e.clientWidth-5}e&&t&&n&&(t.addEventListener("click",()=>{e.scrollBy({left:-250,behavior:"smooth"})}),n.addEventListener("click",()=>{e.scrollBy({left:250,behavior:"smooth"})}),e.addEventListener("scroll",a,{passive:!0}),a(),e.addEventListener("click",function(e){var t=e.target.closest(".category-item");if(t){e.preventDefault();var n=t.getAttribute("href"),a=n?document.querySelector(n):null;if(a){var o=a.getBoundingClientRect().top+window.pageYOffset-100;window.scrollTo({top:o,behavior:"smooth"})}}}))}(),(k=document.getElementById("menu-search"))&&k.addEventListener("input",function(e){var t=e.target.value.toLowerCase();document.querySelectorAll(".menu-item-card").forEach(function(e){var n=e.querySelector("h4"),a=e.querySelector(".item-description"),o=n?n.textContent.toLowerCase():"",r=a?a.textContent.toLowerCase():"";e.style.display=o.includes(t)||r.includes(t)?"":"none"})}),document.querySelectorAll(".filter-btn").forEach(e=>{e.addEventListener("click",()=>{document.querySelectorAll(".filter-btn").forEach(e=>e.classList.remove("active")),e.classList.add("active");const t=e.dataset.filter;document.querySelectorAll(".menu-item-card").forEach(e=>{const n=e.querySelector(".veg-badge"),a=e.querySelector(".nonveg-badge");"all"===t?e.style.display="":"veg"===t?e.style.display=n?"":"none":"non-veg"===t&&(e.style.display=a?"":"none")})})});var A,M,_,q,T,P,O,N=document.getElementById("contact-form");if(N&&N.addEventListener("submit",e=>{e.preventDefault(),"function"==typeof window.showAuthToast&&window.showAuthToast("Thank you for your message! We will get back to you shortly."),e.target.reset()}),function(){const e=document.getElementById("food-particles");if(!e)return;const t=["🍛","🍚","🌶️","🍗","🥘","🫓","☕","🍲"];for(let n=0;n<12;n++){const n=document.createElement("span");n.className="food-particle",n.textContent=t[Math.floor(Math.random()*t.length)],n.style.left=100*Math.random()+"%",n.style.animationDuration=15+20*Math.random()+"s",n.style.animationDelay=15*Math.random()+"s",n.style.fontSize=1+1.5*Math.random()+"rem",e.appendChild(n)}}(),function(){let e;var t=document.getElementById("pwa-prompt"),n=document.getElementById("pwa-install-btn"),a=document.getElementById("pwa-dismiss-btn");function o(){t&&(t.style.opacity="0",t.style.transform="translateX(-50%) translateY(30px)",setTimeout(function(){t.style.display="none"},400))}window.addEventListener("beforeinstallprompt",function(n){n.preventDefault(),e=n,t&&(t.style.display="flex")}),n&&n.addEventListener("click",function(){e&&(e.prompt(),e.userChoice.then(function(){e=null,o()}))}),a&&a.addEventListener("click",o)}(),window.innerWidth<=768||document.querySelectorAll(".cta-button, .add-to-cart").forEach(e=>{e.addEventListener("mousemove",t=>{const n=e.getBoundingClientRect(),a=t.clientX-n.left-n.width/2,o=t.clientY-n.top-n.height/2;e.style.transform="translate(".concat(.15*a,"px, ").concat(.15*o,"px)")}),e.addEventListener("mouseleave",()=>{e.style.transform=""})}),function(){function e(e){e.complete&&e.naturalHeight>0?e.classList.add("loaded"):e.addEventListener("load",()=>e.classList.add("loaded"))}document.querySelectorAll('img[loading="lazy"]').forEach(e);var t=[document.getElementById("dynamic-menu-container"),document.querySelector(".specials"),document.querySelector(".gallery")].filter(Boolean);if(t.length){const n=new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{1===t.nodeType&&("IMG"===t.tagName&&"lazy"===t.loading&&e(t),(t.querySelectorAll?t.querySelectorAll('img[loading="lazy"]'):[]).forEach(e))})})});t.forEach(function(e){n.observe(e,{childList:!0,subtree:!0})})}}(),function(){if(window.innerWidth<=768)return;document.querySelectorAll(".menu-item-card").forEach(function(e){var t=null;e.addEventListener("mouseenter",function(){t=e.getBoundingClientRect()}),e.addEventListener("mousemove",function(n){if(!t)return;const a=n.clientX-t.left,o=n.clientY-t.top,r=t.width/2,i=t.height/2,s=(o-i)/i*-4,c=(a-r)/r*4;e.style.transform="perspective(1200px) rotateX("+.5*s+"deg) rotateY("+.5*c+"deg) translateY(-2px)"}),e.addEventListener("mouseleave",function(){t=null,e.style.transition="transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1)",e.style.transform="perspective(1200px) rotateX(0) rotateY(0) translateY(0)",setTimeout(function(){e.style.transition=""},500)})})}(),function(){if(!(window.innerWidth<=768)){var e=document.getElementById("cursor-glow");if(e){var t=0,n=0,a=0,o=0,r=!1;document.addEventListener("mousemove",function(a){t=a.clientX,n=a.clientY,r||(r=!0,e.classList.add("active"))}),document.addEventListener("mouseleave",function(){r=!1,e.classList.remove("active")}),e.style.left="0",e.style.top="0",e.style.willChange="transform",function r(){a+=.12*(t-a),o+=.12*(n-o),e.style.transform="translate3d("+a+"px,"+o+"px,0)",requestAnimationFrame(r)}()}}}(),function(){var e=document.querySelectorAll(".svg-ornament");if(0!==e.length){var t=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&e.target.classList.add("visible")})},{threshold:.5});e.forEach(function(e){t.observe(e)})}}(),function(){if(!(window.innerWidth<=768)){var e=document.getElementById("menu-preview-img");if(e){var t={starters:"pics/Gemini_Generated_Image_wnzsqxwnzsqxwnzs.png",curries:"pics/Gemini_Generated_Image_tu348stu348stu34.png",biryanis:"pics/Gemini_Generated_Image_h1vezgh1vezgh1ve.png",kebabs:"pics/Gemini_Generated_Image_5jdcgq5jdcgq5jdc.png",noodles:"pics/Gemini_Generated_Image_1ojbou1ojbou1ojb.png",friedrice:"pics/Gemini_Generated_Image_bfgo8abfgo8abfgo.png",rotis:"pics/Gemini_Generated_Image_6lqqu6lqqu6lqqu6.png"};document.querySelectorAll(".menu-item-card").forEach(function(n){n.addEventListener("mouseenter",function(){var a=n.dataset.imageUrl;if(a)e.src=a,e.style.display="",e.classList.add("active");else{var o=function(e){var t=e.closest(".menu-category");if(!t)return null;var n=t.id||"";return-1!==n.indexOf("starters")?"starters":-1!==n.indexOf("curries")?"curries":-1!==n.indexOf("biryanis")?"biryanis":-1!==n.indexOf("kebabs")?"kebabs":-1!==n.indexOf("noodles")?"noodles":-1!==n.indexOf("friedrice")?"friedrice":-1!==n.indexOf("rotis")?"rotis":null}(n);o&&t[o]&&(e.src=t[o],e.style.display="",e.classList.add("active"))}}),n.addEventListener("mousemove",function(t){e.style.left=t.clientX+20+"px",e.style.top=t.clientY-90+"px"}),n.addEventListener("mouseleave",function(){e.classList.remove("active"),e.style.display="none"})})}}}(),window.innerWidth<=768||document.querySelectorAll(".chef-slide, .gallery-slide-item img, .gallery-item img").forEach(function(e){e.classList.add("magnetic-image");var t=null;e.addEventListener("mouseenter",function(){t=e.getBoundingClientRect()}),e.addEventListener("mousemove",function(n){if(t){var a=n.clientX-t.left-t.width/2,o=n.clientY-t.top-t.height/2;e.style.transform="translate3d("+.015*a+"px,"+.015*o+"px,0) scale(1.01)"}}),e.addEventListener("mouseleave",function(){t=null,e.style.transform=""})}),window.innerWidth<=768||document.querySelectorAll(".menu-item-card, .about-text").forEach(function(e){var t=document.createElement("div");t.className="card-reflection",e.appendChild(t);var n=null;e.addEventListener("mouseenter",function(){n=e.getBoundingClientRect()}),e.addEventListener("mousemove",function(e){n&&(t.style.setProperty("--ref-x",e.clientX-n.left+"px"),t.style.setProperty("--ref-y",e.clientY-n.top+"px"))}),e.addEventListener("mouseleave",function(){n=null})}),function(){var e=document.querySelectorAll(".section-wipe");if(0!==e.length){var t=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&!e.target.classList.contains("wipe-active")&&e.target.classList.add("wipe-active")})},{threshold:.15});e.forEach(function(e){t.observe(e)})}}(),document.addEventListener("click",function(e){var t=e.target;if(t&&"function"==typeof t.closest){var n=t.closest(".add-to-cart, .cta-button, .btn-primary, .pay-now-btn, .combo-add-btn");if(n){var a=document.createElement("span");a.className="btn-ripple";var o=n.getBoundingClientRect(),r=2*Math.max(o.width,o.height);a.style.width=a.style.height=r+"px",a.style.left=e.clientX-o.left-r/2+"px",a.style.top=e.clientY-o.top-r/2+"px",n.appendChild(a),setTimeout(function(){a.remove()},700)}}}),window.innerWidth<=768||document.addEventListener("click",function(e){var t=e.target;if(t){var n=!(!t.classList||"function"!=typeof t.classList.contains||!t.classList.contains("add-to-cart")),a="function"==typeof t.closest&&!!t.closest(".add-to-cart");(n||a)&&function(e,t){for(var n=0;n<10;n++){var a=document.createElement("span");a.className="gold-particle";var o=n/10*Math.PI*2,r=40+30*Math.random(),i=Math.cos(o)*r,s=Math.sin(o)*r;a.style.left=e+"px",a.style.top=t+"px",a.style.setProperty("--tx",i+"px"),a.style.setProperty("--ty",s+"px"),a.style.animationDelay=.1*Math.random()+"s",document.body.appendChild(a),a.addEventListener("animationend",function(){this.remove()})}}(e.clientX,e.clientY)}}),A={Mild:"Subtle warmth, family-friendly",Medium:"Balanced heat, our recommendation",Spicy:"Andhra-level heat, for the brave!"},document.querySelectorAll(".spice-level").forEach(function(e){var t=e.textContent.trim();A[t]&&(e.setAttribute("data-tooltip",A[t]),e.classList.add("has-tooltip"))}),function(){function e(e,t){if(e){var n=0,a=0,o=!1;e.addEventListener("touchstart",function(e){n=e.touches[0].clientX,a=e.touches[0].clientY,o=!0},{passive:!0}),e.addEventListener("touchmove",function(e){if(o){var t=e.touches[0].clientX-n,r=e.touches[0].clientY-a;Math.abs(t)>Math.abs(r)&&Math.abs(t)>10&&e.preventDefault()}},{passive:!1}),e.addEventListener("touchend",function(e){if(o){o=!1;var a=e.changedTouches[0].clientX-n;Math.abs(a)>50&&t(a<0?1:-1)}},{passive:!0})}}e(document.querySelector(".gallery-slideshow-wrapper"),function(e){"function"==typeof window.moveGallerySlide&&window.moveGallerySlide(e)}),e(document.querySelector(".reviews-carousel-wrapper"),function(e){"function"==typeof window.moveCarousel&&window.moveCarousel(e)})}(),function(){var e=document.getElementById("menu-search");if(e){var t=document.createElement("div");t.id="search-autocomplete",t.className="search-autocomplete-dropdown",e.parentElement.classList.add("search-autocomplete-wrap"),e.parentElement.appendChild(t);var n,a,o=[];document.querySelectorAll(".menu-item-card").forEach(function(e){var t=e.querySelector("h4"),n=e.querySelector(".item-description"),a=e.querySelector(".price"),r=!!e.querySelector(".veg-badge"),i=e.closest(".menu-category"),s=i?i.querySelector(".category-title"):null,c=s?s.textContent:"";o.push({name:t?t.textContent.replace(/Bestseller|Popular|Chef's Pick|Must Try/g,"").trim():"",desc:n?n.textContent:"",price:a?a.textContent:"",isVeg:r,category:c,card:e})}),e.addEventListener("input",function(){clearTimeout(n),n=setTimeout(function(){var n=e.value.toLowerCase().trim();if(document.querySelectorAll(".menu-item-card").forEach(function(e){var t=e.querySelector("h4"),a=e.querySelector(".item-description"),o=t?t.textContent.toLowerCase():"",r=a?a.textContent.toLowerCase():"";e.style.display=!n||o.includes(n)||r.includes(n)?"":"none"}),n.length<2)return t.classList.remove("visible"),void(t.innerHTML="");var a=o.filter(function(e){return e.name.toLowerCase().includes(n)||e.desc.toLowerCase().includes(n)}).slice(0,6);if(0===a.length)return t.classList.remove("visible"),void(t.innerHTML="");t.innerHTML="",a.forEach(function(e){var n=document.createElement("button");n.className="ac-item",n.dataset.name=e.name;var a=document.createElement("div");a.className="ac-info";var o=document.createElement("span");o.className="ac-name",o.textContent=e.name;var r=document.createElement("span");r.className="ac-meta";var i=document.createElement("span");i.className=e.isVeg?"ac-badge veg":"ac-badge non-veg",i.textContent=e.isVeg?"VEG":"NON-VEG";var s=document.createElement("span");s.className="ac-cat",s.textContent=e.category,r.appendChild(i),r.appendChild(document.createTextNode(" ")),r.appendChild(s),a.appendChild(o),a.appendChild(r);var c=document.createElement("span");c.className="ac-price",c.textContent=e.price,n.appendChild(a),n.appendChild(c),t.appendChild(n)}),t.classList.add("visible")},150)}),t.addEventListener("click",function(n){var a=n.target.closest(".ac-item");if(a){var r=a.dataset.name;e.value=r,t.classList.remove("visible");var i=o.find(function(e){return e.name===r});i&&i.card&&(document.querySelectorAll(".menu-item-card").forEach(function(e){e.style.display=""}),i.card.scrollIntoView({behavior:"smooth",block:"center"}),i.card.classList.add("search-highlight"),setTimeout(function(){i.card.classList.remove("search-highlight")},2e3))}}),document.addEventListener("click",function(e){e.target&&"function"==typeof e.target.closest&&e.target.closest(".search-autocomplete-wrap")||t.classList.remove("visible")}),e.addEventListener("keydown",function(n){if("Escape"===n.key)return t.classList.remove("visible"),void e.blur();if("ArrowDown"===n.key||"ArrowUp"===n.key){var a=t.querySelectorAll(".ac-item");if(0===a.length)return;n.preventDefault();var o=t.querySelector(".ac-item.focused"),r=o?Array.from(a).indexOf(o):-1;return o&&o.classList.remove("focused"),a[r="ArrowDown"===n.key?(r+1)%a.length:r<=0?a.length-1:r-1].classList.add("focused"),void a[r].scrollIntoView({block:"nearest"})}if("Enter"===n.key){var i=t.querySelector(".ac-item.focused");i&&(n.preventDefault(),i.click())}}),e.addEventListener("input",function(){clearTimeout(a);var t=e.value.trim();t.length<4?r():a=setTimeout(async function(){try{var n=document.getElementById("ai-search-badge");n||((n=document.createElement("span")).id="ai-search-badge",n.className="ai-search-badge",e.parentElement.appendChild(n)),n.textContent="AI searching...",n.style.display="inline-block";var a=await fetch("/api/smart-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:t})});if(!a.ok)return void(n.style.display="none");var o=await a.json();n.textContent="AI: "+(o.interpretation||"results"),o.results&&o.results.length>0&&(document.querySelectorAll(".menu-item-card").forEach(function(e){e.classList.remove("ai-highlighted")}),o.results.forEach(function(e){var t=document.querySelector('.menu-item-card[data-id="'+e.name+'"]');t&&(t.style.display="",t.classList.add("ai-highlighted"))}))}catch(i){r()}},800)})}function r(){var e=document.getElementById("ai-search-badge");e&&(e.style.display="none"),document.querySelectorAll(".menu-item-card.ai-highlighted").forEach(function(e){e.classList.remove("ai-highlighted")})}}(),document.querySelectorAll('img[loading="lazy"]').forEach(function(e){e.complete?e.classList.add("loaded"):(e.addEventListener("load",function(){e.classList.add("loaded")}),e.addEventListener("error",function(){e.classList.add("loaded")}))}),new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){1===e.nodeType&&(e.querySelectorAll?e.querySelectorAll('img[loading="lazy"]'):[]).forEach(function(e){e.complete?e.classList.add("loaded"):e.addEventListener("load",function(){e.classList.add("loaded")})})})})}).observe(document.body,{childList:!0,subtree:!0}),window.location.hash){var D=window.location.hash.split("?")[0],R=null;if(D.length>1)try{R=document.querySelector(D)}catch(j){}R&&setTimeout(function(){R.scrollIntoView({behavior:"smooth",block:"start"})},2e3)}function H(e){var t=document.getElementById("aria-live-region");t&&(t.textContent="",setTimeout(function(){t.textContent=e},100))}navigator.vibrate&&document.addEventListener("click",function(e){var t=e.target;t&&"function"==typeof t.closest&&t.closest(".add-to-cart, .cta-button, .btn-primary, .filter-btn")&&navigator.vibrate(8)}),document.addEventListener("keydown",function(e){if("Escape"===e.key){var t=document.querySelector('.modal[style*="flex"], .modal[style*="block"]');if(t){var n=t.querySelector(".close");n&&n.click()}}if("/"===e.key&&!e.ctrlKey&&!e.metaKey){var a=document.activeElement;if(a&&("INPUT"===a.tagName||"TEXTAREA"===a.tagName||"SELECT"===a.tagName))return;var o=document.getElementById("menu-search");o&&(e.preventDefault(),o.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(function(){o.focus()},300))}}),function(){var e=document.getElementById("dynamic-menu-container");if(e&&!(e.children.length>0)){for(var t="",n=0;n<6;n++)t+='<div class="skeleton" style="height:120px;margin-bottom:1rem;border-radius:var(--radius-md)"></div>';e.innerHTML='<div style="padding:1rem">'+t+"</div>";var a=new MutationObserver(function(t){t.forEach(function(t){if(t.addedNodes.length>0){var n=e.querySelector(".skeleton");n&&n.parentElement.remove(),a.disconnect()}})});a.observe(e,{childList:!0})}}(),function(){var e=document.getElementById("cookie-consent"),t=document.getElementById("cookie-accept"),a=document.getElementById("cookie-decline");if(e){if(window.Capacitor&&"function"==typeof window.Capacitor.isNativePlatform&&window.Capacitor.isNativePlatform())return e.style.display="none",void e.setAttribute("aria-hidden","true");r("amogha-cookie-consent")||(e.style.pointerEvents="none",setTimeout(function(){e.style.animation="none",e.style.transition="none",e.style.opacity="0",e.style.transform="translateY(30px)",e.style.display="",setTimeout(function(){e.style.transition="opacity .5s ease, transform .5s ease",e.style.opacity="1",e.style.transform="translateY(0)",e.style.pointerEvents=""},50)},2500),t&&t.addEventListener("click",function(){o("accepted")}),a&&a.addEventListener("click",function(){o("essential")}))}function o(t){n("amogha-cookie-consent",t),e.style.pointerEvents="none",e.style.opacity="0",e.style.transform="translateY(20px)",setTimeout(function(){e.style.display="none"},400)}}(),M=document.getElementById("newsletter-form"),_=document.getElementById("newsletter-email"),q=document.getElementById("newsletter-msg"),M&&_&&M.addEventListener("submit",function(e){e.preventDefault();var t=_.value.trim();if(t&&t.includes("@")){var a=JSON.parse(r("amogha-newsletter")||"[]");a.includes(t)?q&&(q.textContent="You're already subscribed!"):(a.push(t),n("amogha-newsletter",JSON.stringify(a)),_.value="",q&&(q.textContent="Welcome! You'll receive our best offers."),"function"==typeof window.showAuthToast&&window.showAuthToast("Subscribed successfully! Watch for delicious updates."),setTimeout(function(){q&&(q.textContent="")},5e3))}}),(T=document.getElementById("scroll-progress"))&&window.addEventListener("scroll",function(){var e=document.documentElement.scrollHeight-document.documentElement.clientHeight,t=e>0?window.pageYOffset/e*100:0;T.style.width=t+"%"},{passive:!0}),function(){var e=document.getElementById("offline-banner");function t(){navigator.onLine?(e.style.display="none",H("You are back online.")):(e.style.display="",H("You appear to be offline. Some features may be limited."))}e&&(window.addEventListener("online",t),window.addEventListener("offline",t),navigator.onLine||(e.style.display=""))}(),window._ariaAnnounce=H,function(){var e=document.getElementById("dynamic-menu-container");if(e){var t=new MutationObserver(function(n){var a=e.querySelectorAll(".menu-item-card");if(0!==a.length){t.disconnect();for(var o=[],r=a.length,i=Math.min(5,Math.floor(r/3));o.length<i;){var s=Math.floor(Math.random()*r);-1===o.indexOf(s)&&o.push(s)}o.forEach(function(e){var t=a[e];if(!t.querySelector(".social-proof-badge")){var n=15+Math.floor(35*Math.random()),o=document.createElement("div");o.className="social-proof-badge",o.innerHTML='<span class="proof-dot"></span>'+n+" ordered today";var r=t.querySelector(".price")||t.querySelector(".item-price");r&&r.parentElement&&r.parentElement.insertBefore(o,r.nextSibling)}})}});t.observe(e,{childList:!0,subtree:!0})}}(),document.addEventListener("keydown",function(e){if("Tab"===e.key){var t=document.querySelector('.modal[style*="flex"], .modal[style*="block"]');if(t){var n=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(0!==n.length){var a=n[0],o=n[n.length-1];e.shiftKey?document.activeElement===a&&(e.preventDefault(),o.focus()):document.activeElement===o&&(e.preventDefault(),a.focus())}}}}),window.addEventListener("error",function(e){console.error("[Amogha Error]",e.message,e.filename,e.lineno)}),window.addEventListener("unhandledrejection",function(e){e.reason&&"AbortError"===e.reason.name?e.preventDefault():(console.error("[Amogha Unhandled Promise]",e.reason),e.reason&&"permission-denied"===e.reason.code&&e.preventDefault())}),(P=document.createElement("div")).className="toast-stack",P.setAttribute("aria-live","polite"),document.body.appendChild(P),window._showToast=function(e,t,n){t=t||"",n=n||3500;var a=document.createElement("div");a.className="toast-item"+(t?" "+t:""),a.textContent=e,P.appendChild(a),setTimeout(function(){a.style.opacity="0",a.style.transform="translateX(30px)",a.style.transition="opacity 0.3s, transform 0.3s",setTimeout(function(){a.remove()},300)},n)},(O=document.getElementById("payment-processing"))&&(window._showPaymentProcessing=function(){O.classList.add("active"),window._ariaAnnounce&&window._ariaAnnounce("Processing your payment, please wait")},window._hidePaymentProcessing=function(){O.classList.remove("active")})}(),function(){var e=document.querySelectorAll("#hero-slideshow .hero-slide"),t=document.getElementById("hero-sparkles"),n=0,a=window.innerWidth<=768;!function(){if(t){t.innerHTML="";for(var e=a?5:12,n=a?3:6,o=a?4:10,r=a?2:4,i=0;i<r;i++){var s=document.createElement("span");s.className="sp-glow";var c=200+250*Math.random(),l=10+i/r*70+15*Math.random(),d=20+50*Math.random(),u=10+8*Math.random(),m=3*i+2*Math.random();s.style.cssText="left:"+l+"%;top:"+d+"%;width:"+c+"px;height:"+c+"px;--glow-dur:"+u+"s;--glow-delay:"+m+"s;",t.appendChild(s)}for(var p=0;p<e;p++){var f=document.createElement("span"),v=["","thin","accent","thin",""],y=v[p%v.length];f.className="sp-line"+(y?" "+y:"");var g=140+180*Math.random(),h=3+p/e*90+6*Math.random(),w=12+10*Math.random(),b=p/e*w,E=7+6*Math.random(),I=2.5+2*Math.random();f.style.cssText="left:"+h+"%;height:"+g+"px;--line-dur:"+w+"s;--line-delay:"+b+"s;--sway-dur:"+E+"s;--shimmer-dur:"+I+"s;",t.appendChild(f)}for(var L=0;L<n;L++){var C=document.createElement("span");C.className="sp-dot";var S=4+5*Math.random(),x=8+84*Math.random(),k=18+12*Math.random(),B=3.5*L+4*Math.random();C.style.cssText="left:"+x+"%;width:"+S+"px;height:"+S+"px;--dot-dur:"+k+"s;--dot-delay:"+B+"s;",t.appendChild(C)}for(var A=0;A<o;A++){var M=document.createElement("span");M.className="sp-mote";var _=2+3*Math.random(),q=5+90*Math.random(),T=18+14*Math.random(),P=2.5*A+3*Math.random(),O=1.5+2*Math.random();M.style.cssText="left:"+q+"%;width:"+_+"px;height:"+_+"px;--mote-dur:"+T+"s;--mote-delay:"+P+"s;--twinkle-dur:"+O+"s;",t.appendChild(M)}}}();var o=["kb-zoom-left","kb-zoom-right","kb-pan-down","kb-zoom-center"],r=null;function i(e){(e&&e.dataset.bg&&""===e.style.backgroundImage||e&&e.dataset.bg&&/none/.test(e.style.backgroundImage))&&(e.style.backgroundImage=e.dataset.bg)}if(function(){for(var e=document.querySelectorAll("#hero-slideshow .hero-slide"),t=1;t<e.length;t++){var n=e[t].style.backgroundImage;n&&"none"!==n&&(e[t].dataset.bg=n,e[t].style.backgroundImage="none")}}(),r&&clearInterval(r),e=document.querySelectorAll("#hero-slideshow .hero-slide"),n=0,e.length>1&&(r=setInterval(function(){e[n].classList.remove("active"),n=(n+1)%e.length;for(var t=0;t<o.length;t++)e[n].classList.remove(o[t]);e[n].classList.add(o[Math.floor(Math.random()*o.length)]),e[n].classList.add("active"),i(e[n]),i(e[(n+1)%e.length])},5e3)),window.updateHeroSlides=function(t){var a=document.getElementById("hero-slideshow");if(a&&0!==t.length){r&&clearInterval(r);for(var i=a.querySelectorAll(".hero-slide"),s=0;s<i.length;s++)i[s].remove();t.forEach(function(e,t){var n=document.createElement("div");if(n.className="hero-slide"+(0===t?" active":""),0===t&&n.classList.add(o[Math.floor(Math.random()*o.length)]),n.setAttribute("role","img"),n.setAttribute("aria-label",e.alt||e.name||"Hero slide "+(t+1)),"video"===e.type){n.classList.add("hero-slide-video");var r=document.createElement("video");r.src=e.url,r.autoplay=!0,r.muted=!0,r.loop=!0,r.playsInline=!0,r.setAttribute("playsinline",""),r.setAttribute("webkit-playsinline",""),n.appendChild(r)}else{var i=e.url;i&&-1!==i.indexOf("res.cloudinary.com")&&-1!==i.indexOf("/upload/")&&(i=i.replace("/upload/","/upload/f_auto,q_auto,w_1200/")),n.style.backgroundImage="url("+i+")"}a.appendChild(n)});var c=a.querySelector(".hero-slide.active video");c&&(c._playP=c.play(),c._playP&&c._playP.catch(function(){})),e=a.querySelectorAll(".hero-slide"),n=0,e.length>1&&(r=setInterval(function(){e[n].classList.remove("active");var t=e[n].querySelector("video");if(t){var a=function(e){return function(){e.pause()}}(t);t._playP?(t._playP.then(a).catch(function(){}),t._playP=null):a()}n=(n+1)%e.length;for(var r=0;r<o.length;r++)e[n].classList.remove(o[r]);e[n].classList.add(o[Math.floor(Math.random()*o.length)]),e[n].classList.add("active");var i=e[n].querySelector("video");i&&(i.currentTime=0,i._playP=i.play(),i._playP&&i._playP.catch(function(){}))},5e3))}},window.innerWidth>768){const e=document.querySelector(".hero"),t=document.querySelector(".hero-mouse-spotlight");e&&t&&e.addEventListener("mousemove",function(n){const a=e.getBoundingClientRect(),o=n.clientX-a.left,r=n.clientY-a.top;t.style.setProperty("--mouse-x",o+"px"),t.style.setProperty("--mouse-y",r+"px")})}}(),function(){const e=["Authentic Indian Cuisine","Crafted with Passion","A Legacy of Flavour","Where Taste Meets Art","Born from Tradition"],t=["Tradition, Perfection & Soul in Every Dish","Handcrafted Recipes Passed Down Generations","An Unforgettable Culinary Journey Awaits","Every Flavour Tells a Story of Heritage","Experience the Art of Indian Fine Dining"],n=document.querySelector(".hero-tagline .hero-text-inner"),a=document.querySelector(".hero-subtitle .hero-text-inner");if(!n||!a)return;let o=0;function r(){o=(o+1)%e.length,n.classList.add("fade-out"),a.classList.add("fade-out"),setTimeout(()=>{n.textContent=e[o],a.textContent=t[o],n.classList.remove("fade-out"),a.classList.remove("fade-out")},700)}setTimeout(()=>{window._heroRotateInterval&&clearInterval(window._heroRotateInterval),window._heroRotateInterval=setInterval(r,8e3)},5e3)}(),function(){const e=document.querySelectorAll(".header-slideshow .slide");if(e.length<=1)return;let t=0;window._heroSlideshowInterval&&clearInterval(window._heroSlideshowInterval),window._heroSlideshowInterval=setInterval(()=>{let n;e[t].classList.remove("active");do{n=Math.floor(Math.random()*e.length)}while(n===t&&e.length>1);t=n,e[t].classList.add("active")},3e3)}(),E(),function(){try{const t=r("amoghaCart");if(t){var e=JSON.parse(t);if(!Array.isArray(e))throw new Error("cart payload not an array");x.length=0,e.forEach(function(e){x.push(e)}),_()}}catch(t){x.length=0;try{n("amoghaCart",JSON.stringify([]))}catch(a){}}}(),x.forEach(e=>N(e.name)),H(),function(){var e=document.getElementById("cart-icon"),n=document.getElementById("cart-modal");if(e&&e.addEventListener("click",e=>{e.preventDefault(),j(),n&&(n.style.display="block"),i()}),n){var a=n.querySelector(".close");a&&a.addEventListener("click",function(){n.style.display="none",t()})}var o=document.getElementById("reservation-modal");if(o){var r=o.querySelector(".close");r&&r.addEventListener("click",function(){o.style.display="none",t()})}window.addEventListener("click",e=>{e.target===n&&(n.style.display="none",t()),e.target===document.getElementById("reservation-modal")&&(document.getElementById("reservation-modal").style.display="none",t())}),document.addEventListener("click",e=>{if(e.target.classList.contains("qty-plus")){const t=e.target.dataset.item,n=e.target.closest(".add-to-cart");if(!n)return;return void q(t,n.dataset.price,n)}if(e.target.classList.contains("qty-minus")){const t=e.target.dataset.item,n=x.find(e=>e.name===t);return void(n&&(n.quantity--,n.quantity<=0&&x.splice(x.indexOf(n),1),_(),M(),N(t),D(),R()))}var t,n,a;e.target.classList.contains("add-to-cart")&&!e.target.classList.contains("has-qty")&&(q(e.target.dataset.item,e.target.dataset.price,e.target),n=(t=e.target).closest(".add-to-cart")||t,(a=document.createElement("span")).className="atc-checkmark",a.textContent="✓",n.appendChild(a),setTimeout(function(){a.remove()},800))});var s=document.getElementById("clear-cart");s&&s.addEventListener("click",F);var c=document.getElementById("checkout");c&&c.addEventListener("click",function(){"function"==typeof window.checkout&&window.checkout()})}(),function(){var e=g();if(e){var t=document.getElementById("dynamic-menu-container");if(t){var n='<div class="menu-category"><h3 class="category-title"><div class="skeleton-line w-60" style="height:1.2rem;border-radius:6px;background:#2a2a3a;width:160px;margin-bottom:1rem"></div></h3><div class="menu-items">'+Array(4).fill('<div class="menu-skeleton-card"><div class="skeleton-line h-img"></div><div class="skeleton-line w-60"></div><div class="skeleton-line w-100"></div><div class="skeleton-btn"></div></div>').join("")+"</div></div>";t.innerHTML=n+n}ie("menu","menu_cache",300,function(e){var t={};return e.forEach(function(e){t[e.id]=e.data()}),t},function(e){!function(e){var t={};Object.keys(e).forEach(function(n){var a=e[n],o=(a.category||"Others").trim()||"Others";t[o]||(t[o]=[]),t[o].push(Object.assign({name:n},a))});var n=Object.keys(t).sort(function(e,t){var n=ce.indexOf(e),a=ce.indexOf(t);return-1===n&&-1===a?e.localeCompare(t):-1===n?1:-1===a?-1:n-a});n.forEach(function(e){t[e].sort(function(e,t){var n=(e.sortOrder||999)-(t.sortOrder||999);return 0!==n?n:(e.name||"").localeCompare(t.name||"")})});var a=document.getElementById("dynamic-menu-container");if(a){var o=document.createElement("div");o.innerHTML=n.map(function(e){return'<div class="menu-category" id="cat-'+me(e)+'"><h3 class="category-title">'+ue(e)+'</h3><div class="menu-items">'+t[e].map(pe).join("")+"</div></div>"}).join("");for(var r=document.createDocumentFragment();o.firstChild;)r.appendChild(o.firstChild);a.innerHTML="",a.appendChild(r)}var i=document.getElementById("category-carousel");i&&(i.innerHTML=n.map(function(e){var t=me(e),n=de[e],a=le[e]||"🍽️",o=n?'<div class="category-img-wrap"><img src="'+ue(n)+'" alt="'+ue(e)+'" loading="lazy"></div>':'<div class="category-img-wrap" style="display:flex;align-items:center;justify-content:center;font-size:2rem;background:rgba(212,160,23,.08)">'+a+"</div>";return'<a href="#cat-'+t+'" class="category-item" data-category="'+ue(e)+'">'+o+'<span class="category-name">'+ue(e)+"</span></a>"}).join("")),document.querySelectorAll(".menu-item-card").forEach(function(e){var t=e.querySelector(".menu-badge"),n=e.querySelector("h4"),a=t||n;if(a){var o=(t?t.textContent:"")+a.closest(".menu-item-card").dataset.id;if(/chef|spicy|hot|bestseller/i.test(o)&&!e.querySelector(".flame-badge")){var r=document.createElement("span");r.className="flame-badge",r.textContent="🔥",r.title="Popular pick!",t?t.after(r):n&&n.appendChild(r)}}}),window._safeForMeActive&&fe()}(e)}),ie("specials","specials_cache",300,function(e){var t=[];return e.forEach(function(e){var n=e.data();n.id=e.id,t.push(n)}),t},se,{orderBy:["sortOrder"]}),ie("heroSlides","heroSlides_cache",300,function(e){var t=[];return e.forEach(function(e){var n=e.data();n.active&&t.push(n)}),t},function(e){0!==e.length&&"function"==typeof window.updateHeroSlides&&window.updateHeroSlides(e)},{orderBy:["sortOrder"]});var a=!1;try{var o=localStorage.getItem("theme_cache");if(o){var r=JSON.parse(o);r.ts&&Date.now()-r.ts<6e5&&r.theme&&("default"!==r.theme&&document.body.classList.add("theme-"+r.theme),a=!0)}}catch(c){}a||e.collection("settings").doc("global").get().then(function(e){var t=e.exists&&e.data().activeTheme?e.data().activeTheme:"default";"default"!==t&&document.body.classList.add("theme-"+t);try{localStorage.setItem("theme_cache",JSON.stringify({ts:Date.now(),theme:t}))}catch(c){}}).catch(function(){});var i=document.getElementById("testimonials-grid");i&&ie("testimonials","testimonials_cache",600,function(e){var t=[];return e.forEach(function(e){var n=e.data();n.active&&t.push(n)}),t},function(e){if(0!==e.length)i.innerHTML=e.map(function(e){var t=e.thumbnailUrl||(e.videoUrl?e.videoUrl.replace("/upload/","/upload/f_jpg,so_1/"):"");return'<div class="testimonial-card" onclick="openVideoLightbox(\''+ue(e.videoUrl||"")+'\')"><div class="testimonial-thumb">'+(t?'<img src="'+ue(t)+'" alt="" loading="lazy">':'<div class="testimonial-placeholder">🎬</div>')+'<div class="testimonial-play">▶</div></div><p class="testimonial-name">'+ue(e.customerName||"")+"</p>"+(e.caption?'<p class="testimonial-caption">'+ue(e.caption)+"</p>":"")+"</div>"}).join("");else{var t=i.closest(".testimonials");t&&(t.style.display="none")}},{orderBy:["sortOrder"]});var s=document.getElementById("social-feed-strip");s&&ie("socialPosts","socialPosts_cache",600,function(e){var t=[];return e.forEach(function(e){var n=e.data();n.active&&t.push(n)}),t},function(e){if(0!==e.length)s.innerHTML=e.map(function(e){var t=e.link&&/^https?:\/\//i.test(e.link)?e.link:"",n=t?"</a>":"</div>";return(t?'<a href="'+ue(t)+'" target="_blank" rel="noopener">':"<div>")+'<div class="social-card"><img src="'+ue(e.imageUrl)+'" alt="" loading="lazy">'+(e.caption?'<span class="social-caption">'+ue(e.caption)+"</span>":"")+"</div>"+n}).join("");else{var t=s.closest(".social-feed");t&&(t.style.display="none")}},{orderBy:["sortOrder"]})}}(),(window.requestIdleCallback||function(e){setTimeout(e,100)})(function(){!function(){k.length=0;try{var e=localStorage.getItem("addons_cache");if(e){var t=JSON.parse(e);if(t.ts&&Date.now()-t.ts<6e5&&t.data)return void k.push(...t.data)}}catch(a){}var n=g();n&&n.collection("addons").where("active","==",!0).orderBy("sortOrder").get().then(function(e){e.forEach(function(e){k.push(e.data())});try{localStorage.setItem("addons_cache",JSON.stringify({ts:Date.now(),data:k}))}catch(a){}}).catch(function(){})}(),I(),function(){setTimeout(he,5e3),setTimeout(Ee,8e3);var e=r("amoghaLastOrderId");e&&Le(e)}(),function(){var e=document.querySelector(".cta-button.secondary");e&&-1!==e.textContent.indexOf("Reserve")&&(e.onclick=function(){Ce()});var t=document.getElementById("reservation-form");t&&t.addEventListener("submit",e=>{if("true"!==e.target.dataset.enhanced){e.preventDefault(),"function"==typeof showAuthToast&&showAuthToast("Reservation request received! We will confirm shortly."),e.target.reset();var t=document.getElementById("reservation-modal");t&&(t.style.display="none")}})}(),Ve(),window._personalizeInitDone||(window._personalizeInitDone=!0,function(){var e=document.getElementById("time-greeting");if(e){var t=$e(),n=Ze[t];e.innerHTML='<span class="time-greeting-emoji">'+n.emoji+'</span> <span class="time-greeting-text">'+n.text+"</span>",e.classList.add("time-greeting--"+t),requestAnimationFrame(function(){e.classList.add("time-greeting--visible")})}}(),function(){var e=$e(),t=et[e]||[];if(0!==t.length)var n=0,a=setInterval(function(){n++;var e=document.getElementById("category-carousel");if(e){var o=e.querySelectorAll(".category-item");if(0!==o.length){clearInterval(a);var r=null;if(o.forEach(function(e){var n=e.getAttribute("data-category")||"";t.some(function(e){return-1!==n.toLowerCase().indexOf(e.toLowerCase())})&&(e.classList.add("active"),r||(r=e))}),r&&e.scrollTo){var i=r.offsetLeft-e.offsetLeft-16;e.scrollTo({left:i,behavior:"smooth"})}}else n>=20&&clearInterval(a)}else n>=20&&clearInterval(a)},500)}(),setTimeout(tt,3e3)),C(()=>import("./assets/profile-CQtOP2ll.js"),__vite__mapDeps([0,1,2])).then(function(e){e.initProfile()}),C(()=>import("./assets/badges-C5OTwEu_.js"),__vite__mapDeps([3,1,2]))}),ot(["menu","dynamic-menu-container"],function(){Ge(),ze(),We(),Ye(),at(C(()=>import("./assets/group-CyGAM4ft.js"),__vite__mapDeps([4,1,2])),"group","initGroupOrdering"),at(C(()=>import("./assets/chatbot-BddtVMnH.js"),__vite__mapDeps([5,1,2])),"chatbot","initChatbot"),at(C(()=>import("./assets/splitbill-BQZMlXKW.js"),__vite__mapDeps([6,1,2])),"splitbill"),at(C(()=>import("./assets/subscriptions-BHqqHuLd.js"),__vite__mapDeps([7,1,2])),"subscriptions"),at(C(()=>import("./assets/enhancements-iQl5hZsj.js"),[]),"enhancements","initEnhancements"),at(C(()=>import("./assets/premium-pFoKJGSt.js"),[]),"premium","initPremium")},1500),(window.requestIdleCallback||function(e){setTimeout(e,2e3)})(function(){var e=null;try{e=JSON.parse(localStorage.getItem("amoghaUser"))}catch(t){}e&&function(){var e=null;try{e=JSON.parse(localStorage.getItem("amoghaMyOrders"))}catch(t){}if(e&&e.length){var n=e[0].data;if(n&&n.items&&n.items.length){if(n.createdAt&&(Date.now()-new Date(n.createdAt).getTime())/864e5<1)return;var a=n.items.slice(0,2).map(function(e){return e.name}).join(", ");n.items.length>2&&(a+=" +"+(n.items.length-2)+" more");var o=document.createElement("div");o.className="reorder-toast",o.innerHTML='<div class="reorder-toast-text"><div class="reorder-toast-title">Welcome back! 👋</div><div class="reorder-toast-sub">'+a+'</div></div><button class="reorder-toast-btn" id="reorder-toast-btn">Order Again</button><button class="reorder-toast-close" id="reorder-toast-close">×</button>',document.body.appendChild(o),setTimeout(function(){o.classList.add("show")},100);var r=e[0].id;o.querySelector("#reorder-toast-btn").addEventListener("click",function(){"function"==typeof window.reorderFromHistory&&window.reorderFromHistory(r),o.classList.remove("show"),setTimeout(function(){o.remove()},400)}),o.querySelector("#reorder-toast-close").addEventListener("click",function(){o.classList.remove("show"),setTimeout(function(){o.remove()},400)}),setTimeout(function(){o.classList.remove("show"),setTimeout(function(){o.parentNode&&o.remove()},400)},8e3)}}}()}),ot(["reviews","gallery","menu"],function(){at(C(()=>import("./assets/engagement-CLGf70us.js").then(e=>e.e),__vite__mapDeps([1,2])),"challenges","initChallenges"),at(C(()=>import("./assets/engagement-CLGf70us.js").then(e=>e.f),__vite__mapDeps([1,2])),"spinwheel","initSpinWheel"),at(C(()=>import("./assets/engagement-CLGf70us.js").then(e=>e.h),__vite__mapDeps([1,2])),"secretmenu","initSecretMenu"),at(C(()=>import("./assets/engagement-CLGf70us.js").then(e=>e.j),__vite__mapDeps([1,2])),"feedback","initFeedback"),at(C(()=>import("./assets/engagement-CLGf70us.js").then(e=>e.k),__vite__mapDeps([1,2])),"socialshare","initSocialShare"),at(C(()=>import("./assets/engagement-CLGf70us.js").then(e=>e.p),__vite__mapDeps([1,2])),"polls","initPolls"),at(C(()=>import("./assets/engagement-CLGf70us.js").then(e=>e.m),__vite__mapDeps([1,2])),"milestones"),at(C(()=>import("./assets/engagement-CLGf70us.js").then(e=>e.o),__vite__mapDeps([1,2])),"ordertracker","initOrderTracker"),at(C(()=>import("./assets/seasonal-C9cQEumV.js").then(e=>e.s),__vite__mapDeps([8,1,2])),"seasonal","initSeasonal"),at(C(()=>import("./assets/seasonal-C9cQEumV.js").then(e=>e.w),__vite__mapDeps([8,1,2])),"weather","initWeather")},2500),ot(["gallery","footer","contact"],function(){at(C(()=>import("./assets/worldclass-qouaMUhU.js").then(e=>e.s),__vite__mapDeps([9,1,2])),"stories","initStories"),at(C(()=>import("./assets/worldclass-qouaMUhU.js").then(e=>e.m),__vite__mapDeps([9,1,2])),"moodorder","initMoodOrder"),at(C(()=>import("./assets/worldclass-qouaMUhU.js").then(e=>e.l),__vite__mapDeps([9,1,2])),"livequeue","initLiveQueue"),at(C(()=>import("./assets/worldclass-qouaMUhU.js").then(e=>e.a),__vite__mapDeps([9,1,2])),"streaks","initStreaks"),at(C(()=>import("./assets/worldclass-qouaMUhU.js").then(e=>e.g),__vite__mapDeps([9,1,2])),"giftcards","initGiftCards"),at(C(()=>import("./assets/worldclass-qouaMUhU.js").then(e=>e.r),__vite__mapDeps([9,1,2])),"referral","initReferral"),at(C(()=>import("./assets/worldclass-qouaMUhU.js").then(e=>e.b),__vite__mapDeps([9,1,2])),"musicplayer","initMusicPlayer"),at(C(()=>import("./assets/worldclass-qouaMUhU.js").then(e=>e.c),__vite__mapDeps([9,1,2])),"arpreview","initARPreview"),at(C(()=>import("./assets/worldclass-qouaMUhU.js").then(e=>e.v),__vite__mapDeps([9,1,2])),"voiceorder","initVoiceOrder"),at(C(()=>import("./assets/worldclass-qouaMUhU.js").then(e=>e.d),__vite__mapDeps([9,1,2])),"geofence","initGeofence")},3500),ot(["footer","contact","gallery"],function(){at(C(()=>import("./assets/worldclass2-B_2sGT2K.js"),__vite__mapDeps([10,1,2])),"worldclass2","initWorldClass2")},5e3),(window.requestIdleCallback||function(e){setTimeout(e,3e3)})(async function(){var e=document.getElementById("ai-for-you"),t=document.getElementById("ai-for-you-cards");if(e&&t){try{var n=JSON.parse(localStorage.getItem("ai_recommendations"));if(n&&Date.now()-n.ts<18e5)return void Qe(e,t,n.data)}catch(c){}var a=y(),o=[];try{var r=JSON.parse(localStorage.getItem("amoghaMyOrders"));r&&(o=r.map(function(e){return e.data}))}catch(c){}try{var i=await fetch("/api/recommend",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orderHistory:o.slice(0,10),currentCart:x.map(function(e){return{name:e.name}}),timeOfDay:(new Date).getHours(),isVegOnly:a&&(a.dietaryPrefs||[]).includes("Vegetarian")})});if(!i.ok)return void(e.style.display="none");var s=await i.json();if(s.recommendations&&s.recommendations.length>0){Qe(e,t,s.recommendations);try{localStorage.setItem("ai_recommendations",JSON.stringify({ts:Date.now(),data:s.recommendations}))}catch(c){}}}catch(c){e.style.display="none"}}}),R(),document.body.style.overflow="",document.body.classList.remove("modal-open"),window.displayCart=j,window.loadMenuRatings=function(){var e=g();if(e){try{var t=r("amoghaRatings");if(t){var a=JSON.parse(t);if(a.ts&&Date.now()-a.ts<6e5&&a.data)return void o(a.data)}}catch(i){}e.collection("reviews").get().then(function(e){var t={};e.forEach(function(e){var n=e.data();t[n.itemName]||(t[n.itemName]={total:0,count:0}),t[n.itemName].total+=n.rating,t[n.itemName].count++}),o(t),n("amoghaRatings",JSON.stringify({ts:Date.now(),data:t}))}).catch(function(){try{var e=r("amoghaRatings");if(e){var t=JSON.parse(e);t.data&&o(t.data)}}catch(i){}})}function o(e){document.querySelectorAll(".menu-item-card").forEach(function(t){var n=t.querySelector("h4");if(n){var a=n.textContent.replace(/Bestseller|Must Try|New/gi,"").trim(),o=e[a];if(o&&o.count>0){var r=(o.total/o.count).toFixed(1),i=t.querySelector(".item-rating");i&&i.remove();var s=document.createElement("div");s.className="item-rating",s.innerHTML='<span class="rating-stars">'+function(e){for(var t="",n=1;n<=5;n++)n<=Math.floor(e)?t+='<span class="star filled">★</span>':t+=n-.5<=e?'<span class="star half">★</span>':'<span class="star empty">☆</span>';return t}(parseFloat(r))+'</span><span class="rating-text">'+r+" ("+o.count+")</span>";var c=t.querySelector(".item-description");c&&c.after(s)}}})}},window.addEventListener("online",rt),window.addEventListener("offline",rt),rt(),window.addEventListener("error",function(e){console.error("[Amogha] Unhandled error:",e.message,"at",e.filename,":",e.lineno)}),window.addEventListener("unhandledrejection",function(e){e.reason&&"AbortError"===e.reason.name?e.preventDefault():console.error("[Amogha] Unhandled promise rejection:",e.reason)}),"undefined"!=typeof performance&&performance.mark&&performance.mark("amogha-app-init-complete"),"undefined"!=typeof PerformanceObserver)try{new PerformanceObserver(function(e){var t=e.getEntries(),n=t[t.length-1];n&&Math.round(n.startTime)}).observe({type:"largest-contentful-paint",buffered:!0});var it=0;new PerformanceObserver(function(e){e.getEntries().forEach(function(e){e.hadRecentInput||(it+=e.value)})}).observe({type:"layout-shift",buffered:!0}),document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&it>0&&it.toFixed(4)})}catch(st){}export{e as __vite_legacy_guard,D as a,x as c,M as s,_ as u};