1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6716],{16716:(e,t,s)=>{s.d(t,{l:()=>v});var l=s(95155),r=s(12115),i=s(4474),n=s(33210),a=s(6296),o=s(51914),d=s(66609),c=s(58246),x=s(37002),u=s(74350),m=s(16321),h=s(96621),b=s(25602),p=s(27714),g=s(2693),f=s(23591),w=s(74320),j=s(45601),N=s(62795);let v=({isOpen:e,onOpenChange:t,store:s,t:g,onSuccess:f,onOpenChat:v})=>{let[y,_]=(0,r.useState)(!1),[S,C]=(0,r.useState)(""),[I,B]=(0,r.useState)(""),[z,F]=(0,r.useState)(!1),M=s?.BespokeOrderTemplate,$=M?.Id??M?.TemplateId,q=s?.Id??s?.StoreId,A=(0,h.a)(),[T,D]=(0,r.useState)(!1),[O,G]=(0,r.useState)(!1),[P,R]=(0,r.useState)(!1),E=(0,r.useRef)(null),{openAuthModal:U}=(0,j.w)(),H=(0,x.useGlobalStore)(e=>e.currency),L=Number(H?.ConversionRate??1),Q=(0,r.useMemo)(()=>M?.MinBudget==null?null:M.MinBudget*L,[M?.MinBudget,L]),V=(0,r.useMemo)(()=>M?.MinBudget==null?"":(0,p.Hx)(M.MinBudget,{currency:H,showSymbol:!1}),[M?.MinBudget,H]),X=()=>{C(""),B(""),F(!1)},Y=()=>{let e=E.current?.getApiPayload()??[];return!!S.trim()||e.length>0},J=()=>{G(!1),R(!1),t(!1),setTimeout(X,300)};if((0,r.useEffect)(()=>{D(!0)},[]),!e||!M||!$||!q)return null;let K=async()=>{if(y)return;let e=x.useGlobalStore.getState().current_user;if(!e||e.IsGuest){if(!await U())return;e=x.useGlobalStore.getState().current_user}if(!await (E.current?.validate()??Promise.resolve(!0)))return;let t=!1;if(null!=Q)if(S){let e=parseFloat(S);(isNaN(e)||e<Q)&&(B(g.bespoke.budget_error?.replace("{minBudget}",V)||`Minimum budget is ${V}`),t=!0)}else B(g.bespoke.budget_required),t=!0;if(t){d.oR.error(g.bespoke.fill_required),setTimeout(()=>{let e=document.getElementById("budget-section");e&&e.scrollIntoView({behavior:"smooth",block:"center"})},100),_(!1);return}_(!0);try{let t={Answers:E.current?.getApiPayload()??[],BudgetInUsd:S?Number((parseFloat(S)/L).toFixed(2)):null,StoreId:q,TemplateId:$,UserId:e?.Id||null},s=await (0,b.Gq)(t);if(s.Success){let e=s.Data,t=e?.Id||s?.Id||e;"number"==typeof t&&f?.(t),F(!0)}else d.oR.error(s?.Message||g?.bespoke?.error_message||"Failed to submit request.")}catch(e){console.error("Submission error:",e),d.oR.error(e?.message||g?.bespoke?.generic_error||"An error occurred while submitting.")}finally{_(!1)}},W=(0,l.jsx)("div",{className:"relative flex flex-col h-full max-h-[inherit]",children:z?(0,l.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center animate-in fade-in zoom-in duration-500",children:[(0,l.jsx)("div",{className:"w-40 h-40 lg:w-48 lg:h-48 mb-6",children:(0,l.jsx)(c.A,{src:"/sugary-web-assets/animations/success.json",loop:!1,className:"w-full h-full"})}),(0,l.jsx)("h2",{className:"text-2xl font-bold text-white mb-3",children:g?.bespoke?.submit_success_title||"Submit Successful"}),(0,l.jsx)("p",{className:"text_gray_50 text-sm lg:text-base leading-relaxed max-w-sm mb-8",children:g?.bespoke?.submit_success_desc||"Your request has been sent! To discuss details and chat with the store, please proceed to chat or download the Sugary app."}),(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 w-full max-w-xs sm:max-w-sm",children:[(0,l.jsx)(i.$,{onClick:()=>{t(!1),X(),v?v():q&&N.c.getState().openDrawer({storeId:Number(q)})},className:"flex-1 h-[52px] bg-emerald-600 hover:bg-emerald-500 text-white font-bold rounded-2xl transition-all shadow-[0_8px_30px_rgba(16,185,129,0.3)] active:scale-[0.98] text-xl md:text-sm",children:g?.bespoke?.open_chat||"Open Chat"}),(0,l.jsx)(i.$,{variant:"ghost",onClick:()=>{t(!1),X()},className:"flex-1 h-[52px] bg-white/5 hover:bg-white/10 text-white/70 hover:text-white font-bold rounded-2xl transition-all text-xl md:text-sm",children:g?.bespoke?.close||"Close"})]})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-10 custom-scrollbar scroll-smooth",children:[(0,l.jsxs)("div",{className:"shrink-0 border-b border-white/5 p-2 mb-4",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-4 mb-1",children:[(0,l.jsx)("h2",{className:"text-2xl font-bold leading-tight text-white",children:M.Title}),(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)("button",{type:"button",onClick:()=>{Y()?R(!0):(t(!1),X())},className:"cursor-pointer shrink-0 p-2 rounded-full bg-white/10 hover:bg-white/20 transition-all text-white",children:(0,l.jsx)(n.A,{className:"w-5 h-5"})}),P&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"fixed inset-0 z-[9998]",onClick:()=>R(!1)}),(0,l.jsx)("div",{className:"absolute top-full right-0 mt-3 w-64 p-4 bg-neutral-900 border border-white/10 ring-1 ring-white/10 text-white rounded-2xl z-[9999] shadow-2xl animate-in fade-in zoom-in-95 duration-200",children:(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)("p",{className:"text-sm font-semibold",children:g.bespoke.discard_title||"Discard changes?"}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(i.$,{size:"sm",type:"button",onClick:()=>R(!1),className:"flex-1 h-9 bg-white/5 hover:bg-white/10 text-white text-xs rounded-xl",children:g.bespoke.keep_writing}),(0,l.jsx)(i.$,{size:"sm",type:"button",onClick:J,className:"flex-1 h-9 bg-red-600 hover:bg-red-500 text-white text-xs rounded-xl",children:g.bespoke.discard_confirm})]})]})})]})]})]}),(0,l.jsx)("p",{className:"text_gray_50 text-xl lg:text-base leading-relaxed line-clamp-3",children:M.Instruction})]}),(0,l.jsx)(w.X,{ref:E,customizations:M.Questions,quantity:1,storeOrderItemId:null,readonly:!1,basketId:null,onCostChange:()=>{},slotTitle:"Fill up the Form",transparentUI:!0}),(0,l.jsx)(k,{id:"budget-section",value:S,onChange:e=>{if(C(e),B(""),e&&null!=Q){let t=parseFloat(e);!isNaN(t)&&t<Q&&B(g.bespoke.budget_error.replace("{minBudget}",V))}},currency:H,placeholder:g.bespoke.enter_budget,error:I,isRequired:null!=Q,minBudgetInfo:Q?g.bespoke.budget_min_info?.replace("{minBudget}",(0,p.Hx)(M.MinBudget,{currency:H}
1)):void 0})]}),(0,l.jsxs)("div",{className:`flex items-center justify-end gap-2 shrink-0 px-6 py-2 pb-4 border-t border-white/5 ${A?"pb-10":""}`,children:[!A&&(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(i.$,{type:"button",onClick:()=>{Y()?G(!0):(t(!1),X())},className:" h-[52px] bg_secondary text-white hover:bg-white/30 font-bold text-sm rounded-2xl active:scale-[0.98] transition-all flex items-center justify-center gap-3",children:(0,l.jsx)("span",{className:"flex items-center gap-2",children:g.bespoke.close})}),O&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"fixed inset-0 z-[9998]",onClick:()=>G(!1)}),(0,l.jsx)("div",{className:"absolute bottom-full right-0 mb-3 w-64 p-4 bg-neutral-900 border border-white/10 ring-1 ring-white/10 text-white rounded-2xl z-[9999] shadow-2xl animate-in fade-in zoom-in-95 duration-200",children:(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)("p",{className:"text-sm font-semibold",children:g.bespoke.discard_title}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(i.$,{size:"sm",type:"button",onClick:()=>G(!1),className:"flex-1 h-9 bg-white/5 hover:bg-white/10 text-white text-xs rounded-xl",children:g.bespoke.keep_writing}),(0,l.jsx)(i.$,{size:"sm",type:"button",onClick:J,className:"flex-1 h-9 bg-red-500 hover:bg-red-400 text-white text-xs rounded-xl",children:g.bespoke.discard_confirm})]})]})})]})]}),(0,l.jsx)(i.$,{onClick:K,disabled:y,className:`${A&&"w-full"} !h-[52px] text-white bg-gradient-to-br from-[#003d24]/70 to-[#005a34] border border-white/10 font-bold text-2xl md:text-sm rounded-2xl active:scale-[0.98] transition-all flex items-center justify-center gap-3 hover:opacity-80`,children:y?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.A,{className:"w-5 h-5 animate-spin"}),(0,l.jsx)("span",{children:g.bespoke.sending})]}):(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[(0,l.jsx)(o.A,{className:"w-5 h-5"}),g.bespoke.submit_booking]})})})]})]})});return T?A?(0,l.jsx)(m._s,{open:e,onOpenChange:e=>{e?t(!0):t(!1)},children:(0,l.jsx)(m.zj,{className:"bg-neutral-950 border-white/10 h-[92vh] focus:outline-none",onPointerDownOutside:e=>e.preventDefault(),children:W})}):(0,l.jsx)(u.lG,{open:e,onOpenChange:t,children:(0,l.jsxs)(u.Cf,{className:"w-[55vw] max-w-[680px] lg:max-h-[90vh] overflow-hidden squircle p-0 border-none bg-black text-white shadow-2xl ring-1 ring-white/10 animate-in fade-in zoom-in duration-300",onPointerDownOutside:e=>e.preventDefault(),children:[(0,l.jsx)(u.L3,{className:"sr-only",children:"Bespoke order request"}),W]})}):null},k=({id:e,value:t,onChange:s,currency:i,placeholder:n,error:a,minBudgetInfo:o,isRequired:d})=>{let[c,x]=(0,r.useState)(t),{language:u}=(0,g.n)(),m=f.P[u];return(0,r.useEffect)(()=>{x(t)},[t]),(0,l.jsxs)("div",{id:e,className:"space-y-5 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[(0,l.jsx)("div",{className:"space-y-1.5 border-l-4 border-emerald-400 pl-2",children:(0,l.jsxs)("div",{className:"text-[17px] font-bold text-white/70 mb-0 flex items-center gap-2",children:[m.bespoke?.budget_section,d&&(0,l.jsx)("span",{className:"text-red-500 text-xl leading-none",children:"*"})]})}),(0,l.jsxs)("div",{className:"relative group",children:[(0,l.jsx)("div",{className:"absolute left-5 top-1/2 -translate-y-1/2 text-white/40 font-bold",children:i?.Symbol}),(0,l.jsx)("input",{type:"number",className:"w-full bg-white/[0.03] border border-white/10 rounded-2xl pl-14 pr-5 h-[52px] outline-none focus:border-emerald-500/40 focus:bg-white/[0.07] transition-all text-[1.5rem] md:text-[1.2rem] lg:text-[1.1rem] font-medium placeholder:text-muted-foreground",placeholder:n,value:c,onChange:e=>{let t=e.target.value;x(t),s(t)}})]}),a?(0,l.jsxs)("p",{className:"text-red-500 text-xs mt-1.5 font-medium ml-1 inline-flex items-center",children:[a," ",i?.Symbol]}):o&&(0,l.jsx)("p",{className:"text-white/50 text-lg mt-1.5 ml-1",children:o})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.