@pisell/private-materials 6.12.436 → 6.12.437
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/bigSale/hooks/useBigSaleProductListConfig.js +1 -0
- package/es/components/ticketBooking/components/ProductDisplayAdapter/index.js +3 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +1 -0
- package/es/components/venueBookingSales/availability/catalogPreview.js +1 -1
- package/es/components/venueBookingSales/catalogPresentation.js +1 -0
- package/es/components/venueBookingSales/useVenueCatalog.js +1 -0
- package/es/components/venueBookingSales/useVenueDates.js +1 -0
- package/es/plus/pisellReservation/utils/calendarBookingSelection.js +4 -4
- package/es/plus/saasDevice/devicePasscodes/model.js +4 -4
- package/es/plus/walletPassGallery/components/timelineSection/index.js +4 -4
- package/es/pro/skuDetailModal/flow/calendarEntry.js +2 -2
- package/lib/components/venueBookingSales/availability/catalogPreview.js +1 -1
- package/lib/components/venueBookingSales/useVenueCatalog.js +1 -0
- package/lib/components/venueBookingSales/useVenueDates.js +1 -0
- package/package.json +4 -4
package/build/lowcode/view.js
CHANGED
|
@@ -53,7 +53,7 @@ ${i} {
|
|
|
53
53
|
${eKb.filter(e=>"paired"===e.mode).map(e=>` --${e.id}: var(--${e.id}-h5);`).join("\n")}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
`:"")}(f,e)+t+l},[f,g,j,o]),C=(0,eN.useMemo)(()=>({...eKp(v.primaryColor),...c?{"--booking-font-family":c}:{},..._?{"--booking-viewport-height":_}:{}}),[v.primaryColor,c,_]),M=(0,eN.useMemo)(()=>({lang:l,layout:h,presentationPlatform:o,currency:a,timeZone:n,progress:S,root:y,portal:x,background:u??y,money:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"AUD",i=new Intl.NumberFormat("en"===t?"en-AU":"zh-CN",{style:"currency",currency:l,currencyDisplay:"narrowSymbol"}),a=i.resolvedOptions().maximumFractionDigits??2,n=i.format(e/10**a);return"AUD"===l?n.replace("$","A$"):n}(e,t,a)},brand:v,design:f,fontFamily:c,brandTokens:C,scopeId:g}),[l,h,o,a,n,S,x,y,u,v,f,C,g,c]);return(0,eB.jsxs)(eKi.Provider,{value:M,children:[(0,eB.jsx)("style",{children:N}),(0,eB.jsx)("div",{ref:b,className:`booking-ui${"compact"===h?" booking-ui-compact":""} ${m}`.trim(),"data-booking-scope":g,"data-booking-presentation":o,lang:"zh"===l?"zh-CN":"en-AU",style:"kiosk"===o?{...C,height:"var(--booking-viewport-height)",minHeight:0,overflowY:"auto"}:C,children:(0,eB.jsx)(eKg,{config:v,children:t})}),"u">typeof document&&(0,oj.createPortal)((0,eB.jsx)("div",{ref:k,className:`booking-ui booking-ui-portals${"compact"===h?" booking-ui-compact":""}`,lang:"zh"===l?"zh-CN":"en-AU","data-booking-scope":g,"data-booking-presentation":o,style:C}),p??document.body)]})},eKM=e=>!!(e&&"object"==typeof e&&!Array.isArray(e));function eKT(e,t){if("string"==typeof e)return e;if(e&&"object"==typeof e&&!Array.isArray(e)){let l=e[t]??e["zh"===t?"zh-CN":"en"]??e.en;return"string"==typeof l?l:Object.values(e).find(e=>"string"==typeof e)||""}return""}function eKI(e,t){let l=eKT(e,t);if("u"<typeof DOMParser)return l.replace(/<br\s*\/?\s*>|<\/(?:p|div|li|h[1-6])>/gi,"\n").replace(/<[^>]*>/g,"").trim();if(!/[<&\r\0]/.test(l))return l.replace(/\n{3,}/g,"\n\n").trim();let i=new DOMParser().parseFromString(l,"text/html").body;return i.querySelectorAll("script, style, template").forEach(e=>e.remove()),i.querySelectorAll("br").forEach(e=>e.replaceWith("\n")),i.querySelectorAll("p, div, li, h1, h2, h3, h4, h5, h6, blockquote, tr").forEach(e=>e.append("\n")),(i.textContent||"").replace(/\n{3,}/g,"\n\n").trim()}let eKP=e=>({skuValue:{product_id:e,product_variant_id:0,option:[],bundle:[]},variantDraft:null}),eKA=e=>{var t;return(null==e||null==(t=e._extend)?void 0:t.localId)||(null==e?void 0:e.external_sale_number)||(null==e?void 0:e.order_id)||e};function eKD(e){let t=new Intl.DateTimeFormat("en-CA",{timeZone:e||void 0,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date),l=e=>{var l;return null==(l=t.find(t=>t.type===e))?void 0:l.value};return`${l("year")}-${l("month")}-${l("day")}`}function eKE(e){if(!e||"object"!=typeof e)return!1;let t=e.otherParams;return!!t&&"object"==typeof t&&"kiosk"===String((null==t?void 0:t.platform)||"").trim().toLowerCase()&&((null==t?void 0:t.venueBookingMode)==="tickets"||(null==t?void 0:t.venueBookingMode)==="party")}function eKO(e){var t,l,i;let a=e.sales.bookingTicket,n=null==a||null==(t=a.getTempOrder)?void 0:t.call(a),r=null==a||null==(l=a.getOrderCustomerSnapshot)?void 0:l.call(a);return eb7(null==n?void 0:n.customer_id,null==n||null==(i=n.customer)?void 0:i.id,null==r?void 0:r.customer_id,null==r?void 0:r.id)}function eKz(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!eKE(e.sales.bookingTicket)&&"promotion_code"!==t.reason)return null;let l=eKO(e);if(eb5(l))return null;if("promotion_code"===t.reason)return{reason:"promotion_code",currentCustomerId:l};let i=t.products?t.products.map(e=>({cacheItem:e})):e_S(e.sales.bookingTicket),a=eHB({platform:"kiosk",currentCustomerIdCandidates:[l],unassignedHolderLines:i});return!a&&t.force&&i[0]?{reason:"holder_required",product:i[0].cacheItem,currentCustomerId:l}:a}async function eKL(e){if(!e.isCurrent())return!1;let t=eKz(e.context,e);if(!t)return!0;if(!e.openCustomerAuth)throw Error("Customer sign-in is unavailable. Please try again.");let l=e.context.sales.bookingTicket,i=String(eKO(e.context)||""),a=()=>e.isCurrent()&&String(eKO(e.context)||"")===i;return await eHH({request:t,openCustomerAuth:e.openCustomerAuth,setOrderCustomer:"function"==typeof(null==l?void 0:l.setOrderCustomer)?async t=>{if(!a())return;let n=l.setOrderCustomer(t);i=String(eKO(e.context)||""),await n}:void 0,loadDiscountConfig:async()=>{a()&&(await e.context.cart.loadDiscountConfig(),a()&&e.context.cart.refreshCartSnapshot())},isActive:a})&&a()&&eb5(eKO(e.context))}let eKR=(0,eN.createContext)({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),eK$=eN.forwardRef((e,t)=>{let{alt:l,color:i,size:a,weight:n,mirrored:r,children:o,weights:s,...d}=e,{color:c="currentColor",size:u,weight:p="regular",mirrored:m=!1,...g}=eN.useContext(eKR);return eN.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:null!=a?a:u,height:null!=a?a:u,fill:null!=i?i:c,viewBox:"0 0 256 256",transform:r||m?"scale(-1, 1)":void 0,...g,...d},!!l&&eN.createElement("title",null,l),o,s.get(null!=n?n:p))});eK$.displayName="IconBase";let eKF=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232,108a12,12,0,0,0,12-12V64a20,20,0,0,0-20-20H32A20,20,0,0,0,12,64V96a12,12,0,0,0,12,12,20,20,0,0,1,0,40,12,12,0,0,0-12,12v32a20,20,0,0,0,20,20H224a20,20,0,0,0,20-20V160a12,12,0,0,0-12-12,20,20,0,0,1,0-40ZM36,170.34a44,44,0,0,0,0-84.68V68H88V188H36Zm184,0V188H112V68H220V85.66a44,44,0,0,0,0,84.68Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M200,128a32,32,0,0,0,32,32v32a8,8,0,0,1-8,8H96V56H224a8,8,0,0,1,8,8V96A32,32,0,0,0,200,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M232,104a8,8,0,0,0,8-8V64a16,16,0,0,0-16-16H32A16,16,0,0,0,16,64V96a8,8,0,0,0,8,8,24,24,0,0,1,0,48,8,8,0,0,0-8,8v32a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V160a8,8,0,0,0-8-8,24,24,0,0,1,0-48ZM32,167.2a40,40,0,0,0,0-78.4V64H88V192H32Zm192,0V192H104V64H224V88.8a40,40,0,0,0,0,78.4Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232,104a8,8,0,0,0,8-8V64a16,16,0,0,0-16-16H32A16,16,0,0,0,16,64V96a8,8,0,0,0,8,8,24,24,0,0,1,0,48,8,8,0,0,0-8,8v32a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V160a8,8,0,0,0-8-8,24,24,0,0,1,0-48ZM32,167.2a40,40,0,0,0,0-78.4V64H88V192H32Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232,102a6,6,0,0,0,6-6V64a14,14,0,0,0-14-14H32A14,14,0,0,0,18,64V96a6,6,0,0,0,6,6,26,26,0,0,1,0,52,6,6,0,0,0-6,6v32a14,14,0,0,0,14,14H224a14,14,0,0,0,14-14V160a6,6,0,0,0-6-6,26,26,0,0,1,0-52ZM30,192V165.53a38,38,0,0,0,0-75.06V64a2,2,0,0,1,2-2H90V194H32A2,2,0,0,1,30,192Zm196-26.47V192a2,2,0,0,1-2,2H102V62H224a2,2,0,0,1,2,2V90.47a38,38,0,0,0,0,75.06Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232,104a8,8,0,0,0,8-8V64a16,16,0,0,0-16-16H32A16,16,0,0,0,16,64V96a8,8,0,0,0,8,8,24,24,0,0,1,0,48,8,8,0,0,0-8,8v32a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V160a8,8,0,0,0-8-8,24,24,0,0,1,0-48ZM32,167.2a40,40,0,0,0,0-78.4V64H88V192H32Zm192,0V192H104V64H224V88.8a40,40,0,0,0,0,78.4Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232,100a4,4,0,0,0,4-4V64a12,12,0,0,0-12-12H32A12,12,0,0,0,20,64V96a4,4,0,0,0,4,4,28,28,0,0,1,0,56,4,4,0,0,0-4,4v32a12,12,0,0,0,12,12H224a12,12,0,0,0,12-12V160a4,4,0,0,0-4-4,28,28,0,0,1,0-56ZM28,192V163.78a36,36,0,0,0,0-71.56V64a4,4,0,0,1,4-4H92V196H32A4,4,0,0,1,28,192Zm168-64a36.06,36.06,0,0,0,32,35.78V192a4,4,0,0,1-4,4H100V60H224a4,4,0,0,1,4,4V92.22A36.06,36.06,0,0,0,196,128Z"}))]]),eKq=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eKF}));function eKB(){let{progress:e}=eKa(),t=(0,eN.useRef)(void 0);return(0,eN.useEffect)(()=>()=>{var e;return null==(e=t.current)?void 0:e.call(t)},[]),(0,eN.useCallback)((l,i)=>{t.current=e.moveTo(l,i)},[e])}function eKH(e){let{number:t,state:l,lang:i,className:a}=e,n=(0,eN.useRef)(null);(0,eN.useLayoutEffect)(()=>{let e=n.current;if(!e||!l.from||void 0===l.changedAt)return;let t=window.matchMedia("(prefers-reduced-motion: reduce)"),i=performance.now()-l.changedAt,a="complete"===l.status?320:240;if(t.matches||i>=a)return;let r=[],o=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a;if(!e||"function"!=typeof e.animate||i>=l)return;let n=e.animate(t,{duration:l,easing:"ease-out"});n.currentTime=i,r.push(n)},s=getComputedStyle(e);o(e,[{backgroundColor:s.getPropertyValue(`--step-${l.from}-background`).trim()},{backgroundColor:s.backgroundColor}],240),o(e,[{transform:"scale(0.8)"},..."complete"===l.status?[{opacity:1,transform:"scale(1.12)",offset:.65}]:[],{transform:"scale(1)"}]);let d=()=>r.forEach(e=>e.cancel()),c=()=>{t.matches&&d()};return t.addEventListener("change",c),()=>{d(),t.removeEventListener("change",c)}},[l]);let r={locked:"zh"===i?"不可填写":"Locked",available:"zh"===i?"可填写":"Ready to fill in",complete:"zh"===i?"已填写":"Completed"}[l.status];return(0,eB.jsx)("span",{ref:n,className:`${a} selection-step-indicator`,"data-step-status":l.status,role:"img","aria-label":"zh"===i?`第 ${t} 步:${r}`:`Step ${t}: ${r}`})}function eKV(e){let{navigation:t,title:l,description:i,children:a,summary:n,footer:r,className:o="",contentClassName:s="",stage:d,id:c}=e;return(0,eB.jsxs)("div",{id:c,className:`checkout-page booking-page ${o}`,children:[(0,eB.jsxs)("div",{className:`content checkout-grid ${s}`,children:[(0,eB.jsxs)("div",{className:"checkout-main","data-booking-scroll-root":!0,children:[t&&(0,eB.jsx)("div",{className:"booking-page-navigation","data-booking-sticky":!0,children:t}),(l||i)&&(0,eB.jsxs)("header",{className:"page-title","data-booking-stage":d,tabIndex:-1,children:[l&&(0,eB.jsx)("h1",{children:l}),i&&(0,eB.jsx)("p",{children:i})]}),!l&&!i&&d&&(0,eB.jsx)("div",{"data-booking-stage":d,tabIndex:-1}),a]}),n]}),r]})}function eKU(e){let{label:t,amount:l,formatAmount:i,total:a=!1,className:n=""}=e;return(0,eB.jsxs)("div",{className:`amount-row ${a?"total-row":"price-row"} ${n}`,children:[(0,eB.jsx)("span",{children:t}),(0,eB.jsx)("strong",{children:"number"==typeof l&&i?i(l):l})]})}eKq.displayName="TicketIcon";let eKY=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M112,56V200L40,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z"}))]]),eKW=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eKY}));eKW.displayName="ArrowLeftIcon";let eKG=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M236,128a108,108,0,0,1-216,0c0-42.52,24.73-81.34,63-98.9A12,12,0,1,1,93,50.91C63.24,64.57,44,94.83,44,128a84,84,0,0,0,168,0c0-33.17-19.24-63.43-49-77.09A12,12,0,1,1,173,29.1C211.27,46.66,236,85.48,236,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,176A72,72,0,0,1,92,65.64a8,8,0,0,1,8,13.85,56,56,0,1,0,56,0,8,8,0,0,1,8-13.85A72,72,0,0,1,128,200Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M228,128a100,100,0,0,1-200,0c0-39.4,22.9-75.37,58.33-91.63a4,4,0,1,1,3.34,7.27C57.07,58.6,36,91.71,36,128a92,92,0,0,0,184,0c0-36.29-21.07-69.4-53.67-84.36a4,4,0,1,1,3.34-7.27C205.1,52.63,228,88.6,228,128Z"}))]]),eKK=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eKG}));function eKQ(e){let{secondary:t,busy:l,children:i,disabled:a,type:n="button",className:r="",...o}=e;return(0,eB.jsxs)("button",{...o,type:n,disabled:a||l,"aria-busy":l||void 0,className:`button ${t?"secondary":""} ${r}`,children:[(0,eB.jsx)("span",{className:"booking-button-content",children:i}),l&&(0,eB.jsx)(eKK,{className:"booking-button-spinner",size:22,"aria-hidden":"true"})]})}function eKZ(e){let{type:t="button",className:l="",...i}=e;return(0,eB.jsx)("button",{...i,type:t,className:`shared-icon-button ${l}`})}function eKJ(e){var t;let{lang:l,children:i,className:a=""}=e,n=(null==(t=eKn())?void 0:t.presentationPlatform)==="kiosk",r=(0,eN.useRef)(null);return(0,eN.useLayoutEffect)(()=>{let e=r.current;if(e)return eKN(e,"--mobile-action-bar-height",n)},[n]),(0,eB.jsx)("div",{ref:r,className:`mobile-action-bar ${a}`,role:"region","aria-label":"zh"===l?"订单操作":"Order actions",children:i})}function eKX(e){let{action:t,className:l="",id:i}=e;return(0,eB.jsx)(eKQ,{id:i,className:`booking-primary-action ${l}`,disabled:t.disabled,busy:t.busy,onClick:()=>{t.onClick()},children:t.label})}function eK0(e){let{leading:t,amount:l,label:i,detail:a,action:n,actionId:r,secondaryAction:o,feedback:s}=e;return(0,eB.jsxs)("div",{className:"booking-config-footer",children:[a&&(0,eB.jsx)("div",{className:"booking-config-detail",children:a}),(0,eB.jsxs)("div",{className:"booking-config-main",children:[t&&(0,eB.jsx)("div",{className:"booking-config-leading",children:t}),(0,eB.jsxs)("div",{className:"booking-config-amount",children:[i&&(0,eB.jsx)("small",{children:i}),(0,eB.jsx)("strong",{children:l})]}),(0,eB.jsxs)("div",{className:"booking-config-actions",children:[o&&(0,eB.jsx)(eKQ,{secondary:!0,disabled:o.disabled||n.busy,busy:o.busy,onClick:()=>{o.onClick()},children:o.label}),(0,eB.jsx)(eKX,{id:r,action:{...n,label:(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("span",{className:"booking-config-action-full",children:n.label}),(0,eB.jsxs)("span",{className:"booking-config-action-compact",children:[n.compactLabel??n.label," ",(0,eB.jsx)("span",{"aria-hidden":"true",children:"\xb7"})," ",l]})]})}})]})]}),s&&(0,eB.jsx)("div",{className:"booking-config-feedback",children:s})]})}function eK2(e){let{lang:t,back:l,summary:i,action:a,feedback:n}=e;return(0,eB.jsxs)(eKJ,{lang:t,className:`booking-footer mobile-action${n?" booking-footer--with-feedback":""}`,children:[n&&(0,eB.jsx)("div",{className:"booking-footer-feedback",children:n}),l&&(l.href?(0,eB.jsx)("a",{className:"mobile-action-back",href:l.href,"aria-label":l.label,"aria-disabled":a.busy||void 0,tabIndex:a.busy?-1:void 0,onClick:e=>{a.busy?e.preventDefault():0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||l.onClick&&(e.preventDefault(),l.onClick())},children:(0,eB.jsx)(eKW,{size:20,"aria-hidden":"true"})}):(0,eB.jsx)(eKZ,{className:"mobile-action-back","aria-label":l.label,disabled:a.busy,onClick:l.onClick,children:(0,eB.jsx)(eKW,{size:20,"aria-hidden":"true"})})),i,(0,eB.jsx)(eKX,{action:a})]})}eKK.displayName="CircleNotchIcon";let eK1=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,76H180V56A52,52,0,0,0,76,56V76H48A20,20,0,0,0,28,96V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V96A20,20,0,0,0,208,76ZM100,56a28,28,0,0,1,56,0V76H100ZM204,204H52V100H204Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,96V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V96a8,8,0,0,1,8-8H208A8,8,0,0,1,216,96Z",opacity:"0.2"}),eN.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,82H174V56a46,46,0,0,0-92,0V82H48A14,14,0,0,0,34,96V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V96A14,14,0,0,0,208,82ZM94,56a34,34,0,0,1,68,0V82H94ZM210,208a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V96a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,84H172V56a44,44,0,0,0-88,0V84H48A12,12,0,0,0,36,96V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V96A12,12,0,0,0,208,84ZM92,56a36,36,0,0,1,72,0V84H92ZM212,208a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V96a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Z"}))]]),eK4=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eK1}));eK4.displayName="LockSimpleIcon";let eK3=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),eN.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),eK8=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eK3}));eK8.displayName="CaretUpIcon";let eK6=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M176.49,95.51a12,12,0,0,1,0,17l-56,56a12,12,0,0,1-17,0l-24-24a12,12,0,1,1,17-17L112,143l47.51-47.52A12,12,0,0,1,176.49,95.51ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),eK5=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eK6}));eK5.displayName="CheckCircleIcon";let eK7=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216.49,184.49l-32,32a12,12,0,0,1-17-17L179,188H48a12,12,0,0,1,0-24H179l-11.52-11.51a12,12,0,0,1,17-17l32,32A12,12,0,0,1,216.49,184.49Zm-145-64a12,12,0,0,0,17-17L77,92H208a12,12,0,0,0,0-24H77L88.49,56.49a12,12,0,0,0-17-17l-32,32a12,12,0,0,0,0,17Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,80v96H48V80Z",opacity:"0.2"}),eN.createElement("path",{d:"M213.66,181.66l-32,32a8,8,0,0,1-11.32-11.32L188.69,184H48a8,8,0,0,1,0-16H188.69l-18.35-18.34a8,8,0,0,1,11.32-11.32l32,32A8,8,0,0,1,213.66,181.66Zm-139.32-64a8,8,0,0,0,11.32-11.32L67.31,88H208a8,8,0,0,0,0-16H67.31L85.66,53.66A8,8,0,0,0,74.34,42.34l-32,32a8,8,0,0,0,0,11.32Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M42.34,85.66a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,88,48V72H208a8,8,0,0,1,0,16H88v24a8,8,0,0,1-13.66,5.66Zm171.32,84.68-32-32A8,8,0,0,0,168,144v24H48a8,8,0,0,0,0,16H168v24a8,8,0,0,0,13.66,5.66l32-32A8,8,0,0,0,213.66,170.34Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M212.24,171.76a6,6,0,0,1,0,8.48l-32,32a6,6,0,0,1-8.48-8.48L193.51,182H48a6,6,0,0,1,0-12H193.51l-21.75-21.76a6,6,0,0,1,8.48-8.48ZM75.76,116.24a6,6,0,0,0,8.48-8.48L62.49,86H208a6,6,0,0,0,0-12H62.49L84.24,52.24a6,6,0,0,0-8.48-8.48l-32,32a6,6,0,0,0,0,8.48Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M213.66,181.66l-32,32a8,8,0,0,1-11.32-11.32L188.69,184H48a8,8,0,0,1,0-16H188.69l-18.35-18.34a8,8,0,0,1,11.32-11.32l32,32A8,8,0,0,1,213.66,181.66Zm-139.32-64a8,8,0,0,0,11.32-11.32L67.31,88H208a8,8,0,0,0,0-16H67.31L85.66,53.66A8,8,0,0,0,74.34,42.34l-32,32a8,8,0,0,0,0,11.32Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M210.83,173.17a4,4,0,0,1,0,5.66l-32,32a4,4,0,0,1-5.66-5.66L198.34,180H48a4,4,0,0,1,0-8H198.34l-25.17-25.17a4,4,0,0,1,5.66-5.66ZM77.17,114.83a4,4,0,0,0,5.66-5.66L57.66,84H208a4,4,0,0,0,0-8H57.66L82.83,50.83a4,4,0,0,0-5.66-5.66l-32,32a4,4,0,0,0,0,5.66Z"}))]]),eK9=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eK7}));function eQe(e){let{number:t,stepStatus:l,title:i,children:a,summary:n,open:r,onToggle:o,id:s,lang:d,locked:c=!1,completing:u=!1,className:p=""}=e,m=r||!n,g=m?"zh"===d?"收起":"Done":"zh"===d?"切换":"Change";return(0,eB.jsxs)("section",{className:`selection-section ${p}`,id:s,tabIndex:-1,"aria-labelledby":`${s}-title`,children:[(0,eB.jsxs)("div",{className:"selection-section-heading",children:[l?(0,eB.jsx)(eKH,{number:t,state:l,lang:d,className:"checkout-module-number"}):(0,eB.jsx)("span",{className:"checkout-module-number","aria-hidden":"true",children:t}),(0,eB.jsx)("h2",{id:`${s}-title`,children:i}),c&&!l&&(0,eB.jsx)(eK4,{size:18,"aria-label":"zh"===d?"已锁定":"Locked"}),m&&n&&(0,eB.jsx)(eKZ,{className:"selection-section-toggle",onClick:o,disabled:c,"aria-label":`${g} \xb7 ${i}`,"aria-expanded":!0,"aria-controls":`${s}-content`,children:(0,eB.jsx)(eK8,{size:20,"aria-hidden":"true"})})]}),(0,eB.jsx)("div",{id:`${s}-content`,children:m?a:(0,eB.jsxs)("button",{type:"button",className:`selection-section-summary${u?" is-completing":""}`,onClick:o,disabled:c,"aria-label":`${g} \xb7 ${i}`,"aria-describedby":`${s}-summary-copy`,"aria-expanded":!1,"aria-controls":`${s}-content`,children:[(0,eB.jsx)("span",{className:"selection-section-summary-copy",id:`${s}-summary-copy`,children:n}),(0,eB.jsxs)("span",{className:"selection-summary-status","aria-hidden":"true",children:[(0,eB.jsx)(eK5,{className:"selection-summary-check",size:24,weight:"fill"}),(0,eB.jsx)(eK9,{className:"selection-summary-change",size:21,weight:"bold"})]})]})})]})}eK9.displayName="ArrowsLeftRightIcon";let eQt=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M233.21,56.31A12,12,0,0,0,224,52H66L60.53,21.85A12,12,0,0,0,48.73,12H24a12,12,0,0,0,0,24H38.71L63.62,173a28,28,0,0,0,4.07,10.21A32,32,0,1,0,123,196h34a32,32,0,1,0,31-24H91.17a4,4,0,0,1-3.93-3.28L84.92,156H196.1a28,28,0,0,0,27.55-23l12.16-66.86A12,12,0,0,0,233.21,56.31ZM100,204a8,8,0,1,1-8-8A8,8,0,0,1,100,204Zm88,8a8,8,0,1,1,8-8A8,8,0,0,1,188,212Zm12-83.28A4,4,0,0,1,196.1,132H80.56L70.38,76H209.62Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,64l-12.16,66.86A16,16,0,0,1,196.1,144H70.55L56,64Z",opacity:"0.2"}),eN.createElement("path",{d:"M230.14,58.87A8,8,0,0,0,224,56H62.68L56.6,22.57A8,8,0,0,0,48.73,16H24a8,8,0,0,0,0,16h18L67.56,172.29a24,24,0,0,0,5.33,11.27,28,28,0,1,0,44.4,8.44h45.42A27.75,27.75,0,0,0,160,204a28,28,0,1,0,28-28H91.17a8,8,0,0,1-7.87-6.57L80.13,152h116a24,24,0,0,0,23.61-19.71l12.16-66.86A8,8,0,0,0,230.14,58.87ZM104,204a12,12,0,1,1-12-12A12,12,0,0,1,104,204Zm96,0a12,12,0,1,1-12-12A12,12,0,0,1,200,204Zm4-74.57A8,8,0,0,1,196.1,136H77.22L65.59,72H214.41Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M230.14,58.87A8,8,0,0,0,224,56H62.68L56.6,22.57A8,8,0,0,0,48.73,16H24a8,8,0,0,0,0,16h18L67.56,172.29a24,24,0,0,0,5.33,11.27,28,28,0,1,0,44.4,8.44h45.42A27.75,27.75,0,0,0,160,204a28,28,0,1,0,28-28H91.17a8,8,0,0,1-7.87-6.57L80.13,152h116a24,24,0,0,0,23.61-19.71l12.16-66.86A8,8,0,0,0,230.14,58.87ZM104,204a12,12,0,1,1-12-12A12,12,0,0,1,104,204Zm96,0a12,12,0,1,1-12-12A12,12,0,0,1,200,204Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M228.61,60.16A6,6,0,0,0,224,58H61L54.63,22.93A6,6,0,0,0,48.73,18H24a6,6,0,0,0,0,12H43.72L69.53,171.94a21.93,21.93,0,0,0,6.24,11.77A26,26,0,1,0,113.89,190h52.22A26,26,0,1,0,188,178H91.17a10,10,0,0,1-9.84-8.21L77.73,150H196.1a22,22,0,0,0,21.65-18.06L229.9,65.07A6,6,0,0,0,228.61,60.16ZM106,204a14,14,0,1,1-14-14A14,14,0,0,1,106,204Zm96,0a14,14,0,1,1-14-14A14,14,0,0,1,202,204Zm3.94-74.21A10,10,0,0,1,196.1,138H75.55L63.19,70H216.81Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M230.14,58.87A8,8,0,0,0,224,56H62.68L56.6,22.57A8,8,0,0,0,48.73,16H24a8,8,0,0,0,0,16h18L67.56,172.29a24,24,0,0,0,5.33,11.27,28,28,0,1,0,44.4,8.44h45.42A27.75,27.75,0,0,0,160,204a28,28,0,1,0,28-28H91.17a8,8,0,0,1-7.87-6.57L80.13,152h116a24,24,0,0,0,23.61-19.71l12.16-66.86A8,8,0,0,0,230.14,58.87ZM104,204a12,12,0,1,1-12-12A12,12,0,0,1,104,204Zm96,0a12,12,0,1,1-12-12A12,12,0,0,1,200,204Zm4-74.57A8,8,0,0,1,196.1,136H77.22L65.59,72H214.41Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M227.07,61.44A4,4,0,0,0,224,60H59.34L52.66,23.28A4,4,0,0,0,48.73,20H24a4,4,0,0,0,0,8H45.39l6.69,36.8h0L71.49,171.58A20,20,0,0,0,79,183.85,24,24,0,1,0,109.87,188h60.26A24,24,0,1,0,188,180H91.17a12,12,0,0,1-11.8-9.85l-4-22.15H196.1a20,20,0,0,0,19.68-16.42l12.16-66.86A4,4,0,0,0,227.07,61.44ZM108,204a16,16,0,1,1-16-16A16,16,0,0,1,108,204Zm96,0a16,16,0,1,1-16-16A16,16,0,0,1,204,204Zm3.91-73.85A12,12,0,0,1,196.1,140H73.88L60.79,68H219.21Z"}))]]),eQl=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eQt}));eQl.displayName="ShoppingCartIcon";let eQi=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),eN.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]),eQa=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eQi}));eQa.displayName="XIcon";let eQn=[],eQr=new WeakMap,eQo="",eQs=new Map,eQd=".pisell-sku-options-modal[role='dialog'], .pisell-sku-options-modal [role='dialog'], .pisell-lookup-modal-container[role='dialog'], .pisell-lookup-modal-container [role='dialog'], .pisell-lookup-drawer-container[role='dialog'], .pisell-lookup-drawer-container [role='dialog'], .ant-modal-root [role='dialog'], .ant-drawer [role='dialog'], .pisell-pc-modal [role='dialog'], .pisell-mobile-modal [role='dialog'], .pisell-lowcode-floating-layer-root [role='dialog'], .sales-sdk-allergy-modal [role='dialog'], .numeric-stepper-keyboard-popover, .numeric-stepper-keyboard-modal";function eQc(){eQn.forEach((e,t)=>{e.inert=t!==eQn.length-1,e.style.zIndex=String((eQr.get(e)??1e3)+t)})}function eQu(e){let{title:t,children:l,onClose:i,closeLabel:a,wide:n=!1,className:r="",initialFocus:o,open:s=!0,footer:d,intro:c,bodyClassName:u="",footerClassName:p="",mobile:m="sheet",bodyRef:g,closeDisabled:h=!1,closeOnBackdrop:v=!0,closeOnEscape:f=!0,style:y,portal:b,zIndex:x,externalDialogSelector:k}=e,_=eKn(),w=dL("booking-dialog"),S=(0,eN.useRef)(null),j=(0,eN.useRef)(null),N=(0,eN.useRef)(i);N.current=()=>{h||i()};let C=(0,eN.useRef)(f);if(C.current=f,(0,eN.useEffect)(()=>{if(!s||!S.current||!j.current)return;let e=S.current,t=j.current,l=document.activeElement,i=(null==_?void 0:_.background)&&!_.background.contains(e)?_.background:null;if(eQn.length||(eQo=document.body.style.overflow,document.body.style.overflow="hidden"),i){let e=eQs.get(i)??{count:0,inert:i.inert};e.count++,eQs.set(i,e),i.inert=!0}void 0!==x&&eQr.set(e,x),eQn.push(e),eQc();let a=e=>{if(!e.getClientRects().length||e.closest('[inert], [aria-hidden="true"]'))return!1;let t=window.getComputedStyle(e);return"hidden"!==t.visibility&&"none"!==t.display},n=e=>{let t=e,l=0;for(;t;){let e=parseInt(window.getComputedStyle(t).zIndex,10);Number.isFinite(e)&&(l=Math.max(l,e)),t=t.parentElement}return l},r=()=>{if(!k)return t;let l=Array.from(document.querySelectorAll(k)).filter(l=>!t.contains(l)&&a(l)&&n(l)>n(e)).sort((e,t)=>n(e)-n(t));return l[l.length-1]||t},d=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r();return Array.from(e.querySelectorAll('button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), summary, a[href], [tabindex="0"]')).filter(e=>e.tabIndex>=0&&e.getClientRects().length>0&&!e.closest("[inert]"))},c=()=>{let e=r(),l=e===t&&o&&t.querySelector(o);e.hasAttribute("tabindex")||(e.tabIndex=-1),(l||d(e)[0]||e).focus({preventScroll:!0})},u=requestAnimationFrame(()=>{eQn[eQn.length-1]===e&&c()}),p=l=>{if(eQn[eQn.length-1]!==e)return;let i=r(),n=document.activeElement instanceof HTMLElement&&document.activeElement.closest(".ant-select-dropdown, .ant-picker-dropdown"),o="Escape"===l.key&&Array.from(document.querySelectorAll(".ant-select-dropdown, .ant-picker-dropdown")).some(e=>{if(!a(e))return!1;let t=e;for(;t;){let e=window.getComputedStyle(t);if("hidden"===e.visibility||"none"===e.display||"0"===e.opacity)return!1;t=t.parentElement}return!0});if(("Escape"!==l.key||!o)&&("Tab"!==l.key||!n)&&("Escape"===l.key&&i===t&&(l.preventDefault(),l.stopImmediatePropagation(),C.current&&N.current()),"Tab"===l.key)){let e=d(),t=e[0],a=e[e.length-1];if(!t){l.preventDefault(),i.focus();return}l.shiftKey&&(document.activeElement===t||!i.contains(document.activeElement))?(l.preventDefault(),null==a||a.focus()):l.shiftKey||document.activeElement!==a&&i.contains(document.activeElement)||(l.preventDefault(),t.focus())}},m=null,g=l=>{let i=l.target;i instanceof HTMLElement&&t.contains(i)&&(m=i),!(i instanceof HTMLElement&&i.closest(".ant-select-dropdown, .ant-picker-dropdown"))&&(eQn[eQn.length-1]!==e||r().contains(i)||c())},h=0,v=t,f=k?new MutationObserver(()=>{cancelAnimationFrame(h),h=requestAnimationFrame(()=>{if(eQn[eQn.length-1]!==e)return;let l=r();l===v||l.contains(document.activeElement)||(l===t&&(null==m?void 0:m.isConnected)&&a(m)?m.focus({preventScroll:!0}):c()),v=l})}):null;return null==f||f.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","aria-hidden"]}),document.addEventListener("keydown",p,!0),document.addEventListener("focusin",g),()=>{if(cancelAnimationFrame(u),cancelAnimationFrame(h),null==f||f.disconnect(),document.removeEventListener("keydown",p,!0),document.removeEventListener("focusin",g),eQn.splice(eQn.indexOf(e),1),eQr.delete(e),eQc(),eQn.length||(document.body.style.overflow=eQo),i){let e=eQs.get(i);0==--e.count&&(i.inert=e.inert,eQs.delete(i))}(null==l?void 0:l.isConnected)&&!l.closest("[inert]")&&l.focus({preventScroll:!0})}},[s,null==_?void 0:_.portal,null==_?void 0:_.background,b,x,k]),"u"<typeof document||void 0===b&&_&&!_.portal)return null;let M=(0,eB.jsx)("div",{ref:S,hidden:!s,style:s?void 0:{display:"none"},className:`modal-backdrop ${"calendar-modal"===r?"calendar-backdrop":""}`,onMouseDown:e=>{v&&e.target===e.currentTarget&&eQn[eQn.length-1]===S.current&&N.current()},children:(0,eB.jsxs)("div",{ref:j,style:y,"data-booking-scroll-root":!0,className:`modal ${n?"wide":""} ${r} ${d?`dialog-framed dialog-${m}`:""}`,role:"dialog","aria-modal":"true","aria-labelledby":w,tabIndex:-1,children:[(0,eB.jsxs)("div",{className:"modal-heading",children:[(0,eB.jsx)("h2",{id:w,children:t}),(0,eB.jsx)(eKZ,{type:"button",className:"icon-button","aria-label":a,disabled:h,onClick:()=>N.current(),children:(0,eB.jsx)(eQa,{size:23})})]}),d?(0,eB.jsxs)(eB.Fragment,{children:[c&&(0,eB.jsx)("div",{className:"dialog-intro",children:c}),(0,eB.jsx)("div",{ref:g,className:`dialog-body ${u}`,tabIndex:0,role:"region","aria-labelledby":w,children:l}),(0,eB.jsx)("div",{className:`dialog-footer ${p}`,children:d})]}):l]})}),T=_&&(!1===b||null!=b&&b!==_.portal)?(0,eB.jsx)("div",{className:`booking-ui booking-ui-portals${"compact"===_.layout?" booking-ui-compact":""}`,"data-booking-scope":_.scopeId,"data-booking-presentation":_.presentationPlatform,lang:"zh"===_.lang?"zh-CN":"en-AU",style:_.brandTokens,children:M}):M;return!1===b?T:(0,oj.createPortal)(T,b??(null==_?void 0:_.portal)??document.body)}function eQp(e){let{current:t,steps:l,label:i,currentLabel:a}=e;return(0,eB.jsx)("nav",{"data-booking-sticky":!0,className:"booking-navigation","aria-label":i,children:(0,eB.jsx)("ol",{className:"steps interactive-steps",style:{"--step-count":Math.max(1,l.length),"--step-progress":l.length>1?Math.max(0,Math.min(t,l.length-1))/(l.length-1):0},children:l.map((e,l)=>{let i=l===t,n="skipped"===e.status&&!i,r="available"!==e.status;return(0,eB.jsx)("li",{className:`${i?"active":n?"skipped":l<t?"done":""} ${r&&!n?"locked":""}`,children:(0,eB.jsxs)("button",{type:"button","aria-label":e.ariaLabel??e.label,"aria-current":i?"step":void 0,disabled:r&&!i,title:i?a:e.hint,onClick:()=>{var t;i||r||null==(t=e.onClick)||t.call(e)},children:[(0,eB.jsx)("span",{className:"step-number","aria-hidden":"true",children:n?"–":l+1}),(0,eB.jsxs)("span",{className:"step-label",children:[r&&!n&&!i&&(0,eB.jsx)(eK4,{size:13,"aria-hidden":"true"}),(0,eB.jsx)("b",{className:"step-full-label",children:e.label}),(0,eB.jsx)("b",{className:"step-short-label",children:e.shortLabel??e.label})]})]})},e.id)})})})}function eQm(e){let{panel:t,title:l,closeLabel:i,header:a,body:n,footer:r,decoration:o}=e,s=eKn(),d=(0,eN.useRef)(null);(0,eN.useLayoutEffect)(()=>{let e=d.current;if(t.isMobile||!e)return;let l=0,i=()=>{let t=parseFloat(getComputedStyle(e).getPropertyValue("--summary-decoration-bleed"))||0,l=parseFloat(getComputedStyle(e).getPropertyValue("--summary-sticky-offset"))||22,i=Math.max(240,window.innerHeight-Math.max(l,e.getBoundingClientRect().top)-l-t),a=`${Math.floor(i)}px`;e.style.getPropertyValue("--summary-available-height")!==a&&e.style.setProperty("--summary-available-height",a)},a=()=>{cancelAnimationFrame(l),l=requestAnimationFrame(i)},n=new ResizeObserver(a);return n.observe(e),window.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a),i(),()=>{cancelAnimationFrame(l),n.disconnect(),window.removeEventListener("scroll",a),window.removeEventListener("resize",a)}},[t.isMobile,null==s?void 0:s.design]);let c=(0,eB.jsxs)(eB.Fragment,{children:[a,(0,eB.jsx)("div",{className:"order-summary-scroll",tabIndex:0,role:"region","aria-label":l,children:n}),(0,eB.jsx)("div",{className:"order-summary-footer",children:r})]});return t.isMobile?(0,eB.jsx)(eQu,{title:l,open:t.open,onClose:t.close,closeLabel:i,className:"order-summary-sheet",zIndex:600,externalDialogSelector:eQd,children:c}):(0,eB.jsxs)("aside",{ref:d,className:"order-summary booking-order-summary",children:[(0,eB.jsx)("h2",{children:l}),c,o]})}function eQg(e){let{panel:t,title:l,label:i,total:a,count:n}=e;return(0,eB.jsx)("button",{type:"button",className:`order-panel-trigger ${void 0!==n?"has-count":""}`,"aria-label":`${l} \xb7 ${a}`,"aria-haspopup":"dialog","aria-expanded":t.open,onClick:t.show,children:void 0!==n?(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)("span",{className:"summary-trigger-count","aria-hidden":"true",children:[(0,eB.jsx)(eQl,{size:25}),(0,eB.jsx)("b",{children:n})]}),(0,eB.jsxs)("span",{className:"summary-trigger-content",children:[(0,eB.jsx)("strong",{children:a}),(0,eB.jsxs)("small",{children:[i,(0,eB.jsx)(eK8,{size:13,"aria-hidden":"true"})]})]})]}):(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)("span",{children:[(0,eB.jsx)(eQl,{size:16,"aria-hidden":"true"}),i,(0,eB.jsx)(eK8,{size:13,"aria-hidden":"true"})]}),(0,eB.jsx)("strong",{children:a})]})})}let eQh=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,28H188V24a12,12,0,0,0-24,0v4H92V24a12,12,0,0,0-24,0v4H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28ZM68,52a12,12,0,0,0,24,0h72a12,12,0,0,0,24,0h16V76H52V52ZM52,204V100H204V204Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,48V88H40V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z",opacity:"0.2"}),eN.createElement("path",{d:"M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,48H48V48H72v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,34H182V24a6,6,0,0,0-12,0V34H86V24a6,6,0,0,0-12,0V34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34ZM48,46H74V56a6,6,0,0,0,12,0V46h84V56a6,6,0,0,0,12,0V46h26a2,2,0,0,1,2,2V82H46V48A2,2,0,0,1,48,46ZM208,210H48a2,2,0,0,1-2-2V94H210V208A2,2,0,0,1,208,210Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,36H180V24a4,4,0,0,0-8,0V36H84V24a4,4,0,0,0-8,0V36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36ZM48,44H76V56a4,4,0,0,0,8,0V44h88V56a4,4,0,0,0,8,0V44h28a4,4,0,0,1,4,4V84H44V48A4,4,0,0,1,48,44ZM208,212H48a4,4,0,0,1-4-4V92H212V208A4,4,0,0,1,208,212Z"}))]]),eQv=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eQh}));eQv.displayName="CalendarBlankIcon";let eQf=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M160,48V208L80,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61ZM152,188.69,91.31,128,152,67.31Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M168,48V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,168,48Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M164.24,203.76a6,6,0,1,1-8.48,8.48l-80-80a6,6,0,0,1,0-8.48l80-80a6,6,0,0,1,8.48,8.48L88.49,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M162.83,205.17a4,4,0,0,1-5.66,5.66l-80-80a4,4,0,0,1,0-5.66l80-80a4,4,0,1,1,5.66,5.66L85.66,128Z"}))]]),eQy=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eQf}));eQy.displayName="CaretLeftIcon";let eQb=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M176,128,96,208V48Z",opacity:"0.2"}),eN.createElement("path",{d:"M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z"}))]]),eQx=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eQb}));eQx.displayName="CaretRightIcon";let eQk="Australia/Sydney";function eQ_(e){let t,l=Intl.Locale;try{var i,a;let n=l?new l(e):void 0;t=(null==n||null==(i=n.getWeekInfo)?void 0:i.call(n).firstDay)??(null==n||null==(a=n.weekInfo)?void 0:a.firstDay)}catch{}return void 0===t?+("en-US"!==e):t%7}function eQw(e){if("string"!=typeof e||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=new Date(`${e}T12:00:00Z`);return Number.isFinite(t.getTime())&&t.toISOString().slice(0,10)===e}function eQS(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eQk,l=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(e);return["year","month","day"].map(e=>l.find(t=>t.type===e).value).join("-")}function eQj(e,t){let l=new Date(`${e}T12:00:00Z`);return l.setUTCDate(l.getUTCDate()+t),l.toISOString().slice(0,10)}function eQN(e,t){let l=new Date(`${e}T12:00:00Z`).getUTCDay();return eQj(e,-((l-t+7)%7))}function eQC(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eQS(),l=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;return eQw(e)&&e>=t&&(void 0===l||e<=l)&&!(null==i?void 0:i(e))}function eQM(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{weekday:"long",year:"numeric",month:"long",day:"numeric"};return new Intl.DateTimeFormat(t,{...l,timeZone:"UTC"}).format(new Date(`${e}T12:00:00Z`))}function eQT(e){let{locale:t,firstDay:l,today:i,month:a,selected:n,minDate:r,maxDate:o,viewEnd:s,disabled:d,allowed:c,onMonthChange:u,onSelect:p,t:m}=e,g=(0,eN.useRef)(null),h=(0,eN.useRef)(),[v,f]=(0,eN.useState)(n);(0,eN.useLayoutEffect)(()=>{var e;let t=null==(e=g.current)?void 0:e.querySelector(".venue-booking-picker-panel");t&&(t.tabIndex=-1)},[]);let y=(0,eN.useMemo)(()=>{let e=t.startsWith("zh"),i=e?eyA:eyD,a=`venue-booking-${e?"zh":"en"}-week-${l}`;return ew().locale({...e?Qm():Qh(),name:a,weekStart:l},void 0,!0),{...i,lang:{...i.lang,locale:a,shortWeekDays:Array.from({length:7},(e,l)=>eQM(eQj("2023-01-01",l),t,{weekday:"short"}))}}},[t,l]),b=ew()(a).locale(y.lang.locale),x=e=>e.slice(0,7)===a.slice(0,7),k=e=>x(e)&&c(e),_=r.slice(0,7),w=null==o?void 0:o.slice(0,7),S=e=>{d||e.slice(0,7)<_||w&&e.slice(0,7)>w||u(`${e.slice(0,7)}-01`)},j=eQN(a,l),N=Array.from({length:42},(e,t)=>eQj(j,t)).filter(x),C=N.includes(v)&&c(v)?v:N.includes(n)&&c(n)?n:N.find(c);(0,eN.useEffect)(()=>{var e,t;let l=h.current;if(!l||!N.includes(l))return;let i=c(l)?l:N.find(e=>e>=l&&c(e))||N.find(c);i&&(h.current=void 0,f(i),null==(t=g.current)||null==(e=t.querySelector(`[data-calendar-day="${i}"]`))||e.focus())});let M=Number(r.slice(0,4)),T=Array.from({length:Math.max(1,(o?Number(o.slice(0,4)):Math.max(M+10,Number(s.slice(0,4)),b.year()))-M+1)},(e,t)=>M+t);return(0,eB.jsx)("div",{ref:g,lang:t,onFocusCapture:e=>{var t,l;e.target.classList.contains("venue-booking-picker-panel")&&C&&(null==(l=g.current)||null==(t=l.querySelector(`[data-calendar-day="${C}"]`))||t.focus())},onKeyDownCapture:e=>{e.target.classList.contains("venue-booking-picker-panel")&&["Enter"," ","PageUp","PageDown","Home","End","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)&&(e.preventDefault(),e.stopPropagation())},children:(0,eB.jsx)(eM.ConfigProvider,{locale:{locale:t,Calendar:y},children:(0,eB.jsx)(eM.Calendar,{prefixCls:"venue-booking-picker",className:"venue-booking-calendar",fullscreen:!1,mode:"month",locale:y,value:b,disabledDate:e=>!k(e.format("YYYY-MM-DD")),onPanelChange:e=>S(e.format("YYYY-MM-DD")),onSelect:(e,t)=>{let l=e.format("YYYY-MM-DD");"date"===t.source&&k(l)&&p(l)},headerRender:()=>(0,eB.jsxs)("div",{className:"venue-booking-calendar-header",children:[(0,eB.jsx)("button",{type:"button",className:"icon-button","aria-label":m("previousMonth"),disabled:d||b.format("YYYY-MM")<=_,onClick:()=>S(b.subtract(1,"month").format("YYYY-MM-DD")),children:(0,eB.jsx)(eQy,{size:18,"aria-hidden":"true"})}),(0,eB.jsxs)("div",{className:"venue-booking-calendar-dropdowns",children:[(0,eB.jsx)("select",{"aria-label":m("calendarMonth"),value:b.month(),disabled:d,onChange:e=>S(b.month(Number(e.target.value)).format("YYYY-MM-DD")),children:Array.from({length:12},(e,l)=>{let i=b.month(l).format("YYYY-MM-DD");return(0,eB.jsx)("option",{value:l,disabled:i.slice(0,7)<_||!!(w&&i.slice(0,7)>w),children:eQM(i,t,{month:"long"})},l)})}),(0,eB.jsx)("select",{"aria-label":m("calendarYear"),value:b.year(),disabled:d,onChange:e=>{let t=b.year(Number(e.target.value)).format("YYYY-MM-DD");t.slice(0,7)<_&&(t=r),o&&t.slice(0,7)>w&&(t=o),S(t)},children:T.map(e=>(0,eB.jsx)("option",{value:e,children:e},e))})]}),(0,eB.jsx)("button",{type:"button",className:"icon-button","aria-label":m("nextMonth"),disabled:d||!!(w&&b.format("YYYY-MM")>=w),onClick:()=>S(b.add(1,"month").format("YYYY-MM-DD")),children:(0,eB.jsx)(eQx,{size:18,"aria-hidden":"true"})})]}),fullCellRender:e=>{let a=e.format("YYYY-MM-DD");if(!x(a))return null;let s=a===n;return(0,eB.jsx)("button",{type:"button","data-calendar-day":a,className:`venue-booking-calendar-day ${s?"is-selected":""} ${a===i?"is-today":""}`,disabled:!k(a),tabIndex:a===C?0:-1,"aria-label":eQM(a,t),"aria-pressed":s,"aria-current":a===i?"date":void 0,onFocus:()=>f(a),onKeyDown:t=>{if("Enter"===t.key||" "===t.key){t.preventDefault(),t.stopPropagation(),k(a)&&p(a);return}if("PageUp"===t.key||"PageDown"===t.key){t.preventDefault(),t.stopPropagation();let l=e.add("PageUp"===t.key?-1:1,"month").format("YYYY-MM-DD");if(l<r||o&&l>o)return;h.current=l,f(l),S(l);return}let i={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7,Home:-((e.day()-l+7)%7),End:6-(e.day()-l+7)%7};if(!(t.key in i))return;t.preventDefault(),t.stopPropagation();let n=eQj(a,i[t.key]),s=i[t.key]<0?-1:1;for(;N.includes(n)&&!c(n);)n=eQj(n,s);n===a||n<r||o&&n>o||(N.includes(n)||S(n),h.current=n,f(n))},children:e.date()})}})})})}function eQI(e){var t,l,i;let{value:a,onChange:n,locale:r,title:o,description:s,stepNumber:d,stepStatus:c,timeZone:u=eQk,todayMarker:p="venue",minDate:m,maxDate:g,isUnavailable:h,dateStates:v={},onVisibleDatesChange:f,onInteraction:y,disabled:b=!1,loading:x=!1,allowEmpty:k=!1,t:_}=e,w=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eQk,t=()=>{let t=new Date;return{venue:eQS(t,e),device:`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}},[l,i]=(0,eN.useState)(t);return(0,eN.useEffect)(()=>{let e=()=>{let e=t();i(t=>t.venue===e.venue&&t.device===e.device?t:e)};e();let l=window.setInterval(e,1e3);return window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{clearInterval(l),window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[e]),l}(u),S=w.venue,j="device"===p?w.device:S,N=m||S,C=eQj(eQw(a)&&a>N?a:N,180),[M,T]=(0,eN.useState)(C),I=g||(M>C?M:C),P=e=>{if(g)return;let t=eQj(e,180);T(e=>e>t?e:t)},A=eQ_(r),D=(0,eN.useMemo)(()=>(function(e,t,l){let i=[];for(let a=eQN(e,l);a<=t;a=eQj(a,7))i.push(a);return i})(N,I,A),[N,I,A]),E=eQN(eQw(a)?a:S,A),O=Math.max(0,Math.min(D.length-1,D.findIndex(e=>e===E))),[z,L]=(0,eN.useState)(O),R=Math.max(0,Math.min(z,D.length-1)),$=(0,eN.useRef)(R);$.current=R;let[F,q]=(0,eN.useState)(!1),[B,H]=(0,eN.useState)(()=>(eQw(a)?a:S).slice(0,7)+"-01"),[V,U]=(0,eN.useState)(a),Y=(0,eN.useRef)(null),W=(0,eN.useRef)(void 0),G=(0,eN.useRef)(null),K=(0,eN.useRef)(0),Q=(0,eN.useRef)(),Z=dL("booking-date-title"),J=dL("booking-date-description"),X=dL("booking-date-error"),ee=D[R]||eQN(N,A);(0,eN.useEffect)(()=>{!g&&R>=D.length-4&&P(I)},[g,R,D.length,I]);let et=(0,eN.useMemo)(()=>{let e;if(F){let t=`${B.slice(0,7)}-01`;e=Array.from({length:31},(e,l)=>eQj(t,l)).filter(e=>e.slice(0,7)===B.slice(0,7))}else e=Array.from({length:7},(e,t)=>eQj(ee,t)),eQw(a)&&e.push(a);return Array.from(new Set(e)).filter(e=>e>=N&&(void 0===g||e<=g)).sort()},[ee,F,B,u,A,a,N,g]),el=et.join(","),ei=(0,eN.useRef)(f);ei.current=f,(0,eN.useEffect)(()=>{var e;null==(e=ei.current)||e.call(ei,et)},[el]);let ea=x||et.some(e=>!v[e]||"loading"===v[e].status),en=et.some(e=>{var t;return(null==(t=v[e])?void 0:t.status)==="error"}),er=new Map,eo=e=>{var t,l;return er.has(e)||er.set(e,!b&&!x&&((null==(t=v[e])?void 0:t.status)==="available"||(null==(l=v[e])?void 0:l.status)==="configuration")&&eQC(e,N,g,h)),er.get(e)};(0,eN.useEffect)(()=>{let e=Q.current;if(!e||b||x||!v[e]||"loading"===v[e].status)return;let t=Array.from({length:7},(e,t)=>eQj(ee,t));if(!t.includes(e)){Q.current=void 0;return}let l=eo(e)?e:t.find(eo);if(!(!l&&t.some(e=>e>=N&&(void 0===g||e<=g)&&(!v[e]||"loading"===v[e].status)))&&(Q.current=void 0,l)){var i,a;U(l),null==(a=Y.current)||null==(i=a.querySelector(`[data-booking-day="${l}"]`))||i.focus({preventScroll:!0})}},[v,ee,b,x,h,N,g]);let es=x||!v[a]||"loading"===v[a].status,ed=!x&&!(k&&!a)&&(!eQC(a,N,g)||!es&&((null==(t=v[a])?void 0:t.status)==="unavailable"||((null==(l=v[a])?void 0:l.status)==="available"||(null==(i=v[a])?void 0:i.status)==="configuration")&&(null==h?void 0:h(a)))),ec=e=>Math.floor((new Date(`${e}T12:00:00Z`).getTime()-new Date(`${D[0]||eQN(N,A)}T12:00:00Z`).getTime())/6048e5),eu=function(e){var t;let l=!(arguments.length>1)||void 0===arguments[1]||arguments[1];e=Math.max(0,g?Math.min(D.length-1,e):e),!g&&e>=D.length-4&&P(eQj(D[0]||eQN(N,A),7*e+6)),$.current=e,L(e),null==(t=Y.current)||t.scrollTo({left:e*Y.current.clientWidth,behavior:l&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches?"smooth":"instant"})};(0,eN.useLayoutEffect)(()=>{eu(O,!1),U(a)},[a,N,g,A]),(0,eN.useLayoutEffect)(()=>{var e;null==(e=Y.current)||e.scrollTo({left:$.current*Y.current.clientWidth,behavior:"instant"})},[D.length]),(0,eN.useEffect)(()=>{let e=Y.current;if(!e)return;let t=new ResizeObserver(()=>e.scrollTo({left:$.current*e.clientWidth,behavior:"instant"}));return t.observe(e),()=>t.disconnect()},[]),(0,eN.useEffect)(()=>()=>clearTimeout(W.current),[]);let ep=e=>{eo(e)&&(null==y||y(),Q.current=void 0,n(e),eu(ec(e),!1),U(e),q(!1))},em=eQw(a)?eQM(a,r,{day:"numeric",month:"short",year:"numeric"}):_("chooseDate"),eg=e=>eQM(ee,r,{month:e?"short":"long",year:"numeric"}),eh=()=>{let e=G.current,t=Y.current;if(G.current=null,!(null==e?void 0:e.dragging)||!t)return;K.current=Date.now()+300,t.style.scrollSnapType="",t.hasPointerCapture(e.id)&&t.releasePointerCapture(e.id);let l=t.scrollLeft-e.scroll;eu(Math.abs(l)>40?Math.round(e.scroll/t.clientWidth)+Math.sign(l):Math.round(t.scrollLeft/t.clientWidth))};return(0,eB.jsxs)("div",{className:"booking-date-picker",role:"group","aria-labelledby":Z,"aria-disabled":b||void 0,"aria-busy":ea||void 0,children:[(0,eB.jsxs)("div",{className:"booking-date-heading",children:[(0,eB.jsxs)("div",{className:"booking-date-copy",children:[void 0===d?(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("span",{className:"booking-date-icon","aria-hidden":"true",children:(0,eB.jsx)(eQv,{size:17,weight:"bold"})}),(0,eB.jsx)("strong",{id:Z,children:o})]}):(0,eB.jsxs)("h3",{className:"booking-substep-title",id:Z,children:[c?(0,eB.jsx)(eKH,{number:d,state:c,lang:r.startsWith("zh")?"zh":"en",className:"booking-substep-number"}):(0,eB.jsx)("span",{className:"booking-substep-number",children:d}),o]}),s&&(0,eB.jsx)("p",{className:"sr-only",id:J,children:s})]}),(0,eB.jsxs)("div",{className:"booking-date-controls",children:[(0,eB.jsxs)("button",{type:"button",className:"calendar-trigger","aria-haspopup":"dialog","aria-expanded":F,disabled:b,"aria-label":`${_("openCalendar")}: ${em}`,title:`${_("openCalendar")}: ${em}`,"aria-invalid":ed||void 0,"aria-describedby":ed?X:s?J:void 0,onClick:()=>{null==y||y();let e=eQw(a)&&a>=N&&(void 0===g||a<=g)?a:N;H(`${e.slice(0,7)}-01`),P(e),q(!0)},children:[(0,eB.jsx)("span",{className:"calendar-caption-full",children:eg(!1)}),(0,eB.jsx)("span",{className:"calendar-caption-short",children:eg(!0)}),(0,eB.jsx)(eQv,{size:16,"aria-hidden":"true"})]}),(0,eB.jsxs)("div",{className:"booking-week-arrows",children:[(0,eB.jsx)("button",{type:"button",className:"icon-button","aria-label":_("previousWeek"),disabled:b||0===R,onClick:()=>{null==y||y(),eu(R-1)},children:(0,eB.jsx)(eQy,{size:16})}),(0,eB.jsx)("button",{type:"button",className:"icon-button","aria-label":_("nextWeek"),disabled:b||void 0!==g&&R===D.length-1,onClick:()=>{null==y||y(),eu(R+1)},children:(0,eB.jsx)(eQx,{size:16})})]})]})]}),(0,eB.jsx)("span",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:eQS(),i=eQj(e,6),a=new Intl.DateTimeFormat(t,{day:"numeric",month:"short",...e.slice(0,4)!==l.slice(0,4)||e.slice(0,4)!==i.slice(0,4)?{year:"numeric"}:{},timeZone:"UTC"}),n=new Date(`${e}T12:00:00Z`),r=new Date(`${i}T12:00:00Z`);return a.formatRange?a.formatRange(n,r):`${a.format(n)} – ${a.format(r)}`}(ee,r,S)}),(0,eB.jsx)("div",{ref:Y,className:"booking-week-track","aria-label":_("quickVisitDates"),onScroll:()=>{clearTimeout(W.current),W.current=setTimeout(()=>{var e;(null==(e=G.current)?void 0:e.dragging)||!Y.current||L(Math.round(Y.current.scrollLeft/Y.current.clientWidth))},120)},onPointerDown:e=>{b||("mouse"!==e.pointerType&&(null==y||y()),"mouse"===e.pointerType&&0===e.button&&(G.current={id:e.pointerId,x:e.clientX,scroll:e.currentTarget.scrollLeft,dragging:!1}))},onPointerMove:e=>{let t=G.current;t&&(!t.dragging&&Math.abs(e.clientX-t.x)>8&&(null==y||y(),t.dragging=!0,e.currentTarget.setPointerCapture(e.pointerId),e.currentTarget.style.scrollSnapType="none"),t.dragging&&(e.preventDefault(),e.currentTarget.scrollLeft=t.scroll-(e.clientX-t.x)))},onPointerUp:eh,onWheel:e=>{!b&&(0!==e.deltaX||e.shiftKey&&0!==e.deltaY)&&(null==y||y())},onPointerCancel:eh,onLostPointerCapture:eh,onPointerLeave:()=>{var e;(null==(e=G.current)?void 0:e.dragging)||(G.current=null)},onClickCapture:e=>{Date.now()<K.current&&(e.preventDefault(),e.stopPropagation())},children:D.map((e,t)=>{if(Math.abs(t-R)>1)return(0,eB.jsx)("div",{className:"booking-week",ref:e=>{null==e||e.setAttribute("inert","")},"aria-hidden":"true"},e);let l=Array.from({length:7},(t,l)=>eQj(e,l)),i=l.includes(V)&&eo(V)?V:l.includes(a)&&eo(a)?a:l.find(eo);return(0,eB.jsx)("div",{className:"booking-week",ref:e=>{null==e||e.toggleAttribute("inert",t!==R)},"aria-hidden":t!==R||void 0,children:l.map(e=>{var n;return(0,eB.jsxs)("button",{type:"button","data-booking-day":e,className:`booking-day ${e===a?"is-selected":""} ${e===j?"is-today":""}`,disabled:!eo(e),"aria-busy":x||!v[e]||"loading"===v[e].status||void 0,title:null==(n=v[e])?void 0:n.reason,"aria-label":eQM(e,r),"aria-pressed":e===a,"aria-current":e===j?"date":void 0,tabIndex:t===R&&e===i?0:-1,onClick:()=>ep(e),onFocus:()=>U(e),onKeyDown:t=>{let i={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7,Home:-1*l.indexOf(e),End:6-l.indexOf(e)};if(!(t.key in i))return;t.preventDefault(),null==y||y();let a=eQj(e,i[t.key]),n=i[t.key]<0?-1:1;for(;a>=N&&(void 0===g||a<=g)&&!eo(a);){if(!v[a]||"loading"===v[a].status){Q.current=a,eu(ec(a),!1),U(a);return}a=eQj(a,n)}eo(a)&&(eu(ec(a),!1),U(a),requestAnimationFrame(()=>{var e,t;return null==(t=Y.current)||null==(e=t.querySelector(`[data-booking-day="${a}"]`))?void 0:e.focus({preventScroll:!0})}))},children:[(0,eB.jsx)("small",{children:e===j?_("calendarToday"):eQM(e,r,{weekday:"short"})}),(0,eB.jsxs)("span",{className:"booking-day-date",children:[(0,eB.jsx)("span",{className:"booking-day-date-full",children:eQM(e,r,{day:"numeric",month:"short"})}),(0,eB.jsx)("span",{className:"booking-day-date-short",children:r.startsWith("zh")?e.slice(0,7)===ee.slice(0,7)?eQM(e,r,{day:"numeric"}):`${Number(e.slice(5,7))}/${Number(e.slice(-2))}`:eQM(e,r,{day:"numeric",month:"short"})})]})]},e)})},e)})}),ee!==eQN(S,A)&&(0,eB.jsx)("div",{className:"booking-week-return",children:(0,eB.jsx)("button",{type:"button",className:"back-this-week",disabled:b,onClick:()=>{null==y||y(),eu(ec(S))},children:_("backThisWeek")})}),ed&&(0,eB.jsx)("p",{id:X,className:"booking-date-error",role:"alert",children:_("dateNeedsReselect")}),en&&(0,eB.jsx)("p",{className:"booking-date-error",role:"alert",children:_("calendarLoadFailed")}),F&&(0,eB.jsxs)(eQu,{title:_("chooseVisitDate"),closeLabel:_("closeCalendar"),className:"calendar-modal",initialFocus:'.venue-booking-calendar-day[tabindex="0"]',onClose:()=>q(!1),children:[(0,eB.jsx)(eQT,{locale:r,firstDay:A,today:j,month:B,onMonthChange:e=>{b||(null==y||y(),P(e),H(e))},selected:a,onSelect:ep,allowed:eo,disabled:b,minDate:N,maxDate:g,viewEnd:I,t:_}),(0,eB.jsxs)("div",{className:"calendar-panel-footer",children:[(0,eB.jsx)("span",{role:ea||en?"status":void 0,children:ea?_("calendarLoading"):en?_("calendarLoadFailed"):_("calendarVenueTime")}),(0,eB.jsx)("button",{type:"button",className:"text-link",disabled:b||S<N||void 0!==g&&S>g,onClick:()=>{null==y||y(),H(`${S.slice(0,7)}-01`)},children:_("calendarThisMonth")})]})]})]})}let eQP={unavailableProductAction:["Unavailable","不可预约"],timeMaximumCapacity:["Maximum capacity: {count}","最大容量:{count}"],timeRoomsLeft:["Rooms left: {count}","剩余房间:{count}"],timeSpacesLeft:["Spaces left: {count}","剩余名额:{count}"],capacityAvailable:["Available","可预约"],capacityLimited:["Limited availability","剩余量有限"],updatingQuote:["Updating price…","正在更新报价…"],selected:["Selected","已选"],extras:["Extras","附加商品"],navExtras:["Extras","附加商品"],nextExtras:["Continue: extras","继续:附加商品"],skipExtras:["Skip extras and continue","不加购,继续下一步"],editExtras:["Review extras","修改附加商品"],unavailableExtra:["Unavailable extra","已下架附加商品"],extraUnavailable:["Some extras are unavailable. Remove them or adjust their quantity to continue.","部分附加商品已不可购买,请移除或调整数量后继续。"],selectedTickets:["{count} tickets selected","已选 {count} 张"],selectedTicketCorner:["Selected {count}","已选 {count} 张"],fullProductInfo:["View details","查看详情"],walletPassTitle:["Wallet Pass","卡券/通票"],walletPassLogin:["Sign in to view your passes","登录查看可用卡券/通票"],walletPassUnsupported:["Wallet Pass is not available for this booking.","此预约暂不支持卡券/通票。"],walletPassLoading:["Loading your passes…","正在读取卡券/通票…"],walletPassLoadFailed:["Your passes could not be loaded. Please try again.","卡券/通票加载失败,请重试。"],walletPassEmpty:["You have no passes for this booking.","此预约暂无可用卡券/通票。"],walletPassUses:["{count} visits remaining","剩余 {count} 次"],walletPassUnavailable:["This pass cannot be used for the current booking. Remove it or choose another.","此卡券/通票不适用于当前预约,请移除或重新选择。"],walletPassRemove:["Remove selected pass","移除已选卡券/通票"],walletPassApplied:["Pass applied","已使用卡券/通票"],benefitsTitle:["Use offers","使用优惠"],benefitsSaved:["Saved {amount}","已优惠 {amount}"],benefitsUpdating:["Updating savings…","优惠计算中…"],benefitsAttention:["Review offers","优惠需处理"],benefitsDone:["Done","完成"],benefitsNoOffers:["You have no offers available. You can still enter a promo code.","暂无账号优惠券,你仍可输入优惠码。"],benefitsQuoteFailed:["We couldn’t update your total. Close this panel and retry the quote on the checkout page.","订单金额更新失败,请关闭弹窗,在结账页重试报价。"],redemptionCodes:["Admission codes","入场核销码"],redemptionCode:["Admission code","核销码"],redemptionUnavailable:["Your admission code is not available yet. Check your booking details or contact the venue.","暂未取得核销码,请查看订单详情或联系场馆。"],redemptionUsed:["Already redeemed","已核销"],redemptionExpired:["Expired","已过期"],redemptionVoid:["No longer valid","已失效"],showRedemption:["Show this code when you arrive.","到场时请出示此码。"],demoRedemption:["Demo code \xb7 not valid for real admission","演示核销码 \xb7 不可用于真实入场"],chooseResourceTitle:["Choose a play space","选择场地"],chooseResource:["Choose a play space to continue.","请选择场地后继续。"],resourceChanged:["Your saved play space is no longer offered. Confirm the available space to choose a new time.","原选场地已不再提供,请确认当前可用场地后重新选择时间。"],useResource:["Use {name}","使用{name}"],chooseResourceRights:["Your choice of play space","自选游玩场地"],resourceAdmission:["Play space admission","场地入场"],resourceAvailable:["Available times","有可预约时间"],resourceRemaining:["{count} places left","剩余 {count} 人名额"],resourcePeople:["Up to {count} people","最多 {count} 人"],resourceInsufficient:["Only {count} places left \xb7 reduce quantity","仅剩 {count} 人名额,请减少数量"],resourceFull:["Fully booked","已约满"],resourceNotOpen:["Not open for bookings","未开放预约"],resourceTimeUnavailable:["Unavailable at this time","该时间不可预约"],resourceLoadFailed:["Some play spaces could not be checked. Try again, or choose an available space.","部分场地查询失败,请重试或选择其他可预约场地。"],resourceCapacity:["There are not enough places for this group. Choose another space or time, or reduce the quantity.","该场地在此时间的名额不足,请更换场地、时间或减少数量。"],payNow:["Pay now","立即付款"],paymentRecoveryHint:["Your choices are saved. Check the payment status before trying again.","已保存您的选择,请查询付款状态后再操作。"],openCalendar:["Open calendar","打开日历"],closeCalendar:["Close calendar","关闭日历"],chooseVisitDate:["Choose your visit date","选择游玩日期"],chooseDate:["Choose a date","选择日期"],previousWeek:["Previous week","上一周"],nextWeek:["Next week","下一周"],backThisWeek:["This week","回到本周"],calendarToday:["Today","今天"],previousMonth:["Previous month","上个月"],nextMonth:["Next month","下个月"],calendarMonth:["Month","月份"],calendarYear:["Year","年份"],calendarThisMonth:["This month","回到本月"],calendarVenueTime:["Dates follow venue local time","日期按场馆当地时间"],dateNeedsReselect:["This date is no longer available. Please choose an available date.","此日期已不可预约,请重新选择可用日期。"],validPlayTime:["Your playtime","游玩有效时间"],playStartTime:["Start playing at","开始游玩时间"],timeNotSelected:["Not selected","待选择"],timeLoading:["Updating…","更新中…"],timeLoadFailed:["Load failed","加载失败"],timeUnavailable:["Unavailable","暂无时段"],timeNeedsDate:["Choose today","请选择今天"],immediateTimeHint:["Your start time is recorded when you add this ticket.","开始时间以加入订单时为准。"],closesAt:["Closes","闭馆"],startUnavailable:["This start time is unavailable. Choose a listed time or another date.","此开始时间不可预约,请选择可用时间或更换日期。"],noPlayTimes:["No available playtime","当日暂无可预约时间"],tryAnotherDate:["Try another date; available times depend on this ticket and its play areas.","请更换日期;可预约时间以本票及所含区域的安排为准。"],otherTimes:["View unavailable sessions","查看不可预约场次"],untilClosing:["Until closing","至闭馆"],duringOpening:["During opening hours","营业时间内有效"],todayOnlyTime:["This ticket starts now","本票从当前时间开始"],todayOnlyTimeHint:["Choose today to book immediate entry. Future dates need a ticket with a scheduled start.","即入门票仅支持当天,请选择今天;其他日期请选择可预约开始时间的门票。"],useToday:["Use today for this ticket","此门票改为今天"],timeRuleChanged:["The time rules have changed. Edit this ticket to review and confirm its new validity.","时间规则已变更,请修改此门票,重新核对并确认有效时间。"],timeUpdated:["The available time has changed. Check the time shown before adding.","可用时间已更新,请核对上方有效时间后添加。"],timeConfigTitle:["Ticket & resource time rules","门票与资源时间配置"],timeConfigHint:["Local demo settings. Ticket names do not determine validity; these rules do. Existing tickets keep their recorded time and may need editing after a rule change.","本地演示配置。商品标题不决定权益,实际有效时间由以下规则控制。修改规则后,已选票保留原时间,可能需要重新编辑确认。"],productTimeRules:["Ticket time rule","门票时间规则"],configureProduct:["Ticket product","配置门票"],timeMode:["Validity rule","有效时间规则"],modeFixed:["Fixed sessions","固定时间段"],modeDuration:["Fixed duration \xb7 flexible start","固定时长 \xb7 灵活开始"],modeAllDay:["Opening-hours window","全天 \xb7 营业时间范围"],modeUntilClose:["Choose a start \xb7 until closing","选择开始时间 \xb7 至闭馆"],customerChoosesStart:["Ask the guest to choose a start time","需要客人选择开始时间"],customerStartHint:["The selected time becomes the ticket’s actual validity start. With this off, opening-hours tickets use the full window; fixed-duration tickets start now and are today-only.","开启后,所选时间就是门票实际生效时间。关闭时,全天规则使用完整营业时间;固定时长规则从当前时间开始,仅支持当天。"],configuredDuration:["Play duration (minutes)","游玩时长(分钟)"],startInterval:["Start time increment","开始时间间隔"],fixedStarts:["Session starts (comma-separated)","固定场次开始时间(逗号分隔)"],resourceTimeRules:["Resource opening hours","资源营业时间"],configureResource:["Resource","配置资源"],venueResource:["Venue / lobby","场馆/大厅"],opensAt:["Opens","开门"],resourceInterval:["Resource start increment","资源开始时间间隔"],resourceTimeHint:["A ticket must fit within the venue and every included area’s hours. Time increments must also satisfy each resource.","门票时间需同时满足场馆及所有绑定区域的营业时间和开始间隔。"],applyTimeRules:["Save time rules","保存时间配置"],resetTimeRules:["Restore default time rules","恢复默认时间规则"],timeRulesSaved:["Time rules saved. Review any existing tickets before payment.","时间配置已保存;付款前请核对已有门票的有效时间。"],invalidTimeConfig:["Enter valid opening hours and session times.","请填写有效的营业时间和场次时间。"],book:["Book a play session","预约欢乐时光"],basket:["My order","我的订单"],plan:["Choose tickets","选择门票"],details:["Participants","参加者信息"],confirm:["Review & pay","确认并支付"],booked:["You’re booked","预约成功"],bookingNavigation:["Booking steps","预约步骤导航"],navPlan:["Tickets","选择门票"],navDetails:["Details","参加者"],navReview:["Review","确认支付"],currentStep:["Current step","当前步骤"],jumpToStep:["Click a step to go back or continue.","点击已解锁的步骤,可快捷切换或返回修改。"],addTicketsFirst:["Add tickets to unlock the next steps.","先添加门票,解锁后续步骤。"],previousStep:["Back","上一步"],nextStep:["Next","下一步"],nextDetails:["Next: participants","下一步:参加者信息"],nextReview:["Next: review & pay","下一步:确认与支付"],participantsNotRequired:["Not required for these tickets","所选门票无需填写参加者"],heroTitle:["A little play.\nA big day.","小小玩乐,\n大大快乐。"],heroSub:["Find their perfect ticket to a happy day.","选一张心仪的门票,开启孩子的快乐天地。"],homeEyebrow:["SYDNEY’S LITTLE HAPPY PLACE","悉尼的亲子欢乐天地"],homeTitle:["Big smiles.\nLittle adventures.","小小冒险,\n满满笑容。"],homeSub:["A world of bouncing, climbing and make-believe. Make a little time for a whole lot of happy.","蹦跳、攀爬、天马行空的想象。留一点时间,收获一整天的快乐。"],explore:["Find their happy place","发现孩子的快乐天地"],exploreSub:["Three ways to play. A thousand reasons to smile.","三种游玩方式,无数个开心的理由。"],viewArea:["Find tickets","查看相关门票"],safe:["Little people. Big peace of mind.","孩子玩得开心,家长更安心。"],timed:["Your time to play","专属游玩时间"],family:["Made for families","为亲子家庭设计"],ready:["Ready, set, happy.","准备好,一起快乐出发。"],readySub:["Arrive 15 minutes early. Bring comfy clothes and your biggest smile.","建议提前 15 分钟到场,穿上舒适衣服,带上开心的笑容。"],previous:["Previous","上一页"],next:["Next","下一页"],today:["Today","今天"],soldOut:["Sold out","已售罄"],notOpen:["Unavailable","不可预约"],minutes:["minutes of happy","分钟欢乐时光"],sydneyTime:["All times are venue local time","所有时间均为场馆当地时间"],updateBasket:["Save changes","保存修改"],total:["Total","合计"],subtotal:["Subtotal","小计"],discount:["Discount","优惠"],chooseSession:["Choose your session","选择场次"],selectTickets:["Choose at least one ticket.","请至少选择一张票。"],capacity:["There aren’t enough spots for these tickets. Choose another time or reduce the quantity.","本场次余位不足,请更换时段或减少票数。"],added:["A little happy, added to your basket.","欢乐已加入购物车。"],saved:["Your session has been updated.","场次已更新。"],edit:["Edit","修改"],remove:["Remove","删除"],undo:["Undo","撤销"],removed:["Ticket removed.","门票已删除。"],groupRemoved:["Tickets removed.","门票已删除。"],emptyTitle:["A little empty. For now.","还空着,等你添点快乐。"],emptySub:["Your next happy day starts with a ticket.","下一段欢乐时光,从选择一张门票开始。"],tickets:["tickets","张票"],ticket:["Ticket","门票"],childPending:["Child details to add","待补充儿童信息"],notes:["Anything we should know?","有什么需要我们留意?"],optional:["Optional","选填"],notesHint:["Add a note for our team…","给场馆团队留言…"],notesHelp:["Requests are subject to confirmation. Please don’t include sensitive information.","特殊需求以场馆确认为准,请勿填写敏感信息。"],promo:["A little treat?","让快乐再优惠一点"],promoHint:["Enter a promo code","输入优惠码"],apply:["Apply","使用"],couponApplied:["Promo code applied.","优惠码已使用。"],couponInvalid:["We couldn’t find that code. Try HAPPY10.","没有找到该优惠码,请试试 HAPPY10。"],couponExpired:["This offer has expired. Remove it or choose another.","该优惠已过期,请移除或更换。"],couponMinimum:["PLAY5 needs a ticket subtotal of A$50.","PLAY5 需门票小计达到 A$50。"],accountOffers:["Your offers","你的优惠券"],offer10:["10% off your play day","游玩订单享九折"],offer5:["A$5 off orders of A$50+","满 A$50 减 A$5"],offerLittle:["A$5 off the Little Explorers toddler ticket","小小探索家幼儿单区票减 A$5"],offerHint:["One offer per order. Rechecked when your basket changes.","每单限用一张优惠券,购物车变化后重新计算。"],loginOffers:["Sign in to see your offers","登录查看你的优惠券"],checkout:["Continue to checkout","前往结算"],loginTitle:["Welcome to the sunny side.","欢迎来到欢乐的一边。"],loginSub:["Sign in to keep your little explorers and bookings together.","登录后可管理儿童档案与预约。"],demoLogin:["Demo sign-in","演示登录"],demoLoginHint:["This prototype uses a demo account. No email is sent and no password is needed.","此原型使用演示账号,不会发送邮件,也无需真实密码。"],email:["Email address","电子邮箱"],signIn:["Continue with demo account","使用演示账号继续"],signingIn:["Signing in…","正在登录…"],close:["Close","关闭"],hello:["Hi, Alex","你好,Alex"],signOut:["Sign out","退出登录"],loginRequired:["Sign in to add participant details.","登录后即可填写参加者信息。"],detailsTitle:["Meet the little adventurers.","认识今天的小小冒险家。"],detailsSub:["Match each child ticket to its explorer. Adults don’t need a profile.","为每张儿童票选择参加者,成人票无需儿童档案。"],completed:["complete","已完成"],chooseChild:["Choose a child","选择儿童"],addChild:["Add a child","新增儿童"],newChild:["A new little explorer","新增小小探索家"],childName:["Child’s name","儿童姓名"],dob:["Date of birth","出生日期"],dobHelp:["Age on the visit date is used for guidance only. It will not prevent a booking.","游玩当日年龄仅用于建议提示,不影响购买。"],saveChild:["Save child","保存儿童信息"],childConsent:["Saved for reuse across your bookings.","保存到此演示账号,可在不同场次复用。"],invalidDob:["Enter a valid date of birth, no later than today.","请输入有效出生日期,不能晚于今天。"],nameRequired:["Please enter a name.","请填写姓名。"],emailInvalid:["Enter a valid email address.","请输入有效邮箱。"],childMissing:["Choose a child for this ticket.","请为这张票选择儿童。"],duplicateChild:["This child already has a ticket for this session.","该儿童已绑定此场次的另一张门票。"],invalidTicket:["This ticket is not available in this area.","此票种不适用于当前区域。"],contact:["Who can we get in touch with?","我们可以联系谁?"],phone:["Phone number","联系电话"],review:["Review your booking","确认预约信息"],checkDetails:["A few details need your attention.","还有一些信息需要处理。"],agreement:["Area agreement","区域协议"],confirmAgreement:["Confirm","确认"],accepted:["Agreed","已同意"],notAccepted:["Needs your agreement","待确认协议"],agreementRequired:["Please agree to this area’s current agreement.","请阅读并同意当前版本协议。"],version:["Version","版本"],demoAgreement:["Demo terms for this prototype. Not a legal waiver.","此为原型演示条款,不构成法律责任豁免。"],pay:["Pay","支付"],demoPay:["Simulate payment","模拟付款"],demoPayShort:["Demo pay","模拟付款"],demoPayHint:["Demo checkout \xb7 No real payment or reservation is made.","演示结算 \xb7 不会真实扣款或预订。"],processing:["Checking your booking…","正在检查预约…"],priceChanged:["The ticket price changed. We’ve updated your total. Review it and submit again to confirm.","票价发生变化,已更新总额。请确认新金额后再次提交。"],unavailable:["This session no longer has enough spots. Edit or remove it to continue.","该场次余位已不足,请修改或删除后继续。"],emptyCart:["Your basket is empty.","购物车为空。"],loadError:["We couldn’t load playtimes. Your choices are saved.","暂时无法加载时段,已保留你的选择。"],retry:["Try again","重试"],paymentFailed:["Payment was declined. Your basket is saved. You can try again.","付款未通过,购物车已保留,可以重试。"],paymentPending:["We’re checking your payment.","正在确认付款结果。"],pendingSub:["Your booking is not confirmed yet. Please don’t submit another payment.","预约尚未确认,请勿重复支付。"],checkPayment:["Check payment status","查询付款状态"],successTitle:["Here comes a happy day!","欢乐的一天,要来啦!"],successSub:["Your booking is confirmed. We can’t wait to see those smiles.","预约已确认,期待一起创造快乐回忆。"],bookingRef:["Booking reference","预约编号"],itinerary:["Your play-day plan","你的游玩行程"],download:["Download booking","下载预约凭证"],bookMore:["Plan another happy day","再安排一段欢乐"],bookingDetails:["Booking details","预约详情"],noBooking:["No booking to show yet.","暂时没有预约记录。"],arrival:["A little before you arrive","出发前的小提醒"],arrivalText:["Arrive 15 minutes early. Wear comfortable clothes. Check your area agreement for equipment requirements.","建议提前 15 分钟到场,穿着舒适衣物,装备要求请查看对应区域协议。"],confirmationEmail:["Booking contact","预约联系人"],orderNote:["Your note","订单备注"],date:["Date","日期"],time:["Time","时间"],area:["Play area","游玩区域"],payment:["Payment","付款"],confirmed:["Confirmed","已确认"],demo:["Prototype","交互原型"],demoControls:["Demo scenarios","演示场景"],demoTitle:["Test a different kind of day.","试试不同的预约情况。"],demoSub:["These controls only affect this local prototype. Your basket is kept when switching scenarios.","这些控制仅影响本地原型,切换场景会保留购物车。"],normal:["Normal booking","正常预约"],soldOutScenario:["11:30 sells out \xb7 selectable spaces fully booked","11:30 场次售罄 \xb7 可选场地全部满员"],priceChangeScenario:["Price rises A$2 per ticket at payment","提交时每张票涨价 A$2"],expiredCouponScenario:["Coupons expire","优惠券过期"],loadErrorScenario:["Playtime loading fails once","首次时段加载失败"],paymentFailScenario:["First payment fails","首次付款失败"],paymentPendingScenario:["Payment awaits confirmation","付款结果待确认"],singleAreaScenario:["Only one ticket available","只有一种可售门票"],reset:["Reset demo data","重置演示数据"],resetHint:["Clears this demo basket, profiles and booking.","清除演示购物车、档案与预约。"],backPlan:["Back to tickets","返回选票"],footerNote:["A little play goes a long way.","小小玩乐,收获满满。"],demoFooter:["Interactive prototype \xb7 Sydney \xb7 AUD","交互原型 \xb7 悉尼 \xb7 澳元"],loading:["Finding your happy time…","正在寻找欢乐时段…"],session:["session","个场次"],sessions:["sessions","个场次"],learnMore:["Plan your visit","到访须知"],age:["years old on visit date","岁(游玩当日)"],noChildNeeded:["No child details required","无需儿童信息"],allAccess:["All areas included","全区域通玩"],lobbyOnly:["Lobby admission","仅大厅入场"],singleAreaTicket:["One play area included","包含一个游玩区域"],noPlayAreas:["Lobby only \xb7 No play areas included","仅大厅入场,不含游玩区域"],suggestedAge:["Suggested ages","建议年龄"],minuteUnit:["minutes","分钟"],perPerson:["per person","/人"],visitDate:["Visit date","游玩日期"],quantity:["Number of tickets","门票数量"],chooseRemoval:["Choose the participant ticket to remove.","请选择要移除的参加者门票。"],addTickets:["Add tickets","添加门票"],addTicketsCompact:["Add","添加"],saveTicketsCompact:["Save","保存"],ticketAdded:["Tickets added to your day.","门票已加入本次订单。"],filterTickets:["Filter tickets by audience","按人群筛选门票"],quickVisitDates:["Choose a day this week","快捷选择游玩日期"],sharedVisitDate:["Your visit date","本次游玩日期"],sharedDateHint:["Used for new tickets.","新添加的门票自动沿用"],changeDate:["Change date","更改日期"],ticketDateHint:["Need a different day? Change this ticket only.","需要另一天游玩?可仅修改这张门票的日期。"],noMatchingTickets:["No tickets match these filters.","暂无符合筛选条件的门票。"],allTickets:["All tickets","全部门票"],childrenTickets:["Children","儿童"],adultTickets:["Adults","成人"],ticketsIncluding:["Tickets including","包含以下区域的门票:"],showAllTickets:["View all tickets","查看全部门票"],chooseTicket:["Choose ticket","选择门票"],pickTicketsHint:["Pick a ticket to start your family’s adventure.","选一张门票,开始安排全家的欢乐时光。"],childInvalid:["This child profile needs a valid name and date of birth. Select another profile or add corrected details.","儿童资料的姓名或生日无效,请选择其他档案或新增正确信息。"],couponProduct:["This offer applies only to the Little Explorers toddler ticket.","此优惠仅适用于小小探索家幼儿单区票。"],checkoutTitle:["Your happy day, all together.","确认门票,让快乐出发。"],contactSection:["Contact details","填写联系信息"],orderSection:["Review your tickets","确认订单信息"],agreementSection:["Confirm agreements","确认协议"],noteSection:["Leave a note","留言"],checkoutSub:["Review your tickets, add a little saving and get ready to play.","查看全家的门票,使用优惠,确认后即可出发。"],addMoreTickets:["Add more tickets","继续选购门票"],participantsIncomplete:["Some participant details still need attention. Your tickets are saved.","参加者信息尚未完成,已选门票均已保留。"],completeParticipants:["Add participant details","补充参加者信息"],completeContact:["Add contact details","补充联系人"],orderAgreementsHelp:["Open each agreement and confirm your consent in its details.","请点击协议查看详情,并在详情中确认同意。"],agreementsPending:["Agreements to confirm: {count}","还有 {count} 份协议待确认"],agreementsPaymentHelp:["Select “Read agreement” below, read the details and select “Confirm”. Confirm all agreements, then try payment again.","请点击下方“查看协议”,阅读后点击“确认”。全部确认后,再点击支付。"],readAgreement:["Read agreement","查看协议"],orderSummary:["Your order","订单明细"],orderDetailShort:["Details","明细"],checkOrder:["Check order","检查订单"],loginComplete:["Sign in & add your details","登录并补充信息"],availabilityFix:["Update the tickets marked unavailable.","请修改标记为不可预约的门票。"],confirmPrice:["Confirm new price & pay","确认新价格并付款"],confirmPriceShort:["Confirm & pay","确认并付款"],loginShort:["Sign in","登录并补充"],completeShort:["Add details","补充信息"],migrationNotice:["Some saved demo items could not be converted. The original draft is backed up in this browser; please choose those tickets again.","部分旧演示内容无法转换,原始草稿已备份在当前浏览器,请重新选择相关门票。"],timeRechoose:["That time is no longer available for this date. Please choose another time.","该时段在当前日期已不可预约,请重新选择。"],spotsLeft:["spots left","个余位"]},eQA=(e,t)=>{var l;return(null==(l=eQP[t])?void 0:l[+("en"!==e)])??t},eQD={en:{close:"Close",cancel:"Cancel",back:"Back",next:"Next",configuration:"Choose options",booking:"Choose time",confirmConfiguration:"Confirm options",confirmBooking:"Add tickets",working:"Please wait…",validationFailed:"Complete the required selections to continue.",confirmationFailed:"Unable to save your selection. Please try again.",configurationNotReady:"Options are not ready. Please close and try again.",invalidPlan:"Product details are not ready. Please close and try again."},zh:{close:"关闭",cancel:"取消",back:"上一步",next:"下一步",configuration:"选择商品选项",booking:"选择时间",confirmConfiguration:"确认选项",confirmBooking:"添加门票",working:"请稍候…",validationFailed:"请完成必选内容后继续。",confirmationFailed:"保存失败,请重试。",configurationNotReady:"商品选项尚未准备好,请关闭后重试。",invalidPlan:"商品详情尚未准备好,请关闭后重试。"}};function eQE(e){var t,l,i,a,n,r,o,s,d,c,u;let p=eKn(),m=null==p?void 0:p.brandTokens,[g]=(0,eN.useState)(()=>e.plan),[h,v]=(0,eN.useState)(g.hasConfiguration?"configuration":"booking"),[f,y]=(0,eN.useState)(!1),[b,x]=(0,eN.useState)(!1),[k,_]=(0,eN.useState)(!1),[w,S]=(0,eN.useState)(),[j,N]=(0,eN.useState)(null),[C,M]=(0,eN.useState)(!1),T=(0,eN.useRef)(null),I=(0,eN.useRef)(null),P=(0,eN.useRef)(0),A=(0,eN.useRef)(!0),D=(0,eN.useRef)(e);D.current=e;let E=(0,eN.useRef)(e.configuration);E.current=e.configuration;let O=(0,eN.useRef)((0,ni.cloneDeep)(e.configuration)),z=(0,eN.useRef)(null),L=(0,eN.useRef)(0);(0,ni.isEqual)(O.current,e.configuration)||(z.current&&(0,ni.isEqual)(z.current,e.configuration)||(L.current+=1),z.current=null,O.current=(0,ni.cloneDeep)(e.configuration));let R=e.locale||"en",$="edit-draft"===g.intent,F={...eQD[R],...$?{confirmBooking:eQA(R,"updateBasket")}:{},...e.labels},q=!!e.busy||b||k,B=!g.openId||!g.scopeKey||!g.detailRevision||!g.productDetail||String(null==(t=e.configuration.skuValue)?void 0:t.product_id)!==String(g.productDetail.id)||"product-configuration"===g.mode&&(!g.hasConfiguration||!e.onConfigurationConfirm)||"ticket-booking"===g.mode&&(!e.renderBooking||!e.onConfirm),H="ticket-booking"===g.mode,V=H&&g.hasConfiguration;(0,eN.useEffect)(()=>(A.current=!0,()=>{var e;A.current=!1,P.current+=1,null==(e=I.current)||e.abort()}),[]);let U=(0,eN.useCallback)(e=>{T.current=e,M(!!e)},[]),Y=()=>{var t;q||(P.current+=1,null==(t=I.current)||t.abort(),e.onCancel())},W=()=>{!q&&V&&(S(void 0),y(!0),v("configuration"),null==j||j.scrollTo({top:0}))},G=async()=>{var e,t,l,i,a,n,r,o,s,d;if(q||B||I.current)return;let c=new AbortController,u=++P.current,p=D.current.selectionRevision,m=L.current;I.current=c;let f={openId:g.openId,scopeKey:g.scopeKey,detailRevision:g.detailRevision,signal:c.signal,isCurrent:()=>A.current&&!c.signal.aborted&&P.current===u&&L.current===m&&("booking"!==h||D.current.selectionRevision===p)};x(!0),S(void 0);let b="validation";try{let s=E.current;if("configuration"===h){let e=T.current;if(!C||!e)return void S(F.configurationNotReady);if(!1!==D.current.requiredOptionValidation&&await e.validate(),!f.isCurrent())return;let t=iw(g.productDetail,e.getTransformValues(),{requiredOptionValidation:D.current.requiredOptionValidation,overSold:(null==(i=D.current.skuOptions)||null==(l=i.config)?void 0:l.overSold)===1||(null==(n=D.current.skuOptions)||null==(a=n.config)?void 0:a.overSold)==null&&lW(g.productDetail.over_sold)});if(!t)return void S(F.validationFailed);if(s={skuValue:t,variantDraft:E.current.variantDraft},E.current=s,z.current=(0,ni.cloneDeep)(s),D.current.onConfigurationChange(s),H){if(await (null==(r=(o=D.current).onConfigurationContinue)?void 0:r.call(o,s,f)),!f.isCurrent())return;y(!0),v("booking"),null==j||j.scrollTo({top:0});return}}else if(!H||!D.current.bookingReady)return;b="confirmation";let d=H?await D.current.onConfirm(s,f):await (null==(e=(t=D.current).onConfigurationConfirm)?void 0:e.call(t,s,f));f.isCurrent()&&!1!==d&&_(!0)}catch(e){if(!f.isCurrent())return;S("validation"===b?F.validationFailed:F.confirmationFailed),null==(s=(d=D.current).onError)||s.call(d,e,b)}finally{A.current&&P.current===u&&x(!1),I.current===c&&(I.current=null)}},K=q||B||("configuration"===h?!C:!H||!e.bookingReady),Q={mode:g.mode,step:h,configuration:e.configuration,busy:q},Z="function"==typeof e.footerContent?e.footerContent(Q):e.footerContent,J="configuration"===h?e.configurationFooter:void 0,X="configuration"===h?H?F.next:F.confirmConfiguration:F.confirmBooking,ee=B?F.invalidPlan:w||e.error,et=H||!!J,el=H&&"booking"===h?e.bookingActionAmount??"—":(null==J?void 0:J.amount)??null,ei=H&&"booking"===h?e.bookingSubtotalLabel??eQA(R,"subtotal"):(null==J?void 0:J.label)??(H?void 0:eQA(R,"subtotal")),ea=(null==(l=e.skuOptions)?void 0:l.type)||"flat",en=null==(i=e.skuOptions)?void 0:i.presentation,er="function"==typeof e.getContainer?e.getContainer():"string"==typeof e.getContainer?document.querySelector(e.getContainer):e.getContainer,eo=V?(0,eB.jsx)("div",{className:"pisell-booking-product-detail-steps",children:(0,eB.jsx)(eQp,{current:+("configuration"!==h),label:"zh"===R?"商品选择步骤":"Product selection steps",currentLabel:"zh"===R?"当前步骤":"Current step",steps:[{id:"configuration",label:F.configuration,status:"configuration"!==h&&q?"locked":"available",onClick:W},{id:"booking",label:F.booking,status:"booking"===h?"available":"locked"}]})}):null;return(0,eB.jsx)(eQu,{title:e.title,onClose:Y,closeLabel:F.close,closeDisabled:q,wide:!0,className:`${H?"reservation-modal":"party-package-dialog"} pisell-booking-product-detail-modal ${e.className||""}`,bodyClassName:`${H?"reservation-content":"package-config-body"} pisell-booking-product-detail-body`,footerClassName:`${et?"booking-config-dialog-footer":"package-config-footer"} pisell-booking-product-detail-footer`,mobile:"fullscreen",bodyRef:N,portal:er,zIndex:600,externalDialogSelector:eQd,style:{...e.width?{width:e.width}:{},...e.style},intro:eo,footer:et?(0,eB.jsx)(eK0,{leading:!H||"booking"===h||J?Z:void 0,label:ei,amount:el,action:{label:k?F.working:X,disabled:K,busy:b||e.busy,onClick:G},feedback:ee&&(0,eB.jsx)("p",{className:"error-text pisell-booking-product-detail-error",role:"alert",children:ee})}):(0,eB.jsxs)(eB.Fragment,{children:[ee&&(0,eB.jsx)("div",{className:"error-text pisell-booking-product-detail-error",role:"alert",children:ee}),Z&&(0,eB.jsx)("div",{className:"pisell-booking-product-detail-footer-content",children:Z}),(0,eB.jsxs)("div",{className:"package-config-footer-actions pisell-booking-product-detail-actions",children:[(0,eB.jsx)(eKQ,{secondary:!0,disabled:q,onClick:Y,children:F.cancel}),(0,eB.jsx)(eKQ,{disabled:K,busy:b||e.busy,onClick:()=>void G(),children:(0,eB.jsx)("span",{children:k?F.working:X})})]})]}),children:(0,eB.jsxs)("div",{"aria-busy":q,children:[e.summary&&(0,eB.jsx)("div",{className:"pisell-booking-product-detail-summary",children:e.summary}),!B&&"configuration"===h&&(0,eB.jsx)("div",{className:"pisell-booking-product-detail-sku-guard venue-booking-legacy-controls","aria-disabled":q,style:q?{pointerEvents:"none"}:void 0,onKeyDownCapture:e=>{q&&"Tab"!==e.key&&(e.preventDefault(),e.stopPropagation())},children:(0,eB.jsx)($T,{...e.skuOptions,ref:U,type:ea,presentation:"flat"===ea?{...en,modal:{...null==en?void 0:en.modal,style:{...null==en||null==(a=en.modal)?void 0:a.style,...(null==p?void 0:p.fontFamily)?{fontFamily:p.fontFamily}:{}},className:[null==(o=$x(ea))||null==(r=o.presentation)||null==(n=r.modal)?void 0:n.className,null==en||null==(s=en.modal)?void 0:s.className,"pisell-booking-product-detail-options-modal"].filter(Boolean).join(" ")}}:en,theme:(null==(d=e.skuOptions)?void 0:d.theme)||{token:{colorPrimary:null==m?void 0:m["--primary"],colorPrimaryBg:null==m?void 0:m["--primary-soft"]}},config:(null==(c=e.skuOptions)?void 0:c.config)||{overSold:+!!lW(g.productDetail.over_sold)},dataSource:g.productDetail,value:e.configuration.skuValue,variantDraft:e.configuration.variantDraft,selectionKey:g.selectionKey,initializationPolicy:f||"edit-draft"===g.intent?"preserve":(null==(u=e.skuOptions)?void 0:u.initializationPolicy)||"auto-required-defaults",disabled:!!e.busy||k,customScrollParent:j||void 0,className:"pisell-booking-product-detail-sku",onChange:(t,l)=>{if(b||k||e.busy)return;let i={skuValue:t,variantDraft:void 0===l?E.current.variantDraft:l.variantDraft};E.current=i,e.onConfigurationChange(i),S(void 0)}})}),!B&&H&&"booking"===h&&e.renderBooking({plan:g,configuration:e.configuration,busy:q,scrollContainer:j,backToConfiguration:W})]})})}let eQO=function(e){let t,l=eKn();if(!e.plan)return null;let i=(0,eB.jsx)(eQE,{...e},JSON.stringify([(t=e.plan).openId,t.scopeKey,t.detailRevision,t.mode,t.selectionKey]));return l?i:(0,eB.jsx)(eKC,{lang:e.locale||"en",children:i})},eQz={en:{date:"Choose a date",time:"Choose a time",room:"Choose a room",resource:"Choose an area",selectTime:"Choose a time to see available areas.",selectRoom:"Choose a room for this time.",timeBeforeRoom:"Choose a time to see available rooms.",timeForRooms:"Choose available rooms for this time.",checking:"Checking availability…",noTimes:"No available times for this selection.",noResources:"No resources are available for this selection.",none:"No selection",optional:"Optional",retry:"Check again",reselect:"Choose again",unavailable:"Unavailable for this selection",selectedUnavailable:"Your previous selection is unavailable. Please choose again.",configuration:"This product’s booking configuration is incomplete. Please contact the venue.",resourceRequired:"Choose one option in each required group.",singleResource:"Choose one option in this group.",chooseTime:"Choose an available time.",quantity:"Choose a valid quantity.",changed:"Your selection has changed. Please review it before continuing.",requestFailed:"Availability could not be checked. Please try again.",reconciliation:"The booking result needs to be checked. Return to your order before trying again.",ready:"This selection is available.",dateFailed:"The date could not be changed. Please try again."},zh:{date:"选择日期",time:"选择时间",room:"选择房间",resource:"选择区域",selectTime:"请先选择时间,再查看可用区域。",selectRoom:"请选择该时段的房间。",timeBeforeRoom:"请先选择时间,再查看可用房间。",timeForRooms:"请先选择在该时段可用的房间。",checking:"正在查询可用性…",noTimes:"当前选择没有可用时段。",noResources:"当前选择没有可用资源。",none:"不选择",optional:"选填",retry:"重新查询",reselect:"重新选择",unavailable:"当前选择不可用",selectedUnavailable:"之前选择的时间或资源已不可用,请重新选择。",configuration:"该商品的预约配置不完整,请联系场馆。",resourceRequired:"请为每个必选组选择一项。",singleResource:"同一组只能选择一项。",chooseTime:"请选择可用时段。",quantity:"请选择有效数量。",changed:"选择已变更,请核对后继续。",requestFailed:"暂时无法查询可用性,请重试。",reconciliation:"本次预约写入结果需要核对,请返回订单查看后再试。",ready:"当前选择可用。",dateFailed:"日期变更失败,请重试。"}};function eQL(e,t){let l=eQz[t],i={past:["This time has passed.","该时段已结束。"],outside_operating_hours:["Outside venue opening hours.","不在场馆营业时间内。"],outside_resource_window:["This area is not open at this time.","该资源在此时段不开放。"],schedule_excluded_date:["Not offered on this date.","此日期未开放预订。"],capacity_full:["Not enough capacity for this selection.","剩余容量不足。"],resource_capacity_exceeded:["Not enough capacity for this selection.","剩余容量不足。"],resource_occupied:["Already booked at this time.","该时段已被预订。"],cart_occupied:["Reserved by another item in your order.","与订单内另一项预约冲突。"],selection_occupied:["Conflicts with the current selection.","与当前选择冲突。"],booking_cutoff_invalid:["Booking rules need to be checked by the venue.","预订截止配置有误,请联系场馆。"],booking_cutoff_future_day:["This date is not open for booking yet.","该日期暂未开放预订。"],booking_cutoff_after_start:["The booking deadline has passed.","已过预订截止时间。"],booking_cutoff_before_start:["The booking deadline has passed.","已过预订截止时间。"],booking_cutoff_advance:["The booking deadline has passed.","已过预订截止时间。"]};return i[e]?i[e][+("zh"===t)]:e.includes("CONFIGURATION")||"UNSUPPORTED_RESOURCE_GROUP"===e||"AVAILABILITY_UNSUPPORTED"===e?l.configuration:"RESOURCE_REQUIRED"===e?l.resourceRequired:"PARTY_ROOM_REQUIRED"===e?l.selectRoom:"RESOURCE_SINGLE_SELECTION_REQUIRED"===e?l.singleResource:"TIME_REQUIRED"===e?l.chooseTime:"QUANTITY_REQUIRED"===e||"SINGLE_BOOKING_REQUIRED"===e?l.quantity:"NO_AVAILABLE_TIME"===e?l.noTimes:"AUTOMATIC_RESOURCE_UNAVAILABLE"===e?l.noResources:"SELECTED_TIME_UNAVAILABLE"===e||"SELECTED_RESOURCE_UNAVAILABLE"===e?l.selectedUnavailable:e.endsWith("_CHANGED")||"BOOKING_SELECTION_NOT_READY"===e?l.changed:"AVAILABILITY_REQUEST_FAILED"===e?l.requestFailed:l.unavailable}function eQR(e,t){var l;return(null==t||null==(l=t[String(e.formId??e.groupId)])?void 0:l.resourceSelectionMode)==="automatic"}let eQ$=e=>{var t;return(Array.isArray(null==e||null==(t=e.product_resource)?void 0:t.resources)?e.product_resource.resources:[]).filter(e=>0!==Number(e.status)).map(e=>({groupId:String(e.id??e.form_id??e.code),formId:e.id??e.form_id}))};function eQF(e,t){return!e||eQ$(e).some(e=>!eQR(e,t))}let eQq=(e,t)=>null!=e.requirementGroupId?String(e.requirementGroupId)===String(t.groupId):null!=e.formId&&null!=t.formId&&String(e.formId)===String(t.formId),eQB=e=>{if(null==e||""===e)return;let t=Number(e);return Number.isSafeInteger(t)&&t>0?t:void 0},eQH=e=>{if(!(!e.length||e.some(e=>!Number.isSafeInteger(Number(null==e?void 0:e.value))||0>Number(null==e?void 0:e.value))))return eQB(e.reduce((e,t)=>e+Number(t.value),0))};function eQV(e,t){var l,i,a,n,r,o;let s,d,c=void 0===t?null==e||null==(l=e._extend)?void 0:l.other:q4(null==e||null==(i=e._extend)?void 0:i.other,t),u={...e,id:(null==e?void 0:e.id)??(null==e?void 0:e.product_id),_extend:{...(null==e?void 0:e._extend)||{},other:c}},p=[],m=(null==e||null==(a=e._data)?void 0:a.capacitys)??(null==e?void 0:e.capacity),g=[];if((null==m?void 0:m.type)==="product")s=eQH(g=nc({capacitys:m,cacheItem:u}));else if((null==m?void 0:m.type)==="package")s=eQH(g=nc({capacitys:m,cacheItem:u}));else if((null==m?void 0:m.type)==="custom"){let t=Array.isArray(m.custom)?m.custom:[],l=Array.isArray(null==e||null==(n=e._extend)?void 0:n.capacity)?e._extend.capacity:[];t.length&&t.every(e=>{let t=l.find(t=>String(null==t?void 0:t.id)===String(e.id)),i=Number(null==t?void 0:t.value);return t&&Number.isSafeInteger(i)&&i>=Number(e.min)&&i<=Number(e.max)})?g=t.map(e=>l.find(t=>String(t.id)===String(e.id))):t.length&&t.every(e=>Number.isSafeInteger(Number(e.min))&&Number(e.min)>=0&&Number(e.min)<=Number(e.max))&&(g=nc({capacitys:m,cacheItem:u})),s=eQH(g)??eQB(m.default)}else{s=eQB((null==m?void 0:m.default)??m);let t=null==e||null==(r=e._extend)?void 0:r.capacity;if(!s&&Array.isArray(t)&&(s=eQH(t)),!s){let t=((null==e||null==(o=e.product_resource)?void 0:o.resources)||[]).filter(e=>(null==e?void 0:e.status)!==0).map(e=>eQB(e.capacity_required));t.length&&t.every(e=>e===t[0]&&void 0!==e)&&(s=t[0])}}s||p.push("CAPACITY_CONFIGURATION_REQUIRED"),g.length&&(u._extend.capacity=g);let h=(null==e?void 0:e.duration)??(null==e?void 0:e.service_duration),v=null==h?void 0:r7(h);if("flexible"===v);else if("number"==typeof v||"string"==typeof v){let e=Number(v);Number.isFinite(e)&&e>0?d=e:null!=v&&p.push("DURATION_CONFIGURATION_REQUIRED")}else null!=v&&p.push("UNSUPPORTED_DURATION_CONFIGURATION");let f=u.id;return null!=f&&""!==f&&Number.isFinite(Number(f))||p.push("PRODUCT_CONFIGURATION_REQUIRED"),{product:u,productId:f,partySize:s,durationMinutes:d,reasonCodes:p}}function eQU(e){var t;let l={},i=null==e||null==(t=e.product_resource)?void 0:t.resources;return Array.isArray(i)&&i.filter(e=>(null==e?void 0:e.status)!==0).forEach((e,t)=>{var i;let a=e.id??e.form_id??e.code??`requirement-${t}`,n=[...Array.isArray(e.default_resource)?e.default_resource:[],...Array.isArray(e.optional_resource)?e.optional_resource:[],...(null==(i=e.combined_resource)?void 0:i.status)===1&&Array.isArray(e.combined_resource.resource_ids)?e.combined_resource.resource_ids:[]].filter(e=>"string"==typeof e||"number"==typeof e);l[String(a)]=n.filter((e,t)=>n.findIndex(t=>String(t)===String(e))===t)}),l}function eQY(e){var t,l,i,a;let n=e.product||{};return JSON.stringify({mode:e.mode,date:e.date,quantity:e.quantity,edit:e.editingProductLineUid,disabled:e.disabled,resourcePolicy:(a=e.resourceSettings,JSON.stringify(eQ$(n).map(e=>[String(e.formId??e.groupId),eQR(e,a)]).sort((e,t)=>String(e[0]).localeCompare(String(t[0]))))),resourceSettingsReady:!1!==e.resourceSettingsReady,resourceSettingsFailed:!!e.resourceSettingsFailed,id:n.id??n.product_id,updatedAt:n.updated_at,sku:Ba((null==(t=n._extend)?void 0:t.other)??n.product_sku),capacity:(null==(l=n._data)?void 0:l.capacitys)??n.capacity,capacityValue:null==(i=n._extend)?void 0:i.capacity,duration:n.duration,serviceDuration:n.service_duration,resources:n.product_resource,schedule:n.schedule,schedules:n.schedules,session:n.session})}class eQW extends Error{constructor(e,t=Array.from(new Set(e.map(e=>eQL(e,"en")))).join(" ")){super(t),e2(this,"reasonCodes",void 0),this.reasonCodes=e,this.name="BookingSelectionError"}}let eQG=(e,t)=>String(e)===String(t),eQK=(e,t)=>("available"===e.status||"limited"===e.status)&&(null==e.maxPartySize||e.maxPartySize>=t);function eQQ(e,t){return!!e&&!!t&&eQG(e.productId,t.productId)&&e.key===t.key&&e.source===t.source&&e.date===t.date&&e.businessDate===t.businessDate&&e.startAt===t.startAt&&e.endAt===t.endAt&&e.bookingStartAt===t.bookingStartAt&&e.bookingEndAt===t.bookingEndAt&&e.timezone===t.timezone&&JSON.stringify(e.scheduleRefs)===JSON.stringify(t.scheduleRefs)&&JSON.stringify(e.primaryScheduleRef)===JSON.stringify(t.primaryScheduleRef)}let eQZ=(e,t)=>eQQ(e,t)&&(null==e?void 0:e.availabilityContextId)===(null==t?void 0:t.availabilityContextId)&&(null==e?void 0:e.availabilityContextVersion)===(null==t?void 0:t.availabilityContextVersion);function eQJ(e){return JSON.stringify([String(e.productId),e.date,e.businessDate,e.startAt,e.endAt,e.bookingStartAt||e.startAt,e.bookingEndAt||e.endAt,e.timezone])}function eQX(e,t){let l=new Map;for(let i of e){let e=eQJ(i),a=l.get(e);a?(a.candidates.push(i),!eQK(a.candidate,t)&&eQK(i,t)&&(a.candidate=i)):l.set(e,{id:e,candidate:i,candidates:[i]})}return Array.from(l.values())}function eQ0(e,t){return null!=e.requirementGroupId?eQG(e.requirementGroupId,t.groupId):null!=e.formId&&null!=t.formId&&eQG(e.formId,t.formId)}function eQ2(e){return JSON.stringify({candidate:e.candidate&&{productId:e.candidate.productId,key:e.candidate.key,startAt:e.candidate.startAt,endAt:e.candidate.endAt},selections:e.requirementSelections.map(e=>({group:e.requirementGroupId,form:e.formId,ids:e.resourceIds.map(String).sort()})).sort((e,t)=>String(e.group??e.form).localeCompare(String(t.group??t.form)))})}function eQ1(e,t,l){let i=[];for(let n of e){var a;let e=t.filter(e=>eQ0(e,n)),r=(null==(a=e[0])?void 0:a.resourceIds)||[],o=Math.max(+!!n.required,n.min||0);(o>1||n.max<o)&&i.push("UNSUPPORTED_RESOURCE_GROUP"),(e.length>1||r.length>1||r.length>n.max)&&i.push("RESOURCE_SINGLE_SELECTION_REQUIRED"),r.length<o&&i.push("RESOURCE_REQUIRED"),r.some(e=>!n.options.some(t=>eQG(t.resourceId,e)&&eQK(t,l)))&&i.push("SELECTED_RESOURCE_UNAVAILABLE")}return t.some(t=>t.resourceIds.length&&!e.some(e=>eQ0(t,e)))&&i.push("SELECTED_RESOURCE_UNAVAILABLE"),Array.from(new Set(i))}function eQ4(e,t,l,i){let a=eQU(l),n=t.map(e=>({...e,resourceIds:[...e.resourceIds]}));for(let t of e){if(n.some(e=>eQ0(e,t)&&e.resourceIds.length))continue;let e=a[t.groupId]||(null==t.formId?[]:a[String(t.formId)])||[];if((t.required||t.min>0)&&1===e.length&&t.max>=1&&t.options.some(t=>eQG(t.resourceId,e[0])&&eQK(t,i))){let l={requirementGroupId:t.groupId,formId:t.formId,resourceIds:[e[0]]},i=n.findIndex(e=>eQ0(e,t));-1===i?n.push(l):n[i]=l}}return n}function eQ3(e,t){var l;t&&(null==(l=e.releaseAvailabilityContext)||l.call(e,t.contextId))}function eQ8(e,t){let l=Array.from(new Set(t.filter(eQw))).sort(),i=l.indexOf(e);if(i<0)return{startDate:e,endDate:e};let a=i,n=i;for(;a>0&&eQj(l[a],-1)===l[a-1];)a--;for(;n+1<l.length&&eQj(l[n],1)===l[n+1];)n++;return{startDate:l[a],endDate:l[n]}}async function eQ6(e,t){let l;var i,a=e.os;if(!a.prepareAvailabilityProjection||!a.getProductTimeRanges||!a.queryBookingAvailability||!a.releaseAvailabilityContext)throw new eQW(["AVAILABILITY_UNSUPPORTED"]);let n=(l=eQV(e.product).reasonCodes,/^\d{4}-\d{2}-\d{2}$/.test(e.date)&&!Number.isNaN(Date.parse(`${e.date}T00:00:00Z`))&&new Date(`${e.date}T00:00:00Z`).toISOString().slice(0,10)===e.date||l.push("DATE_REQUIRED"),eQB(e.quantity)||l.push("QUANTITY_REQUIRED"),("party"===e.mode||e.editingProductLineUid)&&1!==e.quantity&&l.push("SINGLE_BOOKING_REQUIRED"),l);if(n.length)throw new eQW(n);let r=eQV(e.product),o=r.partySize,s=o*e.quantity;if(!Number.isSafeInteger(s))throw new eQW(["CAPACITY_CONFIGURATION_REQUIRED"]);let d={startDate:e.date,endDate:e.date},c=null==t?void 0:t.projectionDateRange,u=c&&eQw(c.startDate)&&eQw(c.endDate)&&c.startDate<=e.date&&c.endDate>=e.date?c:d,p={productIds:[r.productId],rawProducts:[r.product],dateRange:u,editingProductLineUids:e.editingProductLineUid?[e.editingProductLineUid]:void 0,publishCatalog:!1,refreshOccupancies:!1,strictAvailability:!0,mode:"appointment",occupancyCachePolicy:"session"},m=await e.os.prepareAvailabilityProjection(p);try{let t=(await e.os.getProductTimeRanges(m.contextId,{productIds:[r.productId],dateRange:d,partySize:s,...r.durationMinutes?{durationMinutesByProductId:{[String(r.productId)]:r.durationMinutes}}:{},...e.editingProductLineUid&&(null==(i=e.initialSelection)?void 0:i.candidate)&&r.durationMinutes?{editingStartAtByProductId:{[String(r.productId)]:e.initialSelection.candidate.startAt}}:{}})).filter(e=>eQG(e.productId,r.productId)).flatMap(e=>e.ranges||[]),l=t.length?await e.os.queryBookingAvailability(m.contextId,{target:"time",productIds:[r.productId],candidates:t,partySize:s}):void 0,a=((null==l?void 0:l.data)||[]).filter(e=>eQG(e.productId,r.productId)).flatMap(e=>e.times||[]).filter(t=>t.availabilityContextId===m.contextId&&(t.businessDate||t.date)===e.date),n=e.os.getAvailabilityResources?Array.from(await e.os.getAvailabilityResources(m.contextId,"number"==typeof(null==l?void 0:l.contextVersion)?l.contextVersion:void 0)):[];return{contextId:m.contextId,productId:r.productId,partySize:o,bookingCount:e.quantity,queryPartySize:s,times:a,resources:n,product:r.product}}catch(t){throw eQ3(e.os,m),t}}async function eQ5(e,t,l){var i;let a={target:"resource",productIds:[t.productId],selectedRanges:[l],partySize:t.queryPartySize,customerSelectionSnapshot:!0},n=(await e.queryBookingAvailability(t.contextId,a)).data.filter(e=>eQG(e.productId,t.productId)).flatMap(e=>e.ranges||[]).find(e=>eQZ(e.range,l));if(!n||!eQK(n,t.queryPartySize))throw new eQW((null==n||null==(i=n.reasonCodes)?void 0:i.length)?n.reasonCodes:["SELECTED_TIME_UNAVAILABLE"]);return{candidate:n.range,groups:n.requirementGroups||[]}}async function eQ7(e,t,l){let i=eQJ(l),a=t.times.filter(e=>eQJ(e)===i),n=[];for(let l=0;l<a.length;l+=2){let i=await Promise.all(a.slice(l,l+2).map(async l=>{try{return await eQ5(e,t,l)}catch(e){if(e instanceof eQW)return;throw e}}));n.push(...i.filter(e=>!!e))}if(!n.length)throw new eQW(["SELECTED_TIME_UNAVAILABLE"]);return n}function eQ9(e,t,l){let i=new Map;for(let a of e)for(let e of a.groups){let n=i.get(e.groupId);n||(n={...e,options:[]},i.set(e.groupId,n));let r=t.filter(t=>!eQ0(t,e)),o=eQ1(a.groups,r,l.queryPartySize).every(e=>"RESOURCE_REQUIRED"===e);for(let t of e.options){let e=o?t:{...t,status:"unavailable",reasonCodes:["SELECTED_RESOURCE_UNAVAILABLE"]},i=n.options.findIndex(t=>eQG(t.resourceId,e.resourceId));i<0?n.options.push(e):!eQK(n.options[i],l.queryPartySize)&&eQK(e,l.queryPartySize)&&(n.options[i]=e)}}return eZe(Array.from(i.values()),l)}function eZe(e,t){let l=eQU(t.product);return e.map(e=>{let i=[...e.options];for(let a of l[e.groupId]||[])if(!i.some(e=>eQG(e.resourceId,a))){let e=t.resources.find(e=>eQG(e.id,a));i.push({resourceId:a,resourceName:null==e?void 0:e.name,status:"unavailable",reasonCodes:["RESOURCE_NOT_AVAILABLE_IN_CONTEXT"]})}return{...e,options:i}})}function eZt(e,t){return e.resources.filter(e=>t.some(t=>t.resourceIds.some(t=>eQG(t,e.id))))}let eZl=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return{status:"idle",ready:!1,reasonCodes:[],bookingCount:e,times:[],resourceGroups:[],resources:[],selectedResourceDetails:[],requirementSelections:[],resourceScrollRevision:0}},eZi=e=>e instanceof eQW?e.reasonCodes:["AVAILABILITY_REQUEST_FAILED"],eZa=e=>e instanceof Error?e.message:String(e),eZn=e=>(null==e?void 0:e.resourceSettingsReady)===!1||(null==e?void 0:e.resourceSettingsFailed)===!0,eZr=e=>({candidate:null==e?void 0:e.candidate,requirementSelections:((null==e?void 0:e.requirementSelections)||[]).map(e=>({...e,resourceIds:[...e.resourceIds]}))});class eZo{publish(e){this.disposed||(this.state={...this.state,...e},this.listeners.forEach(e=>e()))}releaseCurrent(){this.input&&eQ3(this.input.os,this.projection),this.projection=void 0}async setInput(e){var t;let l=eQY(e);if(this.disposed)return;if(l===this.inputKey&&e.os===(null==(t=this.input)?void 0:t.os)){this.input=e;return}let i=this.input,a=this.intent.candidate;if(i&&this.projection&&a&&!this.committing&&!e.disabled&&!this.state.requiresOrderReconciliation&&e.os===i.os&&(e.quantity===i.quantity||"ticket"===e.mode&&!e.editingProductLineUid)&&Number.isSafeInteger(e.quantity)&&e.quantity>0&&Number.isSafeInteger(this.projection.partySize*e.quantity)&&eQY({...e,quantity:i.quantity,resourceSettings:i.resourceSettings,resourceSettingsReady:i.resourceSettingsReady,resourceSettingsFailed:i.resourceSettingsFailed})===this.inputKey)return(this.input=e,this.inputKey=l,this.generation++,this.queryRevision++,this.projection={...this.projection,bookingCount:e.quantity,queryPartySize:this.projection.partySize*e.quantity},this.publish({bookingCount:e.quantity}),eZn(e))?void this.publish({status:e.resourceSettingsFailed?"error":"loading",ready:!1,reasonCodes:e.resourceSettingsFailed?["AVAILABILITY_REQUEST_FAILED"]:[],error:void 0}):void await this.resolveTime(a,!1);let n=i&&!eQG(i.product.id??i.product.product_id,e.product.id??e.product.product_id);(!i||n||i.editingProductLineUid!==e.editingProductLineUid?this.intent=eZr(e.initialSelection):i.date!==e.date&&(this.intent={requirementSelections:[]}),this.releaseCurrent(),this.input=e,this.inputKey=l,this.generation++,this.queryRevision++,this.committing)?this.publish({ready:!1}):await this.load()}async load(){let e,t=this.input;if(!t||this.disposed)return;if(t.disabled)return void this.publish({...eZl(t.quantity),status:"blocked",reasonCodes:["BOOKING_DISABLED"]});if(eZn(t))return void this.publish({...eZl(t.quantity),...eZr(this.intent),status:t.resourceSettingsFailed?"error":"loading",reasonCodes:t.resourceSettingsFailed?["AVAILABILITY_REQUEST_FAILED"]:[]});let l=this.generation;this.publish({...eZl(t.quantity),status:"loading",...eZr(this.intent)});try{if(e=await eQ6({...t,initialSelection:this.intent}),this.disposed||l!==this.generation)return void eQ3(t.os,e);this.projection=e;let i=eZe(function(e){let t=new Map;for(let l of e.times)for(let i of l.requirementGroups||[]){let a=t.get(i.groupId);for(let n of(a||(a={...i,options:[]},t.set(i.groupId,a)),i.options||[])){let t=eQK(l,e.queryPartySize)?n:{...n,status:"unavailable"},i=a.options.findIndex(e=>eQG(e.resourceId,t.resourceId));i<0?a.options.push(t):!eQK(a.options[i],e.queryPartySize)&&eQK(t,e.queryPartySize)&&(a.options[i]=t)}}return Array.from(t.values())}(e),e);this.publish({contextId:e.contextId,productId:e.productId,partySize:e.partySize,bookingCount:e.bookingCount,times:e.times,resourceGroups:i,resources:e.resources});let a=e.times.find(t=>eQQ(t,this.intent.candidate)&&eQK(t,e.queryPartySize));if(a)return void await this.resolveTime(a,!1);let n=eQX(e.times,e.queryPartySize).filter(t=>eQK(t.candidate,e.queryPartySize));if("ticket"===t.mode&&!this.intent.candidate&&1===n.length)return void await this.resolveTime(n[0].candidate,!1);let r=e.times.some(t=>eQK(t,e.queryPartySize))?[]:["NO_AVAILABLE_TIME"];this.intent.candidate&&r.push("SELECTED_TIME_UNAVAILABLE"),"party"!==t.mode||i.length||r.push("PARTY_ROOM_CONFIGURATION_REQUIRED"),this.publish({status:r.length?"blocked":"selecting",ready:!1,reasonCodes:r,...eZr(this.intent),selectedResourceDetails:eZt(e,this.intent.requirementSelections)})}catch(e){if(this.disposed||l!==this.generation)return;this.publish({status:"error",ready:!1,reasonCodes:eZi(e),error:eZa(e)})}}async resolveTime(e,t){let l=this.projection,i=this.input;if(!l||!i)return;let a=this.generation,n=++this.queryRevision;this.intent={...this.intent,candidate:e},this.publish({status:"loading",ready:!1,reasonCodes:[],error:void 0,...eZr(this.intent)});try{let r=await eQ7(i.os,l,e);if(this.disposed||a!==this.generation||n!==this.queryRevision)return;let o=[...r].sort((t,l)=>Number(eQQ(l.candidate,e))-Number(eQQ(t.candidate,e))),s=r.some(e=>e.groups.some(e=>eQR(e,i.resourceSettings)))?void 0:eQ4(eQ9(r,this.intent.requirementSelections,l),this.intent.requirementSelections,l.product,l.queryPartySize),d=o.map(e=>{let t=s||eQ4(e.groups,this.intent.requirementSelections,l.product,l.queryPartySize),a=function(e,t,l,i){let a=t.map(e=>({...e,resourceIds:[...e.resourceIds]})),n=[];for(let t of e){if(!eQR(t,l))continue;let e=a.filter(e=>eQq(e,t)),r=Vk({...t,options:t.options.filter(e=>null==e.maxPartySize||e.maxPartySize>=i)}),o=1===e.length&&1===e[0].resourceIds.length&&r.some(t=>String(t.resourceId)===String(e[0].resourceIds[0])),s=t.min>1||t.max<1,d=s?[]:o?e[0].resourceIds:Vw({...t,options:r},{mode:"availability"});for(let e=a.length-1;e>=0;e--)eQq(a[e],t)&&a.splice(e,1);a.push({requirementGroupId:t.groupId,formId:t.formId,resourceIds:d}),s?n.push("UNSUPPORTED_RESOURCE_GROUP"):1!==d.length&&n.push("AUTOMATIC_RESOURCE_UNAVAILABLE")}return{selections:a,reasonCodes:n}}(e.groups,t,i.resourceSettings,l.queryPartySize);return{result:e,selections:a.selections,reasons:Array.from(new Set([...eQ1(e.groups,a.selections,l.queryPartySize),...a.reasonCodes]))}}),c=d.find(e=>!e.reasons.length)||d.find(e=>e.reasons.every(e=>"RESOURCE_REQUIRED"===e))||d[0],{result:u,selections:p}=c;this.intent={candidate:u.candidate,requirementSelections:p};let m=[...c.reasons];"party"!==i.mode||u.groups.length||m.push("PARTY_ROOM_CONFIGURATION_REQUIRED"),"party"!==i.mode||this.intent.requirementSelections.some(e=>e.resourceIds.length)||m.push("PARTY_ROOM_REQUIRED");let g=p.filter(e=>!r.some(t=>t.groups.some(t=>eQR(t,i.resourceSettings)&&eQ0(e,t))));return this.publish({status:m.length?"selecting":"ready",ready:!m.length,reasonCodes:m,...eZr(this.intent),resourceGroups:eQ9(r,g,l),selectedResourceDetails:eZt(l,this.intent.requirementSelections),resourceScrollRevision:this.state.resourceScrollRevision+(t&&u.groups.length?1:0)}),this.state}catch(e){if(this.disposed||a!==this.generation||n!==this.queryRevision)return;this.publish({status:"error",ready:!1,reasonCodes:eZi(e),error:eZa(e)})}}dispose(){this.disposed||(this.disposed=!0,this.generation++,this.queryRevision++,this.releaseCurrent(),this.listeners.clear())}constructor(){var e=this;e2(this,"input",void 0),e2(this,"inputKey",""),e2(this,"projection",void 0),e2(this,"intent",{requirementSelections:[]}),e2(this,"generation",0),e2(this,"queryRevision",0),e2(this,"disposed",!1),e2(this,"committing",!1),e2(this,"listeners",new Set),e2(this,"state",eZl()),e2(this,"getSnapshot",()=>this.state),e2(this,"isInputCurrent",e=>{var t;return!this.disposed&&(null==(t=this.input)?void 0:t.os)===e.os&&this.inputKey===eQY(e)}),e2(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)})),e2(this,"refresh",async()=>{this.disposed||!this.input||this.committing||this.state.requiresOrderReconciliation||(this.generation++,this.queryRevision++,this.releaseCurrent(),await this.load())}),e2(this,"resetSelection",async()=>{this.committing||this.disposed||this.state.requiresOrderReconciliation||(this.intent={requirementSelections:[]},await this.refresh())}),e2(this,"canSelectTime",e=>{var t;let l=this.projection;return!!l&&!this.committing&&!(null==(t=this.input)?void 0:t.disabled)&&!eZn(this.input)&&!this.state.requiresOrderReconciliation&&"loading"!==this.state.status&&"committed"!==this.state.status&&eQK(e,l.queryPartySize)}),e2(this,"selectTime",async e=>{var t;if(!this.canSelectTime(e))return;let l=null==(t=this.projection)?void 0:t.times.find(t=>eQQ(t,e)&&t.availabilityContextId===e.availabilityContextId&&t.availabilityContextVersion===e.availabilityContextVersion);if(l)return this.resolveTime(l,!0)}),e2(this,"selectResource",async(e,t)=>{let l=this.projection,i=this.input;if(!l||!i||i.disabled||eZn(i)||this.committing||"loading"===this.state.status||"committed"===this.state.status||this.state.requiresOrderReconciliation)return;let a=this.state.resourceGroups,n=a.find(t=>eQG(t.groupId,e));if(!n||!this.intent.candidate||eQR(n,i.resourceSettings)||null==t&&(n.required||n.min>0)||null!=t&&!n.options.some(e=>eQG(e.resourceId,t)&&eQK(e,l.queryPartySize)))return;let r=this.intent.requirementSelections.filter(e=>!eQ0(e,n));r.push({requirementGroupId:n.groupId,formId:n.formId,resourceIds:null==t?[]:[t]}),this.intent={...this.intent,requirementSelections:r},this.queryRevision++;let o=l.times.find(e=>eQQ(e,this.intent.candidate));if(o&&eQK(o,l.queryPartySize))return this.resolveTime(o,!1);this.publish({status:"selecting",ready:!1,reasonCodes:this.intent.candidate?["SELECTED_TIME_UNAVAILABLE"]:[],...eZr(this.intent),resourceGroups:a,selectedResourceDetails:eZt(l,r)})}),e2(this,"commit",async function(t){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.input;if(!(null==i?void 0:i.os.commitAvailabilitySelection))throw new eQW(["AVAILABILITY_UNSUPPORTED"]);let a=e.projection;if(e.disposed||e.committing||!e.state.ready||!a||!e.intent.candidate||e.state.requiresOrderReconciliation)throw new eQW(["BOOKING_SELECTION_NOT_READY"]);if(!eQG(t.product_id??t.id,a.productId))throw new eQW(["PRODUCT_SELECTION_CHANGED"]);if(Number(t.num??t.quantity)!==i.quantity)throw new eQW(["QUANTITY_SELECTION_CHANGED"]);let n=l.mode||(i.editingProductLineUid?"edit":"add");if("add"!==n&&!i.editingProductLineUid||"add"===n&&i.editingProductLineUid)throw new eQW(["BOOKING_EDIT_IDENTITY_REQUIRED"]);if("replace"===n&&!Array.isArray(l.relatedRetailProducts))throw new eQW(["RELATED_PRODUCTS_REQUIRED"]);let r=e.generation,o=e.inputKey,s=eZr(e.intent),d=eQ2(s),c=()=>{var t,i;if(e.disposed||e.generation!==r||e.inputKey!==o||eQ2(e.intent)!==d||(null==(t=e.input)?void 0:t.disabled)||eZn(e.input))throw new eQW(["BOOKING_SELECTION_CHANGED"]);null==(i=l.availabilityCommitGuard)||i.call(l)};e.committing=!0,e.publish({status:"committing",ready:!1,reasonCodes:[],error:void 0});let u=!1;try{var p,m;c(),u=!0;let r=i.os.commitAvailabilitySelection,o=await r.call(i.os,a.contextId,{...l,mode:n,customerSelectionSnapshot:!0,productLineUid:i.editingProductLineUid,orderProduct:t,candidate:s.candidate,requirementSelections:s.requirementSelections,partySize:a.partySize,bookingCount:a.bookingCount,availabilityCommitGuard:c});if((null==(p=o.validation)?void 0:p.ok)===!1)throw new eQW((null==(m=o.validation.conflicts)?void 0:m.map(e=>e.code||"BOOKING_COMMIT_FAILED"))||["BOOKING_COMMIT_FAILED"]);return e.publish({status:"committed",ready:!1,reasonCodes:[],candidate:s.candidate,selectedResourceDetails:eZt(a,s.requirementSelections)}),o}catch(l){let t=!!l&&"object"==typeof l&&"code"in l&&"BUSINESS_UNAVAILABLE"===l.code;throw e.publish({status:"error",ready:!1,reasonCodes:eZi(l),error:eZa(l),requiresOrderReconciliation:u&&!t}),l}finally{e.committing=!1}})}}function eZs(e){let{label:t,value:l,options:i,onChange:a,onReselect:n,describedBy:r,invalid:o}=e,s=dL("booking-time");return(0,eB.jsx)("div",{className:"time-choices-grid","data-has-end":i.some(e=>!!e.end),role:"radiogroup","aria-label":t,"aria-describedby":r,"aria-invalid":o||void 0,children:i.map(e=>(0,eB.jsxs)("label",{className:"time-choice",children:[(0,eB.jsx)("input",{className:"sr-only",type:"radio",name:s,value:e.id,checked:l===e.id,disabled:e.disabled,onChange:()=>a(e.id),onKeyDown:t=>{n&&l===e.id&&(" "===t.key||"Enter"===t.key)&&(t.preventDefault(),n())},onClick:()=>{l===e.id&&(null==n||n())}}),(0,eB.jsxs)("span",{className:"time-choice-card",children:[l===e.id&&(0,eB.jsx)(eK5,{className:"time-choice-check",size:12,weight:"fill","aria-hidden":"true"}),(0,eB.jsxs)("span",{children:[e.indicator&&(0,eB.jsx)("span",{className:"time-choice-availability","data-tone":e.indicator.tone,role:"img","aria-label":e.indicator.label}),e.start,e.end&&`–${e.end}`]}),e.description&&(0,eB.jsx)("small",{children:e.description})]})]},e.id))})}function eZd(e){let{label:t,value:l}=e;return(0,eB.jsxs)("div",{className:"time-choice-validity",role:"status","aria-live":"polite","aria-atomic":"true",children:[(0,eB.jsx)("strong",{children:t}),(0,eB.jsx)("span",{children:l})]})}let eZc=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M125.18,156.94a64,64,0,1,0-82.36,0,100.23,100.23,0,0,0-39.49,32,12,12,0,0,0,19.35,14.2,76,76,0,0,1,122.64,0,12,12,0,0,0,19.36-14.2A100.33,100.33,0,0,0,125.18,156.94ZM44,108a40,40,0,1,1,40,40A40,40,0,0,1,44,108Zm206.1,97.67a12,12,0,0,1-16.78-2.57A76.31,76.31,0,0,0,172,172a12,12,0,0,1,0-24,40,40,0,1,0-10.3-78.67,12,12,0,1,1-6.16-23.19,64,64,0,0,1,57.64,110.8,100.23,100.23,0,0,1,39.49,32A12,12,0,0,1,250.1,205.67Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M136,108A52,52,0,1,1,84,56,52,52,0,0,1,136,108Z",opacity:"0.2"}),eN.createElement("path",{d:"M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M164.47,195.63a8,8,0,0,1-6.7,12.37H10.23a8,8,0,0,1-6.7-12.37,95.83,95.83,0,0,1,47.22-37.71,60,60,0,1,1,66.5,0A95.83,95.83,0,0,1,164.47,195.63Zm87.91-.15a95.87,95.87,0,0,0-47.13-37.56A60,60,0,0,0,144.7,54.59a4,4,0,0,0-1.33,6A75.83,75.83,0,0,1,147,150.53a4,4,0,0,0,1.07,5.53,112.32,112.32,0,0,1,29.85,30.83,23.92,23.92,0,0,1,3.65,16.47,4,4,0,0,0,3.95,4.64h60.3a8,8,0,0,0,7.73-5.93A8.22,8.22,0,0,0,252.38,195.48Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M112.6,158.43a58,58,0,1,0-57.2,0A93.83,93.83,0,0,0,5.21,196.72a6,6,0,0,0,10.05,6.56,82,82,0,0,1,137.48,0,6,6,0,0,0,10-6.56A93.83,93.83,0,0,0,112.6,158.43ZM38,108a46,46,0,1,1,46,46A46.06,46.06,0,0,1,38,108Zm211,97a6,6,0,0,1-8.3-1.74A81.8,81.8,0,0,0,172,166a6,6,0,0,1,0-12,46,46,0,1,0-17.08-88.73,6,6,0,1,1-4.46-11.14,58,58,0,0,1,50.14,104.3,93.83,93.83,0,0,1,50.19,38.29A6,6,0,0,1,249,205Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M107.19,159a56,56,0,1,0-46.38,0A91.83,91.83,0,0,0,6.88,197.81a4,4,0,1,0,6.7,4.37,84,84,0,0,1,140.84,0,4,4,0,1,0,6.7-4.37A91.83,91.83,0,0,0,107.19,159ZM36,108a48,48,0,1,1,48,48A48.05,48.05,0,0,1,36,108Zm212,95.35a4,4,0,0,1-5.53-1.17A83.81,83.81,0,0,0,172,164a4,4,0,0,1,0-8,48,48,0,1,0-17.82-92.58,4,4,0,1,1-3-7.43,56,56,0,0,1,44,103,91.83,91.83,0,0,1,53.93,38.86A4,4,0,0,1,248,203.35Z"}))]]),eZu=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eZc}));function eZp(e){let{label:t,value:l,options:i,onChange:a,disabled:n=!1}=e;return(0,eB.jsx)("div",{className:"resource-picker",role:"group","aria-label":t,children:i.map(e=>(0,eB.jsxs)("button",{type:"button",className:"resource-card","aria-pressed":l===e.id,disabled:n||e.disabled,onClick:()=>a(e.id),children:[e.image&&(0,eB.jsx)("img",{src:e.image,alt:""}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("h3",{children:e.name}),e.description&&(0,eB.jsx)("p",{children:e.description}),(e.capacity||e.price)&&(0,eB.jsxs)("div",{className:"resource-card-meta",children:[e.capacity&&(0,eB.jsxs)("span",{children:[(0,eB.jsx)(eZu,{size:15}),e.capacity]}),e.price&&(0,eB.jsx)("b",{children:e.price})]}),e.status&&(0,eB.jsx)("p",{children:e.status})]})]},e.id))})}eZu.displayName="UsersIcon";let eZm=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm-12-80V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,172Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm-6-82V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,172Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm-4-84V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,172Z"}))]]),eZg=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eZm}));eZg.displayName="WarningCircleIcon";let eZh=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),eZv=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eZh}));function eZf(e){let{children:t,tone:l="info",id:i,className:a="",icon:n}=e,r="error"===l||"warning"===l?eZg:"success"===l?eK5:eZv;return(0,eB.jsxs)("div",{id:i,className:`shared-notice ${l} ${a}`,role:"error"===l?"alert":"status",children:[n??(0,eB.jsx)(r,{size:20,"aria-hidden":"true"}),(0,eB.jsx)("div",{className:"shared-notice-content",children:t})]})}function eZy(e){let{title:t,description:l,icon:i,decoration:a,eyebrow:n,children:r,actions:o,className:s="",pending:d=!1,headingLevel:c=2}=e;return(0,eB.jsxs)("div",{className:`status-panel ${s}`,role:d?"status":void 0,children:[a,i&&(0,eB.jsx)("div",{className:"status-panel-icon","aria-hidden":"true",children:i}),n,t&&(0,eB.jsx)(1===c?"h1":3===c?"h3":"h2",{children:t}),l&&(0,eB.jsx)("p",{children:l}),r,o]})}eZv.displayName="InfoIcon";let eZb=e=>"number"==typeof e&&Number.isFinite(e)&&e>=0;function eZx(e,t){if(!Array.isArray(e.requirementGroups)||e.requirementGroups.some(e=>!e||"object"!=typeof e))return;let l=e.requirementGroups.filter(e=>!1!==e.required);if(!l.length)return;let i=l.map(e=>{let l=function(e){if(!(!Array.isArray(e.options)||e.options.some(e=>!e||!["available","limited","full","conflict","unavailable","past"].includes(e.status))))return e.options.filter(e=>"available"===e.status||"limited"===e.status)}(e);return void 0===l?void 0:t(l)});return i.every(eZb)?Math.min(...i):void 0}function eZk(e){if(!e.some(e=>!eZb(e.remainingCapacity)))return e.reduce((e,t)=>Math.max(e,t.remainingCapacity),0)}function eZ_(e){if(!e.some(e=>!eZb(e.remainingCapacity)))return e.reduce((e,t)=>e+t.remainingCapacity,0)}let eZw=(0,eN.forwardRef)((e,t)=>{let{locale:l="en",resourcePresentation:i=[]}=e,a=eQz[l],n=function(e){var t;let l=(0,eN.useRef)(e);l.current=e;let i=(0,eN.useRef)(null),[a,n]=(0,eN.useState)(()=>new eZo().getSnapshot()),r=eQY(e);(0,eN.useLayoutEffect)(()=>{let e=new eZo;i.current=e;let t=e.subscribe(()=>n(e.getSnapshot()));return e.setInput(l.current),()=>{t(),e.dispose(),i.current===e&&(i.current=null)}},[]),(0,eN.useLayoutEffect)(()=>{var e;null==(e=i.current)||e.setInput(l.current)},[r,e.os]);let o=(0,eN.useCallback)(async()=>{let e=i.current;e&&(await e.setInput(l.current),await e.refresh())},[]),s=(0,eN.useCallback)(async(e,t)=>{let a=i.current;if(!a)throw new eQW(["BOOKING_SELECTION_NOT_READY"]);if(!a.isInputCurrent(l.current))throw new eQW(["BOOKING_SELECTION_CHANGED"]);return a.commit(e,t)},[]),d=(0,eN.useCallback)(async e=>{let t=i.current;if(null==t?void 0:t.isInputCurrent(l.current)){let a=await t.selectTime(e);if(i.current===t&&t.isInputCurrent(l.current))return a}},[]),c=(0,eN.useCallback)(async(e,t)=>{let a=i.current;if(null==a?void 0:a.isInputCurrent(l.current)){let n=await a.selectResource(e,t);if(i.current===a&&a.isInputCurrent(l.current))return n}},[]),u=(0,eN.useCallback)(e=>{let t=i.current;return!!(null==t?void 0:t.isInputCurrent(l.current))&&t.canSelectTime(e)},[]),p=(0,eN.useCallback)(async()=>{var e;await (null==(e=i.current)?void 0:e.resetSelection())},[]);return{state:(null==(t=i.current)?void 0:t.isInputCurrent(e))?a:{...a,status:"loading",ready:!1},refresh:o,commit:s,selectTime:d,selectResource:c,canSelectTime:u,resetSelection:p}}(e),{state:r}=n,o=(0,eN.useRef)(e.onSelectionChange);o.current=e.onSelectionChange;let s=(0,eN.useRef)(e);s.current=e;let[d,c]=(0,eN.useState)(!1),u=(0,eN.useRef)(!1),[p,m]=(0,eN.useState)(!1),g=(0,eN.useRef)(null),h=(0,eN.useRef)(null),v=(0,eN.useRef)(),f=(0,eN.useRef)(null),y=(0,eN.useRef)(null),b=(0,eN.useRef)(!0),x=eKB();(0,eN.useEffect)(()=>(b.current=!0,()=>{b.current=!1}),[]);let k=(0,eN.useCallback)(async()=>{let e=s.current;if(e.resourceSettingsFailed&&e.onRetryResourceSettings){try{await e.onRetryResourceSettings()}catch{}return}await n.refresh()},[n.refresh]);(0,eN.useImperativeHandle)(t,()=>({refresh:k,commit:(e,t)=>n.commit(e,{...t,availabilityCommitGuard:()=>{var e;if(u.current)throw new eQW(["BOOKING_SELECTION_CHANGED"]);null==t||null==(e=t.availabilityCommitGuard)||e.call(t)}})}),[k,n.commit]),(0,eN.useEffect)(()=>{o.current(d?{...r,ready:!1}:r)},[r,d]);let _="loading"===r.status||"committing"===r.status||d,w=!!e.disabled||!!e.interactionDisabled||_||"committed"===r.status||!!r.requiresOrderReconciliation,S=e.reasonFormatter||(e=>eQL(e,l)),j=eQU(e.product),N=t=>t.resourceGroups.filter(l=>{if(!1===e.resourceSettingsReady||e.resourceSettingsFailed||eQR(l,e.resourceSettings))return!1;if("ticket"!==e.mode||!l.required&&0===l.min)return!0;let i=j[l.groupId]||(null==l.formId?[]:j[String(l.formId)])||[],a=t.requirementSelections.find(e=>eQ0(e,l));return!(1===i.length&&(null==a?void 0:a.resourceIds.length)===1&&eQG(i[0],a.resourceIds[0])&&l.options.some(e=>eQG(e.resourceId,i[0])&&eQK(e,(t.partySize||0)*t.bookingCount)))}),C=(e,t)=>{var l,i;null==(l=(i=s.current).onExplicitSelection)||l.call(i,e,t),!s.current.renderContent&&("time"===e&&N(t).length?x(()=>h.current):t.ready&&x(s.current.actionTarget||(()=>{var e,t;return(null==(t=g.current)||null==(e=t.closest('[role="dialog"]'))?void 0:e.querySelector(".reservation-submit"))||null}),{focus:"control"}))},M=async t=>{var l;if(w)return;let i=null==(l=e.operationLog)?void 0:l.capture(),a=await n.selectTime(t);return a&&b.current&&(null==i||i("time_selected",{productId:a.productId,selectedDate:e.date,startAt:t.bookingStartAt||t.startAt,endAt:t.bookingEndAt||t.endAt}),C("time",a)),a},T=async(t,l)=>{var i;if(w)return;let a=null==(i=e.operationLog)?void 0:i.capture(),r=await n.selectResource(t,l);return r&&b.current&&(null==a||a("resource_selected",{productId:r.productId,selectedDate:e.date,groupId:t,resourceId:l}),C("resource",r)),r},I=async t=>{if(!w){if(m(!1),t===e.date){y.current&&(y.current.open=!1),s.current.renderContent||x(()=>f.current);return}u.current=!0,c(!0);try{if(await e.onDateChange(t)===!1)return;b.current&&(y.current&&(y.current.open=!1),s.current.renderContent||x(()=>f.current))}catch{b.current&&m(!0)}finally{u.current=!1,b.current&&c(!1)}}},P=eQX(r.times,(r.partySize||0)*r.bookingCount),A=r.times.find(e=>eQQ(e,r.candidate)),D=A&&eQK(A,(r.partySize||0)*r.bookingCount)?r.candidate:void 0,E=D?`${r.contextId||""}:${eQJ(D)}`:void 0,O=!!E&&!d&&("selecting"===r.status||"ready"===r.status||v.current===E);(0,eN.useEffect)(()=>{!E||d?v.current=void 0:("selecting"===r.status||"ready"===r.status)&&(v.current=E)},[E,r.status,d]);let z="loading"===r.status||d?eQA(l,"timeLoading"):"error"===r.status?eQA(l,"timeLoadFailed"):D?`${eZS(D.bookingStartAt||D.startAt,D.startTime)}–${eZS(D.bookingEndAt||D.endAt,D.endTime)}`:eQA(l,P.some(e=>{let{candidate:t}=e;return eQK(t,(r.partySize||0)*r.bookingCount)})?"timeNotSelected":"timeUnavailable"),L="party"===e.mode&&!r.times.length&&("idle"===r.status||"loading"===r.status||d),R="party"===e.mode&&!r.times.length&&"error"===r.status&&!r.requiresOrderReconciliation,$=(0,eB.jsxs)("div",{ref:f,tabIndex:-1,children:["ticket"===e.mode&&(0,eB.jsx)(eZd,{label:eQA(l,"validPlayTime"),value:z}),L&&(0,eB.jsx)(eZy,{pending:!0,description:eQA(l,"timeLoading")}),R&&(0,eB.jsx)(eZy,{description:eQA(l,"timeLoadFailed"),actions:(0,eB.jsx)(eKQ,{secondary:!0,disabled:w,onClick:()=>{k()},children:a.retry})}),(0,eB.jsx)(eZs,{label:a.time,value:A?eQJ(A):"",options:P.map(t=>{var i;let{id:o,candidate:s}=t,d=eQK(s,(r.partySize||0)*r.bookingCount),c=function(e){let{candidate:t,settings:l,mode:i}=e,a=Array.isArray(l)?Array.from(new Set(l.filter(e=>"maximum_capacity"===e||"available_quantity"===e||"colour_indicators"===e))):[],n={showColourIndicator:a.includes("colour_indicators")};return a.includes("maximum_capacity")&&(n.maximumCapacity=eZb(t.maxPartySize)?t.maxPartySize:eZx(t,eZk)),a.includes("available_quantity")&&(n.availableQuantity=eZx(t,"party"===i?e=>e.length:eZ_)),n}({candidate:s,settings:e.capacityDisplayContent,mode:e.mode}),u=!_&&d&&(void 0!==c.maximumCapacity||void 0!==c.availableQuantity);return{id:o,start:s.startTime,end:s.endTime,disabled:w||!n.canSelectTime(s),indicator:!_&&c.showColourIndicator?{tone:d?"limited"===s.status?"limited":"available":"unavailable",label:d?"limited"===s.status?eQA(l,"capacityLimited"):eQA(l,"capacityAvailable"):a.unavailable}:void 0,description:d?u?(0,eB.jsxs)(eB.Fragment,{children:[void 0!==c.maximumCapacity&&(0,eB.jsx)("span",{className:"venue-booking-time-capacity",children:eQA(l,"timeMaximumCapacity").replace("{count}",String(c.maximumCapacity))}),void 0!==c.availableQuantity&&(0,eB.jsx)("span",{className:"venue-booking-time-capacity",children:eQA(l,"party"===e.mode?"timeRoomsLeft":"timeSpacesLeft").replace("{count}",String(c.availableQuantity))})]}):void 0:S((null==(i=s.reasonCodes)?void 0:i[0])||"UNAVAILABLE")}}),onChange:e=>{var t;let l=null==(t=P.find(t=>t.id===e))?void 0:t.candidate;l&&M(l)},onReselect:()=>{!w&&A&&M(A)}}),!_&&!r.times.length&&"idle"!==r.status&&"error"!==r.status&&(0,eB.jsx)("p",{children:a.noTimes})]}),F=(0,eB.jsxs)("div",{ref:h,tabIndex:-1,children:[!A&&(0,eB.jsx)("p",{children:"party"===e.mode?a.timeBeforeRoom:a.selectTime}),N(r).map(t=>{var n;let o=null==(n=e.resourceSettings)?void 0:n[String(t.formId??t.groupId)],s="zh"===l?"zh-CN":"en",d=RC(null==o?void 0:o.name,void 0,s).trim()||RC(t.title,void 0,s).trim()||("party"===e.mode?a.room:a.resource),c=r.requirementSelections.find(e=>eQ0(e,t)),u=!w&&!!A,p=1===t.options.length?t.options:t.options.filter(e=>eQK(e,(r.partySize||0)*r.bookingCount)),m=p.map(t=>{var l,n,o;let s=i.find(e=>eQG(e.resourceId,t.resourceId)),d=r.resources.find(e=>eQG(e.id,t.resourceId)),c=eQK(t,(r.partySize||0)*r.bookingCount),u=null==d||null==(l=d.raw)?void 0:l.cover,p=Array.isArray(u)?null==(n=u.find(e=>"string"==typeof(null==e?void 0:e.url)&&e.url.trim()))?void 0:n.url:void 0,m=[null==s?void 0:s.image,p,null==d||null==(o=d.raw)?void 0:o.image].find(e=>"string"==typeof e&&e.trim()),g=[null==s?void 0:s.name,t.resourceName,null==d?void 0:d.name].find(e=>"string"==typeof e&&e.trim())||`${"party"===e.mode?a.room:a.resource} ${t.resourceId}`;return{id:String(t.resourceId),name:g,image:m,disabled:!c}});return t.required||0!==t.min||m.unshift({id:"",name:a.none,status:""}),(0,eB.jsxs)("fieldset",{className:"venue-booking-availability__group",disabled:!u,children:[(0,eB.jsxs)("legend",{children:[d,t.required||0!==t.min?"":` \xb7 ${a.optional}`]}),(0,eB.jsx)(eZp,{label:d,value:(null==c?void 0:c.resourceIds.length)?String(c.resourceIds[0]):"",options:m,disabled:!u,onChange:e=>{let l=t.options.find(t=>String(t.resourceId)===e);l?T(t.groupId,l.resourceId):""!==e||t.required||0!==t.min||T(t.groupId,null)}}),!p.length&&(0,eB.jsx)("p",{children:a.noResources})]},t.groupId)})]}),q=e.renderDatePicker?e.renderDatePicker({date:e.date,disabled:w,onChange:e=>{I(e)}}):(0,eB.jsx)("input",{type:"date","aria-label":a.date,value:e.date,disabled:w,onChange:e=>{I(e.target.value)}}),B=(e,t)=>(0,eB.jsxs)("section",{className:"reservation-section venue-booking-availability__section","aria-label":e,children:[(0,eB.jsx)("h3",{children:e}),t]}),H="ticket"===e.mode?(0,eB.jsxs)("details",{ref:y,className:"reservation-date",children:[(0,eB.jsxs)("summary",{"aria-disabled":w,onClick:e=>{w&&e.preventDefault()},children:[(0,eB.jsx)(eQv,{size:21,"aria-hidden":"true"}),(0,eB.jsx)("span",{children:(0,eB.jsx)("b",{children:eQM(e.date,l)})}),(0,eB.jsx)("span",{className:"date-change-label",children:eQA(l,"changeDate")})]}),(0,eB.jsx)("div",{className:"reservation-date-picker",children:q})]}):e.renderDatePicker?q:B(a.date,q),V="ticket"===e.mode?(0,eB.jsx)("section",{className:"reservation-section venue-booking-availability__section","aria-label":eQA(l,"validPlayTime"),children:$}):B(a.time,$),U=B("party"===e.mode?a.room:a.resource,F),Y=r.reasonCodes.filter(e=>!["RESOURCE_REQUIRED","PARTY_ROOM_REQUIRED","TIME_REQUIRED"].includes(e)),W=!_&&("error"===r.status||"blocked"===r.status||r.requiresOrderReconciliation||Y.length>0),G=W?Array.from(new Set(Y.map(S))):[],K=N(r).length>0||!r.resourceGroups.length&&eQF(e.product,e.resourceSettings),Q=!1!==e.resourceSettingsReady&&!e.resourceSettingsFailed&&("party"===e.mode||O)&&K,Z=(0,eB.jsxs)(eB.Fragment,{children:[(W||p)&&(0,eB.jsxs)("div",{className:"venue-booking-availability__status",role:"alert",children:[r.requiresOrderReconciliation?(0,eB.jsx)("p",{children:a.reconciliation}):G.map(e=>(0,eB.jsx)("p",{children:e},e)),p&&(0,eB.jsx)("p",{children:a.dateFailed})]}),("error"===r.status||"blocked"===r.status)&&!r.requiresOrderReconciliation&&!R&&(0,eB.jsx)(eKQ,{secondary:!0,className:"venue-booking-availability__retry",disabled:w,onClick:()=>{k()},children:a.retry}),r.reasonCodes.some(e=>"SELECTED_RESOURCE_UNAVAILABLE"===e||"SELECTED_TIME_UNAVAILABLE"===e)&&(0,eB.jsx)(eKQ,{secondary:!0,className:"venue-booking-availability__retry",disabled:w,onClick:()=>{n.resetSelection()},children:a.reselect})]}),J={state:r,busy:_,disabled:w,dateContent:q,timeContent:$,resourceContent:F,datePanel:H,timePanel:V,resourcePanel:U,statusPanel:Z,showResources:Q,actions:{changeDate:I,selectTime:M,selectResource:T,refresh:k,resetSelection:n.resetSelection}};return(0,eB.jsx)("div",{ref:g,className:`venue-booking-availability ${e.className||""}`,"aria-busy":_,children:e.renderContent?e.renderContent(J):(0,eB.jsxs)(eB.Fragment,{children:[H,V,Q&&U,Z]})})});function eZS(e,t){let l=null==e?void 0:e.match(/[T ](\d{2}:\d{2})(?::(\d{2}))?/);return l?`${l[1]}${l[2]&&"00"!==l[2]?`:${l[2]}`:""}`:t}async function eZj(e){let t=iS(e.product,e.skuValue,{requiredOptionValidation:!1,overSold:1===Number(e.product.over_sold)});if(!t)throw Error("The selected product options are no longer available.");return exX({productData:e.product,skuValue:t,quantity:e.quantity,selectedCandidate:e.candidate,duration:null,customerId:e.customerId,contextKey:e.scopeKey},{calculateProductBookingPrice:async t=>{let l=await e.os.calculateProductBookingPrice(t),i=t.product;if(Number(l.product_id)!==Number(i.product_id??i.id)||Number(l.product_variant_id||0)!==Number(i.product_variant_id||0)||null==l.unit_price||""===String(l.unit_price).trim()||!Number.isFinite(Number(l.unit_price))||0>Number(l.unit_price))throw Error("The booking price is unavailable or does not match the selected product.");return l},channel:"online_ordering"})}eZw.displayName="BookingSelectionPanel";let eZN=()=>{};function eZC(e){try{let t=e&&("object"==typeof e||"function"==typeof e)?e:void 0,l=null==t?void 0:t.name,i=null==t?void 0:t.code;return{errorName:"string"==typeof l&&l?l.slice(0,80):"unknown",..."string"==typeof i?{errorCode:i.slice(0,80)}:"number"==typeof i&&Number.isFinite(i)?{errorCode:i}:{}}}catch{return{errorName:"unknown"}}}let eZM=e=>"number"==typeof e?Number.isFinite(e)?e:void 0:"string"==typeof e&&e.trim()?e.trim():void 0,eZT=new Set(["cacheid","cache_id","scene","temp","ticketsmenulistids","partymenulistids","extrasmenulistids","menulistids","businesscode","business_code","channel","template","display_template_id","type","mode","lang","locale","date","schedule_date","resourceid","productid"]);function eZI(e){var t,l,i,a,n;let{mode:r,draft:o,context:s,date:d,scopeKey:c,locale:u,priceSource:p}=e,m=(e,t)=>"zh"===u?t:e,g=s.sales.bookingTicket,h=exp(),v=(0,eN.useRef)(null),[f,y]=(0,eN.useState)(o.configuration),[b,x]=(0,eN.useState)(()=>{let e=Number(o.quantity);return Number.isSafeInteger(e)&&e>0?e:1}),[k,_]=(0,eN.useState)(),w=(0,eN.useRef)(o.initialSelection),[S,j]=(0,eN.useState)(),[N,C]=(0,eN.useState)(),[M,T]=(0,eN.useState)(!1),I=(0,eN.useRef)(!1),P=(0,eN.useRef)(!0),A=(0,eN.useRef)(e.onBusyChange);A.current=e.onBusyChange;let D=(0,eN.useRef)(e.onDraftChange);D.current=e.onDraftChange,(0,eN.useEffect)(()=>(P.current=!0,()=>{var e;P.current=!1,null==(e=A.current)||e.call(A,!1)}),[]);let E=(0,eN.useMemo)(()=>eQV(o.detail,f.skuValue),[o.detail,f]);(0,eN.useEffect)(()=>{var e;k&&"idle"!==k.status&&!("blocked"===k.status&&k.reasonCodes.includes("BOOKING_DISABLED"))&&(w.current=k),null==(e=D.current)||e.call(D,{configuration:f,quantity:b,initialSelection:w.current})},[f,b,k,o]);let O=JSON.stringify([c,r,o.openId??(null==(t=o.plan)?void 0:t.openId),o.detail.product_id??o.detail.id,o.lineUid,d,b,f.skuValue,k&&eQ2(k),e.customerId]),z=(0,eN.useRef)({revision:O,disabled:e.disabled,os:g,draft:o,priceSource:p});z.current={revision:O,disabled:e.disabled,os:g,draft:o,priceSource:p},(0,eN.useEffect)(()=>{let t=!0;if(j(void 0),(null==k?void 0:k.candidate)&&["selecting","ready"].includes(k.status)&&("tickets"===r||k.ready)&&!k.requiresOrderReconciliation&&k.candidate.date===d&&k.candidate.availabilityContextId===k.contextId&&k.times.some(e=>eQZ(e,k.candidate)&&eQK(e,(k.partySize||0)*k.bookingCount)))return C(void 0),eZj({os:p,product:E.product,skuValue:f.skuValue,candidate:k.candidate,quantity:b,customerId:e.customerId,scopeKey:c}).then(e=>{t&&j(e)}).catch(e=>{t&&C(e instanceof Error?e.message:String(e))}),()=>{t=!1}},[g,p,o,E.product,O,null==k?void 0:k.ready,null==k?void 0:k.status,null==k?void 0:k.contextId,null==k||null==(l=k.candidate)?void 0:l.availabilityContextVersion]);let L=async()=>{var t,l,i,a,n,y,x,_;if(I.current||e.disabled||!S||!(null==k?void 0:k.ready)||!k.candidate||!v.current)return!1;I.current=!0,T(!0),null==(t=A.current)||t.call(A,!0),C(void 0);let w=null==(l=g.getTempOrder)?void 0:l.call(g),N=e=>{var t;return JSON.stringify([null==e?void 0:e.order_id,null==e?void 0:e.external_sale_number,null==e||null==(t=e._extend)?void 0:t.localId])},M=N(w),D=null==(i=e.operationLog)?void 0:i.capture(),L=o.lineUid?"cart_update":"cart_add",R={productId:E.product.product_id??E.product.id,quantity:b,selectedDate:d,startAt:k.candidate.bookingStartAt||k.candidate.startAt,endAt:k.candidate.bookingEndAt||k.candidate.endAt,resourceIds:null==(a=k.requirementSelections)?void 0:a.flatMap(e=>e.resourceIds).slice(0,100)};null==D||D(`${L}_requested`,R);let $=()=>{var e,t;return P.current&&z.current.revision===O&&z.current.os===g&&z.current.draft===o&&z.current.priceSource===p&&(null==(e=g.getTempOrder)?void 0:e.call(g))===w&&N(null==(t=g.getTempOrder)?void 0:t.call(g))===M},F=()=>{if(!$()||z.current.disabled)throw Error(m("Your selection changed. Please review it again.","选择已变化,请重新确认。"))},q=!1;try{F(),await h.assertCanMutate(),F();let t=await eZj({os:p,product:E.product,skuValue:f.skuValue,candidate:k.candidate,quantity:b,customerId:e.customerId,scopeKey:c});if(F(),t.compositeLineTotal!==S.compositeLineTotal)throw j(t),Error(m("The price changed. Please review the new amount and confirm again.","价格已更新,请核对新金额后再次确认。"));let l=(_={product:E.product,skuValue:f.skuValue,quote:t,quantity:b,candidate:k.candidate,role:r,scopeKey:c},ekr({...Hb({productData:_.product,skuValue:_.skuValue,quantity:_.quantity,booking:{startDate:ew()(_.candidate.startAt),endDate:ew()(_.candidate.endAt),startTime:_.candidate.startTime,endTime:_.candidate.endTime,resource:null,capacity:null,duration:null,holderIds:[]},bookingPrice:{status:"ready",requestKey:_.scopeKey,quote:_.quote}},{moduleTypes:["sku","bookingPrice"],requireBookingPrice:!0}),quantity:_.quantity,num:_.quantity,metadata:{..._.product.metadata,venue_booking_role:"tickets"===_.role?"tickets":"party_main",venue_booking_scope_key:_.scopeKey,venue_booking_service_datetime:_.candidate.startAt}})),i=await s.cart.prepareAllergyBeforeCommit({product:l,flowId:(null==(n=o.plan)?void 0:n.openId)||`${c}:${o.lineUid||o.detail.id}`,perFlow:!0});if(F(),!i.allowed)return null==D||D(`${L}_cancelled`,{...R,reason:"allergy_confirmation"}),!1;let a=e.prepareRelated?await e.prepareRelated(k):{};if(F(),await h.assertCanMutate(),F(),null==(y=a.availabilityCommitGuard)||y.call(a),await v.current.commit(l,{...a,availabilityCommitGuard:()=>{var e;F(),null==(e=a.availabilityCommitGuard)||e.call(a)},salesNotes:i.noteDraft?[i.noteDraft]:void 0,allowBookingReprice:!0}),q=!0,null==D||D(`${L}_succeeded`,R),!$())return!0;return s.cart.refreshCartSnapshot(),$()&&await e.onCommitted(),!0}catch(e){if(q)return null==D||D("cart_view_refresh_failed",{...R,...eZC(e)},"warning"),console.warn("[VenueBooking] Selection saved; view refresh failed",e),$()&&C(m("Your selection was saved, but the view could not refresh. Reopen your order to review it.","选择已保存,但页面刷新失败。请重新打开订单核对。")),!0;if(null==D||D(`${L}_failed`,{...R,writeOutcome:"unconfirmed",...eZC(e)},"warning"),$()){try{s.cart.refreshCartSnapshot()}catch(e){console.warn("[VenueBooking] Could not refresh the current selection",e)}C(e instanceof eQW?e.reasonCodes.map(e=>eQL(e,u)).join(" "):e instanceof Error?e.message:String(e))}return!1}finally{I.current=!1,P.current&&(T(!1),null==(x=A.current)||x.call(A,!1))}},R={operationLog:e.operationLog,os:g,mode:"tickets"===r?"ticket":"party",date:d,product:E.product,quantity:b,editingProductLineUid:o.lineUid,initialSelection:o.initialSelection,disabled:!!e.disabled,interactionDisabled:M,onDateChange:e.onDateChange,onSelectionChange:_,locale:u,capacityDisplayContent:null==(a=g.otherParams)||null==(i=a.openData)?void 0:i["interface.capacity_display_content"],resourceSettings:null==(n=s.sales.salesSettings)?void 0:n.reservation.resourceSettings,resourceSettingsReady:"picoding"!==s.sales.salesSettingsSource||!!(s.sales.salesSettings&&!s.sales.salesSettingsError),resourceSettingsFailed:!!s.sales.salesSettingsError,onRetryResourceSettings:s.sales.ensureSalesSettings},$=!!((null==k?void 0:k.ready)&&S&&!k.requiresOrderReconciliation);return{configuration:f,setConfiguration:y,quantity:b,setQuantity:x,prepared:E,selection:k,quote:S,error:N,working:M,revision:O,panelRef:v,bookingProps:R,bookingReady:$,canCommit:$&&!e.disabled&&!M,preview:{product:E.product,configuration:f,quantity:b,date:d,editingProductLineUid:o.lineUid,candidate:null==k?void 0:k.candidate,requirementSelections:(null==k?void 0:k.requirementSelections)??[],selectedResourceDetails:(null==k?void 0:k.selectedResourceDetails)??[],quote:S},commit:L,cancel:()=>{I.current||e.onCancel()}}}let eZP=new Set(["p","div","span","br","strong","b","em","i","u","s","del","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","pre","code","a","img","hr","sub","sup","table","thead","tbody","tfoot","tr","th","td"]),eZA=new Set(["script","style","iframe","object","embed","svg","math","template","input","button","select","textarea"]),eZD=["fontWeight","fontStyle","fontSize","textDecoration","textAlign","color","backgroundColor","whiteSpace"];function eZE(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=null==e?void 0:e.trim();if(l&&(/^https?:\/\//i.test(l)||/^\/(?!\/)/.test(l)||!t&&/^(?:mailto:|tel:|#)/i.test(l)))return l}function eZO(e,t){if(3===e.nodeType)return e.textContent;if(1!==e.nodeType)return null;let l=e.tagName.toLowerCase();if(eZA.has(l))return null;let i=Array.from(e.childNodes,eZO);if(!eZP.has(l))return(0,eB.jsx)(eC().Fragment,{children:i},t);let a={key:t},n={};if(eZD.forEach(t=>{let l=e.style[t];l&&(n[t]=l)}),a.style=n,"a"===l&&(a.href=eZE(e.getAttribute("href")),a.target="_blank",a.rel="noopener noreferrer"),"img"===l){if(a.src=eZE(e.getAttribute("src"),!0),!a.src)return null;a.alt=e.getAttribute("alt")||"",a.loading="lazy"}if("td"===l||"th"===l)for(let[t,l]of[["colspan","colSpan"],["rowspan","rowSpan"]]){let i=Number(e.getAttribute(t));Number.isInteger(i)&&i>0&&i<=1e3&&(a[l]=i)}if("ol"===l&&e.hasAttribute("start")){let t=Number(e.getAttribute("start"));Number.isInteger(t)&&(a.start=t)}return eC().createElement(l,a,...["br","img","hr"].includes(l)?[]:i)}function eZz(e){let{content:t}=e,l=(0,eN.useMemo)(()=>"u"<typeof DOMParser?t:Array.from(new DOMParser().parseFromString(t,"text/html").body.childNodes,eZO),[t]);return(0,eB.jsx)("div",{className:"venue-product-description",children:l})}let eZL=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),eN.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),eZR=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eZL}));eZR.displayName="CheckIcon";let eZ$=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z",opacity:"0.2"}),eN.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z"}))]]),eZF=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eZ$}));eZF.displayName="ArrowSquareOutIcon";let eZq=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,36H48A20,20,0,0,0,28,56v56c0,54.29,26.32,87.22,48.4,105.29,23.71,19.39,47.44,26,48.44,26.29a12.1,12.1,0,0,0,6.32,0c1-.28,24.73-6.9,48.44-26.29,22.08-18.07,48.4-51,48.4-105.29V56A20,20,0,0,0,208,36Zm-4,76c0,35.71-13.09,64.69-38.91,86.15A126.28,126.28,0,0,1,128,219.38a126.14,126.14,0,0,1-37.09-21.23C65.09,176.69,52,147.71,52,112V60H204ZM79.51,144.49a12,12,0,1,1,17-17L112,143l47.51-47.52a12,12,0,0,1,17,17l-56,56a12,12,0,0,1-17,0Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,56v56c0,96-88,120-88,120S40,208,40,112V56a8,8,0,0,1,8-8H208A8,8,0,0,1,216,56Z",opacity:"0.2"}),eN.createElement("path",{d:"M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm-34.32,69.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,42H48A14,14,0,0,0,34,56v56c0,51.94,25.12,83.4,46.2,100.64,22.73,18.6,45.27,24.89,46.22,25.15a6,6,0,0,0,3.16,0c.95-.26,23.49-6.55,46.22-25.15C196.88,195.4,222,163.94,222,112V56A14,14,0,0,0,208,42Zm2,70c0,37.76-13.94,68.39-41.44,91.06A131.17,131.17,0,0,1,128,225.72a130.94,130.94,0,0,1-40.56-22.66C59.94,180.39,46,149.76,46,112V56a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2ZM172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,44H48A12,12,0,0,0,36,56v56c0,51.16,24.73,82.12,45.47,99.1,22.4,18.32,44.55,24.5,45.48,24.76a4,4,0,0,0,2.1,0c.93-.26,23.08-6.44,45.48-24.76,20.74-17,45.47-47.94,45.47-99.1V56A12,12,0,0,0,208,44Zm4,68c0,38.44-14.23,69.63-42.29,92.71A132.45,132.45,0,0,1,128,227.82a132.23,132.23,0,0,1-41.71-23.11C58.23,181.63,44,150.44,44,112V56a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-41.17-10.83a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17Z"}))]]),eZB=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eZq}));function eZH(e){let{title:t,version:l,accepted:i,lang:a,onOpen:n,disabled:r=!1}=e;return(0,eB.jsxs)("button",{type:"button",className:`checkout-agreement ${i?"accepted":""}`,"data-accepted":i,"aria-haspopup":"dialog","aria-label":`${eQA(a,"readAgreement")} \xb7 ${t} \xb7 ${eQA(a,i?"accepted":"notAccepted")}`,onClick:n,disabled:r,children:[(0,eB.jsx)("span",{className:"agreement-state","aria-hidden":"true",children:i&&(0,eB.jsx)(eZR,{size:15,weight:"bold"})}),(0,eB.jsxs)("span",{className:"agreement-copy",children:[(0,eB.jsx)("b",{children:t}),(0,eB.jsxs)("small",{children:[l&&(0,eB.jsxs)(eB.Fragment,{children:[eQA(a,"version")," ",l," \xb7"," "]}),eQA(a,i?"accepted":"notAccepted")]})]}),(0,eB.jsxs)("span",{className:"agreement-open","aria-hidden":"true",children:[(0,eB.jsx)("span",{children:eQA(a,"readAgreement")}),(0,eB.jsx)(eZF,{size:15})]})]})}function eZV(e){let{title:t,version:l,lang:i,children:a,onConfirm:n,onClose:r}=e;return(0,eB.jsxs)(eQu,{wide:!0,className:"agreement-dialog",title:t,closeLabel:eQA(i,"close"),onClose:r,children:[(0,eB.jsxs)("div",{className:"agreement-dialog-content",tabIndex:0,role:"region","aria-label":t,children:[l&&(0,eB.jsxs)("div",{className:"agreement-label",children:[(0,eB.jsx)(eZB,{size:24,"aria-hidden":"true"}),(0,eB.jsxs)("span",{children:[eQA(i,"version")," ",l]})]}),a]}),(0,eB.jsx)("div",{className:"agreement-dialog-footer",children:(0,eB.jsx)(eKQ,{type:"button",className:"button full",onClick:()=>{null==n||n(),r()},children:eQA(i,n?"confirmAgreement":"close")})})]})}function eZU(e){let{name:t,description:l,content:i,lang:a}=e,n=(0,eN.useRef)(null),[r,o]=(0,eN.useState)(!1),[s,d]=(0,eN.useState)(!1),c=eQA(a,"fullProductInfo");return(0,eN.useEffect)(()=>{var e;let t=n.current;if(!t)return;let l=!0,i=()=>{l&&o(t.scrollHeight>t.clientHeight+1)};i();let a="u"<typeof ResizeObserver?void 0:new ResizeObserver(i);return null==a||a.observe(t),window.addEventListener("resize",i),null==(e=document.fonts)||e.ready.then(i),()=>{l=!1,null==a||a.disconnect(),window.removeEventListener("resize",i)}},[l]),(0,eB.jsxs)("div",{className:"product-description",children:[(0,eB.jsx)("p",{className:"product-description-text",ref:n,children:l}),r&&(0,eB.jsx)("button",{type:"button",className:"text-link product-description-more","aria-haspopup":"dialog","aria-label":`${c}: ${t}`,onClick:()=>d(!0),children:c}),s&&(0,eB.jsx)(eZV,{title:t,lang:a,onClose:()=>d(!1),children:i??(0,eB.jsx)("div",{className:"agreement-body",children:(0,eB.jsx)("p",{className:"preserve-lines",children:l})})})]})}function eZY(e){let{detail:t,configuration:l,locale:i,catalogStartingAmount:a,catalogPriceQualifier:n,formatAmount:r}=e,{durationMinutes:o}=(0,eN.useMemo)(()=>eQV(t,{...l.skuValue}),[t,l.skuValue]),s=eKT(t.title,i)||eKT(t.name,i),d=eKT(t.description,i).trim(),c=(0,eN.useMemo)(()=>eKI(d,i),[d,i]),u="string"==typeof t.cover?t.cover.trim():"",p=("string"==typeof a||"number"==typeof a)&&""!==String(a).trim()&&Number.isFinite(Number(a))&&Number(a)>=0;return(0,eB.jsxs)("div",{className:"reservation-intro venue-product-intro",children:[(0,eB.jsx)("div",{className:"venue-product-intro__cover",children:(0,eB.jsx)(nB.PisellImageCard,{dataSource:{src:u||void 0,alt:s},width:"100%",height:"100%",aliWidth:220,fillMode:"cover"})}),(0,eB.jsxs)("div",{className:"venue-product-intro__copy",children:[d&&(0,eB.jsx)(eZU,{name:s,description:c,lang:i,content:(0,eB.jsx)(eZz,{content:d})}),null!=o&&(0,eB.jsxs)("span",{className:"small muted",children:[o," ","zh"===i?"分钟":"minutes"]}),p&&(0,eB.jsxs)("strong",{children:["from"===n&&"zh"!==i&&"From ",r(a),"from"===n&&"zh"===i&&" 起"]})]})]})}eZB.displayName="ShieldCheckIcon";let eZW=(e,t)=>null!=e&&null!=t&&String(e)===String(t),eZG=e=>Array.isArray(e)?e:[],eZK=e=>{if("string"!=typeof e&&"number"!=typeof e||""===String(e).trim())throw Error("The estimated price is unavailable.");let t=new lO(e);if(!t.isFinite())throw Error("The estimated price is unavailable.");return t},eZQ=e=>{let t=Number(e);if(!Number.isSafeInteger(t)||t<=0)throw Error("The selected quantity is invalid.");return t},eZZ=e=>(e||[]).map(e=>{var t;return{...e,required:0,min_quantity:0,max_quantity:0,metadata:{...e.metadata,option_types_config:{...null==(t=e.metadata)?void 0:t.option_types_config,min:0,max:0}},option_item:(e.option_item||[]).map(e=>({...e,min_quantity:0,max_quantity:0}))}});function eZJ(e,t){return eZG(e).reduce((e,l)=>{let i=eZG(t).find(e=>eZW(e.id,l.option_group_id??l.group_id)),a=eZG(null==i?void 0:i.option_item).find(e=>eZW(e.id,l.product_option_item_id??l.option_group_item_id??l.id));if(!a)throw Error("The selected option is unavailable.");return e.add(eZK(a.add_price??a.price).mul(eZQ(l.quantity??l.num)))},new lO(0))}async function eZX(e){var t,l;let i=eZQ(e.quantity),a=(t=e.productDetail,l=e.skuValue,{...t,variant_group:0===Number(l.product_variant_id||0)?[]:t.variant_group,option_group:eZZ(t.option_group),bundle_group:(t.bundle_group||[]).map(e=>({...e,min_quantity:0,max_quantity:0,bundle_item:(e.bundle_item||[]).map(e=>({...e,min_quantity:0,max_quantity:0,option_group:eZZ(e.option_group)}))}))}),n=iS(a,e.skuValue,{requiredOptionValidation:!1,overSold:e.overSold});if(!n)throw Error("The selected options cannot be priced.");let r=Number(n.product_variant_id)>0?eZG(a.variant).find(e=>eZW(e.id,n.product_variant_id)):void 0,o=eZK(r?r.price??r.selling_price??r.base_price:a.price??a.selling_price??a.base_price);if(o.isNegative())throw Error("The estimated price is unavailable.");let s=eZJ(n.option,a.option_group),d=eZG(n.bundle).map(e=>{let t=eZG(a.bundle_group).find(t=>eZW(t.id,e.group_id??e.bundle_group_id)),l=eZG(null==t?void 0:t.bundle_item).find(t=>eZW(t.id,e.id??e.bundle_id));if(!l)throw Error("The selected package item is unavailable.");let i=eZK(l.price??l.custom_price??l.product_price??l.base_price),n=(l.price_type??l.custom_price_type)==="markdown"&&(l.price_type_ext??l.custom_price_type_ext)!=="product_price",r=n?i.abs().toString():i.toString();return{selected:e,markdown:n,base:eZK(r),options:eZJ(e.option,l.option_group),quantity:eZQ(e.quantity??e.num),query:exV({...e,price:r,bundle_selling_price:r,original_price:r,custom_price:r,product_price:r,base_price:r})}}),c=t=>{let l=t.mul(i);if(l.isNegative()||!l.isFinite())throw Error("The estimated price is unavailable.");return{subtotal:l.toString(),pricedAt:e.datetime}};if("catalog"===e.priceBasis)return c(d.reduce((e,t)=>e.add((t.markdown?t.base.abs().negated():t.base).add(t.options).mul(t.quantity)),o.add(s)));let u=await e.calculateProductBookingPrice({product:{...e.productDetail,product_id:a.id,product_variant_id:n.product_variant_id,price:o.toString(),quantity:i,num:i,product_sku:{option:n.option},product_bundle:d.map(e=>e.query)},datetime:e.datetime,channel:"online_ordering",...null!=e.customerId?{customer_id:e.customerId}:{}});if(!u||!eZW(u.product_id,a.id)||!eZW(u.product_variant_id??0,n.product_variant_id??0)||eZQ(u.quantity)!==i)throw Error("The returned estimate does not match the selected product.");let p=eZK(u.unit_price);if(p.isNegative())throw Error("The estimated price is unavailable.");let m=p.add(s);for(let e of d){let t=eZG(u.product_bundle).find(t=>eZW(t.bundle_id,e.selected.id??e.selected.bundle_id)&&eZW(t.bundle_group_id??t.group_id,e.selected.bundle_group_id??e.selected.group_id)&&eZW(t.bundle_product_id,e.query.bundle_product_id)&&eZW(t.bundle_variant_id??0,e.query.bundle_variant_id??0));if(!t)throw Error("The selected package item could not be priced.");let l=eZK(t.unit_price);m=m.add((e.markdown?l.abs().negated():l).add(e.options).mul(e.quantity))}return c(m)}function eZ0(e){let{enabled:t,openId:l,scopeKey:i,sessionId:a,productDetail:n,skuValue:r,quantity:o=1,overSold:s,priceBasis:d="current-time",timeZone:c,customerId:u,os:p}=e,m=ia(r),g=(0,eN.useMemo)(()=>t&&l&&n&&r?{openId:l,scopeKey:i,sessionId:a,productDetail:n,skuValue:r,quantity:o,overSold:s,priceBasis:d,timeZone:c,customerId:u,os:p}:void 0,[t,l,i,a,n,m,o,s,d,c,u,p]),h=(0,eN.useRef)(g);h.current=g;let[v,f]=(0,eN.useState)();return((0,eN.useEffect)(()=>{if(!g)return;let e=!0,t=()=>e&&h.current===g;return f({request:g,value:{status:"loading"}}),(async()=>{try{if("catalog"!==g.priceBasis&&"function"!=typeof g.os.calculateProductBookingPrice)throw Error("Pricing is unavailable.");let e=await eZX({productDetail:g.productDetail,skuValue:g.skuValue,quantity:g.quantity,overSold:g.overSold,priceBasis:g.priceBasis,datetime:e_d(g.timeZone),customerId:g.customerId,calculateProductBookingPrice:e=>g.os.calculateProductBookingPrice(e)});t()&&f({request:g,value:{status:"ready",...e}})}catch{t()&&f({request:g,value:{status:"unavailable"}})}})(),()=>{e=!1}},[g]),g)?(null==v?void 0:v.request)===g?v.value:{status:"loading"}:{status:"idle"}}function eZ2(e){var t,l,i,a,n;let{mode:r,draft:o,locale:s}=e,d=(e,t)=>"zh"===s?t:e,c=eZI(e),u=eKn(),{configuration:p,setConfiguration:m,quantity:g,setQuantity:h,quote:v,error:f,working:y,revision:b,commit:x}=c,k="tickets"===r&&(null==(t=o.plan)?void 0:t.hasConfiguration)?o.plan.productDetail:void 0,_=lW((null==(i=e.skuOptions)||null==(l=i.config)?void 0:l.overSold)??o.detail.over_sold),w=(0,eN.useMemo)(()=>!!(k&&iw(k,p.skuValue,{requiredOptionValidation:e.requiredOptionValidation,overSold:_})),[k,p.skuValue,e.requiredOptionValidation,_]),S=eZ0({enabled:w,openId:null==(a=o.plan)?void 0:a.openId,scopeKey:e.scopeKey,productDetail:k,skuValue:p.skuValue,quantity:g,overSold:_,priceBasis:"catalog",timeZone:null==u?void 0:u.timeZone,customerId:e.customerId,os:e.priceSource}),j=e.formatAmount||(t=>{var l,i;return Yg((null==(i=e.context.sales.bookingTicket)||null==(l=i.getTempOrder)?void 0:l.call(i))??e.context.cart.tempOrder,t)}),N=o.catalogStartingAmount,C="tickets"===r&&null!=N&&""!==String(N).trim()&&Number.isFinite(Number(N))?j(new lO(N).times(g).toString()):void 0,M=void 0===C?"—":"zh"===s?`${C} 起`:`From ${C}`,T=M;w&&"ready"===S.status?T=j(S.subtotal):w&&"loading"===S.status&&(T="—");let I=v?j(v.compositeLineTotal):k?T:"from"===o.catalogPriceQualifier?M:C??"—",P=t=>(0,eB.jsx)(eZw,{ref:c.panelRef,...c.bookingProps,scrollContainer:t,renderDatePicker:e.renderDatePicker,actionTarget:()=>{var e;return(null==t||null==(e=t.closest('[role="dialog"]'))?void 0:e.querySelector(".booking-config-actions .booking-primary-action"))||null}}),A=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"tickets"!==r||o.lineUid?null:(0,eB.jsxs)("div",{className:"reservation-quantity",children:[(0,eB.jsx)("span",{children:d("Number","数量")}),(0,eB.jsx)(z0,{className:"booking-ticket-quantity",variant:"capsule",min:1,step:1,value:g,disabled:t||y||e.disabled,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,onChange:l=>{!t&&!y&&!e.disabled&&Number.isSafeInteger(l)&&l>=1&&h(l)}})]})},D=(0,eB.jsxs)("div",{className:"venue-booking-sales__booking-footer",children:[A(),(0,eB.jsxs)("div",{className:"tickets"===r?"reservation-subtotal":"party-total","aria-live":"polite",children:[(0,eB.jsx)("span",{children:d("Subtotal","小计")}),(0,eB.jsx)("strong",{children:I})]})]});return"tickets"===r&&o.plan?(0,eB.jsx)(eQO,{plan:o.plan,title:eKT(o.detail.title||o.detail.name,s)||d("Play admission","游玩门票"),summary:(0,eB.jsx)(eZY,{detail:o.detail,configuration:p,locale:s,catalogStartingAmount:o.catalogStartingAmount,catalogPriceQualifier:o.catalogPriceQualifier,formatAmount:j}),configuration:p,onConfigurationChange:m,skuOptions:{...e.skuOptions,priceFormatter:(null==(n=e.skuOptions)?void 0:n.priceFormatter)||(e=>String(j(e)))},requiredOptionValidation:e.requiredOptionValidation,onCancel:c.cancel,locale:s,busy:y||e.disabled,selectionRevision:b,error:f,renderBooking:e=>{let{scrollContainer:t}=e;return P(t)},footerContent:e=>{let{busy:t}=e;return A(t)},configurationFooter:{label:d("Estimated subtotal","预计小计"),amount:(0,eB.jsx)("span",{role:"status","aria-live":"polite",children:T})},bookingActionAmount:I,bookingSubtotalLabel:!v&&w?d("Estimated subtotal","预计小计"):void 0,bookingReady:c.bookingReady,onConfirm:x}):(0,eB.jsxs)("section",{className:"venue-booking-sales__party-selection","aria-label":d("Choose your room and time","选择房间和时间"),children:[P(),f&&(0,eB.jsx)(eM.Alert,{type:"error",message:f,showIcon:!0}),D,(0,eB.jsxs)("div",{className:"venue-booking-sales__actions",children:[(0,eB.jsx)(eKQ,{secondary:!0,disabled:y||e.disabled,onClick:c.cancel,children:d("Cancel changes","取消更改")}),(0,eB.jsx)(eKQ,{busy:y,disabled:e.disabled||!c.bookingReady,onClick:()=>void x(),children:d("Save Party selection","保存 Party 选择")})]})]})}let eZ1=new Set,eZ4=0,eZ3=new WeakMap,eZ8=e=>{var t,l,i,a;let n=e=>"string"==typeof e&&e.trim()?e.trim():void 0;if((null==(t=e.otherParams)?void 0:t.businessCode)==="venue_booking"){let t=n(e.otherParams.previousVenueCacheId);if(t)return t}try{return n(null==(l=e.getCacheId)?void 0:l.call(e))||n(null==(i=e.otherParams)?void 0:i.cacheId)}catch{return n(null==(a=e.otherParams)?void 0:a.cacheId)}},eZ6=e=>null!=e&&""!==String(e).trim()&&"0"!==String(e).trim(),eZ5=e=>{var t;if(!e||"payment_pending"!==String(e.status||"").trim().toLowerCase()||!eZ6(e.voucher_id)||eZ6(e.order_payment_id))return!1;let l=null==(t=e.metadata)?void 0:t.transactions;return!Array.isArray(l)||!l.some(e=>eZ6(null==e?void 0:e.number))},eZ7=e=>{var t,l;return eZ6(null==e?void 0:e.order_id)||1===Number(null==e?void 0:e.need_sync)||[null==e?void 0:e.paid_amount,null==e||null==(t=e.summary)?void 0:t.order_paid_amount,null==e||null==(l=e.summary)?void 0:l.customer_paid_amount].some(e=>Number.isFinite(Number(e))&&Number(e)>0)||Array.isArray(null==e?void 0:e.payments)&&e.payments.some(e=>!eZ5(e))},eZ9=e=>e.listeners.forEach(e=>e()),eJe=e=>{e.active=!1,e.value={...e.value,ready:!1},eZ9(e)},eJt=function(e,t,l,i){let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(e.retiring)return e.retiring;let n=()=>t.orderOwner===e&&t.orderSessionId===l,r=()=>null==t.orderOwner&&(!t.owner||t.owner===e);if(e.retired)return Promise.resolve((n()||r())&&i());if(!e.retireOrder)return Promise.resolve(!1);let o=t.tail.then(async()=>{var t,o;if(a&&e.refs>0||e.sessionId!==l||(await (null==(t=e.waitForRetire)?void 0:t.call(e)),a&&e.refs>0||!i()||e.sessionId!==l))return!1;if(!n())return!!r()&&(e.retired=!0,!0);if(eJe(e),e.storageKey)try{(null==(o=JSON.parse(sessionStorage.getItem(e.storageKey)||"null"))?void 0:o.sessionId)===l&&sessionStorage.removeItem(e.storageKey)}catch{}return await e.retireOrder(),!!n()&&(e.order=e.source.getTempOrder(),e.discarded=!0,e.retired=!0,!0)});e.retiring=o;let s=()=>{e.retiring===o&&(e.retiring=void 0)};return t.tail=o.then(s,s),o};class eJl extends Error{constructor(e){super(e),e2(this,"code",void 0),this.code=e}}let eJi=e=>{throw new eJl(e)},eJa=e=>Array.isArray(e)?e.filter(Boolean):[],eJn=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(null==e||""===e)return t;let l=Number(e);return Number.isSafeInteger(l)&&l>=0?l:eJi("PREVIEW_INVALID_SKU_BOUNDS")},eJr=e=>{++e.work>15e4&&eJi("PREVIEW_COMPLEX_CONFIGURATION")};function eJo(e){let t,l;for(let i of e)0===i.capacity?(!t||i.quantity<t.quantity)&&(t=i):(!l||i.capacity<l.capacity||i.capacity===l.capacity&&i.quantity<l.quantity)&&(l=i);return[t,l].filter(e=>!!e)}function eJs(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,l=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(l||!lW(e.is_track)||lW(e.over_sold))return 256;let i=Number(e.stock_quantity);return Number.isFinite(i)&&i>0?Math.max(0,Math.floor(i/t)):0}function eJd(e){var t,l,i,a,n,r;let{group:o,kind:s,policy:d,budget:c,multiplier:u}=e,p="bundle"===s||lW(o.is_multiple),m="option"===s&&p&&lW(null==(t=o.metadata)?void 0:t.advanced_settings_enabled),g=d.requiredOptionValidation,h=g&&m?eJn(null==(i=o.metadata)||null==(l=i.option_types_config)?void 0:l.min):0,v=m?eJn(null==(n=o.metadata)||null==(a=n.option_types_config)?void 0:a.max):0,f=g?p?eJn(o.min_quantity):+!!lW(o.required):0,y=p?eJn(o.max_quantity):0;(y&&f>y||v&&h>v)&&eJi("PREVIEW_INVALID_SKU_BOUNDS");let b=e.items.filter(e=>l0(e,{overSold:d.overSold})),x=b.map(e=>Math.max(1,eJn(e.min_quantity)));if(!p){if(!f)return[{rows:[],capacity:0,quantity:0}];for(let t=0;t<b.length;t++){eJr(c);let l=x[t],i=eJn(b[t].max_quantity);if(l>256&&eJi("PREVIEW_COMPLEX_CONFIGURATION"),i&&l>i||l>eJs(b[t],u,d.overSold))continue;let a=e.makeRow(b[t],l);if(a)return[{rows:[a],capacity:(null==(r=e.counted)?void 0:r.call(e,b[t]))?l:0,quantity:l}]}return[]}if(0===f&&0===h&&!b.some(t=>{var l;return null==(l=e.counted)?void 0:l.call(e,t)}))return[{rows:[],capacity:0,quantity:0}];let k=Math.max(1,...x),_=Math.max(1,Math.min(f+x.reduce((e,t)=>e+t,0),Math.max(f,h*k)+2*k)),w=y?Math.min(_,y):_;(w>256||h>256)&&eJi("PREVIEW_COMPLEX_CONFIGURATION");let S=!p||h>0||v>0,j=new Map([["0:0",[{rows:[],capacity:0,quantity:0}]]]);for(let t=0;t<b.length;t++){let l=b[t],i=x[t],a=Math.min(w,eJn(l.max_quantity)||w,eJs(l,u,d.overSold)),n=new Map,r=new Map;for(let[t,o]of j){let[s,d]=t.split(":").map(Number),u=[0];if(p||0===d)for(let e=i;e<=a&&s+e<=w;e++)u.push(e);for(let t of u){let i;eJr(c);let a=d+(t&&S?1:0);if(v&&a>v||t&&(n.has(t)||n.set(t,e.makeRow(l,t)),!(i=n.get(t))))continue;let u=`${s+t}:${a}`,p=o.map(a=>{var n;return{rows:i?[...a.rows,i]:a.rows,quantity:s+t,capacity:a.capacity+((null==(n=e.counted)?void 0:n.call(e,l))?t:0)}});r.set(u,eJo([...r.get(u)||[],...p]))}}j=r}return eJo([...j.entries()].flatMap(e=>{let[t,l]=e,[i,a]=t.split(":").map(Number);return i>=f&&a>=h?l:[]}))}function eJc(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=[];for(let n of eJa(e.option_group).filter(lJ)){let r=eJd({group:n,items:eJa(n.option_item),kind:"option",policy:t,budget:l,multiplier:i,makeRow:(t,l)=>({...t,id:t.id,product_option_item_id:t.id,option_group_id:n.id,product_id:e.id,quantity:l,num:l})});if(!r.length)return;a.push(...r[0].rows)}return a}function eJu(e,t,l){var i;let a=(null==(i=e._data)?void 0:i.capacitys)??e.capacity,n=(null==a?void 0:a.type)==="package"?eJa(a.package).map(e=>e.product_id):[],r=[{rows:[],capacity:0,quantity:0}];for(let i of eJa(e.bundle_group).filter(lJ)){let e=eJd({group:i,items:eJa(i.bundle_item),kind:"bundle",policy:t,budget:l,multiplier:1,counted:e=>n.includes(e.bundle_product_id),makeRow:(e,a)=>{let n=eJc(e,t,l,a);if(n)return{...e,id:e.id,group_id:i.id,_bundle_product_id:e.bundle_product_id,quantity:a,num:a,option:n}}});if(!e.length)return[];r=eJo(r.flatMap(t=>e.map(e=>({rows:[...t.rows,...e.rows],capacity:t.capacity+e.capacity,quantity:t.quantity+e.quantity}))))}return r}function eJp(e,t){if(t.overSold)return;let l=new Set;for(let t of eJa(e.bundle_group).filter(lJ))for(let e of eJa(t.bundle_item).filter(lJ)){if(lW(e.is_track)&&!lW(e.over_sold)){let t=Number(e.bundle_variant_id)>0?`variant:${e.bundle_variant_id}`:`product:${e.bundle_product_id}`;(null==e.bundle_product_id||l.has(t))&&eJi("PREVIEW_SHARED_STOCK_CONFIGURATION"),l.add(t)}1!==eJn(e.max_quantity)&&1!==eJn(t.max_quantity)&&eJa(e.option_group).filter(lJ).some(e=>eJa(e.option_item).some(e=>lJ(e)&&lW(e.is_track)&&!lW(e.over_sold)))&&eJi("PREVIEW_SPLIT_BUNDLE_STOCK_CONFIGURATION")}}let eJm=["duration","service_duration","product_resource","capacity","session","schedule","schedules"];function eJg(e){for(let t of[...eJa(e.variant),...eJa(e.option_group).flatMap(e=>eJa(e.option_item))])for(let l of eJm)null!=t[l]&&JSON.stringify(t[l])!==JSON.stringify(e[l])&&eJi("PREVIEW_SKU_BOOKING_OVERRIDE_UNSUPPORTED")}async function eJh(e,t){let l={available:!1,availability:{}},i=()=>{var e;return(null==(e=t.isCurrent)?void 0:e.call(t))!==!1};for(let a of t.products){if(!i())break;let n=a.id??a.product_id;if(!Number.isSafeInteger(Number(n))||0>=Number(n)){l.availability[String(n)]={available:!1,reasons:["INVALID_PRODUCT_ID"]};continue}if(!t.catalogParams.menu_list_ids.length)throw new eJl("PREVIEW_MENU_CONFIGURATION_REQUIRED");let r=await t.queries.queryCatalogProductDetail({...t.catalogParams,product_id:Number(n),schedule_date:t.date,with_count:["bundleGroup","optionGroup"],with_schedule:1});if(!i())break;if(!r){l.availability[String(n)]={available:!1,reasons:["PRODUCT_NOT_IN_MENU"]};continue}if(String(r.id??r.product_id)!==String(n)){l.availability[String(n)]={available:!1,reasons:["PRODUCT_MISMATCH"]};continue}let o=function(e,t){try{let l;t.runtimePolicy.settings||eJi("PREVIEW_SALES_SETTINGS_REQUIRED");let i=iM({productDetail:e,requestedProductId:e.id??e.product_id,completeness:"complete"}),a=Number(e.variant_count);if(lW(e.is_variant)&&(!eJa(e.variant).length||Number.isSafeInteger(a)&&a>eJa(e.variant).length)&&("ready"===i.status||i.issues.length&&i.issues.every(e=>"MISSING_VARIANTS"===e.code&&"variant"===e.path))){let l=function(e,t){if(!lJ(e)||!Object.values(eQU(e)).some(e=>e.length>0))return[];eJg(e),eJp(e,t);let l={work:0},i=eJc(e,t,l),a=eJu(e,t,l);if(!i||!a.length)return[];let n=[];for(let t of a){let l=eQV(e,{option:i,bundle:t.rows}),a=e.duration??e.service_duration;!l.reasonCodes.length&&l.partySize&&(l.durationMinutes||(null==a?void 0:a.type)==="flexible")&&n.push({product:l.product,partySize:l.partySize,durationMinutes:l.durationMinutes})}return n}(e,{...t,overSold:t.overSold&&lW(e.over_sold)});return l.length?{status:"requires-configuration",candidates:l,reasonCodes:[]}:{status:"configuration-error",candidates:[],reasonCodes:["PREVIEW_CONFIGURATION_UNAVAILABLE"]}}if("invalid"===i.status)return{status:"configuration-error",candidates:[],reasonCodes:["PREVIEW_CONFIGURATION_UNAVAILABLE",...new Set(i.issues.map(e=>e.code))]};let n=i.productDetail;t={...t,overSold:t.overSold&&lW(n.over_sold)},eJg(n),eJp(n,t);let r={work:0},o=eJc(n,t,r),s=eJu(n,t,r);if(!o||!s.length)return{status:"unavailable",candidates:[],reasonCodes:["NO_SELLABLE_SKU"]};let d=eJa(n.variant_group).some(lJ)?eJa(n.variant).filter(e=>l0(e,{overSold:t.overSold})):[void 0],c=new Set;for(let e of d)for(let i of s){if(eJr(r),1>eJs(e||n,1,t.overSold))continue;let a=iw(n,{product_id:Number(n.id),product_variant_id:Number((null==e?void 0:e.id)||0),option:o,bundle:i.rows},t);if(!a||iV({data:function(e,t){if(!t)return e;let l=e=>eJa(e).map(e=>({...e,option_item:eJa(e.option_item).map(e=>({...e,over_sold:1}))}));return{...e,over_sold:1,variant:eJa(e.variant).map(e=>({...e,over_sold:1})),option_group:l(e.option_group),bundle_group:eJa(e.bundle_group).map(e=>({...e,bundle_item:eJa(e.bundle_item).map(e=>({...e,over_sold:1,option_group:l(e.option_group)}))}))}}(n,t.overSold),value:a,runtimePolicy:{...t.runtimePolicy,platform:"pc"}}).shouldBlock)continue;let s=eQV(n,a);if(s.reasonCodes.length||!s.partySize){s.reasonCodes.forEach(e=>c.add(e));continue}(!l||s.partySize<l.partySize)&&(l={product:s.product,skuValue:a,partySize:s.partySize,durationMinutes:s.durationMinutes})}if(l)return{status:"ready",candidates:[l],reasonCodes:[]};return{status:c.size?"configuration-error":"unavailable",candidates:[],reasonCodes:c.size?[...c]:["NO_SELLABLE_SKU"]}}catch(e){if(e instanceof eJl)return{status:"configuration-error",candidates:[],reasonCodes:["PREVIEW_CONFIGURATION_UNAVAILABLE",e.code]};throw e}}(r,await t.resolvePolicy(r));if(!i())break;let s={available:!1,reasons:[...o.reasonCodes]};if(l.availability[String(n)]=s,"ready"===o.status||"requires-configuration"===o.status){for(let l of o.candidates){let a;try{if(a=await eQ6({os:e,mode:t.mode||"ticket",date:t.date,product:l.product,quantity:1},{projectionDateRange:t.projectionDateRange}),!i())break;let n=a.times.filter(e=>eQK(e,l.partySize));if(n.some(e=>{let i=e.requirementGroups||[];return i.every(e=>1>=Math.max(+!!e.required,e.min||0)&&(!(e.required||e.min>0)||e.max>=1&&e.options.some(e=>eQK(e,l.partySize))))&&("party"!==t.mode||i.some(e=>e.max>=1&&e.options.some(e=>eQK(e,l.partySize))))})){"requires-configuration"===o.status?s.requiresConfiguration=!0:s.available=!0,s.reasons=[];break}s.reasons.push(...a.times.flatMap(e=>e.reasonCodes||[])),s.reasons.length||s.reasons.push(n.length?"UNSUPPORTED_RESOURCE_GROUP":"NO_AVAILABLE_BOOKING")}catch(e){if(e instanceof eQW)s.reasons.push(...e.reasonCodes);else throw e}finally{eQ3(e,a)}}if(s.reasons=[...new Set(s.reasons)],l.available||(l.available=s.available),l.requiresConfiguration||(l.requiresConfiguration=s.requiresConfiguration),(l.available||l.requiresConfiguration)&&t.stopAtFirstAvailable)break}}return l}let eJv=e=>{let t=e.id??e.product_id;return"number"==typeof t?Number.isFinite(t)?String(t):void 0:"string"==typeof t&&t.trim()?t:void 0};function eJf(e){let{os:t,ready:l,catalog:i,date:a,datetime:n,customerId:r,scopeKey:o,retail:s=!1,retailTimeZone:d,revision:c=0,resolvePolicy:u,mode:p="ticket",queries:m,onRetry:g,projectionDateRange:h,operationLog:v}=e,[f,y]=(0,eN.useState)(0),b=(0,eN.useRef)(0),x=(0,eN.useRef)(v);x.current=v;let k=(0,eN.useRef)(),_=JSON.stringify((null==i?void 0:i.menuListIds)||[]),w=s?void 0:a,S=s?void 0:n,j=s||null==h?void 0:h.startDate,N=s||null==h?void 0:h.endDate,C=(0,eN.useMemo)(()=>({}),[t,_,w,S,r,o,s,d,p]),M=(0,eN.useMemo)(()=>({identity:C,ready:l}),[C,l,f,c,u,m,j,N]),[T,I]=(0,eN.useState)(),P=e=>l&&(null==e?void 0:e.request.identity)===C?e.state.products:[];return(0,eN.useEffect)(()=>{let e,n,o=++b.current,c=!1;if(I(e=>({request:M,state:{products:P(e),loading:!0,availability:{}}})),!l){k.current=void 0;return}try{var g;e=null==(g=x.current)?void 0:g.capture()}catch{}return(async()=>{if(!(null==i?void 0:i.menuListIds.length))return void I({request:M,state:{products:[],availability:{},loading:!1}});if("function"!=typeof(null==m?void 0:m.queryCatalogSnapshot))throw Error("The booking catalog service is unavailable. Please update the booking service.");n=s?e_d(d):S;let l=await m.queryCatalogSnapshot({menu_list_ids:[...i.menuListIds],schedule_date:s?n.slice(0,10):w,...n?{schedule_datetime:n}:{},...r?{customer_id:Number(r)}:{}});if(c||b.current!==o)return;let g={};if(!s&&l.length){if(!u)throw Error("The booking sales settings are unavailable.");Object.assign(g,(await eJh(t,{products:l,date:a,mode:p,resolvePolicy:u,queries:m,...j&&N?{projectionDateRange:{startDate:j,endDate:N}}:{},catalogParams:{menu_list_ids:i.menuListIds,...r?{customer_id:r}:{}},isCurrent:()=>!c&&b.current===o})).availability)}c||b.current!==o||(I({request:M,state:{products:l,availability:g,loading:!1,...s?{pricingDatetime:n}:{}}}),((t,l)=>{if(e)try{let r=function(e){let t=e.menuListIds.length>100,l=0,i=new Set,a=[],n={available:{count:0,ids:[]},unavailable:{count:0,ids:[]},requiresConfiguration:{count:0,ids:[]},unknown:{count:0,ids:[]}},r=[];for(let s of e.products){var o;let d=eJv(s);if(void 0===d){l++;continue}if(i.has(d))continue;i.add(d),a.length<100?a.push(d):t=!0;let c="main"===e.poolRole?null==(o=e.availability)?void 0:o[d]:void 0,u=(null==c?void 0:c.requiresConfiguration)?"requiresConfiguration":(null==c?void 0:c.available)===!0?"available":(null==c?void 0:c.available)===!1?"unavailable":"unknown",p=n[u];if(p.count++,p.ids.length<100?p.ids.push(d):t=!0,"unavailable"===u&&r.length<100){let e=(null==c?void 0:c.reasons)||[],l=[];for(let i of e){if(3===l.length){t=!0;break}if("string"==typeof i&&i){if(!/^[a-z][a-z0-9_:-]*$/i.test(i)){t=!0;continue}i.length>80&&(t=!0),l.push(i.slice(0,80))}}r.push({productId:d,reasonCodes:l})}}return{poolRole:e.poolRole,requestedDate:e.requestedDate,...e.pricingDatetime?{pricingDatetime:e.pricingDatetime}:{},menuCount:e.menuListIds.length,menuListIds:e.menuListIds.slice(0,100),productsCount:e.products.length,productIdCount:i.size,productIds:a,unidentifiedProductsCount:l,availabilityChecked:"main"===e.poolRole,availableCount:n.available.count,availableProductIds:n.available.ids,unavailableCount:n.unavailable.count,unavailableProductIds:n.unavailable.ids,requiresConfigurationCount:n.requiresConfiguration.count,requiresConfigurationProductIds:n.requiresConfiguration.ids,unknownCount:n.unknown.count,unknownProductIds:n.unknown.ids,unavailableReasons:r,truncated:t}}({poolRole:s?"extras":"main",requestedDate:s?n.slice(0,10):a,pricingDatetime:n,menuListIds:(null==i?void 0:i.menuListIds)||[],products:t,availability:l}),o=JSON.stringify(r),d=k.current;if(!r.truncated&&(null==d?void 0:d.identity)===C&&d.queries===m&&d.key===o)return;e("catalog_resolved",r),k.current={identity:C,queries:m,key:o}}catch{}})(l,g))})().catch(t=>{if(!c&&b.current===o){I(e=>({request:M,state:{products:P(e),availability:{},loading:!1,error:t instanceof Error?t.message:String(t)}})),k.current=void 0;try{null==e||e("catalog_failed",{poolRole:s?"extras":"main",requestedDate:s?null==n?void 0:n.slice(0,10):a,...n?{pricingDatetime:n}:{},menuListIds:((null==i?void 0:i.menuListIds)||[]).slice(0,100),errorCode:t&&"object"==typeof t&&"code"in t?String(t.code).slice(0,80):void 0,errorMessage:(t instanceof Error?t.message:String(t)).slice(0,300)},"error")}catch{}}}),()=>{c=!0}},[M]),{...(null==T?void 0:T.request)===M?T.state:{products:P(T),loading:!0,availability:{}},retry:g||(()=>{var e;null==(e=m.retry)||e.call(m),y(e=>e+1)})}}function eJy(e){var t;if(!lJ(e)||lW(e.is_grey)||["draft","pending","archived"].includes(e.status))return!1;let l=lG(null==(t=e.item_rule_limit)?void 0:t.remainingMax);if(void 0!==l&&l<1)return!1;let i=lW(e.over_sold),a=e=>{let t=lG(e.stock_quantity)??lG(e.sum_stock);return!lW(e.is_track)||i||lW(e.over_sold)||void 0===t||t>0},n=e.variant;return a(e)&&(!Array.isArray(n)||!n.length||n.some(e=>lJ(e)&&a(e)))}let eJb=(e,t)=>e.length===t.length&&e.every((e,l)=>e===t[l]);function eJx(e){let t=e.menuListIds.join(","),l=(0,eN.useMemo)(()=>{if(!e.sessionId||!t||!e.os.createVenueCatalogSession){let e=async()=>{throw Error("The local booking catalog is unavailable. Please update the booking service.")};return{queryCatalogSnapshot:e,queryCatalogProductDetail:e,prepareProductDetail:e,calculateProductBookingPrice:e,dispose(){}}}return e.os.createVenueCatalogSession({menu_list_ids:[...e.menuListIds],poolRole:e.poolRole,sessionKey:e.sessionId})},[e.os,e.scopeKey,e.sessionId,t,e.poolRole]);return(0,eN.useEffect)(()=>()=>l.dispose(),[l]),l}function eJk(e){if(!e||!eQw(e.startDate)||!eQw(e.endDate))return[];let t=(Date.parse(`${e.endDate}T12:00:00Z`)-Date.parse(`${e.startDate}T12:00:00Z`))/864e5+1;return!Number.isSafeInteger(t)||t<1||t>32?[]:Array.from({length:t},(t,l)=>eQj(e.startDate,l))}let eJ_=(e,t)=>Array.isArray(e)?e.find(e=>Number(null==e?void 0:e.id)===Number(t)):void 0;function eJw(e,t,l){let i=e||{...l,id:Number(null==l?void 0:l.product_id)},a=t&&e?eJ_(e.variant,t):void 0,n=l&&Number(l.product_id)===Number(i.id)&&Number(l.product_variant_id)===Number(t),r=B2(a);if(!a&&t&&n){var o,s;if(Number(null==(o=l.metadata)?void 0:o.venue_extra_holder_variant_id)===t)r=B2(l);else{let e=(null==(s=l.metadata)?void 0:s.origin)??l._origin;r=B2(eJ_(null==e?void 0:e.variant,t))}}return r?{source:{...i,holder_config:r},overrideVariantId:t||null}:{source:i,overrideVariantId:null}}function eJS(e,t,l){return eJw(e,t,l).source}function eJj(e,t,l,i,a,n){let r=B4(eJS(e,t,n)),o=i.filter(e=>"form"===e.holder_type);if(!r.enabled)return!o.length;let s=new Set(o.map(e=>Number(e.holder_id)));return o.every(e=>{var t,l;return"order_detail"===e.relation_model&&Number.isSafeInteger(Number(e.holder_id))&&Number(e.holder_id)>0&&((null==(t=e.metadata)?void 0:t.form_id)==null||String(e.metadata.form_id)===String(r.formId))&&((null==(l=e.metadata)?void 0:l.customer_id)==null||String(e.metadata.customer_id)===String(a))})&&s.size===o.length&&s.size<=l&&(!r.required||s.size===l)}class eJN extends Error{constructor(e,t){super(t),e2(this,"code",void 0),this.code=e,this.name="PartyExtraError"}}let eJC=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??"")};function eJM(e,t){if("tickets"!==t.mode){let l;return(l=t.parentLineUid)?e.filter(e=>{var t;return(null==(t=e.metadata)?void 0:t.venue_booking_role)==="party_extra"&&String(e.metadata.venue_booking_parent_uid??"")===l}):[]}return e.filter(e=>{var l;return(null==(l=e.metadata)?void 0:l.venue_booking_role)==="tickets_extra"&&e.metadata.venue_booking_scope_key===t.scopeKey})}function eJT(e){let{schedule_date:t,schedule_datetime:l,...i}=e.productLoadParams;return JSON.stringify([e.mode??"party",e.scopeKey,"tickets"===e.mode?null:e.parentLineUid,e.timeZone,e.customerId??null,i])}function eJI(e,t){return{mode:e.mode,timeZone:e.timeZone,parentLineUid:e.parentLineUid,serviceDatetime:e.serviceDatetime,scopeKey:e.scopeKey,customerId:e.customerId,productLoadParams:e.productLoadParams,...t}}function eJP(e,t){let l=eJI(e,t);return{...l,..."tickets"===l.mode?{parentLineUid:void 0}:{},serviceDatetime:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;try{return e_d(e,t)}catch(e){throw new eJN("TIMEZONE_REQUIRED",e instanceof Error?e.message:"The venue timezone is invalid.")}}(l.timeZone)}}function eJA(e,t,l){return{code:e instanceof eJN?e.code:"EXTRA_UNAVAILABLE",message:e instanceof Error?e.message:"Unable to prepare this extra. Please try again.",productId:l??((null==t?void 0:t.product_id)==null?void 0:Number(t.product_id)),...t?{lineUid:eJC(t),line:t}:{}}}function eJD(e){if(!Number.isSafeInteger(e)||e<=0)throw new eJN("INVALID_QUANTITY","Choose a valid quantity.");return e}function eJE(e){let t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(e=>({product_option_item_id:e.product_option_item_id??e.option_group_item_id??e.id,option_group_id:e.option_group_id,num:e.num??e.quantity??1}))};return{product_id:Number(e.product_id),product_variant_id:Number(e.product_variant_id??0),product_option_string:e.product_option_string,option:t(e.option),bundle:(e.bundle||[]).map(e=>{var l;return{id:e.id??e.bundle_id??e.bundle_item_id,group_id:e.group_id??e.bundle_group_id,bundle_variant_id:e.bundle_variant_id??e.variant_id,num:e.num??e.quantity??1,option:t(e.option??(null==(l=e.product_sku)?void 0:l.option))}})}}function eJO(e){var t;return eJE({product_id:Number(e.product_id),product_variant_id:Number(e.product_variant_id??0),option:(null==(t=e.product_sku)?void 0:t.option)??[],bundle:e.product_bundle??[]})}let eJz=e=>JSON.stringify([String(e.group_id??e.bundle_group_id??""),String(e.id??e.bundle_id??e.bundle_item_id??""),String(e.bundle_variant_id??e.variant_id??0)]);function eJL(e){var t,l;let i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(e=>[String(e.option_group_id??""),String(e.product_option_item_id??e.option_group_item_id??e.id??""),Number(e.num??e.quantity??1),Number(e.original_price??e.price??e.add_price??0)]).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t)))},a=(e.product_bundle??[]).map(e=>{var t;return[String(e.group_id??e.bundle_group_id??""),String(e.id??e.bundle_id??e.bundle_item_id??""),String(e.bundle_variant_id??e.variant_id??0),Number(e.num??e.quantity??1),String(e.price_type??e.custom_price_type??""),String(e.price_type_ext??""),Number(e.original_price??e.product_price??e.price??0),i(e.option??(null==(t=e.product_sku)?void 0:t.option))]}).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t)));return JSON.stringify([Number(e.num),Number((null==(t=e.metadata)?void 0:t.main_product_original_price)??e.original_price),i(null==(l=e.product_sku)?void 0:l.option),a])}function eJR(e){return{venue_booking_role:"tickets"===e.mode?"tickets_extra":"party_extra",..."tickets"===e.mode?{}:{venue_booking_parent_uid:e.parentLineUid},venue_booking_service_datetime:e.serviceDatetime,venue_booking_scope_key:e.scopeKey}}let eJ$=function(e){var t;let l,i,a,n,r,o,s,d,c,u,p,m,g,h,v,f,y,b,x,k,_,w,S,j,N,C,M=(0,eN.useRef)(e);M.current=e;let T=(0,eN.useRef)(!0),I=(0,eN.useRef)();I.current||(t=()=>{if(!T.current)throw new eJN("CLOSED","The extras page is closed. Please open it again.");return M.current},l=0,i=0,a=!1,n=new Map,r=()=>{var e;return(null==(e=t().os.getTempOrder())?void 0:e.products)??[]},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eJI(t());return eJM(r(),e)},s=e=>{var l;return Uy(e,null==(l=t().os.getTempOrder())?void 0:l.holder_relations)},d=e=>JSON.stringify([e,s(e)]),c=e=>JSON.stringify(o(e).map(d)),u=e=>{var t;return JSON.stringify([null==e?void 0:e.order_id,null==e?void 0:e.external_sale_number,null==e||null==(t=e._extend)?void 0:t.localId])},p=e=>{let l=t().os.getTempOrder();if(!l||Number(l.order_id||0)>0)throw new eJN("NEW_DRAFT_REQUIRED","Start a new booking order before adding extras.");if("tickets"===e.mode){if(!r().some(t=>{var l;return(null==(l=t.metadata)?void 0:l.venue_booking_role)==="tickets"&&t.metadata.venue_booking_scope_key===e.scopeKey}))throw new eJN("TICKETS_REQUIRED","Add a ticket before adding extras.")}else if(!e.parentLineUid||!r().some(t=>{var l;return eJC(t)===e.parentLineUid&&(null==(l=t.metadata)?void 0:l.venue_booking_role)==="party_main"&&t.metadata.venue_booking_scope_key===e.scopeKey}))throw new eJN("PARENT_REQUIRED","Choose and save the Party product before adding extras.")},m=e=>{if(p(e),!e.scopeKey||!e.serviceDatetime||!/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/.test(e.serviceDatetime))throw new eJN("SERVICE_TIME_REQUIRED","The extras pricing date and time are unavailable.");let t=e.productLoadParams.menu_list_ids;if(!(null==t?void 0:t.length)||t.some(e=>!Number.isSafeInteger(e)||e<=0))throw new eJN("CATALOG_REQUIRED","This extras step needs its own menu configuration.")},g=(e,l)=>{if(t().os!==l.os||t().catalogSession!==l.catalogSession||eJT(eJI(t()))!==eJT(e))throw new eJN("STALE_CONTEXT","The booking or extras selection changed. Please choose this item again.");p(e)},h=(e,t)=>{let l=t.os.getTempOrder(),i=null==l?void 0:l.customer_id,a=u(l),n=c(e),r=()=>{if(g(e,t),!l||t.os.getTempOrder()!==l||u(l)!==a||l.customer_id!==i)throw new eJN("STALE_CART","The order or customer changed. Please check the extras again.")};return{beforeApply:()=>{var l,i;if("tickets"===e.mode&&(null==(l=(i=t.os).supportsVenueTicketExtras)?void 0:l.call(i))!==!0)throw new eJN("TICKETS_EXTRAS_SERVICE_UPGRADE_REQUIRED","Tickets extras need an updated booking service. Your selection is kept; update the service before adding or repricing extras.");if(r(),n!==c(e))throw new eJN("STALE_CART","The extras changed while checking the price. Please retry.")},isCurrentOrder:()=>{try{return r(),!0}catch{return!1}}}},v=async e=>{if(a)throw new eJN("BUSY","Please wait for the current cart update.");a=!0;try{return await e()}finally{a=!1}},f=async()=>{try{var e,l;t().cart.refreshCartSnapshot(),await (null==(e=(l=t()).onMutated)?void 0:e.call(l))}catch(e){console.warn("[PartyExtras] Saved extra; UI refresh failed",e)}},y=async function(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"local";m(t);let a=l.catalogSession;if(!(null==a?void 0:a.queryCatalogProductDetail)||!a.calculateProductBookingPrice||"prepare-configuration"===i&&!a.prepareProductDetail)throw new eJN("CATALOG_SESSION_REQUIRED","The extras catalog service is unavailable. Update the booking service and reload this page.");let n={...t.productLoadParams,product_id:e,schedule_date:t.serviceDatetime.slice(0,10),schedule_datetime:t.serviceDatetime,with_count:["bundleGroup","optionGroup"],with_schedule:1,...null!=t.customerId?{customer_id:Number(t.customerId)}:{}},r="prepare-configuration"===i?await a.prepareProductDetail({...n,retry:!0}):await a.queryCatalogProductDetail(n);if(!r||Number(r.id)!==e)throw new eJN("NOT_IN_CATALOG","This extra is no longer available in the selected menu at the current venue time.");for(let[e,t]of[["option_group_count","option_group"],["bundle_group_count","bundle_group"]])if(Number(r[e])>0&&!Array.isArray(r[t]))throw new eJN("INCOMPLETE_DETAIL","Product options are not ready. Please retry.");let o=iM({productDetail:r,requestedProductId:e,completeness:"complete",missingGroupPolicy:l.detailMissingGroupPolicy??"reject"});if("invalid"===o.status)throw new eJN("INCOMPLETE_DETAIL",o.issues.map(e=>e.message).join(" "));if(lW(r.open_sold_weight))throw new eJN("WEIGHING_REQUIRED","This extra requires a measured weight and cannot be added from this booking page.");return o.productDetail},b=async(e,t,l,i,a,n,r)=>{var o,d,c,u,p,m,g;let h,v=a.catalogSession;if(!(null==v?void 0:v.calculateProductBookingPrice))throw new eJN("CATALOG_SESSION_REQUIRED","The extras catalog service is unavailable. Update the booking service and reload this page.");let f=await a.resolveSelectionPolicy(e),y=iw(e,eJE(t),f);if(!y)throw new eJN("INVALID_CONFIGURATION","An option or variant is no longer available. Please choose the options again.");!function(e,t,l,i){var a,n,r,o,s;eJD(l);let d=(t.product_variant_id?null==(a=e.variant)?void 0:a.find(e=>String(e.id)===String(t.product_variant_id)):void 0)??e;if(!l0(e,{overSold:i})||!l0(d,{overSold:i})||lW(e.is_grey))throw new eJN("SOLD_OUT","This extra is currently unavailable. Choose another item or remove it.");if(lW(d.is_track)&&!i&&l>Number(d.stock_quantity??0))throw new eJN("INSUFFICIENT_STOCK","The selected quantity is no longer available.");let c=null==(n=e.item_rule_limit)?void 0:n.remainingMax;if(l<Number((null==(r=e.item_rule_limit)?void 0:r.min)??0)||null!=c&&l>Number(c))throw new eJN("QUANTITY_LIMIT",(null==(o=e.item_rule_limit)?void 0:o.validationMessage)||"Update this extra to an available quantity.");let u=[...t.option,...t.bundle].map(e=>({row:e,multiplier:l}));for(let e of t.bundle)for(let t of e.option??(null==(s=e.product_sku)?void 0:s.option)??[])u.push({row:t,multiplier:l*Number(e.num??1)});for(let{row:e,multiplier:t}of u)if(lW(e.is_track)&&!i&&t*Number(e.num??1)>Number(e.stock_quantity??0))throw new eJN("INSUFFICIENT_STOCK","An option or bundle item no longer has enough stock.")}(e,y,l,f.overSold);let b={...e,product_id:e.id,product_variant_id:y.product_variant_id,quantity:l,num:l,product_sku:{option:y.option},product_bundle:y.bundle.map(exV)},x=await v.calculateProductBookingPrice({product:b,datetime:i.serviceDatetime,channel:"online_ordering",...null!=i.customerId?{customer_id:i.customerId}:{}});if(Number(x.product_id)!==Number(e.id)||Number(x.product_variant_id??0)!==Number(y.product_variant_id??0))throw new eJN("PRICE_MISMATCH","The returned price does not match the selected extra. Please retry.");if(null==x.unit_price||""===String(x.unit_price).trim()||!Number.isFinite(Number(x.unit_price))||0>Number(x.unit_price))throw new eJN("PRICE_UNAVAILABLE","The current price is unavailable. Please retry before adding this extra.");let k=exY(b.product_bundle,x)??[],_={...e.metadata||{},...eJR(i),quotation_shelf_id:x.quotation_shelf_id};delete _.unique_identification_number,delete _.booking_uid;let{source:w,overrideVariantId:S}=eJw(e,y.product_variant_id,n),j=B4(w),N=n?s(n):[],C=r??N;if((j.required||j.enabled&&C.length>0)&&(null==(o=(d=a.os).supportsVenueExtraHolders)?void 0:o.call(d))!==!0)throw new eJN("HOLDER_SERVICE_REQUIRED","The booking service needs to be updated to save holder profiles.");if((j.required||void 0!==r)&&!eJj(e,y.product_variant_id,l,C,i.customerId,n))throw new eJN("HOLDER_REQUIRED","Review the holder profiles for this item.");let M=j.raw??{status:"disable",required:0};_.holder_config=M,_.venue_extra_holder_variant_id=S,"tickets"===i.mode&&delete _.venue_booking_parent_uid,n&&(_.unique_identification_number=eJC(n));let T={...b,price:x.unit_price,selling_price:x.unit_price,quotation_shelf_id:x.quotation_shelf_id,total:void 0,line_total:void 0,price_override:void 0,_extend:j.enabled||C.length?{holder_relations:C}:void 0,unique_identification_number:void 0,discount_list:[],metadata:_,option:y.option,bundle:k,product_bundle:k,holder_config:M,booking_uid:void 0},I=!1;if(n){(h=exW({line:{...n,num:l,product_sku:b.product_sku,product_bundle:k},result:x,resetDiscountList:!0})).unique_identification_number=eJC(n),h.updates.metadata={...h.updates.metadata,...eJR(i)};let e={...n,...h.updates};if(I=eJL(n)!==eJL(e),eJL(n)===eJL(e)){let e=null==(p=n.product_bundle)?void 0:p.map(e=>{var t;return{...e,quotation_shelf_id:null==(t=k.find(t=>eJz(t)===eJz(e)))?void 0:t.quotation_shelf_id}}),t=[null==(m=n.metadata)?void 0:m.quotation_shelf_id,null==(g=n.product_bundle)?void 0:g.map(e=>e.quotation_shelf_id),Object.keys(eJR(i)).map(e=>{var t;return null==(t=n.metadata)?void 0:t[e]})],l=[x.quotation_shelf_id,null==e?void 0:e.map(e=>e.quotation_shelf_id),Object.values(eJR(i))];h=JSON.stringify(t)===JSON.stringify(l)?void 0:{product_id:n.product_id,product_variant_id:n.product_variant_id,unique_identification_number:eJC(n),updates:{metadata:{...n.metadata,...eJR(i),quotation_shelf_id:x.quotation_shelf_id},...e?{product_bundle:e}:{}}}}(void 0!==r||JSON.stringify(null==(c=n.metadata)?void 0:c.holder_config)!==JSON.stringify(M)||((null==(u=n.metadata)?void 0:u.venue_extra_holder_variant_id)??null)!==S)&&(h={...h||{product_id:n.product_id,product_variant_id:n.product_variant_id,unique_identification_number:eJC(n)},updates:{...null==h?void 0:h.updates,holder_config:M,metadata:{...(null==h?void 0:h.updates.metadata)||n.metadata,holder_config:M,venue_extra_holder_variant_id:S},...void 0!==r?{_extend:{holder_relations:C}}:{}}})}return{source:T,update:h,priceChanged:I}},x=async function(e,a,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"local",c=arguments.length>4?arguments[4]:void 0,p=++i;n.clear();try{let h=(null==r?void 0:r.options)??t(),v=(null==r?void 0:r.context)??eJP(h);if(eJD(a),m(v),h.catalog.loading||h.catalog.error||!h.catalog.products.some(t=>Number(t.id)===Number(e.id)))throw new eJN("CATALOG_NOT_READY","Wait for the current extras menu to load, then choose this item again.");let f=h.catalog.products,b=h.os.getTempOrder(),x=u(b),k=c?d(c):void 0,_=await y(Number(e.id),v,h,o);if(await h.resolveSelectionPolicy(_),g(v,h),h.os.getTempOrder()!==b||u(b)!==x)throw new eJN("STALE_CART","The order changed. Please choose this extra again.");if(p!==i)throw new eJN("STALE_SELECTION","A newer extra selection is already open.");if(t().catalog.products!==f)throw new eJN("STALE_CATALOG","The extras menu changed. Please choose this item again.");let w=`party-extra-${Date.now()}-${++l}`,S=iT({productDetail:_,requestedProductId:_.id,completeness:"complete",missingGroupPolicy:h.detailMissingGroupPolicy??"reject",mode:"product-configuration",openId:w,scopeKey:v.scopeKey,detailRevision:w,selectionKey:_.id});if("invalid"===S.status)throw new eJN("INCOMPLETE_DETAIL",S.issues.map(e=>e.message).join(" "));let j="ready"===S.status,N=c?eJO(c):{product_id:_.id,product_variant_id:0,option:[],bundle:[]},C=B4(eJS(_,N.product_variant_id,c)).enabled,M={id:w,contextKey:eJT(v),productId:_.id,quantity:a,productDetail:_,hasSku:j,...c?{lineUid:eJC(c),editingLine:c,holderRelations:s(c)}:{}};!r||j||C||(r.detail=_),n.clear(),n.set(w,{session:M,catalog:f,catalogSession:h.catalogSession,os:h.os,order:b,orderIdentity:x,lineSnapshot:k,consumed:!1});let T={skuValue:N,variantDraft:null};if("ready"===S.status)return{status:"ready",session:M,configuration:T,plan:S.plan};if(!C&&!c)return{status:"direct",session:M,configuration:T};return{status:"ready",session:M,configuration:T,plan:{openId:w,scopeKey:v.scopeKey,detailRevision:w,selectionKey:w,productDetail:_,mode:"product-configuration",hasConfiguration:!0}}}catch(t){return{status:"invalid",issues:[eJA(t,void 0,Number(e.id))]}}},k=async(e,l)=>{let i=o().find(t=>eJC(t)===e),a=i&&t().catalog.products.find(e=>Number(e.id)===Number(i.product_id));return i&&a?x(a,l??Number(i.num),void 0,"prepare-configuration",i):{status:"invalid",issues:[eJA(new eJN("LINE_NOT_FOUND","This extra is no longer available. Review your order."),i)]}},_=async function(e,l,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.quantity,r=arguments.length>4?arguments[4]:void 0;return v(async()=>{var s,c;let p=(null==i?void 0:i.options)??t(),m=(null==i?void 0:i.context)??eJP(p),g=n.get(e.id);if(!g||g.session!==e||g.consumed||g.os!==p.os||g.catalogSession!==p.catalogSession||e.contextKey!==eJT(m)||g.catalog!==p.catalog.products||g.order!==p.os.getTempOrder()||g.orderIdentity!==u(p.os.getTempOrder()))throw new eJN("STALE_SESSION","The extra selection has expired. Please choose it again.");let v=eJD(a),x=(null==i?void 0:i.guard)??h(m,p);x.beforeApply(),await (null==(s=p.beforeMutate)?void 0:s.call(p)),x.beforeApply();let k=(null==i?void 0:i.detail)??await y(e.productId,m,p),_=e.lineUid?o().find(t=>eJC(t)===e.lineUid):void 0;if(e.lineUid&&(!_||d(_)!==g.lineSnapshot))throw new eJN("STALE_CART","This extra has changed. Please open it again.");let w=_?eJO(_):l.skuValue,S=await b(k,w,v,m,p,_,r);if(x.beforeApply(),g.catalog!==t().catalog.products)throw new eJN("STALE_CATALOG","The extras menu changed. Please choose this item again.");let j=_?{allowed:!0,noteDraft:void 0}:await p.cart.prepareAllergyBeforeCommit({product:S.source,flowId:e.id,perFlow:!0});if(x.beforeApply(),!j.allowed)return{status:"cancelled"};if(await (null==(c=p.beforeMutate)?void 0:c.call(p)),x.beforeApply(),g.catalog!==t().catalog.products)throw new eJN("STALE_CATALOG","The extras menu changed. Please choose this item again.");if(g.consumed=!0,_)return S.update&&await p.os.updateOrderProducts([S.update],x),await f(),{status:"updated"};let N=await p.os.addRetailProduct({product:S.source,quantity:v,salesNotes:j.noteDraft?[j.noteDraft]:void 0,availabilityCommitGuard:x.beforeApply});return await f(),{status:"added",products:N}})},w=async function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t(),i=eJI(l),a=l.os.getTempOrder(),n=u(a),r=null==a?void 0:a.customer_id,s=new Set(e),d=o(i).filter(e=>s.has(eJC(e)));if(!a||Number(a.order_id||0)>0||!s.size||s.size!==e.length||e.some(e=>!e)||d.length!==s.size||new Set(d.map(eJC)).size!==s.size||a.products.filter(e=>s.has(eJC(e))).length!==s.size||d.some(e=>{var t;return(null==(t=e.metadata)?void 0:t.venue_booking_scope_key)!==i.scopeKey}))throw new eJN("LINE_NOT_FOUND","These extras changed. Please review the cart.");let c=()=>t().os===l.os&&l.os.getTempOrder()===a&&u(a)===n&&a.customer_id===r&&eJT(eJI(t()))===eJT(i),p=JSON.stringify([a.products,a.bookings,a.notes]),m=()=>{if(!c()||p!==JSON.stringify([a.products,a.bookings,a.notes]))throw new eJN("STALE_CART","The extras changed. Please review the cart.")};if(!l.os.removeProductsFromOrder)throw new eJN("CART_SERVICE_REQUIRED","The booking cart service needs to be updated.");m();try{let e=await l.os.removeProductsFromOrder(d.map(e=>({product_id:e.product_id,product_variant_id:e.product_variant_id,unique_identification_number:eJC(e)})),{beforeApply:m,isCurrentOrder:c});if(!c())throw new eJN("STALE_CART","The order changed while removing extras.");return await f(),{status:"updated",products:e}}catch(e){throw c()&&await f(),e}},S=async(e,l,i)=>v(async()=>{var a,n;let r=(null==i?void 0:i.options)??t();if(!Number.isSafeInteger(l)||l<0)throw new eJN("INVALID_QUANTITY","Choose a valid quantity.");let s=o().find(t=>eJC(t)===e);if(!s||!e)throw new eJN("LINE_NOT_FOUND","This extra has changed. Please refresh the cart.");if(l===Number(s.num))return{status:"unchanged"};if(0===l)return w([e],r);let d=(null==i?void 0:i.context)??eJP(r),c=(null==i?void 0:i.guard)??h(d,r);c.beforeApply(),await (null==(a=r.beforeMutate)?void 0:a.call(r)),c.beforeApply();let u=(null==i?void 0:i.detail)??await y(Number(s.product_id),d,r);if(B4(eJS(u,s.product_variant_id,s)).enabled)return k(e,l);let p=await b(u,eJO(s),l,d,r,s);c.beforeApply(),await (null==(n=r.beforeMutate)?void 0:n.call(r)),c.beforeApply();let m=await r.os.updateOrderProducts([p.update],c);return await f(),{status:"updated",products:m}}),j=(e,t)=>S(e,t),N=async e=>{let l=t(),i=eJP(l,e),a=l.os.getTempOrder(),n=u(a),r=o(eJI(l)),s=c(eJI(l)),d={context:i,contextKey:eJT(i),sourceRows:r,orderSignature:s,validRows:[],updates:[],invalidItems:[],priceChanged:!1};if(!r.length)return d;let p=new Map;for(let e of r)try{if(!eJC(e))throw new eJN("MISSING_LINE_UID","This extra has no line identity. Remove it and add it again.");let t=Number(e.product_id);p.has(t)||p.set(t,y(t,i,l));let a=await p.get(t),n=await b(a,eJO(e),Number(e.num),i,l,e);d.validRows.push(n.source),d.priceChanged||(d.priceChanged=n.priceChanged),n.update&&d.updates.push(n.update)}catch(t){d.invalidItems.push(eJA(t,e))}if(l.os!==t().os||l.catalogSession!==t().catalogSession||l.os.getTempOrder()!==a||u(a)!==n||s!==c(eJI(l))||eJT(eJI(l))!==eJT(eJI(t())))throw new eJN("STALE_CART","The Party or extras changed while checking availability. Please retry.");return d},C=async()=>v(async()=>{var e,l;let i=t(),a=h(eJI(i),i);a.beforeApply(),await (null==(e=i.beforeMutate)?void 0:e.call(i)),a.beforeApply();let n=await N();if(g(n.context,i),n.orderSignature!==c(n.context))throw new eJN("STALE_CART","The extras changed while checking availability. Please retry.");return a.beforeApply(),n.updates.length&&(await (null==(l=i.beforeMutate)?void 0:l.call(i)),a.beforeApply(),await i.os.updateOrderProducts(n.updates,a),await f()),n}),I.current={prepare:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return x(e,t,void 0,"prepare-configuration")},prepareEdit:k,commit:function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.quantity,i=arguments.length>3?arguments[3]:void 0;return _(e,t,void 0,l,i)},setProductQuantity:async(e,l)=>{let i;if(!Number.isSafeInteger(l)||l<0)throw new eJN("INVALID_QUANTITY","Choose a valid quantity.");let a=o().filter(t=>Number(t.product_id)===Number(e.id)),n=a.reduce((e,t)=>e+Number(t.num||0),0);if(n===l)return{status:"unchanged"};if(l<n){var r,s,d;if(1===a.length)return j(eJC(a[0]),l);if(!lW(e.is_variant)&&!lW(e.is_bundle)&&!lW(e.open_sold_weight)&&!lW(e.isOpenDetailModal)&&!["session_product","session_ticket"].includes(String(e.extension_type||""))&&!Number(e.option_group_count||0)&&!Number(e.bundle_group_count||0)&&!(null==(r=e.variant_group)?void 0:r.length)&&!(null==(s=e.option_group)?void 0:s.length)&&!(null==(d=e.bundle_group)?void 0:d.length)&&a.every(e=>{var t;return!Number(e.product_variant_id)&&!((null==(t=e.product_sku)?void 0:t.option)||[]).length&&!(e.product_bundle||[]).length})){let e=a[a.length-1];return j(eJC(e),Math.max(0,Number(e.num)-(n-l)))}return{status:"choose-line",rows:a,targetQuantity:l}}try{let e,l,a,n;e=t(),l=eJP(e),a=e.catalog.products,n=h(l,e),i={options:e,context:l,guard:{...n,beforeApply:()=>{if(n.beforeApply(),t().catalog.products!==a)throw new eJN("STALE_CATALOG","The extras menu changed. Please choose this item again.")}}}}catch(t){return{status:"invalid",issues:[eJA(t,void 0,Number(e.id))]}}let c=await x(e,l-n,i);if("direct"!==c.status)return c;if(o().filter(t=>Number(t.product_id)===Number(e.id)).reduce((e,t)=>e+Number(t.num||0),0)!==n)throw new eJN("STALE_CART","The extra quantity changed. Please retry.");return 1===a.length?S(eJC(a[0]),l,i):_(c.session,c.configuration,i)},setLineQuantity:j,removeLines:e=>v(()=>w(e)),prepareRevalidation:N,revalidate:C});let[P,A]=(0,eN.useState)(0),[D,E]=(0,eN.useState)([]),[O,z]=(0,eN.useState)(()=>eJT(e));(0,eN.useEffect)(()=>(T.current=!0,()=>{T.current=!1}),[]);let L=(0,eN.useMemo)(()=>{var t;return eJM((null==(t=e.cart.tempOrder)?void 0:t.products)??[],e)},[e.cart.tempOrder,e.parentLineUid,e.mode,e.scopeKey]),R=eJT(e);(0,eN.useEffect)(()=>{L.length||z(R)},[R,L.length]);let $=(0,eN.useMemo)(()=>{let t=new Set(L.map(eJC)),l=D.filter(e=>e.lineUid&&t.has(e.lineUid));for(let t of L){var i;let a=eJC(t);R===O&&(null==(i=t.metadata)?void 0:i.venue_booking_scope_key)===e.scopeKey||l.some(e=>e.lineUid===a)||l.push({code:"REVALIDATION_REQUIRED",message:"The booking context changed. Check this extra again before checkout.",lineUid:a,productId:Number(t.product_id),line:t})}return l},[L,D,R,O,e.scopeKey]),F=(0,eN.useMemo)(()=>{let e={};for(let t of L){let l=Number(t.num);if(Number.isFinite(l)&&l>0){let i=String(t.product_id);e[i]=(e[i]??0)+l}}return e},[L]);return{...(0,eN.useMemo)(()=>{let e=I.current,t=async e=>{T.current&&A(e=>e+1);try{return await e()}finally{T.current&&A(e=>Math.max(0,e-1))}};return{prepare:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.prepare(...i))},prepareEdit:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.prepareEdit(...i))},commit:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(async()=>{let t=await e.commit(...i);return T.current&&i[0].lineUid&&"updated"===t.status&&E(e=>e.filter(e=>e.lineUid!==i[0].lineUid)),t})},setProductQuantity:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.setProductQuantity(...i))},setLineQuantity:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(async()=>{let t=await e.setLineQuantity(...i);return T.current&&E(e=>e.filter(e=>e.lineUid!==i[0])),t})},removeLines:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(async()=>{let t=await e.removeLines(...i);return T.current&&E(e=>e.filter(e=>!e.lineUid||!i[0].includes(e.lineUid))),t})},prepareRevalidation:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.prepareRevalidation(...i))},revalidate:()=>t(async()=>{let t=await e.revalidate();return T.current&&eJT(M.current)===t.contextKey&&(E(t.invalidItems),z(t.contextKey)),t})}},[]),rows:L,quantityByProductId:F,invalidItems:$,busy:P>0}},eJF=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??"")},eJq=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.booking_uid??"")},eJB=e=>"string"==typeof e&&""!==e.trim()||"number"==typeof e&&Number.isFinite(e),eJH=(e,t)=>{let l=String(e??"").slice(0,10),i=String(t??"");return/^\d{4}-\d{2}-\d{2}$/.test(l)&&/^\d{2}:\d{2}(:\d{2})?$/.test(i)?`${l} ${5===i.length?`${i}:00`:i}`:""},eJV=e=>{let t=String(e??"").replace("T"," ");return 16===t.length?`${t}:00`:t},eJU=e=>eJV(e).slice(0,16);function eJY(e,t){let l={bindings:[],extras:[],gifts:[],issues:[]},i=(e,t,i,a)=>l.issues.push({code:e,message:t,productLineUid:i,bookingUid:a});if(!e)return i("ORDER_REQUIRED","The booking draft is unavailable."),l;Number(e.order_id||0)>0&&i("NEW_DRAFT_REQUIRED","This entry supports new booking drafts only.");let a=Array.isArray(e.products)?e.products:[],n=Array.isArray(e.bookings)?e.bookings:[],r=new Set,o=new Set;for(let e of a){var s,d,c,u,p,m,g,h;let v=eJF(e),f=null==(s=e.metadata)?void 0:s.venue_booking_role;if(null==(d=e.metadata)?void 0:d._giftInfo){l.gifts.push(e);let t=String(e.booking_uid??(null==(u=e.metadata)?void 0:u.booking_uid)??"");n.filter(e=>t&&eJq(e)===t||String(e.product_uid??"")===v).forEach(e=>o.add(eJq(e)));continue}if("party_extra"===f||"tickets_extra"===f){f!==("tickets"===t.mode?"tickets_extra":"party_extra")&&i("UNEXPECTED_ORDER_LINE","The draft contains an extra from another booking entry.",v),(!v||r.has(v))&&i("INVALID_LINE_IDENTITY","The extra line identity is missing or duplicated.",v),r.add(v),Number(e.order_detail_id||0)>0&&i("NEW_DRAFT_REQUIRED","An existing extra cannot be edited here.",v),(!Number.isSafeInteger(Number(e.num))||0>=Number(e.num))&&i("EXTRA_QUANTITY_INVALID","Update this extra to a valid quantity.",v),(null==(p=e.metadata)?void 0:p.venue_booking_scope_key)&&(!t.scopeKey||e.metadata.venue_booking_scope_key===t.scopeKey)||i("EXTRA_SCOPE_INVALID","This extra belongs to another booking entry.",v);let o=String((null==(m=e.metadata)?void 0:m.venue_booking_parent_uid)||"");"tickets_extra"===f&&o&&i("EXTRA_PARENT_INVALID","Ticket extras belong to the order, not a booking line.",v),"party_extra"!==f||a.some(t=>{var l,i;return eJF(t)===o&&(null==(l=t.metadata)?void 0:l.venue_booking_role)==="party_main"&&t.metadata.venue_booking_scope_key===(null==(i=e.metadata)?void 0:i.venue_booking_scope_key)})||i("EXTRA_PARENT_INVALID","The Party product for this extra is missing.",v),(null==(g=e.metadata)?void 0:g.venue_booking_service_datetime)||i("EXTRA_PRICE_CONTEXT_MISSING","Recheck this extra before checkout.",v),(e.booking_uid||(null==(h=e.metadata)?void 0:h.booking_uid)||n.some(e=>String(e.product_uid||"")===v))&&i("EXTRA_BOOKING_INVALID","An extra must not create a booking.",v),l.extras.push(e);continue}if(f!==("tickets"===t.mode?"tickets":"party_main")){i("UNEXPECTED_ORDER_LINE","The draft contains a product from another booking entry.",v);continue}if(!v||r.has(v)){i("INVALID_LINE_IDENTITY","The product line identity is missing or duplicated.",v);continue}r.add(v),Number(e.order_detail_id||0)>0&&i("NEW_DRAFT_REQUIRED","An existing order line cannot be edited here.",v);let y=String(e.booking_uid??(null==(c=e.metadata)?void 0:c.booking_uid)??""),b=n.filter(e=>y&&eJq(e)===y||String(e.product_uid??"")===v);if(1!==b.length){i("BOOKING_LINK_INVALID","A booking product must have exactly one linked booking.",v);continue}let x=b[0],k=eJq(x);if(!k||o.has(k)||y&&y!==k||x.product_uid&&String(x.product_uid)!==v){i("BOOKING_LINK_INVALID","The booking and product line identities no longer match.",v,k);continue}o.add(k);let _=eJH(x.start_date,x.start_time),w=eJH(x.end_date,x.end_time),S=x.metadata||{},j=String(S.availability_business_date||t.date||_.slice(0,10)),N=Number(e.num);_&&w&&!(w<=_)||i("BOOKING_TIME_INVALID","The saved booking interval is incomplete.",v,k),Number.isSafeInteger(N)&&1===N||i("BOOKING_LINE_COUNT_INVALID","Each saved booking must map to one product line.",v,k),S.availability_candidate_key&&S.availability_source&&S.availability_slice_start_at&&S.availability_slice_end_at&&Array.isArray(S.availability_schedule_refs)||i("BOOKING_INTENT_MISSING","The saved booking is missing its original availability intent. Please reselect it.",v,k);let C=[];for(let e of Array.isArray(x.resources)?x.resources:[]){let t=e.relation_id??e.resource_id??e.id;if(!eJB(t)||0===Number(t)||!eJB(e.form_id)){i("BOOKING_RESOURCE_INVALID","The saved resource identity is incomplete.",v,k);continue}C.push({formId:e.form_id,resourceId:t,capacity:Number(e.capacity)})}l.bindings.push({productLineUid:v,bookingUid:k,identity:ekX(e),line:e,booking:x,quantity:N,date:j,intent:{date:j,startAt:_,endAt:w,sliceStartAt:String(S.availability_slice_start_at??""),sliceEndAt:String(S.availability_slice_end_at??""),candidateKey:String(S.availability_candidate_key??""),source:String(S.availability_source??""),scheduleRefs:S.availability_schedule_refs||[],timezone:S.availability_timezone,primaryScheduleRef:S.availability_primary_schedule_ref,resources:C}})}l.bindings.length||i("BOOKING_REQUIRED","Add a booking before continuing."),"party"===t.mode&&1!==l.bindings.length&&i("PARTY_SINGLE_MAIN_REQUIRED","A party order requires one main product, room and time.");let v=new Set(l.bindings.map(e=>e.date));for(let e of((v.size>1||t.date&&[...v].some(e=>e!==t.date))&&i("SINGLE_DATE_REQUIRED","All bookings must retain the selected booking date."),n))o.has(eJq(e))||i("ORPHAN_BOOKING","The draft contains an unlinked booking.",void 0,eJq(e));return l}let eJW=e=>{var t;return(0,ni.cloneDeep)(e&&{orderId:e.order_id,externalSaleNumber:e.external_sale_number,localId:null==(t=e._extend)?void 0:t.localId,customerId:e.customer_id,products:e.products,bookings:e.bookings,holder:e.holder,holderRelations:e.holder_relations,notes:e.notes,orderDiscounts:e.discount_list,shopDiscount:e.shop_discount,payments:e.payments})};async function eJG(e){var t,l,i;let a=e.os.getTempOrder(),n=eJW(a),r=eJY(a,e),o={bindings:[],extras:r.extras,gifts:r.gifts,issues:[...r.issues]},s=void 0===e.customerId?null==a?void 0:a.customer_id:e.customerId;if(String(s??"")!==String((null==a?void 0:a.customer_id)??"")&&o.issues.push({code:"CUSTOMER_CHANGED",message:"The customer changed. Please review the booking again."}),r.issues.length)return o;let d=()=>{var t;let l;return(null==(t=e.isCurrent)?void 0:t.call(e))!==!1&&(l=e.os,(0,ni.isEqual)(eJW(l.getTempOrder()),n))};if(!(null==(t=e.catalog)?void 0:t.menuListIds.length)||!(null==(l=e.queries)?void 0:l.queryCatalogProductDetail)||!e.os.buildCacheItemFromOrderLine)return o.issues.push({code:"BOOKING_SERVICE_UNAVAILABLE",message:"The configured booking menu or detail service is unavailable."}),o;for(let t of r.bindings){let l,a;try{if(!d())throw Error("ORDER_CHANGED");let n={menu_list_ids:[...e.catalog.menuListIds],schedule_date:t.date,schedule_datetime:t.intent.startAt,...null!=s?{customer_id:Number(s)}:{}},r=await e.queries.queryCatalogProductDetail({...n,product_id:Number(t.line.product_id)});if(!d())throw Error("ORDER_CHANGED");if(!r||String(r.id)!==String(t.line.product_id))throw Error("PRODUCT_DETAIL_UNAVAILABLE");let c=iM({productDetail:r,requestedProductId:Number(t.line.product_id),completeness:"complete"});if("invalid"===c.status)throw Error("PRODUCT_DETAIL_INCOMPLETE");let u=e.os.buildCacheItemFromOrderLine({product:t.line,booking:t.booking,sourceProduct:r}),p=e_V({...u,product_resource:r.product_resource,duration:r.duration,capacity:r.capacity,_data:{...u._data,capacitys:null==(i=r._data)?void 0:i.capacitys}}),m=$O(p._extend);if(!m||String(m.product_id)!==String(t.line.product_id)||String(m.product_variant_id)!==String(t.line.product_variant_id))throw Error("ORDER_SKU_INVALID");let g=new Map;for(let e of t.intent.resources){let t=String(e.formId),l=g.get(t)||{formId:e.formId,resourceIds:[]};l.resourceIds.push(e.resourceId),g.set(t,l)}if(a={...t,product:p,skuValue:m,selection:{requirementSelections:[...g.values()]}},l=await eQ6({os:e.os,mode:"tickets"===e.mode?"ticket":"party",date:t.date,product:p,quantity:t.quantity,editingProductLineUid:t.productLineUid}),!d())throw Error("ORDER_CHANGED");let h=l.times.filter(e=>{var l;return l=t.intent,e.key===l.candidateKey&&e.source===l.source&&eJV(e.startAt)===eJV(l.sliceStartAt)&&eJV(e.endAt)===eJV(l.sliceEndAt)&&eJU(e.bookingStartAt||e.startAt)===eJU(l.startAt)&&eJU(e.bookingEndAt||e.endAt)===eJU(l.endAt)&&(0,ni.isEqual)(e.scheduleRefs,l.scheduleRefs)&&(!l.timezone||e.timezone===l.timezone)&&(!l.primaryScheduleRef||(0,ni.isEqual)(e.primaryScheduleRef,l.primaryScheduleRef))});if(1!==h.length)throw Error("SELECTED_TIME_UNAVAILABLE");let v=await eQ5(e.os,l,h[0]);if(!d())throw Error("ORDER_CHANGED");let f=[];for(let e of t.intent.resources){let t=v.groups.filter(t=>String(t.formId)===String(e.formId)&&t.options.some(t=>String(t.resourceId)===String(e.resourceId)));if(1!==t.length)throw Error("SAVED_RESOURCE_GROUP_AMBIGUOUS");if(e.capacity!==l.partySize)throw Error("BOOKING_CAPACITY_CHANGED");let i=t[0],a=f.find(e=>e.requirementGroupId===i.groupId);a||(a={requirementGroupId:i.groupId,formId:i.formId,resourceIds:[]},f.push(a)),a.resourceIds.push(e.resourceId)}o.bindings.push({...t,product:p,skuValue:m,selection:{candidate:v.candidate,requirementSelections:f}})}catch(i){let l=i instanceof Error?i.message:"BOOKING_VALIDATION_FAILED";!e.requireAvailable&&a&&d()&&o.bindings.push(a),o.issues.push({code:l,message:"ORDER_CHANGED"===l?"The booking draft changed. Please review it again.":"This saved booking is no longer available. Please reselect it.",productLineUid:t.productLineUid,bookingUid:t.bookingUid})}finally{eQ3(e.os,l)}if(!d())break}return o}function eJK(e,t){var l,i,a,n,r,o,s,d;let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"en",u=e.sales.bookingTicket,p=null==u||null==(l=u.getCart)?void 0:l.call(u),m=new Set(e_S(u).map(e=>{var t;return String((null==(t=e.orderLine.metadata)?void 0:t.unique_identification_number)||"")})),g=new Set;for(let e of(null==p?void 0:p.bookings)||[]){let t=e.product_uid??(null==(n=e._extend)||null==(a=n.product)||null==(i=a.metadata)?void 0:i.unique_identification_number);t&&g.add(String(t))}for(let e of(null==p?void 0:p.items)||[])!["tickets_extra","party_extra"].includes(null==(r=e.metadata)?void 0:r.venue_booking_role)&&(null==(o=e.metadata)?void 0:o.unique_identification_number)&&g.add(String(e.metadata.unique_identification_number));let h=[],v=[];if(u)for(let e of g){let t=e_j(u,e);if(!t)continue;let l=B4(t.cacheItem),i=Number((null==(s=t.cacheItem._extend)?void 0:s.quantity)||1),a=Number.isSafeInteger(i)&&i>0?i:1,n={...t,uid:e,config:l,quantity:a,title:eKT(t.orderLine.product_title||t.cacheItem.title||t.cacheItem.name||t.cacheItem.product_name,c),ids:Uk(null==(d=t.cacheItem._extend)?void 0:d.holder_id),missing:m.has(e)};(t.booking||l.enabled)&&v.push(n),l.enabled&&h.push(n)}let f=h.reduce((e,t)=>e+t.quantity,0),y=h.reduce((e,t)=>e+Math.min(t.quantity,t.ids.length),0),b=h.reduce((e,t)=>e+(t.config.required?t.quantity:0),0),x=h.reduce((e,t)=>e+(t.config.required?Math.min(t.quantity,t.ids.length):0),0),k=JSON.parse(eJQ(e,t||"")),_=void 0!==t&&eJX(u,eJQ(e,t))||!!u&&[...eJZ.get(u)||[]].some(e=>{let l=JSON.parse(e);return(void 0===t||l[0]===t)&&l[1]===k[1]&&l[2]===k[2]});return{enabled:h.length>0,required:b>0,complete:!_&&x===b,total:f,completed:y,requiredCount:b,requiredCompleted:x,pending:!1,blocked:_,lines:h,displayLines:v}}function eJQ(e,t){var l,i,a;let n=(null==(i=e.sales.bookingTicket)||null==(l=i.getTempOrder)?void 0:l.call(i))??e.sales.tempOrder;return JSON.stringify([t,(null==n||null==(a=n._extend)?void 0:a.localId)||(null==n?void 0:n.external_sale_number)||(null==n?void 0:n.order_id),null==n?void 0:n.customer_id])}let eJZ=new WeakMap,eJJ=e=>`pisell:venue-booking:holder-unconfirmed:${e}`;function eJX(e,t){var l;if(!e)return!1;if(null==(l=eJZ.get(e))?void 0:l.has(t))return!0;try{return"1"===sessionStorage.getItem(eJJ(t))}catch{return!1}}let eJ0=new WeakMap;function eJ2(e,t){var l;return!!e&&!!(null==(l=eJ0.get(e))?void 0:l.has(t))}let eJ1=(0,eN.memo)(function(e){var t,l,i,a,n,r,o;let{balanceAmount:s="$15.1",customerEmail:d="customer@email.com",customerName:c="",onClose:u,sendPaymentLink:p,customerId:m}=e,g=ea2(),h=eR();sZ(WU,(null==(n=h.appHelper.utils)||null==(a=n.getApp)||null==(i=a.call(n))||null==(l=i.locales)||null==(t=l.getLocale)?void 0:t.call(l))||(null==(o=h.appHelper.utils)||null==(r=o.storage)?void 0:r.get("umi_locale"))||"en");let v=qS(),f=(e,t)=>ez.getText(e)||t,[y,b]=(0,eN.useState)(d||"");(0,eN.useEffect)(()=>{b(d||"")},[d]);let x=(0,eB.jsx)("div",{className:aj()("send-payment-link-modal"),children:(0,eB.jsx)("div",{className:aj()("modal-content"),children:(0,eB.jsxs)("div",{className:aj()("main-content"),children:[(0,eB.jsx)("div",{className:aj()("illustration-container"),children:(0,eB.jsx)("img",{src:g+"/send_payment_link.png",className:aj()("illustration")})}),(0,eB.jsxs)("div",{className:aj()("form-container"),children:[(0,eB.jsx)("div",{className:aj()("email-options-container"),children:(0,eB.jsxs)("div",{className:aj()("email-section"),children:[(0,eB.jsxs)("div",{className:aj()("section-label"),children:[(e=>{if(r9(m))return"";let t=f("pisell2.checkout.send-payment-link.customer-name-format");return"function"==typeof t?t(e):`${e}'s `})(c),f("pisell2.checkout.send-payment-link.email-address","Email Address")]}),(0,eB.jsx)("div",{className:aj()("email-option"),children:(0,eB.jsx)("div",{className:aj()("email-input-container"),children:(0,eB.jsx)("div",{className:`${aj()("email-input")} ${aj()("email-input-selected")}`,children:(0,eB.jsx)("input",{type:"email",value:y,onChange:e=>b(e.target.value),placeholder:f("pisell2.checkout.send-payment-link.email-placeholder","Enter email address"),className:aj()("email-text-input")})})})})]})}),(0,eB.jsx)("div",{className:aj()("footer"),children:(0,eB.jsx)("button",{className:aj()("send-button"),onClick:()=>{var e;y&&""!==y.trim()?(e=y.trim(),/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))?(p({emails:[y.trim()],amount:s}),null==u||u()):v.fail(f("pisell2.checkout.send-payment-link.email-invalid")):v.fail(f("pisell2.checkout.send-payment-link.email-required"))},children:f("pisell2.checkout.send-payment-link.send-button","Send Link")})})]})]})})});return(0,eB.jsx)(eM.Modal,{title:f("pisell2.checkout.send-payment-link.modal-title","Send Payment Link"),width:680,footer:null,centered:!0,wrapClassName:"send-payment-link-modal-wrapper",open:!0,onCancel:u,children:x})}),eJ4=e=>(0,eB.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"currentColor",viewBox:"0 0 24 24",...e,children:(0,eB.jsx)("path",{fillRule:"evenodd",d:"M11.293 8.293a1 1 0 0 1 1.414 0l6 6a1 1 0 0 1-1.414 1.414L12 10.414l-5.293 5.293a1 1 0 0 1-1.414-1.414z",clipRule:"evenodd"})}),eJ3=e=>(0,eB.jsx)(ne,af(af({},e),{},{viewBox:(null==e?void 0:e.viewBox)||"0 0 24 24",component:eJ4})),eJ8=function(e){var t;let l,i,{amountSymbol:a,orderInfo:n,cartData:r,onClose:o,summaryData:s=[],labelMaps:d,paymentItems:c=[],customAmount:u,voidPayment:p,walletPassData:m,clientInfo:g}=e,[h,v]=(0,eN.useState)(!0),[f,y]=(0,eN.useState)(!0),[b,x]=(0,eN.useState)(!0),k=eR(),_=(e,t)=>{var l,i,a,n,r,o,s,d;let c=null==(d=WU[(null==(r=k.appHelper.utils)||null==(n=r.getApp)||null==(a=n.call(r))||null==(i=a.locales)||null==(l=i.getLocale)?void 0:l.call(i))||(null==(s=k.appHelper.utils)||null==(o=s.storage)?void 0:o.get("umi_locale"))||"en"])?void 0:d[e];return c||ez.getText(e)||t},w=()=>{var e;let t=g||{},l=e=>null!=e&&""!==String(e).trim()?String(e).trim():null,i=l(null==t?void 0:t.display_name)||l(null==t?void 0:t.name)||_("pisell2.checkout.customer.default-name")||"Customer";return{nickname:(null==t?void 0:t.nickname)&&(null==t?void 0:t.nickname)!=="Select a customer"?null==t?void 0:t.nickname:ez.getText("pisell2.checkout.customer.default-name"),display_name:i,email:(null==t?void 0:t.email)||(null==t||null==(e=t.contacts)?void 0:e.email)||""}},S=e=>{let{expanded:t,color:l="black"}=e;return(0,eB.jsx)("div",{className:aj()("collapse-icon",{expanded:t}),children:(0,eB.jsx)(eJ3,{style:{color:l,fontSize:"24px"}})})},j=e=>{let t=e.order_payment_id;return("cash"===e.code||"custom"===e.type)&&eTt(e)&&(null==t||""===t)},N=e=>eTt(e),C=()=>c.filter(N).reduce((e,t)=>{let l=new lO(Math.abs(t.amount)),i=new lO(Number(t.rounding_amount)>0?0:t.rounding_amount||0);return new lO(e).plus(l).plus(i).toNumber()},0),M=e=>{p&&p(e)},T=e=>e.label||d&&d[e.key]||e.key;return(0,eB.jsxs)("div",{className:aj()("payment-detail-modal"),children:[(0,eB.jsxs)("div",{className:aj()("main-content"),children:[(0,eB.jsxs)("div",{className:aj()("section-container"),children:[(0,eB.jsxs)("div",{className:aj()("section-header"),onClick:()=>v(!h),children:[(0,eB.jsx)("div",{className:aj()("section-title-container"),children:(0,eB.jsx)("div",{className:aj()("section-title"),children:_("order.total")||"Order Total"})}),(0,eB.jsxs)("div",{className:aj()("section-right"),children:[(0,eB.jsx)("div",{className:aj()("section-amount"),children:lY((l=s.find(e=>"sub_total"===e.key))?l.value:0,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})}),(0,eB.jsx)(S,{expanded:h})]})]}),h&&(0,eB.jsx)("div",{className:aj()("section-content"),children:(()=>{if(!s||0===s.length)return(0,eB.jsx)("div",{className:aj()("order-details-grid"),children:(0,eB.jsx)("div",{className:aj()("order-details-column"),children:(0,eB.jsxs)("div",{className:aj()("order-row"),children:[(0,eB.jsx)("div",{className:aj()("order-row-text"),children:_("no.items.found")||"No items found"}),(0,eB.jsx)("div",{className:aj()("order-row-amount"),children:lY(0,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]})})});let e=s.slice(0,Math.ceil(s.length/2)),t=s.slice(Math.ceil(s.length/2));return(0,eB.jsxs)("div",{className:aj()("order-details-grid"),children:[(0,eB.jsx)("div",{className:aj()("order-details-column"),children:e.map(e=>{let t="";return(null==e?void 0:e.key)!=="discount"&&(t=e.value>=0?"+":""),(0,eB.jsxs)("div",{className:aj()("order-row"),children:[(0,eB.jsx)("div",{className:aj()("order-row-label"),children:T(e)}),(0,eB.jsxs)("div",{className:aj()("order-row-amount"),children:[t,lY(e.value,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]})]},e.key)})}),t.length>0&&(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("div",{className:aj()("divider-vertical")}),(0,eB.jsx)("div",{className:aj()("order-details-column"),children:t.map(e=>{let t="";return(null==e?void 0:e.key)!=="discount"&&(t=e.value>=0?"+":""),(0,eB.jsxs)("div",{className:aj()("order-row"),children:[(0,eB.jsx)("div",{className:aj()("order-row-label"),children:T(e)}),(0,eB.jsxs)("div",{className:aj()("order-row-amount"),children:[t,lY(e.value,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]})]},e.key)})})]})]})})()})]}),(0,eB.jsx)("div",{className:aj()("divider-horizontal")}),(0,eB.jsxs)("div",{className:aj()("section-container"),children:[(0,eB.jsxs)("div",{className:aj()("section-header"),onClick:()=>y(!f),role:"button",tabIndex:0,children:[(0,eB.jsx)("div",{className:aj()("section-title-container"),children:(0,eB.jsx)("div",{className:aj()("section-title"),children:_("order.paid")||"Order Paid"})}),(0,eB.jsxs)("div",{className:aj()("section-right"),children:[(0,eB.jsxs)("div",{className:aj()("section-amount"),children:["-",lY(C(),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]}),(0,eB.jsx)(S,{expanded:f})]})]}),f&&(()=>{let e=c.filter(N),t=e.filter(e=>"deposit"===e.type),l=e.filter(e=>"deposit"!==e.type);if(0===e.length||0===l.length&&0===t.length)return(0,eB.jsx)("div",{className:aj()("section-content"),children:(0,eB.jsx)("div",{className:aj()("no-payment-text"),children:_("no.payments.recorded")||"No payments recorded"})});let i=t.reduce((e,t)=>new lO(e).plus(new lO(t.amount)).plus(new lO(Number(t.rounding_amount)>0?0:t.rounding_amount||0)).toNumber(),0),n=l.reduce((e,t)=>new lO(e).plus(new lO(t.amount)).plus(new lO(Number(t.rounding_amount)>0?0:t.rounding_amount||0)).toNumber(),0);return(0,eB.jsx)("div",{className:aj()("section-content"),children:(0,eB.jsxs)("div",{className:aj()("payment-record-container"),children:[t.length>0&&(0,eB.jsxs)("div",{className:aj()("payment-item-header"),children:[(0,eB.jsx)("div",{children:_("pisell2.subtotal.deposit")||"Deposit"}),(0,eB.jsx)("div",{children:lY(i,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),t.map(e=>(0,eB.jsxs)("div",{className:aj()("payment-item"),children:[(0,eB.jsx)("div",{className:aj()("payment-item-bullet")}),(0,eB.jsxs)("div",{className:aj()("payment-item-content"),children:[(0,eB.jsxs)("div",{className:aj()("payment-item-text"),children:[e.name," - ",e.created_at||new Date().toLocaleDateString()," ",_("pisell2.checkout.payment-detail.by")||"by"," ",w().nickname]}),(0,eB.jsxs)("div",{className:aj()("payment-item-actions"),children:[(0,eB.jsxs)("div",{className:aj()("payment-item-amount"),children:["-",lY(new lO(Math.abs(e.amount)).plus(new lO(Number(e.rounding_amount)>0?0:e.rounding_amount||0)).toNumber(),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]}),j(e)&&(0,eB.jsx)("button",{className:aj()("void-button"),onClick:()=>M(e),type:"button",children:_("void")||"Void"})]})]})]},e.uuid)),l.length>0&&(0,eB.jsxs)("div",{className:aj()("payment-item-header"),children:[(0,eB.jsx)("div",{children:_("payment.text")||"Payment"}),(0,eB.jsx)("div",{children:lY(n,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),l.map(e=>(0,eB.jsxs)("div",{className:aj()("payment-item"),children:[(0,eB.jsx)("div",{className:aj()("payment-item-bullet")}),(0,eB.jsxs)("div",{className:aj()("payment-item-content"),children:[(0,eB.jsxs)("div",{className:aj()("payment-item-text"),children:[e.name," - ",e.created_at||new Date().toLocaleDateString()," ",_("pisell2.checkout.payment-detail.by")||"by"," ",w().nickname]}),(0,eB.jsxs)("div",{className:aj()("payment-item-actions"),children:[(0,eB.jsxs)("div",{className:aj()("payment-item-amount"),children:["-",lY(new lO(Math.abs(e.amount)).plus(new lO(Number(e.rounding_amount)>0?0:e.rounding_amount||0)).toNumber(),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]}),j(e)&&(0,eB.jsx)("button",{className:aj()("void-button"),onClick:()=>M(e),type:"button",children:_("void")||"Void"})]})]})]},e.uuid))]})})})()]})]}),(0,eB.jsxs)("div",{className:aj()("balance-to-pay-section"),children:[(0,eB.jsxs)("div",{className:aj()("balance-to-pay-header"),onClick:()=>x(!b),role:"button",tabIndex:0,children:[(0,eB.jsx)("div",{className:aj()("section-title-container"),children:(0,eB.jsx)("div",{className:aj()("balance-to-pay-title"),children:_("balance.to.pay")||"Balance to Pay"})}),(0,eB.jsxs)("div",{className:aj()("balance-to-pay-right"),children:[(0,eB.jsx)("div",{className:aj()("balance-to-pay-amount"),children:lY(new lO(n.totalAmount||0).sub(new lO(C())).toNumber().toFixed(2),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})}),(0,eB.jsx)(S,{expanded:b,color:"#7F56DA"})]})]}),b&&(0,eB.jsx)("div",{className:aj()("balance-to-pay-content"),children:(i=[],((null==m||null==(t=m.selectedWallet)?void 0:t.length)&&m.selectedWallet.forEach(e=>{i.push((0,eB.jsxs)("div",{className:aj()("balance-item-row"),children:[(0,eB.jsx)("div",{className:aj()("balance-item-text"),children:e.name||e.product_name||_("wallet.pass")||"Wallet Pass"}),(0,eB.jsxs)("div",{className:aj()("balance-item-amount"),children:["-",e.redeem||lY(Math.abs(e.savedAmount||0),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]})]},`wallet-${e.id}`))}),0===i.length)?(0,eB.jsx)("div",{className:aj()("balance-item-row","empty-state"),children:(0,eB.jsx)("div",{className:aj()("balance-item-text","empty-text"),children:_("pisell2.checkout.payment-detail.no-wallet-pass-items")||"No WalletPass payment items"})}):(0,eB.jsx)(eB.Fragment,{children:i}))}),(0,eB.jsx)("div",{className:aj()("balance-due-section"),children:(0,eB.jsxs)("div",{className:aj()("balance-due-header"),children:[(0,eB.jsx)("div",{className:aj()("balance-due-title"),children:_("balance.due")||"Balance Due"}),(0,eB.jsx)("div",{className:aj()("balance-due-amount"),children:lY(u||0,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]})})]})]})},eJ6=(0,eN.forwardRef)((e,t)=>{let{children:l,value:i="",onChange:a,onConfirm:n,onCancel:r,showCurrencySymbol:o=!0,useThousandsSeparator:s=!1,selectType:d="dark",disabled:c=!1,overlayClassName:u="",style:p}=e,[m,g]=(0,eN.useState)(!1),[h,v]=(0,eN.useState)(""),[f,y]=(0,eN.useState)(!0);(0,eN.useImperativeHandle)(t,()=>({open:()=>{g(!0),v(i),y(!0)},close:()=>g(!1),isOpen:()=>m}));let b=(0,eB.jsx)("div",{className:"pisell-price-keyboard-popover-content",children:(0,eB.jsx)(nB.PisellPriceKeyboard,{value:h,onChange:e=>{if((""===e||0===e||"0"===e)&&!f){y(!0),v(e),null==a||a(e);return}if(f&&""!==e&&0!==e&&"0"!==e){y(!1);let t=String(h||"").replace(/[^\d.]/g,""),l=String(e).replace(/[^\d.]/g,"");if(t&&"0"!==t&&l.length>t.length&&l.startsWith(t)){let e=l.slice(t.length);if(e){v(e),null==a||a(e);return}}}v(e),null==a||a(e)},onEnter:e=>{null==n||n(e),g(!1)},doneText:ez.getText("pisell2.customise-item.save"),resetText:ez.getText("pisell2.booking.info.text.clear"),amountProps:{showCurrencySymbol:o,useThousandsSeparator:s},selectType:d,backgroundColor:"transparent"})});return(0,eB.jsx)(eM.Popover,{open:m,content:b,trigger:c?[]:["click"],overlayInnerStyle:{padding:0},destroyTooltipOnHide:!0,arrow:!1,align:{offset:[0,0]},overlayClassName:`pisell-price-keyboard-popover ${u}`,onOpenChange:e=>{c||(g(e),e?(v(i),y(!0)):null==r||r())},overlayStyle:p,children:l})});eJ6.displayName="PisellPriceKeyboardPopover";let eJ5=e=>{let{style:t}=e;return(0,eB.jsx)("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,children:(0,eB.jsx)("path",{d:"M21 15L18 12L15 15M15 21L18 24L21 21",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},eJ7=(0,eN.memo)(function(e){var t;let{amountSymbol:l="$",orderInfo:i,open_deposit:a=!1,customAmount:n,balanceDueAmount:r,clientInfo:o,onAmountChange:s,onDepositStatusChange:d,onDepositAmountChange:c,onBalanceDueAmountClick:u,onConfirm:p,confirmLoading:m=!1,paymentItems:g,cartData:h,walletPassData:v,totalAmount:f=0,baseSales:y,shouldUseNormalPayment:b=!1,enablePriceAdjust:x=!0,showPaymentType:k=!0}=e,_=eR(),{action:w,token:S,store:j,getApp:N}=null==(t=_.appHelper)?void 0:t.utils,C=qS(),M=(e,t)=>{var l,i,a,n,r,o,s,d;let c=null==(d=WU[(null==(r=_.appHelper.utils)||null==(n=r.getApp)||null==(a=n.call(r))||null==(i=a.locales)||null==(l=i.getLocale)?void 0:l.call(i))||(null==(s=_.appHelper.utils)||null==(o=s.storage)?void 0:o.get("umi_locale"))||"en"])?void 0:d[e];return c||ez.getText(e)||t},[T,I]=(0,eN.useState)("regular"),[P,A]=(0,eN.useState)(!1),[D,E]=(0,eN.useState)(!1),[O,z]=(0,eN.useState)([]),[L,R]=(0,eN.useState)("0"),[$,F]=(0,eN.useState)(!1),q={deposit:M("pisell2.subtotal.deposit")||"Deposit",total:M("pisell2.subtotal.total")||"Total",sub_total:M("pisell2.subtotal.subtotal")||"Subtotal",tax:M("pisell2.subtotal.tax")||"Tax",delivery_fee:M("pisell2.subtotal.delivery-fee")||"Delivery Fee",discount:M("pisell2.subtotal.discount")||"Discount",point_deduction:M("pisell2.subtotal.point-deduction")||"Point Deduction",member_deduction:M("pisell2.subtotal.member-deduction")||"Member Deduction",expect_amount:M("pisell2.subtotal.expect-amount")||"Expected Amount"},B=()=>"deposit"===T?(""===r?void 0:r)??(null==i?void 0:i.remainingAmount)??(null==i?void 0:i.depositAmount)??"0":(null==i?void 0:i.remainingAmount)??(null==i?void 0:i.totalAmount)??"0",H=e=>{if("number"==typeof e)return e;if("string"==typeof e){let t=e.replace(/[^-0-9.]/g,"");try{return new lO(t||"0").toNumber()}catch{}}return 0},[V,U]=(0,eN.useState)(n&&""!==n?n:H(B())),Y=(0,eN.useMemo)(()=>(null==g?void 0:g.reduce((e,t)=>{if(!eTi(t))return e;try{let l=new lO(t.amount||"0"),i=new lO(t.rounding_amount||"0");return e.plus(l).plus(i)}catch{return e}},new lO(0)))||new lO(0),[g]),W=(0,eN.useCallback)(e=>{try{return lO.max(new lO(e||0).minus(Y),0).toDecimalPlaces(2).toFixed(2)}catch{return"0.00"}},[Y]),G=(0,eN.useMemo)(()=>W(r||B()),[W,r,i,T]),K=(0,eN.useMemo)(()=>W(V||0),[W,V]);(0,eN.useEffect)(()=>{n&&""!==n?U(n):r&&""!==r&&U(r)},[n,r]),(0,eN.useEffect)(()=>{if(y&&i)try{var e,t,l;let a=(null==(t=y.getOrderAmountSnapshot)||null==(e=t.call(y))?void 0:e.summary)||{},n=null==(l=_.appHelper.utils)?void 0:l.translationOriginal,r=Array.isArray(null==a?void 0:a.surcharges)?a.surcharges.filter(e=>null==e?void 0:e.name).map((e,t)=>({key:`custom_surcharge_${e.surcharge_id??t}`,value:e.amount||0,label:(null==n?void 0:n(e.name))||("string"==typeof e.name?e.name:M("service.charge","Service Charge"))})):[],o=[{key:"sub_total",value:a.product_amount||a.product_expect_amount||0},...r,{key:"tax",value:a.tax_fee||0},{key:"discount",value:a.discount_amount||0},{key:"expect_amount",value:a.expect_amount||a.total_amount||0}];Array.isArray(o)&&z(o),b?(I("regular"),A(!1)):P||(I(i.isDeposit?"deposit":"regular"),A(!1))}catch(e){console.warn("Failed to get cart summary:",e)}},[y,i,b,P]),(0,eN.useEffect)(()=>{O.length>0&&(!n||""===n)&&U(H(B()))},[O,n]),(0,eN.useEffect)(()=>{var e;R((null==g||null==(e=g.reduce((e,t)=>{if(!eTt(t))return e;let l=new lO(t.origin_amount??t.amount??"0");if(t.rounding_amount){let e=new lO(t.rounding_amount);e.isNegative()&&(l=l.plus(e.abs()),e.abs().toNumber())}return e.plus(l)},new lO(0)))?void 0:e.toNumber())||0)},[g]);let Q=[{key:"regular",label:(0,eB.jsxs)("div",{className:aj()("amount-summary-dropdown-option"),children:[(0,eB.jsx)(cF,{className:aj()("dropdown-icon")}),M("regular.payment")||"普通支付"]})},{key:"deposit",label:(0,eB.jsxs)("div",{className:aj()("amount-summary-dropdown-option"),children:[(0,eB.jsx)(CZ,{className:aj()("dropdown-icon")}),M("deposit.payment")||"定金支付"]})}],Z=(0,eN.useCallback)(e=>(null==e?void 0:e.parentElement)||document.body,[]),J=async()=>{E(!0)},X=()=>{E(!1)},ee=()=>{let e="deposit"===T?"payment-button-deposit":"payment-button-regular";return aj()(a?"payment-button-with-dropdown":"payment-button-without-dropdown",e)},et=()=>{var e;let t=new lO(L||"0"),l=(null==g||null==(e=g.reduce((e,t)=>{if(eTi(t))try{let l=new lO(t.amount||"0"),i=new lO(t.rounding_amount||"0");return e.plus(l).plus(i)}catch{}return e},new lO(0)))?void 0:e.toNumber())||0,i=t.plus(l).toNumber(),a=(null==g?void 0:g.filter(e=>eTt(e)&&!eTe(e)))||[];return(null==a?void 0:a.length)>0&&i<f||!(i>=f)&&t.toNumber()>0},el=()=>{if(!O||0===O.length)return null;let e=et()?2:3;return(O.length>e?O.slice(0,e):O).map(e=>{let t=e.label||q[e.key]||e.key;return(0,eB.jsxs)("div",{className:aj()("payment-detail-row"),children:[(0,eB.jsx)("span",{className:aj()("payment-detail-label"),children:t}),(0,eB.jsx)("span",{className:aj()("payment-detail-amount"),children:lY(e.value,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]},e.key)})},ei=()=>{if(!O)return!1;let e=et()?2:3;return O.length>e},ea=(0,eN.useMemo)(()=>{var e,t,l,i;return(null==(e=O.find(e=>"discount"===e.key))?void 0:e.value)??(null==y||null==(i=y.getOrderAmountSnapshot)||null==(l=i.call(y))||null==(t=l.summary)?void 0:t.discount_amount)},[y,O]),en=()=>{let e;if(!n&&!Y.gt(0)&&0>=Number(ea||0)&&f>0)return!1;try{e=new lO(K).toNumber()}catch{return!1}if(e<=0){var t;let e=(null==g?void 0:g.filter(eTi))||[];return e.length>0&&e.every(eTe)||((null==v||null==(t=v.selectedDiscountList)?void 0:t.length)??0)>0||Number(ea||0)>0||0===f}return!1},{run:er}=sr(()=>{p&&p()},{wait:500,leading:!0,trailing:!0}),eo=()=>{m||er()},es=async e=>{var t,l;await (null==y||null==(l=y.deleteOrderPayment)?void 0:l.call(y,(null==e?void 0:e.payment_number)||(null==e?void 0:e.order_payment_id)||(null==e||null==(t=e.metadata)?void 0:t.unique_payment_number)||(null==e?void 0:e.uuid)))},ed=(0,eN.useMemo)(()=>{let e=new lO(0),t=null==g?void 0:g.reduce((e,t)=>eTi(t)?e.plus(t.amount):e,new lO(0)).toNumber(),i=lY((e=new lO(Math.abs(e.plus(new lO(0)).plus(t).toNumber()))).toNumber(),l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0});return(0,eB.jsx)("div",{className:aj()("confirm-payment-container"),children:(0,eB.jsxs)("div",{className:aj()("confirm-payment-content"),children:[(0,eB.jsxs)("div",{className:aj()("confirm-payment-text"),children:[M("will.be.paid.in.full")||"Will be paid in full"," ",(0,eB.jsx)("span",{className:aj()("amount-text"),children:i})," ",M("by.wallet")||"by Wallet"]}),(0,eB.jsx)(eM.Button,{className:aj()("confirm-button"),onClick:eo,type:"primary",loading:m,disabled:m,children:M("confirm")||"Confirm"})]})})},[JSON.stringify(g),T,l,r,n,f,y,m]),ec=(0,eN.useMemo)(()=>0!==Number(null==i?void 0:i.totalAmount)&&!(null==g?void 0:g.some(e=>!eTl(e)&&!!eTt(e)&&(null==e?void 0:e.order_payment_type)!=="deposit"&&(null==e?void 0:e.type)!=="deposit")),[g,null==i?void 0:i.totalAmount]);(0,eN.useMemo)(()=>r!==n&&Number(r)>0&&Number(n)>0,[n,r]);let eu=o0(async e=>{let t=String(e);await (null==c?void 0:c(t))}),ep=(0,eN.useMemo)(()=>null==g?void 0:g.some(e=>"deposit"===e.order_payment_type&&eTt(e)),[g]),em=()=>{null==C||C.fail(ez.getText("pisell2.checkout.can-not-change-deposit-amount"))},eg=(0,eN.useMemo)(()=>(0,eB.jsxs)("div",{onClick:x?em:void 0,children:[(0,eB.jsx)("div",{className:aj()("balance-due-label"),children:M("deposit.due")||"Deposit Due"}),(0,eB.jsxs)("div",{className:aj()("balance-due-amount"),children:[lY(G,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0}),x&&(0,eB.jsx)(dU,{className:aj()("edit-icon"),style:{color:"#7F56DA"}})]})]}),[r,l,x]),eh=(0,eN.useMemo)(()=>(0,eB.jsx)(eJ6,{value:G||"0",onConfirm:eu,showCurrencySymbol:!0,useThousandsSeparator:!0,selectType:"dark",overlayClassName:"cash-payment-keyboard-popover pisell-modal-mask-pointer-events-auto",children:(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("div",{className:aj()("balance-due-label"),children:M("deposit.due")||"Deposit Due"}),(0,eB.jsxs)("div",{className:aj()("balance-due-amount"),children:[lY(G,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0}),(0,eB.jsx)(dU,{className:aj()("edit-icon"),style:{color:"#7F56DA"}})]})]})}),[r,l]);return(0,eB.jsxs)("div",{className:aj()("amount-summary-module","amount-summary-container"),children:[k&&(0,eB.jsxs)("div",{className:aj()("left-section"),children:[a&&ec?(0,eB.jsx)(eM.Dropdown,{menu:{items:Q,onClick:e=>{var t;let{key:l,domEvent:i}=e;i.preventDefault(),i.stopPropagation(),I(t=String(l)),A(!0),d&&d("deposit"===t)},style:{backgroundColor:"#7F56DA",border:"1px solid #C3B2E7",borderRadius:"8px",padding:"8px 16px"}},trigger:["click"],placement:"bottomLeft",overlayClassName:"amount-summary-dropdown",getPopupContainer:Z,children:(0,eB.jsx)(eM.Button,{className:ee(),children:(0,eB.jsxs)("div",{className:aj()("button-content"),children:[(0,eB.jsx)("span",{className:aj()("button-text"),children:"deposit"===T?M("deposit.payment.short")||"定金\n支付":M("regular.payment.short")||"普通\n支付"}),(0,eB.jsx)(eJ5,{style:{width:"36px",height:"36px"}})]})})}):(0,eB.jsxs)(eM.Button,{className:ee(),children:[(0,eB.jsx)("div",{children:"deposit"===T?M("deposit.text")||"定金":M("regular.text")||"普通"}),(0,eB.jsx)("div",{children:M("payment.text")||"支付"})]}),(0,eB.jsx)(nB.Iconfont,{type:"pisell2-arrow-right",style:{fontSize:"20px"}})]}),(0,eB.jsx)("div",{className:aj()("middle-section"),children:"deposit"===T?(0,eB.jsx)(eB.Fragment,{children:(0,eB.jsxs)("div",{className:aj()("payment-details"),children:[et()&&(0,eB.jsxs)("div",{className:aj()("partial-paid-card"),children:[(0,eB.jsx)("span",{className:aj()("partial-paid-label"),children:"deposit"===T?M("deposit.partial.paid")||"Deposit Paid":M("partial.paid")||"Partial Paid"}),(0,eB.jsx)("span",{className:aj()("partial-paid-amount"),children:lY(L,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),el(),ei()&&(0,eB.jsxs)("div",{className:aj()("more-section"),onClick:J,style:{cursor:"pointer"},role:"button",children:[(0,eB.jsx)("span",{className:aj()("more-text"),children:M("more")||"更多"}),(0,eB.jsx)(nB.Iconfont,{type:"pisell2-TriangleFill",style:{fontSize:"12px"}})]})]})}):(0,eB.jsxs)("div",{className:aj()("payment-details"),children:[et()&&(0,eB.jsxs)("div",{className:aj()("partial-paid-card"),children:[(0,eB.jsx)("span",{className:aj()("partial-paid-label"),children:M("partial.paid")||"Partial Paid"}),(0,eB.jsx)("span",{className:aj()("partial-paid-amount"),children:lY(L,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),el(),ei()&&(0,eB.jsxs)("div",{className:aj()("more-section"),onClick:J,style:{cursor:"pointer"},role:"button",children:[(0,eB.jsx)("span",{className:aj()("more-text"),children:M("more")||"更多"}),(0,eB.jsx)(nB.Iconfont,{type:"pisell2-TriangleFill",style:{fontSize:"24px",color:"#C3B2E7"}})]})]})}),(0,eB.jsxs)("div",{className:aj()("balance-due-card",{"confirm-mode":en()}),children:[en()?ed:(0,eB.jsx)("div",{className:aj()("balance-due-info"),children:"deposit"===T?ep||!x?eg:eh:(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("div",{className:aj()("balance-due-label"),children:M("balance.due")||"Balance Due"}),(0,eB.jsxs)("div",{className:aj()("balance-due-amount"),onClick:x?()=>null==u?void 0:u("manual-discount"):void 0,children:[lY(G,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0}),x&&(0,eB.jsx)(dU,{className:aj()("edit-icon"),style:{color:"#7F56DA"}})]})]})}),Number(K)>0&&(0,eB.jsxs)("div",{className:aj()("pay-section"),style:{cursor:"pointer"},role:"button",children:[(0,eB.jsx)("span",{className:aj()("pay-text"),children:M("pay")||"支付"}),(0,eB.jsx)("span",{className:aj()("pay-amount"),children:lY((()=>{try{return new lO(K||"0").toNumber()}catch{return 0}})(),l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]})]}),(0,eB.jsx)(nB.PisellModal,{open:D,onCancel:X,footer:null,closable:!0,mask:!0,maskClosable:!0,centered:!0,width:600,wrapClassName:"payment-detail-modal-wrapper",title:M("order.and.payment.summary")||"Order and Payment Summary",children:D&&(0,eB.jsx)(eJ8,{amountSymbol:l,orderInfo:i,cartData:h,onClose:X,summaryData:O,labelMaps:q,paymentItems:g,customAmount:n,voidPayment:es,walletPassData:v,clientInfo:o})})]})}),eJ9=(0,eN.forwardRef)((e,t)=>{let{amountSymbol:l="$",walletPassData:i,onSavePayLater:a}=e,[n,r]=(0,eN.useState)(!1),[o,s]=(0,eN.useState)(""),d=eR(),c=(e,t)=>{var l,i,a,n,r,o,s,c;let u=null==(c=WU[(null==(r=d.appHelper.utils)||null==(n=r.getApp)||null==(a=n.call(r))||null==(i=a.locales)||null==(l=i.getLocale)?void 0:l.call(i))||(null==(s=d.appHelper.utils)||null==(o=s.storage)?void 0:o.get("umi_locale"))||"en"])?void 0:c[e];return u||ez.getText(e)||t},u=()=>{(null==i?void 0:i.selectedWallet)&&i.selectedWallet.length>0?(s(lU((null==i?void 0:i.selectedWallet)&&Array.isArray(i.selectedWallet)?i.selectedWallet.reduce((e,t)=>{let l=new lO(parseFloat(t.redeem)||0);return e.plus(l)},new lO(0)).toNumber():0,2,l)),r(!0)):a()},p=e=>{r(!1),a(e)};return(0,eN.useImperativeHandle)(t,()=>({handleSavePayLaterClick:u})),(0,eB.jsx)(eB.Fragment,{children:(0,eB.jsx)(nB.PisellModal,{visible:n,onCancel:()=>p("cancel"),closable:!1,mask:!0,maskClosable:!1,centered:!0,width:530,title:c("pisell2.checkout.wallet-balance-confirm.title"),footer:null,className:"wallet-balance-confirm-modal",styles:{header:{textAlign:"center",borderBottom:"1px solid #EAECF0",paddingBottom:"16px"}},children:(0,eB.jsxs)("div",{style:{padding:"40px 0 0 0"},children:[(0,eB.jsxs)("div",{style:{textAlign:"center",marginBottom:"32px",lineHeight:"1.5"},children:[(0,eB.jsx)("span",{style:{color:"#533795",fontWeight:600,fontSize:"18px"},children:o}),(0,eB.jsx)("span",{style:{color:"#101828",fontSize:"16px"},children:c("pisell2.checkout.wallet-balance-confirm.description-before")}),(0,eB.jsx)("span",{style:{color:"#533795",fontWeight:600,fontSize:"16px"},children:c("pisell2.checkout.wallet-balance-confirm.description-after")})]}),(0,eB.jsxs)("div",{style:{display:"flex",gap:"12px",flexDirection:"row"},children:[(0,eB.jsx)(eM.Button,{onClick:()=>p("cancel"),style:{flex:"0 1 auto",minWidth:"fit-content",height:"48px",borderRadius:"12px",fontSize:"16px",fontWeight:500,border:"1px solid #D0D5DD",color:"#344054",padding:"0 16px",whiteSpace:"nowrap"},children:c("pisell2.checkout.wallet-balance-confirm.cancel")}),(0,eB.jsx)(eM.Button,{onClick:()=>p("save-without-deduct"),style:{flex:"1 1 auto",height:"48px",borderRadius:"12px",fontSize:"16px",fontWeight:500,border:"1px solid #D0D5DD",color:"#344054",padding:"0 16px",whiteSpace:"nowrap"},children:c("pisell2.checkout.wallet-balance-confirm.save-without-deduct")}),(0,eB.jsx)(eM.Button,{type:"primary",style:{flex:"1.2 1 auto",height:"48px",backgroundColor:"#533795",borderColor:"#533795",borderRadius:"12px",fontWeight:600,fontSize:"16px",border:"none",boxShadow:"0px 1px 2px rgba(16, 24, 40, 0.05)",padding:"0 16px",whiteSpace:"nowrap"},onClick:()=>p("apply-deduct-now"),children:c("pisell2.checkout.wallet-balance-confirm.apply-deduct-now")})]})]})})})});function eXe(e){var t;return(null==e||null==(t=e.discount)?void 0:t.resource_id)||(null==e?void 0:e.id)}function eXt(e){return!!(null==e?void 0:e.order_detail_id)}function eXl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=new Set;return e.forEach(e=>{eXt(e)&&(e.discount_list||[]).forEach(e=>{let l=eXe(e);l&&["good_pass","discount_card"].includes(e.type)&&t.add(String(l))})}),t}function eXi(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=arguments.length>2?arguments[2]:void 0,i=eXl(t),a=l||i;return e.map(e=>{let t=(null==e?void 0:e.id)||eXe(e);return t&&a.has(String(t))?{...e,isEditMode:!0,isSelected:!0}:(null==e?void 0:e.isEditMode)?{...e,isEditMode:!1,isSelected:!1}:e}).map(e=>{let t;return"product_discount_card"!==(t=(null==e?void 0:e.tag)||(null==e?void 0:e.type))&&"discount_card"!==t&&"good_pass"!==t||void 0!==e.isAvailable?e:{...e,isAvailable:!0,isSelected:e.isSelected??!1}})}function eXa(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return eXi((null==e||null==(t=e.getDiscountList)?void 0:t.call(e))||[],l,i)}function eXn(e){return!!(null==e?void 0:e.expire_date)&&ew()(e.expire_date).endOf("day").isBefore(ew()())}function eXr(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=[];t.forEach(e=>{let t=eXt(e);(e.discount_list||[]).forEach(i=>{var a,n,r,o,s;let d=eXe(i);if(!d||!["good_pass","discount_card"].includes(i.type))return;let c=e.quantity||e.num||e.product_quantity||1,u=Number(i.amount||0)*Number(c||1)+Number((null==i||null==(a=i.metadata)?void 0:a.product_discount_difference)||0),p=l.findIndex(e=>e.id===d);if(-1!==p){l[p]={...l[p],amount:Number(l[p].amount||0)+Number(i.amount||0),savedAmount:Number(l[p].savedAmount||0)+u};return}l.push({...i,id:d,tag:i.tag||i.type,name:i.name||(null==(r=i.discount)||null==(n=r.title)?void 0:n.auto),format_title:(null==(o=i.discount)?void 0:o.title)||i.format_title,isEditMode:t,isAvailable:!0,isDisabled:!0,isSelected:!0,limited_relation_product_data:{},savedAmount:u,product_id:(null==(s=i.discount)?void 0:s.product_id)||i.product_id})})});let i=new Set(l.map(e=>e.id));return[...l,...e.filter(e=>!i.has(e.id))]}eJ9.displayName="SavePayLaterHandler";let eXo=e=>{var t,l,i;let{customerName:a,selectedCount:n,expiredCount:r,isCardMode:o,onExpiredClick:s,onBestSaving:d,onClearAll:c,onToggleDisplayMode:u}=e;return(0,eB.jsxs)("div",{className:"wallet-pass-header",children:[(0,eB.jsxs)("div",{className:"wallet-pass-header-left",children:[(0,eB.jsx)("span",{className:"wallet-pass-module-customer-container",dangerouslySetInnerHTML:{__html:(null==(t=ez.getText("wallet-pass-module-cards-vouchers-in-wallet"))?void 0:t(`<span class="theme-color wallet-pass-module-customer">${a}</span>`))||""}}),(0,eB.jsx)("span",{style:{color:"#475467"},children:null==(l=ez.getText("wallet-pass-module-applied"))?void 0:l(n)}),(0,eB.jsx)("span",{className:aj()("error-color","pointer","underline"),onClick:s,children:null==(i=ez.getText("wallet-pass-module-expired"))?void 0:i(r)})]}),(0,eB.jsxs)("div",{className:"wallet-pass-header-right",children:[(0,eB.jsx)("span",{className:aj()("theme-color","pointer","underline"),onClick:d,children:ez.getText("wallet-pass-module-best-saving")}),(0,eB.jsx)("span",{className:aj()("error-color","pointer","underline"),onClick:c,children:ez.getText("wallet-pass-module-clear-all")}),(0,eB.jsx)("div",{onClick:u,className:"wallet-pass-header-right-icon-container",children:(0,eB.jsx)(nB.Icon,{type:"pisell2-chevron-up",className:aj()("wallet-pass-header-right-icon","theme-color","pointer",{rotated:!o})})})]})]})},eXs=nB.PisellText.Amount,eXd=e=>{let{cardData:t,selectedWalletIds:l}=e;return(0,eB.jsx)("div",{className:"wallet-pass-text-mode",children:t&&t.length>0?t.filter(e=>l.includes(e.id)).map(e=>(0,eB.jsxs)("div",{className:"wallet-pass-text-item selected",children:[(0,eB.jsx)("span",{className:"wallet-pass-text-name",children:e.name}),(0,eB.jsxs)("span",{className:"wallet-pass-text-amount",children:["-",(0,eB.jsx)(eXs,{value:e.redeem,showCurrencySymbol:!0})]})]},e.id)):(0,eB.jsx)("div",{className:"wallet-pass-text-empty"})})},eXc=nB.PisellText.Amount,eXu=e=>{let{isCardMode:t,cardData:l,selectedWalletIds:i,onSelectWallet:a,onDetail:n,onConfirmEditAmount:r,onBeforeEditAmount:o}=e;return(0,eB.jsx)("div",{className:"wallet-pass-card-display-container",children:t?(0,eB.jsx)(nB.PisellCardList,{showActiveBackground:!0,showName:!0,showStoreName:!1,showRedeem:!0,showBalance:!0,showCode:!0,showValidDate:!0,showDetail:!0,showQrCode:!0,showCover:!0,showActions:!1,platform:"pc",mode:"multiple",direction:"horizontal",formatBalance:(e,t)=>{var l,i,a,n,r,o,s,d;if((null==t||null==(l=t.data)?void 0:l.originData.tag)==="point_card"){let l=(null==t?void 0:t.active)?(e||0)-((null==t||null==(a=t.data)||null==(i=a.originData)?void 0:i.recommended_usage_par_value)||0):e,o=(s=l||0,(d=null==t||null==(r=t.data)||null==(n=r.originData)?void 0:n.wallet_pass_usage_unit).points&&d.price?new lO(s).div(d.points).mul(d.price).toFixed(2,lO.ROUND_DOWN):new lO(s).toFixed(2));return(0,eB.jsxs)("div",{children:[(0,eB.jsx)(eXc,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:l,showCurrencySymbol:!1}),"(",(0,eB.jsx)(eXc,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:o,showCurrencySymbol:!1}),")"]})}return(null==t?void 0:t.active)?(0,eB.jsx)("div",{children:(0,eB.jsx)(eXc,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:e?e-((null==t||null==(o=t.data)?void 0:o.redeem)||0):0,showCurrencySymbol:!0})}):(0,eB.jsx)("div",{children:(0,eB.jsx)(eXc,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:e,showCurrencySymbol:!0})})},formatBalanceTitle:(e,t)=>(null==t?void 0:t.active)?(0,eB.jsx)("span",{children:ez.getText("wallet-pass-module-balance-after")}):(0,eB.jsx)("span",{children:ez.getText("wallet-pass-module-balance")}),formatRedeemTitle:(e,t)=>(null==t?void 0:t.active)?(0,eB.jsx)("span",{children:t.originDom}):(0,eB.jsx)("span",{children:ez.getText("wallet-pass-module-max.use")}),type:"mini",data:l,hasMore:!1,showEmpty:!1,fullWidth:!1,value:i,useExternalDetail:!0,onDetail:n,showStatus:!1,onChange:e=>{a(e)},actions:{layout:"expanded",detail:{visible:!1,iconColor:"#1570EF"},edit:{visible:!1,iconColor:"#1570EF"}},enableEditAmount:!0,onConfirmEditAmount:r,onBeforeEditAmount:o}):(0,eB.jsx)(eXd,{cardData:l,selectedWalletIds:i})})},eXp=e=>{let{visible:t,walletData:l,onClose:i,title:a,emptyText:n}=e;return(0,eB.jsx)(nB.PisellModal,{title:(0,eB.jsx)("div",{className:"wallet-modal-title",children:a}),open:t,onCancel:i,width:680,footerDivider:!1,headerDivider:!1,cancelVisible:!1,onOk:i,okText:ez.getText("wallet-pass-module-expired-modal-close"),children:(0,eB.jsx)("div",{className:"wallet-modal-content",children:l&&l.length>0?(0,eB.jsx)(nB.PisellCardList,{showActiveBackground:!0,showName:!0,showStoreName:!1,showRedeem:!0,showBalance:!0,showCode:!0,showValidDate:!0,showDetail:!0,showQrCode:!0,showCover:!0,platform:"pc",mode:"single",direction:"horizontal",type:"mini",data:l,hasMore:!1,showEmpty:!1,fullWidth:!1,showStatus:!1,nameTitleStyle:{fontSize:20,fontWeight:600,color:"#f5a623"},actions:{layout:"expanded",detail:{visible:!1,iconColor:"#1570EF"},edit:{visible:!1,iconColor:"#1570EF"}}}):(0,eB.jsx)(nB.PisellEmpty,{title:n||ez.getText("wallet-pass-module-expired-modal-empty")})})})},eXm=nB.PisellText.Amount,eXg=e=>{let{cardData:t,selectedWalletIds:l}=e;return(0,eB.jsx)("div",{className:"discount-text-mode",children:t&&t.length>0?t.filter(e=>l.includes(e.id)).map(e=>(0,eB.jsxs)("div",{className:"discount-text-item selected",children:[(0,eB.jsx)("span",{className:"discount-text-name",children:e.name}),(0,eB.jsxs)("span",{className:"discount-text-amount",children:["-",(0,eB.jsx)(eXm,{value:e.savedAmount,showCurrencySymbol:!0})]})]},e.id)):(0,eB.jsx)("div",{className:"discount-text-empty"})})},eXh=e=>{let{isCardMode:t,cardData:l,selectedWalletIds:i,onSelectWallet:a,onDetail:n,discountDisabled:r}=e,o=qS(),s=(0,eN.useMemo)(()=>r?l.map(e=>({...e,disabled:!0})):l,[r,l]);return(0,eB.jsx)("div",{className:"discount-wallet-list-container",children:t?(0,eB.jsx)(nB.PisellCardList,{className:"",showName:!0,showActiveBackground:!0,showStoreName:e=>{var t;return(null==e||null==(t=e.originData)?void 0:t.tag)!=="good_pass"||e.active},onItemClick:()=>{r&&o.info(ez.getText("wallet-pass-module-discount-partially-paid"))},disabled:r,showRedeem:!1,showBalance:!1,showCode:!1,showValidDate:!1,showDetail:!1,showQrCode:!1,showCover:!1,showActions:!1,platform:"pc",mode:"multiple",direction:"horizontal",type:"mini",data:s,hasMore:!1,showEmpty:!1,fullWidth:!1,value:i,useExternalDetail:!0,onDetail:n,showStatus:!1,nameTitleStyle:{fontSize:20,fontWeight:600,color:"#FF8A1E"},onChange:a,actions:{layout:"expanded",detail:{visible:!1,iconColor:"#1570EF"},edit:{visible:!1,iconColor:"#1570EF"}},enableEditAmount:!1}):(0,eB.jsx)(eXg,{cardData:l,selectedWalletIds:i})})},eXv={status:"idle",items:[],selectedIds:[],selectedItems:[],committedIds:[],selectionSources:{},totalSelectedAmount:0,error:null,revision:0};function eXf(e){return(null==e?void 0:e.id)??(null==e?void 0:e.voucher_id)??(null==e?void 0:e.code)}function eXy(e){return["product_discount_card","discount_card","good_pass","entitlement_pass"].includes((null==e?void 0:e.tag)||(null==e?void 0:e.type))}let eXb=(0,eN.forwardRef)((e,t)=>{var l;let{orderInfo:i,onSelectChange:a,paymentItems:n,clientId:r,baseSales:o,onDiscountChange:s}=e,d=function(e){var t,l;let{baseSales:i,clientId:a,onSelectChange:n,onDiscountChange:r}=e,[o,s]=(0,eN.useState)(()=>{var e;return(null==i||null==(e=i.getWalletAssetsState)?void 0:e.call(i))||eXv}),[d,c]=(0,eN.useState)(()=>{var e;return((null==i||null==(e=i.getDiscountList)?void 0:e.call(i))||[]).filter(eXy)}),[u,p]=(0,eN.useState)(!1),m=(0,eN.useRef)(!1),g=(0,eN.useRef)(null),h=(0,eN.useRef)(null),v=(0,eN.useRef)(!1);(0,eN.useEffect)(()=>{var e,t;let l=null==i||null==(e=i.getWalletAssetsState)?void 0:e.call(i);if(l&&s(l),c(((null==i||null==(t=i.getDiscountList)?void 0:t.call(i))||[]).filter(eXy)),!(null==i?void 0:i.effectsOn))return;let a=i.effectsOn("onWalletAssetsStateChanged",e=>{if(null==e?void 0:e.state){if(m.current){g.current=e.state;return}s(e.state)}}),n=i.effectsOn("onDiscountApplied",e=>{var t;c((Array.isArray(null==e?void 0:e.discountList)?e.discountList:(null==i||null==(t=i.getDiscountList)?void 0:t.call(i))||[]).filter(eXy))});return()=>{[a,n].forEach(e=>{var t;"function"==typeof e?e():null==e||null==(t=e.remove)||t.call(e)})}},[i]),(0,eN.useEffect)(()=>{var e;let t;try{t=null==n?void 0:n(((null==o?void 0:o.selectedItems)||[]).flatMap(e=>{let t,l=(null==e?void 0:e.voucher_id)??(null==e?void 0:e.id),i=(t=Number(eTJ(e)??(null==e?void 0:e.amount)??0),Number.isFinite(t)&&t>0?t:0);return void 0===l||i<=0?[]:[{voucher_id:l,amount:i,code:null==e?void 0:e.tag,wallet_pass_usage_unit:null==e?void 0:e.wallet_pass_usage_unit,wallet_pass_use_value:null==e?void 0:e.wallet_pass_use_value}]}))}catch(t){throw null==(e=h.current)||e.call(h),h.current=null,v.current=!1,t}let l=h.current;if(l&&!v.current){v.current=!0;let e=()=>{h.current===l&&(h.current=null,v.current=!1),l()};Promise.resolve(t).then(e,e)}},[n,o.revision]),(0,eN.useEffect)(()=>()=>{var e;null==(e=h.current)||e.call(h),h.current=null,v.current=!1},[]);let f=(0,eN.useMemo)(()=>[...o.selectedIds||[],...o.committedIds||[]],[o.committedIds,o.selectedIds]),y=(0,eN.useMemo)(()=>new Set((o.committedIds||[]).map(e=>String(e))),[o.committedIds]),b=(0,eN.useMemo)(()=>new Map((o.selectedItems||[]).map(e=>[String(eXf(e)??(null==e?void 0:e.code)??""),e])),[o.selectedItems]),x=(0,eN.useMemo)(()=>eT1((o.items||[]).map(e=>{let t={...e,...b.get(String(eXf(e)??(null==e?void 0:e.code)??""))||{}};return{...t,...(null==t?void 0:t.unified_available_status)!==void 0?{unified_available_status:Number(t.unified_available_status)}:{},...(null==t?void 0:t._unified_available_status)!==void 0?{_unified_available_status:Number(t._unified_available_status)}:{},...(null==t?void 0:t.available)===!1||(null==t?void 0:t.isDisabled)===!0?{unified_available_status:0,unified_messages:(null==t?void 0:t.unified_messages)||{title:(null==t?void 0:t.reason)||(null==t?void 0:t.disabledReason)}}:{}}}),f).map(e=>({...e,enableEditAmount:!y.has(String(e.id)),...y.has(String(e.id))?{disabled:!0,active:!0}:{}})),[y,b,f,o.items]),k=(0,eN.useMemo)(()=>x.filter(e=>{var t;let l=null==e||null==(t=e.originData)?void 0:t.expire_date;return!!l&&ew()(l).endOf("day").isBefore(ew()())}),[x]),_=(0,eN.useMemo)(()=>k.map(e=>e.id),[k]),w=(0,eN.useMemo)(()=>d.filter(e=>null==e?void 0:e.isSelected).map(e=>null==e?void 0:e.id),[d]),S=(0,eN.useMemo)(()=>eT4(d.filter(e=>(null==e?void 0:e.isAvailable)!==!1||(null==e?void 0:e.isSelected)),w),[d,w]),j=o0(e=>{var t,l,a;c(((null==i||null==(t=i.getDiscountList)?void 0:t.call(i))||[]).filter(eXy)),null==r||r({...e,discountList:(null==i||null==(l=i.getDiscountList)?void 0:l.call(i))||[],productList:(null==i||null==(a=i.getOrderProducts)?void 0:a.call(i))||[]})}),N=o0(async e=>{if(!(null==i?void 0:i.selectWalletAsset)||u)return;let t=new Set((o.committedIds||[]).map(e=>String(e))),l=new Set((o.selectedIds||[]).map(e=>String(e))),a=new Set(e.map(e=>String(e)));p(!0);try{for(let e of o.items||[]){let n=eXf(e);if(void 0===n||t.has(String(n)))continue;let r=l.has(String(n)),o=a.has(String(n));r!==o&&await i.selectWalletAsset({assetId:n,selected:o,source:"manual"})}}finally{p(!1)}}),C=o0(async()=>{if(!u){p(!0);try{var e,t;for(let l of(await (null==i||null==(e=i.clearWalletAssetSelection)?void 0:e.call(i)),w))await (null==i||null==(t=i.setDiscountSelected)?void 0:t.call(i,{discountId:l,isSelected:!1}));j()}finally{p(!1)}}}),M=o0(async(e,t)=>{var l,a,n,r;if(!(null==i?void 0:i.scanWalletAsset))return null;p(!0),m.current=!0,g.current=null;let d=!1,c=o.revision;try{let t=await i.scanWalletAsset(e);d=!0;let n=null==t?void 0:t.asset;if((null==t?void 0:t.type)==="walletCode"){let e=(null==t?void 0:t.data)||n;if(!e)return t;if((null==e?void 0:e.is_cross_shop_wallet)!==!0&&1!==Number(null==e?void 0:e.is_cross_shop_wallet))return{...t,data:e,asset:e};let l=Number(null==e?void 0:e.customer_id);if(!Number.isInteger(l)||l<=1||"function"!=typeof(null==i?void 0:i.resolveCustomerById))throw Error("Customer resolve is unavailable");let a=await i.resolveCustomerById(l);if(!a)throw Error("Customer resolve failed");let r={...e,customer:a};return{...t,data:r,asset:r}}let r=Number((null==n?void 0:n.customer_id)??(null==n||null==(l=n.holder)?void 0:l.customer_id)),o=null==i||null==(a=i.getOrderCustomerSnapshot)?void 0:a.call(i),s=Number((null==o?void 0:o.id)??(null==o?void 0:o.customer_id)??1),c=!Number.isInteger(s)||s<=1,u=Number.isInteger(r)&&r>1;if(c&&u){if("function"!=typeof(null==i?void 0:i.resolveCustomerById)||"function"!=typeof(null==i?void 0:i.setOrderCustomer)||"function"!=typeof(null==i?void 0:i.refreshWalletAssets))throw Error("Customer resolve is unavailable");let l=await i.resolveCustomerById(r);if(!l)throw Error("Customer resolve failed");i.setOrderCustomer(l);let a=await i.refreshWalletAssets({preserveSelection:!1,retainSearchResultCodes:[e]});return{...t,state:a||(null==t?void 0:t.state)}}return t}finally{let e;m.current=!1;let l=(null==i||null==(n=i.getWalletAssetsState)?void 0:n.call(i))||g.current;g.current=null;try{l&&((null==t?void 0:t.waitForApply)&&d&&!Object.is(l.revision,c)&&(null==(r=h.current)||r.call(h),v.current=!1,e=new Promise(e=>{h.current=e})),s(l)),await e}finally{p(!1)}}}),T=o0(async e=>{if(u)return;let t=new Set(w.map(e=>String(e))),l=new Set(e.map(e=>String(e)));p(!0);try{for(let e of d){let n=null==e?void 0:e.id;if(void 0===n)continue;let r=t.has(String(n)),o=l.has(String(n));if(r!==o){var a;await (null==i||null==(a=i.setDiscountSelected)?void 0:a.call(i,{discountId:n,isSelected:o}))}}j()}finally{p(!1)}}),I=o0(async()=>{if(!u){p(!0);try{var e,t,l;let a=(o.items||[]).filter(e=>null==e?void 0:e._wallet_asset_recommended).map(e=>eXf(e)).filter(e=>void 0!==e);for(let l of(await (null==i||null==(e=i.clearWalletAssetSelection)?void 0:e.call(i)),a))await (null==i||null==(t=i.selectWalletAsset)?void 0:t.call(i,{assetId:l,selected:!0,source:"manual"}));if(S.length){let e=await (null==i||null==(l=i.bestDiscount)?void 0:l.call(i));j(e)}}finally{p(!1)}}}),P=o0(async(e,t,l)=>{if(!(null==i?void 0:i.updateWalletAssetAmount)||u)return;let a=eXf((null==l?void 0:l.originData)||l),n=Number(e);if(void 0!==a&&Number.isFinite(n)&&!(n<0)){p(!0);try{await i.updateWalletAssetAmount({assetId:a,amount:n})}finally{p(!1)}}});return{cardData:x,selectedWalletIds:f,expiredWalletIds:_,expiredWalletData:k,disabledWalletData:[],clearDisabledWalletData:()=>void 0,clearAllSelectedWallet:C,handleBestSaving:I,handleSearchIdentificationCode:M,handleSelectWallet:N,availableDiscountList:S,selectedDiscountList:w,handleSelectDiscount:T,customerName:(null==i||null==(l=i.getCustomer)||null==(t=l.call(i))?void 0:t.name)||(a?String(a):""),handleConfirmEditAmount:P,handleBeforeEditAmount:async()=>!0,loading:"loading"===o.status||u}}({baseSales:o,clientId:r,onSelectChange:a,onDiscountChange:s}),[c,u]=(0,eN.useState)(!0),[p,m]=(0,eN.useState)(!1);(0,eN.useImperativeHandle)(t,()=>({handleSearchIdentificationCode:d.handleSearchIdentificationCode,getWalletPassData:e=>({selectedWallet:e.length?d.cardData.filter(e=>d.selectedWalletIds.some(t=>String(t)===String(e.id))):[],availableDiscountList:d.availableDiscountList,selectedDiscountList:d.selectedDiscountList})}));let g=o0(()=>{u(e=>!e)}),h=(0,eN.useMemo)(()=>0===Number(null==i?void 0:i.totalAmount)||!!(null==n?void 0:n.some(e=>!eTl(e)&&!!eTt(e)&&!eMH.includes(e.code))),[null==i?void 0:i.totalAmount,n]),v=d.selectedWalletIds.length+d.selectedDiscountList.length;return 0===d.cardData.length&&0===d.availableDiscountList.length?null:(0,eB.jsx)("div",{className:"wallet-pass-module-container",children:(0,eB.jsx)(nB.PisellLoading,{delay:300,loading:d.loading,fullscreen:!1,mask:{backgroundColor:"rgba(255, 255, 255, 0.5)",width:"100%",height:"100%"},children:(0,eB.jsxs)("div",{className:"wallet-pass-module",children:[(0,eB.jsx)(eXo,{customerName:d.customerName,selectedCount:v,expiredCount:d.expiredWalletIds.length,isCardMode:c,onExpiredClick:()=>m(!0),onBestSaving:d.handleBestSaving,onClearAll:d.clearAllSelectedWallet,onToggleDisplayMode:g}),(0,eB.jsx)(eXu,{isCardMode:c,cardData:d.cardData,selectedWalletIds:d.selectedWalletIds,onSelectWallet:d.handleSelectWallet,onDetail:()=>void 0,onConfirmEditAmount:d.handleConfirmEditAmount,onBeforeEditAmount:d.handleBeforeEditAmount}),(0,eB.jsx)(eXh,{isCardMode:c,cardData:d.availableDiscountList,selectedWalletIds:d.selectedDiscountList,onSelectWallet:d.handleSelectDiscount,onDetail:()=>void 0,discountDisabled:h}),(0,eB.jsx)(eXp,{visible:p,walletData:d.expiredWalletData,onClose:()=>m(!1),title:null==(l=ez.getText("wallet-pass-module-expired-modal-title"))?void 0:l(d.expiredWalletData.length)})]})})})}),eXx=(0,eN.forwardRef)((e,t)=>{var l;let{orderInfo:i,onSelectChange:a,customAmount:n,paymentItems:r,clientId:o,baseSales:s,onDiscountChange:d}=e,{handleSelectWallet:c,cardData:u,selectedWalletIds:p,expiredWalletIds:m,expiredWalletData:g,disabledWalletData:h,clearAllSelectedWallet:v,clearDisabledWalletData:f,handleBestSaving:y,loading:b,handleSearchIdentificationCode:x,availableDiscountList:k,selectedDiscountList:_,handleSelectDiscount:w,customerName:S,handleConfirmEditAmount:j,handleBeforeEditAmount:N}=(e=>{let{onSelectChange:t,customAmount:l,clientId:i,totalAmount:a}=e,n=eHy(),[r,o]=(0,eN.useState)([]),[s,d]=(0,eN.useState)([]),[c,u]=(0,eN.useState)([]),[p,m]=(0,eN.useState)([]),g=(0,eN.useRef)([]),h=(0,eN.useRef)([]),v=(0,eN.useRef)([]),f=(0,eN.useRef)(""),y=(0,eN.useRef)(null),b=(0,eN.useRef)(""),x=(0,eN.useRef)(null),k=(0,eN.useRef)(new Set),_=(0,eN.useRef)(""),w=(0,eN.useRef)(""),S=(0,eN.useRef)(null),j=(0,eN.useRef)(!1),[N,C]=(0,eN.useState)([]),[M,T]=(0,eN.useState)({}),[I,P]=(0,eN.useState)([]),A=(0,eN.useRef)([]),[D,E]=(0,eN.useState)([]),[O,z]=(0,eN.useState)([]),L=(0,eN.useRef)(!1),R=(0,eN.useRef)(!1),$=(0,eN.useRef)(!1),[F,q]=(0,eN.useState)([]),B=(0,eN.useMemo)(()=>I.map(e=>e.id),[I]),H=(0,nB.useToast)(),[V,U]=(0,eN.useState)(!1),[Y,W]=(0,eN.useState)(null),[G,K]=(0,eN.useState)([]),Q=e.baseSales,Z=null==Q?void 0:Q.payment,J=null==Z?void 0:Z.wallet,X=o0(()=>i),ee=o0(()=>{var e,t,i;let n=(null==Q||null==(e=Q.getOrderAmountSnapshot)?void 0:e.call(Q))||(null==Q||null==(i=Q.getOrderSnapshot)||null==(t=i.call(Q))?void 0:t.amount)||{},r=n.amountGap??n.depositAmount??n.totalAmount??n.expectAmount;return Number(l??r??a??0)}),et=o0(()=>{var e,t,l,i,a,n;if(F.length>0)return F;let r=(null==Q||null==(e=Q.getOrderProducts)?void 0:e.call(Q))||[];return r.length>0?r:(null==Q||null==(l=Q.getTempOrder)||null==(t=l.call(Q))?void 0:t.products)||(null==Q||null==(n=Q.getOrderSnapshot)||null==(a=n.call(Q))||null==(i=a.tempOrder)?void 0:i.products)||[]}),el=o0(()=>{var e,t,l,i,a,n,r,o,s;if(!Q)return;let d=(null==Q||null==(e=Q.getTempOrder)?void 0:e.call(Q))||(null==Q||null==(l=Q.getOrderSnapshot)||null==(t=l.call(Q))?void 0:t.tempOrder),c=(null==Q||null==(i=Q.getOrderProducts)?void 0:i.call(Q))||(null==d?void 0:d.products)||[],u=eXl(c),p=String((null==d?void 0:d.order_id)||(null==(n=Q.getOrderIdentity)||null==(a=n.call(Q))?void 0:a.orderId)||""),m=null==Q||null==(r=Q.store)?void 0:r.order,g=(null==Q||null==(o=Q.getDiscountList)?void 0:o.call(Q))||(null==m||null==(s=m.getDiscountList)?void 0:s.call(m))||[];_.current!==p&&(_.current=p,k.current=u);let v=em(eXi(g,c,k.current));h.current=v,K(v)}),ei=o0(async()=>{var e,t,l,i,a,n,r,o;let s=(null==Q||null==(e=Q.getTempOrder)?void 0:e.call(Q))||(null==Q||null==(l=Q.getOrderSnapshot)||null==(t=l.call(Q))?void 0:t.tempOrder),d=(null==Q||null==(i=Q.getOrderProducts)?void 0:i.call(Q))||(null==s?void 0:s.products)||[],c=Number(X()||0);if(!Q)return;let u=eXl(d),p=String((null==s?void 0:s.order_id)||(null==(n=Q.getOrderIdentity)||null==(a=n.call(Q))?void 0:a.orderId)||"");_.current!==p&&(_.current=p,k.current=u);let m=JSON.stringify({orderId:(null==s?void 0:s.order_id)||(null==(o=Q.getOrderIdentity)||null==(r=o.call(Q))?void 0:r.orderId),customerId:c,productDiscounts:d.map(e=>({productId:e.product_id||e.id,discounts:(e.discount_list||[]).map(e=>({id:eXe(e),amount:e.amount,type:e.type}))}))});if(f.current===m&&G.length>0)return;if(y.current&&f.current===m)return y.current;f.current=m;let g=async()=>{var e,t,l,i,a,n,r,o,u,p;if("function"==typeof(null==Q?void 0:Q.loadDiscountConfig)){let e=await Q.loadDiscountConfig({customerId:c,action:(null==s?void 0:s.order_id)?"edit":"create"});return{...e,discountList:eXi((null==e?void 0:e.discountList)||[],d,k.current)}}let m=null==Q||null==(e=Q.store)?void 0:e.order;if(!(null==m?void 0:m.loadDiscountConfig))return{productList:d,discountList:eXr((null==m||null==(u=m.getDiscountList)?void 0:u.call(m))||(null==Q||null==(p=Q.getDiscountList)?void 0:p.call(Q))||[],d)};let g=eXr(await m.loadDiscountConfig({customerId:c,action:(null==s?void 0:s.order_id)?"edit":"create",orderId:Number((null==s?void 0:s.order_id)||(null==Q||null==(l=Q.getOrderIdentity)||null==(t=l.call(Q))?void 0:t.orderId))||void 0,apply:!1})||(null==(i=m.getDiscountList)?void 0:i.call(m))||[],d);return await (null==m||null==(r=m.store)||null==(n=r.discount)||null==(a=n.setDiscountList)?void 0:a.call(n,g)),{productList:(null==(o=m.getOrderProducts)?void 0:o.call(m))||d,discountList:g}},v=(async()=>{let e=await g(),t=em((null==e?void 0:e.discountList)||eXa(Q,d,k.current));h.current=t,K(t)})();y.current=v;try{return await v}finally{y.current===v&&(y.current=null)}}),ea=(0,eN.useMemo)(()=>{var e,t;return null==Z||null==(t=Z.window)||null==(e=t.getWalletPassEvaluator)?void 0:e.call(t)},[Z]),en=o0(e=>{P(e),A.current=e}),er=o0(()=>A.current.reduce((e,t)=>{let l=Number((null==t?void 0:t.actualDeduction)??(null==t?void 0:t._available_max_amount)??(null==t?void 0:t.available_max_amount)??(null==t?void 0:t.recommended_usage_amount)??(null==t?void 0:t.amount)??0);return e+(Number.isFinite(l)?l:0)},0)),eo=o0(()=>{let e=new Map,t=t=>{"number"==typeof(null==t?void 0:t.edit_current_amount)&&e.set(t.id,t.edit_current_amount)};return[A.current,I,c,r,s,N].forEach(e=>{(e||[]).forEach(t)}),e}),es=o0(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=eo();return t.size?e.map(e=>t.has(e.id)?{...e,edit_current_amount:t.get(e.id)}:e):e}),ed=o0(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=new Map;return(A.current.forEach(e=>{D.includes(e.id)&&t.set(e.id,{actualDeduction:e.actualDeduction,_available_max_amount:e._available_max_amount,recommended_usage_amount:e.recommended_usage_amount,recommended_usage_par_value:e.recommended_usage_par_value,available_max_amount:e.available_max_amount})}),t.size)?e.map(e=>{let l=t.get(e.id);return l&&void 0===e.actualDeduction&&void 0===e._available_max_amount&&void 0===e.available_max_amount&&void 0===e.recommended_usage_amount?{...e,...l}:e}):e});(0,eN.useEffect)(()=>{r9(i)&&0===N.length&&!Q&&(d([]),o([]),K([]))},[i]);let ec=(0,eN.useMemo)(()=>eT4(G.filter(e=>!!e.isAvailable).map(e=>({...e,isDisabled:e.isDisabled||e.isDisabledForProductUsed,savedAmount:e.savedAmount||0}))),[G]),eu=(0,eN.useMemo)(()=>ec.filter(e=>e.isSelected&&!e.isEditMode).map(e=>e.id),[ec]),ep=o0(e=>{if(0===g.current.length)return e;let t=new Map(e.map(e=>[e.id,e])),l=[],i=new Set;if(N.length>0)for(let e of[...N].reverse()){let a=t.get(e.id);a&&!i.has(e.id)&&(l.push(a),i.add(e.id))}for(let t of e)g.current.some(e=>e.id===t.id)||i.has(t.id)||(l.push(t),i.add(t.id));for(let e of g.current)t.has(e.id)&&!i.has(e.id)&&(l.push(t.get(e.id)),i.add(e.id));return l}),em=o0(e=>{let t=e=>e.sort((e,t)=>e.isSelected&&!t.isSelected?-1:!e.isSelected&&t.isSelected?1:0);if(0===h.current.length||0===e.length)return[...e.filter(e=>e.isEditMode),...t(e.filter(e=>!e.isEditMode))];let l=new Map;for(let t of e){var i;l.has(t.id)||l.set(t.id,[]),null==(i=l.get(t.id))||i.push(t)}let a=e=>{let t=l.get(e.id);if(!(null==t?void 0:t.length))return null;let i=t.indexOf(e);return -1===i?null:t.splice(i,1)[0]},n=(e,t)=>{let i=l.get(e.id);if(!(null==i?void 0:i.length))return null;let a=i.findIndex(l=>t(l,e));return -1===a?null:i.splice(a,1)[0]},r=[],o=[],s=[];for(let e of h.current.filter(e=>e.isEditMode)){let t=n(e,e=>!!e.isEditMode);t&&r.push(t)}for(let t of e){if(!t.isEditMode)continue;let e=a(t);e&&r.push(e)}for(let e of h.current){if(e.isEditMode)continue;let t=n(e,e=>!e.isEditMode);t&&o.push(t)}for(let t of e){if(t.isEditMode)continue;let e=a(t);e&&s.push(e)}return[...r,...o,...t(s)]}),eg=(0,eN.useMemo)(()=>[...c||[],...N||[]],[c,N]),eh=(0,eN.useMemo)(()=>D.map(e=>eg.find(t=>t.id===e)).filter(Boolean),[D,eg]),{displayVouchers:ev,displayOtherVouchers:ef,selectedWithDetails:ey,totalDeduction:eb}=(0,eN.useMemo)(()=>{if(!ea||!eg.length||!a)return{displayVouchers:[...c||[],...p||[]],displayOtherVouchers:N||[],selectedWithDetails:[],totalDeduction:0};let e=et(),t=ea.recalculateVouchers(eg,eh,a,e),l=[],i=[];return t.allWithUpdatedStatus.forEach(e=>{N.some(t=>t.id===e.id)?i.push(e):l.push(e)}),{displayVouchers:[...l,...p||[]],displayOtherVouchers:i,selectedWithDetails:t.selectedWithDetails,totalDeduction:t.selectedWithDetails.reduce((e,t)=>e+(t.actualDeduction||0),0)}},[eh,eg,c,N,p,a,F,Q]);Fr(()=>{let e;try{e=eE(ey)}catch(e){var t;throw null==(t=S.current)||t.call(S),S.current=null,j.current=!1,e}en(ey),U(!1);let l=S.current;if(l&&!j.current){j.current=!0;let t=()=>{S.current===l&&(S.current=null,j.current=!1),l()};Promise.resolve(e).then(t,t)}},[ey],{wait:200}),(0,eN.useEffect)(()=>()=>{var e;null==(e=S.current)||e.call(S),S.current=null,j.current=!1},[]);let ex=(0,eN.useMemo)(()=>eT1(ep4(ep([...ey,...ev,...ef]),"id"),D),[ev,ef,D,ey]),ek=o0(async e=>{U(!0),W(null);try{var t;let l=await (null==J||null==(t=J.getUserIdentificationCodeListAsync)?void 0:t.call(J,e));if(!l)return[];let i=ep4([...l,...A.current],"id");return d(i),l}catch(e){throw W(e instanceof Error?e.message:"获取用户识别码列表失败"),e}finally{U(!1)}}),e_=o0(()=>{var e;return(null==J||null==(e=J.getWalletRecommendList)?void 0:e.call(J))||[]}),ew=o0(()=>{var e;return(null==J||null==(e=J.getUserIdentificationCodes)?void 0:e.call(J))||[]}),eS=o0(()=>{var e;null==J||null==(e=J.clearWalletRecommendList)||e.call(J),o([])}),ej=o0(()=>{var e;null==J||null==(e=J.clearUserIdentificationCodes)||e.call(J),d([])}),eC=o0(()=>{var e;null==J||null==(e=J.clearAllCache)||e.call(J),o([]),d([]),C([]),z([]),m([]),u([]),en([]),E([])}),eM=o0(l=>{var i,a;null==J||null==(i=J.clearAllCache)||i.call(J),o([]),d([]),C([]),z([]),m([]),u([]),en([]),E([]),K([]),q([]),T({}),W(null),U(!1),g.current=[],h.current=[],v.current=[],f.current="",y.current=null,b.current="",x.current=null,k.current=new Set,_.current="",L.current=!1,R.current=!1,$.current=!1,(null==l?void 0:l.notify)!==!1&&(null==t||t([]),null==(a=e.onDiscountChange)||a.call(e,{discountList:[]}))}),eT=o0(e=>{let{currentSearchResults:t,cachedSearchResults:l}=e,i=et(),n=t;ea&&t.length>0&&a&&(n=ea.searchVoucherFormat({vouchers:t,orderTotalAmount:a,products:i}));let r=l||[];ea&&l&&l.length>0&&a&&(r=ea.searchVoucherFormat({vouchers:l,orderTotalAmount:a,products:i}));let o=ep4([...r||[],...n],"id"),s=[],d=[];n.length>0&&n.forEach(e=>{eT0(e)?s.push(e):d.push(e)});let c=o.filter(e=>eT0(e)),u=o.filter(e=>!eT0(e));z(u);let p=[...A.current];return 1===s.length&&(p=[...A.current,...s],R.current=!0),C(c),m(u),en(p),E(p.map(e=>e.id)),1===s.length}),eI=o0(e=>{var l,i,a,r;T((null==Q||null==(i=Q.getOrderSnapshot)||null==(l=i.call(Q))?void 0:l.tempOrder)||{});let s=(null==e?void 0:e.walletRecommendList)||e_(),c=(null==e?void 0:e.userIdentificationCodes)||ew(),p=(null==J||null==(a=J.getStoredWalletInitData)?void 0:a.call(J))||{},f=(null==e?void 0:e.transformList)||p.transformList||c,y=(null==e?void 0:e.noApplicableVoucher)||p.noApplicableVoucher||[],b=(null==e?void 0:e.products)||p.products||[];(R.current||v.current.length>0)&&(s=es(s),c=es(c),f=es(f)),D.length>0&&(s=ed(s),c=ed(c),f=ed(f));let x=[...s,...c],_=R.current||D.length>0;if(o(s),d(c),u(f),m(y),q(b),g.current=x,L.current||_)if(_){let e=new Set(D);en(ep4([...f,...N,...A.current],"id").filter(t=>e.has(t.id)))}else en([]),E([]),L.current=!1,null==t||t([]);else{en(s),E(s.map(e=>e.id));let e=((null==J||null==(r=J.formatWalletPassList2PreparePayments)?void 0:r.call(J,s))||[]).map(e=>({code:e.tag,voucher_id:e.voucher_id,amount:e.amount||0,wallet_pass_usage_unit:e.wallet_pass_usage_unit,wallet_pass_use_value:e.wallet_pass_use_value}));null==n||n.addLog({type:"info",title:"useWalletPass_onOrderCreated onSelectChange 开始调用",metadata:{}}),null==t||t(e)}let w=em(eXa(Q,b.length?b:F,k.current));h.current=w,K(w),$.current&&(null==H||H.success(ez.getText("wallet-pass-module-best-combination-selected"))),$.current=!1}),eP=o0(async e=>{var t,l,i,a;if(!(null==Q?void 0:Q.initWalletData))return;let n=Number((null==e?void 0:e.order_wait_pay_amount)??ee()),o=er(),s=D.length>0?Number((n+o).toFixed(2)):n;if(s<=0)return;let d=JSON.stringify({orderId:(null==Q||null==(l=Q.getTempOrder)||null==(t=l.call(Q))?void 0:t.order_id)||(null==Q||null==(a=Q.getOrderIdentity)||null==(i=a.call(Q))?void 0:i.orderId),customerId:X(),orderWaitPayAmount:s});if(x.current&&b.current===d)return x.current;if(b.current===d&&r.length>0)return;b.current=d,U(!0);let c=(async()=>{let t=await Q.initWalletData({...e,order_wait_pay_amount:s});return b.current===d&&eI(t),t})();x.current=c;try{return await c}finally{x.current===c&&(x.current=null),U(!1)}}),eA=(0,eN.useMemo)(()=>{var e,t,l,i;let a=(null==M||null==(e=M._extend)?void 0:e.customerSnapshot)||(null==M?void 0:M.customer)||(null==M||null==(t=M.original_order_data)?void 0:t.customer)||{};return r9((null==M?void 0:M.customer_id)||(null==M||null==(l=M.original_order_data)?void 0:l.customer_id)||(null==a?void 0:a.id)||(null==a?void 0:a.customer_id))?ez.getText("wallet-pass-module-customer-name-walk-in"):(null==a?void 0:a.display_name)||(null==a?void 0:a.name)||(null==M?void 0:M.customer_name)||(null==M||null==(i=M.original_order_data)?void 0:i.customer_name)||""},[M]);(0,eN.useEffect)(()=>{let e=X(),t=null==e||""===e?"":String(e);if(Q){if(w.current!==t&&(eM(),w.current=t),!t||r9(e))return void el();(async()=>{await ei()})()}},[Q,i,l,a]),(0,eN.useEffect)(()=>{if(!Q)return;let e=ee();e<=0||eP({order_wait_pay_amount:e})},[Q,i,l,a]);let eD=(0,eN.useMemo)(()=>[...s,...r,...[...N].reverse()],[r,s,N]);o0(()=>N.filter(e=>!A.current.some(t=>t.id===e.id)).map(e=>e.code));let eE=o0(e=>{var l;let i=(null==J||null==(l=J.formatWalletPassList2PreparePayments)?void 0:l.call(J,e))||[],a=[];return i.forEach(e=>{e.amount&&a.every(t=>t.voucher_id!==e.voucher_id)&&a.push({voucher_id:e.voucher_id,amount:e.amount,code:e.tag,wallet_pass_usage_unit:e.wallet_pass_usage_unit,wallet_pass_use_value:e.wallet_pass_use_value})}),null==n||n.addLog({type:"info",title:"useWalletPass_notifySelectChange 通知外部选择变化",metadata:{selectedDetails:e,select:a}}),null==t?void 0:t(a)}),eO=o0(async(e,t)=>{var l,i;if(!(null==J?void 0:J.searchIdentificationCodeAsync))return null;let a=await J.searchIdentificationCodeAsync({code:e,prepare_payments:(null==(l=J.formatWalletPassList2PreparePayments)?void 0:l.call(J,ey))||[]}),n=eT({currentSearchResults:(null==a?void 0:a.data)||[],cachedSearchResults:N});return(null==t?void 0:t.waitForApply)&&n&&(null==(i=S.current)||i.call(S),j.current=!1,await new Promise(e=>{S.current=e})),a}),eL=o0(e=>{U(!0),R.current=!0;let t=D.filter(t=>!e.includes(t));if(t.length>0){let e=t.filter(e=>{let t=eg.find(t=>t.id===e);return(null==t?void 0:t.edit_current_amount)!==void 0});e.length>0&&(eY(e,{edit_current_amount:void 0}),v.current=v.current.filter(t=>!e.includes(t)))}E(e),en(eg.filter(t=>e.includes(t.id)))}),eR=(0,eN.useMemo)(()=>ep4(eD,"id").filter(e=>eXn(e)),[eD,B]),e$=(0,eN.useMemo)(()=>eT1(ep4(eD,"id").filter(e=>eXn(e)),[],{error:!0,showStatus:!1}),[eD]),eF=o0(async()=>{if(v.current.length>0&&(eY(v.current,{edit_current_amount:void 0}),v.current=[]),0!==B.length||0!==eu.length){if(U(!0),eu.length){var l,i,a;for(let e of(L.current=!0,eu))await (null==Q||null==(a=Q.setDiscountSelected)?void 0:a.call(Q,{discountId:e,isSelected:!1}));let t=(null==Q||null==(l=Q.getOrderProducts)?void 0:l.call(Q))||[],n={productList:t,discountList:eXa(Q,t,k.current)},r=em(n.discountList);K(r),null==(i=e.onDiscountChange)||i.call(e,{...n,discountList:r}),U(!1);return}R.current=!0,en([]),E([]),null==n||n.addLog({type:"info",title:"useWalletPass_clearAllSelectedWallet 立即通知外部清空",metadata:{}}),null==t||t([]),U(!1)}}),eq=o0(()=>{if(0===r.length)return!0;let e=r.map(e=>e.id).sort(),t=B.sort();return JSON.stringify(e)===JSON.stringify(t)}),eB=o0(async()=>{null==n||n.addLog({type:"info",title:"useWalletPass_handleBestSaving 开始调用",metadata:{}}),U(!0);let t=!1,l=!1;if(ec.length){var i,a,o,s;t=!0,$.current=!0;let n=await (null==Q||null==(i=Q.bestDiscount)?void 0:i.call(Q)),r=(null==n?void 0:n.productList)||(null==Q||null==(a=Q.getOrderProducts)?void 0:a.call(Q))||[],d=em(eXi((null==n?void 0:n.discountList)||(null==Q||null==(o=Q.getDiscountList)?void 0:o.call(Q))||[],r,k.current));K(d),null==(s=e.onDiscountChange)||s.call(e,{...n,discountList:d}),eT3(d.filter(e=>e.isSelected).map(e=>e.id),eu)&&($.current=!1,l=!0,U(!1),null==H||H.info(ez.getText("wallet-pass-module-already-best-combination")))}if(0===r.length){if((!t||t&&l)&&U(!1),N.length)if(eT3(B,N.map(e=>e.id)))null==H||H.info(ez.getText("wallet-pass-module-already-best-combination"));else{let e=N.filter(e=>eT0(e));en(e),E(e.map(e=>e.id)),e.length&&(null==H||H.success(ez.getText("wallet-pass-module-best-combination-selected")))}return}let d=!1,c=r;if(v.current.length>0&&(d=!0,c=eY(v.current,{edit_current_amount:void 0}).newWalletRecommendList,v.current=[]),eq()&&!d)t||null==H||H.info(ez.getText("wallet-pass-module-already-best-combination"));else{if(t&&!l)return;en(c),E(c.map(e=>e.id)),null==H||H.success(ez.getText("wallet-pass-module-best-combination-selected"))}U(!1)}),eH=o0(async(t,l)=>{U(!0);try{var i,a,n;let r=t.includes(l.id);await (null==Q||null==(i=Q.setDiscountSelected)?void 0:i.call(Q,{discountId:l.id,isSelected:r}));let o=(null==Q||null==(a=Q.getOrderProducts)?void 0:a.call(Q))||[],s={productList:o,discountList:eXa(Q,o,k.current)},d=em(s.discountList);K(d),null==(n=e.onDiscountChange)||n.call(e,{...s,discountList:d})}finally{U(!1)}}),eV=o0(()=>{z([])}),eU=o0((e,t,l)=>{let i=Array.isArray(t)?t:[t];return e.map(e=>i.includes(e.id)?{...e,...l}:e)}),eY=o0((e,t)=>{let l=eU(r,e,t);o(l);let i=eU(s,e,t);d(i);let a=eU(c,e,t);u(a);let n=eU(N,e,t);C(n);let p=eU(I,e,t);return en(p),{newWalletRecommendList:l,newUserIdentificationCodes:i,newTransformList:a,newSearchIdentificationCodeList:n,newSelectedWallet:p}}),eW=o0((e,t,l)=>{0===e?eL(D.filter(e=>e!==l.id)):(U(!0),v.current.includes(l.id)||v.current.push(l.id),eY(l.id,{edit_current_amount:e}))});return{walletRecommendList:r,userIdentificationCodes:s,loading:V,error:Y,cardData:ex,handleSelectWallet:eL,selectedWalletIds:B,expiredWalletIds:eR,expiredWalletData:e$,disabledWalletData:O,clearAllSelectedWallet:eF,clearDisabledWalletData:eV,handleBeforeEditAmount:o0(async(e,t,l)=>!0),handleBestSaving:eB,handleSearchIdentificationCode:eO,availableDiscountList:ec,selectedDiscountList:eu,handleSelectDiscount:eH,customerName:eA,fetchUserIdentificationCodes:ek,getCachedWalletRecommendList:e_,getCachedUserIdentificationCodes:ew,clearWalletRecommendList:eS,clearUserIdentificationCodes:ej,clearAllCache:eC,handleConfirmEditAmount:eW}})({onSelectChange:a,customAmount:n,totalAmount:Number(null==i?void 0:i.totalAmount)||0,clientId:o,baseSales:s,onDiscountChange:d}),[C,M]=(0,eN.useState)(!1),[T,I]=(0,eN.useState)(!1),[P,A]=(0,eN.useState)(!0),D=o0(()=>{M(!0)}),E=o0(()=>{M(!1)}),O=o0(()=>{I(!1),f()}),z=o0(()=>{A(!P)}),L=o0((e,t)=>{}),R=eC().useMemo(()=>eT1(h||[],[],{error:!0,showStatus:!1}),[h]);(0,eN.useEffect)(()=>{h&&h.length>0&&!T&&I(!0)},[h,T]),(0,eN.useImperativeHandle)(t,()=>({handleSearchIdentificationCode:x,getWalletPassData:e=>({selectedWallet:e.length?u.filter(e=>p.includes(e.id)):[],availableDiscountList:k,selectedDiscountList:_})}));let $=(0,eN.useMemo)(()=>{if(h&&1===h.length){var e,t;return(null==(t=h[0])||null==(e=t.unified_messages)?void 0:e.title)||""}return ez.getText("wallet-pass-module-disabled-modal-title")},[h]),F=(0,eN.useMemo)(()=>p.length+_.length,[p.length,_.length]),q=(0,eN.useMemo)(()=>0===Number(null==i?void 0:i.totalAmount)||!!(null==r?void 0:r.some(e=>!eTl(e)&&!!eTt(e)&&!eMH.includes(e.code))),[r,i]);return 0===u.length&&0===k.length&&0===h.length?null:(0,eB.jsx)("div",{className:"wallet-pass-module-container",children:(0,eB.jsx)(nB.PisellLoading,{delay:300,loading:b,fullscreen:!1,mask:{backgroundColor:"rgba(255, 255, 255, 0.5)",width:"100%",height:"100%"},children:(0,eB.jsxs)("div",{className:"wallet-pass-module",children:[(0,eB.jsx)(eXo,{customerName:S,selectedCount:F,expiredCount:m.length,isCardMode:P,onExpiredClick:D,onBestSaving:y,onClearAll:v,onToggleDisplayMode:z}),(0,eB.jsx)(eXu,{isCardMode:P,cardData:u,selectedWalletIds:p,onSelectWallet:c,onDetail:L,onConfirmEditAmount:j,onBeforeEditAmount:N}),(0,eB.jsx)(eXh,{isCardMode:P,cardData:k,selectedWalletIds:_,onSelectWallet:w,onDetail:L,discountDisabled:q}),(0,eB.jsx)(eXp,{visible:C,walletData:g,onClose:E,title:null==(l=ez.getText("wallet-pass-module-expired-modal-title"))?void 0:l((null==g?void 0:g.length)||0)}),(0,eB.jsx)(eXp,{visible:T,walletData:R,onClose:O,title:$})]})})})}),eXk=(0,eN.forwardRef)((e,t)=>"shared"===e.mode?(0,eB.jsx)(eXb,{...e,ref:t}):(0,eB.jsx)(eXx,{...e,ref:t})),eX_=(0,eN.memo)(eXk),eXw={en:{"pisell2.text.others":"Others","pisell2.text.order-note":"Order Note","pisell2.text.print-receipt":"Print Receipt","pisell2.text.save-pay-later":"Save & Pay Later","pisell2.text.send-link":"Send Link","pisell2.text.manual-order-discount":"Manual Order Discount","pisell2.text.order-no-payment-required":"Order requires no payment, cannot manually adjust price","pisell2.text.order-no-payment-cannot-send-link":"Order requires no payment, cannot send payment link.","pisell2.text.additional-module.order-discount":"Order Discount"},"zh-CN":{"pisell2.text.others":"其他","pisell2.text.order-note":"订单备注","pisell2.text.print-receipt":"打印收据","pisell2.text.save-pay-later":"保存稍后支付","pisell2.text.send-link":"发送链接","pisell2.text.manual-order-discount":"手动订单折扣","pisell2.text.order-no-payment-required":"订单已无需支付,不可手动改价","pisell2.text.order-no-payment-cannot-send-link":"订单已无需支付,不可发送支付链接","pisell2.text.additional-module.order-discount":"订单折扣"},"zh-HK":{"pisell2.text.others":"其他","pisell2.text.order-note":"訂單備註","pisell2.text.print-receipt":"打印收據","pisell2.text.save-pay-later":"保存稍後支付","pisell2.text.send-link":"發送鏈接","pisell2.text.manual-order-discount":"手動訂單折扣","pisell2.text.order-no-payment-required":"訂單已無需支付,不可手動改價","pisell2.text.order-no-payment-cannot-send-link":"訂單已無需支付,不可發送支付鏈接","pisell2.text.additional-module.order-discount":"订单折扣"},ja:{"pisell2.text.others":"その他","pisell2.text.order-note":"注文メモ","pisell2.text.print-receipt":"領収書を印刷","pisell2.text.save-pay-later":"保存して後で支払う","pisell2.text.send-link":"リンクを送信","pisell2.text.manual-order-discount":"手動注文割引","pisell2.text.order-no-payment-required":"注文は支払い不要のため、手動で価格を変更できません","pisell2.text.order-no-payment-cannot-send-link":"注文は支払い不要のため、支払いリンクを送信できません","pisell2.text.additional-module.order-discount":"注文割引"},pt:{"pisell2.text.others":"Outros","pisell2.text.order-note":"Nota do Pedido","pisell2.text.print-receipt":"Imprimir Recibo","pisell2.text.save-pay-later":"Salvar e Pagar Depois","pisell2.text.send-link":"Enviar Link","pisell2.text.manual-order-discount":"Desconto Manual do Pedido","pisell2.text.order-no-payment-required":"O pedido n\xe3o requer pagamento, n\xe3o \xe9 poss\xedvel ajustar o pre\xe7o manualmente","pisell2.text.order-no-payment-cannot-send-link":"O pedido n\xe3o requer pagamento, n\xe3o \xe9 poss\xedvel enviar o link de pagamento.","pisell2.text.additional-module.order-discount":"Desconto do Pedido"}},eXS=function(e){let{orderInfo:t,customAmount:l,handleButtonClick:i,hasOrderNote:a=!1,disabled:n=!1,showCashPayment:r=!1,isFullWidth:o=!1,showMore:s=!0}=e;sZ(eXw,eZ());let d=[{key:"send-link",label:ez.getText("pisell2.text.send-link"),icon:(0,eB.jsx)(jd,{})},{key:"print-receipt",label:ez.getText("pisell2.text.print-receipt"),icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-printer"})}],c=qS();return(0,eB.jsxs)("div",{className:"additional-module",children:[r&&(0,eB.jsx)("div",{className:"additional-module-title",children:ez.getText("pisell2.text.others")}),(0,eB.jsx)("div",{className:"additional-module-buttons-container",children:r&&!o?(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)("div",{className:"additional-module-button-row",children:[(0,eB.jsxs)(eM.Button,{className:`additional-module-button-base purple-theme ${a?"note-button":""}`,onClick:()=>{i("order-note")},icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-clipboard-minus",className:"additional-module-button-icon"}),size:"large",children:[ez.getText("pisell2.text.order-note"),a&&(0,eB.jsx)("span",{className:"note-indicator",children:(0,eB.jsx)(nB.Icon,{type:"pisell2-info-circle2"})})]}),(0,eB.jsx)(eM.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("split-payment")},icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-coins-01",className:"additional-module-button-icon"}),size:"large",children:ez.getText("split.payment")})]}),(0,eB.jsxs)("div",{className:"additional-module-button-row",children:[(0,eB.jsx)(eM.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("manual-discount")},icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-sale-01",className:"additional-module-button-icon"}),size:"large",children:ez.getText("pisell2.text.additional-module.order-discount")}),(0,eB.jsx)(eM.Button,{className:`additional-module-button-base ${n?"disabled-theme":"orange-theme"}`,onClick:()=>{i("save-pay-later")},disabled:n,size:"large",icon:(0,eB.jsx)(g2,{className:"additional-module-button-icon"}),children:ez.getText("pisell2.text.save-pay-later")}),s&&(0,eB.jsx)(eM.Dropdown,{menu:{items:d,onClick:e=>{let{key:t}=e;"send-link"===t?n?c.fail(ez.getText("pisell2.text.order-no-payment-cannot-send-link")):i("send-link"):"print-receipt"===t?i("print-receipt"):"split-payment"===t?i("split-payment"):"print-receipt"===t&&i("print-receipt")}},trigger:["click"],placement:"bottomLeft",overlayStyle:{zIndex:9999,pointerEvents:"auto"},mouseEnterDelay:.1,mouseLeaveDelay:.1,onOpenChange:e=>{},children:(0,eB.jsx)(eM.Button,{size:"large",className:"additional-module-button-base more-button",icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-dots-vertical",size:20})})})]}),!s&&(0,eB.jsxs)("div",{className:"additional-module-button-row",children:[(0,eB.jsx)(eM.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("send-link")},disabled:n,size:"large",icon:(0,eB.jsx)(jd,{}),children:ez.getText("pisell2.text.send-link")}),(0,eB.jsx)(eM.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("print-receipt")},disabled:n,size:"large",icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-printer"}),children:ez.getText("pisell2.text.print-receipt")})]})]}):(0,eB.jsxs)("div",{className:"additional-module-button-row",children:[(0,eB.jsxs)(eM.Button,{className:`additional-module-button-base purple-theme ${a?"note-button":""}`,onClick:()=>{i("order-note")},size:"large",icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-clipboard-minus",className:"additional-module-button-icon"}),children:[ez.getText("pisell2.text.order-note"),a&&(0,eB.jsx)("span",{className:"note-indicator",children:(0,eB.jsx)(nB.Icon,{type:"pisell2-info-circle2"})})]}),(0,eB.jsx)(eM.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("split-payment")},size:"large",icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-coins-01",className:"additional-module-button-icon"}),children:ez.getText("split.payment")}),(0,eB.jsx)(eM.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("manual-discount")},icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-sale-01",className:"additional-module-button-icon"}),size:"large",children:ez.getText("pisell2.text.additional-module.order-discount")}),(0,eB.jsx)(eM.Button,{className:`additional-module-button-base ${n?"disabled-theme":"orange-theme"}`,onClick:()=>{i("save-pay-later")},disabled:n,size:"large",icon:(0,eB.jsx)(g2,{className:"additional-module-button-icon"}),children:ez.getText("pisell2.text.save-pay-later")}),(0,eB.jsx)(eM.Dropdown,{menu:{items:d,onClick:e=>{let{key:t}=e;"send-link"===t?n?c.fail(ez.getText("pisell2.text.order-no-payment-cannot-send-link")):i("send-link"):"split-payment"===t?i("split-payment"):"print-receipt"===t&&i("print-receipt")}},trigger:["click"],placement:"bottomLeft",overlayStyle:{zIndex:9999,pointerEvents:"auto"},mouseEnterDelay:.1,mouseLeaveDelay:.1,onOpenChange:e=>{},children:(0,eB.jsx)(eM.Button,{className:"additional-module-button-base more-button",size:"large",icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-dots-vertical",size:20})})})]})})]})},eXj={paid:{titleKey:"payment.result.success",fallbackTitle:"Payment Successful",subtitleMode:"paid",colorClass:"paid",statusClassName:"success",autoClose:!0,maskClosable:!1},partially_paid:{titleKey:"payment.result.success",fallbackTitle:"Payment Successful",subtitleMode:"partial",colorClass:"partially-paid",statusClassName:"success",autoClose:!0,maskClosable:!1},deposit_paid:{titleKey:"payment.result.success",fallbackTitle:"Payment Successful",subtitleMode:"deposit",colorClass:"paid",statusClassName:"success",autoClose:!0,maskClosable:!1},failed:{titleKey:"payment.result.failed",fallbackTitle:"Payment Failed",subtitleMode:"amount_due",colorClass:"amount-due",statusClassName:"failed",autoClose:!1,maskClosable:!1},"wallet-pass-redemption-failed":{titleKey:"pisell2.checkout.wallet-pass.redemption-failed",fallbackTitle:"Wallet pass redeem failed",subtitleMode:"wallet_pass_partial",colorClass:"partially-paid",statusClassName:"wallet-pass-failed",autoClose:!1,maskClosable:!1}};function eXN(e,t){return t||(e?"error"===e?"failed":e in eXj?e:"paid":null)}function eXC(e){let{paymentStatus:t,resultKind:l,orderTotalAmount:i,gapAmount:a,depositAmount:n,changeGivenAmount:r,failureReason:o,isModalMode:s}=e,d=eXN(t,l);if(!d)return null;let c=eXj[d],u={autoClose:c.autoClose,autoCloseDelay:30,maskClosable:c.maskClosable};return s&&(u.autoClose=!1,u.autoCloseDelay=0,u.maskClosable=!1),{resultKind:d,statusClassName:c.statusClassName,paymentStatus:t||d,orderTotalAmount:Number(i||0),depositAmount:Number(n||0),changeGivenAmount:Number(r||0),gapAmount:"partially_paid"===d?Number(a||0):Number(r||0),failureReason:o,autoCloseConfig:u}}let eXM=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$";return lU(e,2,t)},eXT=async(e,t)=>{var l;let i,{paymentStatus:a,resultKind:n,orderTotalAmount:r,gapAmount:o,depositAmount:s,changeGivenAmount:d,failureReason:c,autoCloseConfig:u,actionButtons:p}=e,{getData:m,onToastClose:g}=t,h=eMf({status:"wallet-pass-redemption-failed"===eXN(a,n)?"wallet-pass-failed":eMv("deposit_paid"===n?"deposit_paid":a),paymentStatus:a,currencySymbol:(null==m?void 0:m("shop_symbol"))||"$",orderTotalAmount:r,changeGivenAmount:d,failureReason:c,summary:null,disableDetail:!0});return(null==(l=t.onResultViewModel)||l.call(t,h),"page"===t.paymentResultDisplayMode)?h:(i={...h,actionButtons:p||[],autoClose:(null==u?void 0:u.autoClose)||!1,autoCloseDelay:(null==u?void 0:u.autoCloseDelay)||10,showCountdownProgress:!!(null==u?void 0:u.autoClose),clickOutsideToClose:!!(null==u?void 0:u.autoClose),closable:!0,onClose:g||(()=>{})},WG.addToast(i),h)},eXI=e=>(0,eB.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"currentColor",viewBox:"0 0 24 24",...e,children:(0,eB.jsx)("path",{fillRule:"evenodd",d:"M17.646 7.06A7.503 7.503 0 0 0 4.54 11.213 1 1 0 0 1 2.552 11 9.49 9.49 0 0 1 7.25 3.772c4.129-2.383 9.303-1.316 12.182 2.308l.109-.405a1 1 0 0 1 1.932.518l-.732 2.732a1 1 0 0 1-1.225.707L16.784 8.9a1 1 0 0 1 .518-1.932zm2.913 4.839a1 1 0 0 1 .889 1.1 9.49 9.49 0 0 1-4.698 7.228c-4.129 2.384-9.303 1.316-12.182-2.307l-.109.405a1 1 0 0 1-1.932-.518l.733-2.732a1 1 0 0 1 1.224-.707l2.732.732a1 1 0 0 1-.517 1.932l-.345-.093a7.502 7.502 0 0 0 13.105-4.152 1 1 0 0 1 1.1-.889",clipRule:"evenodd"})}),eXP=e=>(0,eB.jsx)(ne,af(af({},e),{},{viewBox:(null==e?void 0:e.viewBox)||"0 0 24 24",component:eXI})),eXA={display:"flex",flexDirection:"column",minHeight:0,overflowY:"auto",maxHeight:"90%",padding:"0px 16px 16px"},eXD={list:[],pagination:{page:1,pageSize:20,total:0},hasMore:!1};function eXE(e){var t,l,i;if(!e)return eXD;let a=(null==(t=e.getCustomerState)?void 0:t.call(e))||{},n=(null==(l=e.getCustomers)?void 0:l.call(e))||[],r=a.customerList||a.list||a.customers||n,o=a.currentPage||a.page||1,s=a.pageSize||20,d=a.total??r.length;return{list:r,pagination:{page:o,pageSize:s,total:d},hasMore:"boolean"==typeof a.hasMore?a.hasMore:!!(null==(i=e.hasMoreCustomers)?void 0:i.call(e))}}let eXO=(0,eN.memo)(e=>{var t,l,i,a,n,r,o,s;let{disabledSwitch:d,clientInfo:c,onSearch:u,beginScanActivity:p,onClientChange:m,baseSales:g,baseSalesModuleName:h,enableScanner:v=!0,showCustomerSelect:f=!0}=e,[y,b]=(0,eN.useState)(!1),[x,k]=(0,eN.useState)(!1),[_,w]=(0,eN.useState)(!1),[S,j]=(0,eN.useState)(eXD),[N,C]=(0,eN.useState)(0),M=(0,eN.useRef)(null),T=(0,eN.useRef)(null),I=eR(),P=(0,nB.useToast)(),A=(0,eN.useMemo)(()=>{var e,t,l,i;return g||h&&(null==(i=I.appHelper)||null==(l=i.utils)||null==(t=l.pisellos)||null==(e=t.getModule)?void 0:e.call(t,h))||null},[h,null==(l=I.appHelper)||null==(t=l.utils)?void 0:t.pisellos,g]),D=(null==A||null==(i=A.getBookingConfig)?void 0:i.call(A))??null,E=null==D||null==(r=D.config)||null==(n=r.basic)||null==(a=n.appointment_subject)?void 0:a.form_id,O=(0,eN.useCallback)(e=>{var t;let l,i,a;j(e?(l=eXE(A),(a=Array.isArray(i=(null==e?void 0:e.data)??e)?i:Array.isArray(null==i?void 0:i.list)?i.list:Array.isArray(null==i?void 0:i.customerList)?i.customerList:Array.isArray(null==e?void 0:e.list)?e.list:Array.isArray(null==e?void 0:e.customerList)?e.customerList:[]).length?{...l,list:a,pagination:{...l.pagination,total:(null==e?void 0:e.total)??(null==e||null==(t=e.data)?void 0:t.total)??l.pagination.total}}:l):eXE(A))},[A]),z=(0,eN.useCallback)(()=>{C(e=>e+1)},[]),L=(0,eN.useMemo)(()=>{var e,t,l,i,a,n;return(null==c?void 0:c.id)||(null==c?void 0:c.customer_id)||(null==c?void 0:c.display_name)||(null==c?void 0:c.name)?c:(null==A||null==(e=A.getCustomer)?void 0:e.call(A))||(null==A||null==(t=A.getOrderCustomerSnapshot)?void 0:t.call(A))||(null==A||null==(n=A.getOrderSnapshot)||null==(a=n.call(A))||null==(i=a.tempOrder)||null==(l=i._extend)?void 0:l.customerSnapshot)||c||null},[A,c,N]),R=(0,eN.useCallback)(async e=>{var t,l,i,a,n,r,o,s;if(!(null==e?void 0:e.trim()))return;let c=null==p?void 0:p();if(p&&!c){null==(t=M.current)||t.setKeyword("");return}b(!0);try{let t=await (null==u?void 0:u(e));if(!((null==t?void 0:t.asset)||(Array.isArray(null==t?void 0:t.data)?t.data.length>0:!!(null==t?void 0:t.data)))){null==P||null==(i=P.info)||i.call(P,ez.getText("pisell2.checkout.wallet-pass-module.no-result"));return}if("type"in t&&"walletCode"==t.type){if(d){null==P||null==(r=P.info)||r.call(P,ez.getText("pisell2.checkout.client-card.tip.partially-paid"));return}let{customer:e,...l}=t.data;if(!e){null==P||null==(o=P.info)||o.call(P,ez.getText("pisell2.checkout.wallet-pass-module.no-result"));return}let i={...e,latest_wallet_detail:l};await (null==(n=T.current)||null==(a=n.handleSetClient)?void 0:a.call(n,i,{sameClientTip:ez.getText("pisell2.checkout.client-card.tip.same-client")}))}null==(l=M.current)||l.setKeyword("")}catch(t){let e=t instanceof Error?t.message:String(t||"");null==P||null==(s=P.error)||s.call(P,e||ez.getText("pisell2.checkout.wallet-pass-module.no-result"))}finally{b(!1),null==c||c()}},[P,p,d,u]);(0,eN.useEffect)(()=>{O(),z()},[O,z]),(0,eN.useEffect)(()=>{if(!(null==A?void 0:A.effectsOn))return;let e=A.effectsOn("onCustomerListUpdate",()=>{O()}),t=A.effectsOn("onCustomerListReset",()=>{O()}),l=A.effectsOn("onOrderCustomerChange",()=>{z()});return()=>{[e,t,l].forEach(e=>{var t;"function"==typeof e?e():null==e||null==(t=e.remove)||t.call(e)})}},[A,z,O]);let $=(0,eN.useMemo)(()=>{let e=(0,eB.jsx)(nB.Icon,{type:"pisell2-switch-horizontal-01",size:24,style:{color:"#667085"}}),t={buttonProps:{icon:e,size:"default"}};return!0===d&&(t={open:!1,buttonProps:{icon:e,size:"default",onClick:()=>{var e;null==P||null==(e=P.info)||e.call(P,ez.getText("pisell2.checkout.client-card.tip.partially-paid"))},style:{cursor:"not-allowed"}}}),t},[P,d]),F=(0,eN.useCallback)(async(e,t)=>{if(A){(null==t?void 0:t.showLoading)!==!1&&k(!0);try{var l;let i=A.resetAndLoadCustomers?await A.resetAndLoadCustomers({search:e||void 0,relation_form_id:(null==t?void 0:t.relation_form_id)??E??void 0}):await (null==(l=A.getCustomerList)?void 0:l.call(A,{search:e||void 0,relation_form_id:(null==t?void 0:t.relation_form_id)??E??void 0,skip:1,num:S.pagination.pageSize}));O(i)}finally{k(!1)}}},[A,S.pagination.pageSize,E,O]),q=(0,eN.useCallback)(async()=>{if(A&&!_){w(!0);try{var e;let t=await (null==(e=A.loadMoreCustomers)?void 0:e.call(A));O(t)}finally{w(!1)}}},[A,_,O]),B=(0,eN.useCallback)(async(e,t)=>{if(A){k(!0);try{var l;let i=await (null==(l=A.changeCustomerPage)?void 0:l.call(A,e,t));O(i)}finally{k(!1)}}},[A,O]),H=(0,eN.useCallback)(async e=>{var t,l,i,a,n;if(!A){null==m||m(e);return}e?(A.setOrderCustomer?A.setOrderCustomer(e):null==(a=A.updateTempOrderCustomer)||a.call(A,e),null==(i=A.setActiveCustomer)||i.call(A,e)):A.clearOrderCustomer?A.clearOrderCustomer():A.updateTempOrderCustomer?A.updateTempOrderCustomer({customer_id:null,customer_name:"",phone:"",email:""}):null==(n=A.setOrderCustomer)||n.call(A,null),e||null==(t=A.setActiveCustomer)||t.call(A,null),null==(l=A.updateTempOrderContactsInfo)||l.call(A,eCt(e)),z(),null==m||m(e)},[A,m,z]),V=(0,eN.useCallback)(e=>{var t;null==A||null==(t=A.addCustomerToFirst)||t.call(A,e),O()},[A,O]),U=(0,eN.useCallback)((e,t)=>{var l,i;let a=null==(i=I.appHelper)||null==(l=i.utils)?void 0:l.action,n=(null==e?void 0:e.id)??(null==e?void 0:e.customer_id);a&&n&&a({type:"pisell1.handleOpenCustomerModal",data:{id:n},callback:t})},[null==(s=I.appHelper)||null==(o=s.utils)?void 0:o.action]);return(0,eB.jsxs)("div",{className:"checkout-search-client-module",style:{display:"flex",gap:8},children:[(0,eB.jsx)(Zy,{ref:M,className:"checkout-search-client-module__find",displayType:"detached",triggerType:"input",searchMode:"confirm",showConfirmButton:!0,showHistory:!1,enableScanner:v,loading:y,placeholder:ez.getText("pisell2.checkout.search-section.placeholder"),onSearch:R,searchSectionProps:{style:{flex:1,minWidth:0},cameraButtonProps:{icon:["pisell2-camera-01","pisell2-qr-code-02"]},searchButtonProps:{placement:"inside",style:{height:36,padding:8,minWidth:76}}}}),f&&(0,eB.jsx)(eCd,{ref:T,value:L,list:S.list,loading:x,loadingMore:_,hasMore:S.hasMore,pagination:S.pagination,onSearch:F,onLoadMore:q,onChangePage:B,onSelect:H,onAddToFirst:V,onOpenCustomerDetail:U,readOnly:d,bookingConfig:D,clientCardProps:{style:{width:326,minHeight:48,height:48,padding:"4px 8px",borderColor:"#D0D5DD"},avatar:{size:"sm"},dropdown:$}})]})});function eXz(e,t){try{return{value:e(),error:null}}catch(e){return{value:t,error:e}}}let eXL=()=>void 0,eXR={display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto minmax(0, 1fr)",alignItems:"center",gap:12,width:"100%"},eX$={justifySelf:"start"},eXF={minWidth:0,textAlign:"center",fontSize:16,fontWeight:600,lineHeight:"24px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},eXq={justifySelf:"end",minWidth:0};function eXB(e){var t,l;let i=eXV(e.currencyAmount)??new lO(0),a=eXV(null==(t=e.walletPassUsageUnit)?void 0:t.points),n=eXV(null==(l=e.walletPassUsageUnit)?void 0:l.price);return!a||!n||a.eq(0)||n.eq(0)?lU(i.toNumber()):i.div(n).toDecimalPlaces(6,lO.ROUND_DOWN).mul(a).toFixed(2,lO.ROUND_DOWN)}function eXH(e){try{return new lO(e||0).toDecimalPlaces(2).toFixed(2)}catch{return"0.00"}}function eXV(e){if(null==e)return null;try{return new lO(e)}catch{return null}}function eXU(e){let t=eXV(e);return(null==t?void 0:t.isFinite())?lO.max(t,0).toFixed(2):void 0}function eXY(e){let t=eXV(e);return!t||t.lte(0)?"":t.toDecimalPlaces(2).toFixed(2)}function eXW(e,t){return eXU((null==e?void 0:e.expectAmount)??(null==e?void 0:e.totalAmount)??(null==t?void 0:t.totalAmount))??"0.00"}function eXG(e,t){var l,i;let a=(null==e||null==(l=e.getOrderAmountSnapshot)?void 0:l.call(e))||{},n=(null==e||null==(i=e.getTempOrder)?void 0:i.call(e))||{};return eXU(a.depositAmount??n.deposit_amount??(null==t?void 0:t.depositAmount))??eXW(a,t)}function eXK(e){var t,l,i,a,n,r,o,s,d;let c=null==e||null==(t=e.getOrderSnapshot)?void 0:t.call(e),u=(null==e||null==(l=e.getOrderAmountSnapshot)?void 0:l.call(e))||(null==c?void 0:c.amount)||{},p=(null==c?void 0:c.identity)||{};if(!c&&!u)return null;let m=(null==c?void 0:c.tempOrder)||{},g=(null==m||null==(i=m._extend)?void 0:i.customerSnapshot)||(null==m?void 0:m.customer)||(null==c?void 0:c.customer)||null,h=m.customer_id??(null==g?void 0:g.id)??(null==g?void 0:g.customer_id)??(null==c||null==(a=c.customer)?void 0:a.customerId),v=(null==g?void 0:g.display_name)||(null==g?void 0:g.name)||m.customer_name||(null==c||null==(n=c.customer)?void 0:n.customerName)||"";return{orderId:p.orderId||p.externalSaleNumber||p.orderNumber,status:null==c?void 0:c.status,...ePC(u,m),paymentStatus:null==c?void 0:c.paymentStatus,itemCount:(null==c?void 0:c.productCount)||(null==c||null==(o=c.tempOrder)||null==(r=o.products)?void 0:r.length)||0,hasLocalOrderData:!!(null==c?void 0:c.tempOrder),customerId:h,customerName:v,customerPhone:(null==g?void 0:g.phone)||m.phone||(null==c||null==(s=c.customer)?void 0:s.phone)||"",customerEmail:(null==g?void 0:g.email)||m.email||(null==c||null==(d=c.customer)?void 0:d.email)||"",customerSnapshot:g}}function eXQ(e){let t=(null==e?void 0:e.submitResult)||e,l=eX5(t);return(null==l?void 0:l.data)||(null==t?void 0:t.data)||l||{}}async function eXZ(e){var t;await (null==e||null==(t=e.confirmPendingVoucherPayments)?void 0:t.call(e))}async function eXJ(e){var t;"function"==typeof(null==e?void 0:e.discardPendingVoucherPayments)?await e.discardPendingVoucherPayments():await (null==e||null==(t=e.updateVoucherOrderPayments)?void 0:t.call(e,[]))}async function eXX(e,t){var l;let i=(null==e?void 0:e.addOrderPaymentAsync)||(null==e?void 0:e.addOrderPayment);if("function"==typeof i)return null==(l=e.ensureOrderCreatedAt)||l.call(e),i.call(e,t)}async function eX0(e,t,l){let i=(null==e?void 0:e.updateVoucherOrderPaymentsAsync)||(null==e?void 0:e.updateVoucherOrderPayments);if("function"==typeof i)return i.call(e,t,l)}async function eX2(e,t){var l;return{success:!0,response:await (null==e||null==(l=e.submitSalesOrder)?void 0:l.call(e,{smallTicketDataFlag:1,...(null==t?void 0:t.confirmPendingVoucherPayments)!==void 0?{confirmPendingVoucherPayments:t.confirmPendingVoucherPayments}:{}}))}}async function eX1(e){if("function"==typeof(null==e?void 0:e.confirmWalletPayment)){let t=await e.confirmWalletPayment();return{success:!0,response:null==t?void 0:t.submitResult,walletResult:t}}return await eXZ(e),eX2(e,{confirmPendingVoucherPayments:!0})}async function eX4(e,t){if("function"!=typeof(null==e?void 0:e.submitTempOrderAsync))return{success:!1,response:{status:!1,message:"当前订单提交能力不可用,请重启 APP 后再试"}};let l=await e.submitTempOrderAsync({smallTicketDataFlag:1,...(null==t?void 0:t.confirmPendingVoucherPayments)!==void 0?{confirmPendingVoucherPayments:t.confirmPendingVoucherPayments}:{}});return{success:!eX3(l),response:l}}function eX3(e){if(!(e=eX5(e))||"object"!=typeof e)return!1;let t=void 0!==e.code&&200!==e.code&&"200"!==e.code,l=!1===e.status||"number"==typeof e.status&&e.status>=400,i=!1===e.success;return t||l||i}function eX8(e){var t,l,i,a,n,r,o;return(e=eX5(e))&&"object"==typeof e?String(e.message||e.msg||e.error||(null==(t=e.data)?void 0:t.message)||(null==(l=e.data)?void 0:l.msg)||(null==(i=e.data)?void 0:i.error)||(null==(n=e.errors)||null==(a=n[0])?void 0:a.message)||(null==(o=e.errors)||null==(r=o[0])?void 0:r.msg)||""):""}function eX6(e){var t,l,i,a,n;return(null==(e=eX5(e))||null==(t=e.data)?void 0:t.order_id)||(null==e?void 0:e.order_id)||(null==e||null==(i=e.data)||null==(l=i.order)?void 0:l.order_id)||(null==e||null==(n=e.data)||null==(a=n.sales)?void 0:a.order_id)}function eX5(e){return e&&"object"==typeof e&&e.data&&"object"==typeof e.data&&!eX7(e)&&eX7(e.data)?e.data:e}function eX7(e){return!!e&&"object"==typeof e&&(void 0!==e.code||void 0!==e.status||void 0!==e.success||void 0!==e.message||void 0!==e.msg||void 0!==e.error||void 0!==e.errors)}function eX9(e,t){let l=eX5(e);return{code:null==l?void 0:l.code,status:null==l?void 0:l.status,success:null==l?void 0:l.success,message:eX8(l),response:l,rawResponse:e,payments:t}}async function e0e(e,t,l){var i,a,n;let r=null==e||null==(i=e.getTempOrder)?void 0:i.call(e);await (null==e||null==(a=e.getSummary)?void 0:a.call(e));let o=t&&eXY(l)||"0.00";return"function"==typeof(null==e?void 0:e.updateTempOrderDepositAmount)&&await e.updateTempOrderDepositAmount(o),await (null==e||null==(n=e.saveDraft)?void 0:n.call(e)),r}async function e0t(e,t){if("function"==typeof(null==e?void 0:e.updateTempOrderDepositAmount))return e.updateTempOrderDepositAmount(t)}let e0l=(0,eN.forwardRef)((e,t)=>{var l,i,a,n,r,o;let{cartData:s,orderInfo:d,isModalOpen:c,onPaymentComplete:u,onPaymentCancel:p,onStatusChange:m,showingCashToastRef:g,onToastClose:h,orderNote:v,setOrderNote:f,setNoteModalSource:y,setNoteModalOpen:b,totalAmount:x=0,moduleConfig:k,onShowCashPaymentChange:_,showSuccessToast:w,dynamicMaxHeight:S="600px",onOrderSyncFailed:j,generateActionButtons:N,paymentResultToastConfig:C,updateOrderInfo:M,setCurrentEditOrderId:T,config:I,paymentResultDisplayMode:P,shopDiscount:A,client:D,currentTotalPrice:E,onChangeShopDiscount:O,onChangeOrderNote:z,onDeleteOrderNote:L,baseSales:R,walletPassMode:$="legacy",cardReaderDeviceNumber:F,cardReaders:q=[],setIsChangePaymentNotIncludeVoucher:B}=e,H=eR(),V=H.appHelper.utils||{},{getApp:U,pisellos:Y,getData:W,pisellosAllModule:G,interaction:K}=V,Q=(0,nB.useToast)(),Z=(0,eN.useRef)(null),J=(0,eN.useRef)(null),X=(0,eN.useRef)(null),[ee,et]=(0,eN.useState)(""),[el,ei]=(0,eN.useState)(""),[ea,en]=(0,eN.useState)(""),[er,eo]=(0,eN.useState)([]),[es,ed]=(0,eN.useState)(!1),ec=(0,eN.useRef)(null),[eu,ep]=(0,eN.useState)([]),[em,eg]=(0,eN.useState)(!1),[eh,ev]=(0,eN.useState)(!1),[ef,ey]=(0,eN.useState)(ez.getText("cards.and.digitals")||"Cards & Digitals"),eb=dZ(),ex=(0,eN.useMemo)(()=>String((null==W?void 0:W("channel"))||"").trim().toLowerCase(),[W]),ek=function(e){let t=(0,eN.useRef)(),l=(0,eN.useRef)(!0),[i,a]=(0,eN.useState)(!1),[n,r]=(0,eN.useState)(!1),o=o0(i=>{if(!e)return eXL;if(t.current)return null;let n=Symbol(i);t.current={token:n,type:i},l.current&&(a("payment"===i),r("scan"===i));let o=!1;return()=>{var e;o||(o=!0,(null==(e=t.current)?void 0:e.token)===n&&(t.current=void 0,l.current&&(a(!1),r(!1))))}}),s=o0(()=>o("payment")),d=o0(()=>o("scan")),c=o0(()=>{var l;return e&&(null==(l=t.current)?void 0:l.type)==="payment"}),u=o0(()=>{var l;return e&&(null==(l=t.current)?void 0:l.type)==="scan"});return(0,eN.useEffect)(()=>(l.current=!0,()=>{l.current=!1}),[]),(0,eN.useEffect)(()=>{e||(t.current=void 0,a(!1),r(!1))},[e]),(0,eN.useMemo)(()=>({tryBeginPayment:s,tryBeginScan:d,getIsPaymentProcessing:c,getIsScanProcessing:u,isPaymentProcessing:i,isScanProcessing:n}),[s,d,c,u,i,n])}("kiosk"===ex),e_=(0,eN.useRef)(),ew=eM8(null==(i=H.appHelper.utils)||null==(l=i.getApp)?void 0:l.call(i)),eS=(0,eN.useRef)(),ej=(0,eN.useMemo)(()=>eu.filter(e=>{var t;return("app"!==e.type||"EFTPOS_LINKLY"!==e.code)&&(null==(t=e.channel_application)?void 0:t.includes(ex))&&(["custom"].includes(e.type)||eMG.includes(e.code))}),[ex,eu]),eT=(0,eN.useMemo)(()=>eTs(eu,q,F||""),[F,q,eu]),eI=(0,eN.useRef)(!1),[eP,eA]=(0,eN.useState)(),eD=(0,eN.useRef)(null),eE=(0,eN.useRef)("0.00"),[eO,eL]=(0,eN.useState)([]),e$=(0,eN.useMemo)(()=>eO.reduce((e,t)=>{if(!eTi(t))return e;try{let l=new lO(t.amount||0),i=new lO(t.rounding_amount||0);return e.plus(l).plus(i)}catch{return e}},new lO(0)),[eO]),eF=(0,eN.useCallback)(e=>{try{return lO.max(new lO(e||0).minus(e$),0).toDecimalPlaces(2).toFixed(2)}catch{return"0.00"}},[e$]),eq=(0,eN.useMemo)(()=>eF(ee||el||0),[el,ee,eF]),eH=(0,eN.useMemo)(()=>eF(el||0),[el,eF]),eV=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=(0,eN.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.some(e=>!!e&&"voided"!==e.status&&((null==e?void 0:e.voucher_id)===void 0||0===Number(e.voucher_id)))})(e),[e]);return{isCustomerChangeLocked:t,canChangeCustomer:!t,shouldReloadWalletPassAfterCustomerChange:!t}}(eO),eU=(0,eN.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.some(e=>!!eTt(e)&&(null==e?void 0:e.order_payment_type)!=="deposit"&&(null==e?void 0:e.type)!=="deposit")})(eO),[eO]),[eY,eW]=(0,eN.useState)({}),[eG,eQ]=(0,eN.useState)(!1),eZ=(0,eN.useMemo)(()=>!!eq&&0>=parseFloat(eq),[eq]),[eJ,eX]=(0,eN.useState)(!1),[e0,e2]=(0,eN.useState)(!1),e1=(null==I?void 0:I.enablePriceAdjust)!==!1,{runWithPermission:e4}=eK({scopeKey:(null==d?void 0:d.orderId)??(null==d?void 0:d.uuid)??R,active:c,isAvailable:()=>e1}),[e3,e8]=(0,eN.useState)(),e6=eHy(),e5=o0(()=>{var e;null==Q||null==(e=Q.info)||e.call(Q,ez.getText("pisell2.checkout.scan-blocked-by-payment"))}),e7=o0(()=>{var e;null==Q||null==(e=Q.info)||e.call(Q,ez.getText("pisell2.checkout.payment-blocked-by-scan"))}),e9=o0(()=>{if(ek.getIsPaymentProcessing()||eG)return e5(),null;if(ek.getIsScanProcessing()){var e;return null==Q||null==(e=Q.info)||e.call(Q,ez.getText("pisell2.checkout.wallet-scan-processing")),null}return ek.tryBeginScan()}),te=o0((e,t)=>{var l;let i=e_.current;!i||t&&!i.source.startsWith(t)||i.deferRelease||(i.release(),null==e6||null==(l=e6.addLog)||l.call(e6,{type:"info",title:"Kiosk checkout payment activity finished",metadata:{reason:e,source:i.source}}))}),tt=o0(e=>{var t,l,i;if("kiosk"!==ex){let e=()=>void 0;return e.isActive=()=>!0,e}if(ek.getIsScanProcessing())return e7(),null;if(ek.getIsPaymentProcessing())return null==Q||null==(l=Q.info)||l.call(Q,ez.getText("payment.processing")),null;if(eG)return null==Q||null==(i=Q.info)||i.call(Q,ez.getText("payment.processing")),null;let a=ek.tryBeginPayment();if(!a)return null;let n=!1,r=()=>{var e;if(n)return;let t=e_.current;(null==t?void 0:t.release)===r&&t.deferRelease||(n=!0,(null==(e=e_.current)?void 0:e.release)===r&&(e_.current=void 0),a())};return r.isActive=()=>{var e;return!n&&(null==(e=e_.current)?void 0:e.release)===r},e_.current={release:r,source:e},null==e6||null==(t=e6.addLog)||t.call(e6,{type:"info",title:"Kiosk checkout payment activity started",metadata:{source:e}}),r});(0,eN.useEffect)(()=>{if(!c){var e;null==(e=eS.current)||e.release(),te("modal-closed")}},[c]),(0,eN.useEffect)(()=>()=>te("component-unmounted"),[]);let tl=W("shop_currency_code")||"USD",ti=W("bookingv2_deposit")||0,ta=null==R||null==(a=R.getOtherParams)?void 0:a.call(R),tn=exa({handle:R??null,scopeKey:JSON.stringify([(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),null==ta?void 0:ta.channel,null==ta?void 0:ta.shop_id,null==ta?void 0:ta.platform,null==ta?void 0:ta.cacheId]),active:!!c,ready:!!(null==R?void 0:R.getContactInfoConfig),order:(null==R||null==(n=R.getTempOrder)?void 0:n.call(R))??null,save:e=>R.updateTempOrderContactsInfo(e)}),tr=(0,eN.useRef)(!1),to=o0(async()=>{var e,t,l;if(tr.current)return!1;tr.current=!0;try{if((null==R?void 0:R.getContactInfoConfig)&&!await tn.runtime.ensureComplete())return!1;return await (null==R||null==(e=R.ensureSalesOrderReadyForPayment)?void 0:e.call(R)),await (null==R||null==(t=R.preparePickupTimingForCheckout)?void 0:t.call(R)),!0}catch(e){return null==Q||null==(l=Q.error)||l.call(Q,e instanceof Error?e.message:String(e)),!1}finally{tr.current=!1}}),ts=(0,eN.useCallback)(async()=>{"shared"===$&&(null==R?void 0:R.clearWalletAssetSelection)?await R.clearWalletAssetSelection():await eXJ(R)},[R,$]);(0,eN.useEffect)(()=>{c||(eI.current=!1,X.current=null,eE.current="0.00",eA(void 0))},[c]);let td=(0,eN.useMemo)(()=>{var e,t;if(eI.current)return eP??null;let l=(null==D?void 0:D.display_name)||(null==D?void 0:D.name)||(null==D?void 0:D.nickname);if((null==D?void 0:D.id)||(null==D?void 0:D.customer_id)||l)return D;let i=(null==d?void 0:d.customerSnapshot)||{},a=i.id??i.customer_id??(null==d?void 0:d.customerId),n=i.display_name||i.name||(null==d?void 0:d.customerName)||"",r=i.phone||(null==d?void 0:d.customerPhone)||"",o=i.email||(null==d?void 0:d.customerEmail)||"";return a||n||r||o?{...i,id:a,customer_id:a,display_name:n,name:i.name||n,phone:r,email:o,contacts:{...i.contacts||{},email:(null==(e=i.contacts)?void 0:e.email)||o,phone:(null==(t=i.contacts)?void 0:t.phone)||r}}:D},[D,null==d?void 0:d.customerEmail,null==d?void 0:d.customerId,null==d?void 0:d.customerName,null==d?void 0:d.customerPhone,null==d?void 0:d.customerSnapshot,eP]),tc=(0,eN.useMemo)(()=>({map:eu.reduce((e,t)=>(eMH.includes(t.code)&&(e[t.code]=t),e),{}),isShow:!0}),[eu]),tu=o0(()=>{let e=eXK(R);e&&(null==M||M(e),ei(e.remainingAmount||"0"),en(e.totalAmount||"0"),et(e.remainingAmount||"0"))}),tp=o0(async e=>{let t=e.payments??await th(),l=Array.isArray(t)?t.filter(e=>{let t=null==e?void 0:e.order_payment_id;return null==t||""===t||0===t}):t;return eMy({baseSales:R,status:e.status,payments:t,sessionPayments:l,currencySymbol:(null==W?void 0:W("shop_symbol"))||void 0,changeGivenAmount:e.changeGivenAmount,orderTotalAmount:e.orderTotalAmount,failureReason:e.failureReason,taxTitle:null==W?void 0:W("tax_title"),translationOriginal:null==V?void 0:V.translationOriginal,actionButtons:e.actionButtons,autoClose:e.autoClose,autoCloseDelay:60,displayMode:P,onClose:()=>{null==h||h()}})}),tm=o0(async e=>{var t,l,i,a,n,r,o,s;let d=null==R||null==(t=R.getOrderAmountSnapshot)?void 0:t.call(R),c=(null==(l=e.syncResult)?void 0:l.isOrderFullyPaid)??(null==(i=e.syncResult)?void 0:i.isFullyPaid),m="deposit_paid"===e.resultKind?"deposit_paid":c?"paid":"partially_paid",g=eXC({paymentStatus:m,resultKind:e.resultKind,orderTotalAmount:e.orderTotalAmount??((null==d?void 0:d.expectAmount)||x),depositAmount:e.depositAmount??(null==(a=e.syncResult)?void 0:a.depositAmount)??(null==d?void 0:d.depositAmount),gapAmount:null==d?void 0:d.amountGap,changeGivenAmount:e.changeGivenAmount,failureReason:e.failureReason,isModalMode:"modal"===P});if(!g)return;let h=eXK(R),v=null==h?void 0:h.orderId,f=await tp({status:eMv(m),changeGivenAmount:e.changeGivenAmount,payments:e.paymentItems,actionButtons:null==N?void 0:N(m,!1,v),autoClose:null==(n=g.autoCloseConfig)?void 0:n.autoClose,autoCloseDelay:null==(r=g.autoCloseConfig)?void 0:r.autoCloseDelay,orderTotalAmount:g.orderTotalAmount});u({response:null==(o=e.syncResult)?void 0:o.submitResult,paymentItems:e.paymentItems,orderPrintPayload:e.orderPrintPayload,paymentResultViewModel:f,toastInfo:{status:m,amount:g.orderTotalAmount,gapAmount:g.gapAmount,depositAmount:g.depositAmount,failureReason:e.failureReason}}),("paid"===m||"deposit_paid"===e.resultKind)&&(null==(s=e.syncResult)?void 0:s.submitResult)&&p(!0,!0)}),tg=o0(e=>{var t;let l=null==e?void 0:e[e.length-1],i=null==l||null==(t=l.metadata)?void 0:t.change_given_amount;if(null==i||""===i)return;let a=Number(i);return Number.isFinite(a)?a:void 0}),th=o0(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];try{var t;let e=await Promise.resolve(null==R||null==(t=R.getOrderPayments)?void 0:t.call(R));if(Array.isArray(e))return e}catch(e){console.warn("Failed to read latest baseSales payment items:",e)}return Array.isArray(e)?e:[]}),tv=o0(async e=>{var t,l,i;let a,n,r,o=(null==e?void 0:e.response)||e,s=eXQ(o),d=(i=null==R||null==(l=R.getOrderIdentity)||null==(t=l.call(R))?void 0:t.orderId,n=(null==(a=eXQ(o))?void 0:a.payment_info)||{},(r=(null==a?void 0:a.order_id)||(null==a?void 0:a.orderId)||i)?{type:"99",data:{order_id:r,machine_code_print_info:(null==n?void 0:n.machine_code_print_info)||(null==a?void 0:a.machine_code_print_info),small_ticket_data:(null==n?void 0:n.small_ticket_data)||(null==a?void 0:a.small_ticket_data),machine_code_print_info_v2:(null==n?void 0:n.machine_code_print_info_v2)||(null==a?void 0:a.machine_code_print_info_v2)}}:null);return u({response:o,paymentItems:await th(eO),orderPrintPayload:d,toastInfo:{status:null==s?void 0:s.payment_status,amount:Number((null==s?void 0:s.total_amount)||(null==s?void 0:s.expect_amount)||0),gapAmount:Number((null==s?void 0:s.amount_gap)||0)}}),d}),tf=o0(async e=>{var t,l,i,a,n,r,o,s,d,c;let p=e.forceUseParamsPayment&&Array.isArray(e.payments)?e.payments:await th(e.payments),m=null==(t=e.syncResult)?void 0:t.submitResult;if(eX3(m)){let t=eX5(m),l=eX8(t)||ez.getText("pisell2.checkout.order-sync-failed");if(console.error(`[PaymentModal] Sales checkout backend rejected: ${l}`,eX9(m,p)),WK(),(null==I?void 0:I.keepOpenOnSyncFailure)===!0)return null==e6||null==(r=e6.addLog)||r.call(e6,{type:"error",title:"BaseSales payment sync rejected; waiting for kiosk retry",metadata:{error:l,response:t,payments:p}}),null==j||j(),null==Q||null==(o=Q.error)||o.call(Q,l),{ok:!1,syncResult:e.syncResult,response:t,message:l,kind:"backend-rejected"};if(e.rollbackPaymentIdentity&&(null==(s=R.deleteOrderPayment)||s.call(R,e.rollbackPaymentIdentity),eL(await th())),null==e6||null==(a=e6.addLog)||a.call(e6,{type:"error",title:"BaseSales payment sync rejected by backend",metadata:{error:l,response:t,payments:p}}),"page"===P){let e=await tp({status:"failed",failureReason:l,payments:p,orderTotalAmount:(null==(c=R.getOrderAmountSnapshot)||null==(d=c.call(R))?void 0:d.totalAmount)||x});u({paymentItems:p,paymentResultViewModel:e,response:t,toastInfo:{status:"failed",failureReason:l}})}return null==Q||null==(n=Q.error)||n.call(Q,l),{ok:!1,syncResult:e.syncResult,response:t,message:l,kind:"backend-rejected"}}let g=eXK(R);g&&(null==M||M(g),ei(g.remainingAmount||"0"),en(g.totalAmount||"0"),et(g.remainingAmount||"0"));let h=e.forceUseParamsPayment?p:await th(p);return eL(h),(null==(l=e.syncResult)?void 0:l.isDepositFullyPaid)&&!(null==(i=e.syncResult)?void 0:i.isOrderFullyPaid)||await tm({syncResult:e.syncResult,paymentItems:h,changeGivenAmount:e.changeGivenAmount??tg(h),orderPrintPayload:null,orderTotalAmount:e.orderTotalAmount}),{ok:!0,syncResult:e.syncResult}});(0,eN.useEffect)(()=>{let e;if("kiosk"===ex){try{let t=U(),l=t.applicationManager.get("global");e=null==l?void 0:l.runFunction("listenExternalCommand",{app:t,handler:async e=>{if("authorization_close"===e.command)return void te("authorization-closed","authorization:");if("payment_result"!==e.command)return;let t=e.params,i=e_.current;(null==i?void 0:i.source.startsWith("authorization:"))&&(i.deferRelease=!0);try{if((null==t?void 0:t.status)==="cancelled")return;let e=Array.isArray(null==t?void 0:t.payments)?t.payments:[];if(null==t?void 0:t.ok){var a,n,r;if((null==t||null==(a=t.syncResult)?void 0:a.isDepositFullyPaid)&&!(null==t||null==(n=t.syncResult)?void 0:n.isOrderFullyPaid))return;await tf({syncResult:t.syncResult,payments:e,changeGivenAmount:tg(e),forceUseParamsPayment:!0,orderTotalAmount:null==t||null==(r=t.syncResult)?void 0:r.orderExpectedAmount});return}await tb({error:(null==t?void 0:t.error)||Error(ez.getText("pisell2.checkout.order-sync-failed")),payments:e,changeGivenAmount:tg(e)})}finally{i&&e_.current===i&&(i.deferRelease=!1);try{l.runFunction("closeAuthorization")}finally{te("payment-result","authorization:")}}}})}catch(e){}return"function"==typeof e?e:void 0}},[]);let ty=o0(async e=>{var t;let l=await th(e.payments),i=eXK(R);i&&(null==M||M(i),ei(i.remainingAmount||"0"),en(i.totalAmount||"0"),et(i.remainingAmount||"0"));let a=await th(l);return eL(a),await tm({syncResult:e.syncResult,paymentItems:a,resultKind:"deposit_paid",depositAmount:e.depositAmount??(null==(t=e.syncResult)?void 0:t.depositAmount)??(null==i?void 0:i.depositAmount),changeGivenAmount:e.changeGivenAmount??tg(a),orderPrintPayload:null}),{ok:!0,syncResult:e.syncResult}}),tb=o0(async e=>{var t,l,i,a,n,r,o,s,d,c,p,m,g,h,v,f,y,b,k,_,w,S;let C,T,A,D,E=await th(e.payments),O=eX5([null==(k=e.error)||null==(_=k.response)?void 0:_.data,null==k?void 0:k.data,null==k||null==(w=k.response)?void 0:w.body,null==k?void 0:k.body].find(e=>{let t=eX5(e);return t&&"object"==typeof t&&(eX3(t)||eX8(t))})),z=!!O,L=!O&&(T=String((null==(S=e.error)?void 0:S.message)||S||"").toLowerCase(),A=String((null==S?void 0:S.code)||"").toLowerCase(),D=String((null==S?void 0:S.name)||"").toLowerCase(),["network","failed to fetch","load failed","timeout","timed out","请求超时","err_network","econnaborted","etimedout"].some(e=>T.includes(e)||A.includes(e)||D.includes(e))),$=z?eX8(O)||ez.getText("pisell2.checkout.order-sync-failed"):e.error instanceof Error?e.error.message:String(e.error);if((null==I?void 0:I.keepOpenOnSyncFailure)===!0)return WK(),null==e6||null==(s=e6.addLog)||s.call(e6,{type:"error",title:"BaseSales payment sync failed; waiting for kiosk retry",metadata:{error:$,kind:z?"backend-rejected":null==(r=e.error)?void 0:r.kind,response:O||(null==(o=e.error)?void 0:o.response),payments:E}}),null==j||j(),null==Q||null==(d=Q.error)||d.call(Q,$),{ok:!1,error:e.error,message:$,response:O,kind:z?"backend-rejected":(null==(c=e.error)?void 0:c.kind)||"unknown"};if(z?(console.error(`[PaymentModal] Sales checkout backend rejected: ${$}`,eX9(O,E)),WK()):console.error("[PaymentModal] Sales checkout submit failed",e.error),L){let t=ez.getText("pisell2.checkout.order-saved-sync-later"),l=eXK(R);l&&(null==M||M(l),ei(l.remainingAmount||"0"),en(l.totalAmount||"0"),et(l.remainingAmount||"0"));let i=await th(E);eL(i),null==e6||null==(m=e6.addLog)||m.call(e6,{type:"info",title:"BaseSales payment saved locally, backend sync deferred",metadata:{error:e.error instanceof Error?e.error.message:String(e.error),kind:(null==(p=e.error)?void 0:p.kind)||"network-deferred",payments:i}}),null==Q||null==(g=Q.info)||g.call(Q,t);let a={isFullyPaid:!0,submitResult:{deferred_sync:!0,message:t}};return await tm({syncResult:a,paymentItems:i,changeGivenAmount:e.changeGivenAmount??tg(i),failureReason:t}),{ok:!0,syncResult:a,message:t,kind:"network-deferred"}}if(e.rollbackPaymentIdentity&&(null==(h=R.deleteOrderPayment)||h.call(R,e.rollbackPaymentIdentity),eL(await th())),null==e6||null==(i=e6.addLog)||i.call(e6,{type:"error",title:"BaseSales payment sync failed",metadata:{error:$,kind:z?"backend-rejected":null==(t=e.error)?void 0:t.kind,response:O||(null==(l=e.error)?void 0:l.response),payments:E}}),!z||"page"===P){let e=eXC({paymentStatus:"failed",orderTotalAmount:(null==(f=R.getOrderAmountSnapshot)||null==(v=f.call(R))?void 0:v.totalAmount)||x,failureReason:$,isModalMode:"modal"===P});C=await tp({status:"failed",failureReason:$,actionButtons:(null==N?void 0:N("failed"))||[],autoClose:null==e||null==(y=e.autoCloseConfig)?void 0:y.autoClose,autoCloseDelay:null==e||null==(b=e.autoCloseConfig)?void 0:b.autoCloseDelay,orderTotalAmount:null==e?void 0:e.orderTotalAmount})}return"page"===P&&C&&u({error:e.error,paymentItems:E,paymentResultViewModel:C,toastInfo:{status:"failed",failureReason:$}}),null==Q||null==(a=Q.error)||a.call(Q,$),{ok:!1,error:e.error,message:$,response:O,kind:z?"backend-rejected":(null==(n=e.error)?void 0:n.kind)||"unknown"}});o0(async e=>{var t,l;if(!(null==R?void 0:R.syncPaymentsToOrder)){let e=Error("BaseSales syncPaymentsToOrder is not available");return console.error("[PaymentModal] Sales checkout submit failed",e),null==Q||null==(t=Q.error)||t.call(Q,e.message),{ok:!1,error:e,message:e.message,kind:"missing-api"}}let i=await th();try{let t=await (null==(l=R.syncPaymentsToOrder)?void 0:l.call(R,{payments:i,paymentStatus:"paid",submitWhenPaid:!0,smallTicketDataFlag:1}));if(!(null==e?void 0:e.handleResult))return{ok:!0,syncResult:t};return tf({syncResult:t,payments:i,changeGivenAmount:null==e?void 0:e.changeGivenAmount,rollbackPaymentIdentity:null==e?void 0:e.rollbackPaymentIdentity})}catch(t){if(!(null==e?void 0:e.handleResult))return{ok:!1,error:t,message:t instanceof Error?t.message:String(t),kind:(null==t?void 0:t.kind)||"unknown"};return tb({error:t,payments:i,changeGivenAmount:null==e?void 0:e.changeGivenAmount,rollbackPaymentIdentity:null==e?void 0:e.rollbackPaymentIdentity})}});let tx=o0(async()=>{var e;let t=await th();await (null==R||null==(e=R.syncPaymentsToOrder)?void 0:e.call(R,{payments:t,paymentStatus:"paid",submitWhenPaid:!0,smallTicketDataFlag:1}))});(0,eN.useEffect)(()=>{if(!(null==R?void 0:R.effectsOn)||!c)return;let e=R.effectsOn("onPaymentSyncStart",()=>{var e;eQ(!0),null==Q||null==(e=Q.loading)||e.call(Q,"",0)}),t=R.effectsOn("onPaymentSyncEnd",async e=>{var t,l,i,a,n,r;try{null==(a=window)||null==(i=a.app)||i.applicationManager.get("global").runFunction("sendCommand",{app:null==(l=window)?void 0:l.app,command:"payment_result",params:e})}catch(e){}null==Q||null==(t=Q.hide)||t.call(Q),eQ(!1);let o=Array.isArray(null==e?void 0:e.payments)?e.payments:[];if(null==e?void 0:e.ok){if((null==e||null==(n=e.syncResult)?void 0:n.isDepositFullyPaid)&&!(null==e||null==(r=e.syncResult)?void 0:r.isOrderFullyPaid))return;await tf({syncResult:e.syncResult,payments:o,changeGivenAmount:tg(o)});return}await tb({error:(null==e?void 0:e.error)||Error(ez.getText("pisell2.checkout.order-sync-failed")),payments:o,changeGivenAmount:tg(o)})}),l=R.effectsOn("onDepositPaymentSyncEnd",async e=>{var t;null==Q||null==(t=Q.hide)||t.call(Q),eQ(!1);let l=Array.isArray(null==e?void 0:e.payments)?e.payments:[];(null==e?void 0:e.ok)&&await ty({syncResult:e.syncResult,payments:l,depositAmount:null==e?void 0:e.depositAmount,changeGivenAmount:tg(l)})});return()=>{var i;null==e||e(),null==t||t(),null==l||l(),null==Q||null==(i=Q.hide)||i.call(Q),eQ(!1)}},[R,c,Q,tg,tf,ty,tb]);let tk=e=>{var t;let l,i=Number(e);return!!Number.isFinite(i)&&!!(i>0)||(l=ez.getText("pisell2.checkout.payment.invalid-positive-amount")||"Please pay an amount greater than 0",(null==Q?void 0:Q.fail)?Q.fail(l):null==Q||null==(t=Q.error)||t.call(Q,l),!1)},t_=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l=eXK(R),i=new lO(eF((null==l?void 0:l.remainingAmount)??"0")),a=new lO(e||0).minus(t||0);return!(i.lte(0)||a.lte(0)||a.gt(i.plus("0.01")))||(tu(),!1)},tw=o0(async()=>{let e=await th();return eL(e),e}),tS=o0(async function(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof(null==R?void 0:R.deleteOrderPayment))throw Error("当前订单不支持删除 EFTPOS 待确认支付项,请重启 APP 后再试");if(R.deleteOrderPayment(e),await tw(),!1===l.persistDraft)return;let i=await (null==R||null==(t=R.saveSalesOrderDraft)?void 0:t.call(R));if(eX3(i))throw Error(eX8(i)||ez.getText("pisell2.checkout.order-sync-failed")||"EFTPOS 待确认支付项保存失败,请重试")}),tj=o0(async(e,t)=>{var l,i,a,n,r,o;if(!tk(t))return null;let s="",d=!1,c=[];null==Q||null==(l=Q.loading)||l.call(Q,"",0);try{if("function"!=typeof(null==R?void 0:R.addOrderPaymentAsync)&&"function"!=typeof(null==R?void 0:R.addOrderPayment)||"function"!=typeof(null==R?void 0:R.saveSalesOrderDraft))throw Error(ez.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");c=await th();let l=await eXX(R,{amount:t,code:e.code,custom_payment_id:e.id,name:e.name,custom_payment_type:e.type,voucher_id:"",service_charge:(null==e?void 0:e.is_surcharge)&&((null==e?void 0:e.fixed)!==void 0||(null==e?void 0:e.percentage)!==void 0)?{amount:(null==e?void 0:e.fixed)||"0",percentage:(null==e?void 0:e.percentage)||"0"}:{},status:"payment_pending",metadata:{transactions:[]}});d=!0,Array.isArray(l)&&eL(l);let n=Array.isArray(l)?l[l.length-1]:void 0;if(!(s=String((null==n?void 0:n.payment_number)||"").trim()))throw Error("EFTPOS 待确认支付项缺少 payment_number,请重启 APP 后再试");let r=await (null==R||null==(i=R.saveSalesOrderDraft)?void 0:i.call(R));if(eX3(r))throw Error(eX8(r)||ez.getText("pisell2.checkout.order-sync-failed")||"EFTPOS 待确认支付项保存失败,请重试");return null==Q||null==(a=Q.hide)||a.call(Q),{paymentNumber:s,draftResult:r}}catch(t){if(d)try{s?await tS(s,{persistDraft:!1}):"function"==typeof(null==R?void 0:R.setOrderPayments)&&(R.setOrderPayments(c),await tw())}catch(e){console.error("Failed to rollback pending EFTPOS payment:",e)}let e=t instanceof Error?t.message:String(t);return null==e6||null==(n=e6.addLog)||n.call(e6,{type:"error",title:"EFTPOS pending payment draft failed",metadata:{error:e,paymentNumber:s}}),null==Q||null==(r=Q.hide)||r.call(Q),null==Q||null==(o=Q.error)||o.call(Q,e),null}}),tN=o0(async e=>{var t,l;let i=null==(t=e.transactionNumber)?void 0:t.trim();if(!i)throw Error("EFTPOS 回调缺少交易号,支付项保持待确认状态");let a={...e.updates||{},status:"paid",metadata:{...(null==(l=e.updates)?void 0:l.metadata)||{},unique_payment_number:i,transactions:[{number:i,status:"success"}]}};if("function"!=typeof(null==R?void 0:R.updateOrderPayment))throw Error("当前订单不支持更新 EFTPOS 支付状态,请重启 APP 后再试");let n=await R.updateOrderPayment(e.paymentNumber,a,{persistDraft:!0,submitWhenPaid:!0});return Array.isArray(null==n?void 0:n.payments)?eL(n.payments):await tw(),null==B||B(!0),n}),tC=o0((e,t)=>{var l,i;let a=e instanceof Error?e.message:String(e);null==e6||null==(l=e6.addLog)||l.call(e6,{type:"error",title:"EFTPOS payment update failed",metadata:{error:a,paymentNumber:t}}),null==Q||null==(i=Q.error)||i.call(Q,a)}),tM=async e=>{var t,l,i,a;let n=tt("cash");if(n)try{if(!tk(e.amount)||!await to()||!n.isActive()||!t_(e.amount,e.roundingAmount))return;let i=(null==W?void 0:W("channel"))||"pos",a=`cash-${Date.now()}-${Math.random().toString(16).slice(2)}`,r=eu.find(e=>{var t,l;return((null==(t=e.name)?void 0:t.toLowerCase().includes("cash"))||/现金|現金/i.test(e.name))&&(null==(l=e.channel_application)?void 0:l.includes(i))});eHx(e6,W,"cash-local-add",()=>({paymentChannel:ex,currentChannel:i,osKey:eb,...eHb(R),businessCode:(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),osChannel:null==ta?void 0:ta.channel,osPlatform:null==ta?void 0:ta.platform,paymentMethodId:null==r?void 0:r.id,paymentMethodCode:null==r?void 0:r.code,uniquePaymentNumber:a})),null==e6||e6.addLog({type:"info",title:"open_till",metadata:{}}),null==K||null==(l=K.utils)||null==(t=l.postMessageToApp)||t.call(l,{module:"till",key:"open_till",data:{type:"cash"}}),null==B||B(!0),await eXX(R,{amount:e.amount,code:null==r?void 0:r.code,custom_payment_id:null==r?void 0:r.id,name:null==r?void 0:r.name,custom_payment_type:null==r?void 0:r.type,voucher_id:0,rounding_amount:e.roundingAmount,metadata:{unique_payment_number:a,actual_paid_amount:e.actual_paid_amount??e.amount,change_given_amount:e.change||0}})}catch(l){let t=l instanceof Error?l.message:String(l);null==e6||null==(i=e6.addLog)||i.call(e6,{type:"error",title:"Cash payment failed",metadata:{error:t,result:e}}),null==Q||null==(a=Q.error)||a.call(Q,t)}finally{n()}},tT=e=>{if("string"==typeof e){let t=e.match(/\d+(?:\.\d+)?/);return t?t[0]:void 0}return"number"==typeof e?String(e):e},tI=(null==(o=H.appHelper.utils)||null==(r=o.getApp)?void 0:r.call(o)).getPlugin("screenProtector"),tP=async e=>{var t,l,i,a,n,r,o,s,d,c,u,m,g,h,v,f,y,b,x,k,_,w,S,j,N,C,M,T,I;let P;if(eG)return;if(eM6()){null==Q||null==(t=Q.info)||t.call(Q,ez.getText("payment.processing"));return}let A=eMW.includes((null==e?void 0:e.code)||""),D=A?eM5():null;if(A&&!D)return;let E=tt(`payment:${(null==e?void 0:e.code)||"unknown"}`);if(!E){null==D||D.release();return}let O=()=>{try{E()}finally{null==D||D.release()}};O.isActive=()=>((null==D?void 0:D.isActive())??!0)&&E.isActive();let z=!1,L=!1,$=e=>{let t;return function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t??(t=Promise.resolve().then(async()=>{let t=null==P?void 0:P.hold();try{await e(...i)}finally{try{null==t||t(),await (null==P?void 0:P.release())}finally{O()}}})),t}};try{let{id:t,code:T,name:I,type:A}=e||{},D=e.totalAmount??eq;if(!await to()||!O.isActive()||!t_(eq))return;let E=eMY.includes(T||""),q=eMW.includes(T||"");if(E||q){if(eS.current=P=ew(),await P.pause(),!P.isActive()||!O.isActive())return;null==R||null==(l=R.ensureOrderCreatedAt)||l.call(R);let j=q?"mx51":"eftpos",N=null==(a=H.appHelper.utils)||null==(i=a.getApp)?void 0:i.call(a),C=!!(null==H||null==(s=H.appHelper)||null==(o=s.utils)||null==(r=o.businessUtils)||null==(n=r.isPiPaymentEnabled)?void 0:n.call(r)),M=eMZ((null==e?void 0:e.code)||"",C),E=!!M;if(!E&&q){null==e6||e6.addLog({type:"info",title:"addPendingEftposPayment_start_spi",metadata:{timestamp:Date.now()}});let l=await tj(e,D);if(!l)return;let{paymentNumber:i,draftResult:a}=l;if(!P.isActive())return void await tS(i);let n=(null==R||null==(v=R.getOrderIdentity)||null==(h=v.call(R))?void 0:h.externalSaleNumber)||(null==(f=eXQ(a))?void 0:f.external_sale_number),r=null==R||null==(b=R.getOrderIdentity)||null==(y=b.call(R))?void 0:y.orderId,o=ec.current;if(!o)return void await tS(i);let s=await o.onPay(j,{isActive:()=>O.isActive()&&!!(null==P?void 0:P.isActive()),source:"normal",data:{payMethod:{id:t,code:T,name:I,type:A},params:{salesId:n,orderId:r,paymentNumber:i,symbol:W("shop_symbol"),amount:D,surcharge:tT(e.surcharge)},mode:"pay"},callback:$(async l=>{let{status:a,data:n,msg:r}=l;if((null==n?void 0:n.action)==="cancel_order"){await tS(i),p(!0);return}if("success"!==a)return;let o={amount:Number(null==n?void 0:n.amount),code:T,custom_payment_id:t,name:I,custom_payment_type:A,voucher_id:"",service_charge:{},metadata:{unique_payment_number:null==n?void 0:n.uniquePaymentNumber}};Number((null==n?void 0:n.surcharge)||0)!==Number((null==e?void 0:e.surcharge)||0)?o.service_charge={amount:(null==n?void 0:n.surcharge)||"0",percentage:"0"}:o.service_charge={amount:(null==e?void 0:e.fixed)||"0",percentage:(null==e?void 0:e.percentage)||"0"},tk(o.amount)&&(null==B||B(!0),await tN({paymentNumber:i,transactionNumber:null==n?void 0:n.uniquePaymentNumber,updates:o}))})});s||await tS(i),z=s;return}if(!E){let l=JSON.parse((null==N||null==(k=N.storage)||null==(x=k.getStorage)?void 0:x.call(k,"account"))||"{}"),i=null==R||null==(w=R.getOrderIdentity)||null==(_=w.call(R))?void 0:_.orderId;if(!i||"string"==typeof i&&i.startsWith("LOCAL_")){let e;null==Q||null==(S=Q.loading)||S.call(Q,"",0);try{e=await eX4(R)}catch(e){null==Q||Q.error(e instanceof Error?e.message:ez.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(null==e?void 0:e.success)||eX3(null==e?void 0:e.response)){null==Q||Q.error(eX8(null==e?void 0:e.response)||ez.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(i=eX6(null==e?void 0:e.response))){null==Q||Q.error(ez.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}}null==Q||Q.hide();let a=ec.current;if(!a||!P.isActive())return;z=await a.onPay(j,{isActive:()=>O.isActive()&&!!(null==P?void 0:P.isActive()),source:"normal",data:{payMethod:{id:t,code:T,name:I,type:A},params:{orderId:i,symbol:W("shop_symbol"),amount:D,surcharge:tT(e.surcharge),operator_id:null==l?void 0:l.id,operator_type:"shop",platform:ex||"pos"},mode:"pay"},callback:$(async e=>{let{status:l,data:i,msg:a}=e;if("success"!==l)return;let n={amount:D,code:T,custom_payment_id:t,name:I,custom_payment_type:A,voucher_id:"",service_charge:{percentage:null==i?void 0:i.surPercentRate,amount:null==i?void 0:i.surMoney},metadata:{unique_payment_number:null==i?void 0:i.uniquePaymentNumber,manual_marking_flag:null==i?void 0:i.manual_marking_flag}};tk(n.amount)&&(null==B||B(!0),await eXX(R,n))})});return}null==e6||e6.addLog({type:"info",title:"addPendingEftposPayment_start",metadata:{timestamp:Date.now()}});let L=await tj(e,D);if(!L)return;let{paymentNumber:V,draftResult:U}=L,Y=(null==R||null==(c=R.getOrderIdentity)||null==(d=c.call(R))?void 0:d.externalSaleNumber)||(null==(u=eXQ(U))?void 0:u.external_sale_number),G=JSON.parse((null==N||null==(g=N.storage)||null==(m=g.getStorage)?void 0:m.call(g,"account"))||"{}"),K=eMJ({baseSales:R,salesId:String(Y||""),paymentNumber:V});if(!Y||!ec.current){if(Y)await K.finalize();else throw Error("支付草稿缺少订单标识,请刷新订单后重试");return}if(!O.isActive()||!P.isActive())return void await K.finalize();null==e6||e6.addLog({type:"info",title:"addPendingEftposPayment_end",metadata:{timestamp:Date.now()}}),ec.current.openPi({provider:M,mode:"pay",amount:D,salesId:String(Y),paymentNumber:V,currency:W("shop_symbol"),deviceNumber:F,metadata:{payMethod:{id:t,code:T,name:I,type:A},symbol:W("shop_symbol"),payment_number:V},operator:{id:null==G?void 0:G.id,type:"shop"},..."kiosk"===ex?{slots:{failed:(0,eB.jsx)(eM.Button,{block:!0,type:"primary",className:"pi-payment-action-button",onClick:()=>p(!0,!1,"start-new-order"),style:{marginTop:"10px"},children:ez.getText("order.start-new-order")})}}:{},platform:ex||"pos",usageScene:eMU.includes(ex)?"merchant":"user",onChange:async e=>{if(!K.observe(e))return;let t=null==P?void 0:P.hold(),l="success"===e.type||"closed"===e.type||"printOnTimeout"===e.type;try{var i,a,n,r,o;let t=e.transactionNumber;if("printOnTimeout"===e.type){if(await eX2(R,{confirmPendingVoucherPayments:!0}),!(null==R?void 0:R.printLocalOrderReceipt))return;null==e6||null==(i=e6.addLog)||i.call(e6,{type:"info",title:"eftpos支付异常,请求本地打印小票"});try{let e=await R.printLocalOrderReceipt();null==e6||null==(a=e6.addLog)||a.call(e6,{type:"info",title:"eftpos支付异常,请求本地打印小票结果",metadata:{res:e}})}catch(e){console.error("handleButtonClick_print-receipt_error>>>>",e),null==e6||null==(n=e6.addLog)||n.call(e6,{type:"error",title:"eftpos支付异常,请求本地打印小票失败",metadata:{error:e instanceof Error?e.message:String(e)}})}p(!0),N.history.replace("/home")}if("success"===e.type||"failed"===e.type){if("success"!==e.type)return;let l=e.amount||D,i={percentage:(null==(r=e.surcharge)?void 0:r.ratePercent)?new lO(e.surcharge.ratePercent).div(100).toString():void 0,amount:null==(o=e.surcharge)?void 0:o.fixedAmount},a={amount:l,service_charge:i,service_fee:function(e,t){if(t)try{return new lO(e||0).times(t.percentage||0).plus(t.amount||0).toDecimalPlaces(2).toFixed(2)}catch{return}}(l,i),metadata:{manual_marking_flag:e.manuallyConfirmed?1:void 0,card_reader_snapshot:e.readerSnapshot}};await tN({paymentNumber:V,transactionNumber:t,updates:a});return}"closed"===e.type&&(await K.finalize(),await tw())}catch(e){tC(e,V)}finally{null==t||t(),l&&(await (null==P?void 0:P.release()),O())}}})?z=!0:(await K.finalize(),await tw())}else{await (null==tI||null==(j=tI.pauseIdleTimer)?void 0:j.call(tI)),L=!0;let t=null;if(((null==e?void 0:e.fixed)||(null==e?void 0:e.percentage))&&(t={amount:(null==e?void 0:e.fixed)||"0",percentage:(null==e?void 0:e.percentage)||"0"}),!tk(D))return;"custom"===e.type&&(null==(N=e.metadata)?void 0:N.order_open_cash_drawer)&&(null==e6||e6.addLog({type:"info",title:"open_till",metadata:{}}),null==K||null==(M=K.utils)||null==(C=M.postMessageToApp)||C.call(M,{module:"till",key:"open_till",data:{type:"cash"}})),null==B||B(!0),eHx(e6,W,"method-local-add",()=>({paymentChannel:ex,osKey:eb,...eHb(R),businessCode:(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),osChannel:null==ta?void 0:ta.channel,osPlatform:null==ta?void 0:ta.platform,paymentMethodId:e.id,paymentMethodCode:e.code,paymentMethodType:e.type})),await eXX(R,{amount:D,code:e.code,custom_payment_id:e.id,name:e.name,custom_payment_type:e.type,voucher_id:0,service_charge:t,..."custom"===e.type?{metadata:{unique_payment_number:`custom-${Date.now()}-${Math.random().toString(16).slice(2)}`}}:{}})}}catch(e){null==Q||null==(T=Q.error)||T.call(Q,e instanceof Error?e.message:String(e))}finally{if(L)try{await (null==tI||null==(I=tI.resumeIdleTimer)?void 0:I.call(tI))}catch(e){console.warn("[Payment] resume screen protector failed",e)}if(!z)try{await (null==P?void 0:P.release())}finally{O()}}};(0,eN.useEffect)(()=>{var e,t,l,i,a;if(R&&d&&c)try{null===X.current&&(eE.current=eXG(R,d));let a=eXK(R),n=(null==a?void 0:a.remainingAmount)??(null==R||null==(t=R.getOrderAmountSnapshot)||null==(e=t.call(R))?void 0:e.amountGap)??ee??"0";if(n){et(n),ei(n),en(d.totalAmount||"0");let e=null==R||null==(l=R.getTempOrderNote)?void 0:l.call(R);e?f(e):(null==s||null==(i=s.order_info)?void 0:i.order_note)&&f(s.order_info.order_note)}}catch(e){console.warn("Failed to get initial custom amount:",e)}R&&c&&Promise.resolve((null==R||null==(a=R.getOrderPayments)?void 0:a.call(R))||[]).then(e=>{eL(e)})},[R,d,c]),(0,eN.useEffect)(()=>{if(!R||!c)return void eg(!1);let e=!1;return eg(!1),R.getPaymentMethodsAsync().then(async t=>{if(e)return;let l=await eTn(t,K);if(e)return;ep(l),eg(!0);let i=t.some(e=>{var t;return"CASHMANUAL"===e.code||/现金|現金/i.test(e.name)||/cash/i.test(e.name)&&(null==(t=e.channel_application)?void 0:t.includes(ex))});ev(i),null==_||_(i),i||ey(ez.getText("pisell2.checkout.payment.select-payment")||"Select Payment")}),()=>{e=!0}},[R,K,c,_,ex]),(0,eN.useEffect)(()=>{if(eq&&R&&tl&&d&&c)try{let e;eo([e=Number(eq||0),10*Math.ceil(e/10),20*Math.ceil(e/20)].filter((e,t,l)=>e>0&&l.indexOf(e)===t))}catch(e){console.warn("Failed to get recommended amounts:",e)}},[eq,R,tl,d]);let tA=(0,eN.useCallback)(async e=>{if(R)try{et(e)}catch(e){console.error("Failed to set custom amount:",e)}},[R]),tD=(0,eN.useCallback)(async e=>{if(R)try{if(e){var t;let e=eXY(eE.current)||eXY(eXG(R,d))||eXW(null==(t=R.getOrderAmountSnapshot)?void 0:t.call(R),d);eE.current=e}X.current=e,await e0e(R,!!+!!e,eE.current),tu()}catch(e){console.error("Failed to update deposit status:",e)}},[R,tu]),tE=(0,eN.useCallback)(async e=>{if(R)try{await e0t(R,e),eE.current=e,tu()}catch(e){console.error("Failed to update deposit amount:",e)}},[R]),[tO,tz]=(0,eN.useState)(!1),tL=async e=>{if("cancel"===e)return;let t=tt("wallet-confirm");if(!t)return;let l=!0;tz(!0);try{if(!await to()||!t.isActive())return;"save-without-deduct"===e&&(l=!1,await ts());let n=l?await eX1(R):await eX2(R,{confirmPendingVoucherPayments:!1});if(n.success&&await tv(n),await (null==w?void 0:w({...n})),n.success){var i,a;let e=eXK(R),t=(null==n||null==(a=n.response)||null==(i=a.data)?void 0:i.order_id)||(null==n?void 0:n.orderId);if(null==T||T(t),(null==n?void 0:n.is_deposit)&&e&&Number(e.depositAmount)<Number(e.totalAmount)){null==M||M(e);return}p(!0)}}catch(e){console.error("Failed to submit base sales order:",e)}finally{tz(!1),t()}},tR=(0,eN.useCallback)(async e=>{if("cancel"===e||!await to())return;let t=!0;"apply-deduct-now"===e?await eXZ(R):"save-without-deduct"===e&&(t=!1,await ts()),R&&(await eX2(R,{confirmPendingVoucherPayments:t}),p(!0))},[ts,R,p,to]),t$={showCustomerModule:(null==I?void 0:I.showCustomerModule)??!0,showCustomerSelect:(null==I?void 0:I.showCustomerSelect)??!0,showWalletPass:(null==I?void 0:I.showWalletPass)??tc.isShow,showCashPayment:(null==I?void 0:I.showCashPayment)??(null==k?void 0:k.showCashPayment)??!0,showAdditionalModule:(null==I?void 0:I.showAdditionalModule)??!0,showPaymentOptions:(null==I?void 0:I.showPaymentOptions)??!0},tF=t$.showCashPayment&&eh,tq=(0,eN.useRef)();(0,eN.useEffect)(()=>{if(!c){tq.current=void 0;return}if(em)try{let e={paymentChannel:ex,dataChannel:(null==W?void 0:W("channel"))??null,osKey:eb,...eHb(R),businessCode:(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),osChannel:null==ta?void 0:ta.channel,osPlatform:null==ta?void 0:ta.platform,showCashPayment:tF,showCustomerSelect:t$.showCustomerSelect,showPaymentType:(null==I?void 0:I.showPaymentType)!==!1,directCustomPayment:(null==I?void 0:I.directCustomPayment)===!0},t=JSON.stringify(e);if(tq.current===t)return;tq.current=t,eHx(e6,W,"ui-ready",()=>e)}catch{}});let tB=(null==I?void 0:I.paymentOptionsColumnCount)??(tF?1:2),tH="kiosk"===ex&&(eG||ek.isScanProcessing||ek.isPaymentProcessing),tV=o0(async e=>{if(eD.current)return"kiosk"!==ex?eD.current.handleSearchIdentificationCode(e):eD.current.handleSearchIdentificationCode(e,{waitForApply:!0})});(0,eN.useEffect)(()=>{let e=!1;return(async()=>{var t,l,i,a;if(!R)return e8(void 0);let n=null==(t=R.getOrderAmountSnapshot)?void 0:t.call(R),r=null==n||null==(l=n.summary)?void 0:l.product_expect_amount;try{let e=await (null==(i=R.getSummary)?void 0:i.call(R));r=(null==e?void 0:e.product_expect_amount)??(null==e||null==(a=e.summary)?void 0:a.product_expect_amount)??r}catch(e){console.error("Failed to read BaseSales summary:",e)}e||e8(r)})(),()=>{e=!0}},[R,e0,null==d?void 0:d.totalAmount,ea]);let tU=(0,eN.useMemo)(()=>Number(e3??E??(null==d?void 0:d.totalAmount)??0),[e3,E,null==d?void 0:d.totalAmount]),tY=(0,eN.useMemo)(()=>new lO(tU).minus(A||0).toNumber(),[A,tU]),tW=o0(async e=>{var t,l,i,a,n,r,o;if("shared"===$){eL((null==R||null==(t=R.getOrderPayments)?void 0:t.call(R))||[]),tu(),eD.current&&eW(eD.current.getWalletPassData(e));return}if(tc.isShow){let t=[],s=(null==R||null==(l=R.getOrderPayments)?void 0:l.call(R))||[],d=(null==(n=eD.current)||null==(a=n.getWalletPassData)||null==(i=a.call(n,e))?void 0:i.selectedWallet)||[];if(e.forEach(e=>{let l=e.code?eMV[e.code]:null;if(l&&tc.map[l]){let i=tc.map[l],a="payment_pending",n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,l=arguments.length>2?arguments[2]:void 0;return e.find(e=>(null==e?void 0:e.voucher_id)!==void 0&&0!==Number(e.voucher_id||0)&&String(e.voucher_id)===String(t)&&String(e.status||"")===String(l||""))}(s,e.voucher_id,a),r=d.find(t=>{var l;return String((null==t?void 0:t.id)??(null==t||null==(l=t.originData)?void 0:l.id))===String(e.voucher_id)}),o=(null==r?void 0:r.originData)||r||e,c=eXB({currencyAmount:e.amount,walletPassUsageUnit:e.wallet_pass_usage_unit});t.push({...n,amount:e.amount,code:null==i?void 0:i.code,id:Number(null==i?void 0:i.id)||0,name:null==i?void 0:i.name,type:null==i?void 0:i.type,status:a,custom_payment_id:Number(null==i?void 0:i.id)||0,voucher_id:e.voucher_id,wallet_pass_usage_unit:e.wallet_pass_usage_unit,wallet_pass_use_value:c,fund_record:function(e){var t,l;let{item:i,originData:a,paymentMethod:n}=e,r="point_card"===i.code||(null==a?void 0:a.tag)==="point_card"||(null==n?void 0:n.code)==="POINTCARD",o=(null==a?void 0:a.balance_par_value)??(null==a?void 0:a.balance)??(null==a?void 0:a.using_before_value)??0,s=i.wallet_pass_use_value??eXB({currencyAmount:i.amount,walletPassUsageUnit:i.wallet_pass_usage_unit}),d=r?s:i.amount,c=(()=>{try{return new lO(o||0).minus(d||0)}catch{return new lO(0)}})();return{voucher_id:i.voucher_id,wallet_pass_name:(t=(null==a?void 0:a.wallet_pass_name)||(null==a?void 0:a.format_title)||(null==a?void 0:a.product_name),l=null==n?void 0:n.name,t&&"object"==typeof t&&!eC().isValidElement(t)?t:{default:t||l||""}),code:(null==a?void 0:a.code)||i.code,encoded:null==a?void 0:a.encoded,using_before_value:eXH(o),using_after_value:eXH(c)}}({item:{...e,wallet_pass_use_value:c},originData:o,paymentMethod:i})})}}),null==e6||e6.addLog({type:"info",title:"handleSelectWalletChange BaseSales updateVoucherOrderPayments",metadata:{voucherItems:t,select:e}}),"function"!=typeof(null==R?void 0:R.updateVoucherOrderPaymentsAsync)&&"function"!=typeof(null==R?void 0:R.updateVoucherOrderPayments)){null==e6||null==(o=e6.addLog)||o.call(e6,{type:"error",title:"BaseSales updateVoucherOrderPayments is not available",metadata:{voucherItems:t,select:e}});return}await eX0(R,t,{status:"payment_pending"}),eL((null==(r=R.getOrderPayments)?void 0:r.call(R))||[]),tu(),eD.current&&eW(eD.current.getWalletPassData(e))}}),tG=o0(e=>{if(tu(),eD.current){let t=eD.current.getWalletPassData([]);eW(l=>{var i;return{...l,availableDiscountList:t.availableDiscountList,selectedDiscountList:(null==e||null==(i=e.discountList)?void 0:i.filter(e=>e.isSelected&&!e.isEditMode).map(e=>e.id))||t.selectedDiscountList}})}}),tK=async e=>{if(!e1)return void e2(!1);try{if(R&&(null==d?void 0:d.totalAmount)){var t;await (null==(t=R.updateTempOrderShopDiscount)?void 0:t.call(R,e)),null==O||O(e),await R.getSummary();let l=eXK(R);l&&(null==M||M(l),ei((null==l?void 0:l.remainingAmount)||"0"),en((null==l?void 0:l.totalAmount)||"0"),et((null==l?void 0:l.remainingAmount)||"0"))}}catch(e){console.error("Failed to adjust price:",e)}e2(!1)},tQ=o0(async()=>{var e;if(!e1)return;if(!(null==d?void 0:d.totalAmount)){null==Q||Q.fail(ez.getText("pisell2.checkout.manual-discount.no-amount"));return}let t=await Promise.resolve((null==R||null==(e=R.getOrderPayments)?void 0:e.call(R))||[]);if(null==t?void 0:t.length){null==Q||Q.fail(ez.getText("pisell2.checkout.manual-discount.has-payment-items"));return}if(0>=Number(eq)&&Number(null==d?void 0:d.totalAmount)>=0){null==Q||Q.fail(ez.getText("pisell2.checkout.manual-discount.no-amount"));return}e2(!0)}),tZ=async e=>{var t,l,i,a;switch(e){case"order-note":b(!0);break;case"send-link":eX(!0);break;case"split-payment":ed(!0);break;case"print-receipt":if(!(null==R?void 0:R.printLocalOrderReceipt))return;null==e6||null==(t=e6.addLog)||t.call(e6,{type:"info",title:"支付弹窗请求本地打印小票"});try{let e=await R.printLocalOrderReceipt();null==e6||null==(l=e6.addLog)||l.call(e6,{type:"info",title:"支付弹窗请求本地打印小票结果",metadata:{res:e}})}catch(e){console.error("handleButtonClick_print-receipt_error>>>>",e),null==e6||null==(i=e6.addLog)||i.call(e6,{type:"error",title:"支付弹窗请求本地打印小票失败",metadata:{error:e instanceof Error?e.message:String(e)}})}break;case"manual-discount":await e4("discount",tQ);break;case"save-pay-later":null==(a=J.current)||a.handleSavePayLaterClick()}};(0,eN.useImperativeHandle)(t,()=>({handleButtonClick:tZ,getSyncingLock:()=>eG,retryPaymentSync:tx}),[tZ,tx,eG]);let tJ=()=>{var e;let t=e=>null!=e&&""!==String(e).trim()?String(e).trim():null,l=t(null==td?void 0:td.display_name)||t(null==td?void 0:td.name)||ez.getText("pisell2.checkout.customer.default-name")||"Customer";return{id:(null==td?void 0:td.id)??(null==td?void 0:td.customer_id),nickname:(null==td?void 0:td.nickname)||ez.getText("pisell2.checkout.customer.default-name"),display_name:l,email:(null==td?void 0:td.email)||(null==td||null==(e=td.contacts)?void 0:e.email)||""}},tX=async e=>{var t,l,i,a,n,r,o;let s;if(!await to())return;let d=null==R||null==(l=R.getOrderIdentity)||null==(t=l.call(R))?void 0:t.orderId;await ts(),null==Q||null==(i=Q.loading)||i.call(Q,"",0);try{s=await eX4(R,{confirmPendingVoucherPayments:!1})}catch(e){null==Q||Q.error(e instanceof Error?e.message:ez.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(null==s?void 0:s.success)||eX3(null==s?void 0:s.response)){null==Q||Q.error(eX8(null==s?void 0:s.response)||ez.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(null!=(o=d=eX6(null==s?void 0:s.response)||(null==R||null==(n=R.getOrderIdentity)||null==(a=n.call(R))?void 0:a.orderId)||d)&&""!==String(o).trim()&&!("string"==typeof o&&/^LOCAL_/i.test(o.trim())))){null==Q||Q.error(ez.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}null==Q||null==(r=Q.hide)||r.call(Q);let c=await R.sendCustomerPayLink({emails:e.emails,order_ids:[d]});c.success||c.status?(null==Q||Q.success(ez.getText("pisell2.checkout.send-payment-link.success")),setTimeout(()=>{null==p||p(!0)},1e3)):null==Q||Q.error(c.message||ez.getText("pisell2.checkout.send-payment-link.error"))},t0=(0,eN.useCallback)(e=>{eI.current=!0,eA(e??null),eW({selectedWallet:[],availableDiscountList:[],selectedDiscountList:[]}),ts().then(async()=>{var e,t;"shared"===$&&await (null==R||null==(t=R.refreshWalletAssets)?void 0:t.call(R,{preserveSelection:!1})),eL((null==R||null==(e=R.getOrderPayments)?void 0:e.call(R))||[]),tu()}).catch(e=>{console.error("Failed to clear wallet pass payments:",e)});let t=eXK(R);t&&(null==M||M(t),ei(t.remainingAmount||"0"),en(t.totalAmount||"0"),et(t.remainingAmount||"0"))},[ts,R,tu,M,$]),t2=(0,eN.useMemo)(()=>({disabledSwitch:(null==I?void 0:I.disabledSwitchClient)||!!R&&eV.isCustomerChangeLocked}),[R,I,eV.isCustomerChangeLocked]),t1=(0,eN.useCallback)(async e=>{var t;return await (null==R||null==(t=R.roundAmount)?void 0:t.call(R,{amount:e}))},[R]),t4=(0,eN.useCallback)(e=>{"modal"!==P&&WG.clearAll()},[]);return(0,eB.jsxs)("div",{ref:Z,...{onClick:t4},style:{...eXA,maxHeight:S},children:[(t$.showCustomerModule||t$.showCustomerSelect||t$.showWalletPass)&&(0,eB.jsxs)("div",{style:{padding:"12px 16px",border:"1px solid #d0d5dd",borderRadius:8},children:[(t$.showCustomerModule||t$.showCustomerSelect)&&(0,eB.jsx)(eXO,{onClientChange:t0,clientInfo:td,onSearch:tV,baseSales:R,showCustomerSelect:t$.showCustomerSelect,...t2,beginScanActivity:"kiosk"===ex?e9:void 0}),t$.showWalletPass&&(0,eB.jsx)(eX_,{clientId:(null==td?void 0:td.id)??(null==td?void 0:td.customer_id),customAmount:el,orderInfo:d||void 0,ref:eD,paymentItems:eO,onSelectChange:tW,baseSales:R,onDiscountChange:tG,mode:$})]}),(0,eB.jsx)(eJ7,{amountSymbol:W("shop_symbol"),orderInfo:d||void 0,cartData:s,open_deposit:!!ti&&(null==I?void 0:I.enableDepositSwitch)!==!1,customAmount:ee,balanceDueAmount:el,paymentItems:eO,walletPassData:eY,clientInfo:D,onAmountChange:tA,onDepositStatusChange:tD,onDepositAmountChange:tE,onBalanceDueAmountClick:tZ,onConfirm:tL,confirmLoading:tO,totalAmount:x,baseSales:R,shouldUseNormalPayment:eU,enablePriceAdjust:e1,showPaymentType:(null==I?void 0:I.showPaymentType)!==!1}),(0,eB.jsxs)("div",{className:tF?"payment-grid-layout":"payment-flex-layout",children:[tF&&(0,eB.jsx)("div",{"aria-disabled":tH,style:{...tF?{gridColumn:"1",gridRow:(null==ej?void 0:ej.length)===1?"span 2":"1"}:{},...tH?{opacity:.6,pointerEvents:"none"}:{}},children:(0,eB.jsx)(eIf,{disabled:eZ,isModalOpen:c,syncingLock:eG||tH,amountSymbol:W("shop_symbol"),orderInfo:d||void 0,onPaymentComplete:tM,amountButtons:er,customAmount:eq,roundingFunction:t1,balanceDueAmount:eH,balanceDueTotalAmount:ea,shortcutsSize:(null==ej?void 0:ej.length)===3||(null==ej?void 0:ej.length)===1?"large":"default"})}),t$.showPaymentOptions&&(null==ej?void 0:ej.length)>0&&(0,eB.jsx)("div",{className:tF?"":"payment-options-module-container",style:tF?{gridColumn:"2",gridRow:(null==ej?void 0:ej.length)>3?"1 / 3":"1"}:{},children:(0,eB.jsx)(eH_,{amountSymbol:W("shop_symbol"),orderInfo:d||void 0,onClick:tP,paymentMethods:eu,customAmount:eq,title:ef,disabled:eZ||tH,showCashPayment:tF,channel:ex,columnCount:tB,sciSurchargeDisplayMap:eT,directCustomPayment:(null==I?void 0:I.directCustomPayment)===!0,isModalOpen:c,paymentMethodsReady:em,beginKioskPaymentActivity:tt,currentBaseSales:R,autoTriggerSinglePaymentOption:(null==I?void 0:I.autoTriggerSinglePaymentOption)===!0})}),t$.showAdditionalModule&&(0,eB.jsx)("div",{className:tF?"":"additional-module-container",style:tF?{gridColumn:(null==ej?void 0:ej.length)>3?"1":(null==ej?void 0:ej.length)<=1?"2":"span 2",gridRow:(null==ej?void 0:ej.length)===0?"1":"2"}:{},children:(0,eB.jsx)(eXS,{orderInfo:d||void 0,customAmount:eq,handleButtonClick:tZ,hasOrderNote:!!v&&v.trim().length>0,disabled:eZ,showCashPayment:tF,isFullWidth:!((null==ej?void 0:ej.length)>3||(null==ej?void 0:ej.length)<=1),showMore:!(tF&&(null==ej?void 0:ej.length)===0)})})]}),(0,eB.jsx)(eM4,{ref:ec,baseSales:R,dynamicMaxHeight:S,isWebPos:!0}),eJ&&(0,eB.jsx)(eJ1,{balanceAmount:ee,customerEmail:tJ().email,customerName:tJ().display_name||tJ().nickname,customerId:tJ().id,onClose:()=>eX(!1),sendPaymentLink:tX}),e1&&(0,eB.jsx)(dq,{containerProps:{wrapClassName:"pisell-modal-mask-pointer-events-auto",renderType:"modal",open:e0,onCancel:()=>e2(!1)},tips:ez.getText("pisell2.checkout.modal.price-adjustment-tips")||"Changing amount will update order total",selectType:"dark",originalValue:tU,defaultValue:tY,resetText:ez.getText("pisell2.checkout.modal.reset-price-adjustment"),onEnter:tK}),tn.editor,(0,eB.jsx)(eJ9,{ref:J,amountSymbol:W("shop_symbol"),walletPassData:eY,onSavePayLater:tR}),(0,eB.jsx)(eCG,{containerProps:{wrapClassName:"pisell-modal-mask-pointer-events-auto",renderType:"modal",open:es,onCancel:()=>ed(!1)},paymentOriginalValue:eH,paymentDefaultValue:String(eq||0),enableExceedMaxAmount:!1,payment:{enable:!0},surcharge:{enable:!1},surchargeDefaultValue:{percent:"0",fixed:"0"},selectType:"light",onChange:e=>{},doneText:ez.getText("confirm")||"确认",onPay:e=>{ed(!1);let t=Number(e.amount);if(!Number.isFinite(t)||t<=0){var l;null==Q||null==(l=Q.error)||l.call(Q,ez.getText("pisell2.checkout.split-payment.invalid-positive-amount"));return}tA(String(t))}})]})}),e0i=e=>{var t,l,i,a,n,r,o,s;let{open:d,baseSales:c,baseSalesModuleName:u,walletPassMode:p="legacy",data:m,callback:g,onClose:h,onSetLocalOrderId:v,setEditCartMode:f,editOrderId:y,paymentResultDisplayMode:b,shopDiscount:x,client:k,currentTotalPrice:_,onChangeShopDiscount:w,onChangeOrderNote:S,onDeleteOrderNote:j,variant:N,config:C={showHeaderCenter:!0,showHeaderRightButton:!0}}=e,M=eR();sZ(WU,(null==(n=M.appHelper.utils)||null==(a=n.getApp)||null==(i=a.call(n))||null==(l=i.locales)||null==(t=l.getLocale)?void 0:t.call(l))||(null==(o=M.appHelper.utils)||null==(r=o.storage)?void 0:r.get("umi_locale"))||"en");let{getApp:T,pisellos:I,getData:P,interaction:A,isWebPos:D}=(null==M||null==(s=M.appHelper)?void 0:s.utils)||{},E=function(e){let{baseSales:t,pisellos:l,baseSalesModuleName:i}=e,[a,n]=(0,eN.useState)(0),r=(0,eN.useMemo)(()=>{var e;return t||i&&(null==l||null==(e=l.getModule)?void 0:e.call(l,i))||null},[i,l,t,a]),o=(0,eN.useMemo)(()=>eXz(()=>{var e;return(null==r||null==(e=r.getOrderSnapshot)?void 0:e.call(r))||null},null),[r,a]),s=o.value,d=(0,eN.useMemo)(()=>eXz(()=>{var e;return(null==r||null==(e=r.getOrderAmountSnapshot)?void 0:e.call(r))||(null==s?void 0:s.amount)||null},null),[r,s,a]),c=d.value,u=(0,eN.useMemo)(()=>eXz(()=>{var e,t;return(null==r||null==(e=r.getOrderPayments)?void 0:e.call(r))||(null==s||null==(t=s.tempOrder)?void 0:t.payments)||[]},[]),[r,s,a]),p=u.value,m=(0,eN.useCallback)(()=>{n(e=>e+1)},[]),g=o.error||d.error||u.error||(i&&!r?Error(`BaseSales module not found: ${i}`):null),h=(0,eN.useMemo)(()=>(function(e,t){var l,i,a,n,r,o,s;if(!e&&!t)return null;let d=(null==e?void 0:e.identity)||{},c=t||(null==e?void 0:e.amount)||{},u=(null==e?void 0:e.tempOrder)||{},p=(null==u||null==(l=u._extend)?void 0:l.customerSnapshot)||(null==u?void 0:u.customer)||(null==e?void 0:e.customer)||null,m=u.customer_id??(null==p?void 0:p.id)??(null==p?void 0:p.customer_id)??(null==e||null==(i=e.customer)?void 0:i.customerId),g=(null==p?void 0:p.display_name)||(null==p?void 0:p.name)||u.customer_name||(null==e||null==(a=e.customer)?void 0:a.customerName)||"";return{orderId:d.orderId||d.externalSaleNumber||d.orderNumber,status:null==e?void 0:e.status,...ePC(c,u),paymentStatus:null==e?void 0:e.paymentStatus,itemCount:(null==e?void 0:e.productCount)||(null==e||null==(r=e.tempOrder)||null==(n=r.products)?void 0:n.length)||0,hasLocalOrderData:!!(null==e?void 0:e.tempOrder),customerId:m,customerName:g,customerPhone:(null==p?void 0:p.phone)||u.phone||(null==e||null==(o=e.customer)?void 0:o.phone)||"",customerEmail:(null==p?void 0:p.email)||u.email||(null==e||null==(s=e.customer)?void 0:s.email)||"",customerSnapshot:p}})(s,c),[s,c]);return{baseSales:r,orderSnapshot:s,amountSnapshot:c,paymentItems:p,orderInfo:h,error:g,refresh:m}}({baseSales:c,pisellos:I,baseSalesModuleName:u}),O=E.baseSales,z=!!u,[L,R]=(0,eN.useState)(null);(0,eN.useRef)(!1);let[$,F]=(0,eN.useState)(""),[q,B]=(0,eN.useState)([]),H=(0,eN.useRef)(!1),V=(0,eN.useRef)(null),[U,Y]=(0,eN.useState)(0),W=(0,eN.useMemo)(()=>Number((null==L?void 0:L.totalAmount)??U??0),[null==L?void 0:L.totalAmount,U]),[G,K]=(0,eN.useState)(!0),[Q,Z]=(0,eN.useState)(0),[J,X]=(0,eN.useState)(!1),[ee,et]=(0,eN.useState)(!1),[el,ei]=(0,eN.useState)(!1),[ea,en]=(0,eN.useState)(y||0),er=(0,nB.useToast)(),eo=dJ(),es=eC().useRef(null);(0,eN.useEffect)(()=>{if(z){if(E.error){var e;null==er||null==(e=er.error)||e.call(er,E.error.message);return}if(E.orderInfo){let e=Number(E.orderInfo.totalAmount||0);R(e=>{var t,l,i,a;return(null==e?void 0:e.orderId)===(null==(t=E.orderInfo)?void 0:t.orderId)&&(null==e?void 0:e.totalAmount)===(null==(l=E.orderInfo)?void 0:l.totalAmount)&&(null==e?void 0:e.remainingAmount)===(null==(i=E.orderInfo)?void 0:i.remainingAmount)&&(null==e?void 0:e.paymentStatus)===(null==(a=E.orderInfo)?void 0:a.paymentStatus)?e:E.orderInfo}),Y(t=>t===e?t:e)}}},[z,E.error,E.orderInfo,er]);let ed=async()=>{if(!ee){et(!0);try{var e,t;await (null==(t=eA.current)||null==(e=t.retryPaymentSync)?void 0:e.call(t))}catch(e){console.error("PaymentModal retry payment sync failed",e)}finally{et(!1)}}};(0,eN.useEffect)(()=>{let e=()=>{"u">typeof window&&Z(window.innerHeight)};return e(),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}},[]),(0,eN.useEffect)(()=>{var e;let t=async()=>{try{var e,t;let l=await (null==A||null==(t=A.utils)||null==(e=t.asyncDataManager)?void 0:e.call(t,{module:"get",key:"till_button"}));l&&WG.setTillButton(l)}catch(e){console.error("PaymentModal: Failed to get till_button from asyncDataManager:",e)}};(null==A||null==(e=A.utils)?void 0:e.asyncDataManager)&&t()},[A]),(0,eN.useEffect)(()=>{!d||H.current||V.current||(V.current=(async()=>{try{let e=await eTr(A);if(F(e),!e)return;let t=await eTo();B(t),H.current=!0}catch(e){console.warn("Failed to load checkout card readers:",e)}finally{V.current=null}})())},[A,d]);let ec=(0,eN.useMemo)(()=>"smallTablet"===N||"tablet"===N?{width:"98%",heightRatio:.98}:{width:880,heightRatio:.9},[N]),[eu,ep]=(0,eN.useState)(!1),em=(0,eN.useMemo)(()=>{if(0===Q)return"600px";let e=getComputedStyle(document.body).transform,t=1;return"none"!==e&&(t=new DOMMatrix(e).d),`${Math.floor(Q*ec.heightRatio/t)}px`},[Q,ec.heightRatio]),eg="phone"===N,eh=(0,eN.useMemo)(()=>"unset",[Q]),ev={showCashPayment:!0},ef=(0,eN.useCallback)(e=>{K(e)},[]),[ey,eb]=(0,eN.useState)(!1),[ex,ek]=(0,eN.useState)(""),[e_,ew]=(0,eN.useState)("payment-content"),eS=async e=>{var t,l,i,a;if("payment-result-toast"===e_){null==O||null==(l=O.getOrderIdentity)||null==(t=l.call(O))||t.orderId,O&&(null==(i=O.updateTempOrderNote)||i.call(O,e),ek(e),null==er||er.success(ez.getText("pisell2.checkout.order-note.updated-successfully"))),eb(!1),ew("payment-content");return}try{O&&(await (null==(a=O.updateTempOrderNote)?void 0:a.call(O,e)),ek(e),null==er||er.success(ez.getText("pisell2.checkout.order-note.updated-successfully"))),null==S||S(e)}catch(e){console.error("Failed to update order note:",e),null==er||er.error(ez.getText("pisell2.checkout.order-note.update-failed"))}eb(!1),ew("payment-content")},ej=async()=>{try{if(O){var e;await (null==(e=O.updateTempOrderNote)?void 0:e.call(O,"")),ek(""),null==er||er.success(ez.getText("pisell2.checkout.order-note.deleted-successfully"))}null==j||j()}catch(e){console.error("Failed to delete order note:",e),null==er||er.error(ez.getText("pisell2.checkout.order-note.delete-failed"))}eb(!1),ew("payment-content")},eT=(0,eN.useRef)(!1),eI=eC().useRef(!1),eP=eC().useRef(null),eA=eC().useRef(null),eD=()=>{try{var e;let t=(null==O||null==(e=O.getTempOrderNote)?void 0:e.call(O))||"";ek(t)}catch(e){console.warn("Failed to get temp order note:",e)}ew("payment-result-toast"),eb(!0)},eE=(e,t)=>{let l=eZ(),i=ez.formatLocale(l);try{let t=WU[i],l=null==t?void 0:t[e];if(l)return l}catch(e){console.error("本地语言包访问错误:",e)}return ez.getText(e)||t},eO=e=>{var t,l,i;let a={...es.current||{},...e||{}};if(es.current=a,(null==e?void 0:e.orderPrintPayload)&&(eP.current=e.orderPrintPayload),"page"===b&&(null==a||null==(t=a.paymentResultViewModel)?void 0:t.status)==="failed"&&!eI.current){eI.current=!0;let e=null==O||null==(i=O.getOrderIdentity)||null==(l=i.call(O))?void 0:l.orderId;null==h||h(!1,{order_id:e,event:{type:"modal-close",status:"failed",reason:"sync-failed",orderId:e,reset:!1,shouldRefreshOrder:!1,shouldCloseCaller:!1,payload:{order_id:e,paymentResult:a},isChangePaymentNotIncludeVoucher:eu}})}},eL=()=>{null==g||g({type:"toast-close",isCallbackFromToast:!0,shouldRefreshOrder:!1,shouldCloseCaller:!1,isChangePaymentNotIncludeVoucher:eu})},e$=async(e,t,l)=>{var i,a,n,r,o;let s=(null==(a=eA.current)||null==(i=a.getSyncingLock)?void 0:i.call(a))||!1;if(s&&!t){null==eq||eq.addLog({type:"warning",title:"订单正在同步中,用户点击取消",metadata:{isSyncingLocked:s}});return}let d=null==O||null==(r=O.getOrderIdentity)||null==(n=r.call(O))?void 0:n.orderId,c="start-new-order"===l?Q2({type:"modal-close",status:"cancelled",reason:"start-new-order",orderId:(o={orderId:d,payload:{order_id:d,paymentResult:es.current},isChangePaymentNotIncludeVoucher:eu}).orderId,reset:!0,payload:o.payload,shouldRefreshOrder:!0,shouldCloseCaller:!0,isChangePaymentNotIncludeVoucher:o.isChangePaymentNotIncludeVoucher}):void 0;null==g||g(c||{status:"cancelled",order_id:d}),null==h||h(e||!1,{order_id:d,paymentResult:es.current,...c?{event:c}:{}})},eF=o0(async()=>{var e,t,l,i,a;let n=(null==(t=eA.current)||null==(e=t.getSyncingLock)?void 0:e.call(t))||!1;if(n){null==eq||eq.addLog({type:"warning",title:"订单正在同步中,用户点击返回",metadata:{isSyncingLocked:n}});return}let r=null==O||null==(i=O.getOrderIdentity)||null==(l=i.call(O))?void 0:l.orderId;"shared"!==p&&await eXJ(O);let o=((null==O||null==(a=O.getOrderPayments)?void 0:a.call(O))||[]).some(e=>!!eTt(e)&&0===Number((null==e?void 0:e.voucher_id)||0)),s=!!("shared"!==p&&o&&r);null==g||g({status:"cancelled",source:"back",reason:"back",order_id:r,shouldRefreshOrder:s,isChangePaymentNotIncludeVoucher:eu}),null==h||h(!1,{order_id:r,event:{type:"modal-close",status:"cancelled",reason:"back",orderId:r,order_id:r,reset:!1,shouldRefreshOrder:s,shouldCloseCaller:!1,payload:{order_id:r},isChangePaymentNotIncludeVoucher:eu}})});(0,eN.useEffect)(()=>{var e;(null==m||null==(e=m.order_info)?void 0:e.order_note)&&ek(m.order_info.order_note)},[m]);let eq=eHy(),eH=null==eq?void 0:eq.addLog,eV=(0,eN.useCallback)(()=>{var e;null==eq||null==(e=eq.storeLog)||e.call(eq,!0)},[null==eq?void 0:eq.storeLog]);(0,eN.useEffect)(()=>{var e;if(!d||"u"<typeof window||"u"<typeof document)return;let t=`checkout-layout-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,l=0,i=e=>{let t=document.querySelector(e);if(!t)return null;let l=t.getBoundingClientRect();return{width:Number(l.width.toFixed(2)),height:Number(l.height.toFixed(2)),top:Number(l.top.toFixed(2)),left:Number(l.left.toFixed(2)),right:Number(l.right.toFixed(2)),bottom:Number(l.bottom.toFixed(2))}},a=function(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=Date.now();if(a||!(n-l<120)){l=n;try{let l=document.querySelector(".payment-modal-modal"),a=document.querySelector(".payment-modal-wrapper"),r=window.getComputedStyle(document.body),o=l?window.getComputedStyle(l):null,s=a?window.getComputedStyle(a):null,d=window.visualViewport;null==eH||eH({type:"info",title:"Checkout modal layout diagnostic",metadata:{sessionId:t,reason:e,timestamp:new Date(n).toISOString(),variant:N,configuredWidth:ec.width,window:{innerWidth:window.innerWidth,innerHeight:window.innerHeight,documentClientWidth:document.documentElement.clientWidth,documentClientHeight:document.documentElement.clientHeight,devicePixelRatio:window.devicePixelRatio},visualViewport:d?{width:d.width,height:d.height,scale:d.scale,offsetLeft:d.offsetLeft,offsetTop:d.offsetTop}:null,body:{transform:r.transform,zoom:r.zoom},modalWrapper:{rect:i(".payment-modal-modal"),width:(null==o?void 0:o.width)??null,maxWidth:(null==o?void 0:o.maxWidth)??null,transform:(null==o?void 0:o.transform)??null},floatingRoot:{rect:i(".payment-modal-wrapper"),width:(null==s?void 0:s.width)??null,height:(null==s?void 0:s.height)??null}}}),eV()}catch(e){console.warn("Failed to record checkout modal layout diagnostic",e)}}},n=()=>a("viewport-change"),r=new MutationObserver(()=>a("body-mutation"));r.observe(document.body,{attributes:!0,attributeFilter:["style","class"]}),a("modal-open",!0);let o=window.requestAnimationFrame(()=>a("next-frame",!0)),s=window.setTimeout(()=>a("startup-settled",!0),500);return window.addEventListener("resize",n),window.addEventListener("orientationchange",n),null==(e=window.visualViewport)||e.addEventListener("resize",n),()=>{var e;window.cancelAnimationFrame(o),window.clearTimeout(s),window.removeEventListener("resize",n),window.removeEventListener("orientationchange",n),null==(e=window.visualViewport)||e.removeEventListener("resize",n),r.disconnect(),a("modal-close",!0)}},[eH,ec.width,eV,d,N]);let eU=(0,eN.useRef)(void 0),eY=(0,eN.useRef)(void 0);(0,eN.useEffect)(()=>{(async()=>{try{if(O){eU.current=!0;let e=await eTa(A);O.setOtherParams({is_price_include_tax:P("is_price_include_tax")??1,tax_rate:P("tax_rate"),surcharge_list:P("surcharge_list"),currency_format:P("currency_format"),tax_title:P("tax_title")||"GST",tax_country_code:P("tax_country_code"),currency_code:P("shop_currency_code"),currency_symbol:P("shop_symbol"),order_rounding_setting:P("order_rounding_setting"),shop_wallet_pass_id:e,business_code:eo});let t=eXK(O);t&&t.totalAmount&&Y(Number(t.totalAmount||0)),R(t)}else if(eU.current){var e,t,l;eU.current=!1,await (null==O||null==(e=O.restoreOrder)?void 0:e.call(O)),y||ea?await (null==O||null==(t=O.saveDraft)?void 0:t.call(O)):(null==eq||eq.addLog({type:"info",title:"含有 localOrderCreate, 保存 BaseSales 草稿",metadata:{data:m}}),await (null==O||null==(l=O.saveDraft)?void 0:l.call(O)));let i=eXK(O);i&&i.totalAmount&&Y(Number(i.totalAmount||0)),R(i),eU.current=!0}else throw Error("pisellos is not available")}catch(t){console.error("Failed to initialize checkout data:",t);let e=window.location.hostname;null==eq||eq.addLog({type:"error",title:`${e}: Failed to initialize checkout data`,metadata:{error:null==t?void 0:t.message}}),ei(!0)}})()},[]),(0,eN.useEffect)(()=>()=>{if("function"==typeof eY.current){var e;null==(e=eY.current)||e.call(eY),eY.current=void 0}},[]);let eW={context:M,pisellos:I,getData:P,interaction:A,Toast:er,onToastClose:eL,paymentResultDisplayMode:b,onResultViewModel:e=>{eO({paymentResultViewModel:e})}},eG=function(e){var t,l,i;let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0,r=e=>`payment-result-toast-${e}`,{isTerminal:o,isWebPos:s,NativePage:d}=null==(t=M.appHelper)?void 0:t.utils,c=n??(null==O||null==(i=O.getOrderIdentity)||null==(l=i.call(O))?void 0:l.orderId),u=()=>{WK()},p=async()=>{var e,t,l;setTimeout(()=>{u()},0),null==(l=M.appHelper)||null==(t=l.utils)||null==(e=t.action)||e.call(t,{type:"pisell1.handleOpenSaleDetail",data:{osKey:"big-sale-detail",osProps:{orderId:c}},callback:()=>{}})},m=async()=>{var e,t;if(setTimeout(()=>{u()},0),null==O?void 0:O.printLocalOrderReceipt){null==(e=eq.addLog)||e.call(eq,{type:"info",title:"支付结果弹窗请求本地打印小票"});try{let e=await O.printLocalOrderReceipt(c);null==(t=eq.addLog)||t.call(eq,{type:"info",title:"支付结果弹窗请求本地打印小票结果",metadata:{res:e}})}catch(e){console.error("handleButtonClick_print-receipt_error>>>>",e),null==er||er.error(e instanceof Error?e.message:String(e))}}},g=()=>{setTimeout(()=>{u()},0),ez.getText("payment.result.actions.orderNoteClicked"),eD&&eD()},h=()=>{ez.getText("payment.result.actions.refundClicked")};switch(e){case"paid":case"partially_paid":return[[a?{id:"details",buttonProps:{className:r("action-button"),onClick:p,icon:(0,eB.jsx)(GI,{className:r("action-icon")}),children:ez.getText("payment.result.details")}}:{id:"print",buttonProps:{className:r("action-button"),onClick:m,icon:(0,eB.jsx)(GA,{className:r("action-icon")}),children:ez.getText("payment.result.printReceipt")}},{id:"more",isMore:!0,menuData:[{key:"orderNote",label:ez.getText("payment.result.orderNote"),icon:(0,eB.jsx)(eIY,{className:r("menu-icon")}),onClick:g},a?{key:"print",label:ez.getText("payment.result.printReceipt"),icon:(0,eB.jsx)(GA,{className:r("action-icon")}),onClick:m}:{key:"details",label:ez.getText("payment.result.details"),icon:(0,eB.jsx)(GI,{className:r("action-icon")}),onClick:p}],buttonProps:{className:r("action-button"),icon:(0,eB.jsx)(oh,{className:r("action-icon")})}}]];case"failed":return[[{id:"retry",buttonProps:{className:r("action-button retry-button"),onClick:()=>{ez.getText("payment.result.actions.retryClicked")},icon:(0,eB.jsx)(eXP,{className:r("action-icon")}),children:ez.getText("payment.result.retry")}},{id:"changePayment",buttonProps:{className:r("action-button change-payment-button"),onClick:()=>{ez.getText("payment.result.actions.changePaymentClicked")},icon:(0,eB.jsx)(eiS,{className:r("action-icon")}),children:ez.getText("payment.result.changePayment")}},{id:"more",isMore:!0,menuData:[{key:"orderNote",label:ez.getText("payment.result.orderNote"),icon:(0,eB.jsx)(eIY,{className:r("menu-icon")}),onClick:g},{key:"refund",label:ez.getText("payment.result.refund"),icon:(0,eB.jsx)(oS,{className:r("menu-icon")}),onClick:h}],buttonProps:{className:r("action-button"),icon:(0,eB.jsx)(oh,{className:r("action-icon")})}}]];case"wallet-pass-failed":return[[{id:"savePartial",buttonProps:{className:r("action-button primary-button"),onClick:()=>{var e;null==(e=eA.current)||e.handleButtonClick("save-pay-later")},children:ez.getText("payment.result.saveAsPartialPaid")}},{id:"continuePayment",buttonProps:{className:r("action-button primary-button"),onClick:()=>{ez.getText("payment.result.actions.continuePaymentClicked"),u()},children:ez.getText("payment.result.continuePayment")}},{id:"more",isMore:!0,menuData:[{key:"details",label:ez.getText("payment.result.details"),icon:(0,eB.jsx)(GI,{className:r("menu-icon")}),onClick:p},{key:"print",label:ez.getText("payment.result.printReceipt"),icon:(0,eB.jsx)(GA,{className:r("menu-icon")}),onClick:m},{key:"orderNote",label:ez.getText("payment.result.orderNote"),icon:(0,eB.jsx)(eIY,{className:r("menu-icon")}),onClick:g},{key:"refund",label:ez.getText("payment.result.refund"),icon:(0,eB.jsx)(oS,{className:r("menu-icon")}),onClick:h}],buttonProps:{className:r("action-button"),icon:(0,eB.jsx)(oh,{className:r("action-icon")})}}]];default:return[]}},eK=async e=>{var t,l,i;let a,n=null==(t=e.response)?void 0:t.data,r=null==n?void 0:n.payment_status,o=Number((null==n?void 0:n.total_amount)||(null==n?void 0:n.expect_amount)||0),s=Number((null==n?void 0:n.amount_gap)||0),d={autoClose:(a=eXj[eXN(r,void 0)||"paid"]).autoClose,autoCloseDelay:30,maskClosable:a.maskClosable},c=(null==n?void 0:n.order_id)??(null==n?void 0:n.orderId)??(null==(l=e.response)?void 0:l.order_id)??(null==(i=e.response)?void 0:i.orderId),u=eG?eG(r,!1,c):[];return eXT({paymentStatus:r,orderTotalAmount:o,gapAmount:s,autoCloseConfig:d,actionButtons:u},eW)};return(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)(oq,{renderType:eg?"drawer":"modal",showHandlerBar:eg,props:eg?{open:d,placement:"bottom",header:!1,footer:!1,destroyOnClose:!0,height:"95vh",closable:!1,onClose:()=>{e$(!1)},maskClosable:!0,styles:{body:{padding:0,overflow:"hidden"}},className:"payment-mobile-modal"}:{open:d,onCancel:()=>{eF()},title:(0,eB.jsx)(()=>(0,eB.jsxs)("div",{className:"payment-modal-custom-header",children:[(0,eB.jsx)("div",{className:"header__left",children:(0,eB.jsx)(eM.Button,{icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-arrow-left",size:24}),size:"small",type:"text",onClick:eF})}),(null==C?void 0:C.showHeaderCenter)&&(0,eB.jsxs)("div",{className:"header__center",children:[eE("order.total"),":",eXM(W,P("shop_symbol"))]}),(null==C?void 0:C.showHeaderRightButton)&&(0,eB.jsx)("div",{className:"header__right",children:(0,eB.jsx)(eM.Button,{size:"small",type:"link",onClick:()=>e$(!0,!1,"start-new-order"),children:ez.getText("order.start-new-order")})})]}),{}),width:ec.width,className:`payment-modal-modal ${"smallTablet"===N||"tablet"===N?"payment-modal-modal-responsive":""}`,destroyOnClose:!1,maskClosable:!1,footer:null,closeIcon:!1,wrapClassName:`payment-modal-wrapper ${!G?"no-cash-payment":""}`,size:"large",style:{height:"auto",maxHeight:"98%"},bodyStyle:{maxHeight:"100%",overflowY:"auto",padding:0,display:"flex",flexDirection:"column"}},children:eg?(0,eB.jsxs)("div",{className:"payment-mobile-modal-panel",children:[(0,eB.jsx)("div",{className:"payment-mobile-modal-header",children:(0,eB.jsxs)("div",{style:eXR,children:[(0,eB.jsx)(eM.Button,{icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-arrow-left",size:20}),size:"small",type:"text",style:eX$,onClick:eF}),(null==C?void 0:C.showHeaderCenter)!==!1?(0,eB.jsxs)("div",{style:eXF,children:[eE("order.total")||"Order Total",":"," ",eXM(W,P("shop_symbol"))]}):(0,eB.jsx)("div",{}),(null==C?void 0:C.showHeaderRightButton)!==!1?(0,eB.jsx)(eM.Button,{size:"small",type:"link",style:eXq,onClick:()=>e$(!0,!1,"start-new-order"),children:ez.getText("order.start-new-order")||"New Order"}):(0,eB.jsx)("div",{style:eXq})]})}),(0,eB.jsx)("div",{className:"payment-mobile-modal-content",style:{height:"100%"},children:(0,eB.jsx)(e0l,{ref:eA,isModalOpen:d,cartData:(0,ni.cloneDeep)(m),orderInfo:L||void 0,onPaymentComplete:eO,onPaymentCancel:e$,onStatusChange:()=>{},paymentResultDisplayMode:b,shopDiscount:x,client:k,currentTotalPrice:_,onChangeShopDiscount:w,onChangeOrderNote:S,onDeleteOrderNote:j,showingCashToastRef:eT,onToastClose:eL,orderNote:ex,setOrderNote:ek,setNoteModalSource:ew,setNoteModalOpen:eb,totalAmount:W,moduleConfig:ev,onShowCashPaymentChange:ef,showSuccessToast:eK,dynamicMaxHeight:eh,onOrderSyncFailed:()=>X(!0),generateActionButtons:eG,paymentResultToastConfig:eW,updateOrderInfo:e=>R(e),setCurrentEditOrderId:e=>en(e),baseSales:O,walletPassMode:p,config:C,cardReaderDeviceNumber:$,cardReaders:q,setIsChangePaymentNotIncludeVoucher:ep})})]}):(0,eB.jsx)(e0l,{ref:eA,isModalOpen:d,cartData:(0,ni.cloneDeep)(m),orderInfo:L||void 0,onPaymentComplete:eO,onPaymentCancel:e$,onStatusChange:()=>{},paymentResultDisplayMode:b,shopDiscount:x,client:k,currentTotalPrice:_,onChangeShopDiscount:w,onChangeOrderNote:S,onDeleteOrderNote:j,showingCashToastRef:eT,onToastClose:eL,orderNote:ex,setOrderNote:ek,setNoteModalSource:ew,setNoteModalOpen:eb,totalAmount:W,moduleConfig:ev,onShowCashPaymentChange:ef,showSuccessToast:eK,dynamicMaxHeight:em,onOrderSyncFailed:()=>X(!0),generateActionButtons:eG,paymentResultToastConfig:eW,updateOrderInfo:e=>R(e),setCurrentEditOrderId:e=>en(e),baseSales:O,walletPassMode:p,config:C,cardReaderDeviceNumber:$,cardReaders:q,setIsChangePaymentNotIncludeVoucher:ep})}),ey&&(0,oj.createPortal)((0,eB.jsx)("div",{children:(0,eB.jsx)(dM,{open:ey,title:ez.getText("pisell2.text.add-order-notes"),value:ex,onConfirm:eS,onDelete:ej,onCancel:()=>{eb(!1),ew("payment-content")}})}),document.body),(0,eB.jsx)(nB.PisellContainer,{renderType:"modal",props:{open:J,title:ez.getText("pisell2.checkout.tips"),footer:null,keyboard:!1,maskClosable:!1,closable:!1,onCancel:()=>{}},children:(0,eB.jsxs)("div",{style:{textAlign:"center",padding:"20px"},children:[(0,eB.jsx)("div",{style:{marginBottom:"16px",fontSize:"16px"},children:ez.getText("pisell2.checkout.sync-retry-hint")||"请点击重试按钮重新同步订单"}),(0,eB.jsx)(eM.Button,{type:"primary",size:"large",onClick:ed,loading:ee,disabled:ee,style:{width:"100%",marginTop:"80px"},children:ez.getText("retry")||"重试"})]})}),(0,eB.jsx)(nB.PisellContainer,{renderType:"modal",props:{open:el,title:ez.getText("pisell2.checkout.tips"),footer:null,keyboard:!1,onCancel:()=>{ei(!1)}},children:(0,eB.jsxs)("div",{style:{textAlign:"center",padding:"20px"},children:[(0,eB.jsx)("div",{style:{marginBottom:"16px",fontSize:"16px"},children:ez.getText("pisell2.checkout.order-create-failed")}),(0,eB.jsx)(eM.Button,{type:"primary",size:"large",onClick:()=>{ei(!1),window.location.reload()},style:{width:"100%",marginTop:"80px"},children:ez.getText("confirm")||"确认"})]})})]})};e0i.displayName="PaymentModal";let e0a=oW(e0i);function e0n(e){let t=new Set,l=(e,i)=>{if("string"==typeof e)return"[object Object]"===e.trim()?"":e.trim();if(!e||"object"!=typeof e||i>8||t.has(e))return"";if(t.add(e),Array.isArray(e))return e.map(e=>l(e,i+1)).filter(Boolean).join("\n");for(let t of["response","data","body","message","msg","error","errors","statusText"]){let a=l(e[t],i+1);if(a)return a}return""};return l(e,0)}let e0r=e=>e&&"object"==typeof e&&!Array.isArray(e)?e:{},e0o=e=>{if("number"!=typeof e&&"string"!=typeof e||""===String(e).trim())return null;let t=eHE(e);return null!==t&&t>=0?t:null},e0s=function(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];for(let e of t){let t=e0o(e);if(null!==t)return t}return null},e0d=e=>!0===e||1===e||"1"===e||!1!==e&&0!==e&&"0"!==e&&void 0,e0c={en:{"pisell2.venue-kiosk.checkout.failed":"Checkout could not be completed. Please try again.","pisell2.venue-kiosk.checkout.reset-failed":"Could not start the next order. Please try again.","pisell2.venue-kiosk.checkout.result-missing":"The payment result could not be displayed. Continue paying this order.","pisell2.venue-kiosk.checkout.order-reference":"Order","pisell2.venue-kiosk.checkout.continue-payment":"Continue payment"},"zh-CN":{"pisell2.venue-kiosk.checkout.failed":"结账未完成,请重试。","pisell2.venue-kiosk.checkout.reset-failed":"暂时无法开始下一单,请重试。","pisell2.venue-kiosk.checkout.result-missing":"暂时无法显示支付结果,请继续处理当前订单。","pisell2.venue-kiosk.checkout.order-reference":"订单","pisell2.venue-kiosk.checkout.continue-payment":"继续支付"}},e0u=e=>{let t=String(e??"").trim();return/^\d+$/.test(t)&&Number(t)>0?t:void 0},e0p=e=>{var t;return(null==e||null==(t=e._extend)?void 0:t.localId)||(null==e?void 0:e.external_sale_number)||(null==e?void 0:e.order_id)||e},e0m=0,e0g=e=>{var t,l,i;let a=(null==(l=e.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.sales.tempOrder;return(null==a||null==(i=a._extend)?void 0:i.localId)||(null==a?void 0:a.external_sale_number)||(null==a?void 0:a.order_id)||a},e0h=new Set(["id","product_id","product_variant_id","product_option_item_id","option_group_item_id","option_group_id","group_id","bundle_id","bundle_group_id","bundle_product_id","_bundle_product_id","bundle_variant_id","variant_id","quantity","num"]),e0v=e=>"string"==typeof e||"number"==typeof e&&Number.isFinite(e),e0f=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(e)?e.map(e=>{let l={};if(!e||"object"!=typeof e)throw Error("Invalid saved Party configuration.");for(let[t,i]of Object.entries(e))e0h.has(t)&&e0v(i)&&(l[t]=i);return!t&&Array.isArray(e.option)&&(l.option=e0f(e.option,!0)),l}):[]},e0y=(e,t)=>Object.entries(e||{}).reduce((e,l)=>{let[i,a]=l;return!["__proto__","constructor","prototype"].includes(i)&&(!t||t.includes(i))&&e0v(a)&&(e[i]=a),e},{}),e0b=e=>e0y(e,["scheduleId","timeSlotId","ruleId","source","label"]);function e0x(e){let t=null==e?void 0:e.candidate;return{...t?{candidate:{key:t.key,productId:t.productId,source:t.source,date:t.date,businessDate:t.businessDate,startAt:t.startAt,endAt:t.endAt,startTime:t.startTime,endTime:t.endTime,bookingStartAt:t.bookingStartAt,bookingEndAt:t.bookingEndAt,timezone:t.timezone,scheduleRefs:(t.scheduleRefs||[]).map(e0b),...t.primaryScheduleRef?{primaryScheduleRef:e0b(t.primaryScheduleRef)}:{}}}:{},requirementSelections:((null==e?void 0:e.requirementSelections)||[]).map(e=>({...null!=e.requirementGroupId?{requirementGroupId:e.requirementGroupId}:{},...null!=e.formId?{formId:e.formId}:{},resourceIds:e.resourceIds.filter(e0v)}))}}function e0k(e,t){let l=Number(e.detail.id??e.detail.product_id),i=e.configuration.skuValue,a=e.quantity??1;if(!Number.isSafeInteger(l)||l<=0||!Number.isSafeInteger(a)||a<=0||Number(i.product_id)!==l||!Number.isSafeInteger(Number(i.product_variant_id??0)))throw Error("Invalid saved Party configuration.");let n=e.configuration.variantDraft;return{version:1,productId:l,phase:t,quantity:a,...e.lineUid?{lineUid:e.lineUid}:{},configuration:{skuValue:{product_id:l,product_variant_id:Number(i.product_variant_id??0),..."string"==typeof i.product_option_string?{product_option_string:i.product_option_string}:{},option:e0f(i.option),bundle:e0f(i.bundle)},variantDraft:n?{productId:n.productId,selectionKey:n.selectionKey,items:e0y(n.items||{}),productOptionString:n.productOptionString}:null},selection:e0x(e.initialSelection)}}function e0_(e,t){var l,i,a;let n=["string"==typeof e?e:void 0,null==e?void 0:e.message,null==e||null==(i=e.response)||null==(l=i.data)?void 0:l.message,null==e||null==(a=e.data)?void 0:a.message].find(e=>"string"==typeof e&&!!e.trim()&&"[object Object]"!==e.trim());return(null==n?void 0:n.trim())||t}let e0w=e=>Array.isArray(e)?e:[],e0S=(e,t)=>null!=e&&null!=t&&String(e)===String(t),e0j=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??"")},e0N=e=>!!e&&"object"==typeof e&&[0,1,"0","1"].includes(e.has_deposit);function e0C(e,t,l,i){if(!e||Number(e.order_id||0)>0)return[];let a=e0w(e.products);return(0,ni.flatMap)(a,n=>{var r,o,s,d,c,u,p;let m=null==(r=n.metadata)?void 0:r.venue_booking_role,g="tickets"===m||"party_main"===m?l:"tickets_extra"===m||"party_extra"===m?i:void 0,h=e0j(n);if(!g||!h||(null==(o=n.metadata)?void 0:o.venue_booking_scope_key)!==t||Number(n.order_detail_id||0)>0||1!==a.filter(e=>e0j(e)===h).length)return[];let v=n._origin??(null==(u=e._extend)||null==(c=u.productsByUid)||null==(d=c[e0j(n)])?void 0:d.origin)??(null==(p=n.metadata)?void 0:p.origin)??{};if(null!=(n.custom_deposit_data??v.custom_deposit_data??(null==(s=v.product)?void 0:s.custom_deposit_data)))return[];let f=g.filter(e=>e0S(e.id,n.product_id));if(1!==f.length||!e0N(f[0].custom_deposit_data))return[];let y=f[0],b=Number(n.product_variant_id||0),x=e0w(y.variant).filter(e=>e0S(e.id,b));if(b>0&&1!==x.length)return[];let k={...v,custom_deposit_data:(0,ni.cloneDeep)(y.custom_deposit_data)};if(b>0&&e0N(x[0].custom_deposit_data)){let e=e0w(v.variant),t=e.find(e=>e0S(e.id,b));k.variant=t?e.map(e=>e!==t||null!=e.custom_deposit_data?e:{...e,custom_deposit_data:(0,ni.cloneDeep)(x[0].custom_deposit_data)}):[...e,{id:x[0].id,custom_deposit_data:(0,ni.cloneDeep)(x[0].custom_deposit_data)}]}let _=!1,w=e0w(n.product_bundle).map(e=>{let t,l,i,a,n;if(null!=e.custom_deposit_data)return e;let r=(t=e.bundle_group_id??e.group_id,l=e.bundle_id??e.id,i=e.bundle_product_id??e._bundle_product_id??e.product_id,a=e.bundle_variant_id??e.product_variant_id??e.variant_id??0,1===(n=(0,ni.flatMap)(e0w(y.bundle_group).filter(e=>null==t||e0S(e.id,t)),e=>e0w(e.bundle_item)).filter(e=>null!=l&&e0S(e.id??e.bundle_id,l)&&(null==i||e0S(e.bundle_product_id??e._bundle_product_id??e.product_id,i))&&e0S(e.bundle_variant_id??e.product_variant_id??e.variant_id??0,a))).length?n[0]:void 0);return e0N(null==r?void 0:r.custom_deposit_data)?(_=!0,{...e,custom_deposit_data:(0,ni.cloneDeep)(r.custom_deposit_data)}):e});return[{product_id:Number(n.product_id),product_variant_id:b,unique_identification_number:h,updates:{_origin:k,..._?{product_bundle:w}:{}}}]})}let e0M=(e,t)=>{var l,i;return e.os===t.os&&e.scopeKey===t.scopeKey&&e.order===t.os.getTempOrder()&&e.identity===eKA(t.os.getTempOrder())&&e.customer===String((null==(l=t.os.getTempOrder())?void 0:l.customer_id)||"")&&0>=Number((null==(i=t.os.getTempOrder())?void 0:i.order_id)||0)},e0T=e=>({customer:e.customer_id,bookings:e.bookings,holder:e.holder_relations,products:e0w(e.products).filter(e=>{var t;return!(null==(t=e.metadata)?void 0:t._giftInfo)}).map(e=>{var t,l;return{uid:e0j(e),product:e.product_id,variant:e.product_variant_id,num:e.num,sku:ia({product_id:Number(e.product_id),product_variant_id:Number(e.product_variant_id||0),option:exP(e),bundle:e.product_bundle||[]}),note:e.note,remark:e.remark,scope:null==(t=e.metadata)?void 0:t.venue_booking_scope_key,role:null==(l=e.metadata)?void 0:l.venue_booking_role}})});function e0I(e,t){let l=eKP(Number(e.id)),{value:i}=R0(io(l.skuValue,e,{overSold:t}).value,e,{overSold:t});if(i===l.skuValue)return l;let a=is(i,e);return{...l,skuValue:i_(a,e,l.skuValue)}}function e0P(e){var t,l,i,a,n,r,o,s,d,c,u,p,m,g,h,v,f,y;let b,x,k,_,w,S,j=eR(),N=eKa(),C=exp(),M=Uu(),T=function(){var e;let t=(null==(e=eKn())?void 0:e.layout)==="compact",[l,i]=(0,eN.useState)(()=>"u">typeof window&&window.matchMedia("(max-width: 700px)").matches),[a,n]=(0,eN.useState)(!1);return(0,eN.useEffect)(()=>{let e=window.matchMedia("(max-width: 700px)"),l=()=>{i(e.matches),e.matches||t||n(!1)};return l(),e.addEventListener("change",l),()=>e.removeEventListener("change",l)},[t]),{isMobile:t||l,open:a,show:()=>n(!0),close:()=>n(!1),closeThen:e=>{if(!a)return e();n(!1),requestAnimationFrame(e)}}}(),I=eKB(),{mode:P,context:A,config:D,scopeKey:E,variant:O="desktop"}=e,{sales:z,cart:L}=A,R=z.bookingTicket,$=eKE(R),F=String(e.locale).startsWith("zh")?"zh":"en",q=(e,t)=>"zh"===F?t:e,B=eKD((null==(t=R.otherParams)?void 0:t.businessTimezone)||(null==j||null==(a=j.appHelper)||null==(i=a.utils)||null==(l=i.getData)?void 0:l.call(i,"timezone"))),H=(0,eN.useRef)({date:B,step:"select"}),[V,U]=(0,eN.useState)(H.current.date),[Y,W]=(0,eN.useState)(()=>{let e=eQN(H.current.date,eQ_(F));return Array.from({length:7},(t,l)=>eQj(e,l)).filter(e=>e>=B)}),[G,K]=(0,eN.useState)("select"),[Q,Z]=(0,eN.useState)(!1),[J,X]=(0,eN.useState)(),ee=(0,eN.useRef)(),[et,el]=(0,eN.useState)("date"),[ei,ea]=(0,eN.useState)(),[en,er]=(0,eN.useState)(),[eo,es]=(0,eN.useState)(),[ed,ec]=(0,eN.useState)(),[eu,ep]=(0,eN.useState)(),[em,eg]=(0,eN.useState)(!1),[eh,ev]=(0,eN.useState)(),[ef,ey]=(0,eN.useState)(!1),[eb,ex]=(0,eN.useState)(),[ek,e_]=(0,eN.useState)(),[eS,ej]=(0,eN.useState)(!1),[eC,eT]=(0,eN.useState)(!1),[eI,eP]=(0,eN.useState)(0),[eA,eD]=(0,eN.useState)(),[eE,eO]=(0,eN.useState)(!1),[eL,e$]=(0,eN.useState)(!1),eq=(0,eN.useRef)(!1),eB=(0,eN.useRef)(()=>!1),eH=(0,eN.useRef)(async()=>{}),eV=(0,eN.useRef)(async()=>!1),eU=(0,eN.useRef)(0),eY=(0,eN.useRef)(0),eW=(0,eN.useRef)(!0),eG=(0,eN.useRef)(),eK=(0,eN.useCallback)(e=>(eG.current=e,()=>{eG.current===e&&(eG.current=void 0)}),[]),eQ=(0,eN.useRef)(null);(0,eN.useEffect)(()=>(eW.current=!0,()=>{eW.current=!1,eU.current++}),[]);let eZ=D.steps[P].catalog,eJ=$?(null==(r=R.getTempOrder)||null==(n=r.call(R))?void 0:n.customer_id)??(null==(o=L.tempOrder)?void 0:o.customer_id)??void 0:(null==(s=A.customer.selected)?void 0:s.id)??(null==(d=L.tempOrder)?void 0:d.customer_id)??void 0,eX=async()=>{await L.recalcSummary(),L.refreshCartSnapshot()},e0=async()=>{await eX(),eW.current&&eP(e=>e+1)},e2=function(e){var t,l;let{source:i,enabled:a,scopeKey:n,create:r,refresh:o,initialState:s,customerMode:d="web",persistDraft:c=!0,retire:u,canRetire:p,waitForRetire:m}=e,g=eZ8(i),h=null==(t=i.otherParams)?void 0:t.businessCode,v=c&&g?`pisell:venue-booking:v2:${JSON.stringify([n,g])}`:void 0,f=()=>({ready:!1,restored:!1,pendingOrder:!1,state:s}),[y,b]=(0,eN.useState)(()=>({value:f()})),x=(0,eN.useRef)(),k=(0,eN.useRef)({create:r,refresh:o,initialState:s,retire:u,canRetire:p,waitForRetire:m});k.current={create:r,refresh:o,initialState:s,retire:u,canRetire:p,waitForRetire:m},(0,eN.useEffect)(()=>{if(!a||!i)return;let e=eZ3.get(i);e||(e={tail:Promise.resolve(),hasSession:!1},eZ3.set(i,e));let t=e,l=t.owner;if(!(null==l?void 0:l.active)||l.scopeKey!==n||l.cacheId!==g){let e;(null==l?void 0:l.active)&&eJe(l);let a=k.current,r=!!v&&!t.hasSession&&(()=>{try{var e;return"u">typeof performance&&(null==(e=performance.getEntriesByType("navigation")[0])?void 0:e.type)==="reload"}catch{return!1}})()&&!eZ1.has(v);t.hasSession=!0,v&&eZ1.add(v);try{let t=v?JSON.parse(sessionStorage.getItem(v)||"null"):null;v&&(null==t?void 0:t.version)===2&&t.scopeKey===n&&t.cacheId===g&&"status"in t&&"submission-pending"===t.status?sessionStorage.removeItem(v):(r&&(e=t),v&&!r&&sessionStorage.removeItem(v))}catch{}t.owner=l={source:i,scopeKey:n,cacheId:g,storageKey:v,refs:0,releaseVersion:0,active:!0,order:null,sessionId:`${Date.now()}:${++eZ4}`,discarded:!1,lastState:a.initialState,retireOrder:a.retire,canRetire:a.canRetire,waitForRetire:a.waitForRetire,value:{ready:!1,restored:!1,pendingOrder:!1,state:a.initialState},listeners:new Set};let o=l,s=()=>t.owner===o&&o.active&&o.refs>0,c=e=>{s()&&(o.order=i.getTempOrder(),o.lastState=e.state,o.value=e,eZ9(o))};t.tail=t.tail.then(async()=>{if(!s())return;if(t.orderOwner=o,t.orderSessionId=o.sessionId,eZ7(i.getTempOrder()))return void c({ready:!0,restored:!1,pendingOrder:!0,state:a.initialState});if("kiosk"!==d&&("function"!=typeof i.syncAuthenticatedOrderCustomer||"function"!=typeof i.clearOrderCustomer))throw Error("This booking service version cannot safely synchronize the signed-in customer. Please update the service before continuing.");if(await a.create(),!s())return;if(eZ7(i.getTempOrder()))return void c({ready:!0,restored:!1,pendingOrder:!0,state:a.initialState});let l=!1,r=a.initialState;if((null==e?void 0:e.version)===2&&e.scopeKey===n&&e.cacheId===g&&e.order&&!eZ7(e.order)&&Array.isArray(e.order.products)&&Object.prototype.hasOwnProperty.call(e,"state")){if(await i.replaceTempOrder(e.order,{persist:!1,recalculateSummary:!1}),!s())return;l=!0,r=e.state}let u=e=>{var t,l;return String((null==e?void 0:e.customer_id)||(null==e||null==(l=e._extend)||null==(t=l.customerSnapshot)?void 0:t.id)||"")},p=u(i.getTempOrder());if("kiosk"!==d){let e=await i.syncAuthenticatedOrderCustomer();if(!s())return;if(!1===e)i.clearOrderCustomer();else if(!0!==e)throw Error("The booking service did not confirm customer synchronization. Please reload before continuing.")}if(!s())return;let m=i.getTempOrder();if(p!==u(m)&&Array.isArray(null==m?void 0:m.payments)&&m.payments.some(eZ5)){if("function"!=typeof i.clearWalletAssetSelection)throw Error("This booking service version cannot clear the previous customer’s wallet selection. Please update the service before continuing.");if(await i.clearWalletAssetSelection(),!s())return}await a.refresh(),s()&&c({ready:!0,restored:l,pendingOrder:eZ7(i.getTempOrder()),state:r})}).catch(e=>{s()&&(o.value={...o.value,ready:!1,error:e instanceof Error?e.message:String(e)},eZ9(o))})}let r=l;r.refs+=1,r.releaseVersion+=1,x.current=r;let o=!0,s=()=>{o&&b({record:r,value:r.value})};return r.listeners.add(s),s(),()=>{o=!1,r.listeners.delete(s),r.refs-=1,x.current===r&&(x.current=void 0);let e=++r.releaseVersion;"kiosk"===d&&r.retireOrder&&r.canRetire&&eJt(r,t,r.sessionId,r.canRetire,!0).catch(()=>{}),Promise.resolve().then(()=>{var l;0===r.refs&&r.releaseVersion===e&&(eJe(r),t.owner!==r||(null==(l=r.submittedFinish)?void 0:l.pending)||(t.owner=void 0))})}},[i,a,n,g,v,d]);let _=y.record,w=null==_?void 0:_.sessionId,S=a&&(null==_?void 0:_.source)===i&&_.scopeKey===n&&_.cacheId===g&&_.active&&(null==(l=eZ3.get(i))?void 0:l.owner)===_,j=S?y.value:f(),N=e=>{if(e.storageKey&&(e=>{if(!e.storageKey)return!1;try{var t;return(null==(t=JSON.parse(sessionStorage.getItem(e.storageKey)||"null"))?void 0:t.sessionId)===e.sessionId}catch{return!1}})(e))try{sessionStorage.removeItem(e.storageKey)}catch{}};return{...j,sessionId:S?_.sessionId:void 0,save:e=>{var t;if(!S||!_||x.current!==_||!_.active||(null==(t=eZ3.get(i))?void 0:t.owner)!==_||_.sessionId!==w||_.retiring||!_.value.ready||_.value.pendingOrder||_.discarded)return;let l=i.getTempOrder();if(!l||eZ7(l)){try{v&&sessionStorage.removeItem(v)}catch{}return}if(l===_.order&&(_.lastState=e,v&&g))try{sessionStorage.setItem(v,JSON.stringify({version:2,scopeKey:n,cacheId:g,sessionId:_.sessionId,order:l,state:e}))}catch{}},discard:e=>{_&&_.sessionId===w&&(_.discarded=!0,N(_))},restart:()=>{let e=eZ3.get(i);if(!S||!_||!e||x.current!==_||!_.active||_.refs<=0||e.owner!==_||_.sessionId!==w||_.retiring)return Promise.resolve(!1);if(_.restarting)return _.restarting;let t=k.current,l=_.sessionId,a=()=>x.current===_&&e.owner===_&&_.active&&_.refs>0&&_.sessionId===l,n=e=>{a()&&(_.order=i.getTempOrder(),_.lastState=e.state,_.value=e,eZ9(_))},r=e.tail.then(async()=>{if(!a())return!1;if(e.orderOwner=_,e.orderSessionId=l,"kiosk"!==d&&("function"!=typeof i.syncAuthenticatedOrderCustomer||"function"!=typeof i.clearOrderCustomer))throw Error("This booking service version cannot safely synchronize the signed-in customer. Please update the service before continuing.");if(N(_),n({ready:!1,restored:!1,pendingOrder:!1,state:t.initialState}),await t.create(),!a())return!1;if(eZ7(i.getTempOrder()))return n({ready:!0,restored:!1,pendingOrder:!0,state:t.initialState}),!1;if("kiosk"!==d){let e=await i.syncAuthenticatedOrderCustomer();if(!a())return!1;if(!1===e)i.clearOrderCustomer();else if(!0!==e)throw Error("The booking service did not confirm customer synchronization. Please reload before continuing.")}return!!a()&&(await t.refresh(),!!a()&&(_.order=i.getTempOrder(),_.lastState=t.initialState,_.discarded=!1,_.sessionId=`${Date.now()}:${++eZ4}`,e.orderSessionId=_.sessionId,_.value={ready:!0,restored:!1,pendingOrder:eZ7(_.order),state:t.initialState},eZ9(_),!_.value.pendingOrder))}).catch(e=>{if(!a())return!1;throw _.value={..._.value,ready:!1,error:e instanceof Error?e.message:String(e)},eZ9(_),e});_.restarting=r;let o=()=>{_.restarting===r&&(_.restarting=void 0)};return e.tail=r.then(o,o),r},retire:function(){let{canRetire:e=()=>!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=eZ3.get(i);return"kiosk"===d&&_&&t&&_.source===i&&_.sessionId===w&&e()&&(t.owner===_||t.orderOwner===_)?eJt(_,t,w,e):Promise.resolve(!1)},ownsSession:()=>{let e=eZ3.get(i);return!!_&&_.source===i&&_.sessionId===w&&!!e&&(e.owner===_||!e.owner&&e.orderOwner===_&&e.orderSessionId===w)},finishSubmitted:e=>{let t=eZ3.get(i),l=String(e??"").trim();if(!_||!t||!w||!eZ6(l)||_.source!==i||_.sessionId!==w||_.scopeKey!==n||_.cacheId!==g)return Promise.resolve(!1);let a=_.submittedFinish;if((null==a?void 0:a.orderId)===l&&a.sessionId===w)return a.promise;let r=i.getTempOrder(),o=()=>{var e;return eZ3.get(i)===t&&t.owner===_&&_.source===i&&_.sessionId===w&&_.scopeKey===n&&_.cacheId===g&&eZ8(i)===g&&(null==(e=i.otherParams)?void 0:e.businessCode)===h&&i.getTempOrder()===r&&String((null==r?void 0:r.order_id)??"").trim()===l};if(!r||!o())return Promise.resolve(!1);let s=k.current,d=t.tail.then(async()=>{var e;if(!o())return!1;if("function"!=typeof i.restoreOrder)throw Error("This booking service cannot safely reset the submitted order.");return _.discarded=!0,N(_),await i.restoreOrder(),t.owner===_&&_.active&&_.refs>0&&_.sessionId===w&&eZ8(i)===g&&(null==(e=i.otherParams)?void 0:e.businessCode)===h&&await s.refresh(),!0}),c={orderId:l,sessionId:w,pending:!0,promise:d};_.submittedFinish=c;let u=()=>{c.pending=!1,t.owner!==_||_.active||0!==_.refs||(t.owner=void 0)};return t.tail=d.then(u,u),d}}}({source:R,enabled:eB.current()||!1!==e.isActive&&"pending"!==z.catalogState,scopeKey:E,create:async()=>(await z.clearCartAndReset(),z.createNew()),refresh:e0,initialState:H.current,customerMode:$?"kiosk":"web",persistDraft:!$,canRetire:()=>!eB.current(),waitForRetire:()=>eH.current(),retire:$?async()=>{var e;await z.clearCartAndReset(),await eX(),null==(e=R.clearSessionStorageOrderSnapshot)||e.call(R)}:void 0}),e1=(f={mode:P,os:R,sessionId:e2.sessionId,date:V,step:G},b=Rt(),(x=(0,eN.useRef)({input:f,logger:b})).current={input:f,logger:b},(k=(0,eN.useRef)()).current||(_=(y={readContext:()=>x.current.input,getLogger:()=>x.current.logger}).flowId,w=0,S=0,k.current={capture(){try{var e,t;let l,i,a=y.readContext(),n=y.getLogger(),r=(e=>{if(!e)return{};try{let t=new URL(e);if(!t.host)return{};let l=eZM(t.searchParams.get("cacheId"))||eZM(t.searchParams.get("cache_id"));t.username="",t.password="",t.hash="";let i=[];return t.searchParams.forEach((e,t)=>i.push(t)),i.forEach(e=>{eZT.has(e.toLowerCase())||t.searchParams.set(e,"[redacted]")}),{pageUrl:t.href,pagePath:t.pathname,pageHost:t.host,urlCacheId:l}}catch{return{}}})((y.getPageUrl||(()=>"u"<typeof window?void 0:window.location.href))()),o=a.os,s={};try{s=(null==o?void 0:o.otherParams)||{}}catch{}let d=eZM(s.cacheId);try{d=eZM(null==o||null==(e=o.getCacheId)?void 0:e.call(o))||d}catch{}try{let e=null==o||null==(t=o.getTempOrder)?void 0:t.call(o);l=eZM(null==e?void 0:e.order_id),i=eZM(null==e?void 0:e.external_sale_number)}catch{}_||(_=(()=>{try{if("u">typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();if("u">typeof crypto&&"function"==typeof crypto.getRandomValues)return Array.from(crypto.getRandomValues(new Uint32Array(4)),e=>e.toString(16).padStart(8,"0")).join("")}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`})());let c=Object.freeze({source:"materials",layer:"ui",module:"venueBookingSales",category:"business",template:a.mode,templateId:"tickets"===a.mode?"ticketing_1":"party_1",...r,cacheId:r.urlCacheId||d,osCacheId:d,materialSessionId:eZM(a.sessionId),flowId:_,operationId:`${_}:${++w}`,date:eZM(a.date),step:eZM(a.step),platform:eZM(s.platform),businessCode:eZM(s.businessCode??s.business_code),shopId:eZM(s.shopId),orderId:l,externalSaleNumber:i});return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"info";try{if("function"!=typeof(null==n?void 0:n.addLog))return;let i=n.addLog({type:l,title:`[VenueBookingSales][${c.template}] ${e}`,metadata:{...c,action:e,eventSequence:++S,payload:{...t}}});i&&"function"==typeof i.then&&Promise.resolve(i).catch(()=>{})}catch{}}}catch{return eZN}}}),k.current),e4=(0,eN.useCallback)(()=>{if(eW.current&&"party"===P){var e;e1.capture()("product_confirmed"),null==(e=eG.current)||e.call(eG)}},[P,e1]),e3=(0,eN.useRef)(),[e8,e6]=(0,eN.useState)(),e5=!!e2.sessionId&&e8===e2.sessionId;(0,eN.useEffect)(()=>{var e,t,l,i,a;if(!e2.ready||!e2.sessionId||e3.current===e2.sessionId)return;e3.current&&(++eU.current,ea(void 0),er(void 0),es(void 0),ec(void 0),ep(void 0),eg(!1),el("date"),eD(void 0),eO(!1),ev(void 0),e_(void 0),ej(!1),eT(!1),ey(!1),e$(!1),eq.current=!1,T.close()),e3.current=e2.sessionId;let n=e2.state;U(n&&/^\d{4}-\d{2}-\d{2}$/.test(n.date)?n.date:H.current.date),Z(!1),"party"===P&&e2.restored&&(null==n?void 0:n.partyPreview)?(ec({value:n.partyPreview,attempt:0}),Z(!0)):((null==(e=R.getTempOrder())?void 0:e.bookings)||[]).length&&Z(!0);let r=eJY(R.getTempOrder(),{mode:P,scopeKey:E,date:null==n?void 0:n.date}),o=eJK(A,E);K((a={savedStep:null==n?void 0:n.step,restored:e2.restored,canResume:!e2.pendingOrder&&!("party"===P&&(null==n?void 0:n.partyPreview))&&!!((null==n?void 0:n.date)&&/^\d{4}-\d{2}-\d{2}$/.test(n.date)&&n.date>=B)&&r.bindings.length>0&&0===r.issues.length&&r.bindings.every(e=>e.date===(null==n?void 0:n.date)),holderRequired:o.required,holderComplete:o.complete,hasExtras:!!(null==(t=D.steps.extras)?void 0:t.catalog.menuListIds.length)||eJM((null==(l=R.getTempOrder())?void 0:l.products)||[],{mode:P,scopeKey:E,parentLineUid:null==(i=r.bindings[0])?void 0:i.productLineUid}).length>0}).restored&&a.canResume&&"string"==typeof a.savedStep&&["holder","extras","review"].includes(a.savedStep)?a.holderRequired&&!a.holderComplete?"holder":"holder"===a.savedStep?a.holderRequired?"holder":a.hasExtras?"extras":"review":"extras"===a.savedStep&&a.hasExtras?"extras":"review":"select"),e6(e2.sessionId)},[e2.ready,e2.sessionId,e2.state]);let e7="party"!==P?void 0:(null==en?void 0:en.partyDraft)?e0k({...en.partyDraft,configuration:en.configuration},"configuration"):ei?(null==eo?void 0:eo.key)===ei.key?eo.value:e0k(ei,"booking"):void 0,e9=(null==ed?void 0:ed.value)||e7,te=JSON.stringify(e9),tt=JSON.stringify((null==(c=z.tempOrder)?void 0:c.contacts_info)??null);(0,eN.useEffect)(()=>{e5&&e2.save({date:V,step:G,...e9?{partyPreview:e9}:{}})},[e2.ready,e2.sessionId,e5,ed,V,G,L.tempOrder,eI,te,tt]);let tl=e2.ready&&e5&&!ed&&!e2.pendingOrder&&!1!==e.isActive&&!eL,ti=(0,eN.useRef)();(0,eN.useEffect)(()=>{let e=ti.current;tl&&(!e||e.sessionId!==e2.sessionId||e.step!==G)&&(ti.current={sessionId:e2.sessionId,step:G},e1.capture()("step_entered",{step:G,restored:e2.restored}))},[tl,G,e2.sessionId,e2.restored,e1]);let ta=JSON.stringify(z.salesSettings??null,(e,t)=>!t||"object"!=typeof t||Array.isArray(t)?t:Object.fromEntries(Object.keys(t).sort().map(e=>[e,t[e]]))),tn=(0,eN.useMemo)(()=>{var e;let t;return e={ensureSalesSettings:z.ensureSalesSettings,getPlatform:()=>{var e;return z.salesSettingsPlatform||(null==(e=R.otherParams)?void 0:e.platform)}},async l=>{let i=t||(t=Promise.resolve().then(()=>e.ensureSalesSettings()));try{let t=await i;if(!t)throw Error("The booking sales settings are unavailable.");let a={source:"picoding",settings:t,platform:e.getPlatform()};return{requiredOptionValidation:t.product.checkRequiredOptions,overSold:1===iP({productOverSold:l.over_sold,runtimePolicy:a}),runtimePolicy:a}}finally{t===i&&(t=void 0)}}},[z.ensureSalesSettings,ta,z.salesSettingsPlatform,R,E]),tr=eJx({os:R,scopeKey:E,sessionId:e2.sessionId,menuListIds:eZ.menuListIds,poolRole:"main"}),to=eJx({os:R,scopeKey:`${E}:extras`,sessionId:e2.sessionId,menuListIds:(null==(u=D.steps.extras)?void 0:u.catalog.menuListIds)||[],poolRole:"extras"}),ts=(0,eN.useCallback)(()=>{var e;null==(e=tr.retry)||e.call(tr),eP(e=>e+1)},[tr]),td=JSON.stringify([E,e2.sessionId]),tc=(0,eN.useRef)(td);tc.current=td;let tu=(0,eN.useCallback)(()=>{ee.current=td,X(td)},[td]),tp=J===td,tm=(0,eN.useMemo)(()=>(function(e){if(!eQw(e))return;let t=new Date(`${e}T12:00:00Z`),l=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+2,0,12)).getUTCDate();return{startDate:e,endDate:new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,Math.min(t.getUTCDate(),l),12)).toISOString().slice(0,10)}})(B),[B]),tg=!(0,eN.useMemo)(()=>{var e,t,l,i;return!e2.restored||!(null==(e=e2.state)?void 0:e.partyPreview)&&(!(null==(t=e2.state)?void 0:t.date)||e2.state.date<=B)&&!((null==(l=R.getTempOrder())?void 0:l.products)||[]).length&&!((null==(i=R.getTempOrder())?void 0:i.bookings)||[]).length},[e2.sessionId,e2.restored,R,E])||Q||tp||((null==(p=R.getTempOrder())?void 0:p.bookings)||[]).length?void 0:tm,th=tg&&V>=tg.startDate&&V<=tg.endDate?tg:eQ8(V,Y),tv=eJf({os:R,ready:tl,catalog:eZ,date:V,customerId:eJ,scopeKey:E,revision:eI,operationLog:e1,projectionDateRange:th,queries:tr,onRetry:ts,mode:"tickets"===P?"ticket":"party",resolvePolicy:tn}),tf=R.getTempOrder()||L.tempOrder,ty=eJY(tf,{mode:P}),tb="party"===P?ty.bindings[0]:void 0,tx=!!(null==(m=D.steps.extras)?void 0:m.catalog.menuListIds.length),tk=eJf({os:R,ready:tl,operationLog:e1,catalog:null==(g=D.steps.extras)?void 0:g.catalog,date:B,retailTimeZone:N.timeZone,customerId:eJ,scopeKey:`${E}:extras`,retail:!0,queries:to,revision:+(ty.bindings.length>0)}),t_=eJ$({os:R,cart:L,mode:P,timeZone:N.timeZone,beforeMutate:C.assertCanMutate,parentLineUid:null==tb?void 0:tb.productLineUid,scopeKey:E,customerId:eJ,productLoadParams:{menu_list_ids:(null==(h=D.steps.extras)?void 0:h.catalog.menuListIds)||[]},catalog:tk,catalogSession:to,onMutated:eX,resolveSelectionPolicy:async e=>{let t=await tP(e);return{...t,overSold:1===t.overSold}}}),tw=function(e){var t;let l,i,a,n,r,o,s,d,c,u,p,m,g=(0,eN.useRef)(e);g.current=e;let h=(0,eN.useRef)(!0),[,v]=(0,eN.useState)(0),f=(0,eN.useRef)();return f.current||(a=(t={getOwner:()=>g.current.getOwner(),productId:e=>String(e.id),readQuantity:e=>g.current.readQuantity(e),applyQuantity:(e,t)=>g.current.applyQuantity(e,t),refreshActual:()=>g.current.refreshActual(),onError:e=>{h.current&&g.current.onError(e)},onChange:()=>{h.current&&v(e=>e+1)}}).getOwner(),n=0,r=!1,o=!1,s=new Map,d=()=>{void 0!==l&&clearTimeout(l),l=void 0},c=(e,l)=>!r&&l===n&&eJb(e,t.getOwner()),u=()=>{r||t.onChange()},p=()=>{let e=t.getOwner();eJb(a,e)||(a=e,n+=1,s.clear(),d(),u())},m=()=>{if(r||o||!s.size)return;d();let e=s.values().next().value;l=setTimeout(async()=>{if(l=void 0,!r&&!o){o=!0;try{for(;!r&&s.size;){p();let l=s.entries().next().value;if(!l)break;let[r,o]=l,d=a,m=n;try{var e;let l=t.readQuantity(o.product);if(!Number.isSafeInteger(l)||l<0)throw Error("The extra quantity is unavailable. Please review the cart.");if(l===o.quantity){s.delete(r),u();continue}let a=o.quantity;i={owner:d,generation:m,intent:o};let n=await t.applyQuantity(o.product,a);if(!c(d,m)){i=void 0,p();continue}if(i=void 0,"function"==typeof n){s.clear(),u(),await n(()=>c(d,m));break}if(!n){s.clear(),u();break}let g=t.readQuantity(o.product),h=a<l&&g>=a&&g<l;if(!Number.isSafeInteger(g)||g<0||g!==a&&!h)throw Error("The extra quantity changed while updating. Please review the cart.");(null==(e=s.get(r))?void 0:e.quantity)===g&&s.delete(r),u();break}catch(e){if(!c(d,m)){i=void 0,p();continue}try{await t.refreshActual()}catch{}i=void 0,c(d,m)&&(s.clear(),u(),t.onError(e));break}}}finally{i=void 0,o=!1,m()}}},Math.max(0,Math.min(e.lastAt+200,e.firstAt+400)-Date.now()))},f.current={enqueue(e,l,a){var n;let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(r||!Number.isSafeInteger(l)||!Number.isSafeInteger(a))return;p();let d=t.productId(e);if(!d)return;let c=t.readQuantity(e);if(!Number.isSafeInteger(c)||c<0)return;let g=((null==(n=s.get(d))?void 0:n.quantity)??c)+l-a,h=Math.max(0,Number.isSafeInteger(o.min)?o.min:0),v=Math.max(h,Number.isSafeInteger(o.max)?o.max:Number.MAX_SAFE_INTEGER),f=g<=0?0:Math.min(v,Math.max(h,g));if(!Number.isSafeInteger(f))return;let y=Date.now(),b=s.get(d);s.set(d,{product:e,quantity:f,firstAt:b===(null==i?void 0:i.intent)?y:(null==b?void 0:b.firstAt)??y,lastAt:y}),u(),m()},isPending:()=>!r&&eJb(a,t.getOwner())&&(s.size>0||!!i&&i.generation===n&&eJb(i.owner,a)),getTargets:()=>!r&&eJb(a,t.getOwner())?Array.from(s).reduce((e,t)=>{let[l,i]=t;return e[l]=i.quantity,e},{}):{},reconcileOwner:p,dispose(){r=!0,n+=1,s.clear(),d()}}),(0,eN.useEffect)(()=>{var e;null==(e=f.current)||e.reconcileOwner()}),(0,eN.useEffect)(()=>()=>{var e;h.current=!1,null==(e=f.current)||e.dispose()},[]),{changeQuantity:(e,t,l)=>{var i,a;if(!h.current||!g.current.canChange())return;let n=1===Number(e.is_track)&&0===Number(e.over_sold)?Number(e.stock_quantity):200,r=Math.max(0,Math.min(Number.isFinite(n)?n:200,Number((null==(i=e.item_rule_limit)?void 0:i.remainingMax)??200)));f.current.enqueue(e,t,l,{min:Number((null==(a=e.item_rule_limit)?void 0:a.min)??0),max:Math.floor(r)})},isPending:f.current.isPending,pending:f.current.isPending(),quantities:f.current.getTargets()}}({getOwner:()=>{var t;let l=eKA(R.getTempOrder());return[R,l&&"object"==typeof l?e2.sessionId:l,null==(t=R.getTempOrder())?void 0:t.customer_id,E,e2.sessionId,eJ,P,null==tb?void 0:tb.productLineUid,to,tl,!1!==e.isActive]},readQuantity:e=>{var t;return eJM((null==(t=R.getTempOrder())?void 0:t.products)||[],{mode:P,scopeKey:E,parentLineUid:null==tb?void 0:tb.productLineUid}).filter(t=>String(t.product_id)===String(e.id)).reduce((e,t)=>e+Number(t.num||0),0)},applyQuantity:async(e,t)=>{let l=await t_.setProductQuantity(e,t);if("cancelled"===l.status)return!1;if("invalid"===l.status)throw Error(l.issues.map(e=>e.message).join(" "));return!!["added","updated","unchanged"].includes(l.status)||(t=>tI(async()=>{t()&&await tz(l,t)},e.id))},refreshActual:()=>{L.refreshCartSnapshot()},onError:e=>ev(e instanceof Error?e.message:String(e)),canChange:()=>!tH&&!eq.current}),tS=tw.isPending,tj=t_.rows.length>0||tx&&(tk.loading||!!tk.error||tk.products.some(eJy)),tN=!eZ.menuListIds.length||!tv.loading&&!tv.error&&!tv.products.length,tC=tN||tv.loading||!!tv.error;(0,eN.useEffect)(()=>{tl&&("select"!==G&&(tN||tv.error)?(el("product"),K("select")):"extras"!==G||tj?"review"===G&&tk.error&&K("extras"):K(eJK(A,E).complete?"review":"holder"))},[tl,G,tN,tv.error,tj,tk.error,A,E]);let tM=function(e){var t,l;let i=Array.from(new Set(e.dates)).sort().join(","),a=e.catalog.menuListIds.join(","),n=(0,eN.useMemo)(()=>eJk(e.searchRange),[null==(t=e.searchRange)?void 0:t.startDate,null==(l=e.searchRange)?void 0:l.endDate]),r=n.join(","),o=r||i,s=(0,eN.useMemo)(()=>({}),[e.os,e.ready,a,e.customerId,e.scopeKey,e.revision,e.resolvePolicy,e.mode,e.queries]),d=(0,eN.useMemo)(()=>({...e,queryScope:s,searchDates:n,menuIds:[...e.catalog.menuListIds]}),[e.os,e.ready,o,r,a,e.customerId,e.scopeKey,e.revision,e.resolvePolicy,e.mode,e.queries]),c=(0,eN.useMemo)(()=>i?i.split(","):[],[i]),u=(0,eN.useMemo)(()=>Array.from(new Set([...n,...c])).sort(),[n,c]),p=(0,eN.useMemo)(()=>u.reduce((e,t)=>(e[t]={status:d.menuIds.length?"loading":"unavailable"},e),{}),[d,u]),[m,g]=(0,eN.useState)(),h=(0,eN.useRef)(d);h.current=d;let v=(0,eN.useRef)(),f=(0,eN.useMemo)(()=>{var e;return{states:!r&&(null==(e=v.current)?void 0:e.searching)&&v.current.queryScope===s?{...v.current.states}:{},pending:new Set,visibleDates:c,projectionDates:u,pump:void 0}},[d]);(0,eN.useEffect)(()=>{v.current={queryScope:s,searching:!!r,states:f.states}},[f,s,r]);let y=(0,eN.useRef)(0),b=(0,eN.useRef)();return(0,eN.useEffect)(()=>{let e=!0,t=()=>e&&h.current===d;if(g({request:d,states:{...f.states}}),!d.ready||!d.menuIds.length)return()=>{e=!1};let l=(e,l)=>{t()&&(f.states[e]=l,g({request:d,states:{...f.states}}))},i=async e=>{let i=f.projectionDates;try{let a=await d.queries.queryCatalogSnapshot({menu_list_ids:d.menuIds,schedule_date:e,...d.customerId?{customer_id:Number(d.customerId)}:{}});if(!t())return;let n=!1,r=!1;if(a.length){let l=await eJh(d.os,{products:a,date:e,mode:d.mode,queries:d.queries,projectionDateRange:eQ8(e,i),catalogParams:{menu_list_ids:d.menuIds,...d.customerId?{customer_id:d.customerId}:{}},resolvePolicy:d.resolvePolicy,isCurrent:t,stopAtFirstAvailable:!0});n=l.available,r=!0===l.requiresConfiguration}l(e,{status:n?"available":r?"configuration":"unavailable"})}catch(t){l(e,{status:"error",reason:t instanceof Error?t.message:String(t)})}finally{var a;f.pending.delete(e),y.current--,null==(a=b.current)||a.call(b)}},a=e=>!f.pending.has(e)&&(!f.states[e]||"loading"===f.states[e].status),n=()=>{for(let t of d.searchDates){var e;let l=null==(e=f.states[t])?void 0:e.status;if("available"===l||"configuration"===l||"error"===l)break;if(a(t))return t}return f.visibleDates.find(a)},r=()=>{for(;t()&&y.current<2;){let e=n();if(!e)break;f.pending.add(e),y.current++,i(e)}};return f.pump=r,b.current=r,r(),()=>{e=!1,f.pump===r&&(f.pump=void 0),b.current===r&&(b.current=void 0)}},[d,f]),(0,eN.useEffect)(()=>{var e;f.visibleDates=c,f.projectionDates=u,null==(e=f.pump)||e.call(f)},[f,c,u]),(0,eN.useMemo)(()=>({...p,...(null==m?void 0:m.request)===d?m.states:f.states}),[m,d,p,f])}({os:R,ready:tl,catalog:eZ,dates:Y,customerId:eJ,scopeKey:E,revision:eI,searchRange:tg,queries:tr,mode:"tickets"===P?"ticket":"party",resolvePolicy:tn}),tT=(0,eN.useRef)({date:V,scopeKey:E,customerId:eJ,ready:tl,sessionId:e2.sessionId,composerKey:null==ei?void 0:ei.key});tT.current={date:V,scopeKey:E,customerId:eJ,ready:tl,sessionId:e2.sessionId,composerKey:null==ei?void 0:ei.key};let tI=async(e,t)=>{if(!(eq.current||!tl||tS())){eq.current=!0,ey(!0),ev(void 0),ex(null==t?void 0:String(t));try{await e()}catch(e){eW.current&&ev(e instanceof Error?e.message:String(e))}finally{eq.current=!1,eW.current&&(ey(!1),ex(void 0))}}},tP=async e=>{var t;let l=await z.ensureSalesSettings();if(!l)throw Error(q("Sales settings are unavailable. Please try again.","销售配置未就绪,请重试。"));return{overSold:iP({productOverSold:e.over_sold,runtimePolicy:{source:"picoding",settings:l,platform:z.salesSettingsPlatform||(null==(t=R.otherParams)?void 0:t.platform)}}),requiredOptionValidation:l.product.checkRequiredOptions}},tA=async function(e,t){let l=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=arguments.length>3?arguments[3]:void 0,a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],n=e1.capture();a&&n("product_selected",{productId:e.id,editing:!!t,selectedDate:V});let r=tv.products.find(t=>String(t.id)===String(e.id))||e,o=r.price,s=("string"==typeof o||"number"==typeof o)&&""!==String(o).trim()&&Number.isFinite(Number(o))&&Number(o)>=0?Rs(r):void 0,d=null==s?void 0:s.amount,c="party"===P&&!i&&!t&&l;c&&(null==e7?void 0:e7.productId)===Number(e.id)&&(i=e7),"tickets"===P&&ea(void 0),er(void 0),"party"!==P||t||Number(null==tb?void 0:tb.line.product_id)!==Number(e.id)||(t=null==tb?void 0:tb.productLineUid);let u=++eU.current,p={...tT.current},m=()=>eW.current&&u===eU.current&&tT.current.scopeKey===p.scopeKey&&tT.current.date===p.date&&tT.current.customerId===p.customerId&&tT.current.sessionId===p.sessionId;eY.current=u,e_(String(e.id));try{var g;let n,r,o={menu_list_ids:eZ.menuListIds,product_id:e.id,schedule_date:V,...eJ?{customer_id:eJ}:{},with_count:["bundleGroup","optionGroup"],with_schedule:1},p=a?await tr.prepareProductDetail({...o,retry:!0}):await tr.queryCatalogProductDetail(o);if(!m())return!1;if(t){let e=await eJG({os:R,queries:tr,mode:P,catalog:eZ,scopeKey:E,customerId:eJ,isCurrent:m});if(!(n=e.bindings.find(e=>e.productLineUid===t)))throw Error(e.issues.map(e=>e.message).join(" ")||"This booking could not be loaded.")}if(!m())return!1;let h=p&&n?{...p,_extend:{...p._extend,...(null==(g=n.product._extend)?void 0:g.capacity)?{capacity:n.product._extend.capacity}:{}}}:p;if(!h)throw Error(q("This product is no longer in this menu.","当前菜单已不包含该商品。"));let v=await tP(h);if(!m())return!1;let f=`${E}:${u}:${Date.now()}`,y=iT({productDetail:h,requestedProductId:e.id,completeness:"complete",mode:"tickets"===P?"ticket-booking":"product-configuration",openId:f,scopeKey:E,detailRevision:f,selectionKey:t||e.id,intent:t||i?"edit-draft":"create"});if("invalid"===y.status)throw Error(y.issues.map(e=>e.message).join(" "));let b=null==i?void 0:i.configuration,x=(null==b?void 0:b.skuValue)||(null==n?void 0:n.skuValue),k=x?iS(h,x,{...v,overSold:1===v.overSold}):void 0,_="ready"===y.status?y.plan.productDetail:y.productDetail,w=b?{...b,skuValue:k||b.skuValue}:n?{skuValue:k||n.skuValue,variantDraft:null}:e0I(_,1===v.overSold);if(i&&!k&&"no-configuration"===y.status)throw Error(q("The saved options are no longer available. Choose this Party again.","已保存的选项已不可用,请重新选择 Party 商品。"));let S={key:f,catalogStartingAmount:d,catalogPriceQualifier:null==s?void 0:s.qualifier,detail:_,configuration:w,lineUid:"party"===P?null==tb?void 0:tb.productLineUid:t,quantity:null==i?void 0:i.quantity,initialSelection:i?(r=i,e0x(r.selection)):null==n?void 0:n.selection,...v};return"tickets"===P&&"ready"===y.status&&"ticket-booking"===y.plan.mode?ea({...S,plan:y.plan}):"party"===P&&!l&&k?ea(S):"no-configuration"===y.status?(ea(S),el("time"),c&&e4(),I("#party-time")):"product-configuration"===y.plan.mode&&er({plan:y.plan,configuration:w,partyDraft:S,...v}),K("select"),!0}catch(t){throw a&&n("product_open_failed",{productId:e.id,...eZC(t)},"warning"),t}finally{eW.current&&u===eY.current&&e_(void 0)}};(0,eN.useEffect)(()=>{if(!e5||!e2.ready||e2.pendingOrder||!1===e.isActive||!ed)return;let t=!0;return eg(!0),ep(void 0),(async()=>{try{let e=function(e){if((null==e?void 0:e.version)!==1||!["configuration","booking"].includes(e.phase))throw Error("Invalid saved Party preview.");return e0k({detail:{id:e.productId},quantity:e.quantity,lineUid:e.lineUid,configuration:e.configuration,initialSelection:e.selection},e.phase)}(ed.value),l=await tA({id:e.productId},e.lineUid,"configuration"===e.phase,e,!1);if(!t)return;if(!l)throw Error(q("The draft changed. Retry restoring your Party selection.","草稿已变化,请重试恢复 Party 选择。"));el("time"),ec(void 0)}catch(e){t&&ep(e instanceof Error?e.message:String(e))}finally{t&&eg(!1)}})(),()=>{t=!1,++eU.current}},[e5,e2.ready,e2.pendingOrder,e.isActive,ed,R,E,V,eJ]);let tD=async(e,t)=>{if(tB||ei||en||tT.current.scopeKey!==E||tT.current.sessionId!==e2.sessionId||tT.current.customerId!==eJ)return!1;let l=!1;return await tI(async()=>{let i=R.getTempOrder(),a=eKA(i),n=null==i?void 0:i.customer_id,r={...tT.current},o=()=>eW.current&&tT.current.ready&&tT.current.scopeKey===r.scopeKey&&tT.current.sessionId===r.sessionId&&tT.current.customerId===r.customerId&&(null==i?void 0:i.customer_id)===n&&R.getTempOrder()===i&&eKA(i)===a,s=new Set(e);if(!i||Number(i.order_id||0)>0||!s.size||s.size!==e.length||e.some(e=>!e))throw Error(q("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"));let d=i.products||[],c=d.filter(e=>s.has(eJF(e))),u="tickets"===P?"tickets":"party_main";if(c.length!==s.size||c.some(e=>{var t,l;return(null==(t=e.metadata)?void 0:t.venue_booking_role)!==u||(null==(l=e.metadata)?void 0:l.venue_booking_scope_key)!==E})||new Set(c.map(eJF)).size!==s.size)throw Error(q("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"));if(t&&("tickets"!==P||0!==t.index||1!==s.size||!s.has(t.uid)||1!==Number(c[0].num)))throw Error(q("This saved ticket cannot be removed individually. Remove its cart group instead.","此历史门票无法逐张删除,请删除对应购物车组。"));let p="tickets"===P&&!d.some(e=>{var t,l;return(null==(t=e.metadata)?void 0:t.venue_booking_role)==="tickets"&&(null==(l=e.metadata)?void 0:l.venue_booking_scope_key)===E&&!s.has(eJF(e))}),m=d.filter(e=>{var t,l,i;return s.has(eJF(e))||(null==(t=e.metadata)?void 0:t.venue_booking_scope_key)===E&&("party"===P&&(null==(l=e.metadata)?void 0:l.venue_booking_role)==="party_extra"&&s.has(String(e.metadata.venue_booking_parent_uid||""))||p&&(null==(i=e.metadata)?void 0:i.venue_booking_role)==="tickets_extra")}),g=new Set(m.map(eJF));if(g.has("")||g.size!==m.length||d.filter(e=>g.has(eJF(e))).length!==m.length)throw Error(q("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"));let h=JSON.stringify([i.products,i.bookings,i.notes,i.holder_relations]),v=()=>{if(!o()||h!==JSON.stringify([i.products,i.bookings,i.notes,i.holder_relations]))throw Error(q("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"))};if("function"!=typeof R.removeProductsFromOrder)throw Error("The booking cart service needs to be updated.");v();try{if(await R.removeProductsFromOrder(m.map(ekX),{beforeApply:v,isCurrentOrder:o}),!o())return;L.refreshCartSnapshot(),eP(e=>e+1),eJK(A,E).enabled||eT(!1),ea(void 0),eJY(R.getTempOrder(),{mode:P,scopeKey:E}).bindings.length||(eT(!1),K("select")),l=!0}catch(e){throw o()&&(L.refreshCartSnapshot(),eP(e=>e+1),eJK(A,E).enabled||eT(!1),eJY(R.getTempOrder(),{mode:P,scopeKey:E}).bindings.length||(eT(!1),K("select"))),e}}),l},tE=e=>tD(e),tO=async(e,t)=>{if(!ew()(e).isValid()||e<B)return!1;let l=e1.capture();if(e===V)return Z(!0),el("product"),l("date_selected",{previousDate:V,selectedDate:e}),!0;if(eq.current||tS())return;eq.current=!0,ey(!0);let i=eKA(R.getTempOrder()),a=R.getTempOrder(),n=()=>{if(!eW.current||!tT.current.ready||tT.current.date!==V||eKA(R.getTempOrder())!==i)throw Error(q("The draft changed. Please choose the date again.","草稿已变化,请重新选择日期。"))};try{let o,s,d=eJY(R.getTempOrder(),{mode:P}).bindings;if("tickets"===P&&d.length){var r;if(!await new Promise(e=>eM.Modal.confirm({title:q("Change the date for this order?","更改整单日期?"),content:q("All tickets will be removed so you can choose them again for the new date.","订单中的全部门票将移除,请按新日期重新选择。"),okText:q("Change date","更改日期"),cancelText:q("Keep date","保留日期"),onOk:()=>e(!0),onCancel:()=>e(!1)}))||!eW.current)return eW.current&&l("date_change_cancelled",{previousDate:V,selectedDate:e}),!1;n();let t=eJY(R.getTempOrder(),{mode:P}).bindings,o=eJM((null==(r=R.getTempOrder())?void 0:r.products)||[],{mode:P,scopeKey:E});if(await R.removeProductsFromOrder([...t.map(e=>e.identity),...o.map(ekX)],{isCurrentOrder:()=>eW.current&&R.getTempOrder()===a&&eKA(R.getTempOrder())===i}),n(),eJY(R.getTempOrder(),{mode:P}).bindings.length)throw Error("The cart changed. Please review the tickets before changing date.");ea(void 0),er(void 0),await e0()}if(n(),"party"===P&&ei){let l=await tr.queryCatalogProductDetail({menu_list_ids:eZ.menuListIds,product_id:Number(ei.detail.id),schedule_date:e,...eJ?{customer_id:eJ}:{},with_count:["bundleGroup","optionGroup"],with_schedule:1});if(n(),!l)throw Error(q("This Party is unavailable on the selected date. Choose another date or product.","该商品在所选日期不可用,请选择其他日期或商品。"));let i=await tP(l);n();let a=`${E}:date:${++eU.current}:${Date.now()}`,r=iT({productDetail:l,requestedProductId:ei.detail.id,completeness:"complete",mode:"product-configuration",openId:a,scopeKey:E,detailRevision:a,selectionKey:ei.lineUid||ei.detail.id,intent:"edit-draft"});if("invalid"===r.status)throw Error(r.issues.map(e=>e.message).join(" "));let d=(null==t?void 0:t.configuration)||ei.configuration,c=iS(l,d.skuValue,{...i,overSold:1===i.overSold}),u={...ei,key:a,detail:l,...i,quantity:(null==t?void 0:t.quantity)??ei.quantity,initialSelection:(null==t?void 0:t.initialSelection)||ei.initialSelection};c?o={...u,configuration:{skuValue:c,variantDraft:null}}:"ready"===r.status&&"product-configuration"===r.plan.mode?s={plan:r.plan,configuration:d,partyDraft:u,...i}:o={...u,configuration:eKP(Number(l.id))}}return n(),++eU.current,ea(o),er(s),U(e),Z(!0),el(o?"time":"product"),K("select"),ev(void 0),l("date_selected",{previousDate:V,selectedDate:e}),!0}catch(t){throw l("date_change_failed",{previousDate:V,selectedDate:e,...eZC(t)},"warning"),t}finally{eq.current=!1,eW.current&&ey(!1)}},tz=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>!0;if(t()){if("invalid"===e.status)throw Error(e.issues.map(e=>e.message).join(" "));if("choose-line"===e.status)return void eD(e.rows);if("direct"===e.status)return void await t_.commit(e.session,e.configuration);if("ready"===e.status){let l=await tP(e.session.productDetail);if(!t())return;let i=e.session.lineUid?e.configuration:e0I(e.plan.productDetail,1===l.overSold);er({plan:e.plan,configuration:i,extraSession:e.session,...l})}}},tL=()=>{var e;let t=R.getTempOrder(),l={mode:P,scopeKey:E,parentLineUid:null==tb?void 0:tb.productLineUid};if(!eJM((null==t?void 0:t.products)||[],l).length)return!0;if(tk.loading||tk.error)return ev(tk.error||q("The extras menu is loading. Please try again.","附加商品菜单正在加载,请稍后重试。")),K("extras"),T.close(),!1;let i=function(e,t,l){if(!e)return;let i=eJM(e.products||[],l);if(!i.length)return;let a=new Map(t.map(e=>[Number(e.id),e]));return i.find(t=>{let l=a.get(Number(t.product_id)),i=t.product_variant_id;return!!B4(eJS(l,i,t)).required&&!eJj(l,i,Number(t.num),Uy(t,e.holder_relations),e.customer_id??void 0,t)})}(t,tk.products,l);return!i||((e=>{K("extras"),T.close();let t=q("Complete the holder details for this extra.","请补全这件附加商品的 Holder 资料。");if(ev(t),!e||eq.current||tS())return;let l=tT.current,i=eKA(R.getTempOrder()),a=()=>eW.current&&tT.current.ready&&tT.current.scopeKey===l.scopeKey&&tT.current.sessionId===l.sessionId&&tT.current.customerId===l.customerId&&eKA(R.getTempOrder())===i;tI(async()=>{let l=await t_.prepareEdit(e);if(a()){if("invalid"===l.status)throw Error(l.issues.map(e=>e.message).join(" "));"ready"===l.status&&await tz(l,a),a()&&ev(t)}})})(String((null==(e=i.metadata)?void 0:e.unique_identification_number)??"")),!1)},tR=async()=>{if(tq.pending||tq.error||ei||en||!eQ.current||!tl||tC||tS()||tj&&(tk.loading||tk.error))return!1;ev(void 0);let e=eJK(A,E);if(!e.complete||e.pending||e.blocked)return K("holder"),!1;if(!tL()||!await eQ.current.validate())return!1;await L.waitForCartConsistency();let t=eKA(R.getTempOrder()),l={...tT.current};return eW.current&&tT.current.ready&&tT.current.scopeKey===l.scopeKey&&tT.current.date===l.date&&tT.current.customerId===l.customerId&&eKA(R.getTempOrder())===t&&tL()},t$=function(e){var t;let l=function(e){var t,l,i,a,n;sZ(eq_,e.locale),sZ(e0c,e.locale);let r=eR(),o=eF(),s=exp(),d=e.context.sales.bookingTicket,c=String((null==d||null==(t=d.otherParams)?void 0:t.platform)||o||"").trim().toLowerCase(),u=null==d||null==(l=d.otherParams)?void 0:l.venueBookingMode,p="kiosk"===c&&("tickets"===u||"party"===u),m=null==r||null==(n=r.appHelper)||null==(a=n.utils)||null==(i=a.getApp)?void 0:i.call(a),g=eM8(m),h=(0,eN.useRef)(e);h.current=e;let v=(0,eN.useRef)(!0),f=(0,eN.useRef)(!1),y=(0,eN.useRef)(!1),b=(0,eN.useRef)(),x=(0,eN.useRef)(new Set),k=(0,eN.useRef)(),_=(0,eN.useRef)(),w=(0,eN.useRef)(),[S,j]=(0,eN.useState)(!1),[N,C]=(0,eN.useState)(!1),[M,T]=(0,eN.useState)(null),[I,P]=(0,eN.useState)(),[A,D]=(0,eN.useState)(null),[E,O]=(0,eN.useState)(10),[z,L]=(0,eN.useState)(!1);(0,eN.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]),(0,eN.useEffect)(()=>{_.current=void 0,k.current=void 0,w.current=void 0,P(void 0),D(null),T(null)},[e.scopeKey,e.sessionId,d]);let R=o0(async e=>{if(!p||f.current||b.current||y.current||!v.current)return!1;let t=h.current.onKioskFinish;if(!t)return!1;y.current=!0,L(!0),T(null);try{if(!await t({navigateHome:e}))throw Error(String(ez.getText("pisell2.venue-kiosk.checkout.reset-failed")));return v.current&&D(null),!0}catch(e){return v.current&&T(e0n(e)||String(ez.getText("pisell2.venue-kiosk.checkout.reset-failed"))),!1}finally{y.current=!1,v.current&&L(!1)}}),$=o0(()=>R(!0)),F=o0(()=>R(!1)),q=o0(()=>!!(f.current||b.current)),B=o0(()=>q()?new Promise(e=>{x.current.add(e)}):Promise.resolve()),H=o0(()=>{if(q())return;let e=[...x.current];x.current.clear(),e.forEach(e=>e())}),V=o0(async()=>{var e,t,l,i,a,n,r,o,d,u,x,S,N,M,I,E,O,z,L,R,$,q,B,V;let U,Y,W;if(!p||f.current||y.current||!1===h.current.isActive||!v.current)return!1;let G=h.current,K=G.context,Q=K.sales.bookingTicket;if(!Q)return!1;let Z=(null==(e=Q.getTempOrder)?void 0:e.call(Q))??K.sales.tempOrder,J=e0p(Z),X=()=>v.current&&!1!==h.current.isActive&&h.current.scopeKey===G.scopeKey&&h.current.sessionId===G.sessionId&&h.current.context.sales.bookingTicket===Q,ee=()=>{var e;if(!X()||e0p(null==(e=Q.getTempOrder)?void 0:e.call(Q))!==J)throw Error("BOOKING_SELECTION_CHANGED")},et=e=>{let t=e0u(e);if(t&&X()&&(_.current=t,P(t),k.current!==t)){var l;k.current=t,null==(l=G.onOrderSubmitted)||l.call(G,t)}};f.current=!0,j(!0),T(null);let el=!1;try{if(!await s.ensureCanShop()||!X())return!1;if(await K.cart.waitForCartConsistency(),ee(),_.current&&e0u(null==(E=Q.getTempOrder)||null==(I=E.call(Q))?void 0:I.order_id)!==_.current){let e=null==(O=Q.getTempOrder)?void 0:O.call(Q);if((null==e||null==(z=e.products)?void 0:z.length)||(null==e||null==(L=e.bookings)?void 0:L.length)||(await K.sales.loadDetailByRemote(Number(_.current)),!X()))return!1;Z=(null==(R=Q.getTempOrder)?void 0:R.call(Q))??K.sales.tempOrder,J=e0p(Z)}let e=!!(A&&w.current&&w.current.scopeKey===G.scopeKey&&w.current.sessionId===G.sessionId&&w.current.source===Q&&(w.current.identity===J||_.current&&e0u(null==(V=Q.getTempOrder)||null==(B=V.call(Q))?void 0:B.order_id)===_.current));if(!e&&G.beforeCheckout&&!await G.beforeCheckout())return!1;ee(),b.current=U=g(),Y=U.hold(),await U.pause(),ee();let p=null==m||null==(i=m.history)||null==(l=i.instance)||null==(t=l.block)?void 0:t.call(l,()=>!1);"function"==typeof p&&(W=p),C(!0);let y=async()=>(ee(),(!!e||!!await h.current.beforeSubmit())&&(await K.cart.waitForCartConsistency(),ee(),w.current={scopeKey:G.scopeKey,sessionId:G.sessionId,source:Q,identity:J},(el=await s.beginCheckout())&&X())),k=(null==(a=Q.getTempOrder)?void 0:a.call(Q))??Z,j=(null==(r=Q.getOrderAmountSnapshot)||null==(n=r.call(Q))?void 0:n.summary)??(null==k?void 0:k.summary)??K.summary.summary,T=eHL(c,j),P=s.enabled&&!s.requirePaymentOnSubmit;if((P||T)&&!_.current){let e=P?{paymentExecution:"deferred"}:eH$(null==k?void 0:k.payments),t=await K.cart.submit(e,{validateHolder:!0,beforeSubmit:y});if(!X())return!1;if(!eTm(t))throw Error(e0n(t));let l=eH5(t,(null==($=Q.getTempOrder)?void 0:$.call(Q))??k);if(!l)throw Error(String(ez.getText("pisell2.venue-kiosk.checkout.failed")));if(et(l.orderId),T&&!P){let e=(null==(q=Q.getTempOrder)?void 0:q.call(Q))??k,i=eHR(t,null==e?void 0:e.summary,j);if(!eHF({result:t,orderId:l.orderId,totalAmount:i}).ok)throw Error(String(ez.getText("pisell2.venue-kiosk.checkout.failed")));D({kind:"payment",viewModel:eHq({summary:(null==e?void 0:e.summary)??j,currencySymbol:null==e?void 0:e.currency_symbol})})}else D({kind:"submitted",order:l});return!0}let ei=await K.sales.openCheckout({validateHolder:!0,beforeSubmit:y,paymentResultDisplayMode:"page",walletPassMode:"shared"});if(!X())return!1;if(et((null==ei?void 0:ei.orderId)??(null==ei?void 0:ei.order_id)??(null==ei||null==(o=ei.payload)?void 0:o.order_id)??(null==(u=Q.getTempOrder)||null==(d=u.call(Q))?void 0:d.order_id)),(null==ei?void 0:ei.reason)==="start-new-order")return el&&(s.endCheckout(),el=!1),W&&(W(),W=void 0),null==Y||Y(),Y=void 0,await U.release(),b.current=void 0,f.current=!1,v.current&&C(!1),H(),await F(),!1;if((null==ei?void 0:ei.status)==="cancelled"||(null==ei?void 0:ei.reason)==="back")return!1;let ea=(null==ei||null==(S=ei.payload)||null==(x=S.paymentResult)?void 0:x.paymentResultViewModel)??(null==ei||null==(M=ei.data)||null==(N=M.paymentResult)?void 0:N.paymentResultViewModel);if(ea)return D({kind:"payment",viewModel:ea}),!0;throw Error(e0n(ei)||String(ez.getText("pisell2.venue-kiosk.checkout.result-missing")))}catch(e){if(e===Ud||!X())return!1;return T(e0n(e)||String(ez.getText("pisell2.venue-kiosk.checkout.failed"))),!1}finally{el&&s.endCheckout(),W&&W(),null==Y||Y(),await (null==U?void 0:U.release()),b.current===U&&(b.current=void 0),f.current=!1,H(),v.current&&(j(!1),C(!1))}}),U=(null==A?void 0:A.kind)==="submitted"||(null==A?void 0:A.kind)==="payment"&&["success","deposit-paid"].includes(A.viewModel.status);return(0,eN.useEffect)(()=>{if(!p||!U||S||N||!1===e.isActive)return void O(10);let t=Date.now()+1e4,l=window.setInterval(()=>O(Math.max(0,Math.ceil((t-Date.now())/1e3))),1e3),i=window.setTimeout(()=>{$()},1e4);return()=>{window.clearInterval(l),window.clearTimeout(i)}},[p,U,A,S,N,e.isActive,$]),{enabled:p,checkout:V,submitting:S,error:M,submittedOrderId:I,failure:null,confirmFailure:async()=>{},resettingFailure:!1,resetError:null,kioskPaymentResult:A,paymentActive:N,isPaymentActive:q,waitForPaymentIdle:B,backHomeCountdown:E,resettingHome:z,returnHome:$,startNewOrder:F}}(e),i=eR(),a=eF(),n=exp(),r=Uu(),o=Uv(),s=(0,eN.useRef)(e);s.current=e;let d=(0,eN.useRef)(!0),c=(0,eN.useRef)(!1),u=(0,eN.useRef)(null),p=(0,eN.useRef)(null),m=(0,eN.useRef)(null),g=(0,eN.useRef)(!1),h=(0,eN.useRef)(null),[v,f]=(0,eN.useState)(!1),[y,b]=(0,eN.useState)(null),[x,k]=(0,eN.useState)(),[_,w]=(0,eN.useState)("idle"),[S,j]=(0,eN.useState)(null),[N,C]=(0,eN.useState)(!1),[M,T]=(0,eN.useState)(null),I=String(e.locale||"").startsWith("zh"),P=(e,t)=>I?t:e,A=(null==i||null==(t=i.appHelper)?void 0:t.utils)||{};(0,eN.useEffect)(()=>(d.current=!0,()=>{var e;d.current=!1,null==(e=h.current)||e.call(h,!1),h.current=null;let t=u.current;t&&z(t).catch(()=>{})}),[]),(0,eN.useEffect)(()=>{u.current=null,p.current=null,m.current=null,j(null),b(null),T(null),k(void 0),w("idle")},[e.scopeKey,e.sessionId,e.context.sales.bookingTicket]);let D=o0(async()=>{let e=m.current;if(e&&!g.current){if(!(e.resetStarted?e.isSameSession():e.isCurrent())){m.current=null,j(null);return}g.current=!0,e.resetStarted=!0,C(!0),T(null);try{if(!await e.reset()&&e.isSameSession())throw Error(P("Could not reset the cart. Please try again.","购物车清空失败,请重试。"));m.current===e&&(m.current=null,j(null),b(null))}catch(t){d.current&&e.isSameSession()&&T(e0n(t)||P("Could not reset the cart. Please try again.","购物车清空失败,请重试。"))}finally{g.current=!1,d.current&&C(!1)}}}),E=e=>{var t,l,i;let a=A.history||(null==(l=A.getApp)||null==(t=l.call(A))?void 0:t.history);if("function"==typeof(null==a?void 0:a.replace))a.replace(e);else{let t=(null==(i=window.location.pathname.match(/^\/(en|zh-CN|zh-HK|ja|pt)(?=\/|$)/i))?void 0:i[0])||"";window.location.replace(`${t}${e}`)}},O=e=>u.current===e&&s.current.scopeKey===e.scopeKey&&s.current.sessionId===e.sessionId&&s.current.context.sales.bookingTicket===e.context.sales.bookingTicket,z=async e=>{if(e.resetTask)return e.resetTask;if(!e.resetDone&&O(e)){e.resetTask=(async()=>{var t,l;let i=null==(l=e.context.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l);(e0g(e.context)===e.identity||String((null==i?void 0:i.order_id)||"")===e.orderId)&&await e.finishPayment(e.orderId),e.resetDone=!0})();try{await e.resetTask}finally{e.resetTask=void 0}}},L=async function(e){var t,l;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.log,a=()=>d.current&&!1!==s.current.isActive&&s.current.scopeKey===e.scopeKey&&s.current.sessionId===e.sessionId&&s.current.context.sales.bookingTicket===e.context.sales.bookingTicket;if(!a())return;let n=!1,r=()=>{n||(n=!0,null==i||i("payment_handoff",{orderId:e.orderId,kind:e.kind}))},o=()=>z(e);if("deferred"===e.kind||"virtual"===e.kind){if(await o(),!a())return;E("deferred"===e.kind?`/order/details?id=${encodeURIComponent(e.orderId)}`:`/payment-finish/success?amount=${encodeURIComponent(String(e.totalAmount))}&order_id=${encodeURIComponent(e.orderId)}`),r();return}if("function"!=typeof A.action)throw Error(P("Payment is unavailable. Please reopen this order to pay.","支付入口不可用,请从订单详情继续支付。"));let c={target:e,sessionId:`${e.sessionId||"venue"}:${Date.now()}:${++e0m}`,terminal:!1};p.current=c,d.current&&w("opening"),await eVt({action:e=>{a()&&(A.action(e),r())},clearCartAndReset:o,freePay:efs,onFreePayFailure:e=>{throw Error(String((null==e?void 0:e.message)||P("Payment failed. Please try again.","支付失败,请重试。")))},onResetError:e=>console.error("[VenueBooking] Order submitted; local cleanup failed",e),orderId:e.orderId,preparePayments:e.preparePayments,persistCatalogView:()=>{},recalcSummary:async()=>void 0,redirectZeroAmount:(t=e.platform,l=e.totalAmount,"h5"===String(t||"").trim().toLowerCase()&&0===eHE(l)),replace:e=>{a()&&(E(e),r())},totalAmount:e.totalAmount,paymentSessionId:c.sessionId,onPaymentLifecycle:t=>{if(!t||"object"!=typeof t||!("key"in t)||"payment_lifecycle"!==t.key||!("data"in t))return;let l=t.data;if(l&&l.session_id===c.sessionId&&String(l.order_id)===e.orderId&&p.current===c&&!c.terminal&&O(e)){if("opened"===l.phase){d.current&&w("open");return}if("launch_failed"===l.phase){c.terminal=!0,d.current&&(w("failed"),b(("string"!=typeof l.reason||/^[a-z][a-z0-9_]*$/i.test(l.reason)?void 0:l.reason)||P("Payment could not be opened. Please try again.","支付入口未能打开,请重试。")));return}("dismissed"===l.phase||"redirecting"===l.phase)&&(c.terminal=!0,d.current&&w("closing"),o().then(()=>{d.current&&O(e)&&p.current===c&&w("closed")}).catch(t=>{d.current&&O(e)&&p.current===c&&(w("closed"),b(e0n(t)||P("Could not clear this completed checkout.","结账页面清理失败。")))}))}}})},R=o0(async()=>{var e,t,l,p,g,v,y,x,_,S,N,C,M,T,I;if(c.current||m.current||!(d.current&&!1!==s.current.isActive))return!1;c.current=!0,f(!0),b(null);let D=!1,E=!1,O=s.current,{context:z}=O,R=z.sales.bookingTicket,$=e0g(z),F=()=>d.current&&!1!==s.current.isActive&&s.current.scopeKey===O.scopeKey&&s.current.sessionId===O.sessionId&&s.current.context.sales.bookingTicket===R,q=()=>F()&&e0g(s.current.context)===$,B={isCurrent:q,isSameSession:F,reset:O.onFailureConfirmed},H=null==(e=O.operationLog)?void 0:e.capture();null==H||H("checkout_requested",{retrySubmittedOrder:!!u.current,submittedOrderId:null==(t=u.current)?void 0:t.orderId});try{if(u.current){let e=u.current;if(O.scopeKey!==u.current.scopeKey||O.sessionId!==u.current.sessionId||R!==u.current.context.sales.bookingTicket)return!1;return await L(e,H),!0}let e=String(n.platform||(null==R||null==(l=R.otherParams)?void 0:l.platform)||a||"").toLowerCase();if(!R||!["pc","h5"].includes(e))throw Error(P("Open this booking from the customer website.","请从用户端预约页面打开。"));if(!r.holderConfirm)throw Error(P("Booking confirmation is unavailable. Please reload.","预订确认服务未就绪,请刷新页面。"));if(!await n.ensureCanShop()||!q())return!1;let t=(null==i||null==(v=i.appHelper)||null==(g=v.constants)||null==(p=g.config)?void 0:p.channel)||e;if(Um(t)&&!o.isLoggedIn()&&(!await new Promise(e=>{h.current=e,o.openLoginModal({callback:t=>{h.current=null,e("success"===t)}})||(h.current=null,e(!1))})||!q())||(await z.cart.waitForCartConsistency(),!q()||s.current.beforeCheckout&&!await s.current.beforeCheckout()||!q()))return!1;let d=(null==(y=R.getTempOrder)?void 0:y.call(R))??z.sales.tempOrder;if(!(null==d||null==(x=d.products)?void 0:x.length)&&!(null==d||null==(_=d.bookings)?void 0:_.length))return!1;let c=n.enabled&&!n.requirePaymentOnSubmit,m=!!(z.sales.enableMultiCurrencySettlement&&Yc(d));if(!c&&!m&&"function"!=typeof A.action)throw Error(P("Payment is unavailable. Please reload.","支付入口未就绪,请刷新页面。"));let f=null,b=c?{paymentExecution:"deferred"}:{},w=await z.cart.submit(b,{validateHolder:!0,beforeSubmit:async()=>{var t,l,i;if(!q()||"function"!=typeof s.current.beforeSubmit||!await s.current.beforeSubmit()||(await z.cart.waitForCartConsistency(),!q()))return!1;let a=null==(t=R.getWalletAssetsState)?void 0:t.call(R);f=c||m?null:eVe({platform:e,shouldUseConsumerPayment:!0,payments:null==(i=R.getTempOrder)||null==(l=i.call(R))?void 0:l.payments,selectedItems:null==a?void 0:a.selectedItems,items:null==a?void 0:a.items}),Object.assign(b,null==f?void 0:f.submitParams);let r=(D=await n.beginCheckout())&&q();return E=r,r}}),j=[w,null==w?void 0:w.data,null==w?void 0:w.response,null==w||null==(S=w.data)?void 0:S.response].filter(e=>eX3(e))[0];if(j||!eTm(w))throw Error(e0n(j||w)||P("Booking could not be submitted.","预订提交失败。"));let I=eH5(w,d??null);if(!I)throw Error(P("The checkout response did not include an order number.","结账接口未返回订单编号。"));if(null==H||H("order_created",{orderId:I.orderId,deferred:c,virtual:m}),null==(N=O.onOrderSubmitted)||N.call(O,I.orderId),!F())return!1;let B=null==(C=R.getTempOrder)?void 0:C.call(R),V=e0g(z)===$||String((null==B?void 0:B.order_id)||"")===I.orderId;V&&(null==(M=R.clearSessionStorageOrderSnapshot)||M.call(R));let U=function(e){let{result:t,amountSnapshot:l,order:i}=e,a=e0r(t),n=e0r(a.data),r=e0r(e0r(n.response).data??e0r(a.response).data??a.data??a),o=e0r(r.summary),s=e0r(l),d=e0r(i),c=e0o(r.order_wait_pay_amount);if(null!==c)return c;let u=String(r.payment_status||"").trim().toLowerCase();if("paid"===u)return 0;let p=r.deposit_amount??o.deposit_amount,m=e0o(p),g=null!=p&&""!==p,h=e0o(s.depositAmount);if(e0d(r.is_deposit)??(null!==m&&m>0||void 0)??e0d(s.isDeposit)??e0d(d.is_deposit)??(e0s(s.depositAmount,d.deposit_amount)??0)>0){let e=e0s(r.order_paid_amount,r.paid_amount,o.order_paid_amount),t=e0o(e0r(s.summary).order_paid_amount),l=m??h??e0o(d.deposit_amount),i=[...Array.isArray(r.payments)?r.payments:[],...Array.isArray(d.payments)?d.payments:[]].map(e0r).filter(e=>"paid"===e.status),a=i.some(e=>"normal"===e.type||"normal"===e.order_payment_type||"deposit"!==e.type&&"deposit"!==e.order_payment_type),n=e??t;if(a||null!==l&&l>0&&[e,t].some(e=>null!==e&&e>=l)||null!==e&&null!==t&&e!==t||i.length>0&&(null===n||0===n&&i.some(e=>(e0s(e.origin_amount,e.amount)??0)>0)))return null;let c=e0o(s.amountGap);return!0===e0d(s.isDeposit)&&null!==h&&h>0&&null!==c&&(!g||m===h)?c:"unpaid"===u&&0===e&&null!==m&&m>0?m:null}let v=e0r(s.summary??d.summary);return e0o(eHR({data:r},{expect_amount:s.expectAmount??v.expect_amount,total_amount:s.totalAmount??v.total_amount},void 0))}({result:w,amountSnapshot:V?null==(T=R.getOrderAmountSnapshot)?void 0:T.call(R):void 0,order:V?B:void 0});if(!c&&null===eHE(U))return u.current={orderId:I.orderId,totalAmount:U,kind:"deferred",platform:e,context:z,identity:$,resetDone:!1,finishPayment:O.onPaymentFinished,scopeKey:O.scopeKey,sessionId:O.sessionId,log:H},k(I.orderId),await L(u.current),!0;return u.current={orderId:I.orderId,totalAmount:U,kind:c?"deferred":m?"virtual":"payment",preparePayments:null==f?void 0:f.preparePayments,platform:e,context:z,identity:$,resetDone:!1,finishPayment:O.onPaymentFinished,scopeKey:O.scopeKey,sessionId:O.sessionId,log:H},k(I.orderId),await L(u.current),!0}catch(t){if(t===Ud||!F())return null==H||H("checkout_cancelled",{reason:t===Ud?"holder_confirmation":"session_changed"}),!1;null==H||H(u.current?"payment_handoff_failed":"checkout_failed",{orderId:null==(I=u.current)?void 0:I.orderId,admittedToSubmit:E,...eZC(t)},"warning");let e=e0n(t)||P("Booking could not be submitted.","预订提交失败。");if(E&&!u.current&&q()){let t={...B,message:e,resetStarted:!1};m.current=t,j(t)}else b(e),u.current&&w("failed");return!1}finally{D&&n.endCheckout(),c.current=!1,d.current&&f(!1)}});return l.enabled?{...l,canRetryPayment:!1,retryPayment:l.checkout}:{checkout:R,submitting:v,error:y,submittedOrderId:x,failure:S,confirmFailure:D,resettingFailure:N,resetError:M,kioskPaymentResult:null,paymentActive:!1,isPaymentActive:l.isPaymentActive,waitForPaymentIdle:l.waitForPaymentIdle,backHomeCountdown:l.backHomeCountdown,canRetryPayment:!!(x&&!v&&("failed"===_||"closed"===_)),retryPayment:R,resettingHome:!1,returnHome:l.returnHome,startNewOrder:l.startNewOrder}}({context:A,isActive:e.isActive,locale:F,scopeKey:E,sessionId:e2.sessionId,operationLog:e1,beforeSubmit:tR,beforeCheckout:()=>{var e;return!tq.pending&&!tq.error&&!tS()&&tL()&&((null==(e=eQ.current)?void 0:e.validateContact())??!1)},onOrderSubmitted:e2.discard,onFailureConfirmed:e2.restart,onPaymentFinished:e2.finishSubmitted,onKioskFinish:e=>eV.current(e)});eB.current=t$.isPaymentActive,eH.current=t$.waitForPaymentIdle;let tF=function(e){var t,l,i,a,n;let r=eR(),o=null==r||null==(i=r.appHelper)||null==(l=i.utils)||null==(t=l.getApp)?void 0:t.call(l),s=(0,eN.useRef)(e);s.current=e;let d=(0,eN.useRef)();e.sessionId&&((null==(a=d.current)?void 0:a.source)!==e.source||d.current.sessionId!==e.sessionId)?d.current={source:e.source,sessionId:e.sessionId,session:e.session,onReset:e.onReset,onRequestHome:e.onRequestHome}:(null==(n=d.current)?void 0:n.source)===e.source&&e.sessionId&&(d.current.session=e.session,d.current.onReset=e.onReset,d.current.onRequestHome=e.onRequestHome);let c=d.current,u=(0,eN.useRef)(!0),p=(0,eN.useRef)(0),m=(0,eN.useRef)(),g=(0,eN.useRef)(),[h,v]=(0,eN.useState)(!1),[f,y]=(0,eN.useState)(),b=()=>s.current.isPaymentActive?s.current.isPaymentActive():s.current.paymentActive,x=async e=>{if(e)await e();else{var t;if("function"!=typeof(null==o||null==(t=o.history)?void 0:t.replace))throw Error("Home navigation is unavailable. Please try again.");await o.history.replace("/")}},k=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!s.current.enabled||b())return Promise.resolve(!1);if(!e||e.source!==s.current.source){if(!t)return Promise.resolve(!1);if(g.current)return g.current;let e=s.current.source,l=s.current.onRequestHome,i=(async()=>{u.current&&(v(!0),y(void 0));try{return await x(l),!0}catch(t){return u.current&&s.current.source===e&&y(t instanceof Error?t.message:String(t)),!1}finally{u.current&&v(!1)}})();return g.current=i,i.then(()=>{g.current===i&&(g.current=void 0)}),i}let i=()=>d.current===e&&s.current.source===e.source;if(t&&!i())return Promise.resolve(!1);if(m.current)return m.current.owner===e?m.current.promise:Promise.resolve(!1);let a=(async()=>{u.current&&i()&&(v(!0),y(void 0));try{if(i()&&e.session.ownsSession()&&e.onReset(),!(l||t||!1===s.current.isActive||!i()?await e.session.retire({canRetire:()=>!b()}):await e.session.restart()))return!1;if(t){if(!i()||b())return!1;await x(e.onRequestHome)}return!0}catch(e){return u.current&&i()&&y(e instanceof Error?e.message:String(e)),!1}})(),n={owner:e,promise:a};return m.current=n,a.then(()=>{m.current===n&&(m.current=void 0,u.current&&v(!1))}),a},_=(0,eN.useRef)(k);_.current=k;let w=(0,eN.useCallback)(e=>{let{navigateHome:t}=e;return _.current(c,t)},[c]),S=(0,eN.useCallback)(()=>_.current(c,!1),[c]);return(0,eN.useEffect)(()=>(u.current=!0,++p.current,()=>{u.current=!1,++p.current}),[]),(0,eN.useEffect)(()=>{!e.enabled||!1!==e.isActive||b()||_.current(c,!1,!0)},[e.enabled,e.isActive,e.paymentActive,c]),(0,eN.useEffect)(()=>{var t;if(!e.enabled||!1===e.isActive||!c)return;let l=null==o||null==(t=o.getPlugin)?void 0:t.call(o,"screenProtector");if("function"==typeof(null==l?void 0:l.subscribeTrigger))return l.subscribeTrigger(()=>{_.current(c,!1,!0)})},[o,e.enabled,e.isActive,c]),(0,eN.useEffect)(()=>{if(e.enabled&&c)return()=>{let e=p.current;Promise.resolve().then(()=>{u.current&&d.current===c||!u.current&&p.current!==e||b()||_.current(c,!1,!0)})}},[e.enabled,c]),{finish:w,reset:S,resetting:h,error:f}}({enabled:$,isActive:e.isActive,sessionId:e2.sessionId,source:R,session:e2,paymentActive:t$.paymentActive,isPaymentActive:()=>eB.current(),onRequestHome:e.onRequestHome,onReset:()=>{++eU.current,eq.current=!1,ea(void 0),er(void 0),es(void 0),ec(void 0),ep(void 0),eg(!1),eD(void 0),eO(!1),ev(void 0),e_(void 0),ex(void 0),ej(!1),eT(!1),ey(!1),e$(!1),K("select"),Z(!1),el("date"),T.close(),M.customerAuth.dismiss(),M.holder.dismiss(),M.normalProductDetail.dismiss(),M.bookingEdit.dismiss(),M.multiDay.dismiss(),M.allergySelection.dismiss(),M.settlementSelect.dismiss(),M.settlementConflict.dismiss(),M.holderConfirm.cancel()}});eV.current=tF.finish,(0,eN.useEffect)(()=>{tF.error&&ev(tF.error)},[tF.error]);let tq=function(e){var t,l,i;let a=(0,eN.useRef)(e);a.current=e;let n=(0,eN.useRef)(!0),r=(0,eN.useRef)(),o=(0,eN.useRef)(),s=(0,eN.useRef)(!1),[,d]=(0,eN.useState)(0),[c,u]=(0,eN.useState)(),p=(0,eN.useMemo)(()=>e.enabled?e0C(e.order,e.scopeKey,e.mainProducts,e.extrasProducts):[],[e.enabled,e.os,e.scopeKey,e.order,null==(t=e.order)?void 0:t.products,null==(i=e.order)||null==(l=i._extend)?void 0:l.productsByUid,e.mainProducts,e.extrasProducts]),m=!!c&&e0M(c.owner,e),g=m?c.error:void 0,h=e.enabled&&(m&&c.pending||!g&&p.length>0);return(0,eN.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]),(0,eN.useEffect)(()=>{var t;let l=o.current;if(!l||e0M(l.owner,e)&&(0,ni.isEqual)(l.ownership,e0T(e.os.getTempOrder()||{}))||(o.current=void 0,s.current=!1,u(e=>(null==e?void 0:e.owner)===l.owner?void 0:e)),!e.enabled||r.current)return;let i=o.current&&e0M(o.current.owner,e)?o.current:void 0;if(i&&!s.current||!p.length&&!i)return;s.current=!1;let c={os:e.os,scopeKey:e.scopeKey,order:e.order,identity:eKA(e.order),customer:String((null==(t=e.order)?void 0:t.customer_id)||"")};if(!c.order||!e0M(c,e))return;let m=(null==i?void 0:i.published)?i:{owner:c,patches:p,ownership:(0,ni.cloneDeep)(e0T(c.order)),published:!1};r.current=m,u({owner:m.owner,pending:!0});let g=()=>n.current&&e0M(m.owner,a.current),h=()=>0===e0C(m.owner.order,m.owner.scopeKey,e.mainProducts,e.extrasProducts).length,v=String(e.locale||"").startsWith("zh")?"无法更新定金信息,请重试。":"Could not update deposit details. Please try again.";(async()=>{try{if(!g())return;if(!m.published){if(!m.patches.length||!e.os.updateOrderProducts)throw Error(v);let t=(0,ni.cloneDeep)({products:c.order.products,bookings:c.order.bookings,customer:c.order.customer_id,payments:c.order.payments,metadata:c.order.metadata,extend:c.order._extend});if(await e.os.updateOrderProducts(m.patches,{beforeApply:()=>{let l=e.os.getTempOrder();if(!a.current.enabled||a.current.mainProducts!==e.mainProducts||a.current.extrasProducts!==e.extrasProducts||!g()||!(0,ni.isEqual)(m.ownership,e0T(l||{}))||!(0,ni.isEqual)(t,{products:null==l?void 0:l.products,bookings:null==l?void 0:l.bookings,customer:null==l?void 0:l.customer_id,payments:null==l?void 0:l.payments,metadata:null==l?void 0:l.metadata,extend:null==l?void 0:l._extend}))throw Error(v)},isCurrentOrder:g}),!g())return;if(m.ownership=(0,ni.cloneDeep)(e0T(m.owner.order)),m.published=h(),!m.published)throw Error(v)}if(!g())return;if(!e.os.getSummary)throw Error(v);let t=await e.os.getSummary();if(!g())return;if(!t||"object"!=typeof t)throw Error(v);a.current.refreshSnapshot(),o.current=void 0,u({owner:m.owner,pending:!1})}catch(e){if(g()){m.ownership=(0,ni.cloneDeep)(e0T(m.owner.order)),m.published=h(),o.current=m,u({owner:m.owner,pending:!1,error:e0_(e,v)});try{a.current.refreshSnapshot()}catch{}}}finally{r.current===m&&(r.current=void 0),n.current&&(u(e=>(null==e?void 0:e.owner)===m.owner&&e.pending?void 0:e),d(e=>e+1))}})()}),{pending:h,error:g,retry:()=>{e.enabled&&!r.current&&g&&(s.current=!0,d(e=>e+1))}}}({os:R,scopeKey:E,order:tf,locale:F,mainProducts:tv.products,extrasProducts:tk.products,enabled:tl&&!tv.loading&&!tv.error&&!tk.loading&&!tk.error&&!ef&&!eS&&!eC&&!t_.busy&&!tw.pending&&!ei&&!en&&!t$.submitting&&!t$.failure&&!eL,refreshSnapshot:L.refreshCartSnapshot}),tB=!tl||ef||eS||t_.busy||tw.pending||tq.pending||t$.submitting||!!t$.failure||!!t$.submittedOrderId||eL,tH=!tl||!1===e.isActive||ef||eS||eC||t_.busy&&!tS()||tq.pending||t$.submitting||!!t$.failure||!!t$.submittedOrderId||eL||!!ei||!!en||!!eA||tk.loading||!!tk.error,tV=tB||eC,tU=null==(v=R.getOrderAmountSnapshot)?void 0:v.call(R),tY=(null==tU?void 0:tU.summary)||(null==tf?void 0:tf.summary)||A.summary.summary,tW=(null==tU?void 0:tU.depositAmount)??(null==tY?void 0:tY.deposit_amount)??(null==tf?void 0:tf.deposit_amount),tG=Number(tW)>0&&!!((null==tU?void 0:tU.isDeposit)??1===Number(null==tf?void 0:tf.is_deposit)),tK=eCE({baseSalesAmountGap:null==tU?void 0:tU.amountGap,amountGap:null==tY?void 0:tY.amount_gap,fallbackAmount:null==tY?void 0:tY.total_amount,payments:null==tf?void 0:tf.payments}),tQ=ty.bindings.reduce((e,t)=>{let l=String(t.line.product_id);return e[l]=(e[l]||0)+t.quantity,e},{}),tZ=eJK(A,E);(0,eN.useEffect)(()=>{!tl||"review"!==G||tC||!tZ.complete||en||tk.loading||tk.error||tL()},[tl,G,tC,tZ.complete,en,tk.loading,tk.error,tk.products,L.tempOrder]);let tJ=ty.bindings.length>0,tX=tj?"extras":"review",t0=tZ.required?"holder":tX,t2=ty.bindings.every(e=>e.date===V);return{props:e,engine:j,bookingUI:N,orderPanel:T,mode:P,context:A,config:D,scopeKey:E,variant:O,sales:z,cart:L,os:R,isKiosk:$,locale:F,text:q,today:B,date:V,setDate:U,visibleDates:Y,setVisibleDates:W,step:G,setStep:K,dateConfirmed:Q,setDateConfirmed:Z,expandedSection:et,setExpandedSection:el,dateSearchRange:tg,dateInteractionStarted:tp,onDateInteraction:tu,canAutoSelectDate:()=>tc.current===td&&ee.current!==td,composer:ei,setComposer:ea,configurationModal:en,setConfigurationModal:er,error:eh,setError:ev,busy:ef,pendingExtraProductId:eb,preparingProductId:ek,composerBusy:eS,setComposerBusy:ej,rememberPartyPreview:(e,t)=>{if(!eW.current||"party"!==P||!ei||tT.current.composerKey!==e)return;let l=e0k({...ei,...t},"booking");es(t=>(null==t?void 0:t.key)===e&&JSON.stringify(t.value)===JSON.stringify(l)?t:{key:e,value:l})},previewRecovery:ed,previewRecoveryError:eu,recoveringPreview:em,retryPartyPreview:()=>ec(e=>e&&{...e,attempt:e.attempt+1}),discardPartyPreview:()=>{++eU.current,ea(void 0),er(void 0),es(void 0),ep(void 0),eg(!1),ec(void 0),el("product")},uiHydrated:e5,subscribePartyProductConfirmed:eK,notifyPartyProductConfirmed:e4,holderBusy:eC,setHolderBusy:eT,externalHolderDisabled:tB,revision:eI,setRevision:eP,linePicker:eA,setLinePicker:eD,showOffers:eE,setShowOffers:eO,handoff:eL,setHandoff:e$,confirmation:eQ,alive:eW,mainCatalog:eZ,mainQueries:tr,extrasQueries:to,customerId:eJ,refresh:e0,session:e2,ready:tl,main:tv,order:tf,bindings:ty,partyMain:tb,operationLog:e1,extrasCatalog:tk,extras:t_,extraQuantity:tw,extraQuantityDisabled:tH,isExtraQuantityPending:tS,dateStates:tM,run:tI,policy:tP,openProduct:tA,editLine:e=>tI(async()=>{let t=eJY(R.getTempOrder(),{mode:P}).bindings.find(t=>t.productLineUid===e);if(!t)throw Error(q("This booking changed. Please refresh your order.","预约已变化,请刷新订单。"));await tA({id:Number(t.line.product_id)},e,"party"!==P)}),removeLine:e=>tE([e]),removeLines:tE,removeTicket:(e,t)=>tD([e],{uid:e,index:t}),changeDate:tO,showExtraPreparation:tz,checkout:t$,kioskLifecycle:tF,depositHydration:tq,disabled:tV,openOrderHistory:()=>{var e,t,l,i,a,n;let r="h5"===String((null==(e=R.otherParams)?void 0:e.platform)||(null==j||null==(l=j.appHelper)||null==(t=l.constants)?void 0:t.platform))?"/orders":"/order",o=null==j||null==(a=j.appHelper)||null==(i=a.utils)?void 0:i.history;(null==o?void 0:o.push)?o.push(r):window.location.assign(`${(null==(n=window.location.pathname.match(/^\/(en|zh-CN|zh-HK|ja|pt)(?=\/|$)/))?void 0:n[0])||""}${r}`)},summary:tY,amount:e=>Yg(tf,e??0),amountDue:tK,hasDeposit:tG,depositAmount:tW,productQuantities:tQ,holderState:tZ,checkExtraHolders:tL,mainPoolEmpty:tN,mainCatalogBlocked:tC,hasExtras:tj,nextAfterHolder:tX,nextAfterSelect:t0,hasBookings:tJ,mainDateMatches:t2,continueOrder:e=>{!(tV||tq.error||tC||tS())&&tJ&&!ei&&t2&&(ev(void 0),K(e))}}}let e0A=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,128l-72,72V56Z",opacity:"0.2"}),eN.createElement("path",{d:"M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z"}))]]),e0D=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e0A}));e0D.displayName="ArrowRightIcon";let e0E=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),eN.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z"}))]]),e0O=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e0E}));function e0z(e){let{id:t,number:l,title:i,meta:a,className:n="",children:r,...o}=e;return(0,eB.jsxs)("section",{...o,className:`checkout-module ${n}`,id:t,"aria-labelledby":`${t}-heading`,children:[(0,eB.jsxs)("header",{className:"checkout-module-heading",children:[(0,eB.jsx)("span",{className:"checkout-module-number","aria-hidden":"true",children:l}),(0,eB.jsx)("h2",{id:`${t}-heading`,children:i}),a&&(0,eB.jsx)("span",{className:"checkout-module-meta",children:a})]}),(0,eB.jsx)("div",{className:"checkout-module-body",children:r})]})}function e0L(e){let{id:t,label:l,value:i,onChange:a,maxLength:n=500,rows:r=3,placeholder:o,disabled:s=!1,hint:d,hideLabel:c=!1}=e;return(0,eB.jsxs)("div",{className:"note-field",children:[(0,eB.jsx)("label",{className:c?"sr-only":"field",htmlFor:t,children:l}),(0,eB.jsx)("textarea",{id:t,value:i,onChange:e=>a(e.target.value),rows:r,maxLength:n,placeholder:o,disabled:s,"aria-describedby":`${t}-count`}),(0,eB.jsxs)("p",{className:"note-help small muted",children:[(0,eB.jsx)("span",{children:d}),(0,eB.jsxs)("span",{id:`${t}-count`,children:[i.length,"/",n]})]})]})}e0O.displayName="PlusIcon";let e0R=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm68-84a12,12,0,0,1-12,12H128a12,12,0,0,1-12-12V72a12,12,0,0,1,24,0v44h44A12,12,0,0,1,196,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm56,112H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm62-90a6,6,0,0,1-6,6H128a6,6,0,0,1-6-6V72a6,6,0,0,1,12,0v50h50A6,6,0,0,1,190,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm60-92a4,4,0,0,1-4,4H128a4,4,0,0,1-4-4V72a4,4,0,0,1,8,0v52h52A4,4,0,0,1,188,128Z"}))]]),e0$=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e0R}));e0$.displayName="ClockIcon";let e0F=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z",opacity:"0.2"}),eN.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z"}))]]),e0q=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e0F}));e0q.displayName="PencilSimpleIcon";let e0B=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),eN.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),e0H=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e0B}));function e0V(e){let{title:t,image:l,icon:i,details:a,amount:n,action:r,removeAction:o,children:s,className:d="",layout:c="card",id:u}=e;return(0,eB.jsxs)("article",{id:u,className:`booking-order-item booking-order-item-${c} ${d}`,children:[(0,eB.jsxs)("div",{className:"booking-order-item-heading",children:[i&&(0,eB.jsx)("span",{className:"booking-order-item-icon","aria-hidden":"true",children:i}),l&&(0,eB.jsx)("img",{className:"booking-order-item-image",src:l,alt:""}),(0,eB.jsxs)("div",{className:"booking-order-item-copy",children:[(0,eB.jsx)("h3",{children:t}),a&&(0,eB.jsx)("div",{className:"booking-order-item-details",children:a}),void 0!==n&&(0,eB.jsx)("strong",{className:"booking-order-item-amount",children:n}),(r||o)&&(0,eB.jsxs)("div",{className:"booking-order-item-actions",children:[r&&(0,eB.jsx)(eKZ,{className:"booking-order-item-edit","aria-label":r.label,disabled:r.disabled,onClick:r.onClick,children:(0,eB.jsx)(e0q,{size:18,"aria-hidden":"true"})}),o&&(0,eB.jsx)(eKZ,{className:"booking-order-remove","aria-label":o.label,disabled:o.disabled,onClick:o.onClick,children:(0,eB.jsx)(e0H,{size:18,"aria-hidden":"true"})})]})]})]}),s&&(0,eB.jsx)("div",{className:"booking-order-item-content",children:s})]})}function e0U(e){let{items:t}=e;return(0,eB.jsx)("dl",{className:"booking-order-details",children:t.map((e,t)=>(0,eB.jsxs)("div",{className:"booking-order-detail",children:[(0,eB.jsx)("dt",{children:e.label}),(0,eB.jsxs)("dd",{children:[(0,eB.jsxs)("div",{children:[(0,eB.jsx)("strong",{children:e.value}),e.detail&&(0,eB.jsx)("div",{className:"booking-order-detail-copy",children:e.detail})]}),e.action&&(0,eB.jsx)("button",{type:"button",className:"text-link",disabled:e.action.disabled,onClick:e.action.onClick,children:e.action.label})]})]},t))})}function e0Y(e){let{rows:t,lang:l,formatAmount:i}=e;return(0,eB.jsx)("div",{className:"booking-price-breakdown",children:t.map(e=>(0,eB.jsxs)("div",{className:"booking-price-line",children:[(0,eB.jsx)(eKU,{label:e.label,amount:e.amount,formatAmount:i,total:"total"===e.tone,lang:l,className:"discount"===e.tone?"discount":""}),e.detail&&(0,eB.jsx)("div",{className:"small muted booking-price-detail",children:e.detail})]},e.id))})}function e0W(e){let{title:t,description:l,children:i}=e;return(0,eB.jsxs)("section",{className:"booking-holder-section",children:[t&&(0,eB.jsx)("h2",{children:t}),l&&(0,eB.jsx)("p",{className:"muted",children:l}),(0,eB.jsx)("div",{className:"booking-holder-content",children:i})]})}e0H.displayName="TrashIcon";let e0G=e=>null==e?"":String(e),e0K=e=>e0G(e).slice(0,10),e0Q=e=>{let t=e0G(e);return/^\d{2}:\d{2}$/.test(t)?`${t}:00`:t};function e0Z(e,t){var l,i,a,n,r,o,s,d;if(!t||!e.product_id||(null==(l=e._extend)?void 0:l.independentLine)===!0||(null==(n=e.metadata)||null==(a=n.origin)||null==(i=a._extend)?void 0:i.independentLine)===!0)return null;let c=e0K(t.start_date),u=e0K(t.end_date),p=e0Q(t.start_time),m=e0Q(t.end_time);if(![c,u].every(e=>/^\d{4}-\d{2}-\d{2}$/.test(e))||![p,m].every(e=>/^\d{2}:\d{2}:\d{2}$/.test(e)))return null;let g=Array.isArray(t.resources)?t.resources:[];return g.some(e=>!e||!e0G(e.relation_id??e.resource_id??e.id)||!e0G(e.form_id))?null:JSON.stringify(function e(t){return null==t?null:Array.isArray(t)?t.map(e):"object"==typeof t?Object.keys(t).sort().reduce((l,i)=>(l[i]=e(t[i]),l),{}):t}({product:e0G(e.product_id),variant:e0G(e.product_variant_id),sku:{...e.product_sku,option:exP(e)},bundle:e.product_bundle||[],businessDate:e0K((null==(r=t.metadata)?void 0:r.availability_business_date)||c),startDate:c,endDate:u,startTime:p,endTime:m,timezone:e0G(null==(o=t.metadata)?void 0:o.availability_timezone),resources:g.map(e=>({form:e0G(e.form_id),id:e0G(e.relation_id??e.resource_id??e.id),type:e0G(e.relation_type),capacity:e0G(e.capacity)})).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t))),legacyResource:g.length?null:{id:e0G(t.relation_id??t.resource_id),type:e0G(t.relation_type)},role:e0G(null==(s=e.metadata)?void 0:s.venue_booking_role),scope:e0G(null==(d=e.metadata)?void 0:d.venue_booking_scope_key)}))}function e0J(e,t){let l=[],i=new Map;return e.forEach((e,a)=>{let n=t(e),r=null===n?void 0:i.get(n);if(r)r.members.push(e);else{let t={key:null===n?`separate:${a}`:`group:${n}`,members:[e]};l.push(t),null!==n&&i.set(n,t)}}),l}function e0X(e,t,l,i,a){let n=e=>[null==e?void 0:e.bundle_title,null==e?void 0:e.title,null==e?void 0:e.name,null==e?void 0:e.product_title].map(e=>eKT(e,l)).find(Boolean);return(e.product_bundle||[]).flatMap((l,r)=>{var o,s;if(!l)return[];let d=Number(l.num??l.quantity??1);if(!Number.isSafeInteger(d)||d<=0)return[];let c=l.bundle_id??l.id,u=l.bundle_group_id??l.group_id,p=null!=c?{bundle_id:c,bundle_group_id:u}:l;return[{key:`${u??""}:${c??""}:${r}`,name:n(l)||n((null==(o=l.metadata)?void 0:o.origin)??l.origin??l.product)||n(ewb(p,[null==(s=e.metadata)?void 0:s.origin,a,i])),quantity:d*t}]})}async function e00(e){var t,l,i,a,n,r,o,s,d;let{handle:c,line:u,holderIds:p,assertCurrent:m,beforeWrite:g}=e,h=null==(t=u.orderLine.metadata)?void 0:t.venue_booking_role,v=String((null==(l=u.orderLine.metadata)?void 0:l.unique_identification_number)||""),f=String((null==(a=u.booking)||null==(i=a.metadata)?void 0:i.unique_identification_number)||"");if("tickets"!==h&&"party_main"!==h||!v||!f||1!==Number(u.orderLine.num)||1!==p.length||!c.updateOrderBooking)throw Error("This booking cannot accept a Holder-only update. Please reselect the booking.");m();let y=null==(n=c.getTempOrder)?void 0:n.call(c),b=null==y||null==(r=y.bookings)?void 0:r.find(e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)||"")===f});if(!b||String(b.product_uid||"")!==v)throw Error("The booking link changed. Please review the order.");let x=JSON.stringify(b),k=null==y?void 0:y.customer_id,_=await (null==(o=c.getOtherParams)?void 0:o.call(c));m();let w=null==(s=c.getTempOrder)?void 0:s.call(c),S=null==w||null==(d=w.bookings)?void 0:d.find(e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)||"")===f});if(w!==y||(null==w?void 0:w.customer_id)!==k||!S||JSON.stringify(S)!==x)throw Error("The booking changed while choosing a Holder. Please try again.");let j=ekA(p,{customerId:k,isFranchisee:!!(null==_?void 0:_.isFranchisee),holderOptions:e.holderOptions,productSource:u.cacheItem});g(),await c.updateOrderBooking({unique_identification_number:f,updates:{holder:j,metadata:{holder_id:p}}})}function e02(e){let{formId:t,customerId:l,locale:i,onClose:a,onCreated:n,onUnconfirmed:r,isCurrent:o}=e,s=eF(),[d]=YK({components:["FormCard"]}),[c,u]=(0,eN.useState)(),[p,m]=(0,eN.useState)(),[g,h]=(0,eN.useState)(!1),[v,f]=(0,eN.useState)(!1),[y,b]=(0,eN.useState)(!1),x=(0,eN.useRef)(null),k=(0,eN.useRef)(!0),_=(0,eN.useRef)(!1),w=String(i||"").startsWith("zh"),S=(e,t)=>w?t:e;(0,eN.useEffect)(()=>{k.current=!0;let e=!1;return(async()=>{var l,i,a,n;let r=await UC(Number(t),s);if(!r)throw Error(S("The holder form is unavailable.","持票人表单未加载。"));let d=r.form_field??r.field,c=(r.form_type??(null==(l=r.form)?void 0:l.form_type))==="minors"?null==d||null==(a=d.find(e=>"form_to_form"===e.filed_type&&"hide"===e.status))||null==(i=a.setting)?void 0:i.linkedTable:void 0,p=c?await s5(Number(c),s):r;if(!p)throw Error(S("The linked waiver form is unavailable.","关联协议表单未加载。"));!e&&o()&&u({id:Number(c||t),title:String((null==(n=p.form)?void 0:n.title)||p.title||S("New holder profile","新建持票人档案")),franchisor:r.is_franchisor,linkedWaiver:!!c})})().catch(t=>{e||m(e0_(t,S("Unable to load the holder form.","无法加载持票人表单。")))}),()=>{e=!0,k.current=!1}},[t,l,s]);let j=async(e,t)=>{if(!k.current||!c||_.current)return;if("success"!==e){f(!0),h(!1),r(),m(S("The save result is unknown. Close this form and refresh the profile list before trying again.","保存结果尚未确认,请关闭表单并刷新档案列表后核对,勿重复创建。"));return}let l=Array.isArray(t)?Object.fromEntries(t.filter(e=>e&&"object"==typeof e&&"string"==typeof e.key).map(e=>[e.key,e.value])):t&&"object"==typeof t?{...t}:{};_.current=!0;try{o()&&await n({record:l,linkedWaiver:c.linkedWaiver}),k.current&&a()}catch(e){k.current&&(f(!0),r(),m(e0_(e,S("The profile was saved. Refresh the list to select it.","档案已保存,请刷新列表后选择,勿重复创建。"))))}finally{k.current&&h(!1)}};return(0,eB.jsxs)(eQu,{title:(null==c?void 0:c.title)||S("New holder profile","新建持票人档案"),className:"venue-holder-create-modal",mobile:"fullscreen",zIndex:600,closeLabel:S("Close","关闭"),externalDialogSelector:eQd,bodyClassName:"venue-holder-create-body venue-booking-legacy-controls",footerClassName:"venue-holder-create-footer",onClose:()=>{g&&_.current||(g&&r(),k.current=!1,a())},closeDisabled:g&&_.current,closeOnBackdrop:!g,closeOnEscape:!g,footer:(0,eB.jsx)(eKQ,{disabled:!y||v||!o(),busy:g,onClick:()=>{var e;(null==(e=x.current)?void 0:e.submit)&&o()&&(h(!0),m(void 0),x.current.submit())},children:g?S("Saving…","保存中…"):S("Save profile","保存档案")}),children:[p&&(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:p}),g&&!_.current&&(0,eB.jsx)("p",{className:"small muted",children:S("Saving. If you close this form, check the profile list before creating another profile.","正在保存。如需关闭,请先核对档案列表,勿重复创建。")}),!c&&!p&&(0,eB.jsx)(eM.Spin,{}),c&&(d?(0,eB.jsx)(d,{id:c.id,venueHolderLinkedRecords:!0,ref:e=>{x.current=e},isGetLastData:!1,setting:{isHidden:1},isV2API:!0,isShowSkeleton:!0,isClearData:!1,submitExtraParams:{...null!=l&&""!==l?{customer_id:l}:{},...null!=c.franchisor?{source_shop_customer:c.franchisor}:{}},onSubmit:(e,t)=>void j(e,t),onFormConfigChange:e=>b(!!e&&Object.keys(e).length>0),onChange:(e,t)=>b(!e&&!!t&&Object.keys(t).length>0),onFinishFailed:()=>{h(!1),m(S("Complete the required form fields.","请填写表单中的必填内容。"))}}):(0,eB.jsx)(eM.Alert,{type:"error",message:S("The form component is unavailable.","表单组件未加载。")}))]})}function e01(e,t){let l=String(t||"").startsWith("zh"),i=l?"zh":"en",a=(null==e?void 0:e.form)||e,n=[null==a?void 0:a.title,null==a?void 0:a.name,null==e?void 0:e.title,null==e?void 0:e.name].map(e=>eKT(e,i).trim()).find(Boolean)||(l?"持有人":"Holder");return{name:n,edit:l?`编辑${n}`:`Edit ${n}`,required:l?`必填${n}`:`${n} required`,optional:l?`${n}选填`:`Optional ${n}`,notRequired:l?`无需填写${n}`:`No ${n} required`,choose:l?`选择${n}`:`Select ${n}`,placeholder:l?`请选择${n}`:`Select ${n}`,create:l?"新建":"New",missing:l?`请选择${n}。`:`Please select ${n}.`}}let e04=e=>e0J(e,e=>{let t=e0Z(e.orderLine,e.booking);return null===t?null:JSON.stringify([t,e.config.enabled,e.config.required,String(e.config.formId??"")])}),e03=(0,eN.forwardRef)((e,t)=>{var l,i,a;let{context:n,scopeKey:r,locale:o,isActive:s=!0,disabled:d=!1}=e,c=UF(),u=Uu(),p=(0,eN.useMemo)(()=>eND(u.customerAuth),[u.customerAuth]),m=eKB(),g=dL("venue-holder"),h=(0,eN.useRef)(e);h.current=e;let v=(0,eN.useRef)(!0),f=(0,eN.useRef)(!1),y=(0,eN.useRef)(!1),b=(0,eN.useRef)(null),[x,k]=(0,eN.useState)(),[_,w]=(0,eN.useState)(!1),[S,j]=(0,eN.useState)(),[N,C]=(0,eN.useState)({}),[M,T]=(0,eN.useState)(),[I,P]=(0,eN.useState)(),[,A]=(0,eN.useState)(0),D=n.sales.bookingTicket,E=eJQ(n,r),O=eJK(n,r,o),z=e04(O.displayLines),L=e=>JSON.stringify([E,e.quantity,e.ids]),R=e=>{var t;return(null==(t=N[e.uid])?void 0:t.base)===L(e)?N[e.uid].ids:void 0},$=O.lines.some(e=>!!R(e));O.pending=!!S||!!M||!!I||$,O.complete=O.complete&&!$,O.blocked=eJX(D,E);let F=String(o||"").startsWith("zh"),q=(e,t)=>F?t:e,B=o0(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:E;return v.current&&!1!==h.current.isActive&&eJQ(h.current.context,h.current.scopeKey)===e});(0,eN.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]),(0,eN.useEffect)(()=>{k(void 0),w(!1),T(void 0),C({})},[E]),(0,eN.useEffect)(()=>{if(!I)return;let e=h.current,t=()=>{var e,t;return v.current&&!1!==h.current.isActive&&h.current.scopeKey===I.scopeKey&&h.current.context.sales.bookingTicket===I.handle&&eKA((null==(t=I.handle)||null==(e=t.getTempOrder)?void 0:e.call(t))??h.current.context.sales.tempOrder)===I.owner};if(!t()){P(void 0),j(void 0);return}if(String(eKO(e.context)||"")!==I.customerId)return;let l=eJK(e.context).lines.find(e=>e.uid===I.uid);if(!(null==l?void 0:l.config.formId)||I.index>=l.quantity){P(void 0),j(void 0);return}let i=!0,a=eJQ(e.context,e.scopeKey);return c.prepareHolderOptionsForSource(l.cacheItem).then(e=>{i&&t()&&B(a)&&e.accessAllowed&&(y.current=!1,T({uid:l.uid,index:I.index,identity:a,base:JSON.stringify([a,l.quantity,l.ids]),formId:l.config.formId}))}).catch(e=>{i&&t()&&k(e0_(e,String(h.current.locale||"").startsWith("zh")?"无法打开持票人表单。":"Unable to open the holder form."))}).finally(()=>{i&&v.current&&(P(void 0),j(void 0))}),()=>{i=!1}},[I,E,c.prepareHolderOptionsForSource,B]);let H=JSON.stringify([E,O.requiredCount,O.requiredCompleted,O.total,O.completed,O.pending,O.blocked,O.lines.map(e=>[e.uid,e.config.formId,e.ids]),N]);(0,eN.useEffect)(()=>{var e,t;null==(e=(t=h.current).onStateChange)||e.call(t,O)},[H]);let V=JSON.stringify(O.lines.map(e=>[e.uid,e.config.formId]));(0,eN.useEffect)(()=>{if(!s||!D)return;let e=new Set;for(let t of O.lines){let l=String(t.config.formId);e.has(l)||(e.add(l),c.prepareHolderOptionsForSource(t.cacheItem).catch(e=>{B()&&k(e0_(e,q("Unable to load holder profiles.","无法加载持票人档案。")))}))}},[D,E,V,s]),(0,eN.useImperativeHandle)(t,()=>({validate:async()=>{let e=eJK(h.current.context),t=eJX(h.current.context.sales.bookingTicket,eJQ(h.current.context,h.current.scopeKey));return!B()||f.current||M||$||t||!e.complete?(w(!0),k(t?q("A holder update could not be confirmed. Review the order before making another change.","持票人写回结果未确认,请先核对订单,勿重复修改。"):q("Complete the required holder details before continuing.","请先完成必填持票人资料。")),requestAnimationFrame(()=>{var e,t;return null==(t=b.current)||null==(e=t.querySelector('[aria-invalid="true"]'))?void 0:e.focus()}),!1):(k(void 0),!0)}}));let U=(e,t)=>{let l;if(!B(e))return;let i=eJK(h.current.context,h.current.scopeKey);if(i.blocked)return;let a=t&&i.lines.find(e=>e.uid===t.uid),n=e04(i.lines).reduce((e,t)=>e.concat(t.members),[]);for(let e of a?[a,...n.filter(e=>e.config.required&&e.uid!==a.uid)]:n.filter(e=>e.config.required)){let i=(null==t?void 0:t.uid)===e.uid?t.ids:R(e)||e.ids,a=Array.from({length:e.quantity},(e,t)=>i[t]).findIndex(e=>null==e||""===e);if(a>=0){l={uid:e.uid,index:a};break}}let r=l;m(()=>{var t;return!B(e)||f.current||h.current.disabled||!b.current?null:r?Array.from(b.current.querySelectorAll("[data-venue-holder-line]")).find(e=>e.dataset.venueHolderLine===r.uid&&e.dataset.venueHolderIndex===String(r.index)):Array.from((null==(t=b.current.closest(".booking-page"))?void 0:t.querySelectorAll(".booking-primary-action"))||[]).find(eKS)},{block:r?"start":"nearest"})},Y=async function(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:E;if(!D||f.current||d||!B(i)||eJX(D,i))return;let a=e_j(D,e);if(!a)return void k(q("This ticket changed. Please review the order.","该门票已变化,请重新核对订单。"));let r=eJK(h.current.context).lines.find(t=>t.uid===e);if(!r||!Number.isInteger(t)||t<0||t>=r.quantity)return;let o=JSON.stringify([a.orderLine,a.booking]),s=[...R(r)||r.ids];if(s[t]=l,r.quantity>1&&Array.from({length:r.quantity},(e,t)=>s[t]).some(e=>null==e||""===e)){C(t=>({...t,[e]:{base:L(r),ids:s}})),U(i,{uid:e,ids:s});return}let u=s.slice(0,r.quantity).filter(e=>void 0!==e&&""!==e).map(Number);if(u.some(e=>!Number.isSafeInteger(e)||e<=0))return void k(q("The holder profile ID is invalid.","档案编号无效。"));f.current=!0,j(e),k(void 0);let p=!1,m=()=>{let t=e_j(D,e);if(!B(i)||!t||!p&&JSON.stringify([t.orderLine,t.booking])!==o)throw Error(q("The order changed. Please review its holders again.","订单已变化,请重新核对持票人。"))};try{var g,y,b,x;let t=null==(g=a.orderLine.metadata)?void 0:g.venue_booking_role;if(a.booking&&("tickets"===t||"party_main"===t))await e00({handle:D,line:a,holderIds:u,holderOptions:c.getHolderOptionsForSource(a.cacheItem),assertCurrent:m,beforeWrite:()=>{m(),p=!0}});else{let e=new Proxy(D,{get(e,t){let l=Reflect.get(e,t);return"addProductToOrder"===t&&"function"==typeof l?function(){for(var t=arguments.length,i=Array(t),a=0;a<t;a++)i[a]=arguments[a];return m(),p=!0,l.apply(e,i)}:"function"==typeof l?l.bind(e):l}});await e_f({line:a,bookingTicket:e,tempOrder:(null==(y=D.getTempOrder)?void 0:y.call(D))??n.sales.tempOrder,openHolderSelect:async()=>(m(),u),updateItem:async e=>(m(),p=!0,n.cart.updateItem(e)),getHolderOptions:()=>c.getHolderOptionsForSource(a.cacheItem),getHolderFormDetail:()=>c.getHolderFormDetailForSource(a.cacheItem)})}B(i)&&(C(t=>{let l={...t};return delete l[e],l}),n.cart.refreshCartSnapshot(),await (null==(b=(x=h.current).onMutation)?void 0:b.call(x)),B(i)&&(A(e=>e+1),U(i)))}catch(e){p&&function(e,t){let l=eJZ.get(e)||new Set;l.add(t),eJZ.set(e,l);try{sessionStorage.setItem(eJJ(t),"1")}catch{}}(D,i),B(i)&&k(e0_(e,q("Unable to update the holder.","持票人写回失败。")))}finally{f.current=!1,v.current&&j(void 0)}},W=async e=>{let t=await c.prepareHolderOptionsForSource(e.cacheItem,{refresh:!0});return t.accessAllowed&&B()?t.options:[]},G=async e=>{var t;let l;if(!M||!B(M.identity))return;let i=eJK(h.current.context).lines.find(e=>e.uid===M.uid);if(!i||L(i)!==M.base||String(i.config.formId)!==String(M.formId)||M.index>=i.quantity)return;let a=Number.isSafeInteger(l=Number((t=e.record).form_record_id??t.id??t.record_id))&&l>0?l:void 0;e.linkedWaiver||null==a||c.upsertHolderOptions([{...e.record,form_record_id:a}],i.cacheItem);let n=await W(i);y.current=!0;let r=e.linkedWaiver?void 0:a;if(e.linkedWaiver){let t=e.record.form_to_form_value,l=(Array.isArray(t)?t:[]).find(e=>String(null==e?void 0:e.form_id)===String(M.formId)),i=Array.isArray(null==l?void 0:l.form_data_value)?l.form_data_value:[];1===i.length&&n.some(e=>String(e.id)===String(i[0]))&&(r=i[0])}let o=eJK(h.current.context).lines.find(e=>e.uid===M.uid);null!=r&&o&&L(o)===M.base&&B(M.identity)&&await Y(M.uid,M.index,r,M.identity)},K=async(e,t)=>{if(d||O.blocked||f.current||!e.config.formId||eJ2(D,`${E}:${e.config.formId}`))return;f.current=!0,j(e.uid);let l=!1;try{if(eKz(n,{products:[e.cacheItem],force:!0})){var i;let a=eKA((null==D||null==(i=D.getTempOrder)?void 0:i.call(D))??n.sales.tempOrder),o=()=>{var e;return v.current&&!1!==h.current.isActive&&h.current.scopeKey===r&&h.current.context.sales.bookingTicket===D&&eKA((null==D||null==(e=D.getTempOrder)?void 0:e.call(D))??h.current.context.sales.tempOrder)===a};if(!await eKL({context:n,products:[e.cacheItem],force:!0,openCustomerAuth:p,isCurrent:o})||!o())return;l=!0,P({uid:e.uid,index:t,handle:D,scopeKey:r,owner:a,customerId:String(eKO(n))});return}(await c.prepareHolderOptionsForSource(e.cacheItem)).accessAllowed&&B()&&(y.current=!1,T({uid:e.uid,index:t,identity:E,base:L(e),formId:e.config.formId}))}catch(e){B()&&k(e0_(e,q("Unable to open the holder form.","无法打开持票人表单。")))}finally{f.current=!1,v.current&&!l&&j(void 0)}},Q=async(e,t)=>{var l;let i=h.current.onRemoveTicket;if(!i||d||f.current||M||O.blocked||!B(E)||1!==e.quantity||0!==t||(null==(l=e.orderLine.metadata)?void 0:l.venue_booking_role)!=="tickets")return;let a=eJK(h.current.context).displayLines.find(t=>t.uid===e.uid);if(a&&L(a)===L(e)){f.current=!0,j(e.uid),k(void 0);try{await i(e.uid,t)&&B(E)&&C(t=>{let l={...t};return delete l[e.uid],l})}catch(e){B(E)&&k(e0_(e,q("Unable to remove this ticket. Please try again.","无法删除这张票,请重试。")))}finally{f.current=!1,v.current&&j(void 0)}}},Z=O.lines.reduce((e,t)=>e+(t.config.required?Math.min(t.quantity,(R(t)||t.ids).filter(e=>null!=e&&""!==e).length):0),0),J=e=>e01(c.getHolderFormDetailForSource(e.cacheItem),o),X=function(t){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=J(t);return Array.from({length:t.quantity},(a,n)=>{var r;let o=c.getHolderOptionsForSource(t.cacheItem),s=0===o.length,u=(R(t)||t.ids)[n],p=null==u?void 0:o.find(e=>String(e.id)===String(u)),m=`${g}-${t.uid}-${n}`,h=_&&t.config.required&&null==u;return(0,eB.jsxs)("div",{className:"child-ticket","data-venue-holder-line":t.uid,"data-venue-holder-index":n,children:[(0,eB.jsx)(e0V,{layout:"row",icon:(0,eB.jsx)(eKq,{size:20,"aria-hidden":"true"}),title:`${t.title||q("Ticket","门票")} #${l+n+1}`,removeAction:e.onRemoveTicket&&1===t.quantity&&(null==(r=t.orderLine.metadata)?void 0:r.venue_booking_role)==="tickets"?{label:`${q("Remove ticket","删除门票")} ${t.title||q("Ticket","门票")} #${l+n+1}`,disabled:d||!!S||!!M||O.blocked||c.loading,onClick:()=>{Q(t,n)}}:void 0}),t.config.enabled&&(0,eB.jsxs)("div",{className:"holder-picker",children:[(0,eB.jsxs)("label",{className:"field",htmlFor:m,children:[(0,eB.jsx)("span",{children:i.choose}),(0,eB.jsxs)("select",{id:m,value:null==u?"":String(u),disabled:d||!!S||!!M||O.blocked||s,style:s?{opacity:.5,cursor:"not-allowed"}:void 0,"aria-invalid":h||void 0,"aria-describedby":h?`${m}-error`:void 0,onChange:e=>{e.target.value&&Y(t.uid,n,e.target.value)},children:[(0,eB.jsx)("option",{value:"",disabled:!0,children:i.placeholder}),null!=u&&!p&&(0,eB.jsx)("option",{value:String(u),children:String(u)}),o.map(e=>(0,eB.jsx)("option",{value:String(e.id),children:e.label||String(e.id)},String(e.id)))]})]}),h&&(0,eB.jsx)("p",{id:`${m}-error`,className:"error-text",role:"alert",children:i.missing}),(0,eB.jsxs)(eKQ,{secondary:!0,disabled:d||!!S||!!M||O.blocked||eJ2(D,`${E}:${t.config.formId}`),onClick:()=>void K(t,n),children:[(0,eB.jsx)(e0O,{size:18,"aria-hidden":"true"}),(0,eB.jsx)("span",{children:i.create})]})]})]},m)})},ee=(0,eB.jsxs)(eB.Fragment,{children:[$&&(0,eB.jsxs)("p",{className:"small muted",children:[q("Choose a profile for each ticket in this group to save the assignments together.","请为该组每张票选择档案,系统会一并保存,保留全部票数。")," ",(0,eB.jsx)("button",{type:"button",className:"text-link",disabled:!!S||!!M,onClick:()=>C({}),children:q("Discard unsaved choices","撤销未保存选择")})]}),(x||O.blocked)&&(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:x||q("A previous holder update is unconfirmed. Review the order before continuing.","上次持票人写回结果未确认,请先核对订单。")})]});return(0,eB.jsxs)("div",{ref:b,className:"venue-booking-holder-step",children:[e.renderContent?(0,eB.jsxs)(eB.Fragment,{children:[ee,e.renderContent({renderLine:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l=O.lines.find(t=>t.uid===e);return l?c.loading?(0,eB.jsx)("div",{className:"venue-holder-skeleton",role:"status","aria-busy":"true","aria-label":q("Loading holder profiles","正在加载持票人档案"),children:(0,eB.jsx)("div",{className:"holder-picker","aria-hidden":"true",children:(0,eB.jsx)("span",{className:"venue-holder-skeleton-field"})})}):(0,eB.jsx)("div",{className:"child-assignments",children:X(l,t)}):null}})]}):(0,eB.jsxs)(e0W,{children:[(0,eB.jsxs)("div",{className:"completion-bar",children:[(0,eB.jsx)(eZu,{size:23,"aria-hidden":"true"}),(0,eB.jsx)("b",{children:O.requiredCount?`${Z}/${O.requiredCount} ${q("completed","已完成")}`:q("Holder profiles are optional","持票人档案选填")}),O.requiredCount>0&&(0,eB.jsx)("progress",{"aria-label":q("Completed","已完成"),value:Z,max:O.requiredCount})]}),ee,c.loading?(0,eB.jsx)("div",{className:"venue-holder-skeleton",role:"status","aria-busy":"true","aria-label":q("Loading holder profiles","正在加载持票人档案"),children:z.map(e=>(0,eB.jsxs)("div",{className:"cart-group","aria-hidden":"true",children:[(0,eB.jsx)("span",{className:"venue-holder-skeleton-title"}),(0,eB.jsx)("span",{className:"venue-holder-skeleton-text"}),(0,eB.jsxs)("div",{className:"holder-picker",children:[(0,eB.jsx)("span",{className:"venue-holder-skeleton-field"}),(0,eB.jsx)("span",{className:"venue-holder-skeleton-field"})]})]},e.key))}):z.map(t=>{var l,i,a,n,r,s,d,c;let u=t.members[0],p=J(u),m=u.orderLine,g=t.members.reduce((e,t)=>e+t.quantity,0),h=null==(l=e.catalogProducts)?void 0:l.find(e=>String(e.id)===String(u.orderLine.product_id)),v=e0X(u.orderLine,g,o||"en",h,u.cacheItem),f=0,y=t.members.map(e=>{let t=X(e,f);return f+=e.quantity,t});return(0,eB.jsxs)("section",{className:"cart-group",children:[(0,eB.jsx)(e0V,{className:"booking-order-item-flat",title:u.title||q("Ticket","门票"),image:eKT(u.cacheItem.cover||(null==(i=u.cacheItem._extend)?void 0:i.product_cover)||m.product_cover,o||"en")||void 0,details:(0,eB.jsxs)("div",{className:"booking-item-metadata",children:[(null==(a=u.booking)?void 0:a.start_date)&&(0,eB.jsxs)("div",{children:[(0,eB.jsx)(eQv,{size:16,"aria-hidden":"true"}),eQM((null==(n=u.booking.metadata)?void 0:n.availability_business_date)||u.booking.start_date,o||"en")]}),(null==(r=u.booking)?void 0:r.start_time)&&(0,eB.jsxs)("div",{children:[(0,eB.jsx)(e0$,{size:16,"aria-hidden":"true"}),u.booking.start_time,"–",u.booking.end_time]}),((null==(s=u.booking)?void 0:s.resources)||[]).length>0&&(0,eB.jsx)("div",{children:u.booking.resources.map(e=>{var t;return eKT((null==(t=e.metadata)?void 0:t.resource_name)||e.title||e.name||e.resource_name,o||"en")}).filter(Boolean).join(" \xb7 ")}),(u.cacheItem.product_option_string||(null==(d=u.cacheItem._extend)?void 0:d.product_option_string)||m.product_option_string)&&(0,eB.jsx)("div",{children:eKT(u.cacheItem.product_option_string||(null==(c=u.cacheItem._extend)?void 0:c.product_option_string)||m.product_option_string,o||"en")}),(0,eB.jsx)("div",{children:u.config.enabled?u.config.required?p.required:p.optional:p.notRequired})]}),children:v.length>0&&(0,eB.jsx)("ul",{className:"venue-order-bundle","aria-label":q("Included items","套餐内含商品"),children:v.map(e=>(0,eB.jsxs)("li",{children:[(0,eB.jsx)("span",{children:e.name||q("Included item","套餐子商品")}),(0,eB.jsxs)("span",{children:["\xd7 ",e.quantity]})]},e.key))})}),(0,eB.jsx)("div",{className:"child-assignments",children:y})]},t.key)}),e.afterAssignments]}),M&&B(M.identity)&&(0,eB.jsx)(e02,{formId:M.formId,customerId:UT(null==D||null==(l=D.getTempOrder)?void 0:l.call(D),void 0,null==D||null==(a=D.getOrderCustomerSnapshot)||null==(i=a.call(D))?void 0:i.id),locale:o,isCurrent:()=>B(M.identity),onClose:()=>{T(void 0),y.current||c.reload()},onCreated:G,onUnconfirmed:()=>{var e;let t;D&&(e=`${M.identity}:${M.formId}`,(t=eJ0.get(D)||new Set).add(e),eJ0.set(D,t)),k(q("The profile save result is unconfirmed. Reload this page to check the profiles before creating another one.","档案保存结果未确认,请刷新页面核对档案后再尝试新建。"))}})]})});e03.displayName="VenueBookingHolderStep";let e08=["first_name","last_name","phone","email"],e06=e=>e&&"object"==typeof e&&!Array.isArray(e)?e:{},e05=e=>JSON.parse(JSON.stringify(e)),e07=e=>JSON.stringify(e06(e));function e09(e){var t,l;let i=e.context.sales.bookingTicket,a=(null==i||null==(t=i.getTempOrder)?void 0:t.call(i))??e.context.sales.tempOrder;return{handle:i,scopeKey:e.scopeKey,identity:(null==a||null==(l=a._extend)?void 0:l.localId)||(null==a?void 0:a.external_sale_number)||(null==a?void 0:a.order_id)||a,customer:String((null==a?void 0:a.customer_id)||""),order:a}}let e2e=(e,t)=>!!e&&e.handle===t.handle&&e.scopeKey===t.scopeKey&&e.identity===t.identity&&e.customer===t.customer,e2t=(0,eN.forwardRef)((e,t)=>{var l;let[i]=eM.Form.useForm(),[a,n]=(0,eN.useState)(),[r,o]=(0,eN.useState)(!1),s=(0,eN.useRef)(e);s.current=e;let d=(0,eN.useRef)(!0),c=(0,eN.useRef)(0),u=(0,eN.useRef)(!1),p=(0,eN.useRef)(),m=e09(e),g=e07(null==(l=m.order)?void 0:l.contacts_info),h=JSON.stringify(e.config),v=String(e.locale).startsWith("zh"),f=(e,t)=>v?t:e,y=e=>({first_name:f("Enter a first name.","请输入名字。"),last_name:f("Enter a last name.","请输入姓氏。"),phone:f("Enter a phone number.","请输入电话号码。"),email:f("Enter an email address.","请输入邮箱。")})[e];(0,eN.useEffect)(()=>(d.current=!0,()=>{d.current=!1,c.current+=1}),[]),(0,eN.useLayoutEffect)(()=>{var e,t,l,a;let r=!e2e(null==(e=p.current)?void 0:e.owner,m);if(r||(null==(t=p.current)?void 0:t.contact)!==g){let e,t;c.current+=1,r&&(i.resetFields(),n(void 0)),i.setFieldsValue((a=e06(null==(l=m.order)?void 0:l.contacts_info),t=String((e=e06(a.phone)).country_calling_code||""),{first_name:a.first_name||"",last_name:a.last_name||"",email:a.email||"",phone:{phone:e.phone||"",countryCallingCode:t&&!t.startsWith("+")?`+${t}`:t,countryCode:e.country_code||""}})),p.current={owner:m,contact:g}}},[m.handle,m.identity,m.customer,e.scopeKey,g,i]);let b=(e,t)=>{let l=s.current,i=e09(l);if(!d.current||!1===l.isActive||!e2e(t,i)||!i.order)return!1;let a=e06(i.order.contacts_info),n=function(e,t,l){let i=e05(t);for(let o of e08){var a,n,r;!1!==l.fields[o].visible&&(i[o]="phone"===o?{...e06(t.phone),phone:(null==(a=e.phone)?void 0:a.phone)||"",country_calling_code:(null==(n=e.phone)?void 0:n.countryCallingCode)||"",country_code:(null==(r=e.phone)?void 0:r.countryCode)||""}:e[o]||"")}return(i.first_name!==t.first_name||i.last_name!==t.last_name)&&(i.display_name=[i.first_name,i.last_name].filter(Boolean).join(" ")),i}(e,a,l.config);if(e07(n)===e07(a))return!0;let r=e05(n);return p.current={owner:i,contact:e07(r)},p.current={owner:i,contact:e07(l.context.sales.setContactsInfo(r))},!0};return(0,eN.useImperativeHandle)(t,()=>({validate:async()=>{var e,t,l,a,r;if(u.current||!d.current||!1===s.current.isActive)return!1;if(!s.current.config.enabled)return!0;if((null==(e=s.current.context.sales.contactInfo)?void 0:e.loading)||(null==(t=s.current.context.sales.contactInfo)?void 0:t.pending))return!1;let p=e09(s.current);if(!(null==(l=p.handle)?void 0:l.validateContactInfo)||!p.order)return n(f("Contact details are not ready. Please retry.","联系人信息尚未就绪,请重试。")),!1;let m=++c.current,g=JSON.stringify(s.current.config),h=e07(p.order.contacts_info),v=()=>{var e;return d.current&&m===c.current&&!1!==s.current.isActive&&e2e(p,e09(s.current))&&JSON.stringify(s.current.config)===g&&e07(null==(e=e09(s.current).order)?void 0:e.contacts_info)===h};u.current=!0,o(!0),n(void 0);try{let e=await i.validateFields();if(!v())return!1;let t=e08.filter(t=>{var l;let i=s.current.config.fields[t],a="phone"===t?null==(l=e.phone)?void 0:l.phone:e[t];return i.visible&&i.required&&("string"!=typeof a||!a.trim())});if(t.length)return i.setFields(t.map(e=>({name:e,errors:[y(e)]}))),!1;if(!b(e,p)||(h=e07(null==(a=e09(s.current).order)?void 0:a.contacts_info),!v()))return!1;return await p.handle.validateContactInfo(),v()}catch(e){if(!v())return!1;return"CONTACT_INFO_REQUIRED"===e.code&&Array.isArray(e.fields)?i.setFields(e.fields.filter(e=>e08.includes(e)).map(e=>({name:e,errors:[y(e)]}))):(null==(r=e.errorFields)?void 0:r.length)||n(e.message||f("Unable to validate contact details. Please retry.","无法校验联系人信息,请重试。")),!1}finally{u.current=!1,d.current&&o(!1)}}}),[i,h,e.locale]),(0,eB.jsxs)("div",{className:"venue-contact-form","aria-busy":r,children:[(0,eB.jsx)(eeY,{config:e.config.fields,form:i,disabled:e.disabled||r||!1===e.isActive,onValuesChange:(e,t)=>{if(!s.current.disabled&&!1!==s.current.isActive&&s.current.config.enabled&&!u.current){c.current+=1,n(void 0);try{b(t,m)}catch(e){n(e instanceof Error?e.message:f("Unable to save contact details.","无法保存联系人信息。"))}}}}),a&&(0,eB.jsx)("p",{className:"venue-contact-form__error",role:"alert",children:a})]})});function e2l(e){let{policyId:t,title:l,request:i,locale:a,accepted:n=!1,onClose:r,onConfirm:o,onLoadError:s}=e,d=String(a||"").startsWith("zh");return(0,eB.jsx)(Vi,{open:!0,item:{id:t,title:l},isHideCheckout:!1,initialAccepted:n,depositProtocolRequest:i,onCancel:r,onConfirm:o,onLoadError:s,renderDialog:e=>{let{title:t,body:l,footer:i}=e;return(0,eB.jsx)(eQu,{title:t,className:"venue-policy-modal",mobile:"fullscreen",zIndex:600,closeLabel:d?"关闭":"Close",onClose:r,bodyClassName:"venue-policy-body venue-booking-legacy-controls",footerClassName:"venue-policy-footer venue-booking-legacy-controls",footer:i,children:l})}})}function e2i(e){let{title:t,resourceTitle:l,saved:i,open:a,disabled:n,busy:r,locale:o,onOpen:s,onClose:d,children:c,footer:u}=e,p=String(o||"").startsWith("zh"),m=r?p?"正在保存…":"Saving…":i?p?"已保存":"Saved":p?"未保存":"Not saved",g=i?p?"编辑资料":"Edit details":p?"填写资料":"Fill in details";return(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)("button",{type:"button",className:`checkout-agreement venue-resource-form-entry${i?" accepted":""}`,"data-accepted":i,"aria-haspopup":"dialog","aria-expanded":a,"aria-label":`${g} \xb7 ${t} \xb7 ${m}`,disabled:n,onClick:s,children:[(0,eB.jsx)("span",{className:"agreement-state","aria-hidden":"true",children:i&&(0,eB.jsx)(eZR,{size:15,weight:"bold"})}),(0,eB.jsxs)("span",{className:"agreement-copy",children:[(0,eB.jsx)("b",{children:t}),(0,eB.jsxs)("small",{children:[l&&l!==t?`${l} \xb7 `:"",m]})]}),(0,eB.jsxs)("span",{className:"agreement-open","aria-hidden":"true",children:[(0,eB.jsx)("span",{children:g}),(0,eB.jsx)(eZF,{size:15})]})]}),(0,eB.jsx)(eQu,{title:t,className:"venue-resource-form-modal",mobile:"fullscreen",zIndex:600,open:a,onClose:d,closeLabel:p?"关闭":"Close",closeOnBackdrop:!r,closeOnEscape:!r,externalDialogSelector:eQd,bodyClassName:"venue-resource-form-body",footerClassName:"venue-resource-form-footer",footer:u,children:c})]})}let e2a="venue_booking_form_records";function e2n(e){return[...new Set((e.resources||[]).map(e=>String(e.relation_id??e.resource_id??e.id??"")).filter(e=>e&&"0"!==e))]}function e2r(e,t){var l;if(!t||!e.formId||!e2n(t).includes(e.resourceId))return;let i=(null==(l=t.metadata)?void 0:l[e2a])||{};return[i[e.key],...Object.values(i)].find(l=>l&&String(l.resourceId)===e.resourceId&&Number(l.formId)===e.formId&&/^\d+$/.test(String(l.recordId))&&Number(l.recordId)>0&&(t.relation_forms||[]).some(t=>Number(t.form_id)===e.formId&&Array.isArray(t.form_record_ids)&&t.form_record_ids.some(e=>String(e)===String(l.recordId))))}function e2o(e,t){for(let l of e.members){let e=e2r(l,t(l.bookingUid));if(e)return e}}function e2s(e,t){if(!e.formId)return!0;let l=e2o(e,t);return!!l&&e.members.every(e=>{var i;return String(null==(i=e2r(e,t(e.bookingUid)))?void 0:i.recordId)===String(l.recordId)})}async function e2d(e,t,l){var i,a;let n=t=>{l.assertCurrent();let i=l.readBooking(t.bookingUid);if(!i||!e2n(i).includes(e.resourceId))throw Error("The booking resource changed. Please review its details again.");return i};for(let i of(e.members.forEach(n),e.members)){let r=n(i),o=(null==(a=r.metadata)?void 0:a[e2a])||{},s=new Set,d={...o};for(let[t,l]of Object.entries(o))String(null==l?void 0:l.resourceId)===e.resourceId&&Number(null==l?void 0:l.formId)===e.formId&&(s.add(String(l.recordId)),delete d[t]);for(let t of Object.values(d))Number(null==t?void 0:t.formId)===e.formId&&s.delete(String(t.recordId));let c=(r.relation_forms||[]).map(t=>({...t,form_record_ids:[...t.form_record_ids||[]].filter(l=>Number(t.form_id)!==e.formId||!s.has(String(l)))})),u=c.find(t=>Number(t.form_id)===e.formId);u||(u={form_id:e.formId,form_record_ids:[]},c.push(u)),u.form_record_ids.some(e=>String(e)===String(t.recordId))||u.form_record_ids.push(t.recordId),await l.updateBooking({unique_identification_number:i.bookingUid,updates:{relation_forms:c,metadata:{[e2a]:{...d,[i.key]:t}}}})}if(l.assertCurrent(),!e2s(e,l.readBooking)||String(null==(i=e2o(e,l.readBooking))?void 0:i.recordId)!==String(t.recordId))throw Error("The saved form could not be linked to every booking. Please retry.")}function e2c(e){var t,l,i;let a=(null==(l=e.context.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.context.sales.tempOrder;return JSON.stringify([e.scopeKey,(null==a||null==(i=a._extend)?void 0:i.localId)||(null==a?void 0:a.external_sale_number)||(null==a?void 0:a.order_id),null==a?void 0:a.customer_id])}function e2u(e){var t,l;let i=(null==(l=e.context.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.context.sales.tempOrder;return JSON.stringify([e2c(e),((null==i?void 0:i.bookings)||[]).map(e=>{var t;return[null==(t=e.metadata)?void 0:t.unique_identification_number,e.start_date,e.start_time,e.end_date,e.end_time,e2n(e)]})])}let e2p=(0,eN.forwardRef)((e,t)=>{var l,i,a,n,r;let{context:o,locale:s,disabled:d=!1,isActive:c=!0,includeHolderValidation:u=!0}=e,p=dL("venue-review"),m=(0,eN.useRef)(null),g=eKB(),h=(0,eN.useRef)(null),v=(0,eN.useRef)(null),f=(0,eN.useRef)(e);f.current=e;let y=(0,eN.useRef)(!0),[b]=YK({components:["FormCard"]}),x=(0,eN.useRef)({}),k=(0,eN.useRef)(new Set),_=(0,eN.useRef)(new Set),[w,S]=(0,eN.useState)([]),[j,N]=(0,eN.useState)("loading"),[C,M]=(0,eN.useState)(null),[T,I]=(0,eN.useState)(null),[P,A]=(0,eN.useState)(null),[D,E]=(0,eN.useState)(null),[O,z]=(0,eN.useState)({}),[L,R]=(0,eN.useState)({}),[$,F]=(0,eN.useState)(),[q,B]=(0,eN.useState)({}),H=(0,eN.useRef)(),[V,U]=(0,eN.useState)(0),[,Y]=(0,eN.useState)(0),W=e2u(e),G=(0,eN.useRef)(),K=String(s||"").startsWith("zh"),Q=(e,t)=>K?t:e,Z=e=>{var t,l;return eKT(null==(l=e.policyResponse)||null==(t=l.data)?void 0:t.title,s||"en").trim()||Q("Agreement","协议")},J=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:W;return y.current&&!1!==f.current.isActive&&e2u(f.current)===e},X=e=>{var t,l,i,a;return null==(a=f.current.context.sales.bookingTicket)||null==(i=a.getTempOrder)||null==(l=i.call(a))||null==(t=l.bookings)?void 0:t.find(t=>{var l;return String((null==(l=t.metadata)?void 0:l.unique_identification_number)||"")===e})},ee=e=>!k.current.has(e.key)&&e2s(e,X),et=e=>{let t=()=>{J(W)&&g(()=>J(W)&&m.current?e(m.current):null,{block:"center"})};f.current.onValidationBlocked?f.current.onValidationBlocked(t):t()},el=()=>et(e=>e.querySelector(".venue-confirmation-feedback"));(0,eN.useEffect)(()=>(y.current=!0,()=>{y.current=!1}),[]),(0,eN.useEffect)(()=>{let t=!1;G.current=void 0,N("loading"),M(null),I(null);let l=e2c(e);if(H.current!==l&&B({}),H.current=l,F(void 0),A(null),E(null),z({}),R({}),k.current.clear(),_.current.clear(),!c)return;let i=o.sales.bookingTicket;return(async()=>{var l,a,n,r,s;if(!i)throw Error(Q("Booking details are not ready.","预订详情尚未就绪。"));let d=(null==(a=i.getTempOrder)||null==(l=a.call(i))?void 0:l.bookings)||[],c=[],u=new Map,p=new Map,m=new Map;for(let t of d){let l=String(t.start_date||e.date||"").slice(0,10),i=e2n(t);if(!i.length)continue;let a=m.get(l)||new Set;i.forEach(e=>a.add(e)),m.set(l,a)}for(let l of d){let a=e2n(l);if(!a.length)continue;let r=String((null==(n=l.metadata)?void 0:n.unique_identification_number)||""),o=String(l.start_date||e.date||"").slice(0,10);if(!r||!/^\d{4}-\d{2}-\d{2}$/.test(o))throw Error(Q("Unable to load the booking resource forms.","无法读取预订资源的关联表单。"));if("function"!=typeof i.queryBookingResourceDetails)throw Error(Q("The booking service needs to be updated before resource forms can be loaded.","预订服务需要更新后才能读取资源关联表单。"));if(u.has(o)||u.set(o,await i.queryBookingResourceDetails({date:o,resourceIds:[...m.get(o)||[]]})),t||!J())return;let s=u.get(o)||[];for(let e of a){let l=s.find(t=>String(t.id)===e);if(!l)throw Error(Q("A selected resource is no longer available. Please reselect it.","无法读取已选资源,请重新选择。"));let a=l.resource_form_id,n=Number(a);if(a&&(!Number.isSafeInteger(n)||n<=0))throw Error(Q("The resource form configuration is invalid.","资源关联表单配置无效。"));let o=l.policy_id?String(l.policy_id):void 0;if(o&&!p.has(o)){let e=i.getProtocol;if(!e)throw Error(Q("Unable to load the resource policy. Please retry.","无法加载资源协议,请重试。"));let l=function(e){if(!e||"object"!=typeof e||Array.isArray(e)||200!==e.code||!e.data||"string"!=typeof e.data.content)return{status:"invalid"};let t=e.data.content;if(!t.trim())return{status:"empty"};if("u">typeof DOMParser){let l=new DOMParser().parseFromString(t,"text/html").body;if(l.querySelector("img, picture, svg, video, audio, iframe, object, embed, canvas, math, hr, input, select, textarea, button")||Array.from(l.querySelectorAll("[style]")).some(e=>/background(?:-image)?\s*:[^;]*url\s*\(/i.test(e.getAttribute("style")||"")))return{status:"ready",response:e};if(l.querySelectorAll("script, style, template, noscript").forEach(e=>e.remove()),!(l.textContent||"").replace(/[\s\u200b-\u200d\u2060\ufeff]/g,""))return{status:"empty"}}return{status:"ready",response:e}}(await e.call(i,o));if(t||!J())return;if("invalid"===l.status)throw Error(Q("Unable to load the resource policy. Please retry.","无法加载资源协议,请重试。"));p.set(o,"ready"===l.status?l.response:void 0)}let d=o?p.get(o):void 0;(n>0||d)&&c.push({key:`${r}:${e}:${n||""}:${o||""}`,bookingUid:r,resourceId:e,title:String(l.main_field||l.name||e),...n>0?{formId:n}:{},...d?{policyId:o,policyResponse:d}:{}})}}if(!t&&J()){let e=function(e){let t=new Map;for(let l of e){let e=JSON.stringify([l.resourceId,l.formId??null,l.policyId??null]),i=t.get(e);if(i)i.members.some(e=>e.key===l.key)||i.members.push(l);else{let{bookingUid:i,...a}=l;t.set(e,{...a,key:e,members:[l]})}}return[...t.values()]}(c),l=!1;for(let a of e){let e=e2o(a,X);if(!(!e||e2s(a,X))&&1===new Set(a.members.map(e=>e2r(e,X(e.bookingUid))).filter(Boolean).map(e=>String(e.recordId))).size){if(!i.updateOrderBooking)throw Error(Q("Unable to save the form.","表单保存失败。"));await e2d(a,e,{readBooking:X,updateBooking:e=>i.updateOrderBooking(e),assertCurrent:()=>{if(t||!J())throw Error(Q("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"))}}),l=!0}}if(t||!J()||(l&&(o.cart.refreshCartSnapshot(),await (null==(r=(s=f.current).onMutation)?void 0:r.call(s))),t||!J()))return;S(e),B(t=>(function(e,t){let l={};for(let a of e){var i;let e=t[a.key];(null==e?void 0:e.status)==="confirmed"&&a.policyId&&String(e.policyId)===a.policyId&&e.policy&&(null==(i=a.policyResponse)?void 0:i.data)&&JSON.stringify(e.policy)===JSON.stringify(a.policyResponse.data)&&(l[a.key]=e)}return l})(e,t)),G.current=W,N("ready")}})().catch(e=>{!t&&J()&&(M(e0_(e,Q("Unable to load the booking resource forms. Please retry.","无法加载预订资源的关联表单,请重试。"))),N("error"))}),()=>{t=!0}},[o.sales.bookingTicket,W,c,V]);let ei=async()=>{var e;let t=o.sales.contactInfo;if(!J())return!1;if(!(null==t?void 0:t.config)||t.loading||t.pending)return M(Q("Wait for the contact details to load and save.","请等待联系人信息加载并保存完成。")),el(),!1;if(!t.config.enabled)return!0;let l=await (null==(e=v.current)?void 0:e.validate());return!!J()&&(!0!==l?(I({section:"contact",message:Q("Check your contact details before continuing.","请检查联系人信息后继续。")}),et(e=>e.querySelector('.contact-section input[aria-invalid="true"], .contact-section select[aria-invalid="true"], .contact-section textarea[aria-invalid="true"], .contact-section .pisell-lowcode-form-item-has-error, .contact-section .ant-form-item-has-error')||e.querySelector(".contact-section")),!1):(I(e=>(null==e?void 0:e.section)==="contact"?null:e),!0))};(0,eN.useImperativeHandle)(t,()=>({validateContact:ei,validate:async()=>{var e;if(!J())return!1;if(G.current!==W||"ready"!==j||P)return M(Q("Wait for the confirmation details to load and save.","请等待确认资料加载并保存完成。")),el(),!1;let t=w.filter(e=>e.formId).findIndex(e=>!b||!_.current.has(e.key)||!ee(e));if(t>=0)return I({section:"resources",message:Q("Complete and save each resource form before continuing.","请先填写并保存每项资源关联表单。")}),et(e=>e.querySelectorAll(".venue-resource-form-entry")[t]||null),!1;let l=w.filter(e=>e.policyId).findIndex(e=>!q[e.key]);return l>=0?(I({section:"agreements",message:Q("Read and agree to each resource policy before continuing.","请先阅读并同意各项资源协议。")}),et(e=>e.querySelectorAll(".venue-confirmation-agreements .checkout-agreement")[l]||null),!1):u&&!await (null==(e=h.current)?void 0:e.validate())?!!J()&&(M(Q("Complete the required holder details before continuing.","请先完成必填持票人资料。")),el(),!1):!!await ei()&&!!J()&&(M(null),I(null),!0)}}));let ea=async(e,t,l)=>{if(J())try{var i,a,n,r,o;if("success"!==t)throw Error(Q("Unable to save the form.","表单保存失败。"));let s=null==l?void 0:l.form_record_id;if(Number(null==l?void 0:l.form_id)!==e.formId||!s||!/^\d+$/.test(String(s)))throw Error(Q("The form did not return a saved record.","表单未返回有效的保存记录。"));let d=f.current.context.sales.bookingTicket;if(!(null==d?void 0:d.updateOrderBooking))throw Error(Q("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"));let c=JSON.parse(JSON.stringify((null==(n=x.current[e.key])||null==(a=n.form)||null==(i=a.getFieldsValue)?void 0:i.call(a))||{}));if(await e2d(e,{resourceId:e.resourceId,formId:e.formId,recordId:s,values:c},{readBooking:X,updateBooking:e=>d.updateOrderBooking(e),assertCurrent:()=>{if(!J())throw Error(Q("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"))}}),!J()||(k.current.delete(e.key),f.current.context.cart.refreshCartSnapshot(),await (null==(r=(o=f.current).onMutation)?void 0:r.call(o)),!J()))return;Y(e=>e+1),M(null),R(t=>({...t,[e.key]:""})),E(t=>t===e.key?null:t)}catch(t){if(J()){let l=e0_(t,Q("Unable to save the form. Please retry.","表单保存失败,请重试。"));M(l),R(t=>({...t,[e.key]:l}))}}finally{J()&&A(null)}};(null==(i=o.sales.bookingTicket)||null==(l=i.getTempOrder)?void 0:l.call(i))||o.sales.tempOrder;let en=eJK(o),er=e.orderReview??e.children,eo=0;return(0,eB.jsxs)("section",{ref:m,className:"venue-booking-confirmation checkout-modules","aria-label":Q("Booking details","预订资料"),children:[(null==(a=o.sales.contactInfo)?void 0:a.loading)?(0,eB.jsx)(eM.Spin,{}):null,(null==(r=o.sales.contactInfo)||null==(n=r.config)?void 0:n.enabled)&&(0,eB.jsxs)(e0z,{id:`${p}-contact`,number:++eo,title:Q("Contact details","联系人信息"),className:"contact-section",children:[(0,eB.jsx)(e2t,{ref:v,context:o,scopeKey:e.scopeKey,config:o.sales.contactInfo.config,disabled:d,isActive:c,locale:s}),(null==T?void 0:T.section)==="contact"&&(0,eB.jsx)("p",{className:"error-text",role:"alert",children:T.message})]}),er&&(0,eB.jsx)(e0z,{id:`${p}-order`,number:++eo,title:Q("Review your order","核对订单"),children:er}),u?(0,eB.jsx)("div",{hidden:!en.enabled,children:(0,eB.jsx)(e03,{ref:h,context:o,scopeKey:e.scopeKey,locale:s,isActive:c,disabled:d,onMutation:e.onMutation})}):e.holderContent,"loading"===j?(0,eB.jsx)(eM.Spin,{}):null,C?(0,eB.jsx)("div",{className:"venue-confirmation-feedback",children:(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:C,action:"error"===j?(0,eB.jsx)(eM.Button,{onClick:()=>U(e=>e+1),children:Q("Retry","重试")}):void 0})}):null,"ready"===j&&w.some(e=>e.formId)?(0,eB.jsxs)(e0z,{id:`${p}-resources`,number:++eo,title:Q("Form","表单"),children:[(null==T?void 0:T.section)==="resources"&&w.some(e=>e.formId&&(!b||!_.current.has(e.key)||!ee(e)))&&(0,eB.jsx)("p",{className:"error-text",role:"alert",children:T.message}),w.filter(e=>e.formId).map(e=>{var t;return(0,eB.jsxs)(e2i,{title:O[e.key]||e.title,resourceTitle:e.title,locale:s,saved:ee(e),open:D===e.key&&J(),disabled:d||!!(P&&P!==e.key),busy:P===e.key,onOpen:()=>{!J()||d||P&&P!==e.key||E(e.key)},onClose:()=>E(null),footer:(0,eB.jsx)(eKQ,{disabled:d||!!P||!_.current.has(e.key)||ee(e),busy:P===e.key,onClick:()=>{if(J()&&!d&&!P)try{var t,l,i;if(!(null==(t=x.current[e.key])?void 0:t.submit))throw Error(Q("The form is not ready.","表单尚未就绪。"));R(t=>({...t,[e.key]:""})),A(e.key),null==(i=x.current[e.key])||null==(l=i.submit)||l.call(i)}catch(l){let t=e0_(l,Q("Unable to save the form. Please retry.","表单保存失败,请重试。"));A(null),M(t),R(l=>({...l,[e.key]:t}))}},children:ee(e)?Q("Saved","已保存"):Q("Save details","保存资料")}),children:[L[e.key]&&(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:L[e.key]}),b?(0,eB.jsx)(eB.Fragment,{children:(0,eB.jsx)("div",{className:"venue-booking-legacy-controls",style:d||P?{pointerEvents:"none"}:void 0,children:(0,eB.jsx)(b,{id:e.formId,ref:t=>{x.current[e.key]=t},isGetLastData:!1,setting:{isHidden:1},isV2API:!0,isShowSkeleton:!0,isClearData:!1,defaultValues:null==(t=e2o(e,X))?void 0:t.values,onSubmit:(t,l)=>void ea(e,t,l),onFormConfigChange:t=>{if(J()&&t&&Object.keys(t).length){var l;_.current.add(e.key);let i=eKT((null==(l=t.form)?void 0:l.title)??t.title,s||"en");i&&z(t=>t[e.key]===i?t:{...t,[e.key]:i}),Y(e=>e+1)}},onChange:(t,l)=>{if(J()){if(t)_.current.delete(e.key);else if(!l||!Object.keys(l).length){_.current.delete(e.key);let t=Q("Unable to load the form. Please retry.","表单加载失败,请重试。");M(t),R(l=>({...l,[e.key]:t}))}}},onFinishFailed:()=>{if(!J())return;let t=Q("Please complete the required form fields.","请填写表单中的必填内容。");A(null),M(t),R(l=>({...l,[e.key]:t}))},onFormValueChange:t=>{var l;if(!J())return;let i=null==(l=e2o(e,X))?void 0:l.values;JSON.stringify(t)===JSON.stringify(i)?k.current.delete(e.key):k.current.add(e.key),Y(e=>e+1)}})})}):(0,eB.jsx)(eM.Alert,{type:"error",message:Q("The form component is unavailable. Reload before continuing.","表单组件未加载,请刷新后继续。")})]},`${W}:${e.key}`)})]}):null,(e.agreements||"ready"===j&&w.some(e=>e.policyId))&&(0,eB.jsxs)(e0z,{id:`${p}-agreements`,number:++eo,title:Q("Agreements","协议"),className:"venue-confirmation-agreements",children:[(null==T?void 0:T.section)==="agreements"&&w.some(e=>e.policyId&&!q[e.key])&&(0,eB.jsx)("p",{className:"error-text",role:"alert",children:T.message}),"ready"===j&&w.filter(e=>e.policyId).map(e=>(0,eB.jsx)(eZH,{title:Z(e),lang:K?"zh":"en",accepted:!!q[e.key],disabled:d||!!P,onOpen:()=>void(e=>{if(!d&&!P&&J())try{var t;if(!e.policyId||!e.policyResponse)throw Error(Q("Unable to load the resource policy.","无法加载资源协议。"));ez.init(Ve,s||(null==(t=ez.getLocale)?void 0:t.call(ez))||"en"),A(e.key),F({task:e,request:async t=>{if(!J()||String(t)!==e.policyId)throw Error(Q("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"));return e.policyResponse}})}catch(e){J()&&!["cancel","programmatic-close","replaced"].includes(null==e?void 0:e.type)&&M(e0_(e,Q("Unable to load the resource policy.","无法加载资源协议。")))}})(e)},e.key)),e.agreements]}),e.note&&(0,eB.jsx)(e0z,{id:`${p}-note`,number:++eo,title:Q("Order note","订单留言"),children:e.note}),(null==$?void 0:$.task.policyId)&&J()&&(0,eB.jsx)(e2l,{policyId:$.task.policyId,title:Z($.task),request:$.request,locale:s,accepted:!!q[$.task.key],onClose:()=>{F(void 0),A(null)},onConfirm:e=>{let t=$.task.policyId;J()&&t&&(B(l=>({...l,[$.task.key]:{status:"confirmed",policyId:t,policy:e}})),F(void 0),A(null))},onLoadError:e=>{J()&&(M(e0_(e,Q("Unable to load the resource policy.","无法加载资源协议。"))),F(void 0),A(null))}},`${W}:${$.task.key}`)]})});function e2m(e,t,l,i){var a,n,r,o;let s=null==(n=i.find(e=>String(e.id)===String(t)))||null==(a=n.label)?void 0:a.trim();if(s)return s;let d=(null==(r=e.booking)?void 0:r.holder)??(null==(o=e.cacheItem._extend)?void 0:o.holder),c=Uk(null==d?void 0:d.form_record);if(1===e.quantity&&1===c.length&&String(c[0])===String(t)&&String(null==d?void 0:d.form_id)===String(e.config.formId)&&((null==d?void 0:d.customer_id)==null||String(d.customer_id)===String(l)))return"string"==typeof d.name&&d.name.trim()||void 0}function e2g(e){var t,l,i,a,n,r,o;let{context:s,scopeKey:d,mode:c,locale:u,disabled:p,onEdit:m,productLineUid:g,inline:h=!1,ordinalOffset:v=0,onRemoveTicket:f}=e,y=UF(),b=eJK(s,d,u),x=String(u||"").startsWith("zh"),k=(e,t)=>x?t:e,_=(0,eN.useRef)(!0),w=(0,eN.useRef)(!1),S=(0,eN.useRef)({context:s,scopeKey:d,disabled:p,onRemoveTicket:f});S.current={context:s,scopeKey:d,disabled:p,onRemoveTicket:f};let j=eJQ(s,d),[N,C]=(0,eN.useState)(!1),[M,T]=(0,eN.useState)();(0,eN.useEffect)(()=>(_.current=!0,()=>{_.current=!1}),[]),(0,eN.useEffect)(()=>{T(void 0)},[j]);let I=e=>_.current&&eJQ(S.current.context,S.current.scopeKey)===e,P=(null==(i=s.sales.bookingTicket)||null==(l=i.getOrderCustomerSnapshot)||null==(t=l.call(i))?void 0:t.id)??(null==(r=s.sales.bookingTicket)||null==(n=r.getTempOrder)||null==(a=n.call(r))?void 0:a.customer_id)??(null==(o=s.sales.tempOrder)?void 0:o.customer_id),A=(h?b.displayLines:b.lines).filter(e=>{let t=e.orderLine.metadata;return(!g||e.uid===g)&&!!e.booking&&(!(null==t?void 0:t.venue_booking_scope_key)||t.venue_booking_scope_key===d)&&(!(null==t?void 0:t.venue_booking_role)||t.venue_booking_role===("party"===c?"party_main":"tickets"))});if(!A.length)return null;let D=async(e,t)=>{var l;let i=S.current.onRemoveTicket;if(i&&!S.current.disabled&&!w.current&&!b.blocked&&I(j)&&"tickets"===c&&1===e.quantity&&0===t&&(null==(l=e.orderLine.metadata)?void 0:l.venue_booking_role)==="tickets"){w.current=!0,C(!0),T(void 0);try{await i(e.uid,t)}catch(e){I(j)&&T(e0_(e,k("Unable to remove this ticket. Please try again.","无法删除这张票,请重试。")))}finally{w.current=!1,_.current&&C(!1)}}},E=A.map(e=>{let t=e01(y.getHolderFormDetailForSource(e.cacheItem),u),l={label:t.edit,disabled:p||N||b.blocked,onClick:m},i=y.getHolderOptionsForSource(e.cacheItem),a=e.booking,n=[a.start_date,a.start_time&&a.end_time?`${a.start_time}–${a.end_time}`:a.start_time].filter(Boolean).join(" \xb7 "),r=Array.from({length:e.quantity},(l,a)=>{let n=e.ids[a],r=null!=n&&""!==n,o=r?e2m(e,n,P,i):void 0;return{name:o,label:e.config.enabled?o||(r?k("Profile linked; name unavailable","档案已关联,姓名暂不可用"):k(`${t.name} not selected`,`尚未选择${t.name}`)):t.notRequired}});return(0,eB.jsxs)("section",{className:h?"venue-inline-holder-review":"cart-group",children:[!h&&(0,eB.jsx)(e0V,{className:"booking-order-item-flat",title:e.title||k("Booking","预约"),details:n?(0,eB.jsx)("span",{className:"booking-item-metadata",children:n}):void 0}),"party"===c?(0,eB.jsx)(e0U,{items:r.map((e,i)=>({label:r.length>1?`${t.name} #${i+1}`:t.name,value:(0,eB.jsx)("span",{className:e.name?void 0:"needs-attention",children:e.label}),action:l}))}):(0,eB.jsx)("div",{className:"ticket-list",children:r.map((t,i)=>{var a;return(0,eB.jsx)(e0V,{layout:"row",icon:(0,eB.jsx)(eKq,{size:20,"aria-hidden":"true"}),title:`${k("Ticket","门票")} #${v+i+1}`,details:(0,eB.jsx)("small",{className:t.name||!e.config.enabled?void 0:"needs-attention",children:t.label}),action:e.config.enabled?l:void 0,removeAction:f&&1===e.quantity&&(null==(a=e.orderLine.metadata)?void 0:a.venue_booking_role)==="tickets"?{label:`${k("Remove ticket","删除门票")} ${e.title||k("Ticket","门票")} #${v+i+1}`,disabled:p||N||b.blocked,onClick:()=>{D(e,i)}}:void 0},i)})})]},e.uid)}),O=M&&(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:M});return h?(0,eB.jsxs)(eB.Fragment,{children:[O,E]}):(0,eB.jsxs)(e0W,{title:k("Holder","持有人"),children:[O,E]})}e2p.displayName="VenueBookingConfirmation";let e2h=(0,eN.forwardRef)(function(e,t){let{source:l,previous:i,ids:a,onChange:n,quantity:r,customerId:o,os:s,disabled:d,text:c}=e,u=Uq(),{required:p,formId:m}=B4(l),[g,h]=(0,eN.useState)(!0),[v,f]=(0,eN.useState)(!1),[y,b]=(0,eN.useState)(0),[x,k]=(0,eN.useState)(!1),_=(0,eN.useRef)(null),w=a.length>r||p&&a.length!==r,S=(0,eN.useMemo)(()=>({...l,_extend:{...l._extend,quantity:r,holder_relations:i}}),[l,r,i]),j=(0,eN.useMemo)(()=>({client:{value:{id:o}}}),[o]);return(0,eN.useEffect)(()=>{let e=!0;h(!0),f(!1);let t=t=>{e&&(f(!t),h(!1))};return u.prepareHolderOptionsForSource(l,{throwOnError:!0}).then(e=>t(e.accessAllowed),()=>t(!1)),()=>{e=!1}},[l,o,y,u.prepareHolderOptionsForSource]),(0,eN.useImperativeHandle)(t,()=>({async readRelations(){if(w){var e;k(!0),null==(e=_.current)||e.scrollIntoView({block:"nearest"});return}if(a.length&&(g||v))return;let t=a.length?await s.getOtherParams():void 0;return ekD(S,a,{productSource:l,customerId:o,isFranchisee:!!(null==t?void 0:t.isFranchisee),holderOptions:u.getHolderOptionsForSource(l),holderFormDetail:u.getHolderFormDetailForSource(l)})}}),[a,w,g,v,s,l,o,S,u]),(0,eB.jsxs)("fieldset",{className:"venue-extra-holder",ref:_,disabled:d,children:[g?(0,eB.jsx)("p",{role:"status",children:c("Loading holder profiles…","正在加载档案…")}):v?(0,eB.jsxs)("div",{role:"alert",children:[c("Holder profiles are unavailable.","暂时无法加载档案。")," ",(0,eB.jsx)("button",{type:"button",onClick:()=>b(e=>e+1),children:c("Retry","重试")})]}):(0,eB.jsx)(UQ,{presentation:"inline",holderOptionsLoaded:!0,state:j,cacheItem:S,required:p,getCurrentCacheItem:()=>S,value:a,onChange:e=>{d||(n(e),k(!1))}},String(m)),x&&w&&(0,eB.jsx)("p",{role:"alert",className:"venue-extra-detail-error",children:p?c(`Choose ${r} holder profiles to continue.`,`请选择 ${r} 份档案后继续。`):c(`Choose up to ${r} holder profiles.`,`最多选择 ${r} 份档案。`)})]})});function e2v(e){let{runtime:t}=e,l=t.configurationModal;return(null==l?void 0:l.extraSession)?(0,eB.jsx)(e2f,{runtime:t,modal:l},l.plan.openId):null}function e2f(e){var t,l,i;let{runtime:a,modal:n}=e,{plan:r,extraSession:o,configuration:s}=n,{text:d,locale:c,bookingUI:u}=a,p=Uu(),m=(0,eN.useMemo)(()=>eND(p.customerAuth),[p.customerAuth]),g=r.productDetail,[h,v]=(0,eN.useState)(o.quantity),[f,y]=(0,eN.useState)(!1),[b,x]=(0,eN.useState)(!1),[k,_]=(0,eN.useState)(),[w,S]=(0,eN.useState)(!1),[j,N]=(0,eN.useState)(!1),[C,M]=(0,eN.useState)(),T=(0,eN.useRef)(null),I=(0,eN.useRef)(null),P=!1!==o.hasSku,A=(0,eN.useMemo)(()=>eJS(o.productDetail,s.skuValue.product_variant_id,o.editingLine),[o.productDetail,s.skuValue.product_variant_id,o.editingLine]),D=B4(A),E=(0,eN.useRef)(a.customerId),[O,z]=(0,eN.useState)(!0),L=(0,eN.useMemo)(()=>(o.holderRelations||[]).filter(e=>{var t,l;return"form"!==e.holder_type||O&&D.enabled&&E.current===a.customerId&&((null==(t=e.metadata)?void 0:t.form_id)==null||String(e.metadata.form_id)===String(D.formId))&&((null==(l=e.metadata)?void 0:l.customer_id)==null||String(e.metadata.customer_id)===String(a.customerId))}),[o.holderRelations,O,D.enabled,D.formId,a.customerId]),R=JSON.stringify([a.customerId,D.formId]),[$,F]=(0,eN.useState)(()=>({key:R,ids:L.filter(e=>"form"===e.holder_type).map(e=>e.holder_id)})),[q,B]=(0,eN.useState)(()=>n.initialStage??(!P||o.lineUid&&D.enabled?"holder":"sku")),[H,V]=(0,eN.useState)(!!o.lineUid||"holder"===n.initialStage),U="holder"===q&&D.enabled,Y="sku"===q&&P,W=(0,eN.useRef)(!0),G=(0,eN.useRef)(!1),K=(0,eN.useRef)(0),Q=(0,eN.useRef)(a);Q.current=a;let Z=eKA((null==(t=(l=a.os).getTempOrder)?void 0:t.call(l))??a.order),J=(0,eN.useRef)({os:a.os,scopeKey:a.scopeKey,sessionId:a.session.sessionId,order:Z}),X=o0(()=>{var e,t,l;return W.current&&!1!==Q.current.props.isActive&&Q.current.os===J.current.os&&Q.current.scopeKey===J.current.scopeKey&&Q.current.session.sessionId===J.current.sessionId&&eKA((null==(e=(t=Q.current.os).getTempOrder)?void 0:e.call(t))??Q.current.order)===J.current.order&&(null==(l=Q.current.configurationModal)?void 0:l.extraSession)===o}),ee=eKE(a.os)&&D.enabled&&!eKO(a.context),et=eKE(a.os)&&String(E.current||"")!==String(a.customerId||""),el=a.busy||a.extras.busy||a.checkout.submitting||f||b||!!C,ei=a.disabled||!1===a.props.isActive,ea=(0,eN.useMemo)(()=>({token:{colorPrimary:u.brand.primaryColor,colorPrimaryBg:u.brandTokens["--primary-soft"]}}),[u.brand.primaryColor,u.brandTokens]);(0,eN.useEffect)(()=>(W.current=!0,()=>{W.current=!1,K.current+=1}),[]);let en=o0(async()=>{if(!X()||G.current||ei)return;G.current=!0,y(!0),N(!0),_(void 0);let e=String(eKO(Q.current.context)||"");try{await eKL({context:Q.current.context,products:[A],force:!0,openCustomerAuth:m,isCurrent:X})}catch(e){X()&&_(e0_(e,d("Unable to open holder details. Please try again.","无法打开持有人资料,请重试。")))}finally{let t=String(eKO(Q.current.context)||"");X()&&t&&t!==e&&M({customerId:t,configuration:Q.current.configurationModal.configuration,quantity:h}),G.current=!1,W.current&&y(!1)}});(0,eN.useEffect)(()=>{U&&ee&&D.required&&!j&&!el&&!ei&&en()},[U,ee,D.required,j,el,ei,en]),(0,eN.useEffect)(()=>{if(!C)return;if(!X())return void M(void 0);if(String(a.customerId||"")!==C.customerId||a.extrasCatalog.loading)return;if(a.extrasCatalog.error){M(void 0),_(d("Unable to reload this item. Close it and try again.","无法重新读取该商品,请关闭后重试。"));return}let e=!0;return G.current=!0,(o.lineUid?a.extras.prepareEdit(o.lineUid,C.quantity):a.extras.prepare(o.productDetail,C.quantity)).then(t=>{if(!(e&&X()))return;if("ready"!==t.status)throw Error("invalid"===t.status?t.issues.map(e=>e.message).join(" "):d("This item changed. Close it and try again.","该商品已变化,请关闭后重试。"));let l=iw(t.plan.productDetail,C.configuration.skuValue,{requiredOptionValidation:n.requiredOptionValidation,overSold:1===n.overSold});if(!l)throw Error(d("The item options changed. Close it and choose again.","商品规格已变化,请关闭后重新选择。"));Q.current.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?{...e,plan:t.plan,extraSession:t.session,configuration:{...C.configuration,skuValue:l},initialStage:"holder"}:e)}).catch(t=>{e&&X()&&_(e0_(t,d("Unable to reload this item. Close it and try again.","无法重新读取该商品,请关闭后重试。")))}).finally(()=>{G.current=!1,e&&W.current&&M(void 0)}),()=>{e=!1}},[C,a.customerId,a.extrasCatalog.loading,a.extrasCatalog.error,a.os,a.scopeKey,a.session.sessionId,Z,X]);let er=(0,eN.useCallback)(e=>{T.current=e,S(!!e)},[]),eo=eZ0({enabled:!b&&!1!==a.props.isActive,openId:r.openId,scopeKey:o.contextKey,sessionId:a.session.sessionId,productDetail:g,skuValue:s.skuValue,quantity:h,overSold:1===n.overSold,timeZone:u.timeZone,customerId:a.customerId,os:a.extrasQueries}),es=eKT(g.title||g.name,c),ed=eKT(g.description,c),ec=Rs(g),eu=(g.variant||[]).find(e=>Number(e.id)===Number(s.skuValue.product_variant_id))||g,ep=[99999,Number((null==(i=g.item_rule_limit)?void 0:i.remainingMax)??99999)];1===Number(eu.is_track)&&1!==n.overSold&&ep.push(Number(eu.stock_quantity??0));let em=Math.max(0,Math.min(...ep.filter(Number.isFinite))),eg=e=>String(a.amount(e)),eh=iB(s.skuValue,"",e=>eKT(e,c),eg).reduce((e,t)=>e.concat(t.label,...(t.children||[]).map(e=>e.label)),[]).filter(Boolean).join(" \xb7 "),ev=()=>{el||G.current||(K.current+=1,a.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?void 0:e))},ef=async()=>{if(el||ei||G.current||Y&&(!T.current||!w))return;G.current=!0;let e=K.current,t=()=>X()&&e===K.current,l=()=>t()&&!Q.current.disabled&&!1!==Q.current.props.isActive&&(!eKE(Q.current.os)||String(E.current||"")===String(Q.current.customerId||""));y(!0),_(void 0);try{var i,r;if(Y&&!1!==n.requiredOptionValidation)try{await T.current.validate()}catch{return}if(!l())return;let e=iw(g,(null==(i=T.current)?void 0:i.getTransformValues())??s.skuValue,{requiredOptionValidation:n.requiredOptionValidation,overSold:1===n.overSold});if(!e)throw Error(d("Complete the required selections to continue.","请完成必选内容后继续。"));let c={skuValue:e,variantDraft:Q.current.configurationModal.configuration.variantDraft};if(a.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?{...e,configuration:c}:e),Y&&B4(eJS(o.productDetail,e.product_variant_id,o.editingLine)).enabled){V(!0),B("holder");return}let u=U&&!ee?await (null==(r=I.current)?void 0:r.readRelations()):L;if(!u||!l())return;let p=await a.extras.commit(o,c,h,u);if(!t()||"cancelled"===p.status)return;x(!0),a.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?void 0:e)}catch(e){t()&&_(e0_(e,d("Unable to add this item. Please try again.","暂时无法添加商品,请重试。")))}finally{G.current=!1,W.current&&y(!1)}},ey="phone"===a.variant?"mobile":"desktop",eb=FY.View;return(0,eB.jsx)(eM.ConfigProvider,{theme:ea,children:(0,eB.jsx)(nB.PisellThemeProvider,{theme:ea,children:(0,eB.jsx)(oq,{renderType:"mobile"===ey?"drawer":"modal",props:{...FY.getContainerProps(ey),open:!0,onCancel:ev,onClose:ev,closable:!1,destroyOnClose:!0,placement:"bottom",getContainer:u.portal||void 0,className:`${FY.containerClassName} venue-extra-detail-modal venue-booking-legacy-controls`},children:(0,eB.jsxs)(eb,{layout:ey,title:es,subtitle:eKT(g.subtitle,c),cover:g.cover,coverText:es.slice(0,2),unitPrice:ec&&(0,eB.jsxs)(eB.Fragment,{children:["from"===ec.qualifier&&d("From ",""),a.amount(ec.amount),"from"===ec.qualifier&&d(""," 起")]}),totalPrice:(0,eB.jsx)("span",{role:"status","aria-live":"polite",children:"ready"===eo.status?a.amount(eo.subtotal):"loading"===eo.status?d("Calculating…","正在计算…"):"—"}),selectionSummary:eh,description:ed?(0,eB.jsx)(eZz,{content:ed}):null,loading:!1,pending:el,confirmDisabled:ei||Y&&!w||h>em||et||U&&ee&&D.required,confirmLabel:Y&&D.enabled?d("Next: holder details","下一步:选择档案"):o.lineUid?d("Save changes","保存修改"):d("Add to cart","加入购物车"),closeLabel:d("Close","关闭"),backLabel:d("Back","返回"),onBack:U&&P&&!o.lineUid?()=>{el||(B("sku"),_(void 0))}:void 0,onClose:ev,onConfirm:()=>{ef()},noteControl:null,quantityControl:(0,eB.jsxs)(eB.Fragment,{children:[k&&(0,eB.jsx)("div",{role:"alert",className:"venue-extra-detail-error",children:k}),(0,eB.jsx)(z0,{variant:"capsule",size:"large",value:h,min:1,max:em,disabled:el||ei,theme:ea,onChange:e=>{G.current||el||ei||(K.current+=1,v(e),_(void 0))}})]}),children:[Y&&(0,eB.jsx)($T,{ref:er,type:FY.skuType,dataSource:g,value:s.skuValue,variantDraft:s.variantDraft,selectionKey:r.selectionKey,initializationPolicy:H?"preserve":"auto-required-defaults",disabled:ei||b,config:{overSold:n.overSold},theme:ea,priceFormatter:eg,customScrollParent:".venue-extra-detail-modal .sku-detail-appearance__scroller",presentation:{modal:{className:"pisell-flat-sku-selection-modal pisell-booking-product-detail-options-modal"}},onChange:(e,t)=>{if(G.current||el||ei)return;K.current+=1,_(void 0);let l=B4(eJS(o.productDetail,e.product_variant_id,o.editingLine));(String(l.formId)!==String(D.formId)||l.enabled!==D.enabled)&&(z(!1),F({key:JSON.stringify([a.customerId,l.formId]),ids:[]})),a.setConfigurationModal(l=>(null==l?void 0:l.extraSession)===o?{...l,configuration:{skuValue:e,variantDraft:void 0===t?l.configuration.variantDraft:t.variantDraft}}:l)}}),U&&ee?(0,eB.jsx)("div",{className:"venue-extra-holder","aria-busy":f||!!C,children:f||C?(0,eB.jsx)("div",{className:"venue-holder-skeleton",role:"status","aria-label":d("Loading holder profiles","正在加载档案"),children:(0,eB.jsx)("div",{className:"holder-picker","aria-hidden":"true",children:(0,eB.jsx)("span",{className:"venue-holder-skeleton-field"})})}):(0,eB.jsx)("button",{type:"button",className:"button secondary",disabled:el||ei,onClick:()=>{en()},children:D.required?d("Choose holders","选择持有人"):d("Choose holders (optional)","选择持有人(选填)")})}):U&&(0,eB.jsx)(e2h,{ref:I,source:A,previous:L,quantity:h,customerId:a.customerId,os:a.os,ids:$.key===R?$.ids:[],onChange:e=>F({key:R,ids:e}),disabled:el||ei,text:d},R)]})})})})}function e2y(e){let{animated:t,artRef:l}=e;return(0,eB.jsx)("span",{ref:l,className:`benefits-banner-art${t?" benefits-banner-art--animated":""}`,"aria-hidden":"true",children:(0,eB.jsxs)("svg",{viewBox:"0 0 120 88",focusable:"false",children:[(0,eB.jsxs)("g",{className:"benefits-banner-sparkles",children:[(0,eB.jsx)("circle",{cx:"18",cy:"18",r:"4"}),(0,eB.jsx)("circle",{cx:"101",cy:"65",r:"3"}),(0,eB.jsx)("path",{d:"M91 11l2 5 5 2-5 2-2 5-2-5-5-2 5-2 2-5Z"})]}),(0,eB.jsxs)("g",{className:"benefits-banner-gift benefits-banner-gift--left",children:[(0,eB.jsx)("rect",{x:"13",y:"31",width:"35",height:"31",rx:"5"}),(0,eB.jsx)("path",{d:"M10 31h41v10H10zM30.5 31v31M19 22c8-1 11 9 11 9s-12 1-12-6c0-1 .3-2 1-3Zm23 0c-8-1-11 9-11 9s12 1 12-6c0-1-.3-2-1-3Z"})]}),(0,eB.jsxs)("g",{className:"benefits-banner-gift benefits-banner-gift--right",children:[(0,eB.jsx)("rect",{x:"80",y:"38",width:"27",height:"25",rx:"4"}),(0,eB.jsx)("path",{d:"M77 38h33v8H77zM93.5 38v25M85 31c6-1 8 7 8 7s-9 1-9-4c0-1 .3-2 1-3Zm17 0c-6-1-8 7-8 7s9 1 9-4c0-1-.3-2-1-3Z"})]}),(0,eB.jsxs)("g",{className:"benefits-banner-ticket",children:[(0,eB.jsx)("path",{d:"M43 20h42a6 6 0 0 1 6 6v8a7 7 0 0 0 0 14v8a6 6 0 0 1-6 6H43a6 6 0 0 1-6-6v-8a7 7 0 0 0 0-14v-8a6 6 0 0 1 6-6Z"}),(0,eB.jsx)("path",{d:"M54 49 74 30"}),(0,eB.jsx)("circle",{cx:"55",cy:"31",r:"3"}),(0,eB.jsx)("circle",{cx:"73",cy:"49",r:"3"})]})]})})}function e2b(e){let{status:t,needsAttention:l=!1,hidden:i=!1,disabled:a=!1,open:n,onOpenChange:r,onOpen:o,onClose:s,children:d,dialogProps:c,presentation:u="dialog"}=e,{lang:p,presentationPlatform:m}=eKa(),g="kiosk"===m,[h,v]=(0,eN.useState)(!1),f=n??h,y=e=>{void 0===n&&v(e),null==r||r(e)},[b,x]=(0,eN.useState)(!1),k=(0,eN.useRef)(null),_=t??eQA(p,"benefitsTitle"),w=!b&&!a&&!l;(0,eN.useLayoutEffect)(()=>{let e=k.current;if(e)return eKN(e,"--checkout-benefits-height",g)},[g]);let S=()=>{y(!1),null==s||s(),requestAnimationFrame(()=>{var e,t;return null==(t=k.current)||null==(e=t.querySelector("button"))?void 0:e.focus({preventScroll:!0})})},j=(0,eN.useRef)(S);j.current=S,(0,eN.useEffect)(()=>{if("floating"!==u||!f||i)return;let e=()=>Array.from(document.querySelectorAll((null==c?void 0:c.externalDialogSelector)??eQd)).some(e=>e.getClientRects().length>0),t=t=>{var l;(null==(l=k.current)?void 0:l.contains(t.target))||e()||(y(!1),null==s||s())},l=t=>{"Escape"!==t.key||t.defaultPrevented||e()||(t.preventDefault(),j.current())};return document.addEventListener("pointerdown",t),document.addEventListener("keydown",l),()=>{document.removeEventListener("pointerdown",t),document.removeEventListener("keydown",l)}},[u,f,i,r,s,null==c?void 0:c.externalDialogSelector]);let N=d??(0,eB.jsx)("p",{className:"benefits-empty",role:"status",children:"zh"===p?"当前没有可用优惠,您可以继续完成预订。":"There are no offers available for this booking. You can continue to checkout."});return(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)("div",{className:`checkout-benefits${"floating"===u?" checkout-benefits--floating":""}`,ref:k,hidden:i,children:[(0,eB.jsxs)(eKQ,{secondary:!0,className:`checkout-benefits-trigger${l?" needs-attention":""}`,"data-attention":w?"true":void 0,disabled:a,"aria-haspopup":"dialog","aria-expanded":f&&!i,onClick:()=>{x(!0),f?S():(y(!0),null==o||o())},children:[(0,eB.jsx)(e2y,{animated:w}),(0,eB.jsx)("span",{className:"checkout-benefits-label","aria-live":"polite","aria-atomic":"true",children:_}),(0,eB.jsx)(e0D,{className:"checkout-benefits-arrow",size:18,"aria-hidden":"true"})]}),"floating"===u&&(0,eB.jsx)("section",{className:"checkout-benefits-popover",role:"dialog","aria-label":eQA(p,"benefitsTitle"),hidden:!f||i,children:N})]}),"dialog"===u&&(0,eB.jsx)(eQu,{...c,zIndex:(null==c?void 0:c.zIndex)??600,externalDialogSelector:(null==c?void 0:c.externalDialogSelector)??eQd,title:eQA(p,"benefitsTitle"),closeLabel:eQA(p,"close"),className:"checkout-benefits-dialog",open:f&&!i,onClose:S,footer:(0,eB.jsxs)("div",{className:"checkout-benefits-footer",children:[(0,eB.jsx)("p",{role:"status","aria-atomic":"true",children:_}),(0,eB.jsx)(eKQ,{onClick:S,children:eQA(p,"benefitsDone")})]}),children:N})]})}let e2x=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm84,108a83.6,83.6,0,0,1-16.75,50.28L77.72,60.75A84,84,0,0,1,212,128ZM44,128A83.6,83.6,0,0,1,60.75,77.72L178.28,195.25A84,84,0,0,1,44,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm88,104a87.56,87.56,0,0,1-20.41,56.28L71.72,60.4A88,88,0,0,1,216,128ZM40,128A87.56,87.56,0,0,1,60.41,71.72L184.28,195.6A88,88,0,0,1,40,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M200,128a71.69,71.69,0,0,1-15.78,44.91L83.09,71.78A71.95,71.95,0,0,1,200,128ZM56,128a71.95,71.95,0,0,0,116.91,56.22L71.78,83.09A71.69,71.69,0,0,0,56,128Zm180,0A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-20,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm90,102a89.6,89.6,0,0,1-22.29,59.22L68.78,60.29A89.95,89.95,0,0,1,218,128ZM38,128A89.6,89.6,0,0,1,60.29,68.78L187.22,195.71A89.95,89.95,0,0,1,38,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm88,104a87.56,87.56,0,0,1-20.41,56.28L71.72,60.4A88,88,0,0,1,216,128ZM40,128A87.56,87.56,0,0,1,60.41,71.72L184.28,195.6A88,88,0,0,1,40,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm92,100a91.67,91.67,0,0,1-24.21,62.13L65.87,60.21A92,92,0,0,1,220,128ZM36,128A91.67,91.67,0,0,1,60.21,65.87L190.13,195.79A92,92,0,0,1,36,128Z"}))]]),e2k=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e2x}));function e2_(e){let{name:t,image:l,imageFallback:i,imagePosition:a,description:n,descriptionContent:r,lang:o,price:s,priceSuffix:d,metadata:c,details:u,badge:p,featured:m=!1,selection:g,actionLabel:h,disabled:v=!1,busy:f=!1,unavailable:y,disabledReason:b,onSelect:x}=e,k=dL("booking-presentation"),_=v||!!y,w=y?eQA(o,"unavailableProductAction"):h;return(0,eB.jsxs)("article",{className:`product-card ${m?"featured-product":""} ${g?"has-selection":""} ${_?"is-disabled":""} ${y?"is-unavailable":""}`,children:[g&&(0,eB.jsxs)("p",{id:`${k}-selection`,className:"product-selected-count","aria-live":"polite","aria-atomic":"true",children:[(0,eB.jsx)("span",{className:"sr-only",children:g.description??g.label}),(0,eB.jsx)("span",{className:"product-selected-label","aria-hidden":"true",children:g.label})]}),(l||i||p||y)&&(0,eB.jsxs)("div",{className:"product-image",children:[l&&(0,eB.jsx)("img",{src:l,alt:"",style:a?{objectPosition:a}:void 0}),!l&&i,p&&(0,eB.jsx)("span",{className:"product-badge",children:p}),y&&(0,eB.jsxs)("span",{id:`${k}-unavailable`,className:"product-unavailable-badge",children:["ended"===y.kind?(0,eB.jsx)(e0$,{size:16,"aria-hidden":"true"}):(0,eB.jsx)(e2k,{size:16,"aria-hidden":"true"}),(0,eB.jsx)("span",{children:y.label})]})]}),(0,eB.jsxs)("div",{className:"product-copy",children:[(0,eB.jsx)("h3",{children:t}),c,(0,eB.jsx)(eZU,{name:t,description:n,content:r,lang:o}),u,!y&&v&&b&&(0,eB.jsx)("span",{id:`${k}-disabled`,className:"sr-only",children:b}),(0,eB.jsxs)("div",{className:"product-bottom",children:[(0,eB.jsxs)("div",{children:[(0,eB.jsx)("strong",{children:s}),d&&(0,eB.jsx)("small",{children:d})]}),(0,eB.jsxs)(eKQ,{className:"product-select","aria-label":`${w}: ${t}`,"aria-describedby":[g&&`${k}-selection`,y?`${k}-unavailable`:v&&b&&`${k}-disabled`].filter(Boolean).join(" ")||void 0,"aria-haspopup":"dialog",disabled:_,busy:f,onClick:x,children:[w,y?(0,eB.jsx)(e2k,{size:18,"aria-hidden":"true"}):(0,eB.jsx)(e0D,{size:18,"aria-hidden":"true"})]})]})]})]})}function e2w(e){let t="string"==typeof e?e.trim().toLowerCase():"";return"past"===t?"ended":"capacity_full"===t||"resource_capacity_exceeded"===t?"capacity":["booking_cutoff_after_start","booking_cutoff_before_start","booking_cutoff_advance"].includes(t)?"cutoff":["booking_cutoff_future_day","schedule_excluded_date","outside_operating_hours","outside_resource_window"].includes(t)?"not-open":t.includes("configuration")||["booking_cutoff_invalid","unsupported_resource_group","availability_unsupported"].includes(t)?"configuration":void 0}e2k.displayName="ProhibitIcon";let e2S=GH["sku-list-a5"],e2j={...e2S,skuListConfig:{...e2S.skuListConfig,listConfig:{...null==(et=e2S.skuListConfig)?void 0:et.listConfig,columns:2,showTab:!0,isTreeTab:!1,tabStyle:"switch",stickyTop:!1,columnGap:16,rowGap:24}}},e2N={...eqP,columns:2,layoutDirection:"column",nameColor:"var(--ink)",priceColor:"var(--ink)"},e2C={...e2S,skuListConfig:{...e2S.skuListConfig,listConfig:{...null==(el=e2S.skuListConfig)?void 0:el.listConfig,columns:1,isTreeTab:!1,stickyTop:!1,columnGap:16,rowGap:16},skuCardAllConfig:{...null==(ei=e2S.skuListConfig)?void 0:ei.skuCardAllConfig,skuCardConfig:{...null==(en=e2S.skuListConfig)||null==(ea=en.skuCardAllConfig)?void 0:ea.skuCardConfig,background:"var(--cream)",paddingX:16,paddingY:16}}}},e2M={...eqP,columns:1,layoutDirection:"row",showImage:!0,imageWidth:"96px",imageHeight:"96px",nameColor:"var(--ink)",priceColor:"var(--ink)"};function e2T(e){let{product:t,presentation:l,disabled:i,onSelect:a,settlementPriceRows:n,mode:r,locale:o,quantityByProductId:s,formatAmount:d,preparingProductId:c,availability:u,catalogLoading:p,catalogError:m,productLoadChannel:g}=e,h="party"===r,v=o.startsWith("zh"),f=function(e){let{product:t,availability:l,loading:i,error:a,channel:n,locale:r}=e;if(i||a)return;let o=String(r||"").startsWith("zh"),s=(e,t)=>o?t:e;if(RS(t,n))return{label:s("Sold out","已售罄"),kind:"unavailable"};let d=!!(l&&!l.available&&!l.requiresConfiguration);if(!Rj(t)&&!d)return;let c=null==l?void 0:l.reasons,u=(d&&Array.isArray(c)?c:[]).map(e2w),p=u.length&&u[0]&&u.every(e=>e===u[0])?u[0]:void 0;return"ended"===p?{label:s("Session ended","时段已结束"),kind:"ended"}:"capacity"===p?{label:s("Not enough capacity","剩余容量不足"),kind:"unavailable"}:"cutoff"===p?{label:s("Booking closed","预订已截止"),kind:"unavailable"}:"not-open"===p?{label:s("Not offered on this date","当日未开放"),kind:"unavailable"}:"configuration"===p?{label:s("Booking setup incomplete","配置不完整"),kind:"unavailable"}:{label:s("Unavailable on this date","当前日期不可预约"),kind:"unavailable"}}({product:t,availability:u[String(t.id)],loading:p,error:m,channel:g,locale:o}),y=eKT(t.title??t.name,v?"zh":"en"),b=(null==l?void 0:l.description)??eKI(t.description,v?"zh":"en"),x=Rs(t),k="string"==typeof t.cover?t.cover:"",_=(null==l?void 0:l.actionLabel)??(h?v?"查看并选择":"View and customize":v?"选择门票":"Choose ticket"),w=Array.isArray(t._promotionTags)?t._promotionTags.map(e=>eKT(e.text,v?"zh":"en")).filter(Boolean):[],S=(null==n?void 0:n.length)?(0,eB.jsx)(Ru,{rows:n}):x&&d?(0,eB.jsxs)("span",{className:"pisell-price-text",children:["from"===x.qualifier&&!v&&(0,eB.jsx)("span",{className:"pisell-price-text-prefix-text",style:{fontSize:"0.65em",marginRight:4},children:"From"}),d(x.amount),"from"===x.qualifier&&v&&(0,eB.jsx)("span",{className:"pisell-price-text-suffix-text",style:{fontSize:"0.65em",marginLeft:4},children:"起"}),x.unit&&(0,eB.jsxs)("span",{children:["/",x.unit]})]}):x?(0,eB.jsx)(LJ,{value:x.amount,isMini:"from"===x.qualifier,precision:x.precision,hideDecimalForWholeNumbers:!x.precision&&void 0,suffix:x.unit?(0,eB.jsxs)("span",{children:["/",x.unit]}):void 0}):null,j=Number((null==s?void 0:s[String(t.id)])||0),N=h?(null==l?void 0:l.selected)?{label:v?"已选":"Selected"}:void 0:j>0?{label:eQA(v?"zh":"en","selectedTicketCorner").replace("{count}",String(j)),description:eQA(v?"zh":"en","selectedTickets").replace("{count}",String(j))}:void 0;return(0,eB.jsx)(e2_,{name:y,image:k?oQ(k,800):void 0,imageFallback:(0,eB.jsx)(nB.PisellImageCard,{className:"venue-catalog-text-cover",dataSource:{alt:y},width:"100%",height:"100%"}),description:"string"==typeof b?b:eKI(t.description,v?"zh":"en"),descriptionContent:(0,eB.jsx)(eZz,{content:eKT(t.description,v?"zh":"en")}),lang:v?"zh":"en",price:S,metadata:null==l?void 0:l.businessInfo,details:w.length?(0,eB.jsx)("span",{className:"venue-catalog-promotions",children:w.map((e,t)=>(0,eB.jsx)("span",{children:e},`${t}:${e}`))}):void 0,selection:N,actionLabel:"string"==typeof _?_:v?"选择商品":"Choose product",busy:c===String(t.id),disabled:i,unavailable:f,onSelect:a})}function e2I(e){return null==e?null:Array.isArray(e)?e.map(e2I):"object"==typeof e?Object.keys(e).sort().reduce((t,l)=>(t[l]=e2I(e[l]),t),{}):e}let e2P=e=>{if("string"!=typeof e&&"number"!=typeof e)return;let t=String(e).trim();return t&&"0"!==t?t:void 0},e2A=e=>{var t;return e2P((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??e.identity_key)};function e2D(e){if(("string"==typeof e||"number"==typeof e)&&String(e).trim())try{let t=new lO(e);return t.isFinite()&&t.gte(0)?t:void 0}catch{return}}let e2E=new Set(["id","discount_id","order_discount_id","amount","_num","num"]),e2O=new Set(["fixed_amount","original_amount"]),e2z=new Set(["num","mainProductDiscountAmount","optionDiscountAmount","product_discount_difference","custom_product_bundle_map_id","unique_identification_number","product_uid","booking_uid"]);function e2L(e,t){return Object.keys(e||{}).reduce((l,i)=>(t.has(i)||(l[i]=e[i]),l),{})}function e2R(e,t){let l=[];for(let i of e){let e=e2D(i[t]),a=e2D(i.num);if(!e||!a||!a.gt(0))return;let n=lO.clone({precision:Math.max(20,e.precision()+a.precision())});l.push(new n(e).mul(a))}let i=Math.max(1,...l.map(e=>e.e+1)),a=Math.max(0,...l.map(e=>e.decimalPlaces())),n=lO.clone({precision:i+a+String(e.length).length+2});return l.reduce((e,t)=>e.plus(t),new n(0)).toString()}function e2$(e){if(("string"==typeof e||"number"==typeof e)&&""!==String(e).trim())try{let t=new lO(e);return t.isFinite()?t:void 0}catch{return}}let e2F=e=>{var t,l;return{os:e.os,scopeKey:e.scopeKey,sessionId:e.session.sessionId,identity:eKA((null==(t=(l=e.os).getTempOrder)?void 0:t.call(l))??e.order)}},e2q=(e,t)=>e.os===t.os&&e.scopeKey===t.scopeKey&&e.sessionId===t.sessionId&&e.identity===t.identity,e2B=e=>{var t,l,i;return String((null==(t=(null==(l=(i=e.os).getTempOrder)?void 0:l.call(i))??e.order)?void 0:t.customer_id)||"")};function e2H(e){var t,l,i,a;return String((null==(t=e.os.otherParams)?void 0:t.platform)||(null==(a=e.engine)||null==(i=a.appHelper)||null==(l=i.constants)?void 0:l.platform)||"").trim().toLowerCase()}let e2V=(e,t)=>eKE(e.os)||"promotion_code"===t&&"kiosk"===e2H(e);function e2U(e,t){let l=Uv(),i=(0,nB.useToast)(),a=Uu(),n=(0,eN.useMemo)(()=>eND(a.customerAuth),[a.customerAuth]),r=(0,eN.useRef)(e);r.current=e;let o=(0,eN.useRef)(!0),s=(0,eN.useRef)(),[d,c]=(0,eN.useState)(!1),[u,p]=(0,eN.useState)(),m=e2F(e),g=e2V(e,t),h=l.isLoggedIn(),v="promotion_code"===t?t:void 0,f=(g?!eKz(e.context,{reason:v}):h)&&!!u&&e2q(u.owner,m)&&u.customer===e2B(e);return(0,eN.useEffect)(()=>(o.current=!0,()=>{var e,t;o.current=!1,null==(t=s.current)||null==(e=t.cancelLogin)||e.call(t),s.current=void 0}),[]),(0,eN.useEffect)(()=>{if(s.current&&!e2q(s.current.owner,m)){var e,t;null==(e=(t=s.current).cancelLogin)||e.call(t),s.current=void 0,c(!1)}},[m.os,m.scopeKey,m.sessionId,m.identity]),(0,eN.useEffect)(()=>{g||h||p(void 0)},[g,h]),{ready:f,pending:d,ensure:o0(()=>{let e=r.current,a=e2F(e);if(!o.current||!e.ready||!1===e.props.isActive)return Promise.resolve(!1);let d=e2V(e,t);if((d?!eKz(e.context,{reason:v}):l.isLoggedIn())&&u&&e2q(u.owner,a)&&u.customer===e2B(e))return Promise.resolve(!0);if(s.current&&e2q(s.current.owner,a))return s.current.promise;let m={owner:a};s.current=m;let g=()=>o.current&&s.current===m&&!1!==r.current.props.isActive&&("promotion_code"!==t||r.current.showOffers)&&e2q(a,e2F(r.current));return m.promise=Promise.resolve().then(async()=>{try{if(!g())return!1;if(d){if(!await eKL({context:e.context,reason:v,openCustomerAuth:n,isCurrent:g})||!g())return!1;return r.current.cart.refreshCartSnapshot(),p({owner:a,customer:e2B(r.current)}),!0}if(!l.isLoggedIn()&&(!await new Promise(t=>{if(m.cancelLogin=()=>t(!1),!l.openLoginModal({callback:e=>{m.cancelLogin=void 0,t("success"===e)}}))throw m.cancelLogin=void 0,Error(e.text("Login is unavailable. Please try again.","登录暂不可用,请重试。"))})||!g()||!l.isLoggedIn())||!g())return!1;if("function"!=typeof a.os.syncAuthenticatedOrderCustomer||await a.os.syncAuthenticatedOrderCustomer()!==!0)throw Error(e.text("Could not load your account details. Please try again.","无法读取账号信息,请重试。"));if(!g()||!l.isLoggedIn())return!1;return r.current.cart.refreshCartSnapshot(),p({owner:a,customer:e2B(r.current)}),!0}catch(l){return g()&&("promotion_code"===t?i.fail(e0_(l,e.text("Could not verify your account. Please try again.","无法验证账号,请重试。"))):r.current.setError(e0_(l,e.text("Could not prepare checkout. Please try again.","无法进入确认页面,请重试。")))),!1}finally{s.current===m&&(s.current=void 0,o.current&&c(!1))}}),c(!0),m.promise})}}function e2Y(e){var t,l;let{runtime:i,visible:a=!0}=e,{context:n,sales:r,cart:o,variant:s}=i,d=e2H(i),c=e2U(i,"promotion_code"),u=(null==(l=r.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))||r.tempOrder||o.tempOrder,p=Number(null==u?void 0:u.customer_id);return(0,eB.jsx)(eTK,{customerId:Number.isFinite(p)?p:void 0,discountList:o.discountList,getDiscountList:r.getDiscountList,scanPromotionCode:o.scanCode,setDiscountSelected:o.setDiscount,patchDiscountCardHolderOnStore:r.patchDiscountCardHolderOnStore,variant:s,children:(0,eB.jsxs)("div",{hidden:!a,children:[(0,eB.jsx)(eTG,{}),(0,eB.jsx)(ePj,{context:n,variant:s,appearance:"light",enableWalletAssets:!0,enableManualPromotionCode:!0,beforePromotionCodeSearch:["pc","h5","kiosk"].includes(d)?c.ensure:void 0,enablePromotionBanner:!0,preserveWalletAssetsWhileRefreshing:!0,enableVoucherProductAdd:!1,promotionProductSource:"catalog-only"})]})})}function e2W(e){var t,l,i,a,n,r,o;let{context:s,lines:d,locale:c}=e,u=UF(),p=String(c||"").startsWith("zh"),m=function(e,t,l){let i=new Map;for(let a of e){if(!a.config.enabled)continue;let e=l(a.cacheItem);for(let l=0;l<a.quantity;l+=1){let n=a.ids[l],r=null!=n&&""!==n,o=JSON.stringify([String(a.config.formId),r?String(n):"unselected"]),s=i.get(o);s?s.quantity+=1:i.set(o,{key:o,formId:a.config.formId,quantity:1,label:r?e2m(a,n,t,e)||String(n):void 0})}}return Array.from(i.values())}(d,(null==(i=s.sales.bookingTicket)||null==(l=i.getOrderCustomerSnapshot)||null==(t=l.call(i))?void 0:t.id)??(null==(r=s.sales.bookingTicket)||null==(n=r.getTempOrder)||null==(a=n.call(r))?void 0:a.customer_id)??(null==(o=s.sales.tempOrder)?void 0:o.customer_id),u.getHolderOptionsForSource);if(!m.length)return null;let g=e01(void 0,c).name,h=new Map;for(let e of d){let t=String(e.config.formId);e.config.enabled&&!h.has(t)&&h.set(t,e01(u.getHolderFormDetailForSource(e.cacheItem),c).name)}return(0,eB.jsx)("div",{className:"venue-cart-holders","aria-label":p?"持有人":"Holder",children:m.map(e=>{let t=h.get(String(e.formId))||g;return(0,eB.jsxs)("div",{className:e.label?void 0:"venue-cart-holder-unselected",children:[e.label?(0,eB.jsxs)(eB.Fragment,{children:[t,p?":":": ",e.label]}):p?`尚未选择${t}`:`${t} not selected`,e.quantity>1&&(0,eB.jsxs)(eB.Fragment,{children:[" \xd7 ",e.quantity]})]},e.key)})})}function e2G(e){let{products:t,locale:l}=e,i=eTC(t);return i.length?(0,eB.jsx)("div",{className:"venue-order-promotions","aria-label":l.startsWith("zh")?"已生效活动":"Applied promotions",children:i.map(e=>(0,eB.jsx)("span",{children:e.detail||e.title},e.key))}):null}function e2K(e,t,l,i){return(0,eN.useMemo)(()=>{if(!e.length)return e;let a=e=>e.map(e=>{let t=e._promotionTags||[];return{...e,_promotionTags:t.map(e=>({...e,text:eKT(e.text,i)})).filter(e=>e.text)}});if(null==t?void 0:t.appendPromotionTags)try{let i=t.appendPromotionTags(e);if(!l||i.some(e=>{var t;return null==(t=e._promotionTags)?void 0:t.length}))return a(i)}catch{}return a(exh(e,l))},[e,t,l,i])}function e2Q(e,t){var l;let{session:i,checkout:a,error:n,handoff:r,config:o,text:s}=e;if(!i.ready||i.error||i.pendingOrder)return;let d=t||n||a.error;return d?{kind:"error",tone:"error",message:d}:(null==(l=e.depositHydration)?void 0:l.error)?{kind:"deposit",tone:"error",message:e.depositHydration.error}:r?{kind:"submitted",tone:"success",message:s("Your order was submitted. Continue in the payment page or order details.","订单已提交,请在支付页或订单详情继续。")}:o.visualError?{kind:"design",tone:"warning",message:s("The design settings are invalid. The last valid appearance is still in use.","视觉配置无效,已保留上一份有效样式。")}:void 0}function e2Z(e){let{feedback:t,text:l,onDismiss:i,onRetry:a,onRetryPayment:n}=e;return(0,eB.jsx)(eZf,{tone:t.tone,className:"venue-action-feedback",children:(0,eB.jsxs)("div",{className:"venue-action-feedback-message",children:[(0,eB.jsx)("span",{children:t.message}),"deposit"===t.kind&&a&&(0,eB.jsx)(eKQ,{secondary:!0,onClick:a,children:l("Retry","重试")}),n&&(0,eB.jsx)(eKQ,{secondary:!0,onClick:n,children:l("Continue payment","继续支付")}),"restored"===t.kind&&i&&(0,eB.jsx)(eKZ,{className:"venue-action-feedback-dismiss","aria-label":l("Dismiss draft notice","关闭草稿恢复提示"),onClick:i,children:(0,eB.jsx)(eQa,{size:16,"aria-hidden":"true"})})]})})}function e2J(e,t){var l;let[i,a]=(0,eN.useState)(),n=e2Q(e,t),r=n&&!e.linePicker&&("restored"!==n.kind||i!==e.scopeKey)?(0,eB.jsx)(e2Z,{feedback:n,text:e.text,onRetry:null==(l=e.depositHydration)?void 0:l.retry,onRetryPayment:e.checkout.canRetryPayment?()=>{e.checkout.retryPayment()}:void 0,onDismiss:()=>a(e.scopeKey)}):void 0,o=e.orderPanel.isMobile&&!e.orderPanel.open;return{summary:o?void 0:r,footer:o?r:void 0}}function e2X(e){let{extras:t=!1}=e;return(0,eB.jsx)("div",{className:`list-group-items venue-catalog-skeleton-grid${t?" venue-catalog-skeleton-grid--extras":""}`,"aria-hidden":"true",children:[0,1].map(e=>t?(0,eB.jsxs)("div",{className:"pisell-plus-sales-product-card venue-catalog-skeleton-extra",children:[(0,eB.jsx)("div",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-extra-image"}),(0,eB.jsxs)("div",{className:"venue-catalog-skeleton-copy",children:[(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block"}),(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-short"})]}),(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-control"})]},e):(0,eB.jsx)("article",{className:"product-card venue-catalog-skeleton-card",children:(0,eB.jsxs)("div",{className:"product-copy",children:[(0,eB.jsx)("h3",{children:(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block"})}),(0,eB.jsxs)("div",{className:"product-description venue-catalog-skeleton-copy",children:[(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block"}),(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-short"})]}),(0,eB.jsxs)("div",{className:"product-bottom",children:[(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-price"}),(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-action"})]})]})},e))})}function e20(e){var t;let{runtime:l,showHero:i="select"===l.step}=e,{bookingUI:a,config:n}=l;return(0,eB.jsx)(eB.Fragment,{children:i&&(null==(t=n.brand)?void 0:t.hero)&&(0,eB.jsx)("section",{className:"hero booking-hero venue-booking-sales__hero","aria-label":a.brand.name,children:(0,eB.jsx)("img",{src:n.brand.hero,alt:""})})})}function e22(e){let{runtime:t}=e,{session:l,order:i,text:a,openOrderHistory:n}=t,r=t.isKiosk&&(0,eB.jsx)(eKQ,{secondary:!0,disabled:t.checkout.paymentActive||t.kioskLifecycle.resetting,onClick:()=>{t.kioskLifecycle.finish({navigateHome:!0})},children:a("Back to home","返回首页")});return t.isKiosk&&l.error?(0,eB.jsxs)(eZf,{tone:"error",children:[l.error,(0,eB.jsx)(eKQ,{disabled:t.checkout.paymentActive||t.kioskLifecycle.resetting,onClick:()=>{l.restart().catch(e=>t.setError(e instanceof Error?e.message:String(e)))},children:a("Retry","重试")}),r]}):l.error?(0,eB.jsx)(eZf,{tone:"error",children:l.error}):l.ready?t.isKiosk&&l.pendingOrder?(0,eB.jsxs)(eZf,{children:[(0,eB.jsx)("p",{children:a("An order is already open. Return home to start another booking.","当前已有订单,可返回首页开始新的预订。")}),r]}):l.pendingOrder?(0,eB.jsxs)(eZf,{children:[(0,eB.jsx)("p",{children:a("You have an existing order. Continue from its order details.","已有订单,请从订单详情继续。")}),Number(null==i?void 0:i.order_id)>0&&(0,eB.jsx)("a",{className:"button secondary",href:`/order/details?id=${encodeURIComponent(i.order_id)}`,children:a("Open order","查看订单")}),(0,eB.jsx)(eKQ,{secondary:!0,onClick:n,children:a("Check order history","核对订单记录")})]}):null:(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("div",{className:"venue-booking-sales__loading",role:"status","aria-label":a("Loading your booking","正在加载预订"),children:(0,eB.jsx)(eM.Spin,{})}),r]})}function e21(e){var t,l;let{runtime:i}=e,{configurationModal:a,setConfigurationModal:n,locale:r,busy:o,extras:s,checkout:d,setComposer:c,linePicker:u,setLinePicker:p,bookingUI:m,text:g,run:h,disabled:v,setExpandedSection:f}=i,y=eKB(),b="zh"===r?"zh":"en",x=u?e2Q(i):void 0,k=eZ0({enabled:!!(null==a?void 0:a.partyDraft)&&!1!==i.props.isActive,openId:null==a?void 0:a.plan.openId,scopeKey:i.scopeKey,sessionId:i.session.sessionId,productDetail:null==a?void 0:a.plan.productDetail,skuValue:null==a?void 0:a.configuration.skuValue,quantity:null==a||null==(t=a.partyDraft)?void 0:t.quantity,overSold:(null==a?void 0:a.overSold)===1,priceBasis:"catalog",timeZone:m.timeZone,customerId:i.customerId,os:i.mainQueries}),_=(null==a?void 0:a.partyDraft)?{label:g("Estimated subtotal","预计小计"),amount:(0,eB.jsx)("span",{role:"status","aria-live":"polite",children:"ready"===k.status?i.amount(k.subtotal):"loading"===k.status?g("Calculating…","正在计算…"):g("Unavailable","暂无法报价")})}:void 0;return(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)(eM.Modal,{getContainer:m.portal||void 0,open:!!d.failure,title:g("Booking could not be submitted","预订提交失败"),centered:!0,closable:!1,maskClosable:!1,keyboard:!1,destroyOnClose:!0,footer:(0,eB.jsx)(eKQ,{busy:d.resettingFailure,onClick:()=>{d.confirmFailure()},children:g("Confirm","确认")}),children:[(0,eB.jsx)("p",{role:"alert",style:{whiteSpace:"pre-wrap"},children:null==(l=d.failure)?void 0:l.message}),d.resetError&&(0,eB.jsx)(eZf,{tone:"error",children:d.resetError})]}),(0,eB.jsx)(e2v,{runtime:i}),a&&!a.extraSession&&(0,eB.jsx)(eQO,{plan:a.plan,title:eKT(a.plan.productDetail.title||a.plan.productDetail.name,r),summary:a.partyDraft&&(0,eB.jsx)(eZY,{detail:a.plan.productDetail,configuration:a.configuration,locale:b,catalogStartingAmount:a.partyDraft.catalogStartingAmount,catalogPriceQualifier:a.partyDraft.catalogPriceQualifier,formatAmount:i.amount}),configuration:a.configuration,configurationFooter:_,onConfigurationChange:e=>n(t=>t&&{...t,configuration:e}),skuOptions:{config:{overSold:a.overSold}},requiredOptionValidation:a.requiredOptionValidation,locale:b,busy:o||s.busy||d.submitting,onCancel:()=>n(void 0),onConfigurationConfirm:async(e,t)=>!!t.isCurrent()&&(a.partyDraft&&(c({...a.partyDraft,configuration:e}),f("time"),i.notifyPartyProductConfirmed(),y("#party-time")),t.isCurrent()&&n(void 0),!0)},a.plan.openId),(0,eB.jsx)(eM.Modal,{getContainer:m.portal||void 0,open:!!u,title:g("Choose the configured item to change","选择需要调整的商品项"),footer:null,onCancel:()=>p(void 0),destroyOnClose:!0,children:(0,eB.jsxs)("div",{className:"venue-booking-legacy-controls",children:[(null==x?void 0:x.kind)==="error"&&(0,eB.jsx)(e2Z,{feedback:x,text:g}),null==u?void 0:u.map(e=>{var t;return(0,eB.jsxs)("div",{className:"venue-booking-sales__line-picker",children:[(0,eB.jsxs)("span",{children:[eKT(e.product_title,r)||String(e.product_id)," ",(null==(t=e.product_sku)?void 0:t.name)||""]}),(0,eB.jsx)(eM.InputNumber,{min:0,precision:0,value:Number(e.num),disabled:v,onChange:t=>{null!=t&&h(async()=>{let l=await s.setLineQuantity(eJF(e),Number(t));p(void 0),await i.showExtraPreparation(l)})}})]},eJF(e))})]})})]})}function e24(e){let{runtime:t,preview:l,showFilters:i}=e,{mode:a,text:n,disabled:r,main:o,mainPoolEmpty:s}=t;return s&&(!t.mainCatalog.menuListIds.length||l.catalogueReady||"unavailable"===l.status&&!l.searchRange)?(0,eB.jsx)(eZf,{children:"party"===a?n("No Party packages are available.","暂无可选 Party 商品。"):n("No tickets are available.","暂无可选门票。")}):l.catalogueReady?(0,eB.jsx)(e23,{runtime:t,showFilters:i}):l.awaitingSelection?(0,eB.jsx)(eZf,{children:n("Choose a date to see available products.","请选择日期,再查看可用商品。")}):"error"!==l.status&&"unavailable"!==l.status?(0,eB.jsx)("div",{className:`venue-booking-catalog venue-booking-catalog--${a}`,role:"status","aria-busy":"true","aria-label":"party"===a?n("Loading Party packages","正在加载 Party 商品"):n("Loading tickets","正在加载门票"),children:(0,eB.jsx)(e2X,{})}):(0,eB.jsxs)(eZf,{tone:"error"===l.status?"error":void 0,children:["error"===l.status?n("Available dates could not be checked. Please retry.","可订日期查询失败,请重试。"):l.searchRange?n("No available date in the next month. You can browse other dates.","未来一个月内暂无可订日期,可手动查看其他日期。"):n("No available date in this view. Choose another date or week.","当前日期范围内暂无可订日期,请选择其他日期或翻周查看。"),"error"===l.status&&(0,eB.jsx)("button",{type:"button",className:"button secondary",disabled:r,onClick:o.retry,children:n("Retry","重试")})]})}function e23(e){var t,l,i;let{runtime:a,showFilters:n=!0,formatAmount:r=a.amount}=e,{mode:o,locale:s,context:d,variant:c,scopeKey:u,date:p,main:m,props:g,productQuantities:h,disabled:v,text:f,partyMain:y,composer:b,run:x,openProduct:k}=a,_=(0,eN.useMemo)(()=>{let e,t;return e=new Map,t=0,l=>{let i=eKT(l,s);if("u"<typeof DOMParser||!/[<&\r\0]/.test(i))return eKI(i,s);let a=e.get(i);if(void 0!==a)return a;let n=eKI(i,s),r=i.length+n.length;if(r>256e3)return n;for(;e.size>=64||t+r>256e3;){let l=e.keys().next().value;t-=l.length+e.get(l).length,e.delete(l)}return e.set(i,n),t+=r,n}},[u,s]),w=e2K(m.products,a.sales.bookingTicket,null==(i=a.engine)||null==(l=i.appHelper)||null==(t=l.utils)?void 0:t.promotionEvaluator,s),S=(0,eN.useMemo)(()=>{var e;return e={mode:o,locale:s,quantityByProductId:h,formatAmount:r,preparingProductId:a.preparingProductId,availability:m.availability,catalogLoading:m.loading,catalogError:m.error,productLoadChannel:a.sales.productLoadChannel},t=>(0,eB.jsx)(e2T,{...t,...e},t.product.id)},[o,s,h,r,a.preparingProductId,m.availability,m.loading,m.error,a.sales.productLoadChannel]),j=(0,eN.useMemo)(()=>{var e;return n?e2j:{...e2j,skuListConfig:{...e2j.skuListConfig,listConfig:{...null==(e=e2j.skuListConfig)?void 0:e.listConfig,showTab:!1}}}},[n]);return(0,eB.jsx)(eBn,{context:d,mode:"retail",variant:c,businessCode:g.businessCode,className:`venue-booking-catalog venue-booking-catalog--${o}`,renderProductCard:S,catalog:{scopeKey:`${u}:${p}:main`,products:w,loading:m.loading,error:m.error,onRetry:m.retry,keepContentWhileLoading:!0,loadingContent:(0,eB.jsx)(e2X,{}),loadingLabel:(0,eB.jsx)("span",{className:"sr-only",children:f(m.products.length?"Updating availability…":"Loading available products…",m.products.length?"正在重新校验可用性…":"正在加载可预订商品…")})},quantityByProductId:h,isActive:g.isActive,productDisplayConfig:j,productListPreferences:e2N,productListPreferencesOverride:!0,categoryNavigation:n?"top":"tabbar",defaultCategorySelection:"all",allCategoryLabel:f("All","全部"),showSettings:!1,productCardVersion:"v2",productSelectionTrigger:"click",hideSingleCategoryNavigation:!0,onSelectProduct:e=>x(()=>k(e)),getProductPresentation:e=>{let t=m.availability[String(e.id)],l=(null==t?void 0:t.available)||(null==t?void 0:t.requiresConfiguration),i=eQV(e),a="party"===o&&Number((null==b?void 0:b.detail.id)??(null==y?void 0:y.line.product_id))===Number(e.id);return{disabled:v||m.loading||!!m.error||!l,description:_(e.description),businessInfo:"party"===o&&i.partySize||i.durationMinutes?(0,eB.jsxs)("div",{className:"party-meta venue-booking-sales__facts",children:["party"===o&&i.partySize&&(0,eB.jsxs)("span",{children:[(0,eB.jsx)(eZu,{size:15,"aria-hidden":"true"}),i.partySize," ",f("guests included","位参加者")]}),i.durationMinutes&&(0,eB.jsxs)("span",{children:[(0,eB.jsx)(e0$,{size:15,"aria-hidden":"true"}),i.durationMinutes," ",f("minutes","分钟")]})]}):void 0,actionLabel:a?f("Edit package","编辑套餐"):void 0,selected:a}}})}function e28(e){var t,l,i,a;let{runtime:n}=e,{context:r,variant:o,scopeKey:s,extrasCatalog:d,extras:c,props:u,disabled:p,run:m,showExtraPreparation:g}=n,h=e2K(d.products,n.sales.bookingTicket,null==(i=n.engine)||null==(l=i.appHelper)||null==(t=l.utils)?void 0:t.promotionEvaluator,n.locale),v=(0,nB.usePisellConfig)(),f=null==(a=n.order)?void 0:a.currency_symbol,y=(0,eN.useMemo)(()=>"string"==typeof f&&f.trim()?{...v,symbol:f}:v,[v,f]);return(0,eB.jsxs)(nB.PisellContext.Provider,{value:y,children:[(0,eB.jsx)("span",{className:"sr-only",role:"status","aria-live":"polite",children:n.extraQuantity.pending?n.text("Updating extras…","正在更新附加商品…"):""}),c.invalidItems.map(e=>(0,eB.jsx)(eZf,{tone:"warning",children:e.message},e.lineUid||e.code)),(0,eB.jsx)(eBn,{context:r,mode:"retail",variant:o,businessCode:u.businessCode,className:"venue-booking-catalog venue-booking-catalog--extras",productDisplayConfig:e2C,productListPreferences:e2M,productListPreferencesOverride:!0,catalog:{scopeKey:`${s}:extras`,products:h,loading:d.loading,error:d.error,onRetry:d.retry,keepContentWhileLoading:!0,loadingContent:(0,eB.jsx)(e2X,{extras:!0}),loadingLabel:(0,eB.jsx)("span",{className:"sr-only",children:n.text(d.products.length?"Updating extra prices…":"Loading extras…",d.products.length?"正在更新附加商品价格…":"正在加载附加商品…")})},quantityByProductId:{...c.quantityByProductId,...n.extraQuantity.quantities},showSettings:!1,categoryNavigation:"top",defaultCategorySelection:"all",allCategoryLabel:n.text("All","全部"),productCardVersion:"v2",productSelectionTrigger:"click",isActive:u.isActive,getProductPresentation:e=>{let t=RL(e),l=!eJy(e)||(t?n.extraQuantityDisabled:p);if(n.pendingExtraProductId===String(e.id))return{disabled:l,renderAction:()=>(0,eB.jsx)("span",{className:"venue-extra-action-pending",role:"status","aria-label":n.text("Updating item","正在更新商品"),children:(0,eB.jsx)(eM.Spin,{size:"small"})})};let i=B3(e)?n.text("Choose options","选择选项"):"phone"===o||t?void 0:n.text("Options","选规格");return i?{disabled:l,renderAction:e=>{let{quantity:t,disabled:l,onSelect:a}=e;return(0,eB.jsx)(RR,{label:i,quantity:t,disabled:l,onSelect:a})}}:{disabled:l}},onSelectProduct:e=>m(async()=>g(await c.prepare(e)),e.id),onQuantityChange:(e,t,l)=>{RL(e)&&!B3(e)?n.extraQuantity.changeQuantity(e,t,l.previousQuantity):m(async()=>g(await c.setProductQuantity(e,t)),e.id)}})]})}function e26(e,t,l){return function(e){let{line:t,quantity:l,formatAmount:i}=e,a=function(e,t){let l=e2$(t),i=e2$(e.selling_price);if(!l||!l.gt(0)||!i)return;let a=e2$(e.original_price),n=lO.clone({precision:Math.max(20,i.precision()+l.precision(),((null==a?void 0:a.precision())||0)+l.precision())}),r=new n(i).mul(l),o=a&&new n(a).mul(l);return{total:r.toString(),...(null==o?void 0:o.gt(0))&&o.gt(r)?{originalTotal:o.toString()}:{}}}(t,l);if(a)return(0,eB.jsxs)("span",{className:"venue-order-line-price",children:[void 0!==a.originalTotal&&(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("del",{className:"venue-order-line-price-original",children:i(a.originalTotal)})," "]}),(0,eB.jsx)("span",{className:"venue-order-line-price-current",children:i(a.total)})]})}({line:t,quantity:l,formatAmount:e.amount})}function e25(e){let{text:t}=e;return(0,eB.jsx)("h3",{className:"venue-cart-addons-title",children:t("Addons","附加商品")})}function e27(e){let{date:t,locale:l}=e;return l.startsWith("zh")?(0,eB.jsxs)("time",{dateTime:t,children:[eQM(t,l,{year:"numeric",month:"long",day:"numeric"})," ",(0,eB.jsx)("span",{className:"venue-review-weekday",children:eQM(t,l,{weekday:"short"})})]}):(0,eB.jsx)("time",{dateTime:t,children:eQM(t,l)})}function e29(e){var t,l,i,a;let{runtime:n,onlyExtras:r=!1,includeExtras:o=!0,includeGifts:s=!0,onEditExtras:d,review:c=!1,renderBookingDetails:u}=e,{bindings:p,extras:m,hasBookings:g,mode:h,text:v,locale:f,disabled:y,composer:b,orderPanel:x,editLine:k,removeLines:_,run:w}=n,[S,j]=(0,eN.useState)(),N=(i=p.bindings,a=n.holderState,e0J(i,e=>{var t,l;let i=e0Z(e.line,e.booking);if(null===i)return null;let n=a.displayLines.find(t=>t.uid===e.productLineUid);if(!n||n.config.enabled&&(n.missing||n.ids.length<e.quantity))return null;let r=e.line;return JSON.stringify([i,n.config.enabled,n.config.required,String(n.config.formId??""),n.ids.map(String),r.original_price,r.selling_price,r.discount_list,r.note,r.remark,null==(t=r.metadata)?void 0:t._promotion,null==(l=r.metadata)?void 0:l.manual_discount])})),C=(0,eN.useMemo)(()=>new Map(n.extrasCatalog.products.map(e=>[Number(e.id),e])),[n.extrasCatalog.products]),M=e=>B3(eJS(C.get(Number(e.product_id)),e.product_variant_id,e)),T=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:B3,a=new Set,n=new Set;return e.forEach(e=>{let t=e2A(e);t&&a.has(t)&&n.add(t),t&&a.add(t)}),e0J(e,e=>i(e)||Uy(e,l).length?null:function(e,t,l){var i,a,n;let r=e2A(e),o=e.metadata||{},s=o.venue_booking_role,d=Number(e.num),c=e2D(e.original_price),u=e2D(e.selling_price);if(!r||l.has(r)||!e2P(e.product_id)||!e2P(o.venue_booking_scope_key)||!["tickets_extra","party_extra"].includes(s)||"party_extra"===s&&!e2P(o.venue_booking_parent_uid)||!Number.isSafeInteger(d)||d<=0||!c||!u||(null==(i=e._extend)?void 0:i.independentLine)===!0||(null==(n=o.origin)||null==(a=n._extend)?void 0:a.independentLine)===!0||null!=e.discount_list&&!Array.isArray(e.discount_list))return null;let p=(e.discount_list||[]).map(e=>(function(e,t){var l,i,a;if(!e||"object"!=typeof e||Array.isArray(e))return null;let n=String(e.type??e.tag??""),r="product_discount_card"===n?"discount_card":n,o=e2P((null==(l=e.discount)?void 0:l.resource_id)??e.resource_id),s=e2P((null==(i=e.discount)?void 0:i.strategy_id)??e.strategy_id??(null==(a=e.metadata)?void 0:a.strategyId))??("promotion"===r?e2P(null==t?void 0:t.strategyId):void 0);return r&&("discount_card"!==r||o)&&(o||s)?{...e2L(e,e2E),type:r,resource:o,strategy:s,discount:e2L(e.discount,e2O),metadata:e2L(e.metadata,e2z)}:null})(e,o._promotion));if(p.some(e=>null===e))return null;let m=function(e,t){let l=[];for(let i of t){let t=null==i?void 0:i.note_relations;if(!Array.isArray(t))return null;let a=t.filter(t=>(null==t?void 0:t.target_type)==="order_detail"&&String(t.target_uuid)===e);if(a.length){if(!i.note_type||!i.content||a.some(e=>"about"!==e.relation_type&&"related_to"!==e.relation_type))return null;l.push({note_type:i.note_type,content:i.content,importance:i.importance})}}return l.sort((e,t)=>JSON.stringify(e2I(e)).localeCompare(JSON.stringify(e2I(t))))}(r,t);return null===m?null:JSON.stringify(e2I({product:String(e.product_id),variant:String(e.product_variant_id??0),sku:{...e.product_sku,option:exP(e)},bundle:e.product_bundle||[],role:s,scope:o.venue_booking_scope_key,parent:o.venue_booking_parent_uid,original:c.toString(),selling:u.toString(),discounts:p,note:e.note,remark:e.remark,notes:m,inlineNotes:e.notes,salesNotes:e.sales_notes,allergy:e.allergy,allergies:e.allergies,metadataNotes:o.notes,metadataAllergy:o.allergy,metadataAllergies:o.allergies,promotion:o._promotion,promotionTags:o._promotionTags??e._promotionTags,gift:o._giftInfo??e._giftInfo,giftData:e.giftData,manualDiscount:o.manual_discount,isManualDiscount:o.is_manual_discount,priceOverride:o.price_override,sourcePrice:o.source_product_price,mainOriginal:o.main_product_original_price,mainSelling:o.main_product_selling_price}))}(e,t,n)).map(e=>{let t=e2R(e.members,"original_price");return{...e,quantity:e.members.reduce((e,t)=>e+(Number.isFinite(Number(t.num))?Number(t.num):0),0),price:{selling_price:e2R(e.members,"selling_price")??"",...void 0===t?{}:{original_price:t}}}})}(m.rows,null==(t=n.order)?void 0:t.notes,null==(l=n.order)?void 0:l.holder_relations,M),I=e=>e.length>0&&(0,eB.jsx)("ul",{className:"venue-order-bundle","aria-label":v("Included items","套餐内含商品"),children:e.map(e=>(0,eB.jsxs)("li",{children:[(0,eB.jsx)("span",{children:e.name||v("Included item","套餐子商品")}),(0,eB.jsxs)("span",{children:["\xd7 ",e.quantity]})]},e.key))}),P=(e,t)=>{"remove"===t?_(e.map(e=>e.productLineUid)):e.length>1?x.closeThen(()=>j({uids:e.map(e=>e.productLineUid)})):x.closeThen(()=>{k(e[0].productLineUid)})};return(0,eB.jsxs)(eB.Fragment,{children:[!r&&!g&&(0,eB.jsxs)("div",{className:"catalog-empty",children:[(0,eB.jsx)(eKq,{size:36,"aria-hidden":"true"}),(0,eB.jsx)("p",{children:v("tickets"===h?"Pick a ticket to start your family’s adventure.":"Choose a Party to begin.","tickets"===h?"选择门票,开启全家的欢乐时光。":"选择商品开始预订 Party。")})]}),(0,eB.jsxs)("div",{className:"selected-order-list",children:[!r&&N.map(e=>{var t,l,i;let a=e.members[0],r=e.members.reduce((e,t)=>e+t.quantity,0),o=eKT(a.line.product_title,f)||String(a.line.product_id),s=(a.booking.resources||[]).map(e=>{var t;return eKT((null==(t=e.metadata)?void 0:t.resource_name)||e.title||e.name||e.resource_name,f)}).filter(Boolean).join(" \xb7 "),d=null==(t=n.holderState.displayLines.find(e=>e.uid===a.productLineUid))?void 0:t.cacheItem,p=n.main.products.find(e=>String(e.id)===String(a.line.product_id)),m=e0X(a.line,r,f,p,d),g=!!(null==(l=a.line.product_bundle)?void 0:l.length)||1===Number((null==p?void 0:p.is_bundle)??(null==d?void 0:d.is_bundle)),x=[a.line.product_cover,null==d?void 0:d.cover,null==d||null==(i=d._extend)?void 0:i.product_cover,null==p?void 0:p.cover].map(e=>eKT(e,f)).find(Boolean),k=I(m);return(0,eB.jsxs)(e0V,{title:o,amount:e26(n,a.line,r),image:c&&x||void 0,details:(0,eB.jsxs)("div",{className:c?"booking-item-metadata":void 0,children:[c?(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)("div",{children:[(0,eB.jsx)(eQv,{size:16,"aria-hidden":"true"}),(0,eB.jsx)(e27,{date:a.date,locale:f})]}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)(e0$,{size:16,"aria-hidden":"true"}),a.booking.start_time,"–",a.booking.end_time]})]}):(0,eB.jsxs)("div",{children:[a.date," \xb7 ",a.booking.start_time,"–",a.booking.end_time]}),s&&(0,eB.jsx)("div",{children:s}),!g&&(0,eB.jsx)("div",{children:"tickets"===h?`${r} ${v(1===r?"ticket":"tickets","张票")}`:`\xd7 ${r}`}),!c&&(0,eB.jsx)(e2W,{context:n.context,locale:f,lines:n.holderState.displayLines.filter(t=>e.members.some(e=>e.productLineUid===t.uid))})]}),action:{label:`${v("Edit","修改")} ${o}`,disabled:y||!!b,onClick:()=>P(e.members,"edit")},removeAction:{label:`${v("Remove","移除")} ${o}`,disabled:y,onClick:()=>P(e.members,"remove")},children:[(0,eB.jsx)(e2G,{products:e.members.map(e=>e.line),locale:f}),u?(0,eB.jsxs)(eB.Fragment,{children:[k,e.members.map((t,l)=>(0,eB.jsx)(eC().Fragment,{children:u(t.productLineUid,e.members.slice(0,l).reduce((e,t)=>e+t.quantity,0))},t.productLineUid))]}):k]},e.key)}),"tickets"===h&&!c&&o&&T.length>0&&(0,eB.jsx)(e25,{text:v}),o&&T.map(e=>{var t,l,i,a,r;let o=e.members[0],s=eKT(o.product_title,f)||String(o.product_id),c=o._origin??(null==(a=n.order)||null==(i=a._extend)||null==(l=i.productsByUid)||null==(t=l[eJF(o)])?void 0:t.origin),u=e0X(o,e.quantity,f,C.get(Number(o.product_id)),c),p=Uy(o,null==(r=n.order)?void 0:r.holder_relations).filter(e=>"form"===e.holder_type),g=M(o)||p.length>0;return(0,eB.jsxs)(e0V,{layout:"row",title:s,amount:e26(n,e.price,1),details:(0,eB.jsxs)(eB.Fragment,{children:["\xd7 ",e.quantity,p.length>0&&(0,eB.jsxs)("div",{children:[v("Holder: ","Holder:"),p.map(e=>{var t;return(null==(t=e.metadata)?void 0:t.name)||e.holder_id}).join(", ")]})]}),action:d?{label:`${v("Edit extra","编辑附加商品")} ${s}`,disabled:y||!!b,onClick:()=>x.closeThen(()=>{g&&1===e.members.length?w(async()=>{await n.showExtraPreparation(await m.prepareEdit(eJF(o)))}):d()})}:void 0,removeAction:{label:`${v("Remove extra","移除附加商品")} ${s}`,disabled:y,onClick:()=>{w(async()=>m.removeLines(e.members.map(eJF)),o.product_id??void 0)}},children:[(0,eB.jsx)(e2G,{products:e.members,locale:f}),I(u)]},e.key)}),s&&p.gifts.map(e=>(0,eB.jsx)(e0V,{layout:"row",title:eKT(e.product_title,f)||String(e.product_id),details:(0,eB.jsxs)(eB.Fragment,{children:[v("Promotion gift","优惠赠品")," \xd7 ",e.num]}),children:(0,eB.jsx)(e2G,{products:[e],locale:f})},eJF(e)))]}),(0,eB.jsx)(eM.Modal,{getContainer:n.bookingUI.portal||void 0,open:!!S,footer:null,title:v("Choose the booking to change","选择需要调整的预订"),onCancel:()=>j(void 0),destroyOnClose:!0,children:(0,eB.jsx)("div",{className:"venue-booking-group-actions",children:p.bindings.filter(e=>null==S?void 0:S.uids.includes(e.productLineUid)).map((e,t)=>(0,eB.jsxs)(eKQ,{secondary:!0,disabled:y||!!b,onClick:()=>{j(void 0),k(e.productLineUid)},children:[v("Booking","预订")," ",t+1," \xb7 ",e.quantity," ",v("ticket(s)","张票")]},e.productLineUid))})})]})}function e1e(e){let{runtime:t,includeTotal:l=!0,includeDueNow:i=!0,splitPartySubtotal:a=!1}=e,{hasBookings:n,mode:r,text:o,amount:s,amountDue:d,summary:c,order:u,hasDeposit:p,depositAmount:m}=t,g=a&&"party"===r&&n?function(e){var t,l;let{bindings:i,scopeKey:a,summary:n}=e;if(i.issues.length||1!==i.bindings.length)return null;let r=i.bindings[0].line,o=eJF(r);if(!o||(null==(t=r.metadata)?void 0:t.venue_booking_role)!=="party_main"||r.metadata.venue_booking_scope_key!==a)return null;let s=new Set([o]),d=e=>{if("string"!=typeof e&&"number"!=typeof e||""===String(e).trim())return null;try{let t=new lO(e);return t.isFinite()&&!t.isNegative()?t:null}catch{return null}},c=e=>{let t=d(e.selling_price),l=Number(e.num);return t&&Number.isSafeInteger(l)&&l>0?t.mul(l):null},u=c(r),p=d(null==n?void 0:n.product_expect_amount);if(!u||!p)return null;let m=new lO(0);for(let e of i.extras){let t=eJF(e);if(!t||s.has(t)||(null==(l=e.metadata)?void 0:l.venue_booking_role)!=="party_extra"||e.metadata.venue_booking_scope_key!==a||String(e.metadata.venue_booking_parent_uid||"")!==o)return null;let i=c(e);if(!i)return null;s.add(t),m=m.plus(i)}let g=u.toDecimalPlaces(2,lO.ROUND_HALF_UP),h=m.toDecimalPlaces(2,lO.ROUND_HALF_UP);return u.plus(m).toDecimalPlaces(2,lO.ROUND_HALF_UP).eq(p)&&g.plus(h).eq(p)?{main:g.toFixed(2),extras:h.toFixed(2)}:null}(t):null,h=g?[{id:"party-subtotal",label:o("Party subtotal","Party 商品小计"),amount:s(g.main)},{id:"extras-subtotal",label:o("Extras","附加商品"),amount:s(g.extras)}]:[{id:"subtotal",label:o("Subtotal","商品小计"),amount:s(n?null==c?void 0:c.product_expect_amount:0)}],v=Number(null==c?void 0:c.discount_amount);if(n&&Number.isFinite(v)&&0!==v&&h.push({id:"discount",label:o("Discount","优惠"),amount:s(new lO(c.discount_amount).abs().negated().toString()),tone:"discount"}),Number(null==c?void 0:c.surcharge_fee)>0&&h.push({id:"surcharge",label:o("Surcharge","附加费"),amount:s(null==c?void 0:c.surcharge_fee)}),Number(null==c?void 0:c.tax_fee)>0){var f,y;let e=c.tax_title||(null==u?void 0:u.tax_title)||o("Tax","税费"),t=(f=null==u?void 0:u.products,y=c.is_price_include_tax??c.isPriceIncludeTax??(null==u?void 0:u.is_price_include_tax),!!(null==f?void 0:f.length)&&(null==y||1===Number(y))&&f.every(e=>{let t=e.is_price_include_tax??y;return 1===Number(t)&&(e.product_bundle??[]).every(e=>1===Number(e.is_price_include_tax??t))}));h.push({id:"tax",label:t?o(`${e} (Included)`,`${e}(已含税)`):e,amount:s(c.tax_fee)})}return l&&h.push({id:"total",label:o("Total","合计"),amount:s(n?null==c?void 0:c.expect_amount:0),tone:"total"}),n&&p&&h.push({id:"deposit",label:o("Deposit","定金"),amount:s(m)}),i&&n&&h.push({id:"due-now",label:o("Due now","本次待付"),amount:s(d)}),(0,eB.jsx)(e0Y,{rows:h})}function e1t(e){let{runtime:t}=e,{step:l,ready:i,session:a,showOffers:n,setShowOffers:r,hasBookings:o,text:s,disabled:d,orderPanel:c}=t,u=i&&!a.error&&("select"===l||o&&("extras"===l||"review"===l)),p=n&&u;return(0,eB.jsx)(e2b,{status:s("Offers and discount cards","优惠与折扣卡"),hidden:!u,open:p,disabled:d,presentation:"floating",onOpenChange:e=>{e?c.closeThen(()=>r(!0)):r(!1)},children:(0,eB.jsx)("fieldset",{disabled:d,"aria-disabled":d,className:`venue-booking-legacy-controls venue-booking-sales__offers ${d?"venue-booking-sales__offers--disabled":""}`,children:(0,eB.jsx)(e2Y,{runtime:t,visible:p})})})}function e1l(e){let{runtime:t,onBack:l,disabled:i=!1}=e,[a,n]=(0,eN.useState)(!1),[r,o]=(0,eN.useState)(!1),s=(0,eN.useRef)(!1),d=(0,eN.useRef)(!0);(0,eN.useEffect)(()=>(d.current=!0,()=>{d.current=!1}),[]);let c=!!l;(0,eN.useEffect)(()=>{c&&n(!1)},[c]);let u=(0,eN.useRef)(t);u.current=t;let p=async()=>{if(s.current||t.disabled||i)return;let e=t.session.sessionId;s.current=!0,o(!0);try{var l,a,r;if(t.isKiosk)return void await t.kioskLifecycle.finish({navigateHome:!0});if(await t.sales.clearCartAndReset(),t.session.discard(),!d.current||!t.alive.current||u.current.session.sessionId!==e)return;let i=null==(r=t.engine)||null==(a=r.appHelper)||null==(l=a.utils)?void 0:l.history;"function"==typeof(null==i?void 0:i.replace)?i.replace("/"):window.location.replace(window.location.origin)}catch(l){d.current&&t.alive.current&&u.current.session.sessionId===e&&t.setError(l instanceof Error?l.message:String(l))}finally{s.current=!1,d.current&&t.alive.current&&(o(!1),n(!1))}},m=c?t.text("Previous step","上一步"):t.text("Close booking","关闭预订");return(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("button",{type:"button",className:"venue-booking-exit icon-button","aria-label":m,title:m,disabled:i||t.disabled||r,onClick:()=>{l?l():n(!0)},children:c?(0,eB.jsx)(eKW,{size:22,"aria-hidden":"true"}):(0,eB.jsx)(eQa,{size:22,"aria-hidden":"true"})}),a&&!c&&(0,eB.jsx)(eQu,{title:t.text("Leave this booking?","退出本次预订?"),closeLabel:t.text("Close","关闭"),onClose:()=>n(!1),closeDisabled:r,closeOnBackdrop:!1,bodyClassName:"venue-booking-exit-body",footerClassName:"venue-booking-exit-actions",footer:(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("button",{type:"button",className:"button secondary",disabled:r,onClick:()=>n(!1),children:t.text("Keep booking","继续预订")}),(0,eB.jsx)("button",{type:"button",className:"button",disabled:i||r||t.disabled,onClick:()=>{p()},children:t.text("Leave booking","退出预订")})]}),children:(0,eB.jsx)("p",{children:t.text("Your selections will be cleared and you will return to the store home page.","当前选择将被清除,并返回商家首页。")})})]})}function e1i(e){var t,l;let i=e2U(e,"review"),a=eKB(),n=(0,eN.useRef)(null),r=(0,eN.useRef)(e);r.current=e;let o=(0,eN.useRef)(!0),s=(0,eN.useRef)(0),d={scopeKey:e.scopeKey,mode:e.mode,date:e.date,customerId:e.customerId,sessionId:e.session.sessionId,os:e.os,order:eKA(e.order)},c=(0,eN.useRef)(d);Object.keys(d).some(e=>d[e]!==c.current[e])&&(c.current=d);let u=c.current,p=(e,t)=>e.scopeKey===t.scopeKey&&e.mode===t.mode&&e.date===t.date&&e.sessionId===t.sessionId&&e.os===t.os&&e.order===t.order;(0,eN.useEffect)(()=>(o.current=!0,()=>{o.current=!1,s.current+=1}),[]);let m=[{id:"select",label:e.text("tickets"===e.mode?"Tickets":"Party","tickets"===e.mode?"门票":"派对")},...e.holderState.required||"holder"===e.step?[{id:"holder",label:e.text("Holder","持有人")}]:[],...e.hasExtras?[{id:"extras",label:e.text("Addons","附加商品")}]:[],{id:"review",label:e.text("Review","确认")}],g=Math.max(0,m.findIndex(t=>t.id===e.step)),h=null==(t=m[g-1])?void 0:t.id,v=async function(t){let l=arguments.length>1&&void 0!==arguments[1]&&arguments[1],d=r.current;if("extras"!==t||d.hasExtras||(t="review"),"review"===t&&d.hasExtras&&(d.extrasCatalog.loading||d.extrasCatalog.error)&&(t="extras"),!o.current||i.pending||u!==c.current||d.step!==e.step||d.isExtraQuantityPending())return;let h=m.findIndex(e=>e.id===t),v=h>=0&&h<g,f=++s.current,y=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],l=r.current;return o.current&&f===s.current&&(e?p(u,c.current):u===c.current)&&!1!==l.props.isActive&&l.step===d.step&&!l.disabled&&!l.isExtraQuantityPending()&&!l.composer&&!l.configurationModal&&("select"===t||v||l.hasBookings&&l.mainDateMatches&&(e?!l.mainPoolEmpty&&!l.main.error:!l.mainCatalogBlocked))};if(!y())return;if(!v&&("extras"===t||"review"===t)){if("holder"===d.step){var b;let e=await (null==(b=n.current)?void 0:b.validate());if(!y()||!e)return}let e=r.current;if(!eJK(e.context,e.scopeKey).complete){e.setError(e.text("Complete the required holder details first.","请先完成必填持票人资料。")),e.setStep("holder"),a('[data-booking-stage="holder"]');return}if("review"===t&&!e.checkExtraHolders())return}if(!y()||"holder"===t&&d.isKiosk&&(!await i.ensure()||!y(!0)))return;if("review"===t){if(!await i.ensure()||!y(!0))return;let e=r.current;if(!eJK(e.context,e.scopeKey).complete){e.setStep("holder"),a('[data-booking-stage="holder"]');return}}let x=r.current;"select"===t&&l&&x.setExpandedSection("product"),x.setError(void 0),x.setStep(t),x.orderPanel.close(),a(`[data-booking-stage="${t}"]`)},f=()=>{!h||e.disabled||i.pending||v(h)},y="review"===e.step||e.isKiosk&&"holder"===e.step;(0,eN.useEffect)(()=>{if(!y||!e.ready||i.ready)return;let t=!0,l=e.step;return i.ensure().then(e=>{let i=r.current;!e&&t&&o.current&&i.step===l&&p(u,c.current)&&i.setStep(h||"select")}),()=>{t=!1}},[y,e.step,e.ready,i.ready,i.ensure,u.scopeKey,u.mode,u.date,u.sessionId,u.os,u.order,h]);let b="select"===e.step?e.nextAfterSelect:"holder"===e.step?e.nextAfterHolder:"review",x="review"===e.step?e.text("Confirm & pay","确认并支付"):"holder"===b?e.text("Next: Holder","下一步:持有人"):"extras"===b?e.text("Next: add extras","下一步:附加商品"):"extras"!==e.step||e.extras.rows.some(e=>Number(e.num)>0)?e.text("Next: review & pay","下一步:确认订单"):eQA(e.locale,"skipExtras"),k={label:(0,eB.jsxs)(eB.Fragment,{children:[x," ",(0,eB.jsx)(e0D,{size:20,"aria-hidden":"true"})]}),compactLabel:x,disabled:e.disabled||!!e.depositHydration.error||i.pending||"review"===e.step&&!i.ready||!e.hasBookings||!e.mainDateMatches||e.mainCatalogBlocked||!!e.composer||!!e.configurationModal||("extras"===e.step||"review"===e.step)&&e.hasExtras&&(e.extrasCatalog.loading||!!e.extrasCatalog.error),busy:i.pending||e.depositHydration.pending||e.checkout.submitting||e.busy&&!e.pendingExtraProductId||e.holderBusy,onClick:async()=>{if(!(e.disabled||e.depositHydration.error||i.pending||e.isExtraQuantityPending()))if("review"===e.step){if(!await i.ensure())return;await e.checkout.checkout()&&!e.isKiosk&&e.setHandoff(!0)}else"select"===e.step?await v(eJK(e.context,e.scopeKey).required?"holder":e.nextAfterHolder):"holder"===e.step?await v(e.nextAfterHolder):await v("review")}},_={context:e.context,scopeKey:e.scopeKey,locale:e.locale,catalogProducts:e.main.products,isActive:e.props.isActive,disabled:e.externalHolderDisabled,onMutation:e.refresh,onStateChange:t=>e.setHolderBusy(t.pending),onRemoveTicket:"tickets"===e.mode?e.removeTicket:void 0},w=(0,eB.jsxs)("div",{className:"venue-booking-navigation",children:[(0,eB.jsx)(e1l,{runtime:e,onBack:h?f:void 0,disabled:i.pending}),(0,eB.jsx)(eQp,{current:g,label:e.text("Booking steps","预订步骤"),currentLabel:e.text("Current step","当前步骤"),steps:m.map(t=>({...t,status:("select"===t.id||e.hasBookings&&e.mainDateMatches&&!e.mainCatalogBlocked&&("holder"===t.id||e.holderState.complete))&&!e.disabled&&!i.pending?"available":"locked",onClick:()=>{v(t.id)}}))})]}),S=function(t){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(0,eB.jsx)(e2g,{context:e.context,scopeKey:e.scopeKey,mode:e.mode,locale:e.locale,inline:!0,productLineUid:t,ordinalOffset:l,onRemoveTicket:"tickets"===e.mode?e.removeTicket:void 0,disabled:e.disabled||!!e.composer||!!e.configurationModal,onEdit:()=>{v("holder")}})},j="tickets"===e.mode&&(0,eB.jsxs)("button",{type:"button",className:"add-session full",disabled:e.disabled||!!e.composer||!!e.configurationModal,onClick:()=>{v("select",!0)},children:[(0,eB.jsx)(e0O,{size:22,"aria-hidden":"true"}),e.text("Add more tickets","继续选购门票")]}),N=t=>(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)(e29,{runtime:e,review:!0,renderBookingDetails:t,onEditExtras:()=>{v("extras")}}),j,(0,eB.jsx)(e1e,{runtime:e,splitPartySubtotal:"party"===e.mode})]}),C=(0,eB.jsxs)(eB.Fragment,{children:["holder"===e.step&&(!e.isKiosk||i.ready)&&(0,eB.jsx)(e03,{ref:n,..._,afterAssignments:j}),"extras"===e.step&&(0,eB.jsx)(e28,{runtime:e}),y&&!i.ready&&(0,eB.jsx)("div",{className:"venue-booking-sales__loading",role:"status","aria-label":e.text("Loading checkout","正在加载确认页面"),children:(0,eB.jsx)(eM.Spin,{})}),"review"===e.step&&i.ready&&(0,eB.jsx)(e2p,{ref:e.confirmation,context:e.context,scopeKey:e.scopeKey,locale:e.locale,date:e.date,isActive:e.props.isActive,disabled:e.disabled,onMutation:e.refresh,onValidationBlocked:e.orderPanel.closeThen,includeHolderValidation:!1,orderReview:e.holderState.enabled&&!e.holderState.required?(0,eB.jsx)(e03,{ref:n,..._,renderContent:t=>{let{renderLine:l}=t;return N((t,i)=>e.holderState.lines.some(e=>e.uid===t)?l(t,i):S(t,i))}}):N("tickets"===e.mode||e.holderState.enabled?S:void 0),note:(0,eB.jsx)(e0L,{hideLabel:!0,maxLength:2e3,id:`${e.mode}-order-note`,label:e.text("Order note","订单留言"),value:String((null==(l=e.order)?void 0:l.note)||""),disabled:e.disabled,onChange:t=>{e.disabled||e.sales.setOrderNote(t)},placeholder:e.text("Anything else we should know?","还有什么需要告诉我们?")})})]});return{navigation:w,primaryAction:k,back:f,previous:h,holderRef:n,renderStage:C,goTo:v}}function e1a(e){let[t,l]=(0,eN.useState)(),i=(null==t?void 0:t.scopeKey)===e.scopeKey&&t.sessionId===e.session.sessionId&&t.date===e.date,a=function(e,t,l,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e;if(i&&e<a)return{status:"unavailable"};let n=i?[e]:Array.from(new Set(t)).filter(t=>t>=e&&t>=a).sort();for(let e of n){var r;let t=(null==(r=l[e])?void 0:r.status)||"loading";if("loading"===t||"error"===t)return{status:t};if("available"===t||"configuration"===t)return{status:t,date:e}}return{status:n.length?"unavailable":"loading"}}(e.date,e.dateSearchRange?eJk(e.dateSearchRange):e.visibleDates,e.dateStates,e.session.restored&&!e.dateSearchRange,e.today);(0,eN.useEffect)(()=>{!e.ready||e.disabled||e.dateConfirmed||i||e.hasBookings||e.composer||e.configurationModal||!e.canAutoSelectDate()||("available"===a.status||"configuration"===a.status)&&a.date&&(e.setDate(a.date),l({scopeKey:e.scopeKey,sessionId:e.session.sessionId,date:a.date}))},[e.ready,e.disabled,e.dateConfirmed,i,e.hasBookings,e.composer,e.configurationModal,e.scopeKey,e.session.sessionId,a.status,a.date,e.setDate,e.dateInteractionStarted]);let n=e.dateConfirmed||i;return{catalogueReady:n,status:a.status,searching:!n&&!!e.dateSearchRange&&"error"!==a.status&&"unavailable"!==a.status,searchRange:e.dateSearchRange,awaitingSelection:!n&&e.dateInteractionStarted&&("available"===a.status||"configuration"===a.status)}}let e1n={openCalendar:["Open calendar","打开日历"],closeCalendar:["Close calendar","关闭日历"],chooseVisitDate:["Choose your visit date","选择游玩日期"],chooseDate:["Choose a date","选择日期"],previousWeek:["Previous week","上一周"],nextWeek:["Next week","下一周"],backThisWeek:["This week","回到本周"],calendarToday:["Today","今天"],previousMonth:["Previous month","上个月"],nextMonth:["Next month","下个月"],calendarMonth:["Month","月份"],calendarYear:["Year","年份"],calendarThisMonth:["This month","回到本月"],calendarVenueTime:["Dates follow venue local time","日期按场馆当地时间"],dateNeedsReselect:["This date is no longer available. Please choose an available date.","此日期已不可预约,请重新选择可用日期。"],quickVisitDates:["Choose a day this week","快捷选择游玩日期"],calendarLoading:["Checking available dates…","正在查询可用日期…"],calendarLoadFailed:["Some dates could not be checked.","部分日期查询失败。"]},e1r=(e,t)=>{var l;return(null==(l=e1n[e])?void 0:l[+("zh"===t)])||e};function e1o(e){let{checkout:t,locale:l}=e;sZ(eq_,l),sZ(e0c,l);let i=t.kioskPaymentResult;if(!i)return null;let a=`${ez.getText("pisell2.big-sale.kiosk.back-home")} (${t.backHomeCountdown}s)`,n="payment"===i.kind&&!["success","deposit-paid"].includes(i.viewModel.status),r=[[...n?[{id:"continue-payment",buttonProps:{children:ez.getText("pisell2.venue-kiosk.checkout.continue-payment"),className:"primary-button",loading:t.submitting,disabled:t.resettingHome,onClick:()=>{t.checkout()}}}]:[],{id:"back-home",buttonProps:{children:n?ez.getText("pisell2.big-sale.kiosk.back-home"):a,className:n?void 0:"primary-button",loading:t.resettingHome,disabled:t.submitting,onClick:()=>{t.returnHome()}}}]];return(0,eB.jsxs)("section",{className:"venue-kiosk-result",children:[t.error&&(0,eB.jsx)(eZf,{tone:"error",children:t.error}),"payment"===i.kind?(0,eB.jsx)(WW,{...i.viewModel,presentation:"page",actionButtons:r,autoClose:!1,closable:!1,clickOutsideToClose:!1,footer:void 0}):(0,eB.jsxs)("div",{className:"venue-kiosk-result__submitted",children:[(0,eB.jsx)("h1",{children:ez.getText("pisell2.big-sale.kiosk.order-submitted")}),(0,eB.jsx)("p",{children:ez.getText("pisell2.big-sale.kiosk.order-submitted-description")}),(0,eB.jsx)("strong",{children:i.order.reference||`${ez.getText("pisell2.venue-kiosk.checkout.order-reference")} ${i.order.orderId}`}),i.order.paymentStatusLabel&&(0,eB.jsx)("p",{children:ez.getText(i.order.paymentStatusLabel)}),null!=i.order.amountDue&&i.order.amountDue>0&&(0,eB.jsxs)("p",{children:[ez.getText("pisell2.big-sale.kiosk.to-pay"),": ",i.order.amountDueText]}),(0,eB.jsxs)("div",{className:"venue-kiosk-result__actions",children:[(0,eB.jsx)(eKQ,{disabled:t.resettingHome||t.submitting,onClick:()=>{t.startNewOrder()},children:ez.getText("pisell2.big-sale.kiosk.start-next-order")}),(0,eB.jsx)(eKQ,{secondary:!0,disabled:t.resettingHome||t.submitting,onClick:()=>{t.returnHome()},children:a})]})]})]})}function e1s(e){var t;let l=e0P(e),i=e1a(l),a=e1i(l),n=e2J(l),r=eKB(),[o,s]=(0,eN.useState)(!1);(0,eN.useEffect)(()=>{if(!o)return;let e=window.setTimeout(()=>s(!1),1e3);return()=>window.clearTimeout(e)},[o]);let d=(0,eN.useRef)({scopeKey:e.scopeKey}),c=l.bindings.bindings.reduce((e,t)=>e+t.quantity,0),u=function(e,t){var l;let[i,a]=(0,eN.useState)({scope:t,indicators:null==e?void 0:e.map(e=>({status:e}))});if(i.scope!==t){let l=null==e?void 0:e.map(e=>({status:e}));return a({scope:t,indicators:l}),l}if(e&&(e.length!==(null==(l=i.indicators)?void 0:l.length)||e.some((e,t)=>{var l,a;return e!==(null==(a=i.indicators)||null==(l=a[t])?void 0:l.status)}))){let l=performance.now(),n=e.map((e,t)=>{var a;let n=null==(a=i.indicators)?void 0:a[t];return(null==n?void 0:n.status)===e?n:{status:e,from:null==n?void 0:n.status,changedAt:l}});return a({scope:t,indicators:n}),n}return i.indicators}([l.dateConfirmed?"complete":"available",i.catalogueReady?c>0?"complete":"available":"locked"],d.current),p="holder"===l.step?l.text("Who is joining the fun?","谁来一起玩?"):"extras"===l.step?l.text("Make your visit extra special","为游玩增添更多乐趣"):"review"===l.step?l.text("Review your booking","确认您的预订"):void 0,m=String(l.amount(l.hasBookings?l.hasDeposit?l.amountDue:null==(t=l.summary)?void 0:t.expect_amount:0)),g=async e=>{try{await l.changeDate(e)&&(s(!0),r("#ticket-products"))}catch(e){l.setError(e instanceof Error?e.message:String(e))}},h=!!l.session.error||!l.session.ready||l.session.pendingOrder;return l.isKiosk&&l.checkout.kioskPaymentResult?(0,eB.jsx)(e1o,{checkout:l.checkout,locale:l.locale}):(0,eB.jsxs)("div",{className:"venue-booking-sales venue-booking-sales--tickets",children:[(0,eB.jsx)(e20,{runtime:l,showHero:!h&&"select"===l.step}),h?(0,eB.jsx)(e22,{runtime:l}):(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)(eKV,{className:"ticket-catalog-layout",navigation:a.navigation,title:p,stage:l.step,summary:(0,eB.jsx)(eQm,{panel:l.orderPanel,title:l.text("Your order","您的订单"),closeLabel:l.text("Close order","关闭订单"),decoration:(0,eB.jsx)(eKh,{className:"order-mascot"}),body:(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)(e29,{runtime:l,onEditExtras:()=>{a.goTo("extras")}}),(0,eB.jsx)(e1e,{runtime:l,includeTotal:l.hasDeposit,includeDueNow:"review"===l.step&&!l.hasDeposit})]}),footer:(0,eB.jsxs)(eB.Fragment,{children:[n.summary,(0,eB.jsx)(eKU,{label:l.hasDeposit?l.text("Due now","本次待付"):l.text("Total","合计"),amount:m,total:!0}),(0,eB.jsx)(eKX,{action:a.primaryAction,className:"full"})]})}),footer:(0,eB.jsx)(eK2,{lang:l.locale,back:a.previous?{label:l.text("Previous step","上一步"),onClick:a.back}:void 0,summary:(0,eB.jsx)(eQg,{panel:l.orderPanel,title:l.text("Your order","您的订单"),label:l.hasDeposit?l.text("Deposit details","定金明细"):l.text("Details","明细"),total:m}),action:a.primaryAction,feedback:n.footer}),children:["select"===l.step&&(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("section",{id:"ticket-visit-date",className:"visit-date-panel","aria-label":l.text("Shared visit date","统一游玩日期"),tabIndex:-1,children:"date"!==l.expandedSection&&l.dateConfirmed?(0,eB.jsx)(eQe,{id:"ticket-date-summary",className:"visit-date-summary",number:1,stepStatus:null==u?void 0:u[0],title:l.text("Choose a date","选择日期"),open:!1,completing:o,locked:l.disabled,lang:l.locale,summary:(0,eB.jsx)("b",{children:eQM(l.date,l.locale)}),onToggle:()=>{l.disabled||(s(!1),l.setExpandedSection("date"),r("#ticket-visit-date"))},children:null}):(0,eB.jsx)(eQI,{value:l.date,onChange:e=>{g(e)},locale:l.locale,title:l.text("Choose a date","选择日期"),stepNumber:1,stepStatus:null==u?void 0:u[0],timeZone:l.bookingUI.timeZone,todayMarker:"device",minDate:l.today,dateStates:l.dateStates,loading:i.searching,onInteraction:l.onDateInteraction,onVisibleDatesChange:l.setVisibleDates,disabled:l.disabled,t:e=>e1r(e,l.locale)})}),(0,eB.jsx)(eQe,{id:"ticket-products",number:2,stepStatus:null==u?void 0:u[1],title:l.text("Choose tickets","选择门票"),open:"product"===l.expandedSection||!c||!!l.composer,lang:l.locale,locked:l.disabled||!i.catalogueReady,onToggle:()=>{!l.disabled&&i.catalogueReady&&l.setExpandedSection("product"===l.expandedSection&&c?"":"product")},summary:c?(0,eB.jsxs)("span",{children:[(0,eB.jsx)(eKq,{size:20,"aria-hidden":"true"})," ",c," ",l.text("tickets selected","张门票已选")]}):void 0,children:(0,eB.jsx)(e24,{runtime:l,preview:i})})]}),a.renderStage]}),l.composer&&(0,eB.jsx)(eZ2,{mode:"tickets",draft:l.composer,context:l.context,priceSource:l.mainQueries,operationLog:l.operationLog,scopeKey:l.scopeKey,date:l.date,customerId:l.customerId,locale:l.locale,formatAmount:l.amount,disabled:!l.ready||l.busy||l.extras.busy||l.holderBusy||l.checkout.submitting||!!l.checkout.failure||l.handoff,onBusyChange:l.setComposerBusy,skuOptions:{config:{overSold:l.composer.overSold}},requiredOptionValidation:l.composer.requiredOptionValidation,onDateChange:async e=>l.changeDate(e),onCancel:()=>l.setComposer(void 0),onCommitted:()=>{l.setRevision(e=>e+1),l.setExpandedSection("product"),l.setComposer(void 0)},renderDatePicker:e=>{let{date:t,disabled:i,onChange:a}=e;return(0,eB.jsx)(eQI,{value:t,onChange:a,locale:l.locale,title:l.text("Visit date","游玩日期"),timeZone:l.bookingUI.timeZone,todayMarker:"device",minDate:l.today,dateStates:l.dateStates,onVisibleDatesChange:l.setVisibleDates,disabled:i,t:e=>e1r(e,l.locale)})}},l.composer.key)]}),(0,eB.jsx)(e21,{runtime:l}),(0,eB.jsx)(e1t,{runtime:l})]})}let e1d=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M114.32,49.8A19.79,19.79,0,0,0,81.72,57L29.22,201.41A19.82,19.82,0,0,0,47.75,228a20,20,0,0,0,6.84-1.22L199,174.28a19.79,19.79,0,0,0,7.24-32.6ZM104.19,183.21l-31.4-31.4L82.94,123.9l49.16,49.16Zm-52.42,26.4Zm12-32.91L79.3,192.26l-24.45,8.89ZM157,164,92,99l10-27.58L184.57,154ZM128,40V16a12,12,0,0,1,24,0V40a12,12,0,0,1-24,0Zm116.48,83.51a12,12,0,0,1-17,17l-16-16a12,12,0,0,1,17-17Zm-.69-40.13-24,8a12,12,0,0,1-7.59-22.77l24-8a12,12,0,1,1,7.59,22.77ZM156.6,65.93C159.83,47.47,173.39,36,192,36c6.45,0,8.69-2.49,10-4.92a18,18,0,0,0,2-7.22V24a12,12,0,0,1,24,0c0,14.47-9.59,36-36,36-4.94,0-10.21,1.19-11.76,10.06A12,12,0,0,1,168.43,80a12.35,12.35,0,0,1-2.08-.18A12,12,0,0,1,156.6,65.93Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M58.89,154.89l42.22,42.22-50.63,18.4a7.79,7.79,0,0,1-10-10Zm138.82-4.72L105.83,58.29A7.79,7.79,0,0,0,93,61.14l-14.9,41,75.82,75.82,41-14.9A7.79,7.79,0,0,0,197.71,150.17Z",opacity:"0.2"}),eN.createElement("path",{d:"M111.49,52.63a15.8,15.8,0,0,0-26,5.77L33,202.78A15.83,15.83,0,0,0,47.76,224a16,16,0,0,0,5.46-1l144.37-52.5a15.8,15.8,0,0,0,5.78-26Zm-8.33,135.21-35-35,13.16-36.21,58.05,58.05Zm-55,20,14-38.41,24.45,24.45ZM156,168.64,87.36,100l13-35.87,91.43,91.43ZM160,72a37.8,37.8,0,0,1,3.84-15.58C169.14,45.83,179.14,40,192,40c6.7,0,11-2.29,13.65-7.21A22,22,0,0,0,208,23.94,8,8,0,0,1,224,24c0,12.86-8.52,32-32,32-6.7,0-11,2.29-13.65,7.21A22,22,0,0,0,176,72.06,8,8,0,0,1,160,72ZM136,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm101.66,82.34a8,8,0,1,1-11.32,11.31l-16-16a8,8,0,0,1,11.32-11.32Zm4.87-42.75-24,8a8,8,0,0,1-5.06-15.18l24-8a8,8,0,0,1,5.06,15.18Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M111.49,52.63a15.8,15.8,0,0,0-26,5.77L33,202.78A15.83,15.83,0,0,0,47.76,224a16,16,0,0,0,5.46-1l144.37-52.5a15.8,15.8,0,0,0,5.78-26ZM65.14,161.13l19.2-52.79,63.32,63.32-52.8,19.2ZM160,72a37.8,37.8,0,0,1,3.84-15.58C169.14,45.83,179.14,40,192,40c6.7,0,11-2.29,13.65-7.21A22,22,0,0,0,208,23.94,8,8,0,0,1,224,24c0,12.86-8.52,32-32,32-6.7,0-11,2.29-13.65,7.21A22,22,0,0,0,176,72.06,8,8,0,0,1,160,72ZM136,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm101.66,82.34a8,8,0,1,1-11.32,11.31l-16-16a8,8,0,0,1,11.32-11.32Zm4.87-42.75-24,8a8,8,0,0,1-5.06-15.18l24-8a8,8,0,0,1,5.06,15.18Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M110.08,54a13.8,13.8,0,0,0-22.73,5.05L34.85,203.47A13.82,13.82,0,0,0,47.76,222a14,14,0,0,0,4.77-.85l144.38-52.5a13.8,13.8,0,0,0,5-22.73ZM48.43,209.87a1.79,1.79,0,0,1-2.3-2.3L61.31,165.8,90.2,194.68Zm54.21-19.71-36.8-36.81L80.51,113,143,175.49ZM194,156.07a1.74,1.74,0,0,1-1.14,1.3L155.44,171,85,100.55,98.63,63.19a1.72,1.72,0,0,1,1.3-1.14,1.58,1.58,0,0,1,.41,0,1.72,1.72,0,0,1,1.25.53l91.88,91.88A1.73,1.73,0,0,1,194,156.07ZM162,72a35.52,35.52,0,0,1,3.63-14.68C170.57,47.44,179.93,42,192,42c7.47,0,12.53-2.74,15.48-8.38A24.18,24.18,0,0,0,210,24,6,6,0,0,1,216,18h0a6,6,0,0,1,6,6c0,10.38-6.27,30-30,30-7.47,0-12.53,2.74-15.48,8.38A24,24,0,0,0,174,72a6,6,0,0,1-6,6h0A6,6,0,0,1,162,72ZM138,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm98.24,83.76a6,6,0,1,1-8.48,8.48l-16-16a6,6,0,0,1,8.48-8.48Zm5.66-46.07-24,8a6,6,0,1,1-3.8-11.38l24-8a6,6,0,0,1,3.8,11.38Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M111.49,52.63a15.8,15.8,0,0,0-26,5.77L33,202.78A15.83,15.83,0,0,0,47.76,224a16,16,0,0,0,5.46-1l144.37-52.5a15.8,15.8,0,0,0,5.78-26Zm-8.33,135.21-35-35,13.16-36.21,58.05,58.05Zm-55,20,14-38.41,24.45,24.45ZM156,168.64,87.36,100l13-35.87,91.43,91.43ZM160,72a37.8,37.8,0,0,1,3.84-15.58C169.14,45.83,179.14,40,192,40c6.7,0,11-2.29,13.65-7.21A22,22,0,0,0,208,23.94,8,8,0,0,1,224,24c0,12.86-8.52,32-32,32-6.7,0-11,2.29-13.65,7.21A22,22,0,0,0,176,72.06,8,8,0,0,1,160,72ZM136,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm101.66,82.34a8,8,0,1,1-11.32,11.31l-16-16a8,8,0,0,1,11.32-11.32Zm4.87-42.75-24,8a8,8,0,0,1-5.06-15.18l24-8a8,8,0,0,1,5.06,15.18Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M108.66,55.46a11.79,11.79,0,0,0-19.43,4.31L36.73,204.15a11.81,11.81,0,0,0,11,15.85,11.88,11.88,0,0,0,4.08-.73l144.38-52.5a11.79,11.79,0,0,0,4.31-19.43Zm-6.53,137L63.52,153.87l16.19-44.51,66.92,66.93Zm-53,19.28a3.81,3.81,0,0,1-4.87-4.87l16.27-44.72,33.32,33.32Zm146.8-55.25a3.77,3.77,0,0,1-2.42,2.74l-38.56,14L82.72,101.07l14-38.56a3.77,3.77,0,0,1,2.74-2.42,4.32,4.32,0,0,1,.85-.09A3.65,3.65,0,0,1,103,61.12L194.88,153A3.78,3.78,0,0,1,195.91,156.51ZM220,24c0,9.68-5.85,28-28,28-8.31,0-14.18,3.29-17.42,9.79A26.12,26.12,0,0,0,172,72a4,4,0,0,1-8,0,34.06,34.06,0,0,1,3.42-13.79C170.66,51.73,177.56,44,192,44c19.29,0,20-18,20-20a4,4,0,0,1,4-4h0A4,4,0,0,1,220,24ZM140,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm94.83,85.17a4,4,0,0,1-5.66,5.66l-16-16a4,4,0,0,1,5.66-5.66Zm6.43-49.37-24,8A4,4,0,0,1,216,84a4,4,0,0,1-1.27-7.79l24-8a4,4,0,0,1,2.53,7.59Z"}))]]),e1c=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e1d}));e1c.displayName="ConfettiIcon";let e1u=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,60a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,60Zm0,64a20,20,0,1,1,20-20A20,20,0,0,1,128,124Zm0-112a92.1,92.1,0,0,0-92,92c0,77.36,81.64,135.4,85.12,137.83a12,12,0,0,0,13.76,0,259,259,0,0,0,42.18-39C205.15,170.57,220,136.37,220,104A92.1,92.1,0,0,0,128,12Zm31.3,174.71A249.35,249.35,0,0,1,128,216.89a249.35,249.35,0,0,1-31.3-30.18C80,167.37,60,137.31,60,104a68,68,0,0,1,136,0C196,137.31,176,167.37,159.3,186.71Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24a80,80,0,0,0-80,80c0,72,80,128,80,128s80-56,80-128A80,80,0,0,0,128,24Zm0,112a32,32,0,1,1,32-32A32,32,0,0,1,128,136Z",opacity:"0.2"}),eN.createElement("path",{d:"M128,64a40,40,0,1,0,40,40A40,40,0,0,0,128,64Zm0,64a24,24,0,1,1,24-24A24,24,0,0,1,128,128Zm0-112a88.1,88.1,0,0,0-88,88c0,31.4,14.51,64.68,42,96.25a254.19,254.19,0,0,0,41.45,38.3,8,8,0,0,0,9.18,0A254.19,254.19,0,0,0,174,200.25c27.45-31.57,42-64.85,42-96.25A88.1,88.1,0,0,0,128,16Zm0,206c-16.53-13-72-60.75-72-118a72,72,0,0,1,144,0C200,161.23,144.53,209,128,222Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,16a88.1,88.1,0,0,0-88,88c0,75.3,80,132.17,83.41,134.55a8,8,0,0,0,9.18,0C136,236.17,216,179.3,216,104A88.1,88.1,0,0,0,128,16Zm0,56a32,32,0,1,1-32,32A32,32,0,0,1,128,72Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,66a38,38,0,1,0,38,38A38,38,0,0,0,128,66Zm0,64a26,26,0,1,1,26-26A26,26,0,0,1,128,130Zm0-112a86.1,86.1,0,0,0-86,86c0,30.91,14.34,63.74,41.47,94.94a252.32,252.32,0,0,0,41.09,38,6,6,0,0,0,6.88,0,252.32,252.32,0,0,0,41.09-38c27.13-31.2,41.47-64,41.47-94.94A86.1,86.1,0,0,0,128,18Zm0,206.51C113,212.93,54,163.62,54,104a74,74,0,0,1,148,0C202,163.62,143,212.93,128,224.51Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,64a40,40,0,1,0,40,40A40,40,0,0,0,128,64Zm0,64a24,24,0,1,1,24-24A24,24,0,0,1,128,128Zm0-112a88.1,88.1,0,0,0-88,88c0,31.4,14.51,64.68,42,96.25a254.19,254.19,0,0,0,41.45,38.3,8,8,0,0,0,9.18,0A254.19,254.19,0,0,0,174,200.25c27.45-31.57,42-64.85,42-96.25A88.1,88.1,0,0,0,128,16Zm0,206c-16.53-13-72-60.75-72-118a72,72,0,0,1,144,0C200,161.23,144.53,209,128,222Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,68a36,36,0,1,0,36,36A36,36,0,0,0,128,68Zm0,64a28,28,0,1,1,28-28A28,28,0,0,1,128,132Zm0-112a84.09,84.09,0,0,0-84,84c0,30.42,14.17,62.79,41,93.62a250,250,0,0,0,40.73,37.66,4,4,0,0,0,4.58,0A250,250,0,0,0,171,197.62c26.81-30.83,41-63.2,41-93.62A84.09,84.09,0,0,0,128,20Zm37.1,172.23A254.62,254.62,0,0,1,128,227a254.62,254.62,0,0,1-37.1-34.81C73.15,171.8,52,139.9,52,104a76,76,0,0,1,152,0C204,139.9,182.85,171.8,165.1,192.23Z"}))]]),e1p=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e1u}));function e1m(e){let t=e0P(e),l=e1a(t),{composer:i,configurationModal:a,partyMain:n,date:r,step:o,ready:s}=t,[d,c]=(0,eN.useState)("");(0,eN.useEffect)(()=>t.subscribePartyProductConfirmed(()=>{t.setDateConfirmed(!0),c("product")}),[t.subscribePartyProductConfirmed,t.setDateConfirmed]),(0,eN.useEffect)(()=>{c("")},[o]),(0,eN.useEffect)(()=>{if(!d)return;let e=window.setTimeout(()=>c(""),1e3);return()=>window.clearTimeout(e)},[d]);let u=(0,eN.useRef)();(0,eN.useEffect)(()=>{if(!s||i||a||"select"!==o||!n||n.date===r)return;let e=`${n.productLineUid}:${r}`;u.current!==e&&(u.current=e,t.editLine(n.productLineUid))},[s,i,a,o,null==n?void 0:n.productLineUid,null==n?void 0:n.date,r]);let p={datePreview:l,completingSection:d,onComplete:c};return t.isKiosk&&t.checkout.kioskPaymentResult?(0,eB.jsx)(e1o,{checkout:t.checkout,locale:t.locale}):(0,eB.jsxs)(eB.Fragment,{children:[i?(0,eB.jsx)(e1g,{runtime:t,...p},i.key):(0,eB.jsx)(e1h,{runtime:t,...p}),(0,eB.jsx)(e21,{runtime:t}),(0,eB.jsx)(e1t,{runtime:t})]})}function e1g(e){let{runtime:t,datePreview:l,completingSection:i,onComplete:a}=e,n=t.composer,r=eZI({mode:"party",draft:n,context:t.context,scopeKey:t.scopeKey,priceSource:t.mainQueries,operationLog:t.operationLog,date:t.date,customerId:t.customerId,locale:t.locale,disabled:!t.ready||t.busy||t.holderBusy||t.checkout.submitting||t.handoff,onBusyChange:t.setComposerBusy,onDraftChange:e=>t.rememberPartyPreview(n.key,e),onDateChange:async e=>{await t.changeDate(e)},onCancel:()=>t.setComposer(void 0),onCommitted:()=>{let e=eJK(t.context,t.scopeKey).required?"holder":t.nextAfterHolder;t.setRevision(e=>e+1),t.setStep(e),t.setComposer(void 0)},prepareRelated:async()=>{if(!t.partyMain)return{};let e=await t.extras.prepareRevalidation();if(e.invalidItems.length)throw Error(t.text("Some extras are unavailable for the new Party selection. Remove or reselect them before saving. ","部分附加商品不适用于新选择,请移除或重新选择后保存。 ")+e.invalidItems.map(e=>e.message).join(" "));return{mode:Number(t.partyMain.line.product_id)===Number(n.detail.id)?"edit":"replace",relatedRetailProducts:e.validRows,availabilityCommitGuard:()=>{var l;let i=eJY(t.os.getTempOrder(),{mode:"party"});if((null==(l=i.bindings[0])?void 0:l.productLineUid)!==t.partyMain.productLineUid||JSON.stringify(i.extras)!==JSON.stringify(e.sourceRows))throw Error(t.text("The extras changed. Please review your Party again.","附加商品已变化,请重新核对 Party。"))}}}}),o=eZ0({enabled:!1!==t.props.isActive,openId:n.key,scopeKey:t.scopeKey,sessionId:t.session.sessionId,productDetail:n.detail,skuValue:r.configuration.skuValue,quantity:r.quantity,overSold:1===n.overSold,priceBasis:"catalog",timeZone:t.bookingUI.timeZone,customerId:t.customerId,os:t.mainQueries}),s=eKB();return(0,eB.jsx)(eZw,{ref:r.panelRef,...r.bookingProps,onExplicitSelection:(e,l)=>{if("time"===e){null==a||a("time");let e=l.resourceGroups.some(e=>!eQR(e,r.bookingProps.resourceSettings));t.setExpandedSection(!l.ready&&e?"resource":""),s(l.ready?".party-app .booking-primary-action":e?"#party-room":"#party-time",{block:l.ready?"nearest":"start"})}else l.ready&&(null==a||a("resource"),t.setExpandedSection(""),s(".party-app .booking-primary-action",{block:"nearest"}))},renderContent:e=>(0,eB.jsx)(e1h,{runtime:t,datePreview:l,model:r,selection:e,estimatedSubtotal:"ready"===o.status?o.subtotal:void 0,completingSection:i,onComplete:a})})}function e1h(e){var t,l,i,a;let{runtime:n,datePreview:r,model:o,selection:s,estimatedSubtotal:d,completingSection:c,onComplete:u}=e,p=o?B4(o.prepared.product).required:n.holderState.required,m=e1i({...n,holderState:{...n.holderState,required:p}}),g=e2J(n,null==o?void 0:o.error),h=eKB(),{text:v,locale:f,partyMain:y,expandedSection:b,dateConfirmed:x}=n,k=v("Your party","Party 订单明细"),_=eQM(n.date,"zh"===f?"zh-CN":"en-AU",{weekday:"short",year:"numeric",month:"short",day:"numeric"}),w=n.composer,S=w?eKT(w.detail.title||w.detail.name,f):y?eKT(y.line.product_title,f):"",j=null==s?void 0:s.state.candidate,N=o?j?`${e1v(j.bookingStartAt||j.startAt)}–${e1v(j.bookingEndAt||j.endAt)}`:"":y?`${y.booking.start_time}–${y.booking.end_time}`:"",C=o?((null==s?void 0:s.state.selectedResourceDetails)||[]).map(e=>{var t;return eKT(e.name||(null==(t=e.raw)?void 0:t.name),f)}).filter(Boolean).join(" \xb7 "):((null==y?void 0:y.booking.resources)||[]).map(e=>{var t;return eKT((null==(t=e.metadata)?void 0:t.resource_name)||e.title||e.name||e.resource_name,f)}).filter(Boolean).join(" \xb7 "),M=o?!!(j&&(j.businessDate||j.date)===n.date&&(null==s?void 0:s.state.times.some(e=>eQQ(e,j)&&eQK(e,(s.state.partySize||0)*s.state.bookingCount)))):!!(N&&n.mainDateMatches),T=(null==o?void 0:o.prepared.partySize)??(null==y||null==(t=y.intent.resources[0])?void 0:t.capacity),I=iB((null==o?void 0:o.configuration.skuValue)||(y?{...y.line.product_sku,bundle:y.line.product_bundle}:void 0),"",e=>eKT(e,f),e=>String(n.amount(e))),P=!!S,A=o?o.bookingReady:n.hasBookings&&n.mainDateMatches,D=n.disabled||!!(null==o?void 0:o.working),E=n.context.sales.salesSettings,O=null==E||null==(l=E.reservation)?void 0:l.resourceSettings,z="picoding"!==n.context.sales.salesSettingsSource||!!(E&&!n.context.sales.salesSettingsError),L=(null==o?void 0:o.prepared.product)||(null==w?void 0:w.detail)||y&&n.main.products.find(e=>String(e.id)===String(y.line.product_id)),R=L?eQF(L,O):!y||y.intent.resources.some(e=>!eQR({formId:e.formId},O)),$=z&&(s?s.showResources:R),F=e=>{!D&&("resource"!==e||$)&&(null==u||u(e?"":b),n.setStep("select"),n.setExpandedSection(e),!o&&y&&["time","resource"].includes(e)&&n.editLine(y.productLineUid),h(`#party-${"resource"===e?"room":e}`))},q=e=>{D||n.orderPanel.closeThen(e)},B="select"===n.step?{label:v("Next: ","下一步:")+(p?v("holder details","Holder 资料"):n.hasExtras?v("extras","附加商品"):v("review","确认")),busy:(null==o?void 0:o.working)||n.busy||n.depositHydration.pending,disabled:D||n.mainCatalogBlocked||!A||!o&&!!n.depositHydration.error,onClick:async()=>{!D&&!n.mainCatalogBlocked&&A&&(o?await o.commit()&&n.orderPanel.closeThen(()=>h("[data-booking-stage]")):n.orderPanel.closeThen(()=>{n.continueOrder(n.nextAfterSelect),h("[data-booking-stage]")}))}}:m.primaryAction,H=(null==o||null==(i=o.quote)?void 0:i.compositeLineTotal)??d,V=o?null==H?"—":n.amount(H):n.amount(n.hasBookings?n.hasDeposit?n.amountDue:null==(a=n.summary)?void 0:a.expect_amount:0),U=(0,eB.jsx)(eB.Fragment,{children:P?(0,eB.jsxs)("div",{className:"party-summary-lines",children:[(0,eB.jsx)(e0U,{items:[{label:v("Your party","我的 Party"),value:S,detail:(0,eB.jsxs)(eB.Fragment,{children:[T?(0,eB.jsxs)("div",{children:[T," ",v("guests","位参加者")]}):null,I.map(e=>(0,eB.jsxs)("div",{children:[e.label," ",e.meta]},e.key)),!o&&y&&(0,eB.jsx)(e2G,{products:[y.line],locale:f})]}),action:{label:v("Edit","编辑"),onClick:()=>q(()=>F("product")),disabled:D}},{label:v("When","日期与时间"),value:_,detail:N||v("Choose a time","待选择时间"),action:{label:v("Edit","编辑"),onClick:()=>q(()=>F("date")),disabled:D}},{label:v("Where","Party room"),value:C||v("Choose a room","待选择房间"),action:$?{label:v("Edit","编辑"),onClick:()=>q(()=>F("resource")),disabled:D}:void 0},...n.holderState.enabled?[{label:v("Holder","持有人"),value:`${n.holderState.completed} / ${n.holderState.total}`,detail:(0,eB.jsx)(e2W,{context:n.context,locale:f,lines:n.holderState.lines.filter(e=>e.uid===(null==y?void 0:y.productLineUid))}),action:{label:v("Edit","编辑"),onClick:()=>q(()=>{n.setStep(n.holderState.required?"holder":"review"),h("[data-booking-stage]")}),disabled:D||!!o}}]:[]]}),n.extras.rows.length>0&&(0,eB.jsx)(e25,{text:v}),(0,eB.jsx)(e29,{runtime:n,onlyExtras:!0,onEditExtras:()=>{m.goTo("extras")}}),o?(0,eB.jsx)(eKU,{label:v("Party selection subtotal","Party 选择小计"),amount:V}):(0,eB.jsx)(e1e,{runtime:n,splitPartySubtotal:!0,includeTotal:n.hasDeposit,includeDueNow:"review"===n.step&&!n.hasDeposit}),o&&(0,eB.jsx)("p",{className:"small muted",children:v("Final fees and discounts are calculated after saving your selection.","保存选择后计算最终费用与优惠。")})]}):(0,eB.jsx)(eZy,{className:"party-empty",description:v("A wonderful party starts here. Choose a date and a package.","从选日期和商品开始,安排一场欢乐派对。"),icon:(0,eB.jsx)(e1c,{size:34})})}),Y=(0,eB.jsx)(eQI,{value:n.date,onChange:e=>{n.changeDate(e,o?{configuration:o.configuration,initialSelection:o.selection,quantity:o.quantity}:void 0).then(e=>{e&&(null==u||u("date"),h(o?"#party-time":"#party-product"))}).catch(e=>n.setError(e instanceof Error?e.message:String(e)))},locale:"zh"===f?"zh-CN":"en-AU",timeZone:n.bookingUI.timeZone,todayMarker:"device",title:v("Choose a date","选择日期"),stepNumber:1,stepStatus:{status:x?"complete":"available"},minDate:n.today,disabled:D,dateStates:n.dateStates,onVisibleDatesChange:n.setVisibleDates,loading:r.searching,onInteraction:n.onDateInteraction,t:e=>e1r(e,f)});return n.session.error||!n.session.ready||n.session.pendingOrder||!n.uiHydrated||n.previewRecovery?(0,eB.jsxs)("div",{className:"venue-booking-sales venue-booking-sales--party",children:[(0,eB.jsx)(e20,{runtime:n}),(0,eB.jsx)(e22,{runtime:n}),n.previewRecovery&&(0,eB.jsxs)(eZf,{tone:n.previewRecoveryError?"error":void 0,children:[(0,eB.jsx)("p",{children:n.previewRecoveryError||v("Restoring your Party selection with current availability and prices…","正在按当前可用性和价格恢复 Party 选择…")}),n.previewRecoveryError&&(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)(eKQ,{secondary:!0,disabled:n.recoveringPreview,onClick:n.retryPartyPreview,children:v("Retry","重试")}),(0,eB.jsx)(eKQ,{secondary:!0,disabled:n.recoveringPreview,onClick:n.discardPartyPreview,children:v("Discard unsaved selection","放弃未保存的选择")})]})]})]}):(0,eB.jsxs)("div",{className:"venue-booking-sales venue-booking-sales--party party-app",children:[(0,eB.jsx)(e20,{runtime:n}),(0,eB.jsx)(eKV,{className:"party-booking-page",stage:n.step,navigation:m.navigation,title:"holder"===n.step?v("Choose a Holder","选择持有人"):"extras"===n.step?v("Make it your Party","为 Party 增添更多乐趣"):"review"===n.step?v("Your party, all together","确认您的欢乐派对"):void 0,summary:(0,eB.jsx)(eQm,{panel:n.orderPanel,title:k,closeLabel:v("Close","关闭"),body:U,footer:(0,eB.jsxs)(eB.Fragment,{children:[g.summary,(0,eB.jsx)(eKU,{label:o?v("Party selection subtotal","Party 选择小计"):n.hasDeposit?v("Due now","本次待付"):v("Party total","Party 总额"),amount:V,total:!0}),(0,eB.jsx)("div",{className:"party-actions",children:(0,eB.jsx)(eKX,{action:B})})]}),decoration:(0,eB.jsx)(eKh,{variant:"summary"})}),footer:(0,eB.jsx)(eK2,{lang:f,back:m.previous?{label:v("Previous step","上一步"),onClick:m.back}:void 0,summary:(0,eB.jsx)(eQg,{panel:n.orderPanel,title:k,label:!o&&n.hasDeposit?v("Deposit details","定金明细"):v("Details","明细"),total:String(V)}),action:B,feedback:g.footer}),children:"select"===n.step?(0,eB.jsxs)("div",{className:"party-arrangement",children:[(0,eB.jsx)("section",{id:"party-date",tabIndex:-1,className:"visit-date-panel",children:"date"!==b&&x?(0,eB.jsx)(eQe,{lang:f,id:"party-date-summary",number:1,completing:"date"===c,stepStatus:{status:"complete"},title:v("Choose a date","选择日期"),open:!1,summary:(0,eB.jsx)("b",{children:_}),onToggle:()=>F("date"),locked:D,children:null}):Y}),(0,eB.jsx)(eQe,{lang:f,id:"party-product",number:2,title:v("Choose your party package","选择 Party 商品"),completing:"product"===c,stepStatus:{status:P?"complete":r.catalogueReady?"available":"locked"},open:"product"===b||!P,summary:P?(0,eB.jsx)("b",{children:S}):void 0,onToggle:()=>{null==u||u("product"===b?"product":""),n.setExpandedSection("product"===b?"":"product")},locked:D||!r.catalogueReady,children:(0,eB.jsx)(e24,{runtime:n,preview:r,showFilters:!1})}),(0,eB.jsx)(eQe,{lang:f,id:"party-time",number:3,title:v("Choose a time","选择时间"),completing:"time"===c,stepStatus:{status:M?"complete":P?"available":"locked"},open:"time"===b||!M,summary:N?(0,eB.jsx)("b",{children:N}):void 0,onToggle:()=>F("time"===b?"":"time"),locked:D||!P,children:s?s.timeContent:n.preparingProductId?(0,eB.jsx)(eZy,{className:"party-empty",pending:!0,description:v("Loading your Party selection…","正在加载您的 Party 选择…")}):(0,eB.jsx)(eZy,{className:"party-empty",icon:(0,eB.jsx)(e0$,{size:28}),description:v("Choose your Party package first.","请先选择 Party 商品。")})}),$&&(0,eB.jsx)(eQe,{lang:f,id:"party-room",number:4,title:v("Choose a room","选择房间"),completing:"resource"===c,stepStatus:{status:A?"complete":M?"available":"locked"},open:"resource"===b||!C||!A,summary:C?(0,eB.jsx)("b",{children:C}):void 0,onToggle:()=>F("resource"===b?"":"resource"),locked:D||!M,children:s&&M?s.resourceContent:n.preparingProductId?(0,eB.jsx)(eZy,{className:"party-empty",pending:!0,description:v("Loading your Party selection…","正在加载您的 Party 选择…")}):(0,eB.jsx)(eZy,{className:"party-empty",icon:(0,eB.jsx)(e1p,{size:28}),description:v("Choose a time to see available rooms.","选择时间后查看可用房间。")})}),!A&&(null==s?void 0:s.statusPanel),A&&!b&&!D&&!(null==o?void 0:o.error)&&(0,eB.jsxs)(eZf,{id:"party-ready-notice",className:"party-ready-notice",tone:"success",icon:(0,eB.jsx)(eZR,{weight:"bold","aria-hidden":"true"}),children:[(0,eB.jsxs)("div",{className:"party-ready-copy",children:[(0,eB.jsx)("strong",{children:v("Your party choices are ready","Party 安排已选好")}),(0,eB.jsxs)("p",{children:[(0,eB.jsx)("span",{className:"party-ready-desktop",children:v("Click ","点击右侧")}),(0,eB.jsx)("span",{className:"party-ready-mobile",children:v("Tap ","点击底部")}),(0,eB.jsx)("b",{children:"zh"===f?(0,eB.jsxs)(eB.Fragment,{children:["「",B.label,"」"]}):(0,eB.jsxs)(eB.Fragment,{children:["“",B.label,"”"]})}),"en"===f&&(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("span",{className:"party-ready-desktop",children:" on the right."}),(0,eB.jsx)("span",{className:"party-ready-mobile",children:" below."})]})]})]}),(0,eB.jsx)(e0D,{className:"party-ready-direction",size:28,"aria-hidden":"true"})]})]}):m.renderStage})]})}function e1v(e){var t;return(null==(t=String(e||"").match(/[T ](\d{2}:\d{2})/))?void 0:t[1])||String(e||"").slice(0,5)}function e1f(e){var t,l,i,a,n,r,o,s,d,c,u,p,m,g,h;let v="tickets"===e.mode?e1s:e1m,f=eR(),y=(0,eN.useRef)({brand:void 0,design:void 0}),b=function(e,t,l){let i,a;if(!eKM(e)||!eKM(e.steps))return{status:"invalid",reason:"Booking menus have not been configured."};if(void 0!==e.template&&e.template!==t)return{status:"invalid",reason:"The booking template and menu configuration do not match."};let n=[t];Object.prototype.hasOwnProperty.call(e.steps,"extras")&&n.push("extras");let r={};for(let t of n){let l=e.steps[t],i=eKM(l)?l.catalog:void 0,a=eKM(i)?i.menuListIds:void 0;if(!Array.isArray(a)||a.some(e=>"number"!=typeof e||!Number.isSafeInteger(e)||e<=0))return{status:"invalid",reason:`The ${t} menu configuration is missing or invalid.`};r[t]={catalog:{menuListIds:[...new Set(a)]}}}let o=function e(t){if("string"!=typeof t)return;let l=t.trim();if(/^#[\da-f]{6}$/i.test(l))return l.toUpperCase();if(/^#[\da-f]{3}$/i.test(l))return`#${l.slice(1).split("").map(e=>e+e).join("")}`.toUpperCase();if(/^#[\da-f]{6}ff$/i.test(l))return l.slice(0,7).toUpperCase();if(/^#[\da-f]{3}f$/i.test(l))return e(l.slice(0,4));let i=/^(rgb|rgba)\(([^)]+)\)$/i.exec(l);if(!i)return;let a=i[2].split(",").map(e=>e.trim());if(a.length!==("rgba"===i[1].toLowerCase()?4:3)||a.some(e=>!/^(?:\d+(?:\.\d+)?|\.\d+)%?$/.test(e))||4===a.length&&1!==(a[3].endsWith("%")?parseFloat(a[3])/100:Number(a[3])))return;let n=a.slice(0,3).map(e=>{let t=e.endsWith("%"),l=parseFloat(e);return l<0||l>(t?100:255)?NaN:Math.round(t?255*l/100:l)});if(!n.some(e=>!Number.isFinite(e)))return`#${n.map(e=>e.toString(16).padStart(2,"0")).join("")}`.toUpperCase()}(l),s=eKM(e.brand)?e.brand:void 0,d=s||o?{name:"string"==typeof(null==s?void 0:s.name)?s.name:void 0,title:"string"==typeof(null==s?void 0:s.title)?s.title:void 0,logo:"string"==typeof(null==s?void 0:s.logo)?s.logo:void 0,hero:"string"==typeof(null==s?void 0:s.hero)?s.hero:void 0,primaryColor:o??("string"==typeof(null==s?void 0:s.primaryColor)?s.primaryColor:void 0),mascot:"string"==typeof(null==s?void 0:s.mascot)?s.mascot:void 0,logoMode:(null==s?void 0:s.logoMode)==="full"?"full":"icon-and-name"}:void 0;try{i=eK_(e.design),eKw(d)}catch{a="The booking design configuration is invalid."}return{status:"ready",value:{template:t,steps:r,brand:d,design:i,visualError:a},scopeKey:JSON.stringify({template:t,steps:r})}}(e.config,e.mode,null==f||null==(l=f.appHelper)||null==(t=l.constants)?void 0:t.themeColor),x=e.context.sales.bookingTicket;if("invalid"===b.status)return(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:b.reason});if(!x)return(0,eB.jsx)(eM.Spin,{});let k=(null==f||null==(n=f.appHelper)||null==(a=n.utils)||null==(i=a.getData)?void 0:i.call(a,"timezone"))||(null==(r=x.otherParams)?void 0:r.businessTimezone);if(!k&&"pending"===e.context.sales.catalogState)return(0,eB.jsx)(eM.Spin,{});try{if(!k)throw Error();eKD(k)}catch{return(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:String(e.locale).startsWith("zh")?"场馆时区尚未配置,请联系商家。":"The venue timezone is not configured. Please contact the venue."})}if("function"!=typeof x.createVenueCatalogSession)return(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:String(e.locale).startsWith("zh")?"预约服务尚未更新,请联系商家。":"The booking service needs to be updated. Please contact the venue."});let _=e.businessCode||(null==(o=x.otherParams)?void 0:o.businessCode)||"venue_booking",w=x.otherParams,S=eKE(x),j=null==f||null==(c=f.appHelper)||null==(d=c.utils)||null==(s=d.getData)?void 0:s.call(d,"shop_id"),N=JSON.stringify([(null==w?void 0:w.shopId)!=null&&String(w.shopId)!==String(j)?w.shopId:j,(null==w?void 0:w.previousVenueCacheId)&&"venue_booking"===_?null:null==w?void 0:w.tenantId,e.context.sales.osKey,k,b.scopeKey,..."venue_booking"===_?[]:[_],...S?["kiosk",e.mode]:[]]),C=String(e.locale).startsWith("zh")?"zh":"en";b.value.visualError||(y.current={brand:b.value.brand,design:b.value.design});let M={...b.value,...y.current},T={...M.brand,name:(null==(u=M.brand)?void 0:u.name)||(null==(p=M.brand)?void 0:p.title)||eKT(null==f||null==(h=f.appHelper)||null==(g=h.utils)||null==(m=g.getData)?void 0:m.call(g,"shop_name"),C)||("zh"===C?"预订游玩":"Book your visit")};return(0,eB.jsx)(eM.ConfigProvider,{theme:{token:{colorPrimary:T.primaryColor||"#D61518",colorText:"#092d3e",fontFamily:'BookingDM, "PingFang SC", "Microsoft YaHei", sans-serif'}},children:(0,eB.jsx)(eKC,{lang:C,brand:T,design:M.design,timeZone:k,className:"venue-booking-design",presentationPlatform:S?"kiosk":"default",layout:S?"compact":"responsive",children:(0,eB.jsx)(v,{...e,businessCode:_,config:M,scopeKey:N},N)})})}function e1y(e){let{tmpl:t="standard",venueBookingConfig:l,isActive:i=!0,catalogPreparation:a,osKey:n,productListPreferencesChannel:r,context:o,mode:s,variant:d,productLoadParams:c,businessCode:u,bookingConfigParams:p,hideSelectFloorMapResourceAction:m,productDisplayConfig:g,productCatalogSessionKey:h,productCatalogReady:v,kioskShellLayout:f,kioskAppearance:y,saleDetailTemplate:b,saleDetailModuleConfig:x,orderId:k,locale:_,onLocaleChange:w,saleDetailWrapperProps:S,saleDetailHeaderSlot:j,rightActionBarClose:N,onOrderComplete:C,onPaidCheckout:M,onPaymentPageActiveChange:T,onRequestHome:I,renderCatalog:P,externalActionRequest:A,onExternalActionAccepted:D,onExternalPaymentSettled:E}=e;switch(t){case"venue-ticket-booking":case"venue-party-booking":return(0,eB.jsx)(e1f,{mode:"venue-ticket-booking"===t?"tickets":"party",businessCode:u,context:o,variant:d,config:l,isActive:i,locale:_,onRequestHome:I});case"HDLKiosk":return(0,eB.jsx)(eKl,{isActive:i,osKey:n,context:o,mode:s,variant:d,businessCode:u,locale:_,onLocaleChange:w,productLoadParams:c,productCatalogSessionKey:h,productCatalogReady:v});case"kiosk":return(0,eB.jsx)(eVg,{isActive:i,catalogPreparation:a,osKey:n,productListPreferencesChannel:r,context:o,mode:s,variant:d,productLoadParams:c,businessCode:u,bookingConfigParams:p,hideSelectFloorMapResourceAction:m,productDisplayConfig:g,productCatalogSessionKey:h,productCatalogReady:v,kioskShellLayout:f,kioskAppearance:y,saleDetailTemplate:b,saleDetailModuleConfig:x,orderId:k,locale:_,saleDetailHeaderSlot:j,onOrderComplete:C,onPaidCheckout:M,onPaymentPageActiveChange:T,onRequestHome:I,renderCatalog:P});case"secondaryScreen":return(0,eB.jsx)(eHa,{osKey:n,context:o,mode:s,variant:d,productLoadParams:c,businessCode:u,bookingConfigParams:p,hideSelectFloorMapResourceAction:m,productDisplayConfig:g,productCatalogSessionKey:h,productCatalogReady:v,saleDetailTemplate:b,saleDetailModuleConfig:x,orderId:k,locale:_,saleDetailWrapperProps:S,saleDetailHeaderSlot:j,onOrderComplete:C});default:return(0,eB.jsx)(eHi,{isActive:i,osKey:n,productListPreferencesChannel:r,context:o,mode:s,variant:d,productLoadParams:c,businessCode:u,bookingConfigParams:p,hideSelectFloorMapResourceAction:m,productDisplayConfig:g,productCatalogSessionKey:h,productCatalogReady:v,saleDetailTemplate:b,saleDetailModuleConfig:x,orderId:k,locale:_,saleDetailWrapperProps:S,saleDetailHeaderSlot:j,rightActionBarClose:N,onOrderComplete:C,externalActionRequest:A,onExternalActionAccepted:D,onExternalPaymentSettled:E})}}function e1b(e){var t,l;let i,a,n,r,o,s,{isActive:d=!0,catalogPreparation:c,osKey:u,saleDetailHeaderSlot:p,rightActionBarClose:m,overlaySlot:g,className:h,style:v,mode:f="ticket",tmpl:y,template:b="standard",venueBookingConfig:x,variant:k="desktop",productLoadParams:_,businessCode:w,bookingConfigParams:S,hideSelectFloorMapResourceAction:j,productDisplayConfig:N,productCatalogSessionKey:C,productCatalogReady:M,kioskShellLayout:T,kioskAppearance:I,saleDetailTemplate:P,saleDetailModuleConfig:A,autoCreate:D=!0,orderId:E,locale:O,onLocaleChange:z,saleDetailWrapperProps:L,cartProductsPerRow:R,showClient:$,onOrderComplete:F,onPaidCheckout:q,onPaymentPageActiveChange:B,onRequestHome:H,renderCatalog:V,externalActionRequest:U,onExternalActionAccepted:Y,onExternalPaymentSettled:W}=e;sZ(eq_,O);let G=(i=eb$(),a=eCj(),n=ebU(),r=eNa(),o=eCN(),s=eCS(),(0,eN.useMemo)(()=>({sales:i,products:a,customer:n,cart:r,summary:o,booking:s}),[i,a,n,r,o,s]));eW(d);let K=y||b||"standard",Q=(0,eN.useRef)(!1),Z=(null==(l=G.booking)||null==(t=l.getBookingConfig)?void 0:t.call(l))??null,{salesSettingsSource:J,salesSettings:X,salesSettingsError:ee,salesSettingsPlatform:et,ensureSalesSettings:el}=G.sales,ei="picoding"===J&&!X,ea=function(e){let{template:t,mode:l,bookingConfig:i,salesSettingsSource:a,salesSettings:n,platform:r,saleDetailModuleConfig:o,cartProductsPerRow:s,showClient:d}=e;return(0,eN.useMemo)(()=>{var e;let c;return(c=function(e,t){if(!e&&!t)return;let l={...e,...t,hidden:[...new Set([...(null==e?void 0:e.hidden)??[],...(null==t?void 0:t.hidden)??[]])],amountDetails:{...null==e?void 0:e.amountDetails,...null==t?void 0:t.amountDetails},promotionWalletPanelsBehavior:{...null==e?void 0:e.promotionWalletPanelsBehavior,...null==t?void 0:t.promotionWalletPanelsBehavior}};if((null==e?void 0:e.cartItems)||(null==t?void 0:t.cartItems)){var i,a;l.cartItems={...null==e?void 0:e.cartItems,...null==t?void 0:t.cartItems,layout:{...null==e||null==(i=e.cartItems)?void 0:i.layout,...null==t||null==(a=t.cartItems)?void 0:a.layout}}}return l}(function(e){var t,l;let i,{template:a,mode:n,bookingConfig:r,salesSettingsSource:o,salesSettings:s,platform:d,cartProductsPerRow:c,showClient:u}=e,p="secondaryScreen"===a;if("picoding"===o&&!s)return;let m="picoding"===o?{isShowImage:s.cart.showProductImage,isShowDelete:!!iI(d)||s.cart.showRemoveButton}:(t="retail"===n?"retail":"appointment",{isShowImage:eCA((i=((null==r||null==(l=r.config)?void 0:l.cart_settings_tab)||{})[`${t}_product_card_style`]||{}).show_product_image)??!0,isShowDelete:eCA(i.show_remove_button)??!0}),g=function(e){if(void 0!==e)return{columns:e}}(c),h={cartItems:{showProductImage:m.isShowImage,showRemoveButton:!p&&m.isShowDelete,...g?{layout:g}:{}},promotionWalletPanelsBehavior:{enableVoucherProductAdd:!p,enableWalletAssets:!p}};if(p){let e=[...eC$];!1===u&&e.push("customer"),h.hidden=e,h.amountDetails={defaultExpanded:!0}}return h}(e={template:t,mode:l,bookingConfig:i,salesSettingsSource:a,salesSettings:n,platform:r,cartProductsPerRow:s,showClient:d,saleDetailModuleConfig:o}),e.saleDetailModuleConfig))&&"secondaryScreen"===e.template?{...c,cartItems:{...c.cartItems,showRemoveButton:!1},promotionWalletPanelsBehavior:{...c.promotionWalletPanelsBehavior,enableVoucherProductAdd:!1,enableWalletAssets:!1}}:c},[t,l,i,a,n,r,s,d,o])}({template:K,mode:f,bookingConfig:Z,salesSettingsSource:J,salesSettings:X,platform:et,saleDetailModuleConfig:A,cartProductsPerRow:R,showClient:$}),en="secondaryScreen"===K,er="standard"===K,eo=G.sales.productLoadChannel||"pos";return((0,eN.useEffect)(()=>{ei||!D||E||Q.current||!G.sales.bookingTicket||G.sales.tempOrder||"idle"===G.sales.status&&(Q.current=!0,G.sales.createNew().catch(()=>{Q.current=!1}))},[D,E,G.sales,G.sales.bookingTicket,G.sales.status,G.sales.tempOrder,ei]),ei)?(0,eB.jsx)("div",{className:aj()("pisell-big-sale",h),style:v,children:ee?(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:ee.message,action:(0,eB.jsx)(eM.Button,{onClick:()=>void el().catch(()=>void 0),children:ez.getText("pisell2.big-sale.reload")})}):(0,eB.jsx)(eM.Spin,{})}):(0,eB.jsxs)("div",{className:aj()("pisell-big-sale",`pisell-big-sale--${k}`,`pisell-big-sale-tmpl--${K}`,{"pisell-big-sale--secondary-screen":en,"pisell-big-sale--has-right-action-panel":er&&"phone"!==k,"pisell-big-sale--has-right-action-close":er&&"phone"!==k&&!!m},h),"data-kiosk-shell":"kiosk"===K?T:void 0,style:v,children:[(0,eB.jsx)("div",{className:"pisell-big-sale__layout",children:(0,eB.jsx)(e1y,{isActive:d,catalogPreparation:c,osKey:u,productListPreferencesChannel:eo,mode:f,tmpl:K,venueBookingConfig:x,variant:k,context:G,productLoadParams:_,businessCode:w,bookingConfigParams:S,hideSelectFloorMapResourceAction:j,productDisplayConfig:N,productCatalogSessionKey:C,productCatalogReady:M,kioskShellLayout:T,kioskAppearance:I,saleDetailTemplate:P,saleDetailModuleConfig:ea,orderId:E,locale:O,onLocaleChange:z,saleDetailWrapperProps:en?L:void 0,saleDetailHeaderSlot:p,rightActionBarClose:m,onOrderComplete:F,onPaidCheckout:q,onPaymentPageActiveChange:B,onRequestHome:H,renderCatalog:V,externalActionRequest:U,onExternalActionAccepted:Y,onExternalPaymentSettled:W})}),g]})}e1p.displayName="MapPinIcon",e1b.displayName="BigSaleBase";let e1x=oW(e1b);function e1k(e){return"product-selection"===e||"appointment-booking"===e}function e1_(e,t,l){if(!e1k(e))return t;let i=Array.isArray(null==t?void 0:t.steps)||"function"==typeof(null==t?void 0:t.resolveSteps);return{...t,enableProductSelectionFlowForCart:!0,enableBookingSelectionFlowForCart:!0,...!i?{resolveSteps:["pos","webpos"].includes(String(l||"").trim().toLowerCase())?Hp:Hm}:{}}}function e1w(e,t){return e&&ew()(e).isValid()?ew()(e).format("YYYY-MM-DD"):t||ew()().format("YYYY-MM-DD")}let e1S=e=>{var t;let{runtimeRef:l}=e,i=eb$(),a=ebU();return(0,eN.useEffect)(()=>{let e=()=>{var e,t,n,r,o,s,d,c;let u=(null==(t=i.bookingTicket)||null==(e=t.getBookingDate)?void 0:e.call(t))??(null==(d=i.bookingTicket)||null==(s=d.store)||null==(o=s.bookingContext)||null==(r=o.getState)||null==(n=r.call(o))?void 0:n.date);l.current={customerId:null==(c=a.selected)?void 0:c.id,date:e1w(u)}};return e(),ebW(i.bookingTicket,e)},[i.bookingTicket,null==(t=a.selected)?void 0:t.id,l]),null},e1j=e=>{var t,l,i,a,n,r,o;let{osKey:s="big-sale",enableMultiCurrencySettlement:d=!1,osModuleName:c,selectionFlowScene:u="product-selection",lifecycleOwner:p,orderId:m,autoBootstrap:g,autoRestoreOnInit:h,restoreOrderAfterPaidCheckout:v,destroyOnUnmount:f,businessCode:y,bookingConfigParams:b,resourceIdFromCalendar:x,bookingTimeRangeFromCalendar:k,autoInitBookingContext:_,otherParams:w,inventory:S,checkoutHooks:j,rulesHooks:N,uiHosts:C,awaitAllergyConfirmation:M,normalProductDetailConfig:T,mergeBookingLinesForDisplay:I,mode:P="ticket",variant:A,tmpl:D,template:E,venueBookingConfig:O,secondaryScreenDisplay:z,productLoadParams:L,enableMenuOverride:R=!1,productDisplayConfig:$,hideSelectFloorMapResourceAction:F,productCatalogSessionKey:q,productCatalogReady:B,saleDetailTemplate:H,saleDetailModuleConfig:V,autoCreate:U=!0,enableTempOrderPersist:Y,enableTempOrderSync:W=!0,isActive:G=!0,catalogPreparation:K,preserveProductCatalogOnInactiveCustomerClear:Q,autoReloadProductCatalogOnCustomerChange:Z,enableGlobalScanListener:J=!1,scanRequest:X,onScanRequestAccepted:ee,onScanRequestSettled:et,scanScope:el,onScanPromotionResult:ei,promotionScanSuccessMessageKey:ea,promotionItemIncreaseMessageKey:en,className:er,style:eo,locale:es,bootstrapSlot:ed,saleDetailHeaderSlot:ec,rightActionBarClose:eu,overlaySlot:ep,onOrderComplete:em,onPaidCheckout:eg,onPaymentPageActiveChange:eh,onRequestHome:ev,renderCatalog:ef,externalActionRequest:ey,onExternalActionAccepted:eb,onExternalPaymentSettled:ex}=e,ek=eR(),e_=eF(),ew=null==ek||null==(l=ek.appHelper)||null==(t=l.utils)?void 0:t.action,eS=null==ek||null==(a=ek.appHelper)||null==(i=a.utils)?void 0:i.pisellos,ej=null==ek||null==(o=ek.appHelper)||null==(r=o.utils)||null==(n=r.businessUtils)?void 0:n.isProductMergeDisabled,eC=(0,eN.useMemo)(()=>()=>"function"!=typeof ej||!ej(),[ej]),eM=y?`bookingTicket-${s}-${y}`:[s,P].filter(Boolean).join("-"),eT=c||eM,{runtime:eI}=Go(),{isSecondaryScreen:eP,secondaryProductsPerRow:eA,showSecondaryCustomerInfo:eD,mainContentWrapperProps:eE,secondaryScreenSettingsModal:eO}=QL(eI,z),ez=D??E??"standard",eL="venue-ticket-booking"===ez||"venue-party-booking"===ez,e$="kiosk"===ez||"HDLKiosk"===ez,eq=db({preferEngineLocale:e$}),[eH,eV]=(0,eN.useState)(),eU="HDLKiosk"===ez&&eH?eH:es||eq,eY=(0,eN.useCallback)(e=>{eV(e)},[]),eW=eP&&"secondaryScreen"===ez,eG=e1k(u),eK=(0,eN.useMemo)(()=>eHd(eHs(null==w?void 0:w.platform,e_),A),[null==w?void 0:w.platform,e_,A]),eQ="kiosk"===ez&&eK.variant||A,eZ="kiosk"===ez?eK.kioskShellLayout:void 0,eJ=(0,eN.useMemo)(()=>{let e=e1_(u,T,e$?void 0:String(eHs(null==w?void 0:w.platform,e_)??"")),t={...e,..."HDLKiosk"===ez&&!(null==e?void 0:e.appearance)&&!(null==e?void 0:e.resolveAppearance)?{resolveAppearance:eGP}:{},enableMultiCurrencySettlement:d},l=eK.platform?eK.productDetailPresentationPlatform:(null==t?void 0:t.presentationPlatform)??eK.productDetailPresentationPlatform;return e$||eL?{...t,initializeFullBookingContext:!1,variant:eK.productDetailVariant,selectorColumns:"phone"===eK.productDetailVariant&&"default"===l?1:2,isShowProductSummary:!0,isShowCollapsibleSections:!0,isShowMobileWeighing:!0,isShowProcedureSteps:!0,isShowNote:!0,isShowManualPriceChange:!1,isShowRemove:!1,presentationPlatform:l}:{...t,selectorColumns:"phone"===A?1:null==t?void 0:t.selectorColumns,presentationPlatform:eG?"pos":void 0,initializeFullBookingContext:!0,isShowCollapsibleSections:!0,...eG?{isShowManualPriceChange:!0}:{},allowUnavailableBookingSelection:eG,allowNoResourceBookingSelection:eG}},[d,eG,eL,eK.productDetailPresentationPlatform,eK.productDetailVariant,eK.platform,T,null==w?void 0:w.platform,e_,e$,ez,u,A]),eX="kiosk"!==ez&&eG,e0=eHs(null==w?void 0:w.platform,e_),e2="webpos"===String(e0??"").trim().toLowerCase()?"pos":e0,e1=(0,eN.useMemo)(()=>({enforceSingleBookingStartDate:!1,...w,...e2?{platform:e2}:{},enablePickupTiming:"HDLKiosk"!==ez&&!eL}),[w,e2,ez,eL]),e4=(0,eN.useMemo)(()=>eX?{...V,cartItems:{...null==V?void 0:V.cartItems,bookingQuantityMode:"editable"}}:V,[eX,V]),e3=(0,eN.useRef)({date:void 0,customerId:void 0}),e8=(0,eN.useMemo)(()=>ew?{action:ew,getRuntime:()=>{var e,t,l,i,a;let n=null==eS||null==(e=eS.getModule)?void 0:e.call(eS,eT),r=null==n||null==(i=n.store)||null==(l=i.bookingContext)||null==(t=l.getState)?void 0:t.call(l),o=(null==n||null==(a=n.getBookingDate)?void 0:a.call(n))??(null==r?void 0:r.date);return{...e3.current,date:e1w(o,e3.current.date)}}}:void 0,[ew,eS,eT]);return(0,eB.jsx)(dy,{value:eU,children:(0,eB.jsx)(eCx,{destroyOnUnmount:f,osKey:eT,enableMultiCurrencySettlement:d,solution:"unifiedBookingSales",moduleAccess:c?"existing":"ensure",lifecycleOwner:p,orderId:m,autoBootstrap:g??!!m,autoRestoreOnInit:h,restoreOrderAfterPaidCheckout:v,businessCode:y,bookingConfigParams:b,resourceIdFromCalendar:x,bookingTimeRangeFromCalendar:k,autoInitBookingContext:_,otherParams:e1,inventory:S,checkoutHooks:j,deferHolderAuthOnClose:"kiosk"===ez||eL,enablePromotionCodeCustomerAuth:eL&&"kiosk"===eK.platform,enableCustomerAuthHost:"kiosk"===ez&&eK.enableCustomerAuthHost||eL&&eKE({otherParams:w}),shouldMergeProductLines:eC,rulesHooks:N,legacyOpenProductDetail:e8,uiHosts:C,awaitAllergyConfirmation:M,normalProductDetailConfig:eJ,mergeBookingLinesForDisplay:!!eX||I,enableTempOrderPersist:Y,enableTempOrderSync:W,isActive:G,catalogPreparation:K,preserveProductCatalogOnInactiveCustomerClear:Q,enableGlobalScanListener:"HDLKiosk"!==ez&&J,scanRequest:X,onScanRequestAccepted:ee,onScanRequestSettled:et,scanScope:el,onScanPromotionResult:ei,suppressCartIneligibleScanToast:!0,promotionScanSuccessMessageKey:ea,promotionItemIncreaseMessageKey:en??(e$?"pisell2.big-sale.kiosk.offer-added-success":void 0),defaultProductLoadParams:L,autoReloadProductCatalogOnCustomerChange:!eL&&Z,promotionProductSource:eL?"catalog-only":void 0,enableMenuOverride:R,children:(0,eB.jsxs)(eCw,{children:[(0,eB.jsx)(e1S,{runtimeRef:e3}),ed,(0,eB.jsx)(e1x,{isActive:G,catalogPreparation:K,osKey:s,mode:P,variant:eQ,kioskShellLayout:eZ,kioskAppearance:"kiosk"===ez?eK.appearance:void 0,template:ez,venueBookingConfig:O,productLoadParams:L,productDisplayConfig:$,productCatalogSessionKey:q,productCatalogReady:B,saleDetailTemplate:H,saleDetailModuleConfig:e4,autoCreate:U,orderId:m,className:er,style:eo,locale:eU,onLocaleChange:"HDLKiosk"===ez?eY:void 0,saleDetailWrapperProps:eW?eE:void 0,cartProductsPerRow:eW?eA:void 0,showClient:eW?eD:void 0,businessCode:y,bookingConfigParams:b,hideSelectFloorMapResourceAction:F,saleDetailHeaderSlot:ec,rightActionBarClose:eu,overlaySlot:ep,onOrderComplete:em,onPaidCheckout:eg,onPaymentPageActiveChange:eh,onRequestHome:ev,renderCatalog:ef,externalActionRequest:ey,onExternalActionAccepted:eb,onExternalPaymentSettled:ex}),eW?eO:null]})})})};e1j.displayName="BigSale";let e1N=e1j,e1C={catalogTitle:"Choose your items",catalogHint:"Add the options you want, then review your order.",catalogQuantity:"Quantity",catalogAdded:"Added",catalogSoldOut:"Sold Out",catalogUnavailable:"Currently unavailable",catalogUnavailableLabel:"Unavailable",catalogLimitReached:"Limit reached",collectQuotaReached:"No redemptions left",catalogEmpty:"No products are available on this machine.",catalogUpdateFailed:"Unable to update your selection. Please try again.",catalogOrderActions:"Order actions",catalogToPay:"To pay",catalogCart:"View order, {count} items",catalogCheckout:"Checkout",catalogConfirmOrder:"Confirm",catalogPromotion:"Promotion",collectAlsoBuy:"Also buy something?",catalogCartEmpty:"Your cart is empty.",collectTitle:"Items to Redeem",collectAvailable:"Available",collectSelected:"Selected",collectRemaining:"Remaining",collectVoucherCount:"{count} vouchers",collectGroupSelected:"Selected {selected} of {total}",collectSelectedCount:"Selected {selected}",collectSelect:"Select",collectSkuRemaining:"{remaining} of {total} left",collectSkuConfirm:"Confirm",collectSkuCancel:"Cancel",collectRedeem:"Redeem",collectNoProducts:"No redeemable products are available on this machine.",collectInvalid:"Your selection no longer matches the available vouchers. Please adjust it.",collectLimit:"No more items can be selected with this voucher group.",collectScanMore:"Scan to add more vouchers",collectDecrease:"Decrease {name}",collectIncrease:"Increase {name}",collectRemove:"Remove {name}",collectUnsupported:"Please scan a product voucher on this page.",channelTest:"Test",channelTesting:"Testing…",channelTestSuccess:"Test successful",channelTestFailed:"Test failed",channelTestUnknown:"Test result needs checking",channelTestHint:"Testing runs one dispense. Stock is not updated automatically; enter the physical quantity remaining after testing.",reviewTitle:"Review restock",reviewDescription:"Check the products and quantities against the loaded stock before confirming. Channels sharing one inventory space are counted once.",reviewDetails:"Channel changes",reviewBefore:"Qty before",reviewDelta:"Change",reviewProductRemoved:"Remove previous product",reviewProductAdded:"Bind new product",reviewSummary:"Changes by product",reviewAdded:"Added",reviewRemoved:"Removed",reviewTotals:"Total: {added} added \xb7 {removed} removed",reviewConfirm:"Confirm and submit",stockSyncPending:"Submitted. Waiting for the stock records to update. Please do not submit again.",stockSyncReview:"Stock changes need checking. Refresh only queries the stock; it does not submit again. Contact staff if the changes remain unconfirmed.",stockRefresh:"Refresh stock",restockChanged:"The stock or channel configuration has changed. Refresh and check the quantities before submitting.",restockReserved:"Some stock is reserved or unavailable. Check the physical and available stock before reducing it or changing the product.",dispenseStockReview:"Your dispensing results are shown above. Please keep your order number and contact a staff member.",inventoryUnavailable:"Stock could not be refreshed. Please retry.",inventoryUnmapped:"This variant has no configured inventory. Please contact staff.",inventoryInsufficient:"Only {quantity} available for {sku}. Please reduce the quantity.",dispensePluginNotReady:"The dispensing plugin is not ready. Please contact staff.",dispenseInventoryInsufficient:"There is not enough stock to dispense this item. Please contact staff.",brand:"Welcome",poweredBy:"Powered by Pisell",machine:"Vending machine",idleTitle:"Grip socks, right here.",idleDescription:"Buy a pair or redeem the socks you already paid for.",touch:"Touch to start",promoTitle:"Adult sizes are in",promoDescription:"EU 39–46 in black, navy and coral.",partyPromoTitle:"Party packs",partyPromoDescription:"Book a party and socks are included for every guest.",memberPromoTitle:"Members save 10%",memberPromoDescription:"Scan your member code before you pay.",scanHint:"Have a wristband or a QR code? Hold it under the scanner any time.",homeTitle:"Get Your Grip Socks",language:"Language",homeDescription:"Grip socks are required in the play area. Choose an option below.",homePreparing:"Getting ready…",buy:"Buy Socks",buyDescription:"Choose a size and pay here",redeem:"Redeem Socks",redeemDescription:"Scan your wristband, or a QR code or barcode from your order or booking.",redeemTitle:"Find Your Account",redeemFindDescription:"Scan your code, or enter your Sale Number or code below.",redeemCodeLabel:"Enter Your Code Manually",redeemCodePlaceholder:"Enter your code",redeemCodeHint:"Enter the code as shown on your wristband, voucher or booking.",redeemContinue:"Continue",redeemClearCode:"Clear code",redeemScanPrompt:"Scan your QR code or barcode",redeemScannerLocation:"Hold it under the scanner below.",redeemOr:"Or",redeemTypeWristband:"Wristband",redeemTypeWallet:"Member Wallet",redeemTypeVoucher:"Voucher",redeemTypeReceipt:"Sale Receipt",scannedCode:"Scanned code",waitingForScan:"Waiting for scan…",scannedCodeHint:"Your scanned code will appear here automatically.",scanPreparing:"Getting ready for your purchase",scanPreparingHint:"Please wait. The shopping page will open automatically.",scanPrepareFailed:"Unable to open the shopping page",scanPrepareFailedHint:"Please try again, or go back to start over.",scanResolveFailed:"The code is invalid",scanProcessing:"Processing…",scanNoVouchers:"No valid product vouchers were found.",scanVoucherNotStarted:"Your product vouchers are not valid yet.",scanVoucherExpired:"Your product vouchers have expired.",scanVoucherUnavailable:"Your product vouchers cannot be redeemed at this time.",scanUnrecognized:"This code could not be used. Please try another code.",help:"Help",contact:"If you have any problems, please contact a staff member.",back:"Back",home:"Back to home",staffSignIn:"Staff sign in",staffDescription:"Choose your name and enter your PIN to access machine service.",settingsDescription:"Choose your name and enter your PIN to open settings.",selectStaff:"Select staff",enterId:"Enter staff ID",verify:"Verify",staff:"Staff",signOut:"Sign out",welcomeStaff:"Hello, {name}",staffHome:"Machine service",resume:"Resume customer service",configure:"Configure and Restock",configureDescription:"Set the product and the quantity in each channel after loading, then submit once.",configureCard:"Manage products and stock by channel",sellable:"Sellable now",low:"Low",empty:"Empty",unavailable:"Out of service",inline:"Inline Edit",cards:"Card View",all:"All",changed:"Changed",row:"Row",channel:"Channel",channels:"Channels",productStock:"Product and stock",quantityAfter:"Qty after",action:"Action",current:"Current",capacity:"of {capacity}",noProduct:"No product",fill:"Fill",fillAll:"Fill all channels",board:"Control board",restockDraftOnly:"Stock changes cannot be saved yet. Edits stay on this page until you leave.",restockDeviceMissing:"No linked device was found. Check the device settings and try again.",restockConfigurationInvalid:"Check the control board, channel count and maximum capacity in the device settings.",restockDataInvalid:"The inventory response could not be read. Please try again.",restockUnconfigured:"No inventory space is configured for this channel.",restockSpaceMissing:"The configured inventory space could not be found.",restockSpaceInactive:"This inventory space is inactive.",restockMultipleProducts:"Multiple products are bound to this space. Check the channel configuration.",restockProductMissing:"The bound product could not be found.",restockProductInactive:"The bound product is inactive.",restockStockInvalid:"The stock quantity needs checking. Only whole items can be restocked.",restockCapacityExceeded:"Current stock exceeds the configured capacity. Check the stock and capacity.",reset:"Reset",pending:"Pending Changes",submit:"Submit Changes",done:"Done",editChannel:"Channel {code}",cardHint:"Tap a channel to set its product and quantity.",loadError:"Unable to load data. Please try again.",saveError:"Changes could not be saved. Your edits have been kept.",retry:"Retry",loading:"Loading…",saving:"Saving…",saved:"Changes saved",noChannels:"No channels available",noMatches:"No matching channels",discardTitle:"Discard unsaved changes?",discardDescription:"Your channel edits have not been submitted.",discard:"Discard changes",keepEditing:"Keep editing",invalidQuantity:"Enter a whole number between 0 and the channel capacity.",blocked:"Blocked",disabled:"Disabled",product:"Product",quantity:"Quantity after loading",dispensing:"On the way",dispenseDescription:"Your items drop one at a time.",preparing:"Preparing your order",dispensingNow:"Dispensing",waiting:"Waiting",success:"Dropped",failed:"Not dispensed",dispenseUncertain:"Needs checking",dispenseUncertainDescription:"The dispense result could not be confirmed. Please ask a staff member to check the pickup door.",dispenseMappingMissing:"This product has no configured channel. Please contact a staff member.",dispenseMappingInvalid:"The product channel needs to be checked by a staff member.",dispenseUnsupported:"This device cannot dispense items. Please contact a staff member.",dispenseBusy:"The machine is busy. Please contact a staff member.",dispenseBoardOffline:"The product channel is offline. Please contact a staff member.",dispenseNotReady:"The machine is not connected or ready. Please contact a staff member.",dispenseFailedDescription:"This item could not be dispensed. Please contact a staff member.",summaryUncertain:"{success} dispensed \xb7 {failed} not dispensed \xb7 {uncertain} need checking",progress:"{done} of {total} items processed",complete:"Enjoy!",completeDescription:"Thanks for shopping with {brand}.",partial:"Some items need attention",partialDescription:"Your payment is complete. A staff member can help with the remaining items.",postPaymentError:"Your order is paid. Please contact a staff member to complete collection.",redemptionPartialDescription:"A staff member can help with the remaining items.",redemptionCollectionError:"Please contact a staff member to complete collection.",summary:"{success} dispensed \xb7 {failed} not dispensed",returning:"Back to start in {seconds}s",itemNumber:"Item {number}",itemTotal:"of {total}",droppedTotal:"of {total} dropped",droppedCount:"{count} dropped",collectDescription:"Take them from the pickup door below.",pickupTip:"Your items drop into the pickup door below this screen.",waitUntilFinished:"Please wait until every item has dropped.",order:"Order {id}"},e1M={en:e1C,"zh-CN":{catalogTitle:"选择商品",catalogHint:"选择所需规格和数量,然后确认订单。",catalogQuantity:"数量",catalogAdded:"已添加",catalogSoldOut:"已售罄",catalogUnavailable:"暂不可购买",catalogUnavailableLabel:"暂不可购买",catalogLimitReached:"已达可选上限",collectQuotaReached:"可兑换额度已用完",catalogEmpty:"本机暂无可购买的商品。",catalogUpdateFailed:"无法更新所选商品,请重试。",catalogOrderActions:"订单操作",catalogToPay:"待支付",catalogCart:"查看订单,共 {count} 件商品",catalogCheckout:"去结算",catalogConfirmOrder:"确认",catalogPromotion:"优惠",collectAlsoBuy:"还想买些商品?",catalogCartEmpty:"购物车为空,请先选择商品。",collectTitle:"兑换商品",collectAvailable:"可领取",collectSelected:"已选择",collectRemaining:"还可选择",collectVoucherCount:"{count} 张券",collectGroupSelected:"已选 {selected} / {total}",collectSelectedCount:"已选 {selected}",collectSelect:"选择规格",collectSkuRemaining:"还可选 {remaining} / {total}",collectSkuConfirm:"确认",collectSkuCancel:"取消",collectRedeem:"确认领取",collectNoProducts:"本机暂无可兑换的商品。",collectInvalid:"所选商品与可用券不匹配,请调整选择。",collectLimit:"这组券的可选数量已用完。",collectScanMore:"可继续扫码添加商品券",collectDecrease:"减少 {name}",collectIncrease:"增加 {name}",collectRemove:"删除 {name}",collectUnsupported:"此页面仅支持扫描商品兑换券。",channelTest:"测试",channelTesting:"测试中…",channelTestSuccess:"测试成功",channelTestFailed:"测试失败",channelTestUnknown:"测试结果待核对",channelTestHint:"测试会触发一次出货,库存不会自动调整;请按测试后的实物填写数量。",reviewTitle:"核对补货",reviewDescription:"请按实物核对以下商品和数量,确认后再提交。共用同一货位的货道只统计一次。",reviewDetails:"货道变更明细",reviewBefore:"原数量",reviewDelta:"变动数量",reviewProductRemoved:"移除原商品",reviewProductAdded:"绑定新商品",reviewSummary:"商品数量汇总",reviewAdded:"增加",reviewRemoved:"减少",reviewTotals:"合计增加 {added} 件 \xb7 减少 {removed} 件",reviewConfirm:"确认并提交",stockSyncPending:"已提交,正在等待库存记录更新,请勿重复提交。",stockSyncReview:"库存变更待核对。刷新只查询库存,不会重复提交;仍未确认时请联系工作人员。",stockRefresh:"刷新库存",restockChanged:"库存或货道配置已变化,请刷新并核对数量后再提交。",restockReserved:"部分库存已预占或不可用,请核对真实库存和可用库存后再减量或更换商品。",dispenseStockReview:"出货结果如上,请保留订单号并联系工作人员。",inventoryUnavailable:"库存刷新失败,请重试。",inventoryUnmapped:"该规格尚未配置库存,请联系工作人员。",inventoryInsufficient:"{sku} 当前可用库存为 {quantity},请减少购买数量。",dispensePluginNotReady:"出货插件尚未就绪,请联系工作人员。",dispenseInventoryInsufficient:"该商品可出货库存不足,请联系工作人员。",brand:"欢迎光临",poweredBy:"Pisell 技术支持",machine:"自动售货机",idleTitle:"防滑袜,就在这里。",idleDescription:"购买一双新袜子,或领取已付款的袜子。",touch:"轻触屏幕,开始选购",promoTitle:"成人尺码已到货",promoDescription:"欧码 39–46,黑色、藏青色和珊瑚色。",partyPromoTitle:"派对套装",partyPromoDescription:"预订派对,每位宾客均可获赠一双袜子。",memberPromoTitle:"会员享九折",memberPromoDescription:"付款前扫描你的会员码。",scanHint:"有腕带或二维码?随时放到扫描器下方即可。",homeTitle:"获取你的防滑袜",language:"语言",homeDescription:"游乐区内须穿防滑袜。请选择下方选项。",homePreparing:"准备中…",buy:"购买袜子",buyDescription:"选择尺码并在这里付款",redeem:"领取袜子",redeemDescription:"扫描腕带,或订单、预订中的二维码或条形码。",redeemTitle:"查找你的账户",redeemFindDescription:"扫描你的码,或在下方手动输入订单号或兑换码。",redeemCodeLabel:"手动输入你的码",redeemCodePlaceholder:"请输入你的码",redeemCodeHint:"请按照手环、券或预订信息上的内容输入。",redeemContinue:"继续",redeemClearCode:"清空输入",redeemScanPrompt:"扫描你的二维码或条形码",redeemScannerLocation:"请将码放在屏幕下方的扫描器处。",redeemOr:"或",redeemTypeWristband:"手环",redeemTypeWallet:"会员钱包",redeemTypeVoucher:"兑换券",redeemTypeReceipt:"销售小票",scannedCode:"扫码结果",waitingForScan:"等待扫码…",scannedCodeHint:"扫描完成后,码会自动显示在这里。",scanPreparing:"正在准备购买页面",scanPreparingHint:"请稍候,准备完成后将自动进入。",scanPrepareFailed:"购买页面暂时无法打开",scanPrepareFailedHint:"请重试,或返回重新开始。",scanResolveFailed:"此码无效",scanProcessing:"处理中…",scanNoVouchers:"未找到有效商品券。",scanVoucherNotStarted:"商品券尚未到兑换时间。",scanVoucherExpired:"商品券已过期。",scanVoucherUnavailable:"商品券暂时无法兑换。",scanUnrecognized:"此码无法使用,请尝试其他码。",help:"帮助",contact:"如有问题,请联系工作人员。",back:"返回",home:"返回首页",staffSignIn:"员工验证",staffDescription:"选择员工并输入 PIN,进入设备管理。",settingsDescription:"选择员工并输入 PIN,进入设置页面。",selectStaff:"选择员工",enterId:"输入员工 ID",verify:"验证",staff:"员工",signOut:"退出员工模式",welcomeStaff:"你好,{name}",staffHome:"设备管理",resume:"恢复顾客服务",configure:"配置与补货",configureDescription:"装货后设置各货道的商品和数量,完成后统一提交。",configureCard:"管理各货道的商品与库存",sellable:"当前可售",low:"低库存",empty:"空货道",unavailable:"暂停使用",inline:"行内编辑",cards:"卡片视图",all:"全部",changed:"已修改",row:"排",channel:"货道",channels:"个货道",productStock:"商品与库存",quantityAfter:"补货后数量",action:"操作",current:"当前",capacity:"容量 {capacity}",noProduct:"未绑定商品",fill:"补满",fillAll:"全部填满",board:"控制板",restockDraftOnly:"暂不支持保存库存变更,编辑内容仅保留在当前页面,离开后不会保存。",restockDeviceMissing:"未找到当前绑定设备,请检查设备设置后重试。",restockConfigurationInvalid:"请检查设备设置中的控制板、货道数量和最大容量。",restockDataInvalid:"库存数据格式异常,请重试。",restockUnconfigured:"该货道尚未配置库存货位。",restockSpaceMissing:"未找到该货道配置的库存货位。",restockSpaceInactive:"该库存货位已停用。",restockMultipleProducts:"该货位绑定了多种货品,请检查货道配置。",restockProductMissing:"未找到该货位绑定的货品。",restockProductInactive:"该货位绑定的货品已停用。",restockStockInvalid:"库存数量异常,请核对;补货数量必须为整件。",restockCapacityExceeded:"当前库存超过配置容量,请核对库存和容量设置。",reset:"重置",pending:"待提交修改",submit:"提交修改",done:"完成",editChannel:"货道 {code}",cardHint:"点击货道,设置商品和数量。",loadError:"数据加载失败,请重试。",saveError:"提交失败,已保留你的修改。",retry:"重试",loading:"加载中…",saving:"提交中…",saved:"修改已保存",noChannels:"暂无货道",noMatches:"暂无符合条件的货道",discardTitle:"放弃未提交的修改?",discardDescription:"当前货道修改尚未提交。",discard:"放弃修改",keepEditing:"继续编辑",invalidQuantity:"请输入 0 到货道容量之间的整数。",blocked:"已阻塞",disabled:"已停用",product:"商品",quantity:"补货后数量",dispensing:"正在为你出货",dispenseDescription:"商品将逐件出货,请稍候。",preparing:"正在准备订单",dispensingNow:"正在出货",waiting:"等待出货",success:"出货成功",failed:"出货失败",dispenseUncertain:"需要核对",dispenseUncertainDescription:"出货结果无法确认,请工作人员核对取货口的实物。",dispenseMappingMissing:"该商品尚未配置货道,请联系工作人员。",dispenseMappingInvalid:"商品货道配置有误,请联系工作人员核对。",dispenseUnsupported:"当前设备暂不支持出货,请联系工作人员。",dispenseBusy:"设备正忙,请联系工作人员。",dispenseBoardOffline:"该商品所在货道未连接,请联系工作人员。",dispenseNotReady:"设备未连接或尚未就绪,请联系工作人员。",dispenseFailedDescription:"该商品未能出货,请联系工作人员。",summaryUncertain:"成功 {success} 件 \xb7 未出货 {failed} 件 \xb7 待核对 {uncertain} 件",progress:"已处理 {done} / {total} 件",complete:"祝你玩得开心!",completeDescription:"感谢你在 {brand} 购物。",partial:"部分商品需要工作人员协助",partialDescription:"订单已支付,请联系工作人员处理未出货的商品。",postPaymentError:"订单已支付,请联系工作人员协助取货。",redemptionPartialDescription:"请联系工作人员处理未出货的商品。",redemptionCollectionError:"请联系工作人员协助取货。",summary:"成功 {success} 件 \xb7 未出货 {failed} 件",returning:"{seconds} 秒后返回首页",itemNumber:"第 {number} 件",itemTotal:"/ 共 {total} 件",droppedTotal:"/ {total} 件已出货",droppedCount:"已出货 {count} 件",collectDescription:"请从下方取货口取走你的商品。",pickupTip:"商品会掉落到屏幕下方的取货口。",waitUntilFinished:"请等待所有商品出货完成。",order:"订单 {id}"},"zh-HK":{catalogTitle:"選擇商品",catalogHint:"選擇所需規格和數量,然後確認訂單。",catalogQuantity:"數量",catalogAdded:"已加入",catalogSoldOut:"已售罄",catalogUnavailable:"暫不可購買",catalogUnavailableLabel:"暫不可購買",catalogLimitReached:"已達可選上限",collectQuotaReached:"可兌換額度已用完",catalogEmpty:"本機暫無可購買的商品。",catalogUpdateFailed:"無法更新所選商品,請重試。",catalogOrderActions:"訂單操作",catalogToPay:"待支付",catalogCart:"查看訂單,共 {count} 件商品",catalogCheckout:"去結算",catalogConfirmOrder:"確認",catalogPromotion:"優惠",collectAlsoBuy:"還想買些商品?",catalogCartEmpty:"購物車為空,請先選擇商品。",collectTitle:"兌換商品",collectAvailable:"可領取",collectSelected:"已選擇",collectRemaining:"還可選擇",collectVoucherCount:"{count} 張券",collectGroupSelected:"已選 {selected} / {total}",collectSelectedCount:"已選 {selected}",collectSelect:"選擇規格",collectSkuRemaining:"還可選 {remaining} / {total}",collectSkuConfirm:"確認",collectSkuCancel:"取消",collectRedeem:"確認領取",collectNoProducts:"本機暫無可兌換的商品。",collectInvalid:"所選商品與可用券不匹配,請調整選擇。",collectLimit:"這組券的可選數量已用完。",collectScanMore:"可繼續掃碼添加商品券",collectDecrease:"減少 {name}",collectIncrease:"增加 {name}",collectRemove:"刪除 {name}",collectUnsupported:"此頁面僅支援掃描商品兌換券。",channelTest:"測試",channelTesting:"測試中…",channelTestSuccess:"測試成功",channelTestFailed:"測試失敗",channelTestUnknown:"測試結果待核對",channelTestHint:"測試會觸發一次出貨,庫存不會自動調整;請按測試後的實物填寫數量。",reviewTitle:"核對補貨",reviewDescription:"請按實物核對以下商品和數量,確認後再提交。共用同一貨位的貨道只統計一次。",reviewDetails:"貨道變更明細",reviewBefore:"原數量",reviewDelta:"變動數量",reviewProductRemoved:"移除原商品",reviewProductAdded:"綁定新商品",reviewSummary:"商品數量彙總",reviewAdded:"增加",reviewRemoved:"減少",reviewTotals:"合計增加 {added} 件 \xb7 減少 {removed} 件",reviewConfirm:"確認並提交",stockSyncPending:"已提交,正在等待庫存記錄更新,請勿重複提交。",stockSyncReview:"庫存變更待核對。重新整理只查詢庫存,不會重複提交;仍未確認時請聯絡工作人員。",stockRefresh:"重新整理庫存",restockChanged:"庫存或貨道設定已變更,請重新整理並核對數量後再提交。",restockReserved:"部分庫存已預留或不可用,請核對實際庫存和可用庫存後再減量或更換商品。",dispenseStockReview:"出貨結果如上,請保留訂單號並聯絡工作人員。",inventoryUnavailable:"庫存更新失敗,請重試。",inventoryUnmapped:"此規格尚未配置庫存,請聯絡工作人員。",inventoryInsufficient:"{sku} 目前可用庫存為 {quantity},請減少購買數量。",dispensePluginNotReady:"出貨插件尚未就緒,請聯絡工作人員。",dispenseInventoryInsufficient:"此商品可出貨庫存不足,請聯絡工作人員。",brand:"歡迎光臨",poweredBy:"Pisell 技術支援",machine:"自動售貨機",idleTitle:"防滑襪,就在這裡。",idleDescription:"購買一雙新襪子,或領取已付款的襪子。",touch:"輕觸螢幕,開始選購",promoTitle:"成人尺碼已到貨",promoDescription:"歐碼 39–46,黑色、藏青色及珊瑚色。",partyPromoTitle:"派對套裝",partyPromoDescription:"預訂派對,每位賓客均可獲贈一雙襪子。",memberPromoTitle:"會員享九折",memberPromoDescription:"付款前掃描你的會員碼。",scanHint:"有腕帶或二維碼?隨時放到掃描器下方即可。",homeTitle:"取得你的防滑襪",language:"語言",homeDescription:"遊樂區內須穿防滑襪。請選擇下方選項。",homePreparing:"準備中…",buy:"購買襪子",buyDescription:"選擇尺碼並在這裡付款",redeem:"領取襪子",redeemDescription:"掃描腕帶,或訂單、預訂中的二維碼或條碼。",redeemTitle:"尋找你的帳戶",redeemFindDescription:"掃描你的碼,或在下方手動輸入訂單號或兌換碼。",redeemCodeLabel:"手動輸入你的碼",redeemCodePlaceholder:"請輸入你的碼",redeemCodeHint:"請按照手環、券或預訂資訊上的內容輸入。",redeemContinue:"繼續",redeemClearCode:"清空輸入",redeemScanPrompt:"掃描你的二維碼或條碼",redeemScannerLocation:"請將碼放在螢幕下方的掃描器處。",redeemOr:"或",redeemTypeWristband:"手環",redeemTypeWallet:"會員錢包",redeemTypeVoucher:"兌換券",redeemTypeReceipt:"銷售收據",scannedCode:"掃碼結果",waitingForScan:"等待掃碼…",scannedCodeHint:"掃描完成後,碼會自動顯示在這裡。",scanPreparing:"正在準備購買頁面",scanPreparingHint:"請稍候,準備完成後將自動進入。",scanPrepareFailed:"購買頁面暫時無法開啟",scanPrepareFailedHint:"請重試,或返回重新開始。",scanResolveFailed:"此碼無效",scanProcessing:"處理中…",scanNoVouchers:"未找到有效商品券。",scanVoucherNotStarted:"商品券尚未到兌換時間。",scanVoucherExpired:"商品券已過期。",scanVoucherUnavailable:"商品券暫時無法兌換。",scanUnrecognized:"此碼無法使用,請嘗試其他碼。",help:"協助",contact:"如有問題,請聯絡工作人員。",back:"返回",home:"返回首頁",staffSignIn:"員工驗證",staffDescription:"選擇員工並輸入 PIN,進入設備管理。",settingsDescription:"選擇員工並輸入 PIN,進入設定頁面。",selectStaff:"選擇員工",enterId:"輸入員工 ID",verify:"驗證",staff:"員工",signOut:"退出員工模式",welcomeStaff:"你好,{name}",staffHome:"設備管理",resume:"恢復顧客服務",configure:"配置與補貨",configureDescription:"裝貨後設定各貨道的商品和數量,完成後統一提交。",configureCard:"管理各貨道的商品與庫存",sellable:"目前可售",low:"低庫存",empty:"空貨道",unavailable:"暫停使用",inline:"行內編輯",cards:"卡片檢視",all:"全部",changed:"已修改",row:"排",channel:"貨道",channels:"個貨道",productStock:"商品與庫存",quantityAfter:"補貨後數量",action:"操作",current:"目前",capacity:"容量 {capacity}",noProduct:"未綁定商品",fill:"補滿",fillAll:"全部填滿",board:"控制板",restockDraftOnly:"暫不支援儲存庫存變更,編輯內容僅保留在目前頁面,離開後不會儲存。",restockDeviceMissing:"未找到目前綁定裝置,請檢查裝置設定後重試。",restockConfigurationInvalid:"請檢查裝置設定中的控制板、貨道數量和最大容量。",restockDataInvalid:"庫存資料格式異常,請重試。",restockUnconfigured:"此貨道尚未設定庫存貨位。",restockSpaceMissing:"未找到此貨道設定的庫存貨位。",restockSpaceInactive:"此庫存貨位已停用。",restockMultipleProducts:"此貨位綁定了多種貨品,請檢查貨道設定。",restockProductMissing:"未找到此貨位綁定的貨品。",restockProductInactive:"此貨位綁定的貨品已停用。",restockStockInvalid:"庫存數量異常,請核對;補貨數量必須為整件。",restockCapacityExceeded:"目前庫存超過設定容量,請核對庫存和容量設定。",reset:"重設",pending:"待提交修改",submit:"提交修改",done:"完成",editChannel:"貨道 {code}",cardHint:"點擊貨道,設定商品和數量。",loadError:"資料載入失敗,請重試。",saveError:"提交失敗,已保留你的修改。",retry:"重試",loading:"載入中…",saving:"提交中…",saved:"修改已儲存",noChannels:"暫無貨道",noMatches:"暫無符合條件的貨道",discardTitle:"放棄未提交的修改?",discardDescription:"目前貨道修改尚未提交。",discard:"放棄修改",keepEditing:"繼續編輯",invalidQuantity:"請輸入 0 到貨道容量之間的整數。",blocked:"已阻塞",disabled:"已停用",product:"商品",quantity:"補貨後數量",dispensing:"正在為你出貨",dispenseDescription:"商品將逐件出貨,請稍候。",preparing:"正在準備訂單",dispensingNow:"正在出貨",waiting:"等待出貨",success:"出貨成功",failed:"出貨失敗",dispenseUncertain:"需要核對",dispenseUncertainDescription:"出貨結果無法確認,請工作人員核對取貨口的實物。",dispenseMappingMissing:"此商品尚未配置貨道,請聯絡工作人員。",dispenseMappingInvalid:"商品貨道配置有誤,請聯絡工作人員核對。",dispenseUnsupported:"目前裝置暫不支援出貨,請聯絡工作人員。",dispenseBusy:"裝置正忙,請聯絡工作人員。",dispenseBoardOffline:"此商品所在貨道未連線,請聯絡工作人員。",dispenseNotReady:"裝置未連線或尚未就緒,請聯絡工作人員。",dispenseFailedDescription:"此商品未能出貨,請聯絡工作人員。",summaryUncertain:"成功 {success} 件 \xb7 未出貨 {failed} 件 \xb7 待核對 {uncertain} 件",progress:"已處理 {done} / {total} 件",complete:"祝你玩得開心!",completeDescription:"感謝你在 {brand} 購物。",partial:"部分商品需要工作人員協助",partialDescription:"訂單已付款,請聯絡工作人員處理未出貨的商品。",postPaymentError:"訂單已付款,請聯絡工作人員協助取貨。",redemptionPartialDescription:"請聯絡工作人員處理未出貨的商品。",redemptionCollectionError:"請聯絡工作人員協助取貨。",summary:"成功 {success} 件 \xb7 未出貨 {failed} 件",returning:"{seconds} 秒後返回首頁",itemNumber:"第 {number} 件",itemTotal:"/ 共 {total} 件",droppedTotal:"/ {total} 件已出貨",droppedCount:"已出貨 {count} 件",collectDescription:"請從下方取貨口取走你的商品。",pickupTip:"商品會掉落到螢幕下方的取貨口。",waitUntilFinished:"請等待所有商品出貨完成。",order:"訂單 {id}"},ja:{catalogTitle:"商品を選択",catalogHint:"種類と数量を選び、注文内容を確認してください。",catalogQuantity:"数量",catalogAdded:"追加済み",catalogSoldOut:"売り切れ",catalogUnavailable:"現在購入できません",catalogUnavailableLabel:"購入不可",catalogLimitReached:"選択上限に達しました",collectQuotaReached:"交換可能数に達しました",catalogEmpty:"この自販機で購入できる商品はありません。",catalogUpdateFailed:"選択内容を更新できませんでした。もう一度お試しください。",catalogOrderActions:"注文操作",catalogToPay:"お支払い額",catalogCart:"注文を確認、商品 {count} 点",catalogCheckout:"お会計へ",catalogConfirmOrder:"確認",catalogPromotion:"プロモーション",collectAlsoBuy:"商品も購入しますか?",catalogCartEmpty:"カートは空です。商品を選択してください。",collectTitle:"引き換え対象商品",collectAvailable:"受取可能",collectSelected:"選択済み",collectRemaining:"選択可能",collectVoucherCount:"{count} 枚の券",collectGroupSelected:"{total} 点中 {selected} 点選択",collectSelectedCount:"{selected} 点選択",collectSelect:"サイズを選択",collectSkuRemaining:"残り {remaining} / {total}",collectSkuConfirm:"確認",collectSkuCancel:"キャンセル",collectRedeem:"受け取る",collectNoProducts:"この端末で交換できる商品はありません。",collectInvalid:"選択した商品に利用できない券があります。選択を変更してください。",collectLimit:"このグループの選択可能数に達しました。",collectScanMore:"スキャンして商品券を追加",collectDecrease:"{name} を減らす",collectIncrease:"{name} を増やす",collectRemove:"{name} を削除",collectUnsupported:"この画面では商品引換券をスキャンしてください。",channelTest:"テスト",channelTesting:"テスト中…",channelTestSuccess:"テスト成功",channelTestFailed:"テスト失敗",channelTestUnknown:"テスト結果の確認が必要です",channelTestHint:"テストは1回の払い出しを実行します。在庫は自動更新されないため、テスト後の実物数量を入力してください。",reviewTitle:"補充内容を確認",reviewDescription:"商品と数量を実物と照合してから送信してください。同じ在庫位置を共有するレーンは1回だけ集計されます。",reviewDetails:"レーンの変更明細",reviewBefore:"変更前の数量",reviewDelta:"増減数",reviewProductRemoved:"元の商品を解除",reviewProductAdded:"新しい商品を設定",reviewSummary:"商品別の増減",reviewAdded:"追加",reviewRemoved:"減少",reviewTotals:"合計:{added}個追加 \xb7 {removed}個減少",reviewConfirm:"確認して送信",stockSyncPending:"送信済みです。在庫の更新を待っています。再送信しないでください。",stockSyncReview:"在庫変更の確認が必要です。更新ボタンは在庫の照会のみを行い、再送信しません。未確認のままの場合はスタッフにお問い合わせください。",stockRefresh:"在庫を更新",restockChanged:"在庫またはチャネル設定が変更されました。更新して数量を確認してから送信してください。",restockReserved:"一部の在庫は予約済み、または利用できません。在庫を確認してから数量の削減や商品変更を行ってください。",dispenseStockReview:"払出結果は上記のとおりです。注文番号を控えてスタッフにお問い合わせください。",inventoryUnavailable:"在庫を更新できませんでした。再試行してください。",inventoryUnmapped:"このバリエーションには在庫が設定されていません。スタッフにお問い合わせください。",inventoryInsufficient:"{sku} の在庫は {quantity} 点です。数量を減らしてください。",dispensePluginNotReady:"商品排出プラグインの準備ができていません。スタッフにお問い合わせください。",dispenseInventoryInsufficient:"この商品を排出する在庫が不足しています。スタッフにお問い合わせください。",brand:"ようこそ",poweredBy:"Pisell テクニカルサポート",machine:"自動販売機",idleTitle:"滑り止めソックスは、ここで。",idleDescription:"ソックスの購入や、お支払い済み商品の受け取りはこちら。",touch:"タッチして開始",promoTitle:"大人用サイズが入荷",promoDescription:"EU 39–46。ブラック、ネイビー、コーラル。",partyPromoTitle:"パーティーパック",partyPromoDescription:"パーティーをご予約いただくと、全員分のソックスが付いてきます。",memberPromoTitle:"会員は10%オフ",memberPromoDescription:"お支払い前に会員コードをスキャンしてください。",scanHint:"リストバンドやQRコードをスキャナーにかざしてください。",homeTitle:"滑り止めソックスを手に入れよう",language:"言語",homeDescription:"プレイエリアでは滑り止めソックスの着用が必要です。以下の選択肢からお選びください。",homePreparing:"準備中…",buy:"ソックスを購入",buyDescription:"サイズを選んで、ここでお支払い",redeem:"ソックスを受け取る",redeemDescription:"リストバンド、または注文・予約のQRコードやバーコードをスキャンしてください。",redeemTitle:"アカウントを探す",redeemFindDescription:"コードをスキャンするか、注文番号またはコードを入力してください。",redeemCodeLabel:"コードを手動で入力",redeemCodePlaceholder:"コードを入力",redeemCodeHint:"リストバンド、クーポン、予約に記載されたコードを入力してください。",redeemContinue:"続ける",redeemClearCode:"入力をクリア",redeemScanPrompt:"QRコードまたはバーコードをスキャン",redeemScannerLocation:"画面下のスキャナーにかざしてください。",redeemOr:"または",redeemTypeWristband:"リストバンド",redeemTypeWallet:"会員ウォレット",redeemTypeVoucher:"クーポン",redeemTypeReceipt:"レシート",scannedCode:"読み取ったコード",waitingForScan:"スキャン待ち…",scannedCodeHint:"読み取ったコードがここに自動で表示されます。",scanPreparing:"購入画面を準備しています",scanPreparingHint:"準備ができ次第、自動で画面が開きます。そのままお待ちください。",scanPrepareFailed:"購入画面を開けませんでした",scanPrepareFailedHint:"もう一度お試しいただくか、戻ってやり直してください。",scanResolveFailed:"このコードは無効です",scanProcessing:"処理中…",scanNoVouchers:"有効な商品引換券が見つかりませんでした。",scanVoucherNotStarted:"商品引換券の利用開始日時前です。",scanVoucherExpired:"商品引換券の有効期限が切れています。",scanVoucherUnavailable:"商品引換券は現在ご利用いただけません。",scanUnrecognized:"このコードは使用できません。別のコードをお試しください。",help:"ヘルプ",contact:"問題がある場合は、スタッフにお問い合わせください。",back:"戻る",home:"ホームに戻る",staffSignIn:"スタッフ認証",staffDescription:"スタッフを選択し、PIN を入力してください。",settingsDescription:"スタッフを選択し、PIN を入力して設定を開きます。",selectStaff:"スタッフを選択",enterId:"スタッフ ID を入力",verify:"確認",staff:"スタッフ",signOut:"スタッフモードを終了",welcomeStaff:"こんにちは、{name}",staffHome:"機器の管理",resume:"お客様サービスを再開",configure:"設定と補充",configureDescription:"補充後の商品と数量を設定し、まとめて送信してください。",configureCard:"各レーンの商品と在庫を管理",sellable:"販売可能",low:"在庫少",empty:"空",unavailable:"使用停止",inline:"一覧編集",cards:"カード表示",all:"すべて",changed:"変更あり",row:"列",channel:"レーン",channels:"レーン",productStock:"商品と在庫",quantityAfter:"補充後の数量",action:"操作",current:"現在",capacity:"容量 {capacity}",noProduct:"商品なし",fill:"満量",fillAll:"すべて満量にする",board:"制御基板",restockDraftOnly:"在庫変更はまだ保存できません。編集内容はこのページ内のみで保持されます。",restockDeviceMissing:"接続済みの端末が見つかりません。端末設定を確認して再試行してください。",restockConfigurationInvalid:"端末設定の制御基板、チャネル数、最大容量を確認してください。",restockDataInvalid:"在庫データを読み取れませんでした。再試行してください。",restockUnconfigured:"このチャネルには在庫保管場所が設定されていません。",restockSpaceMissing:"設定された在庫保管場所が見つかりません。",restockSpaceInactive:"この在庫保管場所は無効です。",restockMultipleProducts:"複数の商品が関連付けられています。チャネル設定を確認してください。",restockProductMissing:"関連付けられた商品が見つかりません。",restockProductInactive:"関連付けられた商品は無効です。",restockStockInvalid:"在庫数量を確認してください。補充数量は整数のみ指定できます。",restockCapacityExceeded:"現在の在庫が最大容量を超えています。在庫と容量設定を確認してください。",reset:"リセット",pending:"未送信の変更",submit:"変更を送信",done:"完了",editChannel:"レーン {code}",cardHint:"レーンをタップして商品と数量を設定します。",loadError:"データを読み込めません。再試行してください。",saveError:"保存できませんでした。編集内容は保持されています。",retry:"再試行",loading:"読み込み中…",saving:"保存中…",saved:"保存しました",noChannels:"レーンがありません",noMatches:"該当するレーンがありません",discardTitle:"未保存の変更を破棄しますか?",discardDescription:"レーンの変更はまだ送信されていません。",discard:"破棄",keepEditing:"編集を続ける",invalidQuantity:"0 から容量までの整数を入力してください。",blocked:"詰まり",disabled:"停止中",product:"商品",quantity:"補充後の数量",dispensing:"商品を準備しています",dispenseDescription:"商品を一つずつ排出しています。お待ちください。",preparing:"注文を準備中",dispensingNow:"排出中",waiting:"待機中",success:"排出済み",failed:"未排出",dispenseUncertain:"確認が必要です",dispenseUncertainDescription:"払い出し結果を確認できません。スタッフに取り出し口の確認を依頼してください。",dispenseMappingMissing:"この商品の投出口が設定されていません。スタッフにお知らせください。",dispenseMappingInvalid:"商品の投出口設定に問題があります。スタッフに確認を依頼してください。",dispenseUnsupported:"この端末では払い出しできません。スタッフにお知らせください。",dispenseBusy:"機器が使用中です。スタッフにお知らせください。",dispenseBoardOffline:"商品の投出口に接続できません。スタッフにお知らせください。",dispenseNotReady:"機器が未接続か準備中です。スタッフにお知らせください。",dispenseFailedDescription:"この商品を払い出しできませんでした。スタッフにお知らせください。",summaryUncertain:"排出済み {success} 点 \xb7 未排出 {failed} 点 \xb7 要確認 {uncertain} 点",progress:"{total} 点中 {done} 点処理済み",complete:"お楽しみください!",completeDescription:"{brand} でのお買い物、ありがとうございます。",partial:"スタッフの確認が必要です",partialDescription:"お支払いは完了しています。未排出の商品についてスタッフにお問い合わせください。",postPaymentError:"お支払いは完了しています。スタッフにお問い合わせください。",redemptionPartialDescription:"未排出の商品についてスタッフにお問い合わせください。",redemptionCollectionError:"スタッフにお問い合わせください。",summary:"排出済み {success} 点 \xb7 未排出 {failed} 点",returning:"{seconds} 秒後にホームに戻ります",itemNumber:"商品 {number}",itemTotal:"/ 全 {total} 点",droppedTotal:"/ {total} 点を排出済み",droppedCount:"{count} 点を排出済み",collectDescription:"下の取り出し口から商品をお取りください。",pickupTip:"商品はこの画面の下にある取り出し口に出てきます。",waitUntilFinished:"すべての商品の排出が終わるまでお待ちください。",order:"注文 {id}"},pt:{catalogTitle:"Escolha seus produtos",catalogHint:"Escolha as op\xe7\xf5es e quantidades e confira o pedido.",catalogQuantity:"Quantidade",catalogAdded:"Adicionado",catalogSoldOut:"Esgotado",catalogUnavailable:"Indispon\xedvel no momento",catalogUnavailableLabel:"Indispon\xedvel",catalogLimitReached:"Limite atingido",collectQuotaReached:"Sem resgates dispon\xedveis",catalogEmpty:"N\xe3o h\xe1 produtos dispon\xedveis nesta m\xe1quina.",catalogUpdateFailed:"N\xe3o foi poss\xedvel atualizar a sele\xe7\xe3o. Tente novamente.",catalogOrderActions:"A\xe7\xf5es do pedido",catalogToPay:"A pagar",catalogCart:"Ver pedido, {count} produtos",catalogCheckout:"Finalizar compra",catalogConfirmOrder:"Confirmar",catalogPromotion:"Promo\xe7\xf5es",collectAlsoBuy:"Quer comprar mais alguma coisa?",catalogCartEmpty:"O seu carrinho est\xe1 vazio.",collectTitle:"Itens para resgatar",collectAvailable:"Dispon\xedveis",collectSelected:"Selecionadas",collectRemaining:"Restantes",collectVoucherCount:"{count} vouchers",collectGroupSelected:"Selecionados {selected} de {total}",collectSelectedCount:"Selecionados {selected}",collectSelect:"Selecionar",collectSkuRemaining:"Restam {remaining} de {total}",collectSkuConfirm:"Confirmar",collectSkuCancel:"Cancelar",collectRedeem:"Resgatar",collectNoProducts:"N\xe3o h\xe1 produtos dispon\xedveis para resgate nesta m\xe1quina.",collectInvalid:"A sele\xe7\xe3o n\xe3o corresponde aos vouchers dispon\xedveis. Ajuste a sele\xe7\xe3o.",collectLimit:"O limite deste grupo de vouchers foi atingido.",collectScanMore:"Escaneie para adicionar vouchers",collectDecrease:"Diminuir {name}",collectIncrease:"Aumentar {name}",collectRemove:"Remover {name}",collectUnsupported:"Escaneie um voucher de produto nesta p\xe1gina.",channelTest:"Testar",channelTesting:"Testando…",channelTestSuccess:"Teste conclu\xeddo",channelTestFailed:"O teste falhou",channelTestUnknown:"Verifique o resultado do teste",channelTestHint:"O teste executa uma entrega. O estoque n\xe3o \xe9 atualizado automaticamente; informe a quantidade f\xedsica restante ap\xf3s o teste.",reviewTitle:"Revisar reposi\xe7\xe3o",reviewDescription:"Confira os produtos e as quantidades f\xedsicas antes de confirmar. Canais que compartilham a mesma posi\xe7\xe3o de estoque s\xe3o contados apenas uma vez.",reviewDetails:"Altera\xe7\xf5es por canal",reviewBefore:"Qtd. anterior",reviewDelta:"Varia\xe7\xe3o",reviewProductRemoved:"Remover produto anterior",reviewProductAdded:"Associar novo produto",reviewSummary:"Altera\xe7\xf5es por produto",reviewAdded:"Adicionados",reviewRemoved:"Removidos",reviewTotals:"Total: {added} adicionados \xb7 {removed} removidos",reviewConfirm:"Confirmar e enviar",stockSyncPending:"Enviado. Aguardando a atualiza\xe7\xe3o do estoque. N\xe3o envie novamente.",stockSyncReview:"As altera\xe7\xf5es de estoque precisam ser verificadas. Atualizar apenas consulta o estoque, sem reenviar. Entre em contato com um funcion\xe1rio se continuarem sem confirma\xe7\xe3o.",stockRefresh:"Atualizar estoque",restockChanged:"O estoque ou a configura\xe7\xe3o do canal mudou. Atualize e confira as quantidades antes de enviar.",restockReserved:"Parte do estoque est\xe1 reservada ou indispon\xedvel. Confira o estoque f\xedsico e dispon\xedvel antes de reduzir ou trocar o produto.",dispenseStockReview:"Os resultados da entrega est\xe3o acima. Guarde o n\xfamero do pedido e entre em contato com um funcion\xe1rio.",inventoryUnavailable:"N\xe3o foi poss\xedvel atualizar o estoque. Tente novamente.",inventoryUnmapped:"Esta variante n\xe3o tem estoque configurado. Entre em contato com um funcion\xe1rio.",inventoryInsufficient:"H\xe1 apenas {quantity} unidades de {sku} dispon\xedveis. Reduza a quantidade.",dispensePluginNotReady:"O plugin de entrega ainda n\xe3o est\xe1 pronto. Entre em contato com um funcion\xe1rio.",dispenseInventoryInsufficient:"N\xe3o h\xe1 estoque suficiente para entregar este item. Entre em contato com um funcion\xe1rio.",brand:"Bem-vindo",poweredBy:"Suporte t\xe9cnico Pisell",machine:"M\xe1quina de vendas",idleTitle:"Meias antiderrapantes, aqui.",idleDescription:"Compre um par ou retire as meias que voc\xea j\xe1 pagou.",touch:"Toque para come\xe7ar",promoTitle:"Tamanhos adultos dispon\xedveis",promoDescription:"EU 39–46 em preto, azul-marinho e coral.",partyPromoTitle:"Pacotes de festa",partyPromoDescription:"Reserve uma festa com meias inclu\xeddas para todos os convidados.",memberPromoTitle:"Membros economizam 10%",memberPromoDescription:"Leia seu c\xf3digo de membro antes de pagar.",scanHint:"Tem uma pulseira ou c\xf3digo QR? Aproxime do leitor a qualquer momento.",homeTitle:"Adquira suas meias antiderrapantes",language:"Idioma",homeDescription:"O uso de meias antiderrapantes \xe9 obrigat\xf3rio na \xe1rea de recrea\xe7\xe3o. Escolha uma op\xe7\xe3o abaixo.",homePreparing:"Preparando…",buy:"Comprar meias",buyDescription:"Escolha o tamanho e pague aqui",redeem:"Retirar meias",redeemDescription:"Leia sua pulseira ou o c\xf3digo QR ou de barras do seu pedido ou reserva.",redeemTitle:"Encontre sua conta",redeemFindDescription:"Leia seu c\xf3digo ou digite o n\xfamero do pedido ou c\xf3digo abaixo.",redeemCodeLabel:"Digite seu c\xf3digo manualmente",redeemCodePlaceholder:"Digite seu c\xf3digo",redeemCodeHint:"Digite o c\xf3digo como aparece na pulseira, no voucher ou na reserva.",redeemContinue:"Continuar",redeemClearCode:"Limpar c\xf3digo",redeemScanPrompt:"Leia seu c\xf3digo QR ou de barras",redeemScannerLocation:"Aproxime-o do leitor abaixo da tela.",redeemOr:"Ou",redeemTypeWristband:"Pulseira",redeemTypeWallet:"Carteira de membro",redeemTypeVoucher:"Voucher",redeemTypeReceipt:"Recibo",scannedCode:"C\xf3digo lido",waitingForScan:"Aguardando leitura…",scannedCodeHint:"O c\xf3digo lido aparecer\xe1 aqui automaticamente.",scanPreparing:"Preparando sua compra",scanPreparingHint:"Aguarde. A p\xe1gina de compras abrir\xe1 automaticamente.",scanPrepareFailed:"N\xe3o foi poss\xedvel abrir a p\xe1gina de compras",scanPrepareFailedHint:"Tente novamente ou volte para recome\xe7ar.",scanResolveFailed:"O c\xf3digo \xe9 inv\xe1lido",scanProcessing:"Processando…",scanNoVouchers:"Nenhum cupom de produto v\xe1lido foi encontrado.",scanVoucherNotStarted:"Seus cupons de produto ainda n\xe3o est\xe3o v\xe1lidos.",scanVoucherExpired:"Seus cupons de produto expiraram.",scanVoucherUnavailable:"Seus cupons de produto n\xe3o podem ser resgatados no momento.",scanUnrecognized:"Este c\xf3digo n\xe3o pode ser usado. Tente outro c\xf3digo.",help:"Ajuda",contact:"Se tiver algum problema, procure um funcion\xe1rio.",back:"Voltar",home:"Voltar ao in\xedcio",staffSignIn:"Acesso de funcion\xe1rios",staffDescription:"Escolha seu nome e digite seu PIN para gerenciar a m\xe1quina.",settingsDescription:"Escolha seu nome e digite seu PIN para abrir as configura\xe7\xf5es.",selectStaff:"Selecionar funcion\xe1rio",enterId:"Inserir ID",verify:"Verificar",staff:"Funcion\xe1rio",signOut:"Sair do modo funcion\xe1rio",welcomeStaff:"Ol\xe1, {name}",staffHome:"Gerenciar m\xe1quina",resume:"Retomar atendimento",configure:"Configurar e reabastecer",configureDescription:"Defina o produto e a quantidade de cada canal ap\xf3s abastecer e envie todas as altera\xe7\xf5es.",configureCard:"Gerencie produtos e estoque por canal",sellable:"Dispon\xedvel",low:"Baixo",empty:"Vazio",unavailable:"Fora de servi\xe7o",inline:"Editar lista",cards:"Ver cart\xf5es",all:"Todos",changed:"Alterados",row:"Linha",channel:"Canal",channels:"Canais",productStock:"Produto e estoque",quantityAfter:"Qtd. ap\xf3s",action:"A\xe7\xe3o",current:"Atual",capacity:"de {capacity}",noProduct:"Sem produto",fill:"Encher",fillAll:"Encher todos os canais",board:"Placa de controlo",restockDraftOnly:"Ainda n\xe3o \xe9 poss\xedvel guardar altera\xe7\xf5es de estoque. As edi\xe7\xf5es ficam apenas nesta p\xe1gina.",restockDeviceMissing:"Nenhum dispositivo ligado foi encontrado. Verifique as defini\xe7\xf5es e tente novamente.",restockConfigurationInvalid:"Verifique a placa, o n\xfamero de canais e a capacidade m\xe1xima nas defini\xe7\xf5es do dispositivo.",restockDataInvalid:"N\xe3o foi poss\xedvel ler os dados de estoque. Tente novamente.",restockUnconfigured:"Este canal n\xe3o tem uma posi\xe7\xe3o de estoque configurada.",restockSpaceMissing:"A posi\xe7\xe3o de estoque configurada n\xe3o foi encontrada.",restockSpaceInactive:"Esta posi\xe7\xe3o de estoque est\xe1 inativa.",restockMultipleProducts:"Esta posi\xe7\xe3o tem v\xe1rios produtos. Verifique a configura\xe7\xe3o do canal.",restockProductMissing:"O produto associado n\xe3o foi encontrado.",restockProductInactive:"O produto associado est\xe1 inativo.",restockStockInvalid:"Verifique a quantidade em estoque. A reposi\xe7\xe3o exige unidades inteiras.",restockCapacityExceeded:"O estoque atual excede a capacidade configurada. Verifique o estoque e a capacidade.",reset:"Redefinir",pending:"Altera\xe7\xf5es pendentes",submit:"Enviar altera\xe7\xf5es",done:"Concluir",editChannel:"Canal {code}",cardHint:"Toque em um canal para definir produto e quantidade.",loadError:"N\xe3o foi poss\xedvel carregar. Tente novamente.",saveError:"N\xe3o foi poss\xedvel salvar. Suas altera\xe7\xf5es foram mantidas.",retry:"Tentar novamente",loading:"Carregando…",saving:"Salvando…",saved:"Altera\xe7\xf5es salvas",noChannels:"Nenhum canal dispon\xedvel",noMatches:"Nenhum canal corresponde",discardTitle:"Descartar altera\xe7\xf5es n\xe3o salvas?",discardDescription:"As altera\xe7\xf5es dos canais ainda n\xe3o foram enviadas.",discard:"Descartar",keepEditing:"Continuar editando",invalidQuantity:"Insira um n\xfamero inteiro entre 0 e a capacidade do canal.",blocked:"Bloqueado",disabled:"Desativado",product:"Produto",quantity:"Quantidade ap\xf3s abastecer",dispensing:"Preparando seus produtos",dispenseDescription:"Aguarde enquanto entregamos um produto por vez.",preparing:"Preparando seu pedido",dispensingNow:"Entregando",waiting:"Aguardando",success:"Entregue",failed:"N\xe3o entregue",dispenseUncertain:"Requer verifica\xe7\xe3o",dispenseUncertainDescription:"N\xe3o foi poss\xedvel confirmar a entrega. Pe\xe7a a um funcion\xe1rio para verificar o compartimento de retirada.",dispenseMappingMissing:"Este produto n\xe3o tem um canal configurado. Contacte um funcion\xe1rio.",dispenseMappingInvalid:"A configura\xe7\xe3o do canal deste produto deve ser verificada por um funcion\xe1rio.",dispenseUnsupported:"Este dispositivo n\xe3o pode entregar produtos. Contacte um funcion\xe1rio.",dispenseBusy:"A m\xe1quina est\xe1 ocupada. Contacte um funcion\xe1rio.",dispenseBoardOffline:"O canal deste produto est\xe1 offline. Contacte um funcion\xe1rio.",dispenseNotReady:"A m\xe1quina n\xe3o est\xe1 ligada ou pronta. Contacte um funcion\xe1rio.",dispenseFailedDescription:"N\xe3o foi poss\xedvel entregar este produto. Contacte um funcion\xe1rio.",summaryUncertain:"{success} entregues \xb7 {failed} n\xe3o entregues \xb7 {uncertain} por verificar",progress:"{done} de {total} produtos processados",complete:"Aproveite!",completeDescription:"Obrigado por comprar com {brand}.",partial:"Alguns produtos precisam de aten\xe7\xe3o",partialDescription:"O pagamento foi conclu\xeddo. Procure um funcion\xe1rio para os produtos restantes.",postPaymentError:"Seu pedido est\xe1 pago. Procure um funcion\xe1rio para concluir a retirada.",redemptionPartialDescription:"Procure um funcion\xe1rio para os produtos restantes.",redemptionCollectionError:"Procure um funcion\xe1rio para concluir a retirada.",summary:"{success} entregues \xb7 {failed} n\xe3o entregues",returning:"Voltando ao in\xedcio em {seconds}s",itemNumber:"Item {number}",itemTotal:"de {total}",droppedTotal:"de {total} entregues",droppedCount:"{count} entregues",collectDescription:"Retire seus produtos na abertura de retirada abaixo.",pickupTip:"Seus produtos saem pela abertura de retirada abaixo desta tela.",waitUntilFinished:"Aguarde a entrega de todos os produtos.",order:"Pedido {id}"}};function e1T(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"en";return(e1M[l]||e1C)[e].replace(/\{(\w+)\}/g,(e,l)=>String(t[l]??e))}function e1I(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en";return"string"==typeof e?e:e&&(e[t]||e.original||e.en||Object.values(e).find(Boolean))||""}function e1P(){let e=db();return(0,eN.useMemo)(()=>({text:(t,l)=>e1T(t,l,e),localized:t=>e1I(t,e)}),[e])}let e1A=[{value:"en",label:"English"},{value:"zh-CN",label:"简体中文"},{value:"zh-HK",label:"繁體中文"},{value:"ja",label:"日本語"},{value:"pt",label:"Portugu\xeas"}];function e1D(e){let{locale:t,disabled:l,onChange:i}=e,{text:a}=e1P();return(0,eB.jsxs)("label",{className:"vm-customer-language","data-disabled":l,children:[(0,eB.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,eB.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,eB.jsx)("path",{d:"M3.5 12h17M12 3c2.7 2.6 4.1 5.6 4.1 9S14.7 18.4 12 21M12 3C9.3 5.6 7.9 8.6 7.9 12S9.3 18.4 12 21"})]}),(0,eB.jsx)("select",{"aria-label":a("language"),value:t,disabled:l,onChange:e=>{l||i(e.target.value)},children:e1A.map(e=>{let{value:t,label:l}=e;return(0,eB.jsx)("option",{value:t,lang:t,children:l},t)})}),(0,eB.jsx)("svg",{className:"vm-customer-language-chevron",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(0,eB.jsx)("path",{d:"m6 9 6 6 6-6"})})]})}function e1E(e){let{name:t}=e;return(0,eB.jsx)("span",{className:`vm-prototype-icon vm-prototype-icon-${t}`,"aria-hidden":"true"})}function e1O(e){let{children:t}=e;return(0,eB.jsx)("div",{className:"vm-customer-viewport",children:(0,eB.jsx)("div",{className:"vm-customer-canvas",children:t})})}let e1z=(0,eN.createContext)(void 0);function e1L(e){var t;let{name:l,subtitle:i,compact:a=!1}=e,n=null==(t=(0,eN.useContext)(e1z))?void 0:t.trim(),[r,o]=(0,eN.useState)(!1);return(0,eN.useEffect)(()=>o(!1),[n]),(0,eB.jsxs)("div",{className:`vm-customer-brand${a?" vm-customer-brand-compact":""}`,children:[n&&!r?(0,eB.jsx)("img",{className:"vm-customer-logo",src:n,alt:"",onError:()=>o(!0)},n):(0,eB.jsx)("span",{className:"vm-customer-monogram","aria-hidden":"true",children:Array.from(l.trim())[0]||"R"}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("p",{className:"vm-customer-brand-name",children:l}),!a&&(0,eB.jsx)("p",{className:"vm-customer-brand-subtitle",children:i})]})]})}function e1R(e){let{pill:t=!1}=e,{text:l}=e1P();return(0,eB.jsxs)("div",{className:`vm-customer-scan-hint${t?" vm-customer-scan-hint-pill":""}`,children:[(0,eB.jsx)(e1E,{name:"qr-code"}),(0,eB.jsx)("span",{children:l("scanHint")}),(0,eB.jsx)(e1E,{name:"arrow-down"})]})}function e1$(e){let{active:t,onRequestSettings:l}=e,i=db(),a=(0,eN.useRef)([]);return(0,eN.useEffect)(()=>{a.current=[]},[t]),(0,eB.jsx)("fieldset",{className:"vm-customer-technical-support",disabled:!t,children:(0,eB.jsx)(nB.PisellBrand,{locale:i,onClick:e=>{if(e.stopPropagation(),!t)return;let i=Date.now();a.current=[...a.current.filter(e=>i-e<3e3),i],a.current.length>=5&&(a.current=[],l())}})})}function e1F(e){let{brand:t,subtitle:l,active:i,onStart:a,onRequestSettings:n}=e,{text:r}=e1P();return(0,eB.jsxs)("section",{className:`vm-customer-idle${i?"":" vm-customer-paused"}`,children:[(0,eB.jsx)(e1$,{active:i,onRequestSettings:n}),(0,eB.jsxs)("div",{className:"vm-customer-shapes","aria-hidden":"true",children:[(0,eB.jsx)("span",{className:"vm-customer-blob vm-customer-blob-purple"}),(0,eB.jsx)("span",{className:"vm-customer-blob vm-customer-blob-lime"}),(0,eB.jsx)("span",{className:"vm-customer-blob vm-customer-blob-ring"}),(0,eB.jsx)("span",{className:"vm-customer-blob vm-customer-blob-soft"}),(0,eB.jsx)("span",{className:"vm-customer-blob vm-customer-blob-small"})]}),(0,eB.jsxs)("div",{className:"vm-customer-idle-layout",children:[(0,eB.jsxs)("header",{className:"vm-customer-idle-header",children:[(0,eB.jsx)(e1L,{name:t,subtitle:l}),(0,eB.jsxs)("div",{className:"vm-customer-idle-copy",children:[(0,eB.jsx)("h1",{children:r("idleTitle")}),(0,eB.jsx)("p",{children:r("idleDescription")})]})]}),(0,eB.jsx)("div",{className:"vm-customer-idle-actions",children:(0,eB.jsxs)("div",{className:"vm-customer-start",children:[(0,eB.jsxs)("div",{className:"vm-customer-touch","aria-hidden":"true",children:[(0,eB.jsx)("span",{className:"vm-customer-pulse"}),(0,eB.jsx)("span",{className:"vm-customer-pulse"}),(0,eB.jsx)("span",{className:"vm-customer-hand",children:(0,eB.jsx)(e1E,{name:"hand"})})]}),(0,eB.jsx)("p",{className:"vm-customer-touch-label",children:r("touch")})]})}),(0,eB.jsx)("div",{className:"vm-customer-idle-footer",children:(0,eB.jsx)(e1R,{pill:!0})})]}),(0,eB.jsx)("button",{type:"button",className:"vm-customer-idle-hitarea","aria-label":r("touch"),onClick:a})]})}function e1q(e){let{brand:t,machine:l,locale:i="en",languageDisabled:a=!1,onLocaleChange:n,active:r,ready:o,failed:s,onBuy:d,onRedeem:c,onHelp:u,onRetry:p,onRequestSettings:m,onStaffTap:g}=e,{text:h}=e1P();return(0,eB.jsxs)("section",{className:"vm-customer-home",children:[(0,eB.jsx)(e1$,{active:r,onRequestSettings:m}),(0,eB.jsxs)("header",{className:"vm-customer-home-header vm-customer-home-toolbar",children:[(0,eB.jsx)(e1L,{name:t,compact:!0}),n&&(0,eB.jsx)(e1D,{locale:i,disabled:!r||a,onChange:n})]}),(0,eB.jsxs)("div",{className:"vm-customer-home-content",children:[(0,eB.jsx)("h1",{children:h("homeTitle")}),(0,eB.jsx)("p",{className:"vm-customer-home-description",children:h("homeDescription")}),(0,eB.jsxs)("div",{className:"vm-customer-actions",children:[(0,eB.jsxs)("button",{type:"button",className:"vm-customer-buy",disabled:!o,onClick:d,children:[(0,eB.jsx)("span",{className:"vm-customer-buy-icon",children:(0,eB.jsx)(e1E,{name:"footprints"})}),(0,eB.jsxs)("span",{className:"vm-customer-buy-copy",children:[(0,eB.jsx)("span",{className:"vm-customer-buy-title",children:h("buy")}),(0,eB.jsx)("span",{className:"vm-customer-buy-description",children:h("buyDescription")})]}),(0,eB.jsx)(e1E,{name:"chevron-right"})]}),(0,eB.jsxs)("button",{type:"button",className:"vm-customer-buy vm-customer-redeem",onClick:c,children:[(0,eB.jsx)("span",{className:"vm-customer-buy-icon",children:(0,eB.jsx)(e1E,{name:"qr-code"})}),(0,eB.jsxs)("span",{className:"vm-customer-buy-copy",children:[(0,eB.jsx)("span",{className:"vm-customer-buy-title",children:h("redeem")}),(0,eB.jsx)("span",{className:"vm-customer-buy-description",children:h("redeemDescription")})]}),(0,eB.jsx)(e1E,{name:"chevron-right"})]})]}),!o&&s&&(0,eB.jsx)("div",{className:"vm-customer-load-error",children:(0,eB.jsx)(eM.Alert,{type:"error",message:h("loadError"),action:(0,eB.jsx)("button",{className:"vm-text-button",onClick:p,children:h("retry")})})}),(0,eB.jsx)(e1R,{})]}),(0,eB.jsxs)("footer",{className:"vm-customer-home-footer",children:[(0,eB.jsxs)("button",{type:"button",className:"vm-customer-help",onClick:u,children:[(0,eB.jsx)(e1E,{name:"life-buoy"}),h("help")]}),(0,eB.jsx)("div",{className:"vm-customer-machine-row",children:(0,eB.jsx)("button",{type:"button",className:"vm-customer-machine",tabIndex:-1,onClick:g,children:l})})]})]})}let e1B={pending:"waiting",dispensing:"dispensingNow",success:"success",failed:"failed",uncertain:"dispenseUncertain"},e1H={pending:"circle-dashed",dispensing:"loader-circle",success:"check",failed:"circle-alert",uncertain:"circle-alert"},e1V=e=>"failed"===e.status&&e.uncertain?"uncertain":e.status;function e1U(e){var t,l;let{brand:i,sale:a,isRedemption:n,progress:r,error:o,stage:s,seconds:d,onHome:c}=e,{text:u,localized:p}=e1P(),m=(0,eN.useRef)(null),g=(0,eN.useRef)(null),h=(null==r?void 0:r.items)||[],v=h.filter(e=>"success"===e.status).length,f=h.filter(e=>"failed"===e.status).length,y=h.filter(e=>"failed"===e.status&&e.uncertain).length,b=v+f,x=h.findIndex(e=>"dispensing"===e.status),k=null==(t=h[x>=0?x:b-1])?void 0:t.key,_=x>=0?x+1:Math.min(b+1,h.length),w="result"===s,S=n?"redemptionCollectionError":"postPaymentError",j=w&&!o&&(null==r?void 0:r.status)==="complete"&&h.length>0&&v===h.length;return(0,eN.useLayoutEffect)(()=>{let e=m.current,t=g.current;if(!e||!t)return;let l=()=>{if(!e.clientHeight||!e.offsetHeight)return;let l=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a=l.height/e.offsetHeight;if(a<=0)return;let n=(i.top-l.top)/a-e.clientTop,r=i.height/a;if(n>=16&&n+r<=e.clientHeight-16)return;let o=e.scrollTop+n-Math.max(16,(e.clientHeight-r)/2);e.scrollTo({top:Math.max(0,Math.min(o,e.scrollHeight-e.clientHeight)),behavior:"auto"})};l();let i=new ResizeObserver(l);return i.observe(e),i.observe(t),()=>i.disconnect()},[k,w]),(0,eB.jsxs)("section",{className:"vm-dispense-screen",children:[(0,eB.jsx)("header",{className:"vm-dispense-brand",children:(0,eB.jsx)(e1L,{name:i,compact:!0})}),(0,eB.jsxs)("div",{className:"vm-dispense-heading",children:[(0,eB.jsx)("h1",{children:u(w?j?"complete":"partial":"dispensing")}),(0,eB.jsx)("p",{children:u(o?S:w?j?"completeDescription":n?"redemptionPartialDescription":"partialDescription":"dispenseDescription",{brand:i})})]}),(0,eB.jsxs)("div",{className:"vm-dispense-content",ref:m,children:[h.length?(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)("section",{className:"vm-dispense-progress-card","aria-live":"polite",children:[(0,eB.jsxs)("div",{className:"vm-dispense-counter-row",children:[(0,eB.jsxs)("p",{className:"vm-dispense-counter",children:[w?v:u("itemNumber",{number:_}),(0,eB.jsxs)("span",{children:[" ",u(w?"droppedTotal":"itemTotal",{total:h.length})]})]}),!w&&(0,eB.jsx)("p",{className:"vm-dispense-dropped",children:u("droppedCount",{count:v})})]}),(0,eB.jsx)("div",{className:"vm-dispense-segments",role:"progressbar","aria-label":u("progress",{done:b,total:h.length}),"aria-valuemin":0,"aria-valuemax":h.length,"aria-valuenow":b,children:h.map(e=>(0,eB.jsx)("span",{className:"vm-dispense-segment vm-dispense-segment-"+e1V(e)},e.key))})]}),(0,eB.jsx)("ol",{className:"vm-dispense-items",children:h.map(e=>(0,eB.jsxs)("li",{ref:e.key===k?g:void 0,className:"vm-dispense-item vm-dispense-item-"+e1V(e),children:[(0,eB.jsx)("span",{className:"vm-dispense-item-icon",children:(0,eB.jsx)(e1E,{name:e1H[e1V(e)]})}),(0,eB.jsxs)("div",{className:"vm-dispense-item-copy",children:[(0,eB.jsxs)("p",{className:"vm-dispense-item-title",title:[p(e.title),p(e.specification)].filter(Boolean).join(" "),children:[p(e.title),p(e.specification)&&(0,eB.jsxs)(eB.Fragment,{children:[" ",(0,eB.jsx)("span",{className:"vm-dispense-item-specification",children:p(e.specification)})]})]}),(0,eB.jsx)("p",{className:"vm-dispense-item-status",children:u(e1B[e1V(e)])}),"failed"===e.status&&e.message&&(0,eB.jsx)("p",{className:"vm-dispense-item-message",children:e.message})]})]},e.key))})]}):w?null:(0,eB.jsxs)("div",{className:"vm-dispense-preparing",role:"status",children:[(0,eB.jsx)(e1E,{name:"loader-circle"}),u("preparing")]}),w&&(0,eB.jsxs)("div",{className:"vm-dispense-collection-note"+(j?"":" vm-dispense-attention"),role:j?"note":"alert",children:[(0,eB.jsx)("span",{className:"vm-dispense-note-icon",children:(0,eB.jsx)(e1E,{name:j?"hand":"circle-alert"})}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("p",{children:u(j?"collectDescription":S)}),!j&&!!h.length&&(0,eB.jsx)("p",{className:"vm-dispense-summary",children:u(y?"summaryUncertain":"summary",{success:v,failed:h.length-v-y,uncertain:y})}),a&&(0,eB.jsx)("p",{className:"vm-dispense-order",children:u("order",{id:a.orderId})})]})]}),w&&(null==r||null==(l=r.inventorySync)?void 0:l.status)==="review"&&(0,eB.jsxs)("div",{className:"vm-dispense-collection-note vm-dispense-attention",role:"alert",children:[(0,eB.jsx)("span",{className:"vm-dispense-note-icon",children:(0,eB.jsx)(e1E,{name:"circle-alert"})}),(0,eB.jsx)("div",{children:(0,eB.jsx)("p",{children:u("dispenseStockReview")})})]})]}),(0,eB.jsxs)("footer",{className:"vm-dispense-footer",children:[(0,eB.jsxs)("div",{className:"vm-dispense-contact",role:"note",children:[(0,eB.jsx)("span",{className:"vm-dispense-contact-icon",children:(0,eB.jsx)(e1E,{name:"life-buoy"})}),(0,eB.jsx)("p",{children:u("contact")})]}),w&&(0,eB.jsxs)("button",{type:"button",className:"vm-dispense-button vm-dispense-button-primary",onClick:c,children:[(0,eB.jsx)(e1E,{name:"check"}),(0,eB.jsxs)("span",{children:[u("done"),j?` (${d}s)`:""]})]}),(0,eB.jsxs)("div",{className:"vm-dispense-pickup"+(w?"":" vm-dispense-pickup-pending"),role:"note",children:[(0,eB.jsx)("span",{className:"vm-dispense-pickup-icon",children:(0,eB.jsx)(e1E,{name:"arrow-down"})}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("p",{className:"vm-dispense-pickup-title",children:u("pickupTip")}),!w&&(0,eB.jsx)("p",{className:"vm-dispense-wait",children:u("waitUntilFinished")})]})]})]})]})}function e1Y(e){let{busy:t,pending:l=!1,primaryLabel:i,primaryIcon:a,primaryType:n="button",primaryDisabled:r=!1,secondaryAction:o,children:s,onBack:d,onPrimary:c}=e,{text:u}=e1P(),p=(0,eN.useRef)(null),[m,g]=(0,eN.useState)(0);(0,eN.useLayoutEffect)(()=>{var e;let t=null==(e=p.current)?void 0:e.parentElement;if(!t)return;let l=()=>{let e=window.getComputedStyle(t);g(Math.max(0,t.clientWidth-(parseFloat(e.paddingLeft)||0)-(parseFloat(e.paddingRight)||0)))};if(l(),"u">typeof ResizeObserver){let e=new ResizeObserver(e=>{let[t]=e;t&&g(t.contentRect.width)});return e.observe(t),()=>e.disconnect()}return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]);let h=[m<=1600?"vm-bar-compact":"",m<=1024?"vm-bar-stacked":"",m<=450?"vm-bar-narrow":""].filter(Boolean).join(" ");return(0,eB.jsxs)(eB.Fragment,{children:[o&&(0,eB.jsxs)("button",{className:`vm-bottom-bar-secondary ${h}`,type:"button",disabled:t,"aria-disabled":t||l,onClick:()=>{t||l||o.onClick()},children:[o.icon,(0,eB.jsx)("span",{children:o.label})]}),(0,eB.jsxs)("footer",{ref:p,className:`vm-bottom-bar vm-catalog-bar ${h}${s?" vm-bottom-bar--with-summary":""}`,style:{"--vm-bar-fluid-font-size":`${.05*m}px`},"aria-label":u("catalogOrderActions"),children:[(0,eB.jsxs)("button",{className:"vm-catalog-bar-button",type:"button",disabled:t,"aria-disabled":t||l,onClick:()=>{t||l||d()},children:[(0,eB.jsx)("svg",{className:"vm-catalog-bar-arrow",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(0,eB.jsx)("path",{d:"m15 5-7 7 7 7"})}),(0,eB.jsx)("span",{children:u("back")})]}),(0,eB.jsx)("div",{className:"vm-catalog-bar-summary","aria-live":s?"polite":void 0,children:s}),(0,eB.jsxs)("button",{className:"vm-catalog-bar-button vm-catalog-bar-next",type:n,disabled:t||r,"aria-disabled":t||l||r,onClick:e=>{t||l||r?e.preventDefault():null==c||c()},children:[(0,eB.jsx)("span",{children:i}),a]})]})]})}function e1W(e){let{quantity:t,busy:l,pending:i=!1,onReview:a}=e,{text:n}=e1P();return(0,eB.jsxs)("button",{className:"vm-catalog-bar-cart",type:"button",disabled:l||0===t,"aria-disabled":l||i||0===t,onClick:()=>{l||i||!(t>0)||a()},"aria-label":n("catalogCart",{count:t}),children:[(0,eB.jsx)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:(0,eB.jsx)("path",{d:"M6 8h12l1 12H5L6 8Zm3 0a3 3 0 0 1 6 0"})}),(0,eB.jsx)("strong",{children:t})]})}function e1G(e){let{quantity:t,total:l,amountDue:i,busy:a,pending:n=!1,onBack:r,onReview:o,onCheckout:s,onPromotion:d,promotionVisible:c=!1}=e,{text:u}=e1P();return(0,eB.jsxs)(e1Y,{busy:a,pending:n,onBack:r,primaryLabel:u(0===i?"catalogConfirmOrder":"catalogCheckout"),primaryIcon:(0,eB.jsx)("svg",{className:"vm-catalog-bar-arrow",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(0,eB.jsx)("path",{d:"m9 5 7 7-7 7"})}),onPrimary:s,children:[0!==i&&(0,eB.jsxs)("button",{className:"vm-catalog-bar-amount",type:"button",disabled:a||0===t,"aria-disabled":a||n||0===t,onClick:()=>{a||n||!(t>0)||o()},children:[(0,eB.jsx)("span",{children:u("catalogToPay")}),(0,eB.jsx)("strong",{children:l})]}),(0,eB.jsx)(e1W,{quantity:t,busy:a,pending:n,onReview:o}),d&&(0,eB.jsxs)("button",{className:"vm-catalog-bar-promotion",type:"button",disabled:a,"aria-disabled":a||n,"aria-label":u("catalogPromotion"),"aria-pressed":c,"aria-expanded":c,onClick:()=>{a||n||d()},children:[(0,eB.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,eB.jsx)("path",{d:"m6 18 12-12"}),(0,eB.jsx)("circle",{cx:"7",cy:"7",r:"3"}),(0,eB.jsx)("circle",{cx:"17",cy:"17",r:"3"})]}),(0,eB.jsx)("span",{children:u("catalogPromotion")})]})]})}function e1K(e){let{brand:t,active:l=!0,busy:i=!1,scannedCode:a="",onCodeChange:n,onFindSale:r,onBack:o}=e,{text:s}=e1P();return(0,eB.jsxs)("form",{className:`vm-redeem-screen vm-bottom-bar-layout${l?"":" vm-customer-paused"}`,"aria-busy":i,onSubmit:e=>{e.preventDefault();let t=a.trim();l&&!i&&t&&r(t)},children:[(0,eB.jsx)("header",{className:"vm-redeem-brand",children:(0,eB.jsx)(e1L,{name:t,compact:!0})}),(0,eB.jsx)("div",{className:"vm-redeem-heading",children:(0,eB.jsx)("h1",{children:s("redeemTitle")})}),(0,eB.jsxs)("div",{className:"vm-redeem-content",children:[(0,eB.jsx)("div",{className:"vm-redeem-code",children:(0,eB.jsxs)("div",{className:"vm-redeem-code-field",children:[(0,eB.jsxs)("svg",{className:"vm-redeem-keyboard-icon",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,eB.jsx)("rect",{x:"2",y:"3",width:"20",height:"18",rx:"2"}),(0,eB.jsx)("path",{d:"M6 7h.01M10 7h.01M14 7h.01M18 7h.01M6 11h.01M10 11h.01M14 11h.01M18 11h.01M7 16h10"})]}),(0,eB.jsx)("input",{type:"text",value:a,disabled:!l||i,onChange:e=>n(e.target.value),inputMode:"text",enterKeyHint:"search",autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,"aria-label":s("redeemCodeLabel"),placeholder:s("redeemCodePlaceholder")}),a&&(0,eB.jsx)("button",{type:"button",className:"vm-redeem-code-clear",disabled:!l||i,"aria-label":s("redeemClearCode"),onClick:()=>n(""),children:(0,eB.jsx)("span",{"aria-hidden":"true",children:"\xd7"})})]})}),(0,eB.jsx)("div",{className:"vm-redeem-divider",children:(0,eB.jsx)("span",{children:s("redeemOr")})}),(0,eB.jsxs)("div",{className:"vm-redeem-scanner-card",children:[(0,eB.jsxs)("div",{className:"vm-redeem-scanner-symbol","aria-hidden":"true",children:[(0,eB.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-tl"}),(0,eB.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-tr"}),(0,eB.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-bl"}),(0,eB.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-br"}),(0,eB.jsx)("span",{className:"vm-redeem-scanner-icon",children:(0,eB.jsx)(e1E,{name:"qr-code"})}),(0,eB.jsx)("span",{className:"vm-redeem-scan-line"})]}),(0,eB.jsxs)("div",{className:"vm-redeem-scanner-copy",children:[(0,eB.jsx)("p",{className:"vm-redeem-scanner-title",children:s("redeemScanPrompt")}),(0,eB.jsx)("p",{className:"vm-redeem-scanner-hint",children:s("redeemScannerLocation")})]}),(0,eB.jsxs)("ul",{className:"vm-redeem-code-types",children:[(0,eB.jsx)("li",{children:s("redeemTypeWristband")}),(0,eB.jsx)("li",{children:s("redeemTypeWallet")}),(0,eB.jsx)("li",{children:s("redeemTypeVoucher")}),(0,eB.jsx)("li",{children:s("redeemTypeReceipt")})]}),(0,eB.jsx)("span",{className:"vm-redeem-scanner-direction","aria-hidden":"true",children:(0,eB.jsx)(e1E,{name:"arrow-down"})})]})]}),(0,eB.jsx)(e1Y,{busy:!l||i,onBack:o,primaryType:"submit",primaryDisabled:!a.trim(),primaryLabel:s("redeemContinue"),primaryIcon:(0,eB.jsx)("svg",{className:"vm-catalog-bar-arrow",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(0,eB.jsx)("path",{d:"m9 5 7 7-7 7"})})})]})}let e1Q=e=>[...Array.isArray(e)?e:[]].sort((e,t)=>Number(e.sort||0)-Number(t.sort||0)),e1Z=(e,t)=>JSON.stringify([String(e),String(t??0)]),e1J=e=>{var t,l;return!(null==(t=e.variant_group)?void 0:t.length)&&!(null==(l=e.variant)?void 0:l.length)};function e1X(e,t,l){let i=new Map,a=new Map;for(let t of e){let e={id:String(t.id),title:l(t.title_i18n)||l(t.title),subtitle:l(t.subtitle_i18n)||l(t.subtitle),cover:"string"==typeof t.cover?t.cover:void 0,rows:[]},n=e1J(t);for(let i of n?[{id:0}]:e1Q(t.variant)){let r=new Set(String(i.sku_ids||"").split("_")),o=e1Q(t.variant_group).map(e=>{var t,a,n;let o=null==(t=e.variant_item)?void 0:t.find(t=>r.has(`${e.id}:${t.id}`));return{name:l(e.name_i18n)||l(e.name),value:l(null==o?void 0:o.name_i18n)||l(null==o?void 0:o.name)||l((null==(a=i.title)?void 0:a[e.position_id])??(null==(n=i.name)?void 0:n[e.position_id])),enabled:lJ(e)&&(!o||lJ(o))}}),s=i.price??i.base_price??t.price,d={key:e1Z(t.id,i.id),product:t,variant:i,label:n?e.title:o.map(e=>e.value).filter(Boolean).join(" \xb7 ")||l("string"==typeof i.title?i.title:i.code)||String(i.id),specification:o.filter(e=>e.value).map(e=>e.name?`${e.name}: ${e.value}`:e.value).join(", "),price:s,enabled:lJ(t)&&lJ(i)&&o.every(e=>e.enabled)&&null!=s&&Number.isFinite(Number(s))&&Number(s)>=0,items:[],quantity:0};a.has(d.key)||(a.set(d.key,d),e.rows.push(d))}e.rows.length&&i.set(e.id,e)}for(let e of t){var n,r;let t=e.product_variant_id??(null==(n=e.product_sku)?void 0:n.product_variant_id)??0,o=e1Z(e.product_id,t),s=a.get(o);if(!s){let n=String(e.product_id),d=i.get(n);d||(d={id:n,title:l(e.product_title??e.title)||n,subtitle:"",rows:[]},i.set(n,d)),s={key:o,product:{id:e.product_id},variant:{id:t},label:l(e.product_option_string??(null==(r=e.product_sku)?void 0:r.product_option_string))||("0"===String(t)?d.title:String(t)),specification:"",price:e.selling_price??e.price??0,enabled:!1,items:[],quantity:0},d.rows.push(s),a.set(o,s)}s.items.push(e),s.quantity+=Number(e.num||0)}return[...i.values()]}function e10(e){var t;let{product:l,variant:i,specification:a,price:n}=e,r=e1J(l)&&"0"===String(i.id);if(!e.enabled||!r&&!(null==(t=l.variant)?void 0:t.some(e=>String(e.id)===String(i.id))))throw Error("Invalid vending SKU selection");let o=`${l.id}_${i.id}`;return{...l,product_variant_id:i.id,isOpenDetailModal:!1,_extend:{price:n},cartDetailValue:{key:o,rowKey:o,product_id:l.id,product_variant_id:i.id,production_code:(r?l.production_code:i.production_code)??"",product_option_string:a,price:n,quantity:1,option:[],bundle:[],session:null}}}function e12(e,t){let l=e.map(e=>{let l=e.product.variant_group,i={key:"ungrouped",label:"",dimensionName:"",ranks:[Number.MAX_SAFE_INTEGER],display:{row:e,label:e.label}};if(!Array.isArray(l)||0===l.length)return i;if(1===l.length)return{...i,display:{row:e,label:e.specification||e.label}};let a=new Set(String(e.variant.sku_ids||"").split("_")),n=l.map(l=>{var i,n;let r=[...l.variant_item||[]].sort((e,t)=>Number(e.sort||0)-Number(t.sort||0)),o=r.findIndex(e=>a.has(`${l.id}:${e.id}`)),s=r[o],d=t(null==s?void 0:s.name_i18n)||t(null==s?void 0:s.name)||t((null==(i=e.variant.title)?void 0:i[l.position_id])??(null==(n=e.variant.name)?void 0:n[l.position_id]));return{key:JSON.stringify([l.id,(null==s?void 0:s.id)??d]),name:t(l.name_i18n)||t(l.name),value:d,rank:o<0?Number.MAX_SAFE_INTEGER:o}}),[r,...o]=n;return r.value?{key:r.key,label:r.value,dimensionName:t(l[0].name_i18n)||t(l[0].name),ranks:n.map(e=>e.rank),display:{row:e,label:o.filter(e=>e.value).map(e=>e.name?`${e.name}: ${e.value}`:e.value).join(" \xb7 ")||e.label}}:i});l.sort((e,t)=>{for(let l=0;l<Math.max(e.ranks.length,t.ranks.length);l++){let i=(e.ranks[l]??Number.MAX_SAFE_INTEGER)-(t.ranks[l]??Number.MAX_SAFE_INTEGER);if(i)return i}return 0});let i=new Map;for(let e of l){let t=i.get(e.key);t||(t={key:e.key,label:e.label,dimensionName:e.dimensionName,rows:[]},i.set(e.key,t)),t.rows.push(e.display)}return[...i.values()]}function e11(e){let{label:t}=e;return(0,eB.jsx)("div",{className:"vm-sku-status-overlay",role:"status",children:(0,eB.jsx)("svg",{className:"vm-sku-status-stamp",viewBox:"0 0 360 240",focusable:"false",children:(0,eB.jsxs)("g",{className:"vm-sku-status-stamp-art",transform:"rotate(-12 140 120)",children:[(0,eB.jsxs)("g",{fill:"none",stroke:"currentColor","aria-hidden":"true",children:[(0,eB.jsx)("circle",{cx:"140",cy:"120",r:"92",strokeWidth:"8"}),(0,eB.jsx)("circle",{cx:"140",cy:"120",r:"79",strokeWidth:"3"}),(0,eB.jsx)("path",{d:"M226 82c27-18 45 18 72 0l34-18M226 108c27-18 45 18 72 0l34-18M226 134c27-18 45 18 72 0l34-18M226 160c27-18 45 18 72 0l34-18",strokeWidth:"7",strokeLinecap:"round"}),(0,eB.jsx)("path",{d:"M115 66h50M115 176h50",strokeWidth:"3",strokeLinecap:"round"})]}),(0,eB.jsx)("rect",{x:"22",y:"84",width:"236",height:"72",rx:"10",fill:"currentColor"}),(0,eB.jsx)("rect",{x:"29",y:"91",width:"222",height:"58",rx:"5",fill:"none",stroke:"#fff",strokeOpacity:"0.55",strokeWidth:"2"}),(0,eB.jsx)("text",{x:"140",y:"121",textAnchor:"middle",dominantBaseline:"middle",children:t})]})})})}function e14(e){let{choices:t,busy:l,disabled:i,blocked:a,inventoryRefreshing:n,onChange:r}=e,{text:o,localized:s}=e1P(),d=new Map(t.map(e=>[e.row.key,e])),c=e12(t.map(e=>{let{row:t}=e;return t}),s);return(0,eB.jsx)("div",{className:"vm-voucher-sku-list","aria-busy":l,children:c.map(e=>{let t=e.label?"fieldset":"div";return(0,eB.jsxs)(t,{className:"vm-voucher-sku-group",role:e.label?"group":void 0,"aria-label":e.label||void 0,children:[e.label&&(0,eB.jsxs)("legend",{className:"vm-voucher-sku-group-title",children:[e.dimensionName&&(0,eB.jsx)("span",{className:"vm-sku-group-dimension",children:e.dimensionName}),(0,eB.jsx)("h3",{children:e.label})]}),(0,eB.jsx)("div",{className:"vm-voucher-sku-options",children:e.rows.map(t=>{let{row:s,label:c}=t,{quantity:u,maxQuantity:p,available:m,soldOut:g,loading:h,limitReason:v}=d.get(s.key),f=n||h,y=f?o("loading"):"stock"===v?o("catalogLimitReached"):null,b=(!m||g)&&!f,x=!i&&!a&&!f&&m&&!g&&u<p,k=e.label?"h4":"h3";return(0,eB.jsxs)("article",{className:`vm-voucher-sku-row${u>0?" is-selected":""}${!m||g?" is-unavailable":""}${b?" has-status-overlay":""}`,"aria-label":s.label,onClick:()=>{!l&&x&&r(s,u+1)},children:[(0,eB.jsx)("button",{type:"button",className:"vm-voucher-sku-add","aria-label":s.label,title:o("collectIncrease",{name:s.label}),disabled:!x,"aria-disabled":l||!x}),s.variant.cover?(0,eB.jsx)("img",{className:"vm-voucher-sku-image",src:s.variant.cover,alt:""}):(0,eB.jsx)("span",{className:"vm-voucher-sku-dot","aria-hidden":"true"}),(0,eB.jsxs)("div",{className:"vm-voucher-sku-label",children:[(0,eB.jsx)(k,{children:c}),!e.label&&s.specification&&c!==s.specification&&(0,eB.jsx)("p",{children:s.specification}),(0,eB.jsx)("p",{className:"vm-voucher-sku-status",role:y?"status":void 0,"aria-hidden":!y,children:y})]}),b&&(0,eB.jsx)(e11,{label:o(g?"catalogSoldOut":"catalogUnavailableLabel")}),(0,eB.jsx)("div",{className:`vm-voucher-sku-quantity${b&&0===u?" is-hidden":""}`,role:"group","aria-label":s.label,"aria-hidden":b&&0===u,"aria-disabled":l||i,onClickCapture:e=>{(l||i)&&(e.preventDefault(),e.stopPropagation())},onClick:e=>e.stopPropagation(),children:(0,eB.jsx)(z0,{className:"vm-collect-stepper",keyboardClassName:"vm-quantity-keyboard",value:u,min:0,max:Math.max(u,a||f||!m||g?0:p),step:1,size:"large",shape:"square",enableInput:!0,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,plusOnlyAtZero:!1,disabled:i,onChange:e=>{l||i||r(s,e)},minusIcon:(0,eB.jsx)("span",{"aria-label":o("collectDecrease",{name:s.label}),children:"−"}),plusIcon:(0,eB.jsx)("span",{"aria-label":o("collectIncrease",{name:s.label}),children:"+"})})})]},s.key)})})]},e.key)})})}function e13(e){let{context:t,isActive:l,pending:i,errorMessage:a,onBusyChange:n}=e,r=(0,nB.useToast)(),o=eN3(),s=(0,eN.useRef)(!1),[d,c]=(0,eN.useState)(null),u=t.sales.bookingTicket,p=(0,eN.useRef)({ticket:u,isActive:l,revision:0});(p.current.ticket!==u||p.current.isActive!==l)&&(p.current={ticket:u,isActive:l,revision:p.current.revision+1}),(0,eN.useEffect)(()=>()=>{p.current.revision+=1},[]);let m=null!==d,g=!!(i||m||o.isProcessing||t.cart.consistencyPending||o.orderTransition.pending);(0,eN.useEffect)(()=>{n(l&&g)},[l,g,n]),(0,eN.useEffect)(()=>()=>n(!1),[n]);let h=o0(()=>{n(l&&!!(i||o.getIsProcessing()||t.cart.consistencyPending||o.getIsOrderTransitionPending()))}),v=o0(function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return l&&!s.current&&(!o.getIsProcessing()||e)&&!o.getIsPaymentProcessing()&&!o.getIsOrderTransitionPending()}),f=o0(async function(e){var l,i;let{key:d="cart",ownsActivityLock:m=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!v(m))return;s.current=!0;let g=p.current.revision,f=null==u||null==(i=u.getTempOrder)||null==(l=i.call(u))?void 0:l.order_id,y=()=>{var e,t;return p.current.isActive&&p.current.revision===g&&(null==u||null==(t=u.getTempOrder)||null==(e=t.call(u))?void 0:e.order_id)===f},b=o.begin();c(d),n(!0);try{if(await t.cart.waitForCartConsistency(),!y())return;await e(y),await t.cart.waitForCartConsistency()}catch(e){y()&&r.fail((null==e?void 0:e.message)||a)}finally{s.current=!1,b(),c(null),p.current.revision===g&&h()}}),y=o0(e=>{!g&&v()&&e()});return{activity:o,session:p,mutation:s,mutationKey:d,mutating:m,busy:g,canInteract:v,run:f,navigate:y}}let e18=e=>{var t,l,i,a,n;return!!((null==(t=e.option)?void 0:t.length)||(null==(l=e.options)?void 0:l.length)||e.option_group_count||(null==(i=e.bundle)?void 0:i.length)||(null==(a=e.bundle_groups)?void 0:a.length)||(null==(n=e.bundle_group)?void 0:n.length)||Number(e.open_sold_weight))},e16=e=>{var t,l;return!(null==(t=e.variant_group)?void 0:t.length)&&!(null==(l=e.variant)?void 0:l.length)&&!e18(e)};function e15(e,t){var l,i,a;if(e18(e))return!1;let n=null==(l=e.variant)?void 0:l.find(e=>String(e.id)===String(t));if(((null==(i=e.variant_group)?void 0:i.length)||(null==(a=e.variant)?void 0:a.length))&&!n)return!1;let r=(null==n?void 0:n.price)??(null==n?void 0:n.base_price)??e.price;return null!=r&&""!==String(r).trim()&&0===Number(r)}function e17(e){var t;let l=e.source;return"product-voucher"===e.kind&&!l.isEditMode&&!l.usageLimitFailKey&&!l.isDisabled&&(null==l.unified_available_status||""===l.unified_available_status||0!==Number(l.unified_available_status))&&(!l.reasonCode||["product_not_applicable","holder_not_matched"].includes(l.reasonCode))&&((null==(t=l.config)?void 0:t.isAvailable)!==!1||"product_not_applicable"===l.reasonCode)}function e19(e,t){let l=new Set(e.map(e=>String(e.id))),i=eTP(t).filter(e17).filter(e=>!l.has(String(e.id))&&(l.add(String(e.id)),!0));return i.length?[...e,...i.map(e=>e.source)]:e}function e4e(e,t){let l=e.limited_relation_product_data;if(!l)return!1;let i=String(t.id);return!(1===Number(l.filter)&&(l.exclude_product_ids||[]).map(String).includes(i))&&("product_all"===l.type||["products","product_collection"].includes(l.type)&&(l.product_ids||[]).map(String).includes(i))}function e4t(e){return[...new Set((e.discount_list||[]).filter(e=>"good_pass"===(e.type||e.tag)).map(e=>{var t;return null==(t=e.discount)?void 0:t.resource_id}).filter(e=>null!=e&&""!==String(e)).map(String))]}function e4l(e){var t;let l=e.selling_price;return null!=l&&""!==String(l).trim()&&0===Number(l)&&!(null==(t=e.discount_list)?void 0:t.length)}function e4i(e,t){let l=new Set(e.items.flatMap(e4t));return e.vouchers.filter(e=>!l.has(String(e.id))&&e4e(e.source,t))}function e4a(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=new Map,a=new Set,n=new Set(l.flatMap(e4t)),r=l.filter(e4l);for(let l of eTP(e).filter(e17)){if(a.has(String(l.id)))continue;a.add(String(l.id));let e=l.source;if(!t.some(t=>e4e(e,t))&&!n.has(String(l.id))&&!r.some(t=>e4e(e,{id:t.product_id})))continue;let o=function(e){let t=e.product_id;return JSON.stringify(null==t||""===String(t)?["voucher",String(e.id)]:["product",String(t)])}(e),s=i.get(o);s||(s={key:o,title:l.title||RC(e.product_name),vouchers:[],discountIds:[],quota:0,selected:0,freeQuantity:0,remaining:0,items:[],products:[]},i.set(o,s)),s.discountIds.push(l.id),s.vouchers.push(l),s.quota+=1}let o=new Set(r);for(let e of i.values()){e.products=t.filter(t=>e.vouchers.some(e=>e4e(e.source,t)));let i=new Set(e.discountIds.map(String)),a=new Set;e.items=l.filter(t=>{let l=e4t(t).filter(e=>i.has(e));return(l.forEach(e=>a.add(e)),o.has(t)&&e.vouchers.some(e=>e4e(e.source,{id:t.product_id})))?(e.freeQuantity+=Number(t.num||0),!0):l.length>0}),e.selected=a.size,e.remaining=Math.max(0,e.quota-e.selected)}return[...i.values()].filter(e=>e.products.length>0||e.items.length>0)}function e4n(e){var t;let{brand:l,context:i,products:a,loading:n,isActive:r,inventoryFailed:o,inventoryRefreshing:s,checkoutPending:d,refreshInventory:c,onBack:u,onCheckout:p,onBusyChange:m,onActiveChange:g,autoSelectionRef:h}=e,{text:v,localized:f}=e1P(),y=(0,nB.useToast)();(0,eN.useEffect)(()=>(null==g||g(r),()=>null==g?void 0:g(!1)),[r,g]);let{inventory:b}=LK(),x=i.sales.bookingTicket,{activity:k,mutating:_,busy:w,canInteract:S,run:j,navigate:N}=e13({context:i,isActive:r,onBusyChange:m,pending:n||!!d,errorMessage:v("collectInvalid")}),C=(null==x||null==(t=x.getTempOrder)?void 0:t.call(x))??i.cart.tempOrder,M=i.summary.summary??(null==C?void 0:C.summary),T=eCE({amountGap:null==M?void 0:M.amount_gap,fallbackAmount:null==M?void 0:M.total_amount,orderPaidAmount:null==M?void 0:M.order_paid_amount,payments:null==C?void 0:C.payments}),I=e4a(i.cart.discountList,a,(null==C?void 0:C.products)||[]),P=!!(x&&i.cart.addProductWithFlow),A=!r||!P||n||!!d||k.orderTransition.pending,D=[...new Set(I.flatMap(e=>e.items))].filter(e4l).reduce((e,t)=>e+Number(t.num||0),0),E=I.reduce((e,t)=>e+t.selected,D),O=I.reduce((e,t)=>e+t.remaining,0),z=((null==C?void 0:C.products)||[]).reduce((e,t)=>e+Number(t.num||0),0),L=I.reduce((e,t)=>e+t.quota,0),R=o0(()=>{var e,t,l,n;return e4a((null==x||null==(e=x.getDiscountList)?void 0:e.call(x))||i.cart.discountList,a,(null==x||null==(l=x.getTempOrder)||null==(t=l.call(x))?void 0:t.products)||(null==(n=i.cart.tempOrder)?void 0:n.products)||[])}),$=o0((e,t)=>{let l=R().find(t=>t.key===e);return l?e4i(l,t).length:0}),F=o0(async(e,t,l,a)=>{let n=R().find(t=>t.key===e);for(let r of n?e4i(n,t).filter(e=>e.source.isManualSelect):[]){if(!a()||!n||n.selected>=l)return;await i.cart.setDiscount({discountId:r.id,isSelected:!0}),n=R().find(t=>t.key===e)}}),q=o0(function(e,t,l){var a,r,d;let c=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!P||n||o||s||!b)return 0;let u=(null==(a=(null==x||null==(r=x.getTempOrder)?void 0:r.call(x))??i.cart.tempOrder)?void 0:a.products)||[];return Math.max(0,...(void 0===l&&(null==(d=t.variant_group)?void 0:d.length)?t.variant||[]:[{id:l??0}]).map(l=>{let i=l.id??l.product_variant_id,a=b.selectionAvailability(t,i,u),n=c||e15(t,i)?1/0:$(e.key,t);return"ready"===a.availability.status?Math.min(a.availableQuantity,n):0}))}),B=(e,t,l)=>!A&&q(e,t,l)>0,H=o0(async(e,t,l,a)=>{let n=e15(t,t.product_variant_id),r=R().find(t=>t.key===e.key),o=await i.cart.addProductWithFlow(ePt(t),{type:"select",quantity:l,debounceMs:0,notShowToast:!0,getQuantityLimit:n?void 0:()=>$(e.key,t),initialHolderIds:[]});if("added"===o.status&&a()&&!n){let i=R().find(t=>t.key===e.key),n=Math.max(0,((null==i?void 0:i.freeQuantity)||0)-((null==r?void 0:r.freeQuantity)||0));await F(e.key,t,((null==r?void 0:r.selected)||0)+Math.max(0,l-n),a)}return o}),V=(0,eN.useRef)(null),U=h??V,Y=(null==C?void 0:C.external_sale_number)||(null==C?void 0:C.order_id);U.current&&U.current.ticket===x&&U.current.orderKey===Y||(U.current={ticket:x,orderKey:Y,handled:new Set});let W=(e,t)=>JSON.stringify([e.key,String(t)]),G=I.find(e=>{var t;if(1!==e.products.length||!e16(e.products[0]))return!1;let l=e.products[0],i=null==(t=e1X([l],[],f)[0])?void 0:t.rows[0];return(null==i?void 0:i.enabled)&&(null==b?void 0:b.selectionAvailability(l,0,(null==C?void 0:C.products)||[]).availability.status)==="ready"&&e.vouchers.some(t=>!U.current.handled.has(W(e,t.id)))});(0,eN.useEffect)(()=>{if(!G||!P||!r||w||o||s||!S())return;let e=U.current,t=new Set(G.vouchers.filter(t=>!e.handled.has(W(G,t.id))).map(e=>String(e.id)));t.forEach(t=>e.handled.add(W(G,t))),j(async e=>{var l,a,n;let r=R().find(e=>e.key===G.key);if(!r||1!==r.products.length||!e16(r.products[0]))return;let d=r.products[0],c=null==(l=e1X([d],[],f)[0])?void 0:l.rows[0],u=(null==(a=(null==x||null==(n=x.getTempOrder)?void 0:n.call(x))??i.cart.tempOrder)?void 0:a.products)||[];if(!(null==c?void 0:c.enabled)||o||s||(null==b?void 0:b.selectionAvailability(d,0,u).availability.status)!=="ready")return;let p=Math.min(e4i(r,d).filter(e=>t.has(String(e.id))&&!e.source.isManualSelect).length,q(r,d,0),e15(d,0)?Math.max(0,r.quota-r.freeQuantity):1/0);if(p>0){let t=await H(r,e10(c),p,e);if(e()&&"added"!==t.status&&"cancelled"!==t.status)throw Error(v("catalogUpdateFailed"))}})},[G,P,r,w,o,s,b,S,j,R,f,x,i.cart,q,H,U,v]);let K=(e,t,l,a,n,r,o)=>{if(!P||w||!Number.isSafeInteger(a)||a<0)return;let s=l.map(e=>({item:e,uid:ekX(e).unique_identification_number})),d=e=>{var t,l;let{item:a,uid:n}=e;return((null==(t=(null==x||null==(l=x.getTempOrder)?void 0:l.call(x))??i.cart.tempOrder)?void 0:t.products)||[]).find(e=>null!=n&&""!==String(n)?ekX(e).unique_identification_number===n:e===a)};j(async l=>{let c=s.map(d).filter(Boolean),u=a-c.reduce((e,t)=>e+Number(t.num||0),0);if(u>0){var p,m;let a=!r&&c.length>0&&c.every(e4l),s=c[c.length-1];if(!r&&!s)return;let d=R().find(t=>t.key===e.key),g=null==d?void 0:d.products.find(e=>String(e.id)===String(t.id));if(!n||!g||!d||u>q(d,g,(null==o?void 0:o.variant.id)??(null==s?void 0:s.product_variant_id)??0,a))throw Error(v("collectLimit"));if(r){let e=null==(p=e1X([g],[],f)[0])?void 0:p.rows.find(e=>o?e.key===o.key:"0"===String(e.variant.id));if(!(null==e?void 0:e.enabled))throw Error(v("catalogUnavailable"));let t=await H(d,e10(e),u,l);if(l()&&"added"!==t.status&&"cancelled"!==t.status)throw Error(v("catalogUpdateFailed"))}else{let n=(null==(m=R().find(t=>t.key===e.key))?void 0:m.selected)||0;await i.cart.updateItemQuantity(s,Number(s.num)+u),l()&&!a&&await F(e.key,t,n+u,l)}return}let g=-u;for(let e of[...s].reverse()){if(!l()||g<=0)return;let t=d(e);if(!t)continue;let a=Math.min(g,Number(t.num)),n=Number(t.num)-a;n<=0?await i.cart.removeItem(t):await i.cart.updateItemQuantity(t,n),g-=a,await i.cart.waitForCartConsistency()}})},Q=function(e,t,l,i,a){var n;let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=i.reduce((e,t)=>e+Number(t.num||0),0);return(0,eB.jsx)("div",{className:"vm-collect-selection-actions",role:"group","aria-label":e.trim(),"aria-disabled":w||A,onClickCapture:e=>{(w||A)&&(e.preventDefault(),e.stopPropagation())},children:(0,eB.jsx)(z0,{className:"vm-collect-stepper",keyboardClassName:"vm-quantity-keyboard",value:o,min:0,max:o+(a?q(t,l,(null==(n=i[0])?void 0:n.product_variant_id)??0,!r&&i.length>0&&i.every(e4l)):0),step:1,size:"large",shape:"square",enableInput:!0,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,plusOnlyAtZero:!1,disabled:A,onChange:e=>K(t,l,i,e,a,r),minusIcon:(0,eB.jsx)("span",{"aria-label":v("collectDecrease",{name:e.trim()}),children:"−"}),plusIcon:(0,eB.jsx)("span",{"aria-label":v("collectIncrease",{name:e.trim()}),children:"+"})})})};return(0,eB.jsxs)("div",{className:"vm-voucher-collect vm-bottom-bar-layout",children:[(0,eB.jsx)(e1O,{children:(0,eB.jsxs)("section",{className:"vm-collect-screen",children:[(0,eB.jsxs)("header",{className:"vm-collect-header",children:[(0,eB.jsx)(e1L,{name:l,compact:!0}),(0,eB.jsx)("h1",{children:v("collectTitle")}),(0,eB.jsx)("p",{className:"vm-collect-scan-hint",children:w&&!_?v("scanProcessing"):v("collectScanMore")})]}),(0,eB.jsxs)("div",{className:"vm-collect-scroll",children:[(0,eB.jsxs)("div",{className:"vm-collect-stats",children:[(0,eB.jsxs)("div",{children:[(0,eB.jsx)("span",{children:v("collectAvailable")}),(0,eB.jsx)("strong",{children:L})]}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("span",{children:v("collectSelected")}),(0,eB.jsx)("strong",{children:E})]}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("span",{children:v("collectRemaining")}),(0,eB.jsx)("strong",{children:O})]})]}),(o&&!d||!P)&&(0,eB.jsxs)("div",{className:"vm-collect-warning",role:"status",children:[(0,eB.jsx)("span",{children:v(P?"inventoryUnavailable":"collectInvalid")}),o&&(0,eB.jsx)("button",{type:"button",disabled:A||s,"aria-disabled":w||s,onClick:()=>{w||j(c)},children:v("retry")})]}),n?(0,eB.jsx)("p",{className:"vm-collect-empty",role:"status",children:v("loading")}):0===I.length?(0,eB.jsx)("p",{className:"vm-collect-empty",role:"status",children:v("collectNoProducts")}):I.map(e=>{let t=e.items,l=e.selected+e.freeQuantity,i=new Set(e.products.map(e=>String(e.id))),n=new Map(e.products.map(e=>[String(e.id),e]));return t.forEach(e=>{var t;n.has(String(e.product_id))||n.set(String(e.product_id),{id:e.product_id,title:e.product_title,variant_group:Number(e.product_variant_id)>0?[{}]:[],option:null==(t=e.product_sku)?void 0:t.option,bundle:e.product_bundle})}),(0,eB.jsxs)("section",{className:"vm-collect-group",children:[(0,eB.jsxs)("header",{children:[(0,eB.jsxs)("div",{children:[(0,eB.jsx)("h2",{children:e.title}),(0,eB.jsx)("p",{children:v("collectVoucherCount",{count:e.quota})})]}),(0,eB.jsx)("span",{children:v(e.freeQuantity>0?"collectSelectedCount":"collectGroupSelected",{selected:l,total:e.quota})})]}),[...n.values()].map(l=>{var n,r,d;let c=i.has(String(l.id)),u=RC(l.title??l.name),p=function(e,t){let l=new Map;for(let n of e){var i,a;let e=JSON.stringify(function e(t){return Array.isArray(t)?t.map(e).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t))):t&&"object"==typeof t?Object.fromEntries(Object.keys(t).sort().map(l=>[l,e(t[l])])):t}({productId:n.product_id,variantId:n.product_variant_id??0,options:(null==(i=n.product_sku)?void 0:i.option)||(null==(a=n.product_sku)?void 0:a.options)||[],bundle:n.product_bundle||[]})),r=l.get(e)||{key:e,items:[],quantity:0,specification:ewk(n,t).product_option_string||""};r.items.push(n),r.quantity+=Number(n.num||0),l.set(e,r)}return[...l.values()]}(t.filter(e=>String(e.product_id)===String(l.id)),{productsCatalog:a,productsByUid:null==C||null==(n=C._extend)?void 0:n.productsByUid}),m=!!((null==(r=l.variant_group)?void 0:r.length)&&(null==(d=l.variant)?void 0:d.length)&&!e18(l)),g=!e16(l);return(0,eB.jsxs)("div",{className:`vm-collect-product${!g?" has-direct-quantity":""}`,children:[(0,eB.jsxs)("div",{className:"vm-collect-product-main",children:[(0,eB.jsx)("div",{children:(0,eB.jsx)("h3",{children:u})}),m?null:g?(0,eB.jsx)("button",{type:"button",className:"vm-collect-select",disabled:!c||!B(e,l),"aria-disabled":w||!c||!B(e,l),onClick:()=>{w||j(async t=>{if(1>q(e,l))throw Error(v("collectLimit"));return H(e,l,1,t)})},children:v("collectSelect")}):Q(u,e,l,p.flatMap(e=>e.items),c,!0)]}),m&&(0,eB.jsx)(e14,{choices:function(e){var t;let{product:l,items:i,selectedItems:a,remaining:n,inventory:r,localize:o}=e;return((null==(t=e1X([l],a.filter(e=>String(e.product_id)===String(l.id)),o)[0])?void 0:t.rows)||[]).map(e=>{let t=null==r?void 0:r.selectionAvailability(l,e.variant.id,i),a=e.enabled&&(null==t?void 0:t.availability.status)==="ready",o=(null==t?void 0:t.availability.status)==="ready"&&0===t.availability.quantity,s=e15(l,e.variant.id);return{row:e,quantity:e.quantity,maxQuantity:e.quantity+(a?Math.max(0,Math.min(t.availableQuantity,s?1/0:n)):0),available:a,soldOut:o,loading:(null==t?void 0:t.availability.status)==="loading",limitReason:a&&!o?!s&&n<=0?"voucher":0===t.availableQuantity?"stock":void 0:void 0}})}({product:l,items:(null==C?void 0:C.products)||[],selectedItems:e.items,remaining:e4i(e,l).length,inventory:b,localize:f}),busy:w,disabled:A,blocked:o||s||!b,inventoryRefreshing:s,onChange:(t,i)=>K(e,l,t.items,i,c&&t.enabled,!0,t)}),g&&!m&&p.map(t=>(0,eB.jsxs)("div",{className:"vm-collect-selection",children:[(0,eB.jsxs)("div",{children:[(0,eB.jsx)("span",{className:"vm-collect-selection-dot"}),(0,eB.jsxs)("p",{children:[u,t.specification&&(0,eB.jsxs)("span",{children:[" \xb7 ",t.specification]})]})]}),Q(`${u} ${t.specification}`,e,l,t.items,c)]},t.key))]},l.id)})]},e.key)})]})]})}),(0,eB.jsx)(e1Y,{busy:A,pending:w,onBack:()=>N(u),primaryLabel:v(0===T?"collectRedeem":"catalogCheckout"),primaryIcon:(0,eB.jsx)(e1E,{name:"chevron-right"}),primaryDisabled:n||!P||0===z||o||s,onPrimary:()=>N(()=>{var e,t;let l=(null==x||null==(e=x.getTempOrder)?void 0:e.call(x))??i.cart.tempOrder;(null==l||null==(t=l.products)?void 0:t.some(e=>Number(e.num)>0))?p():y.fail(v("catalogCartEmpty"))}),children:(0,eB.jsxs)("div",{className:"vm-catalog-bar-amount","aria-label":v(D>0?"collectSelectedCount":"collectGroupSelected",{selected:E,total:L}),children:[(0,eB.jsx)("span",{children:v("collectSelected")}),(0,eB.jsx)("strong",{children:D>0?E:`${E} / ${L}`})]})})]})}function e4r(){return(0,eB.jsx)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:(0,eB.jsx)("path",{d:"m12 3 9 5-9 5-9-5 9-5Zm9 5v9l-9 5-9-5V8m9 5v9M7.5 5.5l9 5"})})}function e4o(e){let{brand:t,context:l,products:i,loading:a,isActive:n,inventoryFailed:r,inventoryRefreshing:o,checkoutPending:s,refreshInventory:d,onBack:c,onReview:u,onCheckout:p,onBusyChange:m,onPromotion:g,promotionVisible:h}=e,{text:v,localized:f}=e1P(),y=(0,nB.useToast)(),{inventory:b}=LK(),x=!n||a||!l.sales.isReady||!!s,{activity:k,mutationKey:_,busy:w,run:S,navigate:j}=e13({context:l,isActive:n,pending:x,onBusyChange:m,errorMessage:v("catalogUpdateFailed")}),N=l.sales.bookingTicket,C=(0,eN.useRef)(i);C.current=i;let M=eCT(l.sales,l.cart),T=(null==M?void 0:M.products)||[],I=e1X(i,T,f),P={groups:I,stocks:new Map(I.reduce((e,t)=>e.concat(t.rows),[]).map(e=>[e.key,null==b?void 0:b.selectionAvailability(e.product,e.variant.id,T)])),loading:a,inventoryFailed:r,inventoryRefreshing:o},A=(0,eN.useRef)({ticket:N,inventory:b,orderId:null==M?void 0:M.order_id,presentation:P});s&&A.current.ticket===N&&A.current.inventory===b&&A.current.orderId===(null==M?void 0:M.order_id)||(A.current={ticket:N,inventory:b,orderId:null==M?void 0:M.order_id,presentation:P});let D=A.current.presentation,E=T.reduce((e,t)=>e+Number(t.num||0),0),O=l.summary.summary??(null==M?void 0:M.summary),z=eCE({amountGap:null==O?void 0:O.amount_gap,fallbackAmount:null==O?void 0:O.total_amount,orderPaidAmount:null==O?void 0:O.order_paid_amount,payments:null==M?void 0:M.payments}),L=Yg(M,z),R=x||k.orderTransition.pending,$=o0(function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"input";if(!w&&Number.isSafeInteger(t)&&!(t<0))return S(async a=>{var n,s,d,c;let u=(null==N||null==(s=N.getTempOrder)||null==(n=s.call(N))?void 0:n.products)||[],p=e1X(C.current,u,f).reduce((e,t)=>e.concat(t.rows),[]).find(t=>t.key===e.key);if(!p)return;let m="increase"===i?1:"decrease"===i?-1:t-p.quantity;if(m>0){let e=null==b?void 0:b.selectionAvailability(p.product,p.variant.id,u);if(!p.enabled||r||o||(null==e?void 0:e.availability.status)!=="ready"||e.availableQuantity<m)throw Error(v("catalogUnavailable"));let t=await l.cart.addProductWithFlow(e10(p),{type:"select",quantity:m,debounceMs:0,notShowToast:!0});if("added"!==t.status&&"cancelled"!==t.status)throw Error(v("catalogUpdateFailed"))}else if(m<0){let e=p.items.map(e=>({item:e,uid:ekX(e).unique_identification_number})),t=-m;for(let i of e.reverse()){if(!a()||t<=0)return;let e=((null==N||null==(c=N.getTempOrder)||null==(d=c.call(N))?void 0:d.products)||[]).find(e=>i.uid?ekX(e).unique_identification_number===i.uid:e===i.item);if(!e)continue;let n=Math.min(t,Number(e.num)),r=Number(e.num)-n;r<=0?await l.cart.removeItem(e):await l.cart.updateItemQuantity(e,r),t-=n,await l.cart.waitForCartConsistency()}}},{key:e.key})}),F=e=>j(()=>{var t;let i=eCT(l.sales,l.cart);(null==i||null==(t=i.products)?void 0:t.some(e=>Number(e.num)>0))?e():y.show({icon:"warning",content:v("catalogCartEmpty")})});return(0,eB.jsxs)("div",{className:"vm-catalog vm-bottom-bar-layout",children:[(0,eB.jsx)(e1O,{children:(0,eB.jsxs)("section",{className:"vm-catalog-screen","aria-label":v("catalogTitle"),children:[(0,eB.jsxs)("header",{className:"vm-catalog-header",children:[(0,eB.jsx)(e1L,{name:t,compact:!0}),(0,eB.jsx)("h1",{children:v("catalogTitle")}),(0,eB.jsx)("p",{children:v("catalogHint")})]}),(0,eB.jsxs)("div",{className:"vm-catalog-scroll","aria-busy":w||a||o,children:[D.inventoryFailed&&(0,eB.jsxs)("div",{className:"vm-catalog-warning",role:"alert",children:[(0,eB.jsx)("span",{children:v("inventoryUnavailable")}),(0,eB.jsx)("button",{type:"button",disabled:w||o,onClick:()=>{d()},children:v("retry")})]}),D.loading&&(0,eB.jsx)("p",{className:"vm-catalog-empty",role:"status",children:v("loading")}),!D.loading&&0===D.groups.length&&(0,eB.jsx)("p",{className:"vm-catalog-empty",children:v("catalogEmpty")}),D.groups.map(e=>(0,eB.jsxs)("section",{className:"vm-catalog-group","aria-label":e.title,children:[(0,eB.jsxs)("header",{children:[(0,eB.jsx)("span",{className:"vm-catalog-product-icon",children:e.cover?(0,eB.jsx)("img",{src:e.cover,alt:""}):(0,eB.jsx)(e4r,{})}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("h2",{children:e.title}),e.subtitle&&(0,eB.jsx)("p",{children:e.subtitle})]})]}),e12(e.rows,f).map(t=>{let l=t.label?"fieldset":"div";return(0,eB.jsxs)(l,{className:"vm-catalog-sku-group",role:t.label?"group":void 0,"aria-label":t.label||void 0,children:[t.label&&(0,eB.jsxs)("legend",{className:"vm-catalog-sku-group-title",children:[t.dimensionName&&(0,eB.jsx)("span",{className:"vm-sku-group-dimension",children:t.dimensionName}),(0,eB.jsx)("h3",{children:t.label})]}),(0,eB.jsx)("div",{className:"vm-catalog-grid",children:t.rows.map(l=>{let{row:i,label:n}=l,s=D.stocks.get(i.key),d=(null==s?void 0:s.availability.status)==="ready"&&0===s.availability.quantity,c=i.enabled&&(null==s?void 0:s.availability.status)==="ready",u=!a&&!r&&!o&&c&&s.availableQuantity>0,p=!c||d,m=D.inventoryRefreshing||(null==s?void 0:s.availability.status)==="loading",g=p&&!m,h=c&&!d&&!m&&0===s.availableQuantity,f="0"===String(i.variant.id)?e.title:`${e.title} \xb7 ${i.label}`,y=t.label?"h4":"h3";return(0,eB.jsxs)("article",{className:`vm-catalog-card${i.quantity>0?" is-selected":""}${p?" is-unavailable":""}${g?" has-status-overlay":""}`,"aria-label":f,onClick:()=>{u&&$(i,i.quantity+1,"increase")},children:[(0,eB.jsx)("button",{type:"button",className:"vm-catalog-card-add","aria-label":f,title:v("collectIncrease",{name:f}),disabled:R||!u,"aria-disabled":w||!u}),(0,eB.jsxs)("div",{className:"vm-catalog-card-heading",children:[(0,eB.jsx)(y,{children:n}),(0,eB.jsx)("strong",{children:Yg(M,i.price)})]}),g&&(0,eB.jsx)(e11,{label:v(d?"catalogSoldOut":"catalogUnavailableLabel")}),m&&(0,eB.jsx)("span",{className:"vm-catalog-stock-loading",role:"status",children:v("loading")}),(!p||i.quantity>0)&&(0,eB.jsxs)("div",{className:"vm-catalog-quantity",children:[(0,eB.jsx)("span",{children:h?v("catalogLimitReached"):v(i.quantity>0?"catalogAdded":"catalogQuantity")}),(0,eB.jsx)("div",{role:"group","aria-label":f,"aria-disabled":w,"aria-busy":_===i.key,onClick:e=>e.stopPropagation(),children:(0,eB.jsx)(z0,{className:"vm-catalog-stepper",keyboardClassName:"vm-quantity-keyboard",value:i.quantity,min:0,max:i.quantity+(u?s.availableQuantity:0),step:1,size:"large",shape:"square",enableInput:!0,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,plusOnlyAtZero:!1,disabled:R,onChange:(e,t)=>{$(i,e,null==t?void 0:t.action)},minusIcon:(0,eB.jsx)("span",{"aria-label":v("collectDecrease",{name:f}),children:"−"}),plusIcon:(0,eB.jsx)("span",{"aria-label":v("collectIncrease",{name:f}),children:"+"})})})]})]},i.key)})})]},t.key)})]},e.id))]})]})}),(0,eB.jsx)(e1G,{quantity:E,total:L,amountDue:z,busy:R,pending:w,onBack:()=>j(c),onReview:()=>F(u),onCheckout:()=>F(p),onPromotion:g?()=>j(g):void 0,promotionVisible:h})]})}let e4s={en:{label:"Redeemed",fontSize:20,fontFamily:"Arial, sans-serif"},es:{label:"Canjeado",fontSize:21,fontFamily:"Arial, sans-serif"},ja:{label:"引換済み",fontSize:23,fontFamily:"Hiragino Sans, sans-serif"},"zh-CN":{label:"已兑换",fontSize:25,fontFamily:"PingFang SC, sans-serif"},"zh-TW":{label:"已兌換",fontSize:25,fontFamily:"PingFang TC, sans-serif"}};function e4d(){let e=db().replace(/_/g,"-").toLowerCase(),t=e.split("-")[0],l="zh"===t?e4s[/^zh-(tw|hk|mo|hant)(-|$)/.test(e)?"zh-TW":"zh-CN"]:e4s[t]||e4s.en;return(0,eB.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"vm-voucher-redemption-stamp",viewBox:"0 0 128 128",width:128,height:128,role:"img","aria-label":l.label,focusable:"false",children:(0,eB.jsxs)("g",{transform:"rotate(-10 64 64)",children:[(0,eB.jsx)("circle",{cx:64,cy:64,r:60,fill:"none",stroke:"currentColor",strokeWidth:2.2}),(0,eB.jsx)("path",{d:"M52 46L61 55L77 38",fill:"none",stroke:"currentColor",strokeWidth:3.8,strokeLinecap:"round",strokeLinejoin:"round"}),(0,eB.jsx)("text",{x:64,y:92,textAnchor:"middle",fontFamily:l.fontFamily,fontSize:l.fontSize,fontWeight:600,fill:"currentColor",children:l.label})]})})}function e4c(){let{token:e}=eM.theme.useToken();return{colorPrimary:e.colorPrimary,colorPrimaryHover:e.colorPrimaryHover,colorPrimaryActive:e.colorPrimaryActive,colorPrimaryBg:e.colorPrimaryBg,colorPrimaryBgHover:e.colorPrimaryBgHover,colorPrimaryBorder:e.colorPrimaryBorder,colorTextLightSolid:e.colorTextLightSolid}}function e4u(){let e=e4c();return{"--vm-primary":e.colorPrimary,"--vm-primary-hover":e.colorPrimaryHover,"--vm-primary-active":e.colorPrimaryActive,"--vm-primary-bg":e.colorPrimaryBg,"--vm-primary-bg-hover":e.colorPrimaryBgHover,"--vm-primary-border":e.colorPrimaryBorder,"--vm-primary-foreground":e.colorTextLightSolid,"--vm-customer-page-bg":`linear-gradient(rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.96)), ${e.colorPrimary}`,"--vm-customer-soft-bg":`linear-gradient(rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.92)), ${e.colorPrimary}`}}let e4p=0,e4m={cartItems:{renderProductLineItemStatus:function(e){return e4t(e).length>0?(0,eB.jsx)(e4d,{}):null}}};function e4g(e){var t;let{context:l,sales:i,fulfillment:a,blockNavigation:n,scanSource:r,scanEnabled:o=!0,isActive:s=!0,isVisible:d=!0,idleRequest:c=0,homeIdleTimeoutMs:u=3e4,onHomePageActiveChange:p,onLocaleChange:m,brand:g,subtitle:h,machine:v,onRequestSettings:f,onRequestStaff:y,onPrerenderComplete:b,className:x,style:k}=e,{text:_}=e1P(),w=e4u(),S=(0,nB.useToast)(),j=(0,eN.useRef)(null),N=o0(()=>{var e;null==(e=j.current)||e.close(),j.current=null}),[C,M]=eM.Modal.useModal(),{setIdlePaused:T,shouldDispenseAfterSale:I,startDispenseQueue:P,isCurrentContext:A}=a,[D,E]=(0,eN.useState)("idle"),[O,z]=(0,eN.useState)({ready:!1,failed:!1}),[L,R]=(0,eN.useState)(!1),[$,F]=(0,eN.useState)(!1),[q,B]=(0,eN.useState)(null),H=(0,eN.useRef)(null),V=(0,eN.useCallback)(e=>{z(t=>t.ready===e.ready&&t.failed===e.failed?t:e)},[]),U=(0,eN.useMemo)(()=>({active:s&&d&&("idle"===D||"home"===D||"redeem"===D),onStateChange:V}),[s,d,D,V]),[Y,W]=(0,eN.useState)("purchase"),[G,K]=(0,eN.useState)(!1),[Q,Z]=(0,eN.useState)(!1),J=(0,eN.useRef)(!1),[X,ee]=(0,eN.useState)(!1),et=(0,eN.useRef)(!1),[el,ei]=(0,eN.useState)(!1),ea=(0,eN.useRef)(!1),[en,er]=(0,eN.useState)(!1),eo=(0,eN.useRef)(!1),es=(0,eN.useCallback)(e=>{eo.current=e,er(e)},[]),ed=(0,eN.useCallback)(e=>{ea.current=e,ei(e)},[]),ec=(0,eN.useCallback)(e=>{et.current=e,ee(e)},[]),eu=(0,eN.useCallback)(()=>{W("purchase"),K(!1),ec(!1),ed(!1)},[ec,ed]),ep=o0(()=>{if(!i.ready||!O.ready||H.current||em.getIsBusy())return;let e=()=>{W("purchase"),E("sale")};if(!i.inventory)return void e();let t=new AbortController;H.current=t,R(!0),F(!1),i.inventory.refresh({reason:"catalog-entry",signal:t.signal}).then(()=>{!t.signal.aborted&&A(l)&&e()}).catch(e=>{t.signal.aborted||(null==e?void 0:e.name)==="AbortError"||F(!0)}).finally(()=>{H.current===t&&(H.current=null,R(!1))})}),em=function(e){let{context:t,scanSource:l,scanEnabled:i=!0,isActive:a,isVisible:n,fulfillment:r,stage:o,obscured:s,isObscured:d,onResolved:c}=e,[u,p]=(0,eN.useState)(null),[m,g]=(0,eN.useState)(""),h=(0,eN.useRef)(null),v=(0,eN.useRef)(!1),f=JSON.stringify([t.tenantDomain,t.shopId,t.deviceId,t.businessCode]),y=!!(a&&n),b=(0,eN.useRef)({scope:f,active:y});b.current={scope:f,active:y},(0,eN.useEffect)(()=>(v.current=!0,()=>{v.current=!1,h.current=null}),[]);let x=o0((e,t,i)=>{try{var a;null==l||null==(a=l.log)||a.call(l,e,{requestId:t.id,sourcePage:t.sourcePage,scope:t.scope,elapsedMs:Date.now()-t.receivedAt,status:null==i?void 0:i.status,kind:null==i?void 0:i.kind,reason:null==i?void 0:i.reason})}catch{}}),k=o0(e=>{h.current=e,p(e)}),_=o0(()=>{h.current&&x("cancelled",h.current),k(null),g("")});(0,eN.useLayoutEffect)(()=>{(!y||h.current&&h.current.scope!==f)&&_()},[y,f,_]);let w=o0(e=>{if(!y||!i||d()||!r.isCurrentContext(t))return;let l="string"==typeof(null==e?void 0:e.data)?e.data.trim():"";if(!l||h.current||"idle"!==o&&"home"!==o&&"redeem"!==o)return;let a={id:`vending-scan-${Date.now()}-${++e4p}`,code:l,sourcePage:o,scope:f,receivedAt:Date.now(),phase:"waiting"};k(a),"redeem"===o&&g(l),x("received",a),r.setIdlePaused(!0)}),S=y&&i&&!s&&("idle"===o||"home"===o||"redeem"===o||"sale"===o&&!!u),j=!!u;(0,eN.useEffect)(()=>{if(S&&l)return l.subscribe(w,{priority:10*!!j})},[S,l,j,w]);let N=e=>{let l=h.current;return v.current&&b.current.active&&(null==l?void 0:l.id)===e&&l.scope===b.current.scope&&r.isCurrentContext(t)?l:null},C=o0(e=>{let t=N(e);t&&"waiting"===t.phase&&(k({...t,phase:"processing"}),x("accepted",t))}),M=o0((e,t)=>{var l;let i=N(e);if(!i)return;let a="success"===t.status&&["customer","promotion"].includes(t.kind||"")&&!Array.isArray(null==(l=t.redemption)?void 0:l.vouchers)?{status:"failed",reason:"entry_resolution_failed"}:t;x("settled",i,a),c(a),k(null)}),T=o0(()=>!!h.current);return{pending:u,scannedCode:m,setScannedCode:g,submitCode:o0(e=>w({data:e})),busy:!!u,getIsBusy:T,clear:_,accepted:C,settled:M}}({context:l,scanSource:r,scanEnabled:o,isActive:s,isVisible:d,fulfillment:a,stage:D,obscured:Q||L,isObscured:()=>J.current||!!H.current,onResolved:o0(e=>{N();let t=function(e){var t,l,i;if("cancelled"===e.status)return{destination:"stay",vouchers:[]};if(["initialization_failed","order_reset_failed","entry_resolution_failed","scan_failed"].includes(e.reason||""))return{destination:"stay",vouchers:[],notice:"scanResolveFailed"};let a=(null==(t=e.redemption)?void 0:t.vouchers)||[],n="success"===e.status?e19([],a):[];if(n.length)return{destination:"redeem",vouchers:n};if("success"===e.status&&((null==(l=e.redemption)?void 0:l.source)==="wallet"||"products"===e.kind)||"pending"===e.status&&["requiresDetail","requiresBookingEdit"].includes(e.kind||""))return{destination:"purchase",vouchers:[]};let r=a.filter(e=>"good_pass"===(e.tag||e.type)),o=r.map(e=>e.reasonCode);return{destination:"stay",vouchers:[],notice:o.length&&o.every(e=>"not_started"===e)?"scanVoucherNotStarted":o.length&&o.every(e=>"expired"===e)?"scanVoucherExpired":r.length?"scanVoucherUnavailable":(null==(i=e.redemption)?void 0:i.source)==="scan"?"scanNoVouchers":"scanUnrecognized"}}(e);if("redeem"===t.destination)W("vouchers"),E("sale");else if("purchase"===t.destination)W("purchase"),E("sale");else if(t.notice){let e=Symbol();B(e),S.show({icon:"warning",content:_(t.notice),afterClose:()=>B(t=>t===e?null:t)})}})}),eg=i.ready&&O.ready&&!L&&!$,eh=i.failed||O.failed||$,ev=s&&d&&em.busy,ef=s&&d&&"home"===D&&o&&!Q&&!eg&&!eh&&!q,ey=ev?_("scanProcessing"):ef?_("homePreparing"):null,eb=o0(()=>{ey&&(!ev||em.getIsBusy())&&(ev&&B(null),j.current=S.loading(ey,0))});(0,eN.useEffect)(()=>{if(ey)return eb(),N},[ey,eb,N]);let ex=o0(e=>{if(!s||!d||"sale"!==D||"vouchers"!==Y||!G||em.pending||!A(l))return;let t=e.scannedDiscountList||[];if(!(e.isAccepted??e.isAvailable)||!e19([],t).length){let e=t.some(e=>"good_pass"===(e.tag||e.type));S.fail(_(e?"collectInvalid":"collectUnsupported"))}}),ek=(0,eN.useRef)(null),e_=o0(e=>{let t={...e,isActive:e.isActive&&"sale"===D};return"vouchers"===Y?(0,eB.jsx)(e4n,{...t,brand:g,autoSelectionRef:ek,onActiveChange:K,onBusyChange:ec,onPurchase:()=>{em.getIsBusy()||et.current||ea.current||W("purchase")}}):(0,eB.jsx)(e4o,{...t,brand:g,onBusyChange:ed})});(0,eN.useEffect)(()=>{var e;i.failed&&(null==(e=em.pending)?void 0:e.phase)==="waiting"&&em.settled(em.pending.id,{status:"failed",reason:"initialization_failed"})},[i.failed,em.pending,em.settled]);let[ew,eS]=(0,eN.useState)(null),[ej,eC]=(0,eN.useState)(null),[eT,eI]=(0,eN.useState)(!1),[eP,eA]=(0,eN.useState)(10),eD=(0,eN.useRef)(!0),eE=(0,eN.useRef)(s);eE.current=s&&d;let eO=(0,eN.useRef)([]),ez=(0,eN.useRef)(null),eL=(0,eN.useRef)(null),eR=(0,eN.useCallback)(()=>{var e,t;null==(e=eL.current)||e.call(eL),eL.current=null,null==(t=ez.current)||t.cancel(),ez.current=null},[]),e$=(0,eN.useCallback)(e=>{var t;em.getIsBusy()||et.current||ea.current||eo.current||(em.clear(),eu(),eS(null),eC(null),eI(!1),E(e),eO.current=[],null==(t=eL.current)||t.call(eL),eL.current=null,T(!1))},[T,em.clear,em.getIsBusy,eu]),eF=(0,eN.useCallback)(()=>e$("idle"),[e$]),eq=(0,eN.useCallback)(()=>e$("home"),[e$]),eH=(0,eN.useRef)(c);(0,eN.useEffect)(()=>{eH.current!==c&&(eH.current=c,eF())},[c,eF]),(0,eN.useEffect)(()=>(eD.current=!0,()=>{eD.current=!1,eR(),T(!1)}),[T,eR]),(0,eN.useEffect)(()=>{s||(em.clear(),eu(),eR(),eF())},[s,eF,eR,em.clear,eu]),(0,eN.useEffect)(()=>{d||"sale"!==D||"vouchers"!==Y||(em.clear(),eu(),eF())},[d,D,Y,em.clear,eu,eF]);let eV=JSON.stringify([l.tenantDomain,l.shopId,l.deviceId,l.businessCode]);(0,eN.useEffect)(()=>()=>{var e;null==(e=H.current)||e.abort(),H.current=null,R(!1)},[s,d,eV,D]),(0,eN.useEffect)(()=>{i.ready||(z({ready:!1,failed:!1}),F(!1))},[i.ready]);let eU=(0,eN.useRef)(eV);(0,eN.useEffect)(()=>{eU.current!==eV&&(eU.current=eV,em.clear(),eu(),"sale"===D&&eF())},[eV,D,em.clear,eu,eF]);let eY=(0,eN.useRef)(!1);(0,eN.useEffect)(()=>{eY.current||(eY.current=!0,null==b||b())},[b]);let eW=(0,eN.useCallback)(e=>{let t=(0,ni.cloneDeep)(e),i={snapshot:t,isRedemption:"vouchers"===Y},a={...l,businessCode:e.businessCode||l.businessCode},n=()=>eD.current&&eE.current&&A(l);return(async()=>{if(!n())return!0;try{var e;if(!await I(a))return!1;if(!n()||(eS(i),eC(null),eI(!1),E("dispense"),await T(!0),!n()))return!0;let l=P(t,a);ez.current=l;let r=!1,o=e=>{n()&&(eC(e),"running"===e.status||r||(r=!0,eA(10),E("result")))};null==(e=eL.current)||e.call(eL),eL.current=l.subscribe(o),o(l.getSnapshot())}catch{n()&&(eS(i),eI(!0),E("result"))}return!0})()},[Y,l,A,T,I,P]),eG="dispense"===D||"result"===D,eK=eG||em.busy||X||el||en||L;(0,eN.useEffect)(()=>{if(T(s&&d&&eK),s&&d&&eK)return null==n?void 0:n(()=>!1)},[n,s,d,eK,T]);let eQ="result"===D&&!eT&&(null==ej?void 0:ej.status)==="complete"&&ej.items.length>0&&ej.items.every(e=>"success"===e.status);(0,eN.useEffect)(()=>{if(!eQ||!s||!d)return;let e=window.setInterval(()=>eA(e=>Math.max(0,e-1)),1e3);return()=>window.clearInterval(e)},[eQ,s,d]),(0,eN.useEffect)(()=>{eQ&&0===eP&&eF()},[eQ,eP,eF]);let eZ="idle"===D||"home"===D,eJ=s&&d&&eZ;(0,eN.useLayoutEffect)(()=>(null==p||p(eJ),()=>null==p?void 0:p(!1)),[eJ,p]);let eX=eJ&&"home"===D&&o&&!em.busy&&!Q&&!L;(0,eN.useEffect)(()=>{let e;if(!eX)return;let t=Number.isFinite(u)&&u>0?u:3e4,l=()=>{window.clearTimeout(e),e=window.setTimeout(eF,t)},i=["pointerdown","pointermove","touchstart","touchmove","keydown","wheel","click"];return i.forEach(e=>document.addEventListener(e,l,{capture:!0,passive:!0})),l(),()=>{window.clearTimeout(e),i.forEach(e=>document.removeEventListener(e,l,!0))}},[eX,u,eF]);let e0=(null==(t=em.pending)?void 0:t.phase)==="processing",e2="sale"===D||!!em.pending,e1="sale"===D&&!i.ready,e4=i.failed;return(0,eB.jsxs)("main",{className:["vm-app",x].filter(Boolean).join(" "),style:{...w,...k},children:[M,eZ&&(0,eB.jsx)(e1O,{children:"idle"===D?(0,eB.jsx)(e1F,{brand:g,subtitle:h,active:s&&d,onStart:()=>{em.getIsBusy()||E("home")},onRequestSettings:()=>{em.getIsBusy()||f()}}):(0,eB.jsx)(e1q,{brand:g,machine:v,locale:l.locale,languageDisabled:!o||em.busy||Q||L,onLocaleChange:m?e=>{s&&d&&o&&!em.getIsBusy()&&!Q&&!L&&m(e)}:void 0,active:s&&d,ready:eg,failed:eh,onBuy:()=>{em.getIsBusy()||ep()},onRedeem:()=>{em.getIsBusy()||E("redeem")},onRetry:()=>{z({ready:!1,failed:!1}),F(!1),i.retry()},onHelp:()=>{em.getIsBusy()||(J.current=!0,Z(!0),C.info({title:_("help"),content:_("contact"),okText:_("done"),className:"vm-dialog",wrapClassName:"vm-dialog-wrap",centered:!0,afterClose:()=>{J.current=!1,Z(!1)}}))},onRequestSettings:()=>{em.getIsBusy()||f()},onStaffTap:()=>{if(em.getIsBusy())return;let e=Date.now();eO.current=[...eO.current.filter(t=>e-t<3e3),e],eO.current.length>=5&&(eO.current=[],y())}})}),"redeem"===D&&(0,eB.jsx)(e1O,{children:(0,eB.jsx)(e1K,{brand:g,active:s&&d&&o&&!Q,busy:em.busy,scannedCode:em.scannedCode,onCodeChange:em.setScannedCode,onFindSale:em.submitCode,onBack:eq})}),e1&&(0,eB.jsx)(e1O,{children:(0,eB.jsxs)("section",{className:`vm-scan-start${s&&d?"":" vm-customer-paused"}`,children:[(0,eB.jsx)("header",{className:"vm-customer-home-header",children:(0,eB.jsx)(e1L,{name:g,compact:!0})}),(0,eB.jsx)("div",{className:"vm-scan-start-content",children:(0,eB.jsxs)("div",{className:"vm-scan-start-card",role:"status","aria-live":"polite","aria-atomic":"true",children:[(0,eB.jsx)("div",{className:"vm-scan-start-symbol","aria-hidden":"true",children:(0,eB.jsx)(e1E,{name:e4?"circle-alert":"loader-circle"})}),(0,eB.jsx)("h1",{children:_(e4?"scanPrepareFailed":"scanPreparing")}),(0,eB.jsx)("p",{children:_(e4?"scanPrepareFailedHint":"scanPreparingHint")})]})}),(0,eB.jsxs)("footer",{className:"vm-scan-start-actions",children:[(0,eB.jsxs)("button",{type:"button",className:"vm-scan-start-button",disabled:e0,onClick:()=>{em.clear(),E("home")},children:[(0,eB.jsx)(e1E,{name:"arrow-left"}),_("back")]}),e4&&(0,eB.jsx)("button",{type:"button",className:"vm-scan-start-button vm-scan-start-retry",onClick:()=>{i.retry()},children:_("retry")})]})]})}),i.ready&&(0,eB.jsx)("div",{className:"vm-sales",hidden:"sale"!==D||e1,children:(0,eB.jsx)(e1N,{mode:"retail",template:"kiosk",lifecycleOwner:"provider",destroyOnUnmount:!1,selectionFlowScene:"product-selection",saleDetailTemplate:"A",saleDetailModuleConfig:e4m,autoCreate:!1,enableGlobalScanListener:"sale"===D&&o&&!Q,scanRequest:o&&!Q&&em.pending||void 0,onScanRequestAccepted:em.accepted,onScanRequestSettled:em.settled,onScanPromotionResult:ex,scanScope:em.pending?"product-voucher-collection":"vouchers"===Y&&G?"product-voucher":"all",renderCatalog:e_,catalogPreparation:U,onPaymentPageActiveChange:es,mergeBookingLinesForDisplay:!1,style:{height:"100%",minHeight:0},businessCode:l.businessCode,osModuleName:i.osModuleName,otherParams:i.otherParams,inventory:i.inventory,checkoutHooks:i.checkoutHooks,locale:l.locale,isActive:s&&d&&e2,enableTempOrderPersist:!1,onPaidCheckout:eW,onRequestHome:e=>{"catalog-back"===e?eq():eF()}})}),eG&&(0,eB.jsx)(e1O,{children:(0,eB.jsx)(e1U,{brand:g,sale:(null==ew?void 0:ew.snapshot)??null,isRedemption:(null==ew?void 0:ew.isRedemption)??!1,progress:ej,error:eT,stage:D,seconds:eP,onHome:eF})})]})}function e4h(e){let{context:t,onLocaleChange:l}=e,[i,a]=(0,eN.useState)(t.locale||"en");(0,eN.useEffect)(()=>{a(t.locale||"en")},[t.locale,t.tenantDomain,t.businessCode,t.shopId,t.deviceId]);let n=(0,eN.useMemo)(()=>({...t,locale:i}),[t,i]),r=(0,eN.useCallback)(e=>{e!==i&&(null==l||l(e),a(e))},[i,l]);return(0,eB.jsx)(dy,{value:i,children:(0,eB.jsx)(e1z.Provider,{value:e.brandLogo,children:(0,eB.jsx)(e4g,{...e,context:n,onLocaleChange:r},JSON.stringify([t.tenantDomain,t.businessCode,t.shopId,t.deviceId]))})})}function e4v(e){let{brand:t,machine:l,staff:i,onSignOut:a}=e,{text:n}=e1P();return(0,eB.jsxs)("header",{className:"vm-topbar vm-topbar-staff",children:[(0,eB.jsxs)("div",{children:[(0,eB.jsxs)("strong",{children:[(0,eB.jsx)(D5,{}),l]}),(0,eB.jsx)("small",{children:t})]}),i&&(0,eB.jsxs)("button",{className:"vm-staff-badge",onClick:a,"aria-label":n("signOut"),children:[(0,eB.jsx)("span",{children:i.name.slice(0,2)}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("strong",{children:i.name}),(0,eB.jsx)("small",{children:n("signOut")})]})]})]})}function e4f(e){let{changes:t,products:l,channelLabel:i}=e,{text:a,localized:n}=e1P(),r=(0,eN.useMemo)(()=>new Map(l.map(e=>[e.id,e])),[l]),o=(0,eN.useMemo)(()=>{let e=new Map;for(let l of t){let t=void 0===l.before.spaceId?`channel:${l.channelId}`:`space:${l.before.spaceId}`,i=e.get(t)||[];i.push(l),e.set(t,i)}let l=[];for(let[t,i]of e){let{before:e,after:a}=i[0],n=i.map(e=>e.before);e.productId===a.productId?e.productId&&l.push({key:t,channels:n,productId:e.productId,before:e.quantity,after:a.quantity}):(e.productId&&l.push({key:`${t}:out`,channels:n,productId:e.productId,binding:"removed",before:e.quantity,after:0}),a.productId&&l.push({key:`${t}:in`,channels:n,productId:a.productId,binding:"added",before:0,after:a.quantity}))}return l},[t]),s=(0,eN.useMemo)(()=>{let e=new Map;for(let t of o){let l=e.get(t.productId)||{productId:t.productId,added:0,removed:0},i=t.after-t.before;l.added+=Math.max(0,i),l.removed+=Math.max(0,-i),e.set(t.productId,l)}return[...e.values()]},[o]),d=s.reduce((e,t)=>({added:e.added+t.added,removed:e.removed+t.removed}),{added:0,removed:0}),c=e=>{var t,l,i;return(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("strong",{children:n(null==(t=r.get(e))?void 0:t.title)||(null==(l=r.get(e))?void 0:l.sku)||e}),(0,eB.jsx)("span",{className:"vm-review-sku",children:(null==(i=r.get(e))?void 0:i.sku)||"—"})]})};return(0,eB.jsxs)("div",{className:"vm-restock-review",children:[(0,eB.jsx)("p",{children:a("reviewDescription")}),(0,eB.jsx)("div",{className:"vm-review-table-scroll",children:(0,eB.jsxs)("table",{className:"vm-review-table",children:[(0,eB.jsx)("caption",{children:a("reviewDetails")}),(0,eB.jsx)("thead",{children:(0,eB.jsxs)("tr",{children:[(0,eB.jsx)("th",{children:a("channel")}),(0,eB.jsx)("th",{children:a("product")}),(0,eB.jsx)("th",{children:a("reviewBefore")}),(0,eB.jsx)("th",{children:a("quantityAfter")}),(0,eB.jsx)("th",{children:a("reviewDelta")})]})}),(0,eB.jsx)("tbody",{children:o.map(e=>{let t=e.after-e.before;return(0,eB.jsxs)("tr",{children:[(0,eB.jsx)("td",{children:e.channels.map(e=>(0,eB.jsx)("div",{children:i(e)},e.id))}),(0,eB.jsxs)("td",{children:[c(e.productId),e.binding&&(0,eB.jsx)("span",{className:"vm-review-binding",children:a("removed"===e.binding?"reviewProductRemoved":"reviewProductAdded")})]}),(0,eB.jsx)("td",{children:e.before}),(0,eB.jsx)("td",{children:e.after}),(0,eB.jsxs)("td",{className:t>0?"vm-review-added":t<0?"vm-review-removed":"",children:[t>0?"+":"",t]})]},e.key)})})]})}),(0,eB.jsx)("div",{className:"vm-review-table-scroll",children:(0,eB.jsxs)("table",{className:"vm-review-table vm-review-summary",children:[(0,eB.jsx)("caption",{children:a("reviewSummary")}),(0,eB.jsx)("thead",{children:(0,eB.jsxs)("tr",{children:[(0,eB.jsx)("th",{children:a("product")}),(0,eB.jsx)("th",{children:a("reviewAdded")}),(0,eB.jsx)("th",{children:a("reviewRemoved")})]})}),(0,eB.jsx)("tbody",{children:s.map(e=>(0,eB.jsxs)("tr",{children:[(0,eB.jsx)("td",{children:c(e.productId)}),(0,eB.jsxs)("td",{className:"vm-review-added",children:["+",e.added]}),(0,eB.jsxs)("td",{className:"vm-review-removed",children:["−",e.removed]})]},e.productId))})]})}),(0,eB.jsx)("p",{className:"vm-review-totals",children:a("reviewTotals",d)})]})}let e4y=e=>({productId:e.productId,quantity:null===e.quantity?"":String(e.quantity)}),e4b=(e,t)=>t.productId!==e.productId||(null===e.quantity?""!==t.quantity:""===t.quantity.trim()||Number(t.quantity)!==e.quantity),e4x=e=>"enabled"===e.status&&!e.issue&&null!==e.quantity,e4k=(e,t)=>e4x(e)&&""!==t.quantity.trim()&&Number.isSafeInteger(Number(t.quantity))&&Number(t.quantity)>=0&&Number(t.quantity)<=e.capacity&&(null!==t.productId||0===Number(t.quantity));function e4_(e){let{context:t,staff:l,onBack:i,setLeaveGuard:a,service:n,blockNavigation:r}=e,{text:o,localized:s}=e1P(),[d,c]=eM.Modal.useModal(),[u,p]=(0,eN.useState)(null),[m,g]=(0,eN.useState)({}),[h,v]=(0,eN.useState)(!0),[f,y]=(0,eN.useState)(!1),[b,x]=(0,eN.useState)(""),[k,_]=(0,eN.useState)(!1),[w,S]=(0,eN.useState)(""),[j,N]=(0,eN.useState)(),[C,M]=(0,eN.useState)(!1),[T,I]=(0,eN.useState)(null),P=(0,eN.useRef)(null),[A,D]=(0,eN.useState)(null),[E,O]=(0,eN.useState)({}),z=(0,eN.useRef)(null),L=(0,eN.useRef)(null),R=(0,eN.useRef)(!1),$=(0,eN.useRef)(!0),F=(0,eN.useRef)(t);F.current=t;let q=(0,eN.useRef)(!1),B=(0,eN.useRef)(null),H=C||null!==T||null!==A,V=(0,eN.useCallback)(async()=>{var e,t;null==(e=L.current)||e.abort(),null==(t=z.current)||t.abort(),z.current=null,D(null),O({}),P.current=null,I(null);let l=new AbortController;L.current=l,v(!0),y(!1),x("");try{let e=await n.load(F.current,l.signal);if(l.signal.aborted)return;p(e),N(e.inventorySync),g({}),_(!1),S("")}catch(e){l.signal.aborted||(y(!0),x(e instanceof Error?e.message:""))}finally{l.signal.aborted||v(!1)}},[t.tenantDomain,t.businessCode,t.shopId,t.deviceId,n]);(0,eN.useEffect)(()=>($.current=!0,V(),()=>{var e,t;$.current=!1,null==(e=L.current)||e.abort(),null==(t=z.current)||t.abort(),P.current=null}),[V]);let U=e=>m[e.id]||e4y(e),Y=((null==u?void 0:u.channels)||[]).filter(e=>e4b(e,U(e)));q.current=Y.length>0;let W=Y.some(e=>!e4k(e,U(e))),G=(0,eN.useMemo)(()=>new Map(null==u?void 0:u.products.map(e=>[e.id,e])),[null==u?void 0:u.products]),K=(0,eN.useMemo)(()=>[{value:"",label:o("noProduct"),disabled:!1},...((null==u?void 0:u.products)||[]).map(e=>({value:e.id,label:s(e.title)||e.sku||e.id,disabled:!!e.disabled}))],[null==u?void 0:u.products,s,o]),Q=(null==u?void 0:u.groupType)==="board"?"board":"row",Z=e=>s(e.groupName)||e.row,J=e=>`${o(Q)} ${Z(e)} \xb7 ${o("editChannel",{code:e.code})}`,X=function(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:U(e);return e4x(e)&&!!l.productId&&G.has(l.productId)&&!(null==(t=G.get(l.productId))?void 0:t.disabled)},ee=(0,eN.useCallback)(()=>{let e;if(R.current||P.current||z.current)return Promise.resolve(!1);if(!q.current)return Promise.resolve(!0);if(B.current)return B.current.promise;let t=new Promise(t=>{e=t}),l=d.confirm({title:o("discardTitle"),content:o("discardDescription"),okText:o("discard"),cancelText:o("keepEditing"),className:"vm-dialog",wrapClassName:"vm-dialog-wrap",centered:!0,onOk:()=>{B.current=null,e(!0)},onCancel:()=>{B.current=null,e(!1)}});return B.current={promise:t,close:()=>{l.destroy(),e(!1)}},t},[d,o]);(0,eN.useEffect)(()=>{a(ee);let e=e=>{(q.current||R.current||z.current)&&(e.preventDefault(),e.returnValue="")};window.addEventListener("beforeunload",e);let t=null==r?void 0:r(()=>!R.current&&!P.current&&!z.current&&(q.current?o("discardDescription"):void 0));return()=>{var l;a(null),null==t||t(),window.removeEventListener("beforeunload",e),null==(l=B.current)||l.close(),B.current=null}},[r,ee,a,o]);let et=(e,t)=>{!R.current&&!P.current&&!z.current&&e4x(e)&&(_(!1),g(l=>{let i={...l};for(let a of(null==u?void 0:u.channels)||[])e4x(a)&&(a.id===e.id||void 0!==e.spaceId&&a.spaceId===e.spaceId)&&(i[a.id]={...l[a.id]||e4y(a),...t});return i}))},el=async()=>{var e;let i=P.current;if(!u||!1===u.canSubmit||R.current||z.current||!(null==i?void 0:i.length))return;R.current=!0,M(!0),_(!1),S(""),null==(e=L.current)||e.abort();let a=new AbortController;L.current=a;try{let e=await n.submit(t,i,l,a.signal);if(a.signal.aborted)return;let r=!e||"accepted"===e.status||"synced"===e.status;if(e&&"accepted"===e.status)p(e.data),N(e.data.inventorySync);else{let t=new Map(i.map(e=>[e.channelId,e.after])),l=new Set(i.map(e=>e.before.spaceId).filter(e=>void 0!==e));p({...u,channels:u.channels.map(i=>r?t.get(i.id)||i:t.has(i.id)||void 0!==i.spaceId&&l.has(i.spaceId)?{...i,status:"blocked",issue:e&&"review"===e.status?"stockSyncReview":"stockSyncPending"}:i)}),N(e||void 0)}g({}),q.current=!1,r&&(0,nB.PisellToast)({content:o("saved")})}catch(e){a.signal.aborted||(_(!0),S(e instanceof Error?e.message:""))}finally{R.current=!1,P.current=null,$.current&&(M(!1),I(null))}},ei=async e=>{if(!n.testChannel||h||f||R.current||P.current||z.current)return;let l=new AbortController;z.current=l,D(e.id),O(t=>{let l={...t};return delete l[e.id],l});try{let i=await n.testChannel(t,{...e},l.signal);!l.signal.aborted&&$.current&&O(t=>({...t,[e.id]:i}))}catch(t){!l.signal.aborted&&$.current&&O(l=>({...l,[e.id]:{success:!1,uncertain:!0,message:t instanceof Error?t.message:o("channelTestUnknown")}}))}finally{z.current===l&&(z.current=null,$.current&&D(null))}},ea=(0,eN.useMemo)(()=>{let e=new Map;return null==u||u.channels.forEach(t=>e.set(t.row,[...e.get(t.row)||[],t])),Array.from(e.entries())},[null==u?void 0:u.channels]);return(0,eB.jsxs)("section",{className:"vm-restock vm-page",children:[c,(0,eB.jsx)(eM.Modal,{open:null!==T,title:o("reviewTitle"),className:"vm-dialog vm-restock-review-dialog",wrapClassName:"vm-dialog-wrap",width:760,centered:!0,maskClosable:!1,closable:!C,keyboard:!C,confirmLoading:C,cancelButtonProps:{disabled:C},okText:o("reviewConfirm"),cancelText:o("keepEditing"),onCancel:()=>{R.current||(P.current=null,I(null))},onOk:()=>void el(),children:T&&u&&(0,eB.jsx)(e4f,{changes:T,products:u.products,channelLabel:J})}),(0,eB.jsxs)("header",{className:"vm-page-heading",children:[i&&(0,eB.jsx)("button",{className:"vm-icon-button","aria-label":o("back"),disabled:H,onClick:async()=>{await ee()&&i()},children:(0,eB.jsx)(u8,{})}),(0,eB.jsxs)("div",{className:"vm-restock-title",children:[(0,eB.jsx)("h1",{children:o("configure")}),(0,eB.jsx)("p",{children:o("configureDescription")}),n.testChannel&&(0,eB.jsx)("span",{className:"vm-caption",children:o("channelTestHint")})]}),(0,eB.jsx)("button",{className:"vm-button vm-button-outline vm-fill-all",disabled:h||f||H||!(null==u?void 0:u.channels.some(e=>X(e))),onClick:()=>{!u||h||f||R.current||P.current||z.current||(_(!1),g(e=>{let t={...e};for(let l of u.channels){let i=e[l.id]||e4y(l);X(l,i)&&(t[l.id]={...i,quantity:String(l.capacity)})}return t}))},children:o("fillAll")})]}),!h&&!f&&(null==u?void 0:u.canSubmit)===!1&&(0,eB.jsx)(eM.Alert,{className:"vm-restock-notice",type:"info",showIcon:!0,message:o("restockDraftOnly")}),(j&&"synced"!==j.status||k)&&(0,eB.jsx)(eM.Alert,{className:"vm-restock-notice",type:k?"error":(null==j?void 0:j.status)==="review"?"warning":"info",showIcon:!0,message:k?w||o("saveError"):(null==j?void 0:j.message)||o("stockSyncPending"),action:(0,eB.jsx)("button",{className:"vm-button vm-button-outline",disabled:h||H,onClick:async()=>{await ee()&&V()},children:o("stockRefresh")})}),(0,eB.jsx)("div",{className:"vm-restock-scroll","aria-busy":h||C,children:h?(0,eB.jsxs)("div",{className:"vm-state",children:[(0,eB.jsx)(eM.Spin,{}),(0,eB.jsx)("span",{children:o("loading")})]}):f?(0,eB.jsxs)("div",{className:"vm-state",role:"alert",children:[(0,eB.jsx)("p",{children:b||o("loadError")}),(0,eB.jsx)("button",{className:"vm-button",onClick:()=>void V(),children:o("retry")})]}):(null==u?void 0:u.channels.length)?(0,eB.jsxs)("div",{className:"vm-inline-list",children:[(0,eB.jsxs)("div",{className:"vm-list-labels",children:[(0,eB.jsx)("span",{children:o("channel")}),(0,eB.jsx)("span",{children:o("productStock")}),(0,eB.jsx)("span",{children:o("quantityAfter")}),(0,eB.jsx)("span",{children:o("action")})]}),ea.map(e=>{let[t,l]=e;return(0,eB.jsxs)("div",{className:"vm-channel-group",children:[ea.length>1&&(0,eB.jsxs)("div",{className:"vm-channel-group-heading",children:[o(Q)," ",Z(l[0])]}),(0,eB.jsx)("div",{className:"vm-group-items",children:l.map(e=>{let t,l,i,a,r,s,d,c,p=G.get(e.productId||""),m="enabled"!==e.status?e.status:0===e.quantity?"empty":null!==e.quantity&&e.quantity<=e.lowThreshold?"low":null;return(0,eB.jsxs)("div",{className:`vm-channel-line ${m?`vm-status-${m}`:""} ${e4b(e,U(e))?"vm-is-changed":""}`,children:[(0,eB.jsxs)("strong",{className:"vm-channel-code",children:[(0,eB.jsx)("span",{className:"vm-restock-field-label",children:o("channel")}),e.code]}),(0,eB.jsxs)("div",{className:"vm-channel-product",children:[(0,eB.jsx)("span",{className:"vm-restock-field-label",children:o("productStock")}),(t=U(e),(0,eB.jsx)("div",{className:"vm-product-picker",children:(0,eB.jsx)(eM.Select,{className:"vm-product-select",bordered:!1,showSearch:!1,virtual:!0,options:K,placeholder:e.issue?o(e.issue):o("noProduct"),"aria-label":`${J(e)} ${o("product")}`,disabled:H||!e4x(e),value:t.productId||void 0,onChange:t=>et(e,{productId:t||null,quantity:"0"})})})),(0,eB.jsxs)("span",{className:"vm-caption",children:[(0,eB.jsx)("span",{className:"vm-sku",children:(null==p?void 0:p.sku)||"—"})," ","\xb7 ",o("current")," ",e.quantity??"—","enabled"!==e.status&&(0,eB.jsxs)(eB.Fragment,{children:[" \xb7 ",o(e.status)]})]}),e.issue&&(0,eB.jsx)("span",{className:"vm-field-error",children:o(e.issue)})]}),(i=Number((l=U(e)).quantity)||0,a=H||!X(e,l),r=e4x(e)&&!e4k(e,l),(0,eB.jsxs)("div",{className:"vm-quantity-editor",children:[(0,eB.jsx)("span",{className:"vm-restock-field-label",children:o("quantityAfter")}),(0,eB.jsxs)("div",{className:"vm-stepper",children:[(0,eB.jsx)("button",{className:"vm-icon-button","aria-label":`${J(e)} −1`,disabled:a||i<=0,onClick:()=>et(e,{quantity:String(Math.max(0,Math.min(e.capacity,Math.trunc(i)-1)))}),children:(0,eB.jsx)(Nw,{})}),(0,eB.jsx)("input",{inputMode:"numeric",type:"number",step:1,min:0,max:e.capacity,"aria-label":`${J(e)} ${o("quantity")}`,"aria-invalid":r,disabled:a,placeholder:"—",value:l.quantity,onChange:t=>et(e,{quantity:t.target.value})}),(0,eB.jsx)("button",{className:"vm-icon-button","aria-label":`${J(e)} +1`,disabled:a||i>=e.capacity,onClick:()=>et(e,{quantity:String(Math.min(e.capacity,Math.max(0,Math.trunc(i)+1)))}),children:(0,eB.jsx)(dh,{})})]}),(0,eB.jsx)("span",{className:"vm-caption",children:o("capacity",{capacity:e.capacity})}),r&&(0,eB.jsx)("span",{className:"vm-field-error",role:"alert",children:o("invalidQuantity")})]})),(s=E[e.id],d=A===e.id,c="string"==typeof e.machineId&&!!e.machineId&&Number.isSafeInteger(e.boardDeviceId)&&e.boardDeviceId>0&&Number.isInteger(e.laneId)&&e.laneId>=1&&e.laneId<=100,(0,eB.jsxs)("div",{className:"vm-row-actions",children:[(0,eB.jsx)("span",{className:"vm-restock-field-label",children:o("action")}),(0,eB.jsxs)("div",{className:"vm-row-action-buttons",children:[(0,eB.jsx)("button",{className:"vm-button vm-button-outline",disabled:H||!X(e),onClick:()=>et(e,{quantity:String(e.capacity)}),children:o("fill")}),(0,eB.jsx)("button",{className:"vm-button vm-button-outline",title:o("reset"),"aria-label":`${J(e)} ${o("reset")}`,disabled:H||!e4b(e,U(e)),onClick:()=>{!R.current&&!P.current&&!z.current&&(g(t=>{let l={...t};for(let t of(null==u?void 0:u.channels)||[])(t.id===e.id||void 0!==e.spaceId&&t.spaceId===e.spaceId)&&delete l[t.id];return l}),_(!1))},children:o("reset")}),(0,eB.jsx)("button",{className:"vm-button vm-button-outline vm-channel-test",title:o("channelTestHint"),"aria-label":`${J(e)} ${o("channelTest")}`,"aria-busy":d,disabled:H||!n.testChannel||!c,onClick:()=>void ei(e),children:o(d?"channelTesting":"channelTest")})]}),!d&&s&&(0,eB.jsxs)("span",{className:`vm-channel-test-result ${s.success?"vm-test-success":s.uncertain?"vm-test-unknown":"vm-test-failed"}`,role:"status",children:[o(s.success?"channelTestSuccess":s.uncertain?"channelTestUnknown":"channelTestFailed"),!s.success&&s.message&&(0,eB.jsx)("span",{className:"vm-caption",children:s.message})]})]}))]},e.id)})})]},t)})]}):(0,eB.jsx)("div",{className:"vm-state",children:o("noChannels")})}),(0,eB.jsxs)("footer",{className:"vm-submit-bar",children:[(0,eB.jsxs)("div",{children:[(0,eB.jsx)("span",{className:"vm-caption",children:o("pending")}),(0,eB.jsxs)("strong",{children:[Y.length," ",o("channels")]})]}),(0,eB.jsxs)("button",{className:"vm-button vm-button-primary",disabled:H||h||f||(null==u?void 0:u.canSubmit)===!1||!Y.length||W,onClick:()=>{if(!u||!1===u.canSubmit||h||f||R.current||P.current||z.current||!Y.length||W)return;let e=Y.map(e=>{var t;let l=U(e),i=Number(l.quantity),a=l.productId===e.productId;return{channelId:e.id,before:{...e},after:{...e,productId:l.productId,inventoryItemId:null==(t=G.get(l.productId||""))?void 0:t.inventoryItemId,stockId:a?e.stockId:void 0,submissionId:void 0,quantity:i,availableQuantity:a?null==e.availableQuantity||null===e.quantity?e.availableQuantity:e.availableQuantity+i-e.quantity:i}}}),t=new Map;for(let l of e){let e=G.get(l.after.productId||"");if(l.after.productId&&(!e||e.disabled))return void(0,nB.PisellToast)({content:o("restockStockInvalid"),type:"error"});if(void 0===l.before.spaceId)continue;let i=t.get(l.before.spaceId);if(i&&(i.after.productId!==l.after.productId||i.after.quantity!==l.after.quantity))return void(0,nB.PisellToast)({content:o("restockChanged"),type:"error"});t.set(l.before.spaceId,l)}P.current=e,I(e)},children:[C?(0,eB.jsx)(eM.Spin,{size:"small"}):(0,eB.jsx)(gT,{}),o(C?"saving":"reviewTitle")]})]})]})}function e4w(e){let{context:t,brand:l,machine:i,staff:a=null,onBack:n,onSignOut:r,service:o,blockNavigation:s,className:d,style:c}=e,u=e4u(),p=(0,eN.useRef)(null),m=(0,eN.useRef)(!0),g=(0,eN.useCallback)(e=>{p.current=e},[]);(0,eN.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let h=async()=>{(!p.current||await p.current())&&m.current&&(null==r||r())};return(0,eB.jsxs)("main",{className:["vm-app vm-staff-mode",d].filter(Boolean).join(" "),style:{...u,...c},children:[(0,eB.jsx)(e4v,{brand:l,machine:i,staff:a,onSignOut:()=>void h()}),(0,eB.jsx)(e4_,{context:t,staff:a,onBack:n,setLeaveGuard:g,service:o,blockNavigation:s})]})}function e4S(e){let{context:t}=e;return(0,eB.jsx)(dy,{value:t.locale,children:(0,eB.jsx)(e4w,{...e},JSON.stringify([t.tenantDomain,t.businessCode,t.shopId,t.deviceId]))})}function e4j(e){let{context:t,staff:l,service:i,onConfigure:a,onResume:n}=e,{text:r}=e1P(),[o,s]=(0,eN.useState)(null),[d,c]=(0,eN.useState)(!1),[u,p]=(0,eN.useState)(0);(0,eN.useEffect)(()=>{let e=new AbortController;return c(!1),s(null),i.load(t,e.signal).then(t=>{e.signal.aborted||s(t)}).catch(()=>{e.signal.aborted||c(!0)}),()=>e.abort()},[t.businessCode,t.tenantDomain,t.shopId,t.deviceId,i,u]);let m=(null==o?void 0:o.channels)||[],g=[...new Map(m.filter(e=>"enabled"===e.status&&e.productId).map(e=>[void 0===e.spaceId?`channel:${e.id}`:`space:${e.spaceId}`,e])).values()],h=[{label:"sellable",value:g.some(e=>null===e.availableQuantity||null===e.quantity)?null:g.reduce((e,t)=>e+(t.availableQuantity??t.quantity??0),0)},{label:"low",value:m.filter(e=>"enabled"===e.status&&null!==e.quantity&&e.quantity>0&&e.quantity<=e.lowThreshold).length},{label:"empty",value:m.filter(e=>"enabled"===e.status&&0===e.quantity).length},{label:"unavailable",value:m.filter(e=>"enabled"!==e.status).length}];return(0,eB.jsxs)("section",{className:"vm-staff-home vm-page",children:[(0,eB.jsx)("header",{className:"vm-page-heading",children:(0,eB.jsxs)("div",{children:[(0,eB.jsx)("p",{children:r("welcomeStaff",{name:l.name})}),(0,eB.jsx)("h1",{children:r("staffHome")})]})}),(0,eB.jsxs)("div",{className:"vm-staff-content",children:[d?(0,eB.jsx)(eM.Alert,{type:"warning",message:r("loadError"),action:(0,eB.jsx)("button",{className:"vm-text-button",onClick:()=>p(e=>e+1),children:r("retry")})}):(0,eB.jsx)("div",{className:"vm-stats",children:h.map(e=>(0,eB.jsxs)("div",{className:`vm-stat vm-stat-${e.label}`,children:[(0,eB.jsx)("span",{children:r(e.label)}),(0,eB.jsx)("strong",{children:o?e.value??"—":"—"})]},e.label))}),(0,eB.jsxs)("button",{className:"vm-service-card",onClick:a,children:[(0,eB.jsx)(Po,{}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("h2",{children:r("configure")}),(0,eB.jsx)("p",{children:r("configureCard")})]}),(0,eB.jsx)(u5,{})]}),(0,eB.jsxs)("button",{className:"vm-button vm-button-outline vm-resume",onClick:n,children:[r("resume"),(0,eB.jsx)(u5,{})]})]})]})}function e4N(e){let{context:t,brand:l,machine:i,staff:a,service:n,onConfigure:r,onSignOut:o}=e,s=e4u();return(0,eB.jsx)(dy,{value:t.locale,children:(0,eB.jsxs)("main",{className:"vm-app vm-staff-mode",style:s,children:[(0,eB.jsx)(e4v,{brand:l,machine:i,staff:a,onSignOut:o}),(0,eB.jsx)(e4j,{context:t,staff:a,service:n,onConfigure:r,onResume:o})]})})}function e4C(e,t,l){let i=Object.entries(e).reduce((e,t)=>{let[l,i]=t;return"channel"===l&&""===String(i??"").trim()||("otherParams"===l&&i&&"object"==typeof i&&!Array.isArray(i)?e[l]={...e[l]||{},...i}:void 0!==i&&(e[l]=i)),e},{...t||{}}),a=[null==l?void 0:l.menuIds,e.menuIds,null==t?void 0:t.menuIds].map(ex_).find(e=>e.length>0);return a?i.menuIds=a:delete i.menuIds,i}function e4M(){var e;if("u"<typeof window)return"100dvh";let t=function(){if("u"<typeof window||"u"<typeof document)return 1;let e=document.body.style.transform,t=e&&"none"!==e?e:window.getComputedStyle(document.body).transform;if(!t||"none"===t)return 1;let l=new DOMMatrixReadOnly(t);return Math.sqrt(l.c*l.c+l.d*l.d)||1}();if(.001>Math.abs(t-1))return"100%";let l=(null==(e=window.visualViewport)?void 0:e.height)||window.innerHeight;return`${l/t}px`}function e4T(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];for(let e of t){let t=String(e||"").trim();if(t)return t}return""}function e4I(e){var t,l,i,a,n,r,o;let[s,d]=(0,eN.useState)(e4M),c=eR(),u=eF(),p=(null==c||null==(l=c.appHelper)||null==(t=l.constants)?void 0:t.hostPageProps)||{},m=(null==c||null==(i=c.engine)?void 0:i.props)||{},g=e4T(p.channel,null==(a=p.otherParams)?void 0:a.channel),{className:h,mode:v="retail",style:f,businessCode:y,channel:b,otherParams:x,menuIds:k,productLoadParams:_,bootstrapSlot:w,variant:S,normalProductDetailConfig:j,osModuleName:N,...C}=e4C(e,{...p,...m,channel:e4T(g,m.channel),otherParams:{...p.otherParams||{},...m.otherParams||{},...g?{channel:g}:{}}},p),M=e4T(g,b,null==x?void 0:x.channel,null==c||null==(o=c.appHelper)||null==(r=o.utils)||null==(n=r.getData)?void 0:n.call(r,"channel"),"pos"),T=eHd(eHs(null==x?void 0:x.platform,u),S),I=(0,eN.useMemo)(()=>{if(!_&&!(null==k?void 0:k.length))return;let{menu_list_ids:e,...t}=_||{};return{...t,...(null==k?void 0:k.length)?{menu_list_ids:k}:{}}},[k,_]),P=(0,eN.useMemo)(()=>({...x||{},enforceSingleBookingStartDate:!0,...M?{channel:M}:{},enableBusinessAvailability:!!T.platform,...T.platform?{platform:T.platform}:{}}),[M,T.platform,x]),A="pos"===String(M||"").trim().toLowerCase(),D=(0,eN.useMemo)(()=>({...j,resolveAppearance:(null==j?void 0:j.resolveAppearance)??((null==j?void 0:j.appearance)?void 0:eGP),...A?{allowUnavailableBookingSelection:!0,allowNoResourceBookingSelection:!0}:{},presentationPlatform:T.productDetailPresentationPlatform,hideQuantityForBookingProducts:null==j?void 0:j.hideQuantityForBookingProducts}),[A,T.productDetailPresentationPlatform,j]);return(0,eN.useEffect)(()=>{var e;let t=()=>{d(e4M())};t(),window.addEventListener("resize",t),null==(e=window.visualViewport)||e.addEventListener("resize",t);let l=new MutationObserver(t);return l.observe(document.body,{attributes:!0,attributeFilter:["style","class"]}),()=>{var e;window.removeEventListener("resize",t),null==(e=window.visualViewport)||e.removeEventListener("resize",t),l.disconnect()}},[]),(0,eB.jsx)(eqw.Provider,{value:eGI,children:(0,eB.jsx)(e1N,{...C,className:h,mode:v,businessCode:y,otherParams:P,lifecycleOwner:"provider",osModuleName:N,selectionFlowScene:"product-selection",enableGlobalScanListener:!0,normalProductDetailConfig:D,mergeBookingLinesForDisplay:T.mergeBookingLinesForDisplay,productLoadParams:I,enableMenuOverride:!!(null==k?void 0:k.length),autoCreate:!1,bootstrapSlot:w,saleDetailTemplate:"A",style:{minHeight:s,height:s,...f},template:"kiosk",variant:T.variant})})}function e4P(e){var t,l,i,a,n,r,o,s;let{kind:d,...c}=e,u=eR(),p=eF(),m=(null==u||null==(l=u.appHelper)||null==(t=l.constants)?void 0:t.hostPageProps)||{},g=e4C(c,{...m,...(null==u||null==(i=u.engine)?void 0:i.props)||{},otherParams:{...m.otherParams||{},...(null==u||null==(n=u.engine)||null==(a=n.props)?void 0:a.otherParams)||{}}},m),{otherParams:h,channel:v,businessCode:f,variant:y,...b}=g,x=(null==h?void 0:h.platform)||p,k="kiosk"===String(x||"").trim().toLowerCase(),_=f||(null==h?void 0:h.businessCode)||"venue_booking",w=v||(null==h?void 0:h.channel)||(k?"kiosk":"online_ordering"),S=String((null==u||null==(s=u.appHelper)||null==(o=s.utils)||null==(r=o.getData)?void 0:r.call(o,"timezone"))||(null==h?void 0:h.businessTimezone)||""),j=(0,eN.useMemo)(()=>({...h,businessCode:_,channel:w,platform:x,venueBookingMode:d,...k?{enableSessionStoragePersist:!1}:{},businessTimezone:S,type:"appointment_booking",enableBusinessAvailability:!0,enforceSingleBookingStartDate:!0,enablePickupTiming:!1}),[_,w,h,x,S,d,k]);return(0,eB.jsx)(e1N,{...b,osKey:g.osKey||`venue-booking-${d}`,template:"tickets"===d?"venue-ticket-booking":"venue-party-booking",mode:"retail",businessCode:_,otherParams:j,variant:"kiosk"===String(j.platform).trim().toLowerCase()?"phone":y||("h5"===j.platform?"phone":"desktop"),lifecycleOwner:"provider",orderId:void 0,autoBootstrap:!1,autoRestoreOnInit:!1,autoCreate:!1,autoInitBookingContext:!1,enableGlobalScanListener:!1,enableTempOrderSync:k,enableMenuOverride:!1,productLoadParams:void 0,autoReloadProductCatalogOnCustomerChange:!1,mergeBookingLinesForDisplay:!1})}function e4A(e){return(0,eB.jsx)(e4P,{...e,kind:"tickets"})}function e4D(e){return(0,eB.jsx)(e4P,{...e,kind:"party"})}function e4E(e){let{payload:t}=e,l=eb$(),i=l.bookingTicket,a=l.clearCartAndReset,n="picoding"===l.salesSettingsSource&&!l.salesSettings,r=(0,eN.useRef)(Promise.resolve());return(0,eN.useEffect)(()=>{if(!i||n)return;let e=!1;return r.current=r.current.then(async()=>{if(!e){if(t.tempOrder){if(!i.replaceTempOrder)return void console.warn("[SharedSecondaryBigSale] 当前销售实例不支持 replaceTempOrder");await i.replaceTempOrder(t.tempOrder)}else await a();!e&&t.walletAssetsSnapshot&&i.importWalletAssetsSnapshot&&await i.importWalletAssetsSnapshot(t.walletAssetsSnapshot)}}).catch(e=>{console.warn("[SharedSecondaryBigSale] 应用副屏订单快照失败",e)}),()=>{e=!0}},[i,a,t,n]),null}let e4O=0;function e4z(e){var t,l,i;let{osKey:a="shared-secondary-big-sale",saleDetailModuleConfig:n,secondaryScreenDisplay:r,className:o,style:s}=e,d=function(){var e,t,l,i,a;let n=eR(),r=null==n||null==(l=n.appHelper)||null==(t=l.utils)||null==(e=t.getApp)?void 0:e.call(t),o=null==r||null==(i=r.getPlugin)?void 0:i.call(r,"unifiedCommunication"),{runtime:s}=(null==o||null==(a=o.useRuntime)?void 0:a.call(o))||{},d=(null==s?void 0:s.role)==="secondary-screen",c=(0,eN.useRef)(0),[u,p]=(0,eN.useState)(null);return(0,eN.useEffect)(()=>{var e,t,l,i;if(!d)return;let a=!1,n=null==o||null==(t=o.sdk)||null==(e=t.onMessage)?void 0:e.call(t,e=>{var t;let l=eNj(e);!a&&l&&"secondary-screen"!==l.sourceRole&&(t=c.current,!0===l.isActive&&l.timestamp>t&&(c.current=l.timestamp,p(l)))});return Promise.resolve(null==o||null==(i=o.sdk)||null==(l=i.publishData)?void 0:l.call(i,{target:{type:"main"},data:{type:eNx,requestId:`shared-secondary-${Date.now()}-${Math.random().toString(16).slice(2)}`,timestamp:Date.now()},meta:{}})).catch(e=>{console.warn("[SharedSecondaryBigSale] 请求主屏订单快照失败",e)}),()=>{if(a=!0,n&&"function"==typeof n.then)n.then(e=>{var t;return null==e||null==(t=e.remove)?void 0:t.call(e)}).catch(()=>{});else{var e;null==n||null==(e=n.remove)||e.call(n)}}},[d,o]),u}(),c=eR(),u=d?eNS(d):void 0,p=null==u?void 0:u.businessCode,m=null==c||null==(i=c.appHelper)||null==(l=i.utils)||null==(t=l.getData)?void 0:t.call(l,"channel"),g=(null==u?void 0:u.channel)||("string"==typeof m&&m.trim()?m.trim():"cds"),h=(0,eN.useMemo)(()=>++e4O,[a,p,g]),v=(0,eN.useMemo)(()=>({channel:g}),[g]);return d&&p?(0,eB.jsx)(e1N,{osKey:`${a}-${encodeURIComponent(g)}-${h}`,businessCode:p,otherParams:v,mode:"ticket",template:"secondaryScreen",saleDetailTemplate:"A",autoCreate:!1,autoRestoreOnInit:!1,autoInitBookingContext:!1,enableTempOrderSync:!1,secondaryScreenDisplay:r,saleDetailModuleConfig:n,className:o,style:s,bootstrapSlot:(0,eB.jsx)(e4E,{payload:d})},h):(0,eB.jsx)("div",{className:o,style:s,"aria-busy":"true"})}let e4L=eC().memo(e1j);async function e4R(e){var t,l,i,a,n,r,o;let s=(null==(l=e.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.tempOrder??null,d=(null==(a=e.salesDetail)||null==(i=a.header)?void 0:i.order_id)??(null==(n=e.salesDetail)?void 0:n.order_id),c=eIw(null==s?void 0:s.order_id)||!!d,u=(null==s||null==(r=s.products)?void 0:r.length)??0,p=(null==s||null==(o=s.bookings)?void 0:o.length)??0;c?await e.restore():((u>0||p>0)&&"function"==typeof e.clearCartItemsOnly&&await e.clearCartItemsOnly(),await e.createNew())}function e4$(e){var t,l;let{open:i,contentActive:a,openNonce:n=0,orderId:r,preloadedSalesDetail:o,createSeed:s,bookingTimeRangeFromCalendar:d,bookingConfigParams:c,onCreateSeedReady:u,onCreateSeedError:p,onEditReady:m}=e,g=eb$(),h=eNa(),v=eC().useContext(eCf),f=eC().useContext(eCy),y=(0,eN.useRef)(!1),b=(0,eN.useRef)(0),x=(0,eN.useRef)(0),k=(0,eN.useRef)(g);k.current=g;let _=(0,eN.useRef)(h);_.current=h;let w=(0,eN.useRef)(s);w.current=s;let S=(0,eN.useRef)(d);S.current=d;let j=(0,eN.useRef)(o);j.current=o;let N=(0,eN.useRef)(c);N.current=c;let C=(0,eN.useRef)(v);C.current=v;let M=(0,eN.useRef)(f);M.current=f;let T=(0,eN.useRef)(u);T.current=u;let I=(0,eN.useRef)(p);I.current=p;let P=(0,eN.useRef)(m);P.current=m;let A=(0,eN.useRef)(a),D=(0,eN.useRef)(null),E=`${!s?"":`${(null==(t=s.row)?void 0:t.id)??""}-${(null==(l=s.reservationRuleProduct)?void 0:l.id)??""}`}:${(null==d?void 0:d.startAt)||""}:${(null==d?void 0:d.endAt)||""}`,O=!!g.bookingTicket;return(0,eN.useEffect)(()=>{let e=A.current;if(A.current=a,!e||a||!k.current.bookingTicket)return;let t=k.current.restore().then(()=>void 0).catch(e=>{console.warn("[BigSaleDialog] close cleanup failed",e)});D.current=t,t.finally(()=>{D.current===t&&(D.current=null)})},[a,O]),(0,eN.useEffect)(()=>{if(!i){y.current=!1,b.current+=1,x.current+=1;return}y.current=!1,b.current+=1,x.current+=1},[i,n,E]),(0,eN.useEffect)(()=>{var e;if(!i||!r||s)return;let t=k.current;if(!t.bookingTicket)return;let l=x.current;return null==(e=M.current)||e.call(M,r),(async()=>{var e,i,a,n,o,s,d;try{if(await D.current,l!==x.current)return;let d=function(e,t){if(!e||"object"!=typeof e)return;let l=e.order_id;if(null!=l&&String(l)===String(t)&&Array.isArray(e.products)&&Array.isArray(e.bookings))return e}(j.current,r);if(await t.loadDetail(d?{orderId:r,preloadedSalesDetail:d}:r),l!==x.current)return;let c=(null==(i=t.bookingTicket)||null==(e=i.getTempOrder)?void 0:e.call(i))??t.tempOrder,u=exy(c??null);if(await (null==(n=t.bookingTicket)||null==(a=n.initBookingContext)?void 0:a.call(n,exx(N.current,{date:ew()(),bookingIds:u.length?u:void 0,loadResources:!0}))),l!==x.current||(null==(o=C.current)||o.call(C),await _.current.recalcSummary(),l!==x.current))return;null==(s=P.current)||s.call(P)}catch(e){if(l!==x.current)return;null==(d=I.current)||d.call(I,e)}})(),()=>{l===x.current&&(x.current+=1)}},[i,n,r,E,O]),(0,eN.useEffect)(()=>{let e=w.current;if(!i||r)return;let t=k.current;if(!t.bookingTicket||"loading"===t.status||y.current)return;let l=b.current;return(async()=>{var t,i,a,n,r,o,s,d,c,u;try{if(await D.current,l!==b.current||(await e4R(k.current),l!==b.current)||(e&&await eB0({bookingTicket:k.current.bookingTicket,reservationRuleProduct:e.reservationRuleProduct,row:e.row,appointmentStatus:e.appointmentStatus??"started",bookingConfig:(null==(d=k.current.bookingTicket)||null==(s=d.getBookingConfig)?void 0:s.call(d))??null,tempOrder:k.current.tempOrder,date:(null==(c=S.current)?void 0:c.startAt.slice(0,10))||ew()().format("YYYY-MM-DD"),bookingTimeRangeFromCalendar:S.current,assertCurrent:()=>{if(l!==b.current)throw Error("The booking selection has closed.")}}),l!==b.current))return;let u=(null==(i=k.current.bookingTicket)||null==(t=i.getTempOrder)?void 0:t.call(i))??k.current.tempOrder,p=exy(u??null);if(await (null==(n=k.current.bookingTicket)||null==(a=n.initBookingContext)?void 0:a.call(n,exx(N.current,{date:ew()(),bookingIds:p.length?p:void 0,loadResources:!1}))),l!==b.current||(null==(r=C.current)||r.call(C),await _.current.recalcSummary(),l!==b.current))return;y.current=!0,null==(o=T.current)||o.call(T)}catch(e){if(l!==b.current)return;y.current=!1,null==(u=I.current)||u.call(I,e)}})(),()=>{l===b.current&&(b.current+=1)}},[i,n,r,E,O]),null}function e4F(e){let{onClose:t,fallbackTitle:l,variant:i}=e,a=eb$(),n=(0,eN.useMemo)(()=>{var e,t,i,n;let r=a.tempOrder,o=(null==r?void 0:r.shop_full_order_number)||(null==r?void 0:r.shop_order_number)||((null==r?void 0:r.order_number)?String(r.order_number):"");if(o)return String(o);let s=(null==(t=a.salesDetail)||null==(e=t.header)?void 0:e.shop_full_order_number)||(null==(n=a.salesDetail)||null==(i=n.header)?void 0:i.shop_order_number);return s?String(s):l||""},[a.tempOrder,a.salesDetail,l]);return n?(0,eB.jsxs)("div",{className:aj()("big-sale-dialog-header-bar",{"big-sale-dialog-header-bar--phone":"phone"===i}),children:[(0,eB.jsx)("div",{className:"big-sale-dialog-header-bar__content",children:(0,eB.jsx)("div",{className:"big-sale-dialog-header-bar__order-id",title:n,children:n})}),(0,eB.jsx)("button",{type:"button",className:"big-sale-dialog-header-bar__close","aria-label":"Close",onClick:t,children:(0,eB.jsx)(nB.Iconfont,{type:"pisell2-x-close"})})]}):null}function e4q(e){let{open:t,contentActive:l,openNonce:i,orderId:a,preloadedSalesDetail:n,createSeed:r,bookingTimeRangeFromCalendar:o,bookingConfigParams:s,onCreateSeedReady:d,onEditReady:c}=e;return(0,eB.jsx)(e4$,{open:t,contentActive:l,openNonce:i,orderId:a,preloadedSalesDetail:n,createSeed:r,bookingTimeRangeFromCalendar:o,bookingConfigParams:s,onCreateSeedReady:d,onEditReady:c})}function e4B(e){var t,l;let{open:i,contentActive:a=i,onVisualStateSettled:n,orderId:r,preloadedSalesDetail:o,resourceIdFromCalendar:s,bookingTimeRangeFromCalendar:d,createSeed:c,onClose:u,callback:p,rulesHooks:m,enableGlobalScanListener:g,title:h,preloaded:v,destroyOnUnmount:f,osKey:y="cached-dine-in-dialog",mode:b="retail",businessCode:x,bookingConfigParams:k,productDisplayConfig:_,productLoadParams:w,productCatalogReady:S=!0,orderType:j=r?void 0:"table-order",variant:N,openNonce:C=0}=e,M="phone"===N;eW(i);let T=!!r,I=T&&!M,P=(0,eN.useRef)(a);P.current=a;let A=(0,eN.useRef)(n);A.current=n;let D=String(x??"").trim()||("retail"===b?"dine_in":b),E=!(eIw(r)&&"dine_in"===D),O=h||(r?`#${r}`:"New Order"),z=(0,eN.useMemo)(()=>`${y}-${b}`,[y,b]),L=(0,eN.useCallback)(()=>{null==p||p({type:"close"}),null==u||u()},[p,u]),R=(0,eN.useCallback)(e=>{!1!==e.reset&&(null==p||p({type:e.type,data:e.data,order_id:e.order_id,reset:!0}),null==u||u())},[p,u]),$=(0,eN.useRef)(j);(!v||a)&&($.current=j);let F=v&&!a?$.current:j,q=(0,eN.useMemo)(()=>F?{type:F}:void 0,[F]),B=!!v||i,H=(0,eN.useMemo)(()=>a?(0,eB.jsx)(e4F,{onClose:L,fallbackTitle:O,variant:N}):null,[a,L,O,N]),[V,U]=(0,eN.useState)(0);(0,eN.useEffect)(()=>{a||U(0)},[a]),(0,eN.useEffect)(()=>{T||U(0)},[C,null==c||null==(t=c.row)?void 0:t.id,T]);let Y=(0,eN.useCallback)(()=>{U(e=>e+1)},[]);(0,eN.useLayoutEffect)(()=>{if(!i||"u"<typeof window)return;let e=0,t=0;return e=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>{null==n||n(!0,a)})}),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(t)}},[a,n,i]);let W=(0,eN.useCallback)(e=>{if(!e){var t;null==(t=A.current)||t.call(A,!1,P.current)}},[]),G=(0,eN.useMemo)(()=>{var e;let t=(null==o?void 0:o.customer_id)??(null==o||null==(e=o.customer)?void 0:e.id)??"anonymous",l=(null==o?void 0:o.schedule_date)??(null==o?void 0:o.booking_date)??(null==o?void 0:o.start_time)??"",i=(null==o?void 0:o.updated_at)??"",a=Array.isArray(null==w?void 0:w.menu_list_ids)?w.menu_list_ids.join(","):"";return[String(r??"new"),String(t),String(l),String(x??""),a,String(i)].join("|")},[x,r,o,w]),K=S?T?1:V:0,Q=T?`edit-${G}-p${K}`:`create-${C}-${(null==c||null==(l=c.row)?void 0:l.id)??"new"}-p${K}`,Z=i&&a,J=(0,eN.useMemo)(()=>(0,eB.jsx)(e4q,{open:Z,contentActive:a,openNonce:C,orderId:r,preloadedSalesDetail:o,createSeed:c,bookingTimeRangeFromCalendar:i&&!T?d:void 0,bookingConfigParams:k,onCreateSeedReady:Y}),[Z,a,C,r,o,c,d,i,T,k,Y]);return(0,eB.jsx)(oq,{renderType:M?"drawer":"modal",showHandlerBar:!1,onHandlerBarClick:L,props:M?{open:i,onClose:L,afterOpenChange:W,skipEnterMotion:!0,placement:"bottom",title:void 0,width:"100%",height:"95%",className:"big-sale-dialog-drawer-phone",rootClassName:"big-sale-dialog-drawer-phone-root",destroyOnClose:!1,maskClosable:!1,footer:null,closable:!1,bodyStyle:{padding:0,height:"100%",position:"relative"}}:{open:i,onCancel:L,afterOpenChange:W,skipEnterMotion:!0,title:null,width:"100%",height:"100%",className:"big-sale-dialog-modal",destroyOnClose:!1,header:!1,maskClosable:!1,footer:null,closeIcon:null,wrapClassName:"big-sale-dialog-wrapper",size:"large",styles:{content:{borderRadius:0}},bodyStyle:{padding:0,height:"100%",position:"relative"}},children:(0,eB.jsx)("div",{"aria-hidden":!i,className:aj()("big-sale-dialog-content",{"big-sale-dialog-content--inactive":!a}),children:B?(0,eB.jsx)(e4L,{osKey:y,mode:b,destroyOnUnmount:f,selectionFlowScene:"product-selection",isActive:a,enableGlobalScanListener:g,autoCreate:!1,autoBootstrap:!1,autoRestoreOnInit:!1,autoInitBookingContext:!1,orderId:r,businessCode:x,bookingConfigParams:k,resourceIdFromCalendar:i&&!T?s:void 0,bookingTimeRangeFromCalendar:i&&!T?d:void 0,productDisplayConfig:_,productLoadParams:w,productCatalogSessionKey:Q,productCatalogReady:S,hideSelectFloorMapResourceAction:E,rulesHooks:m,otherParams:q,enableTempOrderPersist:!1,preserveProductCatalogOnInactiveCustomerClear:!0,className:"pisell-big-sale--dialog-host",bootstrapSlot:J,saleDetailHeaderSlot:H,rightActionBarClose:I?L:void 0,overlaySlot:null,onOrderComplete:R},z):null})})}e4B.displayName="BigSaleDialog";let e4H=oW(e4B);function e4V(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let l=Object.keys(e),i=Object.keys(t);if(l.length!==i.length)return!1;for(let i of l)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0}function e4U(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e4V,a=(0,eN.useRef)({value:void 0,initialized:!1}),n=(0,eN.useCallback)(()=>{let e=l(),t=a.current;return t.initialized?i(t.value,e)?t.value:(t.value=e,e):(t.value=e,t.initialized=!0,e)},[i]),r=t.join("|");return LU((0,eN.useCallback)(l=>{if(!e)return()=>{};let i=t.map(t=>e.effectsOn(t,l));return()=>{for(let e of i)try{e()}catch{}}},[e,r]),n,n)}let e4Y=e=>{var t;let{runtimeRef:l}=e,i=eb$(),a=ebU();return(0,eN.useEffect)(()=>{var e,t,n,r,o;let s=null==(r=i.bookingTicket)||null==(n=r.store)||null==(t=n.bookingContext)||null==(e=t.getState)?void 0:e.call(t),d=null==s?void 0:s.date,c=d&&ew()(d).isValid()?ew()(d).format("YYYY-MM-DD"):ew()().format("YYYY-MM-DD");l.current={customerId:null==(o=a.selected)?void 0:o.id,date:c}},[i.bookingTicket,null==(t=a.selected)?void 0:t.id,l]),null},e4W=e=>{var t,l;let{children:i,uiHosts:a,...n}=e,r=eR(),o=null==r||null==(l=r.appHelper)||null==(t=l.utils)?void 0:t.action,s=(0,eN.useRef)({date:void 0,customerId:void 0}),d=(0,eN.useMemo)(()=>o?{action:o,getRuntime:()=>s.current}:void 0,[o]);return(0,eB.jsxs)(eCx,{...n,legacyOpenProductDetail:d,uiHosts:a,children:[(0,eB.jsx)(e4Y,{runtimeRef:s}),i]})},e4G={schedule_date:w=ew()().format("YYYY-MM-DD"),menu_list_ids:[44858],schedule_datetime:ew()().format(`${w} HH:mm:ss`)},e4K={orderId:97807},e4Q={loadProductsParams:{...e4G},customerId:void 0,productPicker:{variantIndex:0,num:1}},e4Z={orderId:e4K.orderId,loadProductsParams:{...e4G},customerId:void 0,productPicker:{variantIndex:0,num:1},orderNote:"SalesSdk demo note",shopDiscount:5,contactsInfo:{name:"Demo Contact",phone:"13800000000"}};function e4J(e,t){if(!t)return e;let l=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return void 0!==t}));return{...e,...l,loadProductsParams:{...e.loadProductsParams,...t.loadProductsParams||{}},productPicker:{...e.productPicker,...t.productPicker||{}}}}function e4X(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}let e40=e=>{let{sales:t,cart:l,customer:i,summary:a,products:n}=e;return(0,eB.jsxs)("section",{className:"sales-sdk-demo__panel",children:[(0,eB.jsx)("h3",{children:"Raw Snapshot"}),(0,eB.jsxs)("div",{className:"sales-sdk-demo__raw-grid",children:[(0,eB.jsx)("pre",{children:e4X({selectedCustomer:i.selected})}),(0,eB.jsx)("pre",{children:e4X({tempOrder:t.tempOrder})}),(0,eB.jsx)("pre",{children:e4X({bookings:l.bookings,items:l.items})}),(0,eB.jsx)("pre",{children:e4X({products:n})}),(0,eB.jsx)("pre",{children:e4X({summary:a})})]})]})},e42=e=>{let{entries:t,title:l="Action Log"}=e;if(!t.length)return null;let i=t[t.length-1];return(0,eB.jsxs)("section",{className:`sales-sdk-demo__panel sales-sdk-demo__panel--${i.status}`,children:[(0,eB.jsx)("h3",{children:l}),(0,eB.jsx)("div",{className:"sales-sdk-demo__action-log",children:t.map((e,t)=>(0,eB.jsx)("pre",{className:`sales-sdk-demo__action-entry sales-sdk-demo__action-entry--${e.status}`,children:e.message},t))})]})};function e41(e){let t=e.trim();if(!t)return;let l=Number(t);return Number.isFinite(l)?l:void 0}function e44(e){let{label:t,value:l,placeholder:i,onChange:a}=e;return(0,eB.jsxs)("label",{className:"sales-sdk-demo__field",children:[(0,eB.jsx)("span",{children:t}),(0,eB.jsx)("input",{value:l,placeholder:i,onChange:e=>a(e.target.value)})]})}function e43(e){let{value:t,onChange:l}=e;return(0,eB.jsx)("div",{className:"sales-sdk-demo__advanced-form",children:(0,eB.jsx)(e44,{label:"orderId",value:null!=t.orderId?String(t.orderId):"",placeholder:"使用 fixture 默认值",onChange:e=>l({...t,orderId:e41(e)})})})}function e48(e){let{value:t,onChange:l}=e,i=t.loadProductsParams||{},a=t.productPicker||{},n=e=>{l({...t,loadProductsParams:{...i,...e}})},r=e=>{l({...t,productPicker:{...a,...e}})};return(0,eB.jsxs)("div",{className:"sales-sdk-demo__advanced-form",children:[(0,eB.jsx)(e44,{label:"loadProductsParams.schedule_date",value:i.schedule_date??"",placeholder:"YYYY-MM-DD",onChange:e=>n({schedule_date:e||void 0})}),(0,eB.jsx)(e44,{label:"loadProductsParams.schedule_datetime",value:i.schedule_datetime??"",placeholder:"YYYY-MM-DD HH:mm:ss",onChange:e=>n({schedule_datetime:e||void 0})}),(0,eB.jsx)(e44,{label:"loadProductsParams.menu_list_ids",value:Array.isArray(i.menu_list_ids)?i.menu_list_ids.join(","):"",placeholder:"逗号分隔,如 44858,44859",onChange:e=>n({menu_list_ids:function(e){let t=e.trim();if(t)return t.split(/[,\s]+/).map(e=>Number(e)).filter(e=>Number.isFinite(e))}(e)})}),(0,eB.jsx)(e44,{label:"customerId",value:null!=t.customerId?String(t.customerId):"",placeholder:"缺省 = customer.list[0]",onChange:e=>{let i=e41(e);l({...t,customerId:i})}}),(0,eB.jsx)(e44,{label:"productPicker.productId",value:null!=a.productId?String(a.productId):"",placeholder:"缺省 = products[0].id",onChange:e=>r({productId:e41(e)})}),(0,eB.jsx)(e44,{label:"productPicker.variantIndex",value:null!=a.variantIndex?String(a.variantIndex):"",placeholder:"缺省 0",onChange:e=>r({variantIndex:e41(e)})}),(0,eB.jsx)(e44,{label:"productPicker.num",value:null!=a.num?String(a.num):"",placeholder:"缺省 1",onChange:e=>r({num:e41(e)})})]})}function e46(e){let{value:t,onChange:l}=e,i=void 0===t.contactsInfo?"":null===t.contactsInfo?"null":JSON.stringify(t.contactsInfo);return(0,eB.jsxs)("div",{className:"sales-sdk-demo__advanced-form sales-sdk-demo__advanced-form--meta",children:[(0,eB.jsx)(e44,{label:"orderNote(sales.setOrderNote)",value:t.orderNote??"",placeholder:"留空 = 使用 fixture 默认;填 __skip__ 跳过步骤",onChange:e=>{let i=e.trim();if("__skip__"===i||!i){let{orderNote:e,...i}=t;l(i);return}l({...t,orderNote:i})}}),(0,eB.jsx)(e44,{label:"shopDiscount(sales.setShopDiscount)",value:null!=t.shopDiscount?String(t.shopDiscount):"",placeholder:"如 5 或 5.00;填 __skip__ 跳过步骤",onChange:e=>{let i=e.trim();if("__skip__"===i||!i){let{shopDiscount:e,...i}=t;l(i);return}let a=Number(i);l({...t,shopDiscount:Number.isFinite(a)?a:i})}}),(0,eB.jsxs)("label",{className:"sales-sdk-demo__field",children:[(0,eB.jsx)("span",{children:"contactsInfo(sales.setContactsInfo,JSON)"}),(0,eB.jsx)("textarea",{className:"sales-sdk-demo__textarea",value:i,placeholder:'如 {"name":"Demo"};填 __skip__ 跳过;填 null 清空',rows:3,onChange:e=>{let i=e.target.value.trim();if("__skip__"===i||""===i){let{contactsInfo:e,...i}=t;l(i);return}if("null"===i)return void l({...t,contactsInfo:null});try{let e=JSON.parse(i);if(null===e||"object"!=typeof e||Array.isArray(e))throw Error("contactsInfo 须为 JSON 对象或 null");l({...t,contactsInfo:e})}catch{}}})]})]})}function e45(e){let{value:t,onChange:l}=e;return(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)(e44,{label:"orderId",value:null!=t.orderId?String(t.orderId):"",placeholder:"使用 fixture 默认值",onChange:e=>l({...t,orderId:e41(e)})}),(0,eB.jsx)(e46,{value:t,onChange:l}),(0,eB.jsx)(e48,{value:t,onChange:l})]})}let e47=e=>(0,eB.jsx)("div",{className:"sales-sdk-demo__advanced",children:(0,eB.jsx)(eM.Collapse,{ghost:!0,items:[{key:"adv",label:"高级配置(覆盖 fixture)",children:"detail"===e.variant?(0,eB.jsx)(e43,{value:e.value,onChange:e.onChange}):"create"===e.variant?(0,eB.jsx)(e48,{value:e.value,onChange:e.onChange}):(0,eB.jsx)(e45,{value:e.value,onChange:e.onChange})}]})}),e49=e=>{let{initialOrderId:t}=e,l=eb$(),i=ebU(),a=eNa(),n=eCN(),r=eCj(),o=(0,eN.useMemo)(()=>({...e4K,...t?{orderId:t}:{}}),[t]),[s,d]=(0,eN.useState)({}),c=(0,eN.useMemo)(()=>s?{...o,...s}:o,[o,s]),[u,p]=(0,eN.useState)([]),[m,g]=(0,eN.useState)(!1),[h,v]=(0,eN.useState)("confirmed"),[f,y]=(0,eN.useState)(!1);ewu(n.summary);let b=e=>{p(t=>[...t,e])},x=async()=>{if(!Number.isFinite(c.orderId)||c.orderId<=0)return void b({status:"error",message:"orderId 必须为正整数"});g(!0),b({status:"running",message:`loadDetail(${c.orderId}) running...`});try{let e=await l.loadDetail(c.orderId);b({status:"success",message:`loadDetail(${c.orderId}) success
|
|
56
|
+
`:"")}(f,e)+t+l},[f,g,j,o]),C=(0,eN.useMemo)(()=>({...eKp(v.primaryColor),...c?{"--booking-font-family":c}:{},..._?{"--booking-viewport-height":_}:{}}),[v.primaryColor,c,_]),M=(0,eN.useMemo)(()=>({lang:l,layout:h,presentationPlatform:o,currency:a,timeZone:n,progress:S,root:y,portal:x,background:u??y,money:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"AUD",i=new Intl.NumberFormat("en"===t?"en-AU":"zh-CN",{style:"currency",currency:l,currencyDisplay:"narrowSymbol"}),a=i.resolvedOptions().maximumFractionDigits??2,n=i.format(e/10**a);return"AUD"===l?n.replace("$","A$"):n}(e,t,a)},brand:v,design:f,fontFamily:c,brandTokens:C,scopeId:g}),[l,h,o,a,n,S,x,y,u,v,f,C,g,c]);return(0,eB.jsxs)(eKi.Provider,{value:M,children:[(0,eB.jsx)("style",{children:N}),(0,eB.jsx)("div",{ref:b,className:`booking-ui${"compact"===h?" booking-ui-compact":""} ${m}`.trim(),"data-booking-scope":g,"data-booking-presentation":o,lang:"zh"===l?"zh-CN":"en-AU",style:"kiosk"===o?{...C,height:"var(--booking-viewport-height)",minHeight:0,overflowY:"auto"}:C,children:(0,eB.jsx)(eKg,{config:v,children:t})}),"u">typeof document&&(0,oj.createPortal)((0,eB.jsx)("div",{ref:k,className:`booking-ui booking-ui-portals${"compact"===h?" booking-ui-compact":""}`,lang:"zh"===l?"zh-CN":"en-AU","data-booking-scope":g,"data-booking-presentation":o,style:C}),p??document.body)]})},eKM=e=>!!(e&&"object"==typeof e&&!Array.isArray(e));function eKT(e,t){if("string"==typeof e)return e;if(e&&"object"==typeof e&&!Array.isArray(e)){let l=e[t]??e["zh"===t?"zh-CN":"en"]??e.en;return"string"==typeof l?l:Object.values(e).find(e=>"string"==typeof e)||""}return""}function eKI(e,t){let l=eKT(e,t);if("u"<typeof DOMParser)return l.replace(/<br\s*\/?\s*>|<\/(?:p|div|li|h[1-6])>/gi,"\n").replace(/<[^>]*>/g,"").trim();if(!/[<&\r\0]/.test(l))return l.replace(/\n{3,}/g,"\n\n").trim();let i=new DOMParser().parseFromString(l,"text/html").body;return i.querySelectorAll("script, style, template").forEach(e=>e.remove()),i.querySelectorAll("br").forEach(e=>e.replaceWith("\n")),i.querySelectorAll("p, div, li, h1, h2, h3, h4, h5, h6, blockquote, tr").forEach(e=>e.append("\n")),(i.textContent||"").replace(/\n{3,}/g,"\n\n").trim()}let eKP=e=>({skuValue:{product_id:e,product_variant_id:0,option:[],bundle:[]},variantDraft:null}),eKA=e=>{var t;return(null==e||null==(t=e._extend)?void 0:t.localId)||(null==e?void 0:e.external_sale_number)||(null==e?void 0:e.order_id)||e};function eKD(e){let t=new Intl.DateTimeFormat("en-CA",{timeZone:e||void 0,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date),l=e=>{var l;return null==(l=t.find(t=>t.type===e))?void 0:l.value};return`${l("year")}-${l("month")}-${l("day")}`}function eKE(e){if(!e||"object"!=typeof e)return!1;let t=e.otherParams;return!!t&&"object"==typeof t&&"kiosk"===String((null==t?void 0:t.platform)||"").trim().toLowerCase()&&((null==t?void 0:t.venueBookingMode)==="tickets"||(null==t?void 0:t.venueBookingMode)==="party")}function eKO(e){var t,l,i;let a=e.sales.bookingTicket,n=null==a||null==(t=a.getTempOrder)?void 0:t.call(a),r=null==a||null==(l=a.getOrderCustomerSnapshot)?void 0:l.call(a);return eb7(null==n?void 0:n.customer_id,null==n||null==(i=n.customer)?void 0:i.id,null==r?void 0:r.customer_id,null==r?void 0:r.id)}function eKz(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!eKE(e.sales.bookingTicket)&&"promotion_code"!==t.reason)return null;let l=eKO(e);if(eb5(l))return null;if("promotion_code"===t.reason)return{reason:"promotion_code",currentCustomerId:l};let i=t.products?t.products.map(e=>({cacheItem:e})):e_S(e.sales.bookingTicket),a=eHB({platform:"kiosk",currentCustomerIdCandidates:[l],unassignedHolderLines:i});return!a&&t.force&&i[0]?{reason:"holder_required",product:i[0].cacheItem,currentCustomerId:l}:a}async function eKL(e){if(!e.isCurrent())return!1;let t=eKz(e.context,e);if(!t)return!0;if(!e.openCustomerAuth)throw Error("Customer sign-in is unavailable. Please try again.");let l=e.context.sales.bookingTicket,i=String(eKO(e.context)||""),a=()=>e.isCurrent()&&String(eKO(e.context)||"")===i;return await eHH({request:t,openCustomerAuth:e.openCustomerAuth,setOrderCustomer:"function"==typeof(null==l?void 0:l.setOrderCustomer)?async t=>{if(!a())return;let n=l.setOrderCustomer(t);i=String(eKO(e.context)||""),await n}:void 0,loadDiscountConfig:async()=>{a()&&(await e.context.cart.loadDiscountConfig(),a()&&e.context.cart.refreshCartSnapshot())},isActive:a})&&a()&&eb5(eKO(e.context))}let eKR=(0,eN.createContext)({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),eK$=eN.forwardRef((e,t)=>{let{alt:l,color:i,size:a,weight:n,mirrored:r,children:o,weights:s,...d}=e,{color:c="currentColor",size:u,weight:p="regular",mirrored:m=!1,...g}=eN.useContext(eKR);return eN.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:null!=a?a:u,height:null!=a?a:u,fill:null!=i?i:c,viewBox:"0 0 256 256",transform:r||m?"scale(-1, 1)":void 0,...g,...d},!!l&&eN.createElement("title",null,l),o,s.get(null!=n?n:p))});eK$.displayName="IconBase";let eKF=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232,108a12,12,0,0,0,12-12V64a20,20,0,0,0-20-20H32A20,20,0,0,0,12,64V96a12,12,0,0,0,12,12,20,20,0,0,1,0,40,12,12,0,0,0-12,12v32a20,20,0,0,0,20,20H224a20,20,0,0,0,20-20V160a12,12,0,0,0-12-12,20,20,0,0,1,0-40ZM36,170.34a44,44,0,0,0,0-84.68V68H88V188H36Zm184,0V188H112V68H220V85.66a44,44,0,0,0,0,84.68Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M200,128a32,32,0,0,0,32,32v32a8,8,0,0,1-8,8H96V56H224a8,8,0,0,1,8,8V96A32,32,0,0,0,200,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M232,104a8,8,0,0,0,8-8V64a16,16,0,0,0-16-16H32A16,16,0,0,0,16,64V96a8,8,0,0,0,8,8,24,24,0,0,1,0,48,8,8,0,0,0-8,8v32a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V160a8,8,0,0,0-8-8,24,24,0,0,1,0-48ZM32,167.2a40,40,0,0,0,0-78.4V64H88V192H32Zm192,0V192H104V64H224V88.8a40,40,0,0,0,0,78.4Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232,104a8,8,0,0,0,8-8V64a16,16,0,0,0-16-16H32A16,16,0,0,0,16,64V96a8,8,0,0,0,8,8,24,24,0,0,1,0,48,8,8,0,0,0-8,8v32a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V160a8,8,0,0,0-8-8,24,24,0,0,1,0-48ZM32,167.2a40,40,0,0,0,0-78.4V64H88V192H32Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232,102a6,6,0,0,0,6-6V64a14,14,0,0,0-14-14H32A14,14,0,0,0,18,64V96a6,6,0,0,0,6,6,26,26,0,0,1,0,52,6,6,0,0,0-6,6v32a14,14,0,0,0,14,14H224a14,14,0,0,0,14-14V160a6,6,0,0,0-6-6,26,26,0,0,1,0-52ZM30,192V165.53a38,38,0,0,0,0-75.06V64a2,2,0,0,1,2-2H90V194H32A2,2,0,0,1,30,192Zm196-26.47V192a2,2,0,0,1-2,2H102V62H224a2,2,0,0,1,2,2V90.47a38,38,0,0,0,0,75.06Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232,104a8,8,0,0,0,8-8V64a16,16,0,0,0-16-16H32A16,16,0,0,0,16,64V96a8,8,0,0,0,8,8,24,24,0,0,1,0,48,8,8,0,0,0-8,8v32a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V160a8,8,0,0,0-8-8,24,24,0,0,1,0-48ZM32,167.2a40,40,0,0,0,0-78.4V64H88V192H32Zm192,0V192H104V64H224V88.8a40,40,0,0,0,0,78.4Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232,100a4,4,0,0,0,4-4V64a12,12,0,0,0-12-12H32A12,12,0,0,0,20,64V96a4,4,0,0,0,4,4,28,28,0,0,1,0,56,4,4,0,0,0-4,4v32a12,12,0,0,0,12,12H224a12,12,0,0,0,12-12V160a4,4,0,0,0-4-4,28,28,0,0,1,0-56ZM28,192V163.78a36,36,0,0,0,0-71.56V64a4,4,0,0,1,4-4H92V196H32A4,4,0,0,1,28,192Zm168-64a36.06,36.06,0,0,0,32,35.78V192a4,4,0,0,1-4,4H100V60H224a4,4,0,0,1,4,4V92.22A36.06,36.06,0,0,0,196,128Z"}))]]),eKq=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eKF}));function eKB(){let{progress:e}=eKa(),t=(0,eN.useRef)(void 0);return(0,eN.useEffect)(()=>()=>{var e;return null==(e=t.current)?void 0:e.call(t)},[]),(0,eN.useCallback)((l,i)=>{t.current=e.moveTo(l,i)},[e])}function eKH(e){let{number:t,state:l,lang:i,className:a}=e,n=(0,eN.useRef)(null);(0,eN.useLayoutEffect)(()=>{let e=n.current;if(!e||!l.from||void 0===l.changedAt)return;let t=window.matchMedia("(prefers-reduced-motion: reduce)"),i=performance.now()-l.changedAt,a="complete"===l.status?320:240;if(t.matches||i>=a)return;let r=[],o=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a;if(!e||"function"!=typeof e.animate||i>=l)return;let n=e.animate(t,{duration:l,easing:"ease-out"});n.currentTime=i,r.push(n)},s=getComputedStyle(e);o(e,[{backgroundColor:s.getPropertyValue(`--step-${l.from}-background`).trim()},{backgroundColor:s.backgroundColor}],240),o(e,[{transform:"scale(0.8)"},..."complete"===l.status?[{opacity:1,transform:"scale(1.12)",offset:.65}]:[],{transform:"scale(1)"}]);let d=()=>r.forEach(e=>e.cancel()),c=()=>{t.matches&&d()};return t.addEventListener("change",c),()=>{d(),t.removeEventListener("change",c)}},[l]);let r={locked:"zh"===i?"不可填写":"Locked",available:"zh"===i?"可填写":"Ready to fill in",complete:"zh"===i?"已填写":"Completed"}[l.status];return(0,eB.jsx)("span",{ref:n,className:`${a} selection-step-indicator`,"data-step-status":l.status,role:"img","aria-label":"zh"===i?`第 ${t} 步:${r}`:`Step ${t}: ${r}`})}function eKV(e){let{navigation:t,title:l,description:i,children:a,summary:n,footer:r,className:o="",contentClassName:s="",stage:d,id:c}=e;return(0,eB.jsxs)("div",{id:c,className:`checkout-page booking-page ${o}`,children:[(0,eB.jsxs)("div",{className:`content checkout-grid ${s}`,children:[(0,eB.jsxs)("div",{className:"checkout-main","data-booking-scroll-root":!0,children:[t&&(0,eB.jsx)("div",{className:"booking-page-navigation","data-booking-sticky":!0,children:t}),(l||i)&&(0,eB.jsxs)("header",{className:"page-title","data-booking-stage":d,tabIndex:-1,children:[l&&(0,eB.jsx)("h1",{children:l}),i&&(0,eB.jsx)("p",{children:i})]}),!l&&!i&&d&&(0,eB.jsx)("div",{"data-booking-stage":d,tabIndex:-1}),a]}),n]}),r]})}function eKU(e){let{label:t,amount:l,formatAmount:i,total:a=!1,className:n=""}=e;return(0,eB.jsxs)("div",{className:`amount-row ${a?"total-row":"price-row"} ${n}`,children:[(0,eB.jsx)("span",{children:t}),(0,eB.jsx)("strong",{children:"number"==typeof l&&i?i(l):l})]})}eKq.displayName="TicketIcon";let eKY=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M112,56V200L40,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z"}))]]),eKW=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eKY}));eKW.displayName="ArrowLeftIcon";let eKG=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M236,128a108,108,0,0,1-216,0c0-42.52,24.73-81.34,63-98.9A12,12,0,1,1,93,50.91C63.24,64.57,44,94.83,44,128a84,84,0,0,0,168,0c0-33.17-19.24-63.43-49-77.09A12,12,0,1,1,173,29.1C211.27,46.66,236,85.48,236,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,176A72,72,0,0,1,92,65.64a8,8,0,0,1,8,13.85,56,56,0,1,0,56,0,8,8,0,0,1,8-13.85A72,72,0,0,1,128,200Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M228,128a100,100,0,0,1-200,0c0-39.4,22.9-75.37,58.33-91.63a4,4,0,1,1,3.34,7.27C57.07,58.6,36,91.71,36,128a92,92,0,0,0,184,0c0-36.29-21.07-69.4-53.67-84.36a4,4,0,1,1,3.34-7.27C205.1,52.63,228,88.6,228,128Z"}))]]),eKK=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eKG}));function eKQ(e){let{secondary:t,busy:l,children:i,disabled:a,type:n="button",className:r="",...o}=e;return(0,eB.jsxs)("button",{...o,type:n,disabled:a||l,"aria-busy":l||void 0,className:`button ${t?"secondary":""} ${r}`,children:[(0,eB.jsx)("span",{className:"booking-button-content",children:i}),l&&(0,eB.jsx)(eKK,{className:"booking-button-spinner",size:22,"aria-hidden":"true"})]})}function eKZ(e){let{type:t="button",className:l="",...i}=e;return(0,eB.jsx)("button",{...i,type:t,className:`shared-icon-button ${l}`})}function eKJ(e){var t;let{lang:l,children:i,className:a=""}=e,n=(null==(t=eKn())?void 0:t.presentationPlatform)==="kiosk",r=(0,eN.useRef)(null);return(0,eN.useLayoutEffect)(()=>{let e=r.current;if(e)return eKN(e,"--mobile-action-bar-height",n)},[n]),(0,eB.jsx)("div",{ref:r,className:`mobile-action-bar ${a}`,role:"region","aria-label":"zh"===l?"订单操作":"Order actions",children:i})}function eKX(e){let{action:t,className:l="",id:i}=e;return(0,eB.jsx)(eKQ,{id:i,className:`booking-primary-action ${l}`,disabled:t.disabled,busy:t.busy,onClick:()=>{t.onClick()},children:t.label})}function eK0(e){let{leading:t,amount:l,label:i,detail:a,action:n,actionId:r,secondaryAction:o,feedback:s}=e;return(0,eB.jsxs)("div",{className:"booking-config-footer",children:[a&&(0,eB.jsx)("div",{className:"booking-config-detail",children:a}),(0,eB.jsxs)("div",{className:"booking-config-main",children:[t&&(0,eB.jsx)("div",{className:"booking-config-leading",children:t}),(0,eB.jsxs)("div",{className:"booking-config-amount",children:[i&&(0,eB.jsx)("small",{children:i}),(0,eB.jsx)("strong",{children:l})]}),(0,eB.jsxs)("div",{className:"booking-config-actions",children:[o&&(0,eB.jsx)(eKQ,{secondary:!0,disabled:o.disabled||n.busy,busy:o.busy,onClick:()=>{o.onClick()},children:o.label}),(0,eB.jsx)(eKX,{id:r,action:{...n,label:(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("span",{className:"booking-config-action-full",children:n.label}),(0,eB.jsxs)("span",{className:"booking-config-action-compact",children:[n.compactLabel??n.label," ",(0,eB.jsx)("span",{"aria-hidden":"true",children:"\xb7"})," ",l]})]})}})]})]}),s&&(0,eB.jsx)("div",{className:"booking-config-feedback",children:s})]})}function eK2(e){let{lang:t,back:l,summary:i,action:a,feedback:n}=e;return(0,eB.jsxs)(eKJ,{lang:t,className:`booking-footer mobile-action${n?" booking-footer--with-feedback":""}`,children:[n&&(0,eB.jsx)("div",{className:"booking-footer-feedback",children:n}),l&&(l.href?(0,eB.jsx)("a",{className:"mobile-action-back",href:l.href,"aria-label":l.label,"aria-disabled":a.busy||void 0,tabIndex:a.busy?-1:void 0,onClick:e=>{a.busy?e.preventDefault():0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||l.onClick&&(e.preventDefault(),l.onClick())},children:(0,eB.jsx)(eKW,{size:20,"aria-hidden":"true"})}):(0,eB.jsx)(eKZ,{className:"mobile-action-back","aria-label":l.label,disabled:a.busy,onClick:l.onClick,children:(0,eB.jsx)(eKW,{size:20,"aria-hidden":"true"})})),i,(0,eB.jsx)(eKX,{action:a})]})}eKK.displayName="CircleNotchIcon";let eK1=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,76H180V56A52,52,0,0,0,76,56V76H48A20,20,0,0,0,28,96V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V96A20,20,0,0,0,208,76ZM100,56a28,28,0,0,1,56,0V76H100ZM204,204H52V100H204Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,96V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V96a8,8,0,0,1,8-8H208A8,8,0,0,1,216,96Z",opacity:"0.2"}),eN.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,82H174V56a46,46,0,0,0-92,0V82H48A14,14,0,0,0,34,96V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V96A14,14,0,0,0,208,82ZM94,56a34,34,0,0,1,68,0V82H94ZM210,208a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V96a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,84H172V56a44,44,0,0,0-88,0V84H48A12,12,0,0,0,36,96V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V96A12,12,0,0,0,208,84ZM92,56a36,36,0,0,1,72,0V84H92ZM212,208a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V96a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Z"}))]]),eK4=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eK1}));eK4.displayName="LockSimpleIcon";let eK3=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),eN.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),eK8=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eK3}));eK8.displayName="CaretUpIcon";let eK6=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M176.49,95.51a12,12,0,0,1,0,17l-56,56a12,12,0,0,1-17,0l-24-24a12,12,0,1,1,17-17L112,143l47.51-47.52A12,12,0,0,1,176.49,95.51ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),eK5=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eK6}));eK5.displayName="CheckCircleIcon";let eK7=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216.49,184.49l-32,32a12,12,0,0,1-17-17L179,188H48a12,12,0,0,1,0-24H179l-11.52-11.51a12,12,0,0,1,17-17l32,32A12,12,0,0,1,216.49,184.49Zm-145-64a12,12,0,0,0,17-17L77,92H208a12,12,0,0,0,0-24H77L88.49,56.49a12,12,0,0,0-17-17l-32,32a12,12,0,0,0,0,17Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,80v96H48V80Z",opacity:"0.2"}),eN.createElement("path",{d:"M213.66,181.66l-32,32a8,8,0,0,1-11.32-11.32L188.69,184H48a8,8,0,0,1,0-16H188.69l-18.35-18.34a8,8,0,0,1,11.32-11.32l32,32A8,8,0,0,1,213.66,181.66Zm-139.32-64a8,8,0,0,0,11.32-11.32L67.31,88H208a8,8,0,0,0,0-16H67.31L85.66,53.66A8,8,0,0,0,74.34,42.34l-32,32a8,8,0,0,0,0,11.32Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M42.34,85.66a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,88,48V72H208a8,8,0,0,1,0,16H88v24a8,8,0,0,1-13.66,5.66Zm171.32,84.68-32-32A8,8,0,0,0,168,144v24H48a8,8,0,0,0,0,16H168v24a8,8,0,0,0,13.66,5.66l32-32A8,8,0,0,0,213.66,170.34Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M212.24,171.76a6,6,0,0,1,0,8.48l-32,32a6,6,0,0,1-8.48-8.48L193.51,182H48a6,6,0,0,1,0-12H193.51l-21.75-21.76a6,6,0,0,1,8.48-8.48ZM75.76,116.24a6,6,0,0,0,8.48-8.48L62.49,86H208a6,6,0,0,0,0-12H62.49L84.24,52.24a6,6,0,0,0-8.48-8.48l-32,32a6,6,0,0,0,0,8.48Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M213.66,181.66l-32,32a8,8,0,0,1-11.32-11.32L188.69,184H48a8,8,0,0,1,0-16H188.69l-18.35-18.34a8,8,0,0,1,11.32-11.32l32,32A8,8,0,0,1,213.66,181.66Zm-139.32-64a8,8,0,0,0,11.32-11.32L67.31,88H208a8,8,0,0,0,0-16H67.31L85.66,53.66A8,8,0,0,0,74.34,42.34l-32,32a8,8,0,0,0,0,11.32Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M210.83,173.17a4,4,0,0,1,0,5.66l-32,32a4,4,0,0,1-5.66-5.66L198.34,180H48a4,4,0,0,1,0-8H198.34l-25.17-25.17a4,4,0,0,1,5.66-5.66ZM77.17,114.83a4,4,0,0,0,5.66-5.66L57.66,84H208a4,4,0,0,0,0-8H57.66L82.83,50.83a4,4,0,0,0-5.66-5.66l-32,32a4,4,0,0,0,0,5.66Z"}))]]),eK9=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eK7}));function eQe(e){let{number:t,stepStatus:l,title:i,children:a,summary:n,open:r,onToggle:o,id:s,lang:d,locked:c=!1,completing:u=!1,className:p=""}=e,m=r||!n,g=m?"zh"===d?"收起":"Done":"zh"===d?"切换":"Change";return(0,eB.jsxs)("section",{className:`selection-section ${p}`,id:s,tabIndex:-1,"aria-labelledby":`${s}-title`,children:[(0,eB.jsxs)("div",{className:"selection-section-heading",children:[l?(0,eB.jsx)(eKH,{number:t,state:l,lang:d,className:"checkout-module-number"}):(0,eB.jsx)("span",{className:"checkout-module-number","aria-hidden":"true",children:t}),(0,eB.jsx)("h2",{id:`${s}-title`,children:i}),c&&!l&&(0,eB.jsx)(eK4,{size:18,"aria-label":"zh"===d?"已锁定":"Locked"}),m&&n&&(0,eB.jsx)(eKZ,{className:"selection-section-toggle",onClick:o,disabled:c,"aria-label":`${g} \xb7 ${i}`,"aria-expanded":!0,"aria-controls":`${s}-content`,children:(0,eB.jsx)(eK8,{size:20,"aria-hidden":"true"})})]}),(0,eB.jsx)("div",{id:`${s}-content`,children:m?a:(0,eB.jsxs)("button",{type:"button",className:`selection-section-summary${u?" is-completing":""}`,onClick:o,disabled:c,"aria-label":`${g} \xb7 ${i}`,"aria-describedby":`${s}-summary-copy`,"aria-expanded":!1,"aria-controls":`${s}-content`,children:[(0,eB.jsx)("span",{className:"selection-section-summary-copy",id:`${s}-summary-copy`,children:n}),(0,eB.jsxs)("span",{className:"selection-summary-status","aria-hidden":"true",children:[(0,eB.jsx)(eK5,{className:"selection-summary-check",size:24,weight:"fill"}),(0,eB.jsx)(eK9,{className:"selection-summary-change",size:21,weight:"bold"})]})]})})]})}eK9.displayName="ArrowsLeftRightIcon";let eQt=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M233.21,56.31A12,12,0,0,0,224,52H66L60.53,21.85A12,12,0,0,0,48.73,12H24a12,12,0,0,0,0,24H38.71L63.62,173a28,28,0,0,0,4.07,10.21A32,32,0,1,0,123,196h34a32,32,0,1,0,31-24H91.17a4,4,0,0,1-3.93-3.28L84.92,156H196.1a28,28,0,0,0,27.55-23l12.16-66.86A12,12,0,0,0,233.21,56.31ZM100,204a8,8,0,1,1-8-8A8,8,0,0,1,100,204Zm88,8a8,8,0,1,1,8-8A8,8,0,0,1,188,212Zm12-83.28A4,4,0,0,1,196.1,132H80.56L70.38,76H209.62Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,64l-12.16,66.86A16,16,0,0,1,196.1,144H70.55L56,64Z",opacity:"0.2"}),eN.createElement("path",{d:"M230.14,58.87A8,8,0,0,0,224,56H62.68L56.6,22.57A8,8,0,0,0,48.73,16H24a8,8,0,0,0,0,16h18L67.56,172.29a24,24,0,0,0,5.33,11.27,28,28,0,1,0,44.4,8.44h45.42A27.75,27.75,0,0,0,160,204a28,28,0,1,0,28-28H91.17a8,8,0,0,1-7.87-6.57L80.13,152h116a24,24,0,0,0,23.61-19.71l12.16-66.86A8,8,0,0,0,230.14,58.87ZM104,204a12,12,0,1,1-12-12A12,12,0,0,1,104,204Zm96,0a12,12,0,1,1-12-12A12,12,0,0,1,200,204Zm4-74.57A8,8,0,0,1,196.1,136H77.22L65.59,72H214.41Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M230.14,58.87A8,8,0,0,0,224,56H62.68L56.6,22.57A8,8,0,0,0,48.73,16H24a8,8,0,0,0,0,16h18L67.56,172.29a24,24,0,0,0,5.33,11.27,28,28,0,1,0,44.4,8.44h45.42A27.75,27.75,0,0,0,160,204a28,28,0,1,0,28-28H91.17a8,8,0,0,1-7.87-6.57L80.13,152h116a24,24,0,0,0,23.61-19.71l12.16-66.86A8,8,0,0,0,230.14,58.87ZM104,204a12,12,0,1,1-12-12A12,12,0,0,1,104,204Zm96,0a12,12,0,1,1-12-12A12,12,0,0,1,200,204Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M228.61,60.16A6,6,0,0,0,224,58H61L54.63,22.93A6,6,0,0,0,48.73,18H24a6,6,0,0,0,0,12H43.72L69.53,171.94a21.93,21.93,0,0,0,6.24,11.77A26,26,0,1,0,113.89,190h52.22A26,26,0,1,0,188,178H91.17a10,10,0,0,1-9.84-8.21L77.73,150H196.1a22,22,0,0,0,21.65-18.06L229.9,65.07A6,6,0,0,0,228.61,60.16ZM106,204a14,14,0,1,1-14-14A14,14,0,0,1,106,204Zm96,0a14,14,0,1,1-14-14A14,14,0,0,1,202,204Zm3.94-74.21A10,10,0,0,1,196.1,138H75.55L63.19,70H216.81Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M230.14,58.87A8,8,0,0,0,224,56H62.68L56.6,22.57A8,8,0,0,0,48.73,16H24a8,8,0,0,0,0,16h18L67.56,172.29a24,24,0,0,0,5.33,11.27,28,28,0,1,0,44.4,8.44h45.42A27.75,27.75,0,0,0,160,204a28,28,0,1,0,28-28H91.17a8,8,0,0,1-7.87-6.57L80.13,152h116a24,24,0,0,0,23.61-19.71l12.16-66.86A8,8,0,0,0,230.14,58.87ZM104,204a12,12,0,1,1-12-12A12,12,0,0,1,104,204Zm96,0a12,12,0,1,1-12-12A12,12,0,0,1,200,204Zm4-74.57A8,8,0,0,1,196.1,136H77.22L65.59,72H214.41Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M227.07,61.44A4,4,0,0,0,224,60H59.34L52.66,23.28A4,4,0,0,0,48.73,20H24a4,4,0,0,0,0,8H45.39l6.69,36.8h0L71.49,171.58A20,20,0,0,0,79,183.85,24,24,0,1,0,109.87,188h60.26A24,24,0,1,0,188,180H91.17a12,12,0,0,1-11.8-9.85l-4-22.15H196.1a20,20,0,0,0,19.68-16.42l12.16-66.86A4,4,0,0,0,227.07,61.44ZM108,204a16,16,0,1,1-16-16A16,16,0,0,1,108,204Zm96,0a16,16,0,1,1-16-16A16,16,0,0,1,204,204Zm3.91-73.85A12,12,0,0,1,196.1,140H73.88L60.79,68H219.21Z"}))]]),eQl=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eQt}));eQl.displayName="ShoppingCartIcon";let eQi=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),eN.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]),eQa=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eQi}));eQa.displayName="XIcon";let eQn=[],eQr=new WeakMap,eQo="",eQs=new Map,eQd=".pisell-sku-options-modal[role='dialog'], .pisell-sku-options-modal [role='dialog'], .pisell-lookup-modal-container[role='dialog'], .pisell-lookup-modal-container [role='dialog'], .pisell-lookup-drawer-container[role='dialog'], .pisell-lookup-drawer-container [role='dialog'], .ant-modal-root [role='dialog'], .ant-drawer [role='dialog'], .pisell-pc-modal [role='dialog'], .pisell-mobile-modal [role='dialog'], .pisell-lowcode-floating-layer-root [role='dialog'], .sales-sdk-allergy-modal [role='dialog'], .numeric-stepper-keyboard-popover, .numeric-stepper-keyboard-modal";function eQc(){eQn.forEach((e,t)=>{e.inert=t!==eQn.length-1,e.style.zIndex=String((eQr.get(e)??1e3)+t)})}function eQu(e){let{title:t,children:l,onClose:i,closeLabel:a,wide:n=!1,className:r="",initialFocus:o,open:s=!0,footer:d,intro:c,bodyClassName:u="",footerClassName:p="",mobile:m="sheet",bodyRef:g,closeDisabled:h=!1,closeOnBackdrop:v=!0,closeOnEscape:f=!0,style:y,portal:b,zIndex:x,externalDialogSelector:k}=e,_=eKn(),w=dL("booking-dialog"),S=(0,eN.useRef)(null),j=(0,eN.useRef)(null),N=(0,eN.useRef)(i);N.current=()=>{h||i()};let C=(0,eN.useRef)(f);if(C.current=f,(0,eN.useEffect)(()=>{if(!s||!S.current||!j.current)return;let e=S.current,t=j.current,l=document.activeElement,i=(null==_?void 0:_.background)&&!_.background.contains(e)?_.background:null;if(eQn.length||(eQo=document.body.style.overflow,document.body.style.overflow="hidden"),i){let e=eQs.get(i)??{count:0,inert:i.inert};e.count++,eQs.set(i,e),i.inert=!0}void 0!==x&&eQr.set(e,x),eQn.push(e),eQc();let a=e=>{if(!e.getClientRects().length||e.closest('[inert], [aria-hidden="true"]'))return!1;let t=window.getComputedStyle(e);return"hidden"!==t.visibility&&"none"!==t.display},n=e=>{let t=e,l=0;for(;t;){let e=parseInt(window.getComputedStyle(t).zIndex,10);Number.isFinite(e)&&(l=Math.max(l,e)),t=t.parentElement}return l},r=()=>{if(!k)return t;let l=Array.from(document.querySelectorAll(k)).filter(l=>!t.contains(l)&&a(l)&&n(l)>n(e)).sort((e,t)=>n(e)-n(t));return l[l.length-1]||t},d=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r();return Array.from(e.querySelectorAll('button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), summary, a[href], [tabindex="0"]')).filter(e=>e.tabIndex>=0&&e.getClientRects().length>0&&!e.closest("[inert]"))},c=()=>{let e=r(),l=e===t&&o&&t.querySelector(o);e.hasAttribute("tabindex")||(e.tabIndex=-1),(l||d(e)[0]||e).focus({preventScroll:!0})},u=requestAnimationFrame(()=>{eQn[eQn.length-1]===e&&c()}),p=l=>{if(eQn[eQn.length-1]!==e)return;let i=r(),n=document.activeElement instanceof HTMLElement&&document.activeElement.closest(".ant-select-dropdown, .ant-picker-dropdown"),o="Escape"===l.key&&Array.from(document.querySelectorAll(".ant-select-dropdown, .ant-picker-dropdown")).some(e=>{if(!a(e))return!1;let t=e;for(;t;){let e=window.getComputedStyle(t);if("hidden"===e.visibility||"none"===e.display||"0"===e.opacity)return!1;t=t.parentElement}return!0});if(("Escape"!==l.key||!o)&&("Tab"!==l.key||!n)&&("Escape"===l.key&&i===t&&(l.preventDefault(),l.stopImmediatePropagation(),C.current&&N.current()),"Tab"===l.key)){let e=d(),t=e[0],a=e[e.length-1];if(!t){l.preventDefault(),i.focus();return}l.shiftKey&&(document.activeElement===t||!i.contains(document.activeElement))?(l.preventDefault(),null==a||a.focus()):l.shiftKey||document.activeElement!==a&&i.contains(document.activeElement)||(l.preventDefault(),t.focus())}},m=null,g=l=>{let i=l.target;i instanceof HTMLElement&&t.contains(i)&&(m=i),!(i instanceof HTMLElement&&i.closest(".ant-select-dropdown, .ant-picker-dropdown"))&&(eQn[eQn.length-1]!==e||r().contains(i)||c())},h=0,v=t,f=k?new MutationObserver(()=>{cancelAnimationFrame(h),h=requestAnimationFrame(()=>{if(eQn[eQn.length-1]!==e)return;let l=r();l===v||l.contains(document.activeElement)||(l===t&&(null==m?void 0:m.isConnected)&&a(m)?m.focus({preventScroll:!0}):c()),v=l})}):null;return null==f||f.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","aria-hidden"]}),document.addEventListener("keydown",p,!0),document.addEventListener("focusin",g),()=>{if(cancelAnimationFrame(u),cancelAnimationFrame(h),null==f||f.disconnect(),document.removeEventListener("keydown",p,!0),document.removeEventListener("focusin",g),eQn.splice(eQn.indexOf(e),1),eQr.delete(e),eQc(),eQn.length||(document.body.style.overflow=eQo),i){let e=eQs.get(i);0==--e.count&&(i.inert=e.inert,eQs.delete(i))}(null==l?void 0:l.isConnected)&&!l.closest("[inert]")&&l.focus({preventScroll:!0})}},[s,null==_?void 0:_.portal,null==_?void 0:_.background,b,x,k]),"u"<typeof document||void 0===b&&_&&!_.portal)return null;let M=(0,eB.jsx)("div",{ref:S,hidden:!s,style:s?void 0:{display:"none"},className:`modal-backdrop ${"calendar-modal"===r?"calendar-backdrop":""}`,onMouseDown:e=>{v&&e.target===e.currentTarget&&eQn[eQn.length-1]===S.current&&N.current()},children:(0,eB.jsxs)("div",{ref:j,style:y,"data-booking-scroll-root":!0,className:`modal ${n?"wide":""} ${r} ${d?`dialog-framed dialog-${m}`:""}`,role:"dialog","aria-modal":"true","aria-labelledby":w,tabIndex:-1,children:[(0,eB.jsxs)("div",{className:"modal-heading",children:[(0,eB.jsx)("h2",{id:w,children:t}),(0,eB.jsx)(eKZ,{type:"button",className:"icon-button","aria-label":a,disabled:h,onClick:()=>N.current(),children:(0,eB.jsx)(eQa,{size:23})})]}),d?(0,eB.jsxs)(eB.Fragment,{children:[c&&(0,eB.jsx)("div",{className:"dialog-intro",children:c}),(0,eB.jsx)("div",{ref:g,className:`dialog-body ${u}`,tabIndex:0,role:"region","aria-labelledby":w,children:l}),(0,eB.jsx)("div",{className:`dialog-footer ${p}`,children:d})]}):l]})}),T=_&&(!1===b||null!=b&&b!==_.portal)?(0,eB.jsx)("div",{className:`booking-ui booking-ui-portals${"compact"===_.layout?" booking-ui-compact":""}`,"data-booking-scope":_.scopeId,"data-booking-presentation":_.presentationPlatform,lang:"zh"===_.lang?"zh-CN":"en-AU",style:_.brandTokens,children:M}):M;return!1===b?T:(0,oj.createPortal)(T,b??(null==_?void 0:_.portal)??document.body)}function eQp(e){let{current:t,steps:l,label:i,currentLabel:a}=e;return(0,eB.jsx)("nav",{"data-booking-sticky":!0,className:"booking-navigation","aria-label":i,children:(0,eB.jsx)("ol",{className:"steps interactive-steps",style:{"--step-count":Math.max(1,l.length),"--step-progress":l.length>1?Math.max(0,Math.min(t,l.length-1))/(l.length-1):0},children:l.map((e,l)=>{let i=l===t,n="skipped"===e.status&&!i,r="available"!==e.status;return(0,eB.jsx)("li",{className:`${i?"active":n?"skipped":l<t?"done":""} ${r&&!n?"locked":""}`,children:(0,eB.jsxs)("button",{type:"button","aria-label":e.ariaLabel??e.label,"aria-current":i?"step":void 0,disabled:r&&!i,title:i?a:e.hint,onClick:()=>{var t;i||r||null==(t=e.onClick)||t.call(e)},children:[(0,eB.jsx)("span",{className:"step-number","aria-hidden":"true",children:n?"–":l+1}),(0,eB.jsxs)("span",{className:"step-label",children:[r&&!n&&!i&&(0,eB.jsx)(eK4,{size:13,"aria-hidden":"true"}),(0,eB.jsx)("b",{className:"step-full-label",children:e.label}),(0,eB.jsx)("b",{className:"step-short-label",children:e.shortLabel??e.label})]})]})},e.id)})})})}function eQm(e){let{panel:t,title:l,closeLabel:i,header:a,body:n,footer:r,decoration:o}=e,s=eKn(),d=(0,eN.useRef)(null);(0,eN.useLayoutEffect)(()=>{let e=d.current;if(t.isMobile||!e)return;let l=0,i=()=>{let t=parseFloat(getComputedStyle(e).getPropertyValue("--summary-decoration-bleed"))||0,l=parseFloat(getComputedStyle(e).getPropertyValue("--summary-sticky-offset"))||22,i=Math.max(240,window.innerHeight-Math.max(l,e.getBoundingClientRect().top)-l-t),a=`${Math.floor(i)}px`;e.style.getPropertyValue("--summary-available-height")!==a&&e.style.setProperty("--summary-available-height",a)},a=()=>{cancelAnimationFrame(l),l=requestAnimationFrame(i)},n=new ResizeObserver(a);return n.observe(e),window.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a),i(),()=>{cancelAnimationFrame(l),n.disconnect(),window.removeEventListener("scroll",a),window.removeEventListener("resize",a)}},[t.isMobile,null==s?void 0:s.design]);let c=(0,eB.jsxs)(eB.Fragment,{children:[a,(0,eB.jsx)("div",{className:"order-summary-scroll",tabIndex:0,role:"region","aria-label":l,children:n}),(0,eB.jsx)("div",{className:"order-summary-footer",children:r})]});return t.isMobile?(0,eB.jsx)(eQu,{title:l,open:t.open,onClose:t.close,closeLabel:i,className:"order-summary-sheet",zIndex:600,externalDialogSelector:eQd,children:c}):(0,eB.jsxs)("aside",{ref:d,className:"order-summary booking-order-summary",children:[(0,eB.jsx)("h2",{children:l}),c,o]})}function eQg(e){let{panel:t,title:l,label:i,total:a,count:n}=e;return(0,eB.jsx)("button",{type:"button",className:`order-panel-trigger ${void 0!==n?"has-count":""}`,"aria-label":`${l} \xb7 ${a}`,"aria-haspopup":"dialog","aria-expanded":t.open,onClick:t.show,children:void 0!==n?(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)("span",{className:"summary-trigger-count","aria-hidden":"true",children:[(0,eB.jsx)(eQl,{size:25}),(0,eB.jsx)("b",{children:n})]}),(0,eB.jsxs)("span",{className:"summary-trigger-content",children:[(0,eB.jsx)("strong",{children:a}),(0,eB.jsxs)("small",{children:[i,(0,eB.jsx)(eK8,{size:13,"aria-hidden":"true"})]})]})]}):(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)("span",{children:[(0,eB.jsx)(eQl,{size:16,"aria-hidden":"true"}),i,(0,eB.jsx)(eK8,{size:13,"aria-hidden":"true"})]}),(0,eB.jsx)("strong",{children:a})]})})}let eQh=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,28H188V24a12,12,0,0,0-24,0v4H92V24a12,12,0,0,0-24,0v4H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28ZM68,52a12,12,0,0,0,24,0h72a12,12,0,0,0,24,0h16V76H52V52ZM52,204V100H204V204Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,48V88H40V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z",opacity:"0.2"}),eN.createElement("path",{d:"M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,48H48V48H72v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,34H182V24a6,6,0,0,0-12,0V34H86V24a6,6,0,0,0-12,0V34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34ZM48,46H74V56a6,6,0,0,0,12,0V46h84V56a6,6,0,0,0,12,0V46h26a2,2,0,0,1,2,2V82H46V48A2,2,0,0,1,48,46ZM208,210H48a2,2,0,0,1-2-2V94H210V208A2,2,0,0,1,208,210Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,36H180V24a4,4,0,0,0-8,0V36H84V24a4,4,0,0,0-8,0V36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36ZM48,44H76V56a4,4,0,0,0,8,0V44h88V56a4,4,0,0,0,8,0V44h28a4,4,0,0,1,4,4V84H44V48A4,4,0,0,1,48,44ZM208,212H48a4,4,0,0,1-4-4V92H212V208A4,4,0,0,1,208,212Z"}))]]),eQv=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eQh}));eQv.displayName="CalendarBlankIcon";let eQf=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M160,48V208L80,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61ZM152,188.69,91.31,128,152,67.31Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M168,48V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,168,48Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M164.24,203.76a6,6,0,1,1-8.48,8.48l-80-80a6,6,0,0,1,0-8.48l80-80a6,6,0,0,1,8.48,8.48L88.49,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M162.83,205.17a4,4,0,0,1-5.66,5.66l-80-80a4,4,0,0,1,0-5.66l80-80a4,4,0,1,1,5.66,5.66L85.66,128Z"}))]]),eQy=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eQf}));eQy.displayName="CaretLeftIcon";let eQb=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M176,128,96,208V48Z",opacity:"0.2"}),eN.createElement("path",{d:"M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z"}))]]),eQx=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eQb}));eQx.displayName="CaretRightIcon";let eQk="Australia/Sydney";function eQ_(e){let t,l=Intl.Locale;try{var i,a;let n=l?new l(e):void 0;t=(null==n||null==(i=n.getWeekInfo)?void 0:i.call(n).firstDay)??(null==n||null==(a=n.weekInfo)?void 0:a.firstDay)}catch{}return void 0===t?+("en-US"!==e):t%7}function eQw(e){if("string"!=typeof e||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=new Date(`${e}T12:00:00Z`);return Number.isFinite(t.getTime())&&t.toISOString().slice(0,10)===e}function eQS(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eQk,l=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(e);return["year","month","day"].map(e=>l.find(t=>t.type===e).value).join("-")}function eQj(e,t){let l=new Date(`${e}T12:00:00Z`);return l.setUTCDate(l.getUTCDate()+t),l.toISOString().slice(0,10)}function eQN(e,t){let l=new Date(`${e}T12:00:00Z`).getUTCDay();return eQj(e,-((l-t+7)%7))}function eQC(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eQS(),l=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;return eQw(e)&&e>=t&&(void 0===l||e<=l)&&!(null==i?void 0:i(e))}function eQM(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{weekday:"long",year:"numeric",month:"long",day:"numeric"};return new Intl.DateTimeFormat(t,{...l,timeZone:"UTC"}).format(new Date(`${e}T12:00:00Z`))}function eQT(e){let{locale:t,firstDay:l,today:i,month:a,selected:n,minDate:r,maxDate:o,viewEnd:s,disabled:d,allowed:c,onMonthChange:u,onSelect:p,t:m}=e,g=(0,eN.useRef)(null),h=(0,eN.useRef)(),[v,f]=(0,eN.useState)(n);(0,eN.useLayoutEffect)(()=>{var e;let t=null==(e=g.current)?void 0:e.querySelector(".venue-booking-picker-panel");t&&(t.tabIndex=-1)},[]);let y=(0,eN.useMemo)(()=>{let e=t.startsWith("zh"),i=e?eyA:eyD,a=`venue-booking-${e?"zh":"en"}-week-${l}`;return ew().locale({...e?Qm():Qh(),name:a,weekStart:l},void 0,!0),{...i,lang:{...i.lang,locale:a,shortWeekDays:Array.from({length:7},(e,l)=>eQM(eQj("2023-01-01",l),t,{weekday:"short"}))}}},[t,l]),b=ew()(a).locale(y.lang.locale),x=e=>e.slice(0,7)===a.slice(0,7),k=e=>x(e)&&c(e),_=r.slice(0,7),w=null==o?void 0:o.slice(0,7),S=e=>{d||e.slice(0,7)<_||w&&e.slice(0,7)>w||u(`${e.slice(0,7)}-01`)},j=eQN(a,l),N=Array.from({length:42},(e,t)=>eQj(j,t)).filter(x),C=N.includes(v)&&c(v)?v:N.includes(n)&&c(n)?n:N.find(c);(0,eN.useEffect)(()=>{var e,t;let l=h.current;if(!l||!N.includes(l))return;let i=c(l)?l:N.find(e=>e>=l&&c(e))||N.find(c);i&&(h.current=void 0,f(i),null==(t=g.current)||null==(e=t.querySelector(`[data-calendar-day="${i}"]`))||e.focus())});let M=Number(r.slice(0,4)),T=Array.from({length:Math.max(1,(o?Number(o.slice(0,4)):Math.max(M+10,Number(s.slice(0,4)),b.year()))-M+1)},(e,t)=>M+t);return(0,eB.jsx)("div",{ref:g,lang:t,onFocusCapture:e=>{var t,l;e.target.classList.contains("venue-booking-picker-panel")&&C&&(null==(l=g.current)||null==(t=l.querySelector(`[data-calendar-day="${C}"]`))||t.focus())},onKeyDownCapture:e=>{e.target.classList.contains("venue-booking-picker-panel")&&["Enter"," ","PageUp","PageDown","Home","End","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)&&(e.preventDefault(),e.stopPropagation())},children:(0,eB.jsx)(eM.ConfigProvider,{locale:{locale:t,Calendar:y},children:(0,eB.jsx)(eM.Calendar,{prefixCls:"venue-booking-picker",className:"venue-booking-calendar",fullscreen:!1,mode:"month",locale:y,value:b,disabledDate:e=>!k(e.format("YYYY-MM-DD")),onPanelChange:e=>S(e.format("YYYY-MM-DD")),onSelect:(e,t)=>{let l=e.format("YYYY-MM-DD");"date"===t.source&&k(l)&&p(l)},headerRender:()=>(0,eB.jsxs)("div",{className:"venue-booking-calendar-header",children:[(0,eB.jsx)("button",{type:"button",className:"icon-button","aria-label":m("previousMonth"),disabled:d||b.format("YYYY-MM")<=_,onClick:()=>S(b.subtract(1,"month").format("YYYY-MM-DD")),children:(0,eB.jsx)(eQy,{size:18,"aria-hidden":"true"})}),(0,eB.jsxs)("div",{className:"venue-booking-calendar-dropdowns",children:[(0,eB.jsx)("select",{"aria-label":m("calendarMonth"),value:b.month(),disabled:d,onChange:e=>S(b.month(Number(e.target.value)).format("YYYY-MM-DD")),children:Array.from({length:12},(e,l)=>{let i=b.month(l).format("YYYY-MM-DD");return(0,eB.jsx)("option",{value:l,disabled:i.slice(0,7)<_||!!(w&&i.slice(0,7)>w),children:eQM(i,t,{month:"long"})},l)})}),(0,eB.jsx)("select",{"aria-label":m("calendarYear"),value:b.year(),disabled:d,onChange:e=>{let t=b.year(Number(e.target.value)).format("YYYY-MM-DD");t.slice(0,7)<_&&(t=r),o&&t.slice(0,7)>w&&(t=o),S(t)},children:T.map(e=>(0,eB.jsx)("option",{value:e,children:e},e))})]}),(0,eB.jsx)("button",{type:"button",className:"icon-button","aria-label":m("nextMonth"),disabled:d||!!(w&&b.format("YYYY-MM")>=w),onClick:()=>S(b.add(1,"month").format("YYYY-MM-DD")),children:(0,eB.jsx)(eQx,{size:18,"aria-hidden":"true"})})]}),fullCellRender:e=>{let a=e.format("YYYY-MM-DD");if(!x(a))return null;let s=a===n;return(0,eB.jsx)("button",{type:"button","data-calendar-day":a,className:`venue-booking-calendar-day ${s?"is-selected":""} ${a===i?"is-today":""}`,disabled:!k(a),tabIndex:a===C?0:-1,"aria-label":eQM(a,t),"aria-pressed":s,"aria-current":a===i?"date":void 0,onFocus:()=>f(a),onKeyDown:t=>{if("Enter"===t.key||" "===t.key){t.preventDefault(),t.stopPropagation(),k(a)&&p(a);return}if("PageUp"===t.key||"PageDown"===t.key){t.preventDefault(),t.stopPropagation();let l=e.add("PageUp"===t.key?-1:1,"month").format("YYYY-MM-DD");if(l<r||o&&l>o)return;h.current=l,f(l),S(l);return}let i={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7,Home:-((e.day()-l+7)%7),End:6-(e.day()-l+7)%7};if(!(t.key in i))return;t.preventDefault(),t.stopPropagation();let n=eQj(a,i[t.key]),s=i[t.key]<0?-1:1;for(;N.includes(n)&&!c(n);)n=eQj(n,s);n===a||n<r||o&&n>o||(N.includes(n)||S(n),h.current=n,f(n))},children:e.date()})}})})})}function eQI(e){var t,l,i;let{value:a,onChange:n,locale:r,title:o,description:s,stepNumber:d,stepStatus:c,timeZone:u=eQk,todayMarker:p="venue",minDate:m,maxDate:g,isUnavailable:h,dateStates:v={},onVisibleDatesChange:f,onInteraction:y,disabled:b=!1,loading:x=!1,allowEmpty:k=!1,t:_}=e,w=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eQk,t=()=>{let t=new Date;return{venue:eQS(t,e),device:`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}},[l,i]=(0,eN.useState)(t);return(0,eN.useEffect)(()=>{let e=()=>{let e=t();i(t=>t.venue===e.venue&&t.device===e.device?t:e)};e();let l=window.setInterval(e,1e3);return window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{clearInterval(l),window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[e]),l}(u),S=w.venue,j="device"===p?w.device:S,N=m||S,C=eQj(eQw(a)&&a>N?a:N,180),[M,T]=(0,eN.useState)(C),I=g||(M>C?M:C),P=e=>{if(g)return;let t=eQj(e,180);T(e=>e>t?e:t)},A=eQ_(r),D=(0,eN.useMemo)(()=>(function(e,t,l){let i=[];for(let a=eQN(e,l);a<=t;a=eQj(a,7))i.push(a);return i})(N,I,A),[N,I,A]),E=eQN(eQw(a)?a:S,A),O=Math.max(0,Math.min(D.length-1,D.findIndex(e=>e===E))),[z,L]=(0,eN.useState)(O),R=Math.max(0,Math.min(z,D.length-1)),$=(0,eN.useRef)(R);$.current=R;let[F,q]=(0,eN.useState)(!1),[B,H]=(0,eN.useState)(()=>(eQw(a)?a:S).slice(0,7)+"-01"),[V,U]=(0,eN.useState)(a),Y=(0,eN.useRef)(null),W=(0,eN.useRef)(void 0),G=(0,eN.useRef)(null),K=(0,eN.useRef)(0),Q=(0,eN.useRef)(),Z=dL("booking-date-title"),J=dL("booking-date-description"),X=dL("booking-date-error"),ee=D[R]||eQN(N,A);(0,eN.useEffect)(()=>{!g&&R>=D.length-4&&P(I)},[g,R,D.length,I]);let et=(0,eN.useMemo)(()=>{let e;if(F){let t=`${B.slice(0,7)}-01`;e=Array.from({length:31},(e,l)=>eQj(t,l)).filter(e=>e.slice(0,7)===B.slice(0,7))}else e=Array.from({length:7},(e,t)=>eQj(ee,t)),eQw(a)&&e.push(a);return Array.from(new Set(e)).filter(e=>e>=N&&(void 0===g||e<=g)).sort()},[ee,F,B,u,A,a,N,g]),el=et.join(","),ei=(0,eN.useRef)(f);ei.current=f,(0,eN.useEffect)(()=>{var e;null==(e=ei.current)||e.call(ei,et)},[el]);let ea=x||et.some(e=>!v[e]||"loading"===v[e].status),en=et.some(e=>{var t;return(null==(t=v[e])?void 0:t.status)==="error"}),er=new Map,eo=e=>{var t,l;return er.has(e)||er.set(e,!b&&!x&&((null==(t=v[e])?void 0:t.status)==="available"||(null==(l=v[e])?void 0:l.status)==="configuration")&&eQC(e,N,g,h)),er.get(e)};(0,eN.useEffect)(()=>{let e=Q.current;if(!e||b||x||!v[e]||"loading"===v[e].status)return;let t=Array.from({length:7},(e,t)=>eQj(ee,t));if(!t.includes(e)){Q.current=void 0;return}let l=eo(e)?e:t.find(eo);if(!(!l&&t.some(e=>e>=N&&(void 0===g||e<=g)&&(!v[e]||"loading"===v[e].status)))&&(Q.current=void 0,l)){var i,a;U(l),null==(a=Y.current)||null==(i=a.querySelector(`[data-booking-day="${l}"]`))||i.focus({preventScroll:!0})}},[v,ee,b,x,h,N,g]);let es=x||!v[a]||"loading"===v[a].status,ed=!x&&!(k&&!a)&&(!eQC(a,N,g)||!es&&((null==(t=v[a])?void 0:t.status)==="unavailable"||((null==(l=v[a])?void 0:l.status)==="available"||(null==(i=v[a])?void 0:i.status)==="configuration")&&(null==h?void 0:h(a)))),ec=e=>Math.floor((new Date(`${e}T12:00:00Z`).getTime()-new Date(`${D[0]||eQN(N,A)}T12:00:00Z`).getTime())/6048e5),eu=function(e){var t;let l=!(arguments.length>1)||void 0===arguments[1]||arguments[1];e=Math.max(0,g?Math.min(D.length-1,e):e),!g&&e>=D.length-4&&P(eQj(D[0]||eQN(N,A),7*e+6)),$.current=e,L(e),null==(t=Y.current)||t.scrollTo({left:e*Y.current.clientWidth,behavior:l&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches?"smooth":"instant"})};(0,eN.useLayoutEffect)(()=>{eu(O,!1),U(a)},[a,N,g,A]),(0,eN.useLayoutEffect)(()=>{var e;null==(e=Y.current)||e.scrollTo({left:$.current*Y.current.clientWidth,behavior:"instant"})},[D.length]),(0,eN.useEffect)(()=>{let e=Y.current;if(!e)return;let t=new ResizeObserver(()=>e.scrollTo({left:$.current*e.clientWidth,behavior:"instant"}));return t.observe(e),()=>t.disconnect()},[]),(0,eN.useEffect)(()=>()=>clearTimeout(W.current),[]);let ep=e=>{eo(e)&&(null==y||y(),Q.current=void 0,n(e),eu(ec(e),!1),U(e),q(!1))},em=eQw(a)?eQM(a,r,{day:"numeric",month:"short",year:"numeric"}):_("chooseDate"),eg=e=>eQM(ee,r,{month:e?"short":"long",year:"numeric"}),eh=()=>{let e=G.current,t=Y.current;if(G.current=null,!(null==e?void 0:e.dragging)||!t)return;K.current=Date.now()+300,t.style.scrollSnapType="",t.hasPointerCapture(e.id)&&t.releasePointerCapture(e.id);let l=t.scrollLeft-e.scroll;eu(Math.abs(l)>40?Math.round(e.scroll/t.clientWidth)+Math.sign(l):Math.round(t.scrollLeft/t.clientWidth))};return(0,eB.jsxs)("div",{className:"booking-date-picker",role:"group","aria-labelledby":Z,"aria-disabled":b||void 0,"aria-busy":ea||void 0,children:[(0,eB.jsxs)("div",{className:"booking-date-heading",children:[(0,eB.jsxs)("div",{className:"booking-date-copy",children:[void 0===d?(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("span",{className:"booking-date-icon","aria-hidden":"true",children:(0,eB.jsx)(eQv,{size:17,weight:"bold"})}),(0,eB.jsx)("strong",{id:Z,children:o})]}):(0,eB.jsxs)("h3",{className:"booking-substep-title",id:Z,children:[c?(0,eB.jsx)(eKH,{number:d,state:c,lang:r.startsWith("zh")?"zh":"en",className:"booking-substep-number"}):(0,eB.jsx)("span",{className:"booking-substep-number",children:d}),o]}),s&&(0,eB.jsx)("p",{className:"sr-only",id:J,children:s})]}),(0,eB.jsxs)("div",{className:"booking-date-controls",children:[(0,eB.jsxs)("button",{type:"button",className:"calendar-trigger","aria-haspopup":"dialog","aria-expanded":F,disabled:b,"aria-label":`${_("openCalendar")}: ${em}`,title:`${_("openCalendar")}: ${em}`,"aria-invalid":ed||void 0,"aria-describedby":ed?X:s?J:void 0,onClick:()=>{null==y||y();let e=eQw(a)&&a>=N&&(void 0===g||a<=g)?a:N;H(`${e.slice(0,7)}-01`),P(e),q(!0)},children:[(0,eB.jsx)("span",{className:"calendar-caption-full",children:eg(!1)}),(0,eB.jsx)("span",{className:"calendar-caption-short",children:eg(!0)}),(0,eB.jsx)(eQv,{size:16,"aria-hidden":"true"})]}),(0,eB.jsxs)("div",{className:"booking-week-arrows",children:[(0,eB.jsx)("button",{type:"button",className:"icon-button","aria-label":_("previousWeek"),disabled:b||0===R,onClick:()=>{null==y||y(),eu(R-1)},children:(0,eB.jsx)(eQy,{size:16})}),(0,eB.jsx)("button",{type:"button",className:"icon-button","aria-label":_("nextWeek"),disabled:b||void 0!==g&&R===D.length-1,onClick:()=>{null==y||y(),eu(R+1)},children:(0,eB.jsx)(eQx,{size:16})})]})]})]}),(0,eB.jsx)("span",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:eQS(),i=eQj(e,6),a=new Intl.DateTimeFormat(t,{day:"numeric",month:"short",...e.slice(0,4)!==l.slice(0,4)||e.slice(0,4)!==i.slice(0,4)?{year:"numeric"}:{},timeZone:"UTC"}),n=new Date(`${e}T12:00:00Z`),r=new Date(`${i}T12:00:00Z`);return a.formatRange?a.formatRange(n,r):`${a.format(n)} – ${a.format(r)}`}(ee,r,S)}),(0,eB.jsx)("div",{ref:Y,className:"booking-week-track","aria-label":_("quickVisitDates"),onScroll:()=>{clearTimeout(W.current),W.current=setTimeout(()=>{var e;(null==(e=G.current)?void 0:e.dragging)||!Y.current||L(Math.round(Y.current.scrollLeft/Y.current.clientWidth))},120)},onPointerDown:e=>{b||("mouse"!==e.pointerType&&(null==y||y()),"mouse"===e.pointerType&&0===e.button&&(G.current={id:e.pointerId,x:e.clientX,scroll:e.currentTarget.scrollLeft,dragging:!1}))},onPointerMove:e=>{let t=G.current;t&&(!t.dragging&&Math.abs(e.clientX-t.x)>8&&(null==y||y(),t.dragging=!0,e.currentTarget.setPointerCapture(e.pointerId),e.currentTarget.style.scrollSnapType="none"),t.dragging&&(e.preventDefault(),e.currentTarget.scrollLeft=t.scroll-(e.clientX-t.x)))},onPointerUp:eh,onWheel:e=>{!b&&(0!==e.deltaX||e.shiftKey&&0!==e.deltaY)&&(null==y||y())},onPointerCancel:eh,onLostPointerCapture:eh,onPointerLeave:()=>{var e;(null==(e=G.current)?void 0:e.dragging)||(G.current=null)},onClickCapture:e=>{Date.now()<K.current&&(e.preventDefault(),e.stopPropagation())},children:D.map((e,t)=>{if(Math.abs(t-R)>1)return(0,eB.jsx)("div",{className:"booking-week",ref:e=>{null==e||e.setAttribute("inert","")},"aria-hidden":"true"},e);let l=Array.from({length:7},(t,l)=>eQj(e,l)),i=l.includes(V)&&eo(V)?V:l.includes(a)&&eo(a)?a:l.find(eo);return(0,eB.jsx)("div",{className:"booking-week",ref:e=>{null==e||e.toggleAttribute("inert",t!==R)},"aria-hidden":t!==R||void 0,children:l.map(e=>{var n;return(0,eB.jsxs)("button",{type:"button","data-booking-day":e,className:`booking-day ${e===a?"is-selected":""} ${e===j?"is-today":""}`,disabled:!eo(e),"aria-busy":x||!v[e]||"loading"===v[e].status||void 0,title:null==(n=v[e])?void 0:n.reason,"aria-label":eQM(e,r),"aria-pressed":e===a,"aria-current":e===j?"date":void 0,tabIndex:t===R&&e===i?0:-1,onClick:()=>ep(e),onFocus:()=>U(e),onKeyDown:t=>{let i={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7,Home:-1*l.indexOf(e),End:6-l.indexOf(e)};if(!(t.key in i))return;t.preventDefault(),null==y||y();let a=eQj(e,i[t.key]),n=i[t.key]<0?-1:1;for(;a>=N&&(void 0===g||a<=g)&&!eo(a);){if(!v[a]||"loading"===v[a].status){Q.current=a,eu(ec(a),!1),U(a);return}a=eQj(a,n)}eo(a)&&(eu(ec(a),!1),U(a),requestAnimationFrame(()=>{var e,t;return null==(t=Y.current)||null==(e=t.querySelector(`[data-booking-day="${a}"]`))?void 0:e.focus({preventScroll:!0})}))},children:[(0,eB.jsx)("small",{children:e===j?_("calendarToday"):eQM(e,r,{weekday:"short"})}),(0,eB.jsxs)("span",{className:"booking-day-date",children:[(0,eB.jsx)("span",{className:"booking-day-date-full",children:eQM(e,r,{day:"numeric",month:"short"})}),(0,eB.jsx)("span",{className:"booking-day-date-short",children:r.startsWith("zh")?e.slice(0,7)===ee.slice(0,7)?eQM(e,r,{day:"numeric"}):`${Number(e.slice(5,7))}/${Number(e.slice(-2))}`:eQM(e,r,{day:"numeric",month:"short"})})]})]},e)})},e)})}),ee!==eQN(S,A)&&(0,eB.jsx)("div",{className:"booking-week-return",children:(0,eB.jsx)("button",{type:"button",className:"back-this-week",disabled:b,onClick:()=>{null==y||y(),eu(ec(S))},children:_("backThisWeek")})}),ed&&(0,eB.jsx)("p",{id:X,className:"booking-date-error",role:"alert",children:_("dateNeedsReselect")}),en&&(0,eB.jsx)("p",{className:"booking-date-error",role:"alert",children:_("calendarLoadFailed")}),F&&(0,eB.jsxs)(eQu,{title:_("chooseVisitDate"),closeLabel:_("closeCalendar"),className:"calendar-modal",initialFocus:'.venue-booking-calendar-day[tabindex="0"]',onClose:()=>q(!1),children:[(0,eB.jsx)(eQT,{locale:r,firstDay:A,today:j,month:B,onMonthChange:e=>{b||(null==y||y(),P(e),H(e))},selected:a,onSelect:ep,allowed:eo,disabled:b,minDate:N,maxDate:g,viewEnd:I,t:_}),(0,eB.jsxs)("div",{className:"calendar-panel-footer",children:[(0,eB.jsx)("span",{role:ea||en?"status":void 0,children:ea?_("calendarLoading"):en?_("calendarLoadFailed"):_("calendarVenueTime")}),(0,eB.jsx)("button",{type:"button",className:"text-link",disabled:b||S<N||void 0!==g&&S>g,onClick:()=>{null==y||y(),H(`${S.slice(0,7)}-01`)},children:_("calendarThisMonth")})]})]})]})}let eQP={unavailableProductAction:["Unavailable","不可预约"],timeMaximumCapacity:["Maximum capacity: {count}","最大容量:{count}"],timeRoomsLeft:["Rooms left: {count}","剩余房间:{count}"],timeSpacesLeft:["Spaces left: {count}","剩余名额:{count}"],capacityAvailable:["Available","可预约"],capacityLimited:["Limited availability","剩余量有限"],updatingQuote:["Updating price…","正在更新报价…"],selected:["Selected","已选"],extras:["Extras","附加商品"],navExtras:["Extras","附加商品"],nextExtras:["Continue: extras","继续:附加商品"],skipExtras:["Skip extras and continue","不加购,继续下一步"],editExtras:["Review extras","修改附加商品"],unavailableExtra:["Unavailable extra","已下架附加商品"],extraUnavailable:["Some extras are unavailable. Remove them or adjust their quantity to continue.","部分附加商品已不可购买,请移除或调整数量后继续。"],selectedTickets:["{count} tickets selected","已选 {count} 张"],selectedTicketCorner:["Selected {count}","已选 {count} 张"],fullProductInfo:["View details","查看详情"],walletPassTitle:["Wallet Pass","卡券/通票"],walletPassLogin:["Sign in to view your passes","登录查看可用卡券/通票"],walletPassUnsupported:["Wallet Pass is not available for this booking.","此预约暂不支持卡券/通票。"],walletPassLoading:["Loading your passes…","正在读取卡券/通票…"],walletPassLoadFailed:["Your passes could not be loaded. Please try again.","卡券/通票加载失败,请重试。"],walletPassEmpty:["You have no passes for this booking.","此预约暂无可用卡券/通票。"],walletPassUses:["{count} visits remaining","剩余 {count} 次"],walletPassUnavailable:["This pass cannot be used for the current booking. Remove it or choose another.","此卡券/通票不适用于当前预约,请移除或重新选择。"],walletPassRemove:["Remove selected pass","移除已选卡券/通票"],walletPassApplied:["Pass applied","已使用卡券/通票"],benefitsTitle:["Use offers","使用优惠"],benefitsSaved:["Saved {amount}","已优惠 {amount}"],benefitsUpdating:["Updating savings…","优惠计算中…"],benefitsAttention:["Review offers","优惠需处理"],benefitsDone:["Done","完成"],benefitsNoOffers:["You have no offers available. You can still enter a promo code.","暂无账号优惠券,你仍可输入优惠码。"],benefitsQuoteFailed:["We couldn’t update your total. Close this panel and retry the quote on the checkout page.","订单金额更新失败,请关闭弹窗,在结账页重试报价。"],redemptionCodes:["Admission codes","入场核销码"],redemptionCode:["Admission code","核销码"],redemptionUnavailable:["Your admission code is not available yet. Check your booking details or contact the venue.","暂未取得核销码,请查看订单详情或联系场馆。"],redemptionUsed:["Already redeemed","已核销"],redemptionExpired:["Expired","已过期"],redemptionVoid:["No longer valid","已失效"],showRedemption:["Show this code when you arrive.","到场时请出示此码。"],demoRedemption:["Demo code \xb7 not valid for real admission","演示核销码 \xb7 不可用于真实入场"],chooseResourceTitle:["Choose a play space","选择场地"],chooseResource:["Choose a play space to continue.","请选择场地后继续。"],resourceChanged:["Your saved play space is no longer offered. Confirm the available space to choose a new time.","原选场地已不再提供,请确认当前可用场地后重新选择时间。"],useResource:["Use {name}","使用{name}"],chooseResourceRights:["Your choice of play space","自选游玩场地"],resourceAdmission:["Play space admission","场地入场"],resourceAvailable:["Available times","有可预约时间"],resourceRemaining:["{count} places left","剩余 {count} 人名额"],resourcePeople:["Up to {count} people","最多 {count} 人"],resourceInsufficient:["Only {count} places left \xb7 reduce quantity","仅剩 {count} 人名额,请减少数量"],resourceFull:["Fully booked","已约满"],resourceNotOpen:["Not open for bookings","未开放预约"],resourceTimeUnavailable:["Unavailable at this time","该时间不可预约"],resourceLoadFailed:["Some play spaces could not be checked. Try again, or choose an available space.","部分场地查询失败,请重试或选择其他可预约场地。"],resourceCapacity:["There are not enough places for this group. Choose another space or time, or reduce the quantity.","该场地在此时间的名额不足,请更换场地、时间或减少数量。"],payNow:["Pay now","立即付款"],paymentRecoveryHint:["Your choices are saved. Check the payment status before trying again.","已保存您的选择,请查询付款状态后再操作。"],openCalendar:["Open calendar","打开日历"],closeCalendar:["Close calendar","关闭日历"],chooseVisitDate:["Choose your visit date","选择游玩日期"],chooseDate:["Choose a date","选择日期"],previousWeek:["Previous week","上一周"],nextWeek:["Next week","下一周"],backThisWeek:["This week","回到本周"],calendarToday:["Today","今天"],previousMonth:["Previous month","上个月"],nextMonth:["Next month","下个月"],calendarMonth:["Month","月份"],calendarYear:["Year","年份"],calendarThisMonth:["This month","回到本月"],calendarVenueTime:["Dates follow venue local time","日期按场馆当地时间"],dateNeedsReselect:["This date is no longer available. Please choose an available date.","此日期已不可预约,请重新选择可用日期。"],validPlayTime:["Your playtime","游玩有效时间"],playStartTime:["Start playing at","开始游玩时间"],timeNotSelected:["Not selected","待选择"],timeLoading:["Updating…","更新中…"],timeLoadFailed:["Load failed","加载失败"],timeUnavailable:["Unavailable","暂无时段"],timeNeedsDate:["Choose today","请选择今天"],immediateTimeHint:["Your start time is recorded when you add this ticket.","开始时间以加入订单时为准。"],closesAt:["Closes","闭馆"],startUnavailable:["This start time is unavailable. Choose a listed time or another date.","此开始时间不可预约,请选择可用时间或更换日期。"],noPlayTimes:["No available playtime","当日暂无可预约时间"],tryAnotherDate:["Try another date; available times depend on this ticket and its play areas.","请更换日期;可预约时间以本票及所含区域的安排为准。"],otherTimes:["View unavailable sessions","查看不可预约场次"],untilClosing:["Until closing","至闭馆"],duringOpening:["During opening hours","营业时间内有效"],todayOnlyTime:["This ticket starts now","本票从当前时间开始"],todayOnlyTimeHint:["Choose today to book immediate entry. Future dates need a ticket with a scheduled start.","即入门票仅支持当天,请选择今天;其他日期请选择可预约开始时间的门票。"],useToday:["Use today for this ticket","此门票改为今天"],timeRuleChanged:["The time rules have changed. Edit this ticket to review and confirm its new validity.","时间规则已变更,请修改此门票,重新核对并确认有效时间。"],timeUpdated:["The available time has changed. Check the time shown before adding.","可用时间已更新,请核对上方有效时间后添加。"],timeConfigTitle:["Ticket & resource time rules","门票与资源时间配置"],timeConfigHint:["Local demo settings. Ticket names do not determine validity; these rules do. Existing tickets keep their recorded time and may need editing after a rule change.","本地演示配置。商品标题不决定权益,实际有效时间由以下规则控制。修改规则后,已选票保留原时间,可能需要重新编辑确认。"],productTimeRules:["Ticket time rule","门票时间规则"],configureProduct:["Ticket product","配置门票"],timeMode:["Validity rule","有效时间规则"],modeFixed:["Fixed sessions","固定时间段"],modeDuration:["Fixed duration \xb7 flexible start","固定时长 \xb7 灵活开始"],modeAllDay:["Opening-hours window","全天 \xb7 营业时间范围"],modeUntilClose:["Choose a start \xb7 until closing","选择开始时间 \xb7 至闭馆"],customerChoosesStart:["Ask the guest to choose a start time","需要客人选择开始时间"],customerStartHint:["The selected time becomes the ticket’s actual validity start. With this off, opening-hours tickets use the full window; fixed-duration tickets start now and are today-only.","开启后,所选时间就是门票实际生效时间。关闭时,全天规则使用完整营业时间;固定时长规则从当前时间开始,仅支持当天。"],configuredDuration:["Play duration (minutes)","游玩时长(分钟)"],startInterval:["Start time increment","开始时间间隔"],fixedStarts:["Session starts (comma-separated)","固定场次开始时间(逗号分隔)"],resourceTimeRules:["Resource opening hours","资源营业时间"],configureResource:["Resource","配置资源"],venueResource:["Venue / lobby","场馆/大厅"],opensAt:["Opens","开门"],resourceInterval:["Resource start increment","资源开始时间间隔"],resourceTimeHint:["A ticket must fit within the venue and every included area’s hours. Time increments must also satisfy each resource.","门票时间需同时满足场馆及所有绑定区域的营业时间和开始间隔。"],applyTimeRules:["Save time rules","保存时间配置"],resetTimeRules:["Restore default time rules","恢复默认时间规则"],timeRulesSaved:["Time rules saved. Review any existing tickets before payment.","时间配置已保存;付款前请核对已有门票的有效时间。"],invalidTimeConfig:["Enter valid opening hours and session times.","请填写有效的营业时间和场次时间。"],book:["Book a play session","预约欢乐时光"],basket:["My order","我的订单"],plan:["Choose tickets","选择门票"],details:["Participants","参加者信息"],confirm:["Review & pay","确认并支付"],booked:["You’re booked","预约成功"],bookingNavigation:["Booking steps","预约步骤导航"],navPlan:["Tickets","选择门票"],navDetails:["Details","参加者"],navReview:["Review","确认支付"],currentStep:["Current step","当前步骤"],jumpToStep:["Click a step to go back or continue.","点击已解锁的步骤,可快捷切换或返回修改。"],addTicketsFirst:["Add tickets to unlock the next steps.","先添加门票,解锁后续步骤。"],previousStep:["Back","上一步"],nextStep:["Next","下一步"],nextDetails:["Next: participants","下一步:参加者信息"],nextReview:["Next: review & pay","下一步:确认与支付"],participantsNotRequired:["Not required for these tickets","所选门票无需填写参加者"],heroTitle:["A little play.\nA big day.","小小玩乐,\n大大快乐。"],heroSub:["Find their perfect ticket to a happy day.","选一张心仪的门票,开启孩子的快乐天地。"],homeEyebrow:["SYDNEY’S LITTLE HAPPY PLACE","悉尼的亲子欢乐天地"],homeTitle:["Big smiles.\nLittle adventures.","小小冒险,\n满满笑容。"],homeSub:["A world of bouncing, climbing and make-believe. Make a little time for a whole lot of happy.","蹦跳、攀爬、天马行空的想象。留一点时间,收获一整天的快乐。"],explore:["Find their happy place","发现孩子的快乐天地"],exploreSub:["Three ways to play. A thousand reasons to smile.","三种游玩方式,无数个开心的理由。"],viewArea:["Find tickets","查看相关门票"],safe:["Little people. Big peace of mind.","孩子玩得开心,家长更安心。"],timed:["Your time to play","专属游玩时间"],family:["Made for families","为亲子家庭设计"],ready:["Ready, set, happy.","准备好,一起快乐出发。"],readySub:["Arrive 15 minutes early. Bring comfy clothes and your biggest smile.","建议提前 15 分钟到场,穿上舒适衣服,带上开心的笑容。"],previous:["Previous","上一页"],next:["Next","下一页"],today:["Today","今天"],soldOut:["Sold out","已售罄"],notOpen:["Unavailable","不可预约"],minutes:["minutes of happy","分钟欢乐时光"],sydneyTime:["All times are venue local time","所有时间均为场馆当地时间"],updateBasket:["Save changes","保存修改"],total:["Total","合计"],subtotal:["Subtotal","小计"],discount:["Discount","优惠"],chooseSession:["Choose your session","选择场次"],selectTickets:["Choose at least one ticket.","请至少选择一张票。"],capacity:["There aren’t enough spots for these tickets. Choose another time or reduce the quantity.","本场次余位不足,请更换时段或减少票数。"],added:["A little happy, added to your basket.","欢乐已加入购物车。"],saved:["Your session has been updated.","场次已更新。"],edit:["Edit","修改"],remove:["Remove","删除"],undo:["Undo","撤销"],removed:["Ticket removed.","门票已删除。"],groupRemoved:["Tickets removed.","门票已删除。"],emptyTitle:["A little empty. For now.","还空着,等你添点快乐。"],emptySub:["Your next happy day starts with a ticket.","下一段欢乐时光,从选择一张门票开始。"],tickets:["tickets","张票"],ticket:["Ticket","门票"],childPending:["Child details to add","待补充儿童信息"],notes:["Anything we should know?","有什么需要我们留意?"],optional:["Optional","选填"],notesHint:["Add a note for our team…","给场馆团队留言…"],notesHelp:["Requests are subject to confirmation. Please don’t include sensitive information.","特殊需求以场馆确认为准,请勿填写敏感信息。"],promo:["A little treat?","让快乐再优惠一点"],promoHint:["Enter a promo code","输入优惠码"],apply:["Apply","使用"],couponApplied:["Promo code applied.","优惠码已使用。"],couponInvalid:["We couldn’t find that code. Try HAPPY10.","没有找到该优惠码,请试试 HAPPY10。"],couponExpired:["This offer has expired. Remove it or choose another.","该优惠已过期,请移除或更换。"],couponMinimum:["PLAY5 needs a ticket subtotal of A$50.","PLAY5 需门票小计达到 A$50。"],accountOffers:["Your offers","你的优惠券"],offer10:["10% off your play day","游玩订单享九折"],offer5:["A$5 off orders of A$50+","满 A$50 减 A$5"],offerLittle:["A$5 off the Little Explorers toddler ticket","小小探索家幼儿单区票减 A$5"],offerHint:["One offer per order. Rechecked when your basket changes.","每单限用一张优惠券,购物车变化后重新计算。"],loginOffers:["Sign in to see your offers","登录查看你的优惠券"],checkout:["Continue to checkout","前往结算"],loginTitle:["Welcome to the sunny side.","欢迎来到欢乐的一边。"],loginSub:["Sign in to keep your little explorers and bookings together.","登录后可管理儿童档案与预约。"],demoLogin:["Demo sign-in","演示登录"],demoLoginHint:["This prototype uses a demo account. No email is sent and no password is needed.","此原型使用演示账号,不会发送邮件,也无需真实密码。"],email:["Email address","电子邮箱"],signIn:["Continue with demo account","使用演示账号继续"],signingIn:["Signing in…","正在登录…"],close:["Close","关闭"],hello:["Hi, Alex","你好,Alex"],signOut:["Sign out","退出登录"],loginRequired:["Sign in to add participant details.","登录后即可填写参加者信息。"],detailsTitle:["Meet the little adventurers.","认识今天的小小冒险家。"],detailsSub:["Match each child ticket to its explorer. Adults don’t need a profile.","为每张儿童票选择参加者,成人票无需儿童档案。"],completed:["complete","已完成"],chooseChild:["Choose a child","选择儿童"],addChild:["Add a child","新增儿童"],newChild:["A new little explorer","新增小小探索家"],childName:["Child’s name","儿童姓名"],dob:["Date of birth","出生日期"],dobHelp:["Age on the visit date is used for guidance only. It will not prevent a booking.","游玩当日年龄仅用于建议提示,不影响购买。"],saveChild:["Save child","保存儿童信息"],childConsent:["Saved for reuse across your bookings.","保存到此演示账号,可在不同场次复用。"],invalidDob:["Enter a valid date of birth, no later than today.","请输入有效出生日期,不能晚于今天。"],nameRequired:["Please enter a name.","请填写姓名。"],emailInvalid:["Enter a valid email address.","请输入有效邮箱。"],childMissing:["Choose a child for this ticket.","请为这张票选择儿童。"],duplicateChild:["This child already has a ticket for this session.","该儿童已绑定此场次的另一张门票。"],invalidTicket:["This ticket is not available in this area.","此票种不适用于当前区域。"],contact:["Who can we get in touch with?","我们可以联系谁?"],phone:["Phone number","联系电话"],review:["Review your booking","确认预约信息"],checkDetails:["A few details need your attention.","还有一些信息需要处理。"],agreement:["Area agreement","区域协议"],confirmAgreement:["Confirm","确认"],accepted:["Agreed","已同意"],notAccepted:["Needs your agreement","待确认协议"],agreementRequired:["Please agree to this area’s current agreement.","请阅读并同意当前版本协议。"],version:["Version","版本"],demoAgreement:["Demo terms for this prototype. Not a legal waiver.","此为原型演示条款,不构成法律责任豁免。"],pay:["Pay","支付"],demoPay:["Simulate payment","模拟付款"],demoPayShort:["Demo pay","模拟付款"],demoPayHint:["Demo checkout \xb7 No real payment or reservation is made.","演示结算 \xb7 不会真实扣款或预订。"],processing:["Checking your booking…","正在检查预约…"],priceChanged:["The ticket price changed. We’ve updated your total. Review it and submit again to confirm.","票价发生变化,已更新总额。请确认新金额后再次提交。"],unavailable:["This session no longer has enough spots. Edit or remove it to continue.","该场次余位已不足,请修改或删除后继续。"],emptyCart:["Your basket is empty.","购物车为空。"],loadError:["We couldn’t load playtimes. Your choices are saved.","暂时无法加载时段,已保留你的选择。"],retry:["Try again","重试"],paymentFailed:["Payment was declined. Your basket is saved. You can try again.","付款未通过,购物车已保留,可以重试。"],paymentPending:["We’re checking your payment.","正在确认付款结果。"],pendingSub:["Your booking is not confirmed yet. Please don’t submit another payment.","预约尚未确认,请勿重复支付。"],checkPayment:["Check payment status","查询付款状态"],successTitle:["Here comes a happy day!","欢乐的一天,要来啦!"],successSub:["Your booking is confirmed. We can’t wait to see those smiles.","预约已确认,期待一起创造快乐回忆。"],bookingRef:["Booking reference","预约编号"],itinerary:["Your play-day plan","你的游玩行程"],download:["Download booking","下载预约凭证"],bookMore:["Plan another happy day","再安排一段欢乐"],bookingDetails:["Booking details","预约详情"],noBooking:["No booking to show yet.","暂时没有预约记录。"],arrival:["A little before you arrive","出发前的小提醒"],arrivalText:["Arrive 15 minutes early. Wear comfortable clothes. Check your area agreement for equipment requirements.","建议提前 15 分钟到场,穿着舒适衣物,装备要求请查看对应区域协议。"],confirmationEmail:["Booking contact","预约联系人"],orderNote:["Your note","订单备注"],date:["Date","日期"],time:["Time","时间"],area:["Play area","游玩区域"],payment:["Payment","付款"],confirmed:["Confirmed","已确认"],demo:["Prototype","交互原型"],demoControls:["Demo scenarios","演示场景"],demoTitle:["Test a different kind of day.","试试不同的预约情况。"],demoSub:["These controls only affect this local prototype. Your basket is kept when switching scenarios.","这些控制仅影响本地原型,切换场景会保留购物车。"],normal:["Normal booking","正常预约"],soldOutScenario:["11:30 sells out \xb7 selectable spaces fully booked","11:30 场次售罄 \xb7 可选场地全部满员"],priceChangeScenario:["Price rises A$2 per ticket at payment","提交时每张票涨价 A$2"],expiredCouponScenario:["Coupons expire","优惠券过期"],loadErrorScenario:["Playtime loading fails once","首次时段加载失败"],paymentFailScenario:["First payment fails","首次付款失败"],paymentPendingScenario:["Payment awaits confirmation","付款结果待确认"],singleAreaScenario:["Only one ticket available","只有一种可售门票"],reset:["Reset demo data","重置演示数据"],resetHint:["Clears this demo basket, profiles and booking.","清除演示购物车、档案与预约。"],backPlan:["Back to tickets","返回选票"],footerNote:["A little play goes a long way.","小小玩乐,收获满满。"],demoFooter:["Interactive prototype \xb7 Sydney \xb7 AUD","交互原型 \xb7 悉尼 \xb7 澳元"],loading:["Finding your happy time…","正在寻找欢乐时段…"],session:["session","个场次"],sessions:["sessions","个场次"],learnMore:["Plan your visit","到访须知"],age:["years old on visit date","岁(游玩当日)"],noChildNeeded:["No child details required","无需儿童信息"],allAccess:["All areas included","全区域通玩"],lobbyOnly:["Lobby admission","仅大厅入场"],singleAreaTicket:["One play area included","包含一个游玩区域"],noPlayAreas:["Lobby only \xb7 No play areas included","仅大厅入场,不含游玩区域"],suggestedAge:["Suggested ages","建议年龄"],minuteUnit:["minutes","分钟"],perPerson:["per person","/人"],visitDate:["Visit date","游玩日期"],quantity:["Number of tickets","门票数量"],chooseRemoval:["Choose the participant ticket to remove.","请选择要移除的参加者门票。"],addTickets:["Add tickets","添加门票"],addTicketsCompact:["Add","添加"],saveTicketsCompact:["Save","保存"],ticketAdded:["Tickets added to your day.","门票已加入本次订单。"],filterTickets:["Filter tickets by audience","按人群筛选门票"],quickVisitDates:["Choose a day this week","快捷选择游玩日期"],sharedVisitDate:["Your visit date","本次游玩日期"],sharedDateHint:["Used for new tickets.","新添加的门票自动沿用"],changeDate:["Change date","更改日期"],ticketDateHint:["Need a different day? Change this ticket only.","需要另一天游玩?可仅修改这张门票的日期。"],noMatchingTickets:["No tickets match these filters.","暂无符合筛选条件的门票。"],allTickets:["All tickets","全部门票"],childrenTickets:["Children","儿童"],adultTickets:["Adults","成人"],ticketsIncluding:["Tickets including","包含以下区域的门票:"],showAllTickets:["View all tickets","查看全部门票"],chooseTicket:["Choose ticket","选择门票"],pickTicketsHint:["Pick a ticket to start your family’s adventure.","选一张门票,开始安排全家的欢乐时光。"],childInvalid:["This child profile needs a valid name and date of birth. Select another profile or add corrected details.","儿童资料的姓名或生日无效,请选择其他档案或新增正确信息。"],couponProduct:["This offer applies only to the Little Explorers toddler ticket.","此优惠仅适用于小小探索家幼儿单区票。"],checkoutTitle:["Your happy day, all together.","确认门票,让快乐出发。"],contactSection:["Contact details","填写联系信息"],orderSection:["Review your tickets","确认订单信息"],agreementSection:["Confirm agreements","确认协议"],noteSection:["Leave a note","留言"],checkoutSub:["Review your tickets, add a little saving and get ready to play.","查看全家的门票,使用优惠,确认后即可出发。"],addMoreTickets:["Add more tickets","继续选购门票"],participantsIncomplete:["Some participant details still need attention. Your tickets are saved.","参加者信息尚未完成,已选门票均已保留。"],completeParticipants:["Add participant details","补充参加者信息"],completeContact:["Add contact details","补充联系人"],orderAgreementsHelp:["Open each agreement and confirm your consent in its details.","请点击协议查看详情,并在详情中确认同意。"],agreementsPending:["Agreements to confirm: {count}","还有 {count} 份协议待确认"],agreementsPaymentHelp:["Select “Read agreement” below, read the details and select “Confirm”. Confirm all agreements, then try payment again.","请点击下方“查看协议”,阅读后点击“确认”。全部确认后,再点击支付。"],readAgreement:["Read agreement","查看协议"],orderSummary:["Your order","订单明细"],orderDetailShort:["Details","明细"],checkOrder:["Check order","检查订单"],loginComplete:["Sign in & add your details","登录并补充信息"],availabilityFix:["Update the tickets marked unavailable.","请修改标记为不可预约的门票。"],confirmPrice:["Confirm new price & pay","确认新价格并付款"],confirmPriceShort:["Confirm & pay","确认并付款"],loginShort:["Sign in","登录并补充"],completeShort:["Add details","补充信息"],migrationNotice:["Some saved demo items could not be converted. The original draft is backed up in this browser; please choose those tickets again.","部分旧演示内容无法转换,原始草稿已备份在当前浏览器,请重新选择相关门票。"],timeRechoose:["That time is no longer available for this date. Please choose another time.","该时段在当前日期已不可预约,请重新选择。"],spotsLeft:["spots left","个余位"]},eQA=(e,t)=>{var l;return(null==(l=eQP[t])?void 0:l[+("en"!==e)])??t},eQD={en:{close:"Close",cancel:"Cancel",back:"Back",next:"Next",configuration:"Choose options",booking:"Choose time",confirmConfiguration:"Confirm options",confirmBooking:"Add tickets",working:"Please wait…",validationFailed:"Complete the required selections to continue.",confirmationFailed:"Unable to save your selection. Please try again.",configurationNotReady:"Options are not ready. Please close and try again.",invalidPlan:"Product details are not ready. Please close and try again."},zh:{close:"关闭",cancel:"取消",back:"上一步",next:"下一步",configuration:"选择商品选项",booking:"选择时间",confirmConfiguration:"确认选项",confirmBooking:"添加门票",working:"请稍候…",validationFailed:"请完成必选内容后继续。",confirmationFailed:"保存失败,请重试。",configurationNotReady:"商品选项尚未准备好,请关闭后重试。",invalidPlan:"商品详情尚未准备好,请关闭后重试。"}};function eQE(e){var t,l,i,a,n,r,o,s,d,c,u;let p=eKn(),m=null==p?void 0:p.brandTokens,[g]=(0,eN.useState)(()=>e.plan),[h,v]=(0,eN.useState)(g.hasConfiguration?"configuration":"booking"),[f,y]=(0,eN.useState)(!1),[b,x]=(0,eN.useState)(!1),[k,_]=(0,eN.useState)(!1),[w,S]=(0,eN.useState)(),[j,N]=(0,eN.useState)(null),[C,M]=(0,eN.useState)(!1),T=(0,eN.useRef)(null),I=(0,eN.useRef)(null),P=(0,eN.useRef)(0),A=(0,eN.useRef)(!0),D=(0,eN.useRef)(e);D.current=e;let E=(0,eN.useRef)(e.configuration);E.current=e.configuration;let O=(0,eN.useRef)((0,ni.cloneDeep)(e.configuration)),z=(0,eN.useRef)(null),L=(0,eN.useRef)(0);(0,ni.isEqual)(O.current,e.configuration)||(z.current&&(0,ni.isEqual)(z.current,e.configuration)||(L.current+=1),z.current=null,O.current=(0,ni.cloneDeep)(e.configuration));let R=e.locale||"en",$="edit-draft"===g.intent,F={...eQD[R],...$?{confirmBooking:eQA(R,"updateBasket")}:{},...e.labels},q=!!e.busy||b||k,B=!g.openId||!g.scopeKey||!g.detailRevision||!g.productDetail||String(null==(t=e.configuration.skuValue)?void 0:t.product_id)!==String(g.productDetail.id)||"product-configuration"===g.mode&&(!g.hasConfiguration||!e.onConfigurationConfirm)||"ticket-booking"===g.mode&&(!e.renderBooking||!e.onConfirm),H="ticket-booking"===g.mode,V=H&&g.hasConfiguration;(0,eN.useEffect)(()=>(A.current=!0,()=>{var e;A.current=!1,P.current+=1,null==(e=I.current)||e.abort()}),[]);let U=(0,eN.useCallback)(e=>{T.current=e,M(!!e)},[]),Y=()=>{var t;q||(P.current+=1,null==(t=I.current)||t.abort(),e.onCancel())},W=()=>{!q&&V&&(S(void 0),y(!0),v("configuration"),null==j||j.scrollTo({top:0}))},G=async()=>{var e,t,l,i,a,n,r,o,s,d;if(q||B||I.current)return;let c=new AbortController,u=++P.current,p=D.current.selectionRevision,m=L.current;I.current=c;let f={openId:g.openId,scopeKey:g.scopeKey,detailRevision:g.detailRevision,signal:c.signal,isCurrent:()=>A.current&&!c.signal.aborted&&P.current===u&&L.current===m&&("booking"!==h||D.current.selectionRevision===p)};x(!0),S(void 0);let b="validation";try{let s=E.current;if("configuration"===h){let e=T.current;if(!C||!e)return void S(F.configurationNotReady);if(!1!==D.current.requiredOptionValidation&&await e.validate(),!f.isCurrent())return;let t=iw(g.productDetail,e.getTransformValues(),{requiredOptionValidation:D.current.requiredOptionValidation,overSold:(null==(i=D.current.skuOptions)||null==(l=i.config)?void 0:l.overSold)===1||(null==(n=D.current.skuOptions)||null==(a=n.config)?void 0:a.overSold)==null&&lW(g.productDetail.over_sold)});if(!t)return void S(F.validationFailed);if(s={skuValue:t,variantDraft:E.current.variantDraft},E.current=s,z.current=(0,ni.cloneDeep)(s),D.current.onConfigurationChange(s),H){if(await (null==(r=(o=D.current).onConfigurationContinue)?void 0:r.call(o,s,f)),!f.isCurrent())return;y(!0),v("booking"),null==j||j.scrollTo({top:0});return}}else if(!H||!D.current.bookingReady)return;b="confirmation";let d=H?await D.current.onConfirm(s,f):await (null==(e=(t=D.current).onConfigurationConfirm)?void 0:e.call(t,s,f));f.isCurrent()&&!1!==d&&_(!0)}catch(e){if(!f.isCurrent())return;S("validation"===b?F.validationFailed:F.confirmationFailed),null==(s=(d=D.current).onError)||s.call(d,e,b)}finally{A.current&&P.current===u&&x(!1),I.current===c&&(I.current=null)}},K=q||B||("configuration"===h?!C:!H||!e.bookingReady),Q={mode:g.mode,step:h,configuration:e.configuration,busy:q},Z="function"==typeof e.footerContent?e.footerContent(Q):e.footerContent,J="configuration"===h?e.configurationFooter:void 0,X="configuration"===h?H?F.next:F.confirmConfiguration:F.confirmBooking,ee=B?F.invalidPlan:w||e.error,et=H||!!J,el=H&&"booking"===h?e.bookingActionAmount??"—":(null==J?void 0:J.amount)??null,ei=H&&"booking"===h?e.bookingSubtotalLabel??eQA(R,"subtotal"):(null==J?void 0:J.label)??(H?void 0:eQA(R,"subtotal")),ea=(null==(l=e.skuOptions)?void 0:l.type)||"flat",en=null==(i=e.skuOptions)?void 0:i.presentation,er="function"==typeof e.getContainer?e.getContainer():"string"==typeof e.getContainer?document.querySelector(e.getContainer):e.getContainer,eo=V?(0,eB.jsx)("div",{className:"pisell-booking-product-detail-steps",children:(0,eB.jsx)(eQp,{current:+("configuration"!==h),label:"zh"===R?"商品选择步骤":"Product selection steps",currentLabel:"zh"===R?"当前步骤":"Current step",steps:[{id:"configuration",label:F.configuration,status:"configuration"!==h&&q?"locked":"available",onClick:W},{id:"booking",label:F.booking,status:"booking"===h?"available":"locked"}]})}):null;return(0,eB.jsx)(eQu,{title:e.title,onClose:Y,closeLabel:F.close,closeDisabled:q,wide:!0,className:`${H?"reservation-modal":"party-package-dialog"} pisell-booking-product-detail-modal ${e.className||""}`,bodyClassName:`${H?"reservation-content":"package-config-body"} pisell-booking-product-detail-body`,footerClassName:`${et?"booking-config-dialog-footer":"package-config-footer"} pisell-booking-product-detail-footer`,mobile:"fullscreen",bodyRef:N,portal:er,zIndex:600,externalDialogSelector:eQd,style:{...e.width?{width:e.width}:{},...e.style},intro:eo,footer:et?(0,eB.jsx)(eK0,{leading:!H||"booking"===h||J?Z:void 0,label:ei,amount:el,action:{label:k?F.working:X,disabled:K,busy:b||e.busy,onClick:G},feedback:ee&&(0,eB.jsx)("p",{className:"error-text pisell-booking-product-detail-error",role:"alert",children:ee})}):(0,eB.jsxs)(eB.Fragment,{children:[ee&&(0,eB.jsx)("div",{className:"error-text pisell-booking-product-detail-error",role:"alert",children:ee}),Z&&(0,eB.jsx)("div",{className:"pisell-booking-product-detail-footer-content",children:Z}),(0,eB.jsxs)("div",{className:"package-config-footer-actions pisell-booking-product-detail-actions",children:[(0,eB.jsx)(eKQ,{secondary:!0,disabled:q,onClick:Y,children:F.cancel}),(0,eB.jsx)(eKQ,{disabled:K,busy:b||e.busy,onClick:()=>void G(),children:(0,eB.jsx)("span",{children:k?F.working:X})})]})]}),children:(0,eB.jsxs)("div",{"aria-busy":q,children:[e.summary&&(0,eB.jsx)("div",{className:"pisell-booking-product-detail-summary",children:e.summary}),!B&&"configuration"===h&&(0,eB.jsx)("div",{className:"pisell-booking-product-detail-sku-guard venue-booking-legacy-controls","aria-disabled":q,style:q?{pointerEvents:"none"}:void 0,onKeyDownCapture:e=>{q&&"Tab"!==e.key&&(e.preventDefault(),e.stopPropagation())},children:(0,eB.jsx)($T,{...e.skuOptions,ref:U,type:ea,presentation:"flat"===ea?{...en,modal:{...null==en?void 0:en.modal,style:{...null==en||null==(a=en.modal)?void 0:a.style,...(null==p?void 0:p.fontFamily)?{fontFamily:p.fontFamily}:{}},className:[null==(o=$x(ea))||null==(r=o.presentation)||null==(n=r.modal)?void 0:n.className,null==en||null==(s=en.modal)?void 0:s.className,"pisell-booking-product-detail-options-modal"].filter(Boolean).join(" ")}}:en,theme:(null==(d=e.skuOptions)?void 0:d.theme)||{token:{colorPrimary:null==m?void 0:m["--primary"],colorPrimaryBg:null==m?void 0:m["--primary-soft"]}},config:(null==(c=e.skuOptions)?void 0:c.config)||{overSold:+!!lW(g.productDetail.over_sold)},dataSource:g.productDetail,value:e.configuration.skuValue,variantDraft:e.configuration.variantDraft,selectionKey:g.selectionKey,initializationPolicy:f||"edit-draft"===g.intent?"preserve":(null==(u=e.skuOptions)?void 0:u.initializationPolicy)||"auto-required-defaults",disabled:!!e.busy||k,customScrollParent:j||void 0,className:"pisell-booking-product-detail-sku",onChange:(t,l)=>{if(b||k||e.busy)return;let i={skuValue:t,variantDraft:void 0===l?E.current.variantDraft:l.variantDraft};E.current=i,e.onConfigurationChange(i),S(void 0)}})}),!B&&H&&"booking"===h&&e.renderBooking({plan:g,configuration:e.configuration,busy:q,scrollContainer:j,backToConfiguration:W})]})})}let eQO=function(e){let t,l=eKn();if(!e.plan)return null;let i=(0,eB.jsx)(eQE,{...e},JSON.stringify([(t=e.plan).openId,t.scopeKey,t.detailRevision,t.mode,t.selectionKey]));return l?i:(0,eB.jsx)(eKC,{lang:e.locale||"en",children:i})},eQz={en:{date:"Choose a date",time:"Choose a time",room:"Choose a room",resource:"Choose an area",selectTime:"Choose a time to see available areas.",selectRoom:"Choose a room for this time.",timeBeforeRoom:"Choose a time to see available rooms.",timeForRooms:"Choose available rooms for this time.",checking:"Checking availability…",noTimes:"No available times for this selection.",noResources:"No resources are available for this selection.",none:"No selection",optional:"Optional",retry:"Check again",reselect:"Choose again",unavailable:"Unavailable for this selection",selectedUnavailable:"Your previous selection is unavailable. Please choose again.",configuration:"This product’s booking configuration is incomplete. Please contact the venue.",resourceRequired:"Choose one option in each required group.",singleResource:"Choose one option in this group.",chooseTime:"Choose an available time.",quantity:"Choose a valid quantity.",changed:"Your selection has changed. Please review it before continuing.",requestFailed:"Availability could not be checked. Please try again.",reconciliation:"The booking result needs to be checked. Return to your order before trying again.",ready:"This selection is available.",dateFailed:"The date could not be changed. Please try again."},zh:{date:"选择日期",time:"选择时间",room:"选择房间",resource:"选择区域",selectTime:"请先选择时间,再查看可用区域。",selectRoom:"请选择该时段的房间。",timeBeforeRoom:"请先选择时间,再查看可用房间。",timeForRooms:"请先选择在该时段可用的房间。",checking:"正在查询可用性…",noTimes:"当前选择没有可用时段。",noResources:"当前选择没有可用资源。",none:"不选择",optional:"选填",retry:"重新查询",reselect:"重新选择",unavailable:"当前选择不可用",selectedUnavailable:"之前选择的时间或资源已不可用,请重新选择。",configuration:"该商品的预约配置不完整,请联系场馆。",resourceRequired:"请为每个必选组选择一项。",singleResource:"同一组只能选择一项。",chooseTime:"请选择可用时段。",quantity:"请选择有效数量。",changed:"选择已变更,请核对后继续。",requestFailed:"暂时无法查询可用性,请重试。",reconciliation:"本次预约写入结果需要核对,请返回订单查看后再试。",ready:"当前选择可用。",dateFailed:"日期变更失败,请重试。"}};function eQL(e,t){let l=eQz[t],i={past:["This time has passed.","该时段已结束。"],outside_operating_hours:["Outside venue opening hours.","不在场馆营业时间内。"],outside_resource_window:["This area is not open at this time.","该资源在此时段不开放。"],schedule_excluded_date:["Not offered on this date.","此日期未开放预订。"],capacity_full:["Not enough capacity for this selection.","剩余容量不足。"],resource_capacity_exceeded:["Not enough capacity for this selection.","剩余容量不足。"],resource_occupied:["Already booked at this time.","该时段已被预订。"],cart_occupied:["Reserved by another item in your order.","与订单内另一项预约冲突。"],selection_occupied:["Conflicts with the current selection.","与当前选择冲突。"],booking_cutoff_invalid:["Booking rules need to be checked by the venue.","预订截止配置有误,请联系场馆。"],booking_cutoff_future_day:["This date is not open for booking yet.","该日期暂未开放预订。"],booking_cutoff_after_start:["The booking deadline has passed.","已过预订截止时间。"],booking_cutoff_before_start:["The booking deadline has passed.","已过预订截止时间。"],booking_cutoff_advance:["The booking deadline has passed.","已过预订截止时间。"]};return i[e]?i[e][+("zh"===t)]:e.includes("CONFIGURATION")||"UNSUPPORTED_RESOURCE_GROUP"===e||"AVAILABILITY_UNSUPPORTED"===e?l.configuration:"RESOURCE_REQUIRED"===e?l.resourceRequired:"PARTY_ROOM_REQUIRED"===e?l.selectRoom:"RESOURCE_SINGLE_SELECTION_REQUIRED"===e?l.singleResource:"TIME_REQUIRED"===e?l.chooseTime:"QUANTITY_REQUIRED"===e||"SINGLE_BOOKING_REQUIRED"===e?l.quantity:"NO_AVAILABLE_TIME"===e?l.noTimes:"AUTOMATIC_RESOURCE_UNAVAILABLE"===e?l.noResources:"SELECTED_TIME_UNAVAILABLE"===e||"SELECTED_RESOURCE_UNAVAILABLE"===e?l.selectedUnavailable:e.endsWith("_CHANGED")||"BOOKING_SELECTION_NOT_READY"===e?l.changed:"AVAILABILITY_REQUEST_FAILED"===e?l.requestFailed:l.unavailable}function eQR(e,t){var l;return(null==t||null==(l=t[String(e.formId??e.groupId)])?void 0:l.resourceSelectionMode)==="automatic"}let eQ$=e=>{var t;return(Array.isArray(null==e||null==(t=e.product_resource)?void 0:t.resources)?e.product_resource.resources:[]).filter(e=>0!==Number(e.status)).map(e=>({groupId:String(e.id??e.form_id??e.code),formId:e.id??e.form_id}))};function eQF(e,t){return!e||eQ$(e).some(e=>!eQR(e,t))}let eQq=(e,t)=>null!=e.requirementGroupId?String(e.requirementGroupId)===String(t.groupId):null!=e.formId&&null!=t.formId&&String(e.formId)===String(t.formId),eQB=e=>{if(null==e||""===e)return;let t=Number(e);return Number.isSafeInteger(t)&&t>0?t:void 0},eQH=e=>{if(!(!e.length||e.some(e=>!Number.isSafeInteger(Number(null==e?void 0:e.value))||0>Number(null==e?void 0:e.value))))return eQB(e.reduce((e,t)=>e+Number(t.value),0))};function eQV(e,t){var l,i,a,n,r,o;let s,d,c=void 0===t?null==e||null==(l=e._extend)?void 0:l.other:q4(null==e||null==(i=e._extend)?void 0:i.other,t),u={...e,id:(null==e?void 0:e.id)??(null==e?void 0:e.product_id),_extend:{...(null==e?void 0:e._extend)||{},other:c}},p=[],m=(null==e||null==(a=e._data)?void 0:a.capacitys)??(null==e?void 0:e.capacity),g=[];if((null==m?void 0:m.type)==="product")s=eQH(g=nc({capacitys:m,cacheItem:u}));else if((null==m?void 0:m.type)==="package")s=eQH(g=nc({capacitys:m,cacheItem:u}));else if((null==m?void 0:m.type)==="custom"){let t=Array.isArray(m.custom)?m.custom:[],l=Array.isArray(null==e||null==(n=e._extend)?void 0:n.capacity)?e._extend.capacity:[];t.length&&t.every(e=>{let t=l.find(t=>String(null==t?void 0:t.id)===String(e.id)),i=Number(null==t?void 0:t.value);return t&&Number.isSafeInteger(i)&&i>=Number(e.min)&&i<=Number(e.max)})?g=t.map(e=>l.find(t=>String(t.id)===String(e.id))):t.length&&t.every(e=>Number.isSafeInteger(Number(e.min))&&Number(e.min)>=0&&Number(e.min)<=Number(e.max))&&(g=nc({capacitys:m,cacheItem:u})),s=eQH(g)??eQB(m.default)}else{s=eQB((null==m?void 0:m.default)??m);let t=null==e||null==(r=e._extend)?void 0:r.capacity;if(!s&&Array.isArray(t)&&(s=eQH(t)),!s){let t=((null==e||null==(o=e.product_resource)?void 0:o.resources)||[]).filter(e=>(null==e?void 0:e.status)!==0).map(e=>eQB(e.capacity_required));t.length&&t.every(e=>e===t[0]&&void 0!==e)&&(s=t[0])}}s||p.push("CAPACITY_CONFIGURATION_REQUIRED"),g.length&&(u._extend.capacity=g);let h=(null==e?void 0:e.duration)??(null==e?void 0:e.service_duration),v=null==h?void 0:r7(h);if("flexible"===v);else if("number"==typeof v||"string"==typeof v){let e=Number(v);Number.isFinite(e)&&e>0?d=e:null!=v&&p.push("DURATION_CONFIGURATION_REQUIRED")}else null!=v&&p.push("UNSUPPORTED_DURATION_CONFIGURATION");let f=u.id;return null!=f&&""!==f&&Number.isFinite(Number(f))||p.push("PRODUCT_CONFIGURATION_REQUIRED"),{product:u,productId:f,partySize:s,durationMinutes:d,reasonCodes:p}}function eQU(e){var t;let l={},i=null==e||null==(t=e.product_resource)?void 0:t.resources;return Array.isArray(i)&&i.filter(e=>(null==e?void 0:e.status)!==0).forEach((e,t)=>{var i;let a=e.id??e.form_id??e.code??`requirement-${t}`,n=[...Array.isArray(e.default_resource)?e.default_resource:[],...Array.isArray(e.optional_resource)?e.optional_resource:[],...(null==(i=e.combined_resource)?void 0:i.status)===1&&Array.isArray(e.combined_resource.resource_ids)?e.combined_resource.resource_ids:[]].filter(e=>"string"==typeof e||"number"==typeof e);l[String(a)]=n.filter((e,t)=>n.findIndex(t=>String(t)===String(e))===t)}),l}function eQY(e){var t,l,i,a;let n=e.product||{};return JSON.stringify({mode:e.mode,date:e.date,quantity:e.quantity,edit:e.editingProductLineUid,disabled:e.disabled,resourcePolicy:(a=e.resourceSettings,JSON.stringify(eQ$(n).map(e=>[String(e.formId??e.groupId),eQR(e,a)]).sort((e,t)=>String(e[0]).localeCompare(String(t[0]))))),resourceSettingsReady:!1!==e.resourceSettingsReady,resourceSettingsFailed:!!e.resourceSettingsFailed,id:n.id??n.product_id,updatedAt:n.updated_at,sku:Ba((null==(t=n._extend)?void 0:t.other)??n.product_sku),capacity:(null==(l=n._data)?void 0:l.capacitys)??n.capacity,capacityValue:null==(i=n._extend)?void 0:i.capacity,duration:n.duration,serviceDuration:n.service_duration,resources:n.product_resource,schedule:n.schedule,schedules:n.schedules,session:n.session})}class eQW extends Error{constructor(e,t=Array.from(new Set(e.map(e=>eQL(e,"en")))).join(" ")){super(t),e2(this,"reasonCodes",void 0),this.reasonCodes=e,this.name="BookingSelectionError"}}let eQG=(e,t)=>String(e)===String(t),eQK=(e,t)=>("available"===e.status||"limited"===e.status)&&(null==e.maxPartySize||e.maxPartySize>=t);function eQQ(e,t){return!!e&&!!t&&eQG(e.productId,t.productId)&&e.key===t.key&&e.source===t.source&&e.date===t.date&&e.businessDate===t.businessDate&&e.startAt===t.startAt&&e.endAt===t.endAt&&e.bookingStartAt===t.bookingStartAt&&e.bookingEndAt===t.bookingEndAt&&e.timezone===t.timezone&&JSON.stringify(e.scheduleRefs)===JSON.stringify(t.scheduleRefs)&&JSON.stringify(e.primaryScheduleRef)===JSON.stringify(t.primaryScheduleRef)}let eQZ=(e,t)=>eQQ(e,t)&&(null==e?void 0:e.availabilityContextId)===(null==t?void 0:t.availabilityContextId)&&(null==e?void 0:e.availabilityContextVersion)===(null==t?void 0:t.availabilityContextVersion);function eQJ(e){return JSON.stringify([String(e.productId),e.date,e.businessDate,e.startAt,e.endAt,e.bookingStartAt||e.startAt,e.bookingEndAt||e.endAt,e.timezone])}function eQX(e,t){let l=new Map;for(let i of e){let e=eQJ(i),a=l.get(e);a?(a.candidates.push(i),!eQK(a.candidate,t)&&eQK(i,t)&&(a.candidate=i)):l.set(e,{id:e,candidate:i,candidates:[i]})}return Array.from(l.values())}function eQ0(e,t){return null!=e.requirementGroupId?eQG(e.requirementGroupId,t.groupId):null!=e.formId&&null!=t.formId&&eQG(e.formId,t.formId)}function eQ2(e){return JSON.stringify({candidate:e.candidate&&{productId:e.candidate.productId,key:e.candidate.key,startAt:e.candidate.startAt,endAt:e.candidate.endAt},selections:e.requirementSelections.map(e=>({group:e.requirementGroupId,form:e.formId,ids:e.resourceIds.map(String).sort()})).sort((e,t)=>String(e.group??e.form).localeCompare(String(t.group??t.form)))})}function eQ1(e,t,l){let i=[];for(let n of e){var a;let e=t.filter(e=>eQ0(e,n)),r=(null==(a=e[0])?void 0:a.resourceIds)||[],o=Math.max(+!!n.required,n.min||0);(o>1||n.max<o)&&i.push("UNSUPPORTED_RESOURCE_GROUP"),(e.length>1||r.length>1||r.length>n.max)&&i.push("RESOURCE_SINGLE_SELECTION_REQUIRED"),r.length<o&&i.push("RESOURCE_REQUIRED"),r.some(e=>!n.options.some(t=>eQG(t.resourceId,e)&&eQK(t,l)))&&i.push("SELECTED_RESOURCE_UNAVAILABLE")}return t.some(t=>t.resourceIds.length&&!e.some(e=>eQ0(t,e)))&&i.push("SELECTED_RESOURCE_UNAVAILABLE"),Array.from(new Set(i))}function eQ4(e,t,l,i){let a=eQU(l),n=t.map(e=>({...e,resourceIds:[...e.resourceIds]}));for(let t of e){if(n.some(e=>eQ0(e,t)&&e.resourceIds.length))continue;let e=a[t.groupId]||(null==t.formId?[]:a[String(t.formId)])||[];if((t.required||t.min>0)&&1===e.length&&t.max>=1&&t.options.some(t=>eQG(t.resourceId,e[0])&&eQK(t,i))){let l={requirementGroupId:t.groupId,formId:t.formId,resourceIds:[e[0]]},i=n.findIndex(e=>eQ0(e,t));-1===i?n.push(l):n[i]=l}}return n}function eQ3(e,t){var l;t&&(null==(l=e.releaseAvailabilityContext)||l.call(e,t.contextId))}function eQ8(e,t){let l=Array.from(new Set(t.filter(eQw))).sort(),i=l.indexOf(e);if(i<0)return{startDate:e,endDate:e};let a=i,n=i;for(;a>0&&eQj(l[a],-1)===l[a-1];)a--;for(;n+1<l.length&&eQj(l[n],1)===l[n+1];)n++;return{startDate:l[a],endDate:l[n]}}async function eQ6(e,t){let l;var i,a=e.os;if(!a.prepareAvailabilityProjection||!a.getProductTimeRanges||!a.queryBookingAvailability||!a.releaseAvailabilityContext)throw new eQW(["AVAILABILITY_UNSUPPORTED"]);let n=(l=eQV(e.product).reasonCodes,/^\d{4}-\d{2}-\d{2}$/.test(e.date)&&!Number.isNaN(Date.parse(`${e.date}T00:00:00Z`))&&new Date(`${e.date}T00:00:00Z`).toISOString().slice(0,10)===e.date||l.push("DATE_REQUIRED"),eQB(e.quantity)||l.push("QUANTITY_REQUIRED"),("party"===e.mode||e.editingProductLineUid)&&1!==e.quantity&&l.push("SINGLE_BOOKING_REQUIRED"),l);if(n.length)throw new eQW(n);let r=eQV(e.product),o=r.partySize,s=o*e.quantity;if(!Number.isSafeInteger(s))throw new eQW(["CAPACITY_CONFIGURATION_REQUIRED"]);let d={startDate:e.date,endDate:e.date},c=null==t?void 0:t.projectionDateRange,u=c&&eQw(c.startDate)&&eQw(c.endDate)&&c.startDate<=e.date&&c.endDate>=e.date?c:d,p={productIds:[r.productId],rawProducts:[r.product],dateRange:u,editingProductLineUids:e.editingProductLineUid?[e.editingProductLineUid]:void 0,publishCatalog:!1,refreshOccupancies:!1,strictAvailability:!0,mode:"appointment",occupancyCachePolicy:"session"},m=await e.os.prepareAvailabilityProjection(p);try{let t=(await e.os.getProductTimeRanges(m.contextId,{productIds:[r.productId],dateRange:d,partySize:s,...r.durationMinutes?{durationMinutesByProductId:{[String(r.productId)]:r.durationMinutes}}:{},...e.editingProductLineUid&&(null==(i=e.initialSelection)?void 0:i.candidate)&&r.durationMinutes?{editingStartAtByProductId:{[String(r.productId)]:e.initialSelection.candidate.startAt}}:{}})).filter(e=>eQG(e.productId,r.productId)).flatMap(e=>e.ranges||[]),l=t.length?await e.os.queryBookingAvailability(m.contextId,{target:"time",productIds:[r.productId],candidates:t,partySize:s}):void 0,a=((null==l?void 0:l.data)||[]).filter(e=>eQG(e.productId,r.productId)).flatMap(e=>e.times||[]).filter(t=>t.availabilityContextId===m.contextId&&(t.businessDate||t.date)===e.date),n=e.os.getAvailabilityResources?Array.from(await e.os.getAvailabilityResources(m.contextId,"number"==typeof(null==l?void 0:l.contextVersion)?l.contextVersion:void 0)):[];return{contextId:m.contextId,productId:r.productId,partySize:o,bookingCount:e.quantity,queryPartySize:s,times:a,resources:n,product:r.product}}catch(t){throw eQ3(e.os,m),t}}async function eQ5(e,t,l){var i;let a={target:"resource",productIds:[t.productId],selectedRanges:[l],partySize:t.queryPartySize,customerSelectionSnapshot:!0},n=(await e.queryBookingAvailability(t.contextId,a)).data.filter(e=>eQG(e.productId,t.productId)).flatMap(e=>e.ranges||[]).find(e=>eQZ(e.range,l));if(!n||!eQK(n,t.queryPartySize))throw new eQW((null==n||null==(i=n.reasonCodes)?void 0:i.length)?n.reasonCodes:["SELECTED_TIME_UNAVAILABLE"]);return{candidate:n.range,groups:n.requirementGroups||[]}}async function eQ7(e,t,l){let i=eQJ(l),a=t.times.filter(e=>eQJ(e)===i),n=[];for(let l=0;l<a.length;l+=2){let i=await Promise.all(a.slice(l,l+2).map(async l=>{try{return await eQ5(e,t,l)}catch(e){if(e instanceof eQW)return;throw e}}));n.push(...i.filter(e=>!!e))}if(!n.length)throw new eQW(["SELECTED_TIME_UNAVAILABLE"]);return n}function eQ9(e,t,l){let i=new Map;for(let a of e)for(let e of a.groups){let n=i.get(e.groupId);n||(n={...e,options:[]},i.set(e.groupId,n));let r=t.filter(t=>!eQ0(t,e)),o=eQ1(a.groups,r,l.queryPartySize).every(e=>"RESOURCE_REQUIRED"===e);for(let t of e.options){let e=o?t:{...t,status:"unavailable",reasonCodes:["SELECTED_RESOURCE_UNAVAILABLE"]},i=n.options.findIndex(t=>eQG(t.resourceId,e.resourceId));i<0?n.options.push(e):!eQK(n.options[i],l.queryPartySize)&&eQK(e,l.queryPartySize)&&(n.options[i]=e)}}return eZe(Array.from(i.values()),l)}function eZe(e,t){let l=eQU(t.product);return e.map(e=>{let i=[...e.options];for(let a of l[e.groupId]||[])if(!i.some(e=>eQG(e.resourceId,a))){let e=t.resources.find(e=>eQG(e.id,a));i.push({resourceId:a,resourceName:null==e?void 0:e.name,status:"unavailable",reasonCodes:["RESOURCE_NOT_AVAILABLE_IN_CONTEXT"]})}return{...e,options:i}})}function eZt(e,t){return e.resources.filter(e=>t.some(t=>t.resourceIds.some(t=>eQG(t,e.id))))}let eZl=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return{status:"idle",ready:!1,reasonCodes:[],bookingCount:e,times:[],resourceGroups:[],resources:[],selectedResourceDetails:[],requirementSelections:[],resourceScrollRevision:0}},eZi=e=>e instanceof eQW?e.reasonCodes:["AVAILABILITY_REQUEST_FAILED"],eZa=e=>e instanceof Error?e.message:String(e),eZn=e=>(null==e?void 0:e.resourceSettingsReady)===!1||(null==e?void 0:e.resourceSettingsFailed)===!0,eZr=e=>({candidate:null==e?void 0:e.candidate,requirementSelections:((null==e?void 0:e.requirementSelections)||[]).map(e=>({...e,resourceIds:[...e.resourceIds]}))});class eZo{publish(e){this.disposed||(this.state={...this.state,...e},this.listeners.forEach(e=>e()))}releaseCurrent(){this.input&&eQ3(this.input.os,this.projection),this.projection=void 0}async setInput(e){var t;let l=eQY(e);if(this.disposed)return;if(l===this.inputKey&&e.os===(null==(t=this.input)?void 0:t.os)){this.input=e;return}let i=this.input,a=this.intent.candidate;if(i&&this.projection&&a&&!this.committing&&!e.disabled&&!this.state.requiresOrderReconciliation&&e.os===i.os&&(e.quantity===i.quantity||"ticket"===e.mode&&!e.editingProductLineUid)&&Number.isSafeInteger(e.quantity)&&e.quantity>0&&Number.isSafeInteger(this.projection.partySize*e.quantity)&&eQY({...e,quantity:i.quantity,resourceSettings:i.resourceSettings,resourceSettingsReady:i.resourceSettingsReady,resourceSettingsFailed:i.resourceSettingsFailed})===this.inputKey)return(this.input=e,this.inputKey=l,this.generation++,this.queryRevision++,this.projection={...this.projection,bookingCount:e.quantity,queryPartySize:this.projection.partySize*e.quantity},this.publish({bookingCount:e.quantity}),eZn(e))?void this.publish({status:e.resourceSettingsFailed?"error":"loading",ready:!1,reasonCodes:e.resourceSettingsFailed?["AVAILABILITY_REQUEST_FAILED"]:[],error:void 0}):void await this.resolveTime(a,!1);let n=i&&!eQG(i.product.id??i.product.product_id,e.product.id??e.product.product_id);(!i||n||i.editingProductLineUid!==e.editingProductLineUid?this.intent=eZr(e.initialSelection):i.date!==e.date&&(this.intent={requirementSelections:[]}),this.releaseCurrent(),this.input=e,this.inputKey=l,this.generation++,this.queryRevision++,this.committing)?this.publish({ready:!1}):await this.load()}async load(){let e,t=this.input;if(!t||this.disposed)return;if(t.disabled)return void this.publish({...eZl(t.quantity),status:"blocked",reasonCodes:["BOOKING_DISABLED"]});if(eZn(t))return void this.publish({...eZl(t.quantity),...eZr(this.intent),status:t.resourceSettingsFailed?"error":"loading",reasonCodes:t.resourceSettingsFailed?["AVAILABILITY_REQUEST_FAILED"]:[]});let l=this.generation;this.publish({...eZl(t.quantity),status:"loading",...eZr(this.intent)});try{if(e=await eQ6({...t,initialSelection:this.intent}),this.disposed||l!==this.generation)return void eQ3(t.os,e);this.projection=e;let i=eZe(function(e){let t=new Map;for(let l of e.times)for(let i of l.requirementGroups||[]){let a=t.get(i.groupId);for(let n of(a||(a={...i,options:[]},t.set(i.groupId,a)),i.options||[])){let t=eQK(l,e.queryPartySize)?n:{...n,status:"unavailable"},i=a.options.findIndex(e=>eQG(e.resourceId,t.resourceId));i<0?a.options.push(t):!eQK(a.options[i],e.queryPartySize)&&eQK(t,e.queryPartySize)&&(a.options[i]=t)}}return Array.from(t.values())}(e),e);this.publish({contextId:e.contextId,productId:e.productId,partySize:e.partySize,bookingCount:e.bookingCount,times:e.times,resourceGroups:i,resources:e.resources});let a=e.times.find(t=>eQQ(t,this.intent.candidate)&&eQK(t,e.queryPartySize));if(a)return void await this.resolveTime(a,!1);let n=eQX(e.times,e.queryPartySize).filter(t=>eQK(t.candidate,e.queryPartySize));if("ticket"===t.mode&&!this.intent.candidate&&1===n.length)return void await this.resolveTime(n[0].candidate,!1);let r=e.times.some(t=>eQK(t,e.queryPartySize))?[]:["NO_AVAILABLE_TIME"];this.intent.candidate&&r.push("SELECTED_TIME_UNAVAILABLE"),"party"!==t.mode||i.length||r.push("PARTY_ROOM_CONFIGURATION_REQUIRED"),this.publish({status:r.length?"blocked":"selecting",ready:!1,reasonCodes:r,...eZr(this.intent),selectedResourceDetails:eZt(e,this.intent.requirementSelections)})}catch(e){if(this.disposed||l!==this.generation)return;this.publish({status:"error",ready:!1,reasonCodes:eZi(e),error:eZa(e)})}}async resolveTime(e,t){let l=this.projection,i=this.input;if(!l||!i)return;let a=this.generation,n=++this.queryRevision;this.intent={...this.intent,candidate:e},this.publish({status:"loading",ready:!1,reasonCodes:[],error:void 0,...eZr(this.intent)});try{let r=await eQ7(i.os,l,e);if(this.disposed||a!==this.generation||n!==this.queryRevision)return;let o=[...r].sort((t,l)=>Number(eQQ(l.candidate,e))-Number(eQQ(t.candidate,e))),s=r.some(e=>e.groups.some(e=>eQR(e,i.resourceSettings)))?void 0:eQ4(eQ9(r,this.intent.requirementSelections,l),this.intent.requirementSelections,l.product,l.queryPartySize),d=o.map(e=>{let t=s||eQ4(e.groups,this.intent.requirementSelections,l.product,l.queryPartySize),a=function(e,t,l,i){let a=t.map(e=>({...e,resourceIds:[...e.resourceIds]})),n=[];for(let t of e){if(!eQR(t,l))continue;let e=a.filter(e=>eQq(e,t)),r=Vk({...t,options:t.options.filter(e=>null==e.maxPartySize||e.maxPartySize>=i)}),o=1===e.length&&1===e[0].resourceIds.length&&r.some(t=>String(t.resourceId)===String(e[0].resourceIds[0])),s=t.min>1||t.max<1,d=s?[]:o?e[0].resourceIds:Vw({...t,options:r},{mode:"availability"});for(let e=a.length-1;e>=0;e--)eQq(a[e],t)&&a.splice(e,1);a.push({requirementGroupId:t.groupId,formId:t.formId,resourceIds:d}),s?n.push("UNSUPPORTED_RESOURCE_GROUP"):1!==d.length&&n.push("AUTOMATIC_RESOURCE_UNAVAILABLE")}return{selections:a,reasonCodes:n}}(e.groups,t,i.resourceSettings,l.queryPartySize);return{result:e,selections:a.selections,reasons:Array.from(new Set([...eQ1(e.groups,a.selections,l.queryPartySize),...a.reasonCodes]))}}),c=d.find(e=>!e.reasons.length)||d.find(e=>e.reasons.every(e=>"RESOURCE_REQUIRED"===e))||d[0],{result:u,selections:p}=c;this.intent={candidate:u.candidate,requirementSelections:p};let m=[...c.reasons];"party"!==i.mode||u.groups.length||m.push("PARTY_ROOM_CONFIGURATION_REQUIRED"),"party"!==i.mode||this.intent.requirementSelections.some(e=>e.resourceIds.length)||m.push("PARTY_ROOM_REQUIRED");let g=p.filter(e=>!r.some(t=>t.groups.some(t=>eQR(t,i.resourceSettings)&&eQ0(e,t))));return this.publish({status:m.length?"selecting":"ready",ready:!m.length,reasonCodes:m,...eZr(this.intent),resourceGroups:eQ9(r,g,l),selectedResourceDetails:eZt(l,this.intent.requirementSelections),resourceScrollRevision:this.state.resourceScrollRevision+(t&&u.groups.length?1:0)}),this.state}catch(e){if(this.disposed||a!==this.generation||n!==this.queryRevision)return;this.publish({status:"error",ready:!1,reasonCodes:eZi(e),error:eZa(e)})}}dispose(){this.disposed||(this.disposed=!0,this.generation++,this.queryRevision++,this.releaseCurrent(),this.listeners.clear())}constructor(){var e=this;e2(this,"input",void 0),e2(this,"inputKey",""),e2(this,"projection",void 0),e2(this,"intent",{requirementSelections:[]}),e2(this,"generation",0),e2(this,"queryRevision",0),e2(this,"disposed",!1),e2(this,"committing",!1),e2(this,"listeners",new Set),e2(this,"state",eZl()),e2(this,"getSnapshot",()=>this.state),e2(this,"isInputCurrent",e=>{var t;return!this.disposed&&(null==(t=this.input)?void 0:t.os)===e.os&&this.inputKey===eQY(e)}),e2(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)})),e2(this,"refresh",async()=>{this.disposed||!this.input||this.committing||this.state.requiresOrderReconciliation||(this.generation++,this.queryRevision++,this.releaseCurrent(),await this.load())}),e2(this,"resetSelection",async()=>{this.committing||this.disposed||this.state.requiresOrderReconciliation||(this.intent={requirementSelections:[]},await this.refresh())}),e2(this,"canSelectTime",e=>{var t;let l=this.projection;return!!l&&!this.committing&&!(null==(t=this.input)?void 0:t.disabled)&&!eZn(this.input)&&!this.state.requiresOrderReconciliation&&"loading"!==this.state.status&&"committed"!==this.state.status&&eQK(e,l.queryPartySize)}),e2(this,"selectTime",async e=>{var t;if(!this.canSelectTime(e))return;let l=null==(t=this.projection)?void 0:t.times.find(t=>eQQ(t,e)&&t.availabilityContextId===e.availabilityContextId&&t.availabilityContextVersion===e.availabilityContextVersion);if(l)return this.resolveTime(l,!0)}),e2(this,"selectResource",async(e,t)=>{let l=this.projection,i=this.input;if(!l||!i||i.disabled||eZn(i)||this.committing||"loading"===this.state.status||"committed"===this.state.status||this.state.requiresOrderReconciliation)return;let a=this.state.resourceGroups,n=a.find(t=>eQG(t.groupId,e));if(!n||!this.intent.candidate||eQR(n,i.resourceSettings)||null==t&&(n.required||n.min>0)||null!=t&&!n.options.some(e=>eQG(e.resourceId,t)&&eQK(e,l.queryPartySize)))return;let r=this.intent.requirementSelections.filter(e=>!eQ0(e,n));r.push({requirementGroupId:n.groupId,formId:n.formId,resourceIds:null==t?[]:[t]}),this.intent={...this.intent,requirementSelections:r},this.queryRevision++;let o=l.times.find(e=>eQQ(e,this.intent.candidate));if(o&&eQK(o,l.queryPartySize))return this.resolveTime(o,!1);this.publish({status:"selecting",ready:!1,reasonCodes:this.intent.candidate?["SELECTED_TIME_UNAVAILABLE"]:[],...eZr(this.intent),resourceGroups:a,selectedResourceDetails:eZt(l,r)})}),e2(this,"commit",async function(t){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.input;if(!(null==i?void 0:i.os.commitAvailabilitySelection))throw new eQW(["AVAILABILITY_UNSUPPORTED"]);let a=e.projection;if(e.disposed||e.committing||!e.state.ready||!a||!e.intent.candidate||e.state.requiresOrderReconciliation)throw new eQW(["BOOKING_SELECTION_NOT_READY"]);if(!eQG(t.product_id??t.id,a.productId))throw new eQW(["PRODUCT_SELECTION_CHANGED"]);if(Number(t.num??t.quantity)!==i.quantity)throw new eQW(["QUANTITY_SELECTION_CHANGED"]);let n=l.mode||(i.editingProductLineUid?"edit":"add");if("add"!==n&&!i.editingProductLineUid||"add"===n&&i.editingProductLineUid)throw new eQW(["BOOKING_EDIT_IDENTITY_REQUIRED"]);if("replace"===n&&!Array.isArray(l.relatedRetailProducts))throw new eQW(["RELATED_PRODUCTS_REQUIRED"]);let r=e.generation,o=e.inputKey,s=eZr(e.intent),d=eQ2(s),c=()=>{var t,i;if(e.disposed||e.generation!==r||e.inputKey!==o||eQ2(e.intent)!==d||(null==(t=e.input)?void 0:t.disabled)||eZn(e.input))throw new eQW(["BOOKING_SELECTION_CHANGED"]);null==(i=l.availabilityCommitGuard)||i.call(l)};e.committing=!0,e.publish({status:"committing",ready:!1,reasonCodes:[],error:void 0});let u=!1;try{var p,m;c(),u=!0;let r=i.os.commitAvailabilitySelection,o=await r.call(i.os,a.contextId,{...l,mode:n,customerSelectionSnapshot:!0,productLineUid:i.editingProductLineUid,orderProduct:t,candidate:s.candidate,requirementSelections:s.requirementSelections,partySize:a.partySize,bookingCount:a.bookingCount,availabilityCommitGuard:c});if((null==(p=o.validation)?void 0:p.ok)===!1)throw new eQW((null==(m=o.validation.conflicts)?void 0:m.map(e=>e.code||"BOOKING_COMMIT_FAILED"))||["BOOKING_COMMIT_FAILED"]);return e.publish({status:"committed",ready:!1,reasonCodes:[],candidate:s.candidate,selectedResourceDetails:eZt(a,s.requirementSelections)}),o}catch(l){let t=!!l&&"object"==typeof l&&"code"in l&&"BUSINESS_UNAVAILABLE"===l.code;throw e.publish({status:"error",ready:!1,reasonCodes:eZi(l),error:eZa(l),requiresOrderReconciliation:u&&!t}),l}finally{e.committing=!1}})}}function eZs(e){let{label:t,value:l,options:i,onChange:a,onReselect:n,describedBy:r,invalid:o}=e,s=dL("booking-time");return(0,eB.jsx)("div",{className:"time-choices-grid","data-has-end":i.some(e=>!!e.end),role:"radiogroup","aria-label":t,"aria-describedby":r,"aria-invalid":o||void 0,children:i.map(e=>(0,eB.jsxs)("label",{className:"time-choice",children:[(0,eB.jsx)("input",{className:"sr-only",type:"radio",name:s,value:e.id,checked:l===e.id,disabled:e.disabled,onChange:()=>a(e.id),onKeyDown:t=>{n&&l===e.id&&(" "===t.key||"Enter"===t.key)&&(t.preventDefault(),n())},onClick:()=>{l===e.id&&(null==n||n())}}),(0,eB.jsxs)("span",{className:"time-choice-card",children:[l===e.id&&(0,eB.jsx)(eK5,{className:"time-choice-check",size:12,weight:"fill","aria-hidden":"true"}),(0,eB.jsxs)("span",{children:[e.indicator&&(0,eB.jsx)("span",{className:"time-choice-availability","data-tone":e.indicator.tone,role:"img","aria-label":e.indicator.label}),e.start,e.end&&`–${e.end}`]}),e.description&&(0,eB.jsx)("small",{children:e.description})]})]},e.id))})}function eZd(e){let{label:t,value:l}=e;return(0,eB.jsxs)("div",{className:"time-choice-validity",role:"status","aria-live":"polite","aria-atomic":"true",children:[(0,eB.jsx)("strong",{children:t}),(0,eB.jsx)("span",{children:l})]})}let eZc=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M125.18,156.94a64,64,0,1,0-82.36,0,100.23,100.23,0,0,0-39.49,32,12,12,0,0,0,19.35,14.2,76,76,0,0,1,122.64,0,12,12,0,0,0,19.36-14.2A100.33,100.33,0,0,0,125.18,156.94ZM44,108a40,40,0,1,1,40,40A40,40,0,0,1,44,108Zm206.1,97.67a12,12,0,0,1-16.78-2.57A76.31,76.31,0,0,0,172,172a12,12,0,0,1,0-24,40,40,0,1,0-10.3-78.67,12,12,0,1,1-6.16-23.19,64,64,0,0,1,57.64,110.8,100.23,100.23,0,0,1,39.49,32A12,12,0,0,1,250.1,205.67Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M136,108A52,52,0,1,1,84,56,52,52,0,0,1,136,108Z",opacity:"0.2"}),eN.createElement("path",{d:"M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M164.47,195.63a8,8,0,0,1-6.7,12.37H10.23a8,8,0,0,1-6.7-12.37,95.83,95.83,0,0,1,47.22-37.71,60,60,0,1,1,66.5,0A95.83,95.83,0,0,1,164.47,195.63Zm87.91-.15a95.87,95.87,0,0,0-47.13-37.56A60,60,0,0,0,144.7,54.59a4,4,0,0,0-1.33,6A75.83,75.83,0,0,1,147,150.53a4,4,0,0,0,1.07,5.53,112.32,112.32,0,0,1,29.85,30.83,23.92,23.92,0,0,1,3.65,16.47,4,4,0,0,0,3.95,4.64h60.3a8,8,0,0,0,7.73-5.93A8.22,8.22,0,0,0,252.38,195.48Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M112.6,158.43a58,58,0,1,0-57.2,0A93.83,93.83,0,0,0,5.21,196.72a6,6,0,0,0,10.05,6.56,82,82,0,0,1,137.48,0,6,6,0,0,0,10-6.56A93.83,93.83,0,0,0,112.6,158.43ZM38,108a46,46,0,1,1,46,46A46.06,46.06,0,0,1,38,108Zm211,97a6,6,0,0,1-8.3-1.74A81.8,81.8,0,0,0,172,166a6,6,0,0,1,0-12,46,46,0,1,0-17.08-88.73,6,6,0,1,1-4.46-11.14,58,58,0,0,1,50.14,104.3,93.83,93.83,0,0,1,50.19,38.29A6,6,0,0,1,249,205Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M107.19,159a56,56,0,1,0-46.38,0A91.83,91.83,0,0,0,6.88,197.81a4,4,0,1,0,6.7,4.37,84,84,0,0,1,140.84,0,4,4,0,1,0,6.7-4.37A91.83,91.83,0,0,0,107.19,159ZM36,108a48,48,0,1,1,48,48A48.05,48.05,0,0,1,36,108Zm212,95.35a4,4,0,0,1-5.53-1.17A83.81,83.81,0,0,0,172,164a4,4,0,0,1,0-8,48,48,0,1,0-17.82-92.58,4,4,0,1,1-3-7.43,56,56,0,0,1,44,103,91.83,91.83,0,0,1,53.93,38.86A4,4,0,0,1,248,203.35Z"}))]]),eZu=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eZc}));function eZp(e){let{label:t,value:l,options:i,onChange:a,disabled:n=!1}=e;return(0,eB.jsx)("div",{className:"resource-picker",role:"group","aria-label":t,children:i.map(e=>(0,eB.jsxs)("button",{type:"button",className:"resource-card","aria-pressed":l===e.id,disabled:n||e.disabled,onClick:()=>a(e.id),children:[e.image&&(0,eB.jsx)("img",{src:e.image,alt:""}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("h3",{children:e.name}),e.description&&(0,eB.jsx)("p",{children:e.description}),(e.capacity||e.price)&&(0,eB.jsxs)("div",{className:"resource-card-meta",children:[e.capacity&&(0,eB.jsxs)("span",{children:[(0,eB.jsx)(eZu,{size:15}),e.capacity]}),e.price&&(0,eB.jsx)("b",{children:e.price})]}),e.status&&(0,eB.jsx)("p",{children:e.status})]})]},e.id))})}eZu.displayName="UsersIcon";let eZm=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm-12-80V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,172Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm-6-82V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,172Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm-4-84V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,172Z"}))]]),eZg=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eZm}));eZg.displayName="WarningCircleIcon";let eZh=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),eZv=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eZh}));function eZf(e){let{children:t,tone:l="info",id:i,className:a="",icon:n}=e,r="error"===l||"warning"===l?eZg:"success"===l?eK5:eZv;return(0,eB.jsxs)("div",{id:i,className:`shared-notice ${l} ${a}`,role:"error"===l?"alert":"status",children:[n??(0,eB.jsx)(r,{size:20,"aria-hidden":"true"}),(0,eB.jsx)("div",{className:"shared-notice-content",children:t})]})}function eZy(e){let{title:t,description:l,icon:i,decoration:a,eyebrow:n,children:r,actions:o,className:s="",pending:d=!1,headingLevel:c=2}=e;return(0,eB.jsxs)("div",{className:`status-panel ${s}`,role:d?"status":void 0,children:[a,i&&(0,eB.jsx)("div",{className:"status-panel-icon","aria-hidden":"true",children:i}),n,t&&(0,eB.jsx)(1===c?"h1":3===c?"h3":"h2",{children:t}),l&&(0,eB.jsx)("p",{children:l}),r,o]})}eZv.displayName="InfoIcon";let eZb=e=>"number"==typeof e&&Number.isFinite(e)&&e>=0;function eZx(e,t){if(!Array.isArray(e.requirementGroups)||e.requirementGroups.some(e=>!e||"object"!=typeof e))return;let l=e.requirementGroups.filter(e=>!1!==e.required);if(!l.length)return;let i=l.map(e=>{let l=function(e){if(!(!Array.isArray(e.options)||e.options.some(e=>!e||!["available","limited","full","conflict","unavailable","past"].includes(e.status))))return e.options.filter(e=>"available"===e.status||"limited"===e.status)}(e);return void 0===l?void 0:t(l)});return i.every(eZb)?Math.min(...i):void 0}function eZk(e){if(!e.some(e=>!eZb(e.remainingCapacity)))return e.reduce((e,t)=>Math.max(e,t.remainingCapacity),0)}function eZ_(e){if(!e.some(e=>!eZb(e.remainingCapacity)))return e.reduce((e,t)=>e+t.remainingCapacity,0)}let eZw=(0,eN.forwardRef)((e,t)=>{let{locale:l="en",resourcePresentation:i=[]}=e,a=eQz[l],n=function(e){var t;let l=(0,eN.useRef)(e);l.current=e;let i=(0,eN.useRef)(null),[a,n]=(0,eN.useState)(()=>new eZo().getSnapshot()),r=eQY(e);(0,eN.useLayoutEffect)(()=>{let e=new eZo;i.current=e;let t=e.subscribe(()=>n(e.getSnapshot()));return e.setInput(l.current),()=>{t(),e.dispose(),i.current===e&&(i.current=null)}},[]),(0,eN.useLayoutEffect)(()=>{var e;null==(e=i.current)||e.setInput(l.current)},[r,e.os]);let o=(0,eN.useCallback)(async()=>{let e=i.current;e&&(await e.setInput(l.current),await e.refresh())},[]),s=(0,eN.useCallback)(async(e,t)=>{let a=i.current;if(!a)throw new eQW(["BOOKING_SELECTION_NOT_READY"]);if(!a.isInputCurrent(l.current))throw new eQW(["BOOKING_SELECTION_CHANGED"]);return a.commit(e,t)},[]),d=(0,eN.useCallback)(async e=>{let t=i.current;if(null==t?void 0:t.isInputCurrent(l.current)){let a=await t.selectTime(e);if(i.current===t&&t.isInputCurrent(l.current))return a}},[]),c=(0,eN.useCallback)(async(e,t)=>{let a=i.current;if(null==a?void 0:a.isInputCurrent(l.current)){let n=await a.selectResource(e,t);if(i.current===a&&a.isInputCurrent(l.current))return n}},[]),u=(0,eN.useCallback)(e=>{let t=i.current;return!!(null==t?void 0:t.isInputCurrent(l.current))&&t.canSelectTime(e)},[]),p=(0,eN.useCallback)(async()=>{var e;await (null==(e=i.current)?void 0:e.resetSelection())},[]);return{state:(null==(t=i.current)?void 0:t.isInputCurrent(e))?a:{...a,status:"loading",ready:!1},refresh:o,commit:s,selectTime:d,selectResource:c,canSelectTime:u,resetSelection:p}}(e),{state:r}=n,o=(0,eN.useRef)(e.onSelectionChange);o.current=e.onSelectionChange;let s=(0,eN.useRef)(e);s.current=e;let[d,c]=(0,eN.useState)(!1),u=(0,eN.useRef)(!1),[p,m]=(0,eN.useState)(!1),g=(0,eN.useRef)(null),h=(0,eN.useRef)(null),v=(0,eN.useRef)(),f=(0,eN.useRef)(null),y=(0,eN.useRef)(null),b=(0,eN.useRef)(!0),x=eKB();(0,eN.useEffect)(()=>(b.current=!0,()=>{b.current=!1}),[]);let k=(0,eN.useCallback)(async()=>{let e=s.current;if(e.resourceSettingsFailed&&e.onRetryResourceSettings){try{await e.onRetryResourceSettings()}catch{}return}await n.refresh()},[n.refresh]);(0,eN.useImperativeHandle)(t,()=>({refresh:k,commit:(e,t)=>n.commit(e,{...t,availabilityCommitGuard:()=>{var e;if(u.current)throw new eQW(["BOOKING_SELECTION_CHANGED"]);null==t||null==(e=t.availabilityCommitGuard)||e.call(t)}})}),[k,n.commit]),(0,eN.useEffect)(()=>{o.current(d?{...r,ready:!1}:r)},[r,d]);let _="loading"===r.status||"committing"===r.status||d,w=!!e.disabled||!!e.interactionDisabled||_||"committed"===r.status||!!r.requiresOrderReconciliation,S=e.reasonFormatter||(e=>eQL(e,l)),j=eQU(e.product),N=t=>t.resourceGroups.filter(l=>{if(!1===e.resourceSettingsReady||e.resourceSettingsFailed||eQR(l,e.resourceSettings))return!1;if("ticket"!==e.mode||!l.required&&0===l.min)return!0;let i=j[l.groupId]||(null==l.formId?[]:j[String(l.formId)])||[],a=t.requirementSelections.find(e=>eQ0(e,l));return!(1===i.length&&(null==a?void 0:a.resourceIds.length)===1&&eQG(i[0],a.resourceIds[0])&&l.options.some(e=>eQG(e.resourceId,i[0])&&eQK(e,(t.partySize||0)*t.bookingCount)))}),C=(e,t)=>{var l,i;null==(l=(i=s.current).onExplicitSelection)||l.call(i,e,t),!s.current.renderContent&&("time"===e&&N(t).length?x(()=>h.current):t.ready&&x(s.current.actionTarget||(()=>{var e,t;return(null==(t=g.current)||null==(e=t.closest('[role="dialog"]'))?void 0:e.querySelector(".reservation-submit"))||null}),{focus:"control"}))},M=async t=>{var l;if(w)return;let i=null==(l=e.operationLog)?void 0:l.capture(),a=await n.selectTime(t);return a&&b.current&&(null==i||i("time_selected",{productId:a.productId,selectedDate:e.date,startAt:t.bookingStartAt||t.startAt,endAt:t.bookingEndAt||t.endAt}),C("time",a)),a},T=async(t,l)=>{var i;if(w)return;let a=null==(i=e.operationLog)?void 0:i.capture(),r=await n.selectResource(t,l);return r&&b.current&&(null==a||a("resource_selected",{productId:r.productId,selectedDate:e.date,groupId:t,resourceId:l}),C("resource",r)),r},I=async t=>{if(!w){if(m(!1),t===e.date){y.current&&(y.current.open=!1),s.current.renderContent||x(()=>f.current);return}u.current=!0,c(!0);try{if(await e.onDateChange(t)===!1)return;b.current&&(y.current&&(y.current.open=!1),s.current.renderContent||x(()=>f.current))}catch{b.current&&m(!0)}finally{u.current=!1,b.current&&c(!1)}}},P=eQX(r.times,(r.partySize||0)*r.bookingCount),A=r.times.find(e=>eQQ(e,r.candidate)),D=A&&eQK(A,(r.partySize||0)*r.bookingCount)?r.candidate:void 0,E=D?`${r.contextId||""}:${eQJ(D)}`:void 0,O=!!E&&!d&&("selecting"===r.status||"ready"===r.status||v.current===E);(0,eN.useEffect)(()=>{!E||d?v.current=void 0:("selecting"===r.status||"ready"===r.status)&&(v.current=E)},[E,r.status,d]);let z="loading"===r.status||d?eQA(l,"timeLoading"):"error"===r.status?eQA(l,"timeLoadFailed"):D?`${eZS(D.bookingStartAt||D.startAt,D.startTime)}–${eZS(D.bookingEndAt||D.endAt,D.endTime)}`:eQA(l,P.some(e=>{let{candidate:t}=e;return eQK(t,(r.partySize||0)*r.bookingCount)})?"timeNotSelected":"timeUnavailable"),L="party"===e.mode&&!r.times.length&&("idle"===r.status||"loading"===r.status||d),R="party"===e.mode&&!r.times.length&&"error"===r.status&&!r.requiresOrderReconciliation,$=(0,eB.jsxs)("div",{ref:f,tabIndex:-1,children:["ticket"===e.mode&&(0,eB.jsx)(eZd,{label:eQA(l,"validPlayTime"),value:z}),L&&(0,eB.jsx)(eZy,{pending:!0,description:eQA(l,"timeLoading")}),R&&(0,eB.jsx)(eZy,{description:eQA(l,"timeLoadFailed"),actions:(0,eB.jsx)(eKQ,{secondary:!0,disabled:w,onClick:()=>{k()},children:a.retry})}),(0,eB.jsx)(eZs,{label:a.time,value:A?eQJ(A):"",options:P.map(t=>{var i;let{id:o,candidate:s}=t,d=eQK(s,(r.partySize||0)*r.bookingCount),c=function(e){let{candidate:t,settings:l,mode:i}=e,a=Array.isArray(l)?Array.from(new Set(l.filter(e=>"maximum_capacity"===e||"available_quantity"===e||"colour_indicators"===e))):[],n={showColourIndicator:a.includes("colour_indicators")};return a.includes("maximum_capacity")&&(n.maximumCapacity=eZb(t.maxPartySize)?t.maxPartySize:eZx(t,eZk)),a.includes("available_quantity")&&(n.availableQuantity=eZx(t,"party"===i?e=>e.length:eZ_)),n}({candidate:s,settings:e.capacityDisplayContent,mode:e.mode}),u=!_&&d&&(void 0!==c.maximumCapacity||void 0!==c.availableQuantity);return{id:o,start:s.startTime,end:s.endTime,disabled:w||!n.canSelectTime(s),indicator:!_&&c.showColourIndicator?{tone:d?"limited"===s.status?"limited":"available":"unavailable",label:d?"limited"===s.status?eQA(l,"capacityLimited"):eQA(l,"capacityAvailable"):a.unavailable}:void 0,description:d?u?(0,eB.jsxs)(eB.Fragment,{children:[void 0!==c.maximumCapacity&&(0,eB.jsx)("span",{className:"venue-booking-time-capacity",children:eQA(l,"timeMaximumCapacity").replace("{count}",String(c.maximumCapacity))}),void 0!==c.availableQuantity&&(0,eB.jsx)("span",{className:"venue-booking-time-capacity",children:eQA(l,"party"===e.mode?"timeRoomsLeft":"timeSpacesLeft").replace("{count}",String(c.availableQuantity))})]}):void 0:S((null==(i=s.reasonCodes)?void 0:i[0])||"UNAVAILABLE")}}),onChange:e=>{var t;let l=null==(t=P.find(t=>t.id===e))?void 0:t.candidate;l&&M(l)},onReselect:()=>{!w&&A&&M(A)}}),!_&&!r.times.length&&"idle"!==r.status&&"error"!==r.status&&(0,eB.jsx)("p",{children:a.noTimes})]}),F=(0,eB.jsxs)("div",{ref:h,tabIndex:-1,children:[!A&&(0,eB.jsx)("p",{children:"party"===e.mode?a.timeBeforeRoom:a.selectTime}),N(r).map(t=>{var n;let o=null==(n=e.resourceSettings)?void 0:n[String(t.formId??t.groupId)],s="zh"===l?"zh-CN":"en",d=RC(null==o?void 0:o.name,void 0,s).trim()||RC(t.title,void 0,s).trim()||("party"===e.mode?a.room:a.resource),c=r.requirementSelections.find(e=>eQ0(e,t)),u=!w&&!!A,p=1===t.options.length?t.options:t.options.filter(e=>eQK(e,(r.partySize||0)*r.bookingCount)),m=p.map(t=>{var l,n,o;let s=i.find(e=>eQG(e.resourceId,t.resourceId)),d=r.resources.find(e=>eQG(e.id,t.resourceId)),c=eQK(t,(r.partySize||0)*r.bookingCount),u=null==d||null==(l=d.raw)?void 0:l.cover,p=Array.isArray(u)?null==(n=u.find(e=>"string"==typeof(null==e?void 0:e.url)&&e.url.trim()))?void 0:n.url:void 0,m=[null==s?void 0:s.image,p,null==d||null==(o=d.raw)?void 0:o.image].find(e=>"string"==typeof e&&e.trim()),g=[null==s?void 0:s.name,t.resourceName,null==d?void 0:d.name].find(e=>"string"==typeof e&&e.trim())||`${"party"===e.mode?a.room:a.resource} ${t.resourceId}`;return{id:String(t.resourceId),name:g,image:m,disabled:!c}});return t.required||0!==t.min||m.unshift({id:"",name:a.none,status:""}),(0,eB.jsxs)("fieldset",{className:"venue-booking-availability__group",disabled:!u,children:[(0,eB.jsxs)("legend",{children:[d,t.required||0!==t.min?"":` \xb7 ${a.optional}`]}),(0,eB.jsx)(eZp,{label:d,value:(null==c?void 0:c.resourceIds.length)?String(c.resourceIds[0]):"",options:m,disabled:!u,onChange:e=>{let l=t.options.find(t=>String(t.resourceId)===e);l?T(t.groupId,l.resourceId):""!==e||t.required||0!==t.min||T(t.groupId,null)}}),!p.length&&(0,eB.jsx)("p",{children:a.noResources})]},t.groupId)})]}),q=e.renderDatePicker?e.renderDatePicker({date:e.date,disabled:w,onChange:e=>{I(e)}}):(0,eB.jsx)("input",{type:"date","aria-label":a.date,value:e.date,disabled:w,onChange:e=>{I(e.target.value)}}),B=(e,t)=>(0,eB.jsxs)("section",{className:"reservation-section venue-booking-availability__section","aria-label":e,children:[(0,eB.jsx)("h3",{children:e}),t]}),H="ticket"===e.mode?(0,eB.jsxs)("details",{ref:y,className:"reservation-date",children:[(0,eB.jsxs)("summary",{"aria-disabled":w,onClick:e=>{w&&e.preventDefault()},children:[(0,eB.jsx)(eQv,{size:21,"aria-hidden":"true"}),(0,eB.jsx)("span",{children:(0,eB.jsx)("b",{children:eQM(e.date,l)})}),(0,eB.jsx)("span",{className:"date-change-label",children:eQA(l,"changeDate")})]}),(0,eB.jsx)("div",{className:"reservation-date-picker",children:q})]}):e.renderDatePicker?q:B(a.date,q),V="ticket"===e.mode?(0,eB.jsx)("section",{className:"reservation-section venue-booking-availability__section","aria-label":eQA(l,"validPlayTime"),children:$}):B(a.time,$),U=B("party"===e.mode?a.room:a.resource,F),Y=r.reasonCodes.filter(e=>!["RESOURCE_REQUIRED","PARTY_ROOM_REQUIRED","TIME_REQUIRED"].includes(e)),W=!_&&("error"===r.status||"blocked"===r.status||r.requiresOrderReconciliation||Y.length>0),G=W?Array.from(new Set(Y.map(S))):[],K=N(r).length>0||!r.resourceGroups.length&&eQF(e.product,e.resourceSettings),Q=!1!==e.resourceSettingsReady&&!e.resourceSettingsFailed&&("party"===e.mode||O)&&K,Z=(0,eB.jsxs)(eB.Fragment,{children:[(W||p)&&(0,eB.jsxs)("div",{className:"venue-booking-availability__status",role:"alert",children:[r.requiresOrderReconciliation?(0,eB.jsx)("p",{children:a.reconciliation}):G.map(e=>(0,eB.jsx)("p",{children:e},e)),p&&(0,eB.jsx)("p",{children:a.dateFailed})]}),("error"===r.status||"blocked"===r.status)&&!r.requiresOrderReconciliation&&!R&&(0,eB.jsx)(eKQ,{secondary:!0,className:"venue-booking-availability__retry",disabled:w,onClick:()=>{k()},children:a.retry}),r.reasonCodes.some(e=>"SELECTED_RESOURCE_UNAVAILABLE"===e||"SELECTED_TIME_UNAVAILABLE"===e)&&(0,eB.jsx)(eKQ,{secondary:!0,className:"venue-booking-availability__retry",disabled:w,onClick:()=>{n.resetSelection()},children:a.reselect})]}),J={state:r,busy:_,disabled:w,dateContent:q,timeContent:$,resourceContent:F,datePanel:H,timePanel:V,resourcePanel:U,statusPanel:Z,showResources:Q,actions:{changeDate:I,selectTime:M,selectResource:T,refresh:k,resetSelection:n.resetSelection}};return(0,eB.jsx)("div",{ref:g,className:`venue-booking-availability ${e.className||""}`,"aria-busy":_,children:e.renderContent?e.renderContent(J):(0,eB.jsxs)(eB.Fragment,{children:[H,V,Q&&U,Z]})})});function eZS(e,t){let l=null==e?void 0:e.match(/[T ](\d{2}:\d{2})(?::(\d{2}))?/);return l?`${l[1]}${l[2]&&"00"!==l[2]?`:${l[2]}`:""}`:t}async function eZj(e){let t=iS(e.product,e.skuValue,{requiredOptionValidation:!1,overSold:1===Number(e.product.over_sold)});if(!t)throw Error("The selected product options are no longer available.");return exX({productData:e.product,skuValue:t,quantity:e.quantity,selectedCandidate:e.candidate,duration:null,customerId:e.customerId,contextKey:e.scopeKey},{calculateProductBookingPrice:async t=>{let l=await e.os.calculateProductBookingPrice(t),i=t.product;if(Number(l.product_id)!==Number(i.product_id??i.id)||Number(l.product_variant_id||0)!==Number(i.product_variant_id||0)||null==l.unit_price||""===String(l.unit_price).trim()||!Number.isFinite(Number(l.unit_price))||0>Number(l.unit_price))throw Error("The booking price is unavailable or does not match the selected product.");return l},channel:"online_ordering"})}eZw.displayName="BookingSelectionPanel";let eZN=()=>{};function eZC(e){try{let t=e&&("object"==typeof e||"function"==typeof e)?e:void 0,l=null==t?void 0:t.name,i=null==t?void 0:t.code;return{errorName:"string"==typeof l&&l?l.slice(0,80):"unknown",..."string"==typeof i?{errorCode:i.slice(0,80)}:"number"==typeof i&&Number.isFinite(i)?{errorCode:i}:{}}}catch{return{errorName:"unknown"}}}let eZM=e=>"number"==typeof e?Number.isFinite(e)?e:void 0:"string"==typeof e&&e.trim()?e.trim():void 0,eZT=new Set(["cacheid","cache_id","scene","temp","ticketsmenulistids","partymenulistids","extrasmenulistids","menulistids","businesscode","business_code","channel","template","display_template_id","type","mode","lang","locale","date","schedule_date","resourceid","productid"]);function eZI(e){var t,l,i,a,n;let{mode:r,draft:o,context:s,date:d,scopeKey:c,locale:u,priceSource:p}=e,m=(e,t)=>"zh"===u?t:e,g=s.sales.bookingTicket,h=exp(),v=(0,eN.useRef)(null),[f,y]=(0,eN.useState)(o.configuration),[b,x]=(0,eN.useState)(()=>{let e=Number(o.quantity);return Number.isSafeInteger(e)&&e>0?e:1}),[k,_]=(0,eN.useState)(),w=(0,eN.useRef)(o.initialSelection),[S,j]=(0,eN.useState)(),[N,C]=(0,eN.useState)(),[M,T]=(0,eN.useState)(!1),I=(0,eN.useRef)(!1),P=(0,eN.useRef)(!0),A=(0,eN.useRef)(e.onBusyChange);A.current=e.onBusyChange;let D=(0,eN.useRef)(e.onDraftChange);D.current=e.onDraftChange,(0,eN.useEffect)(()=>(P.current=!0,()=>{var e;P.current=!1,null==(e=A.current)||e.call(A,!1)}),[]);let E=(0,eN.useMemo)(()=>eQV(o.detail,f.skuValue),[o.detail,f]);(0,eN.useEffect)(()=>{var e;k&&"idle"!==k.status&&!("blocked"===k.status&&k.reasonCodes.includes("BOOKING_DISABLED"))&&(w.current=k),null==(e=D.current)||e.call(D,{configuration:f,quantity:b,initialSelection:w.current})},[f,b,k,o]);let O=JSON.stringify([c,r,o.openId??(null==(t=o.plan)?void 0:t.openId),o.detail.product_id??o.detail.id,o.lineUid,d,b,f.skuValue,k&&eQ2(k),e.customerId]),z=(0,eN.useRef)({revision:O,disabled:e.disabled,os:g,draft:o,priceSource:p});z.current={revision:O,disabled:e.disabled,os:g,draft:o,priceSource:p},(0,eN.useEffect)(()=>{let t=!0;if(j(void 0),(null==k?void 0:k.candidate)&&["selecting","ready"].includes(k.status)&&("tickets"===r||k.ready)&&!k.requiresOrderReconciliation&&k.candidate.date===d&&k.candidate.availabilityContextId===k.contextId&&k.times.some(e=>eQZ(e,k.candidate)&&eQK(e,(k.partySize||0)*k.bookingCount)))return C(void 0),eZj({os:p,product:E.product,skuValue:f.skuValue,candidate:k.candidate,quantity:b,customerId:e.customerId,scopeKey:c}).then(e=>{t&&j(e)}).catch(e=>{t&&C(e instanceof Error?e.message:String(e))}),()=>{t=!1}},[g,p,o,E.product,O,null==k?void 0:k.ready,null==k?void 0:k.status,null==k?void 0:k.contextId,null==k||null==(l=k.candidate)?void 0:l.availabilityContextVersion]);let L=async()=>{var t,l,i,a,n,y,x,_;if(I.current||e.disabled||!S||!(null==k?void 0:k.ready)||!k.candidate||!v.current)return!1;I.current=!0,T(!0),null==(t=A.current)||t.call(A,!0),C(void 0);let w=null==(l=g.getTempOrder)?void 0:l.call(g),N=e=>{var t;return JSON.stringify([null==e?void 0:e.order_id,null==e?void 0:e.external_sale_number,null==e||null==(t=e._extend)?void 0:t.localId])},M=N(w),D=null==(i=e.operationLog)?void 0:i.capture(),L=o.lineUid?"cart_update":"cart_add",R={productId:E.product.product_id??E.product.id,quantity:b,selectedDate:d,startAt:k.candidate.bookingStartAt||k.candidate.startAt,endAt:k.candidate.bookingEndAt||k.candidate.endAt,resourceIds:null==(a=k.requirementSelections)?void 0:a.flatMap(e=>e.resourceIds).slice(0,100)};null==D||D(`${L}_requested`,R);let $=()=>{var e,t;return P.current&&z.current.revision===O&&z.current.os===g&&z.current.draft===o&&z.current.priceSource===p&&(null==(e=g.getTempOrder)?void 0:e.call(g))===w&&N(null==(t=g.getTempOrder)?void 0:t.call(g))===M},F=()=>{if(!$()||z.current.disabled)throw Error(m("Your selection changed. Please review it again.","选择已变化,请重新确认。"))},q=!1;try{F(),await h.assertCanMutate(),F();let t=await eZj({os:p,product:E.product,skuValue:f.skuValue,candidate:k.candidate,quantity:b,customerId:e.customerId,scopeKey:c});if(F(),t.compositeLineTotal!==S.compositeLineTotal)throw j(t),Error(m("The price changed. Please review the new amount and confirm again.","价格已更新,请核对新金额后再次确认。"));let l=(_={product:E.product,skuValue:f.skuValue,quote:t,quantity:b,candidate:k.candidate,role:r,scopeKey:c},ekr({...Hb({productData:_.product,skuValue:_.skuValue,quantity:_.quantity,booking:{startDate:ew()(_.candidate.startAt),endDate:ew()(_.candidate.endAt),startTime:_.candidate.startTime,endTime:_.candidate.endTime,resource:null,capacity:null,duration:null,holderIds:[]},bookingPrice:{status:"ready",requestKey:_.scopeKey,quote:_.quote}},{moduleTypes:["sku","bookingPrice"],requireBookingPrice:!0}),quantity:_.quantity,num:_.quantity,metadata:{..._.product.metadata,venue_booking_role:"tickets"===_.role?"tickets":"party_main",venue_booking_scope_key:_.scopeKey,venue_booking_service_datetime:_.candidate.startAt}})),i=await s.cart.prepareAllergyBeforeCommit({product:l,flowId:(null==(n=o.plan)?void 0:n.openId)||`${c}:${o.lineUid||o.detail.id}`,perFlow:!0});if(F(),!i.allowed)return null==D||D(`${L}_cancelled`,{...R,reason:"allergy_confirmation"}),!1;let a=e.prepareRelated?await e.prepareRelated(k):{};if(F(),await h.assertCanMutate(),F(),null==(y=a.availabilityCommitGuard)||y.call(a),await v.current.commit(l,{...a,availabilityCommitGuard:()=>{var e;F(),null==(e=a.availabilityCommitGuard)||e.call(a)},salesNotes:i.noteDraft?[i.noteDraft]:void 0,allowBookingReprice:!0}),q=!0,null==D||D(`${L}_succeeded`,R),!$())return!0;return s.cart.refreshCartSnapshot(),$()&&await e.onCommitted(),!0}catch(e){if(q)return null==D||D("cart_view_refresh_failed",{...R,...eZC(e)},"warning"),console.warn("[VenueBooking] Selection saved; view refresh failed",e),$()&&C(m("Your selection was saved, but the view could not refresh. Reopen your order to review it.","选择已保存,但页面刷新失败。请重新打开订单核对。")),!0;if(null==D||D(`${L}_failed`,{...R,writeOutcome:"unconfirmed",...eZC(e)},"warning"),$()){try{s.cart.refreshCartSnapshot()}catch(e){console.warn("[VenueBooking] Could not refresh the current selection",e)}C(e instanceof eQW?e.reasonCodes.map(e=>eQL(e,u)).join(" "):e instanceof Error?e.message:String(e))}return!1}finally{I.current=!1,P.current&&(T(!1),null==(x=A.current)||x.call(A,!1))}},R={operationLog:e.operationLog,os:g,mode:"tickets"===r?"ticket":"party",date:d,product:E.product,quantity:b,editingProductLineUid:o.lineUid,initialSelection:o.initialSelection,disabled:!!e.disabled,interactionDisabled:M,onDateChange:e.onDateChange,onSelectionChange:_,locale:u,capacityDisplayContent:null==(a=g.otherParams)||null==(i=a.openData)?void 0:i["interface.capacity_display_content"],resourceSettings:null==(n=s.sales.salesSettings)?void 0:n.reservation.resourceSettings,resourceSettingsReady:"picoding"!==s.sales.salesSettingsSource||!!(s.sales.salesSettings&&!s.sales.salesSettingsError),resourceSettingsFailed:!!s.sales.salesSettingsError,onRetryResourceSettings:s.sales.ensureSalesSettings},$=!!((null==k?void 0:k.ready)&&S&&!k.requiresOrderReconciliation);return{configuration:f,setConfiguration:y,quantity:b,setQuantity:x,prepared:E,selection:k,quote:S,error:N,working:M,revision:O,panelRef:v,bookingProps:R,bookingReady:$,canCommit:$&&!e.disabled&&!M,preview:{product:E.product,configuration:f,quantity:b,date:d,editingProductLineUid:o.lineUid,candidate:null==k?void 0:k.candidate,requirementSelections:(null==k?void 0:k.requirementSelections)??[],selectedResourceDetails:(null==k?void 0:k.selectedResourceDetails)??[],quote:S},commit:L,cancel:()=>{I.current||e.onCancel()}}}let eZP=new Set(["p","div","span","br","strong","b","em","i","u","s","del","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","pre","code","a","img","hr","sub","sup","table","thead","tbody","tfoot","tr","th","td"]),eZA=new Set(["script","style","iframe","object","embed","svg","math","template","input","button","select","textarea"]),eZD=["fontWeight","fontStyle","fontSize","textDecoration","textAlign","color","backgroundColor","whiteSpace"];function eZE(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=null==e?void 0:e.trim();if(l&&(/^https?:\/\//i.test(l)||/^\/(?!\/)/.test(l)||!t&&/^(?:mailto:|tel:|#)/i.test(l)))return l}function eZO(e,t){if(3===e.nodeType)return e.textContent;if(1!==e.nodeType)return null;let l=e.tagName.toLowerCase();if(eZA.has(l))return null;let i=Array.from(e.childNodes,eZO);if(!eZP.has(l))return(0,eB.jsx)(eC().Fragment,{children:i},t);let a={key:t},n={};if(eZD.forEach(t=>{let l=e.style[t];l&&(n[t]=l)}),a.style=n,"a"===l&&(a.href=eZE(e.getAttribute("href")),a.target="_blank",a.rel="noopener noreferrer"),"img"===l){if(a.src=eZE(e.getAttribute("src"),!0),!a.src)return null;a.alt=e.getAttribute("alt")||"",a.loading="lazy"}if("td"===l||"th"===l)for(let[t,l]of[["colspan","colSpan"],["rowspan","rowSpan"]]){let i=Number(e.getAttribute(t));Number.isInteger(i)&&i>0&&i<=1e3&&(a[l]=i)}if("ol"===l&&e.hasAttribute("start")){let t=Number(e.getAttribute("start"));Number.isInteger(t)&&(a.start=t)}return eC().createElement(l,a,...["br","img","hr"].includes(l)?[]:i)}function eZz(e){let{content:t}=e,l=(0,eN.useMemo)(()=>"u"<typeof DOMParser?t:Array.from(new DOMParser().parseFromString(t,"text/html").body.childNodes,eZO),[t]);return(0,eB.jsx)("div",{className:"venue-product-description",children:l})}let eZL=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),eN.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),eZR=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eZL}));eZR.displayName="CheckIcon";let eZ$=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z",opacity:"0.2"}),eN.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z"}))]]),eZF=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eZ$}));eZF.displayName="ArrowSquareOutIcon";let eZq=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,36H48A20,20,0,0,0,28,56v56c0,54.29,26.32,87.22,48.4,105.29,23.71,19.39,47.44,26,48.44,26.29a12.1,12.1,0,0,0,6.32,0c1-.28,24.73-6.9,48.44-26.29,22.08-18.07,48.4-51,48.4-105.29V56A20,20,0,0,0,208,36Zm-4,76c0,35.71-13.09,64.69-38.91,86.15A126.28,126.28,0,0,1,128,219.38a126.14,126.14,0,0,1-37.09-21.23C65.09,176.69,52,147.71,52,112V60H204ZM79.51,144.49a12,12,0,1,1,17-17L112,143l47.51-47.52a12,12,0,0,1,17,17l-56,56a12,12,0,0,1-17,0Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,56v56c0,96-88,120-88,120S40,208,40,112V56a8,8,0,0,1,8-8H208A8,8,0,0,1,216,56Z",opacity:"0.2"}),eN.createElement("path",{d:"M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm-34.32,69.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,42H48A14,14,0,0,0,34,56v56c0,51.94,25.12,83.4,46.2,100.64,22.73,18.6,45.27,24.89,46.22,25.15a6,6,0,0,0,3.16,0c.95-.26,23.49-6.55,46.22-25.15C196.88,195.4,222,163.94,222,112V56A14,14,0,0,0,208,42Zm2,70c0,37.76-13.94,68.39-41.44,91.06A131.17,131.17,0,0,1,128,225.72a130.94,130.94,0,0,1-40.56-22.66C59.94,180.39,46,149.76,46,112V56a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2ZM172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,44H48A12,12,0,0,0,36,56v56c0,51.16,24.73,82.12,45.47,99.1,22.4,18.32,44.55,24.5,45.48,24.76a4,4,0,0,0,2.1,0c.93-.26,23.08-6.44,45.48-24.76,20.74-17,45.47-47.94,45.47-99.1V56A12,12,0,0,0,208,44Zm4,68c0,38.44-14.23,69.63-42.29,92.71A132.45,132.45,0,0,1,128,227.82a132.23,132.23,0,0,1-41.71-23.11C58.23,181.63,44,150.44,44,112V56a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-41.17-10.83a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17Z"}))]]),eZB=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:eZq}));function eZH(e){let{title:t,version:l,accepted:i,lang:a,onOpen:n,disabled:r=!1}=e;return(0,eB.jsxs)("button",{type:"button",className:`checkout-agreement ${i?"accepted":""}`,"data-accepted":i,"aria-haspopup":"dialog","aria-label":`${eQA(a,"readAgreement")} \xb7 ${t} \xb7 ${eQA(a,i?"accepted":"notAccepted")}`,onClick:n,disabled:r,children:[(0,eB.jsx)("span",{className:"agreement-state","aria-hidden":"true",children:i&&(0,eB.jsx)(eZR,{size:15,weight:"bold"})}),(0,eB.jsxs)("span",{className:"agreement-copy",children:[(0,eB.jsx)("b",{children:t}),(0,eB.jsxs)("small",{children:[l&&(0,eB.jsxs)(eB.Fragment,{children:[eQA(a,"version")," ",l," \xb7"," "]}),eQA(a,i?"accepted":"notAccepted")]})]}),(0,eB.jsxs)("span",{className:"agreement-open","aria-hidden":"true",children:[(0,eB.jsx)("span",{children:eQA(a,"readAgreement")}),(0,eB.jsx)(eZF,{size:15})]})]})}function eZV(e){let{title:t,version:l,lang:i,children:a,onConfirm:n,onClose:r}=e;return(0,eB.jsxs)(eQu,{wide:!0,className:"agreement-dialog",title:t,closeLabel:eQA(i,"close"),onClose:r,children:[(0,eB.jsxs)("div",{className:"agreement-dialog-content",tabIndex:0,role:"region","aria-label":t,children:[l&&(0,eB.jsxs)("div",{className:"agreement-label",children:[(0,eB.jsx)(eZB,{size:24,"aria-hidden":"true"}),(0,eB.jsxs)("span",{children:[eQA(i,"version")," ",l]})]}),a]}),(0,eB.jsx)("div",{className:"agreement-dialog-footer",children:(0,eB.jsx)(eKQ,{type:"button",className:"button full",onClick:()=>{null==n||n(),r()},children:eQA(i,n?"confirmAgreement":"close")})})]})}function eZU(e){let{name:t,description:l,content:i,lang:a}=e,n=(0,eN.useRef)(null),[r,o]=(0,eN.useState)(!1),[s,d]=(0,eN.useState)(!1),c=eQA(a,"fullProductInfo");return(0,eN.useEffect)(()=>{var e;let t=n.current;if(!t)return;let l=!0,i=()=>{l&&o(t.scrollHeight>t.clientHeight+1)};i();let a="u"<typeof ResizeObserver?void 0:new ResizeObserver(i);return null==a||a.observe(t),window.addEventListener("resize",i),null==(e=document.fonts)||e.ready.then(i),()=>{l=!1,null==a||a.disconnect(),window.removeEventListener("resize",i)}},[l]),(0,eB.jsxs)("div",{className:"product-description",children:[(0,eB.jsx)("p",{className:"product-description-text",ref:n,children:l}),r&&(0,eB.jsx)("button",{type:"button",className:"text-link product-description-more","aria-haspopup":"dialog","aria-label":`${c}: ${t}`,onClick:()=>d(!0),children:c}),s&&(0,eB.jsx)(eZV,{title:t,lang:a,onClose:()=>d(!1),children:i??(0,eB.jsx)("div",{className:"agreement-body",children:(0,eB.jsx)("p",{className:"preserve-lines",children:l})})})]})}function eZY(e){let{detail:t,configuration:l,locale:i,catalogStartingAmount:a,catalogPriceQualifier:n,formatAmount:r}=e,{durationMinutes:o}=(0,eN.useMemo)(()=>eQV(t,{...l.skuValue}),[t,l.skuValue]),s=eKT(t.title,i)||eKT(t.name,i),d=eKT(t.description,i).trim(),c=(0,eN.useMemo)(()=>eKI(d,i),[d,i]),u="string"==typeof t.cover?t.cover.trim():"",p=("string"==typeof a||"number"==typeof a)&&""!==String(a).trim()&&Number.isFinite(Number(a))&&Number(a)>=0;return(0,eB.jsxs)("div",{className:"reservation-intro venue-product-intro",children:[(0,eB.jsx)("div",{className:"venue-product-intro__cover",children:(0,eB.jsx)(nB.PisellImageCard,{dataSource:{src:u||void 0,alt:s},width:"100%",height:"100%",aliWidth:220,fillMode:"cover"})}),(0,eB.jsxs)("div",{className:"venue-product-intro__copy",children:[d&&(0,eB.jsx)(eZU,{name:s,description:c,lang:i,content:(0,eB.jsx)(eZz,{content:d})}),null!=o&&(0,eB.jsxs)("span",{className:"small muted",children:[o," ","zh"===i?"分钟":"minutes"]}),p&&(0,eB.jsxs)("strong",{children:["from"===n&&"zh"!==i&&"From ",r(a),"from"===n&&"zh"===i&&" 起"]})]})]})}eZB.displayName="ShieldCheckIcon";let eZW=(e,t)=>null!=e&&null!=t&&String(e)===String(t),eZG=e=>Array.isArray(e)?e:[],eZK=e=>{if("string"!=typeof e&&"number"!=typeof e||""===String(e).trim())throw Error("The estimated price is unavailable.");let t=new lO(e);if(!t.isFinite())throw Error("The estimated price is unavailable.");return t},eZQ=e=>{let t=Number(e);if(!Number.isSafeInteger(t)||t<=0)throw Error("The selected quantity is invalid.");return t},eZZ=e=>(e||[]).map(e=>{var t;return{...e,required:0,min_quantity:0,max_quantity:0,metadata:{...e.metadata,option_types_config:{...null==(t=e.metadata)?void 0:t.option_types_config,min:0,max:0}},option_item:(e.option_item||[]).map(e=>({...e,min_quantity:0,max_quantity:0}))}});function eZJ(e,t){return eZG(e).reduce((e,l)=>{let i=eZG(t).find(e=>eZW(e.id,l.option_group_id??l.group_id)),a=eZG(null==i?void 0:i.option_item).find(e=>eZW(e.id,l.product_option_item_id??l.option_group_item_id??l.id));if(!a)throw Error("The selected option is unavailable.");return e.add(eZK(a.add_price??a.price).mul(eZQ(l.quantity??l.num)))},new lO(0))}async function eZX(e){var t,l;let i=eZQ(e.quantity),a=(t=e.productDetail,l=e.skuValue,{...t,variant_group:0===Number(l.product_variant_id||0)?[]:t.variant_group,option_group:eZZ(t.option_group),bundle_group:(t.bundle_group||[]).map(e=>({...e,min_quantity:0,max_quantity:0,bundle_item:(e.bundle_item||[]).map(e=>({...e,min_quantity:0,max_quantity:0,option_group:eZZ(e.option_group)}))}))}),n=iS(a,e.skuValue,{requiredOptionValidation:!1,overSold:e.overSold});if(!n)throw Error("The selected options cannot be priced.");let r=Number(n.product_variant_id)>0?eZG(a.variant).find(e=>eZW(e.id,n.product_variant_id)):void 0,o=eZK(r?r.price??r.selling_price??r.base_price:a.price??a.selling_price??a.base_price);if(o.isNegative())throw Error("The estimated price is unavailable.");let s=eZJ(n.option,a.option_group),d=eZG(n.bundle).map(e=>{let t=eZG(a.bundle_group).find(t=>eZW(t.id,e.group_id??e.bundle_group_id)),l=eZG(null==t?void 0:t.bundle_item).find(t=>eZW(t.id,e.id??e.bundle_id));if(!l)throw Error("The selected package item is unavailable.");let i=eZK(l.price??l.custom_price??l.product_price??l.base_price),n=(l.price_type??l.custom_price_type)==="markdown"&&(l.price_type_ext??l.custom_price_type_ext)!=="product_price",r=n?i.abs().toString():i.toString();return{selected:e,markdown:n,base:eZK(r),options:eZJ(e.option,l.option_group),quantity:eZQ(e.quantity??e.num),query:exV({...e,price:r,bundle_selling_price:r,original_price:r,custom_price:r,product_price:r,base_price:r})}}),c=t=>{let l=t.mul(i);if(l.isNegative()||!l.isFinite())throw Error("The estimated price is unavailable.");return{subtotal:l.toString(),pricedAt:e.datetime}};if("catalog"===e.priceBasis)return c(d.reduce((e,t)=>e.add((t.markdown?t.base.abs().negated():t.base).add(t.options).mul(t.quantity)),o.add(s)));let u=await e.calculateProductBookingPrice({product:{...e.productDetail,product_id:a.id,product_variant_id:n.product_variant_id,price:o.toString(),quantity:i,num:i,product_sku:{option:n.option},product_bundle:d.map(e=>e.query)},datetime:e.datetime,channel:"online_ordering",...null!=e.customerId?{customer_id:e.customerId}:{}});if(!u||!eZW(u.product_id,a.id)||!eZW(u.product_variant_id??0,n.product_variant_id??0)||eZQ(u.quantity)!==i)throw Error("The returned estimate does not match the selected product.");let p=eZK(u.unit_price);if(p.isNegative())throw Error("The estimated price is unavailable.");let m=p.add(s);for(let e of d){let t=eZG(u.product_bundle).find(t=>eZW(t.bundle_id,e.selected.id??e.selected.bundle_id)&&eZW(t.bundle_group_id??t.group_id,e.selected.bundle_group_id??e.selected.group_id)&&eZW(t.bundle_product_id,e.query.bundle_product_id)&&eZW(t.bundle_variant_id??0,e.query.bundle_variant_id??0));if(!t)throw Error("The selected package item could not be priced.");let l=eZK(t.unit_price);m=m.add((e.markdown?l.abs().negated():l).add(e.options).mul(e.quantity))}return c(m)}function eZ0(e){let{enabled:t,openId:l,scopeKey:i,sessionId:a,productDetail:n,skuValue:r,quantity:o=1,overSold:s,priceBasis:d="current-time",timeZone:c,customerId:u,os:p}=e,m=ia(r),g=(0,eN.useMemo)(()=>t&&l&&n&&r?{openId:l,scopeKey:i,sessionId:a,productDetail:n,skuValue:r,quantity:o,overSold:s,priceBasis:d,timeZone:c,customerId:u,os:p}:void 0,[t,l,i,a,n,m,o,s,d,c,u,p]),h=(0,eN.useRef)(g);h.current=g;let[v,f]=(0,eN.useState)();return((0,eN.useEffect)(()=>{if(!g)return;let e=!0,t=()=>e&&h.current===g;return f({request:g,value:{status:"loading"}}),(async()=>{try{if("catalog"!==g.priceBasis&&"function"!=typeof g.os.calculateProductBookingPrice)throw Error("Pricing is unavailable.");let e=await eZX({productDetail:g.productDetail,skuValue:g.skuValue,quantity:g.quantity,overSold:g.overSold,priceBasis:g.priceBasis,datetime:e_d(g.timeZone),customerId:g.customerId,calculateProductBookingPrice:e=>g.os.calculateProductBookingPrice(e)});t()&&f({request:g,value:{status:"ready",...e}})}catch{t()&&f({request:g,value:{status:"unavailable"}})}})(),()=>{e=!1}},[g]),g)?(null==v?void 0:v.request)===g?v.value:{status:"loading"}:{status:"idle"}}function eZ2(e){var t,l,i,a,n;let{mode:r,draft:o,locale:s}=e,d=(e,t)=>"zh"===s?t:e,c=eZI(e),u=eKn(),{configuration:p,setConfiguration:m,quantity:g,setQuantity:h,quote:v,error:f,working:y,revision:b,commit:x}=c,k="tickets"===r&&(null==(t=o.plan)?void 0:t.hasConfiguration)?o.plan.productDetail:void 0,_=lW((null==(i=e.skuOptions)||null==(l=i.config)?void 0:l.overSold)??o.detail.over_sold),w=(0,eN.useMemo)(()=>!!(k&&iw(k,p.skuValue,{requiredOptionValidation:e.requiredOptionValidation,overSold:_})),[k,p.skuValue,e.requiredOptionValidation,_]),S=eZ0({enabled:w,openId:null==(a=o.plan)?void 0:a.openId,scopeKey:e.scopeKey,productDetail:k,skuValue:p.skuValue,quantity:g,overSold:_,priceBasis:"catalog",timeZone:null==u?void 0:u.timeZone,customerId:e.customerId,os:e.priceSource}),j=e.formatAmount||(t=>{var l,i;return Yg((null==(i=e.context.sales.bookingTicket)||null==(l=i.getTempOrder)?void 0:l.call(i))??e.context.cart.tempOrder,t)}),N=o.catalogStartingAmount,C="tickets"===r&&null!=N&&""!==String(N).trim()&&Number.isFinite(Number(N))?j(new lO(N).times(g).toString()):void 0,M=void 0===C?"—":"zh"===s?`${C} 起`:`From ${C}`,T=M;w&&"ready"===S.status?T=j(S.subtotal):w&&"loading"===S.status&&(T="—");let I=v?j(v.compositeLineTotal):k?T:"from"===o.catalogPriceQualifier?M:C??"—",P=t=>(0,eB.jsx)(eZw,{ref:c.panelRef,...c.bookingProps,scrollContainer:t,renderDatePicker:e.renderDatePicker,actionTarget:()=>{var e;return(null==t||null==(e=t.closest('[role="dialog"]'))?void 0:e.querySelector(".booking-config-actions .booking-primary-action"))||null}}),A=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"tickets"!==r||o.lineUid?null:(0,eB.jsxs)("div",{className:"reservation-quantity",children:[(0,eB.jsx)("span",{children:d("Number","数量")}),(0,eB.jsx)(z0,{className:"booking-ticket-quantity",variant:"capsule",min:1,step:1,value:g,disabled:t||y||e.disabled,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,onChange:l=>{!t&&!y&&!e.disabled&&Number.isSafeInteger(l)&&l>=1&&h(l)}})]})},D=(0,eB.jsxs)("div",{className:"venue-booking-sales__booking-footer",children:[A(),(0,eB.jsxs)("div",{className:"tickets"===r?"reservation-subtotal":"party-total","aria-live":"polite",children:[(0,eB.jsx)("span",{children:d("Subtotal","小计")}),(0,eB.jsx)("strong",{children:I})]})]});return"tickets"===r&&o.plan?(0,eB.jsx)(eQO,{plan:o.plan,title:eKT(o.detail.title||o.detail.name,s)||d("Play admission","游玩门票"),summary:(0,eB.jsx)(eZY,{detail:o.detail,configuration:p,locale:s,catalogStartingAmount:o.catalogStartingAmount,catalogPriceQualifier:o.catalogPriceQualifier,formatAmount:j}),configuration:p,onConfigurationChange:m,skuOptions:{...e.skuOptions,priceFormatter:(null==(n=e.skuOptions)?void 0:n.priceFormatter)||(e=>String(j(e)))},requiredOptionValidation:e.requiredOptionValidation,onCancel:c.cancel,locale:s,busy:y||e.disabled,selectionRevision:b,error:f,renderBooking:e=>{let{scrollContainer:t}=e;return P(t)},footerContent:e=>{let{busy:t}=e;return A(t)},configurationFooter:{label:d("Estimated subtotal","预计小计"),amount:(0,eB.jsx)("span",{role:"status","aria-live":"polite",children:T})},bookingActionAmount:I,bookingSubtotalLabel:!v&&w?d("Estimated subtotal","预计小计"):void 0,bookingReady:c.bookingReady,onConfirm:x}):(0,eB.jsxs)("section",{className:"venue-booking-sales__party-selection","aria-label":d("Choose your room and time","选择房间和时间"),children:[P(),f&&(0,eB.jsx)(eM.Alert,{type:"error",message:f,showIcon:!0}),D,(0,eB.jsxs)("div",{className:"venue-booking-sales__actions",children:[(0,eB.jsx)(eKQ,{secondary:!0,disabled:y||e.disabled,onClick:c.cancel,children:d("Cancel changes","取消更改")}),(0,eB.jsx)(eKQ,{busy:y,disabled:e.disabled||!c.bookingReady,onClick:()=>void x(),children:d("Save Party selection","保存 Party 选择")})]})]})}let eZ1=new Set,eZ4=0,eZ3=new WeakMap,eZ8=e=>{var t,l,i,a;let n=e=>"string"==typeof e&&e.trim()?e.trim():void 0;if((null==(t=e.otherParams)?void 0:t.businessCode)==="venue_booking"){let t=n(e.otherParams.previousVenueCacheId);if(t)return t}try{return n(null==(l=e.getCacheId)?void 0:l.call(e))||n(null==(i=e.otherParams)?void 0:i.cacheId)}catch{return n(null==(a=e.otherParams)?void 0:a.cacheId)}},eZ6=e=>null!=e&&""!==String(e).trim()&&"0"!==String(e).trim(),eZ5=e=>{var t;if(!e||"payment_pending"!==String(e.status||"").trim().toLowerCase()||!eZ6(e.voucher_id)||eZ6(e.order_payment_id))return!1;let l=null==(t=e.metadata)?void 0:t.transactions;return!Array.isArray(l)||!l.some(e=>eZ6(null==e?void 0:e.number))},eZ7=e=>{var t,l;return eZ6(null==e?void 0:e.order_id)||1===Number(null==e?void 0:e.need_sync)||[null==e?void 0:e.paid_amount,null==e||null==(t=e.summary)?void 0:t.order_paid_amount,null==e||null==(l=e.summary)?void 0:l.customer_paid_amount].some(e=>Number.isFinite(Number(e))&&Number(e)>0)||Array.isArray(null==e?void 0:e.payments)&&e.payments.some(e=>!eZ5(e))},eZ9=e=>e.listeners.forEach(e=>e()),eJe=e=>{e.active=!1,e.value={...e.value,ready:!1},eZ9(e)},eJt=function(e,t,l,i){let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(e.retiring)return e.retiring;let n=()=>t.orderOwner===e&&t.orderSessionId===l,r=()=>null==t.orderOwner&&(!t.owner||t.owner===e);if(e.retired)return Promise.resolve((n()||r())&&i());if(!e.retireOrder)return Promise.resolve(!1);let o=t.tail.then(async()=>{var t,o;if(a&&e.refs>0||e.sessionId!==l||(await (null==(t=e.waitForRetire)?void 0:t.call(e)),a&&e.refs>0||!i()||e.sessionId!==l))return!1;if(!n())return!!r()&&(e.retired=!0,!0);if(eJe(e),e.storageKey)try{(null==(o=JSON.parse(sessionStorage.getItem(e.storageKey)||"null"))?void 0:o.sessionId)===l&&sessionStorage.removeItem(e.storageKey)}catch{}return await e.retireOrder(),!!n()&&(e.order=e.source.getTempOrder(),e.discarded=!0,e.retired=!0,!0)});e.retiring=o;let s=()=>{e.retiring===o&&(e.retiring=void 0)};return t.tail=o.then(s,s),o};class eJl extends Error{constructor(e){super(e),e2(this,"code",void 0),this.code=e}}let eJi=e=>{throw new eJl(e)},eJa=e=>Array.isArray(e)?e.filter(Boolean):[],eJn=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(null==e||""===e)return t;let l=Number(e);return Number.isSafeInteger(l)&&l>=0?l:eJi("PREVIEW_INVALID_SKU_BOUNDS")},eJr=e=>{++e.work>15e4&&eJi("PREVIEW_COMPLEX_CONFIGURATION")};function eJo(e){let t,l;for(let i of e)0===i.capacity?(!t||i.quantity<t.quantity)&&(t=i):(!l||i.capacity<l.capacity||i.capacity===l.capacity&&i.quantity<l.quantity)&&(l=i);return[t,l].filter(e=>!!e)}function eJs(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,l=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(l||!lW(e.is_track)||lW(e.over_sold))return 256;let i=Number(e.stock_quantity);return Number.isFinite(i)&&i>0?Math.max(0,Math.floor(i/t)):0}function eJd(e){var t,l,i,a,n,r;let{group:o,kind:s,policy:d,budget:c,multiplier:u}=e,p="bundle"===s||lW(o.is_multiple),m="option"===s&&p&&lW(null==(t=o.metadata)?void 0:t.advanced_settings_enabled),g=d.requiredOptionValidation,h=g&&m?eJn(null==(i=o.metadata)||null==(l=i.option_types_config)?void 0:l.min):0,v=m?eJn(null==(n=o.metadata)||null==(a=n.option_types_config)?void 0:a.max):0,f=g?p?eJn(o.min_quantity):+!!lW(o.required):0,y=p?eJn(o.max_quantity):0;(y&&f>y||v&&h>v)&&eJi("PREVIEW_INVALID_SKU_BOUNDS");let b=e.items.filter(e=>l0(e,{overSold:d.overSold})),x=b.map(e=>Math.max(1,eJn(e.min_quantity)));if(!p){if(!f)return[{rows:[],capacity:0,quantity:0}];for(let t=0;t<b.length;t++){eJr(c);let l=x[t],i=eJn(b[t].max_quantity);if(l>256&&eJi("PREVIEW_COMPLEX_CONFIGURATION"),i&&l>i||l>eJs(b[t],u,d.overSold))continue;let a=e.makeRow(b[t],l);if(a)return[{rows:[a],capacity:(null==(r=e.counted)?void 0:r.call(e,b[t]))?l:0,quantity:l}]}return[]}if(0===f&&0===h&&!b.some(t=>{var l;return null==(l=e.counted)?void 0:l.call(e,t)}))return[{rows:[],capacity:0,quantity:0}];let k=Math.max(1,...x),_=Math.max(1,Math.min(f+x.reduce((e,t)=>e+t,0),Math.max(f,h*k)+2*k)),w=y?Math.min(_,y):_;(w>256||h>256)&&eJi("PREVIEW_COMPLEX_CONFIGURATION");let S=!p||h>0||v>0,j=new Map([["0:0",[{rows:[],capacity:0,quantity:0}]]]);for(let t=0;t<b.length;t++){let l=b[t],i=x[t],a=Math.min(w,eJn(l.max_quantity)||w,eJs(l,u,d.overSold)),n=new Map,r=new Map;for(let[t,o]of j){let[s,d]=t.split(":").map(Number),u=[0];if(p||0===d)for(let e=i;e<=a&&s+e<=w;e++)u.push(e);for(let t of u){let i;eJr(c);let a=d+(t&&S?1:0);if(v&&a>v||t&&(n.has(t)||n.set(t,e.makeRow(l,t)),!(i=n.get(t))))continue;let u=`${s+t}:${a}`,p=o.map(a=>{var n;return{rows:i?[...a.rows,i]:a.rows,quantity:s+t,capacity:a.capacity+((null==(n=e.counted)?void 0:n.call(e,l))?t:0)}});r.set(u,eJo([...r.get(u)||[],...p]))}}j=r}return eJo([...j.entries()].flatMap(e=>{let[t,l]=e,[i,a]=t.split(":").map(Number);return i>=f&&a>=h?l:[]}))}function eJc(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=[];for(let n of eJa(e.option_group).filter(lJ)){let r=eJd({group:n,items:eJa(n.option_item),kind:"option",policy:t,budget:l,multiplier:i,makeRow:(t,l)=>({...t,id:t.id,product_option_item_id:t.id,option_group_id:n.id,product_id:e.id,quantity:l,num:l})});if(!r.length)return;a.push(...r[0].rows)}return a}function eJu(e,t,l){var i;let a=(null==(i=e._data)?void 0:i.capacitys)??e.capacity,n=(null==a?void 0:a.type)==="package"?eJa(a.package).map(e=>e.product_id):[],r=[{rows:[],capacity:0,quantity:0}];for(let i of eJa(e.bundle_group).filter(lJ)){let e=eJd({group:i,items:eJa(i.bundle_item),kind:"bundle",policy:t,budget:l,multiplier:1,counted:e=>n.includes(e.bundle_product_id),makeRow:(e,a)=>{let n=eJc(e,t,l,a);if(n)return{...e,id:e.id,group_id:i.id,_bundle_product_id:e.bundle_product_id,quantity:a,num:a,option:n}}});if(!e.length)return[];r=eJo(r.flatMap(t=>e.map(e=>({rows:[...t.rows,...e.rows],capacity:t.capacity+e.capacity,quantity:t.quantity+e.quantity}))))}return r}function eJp(e,t){if(t.overSold)return;let l=new Set;for(let t of eJa(e.bundle_group).filter(lJ))for(let e of eJa(t.bundle_item).filter(lJ)){if(lW(e.is_track)&&!lW(e.over_sold)){let t=Number(e.bundle_variant_id)>0?`variant:${e.bundle_variant_id}`:`product:${e.bundle_product_id}`;(null==e.bundle_product_id||l.has(t))&&eJi("PREVIEW_SHARED_STOCK_CONFIGURATION"),l.add(t)}1!==eJn(e.max_quantity)&&1!==eJn(t.max_quantity)&&eJa(e.option_group).filter(lJ).some(e=>eJa(e.option_item).some(e=>lJ(e)&&lW(e.is_track)&&!lW(e.over_sold)))&&eJi("PREVIEW_SPLIT_BUNDLE_STOCK_CONFIGURATION")}}let eJm=["duration","service_duration","product_resource","capacity","session","schedule","schedules"];function eJg(e){for(let t of[...eJa(e.variant),...eJa(e.option_group).flatMap(e=>eJa(e.option_item))])for(let l of eJm)null!=t[l]&&JSON.stringify(t[l])!==JSON.stringify(e[l])&&eJi("PREVIEW_SKU_BOOKING_OVERRIDE_UNSUPPORTED")}async function eJh(e,t){let l={available:!1,availability:{}},i=()=>{var e;return(null==(e=t.isCurrent)?void 0:e.call(t))!==!1};for(let a of t.products){if(!i())break;let n=a.id??a.product_id;if(!Number.isSafeInteger(Number(n))||0>=Number(n)){l.availability[String(n)]={available:!1,reasons:["INVALID_PRODUCT_ID"]};continue}if(!t.catalogParams.menu_list_ids.length)throw new eJl("PREVIEW_MENU_CONFIGURATION_REQUIRED");let r=t.productsFromSessionSnapshot?a:await t.queries.queryCatalogProductDetail({...t.catalogParams,product_id:Number(n),schedule_date:t.date,with_count:["bundleGroup","optionGroup"],with_schedule:1});if(!i())break;if(!r){l.availability[String(n)]={available:!1,reasons:["PRODUCT_NOT_IN_MENU"]};continue}if(String(r.id??r.product_id)!==String(n)){l.availability[String(n)]={available:!1,reasons:["PRODUCT_MISMATCH"]};continue}let o=function(e,t){try{let l;t.runtimePolicy.settings||eJi("PREVIEW_SALES_SETTINGS_REQUIRED");let i=iM({productDetail:e,requestedProductId:e.id??e.product_id,completeness:"complete"}),a=Number(e.variant_count);if(lW(e.is_variant)&&(!eJa(e.variant).length||Number.isSafeInteger(a)&&a>eJa(e.variant).length)&&("ready"===i.status||i.issues.length&&i.issues.every(e=>"MISSING_VARIANTS"===e.code&&"variant"===e.path))){let l=function(e,t){if(!lJ(e)||!Object.values(eQU(e)).some(e=>e.length>0))return[];eJg(e),eJp(e,t);let l={work:0},i=eJc(e,t,l),a=eJu(e,t,l);if(!i||!a.length)return[];let n=[];for(let t of a){let l=eQV(e,{option:i,bundle:t.rows}),a=e.duration??e.service_duration;!l.reasonCodes.length&&l.partySize&&(l.durationMinutes||(null==a?void 0:a.type)==="flexible")&&n.push({product:l.product,partySize:l.partySize,durationMinutes:l.durationMinutes})}return n}(e,{...t,overSold:t.overSold&&lW(e.over_sold)});return l.length?{status:"requires-configuration",candidates:l,reasonCodes:[]}:{status:"configuration-error",candidates:[],reasonCodes:["PREVIEW_CONFIGURATION_UNAVAILABLE"]}}if("invalid"===i.status)return{status:"configuration-error",candidates:[],reasonCodes:["PREVIEW_CONFIGURATION_UNAVAILABLE",...new Set(i.issues.map(e=>e.code))]};let n=i.productDetail;t={...t,overSold:t.overSold&&lW(n.over_sold)},eJg(n),eJp(n,t);let r={work:0},o=eJc(n,t,r),s=eJu(n,t,r);if(!o||!s.length)return{status:"unavailable",candidates:[],reasonCodes:["NO_SELLABLE_SKU"]};let d=eJa(n.variant_group).some(lJ)?eJa(n.variant).filter(e=>l0(e,{overSold:t.overSold})):[void 0],c=new Set;for(let e of d)for(let i of s){if(eJr(r),1>eJs(e||n,1,t.overSold))continue;let a=iw(n,{product_id:Number(n.id),product_variant_id:Number((null==e?void 0:e.id)||0),option:o,bundle:i.rows},t);if(!a||iV({data:function(e,t){if(!t)return e;let l=e=>eJa(e).map(e=>({...e,option_item:eJa(e.option_item).map(e=>({...e,over_sold:1}))}));return{...e,over_sold:1,variant:eJa(e.variant).map(e=>({...e,over_sold:1})),option_group:l(e.option_group),bundle_group:eJa(e.bundle_group).map(e=>({...e,bundle_item:eJa(e.bundle_item).map(e=>({...e,over_sold:1,option_group:l(e.option_group)}))}))}}(n,t.overSold),value:a,runtimePolicy:{...t.runtimePolicy,platform:"pc"}}).shouldBlock)continue;let s=eQV(n,a);if(s.reasonCodes.length||!s.partySize){s.reasonCodes.forEach(e=>c.add(e));continue}(!l||s.partySize<l.partySize)&&(l={product:s.product,skuValue:a,partySize:s.partySize,durationMinutes:s.durationMinutes})}if(l)return{status:"ready",candidates:[l],reasonCodes:[]};return{status:c.size?"configuration-error":"unavailable",candidates:[],reasonCodes:c.size?[...c]:["NO_SELLABLE_SKU"]}}catch(e){if(e instanceof eJl)return{status:"configuration-error",candidates:[],reasonCodes:["PREVIEW_CONFIGURATION_UNAVAILABLE",e.code]};throw e}}(r,await t.resolvePolicy(r));if(!i())break;let s={available:!1,reasons:[...o.reasonCodes]};if(l.availability[String(n)]=s,"ready"===o.status||"requires-configuration"===o.status){for(let l of o.candidates){let a;try{if(a=await eQ6({os:e,mode:t.mode||"ticket",date:t.date,product:l.product,quantity:1},{projectionDateRange:t.projectionDateRange}),!i())break;let n=a.times.filter(e=>eQK(e,l.partySize));if(n.some(e=>{let i=e.requirementGroups||[];return i.every(e=>1>=Math.max(+!!e.required,e.min||0)&&(!(e.required||e.min>0)||e.max>=1&&e.options.some(e=>eQK(e,l.partySize))))&&("party"!==t.mode||i.some(e=>e.max>=1&&e.options.some(e=>eQK(e,l.partySize))))})){"requires-configuration"===o.status?s.requiresConfiguration=!0:s.available=!0,s.reasons=[];break}s.reasons.push(...a.times.flatMap(e=>e.reasonCodes||[])),s.reasons.length||s.reasons.push(n.length?"UNSUPPORTED_RESOURCE_GROUP":"NO_AVAILABLE_BOOKING")}catch(e){if(e instanceof eQW)s.reasons.push(...e.reasonCodes);else throw e}finally{eQ3(e,a)}}if(s.reasons=[...new Set(s.reasons)],l.available||(l.available=s.available),l.requiresConfiguration||(l.requiresConfiguration=s.requiresConfiguration),(l.available||l.requiresConfiguration)&&t.stopAtFirstAvailable)break}}return l}let eJv=e=>{let t=e.id??e.product_id;return"number"==typeof t?Number.isFinite(t)?String(t):void 0:"string"==typeof t&&t.trim()?t:void 0};function eJf(e){let{os:t,ready:l,catalog:i,date:a,datetime:n,customerId:r,scopeKey:o,retail:s=!1,retailTimeZone:d,revision:c=0,resolvePolicy:u,mode:p="ticket",queries:m,onRetry:g,projectionDateRange:h,operationLog:v}=e,[f,y]=(0,eN.useState)(0),b=(0,eN.useRef)(0),x=(0,eN.useRef)(v);x.current=v;let k=(0,eN.useRef)(),_=JSON.stringify((null==i?void 0:i.menuListIds)||[]),w=s?void 0:a,S=s?void 0:n,j=s||null==h?void 0:h.startDate,N=s||null==h?void 0:h.endDate,C=(0,eN.useMemo)(()=>({}),[t,_,w,S,r,o,s,d,p]),M=(0,eN.useMemo)(()=>({identity:C,ready:l}),[C,l,f,c,u,m,j,N]),[T,I]=(0,eN.useState)(),P=e=>l&&(null==e?void 0:e.request.identity)===C?e.state.products:[];return(0,eN.useEffect)(()=>{let e,n,o=++b.current,c=!1;if(I(e=>({request:M,state:{products:P(e),loading:!0,availability:{}}})),!l){k.current=void 0;return}try{var g;e=null==(g=x.current)?void 0:g.capture()}catch{}return(async()=>{if(!(null==i?void 0:i.menuListIds.length))return void I({request:M,state:{products:[],availability:{},loading:!1}});if("function"!=typeof(null==m?void 0:m.queryCatalogSnapshot))throw Error("The booking catalog service is unavailable. Please update the booking service.");n=s?e_d(d):S;let l=await m.queryCatalogSnapshot({menu_list_ids:[...i.menuListIds],schedule_date:s?n.slice(0,10):w,...n?{schedule_datetime:n}:{},...r?{customer_id:Number(r)}:{}});if(c||b.current!==o)return;let g={};if(!s&&l.length){if(!u)throw Error("The booking sales settings are unavailable.");Object.assign(g,(await eJh(t,{products:l,productsFromSessionSnapshot:!0,date:a,mode:p,resolvePolicy:u,queries:m,...j&&N?{projectionDateRange:{startDate:j,endDate:N}}:{},catalogParams:{menu_list_ids:i.menuListIds,...r?{customer_id:r}:{}},isCurrent:()=>!c&&b.current===o})).availability)}c||b.current!==o||(I({request:M,state:{products:l,availability:g,loading:!1,...s?{pricingDatetime:n}:{}}}),((t,l)=>{if(e)try{let r=function(e){let t=e.menuListIds.length>100,l=0,i=new Set,a=[],n={available:{count:0,ids:[]},unavailable:{count:0,ids:[]},requiresConfiguration:{count:0,ids:[]},unknown:{count:0,ids:[]}},r=[];for(let s of e.products){var o;let d=eJv(s);if(void 0===d){l++;continue}if(i.has(d))continue;i.add(d),a.length<100?a.push(d):t=!0;let c="main"===e.poolRole?null==(o=e.availability)?void 0:o[d]:void 0,u=(null==c?void 0:c.requiresConfiguration)?"requiresConfiguration":(null==c?void 0:c.available)===!0?"available":(null==c?void 0:c.available)===!1?"unavailable":"unknown",p=n[u];if(p.count++,p.ids.length<100?p.ids.push(d):t=!0,"unavailable"===u&&r.length<100){let e=(null==c?void 0:c.reasons)||[],l=[];for(let i of e){if(3===l.length){t=!0;break}if("string"==typeof i&&i){if(!/^[a-z][a-z0-9_:-]*$/i.test(i)){t=!0;continue}i.length>80&&(t=!0),l.push(i.slice(0,80))}}r.push({productId:d,reasonCodes:l})}}return{poolRole:e.poolRole,requestedDate:e.requestedDate,...e.pricingDatetime?{pricingDatetime:e.pricingDatetime}:{},menuCount:e.menuListIds.length,menuListIds:e.menuListIds.slice(0,100),productsCount:e.products.length,productIdCount:i.size,productIds:a,unidentifiedProductsCount:l,availabilityChecked:"main"===e.poolRole,availableCount:n.available.count,availableProductIds:n.available.ids,unavailableCount:n.unavailable.count,unavailableProductIds:n.unavailable.ids,requiresConfigurationCount:n.requiresConfiguration.count,requiresConfigurationProductIds:n.requiresConfiguration.ids,unknownCount:n.unknown.count,unknownProductIds:n.unknown.ids,unavailableReasons:r,truncated:t}}({poolRole:s?"extras":"main",requestedDate:s?n.slice(0,10):a,pricingDatetime:n,menuListIds:(null==i?void 0:i.menuListIds)||[],products:t,availability:l}),o=JSON.stringify(r),d=k.current;if(!r.truncated&&(null==d?void 0:d.identity)===C&&d.queries===m&&d.key===o)return;e("catalog_resolved",r),k.current={identity:C,queries:m,key:o}}catch{}})(l,g))})().catch(t=>{if(!c&&b.current===o){I(e=>({request:M,state:{products:P(e),availability:{},loading:!1,error:t instanceof Error?t.message:String(t)}})),k.current=void 0;try{null==e||e("catalog_failed",{poolRole:s?"extras":"main",requestedDate:s?null==n?void 0:n.slice(0,10):a,...n?{pricingDatetime:n}:{},menuListIds:((null==i?void 0:i.menuListIds)||[]).slice(0,100),errorCode:t&&"object"==typeof t&&"code"in t?String(t.code).slice(0,80):void 0,errorMessage:(t instanceof Error?t.message:String(t)).slice(0,300)},"error")}catch{}}}),()=>{c=!0}},[M]),{...(null==T?void 0:T.request)===M?T.state:{products:P(T),loading:!0,availability:{}},retry:g||(()=>{var e;null==(e=m.retry)||e.call(m),y(e=>e+1)})}}function eJy(e){var t;if(!lJ(e)||lW(e.is_grey)||["draft","pending","archived"].includes(e.status))return!1;let l=lG(null==(t=e.item_rule_limit)?void 0:t.remainingMax);if(void 0!==l&&l<1)return!1;let i=lW(e.over_sold),a=e=>{let t=lG(e.stock_quantity)??lG(e.sum_stock);return!lW(e.is_track)||i||lW(e.over_sold)||void 0===t||t>0},n=e.variant;return a(e)&&(!Array.isArray(n)||!n.length||n.some(e=>lJ(e)&&a(e)))}let eJb=(e,t)=>e.length===t.length&&e.every((e,l)=>e===t[l]);function eJx(e){let t=e.menuListIds.join(","),l=(0,eN.useMemo)(()=>{if(!e.sessionId||!t||!e.os.createVenueCatalogSession){let e=async()=>{throw Error("The local booking catalog is unavailable. Please update the booking service.")};return{queryCatalogSnapshot:e,queryCatalogProductDetail:e,prepareProductDetail:e,calculateProductBookingPrice:e,dispose(){}}}return e.os.createVenueCatalogSession({menu_list_ids:[...e.menuListIds],poolRole:e.poolRole,sessionKey:e.sessionId})},[e.os,e.scopeKey,e.sessionId,t,e.poolRole]);return(0,eN.useEffect)(()=>()=>l.dispose(),[l]),l}function eJk(e){if(!e||!eQw(e.startDate)||!eQw(e.endDate))return[];let t=(Date.parse(`${e.endDate}T12:00:00Z`)-Date.parse(`${e.startDate}T12:00:00Z`))/864e5+1;return!Number.isSafeInteger(t)||t<1||t>32?[]:Array.from({length:t},(t,l)=>eQj(e.startDate,l))}let eJ_=(e,t)=>Array.isArray(e)?e.find(e=>Number(null==e?void 0:e.id)===Number(t)):void 0;function eJw(e,t,l){let i=e||{...l,id:Number(null==l?void 0:l.product_id)},a=t&&e?eJ_(e.variant,t):void 0,n=l&&Number(l.product_id)===Number(i.id)&&Number(l.product_variant_id)===Number(t),r=B2(a);if(!a&&t&&n){var o,s;if(Number(null==(o=l.metadata)?void 0:o.venue_extra_holder_variant_id)===t)r=B2(l);else{let e=(null==(s=l.metadata)?void 0:s.origin)??l._origin;r=B2(eJ_(null==e?void 0:e.variant,t))}}return r?{source:{...i,holder_config:r},overrideVariantId:t||null}:{source:i,overrideVariantId:null}}function eJS(e,t,l){return eJw(e,t,l).source}function eJj(e,t,l,i,a,n){let r=B4(eJS(e,t,n)),o=i.filter(e=>"form"===e.holder_type);if(!r.enabled)return!o.length;let s=new Set(o.map(e=>Number(e.holder_id)));return o.every(e=>{var t,l;return"order_detail"===e.relation_model&&Number.isSafeInteger(Number(e.holder_id))&&Number(e.holder_id)>0&&((null==(t=e.metadata)?void 0:t.form_id)==null||String(e.metadata.form_id)===String(r.formId))&&((null==(l=e.metadata)?void 0:l.customer_id)==null||String(e.metadata.customer_id)===String(a))})&&s.size===o.length&&s.size<=l&&(!r.required||s.size===l)}class eJN extends Error{constructor(e,t){super(t),e2(this,"code",void 0),this.code=e,this.name="PartyExtraError"}}let eJC=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??"")};function eJM(e,t){if("tickets"!==t.mode){let l;return(l=t.parentLineUid)?e.filter(e=>{var t;return(null==(t=e.metadata)?void 0:t.venue_booking_role)==="party_extra"&&String(e.metadata.venue_booking_parent_uid??"")===l}):[]}return e.filter(e=>{var l;return(null==(l=e.metadata)?void 0:l.venue_booking_role)==="tickets_extra"&&e.metadata.venue_booking_scope_key===t.scopeKey})}function eJT(e){let{schedule_date:t,schedule_datetime:l,...i}=e.productLoadParams;return JSON.stringify([e.mode??"party",e.scopeKey,"tickets"===e.mode?null:e.parentLineUid,e.timeZone,e.customerId??null,i])}function eJI(e,t){return{mode:e.mode,timeZone:e.timeZone,parentLineUid:e.parentLineUid,serviceDatetime:e.serviceDatetime,scopeKey:e.scopeKey,customerId:e.customerId,productLoadParams:e.productLoadParams,...t}}function eJP(e,t){let l=eJI(e,t);return{...l,..."tickets"===l.mode?{parentLineUid:void 0}:{},serviceDatetime:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;try{return e_d(e,t)}catch(e){throw new eJN("TIMEZONE_REQUIRED",e instanceof Error?e.message:"The venue timezone is invalid.")}}(l.timeZone)}}function eJA(e,t,l){return{code:e instanceof eJN?e.code:"EXTRA_UNAVAILABLE",message:e instanceof Error?e.message:"Unable to prepare this extra. Please try again.",productId:l??((null==t?void 0:t.product_id)==null?void 0:Number(t.product_id)),...t?{lineUid:eJC(t),line:t}:{}}}function eJD(e){if(!Number.isSafeInteger(e)||e<=0)throw new eJN("INVALID_QUANTITY","Choose a valid quantity.");return e}function eJE(e){let t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(e=>({product_option_item_id:e.product_option_item_id??e.option_group_item_id??e.id,option_group_id:e.option_group_id,num:e.num??e.quantity??1}))};return{product_id:Number(e.product_id),product_variant_id:Number(e.product_variant_id??0),product_option_string:e.product_option_string,option:t(e.option),bundle:(e.bundle||[]).map(e=>{var l;return{id:e.id??e.bundle_id??e.bundle_item_id,group_id:e.group_id??e.bundle_group_id,bundle_variant_id:e.bundle_variant_id??e.variant_id,num:e.num??e.quantity??1,option:t(e.option??(null==(l=e.product_sku)?void 0:l.option))}})}}function eJO(e){var t;return eJE({product_id:Number(e.product_id),product_variant_id:Number(e.product_variant_id??0),option:(null==(t=e.product_sku)?void 0:t.option)??[],bundle:e.product_bundle??[]})}let eJz=e=>JSON.stringify([String(e.group_id??e.bundle_group_id??""),String(e.id??e.bundle_id??e.bundle_item_id??""),String(e.bundle_variant_id??e.variant_id??0)]);function eJL(e){var t,l;let i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(e=>[String(e.option_group_id??""),String(e.product_option_item_id??e.option_group_item_id??e.id??""),Number(e.num??e.quantity??1),Number(e.original_price??e.price??e.add_price??0)]).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t)))},a=(e.product_bundle??[]).map(e=>{var t;return[String(e.group_id??e.bundle_group_id??""),String(e.id??e.bundle_id??e.bundle_item_id??""),String(e.bundle_variant_id??e.variant_id??0),Number(e.num??e.quantity??1),String(e.price_type??e.custom_price_type??""),String(e.price_type_ext??""),Number(e.original_price??e.product_price??e.price??0),i(e.option??(null==(t=e.product_sku)?void 0:t.option))]}).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t)));return JSON.stringify([Number(e.num),Number((null==(t=e.metadata)?void 0:t.main_product_original_price)??e.original_price),i(null==(l=e.product_sku)?void 0:l.option),a])}function eJR(e){return{venue_booking_role:"tickets"===e.mode?"tickets_extra":"party_extra",..."tickets"===e.mode?{}:{venue_booking_parent_uid:e.parentLineUid},venue_booking_service_datetime:e.serviceDatetime,venue_booking_scope_key:e.scopeKey}}let eJ$=function(e){var t;let l,i,a,n,r,o,s,d,c,u,p,m,g,h,v,f,y,b,x,k,_,w,S,j,N,C,M=(0,eN.useRef)(e);M.current=e;let T=(0,eN.useRef)(!0),I=(0,eN.useRef)();I.current||(t=()=>{if(!T.current)throw new eJN("CLOSED","The extras page is closed. Please open it again.");return M.current},l=0,i=0,a=!1,n=new Map,r=()=>{var e;return(null==(e=t().os.getTempOrder())?void 0:e.products)??[]},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eJI(t());return eJM(r(),e)},s=e=>{var l;return Uy(e,null==(l=t().os.getTempOrder())?void 0:l.holder_relations)},d=e=>JSON.stringify([e,s(e)]),c=e=>JSON.stringify(o(e).map(d)),u=e=>{var t;return JSON.stringify([null==e?void 0:e.order_id,null==e?void 0:e.external_sale_number,null==e||null==(t=e._extend)?void 0:t.localId])},p=e=>{let l=t().os.getTempOrder();if(!l||Number(l.order_id||0)>0)throw new eJN("NEW_DRAFT_REQUIRED","Start a new booking order before adding extras.");if("tickets"===e.mode){if(!r().some(t=>{var l;return(null==(l=t.metadata)?void 0:l.venue_booking_role)==="tickets"&&t.metadata.venue_booking_scope_key===e.scopeKey}))throw new eJN("TICKETS_REQUIRED","Add a ticket before adding extras.")}else if(!e.parentLineUid||!r().some(t=>{var l;return eJC(t)===e.parentLineUid&&(null==(l=t.metadata)?void 0:l.venue_booking_role)==="party_main"&&t.metadata.venue_booking_scope_key===e.scopeKey}))throw new eJN("PARENT_REQUIRED","Choose and save the Party product before adding extras.")},m=e=>{if(p(e),!e.scopeKey||!e.serviceDatetime||!/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/.test(e.serviceDatetime))throw new eJN("SERVICE_TIME_REQUIRED","The extras pricing date and time are unavailable.");let t=e.productLoadParams.menu_list_ids;if(!(null==t?void 0:t.length)||t.some(e=>!Number.isSafeInteger(e)||e<=0))throw new eJN("CATALOG_REQUIRED","This extras step needs its own menu configuration.")},g=(e,l)=>{if(t().os!==l.os||t().catalogSession!==l.catalogSession||eJT(eJI(t()))!==eJT(e))throw new eJN("STALE_CONTEXT","The booking or extras selection changed. Please choose this item again.");p(e)},h=(e,t)=>{let l=t.os.getTempOrder(),i=null==l?void 0:l.customer_id,a=u(l),n=c(e),r=()=>{if(g(e,t),!l||t.os.getTempOrder()!==l||u(l)!==a||l.customer_id!==i)throw new eJN("STALE_CART","The order or customer changed. Please check the extras again.")};return{beforeApply:()=>{var l,i;if("tickets"===e.mode&&(null==(l=(i=t.os).supportsVenueTicketExtras)?void 0:l.call(i))!==!0)throw new eJN("TICKETS_EXTRAS_SERVICE_UPGRADE_REQUIRED","Tickets extras need an updated booking service. Your selection is kept; update the service before adding or repricing extras.");if(r(),n!==c(e))throw new eJN("STALE_CART","The extras changed while checking the price. Please retry.")},isCurrentOrder:()=>{try{return r(),!0}catch{return!1}}}},v=async e=>{if(a)throw new eJN("BUSY","Please wait for the current cart update.");a=!0;try{return await e()}finally{a=!1}},f=async()=>{try{var e,l;t().cart.refreshCartSnapshot(),await (null==(e=(l=t()).onMutated)?void 0:e.call(l))}catch(e){console.warn("[PartyExtras] Saved extra; UI refresh failed",e)}},y=async function(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"local";m(t);let a=l.catalogSession;if(!(null==a?void 0:a.queryCatalogProductDetail)||!a.calculateProductBookingPrice||"prepare-configuration"===i&&!a.prepareProductDetail)throw new eJN("CATALOG_SESSION_REQUIRED","The extras catalog service is unavailable. Update the booking service and reload this page.");let n={...t.productLoadParams,product_id:e,schedule_date:t.serviceDatetime.slice(0,10),schedule_datetime:t.serviceDatetime,with_count:["bundleGroup","optionGroup"],with_schedule:1,...null!=t.customerId?{customer_id:Number(t.customerId)}:{}},r="prepare-configuration"===i?await a.prepareProductDetail({...n,retry:!0}):await a.queryCatalogProductDetail(n);if(!r||Number(r.id)!==e)throw new eJN("NOT_IN_CATALOG","This extra is no longer available in the selected menu at the current venue time.");for(let[e,t]of[["option_group_count","option_group"],["bundle_group_count","bundle_group"]])if(Number(r[e])>0&&!Array.isArray(r[t]))throw new eJN("INCOMPLETE_DETAIL","Product options are not ready. Please retry.");let o=iM({productDetail:r,requestedProductId:e,completeness:"complete",missingGroupPolicy:l.detailMissingGroupPolicy??"reject"});if("invalid"===o.status)throw new eJN("INCOMPLETE_DETAIL",o.issues.map(e=>e.message).join(" "));if(lW(r.open_sold_weight))throw new eJN("WEIGHING_REQUIRED","This extra requires a measured weight and cannot be added from this booking page.");return o.productDetail},b=async(e,t,l,i,a,n,r)=>{var o,d,c,u,p,m,g;let h,v=a.catalogSession;if(!(null==v?void 0:v.calculateProductBookingPrice))throw new eJN("CATALOG_SESSION_REQUIRED","The extras catalog service is unavailable. Update the booking service and reload this page.");let f=await a.resolveSelectionPolicy(e),y=iw(e,eJE(t),f);if(!y)throw new eJN("INVALID_CONFIGURATION","An option or variant is no longer available. Please choose the options again.");!function(e,t,l,i){var a,n,r,o,s;eJD(l);let d=(t.product_variant_id?null==(a=e.variant)?void 0:a.find(e=>String(e.id)===String(t.product_variant_id)):void 0)??e;if(!l0(e,{overSold:i})||!l0(d,{overSold:i})||lW(e.is_grey))throw new eJN("SOLD_OUT","This extra is currently unavailable. Choose another item or remove it.");if(lW(d.is_track)&&!i&&l>Number(d.stock_quantity??0))throw new eJN("INSUFFICIENT_STOCK","The selected quantity is no longer available.");let c=null==(n=e.item_rule_limit)?void 0:n.remainingMax;if(l<Number((null==(r=e.item_rule_limit)?void 0:r.min)??0)||null!=c&&l>Number(c))throw new eJN("QUANTITY_LIMIT",(null==(o=e.item_rule_limit)?void 0:o.validationMessage)||"Update this extra to an available quantity.");let u=[...t.option,...t.bundle].map(e=>({row:e,multiplier:l}));for(let e of t.bundle)for(let t of e.option??(null==(s=e.product_sku)?void 0:s.option)??[])u.push({row:t,multiplier:l*Number(e.num??1)});for(let{row:e,multiplier:t}of u)if(lW(e.is_track)&&!i&&t*Number(e.num??1)>Number(e.stock_quantity??0))throw new eJN("INSUFFICIENT_STOCK","An option or bundle item no longer has enough stock.")}(e,y,l,f.overSold);let b={...e,product_id:e.id,product_variant_id:y.product_variant_id,quantity:l,num:l,product_sku:{option:y.option},product_bundle:y.bundle.map(exV)},x=await v.calculateProductBookingPrice({product:b,datetime:i.serviceDatetime,channel:"online_ordering",...null!=i.customerId?{customer_id:i.customerId}:{}});if(Number(x.product_id)!==Number(e.id)||Number(x.product_variant_id??0)!==Number(y.product_variant_id??0))throw new eJN("PRICE_MISMATCH","The returned price does not match the selected extra. Please retry.");if(null==x.unit_price||""===String(x.unit_price).trim()||!Number.isFinite(Number(x.unit_price))||0>Number(x.unit_price))throw new eJN("PRICE_UNAVAILABLE","The current price is unavailable. Please retry before adding this extra.");let k=exY(b.product_bundle,x)??[],_={...e.metadata||{},...eJR(i),quotation_shelf_id:x.quotation_shelf_id};delete _.unique_identification_number,delete _.booking_uid;let{source:w,overrideVariantId:S}=eJw(e,y.product_variant_id,n),j=B4(w),N=n?s(n):[],C=r??N;if((j.required||j.enabled&&C.length>0)&&(null==(o=(d=a.os).supportsVenueExtraHolders)?void 0:o.call(d))!==!0)throw new eJN("HOLDER_SERVICE_REQUIRED","The booking service needs to be updated to save holder profiles.");if((j.required||void 0!==r)&&!eJj(e,y.product_variant_id,l,C,i.customerId,n))throw new eJN("HOLDER_REQUIRED","Review the holder profiles for this item.");let M=j.raw??{status:"disable",required:0};_.holder_config=M,_.venue_extra_holder_variant_id=S,"tickets"===i.mode&&delete _.venue_booking_parent_uid,n&&(_.unique_identification_number=eJC(n));let T={...b,price:x.unit_price,selling_price:x.unit_price,quotation_shelf_id:x.quotation_shelf_id,total:void 0,line_total:void 0,price_override:void 0,_extend:j.enabled||C.length?{holder_relations:C}:void 0,unique_identification_number:void 0,discount_list:[],metadata:_,option:y.option,bundle:k,product_bundle:k,holder_config:M,booking_uid:void 0},I=!1;if(n){(h=exW({line:{...n,num:l,product_sku:b.product_sku,product_bundle:k},result:x,resetDiscountList:!0})).unique_identification_number=eJC(n),h.updates.metadata={...h.updates.metadata,...eJR(i)};let e={...n,...h.updates};if(I=eJL(n)!==eJL(e),eJL(n)===eJL(e)){let e=null==(p=n.product_bundle)?void 0:p.map(e=>{var t;return{...e,quotation_shelf_id:null==(t=k.find(t=>eJz(t)===eJz(e)))?void 0:t.quotation_shelf_id}}),t=[null==(m=n.metadata)?void 0:m.quotation_shelf_id,null==(g=n.product_bundle)?void 0:g.map(e=>e.quotation_shelf_id),Object.keys(eJR(i)).map(e=>{var t;return null==(t=n.metadata)?void 0:t[e]})],l=[x.quotation_shelf_id,null==e?void 0:e.map(e=>e.quotation_shelf_id),Object.values(eJR(i))];h=JSON.stringify(t)===JSON.stringify(l)?void 0:{product_id:n.product_id,product_variant_id:n.product_variant_id,unique_identification_number:eJC(n),updates:{metadata:{...n.metadata,...eJR(i),quotation_shelf_id:x.quotation_shelf_id},...e?{product_bundle:e}:{}}}}(void 0!==r||JSON.stringify(null==(c=n.metadata)?void 0:c.holder_config)!==JSON.stringify(M)||((null==(u=n.metadata)?void 0:u.venue_extra_holder_variant_id)??null)!==S)&&(h={...h||{product_id:n.product_id,product_variant_id:n.product_variant_id,unique_identification_number:eJC(n)},updates:{...null==h?void 0:h.updates,holder_config:M,metadata:{...(null==h?void 0:h.updates.metadata)||n.metadata,holder_config:M,venue_extra_holder_variant_id:S},...void 0!==r?{_extend:{holder_relations:C}}:{}}})}return{source:T,update:h,priceChanged:I}},x=async function(e,a,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"local",c=arguments.length>4?arguments[4]:void 0,p=++i;n.clear();try{let h=(null==r?void 0:r.options)??t(),v=(null==r?void 0:r.context)??eJP(h);if(eJD(a),m(v),h.catalog.loading||h.catalog.error||!h.catalog.products.some(t=>Number(t.id)===Number(e.id)))throw new eJN("CATALOG_NOT_READY","Wait for the current extras menu to load, then choose this item again.");let f=h.catalog.products,b=h.os.getTempOrder(),x=u(b),k=c?d(c):void 0,_=await y(Number(e.id),v,h,o);if(await h.resolveSelectionPolicy(_),g(v,h),h.os.getTempOrder()!==b||u(b)!==x)throw new eJN("STALE_CART","The order changed. Please choose this extra again.");if(p!==i)throw new eJN("STALE_SELECTION","A newer extra selection is already open.");if(t().catalog.products!==f)throw new eJN("STALE_CATALOG","The extras menu changed. Please choose this item again.");let w=`party-extra-${Date.now()}-${++l}`,S=iT({productDetail:_,requestedProductId:_.id,completeness:"complete",missingGroupPolicy:h.detailMissingGroupPolicy??"reject",mode:"product-configuration",openId:w,scopeKey:v.scopeKey,detailRevision:w,selectionKey:_.id});if("invalid"===S.status)throw new eJN("INCOMPLETE_DETAIL",S.issues.map(e=>e.message).join(" "));let j="ready"===S.status,N=c?eJO(c):{product_id:_.id,product_variant_id:0,option:[],bundle:[]},C=B4(eJS(_,N.product_variant_id,c)).enabled,M={id:w,contextKey:eJT(v),productId:_.id,quantity:a,productDetail:_,hasSku:j,...c?{lineUid:eJC(c),editingLine:c,holderRelations:s(c)}:{}};!r||j||C||(r.detail=_),n.clear(),n.set(w,{session:M,catalog:f,catalogSession:h.catalogSession,os:h.os,order:b,orderIdentity:x,lineSnapshot:k,consumed:!1});let T={skuValue:N,variantDraft:null};if("ready"===S.status)return{status:"ready",session:M,configuration:T,plan:S.plan};if(!C&&!c)return{status:"direct",session:M,configuration:T};return{status:"ready",session:M,configuration:T,plan:{openId:w,scopeKey:v.scopeKey,detailRevision:w,selectionKey:w,productDetail:_,mode:"product-configuration",hasConfiguration:!0}}}catch(t){return{status:"invalid",issues:[eJA(t,void 0,Number(e.id))]}}},k=async(e,l)=>{let i=o().find(t=>eJC(t)===e),a=i&&t().catalog.products.find(e=>Number(e.id)===Number(i.product_id));return i&&a?x(a,l??Number(i.num),void 0,"prepare-configuration",i):{status:"invalid",issues:[eJA(new eJN("LINE_NOT_FOUND","This extra is no longer available. Review your order."),i)]}},_=async function(e,l,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.quantity,r=arguments.length>4?arguments[4]:void 0;return v(async()=>{var s,c;let p=(null==i?void 0:i.options)??t(),m=(null==i?void 0:i.context)??eJP(p),g=n.get(e.id);if(!g||g.session!==e||g.consumed||g.os!==p.os||g.catalogSession!==p.catalogSession||e.contextKey!==eJT(m)||g.catalog!==p.catalog.products||g.order!==p.os.getTempOrder()||g.orderIdentity!==u(p.os.getTempOrder()))throw new eJN("STALE_SESSION","The extra selection has expired. Please choose it again.");let v=eJD(a),x=(null==i?void 0:i.guard)??h(m,p);x.beforeApply(),await (null==(s=p.beforeMutate)?void 0:s.call(p)),x.beforeApply();let k=(null==i?void 0:i.detail)??await y(e.productId,m,p),_=e.lineUid?o().find(t=>eJC(t)===e.lineUid):void 0;if(e.lineUid&&(!_||d(_)!==g.lineSnapshot))throw new eJN("STALE_CART","This extra has changed. Please open it again.");let w=_?eJO(_):l.skuValue,S=await b(k,w,v,m,p,_,r);if(x.beforeApply(),g.catalog!==t().catalog.products)throw new eJN("STALE_CATALOG","The extras menu changed. Please choose this item again.");let j=_?{allowed:!0,noteDraft:void 0}:await p.cart.prepareAllergyBeforeCommit({product:S.source,flowId:e.id,perFlow:!0});if(x.beforeApply(),!j.allowed)return{status:"cancelled"};if(await (null==(c=p.beforeMutate)?void 0:c.call(p)),x.beforeApply(),g.catalog!==t().catalog.products)throw new eJN("STALE_CATALOG","The extras menu changed. Please choose this item again.");if(g.consumed=!0,_)return S.update&&await p.os.updateOrderProducts([S.update],x),await f(),{status:"updated"};let N=await p.os.addRetailProduct({product:S.source,quantity:v,salesNotes:j.noteDraft?[j.noteDraft]:void 0,availabilityCommitGuard:x.beforeApply});return await f(),{status:"added",products:N}})},w=async function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t(),i=eJI(l),a=l.os.getTempOrder(),n=u(a),r=null==a?void 0:a.customer_id,s=new Set(e),d=o(i).filter(e=>s.has(eJC(e)));if(!a||Number(a.order_id||0)>0||!s.size||s.size!==e.length||e.some(e=>!e)||d.length!==s.size||new Set(d.map(eJC)).size!==s.size||a.products.filter(e=>s.has(eJC(e))).length!==s.size||d.some(e=>{var t;return(null==(t=e.metadata)?void 0:t.venue_booking_scope_key)!==i.scopeKey}))throw new eJN("LINE_NOT_FOUND","These extras changed. Please review the cart.");let c=()=>t().os===l.os&&l.os.getTempOrder()===a&&u(a)===n&&a.customer_id===r&&eJT(eJI(t()))===eJT(i),p=JSON.stringify([a.products,a.bookings,a.notes]),m=()=>{if(!c()||p!==JSON.stringify([a.products,a.bookings,a.notes]))throw new eJN("STALE_CART","The extras changed. Please review the cart.")};if(!l.os.removeProductsFromOrder)throw new eJN("CART_SERVICE_REQUIRED","The booking cart service needs to be updated.");m();try{let e=await l.os.removeProductsFromOrder(d.map(e=>({product_id:e.product_id,product_variant_id:e.product_variant_id,unique_identification_number:eJC(e)})),{beforeApply:m,isCurrentOrder:c});if(!c())throw new eJN("STALE_CART","The order changed while removing extras.");return await f(),{status:"updated",products:e}}catch(e){throw c()&&await f(),e}},S=async(e,l,i)=>v(async()=>{var a,n;let r=(null==i?void 0:i.options)??t();if(!Number.isSafeInteger(l)||l<0)throw new eJN("INVALID_QUANTITY","Choose a valid quantity.");let s=o().find(t=>eJC(t)===e);if(!s||!e)throw new eJN("LINE_NOT_FOUND","This extra has changed. Please refresh the cart.");if(l===Number(s.num))return{status:"unchanged"};if(0===l)return w([e],r);let d=(null==i?void 0:i.context)??eJP(r),c=(null==i?void 0:i.guard)??h(d,r);c.beforeApply(),await (null==(a=r.beforeMutate)?void 0:a.call(r)),c.beforeApply();let u=(null==i?void 0:i.detail)??await y(Number(s.product_id),d,r);if(B4(eJS(u,s.product_variant_id,s)).enabled)return k(e,l);let p=await b(u,eJO(s),l,d,r,s);c.beforeApply(),await (null==(n=r.beforeMutate)?void 0:n.call(r)),c.beforeApply();let m=await r.os.updateOrderProducts([p.update],c);return await f(),{status:"updated",products:m}}),j=(e,t)=>S(e,t),N=async e=>{let l=t(),i=eJP(l,e),a=l.os.getTempOrder(),n=u(a),r=o(eJI(l)),s=c(eJI(l)),d={context:i,contextKey:eJT(i),sourceRows:r,orderSignature:s,validRows:[],updates:[],invalidItems:[],priceChanged:!1};if(!r.length)return d;let p=new Map;for(let e of r)try{if(!eJC(e))throw new eJN("MISSING_LINE_UID","This extra has no line identity. Remove it and add it again.");let t=Number(e.product_id);p.has(t)||p.set(t,y(t,i,l));let a=await p.get(t),n=await b(a,eJO(e),Number(e.num),i,l,e);d.validRows.push(n.source),d.priceChanged||(d.priceChanged=n.priceChanged),n.update&&d.updates.push(n.update)}catch(t){d.invalidItems.push(eJA(t,e))}if(l.os!==t().os||l.catalogSession!==t().catalogSession||l.os.getTempOrder()!==a||u(a)!==n||s!==c(eJI(l))||eJT(eJI(l))!==eJT(eJI(t())))throw new eJN("STALE_CART","The Party or extras changed while checking availability. Please retry.");return d},C=async()=>v(async()=>{var e,l;let i=t(),a=h(eJI(i),i);a.beforeApply(),await (null==(e=i.beforeMutate)?void 0:e.call(i)),a.beforeApply();let n=await N();if(g(n.context,i),n.orderSignature!==c(n.context))throw new eJN("STALE_CART","The extras changed while checking availability. Please retry.");return a.beforeApply(),n.updates.length&&(await (null==(l=i.beforeMutate)?void 0:l.call(i)),a.beforeApply(),await i.os.updateOrderProducts(n.updates,a),await f()),n}),I.current={prepare:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return x(e,t,void 0,"prepare-configuration")},prepareEdit:k,commit:function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.quantity,i=arguments.length>3?arguments[3]:void 0;return _(e,t,void 0,l,i)},setProductQuantity:async(e,l)=>{let i;if(!Number.isSafeInteger(l)||l<0)throw new eJN("INVALID_QUANTITY","Choose a valid quantity.");let a=o().filter(t=>Number(t.product_id)===Number(e.id)),n=a.reduce((e,t)=>e+Number(t.num||0),0);if(n===l)return{status:"unchanged"};if(l<n){var r,s,d;if(1===a.length)return j(eJC(a[0]),l);if(!lW(e.is_variant)&&!lW(e.is_bundle)&&!lW(e.open_sold_weight)&&!lW(e.isOpenDetailModal)&&!["session_product","session_ticket"].includes(String(e.extension_type||""))&&!Number(e.option_group_count||0)&&!Number(e.bundle_group_count||0)&&!(null==(r=e.variant_group)?void 0:r.length)&&!(null==(s=e.option_group)?void 0:s.length)&&!(null==(d=e.bundle_group)?void 0:d.length)&&a.every(e=>{var t;return!Number(e.product_variant_id)&&!((null==(t=e.product_sku)?void 0:t.option)||[]).length&&!(e.product_bundle||[]).length})){let e=a[a.length-1];return j(eJC(e),Math.max(0,Number(e.num)-(n-l)))}return{status:"choose-line",rows:a,targetQuantity:l}}try{let e,l,a,n;e=t(),l=eJP(e),a=e.catalog.products,n=h(l,e),i={options:e,context:l,guard:{...n,beforeApply:()=>{if(n.beforeApply(),t().catalog.products!==a)throw new eJN("STALE_CATALOG","The extras menu changed. Please choose this item again.")}}}}catch(t){return{status:"invalid",issues:[eJA(t,void 0,Number(e.id))]}}let c=await x(e,l-n,i);if("direct"!==c.status)return c;if(o().filter(t=>Number(t.product_id)===Number(e.id)).reduce((e,t)=>e+Number(t.num||0),0)!==n)throw new eJN("STALE_CART","The extra quantity changed. Please retry.");return 1===a.length?S(eJC(a[0]),l,i):_(c.session,c.configuration,i)},setLineQuantity:j,removeLines:e=>v(()=>w(e)),prepareRevalidation:N,revalidate:C});let[P,A]=(0,eN.useState)(0),[D,E]=(0,eN.useState)([]),[O,z]=(0,eN.useState)(()=>eJT(e));(0,eN.useEffect)(()=>(T.current=!0,()=>{T.current=!1}),[]);let L=(0,eN.useMemo)(()=>{var t;return eJM((null==(t=e.cart.tempOrder)?void 0:t.products)??[],e)},[e.cart.tempOrder,e.parentLineUid,e.mode,e.scopeKey]),R=eJT(e);(0,eN.useEffect)(()=>{L.length||z(R)},[R,L.length]);let $=(0,eN.useMemo)(()=>{let t=new Set(L.map(eJC)),l=D.filter(e=>e.lineUid&&t.has(e.lineUid));for(let t of L){var i;let a=eJC(t);R===O&&(null==(i=t.metadata)?void 0:i.venue_booking_scope_key)===e.scopeKey||l.some(e=>e.lineUid===a)||l.push({code:"REVALIDATION_REQUIRED",message:"The booking context changed. Check this extra again before checkout.",lineUid:a,productId:Number(t.product_id),line:t})}return l},[L,D,R,O,e.scopeKey]),F=(0,eN.useMemo)(()=>{let e={};for(let t of L){let l=Number(t.num);if(Number.isFinite(l)&&l>0){let i=String(t.product_id);e[i]=(e[i]??0)+l}}return e},[L]);return{...(0,eN.useMemo)(()=>{let e=I.current,t=async e=>{T.current&&A(e=>e+1);try{return await e()}finally{T.current&&A(e=>Math.max(0,e-1))}};return{prepare:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.prepare(...i))},prepareEdit:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.prepareEdit(...i))},commit:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(async()=>{let t=await e.commit(...i);return T.current&&i[0].lineUid&&"updated"===t.status&&E(e=>e.filter(e=>e.lineUid!==i[0].lineUid)),t})},setProductQuantity:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.setProductQuantity(...i))},setLineQuantity:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(async()=>{let t=await e.setLineQuantity(...i);return T.current&&E(e=>e.filter(e=>e.lineUid!==i[0])),t})},removeLines:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(async()=>{let t=await e.removeLines(...i);return T.current&&E(e=>e.filter(e=>!e.lineUid||!i[0].includes(e.lineUid))),t})},prepareRevalidation:function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t(()=>e.prepareRevalidation(...i))},revalidate:()=>t(async()=>{let t=await e.revalidate();return T.current&&eJT(M.current)===t.contextKey&&(E(t.invalidItems),z(t.contextKey)),t})}},[]),rows:L,quantityByProductId:F,invalidItems:$,busy:P>0}},eJF=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??"")},eJq=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.booking_uid??"")},eJB=e=>"string"==typeof e&&""!==e.trim()||"number"==typeof e&&Number.isFinite(e),eJH=(e,t)=>{let l=String(e??"").slice(0,10),i=String(t??"");return/^\d{4}-\d{2}-\d{2}$/.test(l)&&/^\d{2}:\d{2}(:\d{2})?$/.test(i)?`${l} ${5===i.length?`${i}:00`:i}`:""},eJV=e=>{let t=String(e??"").replace("T"," ");return 16===t.length?`${t}:00`:t},eJU=e=>eJV(e).slice(0,16);function eJY(e,t){let l={bindings:[],extras:[],gifts:[],issues:[]},i=(e,t,i,a)=>l.issues.push({code:e,message:t,productLineUid:i,bookingUid:a});if(!e)return i("ORDER_REQUIRED","The booking draft is unavailable."),l;Number(e.order_id||0)>0&&i("NEW_DRAFT_REQUIRED","This entry supports new booking drafts only.");let a=Array.isArray(e.products)?e.products:[],n=Array.isArray(e.bookings)?e.bookings:[],r=new Set,o=new Set;for(let e of a){var s,d,c,u,p,m,g,h;let v=eJF(e),f=null==(s=e.metadata)?void 0:s.venue_booking_role;if(null==(d=e.metadata)?void 0:d._giftInfo){l.gifts.push(e);let t=String(e.booking_uid??(null==(u=e.metadata)?void 0:u.booking_uid)??"");n.filter(e=>t&&eJq(e)===t||String(e.product_uid??"")===v).forEach(e=>o.add(eJq(e)));continue}if("party_extra"===f||"tickets_extra"===f){f!==("tickets"===t.mode?"tickets_extra":"party_extra")&&i("UNEXPECTED_ORDER_LINE","The draft contains an extra from another booking entry.",v),(!v||r.has(v))&&i("INVALID_LINE_IDENTITY","The extra line identity is missing or duplicated.",v),r.add(v),Number(e.order_detail_id||0)>0&&i("NEW_DRAFT_REQUIRED","An existing extra cannot be edited here.",v),(!Number.isSafeInteger(Number(e.num))||0>=Number(e.num))&&i("EXTRA_QUANTITY_INVALID","Update this extra to a valid quantity.",v),(null==(p=e.metadata)?void 0:p.venue_booking_scope_key)&&(!t.scopeKey||e.metadata.venue_booking_scope_key===t.scopeKey)||i("EXTRA_SCOPE_INVALID","This extra belongs to another booking entry.",v);let o=String((null==(m=e.metadata)?void 0:m.venue_booking_parent_uid)||"");"tickets_extra"===f&&o&&i("EXTRA_PARENT_INVALID","Ticket extras belong to the order, not a booking line.",v),"party_extra"!==f||a.some(t=>{var l,i;return eJF(t)===o&&(null==(l=t.metadata)?void 0:l.venue_booking_role)==="party_main"&&t.metadata.venue_booking_scope_key===(null==(i=e.metadata)?void 0:i.venue_booking_scope_key)})||i("EXTRA_PARENT_INVALID","The Party product for this extra is missing.",v),(null==(g=e.metadata)?void 0:g.venue_booking_service_datetime)||i("EXTRA_PRICE_CONTEXT_MISSING","Recheck this extra before checkout.",v),(e.booking_uid||(null==(h=e.metadata)?void 0:h.booking_uid)||n.some(e=>String(e.product_uid||"")===v))&&i("EXTRA_BOOKING_INVALID","An extra must not create a booking.",v),l.extras.push(e);continue}if(f!==("tickets"===t.mode?"tickets":"party_main")){i("UNEXPECTED_ORDER_LINE","The draft contains a product from another booking entry.",v);continue}if(!v||r.has(v)){i("INVALID_LINE_IDENTITY","The product line identity is missing or duplicated.",v);continue}r.add(v),Number(e.order_detail_id||0)>0&&i("NEW_DRAFT_REQUIRED","An existing order line cannot be edited here.",v);let y=String(e.booking_uid??(null==(c=e.metadata)?void 0:c.booking_uid)??""),b=n.filter(e=>y&&eJq(e)===y||String(e.product_uid??"")===v);if(1!==b.length){i("BOOKING_LINK_INVALID","A booking product must have exactly one linked booking.",v);continue}let x=b[0],k=eJq(x);if(!k||o.has(k)||y&&y!==k||x.product_uid&&String(x.product_uid)!==v){i("BOOKING_LINK_INVALID","The booking and product line identities no longer match.",v,k);continue}o.add(k);let _=eJH(x.start_date,x.start_time),w=eJH(x.end_date,x.end_time),S=x.metadata||{},j=String(S.availability_business_date||t.date||_.slice(0,10)),N=Number(e.num);_&&w&&!(w<=_)||i("BOOKING_TIME_INVALID","The saved booking interval is incomplete.",v,k),Number.isSafeInteger(N)&&1===N||i("BOOKING_LINE_COUNT_INVALID","Each saved booking must map to one product line.",v,k),S.availability_candidate_key&&S.availability_source&&S.availability_slice_start_at&&S.availability_slice_end_at&&Array.isArray(S.availability_schedule_refs)||i("BOOKING_INTENT_MISSING","The saved booking is missing its original availability intent. Please reselect it.",v,k);let C=[];for(let e of Array.isArray(x.resources)?x.resources:[]){let t=e.relation_id??e.resource_id??e.id;if(!eJB(t)||0===Number(t)||!eJB(e.form_id)){i("BOOKING_RESOURCE_INVALID","The saved resource identity is incomplete.",v,k);continue}C.push({formId:e.form_id,resourceId:t,capacity:Number(e.capacity)})}l.bindings.push({productLineUid:v,bookingUid:k,identity:ekX(e),line:e,booking:x,quantity:N,date:j,intent:{date:j,startAt:_,endAt:w,sliceStartAt:String(S.availability_slice_start_at??""),sliceEndAt:String(S.availability_slice_end_at??""),candidateKey:String(S.availability_candidate_key??""),source:String(S.availability_source??""),scheduleRefs:S.availability_schedule_refs||[],timezone:S.availability_timezone,primaryScheduleRef:S.availability_primary_schedule_ref,resources:C}})}l.bindings.length||i("BOOKING_REQUIRED","Add a booking before continuing."),"party"===t.mode&&1!==l.bindings.length&&i("PARTY_SINGLE_MAIN_REQUIRED","A party order requires one main product, room and time.");let v=new Set(l.bindings.map(e=>e.date));for(let e of((v.size>1||t.date&&[...v].some(e=>e!==t.date))&&i("SINGLE_DATE_REQUIRED","All bookings must retain the selected booking date."),n))o.has(eJq(e))||i("ORPHAN_BOOKING","The draft contains an unlinked booking.",void 0,eJq(e));return l}let eJW=e=>{var t;return(0,ni.cloneDeep)(e&&{orderId:e.order_id,externalSaleNumber:e.external_sale_number,localId:null==(t=e._extend)?void 0:t.localId,customerId:e.customer_id,products:e.products,bookings:e.bookings,holder:e.holder,holderRelations:e.holder_relations,notes:e.notes,orderDiscounts:e.discount_list,shopDiscount:e.shop_discount,payments:e.payments})};async function eJG(e){var t,l,i;let a=e.os.getTempOrder(),n=eJW(a),r=eJY(a,e),o={bindings:[],extras:r.extras,gifts:r.gifts,issues:[...r.issues]},s=void 0===e.customerId?null==a?void 0:a.customer_id:e.customerId;if(String(s??"")!==String((null==a?void 0:a.customer_id)??"")&&o.issues.push({code:"CUSTOMER_CHANGED",message:"The customer changed. Please review the booking again."}),r.issues.length)return o;let d=()=>{var t;let l;return(null==(t=e.isCurrent)?void 0:t.call(e))!==!1&&(l=e.os,(0,ni.isEqual)(eJW(l.getTempOrder()),n))};if(!(null==(t=e.catalog)?void 0:t.menuListIds.length)||!(null==(l=e.queries)?void 0:l.queryCatalogProductDetail)||!e.os.buildCacheItemFromOrderLine)return o.issues.push({code:"BOOKING_SERVICE_UNAVAILABLE",message:"The configured booking menu or detail service is unavailable."}),o;for(let t of r.bindings){let l,a;try{if(!d())throw Error("ORDER_CHANGED");let n={menu_list_ids:[...e.catalog.menuListIds],schedule_date:t.date,schedule_datetime:t.intent.startAt,...null!=s?{customer_id:Number(s)}:{}},r=await e.queries.queryCatalogProductDetail({...n,product_id:Number(t.line.product_id)});if(!d())throw Error("ORDER_CHANGED");if(!r||String(r.id)!==String(t.line.product_id))throw Error("PRODUCT_DETAIL_UNAVAILABLE");let c=iM({productDetail:r,requestedProductId:Number(t.line.product_id),completeness:"complete"});if("invalid"===c.status)throw Error("PRODUCT_DETAIL_INCOMPLETE");let u=e.os.buildCacheItemFromOrderLine({product:t.line,booking:t.booking,sourceProduct:r}),p=e_V({...u,product_resource:r.product_resource,duration:r.duration,capacity:r.capacity,_data:{...u._data,capacitys:null==(i=r._data)?void 0:i.capacitys}}),m=$O(p._extend);if(!m||String(m.product_id)!==String(t.line.product_id)||String(m.product_variant_id)!==String(t.line.product_variant_id))throw Error("ORDER_SKU_INVALID");let g=new Map;for(let e of t.intent.resources){let t=String(e.formId),l=g.get(t)||{formId:e.formId,resourceIds:[]};l.resourceIds.push(e.resourceId),g.set(t,l)}if(a={...t,product:p,skuValue:m,selection:{requirementSelections:[...g.values()]}},l=await eQ6({os:e.os,mode:"tickets"===e.mode?"ticket":"party",date:t.date,product:p,quantity:t.quantity,editingProductLineUid:t.productLineUid}),!d())throw Error("ORDER_CHANGED");let h=l.times.filter(e=>{var l;return l=t.intent,e.key===l.candidateKey&&e.source===l.source&&eJV(e.startAt)===eJV(l.sliceStartAt)&&eJV(e.endAt)===eJV(l.sliceEndAt)&&eJU(e.bookingStartAt||e.startAt)===eJU(l.startAt)&&eJU(e.bookingEndAt||e.endAt)===eJU(l.endAt)&&(0,ni.isEqual)(e.scheduleRefs,l.scheduleRefs)&&(!l.timezone||e.timezone===l.timezone)&&(!l.primaryScheduleRef||(0,ni.isEqual)(e.primaryScheduleRef,l.primaryScheduleRef))});if(1!==h.length)throw Error("SELECTED_TIME_UNAVAILABLE");let v=await eQ5(e.os,l,h[0]);if(!d())throw Error("ORDER_CHANGED");let f=[];for(let e of t.intent.resources){let t=v.groups.filter(t=>String(t.formId)===String(e.formId)&&t.options.some(t=>String(t.resourceId)===String(e.resourceId)));if(1!==t.length)throw Error("SAVED_RESOURCE_GROUP_AMBIGUOUS");if(e.capacity!==l.partySize)throw Error("BOOKING_CAPACITY_CHANGED");let i=t[0],a=f.find(e=>e.requirementGroupId===i.groupId);a||(a={requirementGroupId:i.groupId,formId:i.formId,resourceIds:[]},f.push(a)),a.resourceIds.push(e.resourceId)}o.bindings.push({...t,product:p,skuValue:m,selection:{candidate:v.candidate,requirementSelections:f}})}catch(i){let l=i instanceof Error?i.message:"BOOKING_VALIDATION_FAILED";!e.requireAvailable&&a&&d()&&o.bindings.push(a),o.issues.push({code:l,message:"ORDER_CHANGED"===l?"The booking draft changed. Please review it again.":"This saved booking is no longer available. Please reselect it.",productLineUid:t.productLineUid,bookingUid:t.bookingUid})}finally{eQ3(e.os,l)}if(!d())break}return o}function eJK(e,t){var l,i,a,n,r,o,s,d;let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"en",u=e.sales.bookingTicket,p=null==u||null==(l=u.getCart)?void 0:l.call(u),m=new Set(e_S(u).map(e=>{var t;return String((null==(t=e.orderLine.metadata)?void 0:t.unique_identification_number)||"")})),g=new Set;for(let e of(null==p?void 0:p.bookings)||[]){let t=e.product_uid??(null==(n=e._extend)||null==(a=n.product)||null==(i=a.metadata)?void 0:i.unique_identification_number);t&&g.add(String(t))}for(let e of(null==p?void 0:p.items)||[])!["tickets_extra","party_extra"].includes(null==(r=e.metadata)?void 0:r.venue_booking_role)&&(null==(o=e.metadata)?void 0:o.unique_identification_number)&&g.add(String(e.metadata.unique_identification_number));let h=[],v=[];if(u)for(let e of g){let t=e_j(u,e);if(!t)continue;let l=B4(t.cacheItem),i=Number((null==(s=t.cacheItem._extend)?void 0:s.quantity)||1),a=Number.isSafeInteger(i)&&i>0?i:1,n={...t,uid:e,config:l,quantity:a,title:eKT(t.orderLine.product_title||t.cacheItem.title||t.cacheItem.name||t.cacheItem.product_name,c),ids:Uk(null==(d=t.cacheItem._extend)?void 0:d.holder_id),missing:m.has(e)};(t.booking||l.enabled)&&v.push(n),l.enabled&&h.push(n)}let f=h.reduce((e,t)=>e+t.quantity,0),y=h.reduce((e,t)=>e+Math.min(t.quantity,t.ids.length),0),b=h.reduce((e,t)=>e+(t.config.required?t.quantity:0),0),x=h.reduce((e,t)=>e+(t.config.required?Math.min(t.quantity,t.ids.length):0),0),k=JSON.parse(eJQ(e,t||"")),_=void 0!==t&&eJX(u,eJQ(e,t))||!!u&&[...eJZ.get(u)||[]].some(e=>{let l=JSON.parse(e);return(void 0===t||l[0]===t)&&l[1]===k[1]&&l[2]===k[2]});return{enabled:h.length>0,required:b>0,complete:!_&&x===b,total:f,completed:y,requiredCount:b,requiredCompleted:x,pending:!1,blocked:_,lines:h,displayLines:v}}function eJQ(e,t){var l,i,a;let n=(null==(i=e.sales.bookingTicket)||null==(l=i.getTempOrder)?void 0:l.call(i))??e.sales.tempOrder;return JSON.stringify([t,(null==n||null==(a=n._extend)?void 0:a.localId)||(null==n?void 0:n.external_sale_number)||(null==n?void 0:n.order_id),null==n?void 0:n.customer_id])}let eJZ=new WeakMap,eJJ=e=>`pisell:venue-booking:holder-unconfirmed:${e}`;function eJX(e,t){var l;if(!e)return!1;if(null==(l=eJZ.get(e))?void 0:l.has(t))return!0;try{return"1"===sessionStorage.getItem(eJJ(t))}catch{return!1}}let eJ0=new WeakMap;function eJ2(e,t){var l;return!!e&&!!(null==(l=eJ0.get(e))?void 0:l.has(t))}let eJ1=(0,eN.memo)(function(e){var t,l,i,a,n,r,o;let{balanceAmount:s="$15.1",customerEmail:d="customer@email.com",customerName:c="",onClose:u,sendPaymentLink:p,customerId:m}=e,g=ea2(),h=eR();sZ(WU,(null==(n=h.appHelper.utils)||null==(a=n.getApp)||null==(i=a.call(n))||null==(l=i.locales)||null==(t=l.getLocale)?void 0:t.call(l))||(null==(o=h.appHelper.utils)||null==(r=o.storage)?void 0:r.get("umi_locale"))||"en");let v=qS(),f=(e,t)=>ez.getText(e)||t,[y,b]=(0,eN.useState)(d||"");(0,eN.useEffect)(()=>{b(d||"")},[d]);let x=(0,eB.jsx)("div",{className:aj()("send-payment-link-modal"),children:(0,eB.jsx)("div",{className:aj()("modal-content"),children:(0,eB.jsxs)("div",{className:aj()("main-content"),children:[(0,eB.jsx)("div",{className:aj()("illustration-container"),children:(0,eB.jsx)("img",{src:g+"/send_payment_link.png",className:aj()("illustration")})}),(0,eB.jsxs)("div",{className:aj()("form-container"),children:[(0,eB.jsx)("div",{className:aj()("email-options-container"),children:(0,eB.jsxs)("div",{className:aj()("email-section"),children:[(0,eB.jsxs)("div",{className:aj()("section-label"),children:[(e=>{if(r9(m))return"";let t=f("pisell2.checkout.send-payment-link.customer-name-format");return"function"==typeof t?t(e):`${e}'s `})(c),f("pisell2.checkout.send-payment-link.email-address","Email Address")]}),(0,eB.jsx)("div",{className:aj()("email-option"),children:(0,eB.jsx)("div",{className:aj()("email-input-container"),children:(0,eB.jsx)("div",{className:`${aj()("email-input")} ${aj()("email-input-selected")}`,children:(0,eB.jsx)("input",{type:"email",value:y,onChange:e=>b(e.target.value),placeholder:f("pisell2.checkout.send-payment-link.email-placeholder","Enter email address"),className:aj()("email-text-input")})})})})]})}),(0,eB.jsx)("div",{className:aj()("footer"),children:(0,eB.jsx)("button",{className:aj()("send-button"),onClick:()=>{var e;y&&""!==y.trim()?(e=y.trim(),/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))?(p({emails:[y.trim()],amount:s}),null==u||u()):v.fail(f("pisell2.checkout.send-payment-link.email-invalid")):v.fail(f("pisell2.checkout.send-payment-link.email-required"))},children:f("pisell2.checkout.send-payment-link.send-button","Send Link")})})]})]})})});return(0,eB.jsx)(eM.Modal,{title:f("pisell2.checkout.send-payment-link.modal-title","Send Payment Link"),width:680,footer:null,centered:!0,wrapClassName:"send-payment-link-modal-wrapper",open:!0,onCancel:u,children:x})}),eJ4=e=>(0,eB.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"currentColor",viewBox:"0 0 24 24",...e,children:(0,eB.jsx)("path",{fillRule:"evenodd",d:"M11.293 8.293a1 1 0 0 1 1.414 0l6 6a1 1 0 0 1-1.414 1.414L12 10.414l-5.293 5.293a1 1 0 0 1-1.414-1.414z",clipRule:"evenodd"})}),eJ3=e=>(0,eB.jsx)(ne,af(af({},e),{},{viewBox:(null==e?void 0:e.viewBox)||"0 0 24 24",component:eJ4})),eJ8=function(e){var t;let l,i,{amountSymbol:a,orderInfo:n,cartData:r,onClose:o,summaryData:s=[],labelMaps:d,paymentItems:c=[],customAmount:u,voidPayment:p,walletPassData:m,clientInfo:g}=e,[h,v]=(0,eN.useState)(!0),[f,y]=(0,eN.useState)(!0),[b,x]=(0,eN.useState)(!0),k=eR(),_=(e,t)=>{var l,i,a,n,r,o,s,d;let c=null==(d=WU[(null==(r=k.appHelper.utils)||null==(n=r.getApp)||null==(a=n.call(r))||null==(i=a.locales)||null==(l=i.getLocale)?void 0:l.call(i))||(null==(s=k.appHelper.utils)||null==(o=s.storage)?void 0:o.get("umi_locale"))||"en"])?void 0:d[e];return c||ez.getText(e)||t},w=()=>{var e;let t=g||{},l=e=>null!=e&&""!==String(e).trim()?String(e).trim():null,i=l(null==t?void 0:t.display_name)||l(null==t?void 0:t.name)||_("pisell2.checkout.customer.default-name")||"Customer";return{nickname:(null==t?void 0:t.nickname)&&(null==t?void 0:t.nickname)!=="Select a customer"?null==t?void 0:t.nickname:ez.getText("pisell2.checkout.customer.default-name"),display_name:i,email:(null==t?void 0:t.email)||(null==t||null==(e=t.contacts)?void 0:e.email)||""}},S=e=>{let{expanded:t,color:l="black"}=e;return(0,eB.jsx)("div",{className:aj()("collapse-icon",{expanded:t}),children:(0,eB.jsx)(eJ3,{style:{color:l,fontSize:"24px"}})})},j=e=>{let t=e.order_payment_id;return("cash"===e.code||"custom"===e.type)&&eTt(e)&&(null==t||""===t)},N=e=>eTt(e),C=()=>c.filter(N).reduce((e,t)=>{let l=new lO(Math.abs(t.amount)),i=new lO(Number(t.rounding_amount)>0?0:t.rounding_amount||0);return new lO(e).plus(l).plus(i).toNumber()},0),M=e=>{p&&p(e)},T=e=>e.label||d&&d[e.key]||e.key;return(0,eB.jsxs)("div",{className:aj()("payment-detail-modal"),children:[(0,eB.jsxs)("div",{className:aj()("main-content"),children:[(0,eB.jsxs)("div",{className:aj()("section-container"),children:[(0,eB.jsxs)("div",{className:aj()("section-header"),onClick:()=>v(!h),children:[(0,eB.jsx)("div",{className:aj()("section-title-container"),children:(0,eB.jsx)("div",{className:aj()("section-title"),children:_("order.total")||"Order Total"})}),(0,eB.jsxs)("div",{className:aj()("section-right"),children:[(0,eB.jsx)("div",{className:aj()("section-amount"),children:lY((l=s.find(e=>"sub_total"===e.key))?l.value:0,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})}),(0,eB.jsx)(S,{expanded:h})]})]}),h&&(0,eB.jsx)("div",{className:aj()("section-content"),children:(()=>{if(!s||0===s.length)return(0,eB.jsx)("div",{className:aj()("order-details-grid"),children:(0,eB.jsx)("div",{className:aj()("order-details-column"),children:(0,eB.jsxs)("div",{className:aj()("order-row"),children:[(0,eB.jsx)("div",{className:aj()("order-row-text"),children:_("no.items.found")||"No items found"}),(0,eB.jsx)("div",{className:aj()("order-row-amount"),children:lY(0,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]})})});let e=s.slice(0,Math.ceil(s.length/2)),t=s.slice(Math.ceil(s.length/2));return(0,eB.jsxs)("div",{className:aj()("order-details-grid"),children:[(0,eB.jsx)("div",{className:aj()("order-details-column"),children:e.map(e=>{let t="";return(null==e?void 0:e.key)!=="discount"&&(t=e.value>=0?"+":""),(0,eB.jsxs)("div",{className:aj()("order-row"),children:[(0,eB.jsx)("div",{className:aj()("order-row-label"),children:T(e)}),(0,eB.jsxs)("div",{className:aj()("order-row-amount"),children:[t,lY(e.value,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]})]},e.key)})}),t.length>0&&(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("div",{className:aj()("divider-vertical")}),(0,eB.jsx)("div",{className:aj()("order-details-column"),children:t.map(e=>{let t="";return(null==e?void 0:e.key)!=="discount"&&(t=e.value>=0?"+":""),(0,eB.jsxs)("div",{className:aj()("order-row"),children:[(0,eB.jsx)("div",{className:aj()("order-row-label"),children:T(e)}),(0,eB.jsxs)("div",{className:aj()("order-row-amount"),children:[t,lY(e.value,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]})]},e.key)})})]})]})})()})]}),(0,eB.jsx)("div",{className:aj()("divider-horizontal")}),(0,eB.jsxs)("div",{className:aj()("section-container"),children:[(0,eB.jsxs)("div",{className:aj()("section-header"),onClick:()=>y(!f),role:"button",tabIndex:0,children:[(0,eB.jsx)("div",{className:aj()("section-title-container"),children:(0,eB.jsx)("div",{className:aj()("section-title"),children:_("order.paid")||"Order Paid"})}),(0,eB.jsxs)("div",{className:aj()("section-right"),children:[(0,eB.jsxs)("div",{className:aj()("section-amount"),children:["-",lY(C(),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]}),(0,eB.jsx)(S,{expanded:f})]})]}),f&&(()=>{let e=c.filter(N),t=e.filter(e=>"deposit"===e.type),l=e.filter(e=>"deposit"!==e.type);if(0===e.length||0===l.length&&0===t.length)return(0,eB.jsx)("div",{className:aj()("section-content"),children:(0,eB.jsx)("div",{className:aj()("no-payment-text"),children:_("no.payments.recorded")||"No payments recorded"})});let i=t.reduce((e,t)=>new lO(e).plus(new lO(t.amount)).plus(new lO(Number(t.rounding_amount)>0?0:t.rounding_amount||0)).toNumber(),0),n=l.reduce((e,t)=>new lO(e).plus(new lO(t.amount)).plus(new lO(Number(t.rounding_amount)>0?0:t.rounding_amount||0)).toNumber(),0);return(0,eB.jsx)("div",{className:aj()("section-content"),children:(0,eB.jsxs)("div",{className:aj()("payment-record-container"),children:[t.length>0&&(0,eB.jsxs)("div",{className:aj()("payment-item-header"),children:[(0,eB.jsx)("div",{children:_("pisell2.subtotal.deposit")||"Deposit"}),(0,eB.jsx)("div",{children:lY(i,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),t.map(e=>(0,eB.jsxs)("div",{className:aj()("payment-item"),children:[(0,eB.jsx)("div",{className:aj()("payment-item-bullet")}),(0,eB.jsxs)("div",{className:aj()("payment-item-content"),children:[(0,eB.jsxs)("div",{className:aj()("payment-item-text"),children:[e.name," - ",e.created_at||new Date().toLocaleDateString()," ",_("pisell2.checkout.payment-detail.by")||"by"," ",w().nickname]}),(0,eB.jsxs)("div",{className:aj()("payment-item-actions"),children:[(0,eB.jsxs)("div",{className:aj()("payment-item-amount"),children:["-",lY(new lO(Math.abs(e.amount)).plus(new lO(Number(e.rounding_amount)>0?0:e.rounding_amount||0)).toNumber(),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]}),j(e)&&(0,eB.jsx)("button",{className:aj()("void-button"),onClick:()=>M(e),type:"button",children:_("void")||"Void"})]})]})]},e.uuid)),l.length>0&&(0,eB.jsxs)("div",{className:aj()("payment-item-header"),children:[(0,eB.jsx)("div",{children:_("payment.text")||"Payment"}),(0,eB.jsx)("div",{children:lY(n,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),l.map(e=>(0,eB.jsxs)("div",{className:aj()("payment-item"),children:[(0,eB.jsx)("div",{className:aj()("payment-item-bullet")}),(0,eB.jsxs)("div",{className:aj()("payment-item-content"),children:[(0,eB.jsxs)("div",{className:aj()("payment-item-text"),children:[e.name," - ",e.created_at||new Date().toLocaleDateString()," ",_("pisell2.checkout.payment-detail.by")||"by"," ",w().nickname]}),(0,eB.jsxs)("div",{className:aj()("payment-item-actions"),children:[(0,eB.jsxs)("div",{className:aj()("payment-item-amount"),children:["-",lY(new lO(Math.abs(e.amount)).plus(new lO(Number(e.rounding_amount)>0?0:e.rounding_amount||0)).toNumber(),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]}),j(e)&&(0,eB.jsx)("button",{className:aj()("void-button"),onClick:()=>M(e),type:"button",children:_("void")||"Void"})]})]})]},e.uuid))]})})})()]})]}),(0,eB.jsxs)("div",{className:aj()("balance-to-pay-section"),children:[(0,eB.jsxs)("div",{className:aj()("balance-to-pay-header"),onClick:()=>x(!b),role:"button",tabIndex:0,children:[(0,eB.jsx)("div",{className:aj()("section-title-container"),children:(0,eB.jsx)("div",{className:aj()("balance-to-pay-title"),children:_("balance.to.pay")||"Balance to Pay"})}),(0,eB.jsxs)("div",{className:aj()("balance-to-pay-right"),children:[(0,eB.jsx)("div",{className:aj()("balance-to-pay-amount"),children:lY(new lO(n.totalAmount||0).sub(new lO(C())).toNumber().toFixed(2),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})}),(0,eB.jsx)(S,{expanded:b,color:"#7F56DA"})]})]}),b&&(0,eB.jsx)("div",{className:aj()("balance-to-pay-content"),children:(i=[],((null==m||null==(t=m.selectedWallet)?void 0:t.length)&&m.selectedWallet.forEach(e=>{i.push((0,eB.jsxs)("div",{className:aj()("balance-item-row"),children:[(0,eB.jsx)("div",{className:aj()("balance-item-text"),children:e.name||e.product_name||_("wallet.pass")||"Wallet Pass"}),(0,eB.jsxs)("div",{className:aj()("balance-item-amount"),children:["-",e.redeem||lY(Math.abs(e.savedAmount||0),a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})]})]},`wallet-${e.id}`))}),0===i.length)?(0,eB.jsx)("div",{className:aj()("balance-item-row","empty-state"),children:(0,eB.jsx)("div",{className:aj()("balance-item-text","empty-text"),children:_("pisell2.checkout.payment-detail.no-wallet-pass-items")||"No WalletPass payment items"})}):(0,eB.jsx)(eB.Fragment,{children:i}))}),(0,eB.jsx)("div",{className:aj()("balance-due-section"),children:(0,eB.jsxs)("div",{className:aj()("balance-due-header"),children:[(0,eB.jsx)("div",{className:aj()("balance-due-title"),children:_("balance.due")||"Balance Due"}),(0,eB.jsx)("div",{className:aj()("balance-due-amount"),children:lY(u||0,a,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]})})]})]})},eJ6=(0,eN.forwardRef)((e,t)=>{let{children:l,value:i="",onChange:a,onConfirm:n,onCancel:r,showCurrencySymbol:o=!0,useThousandsSeparator:s=!1,selectType:d="dark",disabled:c=!1,overlayClassName:u="",style:p}=e,[m,g]=(0,eN.useState)(!1),[h,v]=(0,eN.useState)(""),[f,y]=(0,eN.useState)(!0);(0,eN.useImperativeHandle)(t,()=>({open:()=>{g(!0),v(i),y(!0)},close:()=>g(!1),isOpen:()=>m}));let b=(0,eB.jsx)("div",{className:"pisell-price-keyboard-popover-content",children:(0,eB.jsx)(nB.PisellPriceKeyboard,{value:h,onChange:e=>{if((""===e||0===e||"0"===e)&&!f){y(!0),v(e),null==a||a(e);return}if(f&&""!==e&&0!==e&&"0"!==e){y(!1);let t=String(h||"").replace(/[^\d.]/g,""),l=String(e).replace(/[^\d.]/g,"");if(t&&"0"!==t&&l.length>t.length&&l.startsWith(t)){let e=l.slice(t.length);if(e){v(e),null==a||a(e);return}}}v(e),null==a||a(e)},onEnter:e=>{null==n||n(e),g(!1)},doneText:ez.getText("pisell2.customise-item.save"),resetText:ez.getText("pisell2.booking.info.text.clear"),amountProps:{showCurrencySymbol:o,useThousandsSeparator:s},selectType:d,backgroundColor:"transparent"})});return(0,eB.jsx)(eM.Popover,{open:m,content:b,trigger:c?[]:["click"],overlayInnerStyle:{padding:0},destroyTooltipOnHide:!0,arrow:!1,align:{offset:[0,0]},overlayClassName:`pisell-price-keyboard-popover ${u}`,onOpenChange:e=>{c||(g(e),e?(v(i),y(!0)):null==r||r())},overlayStyle:p,children:l})});eJ6.displayName="PisellPriceKeyboardPopover";let eJ5=e=>{let{style:t}=e;return(0,eB.jsx)("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,children:(0,eB.jsx)("path",{d:"M21 15L18 12L15 15M15 21L18 24L21 21",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},eJ7=(0,eN.memo)(function(e){var t;let{amountSymbol:l="$",orderInfo:i,open_deposit:a=!1,customAmount:n,balanceDueAmount:r,clientInfo:o,onAmountChange:s,onDepositStatusChange:d,onDepositAmountChange:c,onBalanceDueAmountClick:u,onConfirm:p,confirmLoading:m=!1,paymentItems:g,cartData:h,walletPassData:v,totalAmount:f=0,baseSales:y,shouldUseNormalPayment:b=!1,enablePriceAdjust:x=!0,showPaymentType:k=!0}=e,_=eR(),{action:w,token:S,store:j,getApp:N}=null==(t=_.appHelper)?void 0:t.utils,C=qS(),M=(e,t)=>{var l,i,a,n,r,o,s,d;let c=null==(d=WU[(null==(r=_.appHelper.utils)||null==(n=r.getApp)||null==(a=n.call(r))||null==(i=a.locales)||null==(l=i.getLocale)?void 0:l.call(i))||(null==(s=_.appHelper.utils)||null==(o=s.storage)?void 0:o.get("umi_locale"))||"en"])?void 0:d[e];return c||ez.getText(e)||t},[T,I]=(0,eN.useState)("regular"),[P,A]=(0,eN.useState)(!1),[D,E]=(0,eN.useState)(!1),[O,z]=(0,eN.useState)([]),[L,R]=(0,eN.useState)("0"),[$,F]=(0,eN.useState)(!1),q={deposit:M("pisell2.subtotal.deposit")||"Deposit",total:M("pisell2.subtotal.total")||"Total",sub_total:M("pisell2.subtotal.subtotal")||"Subtotal",tax:M("pisell2.subtotal.tax")||"Tax",delivery_fee:M("pisell2.subtotal.delivery-fee")||"Delivery Fee",discount:M("pisell2.subtotal.discount")||"Discount",point_deduction:M("pisell2.subtotal.point-deduction")||"Point Deduction",member_deduction:M("pisell2.subtotal.member-deduction")||"Member Deduction",expect_amount:M("pisell2.subtotal.expect-amount")||"Expected Amount"},B=()=>"deposit"===T?(""===r?void 0:r)??(null==i?void 0:i.remainingAmount)??(null==i?void 0:i.depositAmount)??"0":(null==i?void 0:i.remainingAmount)??(null==i?void 0:i.totalAmount)??"0",H=e=>{if("number"==typeof e)return e;if("string"==typeof e){let t=e.replace(/[^-0-9.]/g,"");try{return new lO(t||"0").toNumber()}catch{}}return 0},[V,U]=(0,eN.useState)(n&&""!==n?n:H(B())),Y=(0,eN.useMemo)(()=>(null==g?void 0:g.reduce((e,t)=>{if(!eTi(t))return e;try{let l=new lO(t.amount||"0"),i=new lO(t.rounding_amount||"0");return e.plus(l).plus(i)}catch{return e}},new lO(0)))||new lO(0),[g]),W=(0,eN.useCallback)(e=>{try{return lO.max(new lO(e||0).minus(Y),0).toDecimalPlaces(2).toFixed(2)}catch{return"0.00"}},[Y]),G=(0,eN.useMemo)(()=>W(r||B()),[W,r,i,T]),K=(0,eN.useMemo)(()=>W(V||0),[W,V]);(0,eN.useEffect)(()=>{n&&""!==n?U(n):r&&""!==r&&U(r)},[n,r]),(0,eN.useEffect)(()=>{if(y&&i)try{var e,t,l;let a=(null==(t=y.getOrderAmountSnapshot)||null==(e=t.call(y))?void 0:e.summary)||{},n=null==(l=_.appHelper.utils)?void 0:l.translationOriginal,r=Array.isArray(null==a?void 0:a.surcharges)?a.surcharges.filter(e=>null==e?void 0:e.name).map((e,t)=>({key:`custom_surcharge_${e.surcharge_id??t}`,value:e.amount||0,label:(null==n?void 0:n(e.name))||("string"==typeof e.name?e.name:M("service.charge","Service Charge"))})):[],o=[{key:"sub_total",value:a.product_amount||a.product_expect_amount||0},...r,{key:"tax",value:a.tax_fee||0},{key:"discount",value:a.discount_amount||0},{key:"expect_amount",value:a.expect_amount||a.total_amount||0}];Array.isArray(o)&&z(o),b?(I("regular"),A(!1)):P||(I(i.isDeposit?"deposit":"regular"),A(!1))}catch(e){console.warn("Failed to get cart summary:",e)}},[y,i,b,P]),(0,eN.useEffect)(()=>{O.length>0&&(!n||""===n)&&U(H(B()))},[O,n]),(0,eN.useEffect)(()=>{var e;R((null==g||null==(e=g.reduce((e,t)=>{if(!eTt(t))return e;let l=new lO(t.origin_amount??t.amount??"0");if(t.rounding_amount){let e=new lO(t.rounding_amount);e.isNegative()&&(l=l.plus(e.abs()),e.abs().toNumber())}return e.plus(l)},new lO(0)))?void 0:e.toNumber())||0)},[g]);let Q=[{key:"regular",label:(0,eB.jsxs)("div",{className:aj()("amount-summary-dropdown-option"),children:[(0,eB.jsx)(cF,{className:aj()("dropdown-icon")}),M("regular.payment")||"普通支付"]})},{key:"deposit",label:(0,eB.jsxs)("div",{className:aj()("amount-summary-dropdown-option"),children:[(0,eB.jsx)(CZ,{className:aj()("dropdown-icon")}),M("deposit.payment")||"定金支付"]})}],Z=(0,eN.useCallback)(e=>(null==e?void 0:e.parentElement)||document.body,[]),J=async()=>{E(!0)},X=()=>{E(!1)},ee=()=>{let e="deposit"===T?"payment-button-deposit":"payment-button-regular";return aj()(a?"payment-button-with-dropdown":"payment-button-without-dropdown",e)},et=()=>{var e;let t=new lO(L||"0"),l=(null==g||null==(e=g.reduce((e,t)=>{if(eTi(t))try{let l=new lO(t.amount||"0"),i=new lO(t.rounding_amount||"0");return e.plus(l).plus(i)}catch{}return e},new lO(0)))?void 0:e.toNumber())||0,i=t.plus(l).toNumber(),a=(null==g?void 0:g.filter(e=>eTt(e)&&!eTe(e)))||[];return(null==a?void 0:a.length)>0&&i<f||!(i>=f)&&t.toNumber()>0},el=()=>{if(!O||0===O.length)return null;let e=et()?2:3;return(O.length>e?O.slice(0,e):O).map(e=>{let t=e.label||q[e.key]||e.key;return(0,eB.jsxs)("div",{className:aj()("payment-detail-row"),children:[(0,eB.jsx)("span",{className:aj()("payment-detail-label"),children:t}),(0,eB.jsx)("span",{className:aj()("payment-detail-amount"),children:lY(e.value,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]},e.key)})},ei=()=>{if(!O)return!1;let e=et()?2:3;return O.length>e},ea=(0,eN.useMemo)(()=>{var e,t,l,i;return(null==(e=O.find(e=>"discount"===e.key))?void 0:e.value)??(null==y||null==(i=y.getOrderAmountSnapshot)||null==(l=i.call(y))||null==(t=l.summary)?void 0:t.discount_amount)},[y,O]),en=()=>{let e;if(!n&&!Y.gt(0)&&0>=Number(ea||0)&&f>0)return!1;try{e=new lO(K).toNumber()}catch{return!1}if(e<=0){var t;let e=(null==g?void 0:g.filter(eTi))||[];return e.length>0&&e.every(eTe)||((null==v||null==(t=v.selectedDiscountList)?void 0:t.length)??0)>0||Number(ea||0)>0||0===f}return!1},{run:er}=sr(()=>{p&&p()},{wait:500,leading:!0,trailing:!0}),eo=()=>{m||er()},es=async e=>{var t,l;await (null==y||null==(l=y.deleteOrderPayment)?void 0:l.call(y,(null==e?void 0:e.payment_number)||(null==e?void 0:e.order_payment_id)||(null==e||null==(t=e.metadata)?void 0:t.unique_payment_number)||(null==e?void 0:e.uuid)))},ed=(0,eN.useMemo)(()=>{let e=new lO(0),t=null==g?void 0:g.reduce((e,t)=>eTi(t)?e.plus(t.amount):e,new lO(0)).toNumber(),i=lY((e=new lO(Math.abs(e.plus(new lO(0)).plus(t).toNumber()))).toNumber(),l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0});return(0,eB.jsx)("div",{className:aj()("confirm-payment-container"),children:(0,eB.jsxs)("div",{className:aj()("confirm-payment-content"),children:[(0,eB.jsxs)("div",{className:aj()("confirm-payment-text"),children:[M("will.be.paid.in.full")||"Will be paid in full"," ",(0,eB.jsx)("span",{className:aj()("amount-text"),children:i})," ",M("by.wallet")||"by Wallet"]}),(0,eB.jsx)(eM.Button,{className:aj()("confirm-button"),onClick:eo,type:"primary",loading:m,disabled:m,children:M("confirm")||"Confirm"})]})})},[JSON.stringify(g),T,l,r,n,f,y,m]),ec=(0,eN.useMemo)(()=>0!==Number(null==i?void 0:i.totalAmount)&&!(null==g?void 0:g.some(e=>!eTl(e)&&!!eTt(e)&&(null==e?void 0:e.order_payment_type)!=="deposit"&&(null==e?void 0:e.type)!=="deposit")),[g,null==i?void 0:i.totalAmount]);(0,eN.useMemo)(()=>r!==n&&Number(r)>0&&Number(n)>0,[n,r]);let eu=o0(async e=>{let t=String(e);await (null==c?void 0:c(t))}),ep=(0,eN.useMemo)(()=>null==g?void 0:g.some(e=>"deposit"===e.order_payment_type&&eTt(e)),[g]),em=()=>{null==C||C.fail(ez.getText("pisell2.checkout.can-not-change-deposit-amount"))},eg=(0,eN.useMemo)(()=>(0,eB.jsxs)("div",{onClick:x?em:void 0,children:[(0,eB.jsx)("div",{className:aj()("balance-due-label"),children:M("deposit.due")||"Deposit Due"}),(0,eB.jsxs)("div",{className:aj()("balance-due-amount"),children:[lY(G,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0}),x&&(0,eB.jsx)(dU,{className:aj()("edit-icon"),style:{color:"#7F56DA"}})]})]}),[r,l,x]),eh=(0,eN.useMemo)(()=>(0,eB.jsx)(eJ6,{value:G||"0",onConfirm:eu,showCurrencySymbol:!0,useThousandsSeparator:!0,selectType:"dark",overlayClassName:"cash-payment-keyboard-popover pisell-modal-mask-pointer-events-auto",children:(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("div",{className:aj()("balance-due-label"),children:M("deposit.due")||"Deposit Due"}),(0,eB.jsxs)("div",{className:aj()("balance-due-amount"),children:[lY(G,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0}),(0,eB.jsx)(dU,{className:aj()("edit-icon"),style:{color:"#7F56DA"}})]})]})}),[r,l]);return(0,eB.jsxs)("div",{className:aj()("amount-summary-module","amount-summary-container"),children:[k&&(0,eB.jsxs)("div",{className:aj()("left-section"),children:[a&&ec?(0,eB.jsx)(eM.Dropdown,{menu:{items:Q,onClick:e=>{var t;let{key:l,domEvent:i}=e;i.preventDefault(),i.stopPropagation(),I(t=String(l)),A(!0),d&&d("deposit"===t)},style:{backgroundColor:"#7F56DA",border:"1px solid #C3B2E7",borderRadius:"8px",padding:"8px 16px"}},trigger:["click"],placement:"bottomLeft",overlayClassName:"amount-summary-dropdown",getPopupContainer:Z,children:(0,eB.jsx)(eM.Button,{className:ee(),children:(0,eB.jsxs)("div",{className:aj()("button-content"),children:[(0,eB.jsx)("span",{className:aj()("button-text"),children:"deposit"===T?M("deposit.payment.short")||"定金\n支付":M("regular.payment.short")||"普通\n支付"}),(0,eB.jsx)(eJ5,{style:{width:"36px",height:"36px"}})]})})}):(0,eB.jsxs)(eM.Button,{className:ee(),children:[(0,eB.jsx)("div",{children:"deposit"===T?M("deposit.text")||"定金":M("regular.text")||"普通"}),(0,eB.jsx)("div",{children:M("payment.text")||"支付"})]}),(0,eB.jsx)(nB.Iconfont,{type:"pisell2-arrow-right",style:{fontSize:"20px"}})]}),(0,eB.jsx)("div",{className:aj()("middle-section"),children:"deposit"===T?(0,eB.jsx)(eB.Fragment,{children:(0,eB.jsxs)("div",{className:aj()("payment-details"),children:[et()&&(0,eB.jsxs)("div",{className:aj()("partial-paid-card"),children:[(0,eB.jsx)("span",{className:aj()("partial-paid-label"),children:"deposit"===T?M("deposit.partial.paid")||"Deposit Paid":M("partial.paid")||"Partial Paid"}),(0,eB.jsx)("span",{className:aj()("partial-paid-amount"),children:lY(L,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),el(),ei()&&(0,eB.jsxs)("div",{className:aj()("more-section"),onClick:J,style:{cursor:"pointer"},role:"button",children:[(0,eB.jsx)("span",{className:aj()("more-text"),children:M("more")||"更多"}),(0,eB.jsx)(nB.Iconfont,{type:"pisell2-TriangleFill",style:{fontSize:"12px"}})]})]})}):(0,eB.jsxs)("div",{className:aj()("payment-details"),children:[et()&&(0,eB.jsxs)("div",{className:aj()("partial-paid-card"),children:[(0,eB.jsx)("span",{className:aj()("partial-paid-label"),children:M("partial.paid")||"Partial Paid"}),(0,eB.jsx)("span",{className:aj()("partial-paid-amount"),children:lY(L,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]}),el(),ei()&&(0,eB.jsxs)("div",{className:aj()("more-section"),onClick:J,style:{cursor:"pointer"},role:"button",children:[(0,eB.jsx)("span",{className:aj()("more-text"),children:M("more")||"更多"}),(0,eB.jsx)(nB.Iconfont,{type:"pisell2-TriangleFill",style:{fontSize:"24px",color:"#C3B2E7"}})]})]})}),(0,eB.jsxs)("div",{className:aj()("balance-due-card",{"confirm-mode":en()}),children:[en()?ed:(0,eB.jsx)("div",{className:aj()("balance-due-info"),children:"deposit"===T?ep||!x?eg:eh:(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("div",{className:aj()("balance-due-label"),children:M("balance.due")||"Balance Due"}),(0,eB.jsxs)("div",{className:aj()("balance-due-amount"),onClick:x?()=>null==u?void 0:u("manual-discount"):void 0,children:[lY(G,l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0}),x&&(0,eB.jsx)(dU,{className:aj()("edit-icon"),style:{color:"#7F56DA"}})]})]})}),Number(K)>0&&(0,eB.jsxs)("div",{className:aj()("pay-section"),style:{cursor:"pointer"},role:"button",children:[(0,eB.jsx)("span",{className:aj()("pay-text"),children:M("pay")||"支付"}),(0,eB.jsx)("span",{className:aj()("pay-amount"),children:lY((()=>{try{return new lO(K||"0").toNumber()}catch{return 0}})(),l,{precision:2,hideDecimalForWholeNumbers:!1,useThousandsSeparator:!0,showCurrencySymbol:!0})})]})]}),(0,eB.jsx)(nB.PisellModal,{open:D,onCancel:X,footer:null,closable:!0,mask:!0,maskClosable:!0,centered:!0,width:600,wrapClassName:"payment-detail-modal-wrapper",title:M("order.and.payment.summary")||"Order and Payment Summary",children:D&&(0,eB.jsx)(eJ8,{amountSymbol:l,orderInfo:i,cartData:h,onClose:X,summaryData:O,labelMaps:q,paymentItems:g,customAmount:n,voidPayment:es,walletPassData:v,clientInfo:o})})]})}),eJ9=(0,eN.forwardRef)((e,t)=>{let{amountSymbol:l="$",walletPassData:i,onSavePayLater:a}=e,[n,r]=(0,eN.useState)(!1),[o,s]=(0,eN.useState)(""),d=eR(),c=(e,t)=>{var l,i,a,n,r,o,s,c;let u=null==(c=WU[(null==(r=d.appHelper.utils)||null==(n=r.getApp)||null==(a=n.call(r))||null==(i=a.locales)||null==(l=i.getLocale)?void 0:l.call(i))||(null==(s=d.appHelper.utils)||null==(o=s.storage)?void 0:o.get("umi_locale"))||"en"])?void 0:c[e];return u||ez.getText(e)||t},u=()=>{(null==i?void 0:i.selectedWallet)&&i.selectedWallet.length>0?(s(lU((null==i?void 0:i.selectedWallet)&&Array.isArray(i.selectedWallet)?i.selectedWallet.reduce((e,t)=>{let l=new lO(parseFloat(t.redeem)||0);return e.plus(l)},new lO(0)).toNumber():0,2,l)),r(!0)):a()},p=e=>{r(!1),a(e)};return(0,eN.useImperativeHandle)(t,()=>({handleSavePayLaterClick:u})),(0,eB.jsx)(eB.Fragment,{children:(0,eB.jsx)(nB.PisellModal,{visible:n,onCancel:()=>p("cancel"),closable:!1,mask:!0,maskClosable:!1,centered:!0,width:530,title:c("pisell2.checkout.wallet-balance-confirm.title"),footer:null,className:"wallet-balance-confirm-modal",styles:{header:{textAlign:"center",borderBottom:"1px solid #EAECF0",paddingBottom:"16px"}},children:(0,eB.jsxs)("div",{style:{padding:"40px 0 0 0"},children:[(0,eB.jsxs)("div",{style:{textAlign:"center",marginBottom:"32px",lineHeight:"1.5"},children:[(0,eB.jsx)("span",{style:{color:"#533795",fontWeight:600,fontSize:"18px"},children:o}),(0,eB.jsx)("span",{style:{color:"#101828",fontSize:"16px"},children:c("pisell2.checkout.wallet-balance-confirm.description-before")}),(0,eB.jsx)("span",{style:{color:"#533795",fontWeight:600,fontSize:"16px"},children:c("pisell2.checkout.wallet-balance-confirm.description-after")})]}),(0,eB.jsxs)("div",{style:{display:"flex",gap:"12px",flexDirection:"row"},children:[(0,eB.jsx)(eM.Button,{onClick:()=>p("cancel"),style:{flex:"0 1 auto",minWidth:"fit-content",height:"48px",borderRadius:"12px",fontSize:"16px",fontWeight:500,border:"1px solid #D0D5DD",color:"#344054",padding:"0 16px",whiteSpace:"nowrap"},children:c("pisell2.checkout.wallet-balance-confirm.cancel")}),(0,eB.jsx)(eM.Button,{onClick:()=>p("save-without-deduct"),style:{flex:"1 1 auto",height:"48px",borderRadius:"12px",fontSize:"16px",fontWeight:500,border:"1px solid #D0D5DD",color:"#344054",padding:"0 16px",whiteSpace:"nowrap"},children:c("pisell2.checkout.wallet-balance-confirm.save-without-deduct")}),(0,eB.jsx)(eM.Button,{type:"primary",style:{flex:"1.2 1 auto",height:"48px",backgroundColor:"#533795",borderColor:"#533795",borderRadius:"12px",fontWeight:600,fontSize:"16px",border:"none",boxShadow:"0px 1px 2px rgba(16, 24, 40, 0.05)",padding:"0 16px",whiteSpace:"nowrap"},onClick:()=>p("apply-deduct-now"),children:c("pisell2.checkout.wallet-balance-confirm.apply-deduct-now")})]})]})})})});function eXe(e){var t;return(null==e||null==(t=e.discount)?void 0:t.resource_id)||(null==e?void 0:e.id)}function eXt(e){return!!(null==e?void 0:e.order_detail_id)}function eXl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=new Set;return e.forEach(e=>{eXt(e)&&(e.discount_list||[]).forEach(e=>{let l=eXe(e);l&&["good_pass","discount_card"].includes(e.type)&&t.add(String(l))})}),t}function eXi(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=arguments.length>2?arguments[2]:void 0,i=eXl(t),a=l||i;return e.map(e=>{let t=(null==e?void 0:e.id)||eXe(e);return t&&a.has(String(t))?{...e,isEditMode:!0,isSelected:!0}:(null==e?void 0:e.isEditMode)?{...e,isEditMode:!1,isSelected:!1}:e}).map(e=>{let t;return"product_discount_card"!==(t=(null==e?void 0:e.tag)||(null==e?void 0:e.type))&&"discount_card"!==t&&"good_pass"!==t||void 0!==e.isAvailable?e:{...e,isAvailable:!0,isSelected:e.isSelected??!1}})}function eXa(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return eXi((null==e||null==(t=e.getDiscountList)?void 0:t.call(e))||[],l,i)}function eXn(e){return!!(null==e?void 0:e.expire_date)&&ew()(e.expire_date).endOf("day").isBefore(ew()())}function eXr(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=[];t.forEach(e=>{let t=eXt(e);(e.discount_list||[]).forEach(i=>{var a,n,r,o,s;let d=eXe(i);if(!d||!["good_pass","discount_card"].includes(i.type))return;let c=e.quantity||e.num||e.product_quantity||1,u=Number(i.amount||0)*Number(c||1)+Number((null==i||null==(a=i.metadata)?void 0:a.product_discount_difference)||0),p=l.findIndex(e=>e.id===d);if(-1!==p){l[p]={...l[p],amount:Number(l[p].amount||0)+Number(i.amount||0),savedAmount:Number(l[p].savedAmount||0)+u};return}l.push({...i,id:d,tag:i.tag||i.type,name:i.name||(null==(r=i.discount)||null==(n=r.title)?void 0:n.auto),format_title:(null==(o=i.discount)?void 0:o.title)||i.format_title,isEditMode:t,isAvailable:!0,isDisabled:!0,isSelected:!0,limited_relation_product_data:{},savedAmount:u,product_id:(null==(s=i.discount)?void 0:s.product_id)||i.product_id})})});let i=new Set(l.map(e=>e.id));return[...l,...e.filter(e=>!i.has(e.id))]}eJ9.displayName="SavePayLaterHandler";let eXo=e=>{var t,l,i;let{customerName:a,selectedCount:n,expiredCount:r,isCardMode:o,onExpiredClick:s,onBestSaving:d,onClearAll:c,onToggleDisplayMode:u}=e;return(0,eB.jsxs)("div",{className:"wallet-pass-header",children:[(0,eB.jsxs)("div",{className:"wallet-pass-header-left",children:[(0,eB.jsx)("span",{className:"wallet-pass-module-customer-container",dangerouslySetInnerHTML:{__html:(null==(t=ez.getText("wallet-pass-module-cards-vouchers-in-wallet"))?void 0:t(`<span class="theme-color wallet-pass-module-customer">${a}</span>`))||""}}),(0,eB.jsx)("span",{style:{color:"#475467"},children:null==(l=ez.getText("wallet-pass-module-applied"))?void 0:l(n)}),(0,eB.jsx)("span",{className:aj()("error-color","pointer","underline"),onClick:s,children:null==(i=ez.getText("wallet-pass-module-expired"))?void 0:i(r)})]}),(0,eB.jsxs)("div",{className:"wallet-pass-header-right",children:[(0,eB.jsx)("span",{className:aj()("theme-color","pointer","underline"),onClick:d,children:ez.getText("wallet-pass-module-best-saving")}),(0,eB.jsx)("span",{className:aj()("error-color","pointer","underline"),onClick:c,children:ez.getText("wallet-pass-module-clear-all")}),(0,eB.jsx)("div",{onClick:u,className:"wallet-pass-header-right-icon-container",children:(0,eB.jsx)(nB.Icon,{type:"pisell2-chevron-up",className:aj()("wallet-pass-header-right-icon","theme-color","pointer",{rotated:!o})})})]})]})},eXs=nB.PisellText.Amount,eXd=e=>{let{cardData:t,selectedWalletIds:l}=e;return(0,eB.jsx)("div",{className:"wallet-pass-text-mode",children:t&&t.length>0?t.filter(e=>l.includes(e.id)).map(e=>(0,eB.jsxs)("div",{className:"wallet-pass-text-item selected",children:[(0,eB.jsx)("span",{className:"wallet-pass-text-name",children:e.name}),(0,eB.jsxs)("span",{className:"wallet-pass-text-amount",children:["-",(0,eB.jsx)(eXs,{value:e.redeem,showCurrencySymbol:!0})]})]},e.id)):(0,eB.jsx)("div",{className:"wallet-pass-text-empty"})})},eXc=nB.PisellText.Amount,eXu=e=>{let{isCardMode:t,cardData:l,selectedWalletIds:i,onSelectWallet:a,onDetail:n,onConfirmEditAmount:r,onBeforeEditAmount:o}=e;return(0,eB.jsx)("div",{className:"wallet-pass-card-display-container",children:t?(0,eB.jsx)(nB.PisellCardList,{showActiveBackground:!0,showName:!0,showStoreName:!1,showRedeem:!0,showBalance:!0,showCode:!0,showValidDate:!0,showDetail:!0,showQrCode:!0,showCover:!0,showActions:!1,platform:"pc",mode:"multiple",direction:"horizontal",formatBalance:(e,t)=>{var l,i,a,n,r,o,s,d;if((null==t||null==(l=t.data)?void 0:l.originData.tag)==="point_card"){let l=(null==t?void 0:t.active)?(e||0)-((null==t||null==(a=t.data)||null==(i=a.originData)?void 0:i.recommended_usage_par_value)||0):e,o=(s=l||0,(d=null==t||null==(r=t.data)||null==(n=r.originData)?void 0:n.wallet_pass_usage_unit).points&&d.price?new lO(s).div(d.points).mul(d.price).toFixed(2,lO.ROUND_DOWN):new lO(s).toFixed(2));return(0,eB.jsxs)("div",{children:[(0,eB.jsx)(eXc,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:l,showCurrencySymbol:!1}),"(",(0,eB.jsx)(eXc,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:o,showCurrencySymbol:!1}),")"]})}return(null==t?void 0:t.active)?(0,eB.jsx)("div",{children:(0,eB.jsx)(eXc,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:e?e-((null==t||null==(o=t.data)?void 0:o.redeem)||0):0,showCurrencySymbol:!0})}):(0,eB.jsx)("div",{children:(0,eB.jsx)(eXc,{className:"pisell-card-amount-item-value",useThousandsSeparator:!0,value:e,showCurrencySymbol:!0})})},formatBalanceTitle:(e,t)=>(null==t?void 0:t.active)?(0,eB.jsx)("span",{children:ez.getText("wallet-pass-module-balance-after")}):(0,eB.jsx)("span",{children:ez.getText("wallet-pass-module-balance")}),formatRedeemTitle:(e,t)=>(null==t?void 0:t.active)?(0,eB.jsx)("span",{children:t.originDom}):(0,eB.jsx)("span",{children:ez.getText("wallet-pass-module-max.use")}),type:"mini",data:l,hasMore:!1,showEmpty:!1,fullWidth:!1,value:i,useExternalDetail:!0,onDetail:n,showStatus:!1,onChange:e=>{a(e)},actions:{layout:"expanded",detail:{visible:!1,iconColor:"#1570EF"},edit:{visible:!1,iconColor:"#1570EF"}},enableEditAmount:!0,onConfirmEditAmount:r,onBeforeEditAmount:o}):(0,eB.jsx)(eXd,{cardData:l,selectedWalletIds:i})})},eXp=e=>{let{visible:t,walletData:l,onClose:i,title:a,emptyText:n}=e;return(0,eB.jsx)(nB.PisellModal,{title:(0,eB.jsx)("div",{className:"wallet-modal-title",children:a}),open:t,onCancel:i,width:680,footerDivider:!1,headerDivider:!1,cancelVisible:!1,onOk:i,okText:ez.getText("wallet-pass-module-expired-modal-close"),children:(0,eB.jsx)("div",{className:"wallet-modal-content",children:l&&l.length>0?(0,eB.jsx)(nB.PisellCardList,{showActiveBackground:!0,showName:!0,showStoreName:!1,showRedeem:!0,showBalance:!0,showCode:!0,showValidDate:!0,showDetail:!0,showQrCode:!0,showCover:!0,platform:"pc",mode:"single",direction:"horizontal",type:"mini",data:l,hasMore:!1,showEmpty:!1,fullWidth:!1,showStatus:!1,nameTitleStyle:{fontSize:20,fontWeight:600,color:"#f5a623"},actions:{layout:"expanded",detail:{visible:!1,iconColor:"#1570EF"},edit:{visible:!1,iconColor:"#1570EF"}}}):(0,eB.jsx)(nB.PisellEmpty,{title:n||ez.getText("wallet-pass-module-expired-modal-empty")})})})},eXm=nB.PisellText.Amount,eXg=e=>{let{cardData:t,selectedWalletIds:l}=e;return(0,eB.jsx)("div",{className:"discount-text-mode",children:t&&t.length>0?t.filter(e=>l.includes(e.id)).map(e=>(0,eB.jsxs)("div",{className:"discount-text-item selected",children:[(0,eB.jsx)("span",{className:"discount-text-name",children:e.name}),(0,eB.jsxs)("span",{className:"discount-text-amount",children:["-",(0,eB.jsx)(eXm,{value:e.savedAmount,showCurrencySymbol:!0})]})]},e.id)):(0,eB.jsx)("div",{className:"discount-text-empty"})})},eXh=e=>{let{isCardMode:t,cardData:l,selectedWalletIds:i,onSelectWallet:a,onDetail:n,discountDisabled:r}=e,o=qS(),s=(0,eN.useMemo)(()=>r?l.map(e=>({...e,disabled:!0})):l,[r,l]);return(0,eB.jsx)("div",{className:"discount-wallet-list-container",children:t?(0,eB.jsx)(nB.PisellCardList,{className:"",showName:!0,showActiveBackground:!0,showStoreName:e=>{var t;return(null==e||null==(t=e.originData)?void 0:t.tag)!=="good_pass"||e.active},onItemClick:()=>{r&&o.info(ez.getText("wallet-pass-module-discount-partially-paid"))},disabled:r,showRedeem:!1,showBalance:!1,showCode:!1,showValidDate:!1,showDetail:!1,showQrCode:!1,showCover:!1,showActions:!1,platform:"pc",mode:"multiple",direction:"horizontal",type:"mini",data:s,hasMore:!1,showEmpty:!1,fullWidth:!1,value:i,useExternalDetail:!0,onDetail:n,showStatus:!1,nameTitleStyle:{fontSize:20,fontWeight:600,color:"#FF8A1E"},onChange:a,actions:{layout:"expanded",detail:{visible:!1,iconColor:"#1570EF"},edit:{visible:!1,iconColor:"#1570EF"}},enableEditAmount:!1}):(0,eB.jsx)(eXg,{cardData:l,selectedWalletIds:i})})},eXv={status:"idle",items:[],selectedIds:[],selectedItems:[],committedIds:[],selectionSources:{},totalSelectedAmount:0,error:null,revision:0};function eXf(e){return(null==e?void 0:e.id)??(null==e?void 0:e.voucher_id)??(null==e?void 0:e.code)}function eXy(e){return["product_discount_card","discount_card","good_pass","entitlement_pass"].includes((null==e?void 0:e.tag)||(null==e?void 0:e.type))}let eXb=(0,eN.forwardRef)((e,t)=>{var l;let{orderInfo:i,onSelectChange:a,paymentItems:n,clientId:r,baseSales:o,onDiscountChange:s}=e,d=function(e){var t,l;let{baseSales:i,clientId:a,onSelectChange:n,onDiscountChange:r}=e,[o,s]=(0,eN.useState)(()=>{var e;return(null==i||null==(e=i.getWalletAssetsState)?void 0:e.call(i))||eXv}),[d,c]=(0,eN.useState)(()=>{var e;return((null==i||null==(e=i.getDiscountList)?void 0:e.call(i))||[]).filter(eXy)}),[u,p]=(0,eN.useState)(!1),m=(0,eN.useRef)(!1),g=(0,eN.useRef)(null),h=(0,eN.useRef)(null),v=(0,eN.useRef)(!1);(0,eN.useEffect)(()=>{var e,t;let l=null==i||null==(e=i.getWalletAssetsState)?void 0:e.call(i);if(l&&s(l),c(((null==i||null==(t=i.getDiscountList)?void 0:t.call(i))||[]).filter(eXy)),!(null==i?void 0:i.effectsOn))return;let a=i.effectsOn("onWalletAssetsStateChanged",e=>{if(null==e?void 0:e.state){if(m.current){g.current=e.state;return}s(e.state)}}),n=i.effectsOn("onDiscountApplied",e=>{var t;c((Array.isArray(null==e?void 0:e.discountList)?e.discountList:(null==i||null==(t=i.getDiscountList)?void 0:t.call(i))||[]).filter(eXy))});return()=>{[a,n].forEach(e=>{var t;"function"==typeof e?e():null==e||null==(t=e.remove)||t.call(e)})}},[i]),(0,eN.useEffect)(()=>{var e;let t;try{t=null==n?void 0:n(((null==o?void 0:o.selectedItems)||[]).flatMap(e=>{let t,l=(null==e?void 0:e.voucher_id)??(null==e?void 0:e.id),i=(t=Number(eTJ(e)??(null==e?void 0:e.amount)??0),Number.isFinite(t)&&t>0?t:0);return void 0===l||i<=0?[]:[{voucher_id:l,amount:i,code:null==e?void 0:e.tag,wallet_pass_usage_unit:null==e?void 0:e.wallet_pass_usage_unit,wallet_pass_use_value:null==e?void 0:e.wallet_pass_use_value}]}))}catch(t){throw null==(e=h.current)||e.call(h),h.current=null,v.current=!1,t}let l=h.current;if(l&&!v.current){v.current=!0;let e=()=>{h.current===l&&(h.current=null,v.current=!1),l()};Promise.resolve(t).then(e,e)}},[n,o.revision]),(0,eN.useEffect)(()=>()=>{var e;null==(e=h.current)||e.call(h),h.current=null,v.current=!1},[]);let f=(0,eN.useMemo)(()=>[...o.selectedIds||[],...o.committedIds||[]],[o.committedIds,o.selectedIds]),y=(0,eN.useMemo)(()=>new Set((o.committedIds||[]).map(e=>String(e))),[o.committedIds]),b=(0,eN.useMemo)(()=>new Map((o.selectedItems||[]).map(e=>[String(eXf(e)??(null==e?void 0:e.code)??""),e])),[o.selectedItems]),x=(0,eN.useMemo)(()=>eT1((o.items||[]).map(e=>{let t={...e,...b.get(String(eXf(e)??(null==e?void 0:e.code)??""))||{}};return{...t,...(null==t?void 0:t.unified_available_status)!==void 0?{unified_available_status:Number(t.unified_available_status)}:{},...(null==t?void 0:t._unified_available_status)!==void 0?{_unified_available_status:Number(t._unified_available_status)}:{},...(null==t?void 0:t.available)===!1||(null==t?void 0:t.isDisabled)===!0?{unified_available_status:0,unified_messages:(null==t?void 0:t.unified_messages)||{title:(null==t?void 0:t.reason)||(null==t?void 0:t.disabledReason)}}:{}}}),f).map(e=>({...e,enableEditAmount:!y.has(String(e.id)),...y.has(String(e.id))?{disabled:!0,active:!0}:{}})),[y,b,f,o.items]),k=(0,eN.useMemo)(()=>x.filter(e=>{var t;let l=null==e||null==(t=e.originData)?void 0:t.expire_date;return!!l&&ew()(l).endOf("day").isBefore(ew()())}),[x]),_=(0,eN.useMemo)(()=>k.map(e=>e.id),[k]),w=(0,eN.useMemo)(()=>d.filter(e=>null==e?void 0:e.isSelected).map(e=>null==e?void 0:e.id),[d]),S=(0,eN.useMemo)(()=>eT4(d.filter(e=>(null==e?void 0:e.isAvailable)!==!1||(null==e?void 0:e.isSelected)),w),[d,w]),j=o0(e=>{var t,l,a;c(((null==i||null==(t=i.getDiscountList)?void 0:t.call(i))||[]).filter(eXy)),null==r||r({...e,discountList:(null==i||null==(l=i.getDiscountList)?void 0:l.call(i))||[],productList:(null==i||null==(a=i.getOrderProducts)?void 0:a.call(i))||[]})}),N=o0(async e=>{if(!(null==i?void 0:i.selectWalletAsset)||u)return;let t=new Set((o.committedIds||[]).map(e=>String(e))),l=new Set((o.selectedIds||[]).map(e=>String(e))),a=new Set(e.map(e=>String(e)));p(!0);try{for(let e of o.items||[]){let n=eXf(e);if(void 0===n||t.has(String(n)))continue;let r=l.has(String(n)),o=a.has(String(n));r!==o&&await i.selectWalletAsset({assetId:n,selected:o,source:"manual"})}}finally{p(!1)}}),C=o0(async()=>{if(!u){p(!0);try{var e,t;for(let l of(await (null==i||null==(e=i.clearWalletAssetSelection)?void 0:e.call(i)),w))await (null==i||null==(t=i.setDiscountSelected)?void 0:t.call(i,{discountId:l,isSelected:!1}));j()}finally{p(!1)}}}),M=o0(async(e,t)=>{var l,a,n,r;if(!(null==i?void 0:i.scanWalletAsset))return null;p(!0),m.current=!0,g.current=null;let d=!1,c=o.revision;try{let t=await i.scanWalletAsset(e);d=!0;let n=null==t?void 0:t.asset;if((null==t?void 0:t.type)==="walletCode"){let e=(null==t?void 0:t.data)||n;if(!e)return t;if((null==e?void 0:e.is_cross_shop_wallet)!==!0&&1!==Number(null==e?void 0:e.is_cross_shop_wallet))return{...t,data:e,asset:e};let l=Number(null==e?void 0:e.customer_id);if(!Number.isInteger(l)||l<=1||"function"!=typeof(null==i?void 0:i.resolveCustomerById))throw Error("Customer resolve is unavailable");let a=await i.resolveCustomerById(l);if(!a)throw Error("Customer resolve failed");let r={...e,customer:a};return{...t,data:r,asset:r}}let r=Number((null==n?void 0:n.customer_id)??(null==n||null==(l=n.holder)?void 0:l.customer_id)),o=null==i||null==(a=i.getOrderCustomerSnapshot)?void 0:a.call(i),s=Number((null==o?void 0:o.id)??(null==o?void 0:o.customer_id)??1),c=!Number.isInteger(s)||s<=1,u=Number.isInteger(r)&&r>1;if(c&&u){if("function"!=typeof(null==i?void 0:i.resolveCustomerById)||"function"!=typeof(null==i?void 0:i.setOrderCustomer)||"function"!=typeof(null==i?void 0:i.refreshWalletAssets))throw Error("Customer resolve is unavailable");let l=await i.resolveCustomerById(r);if(!l)throw Error("Customer resolve failed");i.setOrderCustomer(l);let a=await i.refreshWalletAssets({preserveSelection:!1,retainSearchResultCodes:[e]});return{...t,state:a||(null==t?void 0:t.state)}}return t}finally{let e;m.current=!1;let l=(null==i||null==(n=i.getWalletAssetsState)?void 0:n.call(i))||g.current;g.current=null;try{l&&((null==t?void 0:t.waitForApply)&&d&&!Object.is(l.revision,c)&&(null==(r=h.current)||r.call(h),v.current=!1,e=new Promise(e=>{h.current=e})),s(l)),await e}finally{p(!1)}}}),T=o0(async e=>{if(u)return;let t=new Set(w.map(e=>String(e))),l=new Set(e.map(e=>String(e)));p(!0);try{for(let e of d){let n=null==e?void 0:e.id;if(void 0===n)continue;let r=t.has(String(n)),o=l.has(String(n));if(r!==o){var a;await (null==i||null==(a=i.setDiscountSelected)?void 0:a.call(i,{discountId:n,isSelected:o}))}}j()}finally{p(!1)}}),I=o0(async()=>{if(!u){p(!0);try{var e,t,l;let a=(o.items||[]).filter(e=>null==e?void 0:e._wallet_asset_recommended).map(e=>eXf(e)).filter(e=>void 0!==e);for(let l of(await (null==i||null==(e=i.clearWalletAssetSelection)?void 0:e.call(i)),a))await (null==i||null==(t=i.selectWalletAsset)?void 0:t.call(i,{assetId:l,selected:!0,source:"manual"}));if(S.length){let e=await (null==i||null==(l=i.bestDiscount)?void 0:l.call(i));j(e)}}finally{p(!1)}}}),P=o0(async(e,t,l)=>{if(!(null==i?void 0:i.updateWalletAssetAmount)||u)return;let a=eXf((null==l?void 0:l.originData)||l),n=Number(e);if(void 0!==a&&Number.isFinite(n)&&!(n<0)){p(!0);try{await i.updateWalletAssetAmount({assetId:a,amount:n})}finally{p(!1)}}});return{cardData:x,selectedWalletIds:f,expiredWalletIds:_,expiredWalletData:k,disabledWalletData:[],clearDisabledWalletData:()=>void 0,clearAllSelectedWallet:C,handleBestSaving:I,handleSearchIdentificationCode:M,handleSelectWallet:N,availableDiscountList:S,selectedDiscountList:w,handleSelectDiscount:T,customerName:(null==i||null==(l=i.getCustomer)||null==(t=l.call(i))?void 0:t.name)||(a?String(a):""),handleConfirmEditAmount:P,handleBeforeEditAmount:async()=>!0,loading:"loading"===o.status||u}}({baseSales:o,clientId:r,onSelectChange:a,onDiscountChange:s}),[c,u]=(0,eN.useState)(!0),[p,m]=(0,eN.useState)(!1);(0,eN.useImperativeHandle)(t,()=>({handleSearchIdentificationCode:d.handleSearchIdentificationCode,getWalletPassData:e=>({selectedWallet:e.length?d.cardData.filter(e=>d.selectedWalletIds.some(t=>String(t)===String(e.id))):[],availableDiscountList:d.availableDiscountList,selectedDiscountList:d.selectedDiscountList})}));let g=o0(()=>{u(e=>!e)}),h=(0,eN.useMemo)(()=>0===Number(null==i?void 0:i.totalAmount)||!!(null==n?void 0:n.some(e=>!eTl(e)&&!!eTt(e)&&!eMH.includes(e.code))),[null==i?void 0:i.totalAmount,n]),v=d.selectedWalletIds.length+d.selectedDiscountList.length;return 0===d.cardData.length&&0===d.availableDiscountList.length?null:(0,eB.jsx)("div",{className:"wallet-pass-module-container",children:(0,eB.jsx)(nB.PisellLoading,{delay:300,loading:d.loading,fullscreen:!1,mask:{backgroundColor:"rgba(255, 255, 255, 0.5)",width:"100%",height:"100%"},children:(0,eB.jsxs)("div",{className:"wallet-pass-module",children:[(0,eB.jsx)(eXo,{customerName:d.customerName,selectedCount:v,expiredCount:d.expiredWalletIds.length,isCardMode:c,onExpiredClick:()=>m(!0),onBestSaving:d.handleBestSaving,onClearAll:d.clearAllSelectedWallet,onToggleDisplayMode:g}),(0,eB.jsx)(eXu,{isCardMode:c,cardData:d.cardData,selectedWalletIds:d.selectedWalletIds,onSelectWallet:d.handleSelectWallet,onDetail:()=>void 0,onConfirmEditAmount:d.handleConfirmEditAmount,onBeforeEditAmount:d.handleBeforeEditAmount}),(0,eB.jsx)(eXh,{isCardMode:c,cardData:d.availableDiscountList,selectedWalletIds:d.selectedDiscountList,onSelectWallet:d.handleSelectDiscount,onDetail:()=>void 0,discountDisabled:h}),(0,eB.jsx)(eXp,{visible:p,walletData:d.expiredWalletData,onClose:()=>m(!1),title:null==(l=ez.getText("wallet-pass-module-expired-modal-title"))?void 0:l(d.expiredWalletData.length)})]})})})}),eXx=(0,eN.forwardRef)((e,t)=>{var l;let{orderInfo:i,onSelectChange:a,customAmount:n,paymentItems:r,clientId:o,baseSales:s,onDiscountChange:d}=e,{handleSelectWallet:c,cardData:u,selectedWalletIds:p,expiredWalletIds:m,expiredWalletData:g,disabledWalletData:h,clearAllSelectedWallet:v,clearDisabledWalletData:f,handleBestSaving:y,loading:b,handleSearchIdentificationCode:x,availableDiscountList:k,selectedDiscountList:_,handleSelectDiscount:w,customerName:S,handleConfirmEditAmount:j,handleBeforeEditAmount:N}=(e=>{let{onSelectChange:t,customAmount:l,clientId:i,totalAmount:a}=e,n=eHy(),[r,o]=(0,eN.useState)([]),[s,d]=(0,eN.useState)([]),[c,u]=(0,eN.useState)([]),[p,m]=(0,eN.useState)([]),g=(0,eN.useRef)([]),h=(0,eN.useRef)([]),v=(0,eN.useRef)([]),f=(0,eN.useRef)(""),y=(0,eN.useRef)(null),b=(0,eN.useRef)(""),x=(0,eN.useRef)(null),k=(0,eN.useRef)(new Set),_=(0,eN.useRef)(""),w=(0,eN.useRef)(""),S=(0,eN.useRef)(null),j=(0,eN.useRef)(!1),[N,C]=(0,eN.useState)([]),[M,T]=(0,eN.useState)({}),[I,P]=(0,eN.useState)([]),A=(0,eN.useRef)([]),[D,E]=(0,eN.useState)([]),[O,z]=(0,eN.useState)([]),L=(0,eN.useRef)(!1),R=(0,eN.useRef)(!1),$=(0,eN.useRef)(!1),[F,q]=(0,eN.useState)([]),B=(0,eN.useMemo)(()=>I.map(e=>e.id),[I]),H=(0,nB.useToast)(),[V,U]=(0,eN.useState)(!1),[Y,W]=(0,eN.useState)(null),[G,K]=(0,eN.useState)([]),Q=e.baseSales,Z=null==Q?void 0:Q.payment,J=null==Z?void 0:Z.wallet,X=o0(()=>i),ee=o0(()=>{var e,t,i;let n=(null==Q||null==(e=Q.getOrderAmountSnapshot)?void 0:e.call(Q))||(null==Q||null==(i=Q.getOrderSnapshot)||null==(t=i.call(Q))?void 0:t.amount)||{},r=n.amountGap??n.depositAmount??n.totalAmount??n.expectAmount;return Number(l??r??a??0)}),et=o0(()=>{var e,t,l,i,a,n;if(F.length>0)return F;let r=(null==Q||null==(e=Q.getOrderProducts)?void 0:e.call(Q))||[];return r.length>0?r:(null==Q||null==(l=Q.getTempOrder)||null==(t=l.call(Q))?void 0:t.products)||(null==Q||null==(n=Q.getOrderSnapshot)||null==(a=n.call(Q))||null==(i=a.tempOrder)?void 0:i.products)||[]}),el=o0(()=>{var e,t,l,i,a,n,r,o,s;if(!Q)return;let d=(null==Q||null==(e=Q.getTempOrder)?void 0:e.call(Q))||(null==Q||null==(l=Q.getOrderSnapshot)||null==(t=l.call(Q))?void 0:t.tempOrder),c=(null==Q||null==(i=Q.getOrderProducts)?void 0:i.call(Q))||(null==d?void 0:d.products)||[],u=eXl(c),p=String((null==d?void 0:d.order_id)||(null==(n=Q.getOrderIdentity)||null==(a=n.call(Q))?void 0:a.orderId)||""),m=null==Q||null==(r=Q.store)?void 0:r.order,g=(null==Q||null==(o=Q.getDiscountList)?void 0:o.call(Q))||(null==m||null==(s=m.getDiscountList)?void 0:s.call(m))||[];_.current!==p&&(_.current=p,k.current=u);let v=em(eXi(g,c,k.current));h.current=v,K(v)}),ei=o0(async()=>{var e,t,l,i,a,n,r,o;let s=(null==Q||null==(e=Q.getTempOrder)?void 0:e.call(Q))||(null==Q||null==(l=Q.getOrderSnapshot)||null==(t=l.call(Q))?void 0:t.tempOrder),d=(null==Q||null==(i=Q.getOrderProducts)?void 0:i.call(Q))||(null==s?void 0:s.products)||[],c=Number(X()||0);if(!Q)return;let u=eXl(d),p=String((null==s?void 0:s.order_id)||(null==(n=Q.getOrderIdentity)||null==(a=n.call(Q))?void 0:a.orderId)||"");_.current!==p&&(_.current=p,k.current=u);let m=JSON.stringify({orderId:(null==s?void 0:s.order_id)||(null==(o=Q.getOrderIdentity)||null==(r=o.call(Q))?void 0:r.orderId),customerId:c,productDiscounts:d.map(e=>({productId:e.product_id||e.id,discounts:(e.discount_list||[]).map(e=>({id:eXe(e),amount:e.amount,type:e.type}))}))});if(f.current===m&&G.length>0)return;if(y.current&&f.current===m)return y.current;f.current=m;let g=async()=>{var e,t,l,i,a,n,r,o,u,p;if("function"==typeof(null==Q?void 0:Q.loadDiscountConfig)){let e=await Q.loadDiscountConfig({customerId:c,action:(null==s?void 0:s.order_id)?"edit":"create"});return{...e,discountList:eXi((null==e?void 0:e.discountList)||[],d,k.current)}}let m=null==Q||null==(e=Q.store)?void 0:e.order;if(!(null==m?void 0:m.loadDiscountConfig))return{productList:d,discountList:eXr((null==m||null==(u=m.getDiscountList)?void 0:u.call(m))||(null==Q||null==(p=Q.getDiscountList)?void 0:p.call(Q))||[],d)};let g=eXr(await m.loadDiscountConfig({customerId:c,action:(null==s?void 0:s.order_id)?"edit":"create",orderId:Number((null==s?void 0:s.order_id)||(null==Q||null==(l=Q.getOrderIdentity)||null==(t=l.call(Q))?void 0:t.orderId))||void 0,apply:!1})||(null==(i=m.getDiscountList)?void 0:i.call(m))||[],d);return await (null==m||null==(r=m.store)||null==(n=r.discount)||null==(a=n.setDiscountList)?void 0:a.call(n,g)),{productList:(null==(o=m.getOrderProducts)?void 0:o.call(m))||d,discountList:g}},v=(async()=>{let e=await g(),t=em((null==e?void 0:e.discountList)||eXa(Q,d,k.current));h.current=t,K(t)})();y.current=v;try{return await v}finally{y.current===v&&(y.current=null)}}),ea=(0,eN.useMemo)(()=>{var e,t;return null==Z||null==(t=Z.window)||null==(e=t.getWalletPassEvaluator)?void 0:e.call(t)},[Z]),en=o0(e=>{P(e),A.current=e}),er=o0(()=>A.current.reduce((e,t)=>{let l=Number((null==t?void 0:t.actualDeduction)??(null==t?void 0:t._available_max_amount)??(null==t?void 0:t.available_max_amount)??(null==t?void 0:t.recommended_usage_amount)??(null==t?void 0:t.amount)??0);return e+(Number.isFinite(l)?l:0)},0)),eo=o0(()=>{let e=new Map,t=t=>{"number"==typeof(null==t?void 0:t.edit_current_amount)&&e.set(t.id,t.edit_current_amount)};return[A.current,I,c,r,s,N].forEach(e=>{(e||[]).forEach(t)}),e}),es=o0(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=eo();return t.size?e.map(e=>t.has(e.id)?{...e,edit_current_amount:t.get(e.id)}:e):e}),ed=o0(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=new Map;return(A.current.forEach(e=>{D.includes(e.id)&&t.set(e.id,{actualDeduction:e.actualDeduction,_available_max_amount:e._available_max_amount,recommended_usage_amount:e.recommended_usage_amount,recommended_usage_par_value:e.recommended_usage_par_value,available_max_amount:e.available_max_amount})}),t.size)?e.map(e=>{let l=t.get(e.id);return l&&void 0===e.actualDeduction&&void 0===e._available_max_amount&&void 0===e.available_max_amount&&void 0===e.recommended_usage_amount?{...e,...l}:e}):e});(0,eN.useEffect)(()=>{r9(i)&&0===N.length&&!Q&&(d([]),o([]),K([]))},[i]);let ec=(0,eN.useMemo)(()=>eT4(G.filter(e=>!!e.isAvailable).map(e=>({...e,isDisabled:e.isDisabled||e.isDisabledForProductUsed,savedAmount:e.savedAmount||0}))),[G]),eu=(0,eN.useMemo)(()=>ec.filter(e=>e.isSelected&&!e.isEditMode).map(e=>e.id),[ec]),ep=o0(e=>{if(0===g.current.length)return e;let t=new Map(e.map(e=>[e.id,e])),l=[],i=new Set;if(N.length>0)for(let e of[...N].reverse()){let a=t.get(e.id);a&&!i.has(e.id)&&(l.push(a),i.add(e.id))}for(let t of e)g.current.some(e=>e.id===t.id)||i.has(t.id)||(l.push(t),i.add(t.id));for(let e of g.current)t.has(e.id)&&!i.has(e.id)&&(l.push(t.get(e.id)),i.add(e.id));return l}),em=o0(e=>{let t=e=>e.sort((e,t)=>e.isSelected&&!t.isSelected?-1:!e.isSelected&&t.isSelected?1:0);if(0===h.current.length||0===e.length)return[...e.filter(e=>e.isEditMode),...t(e.filter(e=>!e.isEditMode))];let l=new Map;for(let t of e){var i;l.has(t.id)||l.set(t.id,[]),null==(i=l.get(t.id))||i.push(t)}let a=e=>{let t=l.get(e.id);if(!(null==t?void 0:t.length))return null;let i=t.indexOf(e);return -1===i?null:t.splice(i,1)[0]},n=(e,t)=>{let i=l.get(e.id);if(!(null==i?void 0:i.length))return null;let a=i.findIndex(l=>t(l,e));return -1===a?null:i.splice(a,1)[0]},r=[],o=[],s=[];for(let e of h.current.filter(e=>e.isEditMode)){let t=n(e,e=>!!e.isEditMode);t&&r.push(t)}for(let t of e){if(!t.isEditMode)continue;let e=a(t);e&&r.push(e)}for(let e of h.current){if(e.isEditMode)continue;let t=n(e,e=>!e.isEditMode);t&&o.push(t)}for(let t of e){if(t.isEditMode)continue;let e=a(t);e&&s.push(e)}return[...r,...o,...t(s)]}),eg=(0,eN.useMemo)(()=>[...c||[],...N||[]],[c,N]),eh=(0,eN.useMemo)(()=>D.map(e=>eg.find(t=>t.id===e)).filter(Boolean),[D,eg]),{displayVouchers:ev,displayOtherVouchers:ef,selectedWithDetails:ey,totalDeduction:eb}=(0,eN.useMemo)(()=>{if(!ea||!eg.length||!a)return{displayVouchers:[...c||[],...p||[]],displayOtherVouchers:N||[],selectedWithDetails:[],totalDeduction:0};let e=et(),t=ea.recalculateVouchers(eg,eh,a,e),l=[],i=[];return t.allWithUpdatedStatus.forEach(e=>{N.some(t=>t.id===e.id)?i.push(e):l.push(e)}),{displayVouchers:[...l,...p||[]],displayOtherVouchers:i,selectedWithDetails:t.selectedWithDetails,totalDeduction:t.selectedWithDetails.reduce((e,t)=>e+(t.actualDeduction||0),0)}},[eh,eg,c,N,p,a,F,Q]);Fr(()=>{let e;try{e=eE(ey)}catch(e){var t;throw null==(t=S.current)||t.call(S),S.current=null,j.current=!1,e}en(ey),U(!1);let l=S.current;if(l&&!j.current){j.current=!0;let t=()=>{S.current===l&&(S.current=null,j.current=!1),l()};Promise.resolve(e).then(t,t)}},[ey],{wait:200}),(0,eN.useEffect)(()=>()=>{var e;null==(e=S.current)||e.call(S),S.current=null,j.current=!1},[]);let ex=(0,eN.useMemo)(()=>eT1(ep4(ep([...ey,...ev,...ef]),"id"),D),[ev,ef,D,ey]),ek=o0(async e=>{U(!0),W(null);try{var t;let l=await (null==J||null==(t=J.getUserIdentificationCodeListAsync)?void 0:t.call(J,e));if(!l)return[];let i=ep4([...l,...A.current],"id");return d(i),l}catch(e){throw W(e instanceof Error?e.message:"获取用户识别码列表失败"),e}finally{U(!1)}}),e_=o0(()=>{var e;return(null==J||null==(e=J.getWalletRecommendList)?void 0:e.call(J))||[]}),ew=o0(()=>{var e;return(null==J||null==(e=J.getUserIdentificationCodes)?void 0:e.call(J))||[]}),eS=o0(()=>{var e;null==J||null==(e=J.clearWalletRecommendList)||e.call(J),o([])}),ej=o0(()=>{var e;null==J||null==(e=J.clearUserIdentificationCodes)||e.call(J),d([])}),eC=o0(()=>{var e;null==J||null==(e=J.clearAllCache)||e.call(J),o([]),d([]),C([]),z([]),m([]),u([]),en([]),E([])}),eM=o0(l=>{var i,a;null==J||null==(i=J.clearAllCache)||i.call(J),o([]),d([]),C([]),z([]),m([]),u([]),en([]),E([]),K([]),q([]),T({}),W(null),U(!1),g.current=[],h.current=[],v.current=[],f.current="",y.current=null,b.current="",x.current=null,k.current=new Set,_.current="",L.current=!1,R.current=!1,$.current=!1,(null==l?void 0:l.notify)!==!1&&(null==t||t([]),null==(a=e.onDiscountChange)||a.call(e,{discountList:[]}))}),eT=o0(e=>{let{currentSearchResults:t,cachedSearchResults:l}=e,i=et(),n=t;ea&&t.length>0&&a&&(n=ea.searchVoucherFormat({vouchers:t,orderTotalAmount:a,products:i}));let r=l||[];ea&&l&&l.length>0&&a&&(r=ea.searchVoucherFormat({vouchers:l,orderTotalAmount:a,products:i}));let o=ep4([...r||[],...n],"id"),s=[],d=[];n.length>0&&n.forEach(e=>{eT0(e)?s.push(e):d.push(e)});let c=o.filter(e=>eT0(e)),u=o.filter(e=>!eT0(e));z(u);let p=[...A.current];return 1===s.length&&(p=[...A.current,...s],R.current=!0),C(c),m(u),en(p),E(p.map(e=>e.id)),1===s.length}),eI=o0(e=>{var l,i,a,r;T((null==Q||null==(i=Q.getOrderSnapshot)||null==(l=i.call(Q))?void 0:l.tempOrder)||{});let s=(null==e?void 0:e.walletRecommendList)||e_(),c=(null==e?void 0:e.userIdentificationCodes)||ew(),p=(null==J||null==(a=J.getStoredWalletInitData)?void 0:a.call(J))||{},f=(null==e?void 0:e.transformList)||p.transformList||c,y=(null==e?void 0:e.noApplicableVoucher)||p.noApplicableVoucher||[],b=(null==e?void 0:e.products)||p.products||[];(R.current||v.current.length>0)&&(s=es(s),c=es(c),f=es(f)),D.length>0&&(s=ed(s),c=ed(c),f=ed(f));let x=[...s,...c],_=R.current||D.length>0;if(o(s),d(c),u(f),m(y),q(b),g.current=x,L.current||_)if(_){let e=new Set(D);en(ep4([...f,...N,...A.current],"id").filter(t=>e.has(t.id)))}else en([]),E([]),L.current=!1,null==t||t([]);else{en(s),E(s.map(e=>e.id));let e=((null==J||null==(r=J.formatWalletPassList2PreparePayments)?void 0:r.call(J,s))||[]).map(e=>({code:e.tag,voucher_id:e.voucher_id,amount:e.amount||0,wallet_pass_usage_unit:e.wallet_pass_usage_unit,wallet_pass_use_value:e.wallet_pass_use_value}));null==n||n.addLog({type:"info",title:"useWalletPass_onOrderCreated onSelectChange 开始调用",metadata:{}}),null==t||t(e)}let w=em(eXa(Q,b.length?b:F,k.current));h.current=w,K(w),$.current&&(null==H||H.success(ez.getText("wallet-pass-module-best-combination-selected"))),$.current=!1}),eP=o0(async e=>{var t,l,i,a;if(!(null==Q?void 0:Q.initWalletData))return;let n=Number((null==e?void 0:e.order_wait_pay_amount)??ee()),o=er(),s=D.length>0?Number((n+o).toFixed(2)):n;if(s<=0)return;let d=JSON.stringify({orderId:(null==Q||null==(l=Q.getTempOrder)||null==(t=l.call(Q))?void 0:t.order_id)||(null==Q||null==(a=Q.getOrderIdentity)||null==(i=a.call(Q))?void 0:i.orderId),customerId:X(),orderWaitPayAmount:s});if(x.current&&b.current===d)return x.current;if(b.current===d&&r.length>0)return;b.current=d,U(!0);let c=(async()=>{let t=await Q.initWalletData({...e,order_wait_pay_amount:s});return b.current===d&&eI(t),t})();x.current=c;try{return await c}finally{x.current===c&&(x.current=null),U(!1)}}),eA=(0,eN.useMemo)(()=>{var e,t,l,i;let a=(null==M||null==(e=M._extend)?void 0:e.customerSnapshot)||(null==M?void 0:M.customer)||(null==M||null==(t=M.original_order_data)?void 0:t.customer)||{};return r9((null==M?void 0:M.customer_id)||(null==M||null==(l=M.original_order_data)?void 0:l.customer_id)||(null==a?void 0:a.id)||(null==a?void 0:a.customer_id))?ez.getText("wallet-pass-module-customer-name-walk-in"):(null==a?void 0:a.display_name)||(null==a?void 0:a.name)||(null==M?void 0:M.customer_name)||(null==M||null==(i=M.original_order_data)?void 0:i.customer_name)||""},[M]);(0,eN.useEffect)(()=>{let e=X(),t=null==e||""===e?"":String(e);if(Q){if(w.current!==t&&(eM(),w.current=t),!t||r9(e))return void el();(async()=>{await ei()})()}},[Q,i,l,a]),(0,eN.useEffect)(()=>{if(!Q)return;let e=ee();e<=0||eP({order_wait_pay_amount:e})},[Q,i,l,a]);let eD=(0,eN.useMemo)(()=>[...s,...r,...[...N].reverse()],[r,s,N]);o0(()=>N.filter(e=>!A.current.some(t=>t.id===e.id)).map(e=>e.code));let eE=o0(e=>{var l;let i=(null==J||null==(l=J.formatWalletPassList2PreparePayments)?void 0:l.call(J,e))||[],a=[];return i.forEach(e=>{e.amount&&a.every(t=>t.voucher_id!==e.voucher_id)&&a.push({voucher_id:e.voucher_id,amount:e.amount,code:e.tag,wallet_pass_usage_unit:e.wallet_pass_usage_unit,wallet_pass_use_value:e.wallet_pass_use_value})}),null==n||n.addLog({type:"info",title:"useWalletPass_notifySelectChange 通知外部选择变化",metadata:{selectedDetails:e,select:a}}),null==t?void 0:t(a)}),eO=o0(async(e,t)=>{var l,i;if(!(null==J?void 0:J.searchIdentificationCodeAsync))return null;let a=await J.searchIdentificationCodeAsync({code:e,prepare_payments:(null==(l=J.formatWalletPassList2PreparePayments)?void 0:l.call(J,ey))||[]}),n=eT({currentSearchResults:(null==a?void 0:a.data)||[],cachedSearchResults:N});return(null==t?void 0:t.waitForApply)&&n&&(null==(i=S.current)||i.call(S),j.current=!1,await new Promise(e=>{S.current=e})),a}),eL=o0(e=>{U(!0),R.current=!0;let t=D.filter(t=>!e.includes(t));if(t.length>0){let e=t.filter(e=>{let t=eg.find(t=>t.id===e);return(null==t?void 0:t.edit_current_amount)!==void 0});e.length>0&&(eY(e,{edit_current_amount:void 0}),v.current=v.current.filter(t=>!e.includes(t)))}E(e),en(eg.filter(t=>e.includes(t.id)))}),eR=(0,eN.useMemo)(()=>ep4(eD,"id").filter(e=>eXn(e)),[eD,B]),e$=(0,eN.useMemo)(()=>eT1(ep4(eD,"id").filter(e=>eXn(e)),[],{error:!0,showStatus:!1}),[eD]),eF=o0(async()=>{if(v.current.length>0&&(eY(v.current,{edit_current_amount:void 0}),v.current=[]),0!==B.length||0!==eu.length){if(U(!0),eu.length){var l,i,a;for(let e of(L.current=!0,eu))await (null==Q||null==(a=Q.setDiscountSelected)?void 0:a.call(Q,{discountId:e,isSelected:!1}));let t=(null==Q||null==(l=Q.getOrderProducts)?void 0:l.call(Q))||[],n={productList:t,discountList:eXa(Q,t,k.current)},r=em(n.discountList);K(r),null==(i=e.onDiscountChange)||i.call(e,{...n,discountList:r}),U(!1);return}R.current=!0,en([]),E([]),null==n||n.addLog({type:"info",title:"useWalletPass_clearAllSelectedWallet 立即通知外部清空",metadata:{}}),null==t||t([]),U(!1)}}),eq=o0(()=>{if(0===r.length)return!0;let e=r.map(e=>e.id).sort(),t=B.sort();return JSON.stringify(e)===JSON.stringify(t)}),eB=o0(async()=>{null==n||n.addLog({type:"info",title:"useWalletPass_handleBestSaving 开始调用",metadata:{}}),U(!0);let t=!1,l=!1;if(ec.length){var i,a,o,s;t=!0,$.current=!0;let n=await (null==Q||null==(i=Q.bestDiscount)?void 0:i.call(Q)),r=(null==n?void 0:n.productList)||(null==Q||null==(a=Q.getOrderProducts)?void 0:a.call(Q))||[],d=em(eXi((null==n?void 0:n.discountList)||(null==Q||null==(o=Q.getDiscountList)?void 0:o.call(Q))||[],r,k.current));K(d),null==(s=e.onDiscountChange)||s.call(e,{...n,discountList:d}),eT3(d.filter(e=>e.isSelected).map(e=>e.id),eu)&&($.current=!1,l=!0,U(!1),null==H||H.info(ez.getText("wallet-pass-module-already-best-combination")))}if(0===r.length){if((!t||t&&l)&&U(!1),N.length)if(eT3(B,N.map(e=>e.id)))null==H||H.info(ez.getText("wallet-pass-module-already-best-combination"));else{let e=N.filter(e=>eT0(e));en(e),E(e.map(e=>e.id)),e.length&&(null==H||H.success(ez.getText("wallet-pass-module-best-combination-selected")))}return}let d=!1,c=r;if(v.current.length>0&&(d=!0,c=eY(v.current,{edit_current_amount:void 0}).newWalletRecommendList,v.current=[]),eq()&&!d)t||null==H||H.info(ez.getText("wallet-pass-module-already-best-combination"));else{if(t&&!l)return;en(c),E(c.map(e=>e.id)),null==H||H.success(ez.getText("wallet-pass-module-best-combination-selected"))}U(!1)}),eH=o0(async(t,l)=>{U(!0);try{var i,a,n;let r=t.includes(l.id);await (null==Q||null==(i=Q.setDiscountSelected)?void 0:i.call(Q,{discountId:l.id,isSelected:r}));let o=(null==Q||null==(a=Q.getOrderProducts)?void 0:a.call(Q))||[],s={productList:o,discountList:eXa(Q,o,k.current)},d=em(s.discountList);K(d),null==(n=e.onDiscountChange)||n.call(e,{...s,discountList:d})}finally{U(!1)}}),eV=o0(()=>{z([])}),eU=o0((e,t,l)=>{let i=Array.isArray(t)?t:[t];return e.map(e=>i.includes(e.id)?{...e,...l}:e)}),eY=o0((e,t)=>{let l=eU(r,e,t);o(l);let i=eU(s,e,t);d(i);let a=eU(c,e,t);u(a);let n=eU(N,e,t);C(n);let p=eU(I,e,t);return en(p),{newWalletRecommendList:l,newUserIdentificationCodes:i,newTransformList:a,newSearchIdentificationCodeList:n,newSelectedWallet:p}}),eW=o0((e,t,l)=>{0===e?eL(D.filter(e=>e!==l.id)):(U(!0),v.current.includes(l.id)||v.current.push(l.id),eY(l.id,{edit_current_amount:e}))});return{walletRecommendList:r,userIdentificationCodes:s,loading:V,error:Y,cardData:ex,handleSelectWallet:eL,selectedWalletIds:B,expiredWalletIds:eR,expiredWalletData:e$,disabledWalletData:O,clearAllSelectedWallet:eF,clearDisabledWalletData:eV,handleBeforeEditAmount:o0(async(e,t,l)=>!0),handleBestSaving:eB,handleSearchIdentificationCode:eO,availableDiscountList:ec,selectedDiscountList:eu,handleSelectDiscount:eH,customerName:eA,fetchUserIdentificationCodes:ek,getCachedWalletRecommendList:e_,getCachedUserIdentificationCodes:ew,clearWalletRecommendList:eS,clearUserIdentificationCodes:ej,clearAllCache:eC,handleConfirmEditAmount:eW}})({onSelectChange:a,customAmount:n,totalAmount:Number(null==i?void 0:i.totalAmount)||0,clientId:o,baseSales:s,onDiscountChange:d}),[C,M]=(0,eN.useState)(!1),[T,I]=(0,eN.useState)(!1),[P,A]=(0,eN.useState)(!0),D=o0(()=>{M(!0)}),E=o0(()=>{M(!1)}),O=o0(()=>{I(!1),f()}),z=o0(()=>{A(!P)}),L=o0((e,t)=>{}),R=eC().useMemo(()=>eT1(h||[],[],{error:!0,showStatus:!1}),[h]);(0,eN.useEffect)(()=>{h&&h.length>0&&!T&&I(!0)},[h,T]),(0,eN.useImperativeHandle)(t,()=>({handleSearchIdentificationCode:x,getWalletPassData:e=>({selectedWallet:e.length?u.filter(e=>p.includes(e.id)):[],availableDiscountList:k,selectedDiscountList:_})}));let $=(0,eN.useMemo)(()=>{if(h&&1===h.length){var e,t;return(null==(t=h[0])||null==(e=t.unified_messages)?void 0:e.title)||""}return ez.getText("wallet-pass-module-disabled-modal-title")},[h]),F=(0,eN.useMemo)(()=>p.length+_.length,[p.length,_.length]),q=(0,eN.useMemo)(()=>0===Number(null==i?void 0:i.totalAmount)||!!(null==r?void 0:r.some(e=>!eTl(e)&&!!eTt(e)&&!eMH.includes(e.code))),[r,i]);return 0===u.length&&0===k.length&&0===h.length?null:(0,eB.jsx)("div",{className:"wallet-pass-module-container",children:(0,eB.jsx)(nB.PisellLoading,{delay:300,loading:b,fullscreen:!1,mask:{backgroundColor:"rgba(255, 255, 255, 0.5)",width:"100%",height:"100%"},children:(0,eB.jsxs)("div",{className:"wallet-pass-module",children:[(0,eB.jsx)(eXo,{customerName:S,selectedCount:F,expiredCount:m.length,isCardMode:P,onExpiredClick:D,onBestSaving:y,onClearAll:v,onToggleDisplayMode:z}),(0,eB.jsx)(eXu,{isCardMode:P,cardData:u,selectedWalletIds:p,onSelectWallet:c,onDetail:L,onConfirmEditAmount:j,onBeforeEditAmount:N}),(0,eB.jsx)(eXh,{isCardMode:P,cardData:k,selectedWalletIds:_,onSelectWallet:w,onDetail:L,discountDisabled:q}),(0,eB.jsx)(eXp,{visible:C,walletData:g,onClose:E,title:null==(l=ez.getText("wallet-pass-module-expired-modal-title"))?void 0:l((null==g?void 0:g.length)||0)}),(0,eB.jsx)(eXp,{visible:T,walletData:R,onClose:O,title:$})]})})})}),eXk=(0,eN.forwardRef)((e,t)=>"shared"===e.mode?(0,eB.jsx)(eXb,{...e,ref:t}):(0,eB.jsx)(eXx,{...e,ref:t})),eX_=(0,eN.memo)(eXk),eXw={en:{"pisell2.text.others":"Others","pisell2.text.order-note":"Order Note","pisell2.text.print-receipt":"Print Receipt","pisell2.text.save-pay-later":"Save & Pay Later","pisell2.text.send-link":"Send Link","pisell2.text.manual-order-discount":"Manual Order Discount","pisell2.text.order-no-payment-required":"Order requires no payment, cannot manually adjust price","pisell2.text.order-no-payment-cannot-send-link":"Order requires no payment, cannot send payment link.","pisell2.text.additional-module.order-discount":"Order Discount"},"zh-CN":{"pisell2.text.others":"其他","pisell2.text.order-note":"订单备注","pisell2.text.print-receipt":"打印收据","pisell2.text.save-pay-later":"保存稍后支付","pisell2.text.send-link":"发送链接","pisell2.text.manual-order-discount":"手动订单折扣","pisell2.text.order-no-payment-required":"订单已无需支付,不可手动改价","pisell2.text.order-no-payment-cannot-send-link":"订单已无需支付,不可发送支付链接","pisell2.text.additional-module.order-discount":"订单折扣"},"zh-HK":{"pisell2.text.others":"其他","pisell2.text.order-note":"訂單備註","pisell2.text.print-receipt":"打印收據","pisell2.text.save-pay-later":"保存稍後支付","pisell2.text.send-link":"發送鏈接","pisell2.text.manual-order-discount":"手動訂單折扣","pisell2.text.order-no-payment-required":"訂單已無需支付,不可手動改價","pisell2.text.order-no-payment-cannot-send-link":"訂單已無需支付,不可發送支付鏈接","pisell2.text.additional-module.order-discount":"订单折扣"},ja:{"pisell2.text.others":"その他","pisell2.text.order-note":"注文メモ","pisell2.text.print-receipt":"領収書を印刷","pisell2.text.save-pay-later":"保存して後で支払う","pisell2.text.send-link":"リンクを送信","pisell2.text.manual-order-discount":"手動注文割引","pisell2.text.order-no-payment-required":"注文は支払い不要のため、手動で価格を変更できません","pisell2.text.order-no-payment-cannot-send-link":"注文は支払い不要のため、支払いリンクを送信できません","pisell2.text.additional-module.order-discount":"注文割引"},pt:{"pisell2.text.others":"Outros","pisell2.text.order-note":"Nota do Pedido","pisell2.text.print-receipt":"Imprimir Recibo","pisell2.text.save-pay-later":"Salvar e Pagar Depois","pisell2.text.send-link":"Enviar Link","pisell2.text.manual-order-discount":"Desconto Manual do Pedido","pisell2.text.order-no-payment-required":"O pedido n\xe3o requer pagamento, n\xe3o \xe9 poss\xedvel ajustar o pre\xe7o manualmente","pisell2.text.order-no-payment-cannot-send-link":"O pedido n\xe3o requer pagamento, n\xe3o \xe9 poss\xedvel enviar o link de pagamento.","pisell2.text.additional-module.order-discount":"Desconto do Pedido"}},eXS=function(e){let{orderInfo:t,customAmount:l,handleButtonClick:i,hasOrderNote:a=!1,disabled:n=!1,showCashPayment:r=!1,isFullWidth:o=!1,showMore:s=!0}=e;sZ(eXw,eZ());let d=[{key:"send-link",label:ez.getText("pisell2.text.send-link"),icon:(0,eB.jsx)(jd,{})},{key:"print-receipt",label:ez.getText("pisell2.text.print-receipt"),icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-printer"})}],c=qS();return(0,eB.jsxs)("div",{className:"additional-module",children:[r&&(0,eB.jsx)("div",{className:"additional-module-title",children:ez.getText("pisell2.text.others")}),(0,eB.jsx)("div",{className:"additional-module-buttons-container",children:r&&!o?(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)("div",{className:"additional-module-button-row",children:[(0,eB.jsxs)(eM.Button,{className:`additional-module-button-base purple-theme ${a?"note-button":""}`,onClick:()=>{i("order-note")},icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-clipboard-minus",className:"additional-module-button-icon"}),size:"large",children:[ez.getText("pisell2.text.order-note"),a&&(0,eB.jsx)("span",{className:"note-indicator",children:(0,eB.jsx)(nB.Icon,{type:"pisell2-info-circle2"})})]}),(0,eB.jsx)(eM.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("split-payment")},icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-coins-01",className:"additional-module-button-icon"}),size:"large",children:ez.getText("split.payment")})]}),(0,eB.jsxs)("div",{className:"additional-module-button-row",children:[(0,eB.jsx)(eM.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("manual-discount")},icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-sale-01",className:"additional-module-button-icon"}),size:"large",children:ez.getText("pisell2.text.additional-module.order-discount")}),(0,eB.jsx)(eM.Button,{className:`additional-module-button-base ${n?"disabled-theme":"orange-theme"}`,onClick:()=>{i("save-pay-later")},disabled:n,size:"large",icon:(0,eB.jsx)(g2,{className:"additional-module-button-icon"}),children:ez.getText("pisell2.text.save-pay-later")}),s&&(0,eB.jsx)(eM.Dropdown,{menu:{items:d,onClick:e=>{let{key:t}=e;"send-link"===t?n?c.fail(ez.getText("pisell2.text.order-no-payment-cannot-send-link")):i("send-link"):"print-receipt"===t?i("print-receipt"):"split-payment"===t?i("split-payment"):"print-receipt"===t&&i("print-receipt")}},trigger:["click"],placement:"bottomLeft",overlayStyle:{zIndex:9999,pointerEvents:"auto"},mouseEnterDelay:.1,mouseLeaveDelay:.1,onOpenChange:e=>{},children:(0,eB.jsx)(eM.Button,{size:"large",className:"additional-module-button-base more-button",icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-dots-vertical",size:20})})})]}),!s&&(0,eB.jsxs)("div",{className:"additional-module-button-row",children:[(0,eB.jsx)(eM.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("send-link")},disabled:n,size:"large",icon:(0,eB.jsx)(jd,{}),children:ez.getText("pisell2.text.send-link")}),(0,eB.jsx)(eM.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("print-receipt")},disabled:n,size:"large",icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-printer"}),children:ez.getText("pisell2.text.print-receipt")})]})]}):(0,eB.jsxs)("div",{className:"additional-module-button-row",children:[(0,eB.jsxs)(eM.Button,{className:`additional-module-button-base purple-theme ${a?"note-button":""}`,onClick:()=>{i("order-note")},size:"large",icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-clipboard-minus",className:"additional-module-button-icon"}),children:[ez.getText("pisell2.text.order-note"),a&&(0,eB.jsx)("span",{className:"note-indicator",children:(0,eB.jsx)(nB.Icon,{type:"pisell2-info-circle2"})})]}),(0,eB.jsx)(eM.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("split-payment")},size:"large",icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-coins-01",className:"additional-module-button-icon"}),children:ez.getText("split.payment")}),(0,eB.jsx)(eM.Button,{className:"additional-module-button-base purple-theme",onClick:()=>{i("manual-discount")},icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-sale-01",className:"additional-module-button-icon"}),size:"large",children:ez.getText("pisell2.text.additional-module.order-discount")}),(0,eB.jsx)(eM.Button,{className:`additional-module-button-base ${n?"disabled-theme":"orange-theme"}`,onClick:()=>{i("save-pay-later")},disabled:n,size:"large",icon:(0,eB.jsx)(g2,{className:"additional-module-button-icon"}),children:ez.getText("pisell2.text.save-pay-later")}),(0,eB.jsx)(eM.Dropdown,{menu:{items:d,onClick:e=>{let{key:t}=e;"send-link"===t?n?c.fail(ez.getText("pisell2.text.order-no-payment-cannot-send-link")):i("send-link"):"split-payment"===t?i("split-payment"):"print-receipt"===t&&i("print-receipt")}},trigger:["click"],placement:"bottomLeft",overlayStyle:{zIndex:9999,pointerEvents:"auto"},mouseEnterDelay:.1,mouseLeaveDelay:.1,onOpenChange:e=>{},children:(0,eB.jsx)(eM.Button,{className:"additional-module-button-base more-button",size:"large",icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-dots-vertical",size:20})})})]})})]})},eXj={paid:{titleKey:"payment.result.success",fallbackTitle:"Payment Successful",subtitleMode:"paid",colorClass:"paid",statusClassName:"success",autoClose:!0,maskClosable:!1},partially_paid:{titleKey:"payment.result.success",fallbackTitle:"Payment Successful",subtitleMode:"partial",colorClass:"partially-paid",statusClassName:"success",autoClose:!0,maskClosable:!1},deposit_paid:{titleKey:"payment.result.success",fallbackTitle:"Payment Successful",subtitleMode:"deposit",colorClass:"paid",statusClassName:"success",autoClose:!0,maskClosable:!1},failed:{titleKey:"payment.result.failed",fallbackTitle:"Payment Failed",subtitleMode:"amount_due",colorClass:"amount-due",statusClassName:"failed",autoClose:!1,maskClosable:!1},"wallet-pass-redemption-failed":{titleKey:"pisell2.checkout.wallet-pass.redemption-failed",fallbackTitle:"Wallet pass redeem failed",subtitleMode:"wallet_pass_partial",colorClass:"partially-paid",statusClassName:"wallet-pass-failed",autoClose:!1,maskClosable:!1}};function eXN(e,t){return t||(e?"error"===e?"failed":e in eXj?e:"paid":null)}function eXC(e){let{paymentStatus:t,resultKind:l,orderTotalAmount:i,gapAmount:a,depositAmount:n,changeGivenAmount:r,failureReason:o,isModalMode:s}=e,d=eXN(t,l);if(!d)return null;let c=eXj[d],u={autoClose:c.autoClose,autoCloseDelay:30,maskClosable:c.maskClosable};return s&&(u.autoClose=!1,u.autoCloseDelay=0,u.maskClosable=!1),{resultKind:d,statusClassName:c.statusClassName,paymentStatus:t||d,orderTotalAmount:Number(i||0),depositAmount:Number(n||0),changeGivenAmount:Number(r||0),gapAmount:"partially_paid"===d?Number(a||0):Number(r||0),failureReason:o,autoCloseConfig:u}}let eXM=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$";return lU(e,2,t)},eXT=async(e,t)=>{var l;let i,{paymentStatus:a,resultKind:n,orderTotalAmount:r,gapAmount:o,depositAmount:s,changeGivenAmount:d,failureReason:c,autoCloseConfig:u,actionButtons:p}=e,{getData:m,onToastClose:g}=t,h=eMf({status:"wallet-pass-redemption-failed"===eXN(a,n)?"wallet-pass-failed":eMv("deposit_paid"===n?"deposit_paid":a),paymentStatus:a,currencySymbol:(null==m?void 0:m("shop_symbol"))||"$",orderTotalAmount:r,changeGivenAmount:d,failureReason:c,summary:null,disableDetail:!0});return(null==(l=t.onResultViewModel)||l.call(t,h),"page"===t.paymentResultDisplayMode)?h:(i={...h,actionButtons:p||[],autoClose:(null==u?void 0:u.autoClose)||!1,autoCloseDelay:(null==u?void 0:u.autoCloseDelay)||10,showCountdownProgress:!!(null==u?void 0:u.autoClose),clickOutsideToClose:!!(null==u?void 0:u.autoClose),closable:!0,onClose:g||(()=>{})},WG.addToast(i),h)},eXI=e=>(0,eB.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"currentColor",viewBox:"0 0 24 24",...e,children:(0,eB.jsx)("path",{fillRule:"evenodd",d:"M17.646 7.06A7.503 7.503 0 0 0 4.54 11.213 1 1 0 0 1 2.552 11 9.49 9.49 0 0 1 7.25 3.772c4.129-2.383 9.303-1.316 12.182 2.308l.109-.405a1 1 0 0 1 1.932.518l-.732 2.732a1 1 0 0 1-1.225.707L16.784 8.9a1 1 0 0 1 .518-1.932zm2.913 4.839a1 1 0 0 1 .889 1.1 9.49 9.49 0 0 1-4.698 7.228c-4.129 2.384-9.303 1.316-12.182-2.307l-.109.405a1 1 0 0 1-1.932-.518l.733-2.732a1 1 0 0 1 1.224-.707l2.732.732a1 1 0 0 1-.517 1.932l-.345-.093a7.502 7.502 0 0 0 13.105-4.152 1 1 0 0 1 1.1-.889",clipRule:"evenodd"})}),eXP=e=>(0,eB.jsx)(ne,af(af({},e),{},{viewBox:(null==e?void 0:e.viewBox)||"0 0 24 24",component:eXI})),eXA={display:"flex",flexDirection:"column",minHeight:0,overflowY:"auto",maxHeight:"90%",padding:"0px 16px 16px"},eXD={list:[],pagination:{page:1,pageSize:20,total:0},hasMore:!1};function eXE(e){var t,l,i;if(!e)return eXD;let a=(null==(t=e.getCustomerState)?void 0:t.call(e))||{},n=(null==(l=e.getCustomers)?void 0:l.call(e))||[],r=a.customerList||a.list||a.customers||n,o=a.currentPage||a.page||1,s=a.pageSize||20,d=a.total??r.length;return{list:r,pagination:{page:o,pageSize:s,total:d},hasMore:"boolean"==typeof a.hasMore?a.hasMore:!!(null==(i=e.hasMoreCustomers)?void 0:i.call(e))}}let eXO=(0,eN.memo)(e=>{var t,l,i,a,n,r,o,s;let{disabledSwitch:d,clientInfo:c,onSearch:u,beginScanActivity:p,onClientChange:m,baseSales:g,baseSalesModuleName:h,enableScanner:v=!0,showCustomerSelect:f=!0}=e,[y,b]=(0,eN.useState)(!1),[x,k]=(0,eN.useState)(!1),[_,w]=(0,eN.useState)(!1),[S,j]=(0,eN.useState)(eXD),[N,C]=(0,eN.useState)(0),M=(0,eN.useRef)(null),T=(0,eN.useRef)(null),I=eR(),P=(0,nB.useToast)(),A=(0,eN.useMemo)(()=>{var e,t,l,i;return g||h&&(null==(i=I.appHelper)||null==(l=i.utils)||null==(t=l.pisellos)||null==(e=t.getModule)?void 0:e.call(t,h))||null},[h,null==(l=I.appHelper)||null==(t=l.utils)?void 0:t.pisellos,g]),D=(null==A||null==(i=A.getBookingConfig)?void 0:i.call(A))??null,E=null==D||null==(r=D.config)||null==(n=r.basic)||null==(a=n.appointment_subject)?void 0:a.form_id,O=(0,eN.useCallback)(e=>{var t;let l,i,a;j(e?(l=eXE(A),(a=Array.isArray(i=(null==e?void 0:e.data)??e)?i:Array.isArray(null==i?void 0:i.list)?i.list:Array.isArray(null==i?void 0:i.customerList)?i.customerList:Array.isArray(null==e?void 0:e.list)?e.list:Array.isArray(null==e?void 0:e.customerList)?e.customerList:[]).length?{...l,list:a,pagination:{...l.pagination,total:(null==e?void 0:e.total)??(null==e||null==(t=e.data)?void 0:t.total)??l.pagination.total}}:l):eXE(A))},[A]),z=(0,eN.useCallback)(()=>{C(e=>e+1)},[]),L=(0,eN.useMemo)(()=>{var e,t,l,i,a,n;return(null==c?void 0:c.id)||(null==c?void 0:c.customer_id)||(null==c?void 0:c.display_name)||(null==c?void 0:c.name)?c:(null==A||null==(e=A.getCustomer)?void 0:e.call(A))||(null==A||null==(t=A.getOrderCustomerSnapshot)?void 0:t.call(A))||(null==A||null==(n=A.getOrderSnapshot)||null==(a=n.call(A))||null==(i=a.tempOrder)||null==(l=i._extend)?void 0:l.customerSnapshot)||c||null},[A,c,N]),R=(0,eN.useCallback)(async e=>{var t,l,i,a,n,r,o,s;if(!(null==e?void 0:e.trim()))return;let c=null==p?void 0:p();if(p&&!c){null==(t=M.current)||t.setKeyword("");return}b(!0);try{let t=await (null==u?void 0:u(e));if(!((null==t?void 0:t.asset)||(Array.isArray(null==t?void 0:t.data)?t.data.length>0:!!(null==t?void 0:t.data)))){null==P||null==(i=P.info)||i.call(P,ez.getText("pisell2.checkout.wallet-pass-module.no-result"));return}if("type"in t&&"walletCode"==t.type){if(d){null==P||null==(r=P.info)||r.call(P,ez.getText("pisell2.checkout.client-card.tip.partially-paid"));return}let{customer:e,...l}=t.data;if(!e){null==P||null==(o=P.info)||o.call(P,ez.getText("pisell2.checkout.wallet-pass-module.no-result"));return}let i={...e,latest_wallet_detail:l};await (null==(n=T.current)||null==(a=n.handleSetClient)?void 0:a.call(n,i,{sameClientTip:ez.getText("pisell2.checkout.client-card.tip.same-client")}))}null==(l=M.current)||l.setKeyword("")}catch(t){let e=t instanceof Error?t.message:String(t||"");null==P||null==(s=P.error)||s.call(P,e||ez.getText("pisell2.checkout.wallet-pass-module.no-result"))}finally{b(!1),null==c||c()}},[P,p,d,u]);(0,eN.useEffect)(()=>{O(),z()},[O,z]),(0,eN.useEffect)(()=>{if(!(null==A?void 0:A.effectsOn))return;let e=A.effectsOn("onCustomerListUpdate",()=>{O()}),t=A.effectsOn("onCustomerListReset",()=>{O()}),l=A.effectsOn("onOrderCustomerChange",()=>{z()});return()=>{[e,t,l].forEach(e=>{var t;"function"==typeof e?e():null==e||null==(t=e.remove)||t.call(e)})}},[A,z,O]);let $=(0,eN.useMemo)(()=>{let e=(0,eB.jsx)(nB.Icon,{type:"pisell2-switch-horizontal-01",size:24,style:{color:"#667085"}}),t={buttonProps:{icon:e,size:"default"}};return!0===d&&(t={open:!1,buttonProps:{icon:e,size:"default",onClick:()=>{var e;null==P||null==(e=P.info)||e.call(P,ez.getText("pisell2.checkout.client-card.tip.partially-paid"))},style:{cursor:"not-allowed"}}}),t},[P,d]),F=(0,eN.useCallback)(async(e,t)=>{if(A){(null==t?void 0:t.showLoading)!==!1&&k(!0);try{var l;let i=A.resetAndLoadCustomers?await A.resetAndLoadCustomers({search:e||void 0,relation_form_id:(null==t?void 0:t.relation_form_id)??E??void 0}):await (null==(l=A.getCustomerList)?void 0:l.call(A,{search:e||void 0,relation_form_id:(null==t?void 0:t.relation_form_id)??E??void 0,skip:1,num:S.pagination.pageSize}));O(i)}finally{k(!1)}}},[A,S.pagination.pageSize,E,O]),q=(0,eN.useCallback)(async()=>{if(A&&!_){w(!0);try{var e;let t=await (null==(e=A.loadMoreCustomers)?void 0:e.call(A));O(t)}finally{w(!1)}}},[A,_,O]),B=(0,eN.useCallback)(async(e,t)=>{if(A){k(!0);try{var l;let i=await (null==(l=A.changeCustomerPage)?void 0:l.call(A,e,t));O(i)}finally{k(!1)}}},[A,O]),H=(0,eN.useCallback)(async e=>{var t,l,i,a,n;if(!A){null==m||m(e);return}e?(A.setOrderCustomer?A.setOrderCustomer(e):null==(a=A.updateTempOrderCustomer)||a.call(A,e),null==(i=A.setActiveCustomer)||i.call(A,e)):A.clearOrderCustomer?A.clearOrderCustomer():A.updateTempOrderCustomer?A.updateTempOrderCustomer({customer_id:null,customer_name:"",phone:"",email:""}):null==(n=A.setOrderCustomer)||n.call(A,null),e||null==(t=A.setActiveCustomer)||t.call(A,null),null==(l=A.updateTempOrderContactsInfo)||l.call(A,eCt(e)),z(),null==m||m(e)},[A,m,z]),V=(0,eN.useCallback)(e=>{var t;null==A||null==(t=A.addCustomerToFirst)||t.call(A,e),O()},[A,O]),U=(0,eN.useCallback)((e,t)=>{var l,i;let a=null==(i=I.appHelper)||null==(l=i.utils)?void 0:l.action,n=(null==e?void 0:e.id)??(null==e?void 0:e.customer_id);a&&n&&a({type:"pisell1.handleOpenCustomerModal",data:{id:n},callback:t})},[null==(s=I.appHelper)||null==(o=s.utils)?void 0:o.action]);return(0,eB.jsxs)("div",{className:"checkout-search-client-module",style:{display:"flex",gap:8},children:[(0,eB.jsx)(Zy,{ref:M,className:"checkout-search-client-module__find",displayType:"detached",triggerType:"input",searchMode:"confirm",showConfirmButton:!0,showHistory:!1,enableScanner:v,loading:y,placeholder:ez.getText("pisell2.checkout.search-section.placeholder"),onSearch:R,searchSectionProps:{style:{flex:1,minWidth:0},cameraButtonProps:{icon:["pisell2-camera-01","pisell2-qr-code-02"]},searchButtonProps:{placement:"inside",style:{height:36,padding:8,minWidth:76}}}}),f&&(0,eB.jsx)(eCd,{ref:T,value:L,list:S.list,loading:x,loadingMore:_,hasMore:S.hasMore,pagination:S.pagination,onSearch:F,onLoadMore:q,onChangePage:B,onSelect:H,onAddToFirst:V,onOpenCustomerDetail:U,readOnly:d,bookingConfig:D,clientCardProps:{style:{width:326,minHeight:48,height:48,padding:"4px 8px",borderColor:"#D0D5DD"},avatar:{size:"sm"},dropdown:$}})]})});function eXz(e,t){try{return{value:e(),error:null}}catch(e){return{value:t,error:e}}}let eXL=()=>void 0,eXR={display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto minmax(0, 1fr)",alignItems:"center",gap:12,width:"100%"},eX$={justifySelf:"start"},eXF={minWidth:0,textAlign:"center",fontSize:16,fontWeight:600,lineHeight:"24px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},eXq={justifySelf:"end",minWidth:0};function eXB(e){var t,l;let i=eXV(e.currencyAmount)??new lO(0),a=eXV(null==(t=e.walletPassUsageUnit)?void 0:t.points),n=eXV(null==(l=e.walletPassUsageUnit)?void 0:l.price);return!a||!n||a.eq(0)||n.eq(0)?lU(i.toNumber()):i.div(n).toDecimalPlaces(6,lO.ROUND_DOWN).mul(a).toFixed(2,lO.ROUND_DOWN)}function eXH(e){try{return new lO(e||0).toDecimalPlaces(2).toFixed(2)}catch{return"0.00"}}function eXV(e){if(null==e)return null;try{return new lO(e)}catch{return null}}function eXU(e){let t=eXV(e);return(null==t?void 0:t.isFinite())?lO.max(t,0).toFixed(2):void 0}function eXY(e){let t=eXV(e);return!t||t.lte(0)?"":t.toDecimalPlaces(2).toFixed(2)}function eXW(e,t){return eXU((null==e?void 0:e.expectAmount)??(null==e?void 0:e.totalAmount)??(null==t?void 0:t.totalAmount))??"0.00"}function eXG(e,t){var l,i;let a=(null==e||null==(l=e.getOrderAmountSnapshot)?void 0:l.call(e))||{},n=(null==e||null==(i=e.getTempOrder)?void 0:i.call(e))||{};return eXU(a.depositAmount??n.deposit_amount??(null==t?void 0:t.depositAmount))??eXW(a,t)}function eXK(e){var t,l,i,a,n,r,o,s,d;let c=null==e||null==(t=e.getOrderSnapshot)?void 0:t.call(e),u=(null==e||null==(l=e.getOrderAmountSnapshot)?void 0:l.call(e))||(null==c?void 0:c.amount)||{},p=(null==c?void 0:c.identity)||{};if(!c&&!u)return null;let m=(null==c?void 0:c.tempOrder)||{},g=(null==m||null==(i=m._extend)?void 0:i.customerSnapshot)||(null==m?void 0:m.customer)||(null==c?void 0:c.customer)||null,h=m.customer_id??(null==g?void 0:g.id)??(null==g?void 0:g.customer_id)??(null==c||null==(a=c.customer)?void 0:a.customerId),v=(null==g?void 0:g.display_name)||(null==g?void 0:g.name)||m.customer_name||(null==c||null==(n=c.customer)?void 0:n.customerName)||"";return{orderId:p.orderId||p.externalSaleNumber||p.orderNumber,status:null==c?void 0:c.status,...ePC(u,m),paymentStatus:null==c?void 0:c.paymentStatus,itemCount:(null==c?void 0:c.productCount)||(null==c||null==(o=c.tempOrder)||null==(r=o.products)?void 0:r.length)||0,hasLocalOrderData:!!(null==c?void 0:c.tempOrder),customerId:h,customerName:v,customerPhone:(null==g?void 0:g.phone)||m.phone||(null==c||null==(s=c.customer)?void 0:s.phone)||"",customerEmail:(null==g?void 0:g.email)||m.email||(null==c||null==(d=c.customer)?void 0:d.email)||"",customerSnapshot:g}}function eXQ(e){let t=(null==e?void 0:e.submitResult)||e,l=eX5(t);return(null==l?void 0:l.data)||(null==t?void 0:t.data)||l||{}}async function eXZ(e){var t;await (null==e||null==(t=e.confirmPendingVoucherPayments)?void 0:t.call(e))}async function eXJ(e){var t;"function"==typeof(null==e?void 0:e.discardPendingVoucherPayments)?await e.discardPendingVoucherPayments():await (null==e||null==(t=e.updateVoucherOrderPayments)?void 0:t.call(e,[]))}async function eXX(e,t){var l;let i=(null==e?void 0:e.addOrderPaymentAsync)||(null==e?void 0:e.addOrderPayment);if("function"==typeof i)return null==(l=e.ensureOrderCreatedAt)||l.call(e),i.call(e,t)}async function eX0(e,t,l){let i=(null==e?void 0:e.updateVoucherOrderPaymentsAsync)||(null==e?void 0:e.updateVoucherOrderPayments);if("function"==typeof i)return i.call(e,t,l)}async function eX2(e,t){var l;return{success:!0,response:await (null==e||null==(l=e.submitSalesOrder)?void 0:l.call(e,{smallTicketDataFlag:1,...(null==t?void 0:t.confirmPendingVoucherPayments)!==void 0?{confirmPendingVoucherPayments:t.confirmPendingVoucherPayments}:{}}))}}async function eX1(e){if("function"==typeof(null==e?void 0:e.confirmWalletPayment)){let t=await e.confirmWalletPayment();return{success:!0,response:null==t?void 0:t.submitResult,walletResult:t}}return await eXZ(e),eX2(e,{confirmPendingVoucherPayments:!0})}async function eX4(e,t){if("function"!=typeof(null==e?void 0:e.submitTempOrderAsync))return{success:!1,response:{status:!1,message:"当前订单提交能力不可用,请重启 APP 后再试"}};let l=await e.submitTempOrderAsync({smallTicketDataFlag:1,...(null==t?void 0:t.confirmPendingVoucherPayments)!==void 0?{confirmPendingVoucherPayments:t.confirmPendingVoucherPayments}:{}});return{success:!eX3(l),response:l}}function eX3(e){if(!(e=eX5(e))||"object"!=typeof e)return!1;let t=void 0!==e.code&&200!==e.code&&"200"!==e.code,l=!1===e.status||"number"==typeof e.status&&e.status>=400,i=!1===e.success;return t||l||i}function eX8(e){var t,l,i,a,n,r,o;return(e=eX5(e))&&"object"==typeof e?String(e.message||e.msg||e.error||(null==(t=e.data)?void 0:t.message)||(null==(l=e.data)?void 0:l.msg)||(null==(i=e.data)?void 0:i.error)||(null==(n=e.errors)||null==(a=n[0])?void 0:a.message)||(null==(o=e.errors)||null==(r=o[0])?void 0:r.msg)||""):""}function eX6(e){var t,l,i,a,n;return(null==(e=eX5(e))||null==(t=e.data)?void 0:t.order_id)||(null==e?void 0:e.order_id)||(null==e||null==(i=e.data)||null==(l=i.order)?void 0:l.order_id)||(null==e||null==(n=e.data)||null==(a=n.sales)?void 0:a.order_id)}function eX5(e){return e&&"object"==typeof e&&e.data&&"object"==typeof e.data&&!eX7(e)&&eX7(e.data)?e.data:e}function eX7(e){return!!e&&"object"==typeof e&&(void 0!==e.code||void 0!==e.status||void 0!==e.success||void 0!==e.message||void 0!==e.msg||void 0!==e.error||void 0!==e.errors)}function eX9(e,t){let l=eX5(e);return{code:null==l?void 0:l.code,status:null==l?void 0:l.status,success:null==l?void 0:l.success,message:eX8(l),response:l,rawResponse:e,payments:t}}async function e0e(e,t,l){var i,a,n;let r=null==e||null==(i=e.getTempOrder)?void 0:i.call(e);await (null==e||null==(a=e.getSummary)?void 0:a.call(e));let o=t&&eXY(l)||"0.00";return"function"==typeof(null==e?void 0:e.updateTempOrderDepositAmount)&&await e.updateTempOrderDepositAmount(o),await (null==e||null==(n=e.saveDraft)?void 0:n.call(e)),r}async function e0t(e,t){if("function"==typeof(null==e?void 0:e.updateTempOrderDepositAmount))return e.updateTempOrderDepositAmount(t)}let e0l=(0,eN.forwardRef)((e,t)=>{var l,i,a,n,r,o;let{cartData:s,orderInfo:d,isModalOpen:c,onPaymentComplete:u,onPaymentCancel:p,onStatusChange:m,showingCashToastRef:g,onToastClose:h,orderNote:v,setOrderNote:f,setNoteModalSource:y,setNoteModalOpen:b,totalAmount:x=0,moduleConfig:k,onShowCashPaymentChange:_,showSuccessToast:w,dynamicMaxHeight:S="600px",onOrderSyncFailed:j,generateActionButtons:N,paymentResultToastConfig:C,updateOrderInfo:M,setCurrentEditOrderId:T,config:I,paymentResultDisplayMode:P,shopDiscount:A,client:D,currentTotalPrice:E,onChangeShopDiscount:O,onChangeOrderNote:z,onDeleteOrderNote:L,baseSales:R,walletPassMode:$="legacy",cardReaderDeviceNumber:F,cardReaders:q=[],setIsChangePaymentNotIncludeVoucher:B}=e,H=eR(),V=H.appHelper.utils||{},{getApp:U,pisellos:Y,getData:W,pisellosAllModule:G,interaction:K}=V,Q=(0,nB.useToast)(),Z=(0,eN.useRef)(null),J=(0,eN.useRef)(null),X=(0,eN.useRef)(null),[ee,et]=(0,eN.useState)(""),[el,ei]=(0,eN.useState)(""),[ea,en]=(0,eN.useState)(""),[er,eo]=(0,eN.useState)([]),[es,ed]=(0,eN.useState)(!1),ec=(0,eN.useRef)(null),[eu,ep]=(0,eN.useState)([]),[em,eg]=(0,eN.useState)(!1),[eh,ev]=(0,eN.useState)(!1),[ef,ey]=(0,eN.useState)(ez.getText("cards.and.digitals")||"Cards & Digitals"),eb=dZ(),ex=(0,eN.useMemo)(()=>String((null==W?void 0:W("channel"))||"").trim().toLowerCase(),[W]),ek=function(e){let t=(0,eN.useRef)(),l=(0,eN.useRef)(!0),[i,a]=(0,eN.useState)(!1),[n,r]=(0,eN.useState)(!1),o=o0(i=>{if(!e)return eXL;if(t.current)return null;let n=Symbol(i);t.current={token:n,type:i},l.current&&(a("payment"===i),r("scan"===i));let o=!1;return()=>{var e;o||(o=!0,(null==(e=t.current)?void 0:e.token)===n&&(t.current=void 0,l.current&&(a(!1),r(!1))))}}),s=o0(()=>o("payment")),d=o0(()=>o("scan")),c=o0(()=>{var l;return e&&(null==(l=t.current)?void 0:l.type)==="payment"}),u=o0(()=>{var l;return e&&(null==(l=t.current)?void 0:l.type)==="scan"});return(0,eN.useEffect)(()=>(l.current=!0,()=>{l.current=!1}),[]),(0,eN.useEffect)(()=>{e||(t.current=void 0,a(!1),r(!1))},[e]),(0,eN.useMemo)(()=>({tryBeginPayment:s,tryBeginScan:d,getIsPaymentProcessing:c,getIsScanProcessing:u,isPaymentProcessing:i,isScanProcessing:n}),[s,d,c,u,i,n])}("kiosk"===ex),e_=(0,eN.useRef)(),ew=eM8(null==(i=H.appHelper.utils)||null==(l=i.getApp)?void 0:l.call(i)),eS=(0,eN.useRef)(),ej=(0,eN.useMemo)(()=>eu.filter(e=>{var t;return("app"!==e.type||"EFTPOS_LINKLY"!==e.code)&&(null==(t=e.channel_application)?void 0:t.includes(ex))&&(["custom"].includes(e.type)||eMG.includes(e.code))}),[ex,eu]),eT=(0,eN.useMemo)(()=>eTs(eu,q,F||""),[F,q,eu]),eI=(0,eN.useRef)(!1),[eP,eA]=(0,eN.useState)(),eD=(0,eN.useRef)(null),eE=(0,eN.useRef)("0.00"),[eO,eL]=(0,eN.useState)([]),e$=(0,eN.useMemo)(()=>eO.reduce((e,t)=>{if(!eTi(t))return e;try{let l=new lO(t.amount||0),i=new lO(t.rounding_amount||0);return e.plus(l).plus(i)}catch{return e}},new lO(0)),[eO]),eF=(0,eN.useCallback)(e=>{try{return lO.max(new lO(e||0).minus(e$),0).toDecimalPlaces(2).toFixed(2)}catch{return"0.00"}},[e$]),eq=(0,eN.useMemo)(()=>eF(ee||el||0),[el,ee,eF]),eH=(0,eN.useMemo)(()=>eF(el||0),[el,eF]),eV=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=(0,eN.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.some(e=>!!e&&"voided"!==e.status&&((null==e?void 0:e.voucher_id)===void 0||0===Number(e.voucher_id)))})(e),[e]);return{isCustomerChangeLocked:t,canChangeCustomer:!t,shouldReloadWalletPassAfterCustomerChange:!t}}(eO),eU=(0,eN.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.some(e=>!!eTt(e)&&(null==e?void 0:e.order_payment_type)!=="deposit"&&(null==e?void 0:e.type)!=="deposit")})(eO),[eO]),[eY,eW]=(0,eN.useState)({}),[eG,eQ]=(0,eN.useState)(!1),eZ=(0,eN.useMemo)(()=>!!eq&&0>=parseFloat(eq),[eq]),[eJ,eX]=(0,eN.useState)(!1),[e0,e2]=(0,eN.useState)(!1),e1=(null==I?void 0:I.enablePriceAdjust)!==!1,{runWithPermission:e4}=eK({scopeKey:(null==d?void 0:d.orderId)??(null==d?void 0:d.uuid)??R,active:c,isAvailable:()=>e1}),[e3,e8]=(0,eN.useState)(),e6=eHy(),e5=o0(()=>{var e;null==Q||null==(e=Q.info)||e.call(Q,ez.getText("pisell2.checkout.scan-blocked-by-payment"))}),e7=o0(()=>{var e;null==Q||null==(e=Q.info)||e.call(Q,ez.getText("pisell2.checkout.payment-blocked-by-scan"))}),e9=o0(()=>{if(ek.getIsPaymentProcessing()||eG)return e5(),null;if(ek.getIsScanProcessing()){var e;return null==Q||null==(e=Q.info)||e.call(Q,ez.getText("pisell2.checkout.wallet-scan-processing")),null}return ek.tryBeginScan()}),te=o0((e,t)=>{var l;let i=e_.current;!i||t&&!i.source.startsWith(t)||i.deferRelease||(i.release(),null==e6||null==(l=e6.addLog)||l.call(e6,{type:"info",title:"Kiosk checkout payment activity finished",metadata:{reason:e,source:i.source}}))}),tt=o0(e=>{var t,l,i;if("kiosk"!==ex){let e=()=>void 0;return e.isActive=()=>!0,e}if(ek.getIsScanProcessing())return e7(),null;if(ek.getIsPaymentProcessing())return null==Q||null==(l=Q.info)||l.call(Q,ez.getText("payment.processing")),null;if(eG)return null==Q||null==(i=Q.info)||i.call(Q,ez.getText("payment.processing")),null;let a=ek.tryBeginPayment();if(!a)return null;let n=!1,r=()=>{var e;if(n)return;let t=e_.current;(null==t?void 0:t.release)===r&&t.deferRelease||(n=!0,(null==(e=e_.current)?void 0:e.release)===r&&(e_.current=void 0),a())};return r.isActive=()=>{var e;return!n&&(null==(e=e_.current)?void 0:e.release)===r},e_.current={release:r,source:e},null==e6||null==(t=e6.addLog)||t.call(e6,{type:"info",title:"Kiosk checkout payment activity started",metadata:{source:e}}),r});(0,eN.useEffect)(()=>{if(!c){var e;null==(e=eS.current)||e.release(),te("modal-closed")}},[c]),(0,eN.useEffect)(()=>()=>te("component-unmounted"),[]);let tl=W("shop_currency_code")||"USD",ti=W("bookingv2_deposit")||0,ta=null==R||null==(a=R.getOtherParams)?void 0:a.call(R),tn=exa({handle:R??null,scopeKey:JSON.stringify([(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),null==ta?void 0:ta.channel,null==ta?void 0:ta.shop_id,null==ta?void 0:ta.platform,null==ta?void 0:ta.cacheId]),active:!!c,ready:!!(null==R?void 0:R.getContactInfoConfig),order:(null==R||null==(n=R.getTempOrder)?void 0:n.call(R))??null,save:e=>R.updateTempOrderContactsInfo(e)}),tr=(0,eN.useRef)(!1),to=o0(async()=>{var e,t,l;if(tr.current)return!1;tr.current=!0;try{if((null==R?void 0:R.getContactInfoConfig)&&!await tn.runtime.ensureComplete())return!1;return await (null==R||null==(e=R.ensureSalesOrderReadyForPayment)?void 0:e.call(R)),await (null==R||null==(t=R.preparePickupTimingForCheckout)?void 0:t.call(R)),!0}catch(e){return null==Q||null==(l=Q.error)||l.call(Q,e instanceof Error?e.message:String(e)),!1}finally{tr.current=!1}}),ts=(0,eN.useCallback)(async()=>{"shared"===$&&(null==R?void 0:R.clearWalletAssetSelection)?await R.clearWalletAssetSelection():await eXJ(R)},[R,$]);(0,eN.useEffect)(()=>{c||(eI.current=!1,X.current=null,eE.current="0.00",eA(void 0))},[c]);let td=(0,eN.useMemo)(()=>{var e,t;if(eI.current)return eP??null;let l=(null==D?void 0:D.display_name)||(null==D?void 0:D.name)||(null==D?void 0:D.nickname);if((null==D?void 0:D.id)||(null==D?void 0:D.customer_id)||l)return D;let i=(null==d?void 0:d.customerSnapshot)||{},a=i.id??i.customer_id??(null==d?void 0:d.customerId),n=i.display_name||i.name||(null==d?void 0:d.customerName)||"",r=i.phone||(null==d?void 0:d.customerPhone)||"",o=i.email||(null==d?void 0:d.customerEmail)||"";return a||n||r||o?{...i,id:a,customer_id:a,display_name:n,name:i.name||n,phone:r,email:o,contacts:{...i.contacts||{},email:(null==(e=i.contacts)?void 0:e.email)||o,phone:(null==(t=i.contacts)?void 0:t.phone)||r}}:D},[D,null==d?void 0:d.customerEmail,null==d?void 0:d.customerId,null==d?void 0:d.customerName,null==d?void 0:d.customerPhone,null==d?void 0:d.customerSnapshot,eP]),tc=(0,eN.useMemo)(()=>({map:eu.reduce((e,t)=>(eMH.includes(t.code)&&(e[t.code]=t),e),{}),isShow:!0}),[eu]),tu=o0(()=>{let e=eXK(R);e&&(null==M||M(e),ei(e.remainingAmount||"0"),en(e.totalAmount||"0"),et(e.remainingAmount||"0"))}),tp=o0(async e=>{let t=e.payments??await th(),l=Array.isArray(t)?t.filter(e=>{let t=null==e?void 0:e.order_payment_id;return null==t||""===t||0===t}):t;return eMy({baseSales:R,status:e.status,payments:t,sessionPayments:l,currencySymbol:(null==W?void 0:W("shop_symbol"))||void 0,changeGivenAmount:e.changeGivenAmount,orderTotalAmount:e.orderTotalAmount,failureReason:e.failureReason,taxTitle:null==W?void 0:W("tax_title"),translationOriginal:null==V?void 0:V.translationOriginal,actionButtons:e.actionButtons,autoClose:e.autoClose,autoCloseDelay:60,displayMode:P,onClose:()=>{null==h||h()}})}),tm=o0(async e=>{var t,l,i,a,n,r,o,s;let d=null==R||null==(t=R.getOrderAmountSnapshot)?void 0:t.call(R),c=(null==(l=e.syncResult)?void 0:l.isOrderFullyPaid)??(null==(i=e.syncResult)?void 0:i.isFullyPaid),m="deposit_paid"===e.resultKind?"deposit_paid":c?"paid":"partially_paid",g=eXC({paymentStatus:m,resultKind:e.resultKind,orderTotalAmount:e.orderTotalAmount??((null==d?void 0:d.expectAmount)||x),depositAmount:e.depositAmount??(null==(a=e.syncResult)?void 0:a.depositAmount)??(null==d?void 0:d.depositAmount),gapAmount:null==d?void 0:d.amountGap,changeGivenAmount:e.changeGivenAmount,failureReason:e.failureReason,isModalMode:"modal"===P});if(!g)return;let h=eXK(R),v=null==h?void 0:h.orderId,f=await tp({status:eMv(m),changeGivenAmount:e.changeGivenAmount,payments:e.paymentItems,actionButtons:null==N?void 0:N(m,!1,v),autoClose:null==(n=g.autoCloseConfig)?void 0:n.autoClose,autoCloseDelay:null==(r=g.autoCloseConfig)?void 0:r.autoCloseDelay,orderTotalAmount:g.orderTotalAmount});u({response:null==(o=e.syncResult)?void 0:o.submitResult,paymentItems:e.paymentItems,orderPrintPayload:e.orderPrintPayload,paymentResultViewModel:f,toastInfo:{status:m,amount:g.orderTotalAmount,gapAmount:g.gapAmount,depositAmount:g.depositAmount,failureReason:e.failureReason}}),("paid"===m||"deposit_paid"===e.resultKind)&&(null==(s=e.syncResult)?void 0:s.submitResult)&&p(!0,!0)}),tg=o0(e=>{var t;let l=null==e?void 0:e[e.length-1],i=null==l||null==(t=l.metadata)?void 0:t.change_given_amount;if(null==i||""===i)return;let a=Number(i);return Number.isFinite(a)?a:void 0}),th=o0(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];try{var t;let e=await Promise.resolve(null==R||null==(t=R.getOrderPayments)?void 0:t.call(R));if(Array.isArray(e))return e}catch(e){console.warn("Failed to read latest baseSales payment items:",e)}return Array.isArray(e)?e:[]}),tv=o0(async e=>{var t,l,i;let a,n,r,o=(null==e?void 0:e.response)||e,s=eXQ(o),d=(i=null==R||null==(l=R.getOrderIdentity)||null==(t=l.call(R))?void 0:t.orderId,n=(null==(a=eXQ(o))?void 0:a.payment_info)||{},(r=(null==a?void 0:a.order_id)||(null==a?void 0:a.orderId)||i)?{type:"99",data:{order_id:r,machine_code_print_info:(null==n?void 0:n.machine_code_print_info)||(null==a?void 0:a.machine_code_print_info),small_ticket_data:(null==n?void 0:n.small_ticket_data)||(null==a?void 0:a.small_ticket_data),machine_code_print_info_v2:(null==n?void 0:n.machine_code_print_info_v2)||(null==a?void 0:a.machine_code_print_info_v2)}}:null);return u({response:o,paymentItems:await th(eO),orderPrintPayload:d,toastInfo:{status:null==s?void 0:s.payment_status,amount:Number((null==s?void 0:s.total_amount)||(null==s?void 0:s.expect_amount)||0),gapAmount:Number((null==s?void 0:s.amount_gap)||0)}}),d}),tf=o0(async e=>{var t,l,i,a,n,r,o,s,d,c;let p=e.forceUseParamsPayment&&Array.isArray(e.payments)?e.payments:await th(e.payments),m=null==(t=e.syncResult)?void 0:t.submitResult;if(eX3(m)){let t=eX5(m),l=eX8(t)||ez.getText("pisell2.checkout.order-sync-failed");if(console.error(`[PaymentModal] Sales checkout backend rejected: ${l}`,eX9(m,p)),WK(),(null==I?void 0:I.keepOpenOnSyncFailure)===!0)return null==e6||null==(r=e6.addLog)||r.call(e6,{type:"error",title:"BaseSales payment sync rejected; waiting for kiosk retry",metadata:{error:l,response:t,payments:p}}),null==j||j(),null==Q||null==(o=Q.error)||o.call(Q,l),{ok:!1,syncResult:e.syncResult,response:t,message:l,kind:"backend-rejected"};if(e.rollbackPaymentIdentity&&(null==(s=R.deleteOrderPayment)||s.call(R,e.rollbackPaymentIdentity),eL(await th())),null==e6||null==(a=e6.addLog)||a.call(e6,{type:"error",title:"BaseSales payment sync rejected by backend",metadata:{error:l,response:t,payments:p}}),"page"===P){let e=await tp({status:"failed",failureReason:l,payments:p,orderTotalAmount:(null==(c=R.getOrderAmountSnapshot)||null==(d=c.call(R))?void 0:d.totalAmount)||x});u({paymentItems:p,paymentResultViewModel:e,response:t,toastInfo:{status:"failed",failureReason:l}})}return null==Q||null==(n=Q.error)||n.call(Q,l),{ok:!1,syncResult:e.syncResult,response:t,message:l,kind:"backend-rejected"}}let g=eXK(R);g&&(null==M||M(g),ei(g.remainingAmount||"0"),en(g.totalAmount||"0"),et(g.remainingAmount||"0"));let h=e.forceUseParamsPayment?p:await th(p);return eL(h),(null==(l=e.syncResult)?void 0:l.isDepositFullyPaid)&&!(null==(i=e.syncResult)?void 0:i.isOrderFullyPaid)||await tm({syncResult:e.syncResult,paymentItems:h,changeGivenAmount:e.changeGivenAmount??tg(h),orderPrintPayload:null,orderTotalAmount:e.orderTotalAmount}),{ok:!0,syncResult:e.syncResult}});(0,eN.useEffect)(()=>{let e;if("kiosk"===ex){try{let t=U(),l=t.applicationManager.get("global");e=null==l?void 0:l.runFunction("listenExternalCommand",{app:t,handler:async e=>{if("authorization_close"===e.command)return void te("authorization-closed","authorization:");if("payment_result"!==e.command)return;let t=e.params,i=e_.current;(null==i?void 0:i.source.startsWith("authorization:"))&&(i.deferRelease=!0);try{if((null==t?void 0:t.status)==="cancelled")return;let e=Array.isArray(null==t?void 0:t.payments)?t.payments:[];if(null==t?void 0:t.ok){var a,n,r;if((null==t||null==(a=t.syncResult)?void 0:a.isDepositFullyPaid)&&!(null==t||null==(n=t.syncResult)?void 0:n.isOrderFullyPaid))return;await tf({syncResult:t.syncResult,payments:e,changeGivenAmount:tg(e),forceUseParamsPayment:!0,orderTotalAmount:null==t||null==(r=t.syncResult)?void 0:r.orderExpectedAmount});return}await tb({error:(null==t?void 0:t.error)||Error(ez.getText("pisell2.checkout.order-sync-failed")),payments:e,changeGivenAmount:tg(e)})}finally{i&&e_.current===i&&(i.deferRelease=!1);try{l.runFunction("closeAuthorization")}finally{te("payment-result","authorization:")}}}})}catch(e){}return"function"==typeof e?e:void 0}},[]);let ty=o0(async e=>{var t;let l=await th(e.payments),i=eXK(R);i&&(null==M||M(i),ei(i.remainingAmount||"0"),en(i.totalAmount||"0"),et(i.remainingAmount||"0"));let a=await th(l);return eL(a),await tm({syncResult:e.syncResult,paymentItems:a,resultKind:"deposit_paid",depositAmount:e.depositAmount??(null==(t=e.syncResult)?void 0:t.depositAmount)??(null==i?void 0:i.depositAmount),changeGivenAmount:e.changeGivenAmount??tg(a),orderPrintPayload:null}),{ok:!0,syncResult:e.syncResult}}),tb=o0(async e=>{var t,l,i,a,n,r,o,s,d,c,p,m,g,h,v,f,y,b,k,_,w,S;let C,T,A,D,E=await th(e.payments),O=eX5([null==(k=e.error)||null==(_=k.response)?void 0:_.data,null==k?void 0:k.data,null==k||null==(w=k.response)?void 0:w.body,null==k?void 0:k.body].find(e=>{let t=eX5(e);return t&&"object"==typeof t&&(eX3(t)||eX8(t))})),z=!!O,L=!O&&(T=String((null==(S=e.error)?void 0:S.message)||S||"").toLowerCase(),A=String((null==S?void 0:S.code)||"").toLowerCase(),D=String((null==S?void 0:S.name)||"").toLowerCase(),["network","failed to fetch","load failed","timeout","timed out","请求超时","err_network","econnaborted","etimedout"].some(e=>T.includes(e)||A.includes(e)||D.includes(e))),$=z?eX8(O)||ez.getText("pisell2.checkout.order-sync-failed"):e.error instanceof Error?e.error.message:String(e.error);if((null==I?void 0:I.keepOpenOnSyncFailure)===!0)return WK(),null==e6||null==(s=e6.addLog)||s.call(e6,{type:"error",title:"BaseSales payment sync failed; waiting for kiosk retry",metadata:{error:$,kind:z?"backend-rejected":null==(r=e.error)?void 0:r.kind,response:O||(null==(o=e.error)?void 0:o.response),payments:E}}),null==j||j(),null==Q||null==(d=Q.error)||d.call(Q,$),{ok:!1,error:e.error,message:$,response:O,kind:z?"backend-rejected":(null==(c=e.error)?void 0:c.kind)||"unknown"};if(z?(console.error(`[PaymentModal] Sales checkout backend rejected: ${$}`,eX9(O,E)),WK()):console.error("[PaymentModal] Sales checkout submit failed",e.error),L){let t=ez.getText("pisell2.checkout.order-saved-sync-later"),l=eXK(R);l&&(null==M||M(l),ei(l.remainingAmount||"0"),en(l.totalAmount||"0"),et(l.remainingAmount||"0"));let i=await th(E);eL(i),null==e6||null==(m=e6.addLog)||m.call(e6,{type:"info",title:"BaseSales payment saved locally, backend sync deferred",metadata:{error:e.error instanceof Error?e.error.message:String(e.error),kind:(null==(p=e.error)?void 0:p.kind)||"network-deferred",payments:i}}),null==Q||null==(g=Q.info)||g.call(Q,t);let a={isFullyPaid:!0,submitResult:{deferred_sync:!0,message:t}};return await tm({syncResult:a,paymentItems:i,changeGivenAmount:e.changeGivenAmount??tg(i),failureReason:t}),{ok:!0,syncResult:a,message:t,kind:"network-deferred"}}if(e.rollbackPaymentIdentity&&(null==(h=R.deleteOrderPayment)||h.call(R,e.rollbackPaymentIdentity),eL(await th())),null==e6||null==(i=e6.addLog)||i.call(e6,{type:"error",title:"BaseSales payment sync failed",metadata:{error:$,kind:z?"backend-rejected":null==(t=e.error)?void 0:t.kind,response:O||(null==(l=e.error)?void 0:l.response),payments:E}}),!z||"page"===P){let e=eXC({paymentStatus:"failed",orderTotalAmount:(null==(f=R.getOrderAmountSnapshot)||null==(v=f.call(R))?void 0:v.totalAmount)||x,failureReason:$,isModalMode:"modal"===P});C=await tp({status:"failed",failureReason:$,actionButtons:(null==N?void 0:N("failed"))||[],autoClose:null==e||null==(y=e.autoCloseConfig)?void 0:y.autoClose,autoCloseDelay:null==e||null==(b=e.autoCloseConfig)?void 0:b.autoCloseDelay,orderTotalAmount:null==e?void 0:e.orderTotalAmount})}return"page"===P&&C&&u({error:e.error,paymentItems:E,paymentResultViewModel:C,toastInfo:{status:"failed",failureReason:$}}),null==Q||null==(a=Q.error)||a.call(Q,$),{ok:!1,error:e.error,message:$,response:O,kind:z?"backend-rejected":(null==(n=e.error)?void 0:n.kind)||"unknown"}});o0(async e=>{var t,l;if(!(null==R?void 0:R.syncPaymentsToOrder)){let e=Error("BaseSales syncPaymentsToOrder is not available");return console.error("[PaymentModal] Sales checkout submit failed",e),null==Q||null==(t=Q.error)||t.call(Q,e.message),{ok:!1,error:e,message:e.message,kind:"missing-api"}}let i=await th();try{let t=await (null==(l=R.syncPaymentsToOrder)?void 0:l.call(R,{payments:i,paymentStatus:"paid",submitWhenPaid:!0,smallTicketDataFlag:1}));if(!(null==e?void 0:e.handleResult))return{ok:!0,syncResult:t};return tf({syncResult:t,payments:i,changeGivenAmount:null==e?void 0:e.changeGivenAmount,rollbackPaymentIdentity:null==e?void 0:e.rollbackPaymentIdentity})}catch(t){if(!(null==e?void 0:e.handleResult))return{ok:!1,error:t,message:t instanceof Error?t.message:String(t),kind:(null==t?void 0:t.kind)||"unknown"};return tb({error:t,payments:i,changeGivenAmount:null==e?void 0:e.changeGivenAmount,rollbackPaymentIdentity:null==e?void 0:e.rollbackPaymentIdentity})}});let tx=o0(async()=>{var e;let t=await th();await (null==R||null==(e=R.syncPaymentsToOrder)?void 0:e.call(R,{payments:t,paymentStatus:"paid",submitWhenPaid:!0,smallTicketDataFlag:1}))});(0,eN.useEffect)(()=>{if(!(null==R?void 0:R.effectsOn)||!c)return;let e=R.effectsOn("onPaymentSyncStart",()=>{var e;eQ(!0),null==Q||null==(e=Q.loading)||e.call(Q,"",0)}),t=R.effectsOn("onPaymentSyncEnd",async e=>{var t,l,i,a,n,r;try{null==(a=window)||null==(i=a.app)||i.applicationManager.get("global").runFunction("sendCommand",{app:null==(l=window)?void 0:l.app,command:"payment_result",params:e})}catch(e){}null==Q||null==(t=Q.hide)||t.call(Q),eQ(!1);let o=Array.isArray(null==e?void 0:e.payments)?e.payments:[];if(null==e?void 0:e.ok){if((null==e||null==(n=e.syncResult)?void 0:n.isDepositFullyPaid)&&!(null==e||null==(r=e.syncResult)?void 0:r.isOrderFullyPaid))return;await tf({syncResult:e.syncResult,payments:o,changeGivenAmount:tg(o)});return}await tb({error:(null==e?void 0:e.error)||Error(ez.getText("pisell2.checkout.order-sync-failed")),payments:o,changeGivenAmount:tg(o)})}),l=R.effectsOn("onDepositPaymentSyncEnd",async e=>{var t;null==Q||null==(t=Q.hide)||t.call(Q),eQ(!1);let l=Array.isArray(null==e?void 0:e.payments)?e.payments:[];(null==e?void 0:e.ok)&&await ty({syncResult:e.syncResult,payments:l,depositAmount:null==e?void 0:e.depositAmount,changeGivenAmount:tg(l)})});return()=>{var i;null==e||e(),null==t||t(),null==l||l(),null==Q||null==(i=Q.hide)||i.call(Q),eQ(!1)}},[R,c,Q,tg,tf,ty,tb]);let tk=e=>{var t;let l,i=Number(e);return!!Number.isFinite(i)&&!!(i>0)||(l=ez.getText("pisell2.checkout.payment.invalid-positive-amount")||"Please pay an amount greater than 0",(null==Q?void 0:Q.fail)?Q.fail(l):null==Q||null==(t=Q.error)||t.call(Q,l),!1)},t_=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l=eXK(R),i=new lO(eF((null==l?void 0:l.remainingAmount)??"0")),a=new lO(e||0).minus(t||0);return!(i.lte(0)||a.lte(0)||a.gt(i.plus("0.01")))||(tu(),!1)},tw=o0(async()=>{let e=await th();return eL(e),e}),tS=o0(async function(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof(null==R?void 0:R.deleteOrderPayment))throw Error("当前订单不支持删除 EFTPOS 待确认支付项,请重启 APP 后再试");if(R.deleteOrderPayment(e),await tw(),!1===l.persistDraft)return;let i=await (null==R||null==(t=R.saveSalesOrderDraft)?void 0:t.call(R));if(eX3(i))throw Error(eX8(i)||ez.getText("pisell2.checkout.order-sync-failed")||"EFTPOS 待确认支付项保存失败,请重试")}),tj=o0(async(e,t)=>{var l,i,a,n,r,o;if(!tk(t))return null;let s="",d=!1,c=[];null==Q||null==(l=Q.loading)||l.call(Q,"",0);try{if("function"!=typeof(null==R?void 0:R.addOrderPaymentAsync)&&"function"!=typeof(null==R?void 0:R.addOrderPayment)||"function"!=typeof(null==R?void 0:R.saveSalesOrderDraft))throw Error(ez.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");c=await th();let l=await eXX(R,{amount:t,code:e.code,custom_payment_id:e.id,name:e.name,custom_payment_type:e.type,voucher_id:"",service_charge:(null==e?void 0:e.is_surcharge)&&((null==e?void 0:e.fixed)!==void 0||(null==e?void 0:e.percentage)!==void 0)?{amount:(null==e?void 0:e.fixed)||"0",percentage:(null==e?void 0:e.percentage)||"0"}:{},status:"payment_pending",metadata:{transactions:[]}});d=!0,Array.isArray(l)&&eL(l);let n=Array.isArray(l)?l[l.length-1]:void 0;if(!(s=String((null==n?void 0:n.payment_number)||"").trim()))throw Error("EFTPOS 待确认支付项缺少 payment_number,请重启 APP 后再试");let r=await (null==R||null==(i=R.saveSalesOrderDraft)?void 0:i.call(R));if(eX3(r))throw Error(eX8(r)||ez.getText("pisell2.checkout.order-sync-failed")||"EFTPOS 待确认支付项保存失败,请重试");return null==Q||null==(a=Q.hide)||a.call(Q),{paymentNumber:s,draftResult:r}}catch(t){if(d)try{s?await tS(s,{persistDraft:!1}):"function"==typeof(null==R?void 0:R.setOrderPayments)&&(R.setOrderPayments(c),await tw())}catch(e){console.error("Failed to rollback pending EFTPOS payment:",e)}let e=t instanceof Error?t.message:String(t);return null==e6||null==(n=e6.addLog)||n.call(e6,{type:"error",title:"EFTPOS pending payment draft failed",metadata:{error:e,paymentNumber:s}}),null==Q||null==(r=Q.hide)||r.call(Q),null==Q||null==(o=Q.error)||o.call(Q,e),null}}),tN=o0(async e=>{var t,l;let i=null==(t=e.transactionNumber)?void 0:t.trim();if(!i)throw Error("EFTPOS 回调缺少交易号,支付项保持待确认状态");let a={...e.updates||{},status:"paid",metadata:{...(null==(l=e.updates)?void 0:l.metadata)||{},unique_payment_number:i,transactions:[{number:i,status:"success"}]}};if("function"!=typeof(null==R?void 0:R.updateOrderPayment))throw Error("当前订单不支持更新 EFTPOS 支付状态,请重启 APP 后再试");let n=await R.updateOrderPayment(e.paymentNumber,a,{persistDraft:!0,submitWhenPaid:!0});return Array.isArray(null==n?void 0:n.payments)?eL(n.payments):await tw(),null==B||B(!0),n}),tC=o0((e,t)=>{var l,i;let a=e instanceof Error?e.message:String(e);null==e6||null==(l=e6.addLog)||l.call(e6,{type:"error",title:"EFTPOS payment update failed",metadata:{error:a,paymentNumber:t}}),null==Q||null==(i=Q.error)||i.call(Q,a)}),tM=async e=>{var t,l,i,a;let n=tt("cash");if(n)try{if(!tk(e.amount)||!await to()||!n.isActive()||!t_(e.amount,e.roundingAmount))return;let i=(null==W?void 0:W("channel"))||"pos",a=`cash-${Date.now()}-${Math.random().toString(16).slice(2)}`,r=eu.find(e=>{var t,l;return((null==(t=e.name)?void 0:t.toLowerCase().includes("cash"))||/现金|現金/i.test(e.name))&&(null==(l=e.channel_application)?void 0:l.includes(i))});eHx(e6,W,"cash-local-add",()=>({paymentChannel:ex,currentChannel:i,osKey:eb,...eHb(R),businessCode:(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),osChannel:null==ta?void 0:ta.channel,osPlatform:null==ta?void 0:ta.platform,paymentMethodId:null==r?void 0:r.id,paymentMethodCode:null==r?void 0:r.code,uniquePaymentNumber:a})),null==e6||e6.addLog({type:"info",title:"open_till",metadata:{}}),null==K||null==(l=K.utils)||null==(t=l.postMessageToApp)||t.call(l,{module:"till",key:"open_till",data:{type:"cash"}}),null==B||B(!0),await eXX(R,{amount:e.amount,code:null==r?void 0:r.code,custom_payment_id:null==r?void 0:r.id,name:null==r?void 0:r.name,custom_payment_type:null==r?void 0:r.type,voucher_id:0,rounding_amount:e.roundingAmount,metadata:{unique_payment_number:a,actual_paid_amount:e.actual_paid_amount??e.amount,change_given_amount:e.change||0}})}catch(l){let t=l instanceof Error?l.message:String(l);null==e6||null==(i=e6.addLog)||i.call(e6,{type:"error",title:"Cash payment failed",metadata:{error:t,result:e}}),null==Q||null==(a=Q.error)||a.call(Q,t)}finally{n()}},tT=e=>{if("string"==typeof e){let t=e.match(/\d+(?:\.\d+)?/);return t?t[0]:void 0}return"number"==typeof e?String(e):e},tI=(null==(o=H.appHelper.utils)||null==(r=o.getApp)?void 0:r.call(o)).getPlugin("screenProtector"),tP=async e=>{var t,l,i,a,n,r,o,s,d,c,u,m,g,h,v,f,y,b,x,k,_,w,S,j,N,C,M,T,I;let P;if(eG)return;if(eM6()){null==Q||null==(t=Q.info)||t.call(Q,ez.getText("payment.processing"));return}let A=eMW.includes((null==e?void 0:e.code)||""),D=A?eM5():null;if(A&&!D)return;let E=tt(`payment:${(null==e?void 0:e.code)||"unknown"}`);if(!E){null==D||D.release();return}let O=()=>{try{E()}finally{null==D||D.release()}};O.isActive=()=>((null==D?void 0:D.isActive())??!0)&&E.isActive();let z=!1,L=!1,$=e=>{let t;return function(){for(var l=arguments.length,i=Array(l),a=0;a<l;a++)i[a]=arguments[a];return t??(t=Promise.resolve().then(async()=>{let t=null==P?void 0:P.hold();try{await e(...i)}finally{try{null==t||t(),await (null==P?void 0:P.release())}finally{O()}}})),t}};try{let{id:t,code:T,name:I,type:A}=e||{},D=e.totalAmount??eq;if(!await to()||!O.isActive()||!t_(eq))return;let E=eMY.includes(T||""),q=eMW.includes(T||"");if(E||q){if(eS.current=P=ew(),await P.pause(),!P.isActive()||!O.isActive())return;null==R||null==(l=R.ensureOrderCreatedAt)||l.call(R);let j=q?"mx51":"eftpos",N=null==(a=H.appHelper.utils)||null==(i=a.getApp)?void 0:i.call(a),C=!!(null==H||null==(s=H.appHelper)||null==(o=s.utils)||null==(r=o.businessUtils)||null==(n=r.isPiPaymentEnabled)?void 0:n.call(r)),M=eMZ((null==e?void 0:e.code)||"",C),E=!!M;if(!E&&q){null==e6||e6.addLog({type:"info",title:"addPendingEftposPayment_start_spi",metadata:{timestamp:Date.now()}});let l=await tj(e,D);if(!l)return;let{paymentNumber:i,draftResult:a}=l;if(!P.isActive())return void await tS(i);let n=(null==R||null==(v=R.getOrderIdentity)||null==(h=v.call(R))?void 0:h.externalSaleNumber)||(null==(f=eXQ(a))?void 0:f.external_sale_number),r=null==R||null==(b=R.getOrderIdentity)||null==(y=b.call(R))?void 0:y.orderId,o=ec.current;if(!o)return void await tS(i);let s=await o.onPay(j,{isActive:()=>O.isActive()&&!!(null==P?void 0:P.isActive()),source:"normal",data:{payMethod:{id:t,code:T,name:I,type:A},params:{salesId:n,orderId:r,paymentNumber:i,symbol:W("shop_symbol"),amount:D,surcharge:tT(e.surcharge)},mode:"pay"},callback:$(async l=>{let{status:a,data:n,msg:r}=l;if((null==n?void 0:n.action)==="cancel_order"){await tS(i),p(!0);return}if("success"!==a)return;let o={amount:Number(null==n?void 0:n.amount),code:T,custom_payment_id:t,name:I,custom_payment_type:A,voucher_id:"",service_charge:{},metadata:{unique_payment_number:null==n?void 0:n.uniquePaymentNumber}};Number((null==n?void 0:n.surcharge)||0)!==Number((null==e?void 0:e.surcharge)||0)?o.service_charge={amount:(null==n?void 0:n.surcharge)||"0",percentage:"0"}:o.service_charge={amount:(null==e?void 0:e.fixed)||"0",percentage:(null==e?void 0:e.percentage)||"0"},tk(o.amount)&&(null==B||B(!0),await tN({paymentNumber:i,transactionNumber:null==n?void 0:n.uniquePaymentNumber,updates:o}))})});s||await tS(i),z=s;return}if(!E){let l=JSON.parse((null==N||null==(k=N.storage)||null==(x=k.getStorage)?void 0:x.call(k,"account"))||"{}"),i=null==R||null==(w=R.getOrderIdentity)||null==(_=w.call(R))?void 0:_.orderId;if(!i||"string"==typeof i&&i.startsWith("LOCAL_")){let e;null==Q||null==(S=Q.loading)||S.call(Q,"",0);try{e=await eX4(R)}catch(e){null==Q||Q.error(e instanceof Error?e.message:ez.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(null==e?void 0:e.success)||eX3(null==e?void 0:e.response)){null==Q||Q.error(eX8(null==e?void 0:e.response)||ez.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(i=eX6(null==e?void 0:e.response))){null==Q||Q.error(ez.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}}null==Q||Q.hide();let a=ec.current;if(!a||!P.isActive())return;z=await a.onPay(j,{isActive:()=>O.isActive()&&!!(null==P?void 0:P.isActive()),source:"normal",data:{payMethod:{id:t,code:T,name:I,type:A},params:{orderId:i,symbol:W("shop_symbol"),amount:D,surcharge:tT(e.surcharge),operator_id:null==l?void 0:l.id,operator_type:"shop",platform:ex||"pos"},mode:"pay"},callback:$(async e=>{let{status:l,data:i,msg:a}=e;if("success"!==l)return;let n={amount:D,code:T,custom_payment_id:t,name:I,custom_payment_type:A,voucher_id:"",service_charge:{percentage:null==i?void 0:i.surPercentRate,amount:null==i?void 0:i.surMoney},metadata:{unique_payment_number:null==i?void 0:i.uniquePaymentNumber,manual_marking_flag:null==i?void 0:i.manual_marking_flag}};tk(n.amount)&&(null==B||B(!0),await eXX(R,n))})});return}null==e6||e6.addLog({type:"info",title:"addPendingEftposPayment_start",metadata:{timestamp:Date.now()}});let L=await tj(e,D);if(!L)return;let{paymentNumber:V,draftResult:U}=L,Y=(null==R||null==(c=R.getOrderIdentity)||null==(d=c.call(R))?void 0:d.externalSaleNumber)||(null==(u=eXQ(U))?void 0:u.external_sale_number),G=JSON.parse((null==N||null==(g=N.storage)||null==(m=g.getStorage)?void 0:m.call(g,"account"))||"{}"),K=eMJ({baseSales:R,salesId:String(Y||""),paymentNumber:V});if(!Y||!ec.current){if(Y)await K.finalize();else throw Error("支付草稿缺少订单标识,请刷新订单后重试");return}if(!O.isActive()||!P.isActive())return void await K.finalize();null==e6||e6.addLog({type:"info",title:"addPendingEftposPayment_end",metadata:{timestamp:Date.now()}}),ec.current.openPi({provider:M,mode:"pay",amount:D,salesId:String(Y),paymentNumber:V,currency:W("shop_symbol"),deviceNumber:F,metadata:{payMethod:{id:t,code:T,name:I,type:A},symbol:W("shop_symbol"),payment_number:V},operator:{id:null==G?void 0:G.id,type:"shop"},..."kiosk"===ex?{slots:{failed:(0,eB.jsx)(eM.Button,{block:!0,type:"primary",className:"pi-payment-action-button",onClick:()=>p(!0,!1,"start-new-order"),style:{marginTop:"10px"},children:ez.getText("order.start-new-order")})}}:{},platform:ex||"pos",usageScene:eMU.includes(ex)?"merchant":"user",onChange:async e=>{if(!K.observe(e))return;let t=null==P?void 0:P.hold(),l="success"===e.type||"closed"===e.type||"printOnTimeout"===e.type;try{var i,a,n,r,o;let t=e.transactionNumber;if("printOnTimeout"===e.type){if(await eX2(R,{confirmPendingVoucherPayments:!0}),!(null==R?void 0:R.printLocalOrderReceipt))return;null==e6||null==(i=e6.addLog)||i.call(e6,{type:"info",title:"eftpos支付异常,请求本地打印小票"});try{let e=await R.printLocalOrderReceipt();null==e6||null==(a=e6.addLog)||a.call(e6,{type:"info",title:"eftpos支付异常,请求本地打印小票结果",metadata:{res:e}})}catch(e){console.error("handleButtonClick_print-receipt_error>>>>",e),null==e6||null==(n=e6.addLog)||n.call(e6,{type:"error",title:"eftpos支付异常,请求本地打印小票失败",metadata:{error:e instanceof Error?e.message:String(e)}})}p(!0),N.history.replace("/home")}if("success"===e.type||"failed"===e.type){if("success"!==e.type)return;let l=e.amount||D,i={percentage:(null==(r=e.surcharge)?void 0:r.ratePercent)?new lO(e.surcharge.ratePercent).div(100).toString():void 0,amount:null==(o=e.surcharge)?void 0:o.fixedAmount},a={amount:l,service_charge:i,service_fee:function(e,t){if(t)try{return new lO(e||0).times(t.percentage||0).plus(t.amount||0).toDecimalPlaces(2).toFixed(2)}catch{return}}(l,i),metadata:{manual_marking_flag:e.manuallyConfirmed?1:void 0,card_reader_snapshot:e.readerSnapshot}};await tN({paymentNumber:V,transactionNumber:t,updates:a});return}"closed"===e.type&&(await K.finalize(),await tw())}catch(e){tC(e,V)}finally{null==t||t(),l&&(await (null==P?void 0:P.release()),O())}}})?z=!0:(await K.finalize(),await tw())}else{await (null==tI||null==(j=tI.pauseIdleTimer)?void 0:j.call(tI)),L=!0;let t=null;if(((null==e?void 0:e.fixed)||(null==e?void 0:e.percentage))&&(t={amount:(null==e?void 0:e.fixed)||"0",percentage:(null==e?void 0:e.percentage)||"0"}),!tk(D))return;"custom"===e.type&&(null==(N=e.metadata)?void 0:N.order_open_cash_drawer)&&(null==e6||e6.addLog({type:"info",title:"open_till",metadata:{}}),null==K||null==(M=K.utils)||null==(C=M.postMessageToApp)||C.call(M,{module:"till",key:"open_till",data:{type:"cash"}})),null==B||B(!0),eHx(e6,W,"method-local-add",()=>({paymentChannel:ex,osKey:eb,...eHb(R),businessCode:(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),osChannel:null==ta?void 0:ta.channel,osPlatform:null==ta?void 0:ta.platform,paymentMethodId:e.id,paymentMethodCode:e.code,paymentMethodType:e.type})),await eXX(R,{amount:D,code:e.code,custom_payment_id:e.id,name:e.name,custom_payment_type:e.type,voucher_id:0,service_charge:t,..."custom"===e.type?{metadata:{unique_payment_number:`custom-${Date.now()}-${Math.random().toString(16).slice(2)}`}}:{}})}}catch(e){null==Q||null==(T=Q.error)||T.call(Q,e instanceof Error?e.message:String(e))}finally{if(L)try{await (null==tI||null==(I=tI.resumeIdleTimer)?void 0:I.call(tI))}catch(e){console.warn("[Payment] resume screen protector failed",e)}if(!z)try{await (null==P?void 0:P.release())}finally{O()}}};(0,eN.useEffect)(()=>{var e,t,l,i,a;if(R&&d&&c)try{null===X.current&&(eE.current=eXG(R,d));let a=eXK(R),n=(null==a?void 0:a.remainingAmount)??(null==R||null==(t=R.getOrderAmountSnapshot)||null==(e=t.call(R))?void 0:e.amountGap)??ee??"0";if(n){et(n),ei(n),en(d.totalAmount||"0");let e=null==R||null==(l=R.getTempOrderNote)?void 0:l.call(R);e?f(e):(null==s||null==(i=s.order_info)?void 0:i.order_note)&&f(s.order_info.order_note)}}catch(e){console.warn("Failed to get initial custom amount:",e)}R&&c&&Promise.resolve((null==R||null==(a=R.getOrderPayments)?void 0:a.call(R))||[]).then(e=>{eL(e)})},[R,d,c]),(0,eN.useEffect)(()=>{if(!R||!c)return void eg(!1);let e=!1;return eg(!1),R.getPaymentMethodsAsync().then(async t=>{if(e)return;let l=await eTn(t,K);if(e)return;ep(l),eg(!0);let i=t.some(e=>{var t;return"CASHMANUAL"===e.code||/现金|現金/i.test(e.name)||/cash/i.test(e.name)&&(null==(t=e.channel_application)?void 0:t.includes(ex))});ev(i),null==_||_(i),i||ey(ez.getText("pisell2.checkout.payment.select-payment")||"Select Payment")}),()=>{e=!0}},[R,K,c,_,ex]),(0,eN.useEffect)(()=>{if(eq&&R&&tl&&d&&c)try{let e;eo([e=Number(eq||0),10*Math.ceil(e/10),20*Math.ceil(e/20)].filter((e,t,l)=>e>0&&l.indexOf(e)===t))}catch(e){console.warn("Failed to get recommended amounts:",e)}},[eq,R,tl,d]);let tA=(0,eN.useCallback)(async e=>{if(R)try{et(e)}catch(e){console.error("Failed to set custom amount:",e)}},[R]),tD=(0,eN.useCallback)(async e=>{if(R)try{if(e){var t;let e=eXY(eE.current)||eXY(eXG(R,d))||eXW(null==(t=R.getOrderAmountSnapshot)?void 0:t.call(R),d);eE.current=e}X.current=e,await e0e(R,!!+!!e,eE.current),tu()}catch(e){console.error("Failed to update deposit status:",e)}},[R,tu]),tE=(0,eN.useCallback)(async e=>{if(R)try{await e0t(R,e),eE.current=e,tu()}catch(e){console.error("Failed to update deposit amount:",e)}},[R]),[tO,tz]=(0,eN.useState)(!1),tL=async e=>{if("cancel"===e)return;let t=tt("wallet-confirm");if(!t)return;let l=!0;tz(!0);try{if(!await to()||!t.isActive())return;"save-without-deduct"===e&&(l=!1,await ts());let n=l?await eX1(R):await eX2(R,{confirmPendingVoucherPayments:!1});if(n.success&&await tv(n),await (null==w?void 0:w({...n})),n.success){var i,a;let e=eXK(R),t=(null==n||null==(a=n.response)||null==(i=a.data)?void 0:i.order_id)||(null==n?void 0:n.orderId);if(null==T||T(t),(null==n?void 0:n.is_deposit)&&e&&Number(e.depositAmount)<Number(e.totalAmount)){null==M||M(e);return}p(!0)}}catch(e){console.error("Failed to submit base sales order:",e)}finally{tz(!1),t()}},tR=(0,eN.useCallback)(async e=>{if("cancel"===e||!await to())return;let t=!0;"apply-deduct-now"===e?await eXZ(R):"save-without-deduct"===e&&(t=!1,await ts()),R&&(await eX2(R,{confirmPendingVoucherPayments:t}),p(!0))},[ts,R,p,to]),t$={showCustomerModule:(null==I?void 0:I.showCustomerModule)??!0,showCustomerSelect:(null==I?void 0:I.showCustomerSelect)??!0,showWalletPass:(null==I?void 0:I.showWalletPass)??tc.isShow,showCashPayment:(null==I?void 0:I.showCashPayment)??(null==k?void 0:k.showCashPayment)??!0,showAdditionalModule:(null==I?void 0:I.showAdditionalModule)??!0,showPaymentOptions:(null==I?void 0:I.showPaymentOptions)??!0},tF=t$.showCashPayment&&eh,tq=(0,eN.useRef)();(0,eN.useEffect)(()=>{if(!c){tq.current=void 0;return}if(em)try{let e={paymentChannel:ex,dataChannel:(null==W?void 0:W("channel"))??null,osKey:eb,...eHb(R),businessCode:(null==ta?void 0:ta.businessCode)??(null==ta?void 0:ta.business_code),osChannel:null==ta?void 0:ta.channel,osPlatform:null==ta?void 0:ta.platform,showCashPayment:tF,showCustomerSelect:t$.showCustomerSelect,showPaymentType:(null==I?void 0:I.showPaymentType)!==!1,directCustomPayment:(null==I?void 0:I.directCustomPayment)===!0},t=JSON.stringify(e);if(tq.current===t)return;tq.current=t,eHx(e6,W,"ui-ready",()=>e)}catch{}});let tB=(null==I?void 0:I.paymentOptionsColumnCount)??(tF?1:2),tH="kiosk"===ex&&(eG||ek.isScanProcessing||ek.isPaymentProcessing),tV=o0(async e=>{if(eD.current)return"kiosk"!==ex?eD.current.handleSearchIdentificationCode(e):eD.current.handleSearchIdentificationCode(e,{waitForApply:!0})});(0,eN.useEffect)(()=>{let e=!1;return(async()=>{var t,l,i,a;if(!R)return e8(void 0);let n=null==(t=R.getOrderAmountSnapshot)?void 0:t.call(R),r=null==n||null==(l=n.summary)?void 0:l.product_expect_amount;try{let e=await (null==(i=R.getSummary)?void 0:i.call(R));r=(null==e?void 0:e.product_expect_amount)??(null==e||null==(a=e.summary)?void 0:a.product_expect_amount)??r}catch(e){console.error("Failed to read BaseSales summary:",e)}e||e8(r)})(),()=>{e=!0}},[R,e0,null==d?void 0:d.totalAmount,ea]);let tU=(0,eN.useMemo)(()=>Number(e3??E??(null==d?void 0:d.totalAmount)??0),[e3,E,null==d?void 0:d.totalAmount]),tY=(0,eN.useMemo)(()=>new lO(tU).minus(A||0).toNumber(),[A,tU]),tW=o0(async e=>{var t,l,i,a,n,r,o;if("shared"===$){eL((null==R||null==(t=R.getOrderPayments)?void 0:t.call(R))||[]),tu(),eD.current&&eW(eD.current.getWalletPassData(e));return}if(tc.isShow){let t=[],s=(null==R||null==(l=R.getOrderPayments)?void 0:l.call(R))||[],d=(null==(n=eD.current)||null==(a=n.getWalletPassData)||null==(i=a.call(n,e))?void 0:i.selectedWallet)||[];if(e.forEach(e=>{let l=e.code?eMV[e.code]:null;if(l&&tc.map[l]){let i=tc.map[l],a="payment_pending",n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,l=arguments.length>2?arguments[2]:void 0;return e.find(e=>(null==e?void 0:e.voucher_id)!==void 0&&0!==Number(e.voucher_id||0)&&String(e.voucher_id)===String(t)&&String(e.status||"")===String(l||""))}(s,e.voucher_id,a),r=d.find(t=>{var l;return String((null==t?void 0:t.id)??(null==t||null==(l=t.originData)?void 0:l.id))===String(e.voucher_id)}),o=(null==r?void 0:r.originData)||r||e,c=eXB({currencyAmount:e.amount,walletPassUsageUnit:e.wallet_pass_usage_unit});t.push({...n,amount:e.amount,code:null==i?void 0:i.code,id:Number(null==i?void 0:i.id)||0,name:null==i?void 0:i.name,type:null==i?void 0:i.type,status:a,custom_payment_id:Number(null==i?void 0:i.id)||0,voucher_id:e.voucher_id,wallet_pass_usage_unit:e.wallet_pass_usage_unit,wallet_pass_use_value:c,fund_record:function(e){var t,l;let{item:i,originData:a,paymentMethod:n}=e,r="point_card"===i.code||(null==a?void 0:a.tag)==="point_card"||(null==n?void 0:n.code)==="POINTCARD",o=(null==a?void 0:a.balance_par_value)??(null==a?void 0:a.balance)??(null==a?void 0:a.using_before_value)??0,s=i.wallet_pass_use_value??eXB({currencyAmount:i.amount,walletPassUsageUnit:i.wallet_pass_usage_unit}),d=r?s:i.amount,c=(()=>{try{return new lO(o||0).minus(d||0)}catch{return new lO(0)}})();return{voucher_id:i.voucher_id,wallet_pass_name:(t=(null==a?void 0:a.wallet_pass_name)||(null==a?void 0:a.format_title)||(null==a?void 0:a.product_name),l=null==n?void 0:n.name,t&&"object"==typeof t&&!eC().isValidElement(t)?t:{default:t||l||""}),code:(null==a?void 0:a.code)||i.code,encoded:null==a?void 0:a.encoded,using_before_value:eXH(o),using_after_value:eXH(c)}}({item:{...e,wallet_pass_use_value:c},originData:o,paymentMethod:i})})}}),null==e6||e6.addLog({type:"info",title:"handleSelectWalletChange BaseSales updateVoucherOrderPayments",metadata:{voucherItems:t,select:e}}),"function"!=typeof(null==R?void 0:R.updateVoucherOrderPaymentsAsync)&&"function"!=typeof(null==R?void 0:R.updateVoucherOrderPayments)){null==e6||null==(o=e6.addLog)||o.call(e6,{type:"error",title:"BaseSales updateVoucherOrderPayments is not available",metadata:{voucherItems:t,select:e}});return}await eX0(R,t,{status:"payment_pending"}),eL((null==(r=R.getOrderPayments)?void 0:r.call(R))||[]),tu(),eD.current&&eW(eD.current.getWalletPassData(e))}}),tG=o0(e=>{if(tu(),eD.current){let t=eD.current.getWalletPassData([]);eW(l=>{var i;return{...l,availableDiscountList:t.availableDiscountList,selectedDiscountList:(null==e||null==(i=e.discountList)?void 0:i.filter(e=>e.isSelected&&!e.isEditMode).map(e=>e.id))||t.selectedDiscountList}})}}),tK=async e=>{if(!e1)return void e2(!1);try{if(R&&(null==d?void 0:d.totalAmount)){var t;await (null==(t=R.updateTempOrderShopDiscount)?void 0:t.call(R,e)),null==O||O(e),await R.getSummary();let l=eXK(R);l&&(null==M||M(l),ei((null==l?void 0:l.remainingAmount)||"0"),en((null==l?void 0:l.totalAmount)||"0"),et((null==l?void 0:l.remainingAmount)||"0"))}}catch(e){console.error("Failed to adjust price:",e)}e2(!1)},tQ=o0(async()=>{var e;if(!e1)return;if(!(null==d?void 0:d.totalAmount)){null==Q||Q.fail(ez.getText("pisell2.checkout.manual-discount.no-amount"));return}let t=await Promise.resolve((null==R||null==(e=R.getOrderPayments)?void 0:e.call(R))||[]);if(null==t?void 0:t.length){null==Q||Q.fail(ez.getText("pisell2.checkout.manual-discount.has-payment-items"));return}if(0>=Number(eq)&&Number(null==d?void 0:d.totalAmount)>=0){null==Q||Q.fail(ez.getText("pisell2.checkout.manual-discount.no-amount"));return}e2(!0)}),tZ=async e=>{var t,l,i,a;switch(e){case"order-note":b(!0);break;case"send-link":eX(!0);break;case"split-payment":ed(!0);break;case"print-receipt":if(!(null==R?void 0:R.printLocalOrderReceipt))return;null==e6||null==(t=e6.addLog)||t.call(e6,{type:"info",title:"支付弹窗请求本地打印小票"});try{let e=await R.printLocalOrderReceipt();null==e6||null==(l=e6.addLog)||l.call(e6,{type:"info",title:"支付弹窗请求本地打印小票结果",metadata:{res:e}})}catch(e){console.error("handleButtonClick_print-receipt_error>>>>",e),null==e6||null==(i=e6.addLog)||i.call(e6,{type:"error",title:"支付弹窗请求本地打印小票失败",metadata:{error:e instanceof Error?e.message:String(e)}})}break;case"manual-discount":await e4("discount",tQ);break;case"save-pay-later":null==(a=J.current)||a.handleSavePayLaterClick()}};(0,eN.useImperativeHandle)(t,()=>({handleButtonClick:tZ,getSyncingLock:()=>eG,retryPaymentSync:tx}),[tZ,tx,eG]);let tJ=()=>{var e;let t=e=>null!=e&&""!==String(e).trim()?String(e).trim():null,l=t(null==td?void 0:td.display_name)||t(null==td?void 0:td.name)||ez.getText("pisell2.checkout.customer.default-name")||"Customer";return{id:(null==td?void 0:td.id)??(null==td?void 0:td.customer_id),nickname:(null==td?void 0:td.nickname)||ez.getText("pisell2.checkout.customer.default-name"),display_name:l,email:(null==td?void 0:td.email)||(null==td||null==(e=td.contacts)?void 0:e.email)||""}},tX=async e=>{var t,l,i,a,n,r,o;let s;if(!await to())return;let d=null==R||null==(l=R.getOrderIdentity)||null==(t=l.call(R))?void 0:t.orderId;await ts(),null==Q||null==(i=Q.loading)||i.call(Q,"",0);try{s=await eX4(R,{confirmPendingVoucherPayments:!1})}catch(e){null==Q||Q.error(e instanceof Error?e.message:ez.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(null==s?void 0:s.success)||eX3(null==s?void 0:s.response)){null==Q||Q.error(eX8(null==s?void 0:s.response)||ez.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}if(!(null!=(o=d=eX6(null==s?void 0:s.response)||(null==R||null==(n=R.getOrderIdentity)||null==(a=n.call(R))?void 0:a.orderId)||d)&&""!==String(o).trim()&&!("string"==typeof o&&/^LOCAL_/i.test(o.trim())))){null==Q||Q.error(ez.getText("pisell2.checkout.order-status-abnormal-restart-app")||"当前订单状态异常,请重启 APP 后再试");return}null==Q||null==(r=Q.hide)||r.call(Q);let c=await R.sendCustomerPayLink({emails:e.emails,order_ids:[d]});c.success||c.status?(null==Q||Q.success(ez.getText("pisell2.checkout.send-payment-link.success")),setTimeout(()=>{null==p||p(!0)},1e3)):null==Q||Q.error(c.message||ez.getText("pisell2.checkout.send-payment-link.error"))},t0=(0,eN.useCallback)(e=>{eI.current=!0,eA(e??null),eW({selectedWallet:[],availableDiscountList:[],selectedDiscountList:[]}),ts().then(async()=>{var e,t;"shared"===$&&await (null==R||null==(t=R.refreshWalletAssets)?void 0:t.call(R,{preserveSelection:!1})),eL((null==R||null==(e=R.getOrderPayments)?void 0:e.call(R))||[]),tu()}).catch(e=>{console.error("Failed to clear wallet pass payments:",e)});let t=eXK(R);t&&(null==M||M(t),ei(t.remainingAmount||"0"),en(t.totalAmount||"0"),et(t.remainingAmount||"0"))},[ts,R,tu,M,$]),t2=(0,eN.useMemo)(()=>({disabledSwitch:(null==I?void 0:I.disabledSwitchClient)||!!R&&eV.isCustomerChangeLocked}),[R,I,eV.isCustomerChangeLocked]),t1=(0,eN.useCallback)(async e=>{var t;return await (null==R||null==(t=R.roundAmount)?void 0:t.call(R,{amount:e}))},[R]),t4=(0,eN.useCallback)(e=>{"modal"!==P&&WG.clearAll()},[]);return(0,eB.jsxs)("div",{ref:Z,...{onClick:t4},style:{...eXA,maxHeight:S},children:[(t$.showCustomerModule||t$.showCustomerSelect||t$.showWalletPass)&&(0,eB.jsxs)("div",{style:{padding:"12px 16px",border:"1px solid #d0d5dd",borderRadius:8},children:[(t$.showCustomerModule||t$.showCustomerSelect)&&(0,eB.jsx)(eXO,{onClientChange:t0,clientInfo:td,onSearch:tV,baseSales:R,showCustomerSelect:t$.showCustomerSelect,...t2,beginScanActivity:"kiosk"===ex?e9:void 0}),t$.showWalletPass&&(0,eB.jsx)(eX_,{clientId:(null==td?void 0:td.id)??(null==td?void 0:td.customer_id),customAmount:el,orderInfo:d||void 0,ref:eD,paymentItems:eO,onSelectChange:tW,baseSales:R,onDiscountChange:tG,mode:$})]}),(0,eB.jsx)(eJ7,{amountSymbol:W("shop_symbol"),orderInfo:d||void 0,cartData:s,open_deposit:!!ti&&(null==I?void 0:I.enableDepositSwitch)!==!1,customAmount:ee,balanceDueAmount:el,paymentItems:eO,walletPassData:eY,clientInfo:D,onAmountChange:tA,onDepositStatusChange:tD,onDepositAmountChange:tE,onBalanceDueAmountClick:tZ,onConfirm:tL,confirmLoading:tO,totalAmount:x,baseSales:R,shouldUseNormalPayment:eU,enablePriceAdjust:e1,showPaymentType:(null==I?void 0:I.showPaymentType)!==!1}),(0,eB.jsxs)("div",{className:tF?"payment-grid-layout":"payment-flex-layout",children:[tF&&(0,eB.jsx)("div",{"aria-disabled":tH,style:{...tF?{gridColumn:"1",gridRow:(null==ej?void 0:ej.length)===1?"span 2":"1"}:{},...tH?{opacity:.6,pointerEvents:"none"}:{}},children:(0,eB.jsx)(eIf,{disabled:eZ,isModalOpen:c,syncingLock:eG||tH,amountSymbol:W("shop_symbol"),orderInfo:d||void 0,onPaymentComplete:tM,amountButtons:er,customAmount:eq,roundingFunction:t1,balanceDueAmount:eH,balanceDueTotalAmount:ea,shortcutsSize:(null==ej?void 0:ej.length)===3||(null==ej?void 0:ej.length)===1?"large":"default"})}),t$.showPaymentOptions&&(null==ej?void 0:ej.length)>0&&(0,eB.jsx)("div",{className:tF?"":"payment-options-module-container",style:tF?{gridColumn:"2",gridRow:(null==ej?void 0:ej.length)>3?"1 / 3":"1"}:{},children:(0,eB.jsx)(eH_,{amountSymbol:W("shop_symbol"),orderInfo:d||void 0,onClick:tP,paymentMethods:eu,customAmount:eq,title:ef,disabled:eZ||tH,showCashPayment:tF,channel:ex,columnCount:tB,sciSurchargeDisplayMap:eT,directCustomPayment:(null==I?void 0:I.directCustomPayment)===!0,isModalOpen:c,paymentMethodsReady:em,beginKioskPaymentActivity:tt,currentBaseSales:R,autoTriggerSinglePaymentOption:(null==I?void 0:I.autoTriggerSinglePaymentOption)===!0})}),t$.showAdditionalModule&&(0,eB.jsx)("div",{className:tF?"":"additional-module-container",style:tF?{gridColumn:(null==ej?void 0:ej.length)>3?"1":(null==ej?void 0:ej.length)<=1?"2":"span 2",gridRow:(null==ej?void 0:ej.length)===0?"1":"2"}:{},children:(0,eB.jsx)(eXS,{orderInfo:d||void 0,customAmount:eq,handleButtonClick:tZ,hasOrderNote:!!v&&v.trim().length>0,disabled:eZ,showCashPayment:tF,isFullWidth:!((null==ej?void 0:ej.length)>3||(null==ej?void 0:ej.length)<=1),showMore:!(tF&&(null==ej?void 0:ej.length)===0)})})]}),(0,eB.jsx)(eM4,{ref:ec,baseSales:R,dynamicMaxHeight:S,isWebPos:!0}),eJ&&(0,eB.jsx)(eJ1,{balanceAmount:ee,customerEmail:tJ().email,customerName:tJ().display_name||tJ().nickname,customerId:tJ().id,onClose:()=>eX(!1),sendPaymentLink:tX}),e1&&(0,eB.jsx)(dq,{containerProps:{wrapClassName:"pisell-modal-mask-pointer-events-auto",renderType:"modal",open:e0,onCancel:()=>e2(!1)},tips:ez.getText("pisell2.checkout.modal.price-adjustment-tips")||"Changing amount will update order total",selectType:"dark",originalValue:tU,defaultValue:tY,resetText:ez.getText("pisell2.checkout.modal.reset-price-adjustment"),onEnter:tK}),tn.editor,(0,eB.jsx)(eJ9,{ref:J,amountSymbol:W("shop_symbol"),walletPassData:eY,onSavePayLater:tR}),(0,eB.jsx)(eCG,{containerProps:{wrapClassName:"pisell-modal-mask-pointer-events-auto",renderType:"modal",open:es,onCancel:()=>ed(!1)},paymentOriginalValue:eH,paymentDefaultValue:String(eq||0),enableExceedMaxAmount:!1,payment:{enable:!0},surcharge:{enable:!1},surchargeDefaultValue:{percent:"0",fixed:"0"},selectType:"light",onChange:e=>{},doneText:ez.getText("confirm")||"确认",onPay:e=>{ed(!1);let t=Number(e.amount);if(!Number.isFinite(t)||t<=0){var l;null==Q||null==(l=Q.error)||l.call(Q,ez.getText("pisell2.checkout.split-payment.invalid-positive-amount"));return}tA(String(t))}})]})}),e0i=e=>{var t,l,i,a,n,r,o,s;let{open:d,baseSales:c,baseSalesModuleName:u,walletPassMode:p="legacy",data:m,callback:g,onClose:h,onSetLocalOrderId:v,setEditCartMode:f,editOrderId:y,paymentResultDisplayMode:b,shopDiscount:x,client:k,currentTotalPrice:_,onChangeShopDiscount:w,onChangeOrderNote:S,onDeleteOrderNote:j,variant:N,config:C={showHeaderCenter:!0,showHeaderRightButton:!0}}=e,M=eR();sZ(WU,(null==(n=M.appHelper.utils)||null==(a=n.getApp)||null==(i=a.call(n))||null==(l=i.locales)||null==(t=l.getLocale)?void 0:t.call(l))||(null==(o=M.appHelper.utils)||null==(r=o.storage)?void 0:r.get("umi_locale"))||"en");let{getApp:T,pisellos:I,getData:P,interaction:A,isWebPos:D}=(null==M||null==(s=M.appHelper)?void 0:s.utils)||{},E=function(e){let{baseSales:t,pisellos:l,baseSalesModuleName:i}=e,[a,n]=(0,eN.useState)(0),r=(0,eN.useMemo)(()=>{var e;return t||i&&(null==l||null==(e=l.getModule)?void 0:e.call(l,i))||null},[i,l,t,a]),o=(0,eN.useMemo)(()=>eXz(()=>{var e;return(null==r||null==(e=r.getOrderSnapshot)?void 0:e.call(r))||null},null),[r,a]),s=o.value,d=(0,eN.useMemo)(()=>eXz(()=>{var e;return(null==r||null==(e=r.getOrderAmountSnapshot)?void 0:e.call(r))||(null==s?void 0:s.amount)||null},null),[r,s,a]),c=d.value,u=(0,eN.useMemo)(()=>eXz(()=>{var e,t;return(null==r||null==(e=r.getOrderPayments)?void 0:e.call(r))||(null==s||null==(t=s.tempOrder)?void 0:t.payments)||[]},[]),[r,s,a]),p=u.value,m=(0,eN.useCallback)(()=>{n(e=>e+1)},[]),g=o.error||d.error||u.error||(i&&!r?Error(`BaseSales module not found: ${i}`):null),h=(0,eN.useMemo)(()=>(function(e,t){var l,i,a,n,r,o,s;if(!e&&!t)return null;let d=(null==e?void 0:e.identity)||{},c=t||(null==e?void 0:e.amount)||{},u=(null==e?void 0:e.tempOrder)||{},p=(null==u||null==(l=u._extend)?void 0:l.customerSnapshot)||(null==u?void 0:u.customer)||(null==e?void 0:e.customer)||null,m=u.customer_id??(null==p?void 0:p.id)??(null==p?void 0:p.customer_id)??(null==e||null==(i=e.customer)?void 0:i.customerId),g=(null==p?void 0:p.display_name)||(null==p?void 0:p.name)||u.customer_name||(null==e||null==(a=e.customer)?void 0:a.customerName)||"";return{orderId:d.orderId||d.externalSaleNumber||d.orderNumber,status:null==e?void 0:e.status,...ePC(c,u),paymentStatus:null==e?void 0:e.paymentStatus,itemCount:(null==e?void 0:e.productCount)||(null==e||null==(r=e.tempOrder)||null==(n=r.products)?void 0:n.length)||0,hasLocalOrderData:!!(null==e?void 0:e.tempOrder),customerId:m,customerName:g,customerPhone:(null==p?void 0:p.phone)||u.phone||(null==e||null==(o=e.customer)?void 0:o.phone)||"",customerEmail:(null==p?void 0:p.email)||u.email||(null==e||null==(s=e.customer)?void 0:s.email)||"",customerSnapshot:p}})(s,c),[s,c]);return{baseSales:r,orderSnapshot:s,amountSnapshot:c,paymentItems:p,orderInfo:h,error:g,refresh:m}}({baseSales:c,pisellos:I,baseSalesModuleName:u}),O=E.baseSales,z=!!u,[L,R]=(0,eN.useState)(null);(0,eN.useRef)(!1);let[$,F]=(0,eN.useState)(""),[q,B]=(0,eN.useState)([]),H=(0,eN.useRef)(!1),V=(0,eN.useRef)(null),[U,Y]=(0,eN.useState)(0),W=(0,eN.useMemo)(()=>Number((null==L?void 0:L.totalAmount)??U??0),[null==L?void 0:L.totalAmount,U]),[G,K]=(0,eN.useState)(!0),[Q,Z]=(0,eN.useState)(0),[J,X]=(0,eN.useState)(!1),[ee,et]=(0,eN.useState)(!1),[el,ei]=(0,eN.useState)(!1),[ea,en]=(0,eN.useState)(y||0),er=(0,nB.useToast)(),eo=dJ(),es=eC().useRef(null);(0,eN.useEffect)(()=>{if(z){if(E.error){var e;null==er||null==(e=er.error)||e.call(er,E.error.message);return}if(E.orderInfo){let e=Number(E.orderInfo.totalAmount||0);R(e=>{var t,l,i,a;return(null==e?void 0:e.orderId)===(null==(t=E.orderInfo)?void 0:t.orderId)&&(null==e?void 0:e.totalAmount)===(null==(l=E.orderInfo)?void 0:l.totalAmount)&&(null==e?void 0:e.remainingAmount)===(null==(i=E.orderInfo)?void 0:i.remainingAmount)&&(null==e?void 0:e.paymentStatus)===(null==(a=E.orderInfo)?void 0:a.paymentStatus)?e:E.orderInfo}),Y(t=>t===e?t:e)}}},[z,E.error,E.orderInfo,er]);let ed=async()=>{if(!ee){et(!0);try{var e,t;await (null==(t=eA.current)||null==(e=t.retryPaymentSync)?void 0:e.call(t))}catch(e){console.error("PaymentModal retry payment sync failed",e)}finally{et(!1)}}};(0,eN.useEffect)(()=>{let e=()=>{"u">typeof window&&Z(window.innerHeight)};return e(),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}},[]),(0,eN.useEffect)(()=>{var e;let t=async()=>{try{var e,t;let l=await (null==A||null==(t=A.utils)||null==(e=t.asyncDataManager)?void 0:e.call(t,{module:"get",key:"till_button"}));l&&WG.setTillButton(l)}catch(e){console.error("PaymentModal: Failed to get till_button from asyncDataManager:",e)}};(null==A||null==(e=A.utils)?void 0:e.asyncDataManager)&&t()},[A]),(0,eN.useEffect)(()=>{!d||H.current||V.current||(V.current=(async()=>{try{let e=await eTr(A);if(F(e),!e)return;let t=await eTo();B(t),H.current=!0}catch(e){console.warn("Failed to load checkout card readers:",e)}finally{V.current=null}})())},[A,d]);let ec=(0,eN.useMemo)(()=>"smallTablet"===N||"tablet"===N?{width:"98%",heightRatio:.98}:{width:880,heightRatio:.9},[N]),[eu,ep]=(0,eN.useState)(!1),em=(0,eN.useMemo)(()=>{if(0===Q)return"600px";let e=getComputedStyle(document.body).transform,t=1;return"none"!==e&&(t=new DOMMatrix(e).d),`${Math.floor(Q*ec.heightRatio/t)}px`},[Q,ec.heightRatio]),eg="phone"===N,eh=(0,eN.useMemo)(()=>"unset",[Q]),ev={showCashPayment:!0},ef=(0,eN.useCallback)(e=>{K(e)},[]),[ey,eb]=(0,eN.useState)(!1),[ex,ek]=(0,eN.useState)(""),[e_,ew]=(0,eN.useState)("payment-content"),eS=async e=>{var t,l,i,a;if("payment-result-toast"===e_){null==O||null==(l=O.getOrderIdentity)||null==(t=l.call(O))||t.orderId,O&&(null==(i=O.updateTempOrderNote)||i.call(O,e),ek(e),null==er||er.success(ez.getText("pisell2.checkout.order-note.updated-successfully"))),eb(!1),ew("payment-content");return}try{O&&(await (null==(a=O.updateTempOrderNote)?void 0:a.call(O,e)),ek(e),null==er||er.success(ez.getText("pisell2.checkout.order-note.updated-successfully"))),null==S||S(e)}catch(e){console.error("Failed to update order note:",e),null==er||er.error(ez.getText("pisell2.checkout.order-note.update-failed"))}eb(!1),ew("payment-content")},ej=async()=>{try{if(O){var e;await (null==(e=O.updateTempOrderNote)?void 0:e.call(O,"")),ek(""),null==er||er.success(ez.getText("pisell2.checkout.order-note.deleted-successfully"))}null==j||j()}catch(e){console.error("Failed to delete order note:",e),null==er||er.error(ez.getText("pisell2.checkout.order-note.delete-failed"))}eb(!1),ew("payment-content")},eT=(0,eN.useRef)(!1),eI=eC().useRef(!1),eP=eC().useRef(null),eA=eC().useRef(null),eD=()=>{try{var e;let t=(null==O||null==(e=O.getTempOrderNote)?void 0:e.call(O))||"";ek(t)}catch(e){console.warn("Failed to get temp order note:",e)}ew("payment-result-toast"),eb(!0)},eE=(e,t)=>{let l=eZ(),i=ez.formatLocale(l);try{let t=WU[i],l=null==t?void 0:t[e];if(l)return l}catch(e){console.error("本地语言包访问错误:",e)}return ez.getText(e)||t},eO=e=>{var t,l,i;let a={...es.current||{},...e||{}};if(es.current=a,(null==e?void 0:e.orderPrintPayload)&&(eP.current=e.orderPrintPayload),"page"===b&&(null==a||null==(t=a.paymentResultViewModel)?void 0:t.status)==="failed"&&!eI.current){eI.current=!0;let e=null==O||null==(i=O.getOrderIdentity)||null==(l=i.call(O))?void 0:l.orderId;null==h||h(!1,{order_id:e,event:{type:"modal-close",status:"failed",reason:"sync-failed",orderId:e,reset:!1,shouldRefreshOrder:!1,shouldCloseCaller:!1,payload:{order_id:e,paymentResult:a},isChangePaymentNotIncludeVoucher:eu}})}},eL=()=>{null==g||g({type:"toast-close",isCallbackFromToast:!0,shouldRefreshOrder:!1,shouldCloseCaller:!1,isChangePaymentNotIncludeVoucher:eu})},e$=async(e,t,l)=>{var i,a,n,r,o;let s=(null==(a=eA.current)||null==(i=a.getSyncingLock)?void 0:i.call(a))||!1;if(s&&!t){null==eq||eq.addLog({type:"warning",title:"订单正在同步中,用户点击取消",metadata:{isSyncingLocked:s}});return}let d=null==O||null==(r=O.getOrderIdentity)||null==(n=r.call(O))?void 0:n.orderId,c="start-new-order"===l?Q2({type:"modal-close",status:"cancelled",reason:"start-new-order",orderId:(o={orderId:d,payload:{order_id:d,paymentResult:es.current},isChangePaymentNotIncludeVoucher:eu}).orderId,reset:!0,payload:o.payload,shouldRefreshOrder:!0,shouldCloseCaller:!0,isChangePaymentNotIncludeVoucher:o.isChangePaymentNotIncludeVoucher}):void 0;null==g||g(c||{status:"cancelled",order_id:d}),null==h||h(e||!1,{order_id:d,paymentResult:es.current,...c?{event:c}:{}})},eF=o0(async()=>{var e,t,l,i,a;let n=(null==(t=eA.current)||null==(e=t.getSyncingLock)?void 0:e.call(t))||!1;if(n){null==eq||eq.addLog({type:"warning",title:"订单正在同步中,用户点击返回",metadata:{isSyncingLocked:n}});return}let r=null==O||null==(i=O.getOrderIdentity)||null==(l=i.call(O))?void 0:l.orderId;"shared"!==p&&await eXJ(O);let o=((null==O||null==(a=O.getOrderPayments)?void 0:a.call(O))||[]).some(e=>!!eTt(e)&&0===Number((null==e?void 0:e.voucher_id)||0)),s=!!("shared"!==p&&o&&r);null==g||g({status:"cancelled",source:"back",reason:"back",order_id:r,shouldRefreshOrder:s,isChangePaymentNotIncludeVoucher:eu}),null==h||h(!1,{order_id:r,event:{type:"modal-close",status:"cancelled",reason:"back",orderId:r,order_id:r,reset:!1,shouldRefreshOrder:s,shouldCloseCaller:!1,payload:{order_id:r},isChangePaymentNotIncludeVoucher:eu}})});(0,eN.useEffect)(()=>{var e;(null==m||null==(e=m.order_info)?void 0:e.order_note)&&ek(m.order_info.order_note)},[m]);let eq=eHy(),eH=null==eq?void 0:eq.addLog,eV=(0,eN.useCallback)(()=>{var e;null==eq||null==(e=eq.storeLog)||e.call(eq,!0)},[null==eq?void 0:eq.storeLog]);(0,eN.useEffect)(()=>{var e;if(!d||"u"<typeof window||"u"<typeof document)return;let t=`checkout-layout-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,l=0,i=e=>{let t=document.querySelector(e);if(!t)return null;let l=t.getBoundingClientRect();return{width:Number(l.width.toFixed(2)),height:Number(l.height.toFixed(2)),top:Number(l.top.toFixed(2)),left:Number(l.left.toFixed(2)),right:Number(l.right.toFixed(2)),bottom:Number(l.bottom.toFixed(2))}},a=function(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=Date.now();if(a||!(n-l<120)){l=n;try{let l=document.querySelector(".payment-modal-modal"),a=document.querySelector(".payment-modal-wrapper"),r=window.getComputedStyle(document.body),o=l?window.getComputedStyle(l):null,s=a?window.getComputedStyle(a):null,d=window.visualViewport;null==eH||eH({type:"info",title:"Checkout modal layout diagnostic",metadata:{sessionId:t,reason:e,timestamp:new Date(n).toISOString(),variant:N,configuredWidth:ec.width,window:{innerWidth:window.innerWidth,innerHeight:window.innerHeight,documentClientWidth:document.documentElement.clientWidth,documentClientHeight:document.documentElement.clientHeight,devicePixelRatio:window.devicePixelRatio},visualViewport:d?{width:d.width,height:d.height,scale:d.scale,offsetLeft:d.offsetLeft,offsetTop:d.offsetTop}:null,body:{transform:r.transform,zoom:r.zoom},modalWrapper:{rect:i(".payment-modal-modal"),width:(null==o?void 0:o.width)??null,maxWidth:(null==o?void 0:o.maxWidth)??null,transform:(null==o?void 0:o.transform)??null},floatingRoot:{rect:i(".payment-modal-wrapper"),width:(null==s?void 0:s.width)??null,height:(null==s?void 0:s.height)??null}}}),eV()}catch(e){console.warn("Failed to record checkout modal layout diagnostic",e)}}},n=()=>a("viewport-change"),r=new MutationObserver(()=>a("body-mutation"));r.observe(document.body,{attributes:!0,attributeFilter:["style","class"]}),a("modal-open",!0);let o=window.requestAnimationFrame(()=>a("next-frame",!0)),s=window.setTimeout(()=>a("startup-settled",!0),500);return window.addEventListener("resize",n),window.addEventListener("orientationchange",n),null==(e=window.visualViewport)||e.addEventListener("resize",n),()=>{var e;window.cancelAnimationFrame(o),window.clearTimeout(s),window.removeEventListener("resize",n),window.removeEventListener("orientationchange",n),null==(e=window.visualViewport)||e.removeEventListener("resize",n),r.disconnect(),a("modal-close",!0)}},[eH,ec.width,eV,d,N]);let eU=(0,eN.useRef)(void 0),eY=(0,eN.useRef)(void 0);(0,eN.useEffect)(()=>{(async()=>{try{if(O){eU.current=!0;let e=await eTa(A);O.setOtherParams({is_price_include_tax:P("is_price_include_tax")??1,tax_rate:P("tax_rate"),surcharge_list:P("surcharge_list"),currency_format:P("currency_format"),tax_title:P("tax_title")||"GST",tax_country_code:P("tax_country_code"),currency_code:P("shop_currency_code"),currency_symbol:P("shop_symbol"),order_rounding_setting:P("order_rounding_setting"),shop_wallet_pass_id:e,business_code:eo});let t=eXK(O);t&&t.totalAmount&&Y(Number(t.totalAmount||0)),R(t)}else if(eU.current){var e,t,l;eU.current=!1,await (null==O||null==(e=O.restoreOrder)?void 0:e.call(O)),y||ea?await (null==O||null==(t=O.saveDraft)?void 0:t.call(O)):(null==eq||eq.addLog({type:"info",title:"含有 localOrderCreate, 保存 BaseSales 草稿",metadata:{data:m}}),await (null==O||null==(l=O.saveDraft)?void 0:l.call(O)));let i=eXK(O);i&&i.totalAmount&&Y(Number(i.totalAmount||0)),R(i),eU.current=!0}else throw Error("pisellos is not available")}catch(t){console.error("Failed to initialize checkout data:",t);let e=window.location.hostname;null==eq||eq.addLog({type:"error",title:`${e}: Failed to initialize checkout data`,metadata:{error:null==t?void 0:t.message}}),ei(!0)}})()},[]),(0,eN.useEffect)(()=>()=>{if("function"==typeof eY.current){var e;null==(e=eY.current)||e.call(eY),eY.current=void 0}},[]);let eW={context:M,pisellos:I,getData:P,interaction:A,Toast:er,onToastClose:eL,paymentResultDisplayMode:b,onResultViewModel:e=>{eO({paymentResultViewModel:e})}},eG=function(e){var t,l,i;let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0,r=e=>`payment-result-toast-${e}`,{isTerminal:o,isWebPos:s,NativePage:d}=null==(t=M.appHelper)?void 0:t.utils,c=n??(null==O||null==(i=O.getOrderIdentity)||null==(l=i.call(O))?void 0:l.orderId),u=()=>{WK()},p=async()=>{var e,t,l;setTimeout(()=>{u()},0),null==(l=M.appHelper)||null==(t=l.utils)||null==(e=t.action)||e.call(t,{type:"pisell1.handleOpenSaleDetail",data:{osKey:"big-sale-detail",osProps:{orderId:c}},callback:()=>{}})},m=async()=>{var e,t;if(setTimeout(()=>{u()},0),null==O?void 0:O.printLocalOrderReceipt){null==(e=eq.addLog)||e.call(eq,{type:"info",title:"支付结果弹窗请求本地打印小票"});try{let e=await O.printLocalOrderReceipt(c);null==(t=eq.addLog)||t.call(eq,{type:"info",title:"支付结果弹窗请求本地打印小票结果",metadata:{res:e}})}catch(e){console.error("handleButtonClick_print-receipt_error>>>>",e),null==er||er.error(e instanceof Error?e.message:String(e))}}},g=()=>{setTimeout(()=>{u()},0),ez.getText("payment.result.actions.orderNoteClicked"),eD&&eD()},h=()=>{ez.getText("payment.result.actions.refundClicked")};switch(e){case"paid":case"partially_paid":return[[a?{id:"details",buttonProps:{className:r("action-button"),onClick:p,icon:(0,eB.jsx)(GI,{className:r("action-icon")}),children:ez.getText("payment.result.details")}}:{id:"print",buttonProps:{className:r("action-button"),onClick:m,icon:(0,eB.jsx)(GA,{className:r("action-icon")}),children:ez.getText("payment.result.printReceipt")}},{id:"more",isMore:!0,menuData:[{key:"orderNote",label:ez.getText("payment.result.orderNote"),icon:(0,eB.jsx)(eIY,{className:r("menu-icon")}),onClick:g},a?{key:"print",label:ez.getText("payment.result.printReceipt"),icon:(0,eB.jsx)(GA,{className:r("action-icon")}),onClick:m}:{key:"details",label:ez.getText("payment.result.details"),icon:(0,eB.jsx)(GI,{className:r("action-icon")}),onClick:p}],buttonProps:{className:r("action-button"),icon:(0,eB.jsx)(oh,{className:r("action-icon")})}}]];case"failed":return[[{id:"retry",buttonProps:{className:r("action-button retry-button"),onClick:()=>{ez.getText("payment.result.actions.retryClicked")},icon:(0,eB.jsx)(eXP,{className:r("action-icon")}),children:ez.getText("payment.result.retry")}},{id:"changePayment",buttonProps:{className:r("action-button change-payment-button"),onClick:()=>{ez.getText("payment.result.actions.changePaymentClicked")},icon:(0,eB.jsx)(eiS,{className:r("action-icon")}),children:ez.getText("payment.result.changePayment")}},{id:"more",isMore:!0,menuData:[{key:"orderNote",label:ez.getText("payment.result.orderNote"),icon:(0,eB.jsx)(eIY,{className:r("menu-icon")}),onClick:g},{key:"refund",label:ez.getText("payment.result.refund"),icon:(0,eB.jsx)(oS,{className:r("menu-icon")}),onClick:h}],buttonProps:{className:r("action-button"),icon:(0,eB.jsx)(oh,{className:r("action-icon")})}}]];case"wallet-pass-failed":return[[{id:"savePartial",buttonProps:{className:r("action-button primary-button"),onClick:()=>{var e;null==(e=eA.current)||e.handleButtonClick("save-pay-later")},children:ez.getText("payment.result.saveAsPartialPaid")}},{id:"continuePayment",buttonProps:{className:r("action-button primary-button"),onClick:()=>{ez.getText("payment.result.actions.continuePaymentClicked"),u()},children:ez.getText("payment.result.continuePayment")}},{id:"more",isMore:!0,menuData:[{key:"details",label:ez.getText("payment.result.details"),icon:(0,eB.jsx)(GI,{className:r("menu-icon")}),onClick:p},{key:"print",label:ez.getText("payment.result.printReceipt"),icon:(0,eB.jsx)(GA,{className:r("menu-icon")}),onClick:m},{key:"orderNote",label:ez.getText("payment.result.orderNote"),icon:(0,eB.jsx)(eIY,{className:r("menu-icon")}),onClick:g},{key:"refund",label:ez.getText("payment.result.refund"),icon:(0,eB.jsx)(oS,{className:r("menu-icon")}),onClick:h}],buttonProps:{className:r("action-button"),icon:(0,eB.jsx)(oh,{className:r("action-icon")})}}]];default:return[]}},eK=async e=>{var t,l,i;let a,n=null==(t=e.response)?void 0:t.data,r=null==n?void 0:n.payment_status,o=Number((null==n?void 0:n.total_amount)||(null==n?void 0:n.expect_amount)||0),s=Number((null==n?void 0:n.amount_gap)||0),d={autoClose:(a=eXj[eXN(r,void 0)||"paid"]).autoClose,autoCloseDelay:30,maskClosable:a.maskClosable},c=(null==n?void 0:n.order_id)??(null==n?void 0:n.orderId)??(null==(l=e.response)?void 0:l.order_id)??(null==(i=e.response)?void 0:i.orderId),u=eG?eG(r,!1,c):[];return eXT({paymentStatus:r,orderTotalAmount:o,gapAmount:s,autoCloseConfig:d,actionButtons:u},eW)};return(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)(oq,{renderType:eg?"drawer":"modal",showHandlerBar:eg,props:eg?{open:d,placement:"bottom",header:!1,footer:!1,destroyOnClose:!0,height:"95vh",closable:!1,onClose:()=>{e$(!1)},maskClosable:!0,styles:{body:{padding:0,overflow:"hidden"}},className:"payment-mobile-modal"}:{open:d,onCancel:()=>{eF()},title:(0,eB.jsx)(()=>(0,eB.jsxs)("div",{className:"payment-modal-custom-header",children:[(0,eB.jsx)("div",{className:"header__left",children:(0,eB.jsx)(eM.Button,{icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-arrow-left",size:24}),size:"small",type:"text",onClick:eF})}),(null==C?void 0:C.showHeaderCenter)&&(0,eB.jsxs)("div",{className:"header__center",children:[eE("order.total"),":",eXM(W,P("shop_symbol"))]}),(null==C?void 0:C.showHeaderRightButton)&&(0,eB.jsx)("div",{className:"header__right",children:(0,eB.jsx)(eM.Button,{size:"small",type:"link",onClick:()=>e$(!0,!1,"start-new-order"),children:ez.getText("order.start-new-order")})})]}),{}),width:ec.width,className:`payment-modal-modal ${"smallTablet"===N||"tablet"===N?"payment-modal-modal-responsive":""}`,destroyOnClose:!1,maskClosable:!1,footer:null,closeIcon:!1,wrapClassName:`payment-modal-wrapper ${!G?"no-cash-payment":""}`,size:"large",style:{height:"auto",maxHeight:"98%"},bodyStyle:{maxHeight:"100%",overflowY:"auto",padding:0,display:"flex",flexDirection:"column"}},children:eg?(0,eB.jsxs)("div",{className:"payment-mobile-modal-panel",children:[(0,eB.jsx)("div",{className:"payment-mobile-modal-header",children:(0,eB.jsxs)("div",{style:eXR,children:[(0,eB.jsx)(eM.Button,{icon:(0,eB.jsx)(nB.Icon,{type:"pisell2-arrow-left",size:20}),size:"small",type:"text",style:eX$,onClick:eF}),(null==C?void 0:C.showHeaderCenter)!==!1?(0,eB.jsxs)("div",{style:eXF,children:[eE("order.total")||"Order Total",":"," ",eXM(W,P("shop_symbol"))]}):(0,eB.jsx)("div",{}),(null==C?void 0:C.showHeaderRightButton)!==!1?(0,eB.jsx)(eM.Button,{size:"small",type:"link",style:eXq,onClick:()=>e$(!0,!1,"start-new-order"),children:ez.getText("order.start-new-order")||"New Order"}):(0,eB.jsx)("div",{style:eXq})]})}),(0,eB.jsx)("div",{className:"payment-mobile-modal-content",style:{height:"100%"},children:(0,eB.jsx)(e0l,{ref:eA,isModalOpen:d,cartData:(0,ni.cloneDeep)(m),orderInfo:L||void 0,onPaymentComplete:eO,onPaymentCancel:e$,onStatusChange:()=>{},paymentResultDisplayMode:b,shopDiscount:x,client:k,currentTotalPrice:_,onChangeShopDiscount:w,onChangeOrderNote:S,onDeleteOrderNote:j,showingCashToastRef:eT,onToastClose:eL,orderNote:ex,setOrderNote:ek,setNoteModalSource:ew,setNoteModalOpen:eb,totalAmount:W,moduleConfig:ev,onShowCashPaymentChange:ef,showSuccessToast:eK,dynamicMaxHeight:eh,onOrderSyncFailed:()=>X(!0),generateActionButtons:eG,paymentResultToastConfig:eW,updateOrderInfo:e=>R(e),setCurrentEditOrderId:e=>en(e),baseSales:O,walletPassMode:p,config:C,cardReaderDeviceNumber:$,cardReaders:q,setIsChangePaymentNotIncludeVoucher:ep})})]}):(0,eB.jsx)(e0l,{ref:eA,isModalOpen:d,cartData:(0,ni.cloneDeep)(m),orderInfo:L||void 0,onPaymentComplete:eO,onPaymentCancel:e$,onStatusChange:()=>{},paymentResultDisplayMode:b,shopDiscount:x,client:k,currentTotalPrice:_,onChangeShopDiscount:w,onChangeOrderNote:S,onDeleteOrderNote:j,showingCashToastRef:eT,onToastClose:eL,orderNote:ex,setOrderNote:ek,setNoteModalSource:ew,setNoteModalOpen:eb,totalAmount:W,moduleConfig:ev,onShowCashPaymentChange:ef,showSuccessToast:eK,dynamicMaxHeight:em,onOrderSyncFailed:()=>X(!0),generateActionButtons:eG,paymentResultToastConfig:eW,updateOrderInfo:e=>R(e),setCurrentEditOrderId:e=>en(e),baseSales:O,walletPassMode:p,config:C,cardReaderDeviceNumber:$,cardReaders:q,setIsChangePaymentNotIncludeVoucher:ep})}),ey&&(0,oj.createPortal)((0,eB.jsx)("div",{children:(0,eB.jsx)(dM,{open:ey,title:ez.getText("pisell2.text.add-order-notes"),value:ex,onConfirm:eS,onDelete:ej,onCancel:()=>{eb(!1),ew("payment-content")}})}),document.body),(0,eB.jsx)(nB.PisellContainer,{renderType:"modal",props:{open:J,title:ez.getText("pisell2.checkout.tips"),footer:null,keyboard:!1,maskClosable:!1,closable:!1,onCancel:()=>{}},children:(0,eB.jsxs)("div",{style:{textAlign:"center",padding:"20px"},children:[(0,eB.jsx)("div",{style:{marginBottom:"16px",fontSize:"16px"},children:ez.getText("pisell2.checkout.sync-retry-hint")||"请点击重试按钮重新同步订单"}),(0,eB.jsx)(eM.Button,{type:"primary",size:"large",onClick:ed,loading:ee,disabled:ee,style:{width:"100%",marginTop:"80px"},children:ez.getText("retry")||"重试"})]})}),(0,eB.jsx)(nB.PisellContainer,{renderType:"modal",props:{open:el,title:ez.getText("pisell2.checkout.tips"),footer:null,keyboard:!1,onCancel:()=>{ei(!1)}},children:(0,eB.jsxs)("div",{style:{textAlign:"center",padding:"20px"},children:[(0,eB.jsx)("div",{style:{marginBottom:"16px",fontSize:"16px"},children:ez.getText("pisell2.checkout.order-create-failed")}),(0,eB.jsx)(eM.Button,{type:"primary",size:"large",onClick:()=>{ei(!1),window.location.reload()},style:{width:"100%",marginTop:"80px"},children:ez.getText("confirm")||"确认"})]})})]})};e0i.displayName="PaymentModal";let e0a=oW(e0i);function e0n(e){let t=new Set,l=(e,i)=>{if("string"==typeof e)return"[object Object]"===e.trim()?"":e.trim();if(!e||"object"!=typeof e||i>8||t.has(e))return"";if(t.add(e),Array.isArray(e))return e.map(e=>l(e,i+1)).filter(Boolean).join("\n");for(let t of["response","data","body","message","msg","error","errors","statusText"]){let a=l(e[t],i+1);if(a)return a}return""};return l(e,0)}let e0r=e=>e&&"object"==typeof e&&!Array.isArray(e)?e:{},e0o=e=>{if("number"!=typeof e&&"string"!=typeof e||""===String(e).trim())return null;let t=eHE(e);return null!==t&&t>=0?t:null},e0s=function(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];for(let e of t){let t=e0o(e);if(null!==t)return t}return null},e0d=e=>!0===e||1===e||"1"===e||!1!==e&&0!==e&&"0"!==e&&void 0,e0c={en:{"pisell2.venue-kiosk.checkout.failed":"Checkout could not be completed. Please try again.","pisell2.venue-kiosk.checkout.reset-failed":"Could not start the next order. Please try again.","pisell2.venue-kiosk.checkout.result-missing":"The payment result could not be displayed. Continue paying this order.","pisell2.venue-kiosk.checkout.order-reference":"Order","pisell2.venue-kiosk.checkout.continue-payment":"Continue payment"},"zh-CN":{"pisell2.venue-kiosk.checkout.failed":"结账未完成,请重试。","pisell2.venue-kiosk.checkout.reset-failed":"暂时无法开始下一单,请重试。","pisell2.venue-kiosk.checkout.result-missing":"暂时无法显示支付结果,请继续处理当前订单。","pisell2.venue-kiosk.checkout.order-reference":"订单","pisell2.venue-kiosk.checkout.continue-payment":"继续支付"}},e0u=e=>{let t=String(e??"").trim();return/^\d+$/.test(t)&&Number(t)>0?t:void 0},e0p=e=>{var t;return(null==e||null==(t=e._extend)?void 0:t.localId)||(null==e?void 0:e.external_sale_number)||(null==e?void 0:e.order_id)||e},e0m=0,e0g=e=>{var t,l,i;let a=(null==(l=e.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.sales.tempOrder;return(null==a||null==(i=a._extend)?void 0:i.localId)||(null==a?void 0:a.external_sale_number)||(null==a?void 0:a.order_id)||a},e0h=new Set(["id","product_id","product_variant_id","product_option_item_id","option_group_item_id","option_group_id","group_id","bundle_id","bundle_group_id","bundle_product_id","_bundle_product_id","bundle_variant_id","variant_id","quantity","num"]),e0v=e=>"string"==typeof e||"number"==typeof e&&Number.isFinite(e),e0f=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(e)?e.map(e=>{let l={};if(!e||"object"!=typeof e)throw Error("Invalid saved Party configuration.");for(let[t,i]of Object.entries(e))e0h.has(t)&&e0v(i)&&(l[t]=i);return!t&&Array.isArray(e.option)&&(l.option=e0f(e.option,!0)),l}):[]},e0y=(e,t)=>Object.entries(e||{}).reduce((e,l)=>{let[i,a]=l;return!["__proto__","constructor","prototype"].includes(i)&&(!t||t.includes(i))&&e0v(a)&&(e[i]=a),e},{}),e0b=e=>e0y(e,["scheduleId","timeSlotId","ruleId","source","label"]);function e0x(e){let t=null==e?void 0:e.candidate;return{...t?{candidate:{key:t.key,productId:t.productId,source:t.source,date:t.date,businessDate:t.businessDate,startAt:t.startAt,endAt:t.endAt,startTime:t.startTime,endTime:t.endTime,bookingStartAt:t.bookingStartAt,bookingEndAt:t.bookingEndAt,timezone:t.timezone,scheduleRefs:(t.scheduleRefs||[]).map(e0b),...t.primaryScheduleRef?{primaryScheduleRef:e0b(t.primaryScheduleRef)}:{}}}:{},requirementSelections:((null==e?void 0:e.requirementSelections)||[]).map(e=>({...null!=e.requirementGroupId?{requirementGroupId:e.requirementGroupId}:{},...null!=e.formId?{formId:e.formId}:{},resourceIds:e.resourceIds.filter(e0v)}))}}function e0k(e,t){let l=Number(e.detail.id??e.detail.product_id),i=e.configuration.skuValue,a=e.quantity??1;if(!Number.isSafeInteger(l)||l<=0||!Number.isSafeInteger(a)||a<=0||Number(i.product_id)!==l||!Number.isSafeInteger(Number(i.product_variant_id??0)))throw Error("Invalid saved Party configuration.");let n=e.configuration.variantDraft;return{version:1,productId:l,phase:t,quantity:a,...e.lineUid?{lineUid:e.lineUid}:{},configuration:{skuValue:{product_id:l,product_variant_id:Number(i.product_variant_id??0),..."string"==typeof i.product_option_string?{product_option_string:i.product_option_string}:{},option:e0f(i.option),bundle:e0f(i.bundle)},variantDraft:n?{productId:n.productId,selectionKey:n.selectionKey,items:e0y(n.items||{}),productOptionString:n.productOptionString}:null},selection:e0x(e.initialSelection)}}function e0_(e,t){var l,i,a;let n=["string"==typeof e?e:void 0,null==e?void 0:e.message,null==e||null==(i=e.response)||null==(l=i.data)?void 0:l.message,null==e||null==(a=e.data)?void 0:a.message].find(e=>"string"==typeof e&&!!e.trim()&&"[object Object]"!==e.trim());return(null==n?void 0:n.trim())||t}let e0w=e=>Array.isArray(e)?e:[],e0S=(e,t)=>null!=e&&null!=t&&String(e)===String(t),e0j=e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??"")},e0N=e=>!!e&&"object"==typeof e&&[0,1,"0","1"].includes(e.has_deposit);function e0C(e,t,l,i){if(!e||Number(e.order_id||0)>0)return[];let a=e0w(e.products);return(0,ni.flatMap)(a,n=>{var r,o,s,d,c,u,p;let m=null==(r=n.metadata)?void 0:r.venue_booking_role,g="tickets"===m||"party_main"===m?l:"tickets_extra"===m||"party_extra"===m?i:void 0,h=e0j(n);if(!g||!h||(null==(o=n.metadata)?void 0:o.venue_booking_scope_key)!==t||Number(n.order_detail_id||0)>0||1!==a.filter(e=>e0j(e)===h).length)return[];let v=n._origin??(null==(u=e._extend)||null==(c=u.productsByUid)||null==(d=c[e0j(n)])?void 0:d.origin)??(null==(p=n.metadata)?void 0:p.origin)??{};if(null!=(n.custom_deposit_data??v.custom_deposit_data??(null==(s=v.product)?void 0:s.custom_deposit_data)))return[];let f=g.filter(e=>e0S(e.id,n.product_id));if(1!==f.length||!e0N(f[0].custom_deposit_data))return[];let y=f[0],b=Number(n.product_variant_id||0),x=e0w(y.variant).filter(e=>e0S(e.id,b));if(b>0&&1!==x.length)return[];let k={...v,custom_deposit_data:(0,ni.cloneDeep)(y.custom_deposit_data)};if(b>0&&e0N(x[0].custom_deposit_data)){let e=e0w(v.variant),t=e.find(e=>e0S(e.id,b));k.variant=t?e.map(e=>e!==t||null!=e.custom_deposit_data?e:{...e,custom_deposit_data:(0,ni.cloneDeep)(x[0].custom_deposit_data)}):[...e,{id:x[0].id,custom_deposit_data:(0,ni.cloneDeep)(x[0].custom_deposit_data)}]}let _=!1,w=e0w(n.product_bundle).map(e=>{let t,l,i,a,n;if(null!=e.custom_deposit_data)return e;let r=(t=e.bundle_group_id??e.group_id,l=e.bundle_id??e.id,i=e.bundle_product_id??e._bundle_product_id??e.product_id,a=e.bundle_variant_id??e.product_variant_id??e.variant_id??0,1===(n=(0,ni.flatMap)(e0w(y.bundle_group).filter(e=>null==t||e0S(e.id,t)),e=>e0w(e.bundle_item)).filter(e=>null!=l&&e0S(e.id??e.bundle_id,l)&&(null==i||e0S(e.bundle_product_id??e._bundle_product_id??e.product_id,i))&&e0S(e.bundle_variant_id??e.product_variant_id??e.variant_id??0,a))).length?n[0]:void 0);return e0N(null==r?void 0:r.custom_deposit_data)?(_=!0,{...e,custom_deposit_data:(0,ni.cloneDeep)(r.custom_deposit_data)}):e});return[{product_id:Number(n.product_id),product_variant_id:b,unique_identification_number:h,updates:{_origin:k,..._?{product_bundle:w}:{}}}]})}let e0M=(e,t)=>{var l,i;return e.os===t.os&&e.scopeKey===t.scopeKey&&e.order===t.os.getTempOrder()&&e.identity===eKA(t.os.getTempOrder())&&e.customer===String((null==(l=t.os.getTempOrder())?void 0:l.customer_id)||"")&&0>=Number((null==(i=t.os.getTempOrder())?void 0:i.order_id)||0)},e0T=e=>({customer:e.customer_id,bookings:e.bookings,holder:e.holder_relations,products:e0w(e.products).filter(e=>{var t;return!(null==(t=e.metadata)?void 0:t._giftInfo)}).map(e=>{var t,l;return{uid:e0j(e),product:e.product_id,variant:e.product_variant_id,num:e.num,sku:ia({product_id:Number(e.product_id),product_variant_id:Number(e.product_variant_id||0),option:exP(e),bundle:e.product_bundle||[]}),note:e.note,remark:e.remark,scope:null==(t=e.metadata)?void 0:t.venue_booking_scope_key,role:null==(l=e.metadata)?void 0:l.venue_booking_role}})});function e0I(e,t){let l=eKP(Number(e.id)),{value:i}=R0(io(l.skuValue,e,{overSold:t}).value,e,{overSold:t});if(i===l.skuValue)return l;let a=is(i,e);return{...l,skuValue:i_(a,e,l.skuValue)}}function e0P(e){var t,l,i,a,n,r,o,s,d,c,u,p,m,g,h,v,f,y;let b,x,k,_,w,S,j=eR(),N=eKa(),C=exp(),M=Uu(),T=function(){var e;let t=(null==(e=eKn())?void 0:e.layout)==="compact",[l,i]=(0,eN.useState)(()=>"u">typeof window&&window.matchMedia("(max-width: 700px)").matches),[a,n]=(0,eN.useState)(!1);return(0,eN.useEffect)(()=>{let e=window.matchMedia("(max-width: 700px)"),l=()=>{i(e.matches),e.matches||t||n(!1)};return l(),e.addEventListener("change",l),()=>e.removeEventListener("change",l)},[t]),{isMobile:t||l,open:a,show:()=>n(!0),close:()=>n(!1),closeThen:e=>{if(!a)return e();n(!1),requestAnimationFrame(e)}}}(),I=eKB(),{mode:P,context:A,config:D,scopeKey:E,variant:O="desktop"}=e,{sales:z,cart:L}=A,R=z.bookingTicket,$=eKE(R),F=String(e.locale).startsWith("zh")?"zh":"en",q=(e,t)=>"zh"===F?t:e,B=eKD((null==(t=R.otherParams)?void 0:t.businessTimezone)||(null==j||null==(a=j.appHelper)||null==(i=a.utils)||null==(l=i.getData)?void 0:l.call(i,"timezone"))),H=(0,eN.useRef)({date:B,step:"select"}),[V,U]=(0,eN.useState)(H.current.date),[Y,W]=(0,eN.useState)(()=>{let e=eQN(H.current.date,eQ_(F));return Array.from({length:7},(t,l)=>eQj(e,l)).filter(e=>e>=B)}),[G,K]=(0,eN.useState)("select"),[Q,Z]=(0,eN.useState)(!1),[J,X]=(0,eN.useState)(),ee=(0,eN.useRef)(),[et,el]=(0,eN.useState)("date"),[ei,ea]=(0,eN.useState)(),[en,er]=(0,eN.useState)(),[eo,es]=(0,eN.useState)(),[ed,ec]=(0,eN.useState)(),[eu,ep]=(0,eN.useState)(),[em,eg]=(0,eN.useState)(!1),[eh,ev]=(0,eN.useState)(),[ef,ey]=(0,eN.useState)(!1),[eb,ex]=(0,eN.useState)(),[ek,e_]=(0,eN.useState)(),[eS,ej]=(0,eN.useState)(!1),[eC,eT]=(0,eN.useState)(!1),[eI,eP]=(0,eN.useState)(0),[eA,eD]=(0,eN.useState)(),[eE,eO]=(0,eN.useState)(!1),[eL,e$]=(0,eN.useState)(!1),eq=(0,eN.useRef)(!1),eB=(0,eN.useRef)(()=>!1),eH=(0,eN.useRef)(async()=>{}),eV=(0,eN.useRef)(async()=>!1),eU=(0,eN.useRef)(0),eY=(0,eN.useRef)(0),eW=(0,eN.useRef)(!0),eG=(0,eN.useRef)(),eK=(0,eN.useCallback)(e=>(eG.current=e,()=>{eG.current===e&&(eG.current=void 0)}),[]),eQ=(0,eN.useRef)(null);(0,eN.useEffect)(()=>(eW.current=!0,()=>{eW.current=!1,eU.current++}),[]);let eZ=D.steps[P].catalog,eJ=$?(null==(r=R.getTempOrder)||null==(n=r.call(R))?void 0:n.customer_id)??(null==(o=L.tempOrder)?void 0:o.customer_id)??void 0:(null==(s=A.customer.selected)?void 0:s.id)??(null==(d=L.tempOrder)?void 0:d.customer_id)??void 0,eX=async()=>{await L.recalcSummary(),L.refreshCartSnapshot()},e0=async()=>{await eX(),eW.current&&eP(e=>e+1)},e2=function(e){var t,l;let{source:i,enabled:a,scopeKey:n,create:r,refresh:o,initialState:s,customerMode:d="web",persistDraft:c=!0,retire:u,canRetire:p,waitForRetire:m}=e,g=eZ8(i),h=null==(t=i.otherParams)?void 0:t.businessCode,v=c&&g?`pisell:venue-booking:v2:${JSON.stringify([n,g])}`:void 0,f=()=>({ready:!1,restored:!1,pendingOrder:!1,state:s}),[y,b]=(0,eN.useState)(()=>({value:f()})),x=(0,eN.useRef)(),k=(0,eN.useRef)({create:r,refresh:o,initialState:s,retire:u,canRetire:p,waitForRetire:m});k.current={create:r,refresh:o,initialState:s,retire:u,canRetire:p,waitForRetire:m},(0,eN.useEffect)(()=>{if(!a||!i)return;let e=eZ3.get(i);e||(e={tail:Promise.resolve(),hasSession:!1},eZ3.set(i,e));let t=e,l=t.owner;if(!(null==l?void 0:l.active)||l.scopeKey!==n||l.cacheId!==g){let e;(null==l?void 0:l.active)&&eJe(l);let a=k.current,r=!!v&&!t.hasSession&&(()=>{try{var e;return"u">typeof performance&&(null==(e=performance.getEntriesByType("navigation")[0])?void 0:e.type)==="reload"}catch{return!1}})()&&!eZ1.has(v);t.hasSession=!0,v&&eZ1.add(v);try{let t=v?JSON.parse(sessionStorage.getItem(v)||"null"):null;v&&(null==t?void 0:t.version)===2&&t.scopeKey===n&&t.cacheId===g&&"status"in t&&"submission-pending"===t.status?sessionStorage.removeItem(v):(r&&(e=t),v&&!r&&sessionStorage.removeItem(v))}catch{}t.owner=l={source:i,scopeKey:n,cacheId:g,storageKey:v,refs:0,releaseVersion:0,active:!0,order:null,sessionId:`${Date.now()}:${++eZ4}`,discarded:!1,lastState:a.initialState,retireOrder:a.retire,canRetire:a.canRetire,waitForRetire:a.waitForRetire,value:{ready:!1,restored:!1,pendingOrder:!1,state:a.initialState},listeners:new Set};let o=l,s=()=>t.owner===o&&o.active&&o.refs>0,c=e=>{s()&&(o.order=i.getTempOrder(),o.lastState=e.state,o.value=e,eZ9(o))};t.tail=t.tail.then(async()=>{if(!s())return;if(t.orderOwner=o,t.orderSessionId=o.sessionId,eZ7(i.getTempOrder()))return void c({ready:!0,restored:!1,pendingOrder:!0,state:a.initialState});if("kiosk"!==d&&("function"!=typeof i.syncAuthenticatedOrderCustomer||"function"!=typeof i.clearOrderCustomer))throw Error("This booking service version cannot safely synchronize the signed-in customer. Please update the service before continuing.");if(await a.create(),!s())return;if(eZ7(i.getTempOrder()))return void c({ready:!0,restored:!1,pendingOrder:!0,state:a.initialState});let l=!1,r=a.initialState;if((null==e?void 0:e.version)===2&&e.scopeKey===n&&e.cacheId===g&&e.order&&!eZ7(e.order)&&Array.isArray(e.order.products)&&Object.prototype.hasOwnProperty.call(e,"state")){if(await i.replaceTempOrder(e.order,{persist:!1,recalculateSummary:!1}),!s())return;l=!0,r=e.state}let u=e=>{var t,l;return String((null==e?void 0:e.customer_id)||(null==e||null==(l=e._extend)||null==(t=l.customerSnapshot)?void 0:t.id)||"")},p=u(i.getTempOrder());if("kiosk"!==d){let e=await i.syncAuthenticatedOrderCustomer();if(!s())return;if(!1===e)i.clearOrderCustomer();else if(!0!==e)throw Error("The booking service did not confirm customer synchronization. Please reload before continuing.")}if(!s())return;let m=i.getTempOrder();if(p!==u(m)&&Array.isArray(null==m?void 0:m.payments)&&m.payments.some(eZ5)){if("function"!=typeof i.clearWalletAssetSelection)throw Error("This booking service version cannot clear the previous customer’s wallet selection. Please update the service before continuing.");if(await i.clearWalletAssetSelection(),!s())return}await a.refresh(),s()&&c({ready:!0,restored:l,pendingOrder:eZ7(i.getTempOrder()),state:r})}).catch(e=>{s()&&(o.value={...o.value,ready:!1,error:e instanceof Error?e.message:String(e)},eZ9(o))})}let r=l;r.refs+=1,r.releaseVersion+=1,x.current=r;let o=!0,s=()=>{o&&b({record:r,value:r.value})};return r.listeners.add(s),s(),()=>{o=!1,r.listeners.delete(s),r.refs-=1,x.current===r&&(x.current=void 0);let e=++r.releaseVersion;"kiosk"===d&&r.retireOrder&&r.canRetire&&eJt(r,t,r.sessionId,r.canRetire,!0).catch(()=>{}),Promise.resolve().then(()=>{var l;0===r.refs&&r.releaseVersion===e&&(eJe(r),t.owner!==r||(null==(l=r.submittedFinish)?void 0:l.pending)||(t.owner=void 0))})}},[i,a,n,g,v,d]);let _=y.record,w=null==_?void 0:_.sessionId,S=a&&(null==_?void 0:_.source)===i&&_.scopeKey===n&&_.cacheId===g&&_.active&&(null==(l=eZ3.get(i))?void 0:l.owner)===_,j=S?y.value:f(),N=e=>{if(e.storageKey&&(e=>{if(!e.storageKey)return!1;try{var t;return(null==(t=JSON.parse(sessionStorage.getItem(e.storageKey)||"null"))?void 0:t.sessionId)===e.sessionId}catch{return!1}})(e))try{sessionStorage.removeItem(e.storageKey)}catch{}};return{...j,sessionId:S?_.sessionId:void 0,save:e=>{var t;if(!S||!_||x.current!==_||!_.active||(null==(t=eZ3.get(i))?void 0:t.owner)!==_||_.sessionId!==w||_.retiring||!_.value.ready||_.value.pendingOrder||_.discarded)return;let l=i.getTempOrder();if(!l||eZ7(l)){try{v&&sessionStorage.removeItem(v)}catch{}return}if(l===_.order&&(_.lastState=e,v&&g))try{sessionStorage.setItem(v,JSON.stringify({version:2,scopeKey:n,cacheId:g,sessionId:_.sessionId,order:l,state:e}))}catch{}},discard:e=>{_&&_.sessionId===w&&(_.discarded=!0,N(_))},restart:()=>{let e=eZ3.get(i);if(!S||!_||!e||x.current!==_||!_.active||_.refs<=0||e.owner!==_||_.sessionId!==w||_.retiring)return Promise.resolve(!1);if(_.restarting)return _.restarting;let t=k.current,l=_.sessionId,a=()=>x.current===_&&e.owner===_&&_.active&&_.refs>0&&_.sessionId===l,n=e=>{a()&&(_.order=i.getTempOrder(),_.lastState=e.state,_.value=e,eZ9(_))},r=e.tail.then(async()=>{if(!a())return!1;if(e.orderOwner=_,e.orderSessionId=l,"kiosk"!==d&&("function"!=typeof i.syncAuthenticatedOrderCustomer||"function"!=typeof i.clearOrderCustomer))throw Error("This booking service version cannot safely synchronize the signed-in customer. Please update the service before continuing.");if(N(_),n({ready:!1,restored:!1,pendingOrder:!1,state:t.initialState}),await t.create(),!a())return!1;if(eZ7(i.getTempOrder()))return n({ready:!0,restored:!1,pendingOrder:!0,state:t.initialState}),!1;if("kiosk"!==d){let e=await i.syncAuthenticatedOrderCustomer();if(!a())return!1;if(!1===e)i.clearOrderCustomer();else if(!0!==e)throw Error("The booking service did not confirm customer synchronization. Please reload before continuing.")}return!!a()&&(await t.refresh(),!!a()&&(_.order=i.getTempOrder(),_.lastState=t.initialState,_.discarded=!1,_.sessionId=`${Date.now()}:${++eZ4}`,e.orderSessionId=_.sessionId,_.value={ready:!0,restored:!1,pendingOrder:eZ7(_.order),state:t.initialState},eZ9(_),!_.value.pendingOrder))}).catch(e=>{if(!a())return!1;throw _.value={..._.value,ready:!1,error:e instanceof Error?e.message:String(e)},eZ9(_),e});_.restarting=r;let o=()=>{_.restarting===r&&(_.restarting=void 0)};return e.tail=r.then(o,o),r},retire:function(){let{canRetire:e=()=>!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=eZ3.get(i);return"kiosk"===d&&_&&t&&_.source===i&&_.sessionId===w&&e()&&(t.owner===_||t.orderOwner===_)?eJt(_,t,w,e):Promise.resolve(!1)},ownsSession:()=>{let e=eZ3.get(i);return!!_&&_.source===i&&_.sessionId===w&&!!e&&(e.owner===_||!e.owner&&e.orderOwner===_&&e.orderSessionId===w)},finishSubmitted:e=>{let t=eZ3.get(i),l=String(e??"").trim();if(!_||!t||!w||!eZ6(l)||_.source!==i||_.sessionId!==w||_.scopeKey!==n||_.cacheId!==g)return Promise.resolve(!1);let a=_.submittedFinish;if((null==a?void 0:a.orderId)===l&&a.sessionId===w)return a.promise;let r=i.getTempOrder(),o=()=>{var e;return eZ3.get(i)===t&&t.owner===_&&_.source===i&&_.sessionId===w&&_.scopeKey===n&&_.cacheId===g&&eZ8(i)===g&&(null==(e=i.otherParams)?void 0:e.businessCode)===h&&i.getTempOrder()===r&&String((null==r?void 0:r.order_id)??"").trim()===l};if(!r||!o())return Promise.resolve(!1);let s=k.current,d=t.tail.then(async()=>{var e;if(!o())return!1;if("function"!=typeof i.restoreOrder)throw Error("This booking service cannot safely reset the submitted order.");return _.discarded=!0,N(_),await i.restoreOrder(),t.owner===_&&_.active&&_.refs>0&&_.sessionId===w&&eZ8(i)===g&&(null==(e=i.otherParams)?void 0:e.businessCode)===h&&await s.refresh(),!0}),c={orderId:l,sessionId:w,pending:!0,promise:d};_.submittedFinish=c;let u=()=>{c.pending=!1,t.owner!==_||_.active||0!==_.refs||(t.owner=void 0)};return t.tail=d.then(u,u),d}}}({source:R,enabled:eB.current()||!1!==e.isActive&&"pending"!==z.catalogState,scopeKey:E,create:async()=>(await z.clearCartAndReset(),z.createNew()),refresh:e0,initialState:H.current,customerMode:$?"kiosk":"web",persistDraft:!$,canRetire:()=>!eB.current(),waitForRetire:()=>eH.current(),retire:$?async()=>{var e;await z.clearCartAndReset(),await eX(),null==(e=R.clearSessionStorageOrderSnapshot)||e.call(R)}:void 0}),e1=(f={mode:P,os:R,sessionId:e2.sessionId,date:V,step:G},b=Rt(),(x=(0,eN.useRef)({input:f,logger:b})).current={input:f,logger:b},(k=(0,eN.useRef)()).current||(_=(y={readContext:()=>x.current.input,getLogger:()=>x.current.logger}).flowId,w=0,S=0,k.current={capture(){try{var e,t;let l,i,a=y.readContext(),n=y.getLogger(),r=(e=>{if(!e)return{};try{let t=new URL(e);if(!t.host)return{};let l=eZM(t.searchParams.get("cacheId"))||eZM(t.searchParams.get("cache_id"));t.username="",t.password="",t.hash="";let i=[];return t.searchParams.forEach((e,t)=>i.push(t)),i.forEach(e=>{eZT.has(e.toLowerCase())||t.searchParams.set(e,"[redacted]")}),{pageUrl:t.href,pagePath:t.pathname,pageHost:t.host,urlCacheId:l}}catch{return{}}})((y.getPageUrl||(()=>"u"<typeof window?void 0:window.location.href))()),o=a.os,s={};try{s=(null==o?void 0:o.otherParams)||{}}catch{}let d=eZM(s.cacheId);try{d=eZM(null==o||null==(e=o.getCacheId)?void 0:e.call(o))||d}catch{}try{let e=null==o||null==(t=o.getTempOrder)?void 0:t.call(o);l=eZM(null==e?void 0:e.order_id),i=eZM(null==e?void 0:e.external_sale_number)}catch{}_||(_=(()=>{try{if("u">typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();if("u">typeof crypto&&"function"==typeof crypto.getRandomValues)return Array.from(crypto.getRandomValues(new Uint32Array(4)),e=>e.toString(16).padStart(8,"0")).join("")}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`})());let c=Object.freeze({source:"materials",layer:"ui",module:"venueBookingSales",category:"business",template:a.mode,templateId:"tickets"===a.mode?"ticketing_1":"party_1",...r,cacheId:r.urlCacheId||d,osCacheId:d,materialSessionId:eZM(a.sessionId),flowId:_,operationId:`${_}:${++w}`,date:eZM(a.date),step:eZM(a.step),platform:eZM(s.platform),businessCode:eZM(s.businessCode??s.business_code),shopId:eZM(s.shopId),orderId:l,externalSaleNumber:i});return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"info";try{if("function"!=typeof(null==n?void 0:n.addLog))return;let i=n.addLog({type:l,title:`[VenueBookingSales][${c.template}] ${e}`,metadata:{...c,action:e,eventSequence:++S,payload:{...t}}});i&&"function"==typeof i.then&&Promise.resolve(i).catch(()=>{})}catch{}}}catch{return eZN}}}),k.current),e4=(0,eN.useCallback)(()=>{if(eW.current&&"party"===P){var e;e1.capture()("product_confirmed"),null==(e=eG.current)||e.call(eG)}},[P,e1]),e3=(0,eN.useRef)(),[e8,e6]=(0,eN.useState)(),e5=!!e2.sessionId&&e8===e2.sessionId;(0,eN.useEffect)(()=>{var e,t,l,i,a;if(!e2.ready||!e2.sessionId||e3.current===e2.sessionId)return;e3.current&&(++eU.current,ea(void 0),er(void 0),es(void 0),ec(void 0),ep(void 0),eg(!1),el("date"),eD(void 0),eO(!1),ev(void 0),e_(void 0),ej(!1),eT(!1),ey(!1),e$(!1),eq.current=!1,T.close()),e3.current=e2.sessionId;let n=e2.state;U(n&&/^\d{4}-\d{2}-\d{2}$/.test(n.date)?n.date:H.current.date),Z(!1),"party"===P&&e2.restored&&(null==n?void 0:n.partyPreview)?(ec({value:n.partyPreview,attempt:0}),Z(!0)):((null==(e=R.getTempOrder())?void 0:e.bookings)||[]).length&&Z(!0);let r=eJY(R.getTempOrder(),{mode:P,scopeKey:E,date:null==n?void 0:n.date}),o=eJK(A,E);K((a={savedStep:null==n?void 0:n.step,restored:e2.restored,canResume:!e2.pendingOrder&&!("party"===P&&(null==n?void 0:n.partyPreview))&&!!((null==n?void 0:n.date)&&/^\d{4}-\d{2}-\d{2}$/.test(n.date)&&n.date>=B)&&r.bindings.length>0&&0===r.issues.length&&r.bindings.every(e=>e.date===(null==n?void 0:n.date)),holderRequired:o.required,holderComplete:o.complete,hasExtras:!!(null==(t=D.steps.extras)?void 0:t.catalog.menuListIds.length)||eJM((null==(l=R.getTempOrder())?void 0:l.products)||[],{mode:P,scopeKey:E,parentLineUid:null==(i=r.bindings[0])?void 0:i.productLineUid}).length>0}).restored&&a.canResume&&"string"==typeof a.savedStep&&["holder","extras","review"].includes(a.savedStep)?a.holderRequired&&!a.holderComplete?"holder":"holder"===a.savedStep?a.holderRequired?"holder":a.hasExtras?"extras":"review":"extras"===a.savedStep&&a.hasExtras?"extras":"review":"select"),e6(e2.sessionId)},[e2.ready,e2.sessionId,e2.state]);let e7="party"!==P?void 0:(null==en?void 0:en.partyDraft)?e0k({...en.partyDraft,configuration:en.configuration},"configuration"):ei?(null==eo?void 0:eo.key)===ei.key?eo.value:e0k(ei,"booking"):void 0,e9=(null==ed?void 0:ed.value)||e7,te=JSON.stringify(e9),tt=JSON.stringify((null==(c=z.tempOrder)?void 0:c.contacts_info)??null);(0,eN.useEffect)(()=>{e5&&e2.save({date:V,step:G,...e9?{partyPreview:e9}:{}})},[e2.ready,e2.sessionId,e5,ed,V,G,L.tempOrder,eI,te,tt]);let tl=e2.ready&&e5&&!ed&&!e2.pendingOrder&&!1!==e.isActive&&!eL,ti=(0,eN.useRef)();(0,eN.useEffect)(()=>{let e=ti.current;tl&&(!e||e.sessionId!==e2.sessionId||e.step!==G)&&(ti.current={sessionId:e2.sessionId,step:G},e1.capture()("step_entered",{step:G,restored:e2.restored}))},[tl,G,e2.sessionId,e2.restored,e1]);let ta=JSON.stringify(z.salesSettings??null,(e,t)=>!t||"object"!=typeof t||Array.isArray(t)?t:Object.fromEntries(Object.keys(t).sort().map(e=>[e,t[e]]))),tn=(0,eN.useMemo)(()=>{var e;let t;return e={ensureSalesSettings:z.ensureSalesSettings,getPlatform:()=>{var e;return z.salesSettingsPlatform||(null==(e=R.otherParams)?void 0:e.platform)}},async l=>{let i=t||(t=Promise.resolve().then(()=>e.ensureSalesSettings()));try{let t=await i;if(!t)throw Error("The booking sales settings are unavailable.");let a={source:"picoding",settings:t,platform:e.getPlatform()};return{requiredOptionValidation:t.product.checkRequiredOptions,overSold:1===iP({productOverSold:l.over_sold,runtimePolicy:a}),runtimePolicy:a}}finally{t===i&&(t=void 0)}}},[z.ensureSalesSettings,ta,z.salesSettingsPlatform,R,E]),tr=eJx({os:R,scopeKey:E,sessionId:e2.sessionId,menuListIds:eZ.menuListIds,poolRole:"main"}),to=eJx({os:R,scopeKey:`${E}:extras`,sessionId:e2.sessionId,menuListIds:(null==(u=D.steps.extras)?void 0:u.catalog.menuListIds)||[],poolRole:"extras"}),ts=(0,eN.useCallback)(()=>{var e;null==(e=tr.retry)||e.call(tr),eP(e=>e+1)},[tr]),td=JSON.stringify([E,e2.sessionId]),tc=(0,eN.useRef)(td);tc.current=td;let tu=(0,eN.useCallback)(()=>{ee.current=td,X(td)},[td]),tp=J===td,tm=(0,eN.useMemo)(()=>(function(e){if(!eQw(e))return;let t=new Date(`${e}T12:00:00Z`),l=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+2,0,12)).getUTCDate();return{startDate:e,endDate:new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,Math.min(t.getUTCDate(),l),12)).toISOString().slice(0,10)}})(B),[B]),tg=!(0,eN.useMemo)(()=>{var e,t,l,i;return!e2.restored||!(null==(e=e2.state)?void 0:e.partyPreview)&&(!(null==(t=e2.state)?void 0:t.date)||e2.state.date<=B)&&!((null==(l=R.getTempOrder())?void 0:l.products)||[]).length&&!((null==(i=R.getTempOrder())?void 0:i.bookings)||[]).length},[e2.sessionId,e2.restored,R,E])||Q||tp||((null==(p=R.getTempOrder())?void 0:p.bookings)||[]).length?void 0:tm,th=tg&&V>=tg.startDate&&V<=tg.endDate?tg:eQ8(V,Y),tv=eJf({os:R,ready:tl,catalog:eZ,date:V,customerId:eJ,scopeKey:E,revision:eI,operationLog:e1,projectionDateRange:th,queries:tr,onRetry:ts,mode:"tickets"===P?"ticket":"party",resolvePolicy:tn}),tf=R.getTempOrder()||L.tempOrder,ty=eJY(tf,{mode:P}),tb="party"===P?ty.bindings[0]:void 0,tx=!!(null==(m=D.steps.extras)?void 0:m.catalog.menuListIds.length),tk=eJf({os:R,ready:tl,operationLog:e1,catalog:null==(g=D.steps.extras)?void 0:g.catalog,date:B,retailTimeZone:N.timeZone,customerId:eJ,scopeKey:`${E}:extras`,retail:!0,queries:to,revision:+(ty.bindings.length>0)}),t_=eJ$({os:R,cart:L,mode:P,timeZone:N.timeZone,beforeMutate:C.assertCanMutate,parentLineUid:null==tb?void 0:tb.productLineUid,scopeKey:E,customerId:eJ,productLoadParams:{menu_list_ids:(null==(h=D.steps.extras)?void 0:h.catalog.menuListIds)||[]},catalog:tk,catalogSession:to,onMutated:eX,resolveSelectionPolicy:async e=>{let t=await tP(e);return{...t,overSold:1===t.overSold}}}),tw=function(e){var t;let l,i,a,n,r,o,s,d,c,u,p,m,g=(0,eN.useRef)(e);g.current=e;let h=(0,eN.useRef)(!0),[,v]=(0,eN.useState)(0),f=(0,eN.useRef)();return f.current||(a=(t={getOwner:()=>g.current.getOwner(),productId:e=>String(e.id),readQuantity:e=>g.current.readQuantity(e),applyQuantity:(e,t)=>g.current.applyQuantity(e,t),refreshActual:()=>g.current.refreshActual(),onError:e=>{h.current&&g.current.onError(e)},onChange:()=>{h.current&&v(e=>e+1)}}).getOwner(),n=0,r=!1,o=!1,s=new Map,d=()=>{void 0!==l&&clearTimeout(l),l=void 0},c=(e,l)=>!r&&l===n&&eJb(e,t.getOwner()),u=()=>{r||t.onChange()},p=()=>{let e=t.getOwner();eJb(a,e)||(a=e,n+=1,s.clear(),d(),u())},m=()=>{if(r||o||!s.size)return;d();let e=s.values().next().value;l=setTimeout(async()=>{if(l=void 0,!r&&!o){o=!0;try{for(;!r&&s.size;){p();let l=s.entries().next().value;if(!l)break;let[r,o]=l,d=a,m=n;try{var e;let l=t.readQuantity(o.product);if(!Number.isSafeInteger(l)||l<0)throw Error("The extra quantity is unavailable. Please review the cart.");if(l===o.quantity){s.delete(r),u();continue}let a=o.quantity;i={owner:d,generation:m,intent:o};let n=await t.applyQuantity(o.product,a);if(!c(d,m)){i=void 0,p();continue}if(i=void 0,"function"==typeof n){s.clear(),u(),await n(()=>c(d,m));break}if(!n){s.clear(),u();break}let g=t.readQuantity(o.product),h=a<l&&g>=a&&g<l;if(!Number.isSafeInteger(g)||g<0||g!==a&&!h)throw Error("The extra quantity changed while updating. Please review the cart.");(null==(e=s.get(r))?void 0:e.quantity)===g&&s.delete(r),u();break}catch(e){if(!c(d,m)){i=void 0,p();continue}try{await t.refreshActual()}catch{}i=void 0,c(d,m)&&(s.clear(),u(),t.onError(e));break}}}finally{i=void 0,o=!1,m()}}},Math.max(0,Math.min(e.lastAt+200,e.firstAt+400)-Date.now()))},f.current={enqueue(e,l,a){var n;let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(r||!Number.isSafeInteger(l)||!Number.isSafeInteger(a))return;p();let d=t.productId(e);if(!d)return;let c=t.readQuantity(e);if(!Number.isSafeInteger(c)||c<0)return;let g=((null==(n=s.get(d))?void 0:n.quantity)??c)+l-a,h=Math.max(0,Number.isSafeInteger(o.min)?o.min:0),v=Math.max(h,Number.isSafeInteger(o.max)?o.max:Number.MAX_SAFE_INTEGER),f=g<=0?0:Math.min(v,Math.max(h,g));if(!Number.isSafeInteger(f))return;let y=Date.now(),b=s.get(d);s.set(d,{product:e,quantity:f,firstAt:b===(null==i?void 0:i.intent)?y:(null==b?void 0:b.firstAt)??y,lastAt:y}),u(),m()},isPending:()=>!r&&eJb(a,t.getOwner())&&(s.size>0||!!i&&i.generation===n&&eJb(i.owner,a)),getTargets:()=>!r&&eJb(a,t.getOwner())?Array.from(s).reduce((e,t)=>{let[l,i]=t;return e[l]=i.quantity,e},{}):{},reconcileOwner:p,dispose(){r=!0,n+=1,s.clear(),d()}}),(0,eN.useEffect)(()=>{var e;null==(e=f.current)||e.reconcileOwner()}),(0,eN.useEffect)(()=>()=>{var e;h.current=!1,null==(e=f.current)||e.dispose()},[]),{changeQuantity:(e,t,l)=>{var i,a;if(!h.current||!g.current.canChange())return;let n=1===Number(e.is_track)&&0===Number(e.over_sold)?Number(e.stock_quantity):200,r=Math.max(0,Math.min(Number.isFinite(n)?n:200,Number((null==(i=e.item_rule_limit)?void 0:i.remainingMax)??200)));f.current.enqueue(e,t,l,{min:Number((null==(a=e.item_rule_limit)?void 0:a.min)??0),max:Math.floor(r)})},isPending:f.current.isPending,pending:f.current.isPending(),quantities:f.current.getTargets()}}({getOwner:()=>{var t;let l=eKA(R.getTempOrder());return[R,l&&"object"==typeof l?e2.sessionId:l,null==(t=R.getTempOrder())?void 0:t.customer_id,E,e2.sessionId,eJ,P,null==tb?void 0:tb.productLineUid,to,tl,!1!==e.isActive]},readQuantity:e=>{var t;return eJM((null==(t=R.getTempOrder())?void 0:t.products)||[],{mode:P,scopeKey:E,parentLineUid:null==tb?void 0:tb.productLineUid}).filter(t=>String(t.product_id)===String(e.id)).reduce((e,t)=>e+Number(t.num||0),0)},applyQuantity:async(e,t)=>{let l=await t_.setProductQuantity(e,t);if("cancelled"===l.status)return!1;if("invalid"===l.status)throw Error(l.issues.map(e=>e.message).join(" "));return!!["added","updated","unchanged"].includes(l.status)||(t=>tI(async()=>{t()&&await tz(l,t)},e.id))},refreshActual:()=>{L.refreshCartSnapshot()},onError:e=>ev(e instanceof Error?e.message:String(e)),canChange:()=>!tH&&!eq.current}),tS=tw.isPending,tj=t_.rows.length>0||tx&&(tk.loading||!!tk.error||tk.products.some(eJy)),tN=!eZ.menuListIds.length||!tv.loading&&!tv.error&&!tv.products.length,tC=tN||tv.loading||!!tv.error;(0,eN.useEffect)(()=>{tl&&("select"!==G&&(tN||tv.error)?(el("product"),K("select")):"extras"!==G||tj?"review"===G&&tk.error&&K("extras"):K(eJK(A,E).complete?"review":"holder"))},[tl,G,tN,tv.error,tj,tk.error,A,E]);let tM=function(e){var t,l;let i=Array.from(new Set(e.dates)).sort().join(","),a=e.catalog.menuListIds.join(","),n=(0,eN.useMemo)(()=>eJk(e.searchRange),[null==(t=e.searchRange)?void 0:t.startDate,null==(l=e.searchRange)?void 0:l.endDate]),r=n.join(","),o=r||i,s=(0,eN.useMemo)(()=>({}),[e.os,e.ready,a,e.customerId,e.scopeKey,e.revision,e.resolvePolicy,e.mode,e.queries]),d=(0,eN.useMemo)(()=>({...e,queryScope:s,searchDates:n,menuIds:[...e.catalog.menuListIds]}),[e.os,e.ready,o,r,a,e.customerId,e.scopeKey,e.revision,e.resolvePolicy,e.mode,e.queries]),c=(0,eN.useMemo)(()=>i?i.split(","):[],[i]),u=(0,eN.useMemo)(()=>Array.from(new Set([...n,...c])).sort(),[n,c]),p=(0,eN.useMemo)(()=>u.reduce((e,t)=>(e[t]={status:d.menuIds.length?"loading":"unavailable"},e),{}),[d,u]),[m,g]=(0,eN.useState)(),h=(0,eN.useRef)(d);h.current=d;let v=(0,eN.useRef)(),f=(0,eN.useMemo)(()=>{var e;return{states:!r&&(null==(e=v.current)?void 0:e.searching)&&v.current.queryScope===s?{...v.current.states}:{},pending:new Set,visibleDates:c,projectionDates:u,pump:void 0}},[d]);(0,eN.useEffect)(()=>{v.current={queryScope:s,searching:!!r,states:f.states}},[f,s,r]);let y=(0,eN.useRef)(0),b=(0,eN.useRef)();return(0,eN.useEffect)(()=>{let e=!0,t=()=>e&&h.current===d;if(g({request:d,states:{...f.states}}),!d.ready||!d.menuIds.length)return()=>{e=!1};let l=(e,l)=>{t()&&(f.states[e]=l,g({request:d,states:{...f.states}}))},i=async e=>{let i=f.projectionDates;try{let a=await d.queries.queryCatalogSnapshot({menu_list_ids:d.menuIds,schedule_date:e,...d.customerId?{customer_id:Number(d.customerId)}:{}});if(!t())return;let n=!1,r=!1;if(a.length){let l=await eJh(d.os,{products:a,productsFromSessionSnapshot:!0,date:e,mode:d.mode,queries:d.queries,projectionDateRange:eQ8(e,i),catalogParams:{menu_list_ids:d.menuIds,...d.customerId?{customer_id:d.customerId}:{}},resolvePolicy:d.resolvePolicy,isCurrent:t,stopAtFirstAvailable:!0});n=l.available,r=!0===l.requiresConfiguration}l(e,{status:n?"available":r?"configuration":"unavailable"})}catch(t){l(e,{status:"error",reason:t instanceof Error?t.message:String(t)})}finally{var a;f.pending.delete(e),y.current--,null==(a=b.current)||a.call(b)}},a=e=>!f.pending.has(e)&&(!f.states[e]||"loading"===f.states[e].status),n=()=>{for(let t of d.searchDates){var e;let l=null==(e=f.states[t])?void 0:e.status;if("available"===l||"configuration"===l||"error"===l)break;if(a(t))return t}return f.visibleDates.find(a)},r=()=>{for(;t()&&y.current<2;){let e=n();if(!e)break;f.pending.add(e),y.current++,i(e)}};return f.pump=r,b.current=r,r(),()=>{e=!1,f.pump===r&&(f.pump=void 0),b.current===r&&(b.current=void 0)}},[d,f]),(0,eN.useEffect)(()=>{var e;f.visibleDates=c,f.projectionDates=u,null==(e=f.pump)||e.call(f)},[f,c,u]),(0,eN.useMemo)(()=>({...p,...(null==m?void 0:m.request)===d?m.states:f.states}),[m,d,p,f])}({os:R,ready:tl,catalog:eZ,dates:Y,customerId:eJ,scopeKey:E,revision:eI,searchRange:tg,queries:tr,mode:"tickets"===P?"ticket":"party",resolvePolicy:tn}),tT=(0,eN.useRef)({date:V,scopeKey:E,customerId:eJ,ready:tl,sessionId:e2.sessionId,composerKey:null==ei?void 0:ei.key});tT.current={date:V,scopeKey:E,customerId:eJ,ready:tl,sessionId:e2.sessionId,composerKey:null==ei?void 0:ei.key};let tI=async(e,t)=>{if(!(eq.current||!tl||tS())){eq.current=!0,ey(!0),ev(void 0),ex(null==t?void 0:String(t));try{await e()}catch(e){eW.current&&ev(e instanceof Error?e.message:String(e))}finally{eq.current=!1,eW.current&&(ey(!1),ex(void 0))}}},tP=async e=>{var t;let l=await z.ensureSalesSettings();if(!l)throw Error(q("Sales settings are unavailable. Please try again.","销售配置未就绪,请重试。"));return{overSold:iP({productOverSold:e.over_sold,runtimePolicy:{source:"picoding",settings:l,platform:z.salesSettingsPlatform||(null==(t=R.otherParams)?void 0:t.platform)}}),requiredOptionValidation:l.product.checkRequiredOptions}},tA=async function(e,t){let l=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=arguments.length>3?arguments[3]:void 0,a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],n=e1.capture();a&&n("product_selected",{productId:e.id,editing:!!t,selectedDate:V});let r=tv.products.find(t=>String(t.id)===String(e.id))||e,o=r.price,s=("string"==typeof o||"number"==typeof o)&&""!==String(o).trim()&&Number.isFinite(Number(o))&&Number(o)>=0?Rs(r):void 0,d=null==s?void 0:s.amount,c="party"===P&&!i&&!t&&l;c&&(null==e7?void 0:e7.productId)===Number(e.id)&&(i=e7),"tickets"===P&&ea(void 0),er(void 0),"party"!==P||t||Number(null==tb?void 0:tb.line.product_id)!==Number(e.id)||(t=null==tb?void 0:tb.productLineUid);let u=++eU.current,p={...tT.current},m=()=>eW.current&&u===eU.current&&tT.current.scopeKey===p.scopeKey&&tT.current.date===p.date&&tT.current.customerId===p.customerId&&tT.current.sessionId===p.sessionId;eY.current=u,e_(String(e.id));try{var g;let n,r,o={menu_list_ids:eZ.menuListIds,product_id:e.id,schedule_date:V,...eJ?{customer_id:eJ}:{},with_count:["bundleGroup","optionGroup"],with_schedule:1},p=a?await tr.prepareProductDetail({...o,retry:!0}):await tr.queryCatalogProductDetail(o);if(!m())return!1;if(t){let e=await eJG({os:R,queries:tr,mode:P,catalog:eZ,scopeKey:E,customerId:eJ,isCurrent:m});if(!(n=e.bindings.find(e=>e.productLineUid===t)))throw Error(e.issues.map(e=>e.message).join(" ")||"This booking could not be loaded.")}if(!m())return!1;let h=p&&n?{...p,_extend:{...p._extend,...(null==(g=n.product._extend)?void 0:g.capacity)?{capacity:n.product._extend.capacity}:{}}}:p;if(!h)throw Error(q("This product is no longer in this menu.","当前菜单已不包含该商品。"));let v=await tP(h);if(!m())return!1;let f=`${E}:${u}:${Date.now()}`,y=iT({productDetail:h,requestedProductId:e.id,completeness:"complete",mode:"tickets"===P?"ticket-booking":"product-configuration",openId:f,scopeKey:E,detailRevision:f,selectionKey:t||e.id,intent:t||i?"edit-draft":"create"});if("invalid"===y.status)throw Error(y.issues.map(e=>e.message).join(" "));let b=null==i?void 0:i.configuration,x=(null==b?void 0:b.skuValue)||(null==n?void 0:n.skuValue),k=x?iS(h,x,{...v,overSold:1===v.overSold}):void 0,_="ready"===y.status?y.plan.productDetail:y.productDetail,w=b?{...b,skuValue:k||b.skuValue}:n?{skuValue:k||n.skuValue,variantDraft:null}:e0I(_,1===v.overSold);if(i&&!k&&"no-configuration"===y.status)throw Error(q("The saved options are no longer available. Choose this Party again.","已保存的选项已不可用,请重新选择 Party 商品。"));let S={key:f,catalogStartingAmount:d,catalogPriceQualifier:null==s?void 0:s.qualifier,detail:_,configuration:w,lineUid:"party"===P?null==tb?void 0:tb.productLineUid:t,quantity:null==i?void 0:i.quantity,initialSelection:i?(r=i,e0x(r.selection)):null==n?void 0:n.selection,...v};return"tickets"===P&&"ready"===y.status&&"ticket-booking"===y.plan.mode?ea({...S,plan:y.plan}):"party"===P&&!l&&k?ea(S):"no-configuration"===y.status?(ea(S),el("time"),c&&e4(),I("#party-time")):"product-configuration"===y.plan.mode&&er({plan:y.plan,configuration:w,partyDraft:S,...v}),K("select"),!0}catch(t){throw a&&n("product_open_failed",{productId:e.id,...eZC(t)},"warning"),t}finally{eW.current&&u===eY.current&&e_(void 0)}};(0,eN.useEffect)(()=>{if(!e5||!e2.ready||e2.pendingOrder||!1===e.isActive||!ed)return;let t=!0;return eg(!0),ep(void 0),(async()=>{try{let e=function(e){if((null==e?void 0:e.version)!==1||!["configuration","booking"].includes(e.phase))throw Error("Invalid saved Party preview.");return e0k({detail:{id:e.productId},quantity:e.quantity,lineUid:e.lineUid,configuration:e.configuration,initialSelection:e.selection},e.phase)}(ed.value),l=await tA({id:e.productId},e.lineUid,"configuration"===e.phase,e,!1);if(!t)return;if(!l)throw Error(q("The draft changed. Retry restoring your Party selection.","草稿已变化,请重试恢复 Party 选择。"));el("time"),ec(void 0)}catch(e){t&&ep(e instanceof Error?e.message:String(e))}finally{t&&eg(!1)}})(),()=>{t=!1,++eU.current}},[e5,e2.ready,e2.pendingOrder,e.isActive,ed,R,E,V,eJ]);let tD=async(e,t)=>{if(tB||ei||en||tT.current.scopeKey!==E||tT.current.sessionId!==e2.sessionId||tT.current.customerId!==eJ)return!1;let l=!1;return await tI(async()=>{let i=R.getTempOrder(),a=eKA(i),n=null==i?void 0:i.customer_id,r={...tT.current},o=()=>eW.current&&tT.current.ready&&tT.current.scopeKey===r.scopeKey&&tT.current.sessionId===r.sessionId&&tT.current.customerId===r.customerId&&(null==i?void 0:i.customer_id)===n&&R.getTempOrder()===i&&eKA(i)===a,s=new Set(e);if(!i||Number(i.order_id||0)>0||!s.size||s.size!==e.length||e.some(e=>!e))throw Error(q("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"));let d=i.products||[],c=d.filter(e=>s.has(eJF(e))),u="tickets"===P?"tickets":"party_main";if(c.length!==s.size||c.some(e=>{var t,l;return(null==(t=e.metadata)?void 0:t.venue_booking_role)!==u||(null==(l=e.metadata)?void 0:l.venue_booking_scope_key)!==E})||new Set(c.map(eJF)).size!==s.size)throw Error(q("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"));if(t&&("tickets"!==P||0!==t.index||1!==s.size||!s.has(t.uid)||1!==Number(c[0].num)))throw Error(q("This saved ticket cannot be removed individually. Remove its cart group instead.","此历史门票无法逐张删除,请删除对应购物车组。"));let p="tickets"===P&&!d.some(e=>{var t,l;return(null==(t=e.metadata)?void 0:t.venue_booking_role)==="tickets"&&(null==(l=e.metadata)?void 0:l.venue_booking_scope_key)===E&&!s.has(eJF(e))}),m=d.filter(e=>{var t,l,i;return s.has(eJF(e))||(null==(t=e.metadata)?void 0:t.venue_booking_scope_key)===E&&("party"===P&&(null==(l=e.metadata)?void 0:l.venue_booking_role)==="party_extra"&&s.has(String(e.metadata.venue_booking_parent_uid||""))||p&&(null==(i=e.metadata)?void 0:i.venue_booking_role)==="tickets_extra")}),g=new Set(m.map(eJF));if(g.has("")||g.size!==m.length||d.filter(e=>g.has(eJF(e))).length!==m.length)throw Error(q("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"));let h=JSON.stringify([i.products,i.bookings,i.notes,i.holder_relations]),v=()=>{if(!o()||h!==JSON.stringify([i.products,i.bookings,i.notes,i.holder_relations]))throw Error(q("The booking cart changed. Please review it again.","购物车已变化,请重新查看。"))};if("function"!=typeof R.removeProductsFromOrder)throw Error("The booking cart service needs to be updated.");v();try{if(await R.removeProductsFromOrder(m.map(ekX),{beforeApply:v,isCurrentOrder:o}),!o())return;L.refreshCartSnapshot(),eP(e=>e+1),eJK(A,E).enabled||eT(!1),ea(void 0),eJY(R.getTempOrder(),{mode:P,scopeKey:E}).bindings.length||(eT(!1),K("select")),l=!0}catch(e){throw o()&&(L.refreshCartSnapshot(),eP(e=>e+1),eJK(A,E).enabled||eT(!1),eJY(R.getTempOrder(),{mode:P,scopeKey:E}).bindings.length||(eT(!1),K("select"))),e}}),l},tE=e=>tD(e),tO=async(e,t)=>{if(!ew()(e).isValid()||e<B)return!1;let l=e1.capture();if(e===V)return Z(!0),el("product"),l("date_selected",{previousDate:V,selectedDate:e}),!0;if(eq.current||tS())return;eq.current=!0,ey(!0);let i=eKA(R.getTempOrder()),a=R.getTempOrder(),n=()=>{if(!eW.current||!tT.current.ready||tT.current.date!==V||eKA(R.getTempOrder())!==i)throw Error(q("The draft changed. Please choose the date again.","草稿已变化,请重新选择日期。"))};try{let o,s,d=eJY(R.getTempOrder(),{mode:P}).bindings;if("tickets"===P&&d.length){var r;if(!await new Promise(e=>eM.Modal.confirm({title:q("Change the date for this order?","更改整单日期?"),content:q("All tickets will be removed so you can choose them again for the new date.","订单中的全部门票将移除,请按新日期重新选择。"),okText:q("Change date","更改日期"),cancelText:q("Keep date","保留日期"),onOk:()=>e(!0),onCancel:()=>e(!1)}))||!eW.current)return eW.current&&l("date_change_cancelled",{previousDate:V,selectedDate:e}),!1;n();let t=eJY(R.getTempOrder(),{mode:P}).bindings,o=eJM((null==(r=R.getTempOrder())?void 0:r.products)||[],{mode:P,scopeKey:E});if(await R.removeProductsFromOrder([...t.map(e=>e.identity),...o.map(ekX)],{isCurrentOrder:()=>eW.current&&R.getTempOrder()===a&&eKA(R.getTempOrder())===i}),n(),eJY(R.getTempOrder(),{mode:P}).bindings.length)throw Error("The cart changed. Please review the tickets before changing date.");ea(void 0),er(void 0),await e0()}if(n(),"party"===P&&ei){let l=await tr.queryCatalogProductDetail({menu_list_ids:eZ.menuListIds,product_id:Number(ei.detail.id),schedule_date:e,...eJ?{customer_id:eJ}:{},with_count:["bundleGroup","optionGroup"],with_schedule:1});if(n(),!l)throw Error(q("This Party is unavailable on the selected date. Choose another date or product.","该商品在所选日期不可用,请选择其他日期或商品。"));let i=await tP(l);n();let a=`${E}:date:${++eU.current}:${Date.now()}`,r=iT({productDetail:l,requestedProductId:ei.detail.id,completeness:"complete",mode:"product-configuration",openId:a,scopeKey:E,detailRevision:a,selectionKey:ei.lineUid||ei.detail.id,intent:"edit-draft"});if("invalid"===r.status)throw Error(r.issues.map(e=>e.message).join(" "));let d=(null==t?void 0:t.configuration)||ei.configuration,c=iS(l,d.skuValue,{...i,overSold:1===i.overSold}),u={...ei,key:a,detail:l,...i,quantity:(null==t?void 0:t.quantity)??ei.quantity,initialSelection:(null==t?void 0:t.initialSelection)||ei.initialSelection};c?o={...u,configuration:{skuValue:c,variantDraft:null}}:"ready"===r.status&&"product-configuration"===r.plan.mode?s={plan:r.plan,configuration:d,partyDraft:u,...i}:o={...u,configuration:eKP(Number(l.id))}}return n(),++eU.current,ea(o),er(s),U(e),Z(!0),el(o?"time":"product"),K("select"),ev(void 0),l("date_selected",{previousDate:V,selectedDate:e}),!0}catch(t){throw l("date_change_failed",{previousDate:V,selectedDate:e,...eZC(t)},"warning"),t}finally{eq.current=!1,eW.current&&ey(!1)}},tz=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>!0;if(t()){if("invalid"===e.status)throw Error(e.issues.map(e=>e.message).join(" "));if("choose-line"===e.status)return void eD(e.rows);if("direct"===e.status)return void await t_.commit(e.session,e.configuration);if("ready"===e.status){let l=await tP(e.session.productDetail);if(!t())return;let i=e.session.lineUid?e.configuration:e0I(e.plan.productDetail,1===l.overSold);er({plan:e.plan,configuration:i,extraSession:e.session,...l})}}},tL=()=>{var e;let t=R.getTempOrder(),l={mode:P,scopeKey:E,parentLineUid:null==tb?void 0:tb.productLineUid};if(!eJM((null==t?void 0:t.products)||[],l).length)return!0;if(tk.loading||tk.error)return ev(tk.error||q("The extras menu is loading. Please try again.","附加商品菜单正在加载,请稍后重试。")),K("extras"),T.close(),!1;let i=function(e,t,l){if(!e)return;let i=eJM(e.products||[],l);if(!i.length)return;let a=new Map(t.map(e=>[Number(e.id),e]));return i.find(t=>{let l=a.get(Number(t.product_id)),i=t.product_variant_id;return!!B4(eJS(l,i,t)).required&&!eJj(l,i,Number(t.num),Uy(t,e.holder_relations),e.customer_id??void 0,t)})}(t,tk.products,l);return!i||((e=>{K("extras"),T.close();let t=q("Complete the holder details for this extra.","请补全这件附加商品的 Holder 资料。");if(ev(t),!e||eq.current||tS())return;let l=tT.current,i=eKA(R.getTempOrder()),a=()=>eW.current&&tT.current.ready&&tT.current.scopeKey===l.scopeKey&&tT.current.sessionId===l.sessionId&&tT.current.customerId===l.customerId&&eKA(R.getTempOrder())===i;tI(async()=>{let l=await t_.prepareEdit(e);if(a()){if("invalid"===l.status)throw Error(l.issues.map(e=>e.message).join(" "));"ready"===l.status&&await tz(l,a),a()&&ev(t)}})})(String((null==(e=i.metadata)?void 0:e.unique_identification_number)??"")),!1)},tR=async()=>{if(tq.pending||tq.error||ei||en||!eQ.current||!tl||tC||tS()||tj&&(tk.loading||tk.error))return!1;ev(void 0);let e=eJK(A,E);if(!e.complete||e.pending||e.blocked)return K("holder"),!1;if(!tL()||!await eQ.current.validate())return!1;await L.waitForCartConsistency();let t=eKA(R.getTempOrder()),l={...tT.current};return eW.current&&tT.current.ready&&tT.current.scopeKey===l.scopeKey&&tT.current.date===l.date&&tT.current.customerId===l.customerId&&eKA(R.getTempOrder())===t&&tL()},t$=function(e){var t;let l=function(e){var t,l,i,a,n;sZ(eq_,e.locale),sZ(e0c,e.locale);let r=eR(),o=eF(),s=exp(),d=e.context.sales.bookingTicket,c=String((null==d||null==(t=d.otherParams)?void 0:t.platform)||o||"").trim().toLowerCase(),u=null==d||null==(l=d.otherParams)?void 0:l.venueBookingMode,p="kiosk"===c&&("tickets"===u||"party"===u),m=null==r||null==(n=r.appHelper)||null==(a=n.utils)||null==(i=a.getApp)?void 0:i.call(a),g=eM8(m),h=(0,eN.useRef)(e);h.current=e;let v=(0,eN.useRef)(!0),f=(0,eN.useRef)(!1),y=(0,eN.useRef)(!1),b=(0,eN.useRef)(),x=(0,eN.useRef)(new Set),k=(0,eN.useRef)(),_=(0,eN.useRef)(),w=(0,eN.useRef)(),[S,j]=(0,eN.useState)(!1),[N,C]=(0,eN.useState)(!1),[M,T]=(0,eN.useState)(null),[I,P]=(0,eN.useState)(),[A,D]=(0,eN.useState)(null),[E,O]=(0,eN.useState)(10),[z,L]=(0,eN.useState)(!1);(0,eN.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]),(0,eN.useEffect)(()=>{_.current=void 0,k.current=void 0,w.current=void 0,P(void 0),D(null),T(null)},[e.scopeKey,e.sessionId,d]);let R=o0(async e=>{if(!p||f.current||b.current||y.current||!v.current)return!1;let t=h.current.onKioskFinish;if(!t)return!1;y.current=!0,L(!0),T(null);try{if(!await t({navigateHome:e}))throw Error(String(ez.getText("pisell2.venue-kiosk.checkout.reset-failed")));return v.current&&D(null),!0}catch(e){return v.current&&T(e0n(e)||String(ez.getText("pisell2.venue-kiosk.checkout.reset-failed"))),!1}finally{y.current=!1,v.current&&L(!1)}}),$=o0(()=>R(!0)),F=o0(()=>R(!1)),q=o0(()=>!!(f.current||b.current)),B=o0(()=>q()?new Promise(e=>{x.current.add(e)}):Promise.resolve()),H=o0(()=>{if(q())return;let e=[...x.current];x.current.clear(),e.forEach(e=>e())}),V=o0(async()=>{var e,t,l,i,a,n,r,o,d,u,x,S,N,M,I,E,O,z,L,R,$,q,B,V;let U,Y,W;if(!p||f.current||y.current||!1===h.current.isActive||!v.current)return!1;let G=h.current,K=G.context,Q=K.sales.bookingTicket;if(!Q)return!1;let Z=(null==(e=Q.getTempOrder)?void 0:e.call(Q))??K.sales.tempOrder,J=e0p(Z),X=()=>v.current&&!1!==h.current.isActive&&h.current.scopeKey===G.scopeKey&&h.current.sessionId===G.sessionId&&h.current.context.sales.bookingTicket===Q,ee=()=>{var e;if(!X()||e0p(null==(e=Q.getTempOrder)?void 0:e.call(Q))!==J)throw Error("BOOKING_SELECTION_CHANGED")},et=e=>{let t=e0u(e);if(t&&X()&&(_.current=t,P(t),k.current!==t)){var l;k.current=t,null==(l=G.onOrderSubmitted)||l.call(G,t)}};f.current=!0,j(!0),T(null);let el=!1;try{if(!await s.ensureCanShop()||!X())return!1;if(await K.cart.waitForCartConsistency(),ee(),_.current&&e0u(null==(E=Q.getTempOrder)||null==(I=E.call(Q))?void 0:I.order_id)!==_.current){let e=null==(O=Q.getTempOrder)?void 0:O.call(Q);if((null==e||null==(z=e.products)?void 0:z.length)||(null==e||null==(L=e.bookings)?void 0:L.length)||(await K.sales.loadDetailByRemote(Number(_.current)),!X()))return!1;Z=(null==(R=Q.getTempOrder)?void 0:R.call(Q))??K.sales.tempOrder,J=e0p(Z)}let e=!!(A&&w.current&&w.current.scopeKey===G.scopeKey&&w.current.sessionId===G.sessionId&&w.current.source===Q&&(w.current.identity===J||_.current&&e0u(null==(V=Q.getTempOrder)||null==(B=V.call(Q))?void 0:B.order_id)===_.current));if(!e&&G.beforeCheckout&&!await G.beforeCheckout())return!1;ee(),b.current=U=g(),Y=U.hold(),await U.pause(),ee();let p=null==m||null==(i=m.history)||null==(l=i.instance)||null==(t=l.block)?void 0:t.call(l,()=>!1);"function"==typeof p&&(W=p),C(!0);let y=async()=>(ee(),(!!e||!!await h.current.beforeSubmit())&&(await K.cart.waitForCartConsistency(),ee(),w.current={scopeKey:G.scopeKey,sessionId:G.sessionId,source:Q,identity:J},(el=await s.beginCheckout())&&X())),k=(null==(a=Q.getTempOrder)?void 0:a.call(Q))??Z,j=(null==(r=Q.getOrderAmountSnapshot)||null==(n=r.call(Q))?void 0:n.summary)??(null==k?void 0:k.summary)??K.summary.summary,T=eHL(c,j),P=s.enabled&&!s.requirePaymentOnSubmit;if((P||T)&&!_.current){let e=P?{paymentExecution:"deferred"}:eH$(null==k?void 0:k.payments),t=await K.cart.submit(e,{validateHolder:!0,beforeSubmit:y});if(!X())return!1;if(!eTm(t))throw Error(e0n(t));let l=eH5(t,(null==($=Q.getTempOrder)?void 0:$.call(Q))??k);if(!l)throw Error(String(ez.getText("pisell2.venue-kiosk.checkout.failed")));if(et(l.orderId),T&&!P){let e=(null==(q=Q.getTempOrder)?void 0:q.call(Q))??k,i=eHR(t,null==e?void 0:e.summary,j);if(!eHF({result:t,orderId:l.orderId,totalAmount:i}).ok)throw Error(String(ez.getText("pisell2.venue-kiosk.checkout.failed")));D({kind:"payment",viewModel:eHq({summary:(null==e?void 0:e.summary)??j,currencySymbol:null==e?void 0:e.currency_symbol})})}else D({kind:"submitted",order:l});return!0}let ei=await K.sales.openCheckout({validateHolder:!0,beforeSubmit:y,paymentResultDisplayMode:"page",walletPassMode:"shared"});if(!X())return!1;if(et((null==ei?void 0:ei.orderId)??(null==ei?void 0:ei.order_id)??(null==ei||null==(o=ei.payload)?void 0:o.order_id)??(null==(u=Q.getTempOrder)||null==(d=u.call(Q))?void 0:d.order_id)),(null==ei?void 0:ei.reason)==="start-new-order")return el&&(s.endCheckout(),el=!1),W&&(W(),W=void 0),null==Y||Y(),Y=void 0,await U.release(),b.current=void 0,f.current=!1,v.current&&C(!1),H(),await F(),!1;if((null==ei?void 0:ei.status)==="cancelled"||(null==ei?void 0:ei.reason)==="back")return!1;let ea=(null==ei||null==(S=ei.payload)||null==(x=S.paymentResult)?void 0:x.paymentResultViewModel)??(null==ei||null==(M=ei.data)||null==(N=M.paymentResult)?void 0:N.paymentResultViewModel);if(ea)return D({kind:"payment",viewModel:ea}),!0;throw Error(e0n(ei)||String(ez.getText("pisell2.venue-kiosk.checkout.result-missing")))}catch(e){if(e===Ud||!X())return!1;return T(e0n(e)||String(ez.getText("pisell2.venue-kiosk.checkout.failed"))),!1}finally{el&&s.endCheckout(),W&&W(),null==Y||Y(),await (null==U?void 0:U.release()),b.current===U&&(b.current=void 0),f.current=!1,H(),v.current&&(j(!1),C(!1))}}),U=(null==A?void 0:A.kind)==="submitted"||(null==A?void 0:A.kind)==="payment"&&["success","deposit-paid"].includes(A.viewModel.status);return(0,eN.useEffect)(()=>{if(!p||!U||S||N||!1===e.isActive)return void O(10);let t=Date.now()+1e4,l=window.setInterval(()=>O(Math.max(0,Math.ceil((t-Date.now())/1e3))),1e3),i=window.setTimeout(()=>{$()},1e4);return()=>{window.clearInterval(l),window.clearTimeout(i)}},[p,U,A,S,N,e.isActive,$]),{enabled:p,checkout:V,submitting:S,error:M,submittedOrderId:I,failure:null,confirmFailure:async()=>{},resettingFailure:!1,resetError:null,kioskPaymentResult:A,paymentActive:N,isPaymentActive:q,waitForPaymentIdle:B,backHomeCountdown:E,resettingHome:z,returnHome:$,startNewOrder:F}}(e),i=eR(),a=eF(),n=exp(),r=Uu(),o=Uv(),s=(0,eN.useRef)(e);s.current=e;let d=(0,eN.useRef)(!0),c=(0,eN.useRef)(!1),u=(0,eN.useRef)(null),p=(0,eN.useRef)(null),m=(0,eN.useRef)(null),g=(0,eN.useRef)(!1),h=(0,eN.useRef)(null),[v,f]=(0,eN.useState)(!1),[y,b]=(0,eN.useState)(null),[x,k]=(0,eN.useState)(),[_,w]=(0,eN.useState)("idle"),[S,j]=(0,eN.useState)(null),[N,C]=(0,eN.useState)(!1),[M,T]=(0,eN.useState)(null),I=String(e.locale||"").startsWith("zh"),P=(e,t)=>I?t:e,A=(null==i||null==(t=i.appHelper)?void 0:t.utils)||{};(0,eN.useEffect)(()=>(d.current=!0,()=>{var e;d.current=!1,null==(e=h.current)||e.call(h,!1),h.current=null;let t=u.current;t&&z(t).catch(()=>{})}),[]),(0,eN.useEffect)(()=>{u.current=null,p.current=null,m.current=null,j(null),b(null),T(null),k(void 0),w("idle")},[e.scopeKey,e.sessionId,e.context.sales.bookingTicket]);let D=o0(async()=>{let e=m.current;if(e&&!g.current){if(!(e.resetStarted?e.isSameSession():e.isCurrent())){m.current=null,j(null);return}g.current=!0,e.resetStarted=!0,C(!0),T(null);try{if(!await e.reset()&&e.isSameSession())throw Error(P("Could not reset the cart. Please try again.","购物车清空失败,请重试。"));m.current===e&&(m.current=null,j(null),b(null))}catch(t){d.current&&e.isSameSession()&&T(e0n(t)||P("Could not reset the cart. Please try again.","购物车清空失败,请重试。"))}finally{g.current=!1,d.current&&C(!1)}}}),E=e=>{var t,l,i;let a=A.history||(null==(l=A.getApp)||null==(t=l.call(A))?void 0:t.history);if("function"==typeof(null==a?void 0:a.replace))a.replace(e);else{let t=(null==(i=window.location.pathname.match(/^\/(en|zh-CN|zh-HK|ja|pt)(?=\/|$)/i))?void 0:i[0])||"";window.location.replace(`${t}${e}`)}},O=e=>u.current===e&&s.current.scopeKey===e.scopeKey&&s.current.sessionId===e.sessionId&&s.current.context.sales.bookingTicket===e.context.sales.bookingTicket,z=async e=>{if(e.resetTask)return e.resetTask;if(!e.resetDone&&O(e)){e.resetTask=(async()=>{var t,l;let i=null==(l=e.context.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l);(e0g(e.context)===e.identity||String((null==i?void 0:i.order_id)||"")===e.orderId)&&await e.finishPayment(e.orderId),e.resetDone=!0})();try{await e.resetTask}finally{e.resetTask=void 0}}},L=async function(e){var t,l;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.log,a=()=>d.current&&!1!==s.current.isActive&&s.current.scopeKey===e.scopeKey&&s.current.sessionId===e.sessionId&&s.current.context.sales.bookingTicket===e.context.sales.bookingTicket;if(!a())return;let n=!1,r=()=>{n||(n=!0,null==i||i("payment_handoff",{orderId:e.orderId,kind:e.kind}))},o=()=>z(e);if("deferred"===e.kind||"virtual"===e.kind){if(await o(),!a())return;E("deferred"===e.kind?`/order/details?id=${encodeURIComponent(e.orderId)}`:`/payment-finish/success?amount=${encodeURIComponent(String(e.totalAmount))}&order_id=${encodeURIComponent(e.orderId)}`),r();return}if("function"!=typeof A.action)throw Error(P("Payment is unavailable. Please reopen this order to pay.","支付入口不可用,请从订单详情继续支付。"));let c={target:e,sessionId:`${e.sessionId||"venue"}:${Date.now()}:${++e0m}`,terminal:!1};p.current=c,d.current&&w("opening"),await eVt({action:e=>{a()&&(A.action(e),r())},clearCartAndReset:o,freePay:efs,onFreePayFailure:e=>{throw Error(String((null==e?void 0:e.message)||P("Payment failed. Please try again.","支付失败,请重试。")))},onResetError:e=>console.error("[VenueBooking] Order submitted; local cleanup failed",e),orderId:e.orderId,preparePayments:e.preparePayments,persistCatalogView:()=>{},recalcSummary:async()=>void 0,redirectZeroAmount:(t=e.platform,l=e.totalAmount,"h5"===String(t||"").trim().toLowerCase()&&0===eHE(l)),replace:e=>{a()&&(E(e),r())},totalAmount:e.totalAmount,paymentSessionId:c.sessionId,onPaymentLifecycle:t=>{if(!t||"object"!=typeof t||!("key"in t)||"payment_lifecycle"!==t.key||!("data"in t))return;let l=t.data;if(l&&l.session_id===c.sessionId&&String(l.order_id)===e.orderId&&p.current===c&&!c.terminal&&O(e)){if("opened"===l.phase){d.current&&w("open");return}if("launch_failed"===l.phase){c.terminal=!0,d.current&&(w("failed"),b(("string"!=typeof l.reason||/^[a-z][a-z0-9_]*$/i.test(l.reason)?void 0:l.reason)||P("Payment could not be opened. Please try again.","支付入口未能打开,请重试。")));return}("dismissed"===l.phase||"redirecting"===l.phase)&&(c.terminal=!0,d.current&&w("closing"),o().then(()=>{d.current&&O(e)&&p.current===c&&w("closed")}).catch(t=>{d.current&&O(e)&&p.current===c&&(w("closed"),b(e0n(t)||P("Could not clear this completed checkout.","结账页面清理失败。")))}))}}})},R=o0(async()=>{var e,t,l,p,g,v,y,x,_,S,N,C,M,T,I;if(c.current||m.current||!(d.current&&!1!==s.current.isActive))return!1;c.current=!0,f(!0),b(null);let D=!1,E=!1,O=s.current,{context:z}=O,R=z.sales.bookingTicket,$=e0g(z),F=()=>d.current&&!1!==s.current.isActive&&s.current.scopeKey===O.scopeKey&&s.current.sessionId===O.sessionId&&s.current.context.sales.bookingTicket===R,q=()=>F()&&e0g(s.current.context)===$,B={isCurrent:q,isSameSession:F,reset:O.onFailureConfirmed},H=null==(e=O.operationLog)?void 0:e.capture();null==H||H("checkout_requested",{retrySubmittedOrder:!!u.current,submittedOrderId:null==(t=u.current)?void 0:t.orderId});try{if(u.current){let e=u.current;if(O.scopeKey!==u.current.scopeKey||O.sessionId!==u.current.sessionId||R!==u.current.context.sales.bookingTicket)return!1;return await L(e,H),!0}let e=String(n.platform||(null==R||null==(l=R.otherParams)?void 0:l.platform)||a||"").toLowerCase();if(!R||!["pc","h5"].includes(e))throw Error(P("Open this booking from the customer website.","请从用户端预约页面打开。"));if(!r.holderConfirm)throw Error(P("Booking confirmation is unavailable. Please reload.","预订确认服务未就绪,请刷新页面。"));if(!await n.ensureCanShop()||!q())return!1;let t=(null==i||null==(v=i.appHelper)||null==(g=v.constants)||null==(p=g.config)?void 0:p.channel)||e;if(Um(t)&&!o.isLoggedIn()&&(!await new Promise(e=>{h.current=e,o.openLoginModal({callback:t=>{h.current=null,e("success"===t)}})||(h.current=null,e(!1))})||!q())||(await z.cart.waitForCartConsistency(),!q()||s.current.beforeCheckout&&!await s.current.beforeCheckout()||!q()))return!1;let d=(null==(y=R.getTempOrder)?void 0:y.call(R))??z.sales.tempOrder;if(!(null==d||null==(x=d.products)?void 0:x.length)&&!(null==d||null==(_=d.bookings)?void 0:_.length))return!1;let c=n.enabled&&!n.requirePaymentOnSubmit,m=!!(z.sales.enableMultiCurrencySettlement&&Yc(d));if(!c&&!m&&"function"!=typeof A.action)throw Error(P("Payment is unavailable. Please reload.","支付入口未就绪,请刷新页面。"));let f=null,b=c?{paymentExecution:"deferred"}:{},w=await z.cart.submit(b,{validateHolder:!0,beforeSubmit:async()=>{var t,l,i;if(!q()||"function"!=typeof s.current.beforeSubmit||!await s.current.beforeSubmit()||(await z.cart.waitForCartConsistency(),!q()))return!1;let a=null==(t=R.getWalletAssetsState)?void 0:t.call(R);f=c||m?null:eVe({platform:e,shouldUseConsumerPayment:!0,payments:null==(i=R.getTempOrder)||null==(l=i.call(R))?void 0:l.payments,selectedItems:null==a?void 0:a.selectedItems,items:null==a?void 0:a.items}),Object.assign(b,null==f?void 0:f.submitParams);let r=(D=await n.beginCheckout())&&q();return E=r,r}}),j=[w,null==w?void 0:w.data,null==w?void 0:w.response,null==w||null==(S=w.data)?void 0:S.response].filter(e=>eX3(e))[0];if(j||!eTm(w))throw Error(e0n(j||w)||P("Booking could not be submitted.","预订提交失败。"));let I=eH5(w,d??null);if(!I)throw Error(P("The checkout response did not include an order number.","结账接口未返回订单编号。"));if(null==H||H("order_created",{orderId:I.orderId,deferred:c,virtual:m}),null==(N=O.onOrderSubmitted)||N.call(O,I.orderId),!F())return!1;let B=null==(C=R.getTempOrder)?void 0:C.call(R),V=e0g(z)===$||String((null==B?void 0:B.order_id)||"")===I.orderId;V&&(null==(M=R.clearSessionStorageOrderSnapshot)||M.call(R));let U=function(e){let{result:t,amountSnapshot:l,order:i}=e,a=e0r(t),n=e0r(a.data),r=e0r(e0r(n.response).data??e0r(a.response).data??a.data??a),o=e0r(r.summary),s=e0r(l),d=e0r(i),c=e0o(r.order_wait_pay_amount);if(null!==c)return c;let u=String(r.payment_status||"").trim().toLowerCase();if("paid"===u)return 0;let p=r.deposit_amount??o.deposit_amount,m=e0o(p),g=null!=p&&""!==p,h=e0o(s.depositAmount);if(e0d(r.is_deposit)??(null!==m&&m>0||void 0)??e0d(s.isDeposit)??e0d(d.is_deposit)??(e0s(s.depositAmount,d.deposit_amount)??0)>0){let e=e0s(r.order_paid_amount,r.paid_amount,o.order_paid_amount),t=e0o(e0r(s.summary).order_paid_amount),l=m??h??e0o(d.deposit_amount),i=[...Array.isArray(r.payments)?r.payments:[],...Array.isArray(d.payments)?d.payments:[]].map(e0r).filter(e=>"paid"===e.status),a=i.some(e=>"normal"===e.type||"normal"===e.order_payment_type||"deposit"!==e.type&&"deposit"!==e.order_payment_type),n=e??t;if(a||null!==l&&l>0&&[e,t].some(e=>null!==e&&e>=l)||null!==e&&null!==t&&e!==t||i.length>0&&(null===n||0===n&&i.some(e=>(e0s(e.origin_amount,e.amount)??0)>0)))return null;let c=e0o(s.amountGap);return!0===e0d(s.isDeposit)&&null!==h&&h>0&&null!==c&&(!g||m===h)?c:"unpaid"===u&&0===e&&null!==m&&m>0?m:null}let v=e0r(s.summary??d.summary);return e0o(eHR({data:r},{expect_amount:s.expectAmount??v.expect_amount,total_amount:s.totalAmount??v.total_amount},void 0))}({result:w,amountSnapshot:V?null==(T=R.getOrderAmountSnapshot)?void 0:T.call(R):void 0,order:V?B:void 0});if(!c&&null===eHE(U))return u.current={orderId:I.orderId,totalAmount:U,kind:"deferred",platform:e,context:z,identity:$,resetDone:!1,finishPayment:O.onPaymentFinished,scopeKey:O.scopeKey,sessionId:O.sessionId,log:H},k(I.orderId),await L(u.current),!0;return u.current={orderId:I.orderId,totalAmount:U,kind:c?"deferred":m?"virtual":"payment",preparePayments:null==f?void 0:f.preparePayments,platform:e,context:z,identity:$,resetDone:!1,finishPayment:O.onPaymentFinished,scopeKey:O.scopeKey,sessionId:O.sessionId,log:H},k(I.orderId),await L(u.current),!0}catch(t){if(t===Ud||!F())return null==H||H("checkout_cancelled",{reason:t===Ud?"holder_confirmation":"session_changed"}),!1;null==H||H(u.current?"payment_handoff_failed":"checkout_failed",{orderId:null==(I=u.current)?void 0:I.orderId,admittedToSubmit:E,...eZC(t)},"warning");let e=e0n(t)||P("Booking could not be submitted.","预订提交失败。");if(E&&!u.current&&q()){let t={...B,message:e,resetStarted:!1};m.current=t,j(t)}else b(e),u.current&&w("failed");return!1}finally{D&&n.endCheckout(),c.current=!1,d.current&&f(!1)}});return l.enabled?{...l,canRetryPayment:!1,retryPayment:l.checkout}:{checkout:R,submitting:v,error:y,submittedOrderId:x,failure:S,confirmFailure:D,resettingFailure:N,resetError:M,kioskPaymentResult:null,paymentActive:!1,isPaymentActive:l.isPaymentActive,waitForPaymentIdle:l.waitForPaymentIdle,backHomeCountdown:l.backHomeCountdown,canRetryPayment:!!(x&&!v&&("failed"===_||"closed"===_)),retryPayment:R,resettingHome:!1,returnHome:l.returnHome,startNewOrder:l.startNewOrder}}({context:A,isActive:e.isActive,locale:F,scopeKey:E,sessionId:e2.sessionId,operationLog:e1,beforeSubmit:tR,beforeCheckout:()=>{var e;return!tq.pending&&!tq.error&&!tS()&&tL()&&((null==(e=eQ.current)?void 0:e.validateContact())??!1)},onOrderSubmitted:e2.discard,onFailureConfirmed:e2.restart,onPaymentFinished:e2.finishSubmitted,onKioskFinish:e=>eV.current(e)});eB.current=t$.isPaymentActive,eH.current=t$.waitForPaymentIdle;let tF=function(e){var t,l,i,a,n;let r=eR(),o=null==r||null==(i=r.appHelper)||null==(l=i.utils)||null==(t=l.getApp)?void 0:t.call(l),s=(0,eN.useRef)(e);s.current=e;let d=(0,eN.useRef)();e.sessionId&&((null==(a=d.current)?void 0:a.source)!==e.source||d.current.sessionId!==e.sessionId)?d.current={source:e.source,sessionId:e.sessionId,session:e.session,onReset:e.onReset,onRequestHome:e.onRequestHome}:(null==(n=d.current)?void 0:n.source)===e.source&&e.sessionId&&(d.current.session=e.session,d.current.onReset=e.onReset,d.current.onRequestHome=e.onRequestHome);let c=d.current,u=(0,eN.useRef)(!0),p=(0,eN.useRef)(0),m=(0,eN.useRef)(),g=(0,eN.useRef)(),[h,v]=(0,eN.useState)(!1),[f,y]=(0,eN.useState)(),b=()=>s.current.isPaymentActive?s.current.isPaymentActive():s.current.paymentActive,x=async e=>{if(e)await e();else{var t;if("function"!=typeof(null==o||null==(t=o.history)?void 0:t.replace))throw Error("Home navigation is unavailable. Please try again.");await o.history.replace("/")}},k=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!s.current.enabled||b())return Promise.resolve(!1);if(!e||e.source!==s.current.source){if(!t)return Promise.resolve(!1);if(g.current)return g.current;let e=s.current.source,l=s.current.onRequestHome,i=(async()=>{u.current&&(v(!0),y(void 0));try{return await x(l),!0}catch(t){return u.current&&s.current.source===e&&y(t instanceof Error?t.message:String(t)),!1}finally{u.current&&v(!1)}})();return g.current=i,i.then(()=>{g.current===i&&(g.current=void 0)}),i}let i=()=>d.current===e&&s.current.source===e.source;if(t&&!i())return Promise.resolve(!1);if(m.current)return m.current.owner===e?m.current.promise:Promise.resolve(!1);let a=(async()=>{u.current&&i()&&(v(!0),y(void 0));try{if(i()&&e.session.ownsSession()&&e.onReset(),!(l||t||!1===s.current.isActive||!i()?await e.session.retire({canRetire:()=>!b()}):await e.session.restart()))return!1;if(t){if(!i()||b())return!1;await x(e.onRequestHome)}return!0}catch(e){return u.current&&i()&&y(e instanceof Error?e.message:String(e)),!1}})(),n={owner:e,promise:a};return m.current=n,a.then(()=>{m.current===n&&(m.current=void 0,u.current&&v(!1))}),a},_=(0,eN.useRef)(k);_.current=k;let w=(0,eN.useCallback)(e=>{let{navigateHome:t}=e;return _.current(c,t)},[c]),S=(0,eN.useCallback)(()=>_.current(c,!1),[c]);return(0,eN.useEffect)(()=>(u.current=!0,++p.current,()=>{u.current=!1,++p.current}),[]),(0,eN.useEffect)(()=>{!e.enabled||!1!==e.isActive||b()||_.current(c,!1,!0)},[e.enabled,e.isActive,e.paymentActive,c]),(0,eN.useEffect)(()=>{var t;if(!e.enabled||!1===e.isActive||!c)return;let l=null==o||null==(t=o.getPlugin)?void 0:t.call(o,"screenProtector");if("function"==typeof(null==l?void 0:l.subscribeTrigger))return l.subscribeTrigger(()=>{_.current(c,!1,!0)})},[o,e.enabled,e.isActive,c]),(0,eN.useEffect)(()=>{if(e.enabled&&c)return()=>{let e=p.current;Promise.resolve().then(()=>{u.current&&d.current===c||!u.current&&p.current!==e||b()||_.current(c,!1,!0)})}},[e.enabled,c]),{finish:w,reset:S,resetting:h,error:f}}({enabled:$,isActive:e.isActive,sessionId:e2.sessionId,source:R,session:e2,paymentActive:t$.paymentActive,isPaymentActive:()=>eB.current(),onRequestHome:e.onRequestHome,onReset:()=>{++eU.current,eq.current=!1,ea(void 0),er(void 0),es(void 0),ec(void 0),ep(void 0),eg(!1),eD(void 0),eO(!1),ev(void 0),e_(void 0),ex(void 0),ej(!1),eT(!1),ey(!1),e$(!1),K("select"),Z(!1),el("date"),T.close(),M.customerAuth.dismiss(),M.holder.dismiss(),M.normalProductDetail.dismiss(),M.bookingEdit.dismiss(),M.multiDay.dismiss(),M.allergySelection.dismiss(),M.settlementSelect.dismiss(),M.settlementConflict.dismiss(),M.holderConfirm.cancel()}});eV.current=tF.finish,(0,eN.useEffect)(()=>{tF.error&&ev(tF.error)},[tF.error]);let tq=function(e){var t,l,i;let a=(0,eN.useRef)(e);a.current=e;let n=(0,eN.useRef)(!0),r=(0,eN.useRef)(),o=(0,eN.useRef)(),s=(0,eN.useRef)(!1),[,d]=(0,eN.useState)(0),[c,u]=(0,eN.useState)(),p=(0,eN.useMemo)(()=>e.enabled?e0C(e.order,e.scopeKey,e.mainProducts,e.extrasProducts):[],[e.enabled,e.os,e.scopeKey,e.order,null==(t=e.order)?void 0:t.products,null==(i=e.order)||null==(l=i._extend)?void 0:l.productsByUid,e.mainProducts,e.extrasProducts]),m=!!c&&e0M(c.owner,e),g=m?c.error:void 0,h=e.enabled&&(m&&c.pending||!g&&p.length>0);return(0,eN.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]),(0,eN.useEffect)(()=>{var t;let l=o.current;if(!l||e0M(l.owner,e)&&(0,ni.isEqual)(l.ownership,e0T(e.os.getTempOrder()||{}))||(o.current=void 0,s.current=!1,u(e=>(null==e?void 0:e.owner)===l.owner?void 0:e)),!e.enabled||r.current)return;let i=o.current&&e0M(o.current.owner,e)?o.current:void 0;if(i&&!s.current||!p.length&&!i)return;s.current=!1;let c={os:e.os,scopeKey:e.scopeKey,order:e.order,identity:eKA(e.order),customer:String((null==(t=e.order)?void 0:t.customer_id)||"")};if(!c.order||!e0M(c,e))return;let m=(null==i?void 0:i.published)?i:{owner:c,patches:p,ownership:(0,ni.cloneDeep)(e0T(c.order)),published:!1};r.current=m,u({owner:m.owner,pending:!0});let g=()=>n.current&&e0M(m.owner,a.current),h=()=>0===e0C(m.owner.order,m.owner.scopeKey,e.mainProducts,e.extrasProducts).length,v=String(e.locale||"").startsWith("zh")?"无法更新定金信息,请重试。":"Could not update deposit details. Please try again.";(async()=>{try{if(!g())return;if(!m.published){if(!m.patches.length||!e.os.updateOrderProducts)throw Error(v);let t=(0,ni.cloneDeep)({products:c.order.products,bookings:c.order.bookings,customer:c.order.customer_id,payments:c.order.payments,metadata:c.order.metadata,extend:c.order._extend});if(await e.os.updateOrderProducts(m.patches,{beforeApply:()=>{let l=e.os.getTempOrder();if(!a.current.enabled||a.current.mainProducts!==e.mainProducts||a.current.extrasProducts!==e.extrasProducts||!g()||!(0,ni.isEqual)(m.ownership,e0T(l||{}))||!(0,ni.isEqual)(t,{products:null==l?void 0:l.products,bookings:null==l?void 0:l.bookings,customer:null==l?void 0:l.customer_id,payments:null==l?void 0:l.payments,metadata:null==l?void 0:l.metadata,extend:null==l?void 0:l._extend}))throw Error(v)},isCurrentOrder:g}),!g())return;if(m.ownership=(0,ni.cloneDeep)(e0T(m.owner.order)),m.published=h(),!m.published)throw Error(v)}if(!g())return;if(!e.os.getSummary)throw Error(v);let t=await e.os.getSummary();if(!g())return;if(!t||"object"!=typeof t)throw Error(v);a.current.refreshSnapshot(),o.current=void 0,u({owner:m.owner,pending:!1})}catch(e){if(g()){m.ownership=(0,ni.cloneDeep)(e0T(m.owner.order)),m.published=h(),o.current=m,u({owner:m.owner,pending:!1,error:e0_(e,v)});try{a.current.refreshSnapshot()}catch{}}}finally{r.current===m&&(r.current=void 0),n.current&&(u(e=>(null==e?void 0:e.owner)===m.owner&&e.pending?void 0:e),d(e=>e+1))}})()}),{pending:h,error:g,retry:()=>{e.enabled&&!r.current&&g&&(s.current=!0,d(e=>e+1))}}}({os:R,scopeKey:E,order:tf,locale:F,mainProducts:tv.products,extrasProducts:tk.products,enabled:tl&&!tv.loading&&!tv.error&&!tk.loading&&!tk.error&&!ef&&!eS&&!eC&&!t_.busy&&!tw.pending&&!ei&&!en&&!t$.submitting&&!t$.failure&&!eL,refreshSnapshot:L.refreshCartSnapshot}),tB=!tl||ef||eS||t_.busy||tw.pending||tq.pending||t$.submitting||!!t$.failure||!!t$.submittedOrderId||eL,tH=!tl||!1===e.isActive||ef||eS||eC||t_.busy&&!tS()||tq.pending||t$.submitting||!!t$.failure||!!t$.submittedOrderId||eL||!!ei||!!en||!!eA||tk.loading||!!tk.error,tV=tB||eC,tU=null==(v=R.getOrderAmountSnapshot)?void 0:v.call(R),tY=(null==tU?void 0:tU.summary)||(null==tf?void 0:tf.summary)||A.summary.summary,tW=(null==tU?void 0:tU.depositAmount)??(null==tY?void 0:tY.deposit_amount)??(null==tf?void 0:tf.deposit_amount),tG=Number(tW)>0&&!!((null==tU?void 0:tU.isDeposit)??1===Number(null==tf?void 0:tf.is_deposit)),tK=eCE({baseSalesAmountGap:null==tU?void 0:tU.amountGap,amountGap:null==tY?void 0:tY.amount_gap,fallbackAmount:null==tY?void 0:tY.total_amount,payments:null==tf?void 0:tf.payments}),tQ=ty.bindings.reduce((e,t)=>{let l=String(t.line.product_id);return e[l]=(e[l]||0)+t.quantity,e},{}),tZ=eJK(A,E);(0,eN.useEffect)(()=>{!tl||"review"!==G||tC||!tZ.complete||en||tk.loading||tk.error||tL()},[tl,G,tC,tZ.complete,en,tk.loading,tk.error,tk.products,L.tempOrder]);let tJ=ty.bindings.length>0,tX=tj?"extras":"review",t0=tZ.required?"holder":tX,t2=ty.bindings.every(e=>e.date===V);return{props:e,engine:j,bookingUI:N,orderPanel:T,mode:P,context:A,config:D,scopeKey:E,variant:O,sales:z,cart:L,os:R,isKiosk:$,locale:F,text:q,today:B,date:V,setDate:U,visibleDates:Y,setVisibleDates:W,step:G,setStep:K,dateConfirmed:Q,setDateConfirmed:Z,expandedSection:et,setExpandedSection:el,dateSearchRange:tg,dateInteractionStarted:tp,onDateInteraction:tu,canAutoSelectDate:()=>tc.current===td&&ee.current!==td,composer:ei,setComposer:ea,configurationModal:en,setConfigurationModal:er,error:eh,setError:ev,busy:ef,pendingExtraProductId:eb,preparingProductId:ek,composerBusy:eS,setComposerBusy:ej,rememberPartyPreview:(e,t)=>{if(!eW.current||"party"!==P||!ei||tT.current.composerKey!==e)return;let l=e0k({...ei,...t},"booking");es(t=>(null==t?void 0:t.key)===e&&JSON.stringify(t.value)===JSON.stringify(l)?t:{key:e,value:l})},previewRecovery:ed,previewRecoveryError:eu,recoveringPreview:em,retryPartyPreview:()=>ec(e=>e&&{...e,attempt:e.attempt+1}),discardPartyPreview:()=>{++eU.current,ea(void 0),er(void 0),es(void 0),ep(void 0),eg(!1),ec(void 0),el("product")},uiHydrated:e5,subscribePartyProductConfirmed:eK,notifyPartyProductConfirmed:e4,holderBusy:eC,setHolderBusy:eT,externalHolderDisabled:tB,revision:eI,setRevision:eP,linePicker:eA,setLinePicker:eD,showOffers:eE,setShowOffers:eO,handoff:eL,setHandoff:e$,confirmation:eQ,alive:eW,mainCatalog:eZ,mainQueries:tr,extrasQueries:to,customerId:eJ,refresh:e0,session:e2,ready:tl,main:tv,order:tf,bindings:ty,partyMain:tb,operationLog:e1,extrasCatalog:tk,extras:t_,extraQuantity:tw,extraQuantityDisabled:tH,isExtraQuantityPending:tS,dateStates:tM,run:tI,policy:tP,openProduct:tA,editLine:e=>tI(async()=>{let t=eJY(R.getTempOrder(),{mode:P}).bindings.find(t=>t.productLineUid===e);if(!t)throw Error(q("This booking changed. Please refresh your order.","预约已变化,请刷新订单。"));await tA({id:Number(t.line.product_id)},e,"party"!==P)}),removeLine:e=>tE([e]),removeLines:tE,removeTicket:(e,t)=>tD([e],{uid:e,index:t}),changeDate:tO,showExtraPreparation:tz,checkout:t$,kioskLifecycle:tF,depositHydration:tq,disabled:tV,openOrderHistory:()=>{var e,t,l,i,a,n;let r="h5"===String((null==(e=R.otherParams)?void 0:e.platform)||(null==j||null==(l=j.appHelper)||null==(t=l.constants)?void 0:t.platform))?"/orders":"/order",o=null==j||null==(a=j.appHelper)||null==(i=a.utils)?void 0:i.history;(null==o?void 0:o.push)?o.push(r):window.location.assign(`${(null==(n=window.location.pathname.match(/^\/(en|zh-CN|zh-HK|ja|pt)(?=\/|$)/))?void 0:n[0])||""}${r}`)},summary:tY,amount:e=>Yg(tf,e??0),amountDue:tK,hasDeposit:tG,depositAmount:tW,productQuantities:tQ,holderState:tZ,checkExtraHolders:tL,mainPoolEmpty:tN,mainCatalogBlocked:tC,hasExtras:tj,nextAfterHolder:tX,nextAfterSelect:t0,hasBookings:tJ,mainDateMatches:t2,continueOrder:e=>{!(tV||tq.error||tC||tS())&&tJ&&!ei&&t2&&(ev(void 0),K(e))}}}let e0A=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,128l-72,72V56Z",opacity:"0.2"}),eN.createElement("path",{d:"M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z"}))]]),e0D=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e0A}));e0D.displayName="ArrowRightIcon";let e0E=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),eN.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z"}))]]),e0O=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e0E}));function e0z(e){let{id:t,number:l,title:i,meta:a,className:n="",children:r,...o}=e;return(0,eB.jsxs)("section",{...o,className:`checkout-module ${n}`,id:t,"aria-labelledby":`${t}-heading`,children:[(0,eB.jsxs)("header",{className:"checkout-module-heading",children:[(0,eB.jsx)("span",{className:"checkout-module-number","aria-hidden":"true",children:l}),(0,eB.jsx)("h2",{id:`${t}-heading`,children:i}),a&&(0,eB.jsx)("span",{className:"checkout-module-meta",children:a})]}),(0,eB.jsx)("div",{className:"checkout-module-body",children:r})]})}function e0L(e){let{id:t,label:l,value:i,onChange:a,maxLength:n=500,rows:r=3,placeholder:o,disabled:s=!1,hint:d,hideLabel:c=!1}=e;return(0,eB.jsxs)("div",{className:"note-field",children:[(0,eB.jsx)("label",{className:c?"sr-only":"field",htmlFor:t,children:l}),(0,eB.jsx)("textarea",{id:t,value:i,onChange:e=>a(e.target.value),rows:r,maxLength:n,placeholder:o,disabled:s,"aria-describedby":`${t}-count`}),(0,eB.jsxs)("p",{className:"note-help small muted",children:[(0,eB.jsx)("span",{children:d}),(0,eB.jsxs)("span",{id:`${t}-count`,children:[i.length,"/",n]})]})]})}e0O.displayName="PlusIcon";let e0R=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm68-84a12,12,0,0,1-12,12H128a12,12,0,0,1-12-12V72a12,12,0,0,1,24,0v44h44A12,12,0,0,1,196,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm56,112H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm62-90a6,6,0,0,1-6,6H128a6,6,0,0,1-6-6V72a6,6,0,0,1,12,0v50h50A6,6,0,0,1,190,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm60-92a4,4,0,0,1-4,4H128a4,4,0,0,1-4-4V72a4,4,0,0,1,8,0v52h52A4,4,0,0,1,188,128Z"}))]]),e0$=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e0R}));e0$.displayName="ClockIcon";let e0F=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z",opacity:"0.2"}),eN.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z"}))]]),e0q=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e0F}));e0q.displayName="PencilSimpleIcon";let e0B=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),eN.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),e0H=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e0B}));function e0V(e){let{title:t,image:l,icon:i,details:a,amount:n,action:r,removeAction:o,children:s,className:d="",layout:c="card",id:u}=e;return(0,eB.jsxs)("article",{id:u,className:`booking-order-item booking-order-item-${c} ${d}`,children:[(0,eB.jsxs)("div",{className:"booking-order-item-heading",children:[i&&(0,eB.jsx)("span",{className:"booking-order-item-icon","aria-hidden":"true",children:i}),l&&(0,eB.jsx)("img",{className:"booking-order-item-image",src:l,alt:""}),(0,eB.jsxs)("div",{className:"booking-order-item-copy",children:[(0,eB.jsx)("h3",{children:t}),a&&(0,eB.jsx)("div",{className:"booking-order-item-details",children:a}),void 0!==n&&(0,eB.jsx)("strong",{className:"booking-order-item-amount",children:n}),(r||o)&&(0,eB.jsxs)("div",{className:"booking-order-item-actions",children:[r&&(0,eB.jsx)(eKZ,{className:"booking-order-item-edit","aria-label":r.label,disabled:r.disabled,onClick:r.onClick,children:(0,eB.jsx)(e0q,{size:18,"aria-hidden":"true"})}),o&&(0,eB.jsx)(eKZ,{className:"booking-order-remove","aria-label":o.label,disabled:o.disabled,onClick:o.onClick,children:(0,eB.jsx)(e0H,{size:18,"aria-hidden":"true"})})]})]})]}),s&&(0,eB.jsx)("div",{className:"booking-order-item-content",children:s})]})}function e0U(e){let{items:t}=e;return(0,eB.jsx)("dl",{className:"booking-order-details",children:t.map((e,t)=>(0,eB.jsxs)("div",{className:"booking-order-detail",children:[(0,eB.jsx)("dt",{children:e.label}),(0,eB.jsxs)("dd",{children:[(0,eB.jsxs)("div",{children:[(0,eB.jsx)("strong",{children:e.value}),e.detail&&(0,eB.jsx)("div",{className:"booking-order-detail-copy",children:e.detail})]}),e.action&&(0,eB.jsx)("button",{type:"button",className:"text-link",disabled:e.action.disabled,onClick:e.action.onClick,children:e.action.label})]})]},t))})}function e0Y(e){let{rows:t,lang:l,formatAmount:i}=e;return(0,eB.jsx)("div",{className:"booking-price-breakdown",children:t.map(e=>(0,eB.jsxs)("div",{className:"booking-price-line",children:[(0,eB.jsx)(eKU,{label:e.label,amount:e.amount,formatAmount:i,total:"total"===e.tone,lang:l,className:"discount"===e.tone?"discount":""}),e.detail&&(0,eB.jsx)("div",{className:"small muted booking-price-detail",children:e.detail})]},e.id))})}function e0W(e){let{title:t,description:l,children:i}=e;return(0,eB.jsxs)("section",{className:"booking-holder-section",children:[t&&(0,eB.jsx)("h2",{children:t}),l&&(0,eB.jsx)("p",{className:"muted",children:l}),(0,eB.jsx)("div",{className:"booking-holder-content",children:i})]})}e0H.displayName="TrashIcon";let e0G=e=>null==e?"":String(e),e0K=e=>e0G(e).slice(0,10),e0Q=e=>{let t=e0G(e);return/^\d{2}:\d{2}$/.test(t)?`${t}:00`:t};function e0Z(e,t){var l,i,a,n,r,o,s,d;if(!t||!e.product_id||(null==(l=e._extend)?void 0:l.independentLine)===!0||(null==(n=e.metadata)||null==(a=n.origin)||null==(i=a._extend)?void 0:i.independentLine)===!0)return null;let c=e0K(t.start_date),u=e0K(t.end_date),p=e0Q(t.start_time),m=e0Q(t.end_time);if(![c,u].every(e=>/^\d{4}-\d{2}-\d{2}$/.test(e))||![p,m].every(e=>/^\d{2}:\d{2}:\d{2}$/.test(e)))return null;let g=Array.isArray(t.resources)?t.resources:[];return g.some(e=>!e||!e0G(e.relation_id??e.resource_id??e.id)||!e0G(e.form_id))?null:JSON.stringify(function e(t){return null==t?null:Array.isArray(t)?t.map(e):"object"==typeof t?Object.keys(t).sort().reduce((l,i)=>(l[i]=e(t[i]),l),{}):t}({product:e0G(e.product_id),variant:e0G(e.product_variant_id),sku:{...e.product_sku,option:exP(e)},bundle:e.product_bundle||[],businessDate:e0K((null==(r=t.metadata)?void 0:r.availability_business_date)||c),startDate:c,endDate:u,startTime:p,endTime:m,timezone:e0G(null==(o=t.metadata)?void 0:o.availability_timezone),resources:g.map(e=>({form:e0G(e.form_id),id:e0G(e.relation_id??e.resource_id??e.id),type:e0G(e.relation_type),capacity:e0G(e.capacity)})).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t))),legacyResource:g.length?null:{id:e0G(t.relation_id??t.resource_id),type:e0G(t.relation_type)},role:e0G(null==(s=e.metadata)?void 0:s.venue_booking_role),scope:e0G(null==(d=e.metadata)?void 0:d.venue_booking_scope_key)}))}function e0J(e,t){let l=[],i=new Map;return e.forEach((e,a)=>{let n=t(e),r=null===n?void 0:i.get(n);if(r)r.members.push(e);else{let t={key:null===n?`separate:${a}`:`group:${n}`,members:[e]};l.push(t),null!==n&&i.set(n,t)}}),l}function e0X(e,t,l,i,a){let n=e=>[null==e?void 0:e.bundle_title,null==e?void 0:e.title,null==e?void 0:e.name,null==e?void 0:e.product_title].map(e=>eKT(e,l)).find(Boolean);return(e.product_bundle||[]).flatMap((l,r)=>{var o,s;if(!l)return[];let d=Number(l.num??l.quantity??1);if(!Number.isSafeInteger(d)||d<=0)return[];let c=l.bundle_id??l.id,u=l.bundle_group_id??l.group_id,p=null!=c?{bundle_id:c,bundle_group_id:u}:l;return[{key:`${u??""}:${c??""}:${r}`,name:n(l)||n((null==(o=l.metadata)?void 0:o.origin)??l.origin??l.product)||n(ewb(p,[null==(s=e.metadata)?void 0:s.origin,a,i])),quantity:d*t}]})}async function e00(e){var t,l,i,a,n,r,o,s,d;let{handle:c,line:u,holderIds:p,assertCurrent:m,beforeWrite:g}=e,h=null==(t=u.orderLine.metadata)?void 0:t.venue_booking_role,v=String((null==(l=u.orderLine.metadata)?void 0:l.unique_identification_number)||""),f=String((null==(a=u.booking)||null==(i=a.metadata)?void 0:i.unique_identification_number)||"");if("tickets"!==h&&"party_main"!==h||!v||!f||1!==Number(u.orderLine.num)||1!==p.length||!c.updateOrderBooking)throw Error("This booking cannot accept a Holder-only update. Please reselect the booking.");m();let y=null==(n=c.getTempOrder)?void 0:n.call(c),b=null==y||null==(r=y.bookings)?void 0:r.find(e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)||"")===f});if(!b||String(b.product_uid||"")!==v)throw Error("The booking link changed. Please review the order.");let x=JSON.stringify(b),k=null==y?void 0:y.customer_id,_=await (null==(o=c.getOtherParams)?void 0:o.call(c));m();let w=null==(s=c.getTempOrder)?void 0:s.call(c),S=null==w||null==(d=w.bookings)?void 0:d.find(e=>{var t;return String((null==(t=e.metadata)?void 0:t.unique_identification_number)||"")===f});if(w!==y||(null==w?void 0:w.customer_id)!==k||!S||JSON.stringify(S)!==x)throw Error("The booking changed while choosing a Holder. Please try again.");let j=ekA(p,{customerId:k,isFranchisee:!!(null==_?void 0:_.isFranchisee),holderOptions:e.holderOptions,productSource:u.cacheItem});g(),await c.updateOrderBooking({unique_identification_number:f,updates:{holder:j,metadata:{holder_id:p}}})}function e02(e){let{formId:t,customerId:l,locale:i,onClose:a,onCreated:n,onUnconfirmed:r,isCurrent:o}=e,s=eF(),[d]=YK({components:["FormCard"]}),[c,u]=(0,eN.useState)(),[p,m]=(0,eN.useState)(),[g,h]=(0,eN.useState)(!1),[v,f]=(0,eN.useState)(!1),[y,b]=(0,eN.useState)(!1),x=(0,eN.useRef)(null),k=(0,eN.useRef)(!0),_=(0,eN.useRef)(!1),w=String(i||"").startsWith("zh"),S=(e,t)=>w?t:e;(0,eN.useEffect)(()=>{k.current=!0;let e=!1;return(async()=>{var l,i,a,n;let r=await UC(Number(t),s);if(!r)throw Error(S("The holder form is unavailable.","持票人表单未加载。"));let d=r.form_field??r.field,c=(r.form_type??(null==(l=r.form)?void 0:l.form_type))==="minors"?null==d||null==(a=d.find(e=>"form_to_form"===e.filed_type&&"hide"===e.status))||null==(i=a.setting)?void 0:i.linkedTable:void 0,p=c?await s5(Number(c),s):r;if(!p)throw Error(S("The linked waiver form is unavailable.","关联协议表单未加载。"));!e&&o()&&u({id:Number(c||t),title:String((null==(n=p.form)?void 0:n.title)||p.title||S("New holder profile","新建持票人档案")),franchisor:r.is_franchisor,linkedWaiver:!!c})})().catch(t=>{e||m(e0_(t,S("Unable to load the holder form.","无法加载持票人表单。")))}),()=>{e=!0,k.current=!1}},[t,l,s]);let j=async(e,t)=>{if(!k.current||!c||_.current)return;if("success"!==e){f(!0),h(!1),r(),m(S("The save result is unknown. Close this form and refresh the profile list before trying again.","保存结果尚未确认,请关闭表单并刷新档案列表后核对,勿重复创建。"));return}let l=Array.isArray(t)?Object.fromEntries(t.filter(e=>e&&"object"==typeof e&&"string"==typeof e.key).map(e=>[e.key,e.value])):t&&"object"==typeof t?{...t}:{};_.current=!0;try{o()&&await n({record:l,linkedWaiver:c.linkedWaiver}),k.current&&a()}catch(e){k.current&&(f(!0),r(),m(e0_(e,S("The profile was saved. Refresh the list to select it.","档案已保存,请刷新列表后选择,勿重复创建。"))))}finally{k.current&&h(!1)}};return(0,eB.jsxs)(eQu,{title:(null==c?void 0:c.title)||S("New holder profile","新建持票人档案"),className:"venue-holder-create-modal",mobile:"fullscreen",zIndex:600,closeLabel:S("Close","关闭"),externalDialogSelector:eQd,bodyClassName:"venue-holder-create-body venue-booking-legacy-controls",footerClassName:"venue-holder-create-footer",onClose:()=>{g&&_.current||(g&&r(),k.current=!1,a())},closeDisabled:g&&_.current,closeOnBackdrop:!g,closeOnEscape:!g,footer:(0,eB.jsx)(eKQ,{disabled:!y||v||!o(),busy:g,onClick:()=>{var e;(null==(e=x.current)?void 0:e.submit)&&o()&&(h(!0),m(void 0),x.current.submit())},children:g?S("Saving…","保存中…"):S("Save profile","保存档案")}),children:[p&&(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:p}),g&&!_.current&&(0,eB.jsx)("p",{className:"small muted",children:S("Saving. If you close this form, check the profile list before creating another profile.","正在保存。如需关闭,请先核对档案列表,勿重复创建。")}),!c&&!p&&(0,eB.jsx)(eM.Spin,{}),c&&(d?(0,eB.jsx)(d,{id:c.id,venueHolderLinkedRecords:!0,ref:e=>{x.current=e},isGetLastData:!1,setting:{isHidden:1},isV2API:!0,isShowSkeleton:!0,isClearData:!1,submitExtraParams:{...null!=l&&""!==l?{customer_id:l}:{},...null!=c.franchisor?{source_shop_customer:c.franchisor}:{}},onSubmit:(e,t)=>void j(e,t),onFormConfigChange:e=>b(!!e&&Object.keys(e).length>0),onChange:(e,t)=>b(!e&&!!t&&Object.keys(t).length>0),onFinishFailed:()=>{h(!1),m(S("Complete the required form fields.","请填写表单中的必填内容。"))}}):(0,eB.jsx)(eM.Alert,{type:"error",message:S("The form component is unavailable.","表单组件未加载。")}))]})}function e01(e,t){let l=String(t||"").startsWith("zh"),i=l?"zh":"en",a=(null==e?void 0:e.form)||e,n=[null==a?void 0:a.title,null==a?void 0:a.name,null==e?void 0:e.title,null==e?void 0:e.name].map(e=>eKT(e,i).trim()).find(Boolean)||(l?"持有人":"Holder");return{name:n,edit:l?`编辑${n}`:`Edit ${n}`,required:l?`必填${n}`:`${n} required`,optional:l?`${n}选填`:`Optional ${n}`,notRequired:l?`无需填写${n}`:`No ${n} required`,choose:l?`选择${n}`:`Select ${n}`,placeholder:l?`请选择${n}`:`Select ${n}`,create:l?"新建":"New",missing:l?`请选择${n}。`:`Please select ${n}.`}}let e04=e=>e0J(e,e=>{let t=e0Z(e.orderLine,e.booking);return null===t?null:JSON.stringify([t,e.config.enabled,e.config.required,String(e.config.formId??"")])}),e03=(0,eN.forwardRef)((e,t)=>{var l,i,a;let{context:n,scopeKey:r,locale:o,isActive:s=!0,disabled:d=!1}=e,c=UF(),u=Uu(),p=(0,eN.useMemo)(()=>eND(u.customerAuth),[u.customerAuth]),m=eKB(),g=dL("venue-holder"),h=(0,eN.useRef)(e);h.current=e;let v=(0,eN.useRef)(!0),f=(0,eN.useRef)(!1),y=(0,eN.useRef)(!1),b=(0,eN.useRef)(null),[x,k]=(0,eN.useState)(),[_,w]=(0,eN.useState)(!1),[S,j]=(0,eN.useState)(),[N,C]=(0,eN.useState)({}),[M,T]=(0,eN.useState)(),[I,P]=(0,eN.useState)(),[,A]=(0,eN.useState)(0),D=n.sales.bookingTicket,E=eJQ(n,r),O=eJK(n,r,o),z=e04(O.displayLines),L=e=>JSON.stringify([E,e.quantity,e.ids]),R=e=>{var t;return(null==(t=N[e.uid])?void 0:t.base)===L(e)?N[e.uid].ids:void 0},$=O.lines.some(e=>!!R(e));O.pending=!!S||!!M||!!I||$,O.complete=O.complete&&!$,O.blocked=eJX(D,E);let F=String(o||"").startsWith("zh"),q=(e,t)=>F?t:e,B=o0(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:E;return v.current&&!1!==h.current.isActive&&eJQ(h.current.context,h.current.scopeKey)===e});(0,eN.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]),(0,eN.useEffect)(()=>{k(void 0),w(!1),T(void 0),C({})},[E]),(0,eN.useEffect)(()=>{if(!I)return;let e=h.current,t=()=>{var e,t;return v.current&&!1!==h.current.isActive&&h.current.scopeKey===I.scopeKey&&h.current.context.sales.bookingTicket===I.handle&&eKA((null==(t=I.handle)||null==(e=t.getTempOrder)?void 0:e.call(t))??h.current.context.sales.tempOrder)===I.owner};if(!t()){P(void 0),j(void 0);return}if(String(eKO(e.context)||"")!==I.customerId)return;let l=eJK(e.context).lines.find(e=>e.uid===I.uid);if(!(null==l?void 0:l.config.formId)||I.index>=l.quantity){P(void 0),j(void 0);return}let i=!0,a=eJQ(e.context,e.scopeKey);return c.prepareHolderOptionsForSource(l.cacheItem).then(e=>{i&&t()&&B(a)&&e.accessAllowed&&(y.current=!1,T({uid:l.uid,index:I.index,identity:a,base:JSON.stringify([a,l.quantity,l.ids]),formId:l.config.formId}))}).catch(e=>{i&&t()&&k(e0_(e,String(h.current.locale||"").startsWith("zh")?"无法打开持票人表单。":"Unable to open the holder form."))}).finally(()=>{i&&v.current&&(P(void 0),j(void 0))}),()=>{i=!1}},[I,E,c.prepareHolderOptionsForSource,B]);let H=JSON.stringify([E,O.requiredCount,O.requiredCompleted,O.total,O.completed,O.pending,O.blocked,O.lines.map(e=>[e.uid,e.config.formId,e.ids]),N]);(0,eN.useEffect)(()=>{var e,t;null==(e=(t=h.current).onStateChange)||e.call(t,O)},[H]);let V=JSON.stringify(O.lines.map(e=>[e.uid,e.config.formId]));(0,eN.useEffect)(()=>{if(!s||!D)return;let e=new Set;for(let t of O.lines){let l=String(t.config.formId);e.has(l)||(e.add(l),c.prepareHolderOptionsForSource(t.cacheItem).catch(e=>{B()&&k(e0_(e,q("Unable to load holder profiles.","无法加载持票人档案。")))}))}},[D,E,V,s]),(0,eN.useImperativeHandle)(t,()=>({validate:async()=>{let e=eJK(h.current.context),t=eJX(h.current.context.sales.bookingTicket,eJQ(h.current.context,h.current.scopeKey));return!B()||f.current||M||$||t||!e.complete?(w(!0),k(t?q("A holder update could not be confirmed. Review the order before making another change.","持票人写回结果未确认,请先核对订单,勿重复修改。"):q("Complete the required holder details before continuing.","请先完成必填持票人资料。")),requestAnimationFrame(()=>{var e,t;return null==(t=b.current)||null==(e=t.querySelector('[aria-invalid="true"]'))?void 0:e.focus()}),!1):(k(void 0),!0)}}));let U=(e,t)=>{let l;if(!B(e))return;let i=eJK(h.current.context,h.current.scopeKey);if(i.blocked)return;let a=t&&i.lines.find(e=>e.uid===t.uid),n=e04(i.lines).reduce((e,t)=>e.concat(t.members),[]);for(let e of a?[a,...n.filter(e=>e.config.required&&e.uid!==a.uid)]:n.filter(e=>e.config.required)){let i=(null==t?void 0:t.uid)===e.uid?t.ids:R(e)||e.ids,a=Array.from({length:e.quantity},(e,t)=>i[t]).findIndex(e=>null==e||""===e);if(a>=0){l={uid:e.uid,index:a};break}}let r=l;m(()=>{var t;return!B(e)||f.current||h.current.disabled||!b.current?null:r?Array.from(b.current.querySelectorAll("[data-venue-holder-line]")).find(e=>e.dataset.venueHolderLine===r.uid&&e.dataset.venueHolderIndex===String(r.index)):Array.from((null==(t=b.current.closest(".booking-page"))?void 0:t.querySelectorAll(".booking-primary-action"))||[]).find(eKS)},{block:r?"start":"nearest"})},Y=async function(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:E;if(!D||f.current||d||!B(i)||eJX(D,i))return;let a=e_j(D,e);if(!a)return void k(q("This ticket changed. Please review the order.","该门票已变化,请重新核对订单。"));let r=eJK(h.current.context).lines.find(t=>t.uid===e);if(!r||!Number.isInteger(t)||t<0||t>=r.quantity)return;let o=JSON.stringify([a.orderLine,a.booking]),s=[...R(r)||r.ids];if(s[t]=l,r.quantity>1&&Array.from({length:r.quantity},(e,t)=>s[t]).some(e=>null==e||""===e)){C(t=>({...t,[e]:{base:L(r),ids:s}})),U(i,{uid:e,ids:s});return}let u=s.slice(0,r.quantity).filter(e=>void 0!==e&&""!==e).map(Number);if(u.some(e=>!Number.isSafeInteger(e)||e<=0))return void k(q("The holder profile ID is invalid.","档案编号无效。"));f.current=!0,j(e),k(void 0);let p=!1,m=()=>{let t=e_j(D,e);if(!B(i)||!t||!p&&JSON.stringify([t.orderLine,t.booking])!==o)throw Error(q("The order changed. Please review its holders again.","订单已变化,请重新核对持票人。"))};try{var g,y,b,x;let t=null==(g=a.orderLine.metadata)?void 0:g.venue_booking_role;if(a.booking&&("tickets"===t||"party_main"===t))await e00({handle:D,line:a,holderIds:u,holderOptions:c.getHolderOptionsForSource(a.cacheItem),assertCurrent:m,beforeWrite:()=>{m(),p=!0}});else{let e=new Proxy(D,{get(e,t){let l=Reflect.get(e,t);return"addProductToOrder"===t&&"function"==typeof l?function(){for(var t=arguments.length,i=Array(t),a=0;a<t;a++)i[a]=arguments[a];return m(),p=!0,l.apply(e,i)}:"function"==typeof l?l.bind(e):l}});await e_f({line:a,bookingTicket:e,tempOrder:(null==(y=D.getTempOrder)?void 0:y.call(D))??n.sales.tempOrder,openHolderSelect:async()=>(m(),u),updateItem:async e=>(m(),p=!0,n.cart.updateItem(e)),getHolderOptions:()=>c.getHolderOptionsForSource(a.cacheItem),getHolderFormDetail:()=>c.getHolderFormDetailForSource(a.cacheItem)})}B(i)&&(C(t=>{let l={...t};return delete l[e],l}),n.cart.refreshCartSnapshot(),await (null==(b=(x=h.current).onMutation)?void 0:b.call(x)),B(i)&&(A(e=>e+1),U(i)))}catch(e){p&&function(e,t){let l=eJZ.get(e)||new Set;l.add(t),eJZ.set(e,l);try{sessionStorage.setItem(eJJ(t),"1")}catch{}}(D,i),B(i)&&k(e0_(e,q("Unable to update the holder.","持票人写回失败。")))}finally{f.current=!1,v.current&&j(void 0)}},W=async e=>{let t=await c.prepareHolderOptionsForSource(e.cacheItem,{refresh:!0});return t.accessAllowed&&B()?t.options:[]},G=async e=>{var t;let l;if(!M||!B(M.identity))return;let i=eJK(h.current.context).lines.find(e=>e.uid===M.uid);if(!i||L(i)!==M.base||String(i.config.formId)!==String(M.formId)||M.index>=i.quantity)return;let a=Number.isSafeInteger(l=Number((t=e.record).form_record_id??t.id??t.record_id))&&l>0?l:void 0;e.linkedWaiver||null==a||c.upsertHolderOptions([{...e.record,form_record_id:a}],i.cacheItem);let n=await W(i);y.current=!0;let r=e.linkedWaiver?void 0:a;if(e.linkedWaiver){let t=e.record.form_to_form_value,l=(Array.isArray(t)?t:[]).find(e=>String(null==e?void 0:e.form_id)===String(M.formId)),i=Array.isArray(null==l?void 0:l.form_data_value)?l.form_data_value:[];1===i.length&&n.some(e=>String(e.id)===String(i[0]))&&(r=i[0])}let o=eJK(h.current.context).lines.find(e=>e.uid===M.uid);null!=r&&o&&L(o)===M.base&&B(M.identity)&&await Y(M.uid,M.index,r,M.identity)},K=async(e,t)=>{if(d||O.blocked||f.current||!e.config.formId||eJ2(D,`${E}:${e.config.formId}`))return;f.current=!0,j(e.uid);let l=!1;try{if(eKz(n,{products:[e.cacheItem],force:!0})){var i;let a=eKA((null==D||null==(i=D.getTempOrder)?void 0:i.call(D))??n.sales.tempOrder),o=()=>{var e;return v.current&&!1!==h.current.isActive&&h.current.scopeKey===r&&h.current.context.sales.bookingTicket===D&&eKA((null==D||null==(e=D.getTempOrder)?void 0:e.call(D))??h.current.context.sales.tempOrder)===a};if(!await eKL({context:n,products:[e.cacheItem],force:!0,openCustomerAuth:p,isCurrent:o})||!o())return;l=!0,P({uid:e.uid,index:t,handle:D,scopeKey:r,owner:a,customerId:String(eKO(n))});return}(await c.prepareHolderOptionsForSource(e.cacheItem)).accessAllowed&&B()&&(y.current=!1,T({uid:e.uid,index:t,identity:E,base:L(e),formId:e.config.formId}))}catch(e){B()&&k(e0_(e,q("Unable to open the holder form.","无法打开持票人表单。")))}finally{f.current=!1,v.current&&!l&&j(void 0)}},Q=async(e,t)=>{var l;let i=h.current.onRemoveTicket;if(!i||d||f.current||M||O.blocked||!B(E)||1!==e.quantity||0!==t||(null==(l=e.orderLine.metadata)?void 0:l.venue_booking_role)!=="tickets")return;let a=eJK(h.current.context).displayLines.find(t=>t.uid===e.uid);if(a&&L(a)===L(e)){f.current=!0,j(e.uid),k(void 0);try{await i(e.uid,t)&&B(E)&&C(t=>{let l={...t};return delete l[e.uid],l})}catch(e){B(E)&&k(e0_(e,q("Unable to remove this ticket. Please try again.","无法删除这张票,请重试。")))}finally{f.current=!1,v.current&&j(void 0)}}},Z=O.lines.reduce((e,t)=>e+(t.config.required?Math.min(t.quantity,(R(t)||t.ids).filter(e=>null!=e&&""!==e).length):0),0),J=e=>e01(c.getHolderFormDetailForSource(e.cacheItem),o),X=function(t){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=J(t);return Array.from({length:t.quantity},(a,n)=>{var r;let o=c.getHolderOptionsForSource(t.cacheItem),s=0===o.length,u=(R(t)||t.ids)[n],p=null==u?void 0:o.find(e=>String(e.id)===String(u)),m=`${g}-${t.uid}-${n}`,h=_&&t.config.required&&null==u;return(0,eB.jsxs)("div",{className:"child-ticket","data-venue-holder-line":t.uid,"data-venue-holder-index":n,children:[(0,eB.jsx)(e0V,{layout:"row",icon:(0,eB.jsx)(eKq,{size:20,"aria-hidden":"true"}),title:`${t.title||q("Ticket","门票")} #${l+n+1}`,removeAction:e.onRemoveTicket&&1===t.quantity&&(null==(r=t.orderLine.metadata)?void 0:r.venue_booking_role)==="tickets"?{label:`${q("Remove ticket","删除门票")} ${t.title||q("Ticket","门票")} #${l+n+1}`,disabled:d||!!S||!!M||O.blocked||c.loading,onClick:()=>{Q(t,n)}}:void 0}),t.config.enabled&&(0,eB.jsxs)("div",{className:"holder-picker",children:[(0,eB.jsxs)("label",{className:"field",htmlFor:m,children:[(0,eB.jsx)("span",{children:i.choose}),(0,eB.jsxs)("select",{id:m,value:null==u?"":String(u),disabled:d||!!S||!!M||O.blocked||s,style:s?{opacity:.5,cursor:"not-allowed"}:void 0,"aria-invalid":h||void 0,"aria-describedby":h?`${m}-error`:void 0,onChange:e=>{e.target.value&&Y(t.uid,n,e.target.value)},children:[(0,eB.jsx)("option",{value:"",disabled:!0,children:i.placeholder}),null!=u&&!p&&(0,eB.jsx)("option",{value:String(u),children:String(u)}),o.map(e=>(0,eB.jsx)("option",{value:String(e.id),children:e.label||String(e.id)},String(e.id)))]})]}),h&&(0,eB.jsx)("p",{id:`${m}-error`,className:"error-text",role:"alert",children:i.missing}),(0,eB.jsxs)(eKQ,{secondary:!0,disabled:d||!!S||!!M||O.blocked||eJ2(D,`${E}:${t.config.formId}`),onClick:()=>void K(t,n),children:[(0,eB.jsx)(e0O,{size:18,"aria-hidden":"true"}),(0,eB.jsx)("span",{children:i.create})]})]})]},m)})},ee=(0,eB.jsxs)(eB.Fragment,{children:[$&&(0,eB.jsxs)("p",{className:"small muted",children:[q("Choose a profile for each ticket in this group to save the assignments together.","请为该组每张票选择档案,系统会一并保存,保留全部票数。")," ",(0,eB.jsx)("button",{type:"button",className:"text-link",disabled:!!S||!!M,onClick:()=>C({}),children:q("Discard unsaved choices","撤销未保存选择")})]}),(x||O.blocked)&&(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:x||q("A previous holder update is unconfirmed. Review the order before continuing.","上次持票人写回结果未确认,请先核对订单。")})]});return(0,eB.jsxs)("div",{ref:b,className:"venue-booking-holder-step",children:[e.renderContent?(0,eB.jsxs)(eB.Fragment,{children:[ee,e.renderContent({renderLine:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l=O.lines.find(t=>t.uid===e);return l?c.loading?(0,eB.jsx)("div",{className:"venue-holder-skeleton",role:"status","aria-busy":"true","aria-label":q("Loading holder profiles","正在加载持票人档案"),children:(0,eB.jsx)("div",{className:"holder-picker","aria-hidden":"true",children:(0,eB.jsx)("span",{className:"venue-holder-skeleton-field"})})}):(0,eB.jsx)("div",{className:"child-assignments",children:X(l,t)}):null}})]}):(0,eB.jsxs)(e0W,{children:[(0,eB.jsxs)("div",{className:"completion-bar",children:[(0,eB.jsx)(eZu,{size:23,"aria-hidden":"true"}),(0,eB.jsx)("b",{children:O.requiredCount?`${Z}/${O.requiredCount} ${q("completed","已完成")}`:q("Holder profiles are optional","持票人档案选填")}),O.requiredCount>0&&(0,eB.jsx)("progress",{"aria-label":q("Completed","已完成"),value:Z,max:O.requiredCount})]}),ee,c.loading?(0,eB.jsx)("div",{className:"venue-holder-skeleton",role:"status","aria-busy":"true","aria-label":q("Loading holder profiles","正在加载持票人档案"),children:z.map(e=>(0,eB.jsxs)("div",{className:"cart-group","aria-hidden":"true",children:[(0,eB.jsx)("span",{className:"venue-holder-skeleton-title"}),(0,eB.jsx)("span",{className:"venue-holder-skeleton-text"}),(0,eB.jsxs)("div",{className:"holder-picker",children:[(0,eB.jsx)("span",{className:"venue-holder-skeleton-field"}),(0,eB.jsx)("span",{className:"venue-holder-skeleton-field"})]})]},e.key))}):z.map(t=>{var l,i,a,n,r,s,d,c;let u=t.members[0],p=J(u),m=u.orderLine,g=t.members.reduce((e,t)=>e+t.quantity,0),h=null==(l=e.catalogProducts)?void 0:l.find(e=>String(e.id)===String(u.orderLine.product_id)),v=e0X(u.orderLine,g,o||"en",h,u.cacheItem),f=0,y=t.members.map(e=>{let t=X(e,f);return f+=e.quantity,t});return(0,eB.jsxs)("section",{className:"cart-group",children:[(0,eB.jsx)(e0V,{className:"booking-order-item-flat",title:u.title||q("Ticket","门票"),image:eKT(u.cacheItem.cover||(null==(i=u.cacheItem._extend)?void 0:i.product_cover)||m.product_cover,o||"en")||void 0,details:(0,eB.jsxs)("div",{className:"booking-item-metadata",children:[(null==(a=u.booking)?void 0:a.start_date)&&(0,eB.jsxs)("div",{children:[(0,eB.jsx)(eQv,{size:16,"aria-hidden":"true"}),eQM((null==(n=u.booking.metadata)?void 0:n.availability_business_date)||u.booking.start_date,o||"en")]}),(null==(r=u.booking)?void 0:r.start_time)&&(0,eB.jsxs)("div",{children:[(0,eB.jsx)(e0$,{size:16,"aria-hidden":"true"}),u.booking.start_time,"–",u.booking.end_time]}),((null==(s=u.booking)?void 0:s.resources)||[]).length>0&&(0,eB.jsx)("div",{children:u.booking.resources.map(e=>{var t;return eKT((null==(t=e.metadata)?void 0:t.resource_name)||e.title||e.name||e.resource_name,o||"en")}).filter(Boolean).join(" \xb7 ")}),(u.cacheItem.product_option_string||(null==(d=u.cacheItem._extend)?void 0:d.product_option_string)||m.product_option_string)&&(0,eB.jsx)("div",{children:eKT(u.cacheItem.product_option_string||(null==(c=u.cacheItem._extend)?void 0:c.product_option_string)||m.product_option_string,o||"en")}),(0,eB.jsx)("div",{children:u.config.enabled?u.config.required?p.required:p.optional:p.notRequired})]}),children:v.length>0&&(0,eB.jsx)("ul",{className:"venue-order-bundle","aria-label":q("Included items","套餐内含商品"),children:v.map(e=>(0,eB.jsxs)("li",{children:[(0,eB.jsx)("span",{children:e.name||q("Included item","套餐子商品")}),(0,eB.jsxs)("span",{children:["\xd7 ",e.quantity]})]},e.key))})}),(0,eB.jsx)("div",{className:"child-assignments",children:y})]},t.key)}),e.afterAssignments]}),M&&B(M.identity)&&(0,eB.jsx)(e02,{formId:M.formId,customerId:UT(null==D||null==(l=D.getTempOrder)?void 0:l.call(D),void 0,null==D||null==(a=D.getOrderCustomerSnapshot)||null==(i=a.call(D))?void 0:i.id),locale:o,isCurrent:()=>B(M.identity),onClose:()=>{T(void 0),y.current||c.reload()},onCreated:G,onUnconfirmed:()=>{var e;let t;D&&(e=`${M.identity}:${M.formId}`,(t=eJ0.get(D)||new Set).add(e),eJ0.set(D,t)),k(q("The profile save result is unconfirmed. Reload this page to check the profiles before creating another one.","档案保存结果未确认,请刷新页面核对档案后再尝试新建。"))}})]})});e03.displayName="VenueBookingHolderStep";let e08=["first_name","last_name","phone","email"],e06=e=>e&&"object"==typeof e&&!Array.isArray(e)?e:{},e05=e=>JSON.parse(JSON.stringify(e)),e07=e=>JSON.stringify(e06(e));function e09(e){var t,l;let i=e.context.sales.bookingTicket,a=(null==i||null==(t=i.getTempOrder)?void 0:t.call(i))??e.context.sales.tempOrder;return{handle:i,scopeKey:e.scopeKey,identity:(null==a||null==(l=a._extend)?void 0:l.localId)||(null==a?void 0:a.external_sale_number)||(null==a?void 0:a.order_id)||a,customer:String((null==a?void 0:a.customer_id)||""),order:a}}let e2e=(e,t)=>!!e&&e.handle===t.handle&&e.scopeKey===t.scopeKey&&e.identity===t.identity&&e.customer===t.customer,e2t=(0,eN.forwardRef)((e,t)=>{var l;let[i]=eM.Form.useForm(),[a,n]=(0,eN.useState)(),[r,o]=(0,eN.useState)(!1),s=(0,eN.useRef)(e);s.current=e;let d=(0,eN.useRef)(!0),c=(0,eN.useRef)(0),u=(0,eN.useRef)(!1),p=(0,eN.useRef)(),m=e09(e),g=e07(null==(l=m.order)?void 0:l.contacts_info),h=JSON.stringify(e.config),v=String(e.locale).startsWith("zh"),f=(e,t)=>v?t:e,y=e=>({first_name:f("Enter a first name.","请输入名字。"),last_name:f("Enter a last name.","请输入姓氏。"),phone:f("Enter a phone number.","请输入电话号码。"),email:f("Enter an email address.","请输入邮箱。")})[e];(0,eN.useEffect)(()=>(d.current=!0,()=>{d.current=!1,c.current+=1}),[]),(0,eN.useLayoutEffect)(()=>{var e,t,l,a;let r=!e2e(null==(e=p.current)?void 0:e.owner,m);if(r||(null==(t=p.current)?void 0:t.contact)!==g){let e,t;c.current+=1,r&&(i.resetFields(),n(void 0)),i.setFieldsValue((a=e06(null==(l=m.order)?void 0:l.contacts_info),t=String((e=e06(a.phone)).country_calling_code||""),{first_name:a.first_name||"",last_name:a.last_name||"",email:a.email||"",phone:{phone:e.phone||"",countryCallingCode:t&&!t.startsWith("+")?`+${t}`:t,countryCode:e.country_code||""}})),p.current={owner:m,contact:g}}},[m.handle,m.identity,m.customer,e.scopeKey,g,i]);let b=(e,t)=>{let l=s.current,i=e09(l);if(!d.current||!1===l.isActive||!e2e(t,i)||!i.order)return!1;let a=e06(i.order.contacts_info),n=function(e,t,l){let i=e05(t);for(let o of e08){var a,n,r;!1!==l.fields[o].visible&&(i[o]="phone"===o?{...e06(t.phone),phone:(null==(a=e.phone)?void 0:a.phone)||"",country_calling_code:(null==(n=e.phone)?void 0:n.countryCallingCode)||"",country_code:(null==(r=e.phone)?void 0:r.countryCode)||""}:e[o]||"")}return(i.first_name!==t.first_name||i.last_name!==t.last_name)&&(i.display_name=[i.first_name,i.last_name].filter(Boolean).join(" ")),i}(e,a,l.config);if(e07(n)===e07(a))return!0;let r=e05(n);return p.current={owner:i,contact:e07(r)},p.current={owner:i,contact:e07(l.context.sales.setContactsInfo(r))},!0};return(0,eN.useImperativeHandle)(t,()=>({validate:async()=>{var e,t,l,a,r;if(u.current||!d.current||!1===s.current.isActive)return!1;if(!s.current.config.enabled)return!0;if((null==(e=s.current.context.sales.contactInfo)?void 0:e.loading)||(null==(t=s.current.context.sales.contactInfo)?void 0:t.pending))return!1;let p=e09(s.current);if(!(null==(l=p.handle)?void 0:l.validateContactInfo)||!p.order)return n(f("Contact details are not ready. Please retry.","联系人信息尚未就绪,请重试。")),!1;let m=++c.current,g=JSON.stringify(s.current.config),h=e07(p.order.contacts_info),v=()=>{var e;return d.current&&m===c.current&&!1!==s.current.isActive&&e2e(p,e09(s.current))&&JSON.stringify(s.current.config)===g&&e07(null==(e=e09(s.current).order)?void 0:e.contacts_info)===h};u.current=!0,o(!0),n(void 0);try{let e=await i.validateFields();if(!v())return!1;let t=e08.filter(t=>{var l;let i=s.current.config.fields[t],a="phone"===t?null==(l=e.phone)?void 0:l.phone:e[t];return i.visible&&i.required&&("string"!=typeof a||!a.trim())});if(t.length)return i.setFields(t.map(e=>({name:e,errors:[y(e)]}))),!1;if(!b(e,p)||(h=e07(null==(a=e09(s.current).order)?void 0:a.contacts_info),!v()))return!1;return await p.handle.validateContactInfo(),v()}catch(e){if(!v())return!1;return"CONTACT_INFO_REQUIRED"===e.code&&Array.isArray(e.fields)?i.setFields(e.fields.filter(e=>e08.includes(e)).map(e=>({name:e,errors:[y(e)]}))):(null==(r=e.errorFields)?void 0:r.length)||n(e.message||f("Unable to validate contact details. Please retry.","无法校验联系人信息,请重试。")),!1}finally{u.current=!1,d.current&&o(!1)}}}),[i,h,e.locale]),(0,eB.jsxs)("div",{className:"venue-contact-form","aria-busy":r,children:[(0,eB.jsx)(eeY,{config:e.config.fields,form:i,disabled:e.disabled||r||!1===e.isActive,onValuesChange:(e,t)=>{if(!s.current.disabled&&!1!==s.current.isActive&&s.current.config.enabled&&!u.current){c.current+=1,n(void 0);try{b(t,m)}catch(e){n(e instanceof Error?e.message:f("Unable to save contact details.","无法保存联系人信息。"))}}}}),a&&(0,eB.jsx)("p",{className:"venue-contact-form__error",role:"alert",children:a})]})});function e2l(e){let{policyId:t,title:l,request:i,locale:a,accepted:n=!1,onClose:r,onConfirm:o,onLoadError:s}=e,d=String(a||"").startsWith("zh");return(0,eB.jsx)(Vi,{open:!0,item:{id:t,title:l},isHideCheckout:!1,initialAccepted:n,depositProtocolRequest:i,onCancel:r,onConfirm:o,onLoadError:s,renderDialog:e=>{let{title:t,body:l,footer:i}=e;return(0,eB.jsx)(eQu,{title:t,className:"venue-policy-modal",mobile:"fullscreen",zIndex:600,closeLabel:d?"关闭":"Close",onClose:r,bodyClassName:"venue-policy-body venue-booking-legacy-controls",footerClassName:"venue-policy-footer venue-booking-legacy-controls",footer:i,children:l})}})}function e2i(e){let{title:t,resourceTitle:l,saved:i,open:a,disabled:n,busy:r,locale:o,onOpen:s,onClose:d,children:c,footer:u}=e,p=String(o||"").startsWith("zh"),m=r?p?"正在保存…":"Saving…":i?p?"已保存":"Saved":p?"未保存":"Not saved",g=i?p?"编辑资料":"Edit details":p?"填写资料":"Fill in details";return(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)("button",{type:"button",className:`checkout-agreement venue-resource-form-entry${i?" accepted":""}`,"data-accepted":i,"aria-haspopup":"dialog","aria-expanded":a,"aria-label":`${g} \xb7 ${t} \xb7 ${m}`,disabled:n,onClick:s,children:[(0,eB.jsx)("span",{className:"agreement-state","aria-hidden":"true",children:i&&(0,eB.jsx)(eZR,{size:15,weight:"bold"})}),(0,eB.jsxs)("span",{className:"agreement-copy",children:[(0,eB.jsx)("b",{children:t}),(0,eB.jsxs)("small",{children:[l&&l!==t?`${l} \xb7 `:"",m]})]}),(0,eB.jsxs)("span",{className:"agreement-open","aria-hidden":"true",children:[(0,eB.jsx)("span",{children:g}),(0,eB.jsx)(eZF,{size:15})]})]}),(0,eB.jsx)(eQu,{title:t,className:"venue-resource-form-modal",mobile:"fullscreen",zIndex:600,open:a,onClose:d,closeLabel:p?"关闭":"Close",closeOnBackdrop:!r,closeOnEscape:!r,externalDialogSelector:eQd,bodyClassName:"venue-resource-form-body",footerClassName:"venue-resource-form-footer",footer:u,children:c})]})}let e2a="venue_booking_form_records";function e2n(e){return[...new Set((e.resources||[]).map(e=>String(e.relation_id??e.resource_id??e.id??"")).filter(e=>e&&"0"!==e))]}function e2r(e,t){var l;if(!t||!e.formId||!e2n(t).includes(e.resourceId))return;let i=(null==(l=t.metadata)?void 0:l[e2a])||{};return[i[e.key],...Object.values(i)].find(l=>l&&String(l.resourceId)===e.resourceId&&Number(l.formId)===e.formId&&/^\d+$/.test(String(l.recordId))&&Number(l.recordId)>0&&(t.relation_forms||[]).some(t=>Number(t.form_id)===e.formId&&Array.isArray(t.form_record_ids)&&t.form_record_ids.some(e=>String(e)===String(l.recordId))))}function e2o(e,t){for(let l of e.members){let e=e2r(l,t(l.bookingUid));if(e)return e}}function e2s(e,t){if(!e.formId)return!0;let l=e2o(e,t);return!!l&&e.members.every(e=>{var i;return String(null==(i=e2r(e,t(e.bookingUid)))?void 0:i.recordId)===String(l.recordId)})}async function e2d(e,t,l){var i,a;let n=t=>{l.assertCurrent();let i=l.readBooking(t.bookingUid);if(!i||!e2n(i).includes(e.resourceId))throw Error("The booking resource changed. Please review its details again.");return i};for(let i of(e.members.forEach(n),e.members)){let r=n(i),o=(null==(a=r.metadata)?void 0:a[e2a])||{},s=new Set,d={...o};for(let[t,l]of Object.entries(o))String(null==l?void 0:l.resourceId)===e.resourceId&&Number(null==l?void 0:l.formId)===e.formId&&(s.add(String(l.recordId)),delete d[t]);for(let t of Object.values(d))Number(null==t?void 0:t.formId)===e.formId&&s.delete(String(t.recordId));let c=(r.relation_forms||[]).map(t=>({...t,form_record_ids:[...t.form_record_ids||[]].filter(l=>Number(t.form_id)!==e.formId||!s.has(String(l)))})),u=c.find(t=>Number(t.form_id)===e.formId);u||(u={form_id:e.formId,form_record_ids:[]},c.push(u)),u.form_record_ids.some(e=>String(e)===String(t.recordId))||u.form_record_ids.push(t.recordId),await l.updateBooking({unique_identification_number:i.bookingUid,updates:{relation_forms:c,metadata:{[e2a]:{...d,[i.key]:t}}}})}if(l.assertCurrent(),!e2s(e,l.readBooking)||String(null==(i=e2o(e,l.readBooking))?void 0:i.recordId)!==String(t.recordId))throw Error("The saved form could not be linked to every booking. Please retry.")}function e2c(e){var t,l,i;let a=(null==(l=e.context.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.context.sales.tempOrder;return JSON.stringify([e.scopeKey,(null==a||null==(i=a._extend)?void 0:i.localId)||(null==a?void 0:a.external_sale_number)||(null==a?void 0:a.order_id),null==a?void 0:a.customer_id])}function e2u(e){var t,l;let i=(null==(l=e.context.sales.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.context.sales.tempOrder;return JSON.stringify([e2c(e),((null==i?void 0:i.bookings)||[]).map(e=>{var t;return[null==(t=e.metadata)?void 0:t.unique_identification_number,e.start_date,e.start_time,e.end_date,e.end_time,e2n(e)]})])}let e2p=(0,eN.forwardRef)((e,t)=>{var l,i,a,n,r;let{context:o,locale:s,disabled:d=!1,isActive:c=!0,includeHolderValidation:u=!0}=e,p=dL("venue-review"),m=(0,eN.useRef)(null),g=eKB(),h=(0,eN.useRef)(null),v=(0,eN.useRef)(null),f=(0,eN.useRef)(e);f.current=e;let y=(0,eN.useRef)(!0),[b]=YK({components:["FormCard"]}),x=(0,eN.useRef)({}),k=(0,eN.useRef)(new Set),_=(0,eN.useRef)(new Set),[w,S]=(0,eN.useState)([]),[j,N]=(0,eN.useState)("loading"),[C,M]=(0,eN.useState)(null),[T,I]=(0,eN.useState)(null),[P,A]=(0,eN.useState)(null),[D,E]=(0,eN.useState)(null),[O,z]=(0,eN.useState)({}),[L,R]=(0,eN.useState)({}),[$,F]=(0,eN.useState)(),[q,B]=(0,eN.useState)({}),H=(0,eN.useRef)(),[V,U]=(0,eN.useState)(0),[,Y]=(0,eN.useState)(0),W=e2u(e),G=(0,eN.useRef)(),K=String(s||"").startsWith("zh"),Q=(e,t)=>K?t:e,Z=e=>{var t,l;return eKT(null==(l=e.policyResponse)||null==(t=l.data)?void 0:t.title,s||"en").trim()||Q("Agreement","协议")},J=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:W;return y.current&&!1!==f.current.isActive&&e2u(f.current)===e},X=e=>{var t,l,i,a;return null==(a=f.current.context.sales.bookingTicket)||null==(i=a.getTempOrder)||null==(l=i.call(a))||null==(t=l.bookings)?void 0:t.find(t=>{var l;return String((null==(l=t.metadata)?void 0:l.unique_identification_number)||"")===e})},ee=e=>!k.current.has(e.key)&&e2s(e,X),et=e=>{let t=()=>{J(W)&&g(()=>J(W)&&m.current?e(m.current):null,{block:"center"})};f.current.onValidationBlocked?f.current.onValidationBlocked(t):t()},el=()=>et(e=>e.querySelector(".venue-confirmation-feedback"));(0,eN.useEffect)(()=>(y.current=!0,()=>{y.current=!1}),[]),(0,eN.useEffect)(()=>{let t=!1;G.current=void 0,N("loading"),M(null),I(null);let l=e2c(e);if(H.current!==l&&B({}),H.current=l,F(void 0),A(null),E(null),z({}),R({}),k.current.clear(),_.current.clear(),!c)return;let i=o.sales.bookingTicket;return(async()=>{var l,a,n,r,s;if(!i)throw Error(Q("Booking details are not ready.","预订详情尚未就绪。"));let d=(null==(a=i.getTempOrder)||null==(l=a.call(i))?void 0:l.bookings)||[],c=[],u=new Map,p=new Map,m=new Map;for(let t of d){let l=String(t.start_date||e.date||"").slice(0,10),i=e2n(t);if(!i.length)continue;let a=m.get(l)||new Set;i.forEach(e=>a.add(e)),m.set(l,a)}for(let l of d){let a=e2n(l);if(!a.length)continue;let r=String((null==(n=l.metadata)?void 0:n.unique_identification_number)||""),o=String(l.start_date||e.date||"").slice(0,10);if(!r||!/^\d{4}-\d{2}-\d{2}$/.test(o))throw Error(Q("Unable to load the booking resource forms.","无法读取预订资源的关联表单。"));if("function"!=typeof i.queryBookingResourceDetails)throw Error(Q("The booking service needs to be updated before resource forms can be loaded.","预订服务需要更新后才能读取资源关联表单。"));if(u.has(o)||u.set(o,await i.queryBookingResourceDetails({date:o,resourceIds:[...m.get(o)||[]]})),t||!J())return;let s=u.get(o)||[];for(let e of a){let l=s.find(t=>String(t.id)===e);if(!l)throw Error(Q("A selected resource is no longer available. Please reselect it.","无法读取已选资源,请重新选择。"));let a=l.resource_form_id,n=Number(a);if(a&&(!Number.isSafeInteger(n)||n<=0))throw Error(Q("The resource form configuration is invalid.","资源关联表单配置无效。"));let o=l.policy_id?String(l.policy_id):void 0;if(o&&!p.has(o)){let e=i.getProtocol;if(!e)throw Error(Q("Unable to load the resource policy. Please retry.","无法加载资源协议,请重试。"));let l=function(e){if(!e||"object"!=typeof e||Array.isArray(e)||200!==e.code||!e.data||"string"!=typeof e.data.content)return{status:"invalid"};let t=e.data.content;if(!t.trim())return{status:"empty"};if("u">typeof DOMParser){let l=new DOMParser().parseFromString(t,"text/html").body;if(l.querySelector("img, picture, svg, video, audio, iframe, object, embed, canvas, math, hr, input, select, textarea, button")||Array.from(l.querySelectorAll("[style]")).some(e=>/background(?:-image)?\s*:[^;]*url\s*\(/i.test(e.getAttribute("style")||"")))return{status:"ready",response:e};if(l.querySelectorAll("script, style, template, noscript").forEach(e=>e.remove()),!(l.textContent||"").replace(/[\s\u200b-\u200d\u2060\ufeff]/g,""))return{status:"empty"}}return{status:"ready",response:e}}(await e.call(i,o));if(t||!J())return;if("invalid"===l.status)throw Error(Q("Unable to load the resource policy. Please retry.","无法加载资源协议,请重试。"));p.set(o,"ready"===l.status?l.response:void 0)}let d=o?p.get(o):void 0;(n>0||d)&&c.push({key:`${r}:${e}:${n||""}:${o||""}`,bookingUid:r,resourceId:e,title:String(l.main_field||l.name||e),...n>0?{formId:n}:{},...d?{policyId:o,policyResponse:d}:{}})}}if(!t&&J()){let e=function(e){let t=new Map;for(let l of e){let e=JSON.stringify([l.resourceId,l.formId??null,l.policyId??null]),i=t.get(e);if(i)i.members.some(e=>e.key===l.key)||i.members.push(l);else{let{bookingUid:i,...a}=l;t.set(e,{...a,key:e,members:[l]})}}return[...t.values()]}(c),l=!1;for(let a of e){let e=e2o(a,X);if(!(!e||e2s(a,X))&&1===new Set(a.members.map(e=>e2r(e,X(e.bookingUid))).filter(Boolean).map(e=>String(e.recordId))).size){if(!i.updateOrderBooking)throw Error(Q("Unable to save the form.","表单保存失败。"));await e2d(a,e,{readBooking:X,updateBooking:e=>i.updateOrderBooking(e),assertCurrent:()=>{if(t||!J())throw Error(Q("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"))}}),l=!0}}if(t||!J()||(l&&(o.cart.refreshCartSnapshot(),await (null==(r=(s=f.current).onMutation)?void 0:r.call(s))),t||!J()))return;S(e),B(t=>(function(e,t){let l={};for(let a of e){var i;let e=t[a.key];(null==e?void 0:e.status)==="confirmed"&&a.policyId&&String(e.policyId)===a.policyId&&e.policy&&(null==(i=a.policyResponse)?void 0:i.data)&&JSON.stringify(e.policy)===JSON.stringify(a.policyResponse.data)&&(l[a.key]=e)}return l})(e,t)),G.current=W,N("ready")}})().catch(e=>{!t&&J()&&(M(e0_(e,Q("Unable to load the booking resource forms. Please retry.","无法加载预订资源的关联表单,请重试。"))),N("error"))}),()=>{t=!0}},[o.sales.bookingTicket,W,c,V]);let ei=async()=>{var e;let t=o.sales.contactInfo;if(!J())return!1;if(!(null==t?void 0:t.config)||t.loading||t.pending)return M(Q("Wait for the contact details to load and save.","请等待联系人信息加载并保存完成。")),el(),!1;if(!t.config.enabled)return!0;let l=await (null==(e=v.current)?void 0:e.validate());return!!J()&&(!0!==l?(I({section:"contact",message:Q("Check your contact details before continuing.","请检查联系人信息后继续。")}),et(e=>e.querySelector('.contact-section input[aria-invalid="true"], .contact-section select[aria-invalid="true"], .contact-section textarea[aria-invalid="true"], .contact-section .pisell-lowcode-form-item-has-error, .contact-section .ant-form-item-has-error')||e.querySelector(".contact-section")),!1):(I(e=>(null==e?void 0:e.section)==="contact"?null:e),!0))};(0,eN.useImperativeHandle)(t,()=>({validateContact:ei,validate:async()=>{var e;if(!J())return!1;if(G.current!==W||"ready"!==j||P)return M(Q("Wait for the confirmation details to load and save.","请等待确认资料加载并保存完成。")),el(),!1;let t=w.filter(e=>e.formId).findIndex(e=>!b||!_.current.has(e.key)||!ee(e));if(t>=0)return I({section:"resources",message:Q("Complete and save each resource form before continuing.","请先填写并保存每项资源关联表单。")}),et(e=>e.querySelectorAll(".venue-resource-form-entry")[t]||null),!1;let l=w.filter(e=>e.policyId).findIndex(e=>!q[e.key]);return l>=0?(I({section:"agreements",message:Q("Read and agree to each resource policy before continuing.","请先阅读并同意各项资源协议。")}),et(e=>e.querySelectorAll(".venue-confirmation-agreements .checkout-agreement")[l]||null),!1):u&&!await (null==(e=h.current)?void 0:e.validate())?!!J()&&(M(Q("Complete the required holder details before continuing.","请先完成必填持票人资料。")),el(),!1):!!await ei()&&!!J()&&(M(null),I(null),!0)}}));let ea=async(e,t,l)=>{if(J())try{var i,a,n,r,o;if("success"!==t)throw Error(Q("Unable to save the form.","表单保存失败。"));let s=null==l?void 0:l.form_record_id;if(Number(null==l?void 0:l.form_id)!==e.formId||!s||!/^\d+$/.test(String(s)))throw Error(Q("The form did not return a saved record.","表单未返回有效的保存记录。"));let d=f.current.context.sales.bookingTicket;if(!(null==d?void 0:d.updateOrderBooking))throw Error(Q("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"));let c=JSON.parse(JSON.stringify((null==(n=x.current[e.key])||null==(a=n.form)||null==(i=a.getFieldsValue)?void 0:i.call(a))||{}));if(await e2d(e,{resourceId:e.resourceId,formId:e.formId,recordId:s,values:c},{readBooking:X,updateBooking:e=>d.updateOrderBooking(e),assertCurrent:()=>{if(!J())throw Error(Q("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"))}}),!J()||(k.current.delete(e.key),f.current.context.cart.refreshCartSnapshot(),await (null==(r=(o=f.current).onMutation)?void 0:r.call(o)),!J()))return;Y(e=>e+1),M(null),R(t=>({...t,[e.key]:""})),E(t=>t===e.key?null:t)}catch(t){if(J()){let l=e0_(t,Q("Unable to save the form. Please retry.","表单保存失败,请重试。"));M(l),R(t=>({...t,[e.key]:l}))}}finally{J()&&A(null)}};(null==(i=o.sales.bookingTicket)||null==(l=i.getTempOrder)?void 0:l.call(i))||o.sales.tempOrder;let en=eJK(o),er=e.orderReview??e.children,eo=0;return(0,eB.jsxs)("section",{ref:m,className:"venue-booking-confirmation checkout-modules","aria-label":Q("Booking details","预订资料"),children:[(null==(a=o.sales.contactInfo)?void 0:a.loading)?(0,eB.jsx)(eM.Spin,{}):null,(null==(r=o.sales.contactInfo)||null==(n=r.config)?void 0:n.enabled)&&(0,eB.jsxs)(e0z,{id:`${p}-contact`,number:++eo,title:Q("Contact details","联系人信息"),className:"contact-section",children:[(0,eB.jsx)(e2t,{ref:v,context:o,scopeKey:e.scopeKey,config:o.sales.contactInfo.config,disabled:d,isActive:c,locale:s}),(null==T?void 0:T.section)==="contact"&&(0,eB.jsx)("p",{className:"error-text",role:"alert",children:T.message})]}),er&&(0,eB.jsx)(e0z,{id:`${p}-order`,number:++eo,title:Q("Review your order","核对订单"),children:er}),u?(0,eB.jsx)("div",{hidden:!en.enabled,children:(0,eB.jsx)(e03,{ref:h,context:o,scopeKey:e.scopeKey,locale:s,isActive:c,disabled:d,onMutation:e.onMutation})}):e.holderContent,"loading"===j?(0,eB.jsx)(eM.Spin,{}):null,C?(0,eB.jsx)("div",{className:"venue-confirmation-feedback",children:(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:C,action:"error"===j?(0,eB.jsx)(eM.Button,{onClick:()=>U(e=>e+1),children:Q("Retry","重试")}):void 0})}):null,"ready"===j&&w.some(e=>e.formId)?(0,eB.jsxs)(e0z,{id:`${p}-resources`,number:++eo,title:Q("Form","表单"),children:[(null==T?void 0:T.section)==="resources"&&w.some(e=>e.formId&&(!b||!_.current.has(e.key)||!ee(e)))&&(0,eB.jsx)("p",{className:"error-text",role:"alert",children:T.message}),w.filter(e=>e.formId).map(e=>{var t;return(0,eB.jsxs)(e2i,{title:O[e.key]||e.title,resourceTitle:e.title,locale:s,saved:ee(e),open:D===e.key&&J(),disabled:d||!!(P&&P!==e.key),busy:P===e.key,onOpen:()=>{!J()||d||P&&P!==e.key||E(e.key)},onClose:()=>E(null),footer:(0,eB.jsx)(eKQ,{disabled:d||!!P||!_.current.has(e.key)||ee(e),busy:P===e.key,onClick:()=>{if(J()&&!d&&!P)try{var t,l,i;if(!(null==(t=x.current[e.key])?void 0:t.submit))throw Error(Q("The form is not ready.","表单尚未就绪。"));R(t=>({...t,[e.key]:""})),A(e.key),null==(i=x.current[e.key])||null==(l=i.submit)||l.call(i)}catch(l){let t=e0_(l,Q("Unable to save the form. Please retry.","表单保存失败,请重试。"));A(null),M(t),R(l=>({...l,[e.key]:t}))}},children:ee(e)?Q("Saved","已保存"):Q("Save details","保存资料")}),children:[L[e.key]&&(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:L[e.key]}),b?(0,eB.jsx)(eB.Fragment,{children:(0,eB.jsx)("div",{className:"venue-booking-legacy-controls",style:d||P?{pointerEvents:"none"}:void 0,children:(0,eB.jsx)(b,{id:e.formId,ref:t=>{x.current[e.key]=t},isGetLastData:!1,setting:{isHidden:1},isV2API:!0,isShowSkeleton:!0,isClearData:!1,defaultValues:null==(t=e2o(e,X))?void 0:t.values,onSubmit:(t,l)=>void ea(e,t,l),onFormConfigChange:t=>{if(J()&&t&&Object.keys(t).length){var l;_.current.add(e.key);let i=eKT((null==(l=t.form)?void 0:l.title)??t.title,s||"en");i&&z(t=>t[e.key]===i?t:{...t,[e.key]:i}),Y(e=>e+1)}},onChange:(t,l)=>{if(J()){if(t)_.current.delete(e.key);else if(!l||!Object.keys(l).length){_.current.delete(e.key);let t=Q("Unable to load the form. Please retry.","表单加载失败,请重试。");M(t),R(l=>({...l,[e.key]:t}))}}},onFinishFailed:()=>{if(!J())return;let t=Q("Please complete the required form fields.","请填写表单中的必填内容。");A(null),M(t),R(l=>({...l,[e.key]:t}))},onFormValueChange:t=>{var l;if(!J())return;let i=null==(l=e2o(e,X))?void 0:l.values;JSON.stringify(t)===JSON.stringify(i)?k.current.delete(e.key):k.current.add(e.key),Y(e=>e+1)}})})}):(0,eB.jsx)(eM.Alert,{type:"error",message:Q("The form component is unavailable. Reload before continuing.","表单组件未加载,请刷新后继续。")})]},`${W}:${e.key}`)})]}):null,(e.agreements||"ready"===j&&w.some(e=>e.policyId))&&(0,eB.jsxs)(e0z,{id:`${p}-agreements`,number:++eo,title:Q("Agreements","协议"),className:"venue-confirmation-agreements",children:[(null==T?void 0:T.section)==="agreements"&&w.some(e=>e.policyId&&!q[e.key])&&(0,eB.jsx)("p",{className:"error-text",role:"alert",children:T.message}),"ready"===j&&w.filter(e=>e.policyId).map(e=>(0,eB.jsx)(eZH,{title:Z(e),lang:K?"zh":"en",accepted:!!q[e.key],disabled:d||!!P,onOpen:()=>void(e=>{if(!d&&!P&&J())try{var t;if(!e.policyId||!e.policyResponse)throw Error(Q("Unable to load the resource policy.","无法加载资源协议。"));ez.init(Ve,s||(null==(t=ez.getLocale)?void 0:t.call(ez))||"en"),A(e.key),F({task:e,request:async t=>{if(!J()||String(t)!==e.policyId)throw Error(Q("The booking changed. Please review its details again.","预订已变化,请重新核对确认资料。"));return e.policyResponse}})}catch(e){J()&&!["cancel","programmatic-close","replaced"].includes(null==e?void 0:e.type)&&M(e0_(e,Q("Unable to load the resource policy.","无法加载资源协议。")))}})(e)},e.key)),e.agreements]}),e.note&&(0,eB.jsx)(e0z,{id:`${p}-note`,number:++eo,title:Q("Order note","订单留言"),children:e.note}),(null==$?void 0:$.task.policyId)&&J()&&(0,eB.jsx)(e2l,{policyId:$.task.policyId,title:Z($.task),request:$.request,locale:s,accepted:!!q[$.task.key],onClose:()=>{F(void 0),A(null)},onConfirm:e=>{let t=$.task.policyId;J()&&t&&(B(l=>({...l,[$.task.key]:{status:"confirmed",policyId:t,policy:e}})),F(void 0),A(null))},onLoadError:e=>{J()&&(M(e0_(e,Q("Unable to load the resource policy.","无法加载资源协议。"))),F(void 0),A(null))}},`${W}:${$.task.key}`)]})});function e2m(e,t,l,i){var a,n,r,o;let s=null==(n=i.find(e=>String(e.id)===String(t)))||null==(a=n.label)?void 0:a.trim();if(s)return s;let d=(null==(r=e.booking)?void 0:r.holder)??(null==(o=e.cacheItem._extend)?void 0:o.holder),c=Uk(null==d?void 0:d.form_record);if(1===e.quantity&&1===c.length&&String(c[0])===String(t)&&String(null==d?void 0:d.form_id)===String(e.config.formId)&&((null==d?void 0:d.customer_id)==null||String(d.customer_id)===String(l)))return"string"==typeof d.name&&d.name.trim()||void 0}function e2g(e){var t,l,i,a,n,r,o;let{context:s,scopeKey:d,mode:c,locale:u,disabled:p,onEdit:m,productLineUid:g,inline:h=!1,ordinalOffset:v=0,onRemoveTicket:f}=e,y=UF(),b=eJK(s,d,u),x=String(u||"").startsWith("zh"),k=(e,t)=>x?t:e,_=(0,eN.useRef)(!0),w=(0,eN.useRef)(!1),S=(0,eN.useRef)({context:s,scopeKey:d,disabled:p,onRemoveTicket:f});S.current={context:s,scopeKey:d,disabled:p,onRemoveTicket:f};let j=eJQ(s,d),[N,C]=(0,eN.useState)(!1),[M,T]=(0,eN.useState)();(0,eN.useEffect)(()=>(_.current=!0,()=>{_.current=!1}),[]),(0,eN.useEffect)(()=>{T(void 0)},[j]);let I=e=>_.current&&eJQ(S.current.context,S.current.scopeKey)===e,P=(null==(i=s.sales.bookingTicket)||null==(l=i.getOrderCustomerSnapshot)||null==(t=l.call(i))?void 0:t.id)??(null==(r=s.sales.bookingTicket)||null==(n=r.getTempOrder)||null==(a=n.call(r))?void 0:a.customer_id)??(null==(o=s.sales.tempOrder)?void 0:o.customer_id),A=(h?b.displayLines:b.lines).filter(e=>{let t=e.orderLine.metadata;return(!g||e.uid===g)&&!!e.booking&&(!(null==t?void 0:t.venue_booking_scope_key)||t.venue_booking_scope_key===d)&&(!(null==t?void 0:t.venue_booking_role)||t.venue_booking_role===("party"===c?"party_main":"tickets"))});if(!A.length)return null;let D=async(e,t)=>{var l;let i=S.current.onRemoveTicket;if(i&&!S.current.disabled&&!w.current&&!b.blocked&&I(j)&&"tickets"===c&&1===e.quantity&&0===t&&(null==(l=e.orderLine.metadata)?void 0:l.venue_booking_role)==="tickets"){w.current=!0,C(!0),T(void 0);try{await i(e.uid,t)}catch(e){I(j)&&T(e0_(e,k("Unable to remove this ticket. Please try again.","无法删除这张票,请重试。")))}finally{w.current=!1,_.current&&C(!1)}}},E=A.map(e=>{let t=e01(y.getHolderFormDetailForSource(e.cacheItem),u),l={label:t.edit,disabled:p||N||b.blocked,onClick:m},i=y.getHolderOptionsForSource(e.cacheItem),a=e.booking,n=[a.start_date,a.start_time&&a.end_time?`${a.start_time}–${a.end_time}`:a.start_time].filter(Boolean).join(" \xb7 "),r=Array.from({length:e.quantity},(l,a)=>{let n=e.ids[a],r=null!=n&&""!==n,o=r?e2m(e,n,P,i):void 0;return{name:o,label:e.config.enabled?o||(r?k("Profile linked; name unavailable","档案已关联,姓名暂不可用"):k(`${t.name} not selected`,`尚未选择${t.name}`)):t.notRequired}});return(0,eB.jsxs)("section",{className:h?"venue-inline-holder-review":"cart-group",children:[!h&&(0,eB.jsx)(e0V,{className:"booking-order-item-flat",title:e.title||k("Booking","预约"),details:n?(0,eB.jsx)("span",{className:"booking-item-metadata",children:n}):void 0}),"party"===c?(0,eB.jsx)(e0U,{items:r.map((e,i)=>({label:r.length>1?`${t.name} #${i+1}`:t.name,value:(0,eB.jsx)("span",{className:e.name?void 0:"needs-attention",children:e.label}),action:l}))}):(0,eB.jsx)("div",{className:"ticket-list",children:r.map((t,i)=>{var a;return(0,eB.jsx)(e0V,{layout:"row",icon:(0,eB.jsx)(eKq,{size:20,"aria-hidden":"true"}),title:`${k("Ticket","门票")} #${v+i+1}`,details:(0,eB.jsx)("small",{className:t.name||!e.config.enabled?void 0:"needs-attention",children:t.label}),action:e.config.enabled?l:void 0,removeAction:f&&1===e.quantity&&(null==(a=e.orderLine.metadata)?void 0:a.venue_booking_role)==="tickets"?{label:`${k("Remove ticket","删除门票")} ${e.title||k("Ticket","门票")} #${v+i+1}`,disabled:p||N||b.blocked,onClick:()=>{D(e,i)}}:void 0},i)})})]},e.uid)}),O=M&&(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:M});return h?(0,eB.jsxs)(eB.Fragment,{children:[O,E]}):(0,eB.jsxs)(e0W,{title:k("Holder","持有人"),children:[O,E]})}e2p.displayName="VenueBookingConfirmation";let e2h=(0,eN.forwardRef)(function(e,t){let{source:l,previous:i,ids:a,onChange:n,quantity:r,customerId:o,os:s,disabled:d,text:c}=e,u=Uq(),{required:p,formId:m}=B4(l),[g,h]=(0,eN.useState)(!0),[v,f]=(0,eN.useState)(!1),[y,b]=(0,eN.useState)(0),[x,k]=(0,eN.useState)(!1),_=(0,eN.useRef)(null),w=a.length>r||p&&a.length!==r,S=(0,eN.useMemo)(()=>({...l,_extend:{...l._extend,quantity:r,holder_relations:i}}),[l,r,i]),j=(0,eN.useMemo)(()=>({client:{value:{id:o}}}),[o]);return(0,eN.useEffect)(()=>{let e=!0;h(!0),f(!1);let t=t=>{e&&(f(!t),h(!1))};return u.prepareHolderOptionsForSource(l,{throwOnError:!0}).then(e=>t(e.accessAllowed),()=>t(!1)),()=>{e=!1}},[l,o,y,u.prepareHolderOptionsForSource]),(0,eN.useImperativeHandle)(t,()=>({async readRelations(){if(w){var e;k(!0),null==(e=_.current)||e.scrollIntoView({block:"nearest"});return}if(a.length&&(g||v))return;let t=a.length?await s.getOtherParams():void 0;return ekD(S,a,{productSource:l,customerId:o,isFranchisee:!!(null==t?void 0:t.isFranchisee),holderOptions:u.getHolderOptionsForSource(l),holderFormDetail:u.getHolderFormDetailForSource(l)})}}),[a,w,g,v,s,l,o,S,u]),(0,eB.jsxs)("fieldset",{className:"venue-extra-holder",ref:_,disabled:d,children:[g?(0,eB.jsx)("p",{role:"status",children:c("Loading holder profiles…","正在加载档案…")}):v?(0,eB.jsxs)("div",{role:"alert",children:[c("Holder profiles are unavailable.","暂时无法加载档案。")," ",(0,eB.jsx)("button",{type:"button",onClick:()=>b(e=>e+1),children:c("Retry","重试")})]}):(0,eB.jsx)(UQ,{presentation:"inline",holderOptionsLoaded:!0,state:j,cacheItem:S,required:p,getCurrentCacheItem:()=>S,value:a,onChange:e=>{d||(n(e),k(!1))}},String(m)),x&&w&&(0,eB.jsx)("p",{role:"alert",className:"venue-extra-detail-error",children:p?c(`Choose ${r} holder profiles to continue.`,`请选择 ${r} 份档案后继续。`):c(`Choose up to ${r} holder profiles.`,`最多选择 ${r} 份档案。`)})]})});function e2v(e){let{runtime:t}=e,l=t.configurationModal;return(null==l?void 0:l.extraSession)?(0,eB.jsx)(e2f,{runtime:t,modal:l},l.plan.openId):null}function e2f(e){var t,l,i;let{runtime:a,modal:n}=e,{plan:r,extraSession:o,configuration:s}=n,{text:d,locale:c,bookingUI:u}=a,p=Uu(),m=(0,eN.useMemo)(()=>eND(p.customerAuth),[p.customerAuth]),g=r.productDetail,[h,v]=(0,eN.useState)(o.quantity),[f,y]=(0,eN.useState)(!1),[b,x]=(0,eN.useState)(!1),[k,_]=(0,eN.useState)(),[w,S]=(0,eN.useState)(!1),[j,N]=(0,eN.useState)(!1),[C,M]=(0,eN.useState)(),T=(0,eN.useRef)(null),I=(0,eN.useRef)(null),P=!1!==o.hasSku,A=(0,eN.useMemo)(()=>eJS(o.productDetail,s.skuValue.product_variant_id,o.editingLine),[o.productDetail,s.skuValue.product_variant_id,o.editingLine]),D=B4(A),E=(0,eN.useRef)(a.customerId),[O,z]=(0,eN.useState)(!0),L=(0,eN.useMemo)(()=>(o.holderRelations||[]).filter(e=>{var t,l;return"form"!==e.holder_type||O&&D.enabled&&E.current===a.customerId&&((null==(t=e.metadata)?void 0:t.form_id)==null||String(e.metadata.form_id)===String(D.formId))&&((null==(l=e.metadata)?void 0:l.customer_id)==null||String(e.metadata.customer_id)===String(a.customerId))}),[o.holderRelations,O,D.enabled,D.formId,a.customerId]),R=JSON.stringify([a.customerId,D.formId]),[$,F]=(0,eN.useState)(()=>({key:R,ids:L.filter(e=>"form"===e.holder_type).map(e=>e.holder_id)})),[q,B]=(0,eN.useState)(()=>n.initialStage??(!P||o.lineUid&&D.enabled?"holder":"sku")),[H,V]=(0,eN.useState)(!!o.lineUid||"holder"===n.initialStage),U="holder"===q&&D.enabled,Y="sku"===q&&P,W=(0,eN.useRef)(!0),G=(0,eN.useRef)(!1),K=(0,eN.useRef)(0),Q=(0,eN.useRef)(a);Q.current=a;let Z=eKA((null==(t=(l=a.os).getTempOrder)?void 0:t.call(l))??a.order),J=(0,eN.useRef)({os:a.os,scopeKey:a.scopeKey,sessionId:a.session.sessionId,order:Z}),X=o0(()=>{var e,t,l;return W.current&&!1!==Q.current.props.isActive&&Q.current.os===J.current.os&&Q.current.scopeKey===J.current.scopeKey&&Q.current.session.sessionId===J.current.sessionId&&eKA((null==(e=(t=Q.current.os).getTempOrder)?void 0:e.call(t))??Q.current.order)===J.current.order&&(null==(l=Q.current.configurationModal)?void 0:l.extraSession)===o}),ee=eKE(a.os)&&D.enabled&&!eKO(a.context),et=eKE(a.os)&&String(E.current||"")!==String(a.customerId||""),el=a.busy||a.extras.busy||a.checkout.submitting||f||b||!!C,ei=a.disabled||!1===a.props.isActive,ea=(0,eN.useMemo)(()=>({token:{colorPrimary:u.brand.primaryColor,colorPrimaryBg:u.brandTokens["--primary-soft"]}}),[u.brand.primaryColor,u.brandTokens]);(0,eN.useEffect)(()=>(W.current=!0,()=>{W.current=!1,K.current+=1}),[]);let en=o0(async()=>{if(!X()||G.current||ei)return;G.current=!0,y(!0),N(!0),_(void 0);let e=String(eKO(Q.current.context)||"");try{await eKL({context:Q.current.context,products:[A],force:!0,openCustomerAuth:m,isCurrent:X})}catch(e){X()&&_(e0_(e,d("Unable to open holder details. Please try again.","无法打开持有人资料,请重试。")))}finally{let t=String(eKO(Q.current.context)||"");X()&&t&&t!==e&&M({customerId:t,configuration:Q.current.configurationModal.configuration,quantity:h}),G.current=!1,W.current&&y(!1)}});(0,eN.useEffect)(()=>{U&&ee&&D.required&&!j&&!el&&!ei&&en()},[U,ee,D.required,j,el,ei,en]),(0,eN.useEffect)(()=>{if(!C)return;if(!X())return void M(void 0);if(String(a.customerId||"")!==C.customerId||a.extrasCatalog.loading)return;if(a.extrasCatalog.error){M(void 0),_(d("Unable to reload this item. Close it and try again.","无法重新读取该商品,请关闭后重试。"));return}let e=!0;return G.current=!0,(o.lineUid?a.extras.prepareEdit(o.lineUid,C.quantity):a.extras.prepare(o.productDetail,C.quantity)).then(t=>{if(!(e&&X()))return;if("ready"!==t.status)throw Error("invalid"===t.status?t.issues.map(e=>e.message).join(" "):d("This item changed. Close it and try again.","该商品已变化,请关闭后重试。"));let l=iw(t.plan.productDetail,C.configuration.skuValue,{requiredOptionValidation:n.requiredOptionValidation,overSold:1===n.overSold});if(!l)throw Error(d("The item options changed. Close it and choose again.","商品规格已变化,请关闭后重新选择。"));Q.current.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?{...e,plan:t.plan,extraSession:t.session,configuration:{...C.configuration,skuValue:l},initialStage:"holder"}:e)}).catch(t=>{e&&X()&&_(e0_(t,d("Unable to reload this item. Close it and try again.","无法重新读取该商品,请关闭后重试。")))}).finally(()=>{G.current=!1,e&&W.current&&M(void 0)}),()=>{e=!1}},[C,a.customerId,a.extrasCatalog.loading,a.extrasCatalog.error,a.os,a.scopeKey,a.session.sessionId,Z,X]);let er=(0,eN.useCallback)(e=>{T.current=e,S(!!e)},[]),eo=eZ0({enabled:!b&&!1!==a.props.isActive,openId:r.openId,scopeKey:o.contextKey,sessionId:a.session.sessionId,productDetail:g,skuValue:s.skuValue,quantity:h,overSold:1===n.overSold,timeZone:u.timeZone,customerId:a.customerId,os:a.extrasQueries}),es=eKT(g.title||g.name,c),ed=eKT(g.description,c),ec=Rs(g),eu=(g.variant||[]).find(e=>Number(e.id)===Number(s.skuValue.product_variant_id))||g,ep=[99999,Number((null==(i=g.item_rule_limit)?void 0:i.remainingMax)??99999)];1===Number(eu.is_track)&&1!==n.overSold&&ep.push(Number(eu.stock_quantity??0));let em=Math.max(0,Math.min(...ep.filter(Number.isFinite))),eg=e=>String(a.amount(e)),eh=iB(s.skuValue,"",e=>eKT(e,c),eg).reduce((e,t)=>e.concat(t.label,...(t.children||[]).map(e=>e.label)),[]).filter(Boolean).join(" \xb7 "),ev=()=>{el||G.current||(K.current+=1,a.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?void 0:e))},ef=async()=>{if(el||ei||G.current||Y&&(!T.current||!w))return;G.current=!0;let e=K.current,t=()=>X()&&e===K.current,l=()=>t()&&!Q.current.disabled&&!1!==Q.current.props.isActive&&(!eKE(Q.current.os)||String(E.current||"")===String(Q.current.customerId||""));y(!0),_(void 0);try{var i,r;if(Y&&!1!==n.requiredOptionValidation)try{await T.current.validate()}catch{return}if(!l())return;let e=iw(g,(null==(i=T.current)?void 0:i.getTransformValues())??s.skuValue,{requiredOptionValidation:n.requiredOptionValidation,overSold:1===n.overSold});if(!e)throw Error(d("Complete the required selections to continue.","请完成必选内容后继续。"));let c={skuValue:e,variantDraft:Q.current.configurationModal.configuration.variantDraft};if(a.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?{...e,configuration:c}:e),Y&&B4(eJS(o.productDetail,e.product_variant_id,o.editingLine)).enabled){V(!0),B("holder");return}let u=U&&!ee?await (null==(r=I.current)?void 0:r.readRelations()):L;if(!u||!l())return;let p=await a.extras.commit(o,c,h,u);if(!t()||"cancelled"===p.status)return;x(!0),a.setConfigurationModal(e=>(null==e?void 0:e.extraSession)===o?void 0:e)}catch(e){t()&&_(e0_(e,d("Unable to add this item. Please try again.","暂时无法添加商品,请重试。")))}finally{G.current=!1,W.current&&y(!1)}},ey="phone"===a.variant?"mobile":"desktop",eb=FY.View;return(0,eB.jsx)(eM.ConfigProvider,{theme:ea,children:(0,eB.jsx)(nB.PisellThemeProvider,{theme:ea,children:(0,eB.jsx)(oq,{renderType:"mobile"===ey?"drawer":"modal",props:{...FY.getContainerProps(ey),open:!0,onCancel:ev,onClose:ev,closable:!1,destroyOnClose:!0,placement:"bottom",getContainer:u.portal||void 0,className:`${FY.containerClassName} venue-extra-detail-modal venue-booking-legacy-controls`},children:(0,eB.jsxs)(eb,{layout:ey,title:es,subtitle:eKT(g.subtitle,c),cover:g.cover,coverText:es.slice(0,2),unitPrice:ec&&(0,eB.jsxs)(eB.Fragment,{children:["from"===ec.qualifier&&d("From ",""),a.amount(ec.amount),"from"===ec.qualifier&&d(""," 起")]}),totalPrice:(0,eB.jsx)("span",{role:"status","aria-live":"polite",children:"ready"===eo.status?a.amount(eo.subtotal):"loading"===eo.status?d("Calculating…","正在计算…"):"—"}),selectionSummary:eh,description:ed?(0,eB.jsx)(eZz,{content:ed}):null,loading:!1,pending:el,confirmDisabled:ei||Y&&!w||h>em||et||U&&ee&&D.required,confirmLabel:Y&&D.enabled?d("Next: holder details","下一步:选择档案"):o.lineUid?d("Save changes","保存修改"):d("Add to cart","加入购物车"),closeLabel:d("Close","关闭"),backLabel:d("Back","返回"),onBack:U&&P&&!o.lineUid?()=>{el||(B("sku"),_(void 0))}:void 0,onClose:ev,onConfirm:()=>{ef()},noteControl:null,quantityControl:(0,eB.jsxs)(eB.Fragment,{children:[k&&(0,eB.jsx)("div",{role:"alert",className:"venue-extra-detail-error",children:k}),(0,eB.jsx)(z0,{variant:"capsule",size:"large",value:h,min:1,max:em,disabled:el||ei,theme:ea,onChange:e=>{G.current||el||ei||(K.current+=1,v(e),_(void 0))}})]}),children:[Y&&(0,eB.jsx)($T,{ref:er,type:FY.skuType,dataSource:g,value:s.skuValue,variantDraft:s.variantDraft,selectionKey:r.selectionKey,initializationPolicy:H?"preserve":"auto-required-defaults",disabled:ei||b,config:{overSold:n.overSold},theme:ea,priceFormatter:eg,customScrollParent:".venue-extra-detail-modal .sku-detail-appearance__scroller",presentation:{modal:{className:"pisell-flat-sku-selection-modal pisell-booking-product-detail-options-modal"}},onChange:(e,t)=>{if(G.current||el||ei)return;K.current+=1,_(void 0);let l=B4(eJS(o.productDetail,e.product_variant_id,o.editingLine));(String(l.formId)!==String(D.formId)||l.enabled!==D.enabled)&&(z(!1),F({key:JSON.stringify([a.customerId,l.formId]),ids:[]})),a.setConfigurationModal(l=>(null==l?void 0:l.extraSession)===o?{...l,configuration:{skuValue:e,variantDraft:void 0===t?l.configuration.variantDraft:t.variantDraft}}:l)}}),U&&ee?(0,eB.jsx)("div",{className:"venue-extra-holder","aria-busy":f||!!C,children:f||C?(0,eB.jsx)("div",{className:"venue-holder-skeleton",role:"status","aria-label":d("Loading holder profiles","正在加载档案"),children:(0,eB.jsx)("div",{className:"holder-picker","aria-hidden":"true",children:(0,eB.jsx)("span",{className:"venue-holder-skeleton-field"})})}):(0,eB.jsx)("button",{type:"button",className:"button secondary",disabled:el||ei,onClick:()=>{en()},children:D.required?d("Choose holders","选择持有人"):d("Choose holders (optional)","选择持有人(选填)")})}):U&&(0,eB.jsx)(e2h,{ref:I,source:A,previous:L,quantity:h,customerId:a.customerId,os:a.os,ids:$.key===R?$.ids:[],onChange:e=>F({key:R,ids:e}),disabled:el||ei,text:d},R)]})})})})}function e2y(e){let{animated:t,artRef:l}=e;return(0,eB.jsx)("span",{ref:l,className:`benefits-banner-art${t?" benefits-banner-art--animated":""}`,"aria-hidden":"true",children:(0,eB.jsxs)("svg",{viewBox:"0 0 120 88",focusable:"false",children:[(0,eB.jsxs)("g",{className:"benefits-banner-sparkles",children:[(0,eB.jsx)("circle",{cx:"18",cy:"18",r:"4"}),(0,eB.jsx)("circle",{cx:"101",cy:"65",r:"3"}),(0,eB.jsx)("path",{d:"M91 11l2 5 5 2-5 2-2 5-2-5-5-2 5-2 2-5Z"})]}),(0,eB.jsxs)("g",{className:"benefits-banner-gift benefits-banner-gift--left",children:[(0,eB.jsx)("rect",{x:"13",y:"31",width:"35",height:"31",rx:"5"}),(0,eB.jsx)("path",{d:"M10 31h41v10H10zM30.5 31v31M19 22c8-1 11 9 11 9s-12 1-12-6c0-1 .3-2 1-3Zm23 0c-8-1-11 9-11 9s12 1 12-6c0-1-.3-2-1-3Z"})]}),(0,eB.jsxs)("g",{className:"benefits-banner-gift benefits-banner-gift--right",children:[(0,eB.jsx)("rect",{x:"80",y:"38",width:"27",height:"25",rx:"4"}),(0,eB.jsx)("path",{d:"M77 38h33v8H77zM93.5 38v25M85 31c6-1 8 7 8 7s-9 1-9-4c0-1 .3-2 1-3Zm17 0c-6-1-8 7-8 7s9 1 9-4c0-1-.3-2-1-3Z"})]}),(0,eB.jsxs)("g",{className:"benefits-banner-ticket",children:[(0,eB.jsx)("path",{d:"M43 20h42a6 6 0 0 1 6 6v8a7 7 0 0 0 0 14v8a6 6 0 0 1-6 6H43a6 6 0 0 1-6-6v-8a7 7 0 0 0 0-14v-8a6 6 0 0 1 6-6Z"}),(0,eB.jsx)("path",{d:"M54 49 74 30"}),(0,eB.jsx)("circle",{cx:"55",cy:"31",r:"3"}),(0,eB.jsx)("circle",{cx:"73",cy:"49",r:"3"})]})]})})}function e2b(e){let{status:t,needsAttention:l=!1,hidden:i=!1,disabled:a=!1,open:n,onOpenChange:r,onOpen:o,onClose:s,children:d,dialogProps:c,presentation:u="dialog"}=e,{lang:p,presentationPlatform:m}=eKa(),g="kiosk"===m,[h,v]=(0,eN.useState)(!1),f=n??h,y=e=>{void 0===n&&v(e),null==r||r(e)},[b,x]=(0,eN.useState)(!1),k=(0,eN.useRef)(null),_=t??eQA(p,"benefitsTitle"),w=!b&&!a&&!l;(0,eN.useLayoutEffect)(()=>{let e=k.current;if(e)return eKN(e,"--checkout-benefits-height",g)},[g]);let S=()=>{y(!1),null==s||s(),requestAnimationFrame(()=>{var e,t;return null==(t=k.current)||null==(e=t.querySelector("button"))?void 0:e.focus({preventScroll:!0})})},j=(0,eN.useRef)(S);j.current=S,(0,eN.useEffect)(()=>{if("floating"!==u||!f||i)return;let e=()=>Array.from(document.querySelectorAll((null==c?void 0:c.externalDialogSelector)??eQd)).some(e=>e.getClientRects().length>0),t=t=>{var l;(null==(l=k.current)?void 0:l.contains(t.target))||e()||(y(!1),null==s||s())},l=t=>{"Escape"!==t.key||t.defaultPrevented||e()||(t.preventDefault(),j.current())};return document.addEventListener("pointerdown",t),document.addEventListener("keydown",l),()=>{document.removeEventListener("pointerdown",t),document.removeEventListener("keydown",l)}},[u,f,i,r,s,null==c?void 0:c.externalDialogSelector]);let N=d??(0,eB.jsx)("p",{className:"benefits-empty",role:"status",children:"zh"===p?"当前没有可用优惠,您可以继续完成预订。":"There are no offers available for this booking. You can continue to checkout."});return(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)("div",{className:`checkout-benefits${"floating"===u?" checkout-benefits--floating":""}`,ref:k,hidden:i,children:[(0,eB.jsxs)(eKQ,{secondary:!0,className:`checkout-benefits-trigger${l?" needs-attention":""}`,"data-attention":w?"true":void 0,disabled:a,"aria-haspopup":"dialog","aria-expanded":f&&!i,onClick:()=>{x(!0),f?S():(y(!0),null==o||o())},children:[(0,eB.jsx)(e2y,{animated:w}),(0,eB.jsx)("span",{className:"checkout-benefits-label","aria-live":"polite","aria-atomic":"true",children:_}),(0,eB.jsx)(e0D,{className:"checkout-benefits-arrow",size:18,"aria-hidden":"true"})]}),"floating"===u&&(0,eB.jsx)("section",{className:"checkout-benefits-popover",role:"dialog","aria-label":eQA(p,"benefitsTitle"),hidden:!f||i,children:N})]}),"dialog"===u&&(0,eB.jsx)(eQu,{...c,zIndex:(null==c?void 0:c.zIndex)??600,externalDialogSelector:(null==c?void 0:c.externalDialogSelector)??eQd,title:eQA(p,"benefitsTitle"),closeLabel:eQA(p,"close"),className:"checkout-benefits-dialog",open:f&&!i,onClose:S,footer:(0,eB.jsxs)("div",{className:"checkout-benefits-footer",children:[(0,eB.jsx)("p",{role:"status","aria-atomic":"true",children:_}),(0,eB.jsx)(eKQ,{onClick:S,children:eQA(p,"benefitsDone")})]}),children:N})]})}let e2x=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm84,108a83.6,83.6,0,0,1-16.75,50.28L77.72,60.75A84,84,0,0,1,212,128ZM44,128A83.6,83.6,0,0,1,60.75,77.72L178.28,195.25A84,84,0,0,1,44,128Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm88,104a87.56,87.56,0,0,1-20.41,56.28L71.72,60.4A88,88,0,0,1,216,128ZM40,128A87.56,87.56,0,0,1,60.41,71.72L184.28,195.6A88,88,0,0,1,40,128Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M200,128a71.69,71.69,0,0,1-15.78,44.91L83.09,71.78A71.95,71.95,0,0,1,200,128ZM56,128a71.95,71.95,0,0,0,116.91,56.22L71.78,83.09A71.69,71.69,0,0,0,56,128Zm180,0A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-20,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm90,102a89.6,89.6,0,0,1-22.29,59.22L68.78,60.29A89.95,89.95,0,0,1,218,128ZM38,128A89.6,89.6,0,0,1,60.29,68.78L187.22,195.71A89.95,89.95,0,0,1,38,128Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm88,104a87.56,87.56,0,0,1-20.41,56.28L71.72,60.4A88,88,0,0,1,216,128ZM40,128A87.56,87.56,0,0,1,60.41,71.72L184.28,195.6A88,88,0,0,1,40,128Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm92,100a91.67,91.67,0,0,1-24.21,62.13L65.87,60.21A92,92,0,0,1,220,128ZM36,128A91.67,91.67,0,0,1,60.21,65.87L190.13,195.79A92,92,0,0,1,36,128Z"}))]]),e2k=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e2x}));function e2_(e){let{name:t,image:l,imageFallback:i,imagePosition:a,description:n,descriptionContent:r,lang:o,price:s,priceSuffix:d,metadata:c,details:u,badge:p,featured:m=!1,selection:g,actionLabel:h,disabled:v=!1,busy:f=!1,unavailable:y,disabledReason:b,onSelect:x}=e,k=dL("booking-presentation"),_=v||!!y,w=y?eQA(o,"unavailableProductAction"):h;return(0,eB.jsxs)("article",{className:`product-card ${m?"featured-product":""} ${g?"has-selection":""} ${_?"is-disabled":""} ${y?"is-unavailable":""}`,children:[g&&(0,eB.jsxs)("p",{id:`${k}-selection`,className:"product-selected-count","aria-live":"polite","aria-atomic":"true",children:[(0,eB.jsx)("span",{className:"sr-only",children:g.description??g.label}),(0,eB.jsx)("span",{className:"product-selected-label","aria-hidden":"true",children:g.label})]}),(l||i||p||y)&&(0,eB.jsxs)("div",{className:"product-image",children:[l&&(0,eB.jsx)("img",{src:l,alt:"",style:a?{objectPosition:a}:void 0}),!l&&i,p&&(0,eB.jsx)("span",{className:"product-badge",children:p}),y&&(0,eB.jsxs)("span",{id:`${k}-unavailable`,className:"product-unavailable-badge",children:["ended"===y.kind?(0,eB.jsx)(e0$,{size:16,"aria-hidden":"true"}):(0,eB.jsx)(e2k,{size:16,"aria-hidden":"true"}),(0,eB.jsx)("span",{children:y.label})]})]}),(0,eB.jsxs)("div",{className:"product-copy",children:[(0,eB.jsx)("h3",{children:t}),c,(0,eB.jsx)(eZU,{name:t,description:n,content:r,lang:o}),u,!y&&v&&b&&(0,eB.jsx)("span",{id:`${k}-disabled`,className:"sr-only",children:b}),(0,eB.jsxs)("div",{className:"product-bottom",children:[(0,eB.jsxs)("div",{children:[(0,eB.jsx)("strong",{children:s}),d&&(0,eB.jsx)("small",{children:d})]}),(0,eB.jsxs)(eKQ,{className:"product-select","aria-label":`${w}: ${t}`,"aria-describedby":[g&&`${k}-selection`,y?`${k}-unavailable`:v&&b&&`${k}-disabled`].filter(Boolean).join(" ")||void 0,"aria-haspopup":"dialog",disabled:_,busy:f,onClick:x,children:[w,y?(0,eB.jsx)(e2k,{size:18,"aria-hidden":"true"}):(0,eB.jsx)(e0D,{size:18,"aria-hidden":"true"})]})]})]})]})}function e2w(e){let t="string"==typeof e?e.trim().toLowerCase():"";return"past"===t?"ended":"capacity_full"===t||"resource_capacity_exceeded"===t?"capacity":["booking_cutoff_after_start","booking_cutoff_before_start","booking_cutoff_advance"].includes(t)?"cutoff":["booking_cutoff_future_day","schedule_excluded_date","outside_operating_hours","outside_resource_window"].includes(t)?"not-open":t.includes("configuration")||["booking_cutoff_invalid","unsupported_resource_group","availability_unsupported"].includes(t)?"configuration":void 0}e2k.displayName="ProhibitIcon";let e2S=GH["sku-list-a5"],e2j={...e2S,skuListConfig:{...e2S.skuListConfig,listConfig:{...null==(et=e2S.skuListConfig)?void 0:et.listConfig,columns:2,showTab:!0,isTreeTab:!1,tabStyle:"switch",stickyTop:!1,columnGap:16,rowGap:24}}},e2N={...eqP,columns:2,layoutDirection:"column",nameColor:"var(--ink)",priceColor:"var(--ink)"},e2C={...e2S,skuListConfig:{...e2S.skuListConfig,listConfig:{...null==(el=e2S.skuListConfig)?void 0:el.listConfig,columns:1,isTreeTab:!1,stickyTop:!1,columnGap:16,rowGap:16},skuCardAllConfig:{...null==(ei=e2S.skuListConfig)?void 0:ei.skuCardAllConfig,skuCardConfig:{...null==(en=e2S.skuListConfig)||null==(ea=en.skuCardAllConfig)?void 0:ea.skuCardConfig,background:"var(--cream)",paddingX:16,paddingY:16}}}},e2M={...eqP,columns:1,layoutDirection:"row",showImage:!0,imageWidth:"96px",imageHeight:"96px",nameColor:"var(--ink)",priceColor:"var(--ink)"};function e2T(e){let{product:t,presentation:l,disabled:i,onSelect:a,settlementPriceRows:n,mode:r,locale:o,quantityByProductId:s,formatAmount:d,preparingProductId:c,availability:u,catalogLoading:p,catalogError:m,productLoadChannel:g}=e,h="party"===r,v=o.startsWith("zh"),f=function(e){let{product:t,availability:l,loading:i,error:a,channel:n,locale:r}=e;if(i||a)return;let o=String(r||"").startsWith("zh"),s=(e,t)=>o?t:e;if(RS(t,n))return{label:s("Sold out","已售罄"),kind:"unavailable"};let d=!!(l&&!l.available&&!l.requiresConfiguration);if(!Rj(t)&&!d)return;let c=null==l?void 0:l.reasons,u=(d&&Array.isArray(c)?c:[]).map(e2w),p=u.length&&u[0]&&u.every(e=>e===u[0])?u[0]:void 0;return"ended"===p?{label:s("Session ended","时段已结束"),kind:"ended"}:"capacity"===p?{label:s("Not enough capacity","剩余容量不足"),kind:"unavailable"}:"cutoff"===p?{label:s("Booking closed","预订已截止"),kind:"unavailable"}:"not-open"===p?{label:s("Not offered on this date","当日未开放"),kind:"unavailable"}:"configuration"===p?{label:s("Booking setup incomplete","配置不完整"),kind:"unavailable"}:{label:s("Unavailable on this date","当前日期不可预约"),kind:"unavailable"}}({product:t,availability:u[String(t.id)],loading:p,error:m,channel:g,locale:o}),y=eKT(t.title??t.name,v?"zh":"en"),b=(null==l?void 0:l.description)??eKI(t.description,v?"zh":"en"),x=Rs(t),k="string"==typeof t.cover?t.cover:"",_=(null==l?void 0:l.actionLabel)??(h?v?"查看并选择":"View and customize":v?"选择门票":"Choose ticket"),w=Array.isArray(t._promotionTags)?t._promotionTags.map(e=>eKT(e.text,v?"zh":"en")).filter(Boolean):[],S=(null==n?void 0:n.length)?(0,eB.jsx)(Ru,{rows:n}):x&&d?(0,eB.jsxs)("span",{className:"pisell-price-text",children:["from"===x.qualifier&&!v&&(0,eB.jsx)("span",{className:"pisell-price-text-prefix-text",style:{fontSize:"0.65em",marginRight:4},children:"From"}),d(x.amount),"from"===x.qualifier&&v&&(0,eB.jsx)("span",{className:"pisell-price-text-suffix-text",style:{fontSize:"0.65em",marginLeft:4},children:"起"}),x.unit&&(0,eB.jsxs)("span",{children:["/",x.unit]})]}):x?(0,eB.jsx)(LJ,{value:x.amount,isMini:"from"===x.qualifier,precision:x.precision,hideDecimalForWholeNumbers:!x.precision&&void 0,suffix:x.unit?(0,eB.jsxs)("span",{children:["/",x.unit]}):void 0}):null,j=Number((null==s?void 0:s[String(t.id)])||0),N=h?(null==l?void 0:l.selected)?{label:v?"已选":"Selected"}:void 0:j>0?{label:eQA(v?"zh":"en","selectedTicketCorner").replace("{count}",String(j)),description:eQA(v?"zh":"en","selectedTickets").replace("{count}",String(j))}:void 0;return(0,eB.jsx)(e2_,{name:y,image:k?oQ(k,800):void 0,imageFallback:(0,eB.jsx)(nB.PisellImageCard,{className:"venue-catalog-text-cover",dataSource:{alt:y},width:"100%",height:"100%"}),description:"string"==typeof b?b:eKI(t.description,v?"zh":"en"),descriptionContent:(0,eB.jsx)(eZz,{content:eKT(t.description,v?"zh":"en")}),lang:v?"zh":"en",price:S,metadata:null==l?void 0:l.businessInfo,details:w.length?(0,eB.jsx)("span",{className:"venue-catalog-promotions",children:w.map((e,t)=>(0,eB.jsx)("span",{children:e},`${t}:${e}`))}):void 0,selection:N,actionLabel:"string"==typeof _?_:v?"选择商品":"Choose product",busy:c===String(t.id),disabled:i,unavailable:f,onSelect:a})}function e2I(e){return null==e?null:Array.isArray(e)?e.map(e2I):"object"==typeof e?Object.keys(e).sort().reduce((t,l)=>(t[l]=e2I(e[l]),t),{}):e}let e2P=e=>{if("string"!=typeof e&&"number"!=typeof e)return;let t=String(e).trim();return t&&"0"!==t?t:void 0},e2A=e=>{var t;return e2P((null==(t=e.metadata)?void 0:t.unique_identification_number)??e.unique_identification_number??e.identity_key)};function e2D(e){if(("string"==typeof e||"number"==typeof e)&&String(e).trim())try{let t=new lO(e);return t.isFinite()&&t.gte(0)?t:void 0}catch{return}}let e2E=new Set(["id","discount_id","order_discount_id","amount","_num","num"]),e2O=new Set(["fixed_amount","original_amount"]),e2z=new Set(["num","mainProductDiscountAmount","optionDiscountAmount","product_discount_difference","custom_product_bundle_map_id","unique_identification_number","product_uid","booking_uid"]);function e2L(e,t){return Object.keys(e||{}).reduce((l,i)=>(t.has(i)||(l[i]=e[i]),l),{})}function e2R(e,t){let l=[];for(let i of e){let e=e2D(i[t]),a=e2D(i.num);if(!e||!a||!a.gt(0))return;let n=lO.clone({precision:Math.max(20,e.precision()+a.precision())});l.push(new n(e).mul(a))}let i=Math.max(1,...l.map(e=>e.e+1)),a=Math.max(0,...l.map(e=>e.decimalPlaces())),n=lO.clone({precision:i+a+String(e.length).length+2});return l.reduce((e,t)=>e.plus(t),new n(0)).toString()}function e2$(e){if(("string"==typeof e||"number"==typeof e)&&""!==String(e).trim())try{let t=new lO(e);return t.isFinite()?t:void 0}catch{return}}let e2F=e=>{var t,l;return{os:e.os,scopeKey:e.scopeKey,sessionId:e.session.sessionId,identity:eKA((null==(t=(l=e.os).getTempOrder)?void 0:t.call(l))??e.order)}},e2q=(e,t)=>e.os===t.os&&e.scopeKey===t.scopeKey&&e.sessionId===t.sessionId&&e.identity===t.identity,e2B=e=>{var t,l,i;return String((null==(t=(null==(l=(i=e.os).getTempOrder)?void 0:l.call(i))??e.order)?void 0:t.customer_id)||"")};function e2H(e){var t,l,i,a;return String((null==(t=e.os.otherParams)?void 0:t.platform)||(null==(a=e.engine)||null==(i=a.appHelper)||null==(l=i.constants)?void 0:l.platform)||"").trim().toLowerCase()}let e2V=(e,t)=>eKE(e.os)||"promotion_code"===t&&"kiosk"===e2H(e);function e2U(e,t){let l=Uv(),i=(0,nB.useToast)(),a=Uu(),n=(0,eN.useMemo)(()=>eND(a.customerAuth),[a.customerAuth]),r=(0,eN.useRef)(e);r.current=e;let o=(0,eN.useRef)(!0),s=(0,eN.useRef)(),[d,c]=(0,eN.useState)(!1),[u,p]=(0,eN.useState)(),m=e2F(e),g=e2V(e,t),h=l.isLoggedIn(),v="promotion_code"===t?t:void 0,f=(g?!eKz(e.context,{reason:v}):h)&&!!u&&e2q(u.owner,m)&&u.customer===e2B(e);return(0,eN.useEffect)(()=>(o.current=!0,()=>{var e,t;o.current=!1,null==(t=s.current)||null==(e=t.cancelLogin)||e.call(t),s.current=void 0}),[]),(0,eN.useEffect)(()=>{if(s.current&&!e2q(s.current.owner,m)){var e,t;null==(e=(t=s.current).cancelLogin)||e.call(t),s.current=void 0,c(!1)}},[m.os,m.scopeKey,m.sessionId,m.identity]),(0,eN.useEffect)(()=>{g||h||p(void 0)},[g,h]),{ready:f,pending:d,ensure:o0(()=>{let e=r.current,a=e2F(e);if(!o.current||!e.ready||!1===e.props.isActive)return Promise.resolve(!1);let d=e2V(e,t);if((d?!eKz(e.context,{reason:v}):l.isLoggedIn())&&u&&e2q(u.owner,a)&&u.customer===e2B(e))return Promise.resolve(!0);if(s.current&&e2q(s.current.owner,a))return s.current.promise;let m={owner:a};s.current=m;let g=()=>o.current&&s.current===m&&!1!==r.current.props.isActive&&("promotion_code"!==t||r.current.showOffers)&&e2q(a,e2F(r.current));return m.promise=Promise.resolve().then(async()=>{try{if(!g())return!1;if(d){if(!await eKL({context:e.context,reason:v,openCustomerAuth:n,isCurrent:g})||!g())return!1;return r.current.cart.refreshCartSnapshot(),p({owner:a,customer:e2B(r.current)}),!0}if(!l.isLoggedIn()&&(!await new Promise(t=>{if(m.cancelLogin=()=>t(!1),!l.openLoginModal({callback:e=>{m.cancelLogin=void 0,t("success"===e)}}))throw m.cancelLogin=void 0,Error(e.text("Login is unavailable. Please try again.","登录暂不可用,请重试。"))})||!g()||!l.isLoggedIn())||!g())return!1;if("function"!=typeof a.os.syncAuthenticatedOrderCustomer||await a.os.syncAuthenticatedOrderCustomer()!==!0)throw Error(e.text("Could not load your account details. Please try again.","无法读取账号信息,请重试。"));if(!g()||!l.isLoggedIn())return!1;return r.current.cart.refreshCartSnapshot(),p({owner:a,customer:e2B(r.current)}),!0}catch(l){return g()&&("promotion_code"===t?i.fail(e0_(l,e.text("Could not verify your account. Please try again.","无法验证账号,请重试。"))):r.current.setError(e0_(l,e.text("Could not prepare checkout. Please try again.","无法进入确认页面,请重试。")))),!1}finally{s.current===m&&(s.current=void 0,o.current&&c(!1))}}),c(!0),m.promise})}}function e2Y(e){var t,l;let{runtime:i,visible:a=!0}=e,{context:n,sales:r,cart:o,variant:s}=i,d=e2H(i),c=e2U(i,"promotion_code"),u=(null==(l=r.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))||r.tempOrder||o.tempOrder,p=Number(null==u?void 0:u.customer_id);return(0,eB.jsx)(eTK,{customerId:Number.isFinite(p)?p:void 0,discountList:o.discountList,getDiscountList:r.getDiscountList,scanPromotionCode:o.scanCode,setDiscountSelected:o.setDiscount,patchDiscountCardHolderOnStore:r.patchDiscountCardHolderOnStore,variant:s,children:(0,eB.jsxs)("div",{hidden:!a,children:[(0,eB.jsx)(eTG,{}),(0,eB.jsx)(ePj,{context:n,variant:s,appearance:"light",enableWalletAssets:!0,enableManualPromotionCode:!0,beforePromotionCodeSearch:["pc","h5","kiosk"].includes(d)?c.ensure:void 0,enablePromotionBanner:!0,preserveWalletAssetsWhileRefreshing:!0,enableVoucherProductAdd:!1,promotionProductSource:"catalog-only"})]})})}function e2W(e){var t,l,i,a,n,r,o;let{context:s,lines:d,locale:c}=e,u=UF(),p=String(c||"").startsWith("zh"),m=function(e,t,l){let i=new Map;for(let a of e){if(!a.config.enabled)continue;let e=l(a.cacheItem);for(let l=0;l<a.quantity;l+=1){let n=a.ids[l],r=null!=n&&""!==n,o=JSON.stringify([String(a.config.formId),r?String(n):"unselected"]),s=i.get(o);s?s.quantity+=1:i.set(o,{key:o,formId:a.config.formId,quantity:1,label:r?e2m(a,n,t,e)||String(n):void 0})}}return Array.from(i.values())}(d,(null==(i=s.sales.bookingTicket)||null==(l=i.getOrderCustomerSnapshot)||null==(t=l.call(i))?void 0:t.id)??(null==(r=s.sales.bookingTicket)||null==(n=r.getTempOrder)||null==(a=n.call(r))?void 0:a.customer_id)??(null==(o=s.sales.tempOrder)?void 0:o.customer_id),u.getHolderOptionsForSource);if(!m.length)return null;let g=e01(void 0,c).name,h=new Map;for(let e of d){let t=String(e.config.formId);e.config.enabled&&!h.has(t)&&h.set(t,e01(u.getHolderFormDetailForSource(e.cacheItem),c).name)}return(0,eB.jsx)("div",{className:"venue-cart-holders","aria-label":p?"持有人":"Holder",children:m.map(e=>{let t=h.get(String(e.formId))||g;return(0,eB.jsxs)("div",{className:e.label?void 0:"venue-cart-holder-unselected",children:[e.label?(0,eB.jsxs)(eB.Fragment,{children:[t,p?":":": ",e.label]}):p?`尚未选择${t}`:`${t} not selected`,e.quantity>1&&(0,eB.jsxs)(eB.Fragment,{children:[" \xd7 ",e.quantity]})]},e.key)})})}function e2G(e){let{products:t,locale:l}=e,i=eTC(t);return i.length?(0,eB.jsx)("div",{className:"venue-order-promotions","aria-label":l.startsWith("zh")?"已生效活动":"Applied promotions",children:i.map(e=>(0,eB.jsx)("span",{children:e.detail||e.title},e.key))}):null}function e2K(e,t,l,i){return(0,eN.useMemo)(()=>{if(!e.length)return e;let a=e=>e.map(e=>{let t=e._promotionTags||[];return{...e,_promotionTags:t.map(e=>({...e,text:eKT(e.text,i)})).filter(e=>e.text)}});if(null==t?void 0:t.appendPromotionTags)try{let i=t.appendPromotionTags(e);if(!l||i.some(e=>{var t;return null==(t=e._promotionTags)?void 0:t.length}))return a(i)}catch{}return a(exh(e,l))},[e,t,l,i])}function e2Q(e,t){var l;let{session:i,checkout:a,error:n,handoff:r,config:o,text:s}=e;if(!i.ready||i.error||i.pendingOrder)return;let d=t||n||a.error;return d?{kind:"error",tone:"error",message:d}:(null==(l=e.depositHydration)?void 0:l.error)?{kind:"deposit",tone:"error",message:e.depositHydration.error}:r?{kind:"submitted",tone:"success",message:s("Your order was submitted. Continue in the payment page or order details.","订单已提交,请在支付页或订单详情继续。")}:o.visualError?{kind:"design",tone:"warning",message:s("The design settings are invalid. The last valid appearance is still in use.","视觉配置无效,已保留上一份有效样式。")}:void 0}function e2Z(e){let{feedback:t,text:l,onDismiss:i,onRetry:a,onRetryPayment:n}=e;return(0,eB.jsx)(eZf,{tone:t.tone,className:"venue-action-feedback",children:(0,eB.jsxs)("div",{className:"venue-action-feedback-message",children:[(0,eB.jsx)("span",{children:t.message}),"deposit"===t.kind&&a&&(0,eB.jsx)(eKQ,{secondary:!0,onClick:a,children:l("Retry","重试")}),n&&(0,eB.jsx)(eKQ,{secondary:!0,onClick:n,children:l("Continue payment","继续支付")}),"restored"===t.kind&&i&&(0,eB.jsx)(eKZ,{className:"venue-action-feedback-dismiss","aria-label":l("Dismiss draft notice","关闭草稿恢复提示"),onClick:i,children:(0,eB.jsx)(eQa,{size:16,"aria-hidden":"true"})})]})})}function e2J(e,t){var l;let[i,a]=(0,eN.useState)(),n=e2Q(e,t),r=n&&!e.linePicker&&("restored"!==n.kind||i!==e.scopeKey)?(0,eB.jsx)(e2Z,{feedback:n,text:e.text,onRetry:null==(l=e.depositHydration)?void 0:l.retry,onRetryPayment:e.checkout.canRetryPayment?()=>{e.checkout.retryPayment()}:void 0,onDismiss:()=>a(e.scopeKey)}):void 0,o=e.orderPanel.isMobile&&!e.orderPanel.open;return{summary:o?void 0:r,footer:o?r:void 0}}function e2X(e){let{extras:t=!1}=e;return(0,eB.jsx)("div",{className:`list-group-items venue-catalog-skeleton-grid${t?" venue-catalog-skeleton-grid--extras":""}`,"aria-hidden":"true",children:[0,1].map(e=>t?(0,eB.jsxs)("div",{className:"pisell-plus-sales-product-card venue-catalog-skeleton-extra",children:[(0,eB.jsx)("div",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-extra-image"}),(0,eB.jsxs)("div",{className:"venue-catalog-skeleton-copy",children:[(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block"}),(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-short"})]}),(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-control"})]},e):(0,eB.jsx)("article",{className:"product-card venue-catalog-skeleton-card",children:(0,eB.jsxs)("div",{className:"product-copy",children:[(0,eB.jsx)("h3",{children:(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block"})}),(0,eB.jsxs)("div",{className:"product-description venue-catalog-skeleton-copy",children:[(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block"}),(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-short"})]}),(0,eB.jsxs)("div",{className:"product-bottom",children:[(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-price"}),(0,eB.jsx)("span",{className:"venue-catalog-skeleton-block venue-catalog-skeleton-action"})]})]})},e))})}function e20(e){var t;let{runtime:l,showHero:i="select"===l.step}=e,{bookingUI:a,config:n}=l;return(0,eB.jsx)(eB.Fragment,{children:i&&(null==(t=n.brand)?void 0:t.hero)&&(0,eB.jsx)("section",{className:"hero booking-hero venue-booking-sales__hero","aria-label":a.brand.name,children:(0,eB.jsx)("img",{src:n.brand.hero,alt:""})})})}function e22(e){let{runtime:t}=e,{session:l,order:i,text:a,openOrderHistory:n}=t,r=t.isKiosk&&(0,eB.jsx)(eKQ,{secondary:!0,disabled:t.checkout.paymentActive||t.kioskLifecycle.resetting,onClick:()=>{t.kioskLifecycle.finish({navigateHome:!0})},children:a("Back to home","返回首页")});return t.isKiosk&&l.error?(0,eB.jsxs)(eZf,{tone:"error",children:[l.error,(0,eB.jsx)(eKQ,{disabled:t.checkout.paymentActive||t.kioskLifecycle.resetting,onClick:()=>{l.restart().catch(e=>t.setError(e instanceof Error?e.message:String(e)))},children:a("Retry","重试")}),r]}):l.error?(0,eB.jsx)(eZf,{tone:"error",children:l.error}):l.ready?t.isKiosk&&l.pendingOrder?(0,eB.jsxs)(eZf,{children:[(0,eB.jsx)("p",{children:a("An order is already open. Return home to start another booking.","当前已有订单,可返回首页开始新的预订。")}),r]}):l.pendingOrder?(0,eB.jsxs)(eZf,{children:[(0,eB.jsx)("p",{children:a("You have an existing order. Continue from its order details.","已有订单,请从订单详情继续。")}),Number(null==i?void 0:i.order_id)>0&&(0,eB.jsx)("a",{className:"button secondary",href:`/order/details?id=${encodeURIComponent(i.order_id)}`,children:a("Open order","查看订单")}),(0,eB.jsx)(eKQ,{secondary:!0,onClick:n,children:a("Check order history","核对订单记录")})]}):null:(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("div",{className:"venue-booking-sales__loading",role:"status","aria-label":a("Loading your booking","正在加载预订"),children:(0,eB.jsx)(eM.Spin,{})}),r]})}function e21(e){var t,l;let{runtime:i}=e,{configurationModal:a,setConfigurationModal:n,locale:r,busy:o,extras:s,checkout:d,setComposer:c,linePicker:u,setLinePicker:p,bookingUI:m,text:g,run:h,disabled:v,setExpandedSection:f}=i,y=eKB(),b="zh"===r?"zh":"en",x=u?e2Q(i):void 0,k=eZ0({enabled:!!(null==a?void 0:a.partyDraft)&&!1!==i.props.isActive,openId:null==a?void 0:a.plan.openId,scopeKey:i.scopeKey,sessionId:i.session.sessionId,productDetail:null==a?void 0:a.plan.productDetail,skuValue:null==a?void 0:a.configuration.skuValue,quantity:null==a||null==(t=a.partyDraft)?void 0:t.quantity,overSold:(null==a?void 0:a.overSold)===1,priceBasis:"catalog",timeZone:m.timeZone,customerId:i.customerId,os:i.mainQueries}),_=(null==a?void 0:a.partyDraft)?{label:g("Estimated subtotal","预计小计"),amount:(0,eB.jsx)("span",{role:"status","aria-live":"polite",children:"ready"===k.status?i.amount(k.subtotal):"loading"===k.status?g("Calculating…","正在计算…"):g("Unavailable","暂无法报价")})}:void 0;return(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)(eM.Modal,{getContainer:m.portal||void 0,open:!!d.failure,title:g("Booking could not be submitted","预订提交失败"),centered:!0,closable:!1,maskClosable:!1,keyboard:!1,destroyOnClose:!0,footer:(0,eB.jsx)(eKQ,{busy:d.resettingFailure,onClick:()=>{d.confirmFailure()},children:g("Confirm","确认")}),children:[(0,eB.jsx)("p",{role:"alert",style:{whiteSpace:"pre-wrap"},children:null==(l=d.failure)?void 0:l.message}),d.resetError&&(0,eB.jsx)(eZf,{tone:"error",children:d.resetError})]}),(0,eB.jsx)(e2v,{runtime:i}),a&&!a.extraSession&&(0,eB.jsx)(eQO,{plan:a.plan,title:eKT(a.plan.productDetail.title||a.plan.productDetail.name,r),summary:a.partyDraft&&(0,eB.jsx)(eZY,{detail:a.plan.productDetail,configuration:a.configuration,locale:b,catalogStartingAmount:a.partyDraft.catalogStartingAmount,catalogPriceQualifier:a.partyDraft.catalogPriceQualifier,formatAmount:i.amount}),configuration:a.configuration,configurationFooter:_,onConfigurationChange:e=>n(t=>t&&{...t,configuration:e}),skuOptions:{config:{overSold:a.overSold}},requiredOptionValidation:a.requiredOptionValidation,locale:b,busy:o||s.busy||d.submitting,onCancel:()=>n(void 0),onConfigurationConfirm:async(e,t)=>!!t.isCurrent()&&(a.partyDraft&&(c({...a.partyDraft,configuration:e}),f("time"),i.notifyPartyProductConfirmed(),y("#party-time")),t.isCurrent()&&n(void 0),!0)},a.plan.openId),(0,eB.jsx)(eM.Modal,{getContainer:m.portal||void 0,open:!!u,title:g("Choose the configured item to change","选择需要调整的商品项"),footer:null,onCancel:()=>p(void 0),destroyOnClose:!0,children:(0,eB.jsxs)("div",{className:"venue-booking-legacy-controls",children:[(null==x?void 0:x.kind)==="error"&&(0,eB.jsx)(e2Z,{feedback:x,text:g}),null==u?void 0:u.map(e=>{var t;return(0,eB.jsxs)("div",{className:"venue-booking-sales__line-picker",children:[(0,eB.jsxs)("span",{children:[eKT(e.product_title,r)||String(e.product_id)," ",(null==(t=e.product_sku)?void 0:t.name)||""]}),(0,eB.jsx)(eM.InputNumber,{min:0,precision:0,value:Number(e.num),disabled:v,onChange:t=>{null!=t&&h(async()=>{let l=await s.setLineQuantity(eJF(e),Number(t));p(void 0),await i.showExtraPreparation(l)})}})]},eJF(e))})]})})]})}function e24(e){let{runtime:t,preview:l,showFilters:i}=e,{mode:a,text:n,disabled:r,main:o,mainPoolEmpty:s}=t;return s&&(!t.mainCatalog.menuListIds.length||l.catalogueReady||"unavailable"===l.status&&!l.searchRange)?(0,eB.jsx)(eZf,{children:"party"===a?n("No Party packages are available.","暂无可选 Party 商品。"):n("No tickets are available.","暂无可选门票。")}):l.catalogueReady?(0,eB.jsx)(e23,{runtime:t,showFilters:i}):l.awaitingSelection?(0,eB.jsx)(eZf,{children:n("Choose a date to see available products.","请选择日期,再查看可用商品。")}):"error"!==l.status&&"unavailable"!==l.status?(0,eB.jsx)("div",{className:`venue-booking-catalog venue-booking-catalog--${a}`,role:"status","aria-busy":"true","aria-label":"party"===a?n("Loading Party packages","正在加载 Party 商品"):n("Loading tickets","正在加载门票"),children:(0,eB.jsx)(e2X,{})}):(0,eB.jsxs)(eZf,{tone:"error"===l.status?"error":void 0,children:["error"===l.status?n("Available dates could not be checked. Please retry.","可订日期查询失败,请重试。"):l.searchRange?n("No available date in the next month. You can browse other dates.","未来一个月内暂无可订日期,可手动查看其他日期。"):n("No available date in this view. Choose another date or week.","当前日期范围内暂无可订日期,请选择其他日期或翻周查看。"),"error"===l.status&&(0,eB.jsx)("button",{type:"button",className:"button secondary",disabled:r,onClick:o.retry,children:n("Retry","重试")})]})}function e23(e){var t,l,i;let{runtime:a,showFilters:n=!0,formatAmount:r=a.amount}=e,{mode:o,locale:s,context:d,variant:c,scopeKey:u,date:p,main:m,props:g,productQuantities:h,disabled:v,text:f,partyMain:y,composer:b,run:x,openProduct:k}=a,_=(0,eN.useMemo)(()=>{let e,t;return e=new Map,t=0,l=>{let i=eKT(l,s);if("u"<typeof DOMParser||!/[<&\r\0]/.test(i))return eKI(i,s);let a=e.get(i);if(void 0!==a)return a;let n=eKI(i,s),r=i.length+n.length;if(r>256e3)return n;for(;e.size>=64||t+r>256e3;){let l=e.keys().next().value;t-=l.length+e.get(l).length,e.delete(l)}return e.set(i,n),t+=r,n}},[u,s]),w=e2K(m.products,a.sales.bookingTicket,null==(i=a.engine)||null==(l=i.appHelper)||null==(t=l.utils)?void 0:t.promotionEvaluator,s),S=(0,eN.useMemo)(()=>{var e;return e={mode:o,locale:s,quantityByProductId:h,formatAmount:r,preparingProductId:a.preparingProductId,availability:m.availability,catalogLoading:m.loading,catalogError:m.error,productLoadChannel:a.sales.productLoadChannel},t=>(0,eB.jsx)(e2T,{...t,...e},t.product.id)},[o,s,h,r,a.preparingProductId,m.availability,m.loading,m.error,a.sales.productLoadChannel]),j=(0,eN.useMemo)(()=>{var e;return n?e2j:{...e2j,skuListConfig:{...e2j.skuListConfig,listConfig:{...null==(e=e2j.skuListConfig)?void 0:e.listConfig,showTab:!1}}}},[n]);return(0,eB.jsx)(eBn,{context:d,mode:"retail",variant:c,businessCode:g.businessCode,className:`venue-booking-catalog venue-booking-catalog--${o}`,renderProductCard:S,catalog:{scopeKey:`${u}:${p}:main`,products:w,loading:m.loading,error:m.error,onRetry:m.retry,keepContentWhileLoading:!0,loadingContent:(0,eB.jsx)(e2X,{}),loadingLabel:(0,eB.jsx)("span",{className:"sr-only",children:f(m.products.length?"Updating availability…":"Loading available products…",m.products.length?"正在重新校验可用性…":"正在加载可预订商品…")})},quantityByProductId:h,isActive:g.isActive,productDisplayConfig:j,productListPreferences:e2N,productListPreferencesOverride:!0,categoryNavigation:n?"top":"tabbar",defaultCategorySelection:"all",allCategoryLabel:f("All","全部"),showSettings:!1,productCardVersion:"v2",productSelectionTrigger:"click",hideSingleCategoryNavigation:!0,onSelectProduct:e=>x(()=>k(e)),getProductPresentation:e=>{let t=m.availability[String(e.id)],l=(null==t?void 0:t.available)||(null==t?void 0:t.requiresConfiguration),i=eQV(e),a="party"===o&&Number((null==b?void 0:b.detail.id)??(null==y?void 0:y.line.product_id))===Number(e.id);return{disabled:v||m.loading||!!m.error||!l,description:_(e.description),businessInfo:"party"===o&&i.partySize||i.durationMinutes?(0,eB.jsxs)("div",{className:"party-meta venue-booking-sales__facts",children:["party"===o&&i.partySize&&(0,eB.jsxs)("span",{children:[(0,eB.jsx)(eZu,{size:15,"aria-hidden":"true"}),i.partySize," ",f("guests included","位参加者")]}),i.durationMinutes&&(0,eB.jsxs)("span",{children:[(0,eB.jsx)(e0$,{size:15,"aria-hidden":"true"}),i.durationMinutes," ",f("minutes","分钟")]})]}):void 0,actionLabel:a?f("Edit package","编辑套餐"):void 0,selected:a}}})}function e28(e){var t,l,i,a;let{runtime:n}=e,{context:r,variant:o,scopeKey:s,extrasCatalog:d,extras:c,props:u,disabled:p,run:m,showExtraPreparation:g}=n,h=e2K(d.products,n.sales.bookingTicket,null==(i=n.engine)||null==(l=i.appHelper)||null==(t=l.utils)?void 0:t.promotionEvaluator,n.locale),v=(0,nB.usePisellConfig)(),f=null==(a=n.order)?void 0:a.currency_symbol,y=(0,eN.useMemo)(()=>"string"==typeof f&&f.trim()?{...v,symbol:f}:v,[v,f]);return(0,eB.jsxs)(nB.PisellContext.Provider,{value:y,children:[(0,eB.jsx)("span",{className:"sr-only",role:"status","aria-live":"polite",children:n.extraQuantity.pending?n.text("Updating extras…","正在更新附加商品…"):""}),c.invalidItems.map(e=>(0,eB.jsx)(eZf,{tone:"warning",children:e.message},e.lineUid||e.code)),(0,eB.jsx)(eBn,{context:r,mode:"retail",variant:o,businessCode:u.businessCode,className:"venue-booking-catalog venue-booking-catalog--extras",productDisplayConfig:e2C,productListPreferences:e2M,productListPreferencesOverride:!0,catalog:{scopeKey:`${s}:extras`,products:h,loading:d.loading,error:d.error,onRetry:d.retry,keepContentWhileLoading:!0,loadingContent:(0,eB.jsx)(e2X,{extras:!0}),loadingLabel:(0,eB.jsx)("span",{className:"sr-only",children:n.text(d.products.length?"Updating extra prices…":"Loading extras…",d.products.length?"正在更新附加商品价格…":"正在加载附加商品…")})},quantityByProductId:{...c.quantityByProductId,...n.extraQuantity.quantities},showSettings:!1,categoryNavigation:"top",defaultCategorySelection:"all",allCategoryLabel:n.text("All","全部"),productCardVersion:"v2",productSelectionTrigger:"click",isActive:u.isActive,getProductPresentation:e=>{let t=RL(e),l=!eJy(e)||(t?n.extraQuantityDisabled:p);if(n.pendingExtraProductId===String(e.id))return{disabled:l,renderAction:()=>(0,eB.jsx)("span",{className:"venue-extra-action-pending",role:"status","aria-label":n.text("Updating item","正在更新商品"),children:(0,eB.jsx)(eM.Spin,{size:"small"})})};let i=B3(e)?n.text("Choose options","选择选项"):"phone"===o||t?void 0:n.text("Options","选规格");return i?{disabled:l,renderAction:e=>{let{quantity:t,disabled:l,onSelect:a}=e;return(0,eB.jsx)(RR,{label:i,quantity:t,disabled:l,onSelect:a})}}:{disabled:l}},onSelectProduct:e=>m(async()=>g(await c.prepare(e)),e.id),onQuantityChange:(e,t,l)=>{RL(e)&&!B3(e)?n.extraQuantity.changeQuantity(e,t,l.previousQuantity):m(async()=>g(await c.setProductQuantity(e,t)),e.id)}})]})}function e26(e,t,l){return function(e){let{line:t,quantity:l,formatAmount:i}=e,a=function(e,t){let l=e2$(t),i=e2$(e.selling_price);if(!l||!l.gt(0)||!i)return;let a=e2$(e.original_price),n=lO.clone({precision:Math.max(20,i.precision()+l.precision(),((null==a?void 0:a.precision())||0)+l.precision())}),r=new n(i).mul(l),o=a&&new n(a).mul(l);return{total:r.toString(),...(null==o?void 0:o.gt(0))&&o.gt(r)?{originalTotal:o.toString()}:{}}}(t,l);if(a)return(0,eB.jsxs)("span",{className:"venue-order-line-price",children:[void 0!==a.originalTotal&&(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("del",{className:"venue-order-line-price-original",children:i(a.originalTotal)})," "]}),(0,eB.jsx)("span",{className:"venue-order-line-price-current",children:i(a.total)})]})}({line:t,quantity:l,formatAmount:e.amount})}function e25(e){let{text:t}=e;return(0,eB.jsx)("h3",{className:"venue-cart-addons-title",children:t("Addons","附加商品")})}function e27(e){let{date:t,locale:l}=e;return l.startsWith("zh")?(0,eB.jsxs)("time",{dateTime:t,children:[eQM(t,l,{year:"numeric",month:"long",day:"numeric"})," ",(0,eB.jsx)("span",{className:"venue-review-weekday",children:eQM(t,l,{weekday:"short"})})]}):(0,eB.jsx)("time",{dateTime:t,children:eQM(t,l)})}function e29(e){var t,l,i,a;let{runtime:n,onlyExtras:r=!1,includeExtras:o=!0,includeGifts:s=!0,onEditExtras:d,review:c=!1,renderBookingDetails:u}=e,{bindings:p,extras:m,hasBookings:g,mode:h,text:v,locale:f,disabled:y,composer:b,orderPanel:x,editLine:k,removeLines:_,run:w}=n,[S,j]=(0,eN.useState)(),N=(i=p.bindings,a=n.holderState,e0J(i,e=>{var t,l;let i=e0Z(e.line,e.booking);if(null===i)return null;let n=a.displayLines.find(t=>t.uid===e.productLineUid);if(!n||n.config.enabled&&(n.missing||n.ids.length<e.quantity))return null;let r=e.line;return JSON.stringify([i,n.config.enabled,n.config.required,String(n.config.formId??""),n.ids.map(String),r.original_price,r.selling_price,r.discount_list,r.note,r.remark,null==(t=r.metadata)?void 0:t._promotion,null==(l=r.metadata)?void 0:l.manual_discount])})),C=(0,eN.useMemo)(()=>new Map(n.extrasCatalog.products.map(e=>[Number(e.id),e])),[n.extrasCatalog.products]),M=e=>B3(eJS(C.get(Number(e.product_id)),e.product_variant_id,e)),T=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:B3,a=new Set,n=new Set;return e.forEach(e=>{let t=e2A(e);t&&a.has(t)&&n.add(t),t&&a.add(t)}),e0J(e,e=>i(e)||Uy(e,l).length?null:function(e,t,l){var i,a,n;let r=e2A(e),o=e.metadata||{},s=o.venue_booking_role,d=Number(e.num),c=e2D(e.original_price),u=e2D(e.selling_price);if(!r||l.has(r)||!e2P(e.product_id)||!e2P(o.venue_booking_scope_key)||!["tickets_extra","party_extra"].includes(s)||"party_extra"===s&&!e2P(o.venue_booking_parent_uid)||!Number.isSafeInteger(d)||d<=0||!c||!u||(null==(i=e._extend)?void 0:i.independentLine)===!0||(null==(n=o.origin)||null==(a=n._extend)?void 0:a.independentLine)===!0||null!=e.discount_list&&!Array.isArray(e.discount_list))return null;let p=(e.discount_list||[]).map(e=>(function(e,t){var l,i,a;if(!e||"object"!=typeof e||Array.isArray(e))return null;let n=String(e.type??e.tag??""),r="product_discount_card"===n?"discount_card":n,o=e2P((null==(l=e.discount)?void 0:l.resource_id)??e.resource_id),s=e2P((null==(i=e.discount)?void 0:i.strategy_id)??e.strategy_id??(null==(a=e.metadata)?void 0:a.strategyId))??("promotion"===r?e2P(null==t?void 0:t.strategyId):void 0);return r&&("discount_card"!==r||o)&&(o||s)?{...e2L(e,e2E),type:r,resource:o,strategy:s,discount:e2L(e.discount,e2O),metadata:e2L(e.metadata,e2z)}:null})(e,o._promotion));if(p.some(e=>null===e))return null;let m=function(e,t){let l=[];for(let i of t){let t=null==i?void 0:i.note_relations;if(!Array.isArray(t))return null;let a=t.filter(t=>(null==t?void 0:t.target_type)==="order_detail"&&String(t.target_uuid)===e);if(a.length){if(!i.note_type||!i.content||a.some(e=>"about"!==e.relation_type&&"related_to"!==e.relation_type))return null;l.push({note_type:i.note_type,content:i.content,importance:i.importance})}}return l.sort((e,t)=>JSON.stringify(e2I(e)).localeCompare(JSON.stringify(e2I(t))))}(r,t);return null===m?null:JSON.stringify(e2I({product:String(e.product_id),variant:String(e.product_variant_id??0),sku:{...e.product_sku,option:exP(e)},bundle:e.product_bundle||[],role:s,scope:o.venue_booking_scope_key,parent:o.venue_booking_parent_uid,original:c.toString(),selling:u.toString(),discounts:p,note:e.note,remark:e.remark,notes:m,inlineNotes:e.notes,salesNotes:e.sales_notes,allergy:e.allergy,allergies:e.allergies,metadataNotes:o.notes,metadataAllergy:o.allergy,metadataAllergies:o.allergies,promotion:o._promotion,promotionTags:o._promotionTags??e._promotionTags,gift:o._giftInfo??e._giftInfo,giftData:e.giftData,manualDiscount:o.manual_discount,isManualDiscount:o.is_manual_discount,priceOverride:o.price_override,sourcePrice:o.source_product_price,mainOriginal:o.main_product_original_price,mainSelling:o.main_product_selling_price}))}(e,t,n)).map(e=>{let t=e2R(e.members,"original_price");return{...e,quantity:e.members.reduce((e,t)=>e+(Number.isFinite(Number(t.num))?Number(t.num):0),0),price:{selling_price:e2R(e.members,"selling_price")??"",...void 0===t?{}:{original_price:t}}}})}(m.rows,null==(t=n.order)?void 0:t.notes,null==(l=n.order)?void 0:l.holder_relations,M),I=e=>e.length>0&&(0,eB.jsx)("ul",{className:"venue-order-bundle","aria-label":v("Included items","套餐内含商品"),children:e.map(e=>(0,eB.jsxs)("li",{children:[(0,eB.jsx)("span",{children:e.name||v("Included item","套餐子商品")}),(0,eB.jsxs)("span",{children:["\xd7 ",e.quantity]})]},e.key))}),P=(e,t)=>{"remove"===t?_(e.map(e=>e.productLineUid)):e.length>1?x.closeThen(()=>j({uids:e.map(e=>e.productLineUid)})):x.closeThen(()=>{k(e[0].productLineUid)})};return(0,eB.jsxs)(eB.Fragment,{children:[!r&&!g&&(0,eB.jsxs)("div",{className:"catalog-empty",children:[(0,eB.jsx)(eKq,{size:36,"aria-hidden":"true"}),(0,eB.jsx)("p",{children:v("tickets"===h?"Pick a ticket to start your family’s adventure.":"Choose a Party to begin.","tickets"===h?"选择门票,开启全家的欢乐时光。":"选择商品开始预订 Party。")})]}),(0,eB.jsxs)("div",{className:"selected-order-list",children:[!r&&N.map(e=>{var t,l,i;let a=e.members[0],r=e.members.reduce((e,t)=>e+t.quantity,0),o=eKT(a.line.product_title,f)||String(a.line.product_id),s=(a.booking.resources||[]).map(e=>{var t;return eKT((null==(t=e.metadata)?void 0:t.resource_name)||e.title||e.name||e.resource_name,f)}).filter(Boolean).join(" \xb7 "),d=null==(t=n.holderState.displayLines.find(e=>e.uid===a.productLineUid))?void 0:t.cacheItem,p=n.main.products.find(e=>String(e.id)===String(a.line.product_id)),m=e0X(a.line,r,f,p,d),g=!!(null==(l=a.line.product_bundle)?void 0:l.length)||1===Number((null==p?void 0:p.is_bundle)??(null==d?void 0:d.is_bundle)),x=[a.line.product_cover,null==d?void 0:d.cover,null==d||null==(i=d._extend)?void 0:i.product_cover,null==p?void 0:p.cover].map(e=>eKT(e,f)).find(Boolean),k=I(m);return(0,eB.jsxs)(e0V,{title:o,amount:e26(n,a.line,r),image:c&&x||void 0,details:(0,eB.jsxs)("div",{className:c?"booking-item-metadata":void 0,children:[c?(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)("div",{children:[(0,eB.jsx)(eQv,{size:16,"aria-hidden":"true"}),(0,eB.jsx)(e27,{date:a.date,locale:f})]}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)(e0$,{size:16,"aria-hidden":"true"}),a.booking.start_time,"–",a.booking.end_time]})]}):(0,eB.jsxs)("div",{children:[a.date," \xb7 ",a.booking.start_time,"–",a.booking.end_time]}),s&&(0,eB.jsx)("div",{children:s}),!g&&(0,eB.jsx)("div",{children:"tickets"===h?`${r} ${v(1===r?"ticket":"tickets","张票")}`:`\xd7 ${r}`}),!c&&(0,eB.jsx)(e2W,{context:n.context,locale:f,lines:n.holderState.displayLines.filter(t=>e.members.some(e=>e.productLineUid===t.uid))})]}),action:{label:`${v("Edit","修改")} ${o}`,disabled:y||!!b,onClick:()=>P(e.members,"edit")},removeAction:{label:`${v("Remove","移除")} ${o}`,disabled:y,onClick:()=>P(e.members,"remove")},children:[(0,eB.jsx)(e2G,{products:e.members.map(e=>e.line),locale:f}),u?(0,eB.jsxs)(eB.Fragment,{children:[k,e.members.map((t,l)=>(0,eB.jsx)(eC().Fragment,{children:u(t.productLineUid,e.members.slice(0,l).reduce((e,t)=>e+t.quantity,0))},t.productLineUid))]}):k]},e.key)}),"tickets"===h&&!c&&o&&T.length>0&&(0,eB.jsx)(e25,{text:v}),o&&T.map(e=>{var t,l,i,a,r;let o=e.members[0],s=eKT(o.product_title,f)||String(o.product_id),c=o._origin??(null==(a=n.order)||null==(i=a._extend)||null==(l=i.productsByUid)||null==(t=l[eJF(o)])?void 0:t.origin),u=e0X(o,e.quantity,f,C.get(Number(o.product_id)),c),p=Uy(o,null==(r=n.order)?void 0:r.holder_relations).filter(e=>"form"===e.holder_type),g=M(o)||p.length>0;return(0,eB.jsxs)(e0V,{layout:"row",title:s,amount:e26(n,e.price,1),details:(0,eB.jsxs)(eB.Fragment,{children:["\xd7 ",e.quantity,p.length>0&&(0,eB.jsxs)("div",{children:[v("Holder: ","Holder:"),p.map(e=>{var t;return(null==(t=e.metadata)?void 0:t.name)||e.holder_id}).join(", ")]})]}),action:d?{label:`${v("Edit extra","编辑附加商品")} ${s}`,disabled:y||!!b,onClick:()=>x.closeThen(()=>{g&&1===e.members.length?w(async()=>{await n.showExtraPreparation(await m.prepareEdit(eJF(o)))}):d()})}:void 0,removeAction:{label:`${v("Remove extra","移除附加商品")} ${s}`,disabled:y,onClick:()=>{w(async()=>m.removeLines(e.members.map(eJF)),o.product_id??void 0)}},children:[(0,eB.jsx)(e2G,{products:e.members,locale:f}),I(u)]},e.key)}),s&&p.gifts.map(e=>(0,eB.jsx)(e0V,{layout:"row",title:eKT(e.product_title,f)||String(e.product_id),details:(0,eB.jsxs)(eB.Fragment,{children:[v("Promotion gift","优惠赠品")," \xd7 ",e.num]}),children:(0,eB.jsx)(e2G,{products:[e],locale:f})},eJF(e)))]}),(0,eB.jsx)(eM.Modal,{getContainer:n.bookingUI.portal||void 0,open:!!S,footer:null,title:v("Choose the booking to change","选择需要调整的预订"),onCancel:()=>j(void 0),destroyOnClose:!0,children:(0,eB.jsx)("div",{className:"venue-booking-group-actions",children:p.bindings.filter(e=>null==S?void 0:S.uids.includes(e.productLineUid)).map((e,t)=>(0,eB.jsxs)(eKQ,{secondary:!0,disabled:y||!!b,onClick:()=>{j(void 0),k(e.productLineUid)},children:[v("Booking","预订")," ",t+1," \xb7 ",e.quantity," ",v("ticket(s)","张票")]},e.productLineUid))})})]})}function e1e(e){let{runtime:t,includeTotal:l=!0,includeDueNow:i=!0,splitPartySubtotal:a=!1}=e,{hasBookings:n,mode:r,text:o,amount:s,amountDue:d,summary:c,order:u,hasDeposit:p,depositAmount:m}=t,g=a&&"party"===r&&n?function(e){var t,l;let{bindings:i,scopeKey:a,summary:n}=e;if(i.issues.length||1!==i.bindings.length)return null;let r=i.bindings[0].line,o=eJF(r);if(!o||(null==(t=r.metadata)?void 0:t.venue_booking_role)!=="party_main"||r.metadata.venue_booking_scope_key!==a)return null;let s=new Set([o]),d=e=>{if("string"!=typeof e&&"number"!=typeof e||""===String(e).trim())return null;try{let t=new lO(e);return t.isFinite()&&!t.isNegative()?t:null}catch{return null}},c=e=>{let t=d(e.selling_price),l=Number(e.num);return t&&Number.isSafeInteger(l)&&l>0?t.mul(l):null},u=c(r),p=d(null==n?void 0:n.product_expect_amount);if(!u||!p)return null;let m=new lO(0);for(let e of i.extras){let t=eJF(e);if(!t||s.has(t)||(null==(l=e.metadata)?void 0:l.venue_booking_role)!=="party_extra"||e.metadata.venue_booking_scope_key!==a||String(e.metadata.venue_booking_parent_uid||"")!==o)return null;let i=c(e);if(!i)return null;s.add(t),m=m.plus(i)}let g=u.toDecimalPlaces(2,lO.ROUND_HALF_UP),h=m.toDecimalPlaces(2,lO.ROUND_HALF_UP);return u.plus(m).toDecimalPlaces(2,lO.ROUND_HALF_UP).eq(p)&&g.plus(h).eq(p)?{main:g.toFixed(2),extras:h.toFixed(2)}:null}(t):null,h=g?[{id:"party-subtotal",label:o("Party subtotal","Party 商品小计"),amount:s(g.main)},{id:"extras-subtotal",label:o("Extras","附加商品"),amount:s(g.extras)}]:[{id:"subtotal",label:o("Subtotal","商品小计"),amount:s(n?null==c?void 0:c.product_expect_amount:0)}],v=Number(null==c?void 0:c.discount_amount);if(n&&Number.isFinite(v)&&0!==v&&h.push({id:"discount",label:o("Discount","优惠"),amount:s(new lO(c.discount_amount).abs().negated().toString()),tone:"discount"}),Number(null==c?void 0:c.surcharge_fee)>0&&h.push({id:"surcharge",label:o("Surcharge","附加费"),amount:s(null==c?void 0:c.surcharge_fee)}),Number(null==c?void 0:c.tax_fee)>0){var f,y;let e=c.tax_title||(null==u?void 0:u.tax_title)||o("Tax","税费"),t=(f=null==u?void 0:u.products,y=c.is_price_include_tax??c.isPriceIncludeTax??(null==u?void 0:u.is_price_include_tax),!!(null==f?void 0:f.length)&&(null==y||1===Number(y))&&f.every(e=>{let t=e.is_price_include_tax??y;return 1===Number(t)&&(e.product_bundle??[]).every(e=>1===Number(e.is_price_include_tax??t))}));h.push({id:"tax",label:t?o(`${e} (Included)`,`${e}(已含税)`):e,amount:s(c.tax_fee)})}return l&&h.push({id:"total",label:o("Total","合计"),amount:s(n?null==c?void 0:c.expect_amount:0),tone:"total"}),n&&p&&h.push({id:"deposit",label:o("Deposit","定金"),amount:s(m)}),i&&n&&h.push({id:"due-now",label:o("Due now","本次待付"),amount:s(d)}),(0,eB.jsx)(e0Y,{rows:h})}function e1t(e){let{runtime:t}=e,{step:l,ready:i,session:a,showOffers:n,setShowOffers:r,hasBookings:o,text:s,disabled:d,orderPanel:c}=t,u=i&&!a.error&&("select"===l||o&&("extras"===l||"review"===l)),p=n&&u;return(0,eB.jsx)(e2b,{status:s("Offers and discount cards","优惠与折扣卡"),hidden:!u,open:p,disabled:d,presentation:"floating",onOpenChange:e=>{e?c.closeThen(()=>r(!0)):r(!1)},children:(0,eB.jsx)("fieldset",{disabled:d,"aria-disabled":d,className:`venue-booking-legacy-controls venue-booking-sales__offers ${d?"venue-booking-sales__offers--disabled":""}`,children:(0,eB.jsx)(e2Y,{runtime:t,visible:p})})})}function e1l(e){let{runtime:t,onBack:l,disabled:i=!1}=e,[a,n]=(0,eN.useState)(!1),[r,o]=(0,eN.useState)(!1),s=(0,eN.useRef)(!1),d=(0,eN.useRef)(!0);(0,eN.useEffect)(()=>(d.current=!0,()=>{d.current=!1}),[]);let c=!!l;(0,eN.useEffect)(()=>{c&&n(!1)},[c]);let u=(0,eN.useRef)(t);u.current=t;let p=async()=>{if(s.current||t.disabled||i)return;let e=t.session.sessionId;s.current=!0,o(!0);try{var l,a,r;if(t.isKiosk)return void await t.kioskLifecycle.finish({navigateHome:!0});if(await t.sales.clearCartAndReset(),t.session.discard(),!d.current||!t.alive.current||u.current.session.sessionId!==e)return;let i=null==(r=t.engine)||null==(a=r.appHelper)||null==(l=a.utils)?void 0:l.history;"function"==typeof(null==i?void 0:i.replace)?i.replace("/"):window.location.replace(window.location.origin)}catch(l){d.current&&t.alive.current&&u.current.session.sessionId===e&&t.setError(l instanceof Error?l.message:String(l))}finally{s.current=!1,d.current&&t.alive.current&&(o(!1),n(!1))}},m=c?t.text("Previous step","上一步"):t.text("Close booking","关闭预订");return(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("button",{type:"button",className:"venue-booking-exit icon-button","aria-label":m,title:m,disabled:i||t.disabled||r,onClick:()=>{l?l():n(!0)},children:c?(0,eB.jsx)(eKW,{size:22,"aria-hidden":"true"}):(0,eB.jsx)(eQa,{size:22,"aria-hidden":"true"})}),a&&!c&&(0,eB.jsx)(eQu,{title:t.text("Leave this booking?","退出本次预订?"),closeLabel:t.text("Close","关闭"),onClose:()=>n(!1),closeDisabled:r,closeOnBackdrop:!1,bodyClassName:"venue-booking-exit-body",footerClassName:"venue-booking-exit-actions",footer:(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("button",{type:"button",className:"button secondary",disabled:r,onClick:()=>n(!1),children:t.text("Keep booking","继续预订")}),(0,eB.jsx)("button",{type:"button",className:"button",disabled:i||r||t.disabled,onClick:()=>{p()},children:t.text("Leave booking","退出预订")})]}),children:(0,eB.jsx)("p",{children:t.text("Your selections will be cleared and you will return to the store home page.","当前选择将被清除,并返回商家首页。")})})]})}function e1i(e){var t,l;let i=e2U(e,"review"),a=eKB(),n=(0,eN.useRef)(null),r=(0,eN.useRef)(e);r.current=e;let o=(0,eN.useRef)(!0),s=(0,eN.useRef)(0),d={scopeKey:e.scopeKey,mode:e.mode,date:e.date,customerId:e.customerId,sessionId:e.session.sessionId,os:e.os,order:eKA(e.order)},c=(0,eN.useRef)(d);Object.keys(d).some(e=>d[e]!==c.current[e])&&(c.current=d);let u=c.current,p=(e,t)=>e.scopeKey===t.scopeKey&&e.mode===t.mode&&e.date===t.date&&e.sessionId===t.sessionId&&e.os===t.os&&e.order===t.order;(0,eN.useEffect)(()=>(o.current=!0,()=>{o.current=!1,s.current+=1}),[]);let m=[{id:"select",label:e.text("tickets"===e.mode?"Tickets":"Party","tickets"===e.mode?"门票":"派对")},...e.holderState.required||"holder"===e.step?[{id:"holder",label:e.text("Holder","持有人")}]:[],...e.hasExtras?[{id:"extras",label:e.text("Addons","附加商品")}]:[],{id:"review",label:e.text("Review","确认")}],g=Math.max(0,m.findIndex(t=>t.id===e.step)),h=null==(t=m[g-1])?void 0:t.id,v=async function(t){let l=arguments.length>1&&void 0!==arguments[1]&&arguments[1],d=r.current;if("extras"!==t||d.hasExtras||(t="review"),"review"===t&&d.hasExtras&&(d.extrasCatalog.loading||d.extrasCatalog.error)&&(t="extras"),!o.current||i.pending||u!==c.current||d.step!==e.step||d.isExtraQuantityPending())return;let h=m.findIndex(e=>e.id===t),v=h>=0&&h<g,f=++s.current,y=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],l=r.current;return o.current&&f===s.current&&(e?p(u,c.current):u===c.current)&&!1!==l.props.isActive&&l.step===d.step&&!l.disabled&&!l.isExtraQuantityPending()&&!l.composer&&!l.configurationModal&&("select"===t||v||l.hasBookings&&l.mainDateMatches&&(e?!l.mainPoolEmpty&&!l.main.error:!l.mainCatalogBlocked))};if(!y())return;if(!v&&("extras"===t||"review"===t)){if("holder"===d.step){var b;let e=await (null==(b=n.current)?void 0:b.validate());if(!y()||!e)return}let e=r.current;if(!eJK(e.context,e.scopeKey).complete){e.setError(e.text("Complete the required holder details first.","请先完成必填持票人资料。")),e.setStep("holder"),a('[data-booking-stage="holder"]');return}if("review"===t&&!e.checkExtraHolders())return}if(!y()||"holder"===t&&d.isKiosk&&(!await i.ensure()||!y(!0)))return;if("review"===t){if(!await i.ensure()||!y(!0))return;let e=r.current;if(!eJK(e.context,e.scopeKey).complete){e.setStep("holder"),a('[data-booking-stage="holder"]');return}}let x=r.current;"select"===t&&l&&x.setExpandedSection("product"),x.setError(void 0),x.setStep(t),x.orderPanel.close(),a(`[data-booking-stage="${t}"]`)},f=()=>{!h||e.disabled||i.pending||v(h)},y="review"===e.step||e.isKiosk&&"holder"===e.step;(0,eN.useEffect)(()=>{if(!y||!e.ready||i.ready)return;let t=!0,l=e.step;return i.ensure().then(e=>{let i=r.current;!e&&t&&o.current&&i.step===l&&p(u,c.current)&&i.setStep(h||"select")}),()=>{t=!1}},[y,e.step,e.ready,i.ready,i.ensure,u.scopeKey,u.mode,u.date,u.sessionId,u.os,u.order,h]);let b="select"===e.step?e.nextAfterSelect:"holder"===e.step?e.nextAfterHolder:"review",x="review"===e.step?e.text("Confirm & pay","确认并支付"):"holder"===b?e.text("Next: Holder","下一步:持有人"):"extras"===b?e.text("Next: add extras","下一步:附加商品"):"extras"!==e.step||e.extras.rows.some(e=>Number(e.num)>0)?e.text("Next: review & pay","下一步:确认订单"):eQA(e.locale,"skipExtras"),k={label:(0,eB.jsxs)(eB.Fragment,{children:[x," ",(0,eB.jsx)(e0D,{size:20,"aria-hidden":"true"})]}),compactLabel:x,disabled:e.disabled||!!e.depositHydration.error||i.pending||"review"===e.step&&!i.ready||!e.hasBookings||!e.mainDateMatches||e.mainCatalogBlocked||!!e.composer||!!e.configurationModal||("extras"===e.step||"review"===e.step)&&e.hasExtras&&(e.extrasCatalog.loading||!!e.extrasCatalog.error),busy:i.pending||e.depositHydration.pending||e.checkout.submitting||e.busy&&!e.pendingExtraProductId||e.holderBusy,onClick:async()=>{if(!(e.disabled||e.depositHydration.error||i.pending||e.isExtraQuantityPending()))if("review"===e.step){if(!await i.ensure())return;await e.checkout.checkout()&&!e.isKiosk&&e.setHandoff(!0)}else"select"===e.step?await v(eJK(e.context,e.scopeKey).required?"holder":e.nextAfterHolder):"holder"===e.step?await v(e.nextAfterHolder):await v("review")}},_={context:e.context,scopeKey:e.scopeKey,locale:e.locale,catalogProducts:e.main.products,isActive:e.props.isActive,disabled:e.externalHolderDisabled,onMutation:e.refresh,onStateChange:t=>e.setHolderBusy(t.pending),onRemoveTicket:"tickets"===e.mode?e.removeTicket:void 0},w=(0,eB.jsxs)("div",{className:"venue-booking-navigation",children:[(0,eB.jsx)(e1l,{runtime:e,onBack:h?f:void 0,disabled:i.pending}),(0,eB.jsx)(eQp,{current:g,label:e.text("Booking steps","预订步骤"),currentLabel:e.text("Current step","当前步骤"),steps:m.map(t=>({...t,status:("select"===t.id||e.hasBookings&&e.mainDateMatches&&!e.mainCatalogBlocked&&("holder"===t.id||e.holderState.complete))&&!e.disabled&&!i.pending?"available":"locked",onClick:()=>{v(t.id)}}))})]}),S=function(t){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(0,eB.jsx)(e2g,{context:e.context,scopeKey:e.scopeKey,mode:e.mode,locale:e.locale,inline:!0,productLineUid:t,ordinalOffset:l,onRemoveTicket:"tickets"===e.mode?e.removeTicket:void 0,disabled:e.disabled||!!e.composer||!!e.configurationModal,onEdit:()=>{v("holder")}})},j="tickets"===e.mode&&(0,eB.jsxs)("button",{type:"button",className:"add-session full",disabled:e.disabled||!!e.composer||!!e.configurationModal,onClick:()=>{v("select",!0)},children:[(0,eB.jsx)(e0O,{size:22,"aria-hidden":"true"}),e.text("Add more tickets","继续选购门票")]}),N=t=>(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)(e29,{runtime:e,review:!0,renderBookingDetails:t,onEditExtras:()=>{v("extras")}}),j,(0,eB.jsx)(e1e,{runtime:e,splitPartySubtotal:"party"===e.mode})]}),C=(0,eB.jsxs)(eB.Fragment,{children:["holder"===e.step&&(!e.isKiosk||i.ready)&&(0,eB.jsx)(e03,{ref:n,..._,afterAssignments:j}),"extras"===e.step&&(0,eB.jsx)(e28,{runtime:e}),y&&!i.ready&&(0,eB.jsx)("div",{className:"venue-booking-sales__loading",role:"status","aria-label":e.text("Loading checkout","正在加载确认页面"),children:(0,eB.jsx)(eM.Spin,{})}),"review"===e.step&&i.ready&&(0,eB.jsx)(e2p,{ref:e.confirmation,context:e.context,scopeKey:e.scopeKey,locale:e.locale,date:e.date,isActive:e.props.isActive,disabled:e.disabled,onMutation:e.refresh,onValidationBlocked:e.orderPanel.closeThen,includeHolderValidation:!1,orderReview:e.holderState.enabled&&!e.holderState.required?(0,eB.jsx)(e03,{ref:n,..._,renderContent:t=>{let{renderLine:l}=t;return N((t,i)=>e.holderState.lines.some(e=>e.uid===t)?l(t,i):S(t,i))}}):N("tickets"===e.mode||e.holderState.enabled?S:void 0),note:(0,eB.jsx)(e0L,{hideLabel:!0,maxLength:2e3,id:`${e.mode}-order-note`,label:e.text("Order note","订单留言"),value:String((null==(l=e.order)?void 0:l.note)||""),disabled:e.disabled,onChange:t=>{e.disabled||e.sales.setOrderNote(t)},placeholder:e.text("Anything else we should know?","还有什么需要告诉我们?")})})]});return{navigation:w,primaryAction:k,back:f,previous:h,holderRef:n,renderStage:C,goTo:v}}function e1a(e){let[t,l]=(0,eN.useState)(),i=(null==t?void 0:t.scopeKey)===e.scopeKey&&t.sessionId===e.session.sessionId&&t.date===e.date,a=function(e,t,l,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e;if(i&&e<a)return{status:"unavailable"};let n=i?[e]:Array.from(new Set(t)).filter(t=>t>=e&&t>=a).sort();for(let e of n){var r;let t=(null==(r=l[e])?void 0:r.status)||"loading";if("loading"===t||"error"===t)return{status:t};if("available"===t||"configuration"===t)return{status:t,date:e}}return{status:n.length?"unavailable":"loading"}}(e.date,e.dateSearchRange?eJk(e.dateSearchRange):e.visibleDates,e.dateStates,e.session.restored&&!e.dateSearchRange,e.today);(0,eN.useEffect)(()=>{!e.ready||e.disabled||e.dateConfirmed||i||e.hasBookings||e.composer||e.configurationModal||!e.canAutoSelectDate()||("available"===a.status||"configuration"===a.status)&&a.date&&(e.setDate(a.date),l({scopeKey:e.scopeKey,sessionId:e.session.sessionId,date:a.date}))},[e.ready,e.disabled,e.dateConfirmed,i,e.hasBookings,e.composer,e.configurationModal,e.scopeKey,e.session.sessionId,a.status,a.date,e.setDate,e.dateInteractionStarted]);let n=e.dateConfirmed||i;return{catalogueReady:n,status:a.status,searching:!n&&!!e.dateSearchRange&&"error"!==a.status&&"unavailable"!==a.status,searchRange:e.dateSearchRange,awaitingSelection:!n&&e.dateInteractionStarted&&("available"===a.status||"configuration"===a.status)}}let e1n={openCalendar:["Open calendar","打开日历"],closeCalendar:["Close calendar","关闭日历"],chooseVisitDate:["Choose your visit date","选择游玩日期"],chooseDate:["Choose a date","选择日期"],previousWeek:["Previous week","上一周"],nextWeek:["Next week","下一周"],backThisWeek:["This week","回到本周"],calendarToday:["Today","今天"],previousMonth:["Previous month","上个月"],nextMonth:["Next month","下个月"],calendarMonth:["Month","月份"],calendarYear:["Year","年份"],calendarThisMonth:["This month","回到本月"],calendarVenueTime:["Dates follow venue local time","日期按场馆当地时间"],dateNeedsReselect:["This date is no longer available. Please choose an available date.","此日期已不可预约,请重新选择可用日期。"],quickVisitDates:["Choose a day this week","快捷选择游玩日期"],calendarLoading:["Checking available dates…","正在查询可用日期…"],calendarLoadFailed:["Some dates could not be checked.","部分日期查询失败。"]},e1r=(e,t)=>{var l;return(null==(l=e1n[e])?void 0:l[+("zh"===t)])||e};function e1o(e){let{checkout:t,locale:l}=e;sZ(eq_,l),sZ(e0c,l);let i=t.kioskPaymentResult;if(!i)return null;let a=`${ez.getText("pisell2.big-sale.kiosk.back-home")} (${t.backHomeCountdown}s)`,n="payment"===i.kind&&!["success","deposit-paid"].includes(i.viewModel.status),r=[[...n?[{id:"continue-payment",buttonProps:{children:ez.getText("pisell2.venue-kiosk.checkout.continue-payment"),className:"primary-button",loading:t.submitting,disabled:t.resettingHome,onClick:()=>{t.checkout()}}}]:[],{id:"back-home",buttonProps:{children:n?ez.getText("pisell2.big-sale.kiosk.back-home"):a,className:n?void 0:"primary-button",loading:t.resettingHome,disabled:t.submitting,onClick:()=>{t.returnHome()}}}]];return(0,eB.jsxs)("section",{className:"venue-kiosk-result",children:[t.error&&(0,eB.jsx)(eZf,{tone:"error",children:t.error}),"payment"===i.kind?(0,eB.jsx)(WW,{...i.viewModel,presentation:"page",actionButtons:r,autoClose:!1,closable:!1,clickOutsideToClose:!1,footer:void 0}):(0,eB.jsxs)("div",{className:"venue-kiosk-result__submitted",children:[(0,eB.jsx)("h1",{children:ez.getText("pisell2.big-sale.kiosk.order-submitted")}),(0,eB.jsx)("p",{children:ez.getText("pisell2.big-sale.kiosk.order-submitted-description")}),(0,eB.jsx)("strong",{children:i.order.reference||`${ez.getText("pisell2.venue-kiosk.checkout.order-reference")} ${i.order.orderId}`}),i.order.paymentStatusLabel&&(0,eB.jsx)("p",{children:ez.getText(i.order.paymentStatusLabel)}),null!=i.order.amountDue&&i.order.amountDue>0&&(0,eB.jsxs)("p",{children:[ez.getText("pisell2.big-sale.kiosk.to-pay"),": ",i.order.amountDueText]}),(0,eB.jsxs)("div",{className:"venue-kiosk-result__actions",children:[(0,eB.jsx)(eKQ,{disabled:t.resettingHome||t.submitting,onClick:()=>{t.startNewOrder()},children:ez.getText("pisell2.big-sale.kiosk.start-next-order")}),(0,eB.jsx)(eKQ,{secondary:!0,disabled:t.resettingHome||t.submitting,onClick:()=>{t.returnHome()},children:a})]})]})]})}function e1s(e){var t;let l=e0P(e),i=e1a(l),a=e1i(l),n=e2J(l),r=eKB(),[o,s]=(0,eN.useState)(!1);(0,eN.useEffect)(()=>{if(!o)return;let e=window.setTimeout(()=>s(!1),1e3);return()=>window.clearTimeout(e)},[o]);let d=(0,eN.useRef)({scopeKey:e.scopeKey}),c=l.bindings.bindings.reduce((e,t)=>e+t.quantity,0),u=function(e,t){var l;let[i,a]=(0,eN.useState)({scope:t,indicators:null==e?void 0:e.map(e=>({status:e}))});if(i.scope!==t){let l=null==e?void 0:e.map(e=>({status:e}));return a({scope:t,indicators:l}),l}if(e&&(e.length!==(null==(l=i.indicators)?void 0:l.length)||e.some((e,t)=>{var l,a;return e!==(null==(a=i.indicators)||null==(l=a[t])?void 0:l.status)}))){let l=performance.now(),n=e.map((e,t)=>{var a;let n=null==(a=i.indicators)?void 0:a[t];return(null==n?void 0:n.status)===e?n:{status:e,from:null==n?void 0:n.status,changedAt:l}});return a({scope:t,indicators:n}),n}return i.indicators}([l.dateConfirmed?"complete":"available",i.catalogueReady?c>0?"complete":"available":"locked"],d.current),p="holder"===l.step?l.text("Who is joining the fun?","谁来一起玩?"):"extras"===l.step?l.text("Make your visit extra special","为游玩增添更多乐趣"):"review"===l.step?l.text("Review your booking","确认您的预订"):void 0,m=String(l.amount(l.hasBookings?l.hasDeposit?l.amountDue:null==(t=l.summary)?void 0:t.expect_amount:0)),g=async e=>{try{await l.changeDate(e)&&(s(!0),r("#ticket-products"))}catch(e){l.setError(e instanceof Error?e.message:String(e))}},h=!!l.session.error||!l.session.ready||l.session.pendingOrder;return l.isKiosk&&l.checkout.kioskPaymentResult?(0,eB.jsx)(e1o,{checkout:l.checkout,locale:l.locale}):(0,eB.jsxs)("div",{className:"venue-booking-sales venue-booking-sales--tickets",children:[(0,eB.jsx)(e20,{runtime:l,showHero:!h&&"select"===l.step}),h?(0,eB.jsx)(e22,{runtime:l}):(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)(eKV,{className:"ticket-catalog-layout",navigation:a.navigation,title:p,stage:l.step,summary:(0,eB.jsx)(eQm,{panel:l.orderPanel,title:l.text("Your order","您的订单"),closeLabel:l.text("Close order","关闭订单"),decoration:(0,eB.jsx)(eKh,{className:"order-mascot"}),body:(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)(e29,{runtime:l,onEditExtras:()=>{a.goTo("extras")}}),(0,eB.jsx)(e1e,{runtime:l,includeTotal:l.hasDeposit,includeDueNow:"review"===l.step&&!l.hasDeposit})]}),footer:(0,eB.jsxs)(eB.Fragment,{children:[n.summary,(0,eB.jsx)(eKU,{label:l.hasDeposit?l.text("Due now","本次待付"):l.text("Total","合计"),amount:m,total:!0}),(0,eB.jsx)(eKX,{action:a.primaryAction,className:"full"})]})}),footer:(0,eB.jsx)(eK2,{lang:l.locale,back:a.previous?{label:l.text("Previous step","上一步"),onClick:a.back}:void 0,summary:(0,eB.jsx)(eQg,{panel:l.orderPanel,title:l.text("Your order","您的订单"),label:l.hasDeposit?l.text("Deposit details","定金明细"):l.text("Details","明细"),total:m}),action:a.primaryAction,feedback:n.footer}),children:["select"===l.step&&(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("section",{id:"ticket-visit-date",className:"visit-date-panel","aria-label":l.text("Shared visit date","统一游玩日期"),tabIndex:-1,children:"date"!==l.expandedSection&&l.dateConfirmed?(0,eB.jsx)(eQe,{id:"ticket-date-summary",className:"visit-date-summary",number:1,stepStatus:null==u?void 0:u[0],title:l.text("Choose a date","选择日期"),open:!1,completing:o,locked:l.disabled,lang:l.locale,summary:(0,eB.jsx)("b",{children:eQM(l.date,l.locale)}),onToggle:()=>{l.disabled||(s(!1),l.setExpandedSection("date"),r("#ticket-visit-date"))},children:null}):(0,eB.jsx)(eQI,{value:l.date,onChange:e=>{g(e)},locale:l.locale,title:l.text("Choose a date","选择日期"),stepNumber:1,stepStatus:null==u?void 0:u[0],timeZone:l.bookingUI.timeZone,todayMarker:"device",minDate:l.today,dateStates:l.dateStates,loading:i.searching,onInteraction:l.onDateInteraction,onVisibleDatesChange:l.setVisibleDates,disabled:l.disabled,t:e=>e1r(e,l.locale)})}),(0,eB.jsx)(eQe,{id:"ticket-products",number:2,stepStatus:null==u?void 0:u[1],title:l.text("Choose tickets","选择门票"),open:"product"===l.expandedSection||!c||!!l.composer,lang:l.locale,locked:l.disabled||!i.catalogueReady,onToggle:()=>{!l.disabled&&i.catalogueReady&&l.setExpandedSection("product"===l.expandedSection&&c?"":"product")},summary:c?(0,eB.jsxs)("span",{children:[(0,eB.jsx)(eKq,{size:20,"aria-hidden":"true"})," ",c," ",l.text("tickets selected","张门票已选")]}):void 0,children:(0,eB.jsx)(e24,{runtime:l,preview:i})})]}),a.renderStage]}),l.composer&&(0,eB.jsx)(eZ2,{mode:"tickets",draft:l.composer,context:l.context,priceSource:l.mainQueries,operationLog:l.operationLog,scopeKey:l.scopeKey,date:l.date,customerId:l.customerId,locale:l.locale,formatAmount:l.amount,disabled:!l.ready||l.busy||l.extras.busy||l.holderBusy||l.checkout.submitting||!!l.checkout.failure||l.handoff,onBusyChange:l.setComposerBusy,skuOptions:{config:{overSold:l.composer.overSold}},requiredOptionValidation:l.composer.requiredOptionValidation,onDateChange:async e=>l.changeDate(e),onCancel:()=>l.setComposer(void 0),onCommitted:()=>{l.setRevision(e=>e+1),l.setExpandedSection("product"),l.setComposer(void 0)},renderDatePicker:e=>{let{date:t,disabled:i,onChange:a}=e;return(0,eB.jsx)(eQI,{value:t,onChange:a,locale:l.locale,title:l.text("Visit date","游玩日期"),timeZone:l.bookingUI.timeZone,todayMarker:"device",minDate:l.today,dateStates:l.dateStates,onVisibleDatesChange:l.setVisibleDates,disabled:i,t:e=>e1r(e,l.locale)})}},l.composer.key)]}),(0,eB.jsx)(e21,{runtime:l}),(0,eB.jsx)(e1t,{runtime:l})]})}let e1d=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M114.32,49.8A19.79,19.79,0,0,0,81.72,57L29.22,201.41A19.82,19.82,0,0,0,47.75,228a20,20,0,0,0,6.84-1.22L199,174.28a19.79,19.79,0,0,0,7.24-32.6ZM104.19,183.21l-31.4-31.4L82.94,123.9l49.16,49.16Zm-52.42,26.4Zm12-32.91L79.3,192.26l-24.45,8.89ZM157,164,92,99l10-27.58L184.57,154ZM128,40V16a12,12,0,0,1,24,0V40a12,12,0,0,1-24,0Zm116.48,83.51a12,12,0,0,1-17,17l-16-16a12,12,0,0,1,17-17Zm-.69-40.13-24,8a12,12,0,0,1-7.59-22.77l24-8a12,12,0,1,1,7.59,22.77ZM156.6,65.93C159.83,47.47,173.39,36,192,36c6.45,0,8.69-2.49,10-4.92a18,18,0,0,0,2-7.22V24a12,12,0,0,1,24,0c0,14.47-9.59,36-36,36-4.94,0-10.21,1.19-11.76,10.06A12,12,0,0,1,168.43,80a12.35,12.35,0,0,1-2.08-.18A12,12,0,0,1,156.6,65.93Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M58.89,154.89l42.22,42.22-50.63,18.4a7.79,7.79,0,0,1-10-10Zm138.82-4.72L105.83,58.29A7.79,7.79,0,0,0,93,61.14l-14.9,41,75.82,75.82,41-14.9A7.79,7.79,0,0,0,197.71,150.17Z",opacity:"0.2"}),eN.createElement("path",{d:"M111.49,52.63a15.8,15.8,0,0,0-26,5.77L33,202.78A15.83,15.83,0,0,0,47.76,224a16,16,0,0,0,5.46-1l144.37-52.5a15.8,15.8,0,0,0,5.78-26Zm-8.33,135.21-35-35,13.16-36.21,58.05,58.05Zm-55,20,14-38.41,24.45,24.45ZM156,168.64,87.36,100l13-35.87,91.43,91.43ZM160,72a37.8,37.8,0,0,1,3.84-15.58C169.14,45.83,179.14,40,192,40c6.7,0,11-2.29,13.65-7.21A22,22,0,0,0,208,23.94,8,8,0,0,1,224,24c0,12.86-8.52,32-32,32-6.7,0-11,2.29-13.65,7.21A22,22,0,0,0,176,72.06,8,8,0,0,1,160,72ZM136,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm101.66,82.34a8,8,0,1,1-11.32,11.31l-16-16a8,8,0,0,1,11.32-11.32Zm4.87-42.75-24,8a8,8,0,0,1-5.06-15.18l24-8a8,8,0,0,1,5.06,15.18Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M111.49,52.63a15.8,15.8,0,0,0-26,5.77L33,202.78A15.83,15.83,0,0,0,47.76,224a16,16,0,0,0,5.46-1l144.37-52.5a15.8,15.8,0,0,0,5.78-26ZM65.14,161.13l19.2-52.79,63.32,63.32-52.8,19.2ZM160,72a37.8,37.8,0,0,1,3.84-15.58C169.14,45.83,179.14,40,192,40c6.7,0,11-2.29,13.65-7.21A22,22,0,0,0,208,23.94,8,8,0,0,1,224,24c0,12.86-8.52,32-32,32-6.7,0-11,2.29-13.65,7.21A22,22,0,0,0,176,72.06,8,8,0,0,1,160,72ZM136,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm101.66,82.34a8,8,0,1,1-11.32,11.31l-16-16a8,8,0,0,1,11.32-11.32Zm4.87-42.75-24,8a8,8,0,0,1-5.06-15.18l24-8a8,8,0,0,1,5.06,15.18Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M110.08,54a13.8,13.8,0,0,0-22.73,5.05L34.85,203.47A13.82,13.82,0,0,0,47.76,222a14,14,0,0,0,4.77-.85l144.38-52.5a13.8,13.8,0,0,0,5-22.73ZM48.43,209.87a1.79,1.79,0,0,1-2.3-2.3L61.31,165.8,90.2,194.68Zm54.21-19.71-36.8-36.81L80.51,113,143,175.49ZM194,156.07a1.74,1.74,0,0,1-1.14,1.3L155.44,171,85,100.55,98.63,63.19a1.72,1.72,0,0,1,1.3-1.14,1.58,1.58,0,0,1,.41,0,1.72,1.72,0,0,1,1.25.53l91.88,91.88A1.73,1.73,0,0,1,194,156.07ZM162,72a35.52,35.52,0,0,1,3.63-14.68C170.57,47.44,179.93,42,192,42c7.47,0,12.53-2.74,15.48-8.38A24.18,24.18,0,0,0,210,24,6,6,0,0,1,216,18h0a6,6,0,0,1,6,6c0,10.38-6.27,30-30,30-7.47,0-12.53,2.74-15.48,8.38A24,24,0,0,0,174,72a6,6,0,0,1-6,6h0A6,6,0,0,1,162,72ZM138,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm98.24,83.76a6,6,0,1,1-8.48,8.48l-16-16a6,6,0,0,1,8.48-8.48Zm5.66-46.07-24,8a6,6,0,1,1-3.8-11.38l24-8a6,6,0,0,1,3.8,11.38Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M111.49,52.63a15.8,15.8,0,0,0-26,5.77L33,202.78A15.83,15.83,0,0,0,47.76,224a16,16,0,0,0,5.46-1l144.37-52.5a15.8,15.8,0,0,0,5.78-26Zm-8.33,135.21-35-35,13.16-36.21,58.05,58.05Zm-55,20,14-38.41,24.45,24.45ZM156,168.64,87.36,100l13-35.87,91.43,91.43ZM160,72a37.8,37.8,0,0,1,3.84-15.58C169.14,45.83,179.14,40,192,40c6.7,0,11-2.29,13.65-7.21A22,22,0,0,0,208,23.94,8,8,0,0,1,224,24c0,12.86-8.52,32-32,32-6.7,0-11,2.29-13.65,7.21A22,22,0,0,0,176,72.06,8,8,0,0,1,160,72ZM136,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm101.66,82.34a8,8,0,1,1-11.32,11.31l-16-16a8,8,0,0,1,11.32-11.32Zm4.87-42.75-24,8a8,8,0,0,1-5.06-15.18l24-8a8,8,0,0,1,5.06,15.18Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M108.66,55.46a11.79,11.79,0,0,0-19.43,4.31L36.73,204.15a11.81,11.81,0,0,0,11,15.85,11.88,11.88,0,0,0,4.08-.73l144.38-52.5a11.79,11.79,0,0,0,4.31-19.43Zm-6.53,137L63.52,153.87l16.19-44.51,66.92,66.93Zm-53,19.28a3.81,3.81,0,0,1-4.87-4.87l16.27-44.72,33.32,33.32Zm146.8-55.25a3.77,3.77,0,0,1-2.42,2.74l-38.56,14L82.72,101.07l14-38.56a3.77,3.77,0,0,1,2.74-2.42,4.32,4.32,0,0,1,.85-.09A3.65,3.65,0,0,1,103,61.12L194.88,153A3.78,3.78,0,0,1,195.91,156.51ZM220,24c0,9.68-5.85,28-28,28-8.31,0-14.18,3.29-17.42,9.79A26.12,26.12,0,0,0,172,72a4,4,0,0,1-8,0,34.06,34.06,0,0,1,3.42-13.79C170.66,51.73,177.56,44,192,44c19.29,0,20-18,20-20a4,4,0,0,1,4-4h0A4,4,0,0,1,220,24ZM140,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm94.83,85.17a4,4,0,0,1-5.66,5.66l-16-16a4,4,0,0,1,5.66-5.66Zm6.43-49.37-24,8A4,4,0,0,1,216,84a4,4,0,0,1-1.27-7.79l24-8a4,4,0,0,1,2.53,7.59Z"}))]]),e1c=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e1d}));e1c.displayName="ConfettiIcon";let e1u=new Map([["bold",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,60a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,60Zm0,64a20,20,0,1,1,20-20A20,20,0,0,1,128,124Zm0-112a92.1,92.1,0,0,0-92,92c0,77.36,81.64,135.4,85.12,137.83a12,12,0,0,0,13.76,0,259,259,0,0,0,42.18-39C205.15,170.57,220,136.37,220,104A92.1,92.1,0,0,0,128,12Zm31.3,174.71A249.35,249.35,0,0,1,128,216.89a249.35,249.35,0,0,1-31.3-30.18C80,167.37,60,137.31,60,104a68,68,0,0,1,136,0C196,137.31,176,167.37,159.3,186.71Z"}))],["duotone",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,24a80,80,0,0,0-80,80c0,72,80,128,80,128s80-56,80-128A80,80,0,0,0,128,24Zm0,112a32,32,0,1,1,32-32A32,32,0,0,1,128,136Z",opacity:"0.2"}),eN.createElement("path",{d:"M128,64a40,40,0,1,0,40,40A40,40,0,0,0,128,64Zm0,64a24,24,0,1,1,24-24A24,24,0,0,1,128,128Zm0-112a88.1,88.1,0,0,0-88,88c0,31.4,14.51,64.68,42,96.25a254.19,254.19,0,0,0,41.45,38.3,8,8,0,0,0,9.18,0A254.19,254.19,0,0,0,174,200.25c27.45-31.57,42-64.85,42-96.25A88.1,88.1,0,0,0,128,16Zm0,206c-16.53-13-72-60.75-72-118a72,72,0,0,1,144,0C200,161.23,144.53,209,128,222Z"}))],["fill",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,16a88.1,88.1,0,0,0-88,88c0,75.3,80,132.17,83.41,134.55a8,8,0,0,0,9.18,0C136,236.17,216,179.3,216,104A88.1,88.1,0,0,0,128,16Zm0,56a32,32,0,1,1-32,32A32,32,0,0,1,128,72Z"}))],["light",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,66a38,38,0,1,0,38,38A38,38,0,0,0,128,66Zm0,64a26,26,0,1,1,26-26A26,26,0,0,1,128,130Zm0-112a86.1,86.1,0,0,0-86,86c0,30.91,14.34,63.74,41.47,94.94a252.32,252.32,0,0,0,41.09,38,6,6,0,0,0,6.88,0,252.32,252.32,0,0,0,41.09-38c27.13-31.2,41.47-64,41.47-94.94A86.1,86.1,0,0,0,128,18Zm0,206.51C113,212.93,54,163.62,54,104a74,74,0,0,1,148,0C202,163.62,143,212.93,128,224.51Z"}))],["regular",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,64a40,40,0,1,0,40,40A40,40,0,0,0,128,64Zm0,64a24,24,0,1,1,24-24A24,24,0,0,1,128,128Zm0-112a88.1,88.1,0,0,0-88,88c0,31.4,14.51,64.68,42,96.25a254.19,254.19,0,0,0,41.45,38.3,8,8,0,0,0,9.18,0A254.19,254.19,0,0,0,174,200.25c27.45-31.57,42-64.85,42-96.25A88.1,88.1,0,0,0,128,16Zm0,206c-16.53-13-72-60.75-72-118a72,72,0,0,1,144,0C200,161.23,144.53,209,128,222Z"}))],["thin",eN.createElement(eN.Fragment,null,eN.createElement("path",{d:"M128,68a36,36,0,1,0,36,36A36,36,0,0,0,128,68Zm0,64a28,28,0,1,1,28-28A28,28,0,0,1,128,132Zm0-112a84.09,84.09,0,0,0-84,84c0,30.42,14.17,62.79,41,93.62a250,250,0,0,0,40.73,37.66,4,4,0,0,0,4.58,0A250,250,0,0,0,171,197.62c26.81-30.83,41-63.2,41-93.62A84.09,84.09,0,0,0,128,20Zm37.1,172.23A254.62,254.62,0,0,1,128,227a254.62,254.62,0,0,1-37.1-34.81C73.15,171.8,52,139.9,52,104a76,76,0,0,1,152,0C204,139.9,182.85,171.8,165.1,192.23Z"}))]]),e1p=eN.forwardRef((e,t)=>eN.createElement(eK$,{ref:t,...e,weights:e1u}));function e1m(e){let t=e0P(e),l=e1a(t),{composer:i,configurationModal:a,partyMain:n,date:r,step:o,ready:s}=t,[d,c]=(0,eN.useState)("");(0,eN.useEffect)(()=>t.subscribePartyProductConfirmed(()=>{t.setDateConfirmed(!0),c("product")}),[t.subscribePartyProductConfirmed,t.setDateConfirmed]),(0,eN.useEffect)(()=>{c("")},[o]),(0,eN.useEffect)(()=>{if(!d)return;let e=window.setTimeout(()=>c(""),1e3);return()=>window.clearTimeout(e)},[d]);let u=(0,eN.useRef)();(0,eN.useEffect)(()=>{if(!s||i||a||"select"!==o||!n||n.date===r)return;let e=`${n.productLineUid}:${r}`;u.current!==e&&(u.current=e,t.editLine(n.productLineUid))},[s,i,a,o,null==n?void 0:n.productLineUid,null==n?void 0:n.date,r]);let p={datePreview:l,completingSection:d,onComplete:c};return t.isKiosk&&t.checkout.kioskPaymentResult?(0,eB.jsx)(e1o,{checkout:t.checkout,locale:t.locale}):(0,eB.jsxs)(eB.Fragment,{children:[i?(0,eB.jsx)(e1g,{runtime:t,...p},i.key):(0,eB.jsx)(e1h,{runtime:t,...p}),(0,eB.jsx)(e21,{runtime:t}),(0,eB.jsx)(e1t,{runtime:t})]})}function e1g(e){let{runtime:t,datePreview:l,completingSection:i,onComplete:a}=e,n=t.composer,r=eZI({mode:"party",draft:n,context:t.context,scopeKey:t.scopeKey,priceSource:t.mainQueries,operationLog:t.operationLog,date:t.date,customerId:t.customerId,locale:t.locale,disabled:!t.ready||t.busy||t.holderBusy||t.checkout.submitting||t.handoff,onBusyChange:t.setComposerBusy,onDraftChange:e=>t.rememberPartyPreview(n.key,e),onDateChange:async e=>{await t.changeDate(e)},onCancel:()=>t.setComposer(void 0),onCommitted:()=>{let e=eJK(t.context,t.scopeKey).required?"holder":t.nextAfterHolder;t.setRevision(e=>e+1),t.setStep(e),t.setComposer(void 0)},prepareRelated:async()=>{if(!t.partyMain)return{};let e=await t.extras.prepareRevalidation();if(e.invalidItems.length)throw Error(t.text("Some extras are unavailable for the new Party selection. Remove or reselect them before saving. ","部分附加商品不适用于新选择,请移除或重新选择后保存。 ")+e.invalidItems.map(e=>e.message).join(" "));return{mode:Number(t.partyMain.line.product_id)===Number(n.detail.id)?"edit":"replace",relatedRetailProducts:e.validRows,availabilityCommitGuard:()=>{var l;let i=eJY(t.os.getTempOrder(),{mode:"party"});if((null==(l=i.bindings[0])?void 0:l.productLineUid)!==t.partyMain.productLineUid||JSON.stringify(i.extras)!==JSON.stringify(e.sourceRows))throw Error(t.text("The extras changed. Please review your Party again.","附加商品已变化,请重新核对 Party。"))}}}}),o=eZ0({enabled:!1!==t.props.isActive,openId:n.key,scopeKey:t.scopeKey,sessionId:t.session.sessionId,productDetail:n.detail,skuValue:r.configuration.skuValue,quantity:r.quantity,overSold:1===n.overSold,priceBasis:"catalog",timeZone:t.bookingUI.timeZone,customerId:t.customerId,os:t.mainQueries}),s=eKB();return(0,eB.jsx)(eZw,{ref:r.panelRef,...r.bookingProps,onExplicitSelection:(e,l)=>{if("time"===e){null==a||a("time");let e=l.resourceGroups.some(e=>!eQR(e,r.bookingProps.resourceSettings));t.setExpandedSection(!l.ready&&e?"resource":""),s(l.ready?".party-app .booking-primary-action":e?"#party-room":"#party-time",{block:l.ready?"nearest":"start"})}else l.ready&&(null==a||a("resource"),t.setExpandedSection(""),s(".party-app .booking-primary-action",{block:"nearest"}))},renderContent:e=>(0,eB.jsx)(e1h,{runtime:t,datePreview:l,model:r,selection:e,estimatedSubtotal:"ready"===o.status?o.subtotal:void 0,completingSection:i,onComplete:a})})}function e1h(e){var t,l,i,a;let{runtime:n,datePreview:r,model:o,selection:s,estimatedSubtotal:d,completingSection:c,onComplete:u}=e,p=o?B4(o.prepared.product).required:n.holderState.required,m=e1i({...n,holderState:{...n.holderState,required:p}}),g=e2J(n,null==o?void 0:o.error),h=eKB(),{text:v,locale:f,partyMain:y,expandedSection:b,dateConfirmed:x}=n,k=v("Your party","Party 订单明细"),_=eQM(n.date,"zh"===f?"zh-CN":"en-AU",{weekday:"short",year:"numeric",month:"short",day:"numeric"}),w=n.composer,S=w?eKT(w.detail.title||w.detail.name,f):y?eKT(y.line.product_title,f):"",j=null==s?void 0:s.state.candidate,N=o?j?`${e1v(j.bookingStartAt||j.startAt)}–${e1v(j.bookingEndAt||j.endAt)}`:"":y?`${y.booking.start_time}–${y.booking.end_time}`:"",C=o?((null==s?void 0:s.state.selectedResourceDetails)||[]).map(e=>{var t;return eKT(e.name||(null==(t=e.raw)?void 0:t.name),f)}).filter(Boolean).join(" \xb7 "):((null==y?void 0:y.booking.resources)||[]).map(e=>{var t;return eKT((null==(t=e.metadata)?void 0:t.resource_name)||e.title||e.name||e.resource_name,f)}).filter(Boolean).join(" \xb7 "),M=o?!!(j&&(j.businessDate||j.date)===n.date&&(null==s?void 0:s.state.times.some(e=>eQQ(e,j)&&eQK(e,(s.state.partySize||0)*s.state.bookingCount)))):!!(N&&n.mainDateMatches),T=(null==o?void 0:o.prepared.partySize)??(null==y||null==(t=y.intent.resources[0])?void 0:t.capacity),I=iB((null==o?void 0:o.configuration.skuValue)||(y?{...y.line.product_sku,bundle:y.line.product_bundle}:void 0),"",e=>eKT(e,f),e=>String(n.amount(e))),P=!!S,A=o?o.bookingReady:n.hasBookings&&n.mainDateMatches,D=n.disabled||!!(null==o?void 0:o.working),E=n.context.sales.salesSettings,O=null==E||null==(l=E.reservation)?void 0:l.resourceSettings,z="picoding"!==n.context.sales.salesSettingsSource||!!(E&&!n.context.sales.salesSettingsError),L=(null==o?void 0:o.prepared.product)||(null==w?void 0:w.detail)||y&&n.main.products.find(e=>String(e.id)===String(y.line.product_id)),R=L?eQF(L,O):!y||y.intent.resources.some(e=>!eQR({formId:e.formId},O)),$=z&&(s?s.showResources:R),F=e=>{!D&&("resource"!==e||$)&&(null==u||u(e?"":b),n.setStep("select"),n.setExpandedSection(e),!o&&y&&["time","resource"].includes(e)&&n.editLine(y.productLineUid),h(`#party-${"resource"===e?"room":e}`))},q=e=>{D||n.orderPanel.closeThen(e)},B="select"===n.step?{label:v("Next: ","下一步:")+(p?v("holder details","Holder 资料"):n.hasExtras?v("extras","附加商品"):v("review","确认")),busy:(null==o?void 0:o.working)||n.busy||n.depositHydration.pending,disabled:D||n.mainCatalogBlocked||!A||!o&&!!n.depositHydration.error,onClick:async()=>{!D&&!n.mainCatalogBlocked&&A&&(o?await o.commit()&&n.orderPanel.closeThen(()=>h("[data-booking-stage]")):n.orderPanel.closeThen(()=>{n.continueOrder(n.nextAfterSelect),h("[data-booking-stage]")}))}}:m.primaryAction,H=(null==o||null==(i=o.quote)?void 0:i.compositeLineTotal)??d,V=o?null==H?"—":n.amount(H):n.amount(n.hasBookings?n.hasDeposit?n.amountDue:null==(a=n.summary)?void 0:a.expect_amount:0),U=(0,eB.jsx)(eB.Fragment,{children:P?(0,eB.jsxs)("div",{className:"party-summary-lines",children:[(0,eB.jsx)(e0U,{items:[{label:v("Your party","我的 Party"),value:S,detail:(0,eB.jsxs)(eB.Fragment,{children:[T?(0,eB.jsxs)("div",{children:[T," ",v("guests","位参加者")]}):null,I.map(e=>(0,eB.jsxs)("div",{children:[e.label," ",e.meta]},e.key)),!o&&y&&(0,eB.jsx)(e2G,{products:[y.line],locale:f})]}),action:{label:v("Edit","编辑"),onClick:()=>q(()=>F("product")),disabled:D}},{label:v("When","日期与时间"),value:_,detail:N||v("Choose a time","待选择时间"),action:{label:v("Edit","编辑"),onClick:()=>q(()=>F("date")),disabled:D}},{label:v("Where","Party room"),value:C||v("Choose a room","待选择房间"),action:$?{label:v("Edit","编辑"),onClick:()=>q(()=>F("resource")),disabled:D}:void 0},...n.holderState.enabled?[{label:v("Holder","持有人"),value:`${n.holderState.completed} / ${n.holderState.total}`,detail:(0,eB.jsx)(e2W,{context:n.context,locale:f,lines:n.holderState.lines.filter(e=>e.uid===(null==y?void 0:y.productLineUid))}),action:{label:v("Edit","编辑"),onClick:()=>q(()=>{n.setStep(n.holderState.required?"holder":"review"),h("[data-booking-stage]")}),disabled:D||!!o}}]:[]]}),n.extras.rows.length>0&&(0,eB.jsx)(e25,{text:v}),(0,eB.jsx)(e29,{runtime:n,onlyExtras:!0,onEditExtras:()=>{m.goTo("extras")}}),o?(0,eB.jsx)(eKU,{label:v("Party selection subtotal","Party 选择小计"),amount:V}):(0,eB.jsx)(e1e,{runtime:n,splitPartySubtotal:!0,includeTotal:n.hasDeposit,includeDueNow:"review"===n.step&&!n.hasDeposit}),o&&(0,eB.jsx)("p",{className:"small muted",children:v("Final fees and discounts are calculated after saving your selection.","保存选择后计算最终费用与优惠。")})]}):(0,eB.jsx)(eZy,{className:"party-empty",description:v("A wonderful party starts here. Choose a date and a package.","从选日期和商品开始,安排一场欢乐派对。"),icon:(0,eB.jsx)(e1c,{size:34})})}),Y=(0,eB.jsx)(eQI,{value:n.date,onChange:e=>{n.changeDate(e,o?{configuration:o.configuration,initialSelection:o.selection,quantity:o.quantity}:void 0).then(e=>{e&&(null==u||u("date"),h(o?"#party-time":"#party-product"))}).catch(e=>n.setError(e instanceof Error?e.message:String(e)))},locale:"zh"===f?"zh-CN":"en-AU",timeZone:n.bookingUI.timeZone,todayMarker:"device",title:v("Choose a date","选择日期"),stepNumber:1,stepStatus:{status:x?"complete":"available"},minDate:n.today,disabled:D,dateStates:n.dateStates,onVisibleDatesChange:n.setVisibleDates,loading:r.searching,onInteraction:n.onDateInteraction,t:e=>e1r(e,f)});return n.session.error||!n.session.ready||n.session.pendingOrder||!n.uiHydrated||n.previewRecovery?(0,eB.jsxs)("div",{className:"venue-booking-sales venue-booking-sales--party",children:[(0,eB.jsx)(e20,{runtime:n}),(0,eB.jsx)(e22,{runtime:n}),n.previewRecovery&&(0,eB.jsxs)(eZf,{tone:n.previewRecoveryError?"error":void 0,children:[(0,eB.jsx)("p",{children:n.previewRecoveryError||v("Restoring your Party selection with current availability and prices…","正在按当前可用性和价格恢复 Party 选择…")}),n.previewRecoveryError&&(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)(eKQ,{secondary:!0,disabled:n.recoveringPreview,onClick:n.retryPartyPreview,children:v("Retry","重试")}),(0,eB.jsx)(eKQ,{secondary:!0,disabled:n.recoveringPreview,onClick:n.discardPartyPreview,children:v("Discard unsaved selection","放弃未保存的选择")})]})]})]}):(0,eB.jsxs)("div",{className:"venue-booking-sales venue-booking-sales--party party-app",children:[(0,eB.jsx)(e20,{runtime:n}),(0,eB.jsx)(eKV,{className:"party-booking-page",stage:n.step,navigation:m.navigation,title:"holder"===n.step?v("Choose a Holder","选择持有人"):"extras"===n.step?v("Make it your Party","为 Party 增添更多乐趣"):"review"===n.step?v("Your party, all together","确认您的欢乐派对"):void 0,summary:(0,eB.jsx)(eQm,{panel:n.orderPanel,title:k,closeLabel:v("Close","关闭"),body:U,footer:(0,eB.jsxs)(eB.Fragment,{children:[g.summary,(0,eB.jsx)(eKU,{label:o?v("Party selection subtotal","Party 选择小计"):n.hasDeposit?v("Due now","本次待付"):v("Party total","Party 总额"),amount:V,total:!0}),(0,eB.jsx)("div",{className:"party-actions",children:(0,eB.jsx)(eKX,{action:B})})]}),decoration:(0,eB.jsx)(eKh,{variant:"summary"})}),footer:(0,eB.jsx)(eK2,{lang:f,back:m.previous?{label:v("Previous step","上一步"),onClick:m.back}:void 0,summary:(0,eB.jsx)(eQg,{panel:n.orderPanel,title:k,label:!o&&n.hasDeposit?v("Deposit details","定金明细"):v("Details","明细"),total:String(V)}),action:B,feedback:g.footer}),children:"select"===n.step?(0,eB.jsxs)("div",{className:"party-arrangement",children:[(0,eB.jsx)("section",{id:"party-date",tabIndex:-1,className:"visit-date-panel",children:"date"!==b&&x?(0,eB.jsx)(eQe,{lang:f,id:"party-date-summary",number:1,completing:"date"===c,stepStatus:{status:"complete"},title:v("Choose a date","选择日期"),open:!1,summary:(0,eB.jsx)("b",{children:_}),onToggle:()=>F("date"),locked:D,children:null}):Y}),(0,eB.jsx)(eQe,{lang:f,id:"party-product",number:2,title:v("Choose your party package","选择 Party 商品"),completing:"product"===c,stepStatus:{status:P?"complete":r.catalogueReady?"available":"locked"},open:"product"===b||!P,summary:P?(0,eB.jsx)("b",{children:S}):void 0,onToggle:()=>{null==u||u("product"===b?"product":""),n.setExpandedSection("product"===b?"":"product")},locked:D||!r.catalogueReady,children:(0,eB.jsx)(e24,{runtime:n,preview:r,showFilters:!1})}),(0,eB.jsx)(eQe,{lang:f,id:"party-time",number:3,title:v("Choose a time","选择时间"),completing:"time"===c,stepStatus:{status:M?"complete":P?"available":"locked"},open:"time"===b||!M,summary:N?(0,eB.jsx)("b",{children:N}):void 0,onToggle:()=>F("time"===b?"":"time"),locked:D||!P,children:s?s.timeContent:n.preparingProductId?(0,eB.jsx)(eZy,{className:"party-empty",pending:!0,description:v("Loading your Party selection…","正在加载您的 Party 选择…")}):(0,eB.jsx)(eZy,{className:"party-empty",icon:(0,eB.jsx)(e0$,{size:28}),description:v("Choose your Party package first.","请先选择 Party 商品。")})}),$&&(0,eB.jsx)(eQe,{lang:f,id:"party-room",number:4,title:v("Choose a room","选择房间"),completing:"resource"===c,stepStatus:{status:A?"complete":M?"available":"locked"},open:"resource"===b||!C||!A,summary:C?(0,eB.jsx)("b",{children:C}):void 0,onToggle:()=>F("resource"===b?"":"resource"),locked:D||!M,children:s&&M?s.resourceContent:n.preparingProductId?(0,eB.jsx)(eZy,{className:"party-empty",pending:!0,description:v("Loading your Party selection…","正在加载您的 Party 选择…")}):(0,eB.jsx)(eZy,{className:"party-empty",icon:(0,eB.jsx)(e1p,{size:28}),description:v("Choose a time to see available rooms.","选择时间后查看可用房间。")})}),!A&&(null==s?void 0:s.statusPanel),A&&!b&&!D&&!(null==o?void 0:o.error)&&(0,eB.jsxs)(eZf,{id:"party-ready-notice",className:"party-ready-notice",tone:"success",icon:(0,eB.jsx)(eZR,{weight:"bold","aria-hidden":"true"}),children:[(0,eB.jsxs)("div",{className:"party-ready-copy",children:[(0,eB.jsx)("strong",{children:v("Your party choices are ready","Party 安排已选好")}),(0,eB.jsxs)("p",{children:[(0,eB.jsx)("span",{className:"party-ready-desktop",children:v("Click ","点击右侧")}),(0,eB.jsx)("span",{className:"party-ready-mobile",children:v("Tap ","点击底部")}),(0,eB.jsx)("b",{children:"zh"===f?(0,eB.jsxs)(eB.Fragment,{children:["「",B.label,"」"]}):(0,eB.jsxs)(eB.Fragment,{children:["“",B.label,"”"]})}),"en"===f&&(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("span",{className:"party-ready-desktop",children:" on the right."}),(0,eB.jsx)("span",{className:"party-ready-mobile",children:" below."})]})]})]}),(0,eB.jsx)(e0D,{className:"party-ready-direction",size:28,"aria-hidden":"true"})]})]}):m.renderStage})]})}function e1v(e){var t;return(null==(t=String(e||"").match(/[T ](\d{2}:\d{2})/))?void 0:t[1])||String(e||"").slice(0,5)}function e1f(e){var t,l,i,a,n,r,o,s,d,c,u,p,m,g,h;let v="tickets"===e.mode?e1s:e1m,f=eR(),y=(0,eN.useRef)({brand:void 0,design:void 0}),b=function(e,t,l){let i,a;if(!eKM(e)||!eKM(e.steps))return{status:"invalid",reason:"Booking menus have not been configured."};if(void 0!==e.template&&e.template!==t)return{status:"invalid",reason:"The booking template and menu configuration do not match."};let n=[t];Object.prototype.hasOwnProperty.call(e.steps,"extras")&&n.push("extras");let r={};for(let t of n){let l=e.steps[t],i=eKM(l)?l.catalog:void 0,a=eKM(i)?i.menuListIds:void 0;if(!Array.isArray(a)||a.some(e=>"number"!=typeof e||!Number.isSafeInteger(e)||e<=0))return{status:"invalid",reason:`The ${t} menu configuration is missing or invalid.`};r[t]={catalog:{menuListIds:[...new Set(a)]}}}let o=function e(t){if("string"!=typeof t)return;let l=t.trim();if(/^#[\da-f]{6}$/i.test(l))return l.toUpperCase();if(/^#[\da-f]{3}$/i.test(l))return`#${l.slice(1).split("").map(e=>e+e).join("")}`.toUpperCase();if(/^#[\da-f]{6}ff$/i.test(l))return l.slice(0,7).toUpperCase();if(/^#[\da-f]{3}f$/i.test(l))return e(l.slice(0,4));let i=/^(rgb|rgba)\(([^)]+)\)$/i.exec(l);if(!i)return;let a=i[2].split(",").map(e=>e.trim());if(a.length!==("rgba"===i[1].toLowerCase()?4:3)||a.some(e=>!/^(?:\d+(?:\.\d+)?|\.\d+)%?$/.test(e))||4===a.length&&1!==(a[3].endsWith("%")?parseFloat(a[3])/100:Number(a[3])))return;let n=a.slice(0,3).map(e=>{let t=e.endsWith("%"),l=parseFloat(e);return l<0||l>(t?100:255)?NaN:Math.round(t?255*l/100:l)});if(!n.some(e=>!Number.isFinite(e)))return`#${n.map(e=>e.toString(16).padStart(2,"0")).join("")}`.toUpperCase()}(l),s=eKM(e.brand)?e.brand:void 0,d=s||o?{name:"string"==typeof(null==s?void 0:s.name)?s.name:void 0,title:"string"==typeof(null==s?void 0:s.title)?s.title:void 0,logo:"string"==typeof(null==s?void 0:s.logo)?s.logo:void 0,hero:"string"==typeof(null==s?void 0:s.hero)?s.hero:void 0,primaryColor:o??("string"==typeof(null==s?void 0:s.primaryColor)?s.primaryColor:void 0),mascot:"string"==typeof(null==s?void 0:s.mascot)?s.mascot:void 0,logoMode:(null==s?void 0:s.logoMode)==="full"?"full":"icon-and-name"}:void 0;try{i=eK_(e.design),eKw(d)}catch{a="The booking design configuration is invalid."}return{status:"ready",value:{template:t,steps:r,brand:d,design:i,visualError:a},scopeKey:JSON.stringify({template:t,steps:r})}}(e.config,e.mode,null==f||null==(l=f.appHelper)||null==(t=l.constants)?void 0:t.themeColor),x=e.context.sales.bookingTicket;if("invalid"===b.status)return(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:b.reason});if(!x)return(0,eB.jsx)(eM.Spin,{});let k=(null==f||null==(n=f.appHelper)||null==(a=n.utils)||null==(i=a.getData)?void 0:i.call(a,"timezone"))||(null==(r=x.otherParams)?void 0:r.businessTimezone);if(!k&&"pending"===e.context.sales.catalogState)return(0,eB.jsx)(eM.Spin,{});try{if(!k)throw Error();eKD(k)}catch{return(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:String(e.locale).startsWith("zh")?"场馆时区尚未配置,请联系商家。":"The venue timezone is not configured. Please contact the venue."})}if("function"!=typeof x.createVenueCatalogSession)return(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:String(e.locale).startsWith("zh")?"预约服务尚未更新,请联系商家。":"The booking service needs to be updated. Please contact the venue."});let _=e.businessCode||(null==(o=x.otherParams)?void 0:o.businessCode)||"venue_booking",w=x.otherParams,S=eKE(x),j=null==f||null==(c=f.appHelper)||null==(d=c.utils)||null==(s=d.getData)?void 0:s.call(d,"shop_id"),N=JSON.stringify([(null==w?void 0:w.shopId)!=null&&String(w.shopId)!==String(j)?w.shopId:j,(null==w?void 0:w.previousVenueCacheId)&&"venue_booking"===_?null:null==w?void 0:w.tenantId,e.context.sales.osKey,k,b.scopeKey,..."venue_booking"===_?[]:[_],...S?["kiosk",e.mode]:[]]),C=String(e.locale).startsWith("zh")?"zh":"en";b.value.visualError||(y.current={brand:b.value.brand,design:b.value.design});let M={...b.value,...y.current},T={...M.brand,name:(null==(u=M.brand)?void 0:u.name)||(null==(p=M.brand)?void 0:p.title)||eKT(null==f||null==(h=f.appHelper)||null==(g=h.utils)||null==(m=g.getData)?void 0:m.call(g,"shop_name"),C)||("zh"===C?"预订游玩":"Book your visit")};return(0,eB.jsx)(eM.ConfigProvider,{theme:{token:{colorPrimary:T.primaryColor||"#D61518",colorText:"#092d3e",fontFamily:'BookingDM, "PingFang SC", "Microsoft YaHei", sans-serif'}},children:(0,eB.jsx)(eKC,{lang:C,brand:T,design:M.design,timeZone:k,className:"venue-booking-design",presentationPlatform:S?"kiosk":"default",layout:S?"compact":"responsive",children:(0,eB.jsx)(v,{...e,businessCode:_,config:M,scopeKey:N},N)})})}function e1y(e){let{tmpl:t="standard",venueBookingConfig:l,isActive:i=!0,catalogPreparation:a,osKey:n,productListPreferencesChannel:r,context:o,mode:s,variant:d,productLoadParams:c,businessCode:u,bookingConfigParams:p,hideSelectFloorMapResourceAction:m,productDisplayConfig:g,productCatalogSessionKey:h,productCatalogReady:v,kioskShellLayout:f,kioskAppearance:y,saleDetailTemplate:b,saleDetailModuleConfig:x,orderId:k,locale:_,onLocaleChange:w,saleDetailWrapperProps:S,saleDetailHeaderSlot:j,rightActionBarClose:N,onOrderComplete:C,onPaidCheckout:M,onPaymentPageActiveChange:T,onRequestHome:I,renderCatalog:P,externalActionRequest:A,onExternalActionAccepted:D,onExternalPaymentSettled:E}=e;switch(t){case"venue-ticket-booking":case"venue-party-booking":return(0,eB.jsx)(e1f,{mode:"venue-ticket-booking"===t?"tickets":"party",businessCode:u,context:o,variant:d,config:l,isActive:i,locale:_,onRequestHome:I});case"HDLKiosk":return(0,eB.jsx)(eKl,{isActive:i,osKey:n,context:o,mode:s,variant:d,businessCode:u,locale:_,onLocaleChange:w,productLoadParams:c,productCatalogSessionKey:h,productCatalogReady:v});case"kiosk":return(0,eB.jsx)(eVg,{isActive:i,catalogPreparation:a,osKey:n,productListPreferencesChannel:r,context:o,mode:s,variant:d,productLoadParams:c,businessCode:u,bookingConfigParams:p,hideSelectFloorMapResourceAction:m,productDisplayConfig:g,productCatalogSessionKey:h,productCatalogReady:v,kioskShellLayout:f,kioskAppearance:y,saleDetailTemplate:b,saleDetailModuleConfig:x,orderId:k,locale:_,saleDetailHeaderSlot:j,onOrderComplete:C,onPaidCheckout:M,onPaymentPageActiveChange:T,onRequestHome:I,renderCatalog:P});case"secondaryScreen":return(0,eB.jsx)(eHa,{osKey:n,context:o,mode:s,variant:d,productLoadParams:c,businessCode:u,bookingConfigParams:p,hideSelectFloorMapResourceAction:m,productDisplayConfig:g,productCatalogSessionKey:h,productCatalogReady:v,saleDetailTemplate:b,saleDetailModuleConfig:x,orderId:k,locale:_,saleDetailWrapperProps:S,saleDetailHeaderSlot:j,onOrderComplete:C});default:return(0,eB.jsx)(eHi,{isActive:i,osKey:n,productListPreferencesChannel:r,context:o,mode:s,variant:d,productLoadParams:c,businessCode:u,bookingConfigParams:p,hideSelectFloorMapResourceAction:m,productDisplayConfig:g,productCatalogSessionKey:h,productCatalogReady:v,saleDetailTemplate:b,saleDetailModuleConfig:x,orderId:k,locale:_,saleDetailWrapperProps:S,saleDetailHeaderSlot:j,rightActionBarClose:N,onOrderComplete:C,externalActionRequest:A,onExternalActionAccepted:D,onExternalPaymentSettled:E})}}function e1b(e){var t,l;let i,a,n,r,o,s,{isActive:d=!0,catalogPreparation:c,osKey:u,saleDetailHeaderSlot:p,rightActionBarClose:m,overlaySlot:g,className:h,style:v,mode:f="ticket",tmpl:y,template:b="standard",venueBookingConfig:x,variant:k="desktop",productLoadParams:_,businessCode:w,bookingConfigParams:S,hideSelectFloorMapResourceAction:j,productDisplayConfig:N,productCatalogSessionKey:C,productCatalogReady:M,kioskShellLayout:T,kioskAppearance:I,saleDetailTemplate:P,saleDetailModuleConfig:A,autoCreate:D=!0,orderId:E,locale:O,onLocaleChange:z,saleDetailWrapperProps:L,cartProductsPerRow:R,showClient:$,onOrderComplete:F,onPaidCheckout:q,onPaymentPageActiveChange:B,onRequestHome:H,renderCatalog:V,externalActionRequest:U,onExternalActionAccepted:Y,onExternalPaymentSettled:W}=e;sZ(eq_,O);let G=(i=eb$(),a=eCj(),n=ebU(),r=eNa(),o=eCN(),s=eCS(),(0,eN.useMemo)(()=>({sales:i,products:a,customer:n,cart:r,summary:o,booking:s}),[i,a,n,r,o,s]));eW(d);let K=y||b||"standard",Q=(0,eN.useRef)(!1),Z=(null==(l=G.booking)||null==(t=l.getBookingConfig)?void 0:t.call(l))??null,{salesSettingsSource:J,salesSettings:X,salesSettingsError:ee,salesSettingsPlatform:et,ensureSalesSettings:el}=G.sales,ei="picoding"===J&&!X,ea=function(e){let{template:t,mode:l,bookingConfig:i,salesSettingsSource:a,salesSettings:n,platform:r,saleDetailModuleConfig:o,cartProductsPerRow:s,showClient:d}=e;return(0,eN.useMemo)(()=>{var e;let c;return(c=function(e,t){if(!e&&!t)return;let l={...e,...t,hidden:[...new Set([...(null==e?void 0:e.hidden)??[],...(null==t?void 0:t.hidden)??[]])],amountDetails:{...null==e?void 0:e.amountDetails,...null==t?void 0:t.amountDetails},promotionWalletPanelsBehavior:{...null==e?void 0:e.promotionWalletPanelsBehavior,...null==t?void 0:t.promotionWalletPanelsBehavior}};if((null==e?void 0:e.cartItems)||(null==t?void 0:t.cartItems)){var i,a;l.cartItems={...null==e?void 0:e.cartItems,...null==t?void 0:t.cartItems,layout:{...null==e||null==(i=e.cartItems)?void 0:i.layout,...null==t||null==(a=t.cartItems)?void 0:a.layout}}}return l}(function(e){var t,l;let i,{template:a,mode:n,bookingConfig:r,salesSettingsSource:o,salesSettings:s,platform:d,cartProductsPerRow:c,showClient:u}=e,p="secondaryScreen"===a;if("picoding"===o&&!s)return;let m="picoding"===o?{isShowImage:s.cart.showProductImage,isShowDelete:!!iI(d)||s.cart.showRemoveButton}:(t="retail"===n?"retail":"appointment",{isShowImage:eCA((i=((null==r||null==(l=r.config)?void 0:l.cart_settings_tab)||{})[`${t}_product_card_style`]||{}).show_product_image)??!0,isShowDelete:eCA(i.show_remove_button)??!0}),g=function(e){if(void 0!==e)return{columns:e}}(c),h={cartItems:{showProductImage:m.isShowImage,showRemoveButton:!p&&m.isShowDelete,...g?{layout:g}:{}},promotionWalletPanelsBehavior:{enableVoucherProductAdd:!p,enableWalletAssets:!p}};if(p){let e=[...eC$];!1===u&&e.push("customer"),h.hidden=e,h.amountDetails={defaultExpanded:!0}}return h}(e={template:t,mode:l,bookingConfig:i,salesSettingsSource:a,salesSettings:n,platform:r,cartProductsPerRow:s,showClient:d,saleDetailModuleConfig:o}),e.saleDetailModuleConfig))&&"secondaryScreen"===e.template?{...c,cartItems:{...c.cartItems,showRemoveButton:!1},promotionWalletPanelsBehavior:{...c.promotionWalletPanelsBehavior,enableVoucherProductAdd:!1,enableWalletAssets:!1}}:c},[t,l,i,a,n,r,s,d,o])}({template:K,mode:f,bookingConfig:Z,salesSettingsSource:J,salesSettings:X,platform:et,saleDetailModuleConfig:A,cartProductsPerRow:R,showClient:$}),en="secondaryScreen"===K,er="standard"===K,eo=G.sales.productLoadChannel||"pos";return((0,eN.useEffect)(()=>{ei||!D||E||Q.current||!G.sales.bookingTicket||G.sales.tempOrder||"idle"===G.sales.status&&(Q.current=!0,G.sales.createNew().catch(()=>{Q.current=!1}))},[D,E,G.sales,G.sales.bookingTicket,G.sales.status,G.sales.tempOrder,ei]),ei)?(0,eB.jsx)("div",{className:aj()("pisell-big-sale",h),style:v,children:ee?(0,eB.jsx)(eM.Alert,{type:"error",showIcon:!0,message:ee.message,action:(0,eB.jsx)(eM.Button,{onClick:()=>void el().catch(()=>void 0),children:ez.getText("pisell2.big-sale.reload")})}):(0,eB.jsx)(eM.Spin,{})}):(0,eB.jsxs)("div",{className:aj()("pisell-big-sale",`pisell-big-sale--${k}`,`pisell-big-sale-tmpl--${K}`,{"pisell-big-sale--secondary-screen":en,"pisell-big-sale--has-right-action-panel":er&&"phone"!==k,"pisell-big-sale--has-right-action-close":er&&"phone"!==k&&!!m},h),"data-kiosk-shell":"kiosk"===K?T:void 0,style:v,children:[(0,eB.jsx)("div",{className:"pisell-big-sale__layout",children:(0,eB.jsx)(e1y,{isActive:d,catalogPreparation:c,osKey:u,productListPreferencesChannel:eo,mode:f,tmpl:K,venueBookingConfig:x,variant:k,context:G,productLoadParams:_,businessCode:w,bookingConfigParams:S,hideSelectFloorMapResourceAction:j,productDisplayConfig:N,productCatalogSessionKey:C,productCatalogReady:M,kioskShellLayout:T,kioskAppearance:I,saleDetailTemplate:P,saleDetailModuleConfig:ea,orderId:E,locale:O,onLocaleChange:z,saleDetailWrapperProps:en?L:void 0,saleDetailHeaderSlot:p,rightActionBarClose:m,onOrderComplete:F,onPaidCheckout:q,onPaymentPageActiveChange:B,onRequestHome:H,renderCatalog:V,externalActionRequest:U,onExternalActionAccepted:Y,onExternalPaymentSettled:W})}),g]})}e1p.displayName="MapPinIcon",e1b.displayName="BigSaleBase";let e1x=oW(e1b);function e1k(e){return"product-selection"===e||"appointment-booking"===e}function e1_(e,t,l){if(!e1k(e))return t;let i=Array.isArray(null==t?void 0:t.steps)||"function"==typeof(null==t?void 0:t.resolveSteps);return{...t,enableProductSelectionFlowForCart:!0,enableBookingSelectionFlowForCart:!0,...!i?{resolveSteps:["pos","webpos"].includes(String(l||"").trim().toLowerCase())?Hp:Hm}:{}}}function e1w(e,t){return e&&ew()(e).isValid()?ew()(e).format("YYYY-MM-DD"):t||ew()().format("YYYY-MM-DD")}let e1S=e=>{var t;let{runtimeRef:l}=e,i=eb$(),a=ebU();return(0,eN.useEffect)(()=>{let e=()=>{var e,t,n,r,o,s,d,c;let u=(null==(t=i.bookingTicket)||null==(e=t.getBookingDate)?void 0:e.call(t))??(null==(d=i.bookingTicket)||null==(s=d.store)||null==(o=s.bookingContext)||null==(r=o.getState)||null==(n=r.call(o))?void 0:n.date);l.current={customerId:null==(c=a.selected)?void 0:c.id,date:e1w(u)}};return e(),ebW(i.bookingTicket,e)},[i.bookingTicket,null==(t=a.selected)?void 0:t.id,l]),null},e1j=e=>{var t,l,i,a,n,r,o;let{osKey:s="big-sale",enableMultiCurrencySettlement:d=!1,osModuleName:c,selectionFlowScene:u="product-selection",lifecycleOwner:p,orderId:m,autoBootstrap:g,autoRestoreOnInit:h,restoreOrderAfterPaidCheckout:v,destroyOnUnmount:f,businessCode:y,bookingConfigParams:b,resourceIdFromCalendar:x,bookingTimeRangeFromCalendar:k,autoInitBookingContext:_,otherParams:w,inventory:S,checkoutHooks:j,rulesHooks:N,uiHosts:C,awaitAllergyConfirmation:M,normalProductDetailConfig:T,mergeBookingLinesForDisplay:I,mode:P="ticket",variant:A,tmpl:D,template:E,venueBookingConfig:O,secondaryScreenDisplay:z,productLoadParams:L,enableMenuOverride:R=!1,productDisplayConfig:$,hideSelectFloorMapResourceAction:F,productCatalogSessionKey:q,productCatalogReady:B,saleDetailTemplate:H,saleDetailModuleConfig:V,autoCreate:U=!0,enableTempOrderPersist:Y,enableTempOrderSync:W=!0,isActive:G=!0,catalogPreparation:K,preserveProductCatalogOnInactiveCustomerClear:Q,autoReloadProductCatalogOnCustomerChange:Z,enableGlobalScanListener:J=!1,scanRequest:X,onScanRequestAccepted:ee,onScanRequestSettled:et,scanScope:el,onScanPromotionResult:ei,promotionScanSuccessMessageKey:ea,promotionItemIncreaseMessageKey:en,className:er,style:eo,locale:es,bootstrapSlot:ed,saleDetailHeaderSlot:ec,rightActionBarClose:eu,overlaySlot:ep,onOrderComplete:em,onPaidCheckout:eg,onPaymentPageActiveChange:eh,onRequestHome:ev,renderCatalog:ef,externalActionRequest:ey,onExternalActionAccepted:eb,onExternalPaymentSettled:ex}=e,ek=eR(),e_=eF(),ew=null==ek||null==(l=ek.appHelper)||null==(t=l.utils)?void 0:t.action,eS=null==ek||null==(a=ek.appHelper)||null==(i=a.utils)?void 0:i.pisellos,ej=null==ek||null==(o=ek.appHelper)||null==(r=o.utils)||null==(n=r.businessUtils)?void 0:n.isProductMergeDisabled,eC=(0,eN.useMemo)(()=>()=>"function"!=typeof ej||!ej(),[ej]),eM=y?`bookingTicket-${s}-${y}`:[s,P].filter(Boolean).join("-"),eT=c||eM,{runtime:eI}=Go(),{isSecondaryScreen:eP,secondaryProductsPerRow:eA,showSecondaryCustomerInfo:eD,mainContentWrapperProps:eE,secondaryScreenSettingsModal:eO}=QL(eI,z),ez=D??E??"standard",eL="venue-ticket-booking"===ez||"venue-party-booking"===ez,e$="kiosk"===ez||"HDLKiosk"===ez,eq=db({preferEngineLocale:e$}),[eH,eV]=(0,eN.useState)(),eU="HDLKiosk"===ez&&eH?eH:es||eq,eY=(0,eN.useCallback)(e=>{eV(e)},[]),eW=eP&&"secondaryScreen"===ez,eG=e1k(u),eK=(0,eN.useMemo)(()=>eHd(eHs(null==w?void 0:w.platform,e_),A),[null==w?void 0:w.platform,e_,A]),eQ="kiosk"===ez&&eK.variant||A,eZ="kiosk"===ez?eK.kioskShellLayout:void 0,eJ=(0,eN.useMemo)(()=>{let e=e1_(u,T,e$?void 0:String(eHs(null==w?void 0:w.platform,e_)??"")),t={...e,..."HDLKiosk"===ez&&!(null==e?void 0:e.appearance)&&!(null==e?void 0:e.resolveAppearance)?{resolveAppearance:eGP}:{},enableMultiCurrencySettlement:d},l=eK.platform?eK.productDetailPresentationPlatform:(null==t?void 0:t.presentationPlatform)??eK.productDetailPresentationPlatform;return e$||eL?{...t,initializeFullBookingContext:!1,variant:eK.productDetailVariant,selectorColumns:"phone"===eK.productDetailVariant&&"default"===l?1:2,isShowProductSummary:!0,isShowCollapsibleSections:!0,isShowMobileWeighing:!0,isShowProcedureSteps:!0,isShowNote:!0,isShowManualPriceChange:!1,isShowRemove:!1,presentationPlatform:l}:{...t,selectorColumns:"phone"===A?1:null==t?void 0:t.selectorColumns,presentationPlatform:eG?"pos":void 0,initializeFullBookingContext:!0,isShowCollapsibleSections:!0,...eG?{isShowManualPriceChange:!0}:{},allowUnavailableBookingSelection:eG,allowNoResourceBookingSelection:eG}},[d,eG,eL,eK.productDetailPresentationPlatform,eK.productDetailVariant,eK.platform,T,null==w?void 0:w.platform,e_,e$,ez,u,A]),eX="kiosk"!==ez&&eG,e0=eHs(null==w?void 0:w.platform,e_),e2="webpos"===String(e0??"").trim().toLowerCase()?"pos":e0,e1=(0,eN.useMemo)(()=>({enforceSingleBookingStartDate:!1,...w,...e2?{platform:e2}:{},enablePickupTiming:"HDLKiosk"!==ez&&!eL}),[w,e2,ez,eL]),e4=(0,eN.useMemo)(()=>eX?{...V,cartItems:{...null==V?void 0:V.cartItems,bookingQuantityMode:"editable"}}:V,[eX,V]),e3=(0,eN.useRef)({date:void 0,customerId:void 0}),e8=(0,eN.useMemo)(()=>ew?{action:ew,getRuntime:()=>{var e,t,l,i,a;let n=null==eS||null==(e=eS.getModule)?void 0:e.call(eS,eT),r=null==n||null==(i=n.store)||null==(l=i.bookingContext)||null==(t=l.getState)?void 0:t.call(l),o=(null==n||null==(a=n.getBookingDate)?void 0:a.call(n))??(null==r?void 0:r.date);return{...e3.current,date:e1w(o,e3.current.date)}}}:void 0,[ew,eS,eT]);return(0,eB.jsx)(dy,{value:eU,children:(0,eB.jsx)(eCx,{destroyOnUnmount:f,osKey:eT,enableMultiCurrencySettlement:d,solution:"unifiedBookingSales",moduleAccess:c?"existing":"ensure",lifecycleOwner:p,orderId:m,autoBootstrap:g??!!m,autoRestoreOnInit:h,restoreOrderAfterPaidCheckout:v,businessCode:y,bookingConfigParams:b,resourceIdFromCalendar:x,bookingTimeRangeFromCalendar:k,autoInitBookingContext:_,otherParams:e1,inventory:S,checkoutHooks:j,deferHolderAuthOnClose:"kiosk"===ez||eL,enablePromotionCodeCustomerAuth:eL&&"kiosk"===eK.platform,enableCustomerAuthHost:"kiosk"===ez&&eK.enableCustomerAuthHost||eL&&eKE({otherParams:w}),shouldMergeProductLines:eC,rulesHooks:N,legacyOpenProductDetail:e8,uiHosts:C,awaitAllergyConfirmation:M,normalProductDetailConfig:eJ,mergeBookingLinesForDisplay:!!eX||I,enableTempOrderPersist:Y,enableTempOrderSync:W,isActive:G,catalogPreparation:K,preserveProductCatalogOnInactiveCustomerClear:Q,enableGlobalScanListener:"HDLKiosk"!==ez&&J,scanRequest:X,onScanRequestAccepted:ee,onScanRequestSettled:et,scanScope:el,onScanPromotionResult:ei,suppressCartIneligibleScanToast:!0,promotionScanSuccessMessageKey:ea,promotionItemIncreaseMessageKey:en??(e$?"pisell2.big-sale.kiosk.offer-added-success":void 0),defaultProductLoadParams:L,autoReloadProductCatalogOnCustomerChange:!eL&&Z,promotionProductSource:eL?"catalog-only":void 0,enableMenuOverride:R,children:(0,eB.jsxs)(eCw,{children:[(0,eB.jsx)(e1S,{runtimeRef:e3}),ed,(0,eB.jsx)(e1x,{isActive:G,catalogPreparation:K,osKey:s,mode:P,variant:eQ,kioskShellLayout:eZ,kioskAppearance:"kiosk"===ez?eK.appearance:void 0,template:ez,venueBookingConfig:O,productLoadParams:L,productDisplayConfig:$,productCatalogSessionKey:q,productCatalogReady:B,saleDetailTemplate:H,saleDetailModuleConfig:e4,autoCreate:U,orderId:m,className:er,style:eo,locale:eU,onLocaleChange:"HDLKiosk"===ez?eY:void 0,saleDetailWrapperProps:eW?eE:void 0,cartProductsPerRow:eW?eA:void 0,showClient:eW?eD:void 0,businessCode:y,bookingConfigParams:b,hideSelectFloorMapResourceAction:F,saleDetailHeaderSlot:ec,rightActionBarClose:eu,overlaySlot:ep,onOrderComplete:em,onPaidCheckout:eg,onPaymentPageActiveChange:eh,onRequestHome:ev,renderCatalog:ef,externalActionRequest:ey,onExternalActionAccepted:eb,onExternalPaymentSettled:ex}),eW?eO:null]})})})};e1j.displayName="BigSale";let e1N=e1j,e1C={catalogTitle:"Choose your items",catalogHint:"Add the options you want, then review your order.",catalogQuantity:"Quantity",catalogAdded:"Added",catalogSoldOut:"Sold Out",catalogUnavailable:"Currently unavailable",catalogUnavailableLabel:"Unavailable",catalogLimitReached:"Limit reached",collectQuotaReached:"No redemptions left",catalogEmpty:"No products are available on this machine.",catalogUpdateFailed:"Unable to update your selection. Please try again.",catalogOrderActions:"Order actions",catalogToPay:"To pay",catalogCart:"View order, {count} items",catalogCheckout:"Checkout",catalogConfirmOrder:"Confirm",catalogPromotion:"Promotion",collectAlsoBuy:"Also buy something?",catalogCartEmpty:"Your cart is empty.",collectTitle:"Items to Redeem",collectAvailable:"Available",collectSelected:"Selected",collectRemaining:"Remaining",collectVoucherCount:"{count} vouchers",collectGroupSelected:"Selected {selected} of {total}",collectSelectedCount:"Selected {selected}",collectSelect:"Select",collectSkuRemaining:"{remaining} of {total} left",collectSkuConfirm:"Confirm",collectSkuCancel:"Cancel",collectRedeem:"Redeem",collectNoProducts:"No redeemable products are available on this machine.",collectInvalid:"Your selection no longer matches the available vouchers. Please adjust it.",collectLimit:"No more items can be selected with this voucher group.",collectScanMore:"Scan to add more vouchers",collectDecrease:"Decrease {name}",collectIncrease:"Increase {name}",collectRemove:"Remove {name}",collectUnsupported:"Please scan a product voucher on this page.",channelTest:"Test",channelTesting:"Testing…",channelTestSuccess:"Test successful",channelTestFailed:"Test failed",channelTestUnknown:"Test result needs checking",channelTestHint:"Testing runs one dispense. Stock is not updated automatically; enter the physical quantity remaining after testing.",reviewTitle:"Review restock",reviewDescription:"Check the products and quantities against the loaded stock before confirming. Channels sharing one inventory space are counted once.",reviewDetails:"Channel changes",reviewBefore:"Qty before",reviewDelta:"Change",reviewProductRemoved:"Remove previous product",reviewProductAdded:"Bind new product",reviewSummary:"Changes by product",reviewAdded:"Added",reviewRemoved:"Removed",reviewTotals:"Total: {added} added \xb7 {removed} removed",reviewConfirm:"Confirm and submit",stockSyncPending:"Submitted. Waiting for the stock records to update. Please do not submit again.",stockSyncReview:"Stock changes need checking. Refresh only queries the stock; it does not submit again. Contact staff if the changes remain unconfirmed.",stockRefresh:"Refresh stock",restockChanged:"The stock or channel configuration has changed. Refresh and check the quantities before submitting.",restockReserved:"Some stock is reserved or unavailable. Check the physical and available stock before reducing it or changing the product.",dispenseStockReview:"Your dispensing results are shown above. Please keep your order number and contact a staff member.",inventoryUnavailable:"Stock could not be refreshed. Please retry.",inventoryUnmapped:"This variant has no configured inventory. Please contact staff.",inventoryInsufficient:"Only {quantity} available for {sku}. Please reduce the quantity.",dispensePluginNotReady:"The dispensing plugin is not ready. Please contact staff.",dispenseInventoryInsufficient:"There is not enough stock to dispense this item. Please contact staff.",brand:"Welcome",poweredBy:"Powered by Pisell",machine:"Vending machine",idleTitle:"Grip socks, right here.",idleDescription:"Buy a pair or redeem the socks you already paid for.",touch:"Touch to start",promoTitle:"Adult sizes are in",promoDescription:"EU 39–46 in black, navy and coral.",partyPromoTitle:"Party packs",partyPromoDescription:"Book a party and socks are included for every guest.",memberPromoTitle:"Members save 10%",memberPromoDescription:"Scan your member code before you pay.",scanHint:"Have a wristband or a QR code? Hold it under the scanner any time.",homeTitle:"Get Your Grip Socks",language:"Language",homeDescription:"Grip socks are required in the play area. Choose an option below.",homePreparing:"Getting ready…",buy:"Buy Socks",buyDescription:"Choose a size and pay here",redeem:"Redeem Socks",redeemDescription:"Scan your wristband, or a QR code or barcode from your order or booking.",redeemTitle:"Find Your Account",redeemFindDescription:"Scan your code, or enter your Sale Number or code below.",redeemCodeLabel:"Enter Your Code Manually",redeemCodePlaceholder:"Enter your code",redeemCodeHint:"Enter the code as shown on your wristband, voucher or booking.",redeemContinue:"Continue",redeemClearCode:"Clear code",redeemScanPrompt:"Scan your QR code or barcode",redeemScannerLocation:"Hold it under the scanner below.",redeemOr:"Or",redeemTypeWristband:"Wristband",redeemTypeWallet:"Member Wallet",redeemTypeVoucher:"Voucher",redeemTypeReceipt:"Sale Receipt",scannedCode:"Scanned code",waitingForScan:"Waiting for scan…",scannedCodeHint:"Your scanned code will appear here automatically.",scanPreparing:"Getting ready for your purchase",scanPreparingHint:"Please wait. The shopping page will open automatically.",scanPrepareFailed:"Unable to open the shopping page",scanPrepareFailedHint:"Please try again, or go back to start over.",scanResolveFailed:"The code is invalid",scanProcessing:"Processing…",scanNoVouchers:"No valid product vouchers were found.",scanVoucherNotStarted:"Your product vouchers are not valid yet.",scanVoucherExpired:"Your product vouchers have expired.",scanVoucherUnavailable:"Your product vouchers cannot be redeemed at this time.",scanUnrecognized:"This code could not be used. Please try another code.",help:"Help",contact:"If you have any problems, please contact a staff member.",back:"Back",home:"Back to home",staffSignIn:"Staff sign in",staffDescription:"Choose your name and enter your PIN to access machine service.",settingsDescription:"Choose your name and enter your PIN to open settings.",selectStaff:"Select staff",enterId:"Enter staff ID",verify:"Verify",staff:"Staff",signOut:"Sign out",welcomeStaff:"Hello, {name}",staffHome:"Machine service",resume:"Resume customer service",configure:"Configure and Restock",configureDescription:"Set the product and the quantity in each channel after loading, then submit once.",configureCard:"Manage products and stock by channel",sellable:"Sellable now",low:"Low",empty:"Empty",unavailable:"Out of service",inline:"Inline Edit",cards:"Card View",all:"All",changed:"Changed",row:"Row",channel:"Channel",channels:"Channels",productStock:"Product and stock",quantityAfter:"Qty after",action:"Action",current:"Current",capacity:"of {capacity}",noProduct:"No product",fill:"Fill",fillAll:"Fill all channels",board:"Control board",restockDraftOnly:"Stock changes cannot be saved yet. Edits stay on this page until you leave.",restockDeviceMissing:"No linked device was found. Check the device settings and try again.",restockConfigurationInvalid:"Check the control board, channel count and maximum capacity in the device settings.",restockDataInvalid:"The inventory response could not be read. Please try again.",restockUnconfigured:"No inventory space is configured for this channel.",restockSpaceMissing:"The configured inventory space could not be found.",restockSpaceInactive:"This inventory space is inactive.",restockMultipleProducts:"Multiple products are bound to this space. Check the channel configuration.",restockProductMissing:"The bound product could not be found.",restockProductInactive:"The bound product is inactive.",restockStockInvalid:"The stock quantity needs checking. Only whole items can be restocked.",restockCapacityExceeded:"Current stock exceeds the configured capacity. Check the stock and capacity.",reset:"Reset",pending:"Pending Changes",submit:"Submit Changes",done:"Done",editChannel:"Channel {code}",cardHint:"Tap a channel to set its product and quantity.",loadError:"Unable to load data. Please try again.",saveError:"Changes could not be saved. Your edits have been kept.",retry:"Retry",loading:"Loading…",saving:"Saving…",saved:"Changes saved",noChannels:"No channels available",noMatches:"No matching channels",discardTitle:"Discard unsaved changes?",discardDescription:"Your channel edits have not been submitted.",discard:"Discard changes",keepEditing:"Keep editing",invalidQuantity:"Enter a whole number between 0 and the channel capacity.",blocked:"Blocked",disabled:"Disabled",product:"Product",quantity:"Quantity after loading",dispensing:"On the way",dispenseDescription:"Your items drop one at a time.",preparing:"Preparing your order",dispensingNow:"Dispensing",waiting:"Waiting",success:"Dropped",failed:"Not dispensed",dispenseUncertain:"Needs checking",dispenseUncertainDescription:"The dispense result could not be confirmed. Please ask a staff member to check the pickup door.",dispenseMappingMissing:"This product has no configured channel. Please contact a staff member.",dispenseMappingInvalid:"The product channel needs to be checked by a staff member.",dispenseUnsupported:"This device cannot dispense items. Please contact a staff member.",dispenseBusy:"The machine is busy. Please contact a staff member.",dispenseBoardOffline:"The product channel is offline. Please contact a staff member.",dispenseNotReady:"The machine is not connected or ready. Please contact a staff member.",dispenseFailedDescription:"This item could not be dispensed. Please contact a staff member.",summaryUncertain:"{success} dispensed \xb7 {failed} not dispensed \xb7 {uncertain} need checking",progress:"{done} of {total} items processed",complete:"Enjoy!",completeDescription:"Thanks for shopping with {brand}.",partial:"Some items need attention",partialDescription:"Your payment is complete. A staff member can help with the remaining items.",postPaymentError:"Your order is paid. Please contact a staff member to complete collection.",redemptionPartialDescription:"A staff member can help with the remaining items.",redemptionCollectionError:"Please contact a staff member to complete collection.",summary:"{success} dispensed \xb7 {failed} not dispensed",returning:"Back to start in {seconds}s",itemNumber:"Item {number}",itemTotal:"of {total}",droppedTotal:"of {total} dropped",droppedCount:"{count} dropped",collectDescription:"Take them from the pickup door below.",pickupTip:"Your items drop into the pickup door below this screen.",waitUntilFinished:"Please wait until every item has dropped.",order:"Order {id}"},e1M={en:e1C,"zh-CN":{catalogTitle:"选择商品",catalogHint:"选择所需规格和数量,然后确认订单。",catalogQuantity:"数量",catalogAdded:"已添加",catalogSoldOut:"已售罄",catalogUnavailable:"暂不可购买",catalogUnavailableLabel:"暂不可购买",catalogLimitReached:"已达可选上限",collectQuotaReached:"可兑换额度已用完",catalogEmpty:"本机暂无可购买的商品。",catalogUpdateFailed:"无法更新所选商品,请重试。",catalogOrderActions:"订单操作",catalogToPay:"待支付",catalogCart:"查看订单,共 {count} 件商品",catalogCheckout:"去结算",catalogConfirmOrder:"确认",catalogPromotion:"优惠",collectAlsoBuy:"还想买些商品?",catalogCartEmpty:"购物车为空,请先选择商品。",collectTitle:"兑换商品",collectAvailable:"可领取",collectSelected:"已选择",collectRemaining:"还可选择",collectVoucherCount:"{count} 张券",collectGroupSelected:"已选 {selected} / {total}",collectSelectedCount:"已选 {selected}",collectSelect:"选择规格",collectSkuRemaining:"还可选 {remaining} / {total}",collectSkuConfirm:"确认",collectSkuCancel:"取消",collectRedeem:"确认领取",collectNoProducts:"本机暂无可兑换的商品。",collectInvalid:"所选商品与可用券不匹配,请调整选择。",collectLimit:"这组券的可选数量已用完。",collectScanMore:"可继续扫码添加商品券",collectDecrease:"减少 {name}",collectIncrease:"增加 {name}",collectRemove:"删除 {name}",collectUnsupported:"此页面仅支持扫描商品兑换券。",channelTest:"测试",channelTesting:"测试中…",channelTestSuccess:"测试成功",channelTestFailed:"测试失败",channelTestUnknown:"测试结果待核对",channelTestHint:"测试会触发一次出货,库存不会自动调整;请按测试后的实物填写数量。",reviewTitle:"核对补货",reviewDescription:"请按实物核对以下商品和数量,确认后再提交。共用同一货位的货道只统计一次。",reviewDetails:"货道变更明细",reviewBefore:"原数量",reviewDelta:"变动数量",reviewProductRemoved:"移除原商品",reviewProductAdded:"绑定新商品",reviewSummary:"商品数量汇总",reviewAdded:"增加",reviewRemoved:"减少",reviewTotals:"合计增加 {added} 件 \xb7 减少 {removed} 件",reviewConfirm:"确认并提交",stockSyncPending:"已提交,正在等待库存记录更新,请勿重复提交。",stockSyncReview:"库存变更待核对。刷新只查询库存,不会重复提交;仍未确认时请联系工作人员。",stockRefresh:"刷新库存",restockChanged:"库存或货道配置已变化,请刷新并核对数量后再提交。",restockReserved:"部分库存已预占或不可用,请核对真实库存和可用库存后再减量或更换商品。",dispenseStockReview:"出货结果如上,请保留订单号并联系工作人员。",inventoryUnavailable:"库存刷新失败,请重试。",inventoryUnmapped:"该规格尚未配置库存,请联系工作人员。",inventoryInsufficient:"{sku} 当前可用库存为 {quantity},请减少购买数量。",dispensePluginNotReady:"出货插件尚未就绪,请联系工作人员。",dispenseInventoryInsufficient:"该商品可出货库存不足,请联系工作人员。",brand:"欢迎光临",poweredBy:"Pisell 技术支持",machine:"自动售货机",idleTitle:"防滑袜,就在这里。",idleDescription:"购买一双新袜子,或领取已付款的袜子。",touch:"轻触屏幕,开始选购",promoTitle:"成人尺码已到货",promoDescription:"欧码 39–46,黑色、藏青色和珊瑚色。",partyPromoTitle:"派对套装",partyPromoDescription:"预订派对,每位宾客均可获赠一双袜子。",memberPromoTitle:"会员享九折",memberPromoDescription:"付款前扫描你的会员码。",scanHint:"有腕带或二维码?随时放到扫描器下方即可。",homeTitle:"获取你的防滑袜",language:"语言",homeDescription:"游乐区内须穿防滑袜。请选择下方选项。",homePreparing:"准备中…",buy:"购买袜子",buyDescription:"选择尺码并在这里付款",redeem:"领取袜子",redeemDescription:"扫描腕带,或订单、预订中的二维码或条形码。",redeemTitle:"查找你的账户",redeemFindDescription:"扫描你的码,或在下方手动输入订单号或兑换码。",redeemCodeLabel:"手动输入你的码",redeemCodePlaceholder:"请输入你的码",redeemCodeHint:"请按照手环、券或预订信息上的内容输入。",redeemContinue:"继续",redeemClearCode:"清空输入",redeemScanPrompt:"扫描你的二维码或条形码",redeemScannerLocation:"请将码放在屏幕下方的扫描器处。",redeemOr:"或",redeemTypeWristband:"手环",redeemTypeWallet:"会员钱包",redeemTypeVoucher:"兑换券",redeemTypeReceipt:"销售小票",scannedCode:"扫码结果",waitingForScan:"等待扫码…",scannedCodeHint:"扫描完成后,码会自动显示在这里。",scanPreparing:"正在准备购买页面",scanPreparingHint:"请稍候,准备完成后将自动进入。",scanPrepareFailed:"购买页面暂时无法打开",scanPrepareFailedHint:"请重试,或返回重新开始。",scanResolveFailed:"此码无效",scanProcessing:"处理中…",scanNoVouchers:"未找到有效商品券。",scanVoucherNotStarted:"商品券尚未到兑换时间。",scanVoucherExpired:"商品券已过期。",scanVoucherUnavailable:"商品券暂时无法兑换。",scanUnrecognized:"此码无法使用,请尝试其他码。",help:"帮助",contact:"如有问题,请联系工作人员。",back:"返回",home:"返回首页",staffSignIn:"员工验证",staffDescription:"选择员工并输入 PIN,进入设备管理。",settingsDescription:"选择员工并输入 PIN,进入设置页面。",selectStaff:"选择员工",enterId:"输入员工 ID",verify:"验证",staff:"员工",signOut:"退出员工模式",welcomeStaff:"你好,{name}",staffHome:"设备管理",resume:"恢复顾客服务",configure:"配置与补货",configureDescription:"装货后设置各货道的商品和数量,完成后统一提交。",configureCard:"管理各货道的商品与库存",sellable:"当前可售",low:"低库存",empty:"空货道",unavailable:"暂停使用",inline:"行内编辑",cards:"卡片视图",all:"全部",changed:"已修改",row:"排",channel:"货道",channels:"个货道",productStock:"商品与库存",quantityAfter:"补货后数量",action:"操作",current:"当前",capacity:"容量 {capacity}",noProduct:"未绑定商品",fill:"补满",fillAll:"全部填满",board:"控制板",restockDraftOnly:"暂不支持保存库存变更,编辑内容仅保留在当前页面,离开后不会保存。",restockDeviceMissing:"未找到当前绑定设备,请检查设备设置后重试。",restockConfigurationInvalid:"请检查设备设置中的控制板、货道数量和最大容量。",restockDataInvalid:"库存数据格式异常,请重试。",restockUnconfigured:"该货道尚未配置库存货位。",restockSpaceMissing:"未找到该货道配置的库存货位。",restockSpaceInactive:"该库存货位已停用。",restockMultipleProducts:"该货位绑定了多种货品,请检查货道配置。",restockProductMissing:"未找到该货位绑定的货品。",restockProductInactive:"该货位绑定的货品已停用。",restockStockInvalid:"库存数量异常,请核对;补货数量必须为整件。",restockCapacityExceeded:"当前库存超过配置容量,请核对库存和容量设置。",reset:"重置",pending:"待提交修改",submit:"提交修改",done:"完成",editChannel:"货道 {code}",cardHint:"点击货道,设置商品和数量。",loadError:"数据加载失败,请重试。",saveError:"提交失败,已保留你的修改。",retry:"重试",loading:"加载中…",saving:"提交中…",saved:"修改已保存",noChannels:"暂无货道",noMatches:"暂无符合条件的货道",discardTitle:"放弃未提交的修改?",discardDescription:"当前货道修改尚未提交。",discard:"放弃修改",keepEditing:"继续编辑",invalidQuantity:"请输入 0 到货道容量之间的整数。",blocked:"已阻塞",disabled:"已停用",product:"商品",quantity:"补货后数量",dispensing:"正在为你出货",dispenseDescription:"商品将逐件出货,请稍候。",preparing:"正在准备订单",dispensingNow:"正在出货",waiting:"等待出货",success:"出货成功",failed:"出货失败",dispenseUncertain:"需要核对",dispenseUncertainDescription:"出货结果无法确认,请工作人员核对取货口的实物。",dispenseMappingMissing:"该商品尚未配置货道,请联系工作人员。",dispenseMappingInvalid:"商品货道配置有误,请联系工作人员核对。",dispenseUnsupported:"当前设备暂不支持出货,请联系工作人员。",dispenseBusy:"设备正忙,请联系工作人员。",dispenseBoardOffline:"该商品所在货道未连接,请联系工作人员。",dispenseNotReady:"设备未连接或尚未就绪,请联系工作人员。",dispenseFailedDescription:"该商品未能出货,请联系工作人员。",summaryUncertain:"成功 {success} 件 \xb7 未出货 {failed} 件 \xb7 待核对 {uncertain} 件",progress:"已处理 {done} / {total} 件",complete:"祝你玩得开心!",completeDescription:"感谢你在 {brand} 购物。",partial:"部分商品需要工作人员协助",partialDescription:"订单已支付,请联系工作人员处理未出货的商品。",postPaymentError:"订单已支付,请联系工作人员协助取货。",redemptionPartialDescription:"请联系工作人员处理未出货的商品。",redemptionCollectionError:"请联系工作人员协助取货。",summary:"成功 {success} 件 \xb7 未出货 {failed} 件",returning:"{seconds} 秒后返回首页",itemNumber:"第 {number} 件",itemTotal:"/ 共 {total} 件",droppedTotal:"/ {total} 件已出货",droppedCount:"已出货 {count} 件",collectDescription:"请从下方取货口取走你的商品。",pickupTip:"商品会掉落到屏幕下方的取货口。",waitUntilFinished:"请等待所有商品出货完成。",order:"订单 {id}"},"zh-HK":{catalogTitle:"選擇商品",catalogHint:"選擇所需規格和數量,然後確認訂單。",catalogQuantity:"數量",catalogAdded:"已加入",catalogSoldOut:"已售罄",catalogUnavailable:"暫不可購買",catalogUnavailableLabel:"暫不可購買",catalogLimitReached:"已達可選上限",collectQuotaReached:"可兌換額度已用完",catalogEmpty:"本機暫無可購買的商品。",catalogUpdateFailed:"無法更新所選商品,請重試。",catalogOrderActions:"訂單操作",catalogToPay:"待支付",catalogCart:"查看訂單,共 {count} 件商品",catalogCheckout:"去結算",catalogConfirmOrder:"確認",catalogPromotion:"優惠",collectAlsoBuy:"還想買些商品?",catalogCartEmpty:"購物車為空,請先選擇商品。",collectTitle:"兌換商品",collectAvailable:"可領取",collectSelected:"已選擇",collectRemaining:"還可選擇",collectVoucherCount:"{count} 張券",collectGroupSelected:"已選 {selected} / {total}",collectSelectedCount:"已選 {selected}",collectSelect:"選擇規格",collectSkuRemaining:"還可選 {remaining} / {total}",collectSkuConfirm:"確認",collectSkuCancel:"取消",collectRedeem:"確認領取",collectNoProducts:"本機暫無可兌換的商品。",collectInvalid:"所選商品與可用券不匹配,請調整選擇。",collectLimit:"這組券的可選數量已用完。",collectScanMore:"可繼續掃碼添加商品券",collectDecrease:"減少 {name}",collectIncrease:"增加 {name}",collectRemove:"刪除 {name}",collectUnsupported:"此頁面僅支援掃描商品兌換券。",channelTest:"測試",channelTesting:"測試中…",channelTestSuccess:"測試成功",channelTestFailed:"測試失敗",channelTestUnknown:"測試結果待核對",channelTestHint:"測試會觸發一次出貨,庫存不會自動調整;請按測試後的實物填寫數量。",reviewTitle:"核對補貨",reviewDescription:"請按實物核對以下商品和數量,確認後再提交。共用同一貨位的貨道只統計一次。",reviewDetails:"貨道變更明細",reviewBefore:"原數量",reviewDelta:"變動數量",reviewProductRemoved:"移除原商品",reviewProductAdded:"綁定新商品",reviewSummary:"商品數量彙總",reviewAdded:"增加",reviewRemoved:"減少",reviewTotals:"合計增加 {added} 件 \xb7 減少 {removed} 件",reviewConfirm:"確認並提交",stockSyncPending:"已提交,正在等待庫存記錄更新,請勿重複提交。",stockSyncReview:"庫存變更待核對。重新整理只查詢庫存,不會重複提交;仍未確認時請聯絡工作人員。",stockRefresh:"重新整理庫存",restockChanged:"庫存或貨道設定已變更,請重新整理並核對數量後再提交。",restockReserved:"部分庫存已預留或不可用,請核對實際庫存和可用庫存後再減量或更換商品。",dispenseStockReview:"出貨結果如上,請保留訂單號並聯絡工作人員。",inventoryUnavailable:"庫存更新失敗,請重試。",inventoryUnmapped:"此規格尚未配置庫存,請聯絡工作人員。",inventoryInsufficient:"{sku} 目前可用庫存為 {quantity},請減少購買數量。",dispensePluginNotReady:"出貨插件尚未就緒,請聯絡工作人員。",dispenseInventoryInsufficient:"此商品可出貨庫存不足,請聯絡工作人員。",brand:"歡迎光臨",poweredBy:"Pisell 技術支援",machine:"自動售貨機",idleTitle:"防滑襪,就在這裡。",idleDescription:"購買一雙新襪子,或領取已付款的襪子。",touch:"輕觸螢幕,開始選購",promoTitle:"成人尺碼已到貨",promoDescription:"歐碼 39–46,黑色、藏青色及珊瑚色。",partyPromoTitle:"派對套裝",partyPromoDescription:"預訂派對,每位賓客均可獲贈一雙襪子。",memberPromoTitle:"會員享九折",memberPromoDescription:"付款前掃描你的會員碼。",scanHint:"有腕帶或二維碼?隨時放到掃描器下方即可。",homeTitle:"取得你的防滑襪",language:"語言",homeDescription:"遊樂區內須穿防滑襪。請選擇下方選項。",homePreparing:"準備中…",buy:"購買襪子",buyDescription:"選擇尺碼並在這裡付款",redeem:"領取襪子",redeemDescription:"掃描腕帶,或訂單、預訂中的二維碼或條碼。",redeemTitle:"尋找你的帳戶",redeemFindDescription:"掃描你的碼,或在下方手動輸入訂單號或兌換碼。",redeemCodeLabel:"手動輸入你的碼",redeemCodePlaceholder:"請輸入你的碼",redeemCodeHint:"請按照手環、券或預訂資訊上的內容輸入。",redeemContinue:"繼續",redeemClearCode:"清空輸入",redeemScanPrompt:"掃描你的二維碼或條碼",redeemScannerLocation:"請將碼放在螢幕下方的掃描器處。",redeemOr:"或",redeemTypeWristband:"手環",redeemTypeWallet:"會員錢包",redeemTypeVoucher:"兌換券",redeemTypeReceipt:"銷售收據",scannedCode:"掃碼結果",waitingForScan:"等待掃碼…",scannedCodeHint:"掃描完成後,碼會自動顯示在這裡。",scanPreparing:"正在準備購買頁面",scanPreparingHint:"請稍候,準備完成後將自動進入。",scanPrepareFailed:"購買頁面暫時無法開啟",scanPrepareFailedHint:"請重試,或返回重新開始。",scanResolveFailed:"此碼無效",scanProcessing:"處理中…",scanNoVouchers:"未找到有效商品券。",scanVoucherNotStarted:"商品券尚未到兌換時間。",scanVoucherExpired:"商品券已過期。",scanVoucherUnavailable:"商品券暫時無法兌換。",scanUnrecognized:"此碼無法使用,請嘗試其他碼。",help:"協助",contact:"如有問題,請聯絡工作人員。",back:"返回",home:"返回首頁",staffSignIn:"員工驗證",staffDescription:"選擇員工並輸入 PIN,進入設備管理。",settingsDescription:"選擇員工並輸入 PIN,進入設定頁面。",selectStaff:"選擇員工",enterId:"輸入員工 ID",verify:"驗證",staff:"員工",signOut:"退出員工模式",welcomeStaff:"你好,{name}",staffHome:"設備管理",resume:"恢復顧客服務",configure:"配置與補貨",configureDescription:"裝貨後設定各貨道的商品和數量,完成後統一提交。",configureCard:"管理各貨道的商品與庫存",sellable:"目前可售",low:"低庫存",empty:"空貨道",unavailable:"暫停使用",inline:"行內編輯",cards:"卡片檢視",all:"全部",changed:"已修改",row:"排",channel:"貨道",channels:"個貨道",productStock:"商品與庫存",quantityAfter:"補貨後數量",action:"操作",current:"目前",capacity:"容量 {capacity}",noProduct:"未綁定商品",fill:"補滿",fillAll:"全部填滿",board:"控制板",restockDraftOnly:"暫不支援儲存庫存變更,編輯內容僅保留在目前頁面,離開後不會儲存。",restockDeviceMissing:"未找到目前綁定裝置,請檢查裝置設定後重試。",restockConfigurationInvalid:"請檢查裝置設定中的控制板、貨道數量和最大容量。",restockDataInvalid:"庫存資料格式異常,請重試。",restockUnconfigured:"此貨道尚未設定庫存貨位。",restockSpaceMissing:"未找到此貨道設定的庫存貨位。",restockSpaceInactive:"此庫存貨位已停用。",restockMultipleProducts:"此貨位綁定了多種貨品,請檢查貨道設定。",restockProductMissing:"未找到此貨位綁定的貨品。",restockProductInactive:"此貨位綁定的貨品已停用。",restockStockInvalid:"庫存數量異常,請核對;補貨數量必須為整件。",restockCapacityExceeded:"目前庫存超過設定容量,請核對庫存和容量設定。",reset:"重設",pending:"待提交修改",submit:"提交修改",done:"完成",editChannel:"貨道 {code}",cardHint:"點擊貨道,設定商品和數量。",loadError:"資料載入失敗,請重試。",saveError:"提交失敗,已保留你的修改。",retry:"重試",loading:"載入中…",saving:"提交中…",saved:"修改已儲存",noChannels:"暫無貨道",noMatches:"暫無符合條件的貨道",discardTitle:"放棄未提交的修改?",discardDescription:"目前貨道修改尚未提交。",discard:"放棄修改",keepEditing:"繼續編輯",invalidQuantity:"請輸入 0 到貨道容量之間的整數。",blocked:"已阻塞",disabled:"已停用",product:"商品",quantity:"補貨後數量",dispensing:"正在為你出貨",dispenseDescription:"商品將逐件出貨,請稍候。",preparing:"正在準備訂單",dispensingNow:"正在出貨",waiting:"等待出貨",success:"出貨成功",failed:"出貨失敗",dispenseUncertain:"需要核對",dispenseUncertainDescription:"出貨結果無法確認,請工作人員核對取貨口的實物。",dispenseMappingMissing:"此商品尚未配置貨道,請聯絡工作人員。",dispenseMappingInvalid:"商品貨道配置有誤,請聯絡工作人員核對。",dispenseUnsupported:"目前裝置暫不支援出貨,請聯絡工作人員。",dispenseBusy:"裝置正忙,請聯絡工作人員。",dispenseBoardOffline:"此商品所在貨道未連線,請聯絡工作人員。",dispenseNotReady:"裝置未連線或尚未就緒,請聯絡工作人員。",dispenseFailedDescription:"此商品未能出貨,請聯絡工作人員。",summaryUncertain:"成功 {success} 件 \xb7 未出貨 {failed} 件 \xb7 待核對 {uncertain} 件",progress:"已處理 {done} / {total} 件",complete:"祝你玩得開心!",completeDescription:"感謝你在 {brand} 購物。",partial:"部分商品需要工作人員協助",partialDescription:"訂單已付款,請聯絡工作人員處理未出貨的商品。",postPaymentError:"訂單已付款,請聯絡工作人員協助取貨。",redemptionPartialDescription:"請聯絡工作人員處理未出貨的商品。",redemptionCollectionError:"請聯絡工作人員協助取貨。",summary:"成功 {success} 件 \xb7 未出貨 {failed} 件",returning:"{seconds} 秒後返回首頁",itemNumber:"第 {number} 件",itemTotal:"/ 共 {total} 件",droppedTotal:"/ {total} 件已出貨",droppedCount:"已出貨 {count} 件",collectDescription:"請從下方取貨口取走你的商品。",pickupTip:"商品會掉落到螢幕下方的取貨口。",waitUntilFinished:"請等待所有商品出貨完成。",order:"訂單 {id}"},ja:{catalogTitle:"商品を選択",catalogHint:"種類と数量を選び、注文内容を確認してください。",catalogQuantity:"数量",catalogAdded:"追加済み",catalogSoldOut:"売り切れ",catalogUnavailable:"現在購入できません",catalogUnavailableLabel:"購入不可",catalogLimitReached:"選択上限に達しました",collectQuotaReached:"交換可能数に達しました",catalogEmpty:"この自販機で購入できる商品はありません。",catalogUpdateFailed:"選択内容を更新できませんでした。もう一度お試しください。",catalogOrderActions:"注文操作",catalogToPay:"お支払い額",catalogCart:"注文を確認、商品 {count} 点",catalogCheckout:"お会計へ",catalogConfirmOrder:"確認",catalogPromotion:"プロモーション",collectAlsoBuy:"商品も購入しますか?",catalogCartEmpty:"カートは空です。商品を選択してください。",collectTitle:"引き換え対象商品",collectAvailable:"受取可能",collectSelected:"選択済み",collectRemaining:"選択可能",collectVoucherCount:"{count} 枚の券",collectGroupSelected:"{total} 点中 {selected} 点選択",collectSelectedCount:"{selected} 点選択",collectSelect:"サイズを選択",collectSkuRemaining:"残り {remaining} / {total}",collectSkuConfirm:"確認",collectSkuCancel:"キャンセル",collectRedeem:"受け取る",collectNoProducts:"この端末で交換できる商品はありません。",collectInvalid:"選択した商品に利用できない券があります。選択を変更してください。",collectLimit:"このグループの選択可能数に達しました。",collectScanMore:"スキャンして商品券を追加",collectDecrease:"{name} を減らす",collectIncrease:"{name} を増やす",collectRemove:"{name} を削除",collectUnsupported:"この画面では商品引換券をスキャンしてください。",channelTest:"テスト",channelTesting:"テスト中…",channelTestSuccess:"テスト成功",channelTestFailed:"テスト失敗",channelTestUnknown:"テスト結果の確認が必要です",channelTestHint:"テストは1回の払い出しを実行します。在庫は自動更新されないため、テスト後の実物数量を入力してください。",reviewTitle:"補充内容を確認",reviewDescription:"商品と数量を実物と照合してから送信してください。同じ在庫位置を共有するレーンは1回だけ集計されます。",reviewDetails:"レーンの変更明細",reviewBefore:"変更前の数量",reviewDelta:"増減数",reviewProductRemoved:"元の商品を解除",reviewProductAdded:"新しい商品を設定",reviewSummary:"商品別の増減",reviewAdded:"追加",reviewRemoved:"減少",reviewTotals:"合計:{added}個追加 \xb7 {removed}個減少",reviewConfirm:"確認して送信",stockSyncPending:"送信済みです。在庫の更新を待っています。再送信しないでください。",stockSyncReview:"在庫変更の確認が必要です。更新ボタンは在庫の照会のみを行い、再送信しません。未確認のままの場合はスタッフにお問い合わせください。",stockRefresh:"在庫を更新",restockChanged:"在庫またはチャネル設定が変更されました。更新して数量を確認してから送信してください。",restockReserved:"一部の在庫は予約済み、または利用できません。在庫を確認してから数量の削減や商品変更を行ってください。",dispenseStockReview:"払出結果は上記のとおりです。注文番号を控えてスタッフにお問い合わせください。",inventoryUnavailable:"在庫を更新できませんでした。再試行してください。",inventoryUnmapped:"このバリエーションには在庫が設定されていません。スタッフにお問い合わせください。",inventoryInsufficient:"{sku} の在庫は {quantity} 点です。数量を減らしてください。",dispensePluginNotReady:"商品排出プラグインの準備ができていません。スタッフにお問い合わせください。",dispenseInventoryInsufficient:"この商品を排出する在庫が不足しています。スタッフにお問い合わせください。",brand:"ようこそ",poweredBy:"Pisell テクニカルサポート",machine:"自動販売機",idleTitle:"滑り止めソックスは、ここで。",idleDescription:"ソックスの購入や、お支払い済み商品の受け取りはこちら。",touch:"タッチして開始",promoTitle:"大人用サイズが入荷",promoDescription:"EU 39–46。ブラック、ネイビー、コーラル。",partyPromoTitle:"パーティーパック",partyPromoDescription:"パーティーをご予約いただくと、全員分のソックスが付いてきます。",memberPromoTitle:"会員は10%オフ",memberPromoDescription:"お支払い前に会員コードをスキャンしてください。",scanHint:"リストバンドやQRコードをスキャナーにかざしてください。",homeTitle:"滑り止めソックスを手に入れよう",language:"言語",homeDescription:"プレイエリアでは滑り止めソックスの着用が必要です。以下の選択肢からお選びください。",homePreparing:"準備中…",buy:"ソックスを購入",buyDescription:"サイズを選んで、ここでお支払い",redeem:"ソックスを受け取る",redeemDescription:"リストバンド、または注文・予約のQRコードやバーコードをスキャンしてください。",redeemTitle:"アカウントを探す",redeemFindDescription:"コードをスキャンするか、注文番号またはコードを入力してください。",redeemCodeLabel:"コードを手動で入力",redeemCodePlaceholder:"コードを入力",redeemCodeHint:"リストバンド、クーポン、予約に記載されたコードを入力してください。",redeemContinue:"続ける",redeemClearCode:"入力をクリア",redeemScanPrompt:"QRコードまたはバーコードをスキャン",redeemScannerLocation:"画面下のスキャナーにかざしてください。",redeemOr:"または",redeemTypeWristband:"リストバンド",redeemTypeWallet:"会員ウォレット",redeemTypeVoucher:"クーポン",redeemTypeReceipt:"レシート",scannedCode:"読み取ったコード",waitingForScan:"スキャン待ち…",scannedCodeHint:"読み取ったコードがここに自動で表示されます。",scanPreparing:"購入画面を準備しています",scanPreparingHint:"準備ができ次第、自動で画面が開きます。そのままお待ちください。",scanPrepareFailed:"購入画面を開けませんでした",scanPrepareFailedHint:"もう一度お試しいただくか、戻ってやり直してください。",scanResolveFailed:"このコードは無効です",scanProcessing:"処理中…",scanNoVouchers:"有効な商品引換券が見つかりませんでした。",scanVoucherNotStarted:"商品引換券の利用開始日時前です。",scanVoucherExpired:"商品引換券の有効期限が切れています。",scanVoucherUnavailable:"商品引換券は現在ご利用いただけません。",scanUnrecognized:"このコードは使用できません。別のコードをお試しください。",help:"ヘルプ",contact:"問題がある場合は、スタッフにお問い合わせください。",back:"戻る",home:"ホームに戻る",staffSignIn:"スタッフ認証",staffDescription:"スタッフを選択し、PIN を入力してください。",settingsDescription:"スタッフを選択し、PIN を入力して設定を開きます。",selectStaff:"スタッフを選択",enterId:"スタッフ ID を入力",verify:"確認",staff:"スタッフ",signOut:"スタッフモードを終了",welcomeStaff:"こんにちは、{name}",staffHome:"機器の管理",resume:"お客様サービスを再開",configure:"設定と補充",configureDescription:"補充後の商品と数量を設定し、まとめて送信してください。",configureCard:"各レーンの商品と在庫を管理",sellable:"販売可能",low:"在庫少",empty:"空",unavailable:"使用停止",inline:"一覧編集",cards:"カード表示",all:"すべて",changed:"変更あり",row:"列",channel:"レーン",channels:"レーン",productStock:"商品と在庫",quantityAfter:"補充後の数量",action:"操作",current:"現在",capacity:"容量 {capacity}",noProduct:"商品なし",fill:"満量",fillAll:"すべて満量にする",board:"制御基板",restockDraftOnly:"在庫変更はまだ保存できません。編集内容はこのページ内のみで保持されます。",restockDeviceMissing:"接続済みの端末が見つかりません。端末設定を確認して再試行してください。",restockConfigurationInvalid:"端末設定の制御基板、チャネル数、最大容量を確認してください。",restockDataInvalid:"在庫データを読み取れませんでした。再試行してください。",restockUnconfigured:"このチャネルには在庫保管場所が設定されていません。",restockSpaceMissing:"設定された在庫保管場所が見つかりません。",restockSpaceInactive:"この在庫保管場所は無効です。",restockMultipleProducts:"複数の商品が関連付けられています。チャネル設定を確認してください。",restockProductMissing:"関連付けられた商品が見つかりません。",restockProductInactive:"関連付けられた商品は無効です。",restockStockInvalid:"在庫数量を確認してください。補充数量は整数のみ指定できます。",restockCapacityExceeded:"現在の在庫が最大容量を超えています。在庫と容量設定を確認してください。",reset:"リセット",pending:"未送信の変更",submit:"変更を送信",done:"完了",editChannel:"レーン {code}",cardHint:"レーンをタップして商品と数量を設定します。",loadError:"データを読み込めません。再試行してください。",saveError:"保存できませんでした。編集内容は保持されています。",retry:"再試行",loading:"読み込み中…",saving:"保存中…",saved:"保存しました",noChannels:"レーンがありません",noMatches:"該当するレーンがありません",discardTitle:"未保存の変更を破棄しますか?",discardDescription:"レーンの変更はまだ送信されていません。",discard:"破棄",keepEditing:"編集を続ける",invalidQuantity:"0 から容量までの整数を入力してください。",blocked:"詰まり",disabled:"停止中",product:"商品",quantity:"補充後の数量",dispensing:"商品を準備しています",dispenseDescription:"商品を一つずつ排出しています。お待ちください。",preparing:"注文を準備中",dispensingNow:"排出中",waiting:"待機中",success:"排出済み",failed:"未排出",dispenseUncertain:"確認が必要です",dispenseUncertainDescription:"払い出し結果を確認できません。スタッフに取り出し口の確認を依頼してください。",dispenseMappingMissing:"この商品の投出口が設定されていません。スタッフにお知らせください。",dispenseMappingInvalid:"商品の投出口設定に問題があります。スタッフに確認を依頼してください。",dispenseUnsupported:"この端末では払い出しできません。スタッフにお知らせください。",dispenseBusy:"機器が使用中です。スタッフにお知らせください。",dispenseBoardOffline:"商品の投出口に接続できません。スタッフにお知らせください。",dispenseNotReady:"機器が未接続か準備中です。スタッフにお知らせください。",dispenseFailedDescription:"この商品を払い出しできませんでした。スタッフにお知らせください。",summaryUncertain:"排出済み {success} 点 \xb7 未排出 {failed} 点 \xb7 要確認 {uncertain} 点",progress:"{total} 点中 {done} 点処理済み",complete:"お楽しみください!",completeDescription:"{brand} でのお買い物、ありがとうございます。",partial:"スタッフの確認が必要です",partialDescription:"お支払いは完了しています。未排出の商品についてスタッフにお問い合わせください。",postPaymentError:"お支払いは完了しています。スタッフにお問い合わせください。",redemptionPartialDescription:"未排出の商品についてスタッフにお問い合わせください。",redemptionCollectionError:"スタッフにお問い合わせください。",summary:"排出済み {success} 点 \xb7 未排出 {failed} 点",returning:"{seconds} 秒後にホームに戻ります",itemNumber:"商品 {number}",itemTotal:"/ 全 {total} 点",droppedTotal:"/ {total} 点を排出済み",droppedCount:"{count} 点を排出済み",collectDescription:"下の取り出し口から商品をお取りください。",pickupTip:"商品はこの画面の下にある取り出し口に出てきます。",waitUntilFinished:"すべての商品の排出が終わるまでお待ちください。",order:"注文 {id}"},pt:{catalogTitle:"Escolha seus produtos",catalogHint:"Escolha as op\xe7\xf5es e quantidades e confira o pedido.",catalogQuantity:"Quantidade",catalogAdded:"Adicionado",catalogSoldOut:"Esgotado",catalogUnavailable:"Indispon\xedvel no momento",catalogUnavailableLabel:"Indispon\xedvel",catalogLimitReached:"Limite atingido",collectQuotaReached:"Sem resgates dispon\xedveis",catalogEmpty:"N\xe3o h\xe1 produtos dispon\xedveis nesta m\xe1quina.",catalogUpdateFailed:"N\xe3o foi poss\xedvel atualizar a sele\xe7\xe3o. Tente novamente.",catalogOrderActions:"A\xe7\xf5es do pedido",catalogToPay:"A pagar",catalogCart:"Ver pedido, {count} produtos",catalogCheckout:"Finalizar compra",catalogConfirmOrder:"Confirmar",catalogPromotion:"Promo\xe7\xf5es",collectAlsoBuy:"Quer comprar mais alguma coisa?",catalogCartEmpty:"O seu carrinho est\xe1 vazio.",collectTitle:"Itens para resgatar",collectAvailable:"Dispon\xedveis",collectSelected:"Selecionadas",collectRemaining:"Restantes",collectVoucherCount:"{count} vouchers",collectGroupSelected:"Selecionados {selected} de {total}",collectSelectedCount:"Selecionados {selected}",collectSelect:"Selecionar",collectSkuRemaining:"Restam {remaining} de {total}",collectSkuConfirm:"Confirmar",collectSkuCancel:"Cancelar",collectRedeem:"Resgatar",collectNoProducts:"N\xe3o h\xe1 produtos dispon\xedveis para resgate nesta m\xe1quina.",collectInvalid:"A sele\xe7\xe3o n\xe3o corresponde aos vouchers dispon\xedveis. Ajuste a sele\xe7\xe3o.",collectLimit:"O limite deste grupo de vouchers foi atingido.",collectScanMore:"Escaneie para adicionar vouchers",collectDecrease:"Diminuir {name}",collectIncrease:"Aumentar {name}",collectRemove:"Remover {name}",collectUnsupported:"Escaneie um voucher de produto nesta p\xe1gina.",channelTest:"Testar",channelTesting:"Testando…",channelTestSuccess:"Teste conclu\xeddo",channelTestFailed:"O teste falhou",channelTestUnknown:"Verifique o resultado do teste",channelTestHint:"O teste executa uma entrega. O estoque n\xe3o \xe9 atualizado automaticamente; informe a quantidade f\xedsica restante ap\xf3s o teste.",reviewTitle:"Revisar reposi\xe7\xe3o",reviewDescription:"Confira os produtos e as quantidades f\xedsicas antes de confirmar. Canais que compartilham a mesma posi\xe7\xe3o de estoque s\xe3o contados apenas uma vez.",reviewDetails:"Altera\xe7\xf5es por canal",reviewBefore:"Qtd. anterior",reviewDelta:"Varia\xe7\xe3o",reviewProductRemoved:"Remover produto anterior",reviewProductAdded:"Associar novo produto",reviewSummary:"Altera\xe7\xf5es por produto",reviewAdded:"Adicionados",reviewRemoved:"Removidos",reviewTotals:"Total: {added} adicionados \xb7 {removed} removidos",reviewConfirm:"Confirmar e enviar",stockSyncPending:"Enviado. Aguardando a atualiza\xe7\xe3o do estoque. N\xe3o envie novamente.",stockSyncReview:"As altera\xe7\xf5es de estoque precisam ser verificadas. Atualizar apenas consulta o estoque, sem reenviar. Entre em contato com um funcion\xe1rio se continuarem sem confirma\xe7\xe3o.",stockRefresh:"Atualizar estoque",restockChanged:"O estoque ou a configura\xe7\xe3o do canal mudou. Atualize e confira as quantidades antes de enviar.",restockReserved:"Parte do estoque est\xe1 reservada ou indispon\xedvel. Confira o estoque f\xedsico e dispon\xedvel antes de reduzir ou trocar o produto.",dispenseStockReview:"Os resultados da entrega est\xe3o acima. Guarde o n\xfamero do pedido e entre em contato com um funcion\xe1rio.",inventoryUnavailable:"N\xe3o foi poss\xedvel atualizar o estoque. Tente novamente.",inventoryUnmapped:"Esta variante n\xe3o tem estoque configurado. Entre em contato com um funcion\xe1rio.",inventoryInsufficient:"H\xe1 apenas {quantity} unidades de {sku} dispon\xedveis. Reduza a quantidade.",dispensePluginNotReady:"O plugin de entrega ainda n\xe3o est\xe1 pronto. Entre em contato com um funcion\xe1rio.",dispenseInventoryInsufficient:"N\xe3o h\xe1 estoque suficiente para entregar este item. Entre em contato com um funcion\xe1rio.",brand:"Bem-vindo",poweredBy:"Suporte t\xe9cnico Pisell",machine:"M\xe1quina de vendas",idleTitle:"Meias antiderrapantes, aqui.",idleDescription:"Compre um par ou retire as meias que voc\xea j\xe1 pagou.",touch:"Toque para come\xe7ar",promoTitle:"Tamanhos adultos dispon\xedveis",promoDescription:"EU 39–46 em preto, azul-marinho e coral.",partyPromoTitle:"Pacotes de festa",partyPromoDescription:"Reserve uma festa com meias inclu\xeddas para todos os convidados.",memberPromoTitle:"Membros economizam 10%",memberPromoDescription:"Leia seu c\xf3digo de membro antes de pagar.",scanHint:"Tem uma pulseira ou c\xf3digo QR? Aproxime do leitor a qualquer momento.",homeTitle:"Adquira suas meias antiderrapantes",language:"Idioma",homeDescription:"O uso de meias antiderrapantes \xe9 obrigat\xf3rio na \xe1rea de recrea\xe7\xe3o. Escolha uma op\xe7\xe3o abaixo.",homePreparing:"Preparando…",buy:"Comprar meias",buyDescription:"Escolha o tamanho e pague aqui",redeem:"Retirar meias",redeemDescription:"Leia sua pulseira ou o c\xf3digo QR ou de barras do seu pedido ou reserva.",redeemTitle:"Encontre sua conta",redeemFindDescription:"Leia seu c\xf3digo ou digite o n\xfamero do pedido ou c\xf3digo abaixo.",redeemCodeLabel:"Digite seu c\xf3digo manualmente",redeemCodePlaceholder:"Digite seu c\xf3digo",redeemCodeHint:"Digite o c\xf3digo como aparece na pulseira, no voucher ou na reserva.",redeemContinue:"Continuar",redeemClearCode:"Limpar c\xf3digo",redeemScanPrompt:"Leia seu c\xf3digo QR ou de barras",redeemScannerLocation:"Aproxime-o do leitor abaixo da tela.",redeemOr:"Ou",redeemTypeWristband:"Pulseira",redeemTypeWallet:"Carteira de membro",redeemTypeVoucher:"Voucher",redeemTypeReceipt:"Recibo",scannedCode:"C\xf3digo lido",waitingForScan:"Aguardando leitura…",scannedCodeHint:"O c\xf3digo lido aparecer\xe1 aqui automaticamente.",scanPreparing:"Preparando sua compra",scanPreparingHint:"Aguarde. A p\xe1gina de compras abrir\xe1 automaticamente.",scanPrepareFailed:"N\xe3o foi poss\xedvel abrir a p\xe1gina de compras",scanPrepareFailedHint:"Tente novamente ou volte para recome\xe7ar.",scanResolveFailed:"O c\xf3digo \xe9 inv\xe1lido",scanProcessing:"Processando…",scanNoVouchers:"Nenhum cupom de produto v\xe1lido foi encontrado.",scanVoucherNotStarted:"Seus cupons de produto ainda n\xe3o est\xe3o v\xe1lidos.",scanVoucherExpired:"Seus cupons de produto expiraram.",scanVoucherUnavailable:"Seus cupons de produto n\xe3o podem ser resgatados no momento.",scanUnrecognized:"Este c\xf3digo n\xe3o pode ser usado. Tente outro c\xf3digo.",help:"Ajuda",contact:"Se tiver algum problema, procure um funcion\xe1rio.",back:"Voltar",home:"Voltar ao in\xedcio",staffSignIn:"Acesso de funcion\xe1rios",staffDescription:"Escolha seu nome e digite seu PIN para gerenciar a m\xe1quina.",settingsDescription:"Escolha seu nome e digite seu PIN para abrir as configura\xe7\xf5es.",selectStaff:"Selecionar funcion\xe1rio",enterId:"Inserir ID",verify:"Verificar",staff:"Funcion\xe1rio",signOut:"Sair do modo funcion\xe1rio",welcomeStaff:"Ol\xe1, {name}",staffHome:"Gerenciar m\xe1quina",resume:"Retomar atendimento",configure:"Configurar e reabastecer",configureDescription:"Defina o produto e a quantidade de cada canal ap\xf3s abastecer e envie todas as altera\xe7\xf5es.",configureCard:"Gerencie produtos e estoque por canal",sellable:"Dispon\xedvel",low:"Baixo",empty:"Vazio",unavailable:"Fora de servi\xe7o",inline:"Editar lista",cards:"Ver cart\xf5es",all:"Todos",changed:"Alterados",row:"Linha",channel:"Canal",channels:"Canais",productStock:"Produto e estoque",quantityAfter:"Qtd. ap\xf3s",action:"A\xe7\xe3o",current:"Atual",capacity:"de {capacity}",noProduct:"Sem produto",fill:"Encher",fillAll:"Encher todos os canais",board:"Placa de controlo",restockDraftOnly:"Ainda n\xe3o \xe9 poss\xedvel guardar altera\xe7\xf5es de estoque. As edi\xe7\xf5es ficam apenas nesta p\xe1gina.",restockDeviceMissing:"Nenhum dispositivo ligado foi encontrado. Verifique as defini\xe7\xf5es e tente novamente.",restockConfigurationInvalid:"Verifique a placa, o n\xfamero de canais e a capacidade m\xe1xima nas defini\xe7\xf5es do dispositivo.",restockDataInvalid:"N\xe3o foi poss\xedvel ler os dados de estoque. Tente novamente.",restockUnconfigured:"Este canal n\xe3o tem uma posi\xe7\xe3o de estoque configurada.",restockSpaceMissing:"A posi\xe7\xe3o de estoque configurada n\xe3o foi encontrada.",restockSpaceInactive:"Esta posi\xe7\xe3o de estoque est\xe1 inativa.",restockMultipleProducts:"Esta posi\xe7\xe3o tem v\xe1rios produtos. Verifique a configura\xe7\xe3o do canal.",restockProductMissing:"O produto associado n\xe3o foi encontrado.",restockProductInactive:"O produto associado est\xe1 inativo.",restockStockInvalid:"Verifique a quantidade em estoque. A reposi\xe7\xe3o exige unidades inteiras.",restockCapacityExceeded:"O estoque atual excede a capacidade configurada. Verifique o estoque e a capacidade.",reset:"Redefinir",pending:"Altera\xe7\xf5es pendentes",submit:"Enviar altera\xe7\xf5es",done:"Concluir",editChannel:"Canal {code}",cardHint:"Toque em um canal para definir produto e quantidade.",loadError:"N\xe3o foi poss\xedvel carregar. Tente novamente.",saveError:"N\xe3o foi poss\xedvel salvar. Suas altera\xe7\xf5es foram mantidas.",retry:"Tentar novamente",loading:"Carregando…",saving:"Salvando…",saved:"Altera\xe7\xf5es salvas",noChannels:"Nenhum canal dispon\xedvel",noMatches:"Nenhum canal corresponde",discardTitle:"Descartar altera\xe7\xf5es n\xe3o salvas?",discardDescription:"As altera\xe7\xf5es dos canais ainda n\xe3o foram enviadas.",discard:"Descartar",keepEditing:"Continuar editando",invalidQuantity:"Insira um n\xfamero inteiro entre 0 e a capacidade do canal.",blocked:"Bloqueado",disabled:"Desativado",product:"Produto",quantity:"Quantidade ap\xf3s abastecer",dispensing:"Preparando seus produtos",dispenseDescription:"Aguarde enquanto entregamos um produto por vez.",preparing:"Preparando seu pedido",dispensingNow:"Entregando",waiting:"Aguardando",success:"Entregue",failed:"N\xe3o entregue",dispenseUncertain:"Requer verifica\xe7\xe3o",dispenseUncertainDescription:"N\xe3o foi poss\xedvel confirmar a entrega. Pe\xe7a a um funcion\xe1rio para verificar o compartimento de retirada.",dispenseMappingMissing:"Este produto n\xe3o tem um canal configurado. Contacte um funcion\xe1rio.",dispenseMappingInvalid:"A configura\xe7\xe3o do canal deste produto deve ser verificada por um funcion\xe1rio.",dispenseUnsupported:"Este dispositivo n\xe3o pode entregar produtos. Contacte um funcion\xe1rio.",dispenseBusy:"A m\xe1quina est\xe1 ocupada. Contacte um funcion\xe1rio.",dispenseBoardOffline:"O canal deste produto est\xe1 offline. Contacte um funcion\xe1rio.",dispenseNotReady:"A m\xe1quina n\xe3o est\xe1 ligada ou pronta. Contacte um funcion\xe1rio.",dispenseFailedDescription:"N\xe3o foi poss\xedvel entregar este produto. Contacte um funcion\xe1rio.",summaryUncertain:"{success} entregues \xb7 {failed} n\xe3o entregues \xb7 {uncertain} por verificar",progress:"{done} de {total} produtos processados",complete:"Aproveite!",completeDescription:"Obrigado por comprar com {brand}.",partial:"Alguns produtos precisam de aten\xe7\xe3o",partialDescription:"O pagamento foi conclu\xeddo. Procure um funcion\xe1rio para os produtos restantes.",postPaymentError:"Seu pedido est\xe1 pago. Procure um funcion\xe1rio para concluir a retirada.",redemptionPartialDescription:"Procure um funcion\xe1rio para os produtos restantes.",redemptionCollectionError:"Procure um funcion\xe1rio para concluir a retirada.",summary:"{success} entregues \xb7 {failed} n\xe3o entregues",returning:"Voltando ao in\xedcio em {seconds}s",itemNumber:"Item {number}",itemTotal:"de {total}",droppedTotal:"de {total} entregues",droppedCount:"{count} entregues",collectDescription:"Retire seus produtos na abertura de retirada abaixo.",pickupTip:"Seus produtos saem pela abertura de retirada abaixo desta tela.",waitUntilFinished:"Aguarde a entrega de todos os produtos.",order:"Pedido {id}"}};function e1T(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"en";return(e1M[l]||e1C)[e].replace(/\{(\w+)\}/g,(e,l)=>String(t[l]??e))}function e1I(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en";return"string"==typeof e?e:e&&(e[t]||e.original||e.en||Object.values(e).find(Boolean))||""}function e1P(){let e=db();return(0,eN.useMemo)(()=>({text:(t,l)=>e1T(t,l,e),localized:t=>e1I(t,e)}),[e])}let e1A=[{value:"en",label:"English"},{value:"zh-CN",label:"简体中文"},{value:"zh-HK",label:"繁體中文"},{value:"ja",label:"日本語"},{value:"pt",label:"Portugu\xeas"}];function e1D(e){let{locale:t,disabled:l,onChange:i}=e,{text:a}=e1P();return(0,eB.jsxs)("label",{className:"vm-customer-language","data-disabled":l,children:[(0,eB.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,eB.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,eB.jsx)("path",{d:"M3.5 12h17M12 3c2.7 2.6 4.1 5.6 4.1 9S14.7 18.4 12 21M12 3C9.3 5.6 7.9 8.6 7.9 12S9.3 18.4 12 21"})]}),(0,eB.jsx)("select",{"aria-label":a("language"),value:t,disabled:l,onChange:e=>{l||i(e.target.value)},children:e1A.map(e=>{let{value:t,label:l}=e;return(0,eB.jsx)("option",{value:t,lang:t,children:l},t)})}),(0,eB.jsx)("svg",{className:"vm-customer-language-chevron",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(0,eB.jsx)("path",{d:"m6 9 6 6 6-6"})})]})}function e1E(e){let{name:t}=e;return(0,eB.jsx)("span",{className:`vm-prototype-icon vm-prototype-icon-${t}`,"aria-hidden":"true"})}function e1O(e){let{children:t}=e;return(0,eB.jsx)("div",{className:"vm-customer-viewport",children:(0,eB.jsx)("div",{className:"vm-customer-canvas",children:t})})}let e1z=(0,eN.createContext)(void 0);function e1L(e){var t;let{name:l,subtitle:i,compact:a=!1}=e,n=null==(t=(0,eN.useContext)(e1z))?void 0:t.trim(),[r,o]=(0,eN.useState)(!1);return(0,eN.useEffect)(()=>o(!1),[n]),(0,eB.jsxs)("div",{className:`vm-customer-brand${a?" vm-customer-brand-compact":""}`,children:[n&&!r?(0,eB.jsx)("img",{className:"vm-customer-logo",src:n,alt:"",onError:()=>o(!0)},n):(0,eB.jsx)("span",{className:"vm-customer-monogram","aria-hidden":"true",children:Array.from(l.trim())[0]||"R"}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("p",{className:"vm-customer-brand-name",children:l}),!a&&(0,eB.jsx)("p",{className:"vm-customer-brand-subtitle",children:i})]})]})}function e1R(e){let{pill:t=!1}=e,{text:l}=e1P();return(0,eB.jsxs)("div",{className:`vm-customer-scan-hint${t?" vm-customer-scan-hint-pill":""}`,children:[(0,eB.jsx)(e1E,{name:"qr-code"}),(0,eB.jsx)("span",{children:l("scanHint")}),(0,eB.jsx)(e1E,{name:"arrow-down"})]})}function e1$(e){let{active:t,onRequestSettings:l}=e,i=db(),a=(0,eN.useRef)([]);return(0,eN.useEffect)(()=>{a.current=[]},[t]),(0,eB.jsx)("fieldset",{className:"vm-customer-technical-support",disabled:!t,children:(0,eB.jsx)(nB.PisellBrand,{locale:i,onClick:e=>{if(e.stopPropagation(),!t)return;let i=Date.now();a.current=[...a.current.filter(e=>i-e<3e3),i],a.current.length>=5&&(a.current=[],l())}})})}function e1F(e){let{brand:t,subtitle:l,active:i,onStart:a,onRequestSettings:n}=e,{text:r}=e1P();return(0,eB.jsxs)("section",{className:`vm-customer-idle${i?"":" vm-customer-paused"}`,children:[(0,eB.jsx)(e1$,{active:i,onRequestSettings:n}),(0,eB.jsxs)("div",{className:"vm-customer-shapes","aria-hidden":"true",children:[(0,eB.jsx)("span",{className:"vm-customer-blob vm-customer-blob-purple"}),(0,eB.jsx)("span",{className:"vm-customer-blob vm-customer-blob-lime"}),(0,eB.jsx)("span",{className:"vm-customer-blob vm-customer-blob-ring"}),(0,eB.jsx)("span",{className:"vm-customer-blob vm-customer-blob-soft"}),(0,eB.jsx)("span",{className:"vm-customer-blob vm-customer-blob-small"})]}),(0,eB.jsxs)("div",{className:"vm-customer-idle-layout",children:[(0,eB.jsxs)("header",{className:"vm-customer-idle-header",children:[(0,eB.jsx)(e1L,{name:t,subtitle:l}),(0,eB.jsxs)("div",{className:"vm-customer-idle-copy",children:[(0,eB.jsx)("h1",{children:r("idleTitle")}),(0,eB.jsx)("p",{children:r("idleDescription")})]})]}),(0,eB.jsx)("div",{className:"vm-customer-idle-actions",children:(0,eB.jsxs)("div",{className:"vm-customer-start",children:[(0,eB.jsxs)("div",{className:"vm-customer-touch","aria-hidden":"true",children:[(0,eB.jsx)("span",{className:"vm-customer-pulse"}),(0,eB.jsx)("span",{className:"vm-customer-pulse"}),(0,eB.jsx)("span",{className:"vm-customer-hand",children:(0,eB.jsx)(e1E,{name:"hand"})})]}),(0,eB.jsx)("p",{className:"vm-customer-touch-label",children:r("touch")})]})}),(0,eB.jsx)("div",{className:"vm-customer-idle-footer",children:(0,eB.jsx)(e1R,{pill:!0})})]}),(0,eB.jsx)("button",{type:"button",className:"vm-customer-idle-hitarea","aria-label":r("touch"),onClick:a})]})}function e1q(e){let{brand:t,machine:l,locale:i="en",languageDisabled:a=!1,onLocaleChange:n,active:r,ready:o,failed:s,onBuy:d,onRedeem:c,onHelp:u,onRetry:p,onRequestSettings:m,onStaffTap:g}=e,{text:h}=e1P();return(0,eB.jsxs)("section",{className:"vm-customer-home",children:[(0,eB.jsx)(e1$,{active:r,onRequestSettings:m}),(0,eB.jsxs)("header",{className:"vm-customer-home-header vm-customer-home-toolbar",children:[(0,eB.jsx)(e1L,{name:t,compact:!0}),n&&(0,eB.jsx)(e1D,{locale:i,disabled:!r||a,onChange:n})]}),(0,eB.jsxs)("div",{className:"vm-customer-home-content",children:[(0,eB.jsx)("h1",{children:h("homeTitle")}),(0,eB.jsx)("p",{className:"vm-customer-home-description",children:h("homeDescription")}),(0,eB.jsxs)("div",{className:"vm-customer-actions",children:[(0,eB.jsxs)("button",{type:"button",className:"vm-customer-buy",disabled:!o,onClick:d,children:[(0,eB.jsx)("span",{className:"vm-customer-buy-icon",children:(0,eB.jsx)(e1E,{name:"footprints"})}),(0,eB.jsxs)("span",{className:"vm-customer-buy-copy",children:[(0,eB.jsx)("span",{className:"vm-customer-buy-title",children:h("buy")}),(0,eB.jsx)("span",{className:"vm-customer-buy-description",children:h("buyDescription")})]}),(0,eB.jsx)(e1E,{name:"chevron-right"})]}),(0,eB.jsxs)("button",{type:"button",className:"vm-customer-buy vm-customer-redeem",onClick:c,children:[(0,eB.jsx)("span",{className:"vm-customer-buy-icon",children:(0,eB.jsx)(e1E,{name:"qr-code"})}),(0,eB.jsxs)("span",{className:"vm-customer-buy-copy",children:[(0,eB.jsx)("span",{className:"vm-customer-buy-title",children:h("redeem")}),(0,eB.jsx)("span",{className:"vm-customer-buy-description",children:h("redeemDescription")})]}),(0,eB.jsx)(e1E,{name:"chevron-right"})]})]}),!o&&s&&(0,eB.jsx)("div",{className:"vm-customer-load-error",children:(0,eB.jsx)(eM.Alert,{type:"error",message:h("loadError"),action:(0,eB.jsx)("button",{className:"vm-text-button",onClick:p,children:h("retry")})})}),(0,eB.jsx)(e1R,{})]}),(0,eB.jsxs)("footer",{className:"vm-customer-home-footer",children:[(0,eB.jsxs)("button",{type:"button",className:"vm-customer-help",onClick:u,children:[(0,eB.jsx)(e1E,{name:"life-buoy"}),h("help")]}),(0,eB.jsx)("div",{className:"vm-customer-machine-row",children:(0,eB.jsx)("button",{type:"button",className:"vm-customer-machine",tabIndex:-1,onClick:g,children:l})})]})]})}let e1B={pending:"waiting",dispensing:"dispensingNow",success:"success",failed:"failed",uncertain:"dispenseUncertain"},e1H={pending:"circle-dashed",dispensing:"loader-circle",success:"check",failed:"circle-alert",uncertain:"circle-alert"},e1V=e=>"failed"===e.status&&e.uncertain?"uncertain":e.status;function e1U(e){var t,l;let{brand:i,sale:a,isRedemption:n,progress:r,error:o,stage:s,seconds:d,onHome:c}=e,{text:u,localized:p}=e1P(),m=(0,eN.useRef)(null),g=(0,eN.useRef)(null),h=(null==r?void 0:r.items)||[],v=h.filter(e=>"success"===e.status).length,f=h.filter(e=>"failed"===e.status).length,y=h.filter(e=>"failed"===e.status&&e.uncertain).length,b=v+f,x=h.findIndex(e=>"dispensing"===e.status),k=null==(t=h[x>=0?x:b-1])?void 0:t.key,_=x>=0?x+1:Math.min(b+1,h.length),w="result"===s,S=n?"redemptionCollectionError":"postPaymentError",j=w&&!o&&(null==r?void 0:r.status)==="complete"&&h.length>0&&v===h.length;return(0,eN.useLayoutEffect)(()=>{let e=m.current,t=g.current;if(!e||!t)return;let l=()=>{if(!e.clientHeight||!e.offsetHeight)return;let l=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a=l.height/e.offsetHeight;if(a<=0)return;let n=(i.top-l.top)/a-e.clientTop,r=i.height/a;if(n>=16&&n+r<=e.clientHeight-16)return;let o=e.scrollTop+n-Math.max(16,(e.clientHeight-r)/2);e.scrollTo({top:Math.max(0,Math.min(o,e.scrollHeight-e.clientHeight)),behavior:"auto"})};l();let i=new ResizeObserver(l);return i.observe(e),i.observe(t),()=>i.disconnect()},[k,w]),(0,eB.jsxs)("section",{className:"vm-dispense-screen",children:[(0,eB.jsx)("header",{className:"vm-dispense-brand",children:(0,eB.jsx)(e1L,{name:i,compact:!0})}),(0,eB.jsxs)("div",{className:"vm-dispense-heading",children:[(0,eB.jsx)("h1",{children:u(w?j?"complete":"partial":"dispensing")}),(0,eB.jsx)("p",{children:u(o?S:w?j?"completeDescription":n?"redemptionPartialDescription":"partialDescription":"dispenseDescription",{brand:i})})]}),(0,eB.jsxs)("div",{className:"vm-dispense-content",ref:m,children:[h.length?(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsxs)("section",{className:"vm-dispense-progress-card","aria-live":"polite",children:[(0,eB.jsxs)("div",{className:"vm-dispense-counter-row",children:[(0,eB.jsxs)("p",{className:"vm-dispense-counter",children:[w?v:u("itemNumber",{number:_}),(0,eB.jsxs)("span",{children:[" ",u(w?"droppedTotal":"itemTotal",{total:h.length})]})]}),!w&&(0,eB.jsx)("p",{className:"vm-dispense-dropped",children:u("droppedCount",{count:v})})]}),(0,eB.jsx)("div",{className:"vm-dispense-segments",role:"progressbar","aria-label":u("progress",{done:b,total:h.length}),"aria-valuemin":0,"aria-valuemax":h.length,"aria-valuenow":b,children:h.map(e=>(0,eB.jsx)("span",{className:"vm-dispense-segment vm-dispense-segment-"+e1V(e)},e.key))})]}),(0,eB.jsx)("ol",{className:"vm-dispense-items",children:h.map(e=>(0,eB.jsxs)("li",{ref:e.key===k?g:void 0,className:"vm-dispense-item vm-dispense-item-"+e1V(e),children:[(0,eB.jsx)("span",{className:"vm-dispense-item-icon",children:(0,eB.jsx)(e1E,{name:e1H[e1V(e)]})}),(0,eB.jsxs)("div",{className:"vm-dispense-item-copy",children:[(0,eB.jsxs)("p",{className:"vm-dispense-item-title",title:[p(e.title),p(e.specification)].filter(Boolean).join(" "),children:[p(e.title),p(e.specification)&&(0,eB.jsxs)(eB.Fragment,{children:[" ",(0,eB.jsx)("span",{className:"vm-dispense-item-specification",children:p(e.specification)})]})]}),(0,eB.jsx)("p",{className:"vm-dispense-item-status",children:u(e1B[e1V(e)])}),"failed"===e.status&&e.message&&(0,eB.jsx)("p",{className:"vm-dispense-item-message",children:e.message})]})]},e.key))})]}):w?null:(0,eB.jsxs)("div",{className:"vm-dispense-preparing",role:"status",children:[(0,eB.jsx)(e1E,{name:"loader-circle"}),u("preparing")]}),w&&(0,eB.jsxs)("div",{className:"vm-dispense-collection-note"+(j?"":" vm-dispense-attention"),role:j?"note":"alert",children:[(0,eB.jsx)("span",{className:"vm-dispense-note-icon",children:(0,eB.jsx)(e1E,{name:j?"hand":"circle-alert"})}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("p",{children:u(j?"collectDescription":S)}),!j&&!!h.length&&(0,eB.jsx)("p",{className:"vm-dispense-summary",children:u(y?"summaryUncertain":"summary",{success:v,failed:h.length-v-y,uncertain:y})}),a&&(0,eB.jsx)("p",{className:"vm-dispense-order",children:u("order",{id:a.orderId})})]})]}),w&&(null==r||null==(l=r.inventorySync)?void 0:l.status)==="review"&&(0,eB.jsxs)("div",{className:"vm-dispense-collection-note vm-dispense-attention",role:"alert",children:[(0,eB.jsx)("span",{className:"vm-dispense-note-icon",children:(0,eB.jsx)(e1E,{name:"circle-alert"})}),(0,eB.jsx)("div",{children:(0,eB.jsx)("p",{children:u("dispenseStockReview")})})]})]}),(0,eB.jsxs)("footer",{className:"vm-dispense-footer",children:[(0,eB.jsxs)("div",{className:"vm-dispense-contact",role:"note",children:[(0,eB.jsx)("span",{className:"vm-dispense-contact-icon",children:(0,eB.jsx)(e1E,{name:"life-buoy"})}),(0,eB.jsx)("p",{children:u("contact")})]}),w&&(0,eB.jsxs)("button",{type:"button",className:"vm-dispense-button vm-dispense-button-primary",onClick:c,children:[(0,eB.jsx)(e1E,{name:"check"}),(0,eB.jsxs)("span",{children:[u("done"),j?` (${d}s)`:""]})]}),(0,eB.jsxs)("div",{className:"vm-dispense-pickup"+(w?"":" vm-dispense-pickup-pending"),role:"note",children:[(0,eB.jsx)("span",{className:"vm-dispense-pickup-icon",children:(0,eB.jsx)(e1E,{name:"arrow-down"})}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("p",{className:"vm-dispense-pickup-title",children:u("pickupTip")}),!w&&(0,eB.jsx)("p",{className:"vm-dispense-wait",children:u("waitUntilFinished")})]})]})]})]})}function e1Y(e){let{busy:t,pending:l=!1,primaryLabel:i,primaryIcon:a,primaryType:n="button",primaryDisabled:r=!1,secondaryAction:o,children:s,onBack:d,onPrimary:c}=e,{text:u}=e1P(),p=(0,eN.useRef)(null),[m,g]=(0,eN.useState)(0);(0,eN.useLayoutEffect)(()=>{var e;let t=null==(e=p.current)?void 0:e.parentElement;if(!t)return;let l=()=>{let e=window.getComputedStyle(t);g(Math.max(0,t.clientWidth-(parseFloat(e.paddingLeft)||0)-(parseFloat(e.paddingRight)||0)))};if(l(),"u">typeof ResizeObserver){let e=new ResizeObserver(e=>{let[t]=e;t&&g(t.contentRect.width)});return e.observe(t),()=>e.disconnect()}return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]);let h=[m<=1600?"vm-bar-compact":"",m<=1024?"vm-bar-stacked":"",m<=450?"vm-bar-narrow":""].filter(Boolean).join(" ");return(0,eB.jsxs)(eB.Fragment,{children:[o&&(0,eB.jsxs)("button",{className:`vm-bottom-bar-secondary ${h}`,type:"button",disabled:t,"aria-disabled":t||l,onClick:()=>{t||l||o.onClick()},children:[o.icon,(0,eB.jsx)("span",{children:o.label})]}),(0,eB.jsxs)("footer",{ref:p,className:`vm-bottom-bar vm-catalog-bar ${h}${s?" vm-bottom-bar--with-summary":""}`,style:{"--vm-bar-fluid-font-size":`${.05*m}px`},"aria-label":u("catalogOrderActions"),children:[(0,eB.jsxs)("button",{className:"vm-catalog-bar-button",type:"button",disabled:t,"aria-disabled":t||l,onClick:()=>{t||l||d()},children:[(0,eB.jsx)("svg",{className:"vm-catalog-bar-arrow",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(0,eB.jsx)("path",{d:"m15 5-7 7 7 7"})}),(0,eB.jsx)("span",{children:u("back")})]}),(0,eB.jsx)("div",{className:"vm-catalog-bar-summary","aria-live":s?"polite":void 0,children:s}),(0,eB.jsxs)("button",{className:"vm-catalog-bar-button vm-catalog-bar-next",type:n,disabled:t||r,"aria-disabled":t||l||r,onClick:e=>{t||l||r?e.preventDefault():null==c||c()},children:[(0,eB.jsx)("span",{children:i}),a]})]})]})}function e1W(e){let{quantity:t,busy:l,pending:i=!1,onReview:a}=e,{text:n}=e1P();return(0,eB.jsxs)("button",{className:"vm-catalog-bar-cart",type:"button",disabled:l||0===t,"aria-disabled":l||i||0===t,onClick:()=>{l||i||!(t>0)||a()},"aria-label":n("catalogCart",{count:t}),children:[(0,eB.jsx)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:(0,eB.jsx)("path",{d:"M6 8h12l1 12H5L6 8Zm3 0a3 3 0 0 1 6 0"})}),(0,eB.jsx)("strong",{children:t})]})}function e1G(e){let{quantity:t,total:l,amountDue:i,busy:a,pending:n=!1,onBack:r,onReview:o,onCheckout:s,onPromotion:d,promotionVisible:c=!1}=e,{text:u}=e1P();return(0,eB.jsxs)(e1Y,{busy:a,pending:n,onBack:r,primaryLabel:u(0===i?"catalogConfirmOrder":"catalogCheckout"),primaryIcon:(0,eB.jsx)("svg",{className:"vm-catalog-bar-arrow",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(0,eB.jsx)("path",{d:"m9 5 7 7-7 7"})}),onPrimary:s,children:[0!==i&&(0,eB.jsxs)("button",{className:"vm-catalog-bar-amount",type:"button",disabled:a||0===t,"aria-disabled":a||n||0===t,onClick:()=>{a||n||!(t>0)||o()},children:[(0,eB.jsx)("span",{children:u("catalogToPay")}),(0,eB.jsx)("strong",{children:l})]}),(0,eB.jsx)(e1W,{quantity:t,busy:a,pending:n,onReview:o}),d&&(0,eB.jsxs)("button",{className:"vm-catalog-bar-promotion",type:"button",disabled:a,"aria-disabled":a||n,"aria-label":u("catalogPromotion"),"aria-pressed":c,"aria-expanded":c,onClick:()=>{a||n||d()},children:[(0,eB.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,eB.jsx)("path",{d:"m6 18 12-12"}),(0,eB.jsx)("circle",{cx:"7",cy:"7",r:"3"}),(0,eB.jsx)("circle",{cx:"17",cy:"17",r:"3"})]}),(0,eB.jsx)("span",{children:u("catalogPromotion")})]})]})}function e1K(e){let{brand:t,active:l=!0,busy:i=!1,scannedCode:a="",onCodeChange:n,onFindSale:r,onBack:o}=e,{text:s}=e1P();return(0,eB.jsxs)("form",{className:`vm-redeem-screen vm-bottom-bar-layout${l?"":" vm-customer-paused"}`,"aria-busy":i,onSubmit:e=>{e.preventDefault();let t=a.trim();l&&!i&&t&&r(t)},children:[(0,eB.jsx)("header",{className:"vm-redeem-brand",children:(0,eB.jsx)(e1L,{name:t,compact:!0})}),(0,eB.jsx)("div",{className:"vm-redeem-heading",children:(0,eB.jsx)("h1",{children:s("redeemTitle")})}),(0,eB.jsxs)("div",{className:"vm-redeem-content",children:[(0,eB.jsx)("div",{className:"vm-redeem-code",children:(0,eB.jsxs)("div",{className:"vm-redeem-code-field",children:[(0,eB.jsxs)("svg",{className:"vm-redeem-keyboard-icon",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,eB.jsx)("rect",{x:"2",y:"3",width:"20",height:"18",rx:"2"}),(0,eB.jsx)("path",{d:"M6 7h.01M10 7h.01M14 7h.01M18 7h.01M6 11h.01M10 11h.01M14 11h.01M18 11h.01M7 16h10"})]}),(0,eB.jsx)("input",{type:"text",value:a,disabled:!l||i,onChange:e=>n(e.target.value),inputMode:"text",enterKeyHint:"search",autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,"aria-label":s("redeemCodeLabel"),placeholder:s("redeemCodePlaceholder")}),a&&(0,eB.jsx)("button",{type:"button",className:"vm-redeem-code-clear",disabled:!l||i,"aria-label":s("redeemClearCode"),onClick:()=>n(""),children:(0,eB.jsx)("span",{"aria-hidden":"true",children:"\xd7"})})]})}),(0,eB.jsx)("div",{className:"vm-redeem-divider",children:(0,eB.jsx)("span",{children:s("redeemOr")})}),(0,eB.jsxs)("div",{className:"vm-redeem-scanner-card",children:[(0,eB.jsxs)("div",{className:"vm-redeem-scanner-symbol","aria-hidden":"true",children:[(0,eB.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-tl"}),(0,eB.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-tr"}),(0,eB.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-bl"}),(0,eB.jsx)("span",{className:"vm-redeem-scanner-corner vm-redeem-scanner-corner-br"}),(0,eB.jsx)("span",{className:"vm-redeem-scanner-icon",children:(0,eB.jsx)(e1E,{name:"qr-code"})}),(0,eB.jsx)("span",{className:"vm-redeem-scan-line"})]}),(0,eB.jsxs)("div",{className:"vm-redeem-scanner-copy",children:[(0,eB.jsx)("p",{className:"vm-redeem-scanner-title",children:s("redeemScanPrompt")}),(0,eB.jsx)("p",{className:"vm-redeem-scanner-hint",children:s("redeemScannerLocation")})]}),(0,eB.jsxs)("ul",{className:"vm-redeem-code-types",children:[(0,eB.jsx)("li",{children:s("redeemTypeWristband")}),(0,eB.jsx)("li",{children:s("redeemTypeWallet")}),(0,eB.jsx)("li",{children:s("redeemTypeVoucher")}),(0,eB.jsx)("li",{children:s("redeemTypeReceipt")})]}),(0,eB.jsx)("span",{className:"vm-redeem-scanner-direction","aria-hidden":"true",children:(0,eB.jsx)(e1E,{name:"arrow-down"})})]})]}),(0,eB.jsx)(e1Y,{busy:!l||i,onBack:o,primaryType:"submit",primaryDisabled:!a.trim(),primaryLabel:s("redeemContinue"),primaryIcon:(0,eB.jsx)("svg",{className:"vm-catalog-bar-arrow",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(0,eB.jsx)("path",{d:"m9 5 7 7-7 7"})})})]})}let e1Q=e=>[...Array.isArray(e)?e:[]].sort((e,t)=>Number(e.sort||0)-Number(t.sort||0)),e1Z=(e,t)=>JSON.stringify([String(e),String(t??0)]),e1J=e=>{var t,l;return!(null==(t=e.variant_group)?void 0:t.length)&&!(null==(l=e.variant)?void 0:l.length)};function e1X(e,t,l){let i=new Map,a=new Map;for(let t of e){let e={id:String(t.id),title:l(t.title_i18n)||l(t.title),subtitle:l(t.subtitle_i18n)||l(t.subtitle),cover:"string"==typeof t.cover?t.cover:void 0,rows:[]},n=e1J(t);for(let i of n?[{id:0}]:e1Q(t.variant)){let r=new Set(String(i.sku_ids||"").split("_")),o=e1Q(t.variant_group).map(e=>{var t,a,n;let o=null==(t=e.variant_item)?void 0:t.find(t=>r.has(`${e.id}:${t.id}`));return{name:l(e.name_i18n)||l(e.name),value:l(null==o?void 0:o.name_i18n)||l(null==o?void 0:o.name)||l((null==(a=i.title)?void 0:a[e.position_id])??(null==(n=i.name)?void 0:n[e.position_id])),enabled:lJ(e)&&(!o||lJ(o))}}),s=i.price??i.base_price??t.price,d={key:e1Z(t.id,i.id),product:t,variant:i,label:n?e.title:o.map(e=>e.value).filter(Boolean).join(" \xb7 ")||l("string"==typeof i.title?i.title:i.code)||String(i.id),specification:o.filter(e=>e.value).map(e=>e.name?`${e.name}: ${e.value}`:e.value).join(", "),price:s,enabled:lJ(t)&&lJ(i)&&o.every(e=>e.enabled)&&null!=s&&Number.isFinite(Number(s))&&Number(s)>=0,items:[],quantity:0};a.has(d.key)||(a.set(d.key,d),e.rows.push(d))}e.rows.length&&i.set(e.id,e)}for(let e of t){var n,r;let t=e.product_variant_id??(null==(n=e.product_sku)?void 0:n.product_variant_id)??0,o=e1Z(e.product_id,t),s=a.get(o);if(!s){let n=String(e.product_id),d=i.get(n);d||(d={id:n,title:l(e.product_title??e.title)||n,subtitle:"",rows:[]},i.set(n,d)),s={key:o,product:{id:e.product_id},variant:{id:t},label:l(e.product_option_string??(null==(r=e.product_sku)?void 0:r.product_option_string))||("0"===String(t)?d.title:String(t)),specification:"",price:e.selling_price??e.price??0,enabled:!1,items:[],quantity:0},d.rows.push(s),a.set(o,s)}s.items.push(e),s.quantity+=Number(e.num||0)}return[...i.values()]}function e10(e){var t;let{product:l,variant:i,specification:a,price:n}=e,r=e1J(l)&&"0"===String(i.id);if(!e.enabled||!r&&!(null==(t=l.variant)?void 0:t.some(e=>String(e.id)===String(i.id))))throw Error("Invalid vending SKU selection");let o=`${l.id}_${i.id}`;return{...l,product_variant_id:i.id,isOpenDetailModal:!1,_extend:{price:n},cartDetailValue:{key:o,rowKey:o,product_id:l.id,product_variant_id:i.id,production_code:(r?l.production_code:i.production_code)??"",product_option_string:a,price:n,quantity:1,option:[],bundle:[],session:null}}}function e12(e,t){let l=e.map(e=>{let l=e.product.variant_group,i={key:"ungrouped",label:"",dimensionName:"",ranks:[Number.MAX_SAFE_INTEGER],display:{row:e,label:e.label}};if(!Array.isArray(l)||0===l.length)return i;if(1===l.length)return{...i,display:{row:e,label:e.specification||e.label}};let a=new Set(String(e.variant.sku_ids||"").split("_")),n=l.map(l=>{var i,n;let r=[...l.variant_item||[]].sort((e,t)=>Number(e.sort||0)-Number(t.sort||0)),o=r.findIndex(e=>a.has(`${l.id}:${e.id}`)),s=r[o],d=t(null==s?void 0:s.name_i18n)||t(null==s?void 0:s.name)||t((null==(i=e.variant.title)?void 0:i[l.position_id])??(null==(n=e.variant.name)?void 0:n[l.position_id]));return{key:JSON.stringify([l.id,(null==s?void 0:s.id)??d]),name:t(l.name_i18n)||t(l.name),value:d,rank:o<0?Number.MAX_SAFE_INTEGER:o}}),[r,...o]=n;return r.value?{key:r.key,label:r.value,dimensionName:t(l[0].name_i18n)||t(l[0].name),ranks:n.map(e=>e.rank),display:{row:e,label:o.filter(e=>e.value).map(e=>e.name?`${e.name}: ${e.value}`:e.value).join(" \xb7 ")||e.label}}:i});l.sort((e,t)=>{for(let l=0;l<Math.max(e.ranks.length,t.ranks.length);l++){let i=(e.ranks[l]??Number.MAX_SAFE_INTEGER)-(t.ranks[l]??Number.MAX_SAFE_INTEGER);if(i)return i}return 0});let i=new Map;for(let e of l){let t=i.get(e.key);t||(t={key:e.key,label:e.label,dimensionName:e.dimensionName,rows:[]},i.set(e.key,t)),t.rows.push(e.display)}return[...i.values()]}function e11(e){let{label:t}=e;return(0,eB.jsx)("div",{className:"vm-sku-status-overlay",role:"status",children:(0,eB.jsx)("svg",{className:"vm-sku-status-stamp",viewBox:"0 0 360 240",focusable:"false",children:(0,eB.jsxs)("g",{className:"vm-sku-status-stamp-art",transform:"rotate(-12 140 120)",children:[(0,eB.jsxs)("g",{fill:"none",stroke:"currentColor","aria-hidden":"true",children:[(0,eB.jsx)("circle",{cx:"140",cy:"120",r:"92",strokeWidth:"8"}),(0,eB.jsx)("circle",{cx:"140",cy:"120",r:"79",strokeWidth:"3"}),(0,eB.jsx)("path",{d:"M226 82c27-18 45 18 72 0l34-18M226 108c27-18 45 18 72 0l34-18M226 134c27-18 45 18 72 0l34-18M226 160c27-18 45 18 72 0l34-18",strokeWidth:"7",strokeLinecap:"round"}),(0,eB.jsx)("path",{d:"M115 66h50M115 176h50",strokeWidth:"3",strokeLinecap:"round"})]}),(0,eB.jsx)("rect",{x:"22",y:"84",width:"236",height:"72",rx:"10",fill:"currentColor"}),(0,eB.jsx)("rect",{x:"29",y:"91",width:"222",height:"58",rx:"5",fill:"none",stroke:"#fff",strokeOpacity:"0.55",strokeWidth:"2"}),(0,eB.jsx)("text",{x:"140",y:"121",textAnchor:"middle",dominantBaseline:"middle",children:t})]})})})}function e14(e){let{choices:t,busy:l,disabled:i,blocked:a,inventoryRefreshing:n,onChange:r}=e,{text:o,localized:s}=e1P(),d=new Map(t.map(e=>[e.row.key,e])),c=e12(t.map(e=>{let{row:t}=e;return t}),s);return(0,eB.jsx)("div",{className:"vm-voucher-sku-list","aria-busy":l,children:c.map(e=>{let t=e.label?"fieldset":"div";return(0,eB.jsxs)(t,{className:"vm-voucher-sku-group",role:e.label?"group":void 0,"aria-label":e.label||void 0,children:[e.label&&(0,eB.jsxs)("legend",{className:"vm-voucher-sku-group-title",children:[e.dimensionName&&(0,eB.jsx)("span",{className:"vm-sku-group-dimension",children:e.dimensionName}),(0,eB.jsx)("h3",{children:e.label})]}),(0,eB.jsx)("div",{className:"vm-voucher-sku-options",children:e.rows.map(t=>{let{row:s,label:c}=t,{quantity:u,maxQuantity:p,available:m,soldOut:g,loading:h,limitReason:v}=d.get(s.key),f=n||h,y=f?o("loading"):"stock"===v?o("catalogLimitReached"):null,b=(!m||g)&&!f,x=!i&&!a&&!f&&m&&!g&&u<p,k=e.label?"h4":"h3";return(0,eB.jsxs)("article",{className:`vm-voucher-sku-row${u>0?" is-selected":""}${!m||g?" is-unavailable":""}${b?" has-status-overlay":""}`,"aria-label":s.label,onClick:()=>{!l&&x&&r(s,u+1)},children:[(0,eB.jsx)("button",{type:"button",className:"vm-voucher-sku-add","aria-label":s.label,title:o("collectIncrease",{name:s.label}),disabled:!x,"aria-disabled":l||!x}),s.variant.cover?(0,eB.jsx)("img",{className:"vm-voucher-sku-image",src:s.variant.cover,alt:""}):(0,eB.jsx)("span",{className:"vm-voucher-sku-dot","aria-hidden":"true"}),(0,eB.jsxs)("div",{className:"vm-voucher-sku-label",children:[(0,eB.jsx)(k,{children:c}),!e.label&&s.specification&&c!==s.specification&&(0,eB.jsx)("p",{children:s.specification}),(0,eB.jsx)("p",{className:"vm-voucher-sku-status",role:y?"status":void 0,"aria-hidden":!y,children:y})]}),b&&(0,eB.jsx)(e11,{label:o(g?"catalogSoldOut":"catalogUnavailableLabel")}),(0,eB.jsx)("div",{className:`vm-voucher-sku-quantity${b&&0===u?" is-hidden":""}`,role:"group","aria-label":s.label,"aria-hidden":b&&0===u,"aria-disabled":l||i,onClickCapture:e=>{(l||i)&&(e.preventDefault(),e.stopPropagation())},onClick:e=>e.stopPropagation(),children:(0,eB.jsx)(z0,{className:"vm-collect-stepper",keyboardClassName:"vm-quantity-keyboard",value:u,min:0,max:Math.max(u,a||f||!m||g?0:p),step:1,size:"large",shape:"square",enableInput:!0,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,plusOnlyAtZero:!1,disabled:i,onChange:e=>{l||i||r(s,e)},minusIcon:(0,eB.jsx)("span",{"aria-label":o("collectDecrease",{name:s.label}),children:"−"}),plusIcon:(0,eB.jsx)("span",{"aria-label":o("collectIncrease",{name:s.label}),children:"+"})})})]},s.key)})})]},e.key)})})}function e13(e){let{context:t,isActive:l,pending:i,errorMessage:a,onBusyChange:n}=e,r=(0,nB.useToast)(),o=eN3(),s=(0,eN.useRef)(!1),[d,c]=(0,eN.useState)(null),u=t.sales.bookingTicket,p=(0,eN.useRef)({ticket:u,isActive:l,revision:0});(p.current.ticket!==u||p.current.isActive!==l)&&(p.current={ticket:u,isActive:l,revision:p.current.revision+1}),(0,eN.useEffect)(()=>()=>{p.current.revision+=1},[]);let m=null!==d,g=!!(i||m||o.isProcessing||t.cart.consistencyPending||o.orderTransition.pending);(0,eN.useEffect)(()=>{n(l&&g)},[l,g,n]),(0,eN.useEffect)(()=>()=>n(!1),[n]);let h=o0(()=>{n(l&&!!(i||o.getIsProcessing()||t.cart.consistencyPending||o.getIsOrderTransitionPending()))}),v=o0(function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return l&&!s.current&&(!o.getIsProcessing()||e)&&!o.getIsPaymentProcessing()&&!o.getIsOrderTransitionPending()}),f=o0(async function(e){var l,i;let{key:d="cart",ownsActivityLock:m=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!v(m))return;s.current=!0;let g=p.current.revision,f=null==u||null==(i=u.getTempOrder)||null==(l=i.call(u))?void 0:l.order_id,y=()=>{var e,t;return p.current.isActive&&p.current.revision===g&&(null==u||null==(t=u.getTempOrder)||null==(e=t.call(u))?void 0:e.order_id)===f},b=o.begin();c(d),n(!0);try{if(await t.cart.waitForCartConsistency(),!y())return;await e(y),await t.cart.waitForCartConsistency()}catch(e){y()&&r.fail((null==e?void 0:e.message)||a)}finally{s.current=!1,b(),c(null),p.current.revision===g&&h()}}),y=o0(e=>{!g&&v()&&e()});return{activity:o,session:p,mutation:s,mutationKey:d,mutating:m,busy:g,canInteract:v,run:f,navigate:y}}let e18=e=>{var t,l,i,a,n;return!!((null==(t=e.option)?void 0:t.length)||(null==(l=e.options)?void 0:l.length)||e.option_group_count||(null==(i=e.bundle)?void 0:i.length)||(null==(a=e.bundle_groups)?void 0:a.length)||(null==(n=e.bundle_group)?void 0:n.length)||Number(e.open_sold_weight))},e16=e=>{var t,l;return!(null==(t=e.variant_group)?void 0:t.length)&&!(null==(l=e.variant)?void 0:l.length)&&!e18(e)};function e15(e,t){var l,i,a;if(e18(e))return!1;let n=null==(l=e.variant)?void 0:l.find(e=>String(e.id)===String(t));if(((null==(i=e.variant_group)?void 0:i.length)||(null==(a=e.variant)?void 0:a.length))&&!n)return!1;let r=(null==n?void 0:n.price)??(null==n?void 0:n.base_price)??e.price;return null!=r&&""!==String(r).trim()&&0===Number(r)}function e17(e){var t;let l=e.source;return"product-voucher"===e.kind&&!l.isEditMode&&!l.usageLimitFailKey&&!l.isDisabled&&(null==l.unified_available_status||""===l.unified_available_status||0!==Number(l.unified_available_status))&&(!l.reasonCode||["product_not_applicable","holder_not_matched"].includes(l.reasonCode))&&((null==(t=l.config)?void 0:t.isAvailable)!==!1||"product_not_applicable"===l.reasonCode)}function e19(e,t){let l=new Set(e.map(e=>String(e.id))),i=eTP(t).filter(e17).filter(e=>!l.has(String(e.id))&&(l.add(String(e.id)),!0));return i.length?[...e,...i.map(e=>e.source)]:e}function e4e(e,t){let l=e.limited_relation_product_data;if(!l)return!1;let i=String(t.id);return!(1===Number(l.filter)&&(l.exclude_product_ids||[]).map(String).includes(i))&&("product_all"===l.type||["products","product_collection"].includes(l.type)&&(l.product_ids||[]).map(String).includes(i))}function e4t(e){return[...new Set((e.discount_list||[]).filter(e=>"good_pass"===(e.type||e.tag)).map(e=>{var t;return null==(t=e.discount)?void 0:t.resource_id}).filter(e=>null!=e&&""!==String(e)).map(String))]}function e4l(e){var t;let l=e.selling_price;return null!=l&&""!==String(l).trim()&&0===Number(l)&&!(null==(t=e.discount_list)?void 0:t.length)}function e4i(e,t){let l=new Set(e.items.flatMap(e4t));return e.vouchers.filter(e=>!l.has(String(e.id))&&e4e(e.source,t))}function e4a(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=new Map,a=new Set,n=new Set(l.flatMap(e4t)),r=l.filter(e4l);for(let l of eTP(e).filter(e17)){if(a.has(String(l.id)))continue;a.add(String(l.id));let e=l.source;if(!t.some(t=>e4e(e,t))&&!n.has(String(l.id))&&!r.some(t=>e4e(e,{id:t.product_id})))continue;let o=function(e){let t=e.product_id;return JSON.stringify(null==t||""===String(t)?["voucher",String(e.id)]:["product",String(t)])}(e),s=i.get(o);s||(s={key:o,title:l.title||RC(e.product_name),vouchers:[],discountIds:[],quota:0,selected:0,freeQuantity:0,remaining:0,items:[],products:[]},i.set(o,s)),s.discountIds.push(l.id),s.vouchers.push(l),s.quota+=1}let o=new Set(r);for(let e of i.values()){e.products=t.filter(t=>e.vouchers.some(e=>e4e(e.source,t)));let i=new Set(e.discountIds.map(String)),a=new Set;e.items=l.filter(t=>{let l=e4t(t).filter(e=>i.has(e));return(l.forEach(e=>a.add(e)),o.has(t)&&e.vouchers.some(e=>e4e(e.source,{id:t.product_id})))?(e.freeQuantity+=Number(t.num||0),!0):l.length>0}),e.selected=a.size,e.remaining=Math.max(0,e.quota-e.selected)}return[...i.values()].filter(e=>e.products.length>0||e.items.length>0)}function e4n(e){var t;let{brand:l,context:i,products:a,loading:n,isActive:r,inventoryFailed:o,inventoryRefreshing:s,checkoutPending:d,refreshInventory:c,onBack:u,onCheckout:p,onBusyChange:m,onActiveChange:g,autoSelectionRef:h}=e,{text:v,localized:f}=e1P(),y=(0,nB.useToast)();(0,eN.useEffect)(()=>(null==g||g(r),()=>null==g?void 0:g(!1)),[r,g]);let{inventory:b}=LK(),x=i.sales.bookingTicket,{activity:k,mutating:_,busy:w,canInteract:S,run:j,navigate:N}=e13({context:i,isActive:r,onBusyChange:m,pending:n||!!d,errorMessage:v("collectInvalid")}),C=(null==x||null==(t=x.getTempOrder)?void 0:t.call(x))??i.cart.tempOrder,M=i.summary.summary??(null==C?void 0:C.summary),T=eCE({amountGap:null==M?void 0:M.amount_gap,fallbackAmount:null==M?void 0:M.total_amount,orderPaidAmount:null==M?void 0:M.order_paid_amount,payments:null==C?void 0:C.payments}),I=e4a(i.cart.discountList,a,(null==C?void 0:C.products)||[]),P=!!(x&&i.cart.addProductWithFlow),A=!r||!P||n||!!d||k.orderTransition.pending,D=[...new Set(I.flatMap(e=>e.items))].filter(e4l).reduce((e,t)=>e+Number(t.num||0),0),E=I.reduce((e,t)=>e+t.selected,D),O=I.reduce((e,t)=>e+t.remaining,0),z=((null==C?void 0:C.products)||[]).reduce((e,t)=>e+Number(t.num||0),0),L=I.reduce((e,t)=>e+t.quota,0),R=o0(()=>{var e,t,l,n;return e4a((null==x||null==(e=x.getDiscountList)?void 0:e.call(x))||i.cart.discountList,a,(null==x||null==(l=x.getTempOrder)||null==(t=l.call(x))?void 0:t.products)||(null==(n=i.cart.tempOrder)?void 0:n.products)||[])}),$=o0((e,t)=>{let l=R().find(t=>t.key===e);return l?e4i(l,t).length:0}),F=o0(async(e,t,l,a)=>{let n=R().find(t=>t.key===e);for(let r of n?e4i(n,t).filter(e=>e.source.isManualSelect):[]){if(!a()||!n||n.selected>=l)return;await i.cart.setDiscount({discountId:r.id,isSelected:!0}),n=R().find(t=>t.key===e)}}),q=o0(function(e,t,l){var a,r,d;let c=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!P||n||o||s||!b)return 0;let u=(null==(a=(null==x||null==(r=x.getTempOrder)?void 0:r.call(x))??i.cart.tempOrder)?void 0:a.products)||[];return Math.max(0,...(void 0===l&&(null==(d=t.variant_group)?void 0:d.length)?t.variant||[]:[{id:l??0}]).map(l=>{let i=l.id??l.product_variant_id,a=b.selectionAvailability(t,i,u),n=c||e15(t,i)?1/0:$(e.key,t);return"ready"===a.availability.status?Math.min(a.availableQuantity,n):0}))}),B=(e,t,l)=>!A&&q(e,t,l)>0,H=o0(async(e,t,l,a)=>{let n=e15(t,t.product_variant_id),r=R().find(t=>t.key===e.key),o=await i.cart.addProductWithFlow(ePt(t),{type:"select",quantity:l,debounceMs:0,notShowToast:!0,getQuantityLimit:n?void 0:()=>$(e.key,t),initialHolderIds:[]});if("added"===o.status&&a()&&!n){let i=R().find(t=>t.key===e.key),n=Math.max(0,((null==i?void 0:i.freeQuantity)||0)-((null==r?void 0:r.freeQuantity)||0));await F(e.key,t,((null==r?void 0:r.selected)||0)+Math.max(0,l-n),a)}return o}),V=(0,eN.useRef)(null),U=h??V,Y=(null==C?void 0:C.external_sale_number)||(null==C?void 0:C.order_id);U.current&&U.current.ticket===x&&U.current.orderKey===Y||(U.current={ticket:x,orderKey:Y,handled:new Set});let W=(e,t)=>JSON.stringify([e.key,String(t)]),G=I.find(e=>{var t;if(1!==e.products.length||!e16(e.products[0]))return!1;let l=e.products[0],i=null==(t=e1X([l],[],f)[0])?void 0:t.rows[0];return(null==i?void 0:i.enabled)&&(null==b?void 0:b.selectionAvailability(l,0,(null==C?void 0:C.products)||[]).availability.status)==="ready"&&e.vouchers.some(t=>!U.current.handled.has(W(e,t.id)))});(0,eN.useEffect)(()=>{if(!G||!P||!r||w||o||s||!S())return;let e=U.current,t=new Set(G.vouchers.filter(t=>!e.handled.has(W(G,t.id))).map(e=>String(e.id)));t.forEach(t=>e.handled.add(W(G,t))),j(async e=>{var l,a,n;let r=R().find(e=>e.key===G.key);if(!r||1!==r.products.length||!e16(r.products[0]))return;let d=r.products[0],c=null==(l=e1X([d],[],f)[0])?void 0:l.rows[0],u=(null==(a=(null==x||null==(n=x.getTempOrder)?void 0:n.call(x))??i.cart.tempOrder)?void 0:a.products)||[];if(!(null==c?void 0:c.enabled)||o||s||(null==b?void 0:b.selectionAvailability(d,0,u).availability.status)!=="ready")return;let p=Math.min(e4i(r,d).filter(e=>t.has(String(e.id))&&!e.source.isManualSelect).length,q(r,d,0),e15(d,0)?Math.max(0,r.quota-r.freeQuantity):1/0);if(p>0){let t=await H(r,e10(c),p,e);if(e()&&"added"!==t.status&&"cancelled"!==t.status)throw Error(v("catalogUpdateFailed"))}})},[G,P,r,w,o,s,b,S,j,R,f,x,i.cart,q,H,U,v]);let K=(e,t,l,a,n,r,o)=>{if(!P||w||!Number.isSafeInteger(a)||a<0)return;let s=l.map(e=>({item:e,uid:ekX(e).unique_identification_number})),d=e=>{var t,l;let{item:a,uid:n}=e;return((null==(t=(null==x||null==(l=x.getTempOrder)?void 0:l.call(x))??i.cart.tempOrder)?void 0:t.products)||[]).find(e=>null!=n&&""!==String(n)?ekX(e).unique_identification_number===n:e===a)};j(async l=>{let c=s.map(d).filter(Boolean),u=a-c.reduce((e,t)=>e+Number(t.num||0),0);if(u>0){var p,m;let a=!r&&c.length>0&&c.every(e4l),s=c[c.length-1];if(!r&&!s)return;let d=R().find(t=>t.key===e.key),g=null==d?void 0:d.products.find(e=>String(e.id)===String(t.id));if(!n||!g||!d||u>q(d,g,(null==o?void 0:o.variant.id)??(null==s?void 0:s.product_variant_id)??0,a))throw Error(v("collectLimit"));if(r){let e=null==(p=e1X([g],[],f)[0])?void 0:p.rows.find(e=>o?e.key===o.key:"0"===String(e.variant.id));if(!(null==e?void 0:e.enabled))throw Error(v("catalogUnavailable"));let t=await H(d,e10(e),u,l);if(l()&&"added"!==t.status&&"cancelled"!==t.status)throw Error(v("catalogUpdateFailed"))}else{let n=(null==(m=R().find(t=>t.key===e.key))?void 0:m.selected)||0;await i.cart.updateItemQuantity(s,Number(s.num)+u),l()&&!a&&await F(e.key,t,n+u,l)}return}let g=-u;for(let e of[...s].reverse()){if(!l()||g<=0)return;let t=d(e);if(!t)continue;let a=Math.min(g,Number(t.num)),n=Number(t.num)-a;n<=0?await i.cart.removeItem(t):await i.cart.updateItemQuantity(t,n),g-=a,await i.cart.waitForCartConsistency()}})},Q=function(e,t,l,i,a){var n;let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=i.reduce((e,t)=>e+Number(t.num||0),0);return(0,eB.jsx)("div",{className:"vm-collect-selection-actions",role:"group","aria-label":e.trim(),"aria-disabled":w||A,onClickCapture:e=>{(w||A)&&(e.preventDefault(),e.stopPropagation())},children:(0,eB.jsx)(z0,{className:"vm-collect-stepper",keyboardClassName:"vm-quantity-keyboard",value:o,min:0,max:o+(a?q(t,l,(null==(n=i[0])?void 0:n.product_variant_id)??0,!r&&i.length>0&&i.every(e4l)):0),step:1,size:"large",shape:"square",enableInput:!0,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,plusOnlyAtZero:!1,disabled:A,onChange:e=>K(t,l,i,e,a,r),minusIcon:(0,eB.jsx)("span",{"aria-label":v("collectDecrease",{name:e.trim()}),children:"−"}),plusIcon:(0,eB.jsx)("span",{"aria-label":v("collectIncrease",{name:e.trim()}),children:"+"})})})};return(0,eB.jsxs)("div",{className:"vm-voucher-collect vm-bottom-bar-layout",children:[(0,eB.jsx)(e1O,{children:(0,eB.jsxs)("section",{className:"vm-collect-screen",children:[(0,eB.jsxs)("header",{className:"vm-collect-header",children:[(0,eB.jsx)(e1L,{name:l,compact:!0}),(0,eB.jsx)("h1",{children:v("collectTitle")}),(0,eB.jsx)("p",{className:"vm-collect-scan-hint",children:w&&!_?v("scanProcessing"):v("collectScanMore")})]}),(0,eB.jsxs)("div",{className:"vm-collect-scroll",children:[(0,eB.jsxs)("div",{className:"vm-collect-stats",children:[(0,eB.jsxs)("div",{children:[(0,eB.jsx)("span",{children:v("collectAvailable")}),(0,eB.jsx)("strong",{children:L})]}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("span",{children:v("collectSelected")}),(0,eB.jsx)("strong",{children:E})]}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("span",{children:v("collectRemaining")}),(0,eB.jsx)("strong",{children:O})]})]}),(o&&!d||!P)&&(0,eB.jsxs)("div",{className:"vm-collect-warning",role:"status",children:[(0,eB.jsx)("span",{children:v(P?"inventoryUnavailable":"collectInvalid")}),o&&(0,eB.jsx)("button",{type:"button",disabled:A||s,"aria-disabled":w||s,onClick:()=>{w||j(c)},children:v("retry")})]}),n?(0,eB.jsx)("p",{className:"vm-collect-empty",role:"status",children:v("loading")}):0===I.length?(0,eB.jsx)("p",{className:"vm-collect-empty",role:"status",children:v("collectNoProducts")}):I.map(e=>{let t=e.items,l=e.selected+e.freeQuantity,i=new Set(e.products.map(e=>String(e.id))),n=new Map(e.products.map(e=>[String(e.id),e]));return t.forEach(e=>{var t;n.has(String(e.product_id))||n.set(String(e.product_id),{id:e.product_id,title:e.product_title,variant_group:Number(e.product_variant_id)>0?[{}]:[],option:null==(t=e.product_sku)?void 0:t.option,bundle:e.product_bundle})}),(0,eB.jsxs)("section",{className:"vm-collect-group",children:[(0,eB.jsxs)("header",{children:[(0,eB.jsxs)("div",{children:[(0,eB.jsx)("h2",{children:e.title}),(0,eB.jsx)("p",{children:v("collectVoucherCount",{count:e.quota})})]}),(0,eB.jsx)("span",{children:v(e.freeQuantity>0?"collectSelectedCount":"collectGroupSelected",{selected:l,total:e.quota})})]}),[...n.values()].map(l=>{var n,r,d;let c=i.has(String(l.id)),u=RC(l.title??l.name),p=function(e,t){let l=new Map;for(let n of e){var i,a;let e=JSON.stringify(function e(t){return Array.isArray(t)?t.map(e).sort((e,t)=>JSON.stringify(e).localeCompare(JSON.stringify(t))):t&&"object"==typeof t?Object.fromEntries(Object.keys(t).sort().map(l=>[l,e(t[l])])):t}({productId:n.product_id,variantId:n.product_variant_id??0,options:(null==(i=n.product_sku)?void 0:i.option)||(null==(a=n.product_sku)?void 0:a.options)||[],bundle:n.product_bundle||[]})),r=l.get(e)||{key:e,items:[],quantity:0,specification:ewk(n,t).product_option_string||""};r.items.push(n),r.quantity+=Number(n.num||0),l.set(e,r)}return[...l.values()]}(t.filter(e=>String(e.product_id)===String(l.id)),{productsCatalog:a,productsByUid:null==C||null==(n=C._extend)?void 0:n.productsByUid}),m=!!((null==(r=l.variant_group)?void 0:r.length)&&(null==(d=l.variant)?void 0:d.length)&&!e18(l)),g=!e16(l);return(0,eB.jsxs)("div",{className:`vm-collect-product${!g?" has-direct-quantity":""}`,children:[(0,eB.jsxs)("div",{className:"vm-collect-product-main",children:[(0,eB.jsx)("div",{children:(0,eB.jsx)("h3",{children:u})}),m?null:g?(0,eB.jsx)("button",{type:"button",className:"vm-collect-select",disabled:!c||!B(e,l),"aria-disabled":w||!c||!B(e,l),onClick:()=>{w||j(async t=>{if(1>q(e,l))throw Error(v("collectLimit"));return H(e,l,1,t)})},children:v("collectSelect")}):Q(u,e,l,p.flatMap(e=>e.items),c,!0)]}),m&&(0,eB.jsx)(e14,{choices:function(e){var t;let{product:l,items:i,selectedItems:a,remaining:n,inventory:r,localize:o}=e;return((null==(t=e1X([l],a.filter(e=>String(e.product_id)===String(l.id)),o)[0])?void 0:t.rows)||[]).map(e=>{let t=null==r?void 0:r.selectionAvailability(l,e.variant.id,i),a=e.enabled&&(null==t?void 0:t.availability.status)==="ready",o=(null==t?void 0:t.availability.status)==="ready"&&0===t.availability.quantity,s=e15(l,e.variant.id);return{row:e,quantity:e.quantity,maxQuantity:e.quantity+(a?Math.max(0,Math.min(t.availableQuantity,s?1/0:n)):0),available:a,soldOut:o,loading:(null==t?void 0:t.availability.status)==="loading",limitReason:a&&!o?!s&&n<=0?"voucher":0===t.availableQuantity?"stock":void 0:void 0}})}({product:l,items:(null==C?void 0:C.products)||[],selectedItems:e.items,remaining:e4i(e,l).length,inventory:b,localize:f}),busy:w,disabled:A,blocked:o||s||!b,inventoryRefreshing:s,onChange:(t,i)=>K(e,l,t.items,i,c&&t.enabled,!0,t)}),g&&!m&&p.map(t=>(0,eB.jsxs)("div",{className:"vm-collect-selection",children:[(0,eB.jsxs)("div",{children:[(0,eB.jsx)("span",{className:"vm-collect-selection-dot"}),(0,eB.jsxs)("p",{children:[u,t.specification&&(0,eB.jsxs)("span",{children:[" \xb7 ",t.specification]})]})]}),Q(`${u} ${t.specification}`,e,l,t.items,c)]},t.key))]},l.id)})]},e.key)})]})]})}),(0,eB.jsx)(e1Y,{busy:A,pending:w,onBack:()=>N(u),primaryLabel:v(0===T?"collectRedeem":"catalogCheckout"),primaryIcon:(0,eB.jsx)(e1E,{name:"chevron-right"}),primaryDisabled:n||!P||0===z||o||s,onPrimary:()=>N(()=>{var e,t;let l=(null==x||null==(e=x.getTempOrder)?void 0:e.call(x))??i.cart.tempOrder;(null==l||null==(t=l.products)?void 0:t.some(e=>Number(e.num)>0))?p():y.fail(v("catalogCartEmpty"))}),children:(0,eB.jsxs)("div",{className:"vm-catalog-bar-amount","aria-label":v(D>0?"collectSelectedCount":"collectGroupSelected",{selected:E,total:L}),children:[(0,eB.jsx)("span",{children:v("collectSelected")}),(0,eB.jsx)("strong",{children:D>0?E:`${E} / ${L}`})]})})]})}function e4r(){return(0,eB.jsx)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:(0,eB.jsx)("path",{d:"m12 3 9 5-9 5-9-5 9-5Zm9 5v9l-9 5-9-5V8m9 5v9M7.5 5.5l9 5"})})}function e4o(e){let{brand:t,context:l,products:i,loading:a,isActive:n,inventoryFailed:r,inventoryRefreshing:o,checkoutPending:s,refreshInventory:d,onBack:c,onReview:u,onCheckout:p,onBusyChange:m,onPromotion:g,promotionVisible:h}=e,{text:v,localized:f}=e1P(),y=(0,nB.useToast)(),{inventory:b}=LK(),x=!n||a||!l.sales.isReady||!!s,{activity:k,mutationKey:_,busy:w,run:S,navigate:j}=e13({context:l,isActive:n,pending:x,onBusyChange:m,errorMessage:v("catalogUpdateFailed")}),N=l.sales.bookingTicket,C=(0,eN.useRef)(i);C.current=i;let M=eCT(l.sales,l.cart),T=(null==M?void 0:M.products)||[],I=e1X(i,T,f),P={groups:I,stocks:new Map(I.reduce((e,t)=>e.concat(t.rows),[]).map(e=>[e.key,null==b?void 0:b.selectionAvailability(e.product,e.variant.id,T)])),loading:a,inventoryFailed:r,inventoryRefreshing:o},A=(0,eN.useRef)({ticket:N,inventory:b,orderId:null==M?void 0:M.order_id,presentation:P});s&&A.current.ticket===N&&A.current.inventory===b&&A.current.orderId===(null==M?void 0:M.order_id)||(A.current={ticket:N,inventory:b,orderId:null==M?void 0:M.order_id,presentation:P});let D=A.current.presentation,E=T.reduce((e,t)=>e+Number(t.num||0),0),O=l.summary.summary??(null==M?void 0:M.summary),z=eCE({amountGap:null==O?void 0:O.amount_gap,fallbackAmount:null==O?void 0:O.total_amount,orderPaidAmount:null==O?void 0:O.order_paid_amount,payments:null==M?void 0:M.payments}),L=Yg(M,z),R=x||k.orderTransition.pending,$=o0(function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"input";if(!w&&Number.isSafeInteger(t)&&!(t<0))return S(async a=>{var n,s,d,c;let u=(null==N||null==(s=N.getTempOrder)||null==(n=s.call(N))?void 0:n.products)||[],p=e1X(C.current,u,f).reduce((e,t)=>e.concat(t.rows),[]).find(t=>t.key===e.key);if(!p)return;let m="increase"===i?1:"decrease"===i?-1:t-p.quantity;if(m>0){let e=null==b?void 0:b.selectionAvailability(p.product,p.variant.id,u);if(!p.enabled||r||o||(null==e?void 0:e.availability.status)!=="ready"||e.availableQuantity<m)throw Error(v("catalogUnavailable"));let t=await l.cart.addProductWithFlow(e10(p),{type:"select",quantity:m,debounceMs:0,notShowToast:!0});if("added"!==t.status&&"cancelled"!==t.status)throw Error(v("catalogUpdateFailed"))}else if(m<0){let e=p.items.map(e=>({item:e,uid:ekX(e).unique_identification_number})),t=-m;for(let i of e.reverse()){if(!a()||t<=0)return;let e=((null==N||null==(c=N.getTempOrder)||null==(d=c.call(N))?void 0:d.products)||[]).find(e=>i.uid?ekX(e).unique_identification_number===i.uid:e===i.item);if(!e)continue;let n=Math.min(t,Number(e.num)),r=Number(e.num)-n;r<=0?await l.cart.removeItem(e):await l.cart.updateItemQuantity(e,r),t-=n,await l.cart.waitForCartConsistency()}}},{key:e.key})}),F=e=>j(()=>{var t;let i=eCT(l.sales,l.cart);(null==i||null==(t=i.products)?void 0:t.some(e=>Number(e.num)>0))?e():y.show({icon:"warning",content:v("catalogCartEmpty")})});return(0,eB.jsxs)("div",{className:"vm-catalog vm-bottom-bar-layout",children:[(0,eB.jsx)(e1O,{children:(0,eB.jsxs)("section",{className:"vm-catalog-screen","aria-label":v("catalogTitle"),children:[(0,eB.jsxs)("header",{className:"vm-catalog-header",children:[(0,eB.jsx)(e1L,{name:t,compact:!0}),(0,eB.jsx)("h1",{children:v("catalogTitle")}),(0,eB.jsx)("p",{children:v("catalogHint")})]}),(0,eB.jsxs)("div",{className:"vm-catalog-scroll","aria-busy":w||a||o,children:[D.inventoryFailed&&(0,eB.jsxs)("div",{className:"vm-catalog-warning",role:"alert",children:[(0,eB.jsx)("span",{children:v("inventoryUnavailable")}),(0,eB.jsx)("button",{type:"button",disabled:w||o,onClick:()=>{d()},children:v("retry")})]}),D.loading&&(0,eB.jsx)("p",{className:"vm-catalog-empty",role:"status",children:v("loading")}),!D.loading&&0===D.groups.length&&(0,eB.jsx)("p",{className:"vm-catalog-empty",children:v("catalogEmpty")}),D.groups.map(e=>(0,eB.jsxs)("section",{className:"vm-catalog-group","aria-label":e.title,children:[(0,eB.jsxs)("header",{children:[(0,eB.jsx)("span",{className:"vm-catalog-product-icon",children:e.cover?(0,eB.jsx)("img",{src:e.cover,alt:""}):(0,eB.jsx)(e4r,{})}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("h2",{children:e.title}),e.subtitle&&(0,eB.jsx)("p",{children:e.subtitle})]})]}),e12(e.rows,f).map(t=>{let l=t.label?"fieldset":"div";return(0,eB.jsxs)(l,{className:"vm-catalog-sku-group",role:t.label?"group":void 0,"aria-label":t.label||void 0,children:[t.label&&(0,eB.jsxs)("legend",{className:"vm-catalog-sku-group-title",children:[t.dimensionName&&(0,eB.jsx)("span",{className:"vm-sku-group-dimension",children:t.dimensionName}),(0,eB.jsx)("h3",{children:t.label})]}),(0,eB.jsx)("div",{className:"vm-catalog-grid",children:t.rows.map(l=>{let{row:i,label:n}=l,s=D.stocks.get(i.key),d=(null==s?void 0:s.availability.status)==="ready"&&0===s.availability.quantity,c=i.enabled&&(null==s?void 0:s.availability.status)==="ready",u=!a&&!r&&!o&&c&&s.availableQuantity>0,p=!c||d,m=D.inventoryRefreshing||(null==s?void 0:s.availability.status)==="loading",g=p&&!m,h=c&&!d&&!m&&0===s.availableQuantity,f="0"===String(i.variant.id)?e.title:`${e.title} \xb7 ${i.label}`,y=t.label?"h4":"h3";return(0,eB.jsxs)("article",{className:`vm-catalog-card${i.quantity>0?" is-selected":""}${p?" is-unavailable":""}${g?" has-status-overlay":""}`,"aria-label":f,onClick:()=>{u&&$(i,i.quantity+1,"increase")},children:[(0,eB.jsx)("button",{type:"button",className:"vm-catalog-card-add","aria-label":f,title:v("collectIncrease",{name:f}),disabled:R||!u,"aria-disabled":w||!u}),(0,eB.jsxs)("div",{className:"vm-catalog-card-heading",children:[(0,eB.jsx)(y,{children:n}),(0,eB.jsx)("strong",{children:Yg(M,i.price)})]}),g&&(0,eB.jsx)(e11,{label:v(d?"catalogSoldOut":"catalogUnavailableLabel")}),m&&(0,eB.jsx)("span",{className:"vm-catalog-stock-loading",role:"status",children:v("loading")}),(!p||i.quantity>0)&&(0,eB.jsxs)("div",{className:"vm-catalog-quantity",children:[(0,eB.jsx)("span",{children:h?v("catalogLimitReached"):v(i.quantity>0?"catalogAdded":"catalogQuantity")}),(0,eB.jsx)("div",{role:"group","aria-label":f,"aria-disabled":w,"aria-busy":_===i.key,onClick:e=>e.stopPropagation(),children:(0,eB.jsx)(z0,{className:"vm-catalog-stepper",keyboardClassName:"vm-quantity-keyboard",value:i.quantity,min:0,max:i.quantity+(u?s.availableQuantity:0),step:1,size:"large",shape:"square",enableInput:!0,commitInputOnClose:!1,selectAllInputOnOpen:!0,clearSelectedInputOnDelete:!0,ignoreEmptyInputConfirm:!0,plusOnlyAtZero:!1,disabled:R,onChange:(e,t)=>{$(i,e,null==t?void 0:t.action)},minusIcon:(0,eB.jsx)("span",{"aria-label":v("collectDecrease",{name:f}),children:"−"}),plusIcon:(0,eB.jsx)("span",{"aria-label":v("collectIncrease",{name:f}),children:"+"})})})]})]},i.key)})})]},t.key)})]},e.id))]})]})}),(0,eB.jsx)(e1G,{quantity:E,total:L,amountDue:z,busy:R,pending:w,onBack:()=>j(c),onReview:()=>F(u),onCheckout:()=>F(p),onPromotion:g?()=>j(g):void 0,promotionVisible:h})]})}let e4s={en:{label:"Redeemed",fontSize:20,fontFamily:"Arial, sans-serif"},es:{label:"Canjeado",fontSize:21,fontFamily:"Arial, sans-serif"},ja:{label:"引換済み",fontSize:23,fontFamily:"Hiragino Sans, sans-serif"},"zh-CN":{label:"已兑换",fontSize:25,fontFamily:"PingFang SC, sans-serif"},"zh-TW":{label:"已兌換",fontSize:25,fontFamily:"PingFang TC, sans-serif"}};function e4d(){let e=db().replace(/_/g,"-").toLowerCase(),t=e.split("-")[0],l="zh"===t?e4s[/^zh-(tw|hk|mo|hant)(-|$)/.test(e)?"zh-TW":"zh-CN"]:e4s[t]||e4s.en;return(0,eB.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"vm-voucher-redemption-stamp",viewBox:"0 0 128 128",width:128,height:128,role:"img","aria-label":l.label,focusable:"false",children:(0,eB.jsxs)("g",{transform:"rotate(-10 64 64)",children:[(0,eB.jsx)("circle",{cx:64,cy:64,r:60,fill:"none",stroke:"currentColor",strokeWidth:2.2}),(0,eB.jsx)("path",{d:"M52 46L61 55L77 38",fill:"none",stroke:"currentColor",strokeWidth:3.8,strokeLinecap:"round",strokeLinejoin:"round"}),(0,eB.jsx)("text",{x:64,y:92,textAnchor:"middle",fontFamily:l.fontFamily,fontSize:l.fontSize,fontWeight:600,fill:"currentColor",children:l.label})]})})}function e4c(){let{token:e}=eM.theme.useToken();return{colorPrimary:e.colorPrimary,colorPrimaryHover:e.colorPrimaryHover,colorPrimaryActive:e.colorPrimaryActive,colorPrimaryBg:e.colorPrimaryBg,colorPrimaryBgHover:e.colorPrimaryBgHover,colorPrimaryBorder:e.colorPrimaryBorder,colorTextLightSolid:e.colorTextLightSolid}}function e4u(){let e=e4c();return{"--vm-primary":e.colorPrimary,"--vm-primary-hover":e.colorPrimaryHover,"--vm-primary-active":e.colorPrimaryActive,"--vm-primary-bg":e.colorPrimaryBg,"--vm-primary-bg-hover":e.colorPrimaryBgHover,"--vm-primary-border":e.colorPrimaryBorder,"--vm-primary-foreground":e.colorTextLightSolid,"--vm-customer-page-bg":`linear-gradient(rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.96)), ${e.colorPrimary}`,"--vm-customer-soft-bg":`linear-gradient(rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.92)), ${e.colorPrimary}`}}let e4p=0,e4m={cartItems:{renderProductLineItemStatus:function(e){return e4t(e).length>0?(0,eB.jsx)(e4d,{}):null}}};function e4g(e){var t;let{context:l,sales:i,fulfillment:a,blockNavigation:n,scanSource:r,scanEnabled:o=!0,isActive:s=!0,isVisible:d=!0,idleRequest:c=0,homeIdleTimeoutMs:u=3e4,onHomePageActiveChange:p,onLocaleChange:m,brand:g,subtitle:h,machine:v,onRequestSettings:f,onRequestStaff:y,onPrerenderComplete:b,className:x,style:k}=e,{text:_}=e1P(),w=e4u(),S=(0,nB.useToast)(),j=(0,eN.useRef)(null),N=o0(()=>{var e;null==(e=j.current)||e.close(),j.current=null}),[C,M]=eM.Modal.useModal(),{setIdlePaused:T,shouldDispenseAfterSale:I,startDispenseQueue:P,isCurrentContext:A}=a,[D,E]=(0,eN.useState)("idle"),[O,z]=(0,eN.useState)({ready:!1,failed:!1}),[L,R]=(0,eN.useState)(!1),[$,F]=(0,eN.useState)(!1),[q,B]=(0,eN.useState)(null),H=(0,eN.useRef)(null),V=(0,eN.useCallback)(e=>{z(t=>t.ready===e.ready&&t.failed===e.failed?t:e)},[]),U=(0,eN.useMemo)(()=>({active:s&&d&&("idle"===D||"home"===D||"redeem"===D),onStateChange:V}),[s,d,D,V]),[Y,W]=(0,eN.useState)("purchase"),[G,K]=(0,eN.useState)(!1),[Q,Z]=(0,eN.useState)(!1),J=(0,eN.useRef)(!1),[X,ee]=(0,eN.useState)(!1),et=(0,eN.useRef)(!1),[el,ei]=(0,eN.useState)(!1),ea=(0,eN.useRef)(!1),[en,er]=(0,eN.useState)(!1),eo=(0,eN.useRef)(!1),es=(0,eN.useCallback)(e=>{eo.current=e,er(e)},[]),ed=(0,eN.useCallback)(e=>{ea.current=e,ei(e)},[]),ec=(0,eN.useCallback)(e=>{et.current=e,ee(e)},[]),eu=(0,eN.useCallback)(()=>{W("purchase"),K(!1),ec(!1),ed(!1)},[ec,ed]),ep=o0(()=>{if(!i.ready||!O.ready||H.current||em.getIsBusy())return;let e=()=>{W("purchase"),E("sale")};if(!i.inventory)return void e();let t=new AbortController;H.current=t,R(!0),F(!1),i.inventory.refresh({reason:"catalog-entry",signal:t.signal}).then(()=>{!t.signal.aborted&&A(l)&&e()}).catch(e=>{t.signal.aborted||(null==e?void 0:e.name)==="AbortError"||F(!0)}).finally(()=>{H.current===t&&(H.current=null,R(!1))})}),em=function(e){let{context:t,scanSource:l,scanEnabled:i=!0,isActive:a,isVisible:n,fulfillment:r,stage:o,obscured:s,isObscured:d,onResolved:c}=e,[u,p]=(0,eN.useState)(null),[m,g]=(0,eN.useState)(""),h=(0,eN.useRef)(null),v=(0,eN.useRef)(!1),f=JSON.stringify([t.tenantDomain,t.shopId,t.deviceId,t.businessCode]),y=!!(a&&n),b=(0,eN.useRef)({scope:f,active:y});b.current={scope:f,active:y},(0,eN.useEffect)(()=>(v.current=!0,()=>{v.current=!1,h.current=null}),[]);let x=o0((e,t,i)=>{try{var a;null==l||null==(a=l.log)||a.call(l,e,{requestId:t.id,sourcePage:t.sourcePage,scope:t.scope,elapsedMs:Date.now()-t.receivedAt,status:null==i?void 0:i.status,kind:null==i?void 0:i.kind,reason:null==i?void 0:i.reason})}catch{}}),k=o0(e=>{h.current=e,p(e)}),_=o0(()=>{h.current&&x("cancelled",h.current),k(null),g("")});(0,eN.useLayoutEffect)(()=>{(!y||h.current&&h.current.scope!==f)&&_()},[y,f,_]);let w=o0(e=>{if(!y||!i||d()||!r.isCurrentContext(t))return;let l="string"==typeof(null==e?void 0:e.data)?e.data.trim():"";if(!l||h.current||"idle"!==o&&"home"!==o&&"redeem"!==o)return;let a={id:`vending-scan-${Date.now()}-${++e4p}`,code:l,sourcePage:o,scope:f,receivedAt:Date.now(),phase:"waiting"};k(a),"redeem"===o&&g(l),x("received",a),r.setIdlePaused(!0)}),S=y&&i&&!s&&("idle"===o||"home"===o||"redeem"===o||"sale"===o&&!!u),j=!!u;(0,eN.useEffect)(()=>{if(S&&l)return l.subscribe(w,{priority:10*!!j})},[S,l,j,w]);let N=e=>{let l=h.current;return v.current&&b.current.active&&(null==l?void 0:l.id)===e&&l.scope===b.current.scope&&r.isCurrentContext(t)?l:null},C=o0(e=>{let t=N(e);t&&"waiting"===t.phase&&(k({...t,phase:"processing"}),x("accepted",t))}),M=o0((e,t)=>{var l;let i=N(e);if(!i)return;let a="success"===t.status&&["customer","promotion"].includes(t.kind||"")&&!Array.isArray(null==(l=t.redemption)?void 0:l.vouchers)?{status:"failed",reason:"entry_resolution_failed"}:t;x("settled",i,a),c(a),k(null)}),T=o0(()=>!!h.current);return{pending:u,scannedCode:m,setScannedCode:g,submitCode:o0(e=>w({data:e})),busy:!!u,getIsBusy:T,clear:_,accepted:C,settled:M}}({context:l,scanSource:r,scanEnabled:o,isActive:s,isVisible:d,fulfillment:a,stage:D,obscured:Q||L,isObscured:()=>J.current||!!H.current,onResolved:o0(e=>{N();let t=function(e){var t,l,i;if("cancelled"===e.status)return{destination:"stay",vouchers:[]};if(["initialization_failed","order_reset_failed","entry_resolution_failed","scan_failed"].includes(e.reason||""))return{destination:"stay",vouchers:[],notice:"scanResolveFailed"};let a=(null==(t=e.redemption)?void 0:t.vouchers)||[],n="success"===e.status?e19([],a):[];if(n.length)return{destination:"redeem",vouchers:n};if("success"===e.status&&((null==(l=e.redemption)?void 0:l.source)==="wallet"||"products"===e.kind)||"pending"===e.status&&["requiresDetail","requiresBookingEdit"].includes(e.kind||""))return{destination:"purchase",vouchers:[]};let r=a.filter(e=>"good_pass"===(e.tag||e.type)),o=r.map(e=>e.reasonCode);return{destination:"stay",vouchers:[],notice:o.length&&o.every(e=>"not_started"===e)?"scanVoucherNotStarted":o.length&&o.every(e=>"expired"===e)?"scanVoucherExpired":r.length?"scanVoucherUnavailable":(null==(i=e.redemption)?void 0:i.source)==="scan"?"scanNoVouchers":"scanUnrecognized"}}(e);if("redeem"===t.destination)W("vouchers"),E("sale");else if("purchase"===t.destination)W("purchase"),E("sale");else if(t.notice){let e=Symbol();B(e),S.show({icon:"warning",content:_(t.notice),afterClose:()=>B(t=>t===e?null:t)})}})}),eg=i.ready&&O.ready&&!L&&!$,eh=i.failed||O.failed||$,ev=s&&d&&em.busy,ef=s&&d&&"home"===D&&o&&!Q&&!eg&&!eh&&!q,ey=ev?_("scanProcessing"):ef?_("homePreparing"):null,eb=o0(()=>{ey&&(!ev||em.getIsBusy())&&(ev&&B(null),j.current=S.loading(ey,0))});(0,eN.useEffect)(()=>{if(ey)return eb(),N},[ey,eb,N]);let ex=o0(e=>{if(!s||!d||"sale"!==D||"vouchers"!==Y||!G||em.pending||!A(l))return;let t=e.scannedDiscountList||[];if(!(e.isAccepted??e.isAvailable)||!e19([],t).length){let e=t.some(e=>"good_pass"===(e.tag||e.type));S.fail(_(e?"collectInvalid":"collectUnsupported"))}}),ek=(0,eN.useRef)(null),e_=o0(e=>{let t={...e,isActive:e.isActive&&"sale"===D};return"vouchers"===Y?(0,eB.jsx)(e4n,{...t,brand:g,autoSelectionRef:ek,onActiveChange:K,onBusyChange:ec,onPurchase:()=>{em.getIsBusy()||et.current||ea.current||W("purchase")}}):(0,eB.jsx)(e4o,{...t,brand:g,onBusyChange:ed})});(0,eN.useEffect)(()=>{var e;i.failed&&(null==(e=em.pending)?void 0:e.phase)==="waiting"&&em.settled(em.pending.id,{status:"failed",reason:"initialization_failed"})},[i.failed,em.pending,em.settled]);let[ew,eS]=(0,eN.useState)(null),[ej,eC]=(0,eN.useState)(null),[eT,eI]=(0,eN.useState)(!1),[eP,eA]=(0,eN.useState)(10),eD=(0,eN.useRef)(!0),eE=(0,eN.useRef)(s);eE.current=s&&d;let eO=(0,eN.useRef)([]),ez=(0,eN.useRef)(null),eL=(0,eN.useRef)(null),eR=(0,eN.useCallback)(()=>{var e,t;null==(e=eL.current)||e.call(eL),eL.current=null,null==(t=ez.current)||t.cancel(),ez.current=null},[]),e$=(0,eN.useCallback)(e=>{var t;em.getIsBusy()||et.current||ea.current||eo.current||(em.clear(),eu(),eS(null),eC(null),eI(!1),E(e),eO.current=[],null==(t=eL.current)||t.call(eL),eL.current=null,T(!1))},[T,em.clear,em.getIsBusy,eu]),eF=(0,eN.useCallback)(()=>e$("idle"),[e$]),eq=(0,eN.useCallback)(()=>e$("home"),[e$]),eH=(0,eN.useRef)(c);(0,eN.useEffect)(()=>{eH.current!==c&&(eH.current=c,eF())},[c,eF]),(0,eN.useEffect)(()=>(eD.current=!0,()=>{eD.current=!1,eR(),T(!1)}),[T,eR]),(0,eN.useEffect)(()=>{s||(em.clear(),eu(),eR(),eF())},[s,eF,eR,em.clear,eu]),(0,eN.useEffect)(()=>{d||"sale"!==D||"vouchers"!==Y||(em.clear(),eu(),eF())},[d,D,Y,em.clear,eu,eF]);let eV=JSON.stringify([l.tenantDomain,l.shopId,l.deviceId,l.businessCode]);(0,eN.useEffect)(()=>()=>{var e;null==(e=H.current)||e.abort(),H.current=null,R(!1)},[s,d,eV,D]),(0,eN.useEffect)(()=>{i.ready||(z({ready:!1,failed:!1}),F(!1))},[i.ready]);let eU=(0,eN.useRef)(eV);(0,eN.useEffect)(()=>{eU.current!==eV&&(eU.current=eV,em.clear(),eu(),"sale"===D&&eF())},[eV,D,em.clear,eu,eF]);let eY=(0,eN.useRef)(!1);(0,eN.useEffect)(()=>{eY.current||(eY.current=!0,null==b||b())},[b]);let eW=(0,eN.useCallback)(e=>{let t=(0,ni.cloneDeep)(e),i={snapshot:t,isRedemption:"vouchers"===Y},a={...l,businessCode:e.businessCode||l.businessCode},n=()=>eD.current&&eE.current&&A(l);return(async()=>{if(!n())return!0;try{var e;if(!await I(a))return!1;if(!n()||(eS(i),eC(null),eI(!1),E("dispense"),await T(!0),!n()))return!0;let l=P(t,a);ez.current=l;let r=!1,o=e=>{n()&&(eC(e),"running"===e.status||r||(r=!0,eA(10),E("result")))};null==(e=eL.current)||e.call(eL),eL.current=l.subscribe(o),o(l.getSnapshot())}catch{n()&&(eS(i),eI(!0),E("result"))}return!0})()},[Y,l,A,T,I,P]),eG="dispense"===D||"result"===D,eK=eG||em.busy||X||el||en||L;(0,eN.useEffect)(()=>{if(T(s&&d&&eK),s&&d&&eK)return null==n?void 0:n(()=>!1)},[n,s,d,eK,T]);let eQ="result"===D&&!eT&&(null==ej?void 0:ej.status)==="complete"&&ej.items.length>0&&ej.items.every(e=>"success"===e.status);(0,eN.useEffect)(()=>{if(!eQ||!s||!d)return;let e=window.setInterval(()=>eA(e=>Math.max(0,e-1)),1e3);return()=>window.clearInterval(e)},[eQ,s,d]),(0,eN.useEffect)(()=>{eQ&&0===eP&&eF()},[eQ,eP,eF]);let eZ="idle"===D||"home"===D,eJ=s&&d&&eZ;(0,eN.useLayoutEffect)(()=>(null==p||p(eJ),()=>null==p?void 0:p(!1)),[eJ,p]);let eX=eJ&&"home"===D&&o&&!em.busy&&!Q&&!L;(0,eN.useEffect)(()=>{let e;if(!eX)return;let t=Number.isFinite(u)&&u>0?u:3e4,l=()=>{window.clearTimeout(e),e=window.setTimeout(eF,t)},i=["pointerdown","pointermove","touchstart","touchmove","keydown","wheel","click"];return i.forEach(e=>document.addEventListener(e,l,{capture:!0,passive:!0})),l(),()=>{window.clearTimeout(e),i.forEach(e=>document.removeEventListener(e,l,!0))}},[eX,u,eF]);let e0=(null==(t=em.pending)?void 0:t.phase)==="processing",e2="sale"===D||!!em.pending,e1="sale"===D&&!i.ready,e4=i.failed;return(0,eB.jsxs)("main",{className:["vm-app",x].filter(Boolean).join(" "),style:{...w,...k},children:[M,eZ&&(0,eB.jsx)(e1O,{children:"idle"===D?(0,eB.jsx)(e1F,{brand:g,subtitle:h,active:s&&d,onStart:()=>{em.getIsBusy()||E("home")},onRequestSettings:()=>{em.getIsBusy()||f()}}):(0,eB.jsx)(e1q,{brand:g,machine:v,locale:l.locale,languageDisabled:!o||em.busy||Q||L,onLocaleChange:m?e=>{s&&d&&o&&!em.getIsBusy()&&!Q&&!L&&m(e)}:void 0,active:s&&d,ready:eg,failed:eh,onBuy:()=>{em.getIsBusy()||ep()},onRedeem:()=>{em.getIsBusy()||E("redeem")},onRetry:()=>{z({ready:!1,failed:!1}),F(!1),i.retry()},onHelp:()=>{em.getIsBusy()||(J.current=!0,Z(!0),C.info({title:_("help"),content:_("contact"),okText:_("done"),className:"vm-dialog",wrapClassName:"vm-dialog-wrap",centered:!0,afterClose:()=>{J.current=!1,Z(!1)}}))},onRequestSettings:()=>{em.getIsBusy()||f()},onStaffTap:()=>{if(em.getIsBusy())return;let e=Date.now();eO.current=[...eO.current.filter(t=>e-t<3e3),e],eO.current.length>=5&&(eO.current=[],y())}})}),"redeem"===D&&(0,eB.jsx)(e1O,{children:(0,eB.jsx)(e1K,{brand:g,active:s&&d&&o&&!Q,busy:em.busy,scannedCode:em.scannedCode,onCodeChange:em.setScannedCode,onFindSale:em.submitCode,onBack:eq})}),e1&&(0,eB.jsx)(e1O,{children:(0,eB.jsxs)("section",{className:`vm-scan-start${s&&d?"":" vm-customer-paused"}`,children:[(0,eB.jsx)("header",{className:"vm-customer-home-header",children:(0,eB.jsx)(e1L,{name:g,compact:!0})}),(0,eB.jsx)("div",{className:"vm-scan-start-content",children:(0,eB.jsxs)("div",{className:"vm-scan-start-card",role:"status","aria-live":"polite","aria-atomic":"true",children:[(0,eB.jsx)("div",{className:"vm-scan-start-symbol","aria-hidden":"true",children:(0,eB.jsx)(e1E,{name:e4?"circle-alert":"loader-circle"})}),(0,eB.jsx)("h1",{children:_(e4?"scanPrepareFailed":"scanPreparing")}),(0,eB.jsx)("p",{children:_(e4?"scanPrepareFailedHint":"scanPreparingHint")})]})}),(0,eB.jsxs)("footer",{className:"vm-scan-start-actions",children:[(0,eB.jsxs)("button",{type:"button",className:"vm-scan-start-button",disabled:e0,onClick:()=>{em.clear(),E("home")},children:[(0,eB.jsx)(e1E,{name:"arrow-left"}),_("back")]}),e4&&(0,eB.jsx)("button",{type:"button",className:"vm-scan-start-button vm-scan-start-retry",onClick:()=>{i.retry()},children:_("retry")})]})]})}),i.ready&&(0,eB.jsx)("div",{className:"vm-sales",hidden:"sale"!==D||e1,children:(0,eB.jsx)(e1N,{mode:"retail",template:"kiosk",lifecycleOwner:"provider",destroyOnUnmount:!1,selectionFlowScene:"product-selection",saleDetailTemplate:"A",saleDetailModuleConfig:e4m,autoCreate:!1,enableGlobalScanListener:"sale"===D&&o&&!Q,scanRequest:o&&!Q&&em.pending||void 0,onScanRequestAccepted:em.accepted,onScanRequestSettled:em.settled,onScanPromotionResult:ex,scanScope:em.pending?"product-voucher-collection":"vouchers"===Y&&G?"product-voucher":"all",renderCatalog:e_,catalogPreparation:U,onPaymentPageActiveChange:es,mergeBookingLinesForDisplay:!1,style:{height:"100%",minHeight:0},businessCode:l.businessCode,osModuleName:i.osModuleName,otherParams:i.otherParams,inventory:i.inventory,checkoutHooks:i.checkoutHooks,locale:l.locale,isActive:s&&d&&e2,enableTempOrderPersist:!1,onPaidCheckout:eW,onRequestHome:e=>{"catalog-back"===e?eq():eF()}})}),eG&&(0,eB.jsx)(e1O,{children:(0,eB.jsx)(e1U,{brand:g,sale:(null==ew?void 0:ew.snapshot)??null,isRedemption:(null==ew?void 0:ew.isRedemption)??!1,progress:ej,error:eT,stage:D,seconds:eP,onHome:eF})})]})}function e4h(e){let{context:t,onLocaleChange:l}=e,[i,a]=(0,eN.useState)(t.locale||"en");(0,eN.useEffect)(()=>{a(t.locale||"en")},[t.locale,t.tenantDomain,t.businessCode,t.shopId,t.deviceId]);let n=(0,eN.useMemo)(()=>({...t,locale:i}),[t,i]),r=(0,eN.useCallback)(e=>{e!==i&&(null==l||l(e),a(e))},[i,l]);return(0,eB.jsx)(dy,{value:i,children:(0,eB.jsx)(e1z.Provider,{value:e.brandLogo,children:(0,eB.jsx)(e4g,{...e,context:n,onLocaleChange:r},JSON.stringify([t.tenantDomain,t.businessCode,t.shopId,t.deviceId]))})})}function e4v(e){let{brand:t,machine:l,staff:i,onSignOut:a}=e,{text:n}=e1P();return(0,eB.jsxs)("header",{className:"vm-topbar vm-topbar-staff",children:[(0,eB.jsxs)("div",{children:[(0,eB.jsxs)("strong",{children:[(0,eB.jsx)(D5,{}),l]}),(0,eB.jsx)("small",{children:t})]}),i&&(0,eB.jsxs)("button",{className:"vm-staff-badge",onClick:a,"aria-label":n("signOut"),children:[(0,eB.jsx)("span",{children:i.name.slice(0,2)}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("strong",{children:i.name}),(0,eB.jsx)("small",{children:n("signOut")})]})]})]})}function e4f(e){let{changes:t,products:l,channelLabel:i}=e,{text:a,localized:n}=e1P(),r=(0,eN.useMemo)(()=>new Map(l.map(e=>[e.id,e])),[l]),o=(0,eN.useMemo)(()=>{let e=new Map;for(let l of t){let t=void 0===l.before.spaceId?`channel:${l.channelId}`:`space:${l.before.spaceId}`,i=e.get(t)||[];i.push(l),e.set(t,i)}let l=[];for(let[t,i]of e){let{before:e,after:a}=i[0],n=i.map(e=>e.before);e.productId===a.productId?e.productId&&l.push({key:t,channels:n,productId:e.productId,before:e.quantity,after:a.quantity}):(e.productId&&l.push({key:`${t}:out`,channels:n,productId:e.productId,binding:"removed",before:e.quantity,after:0}),a.productId&&l.push({key:`${t}:in`,channels:n,productId:a.productId,binding:"added",before:0,after:a.quantity}))}return l},[t]),s=(0,eN.useMemo)(()=>{let e=new Map;for(let t of o){let l=e.get(t.productId)||{productId:t.productId,added:0,removed:0},i=t.after-t.before;l.added+=Math.max(0,i),l.removed+=Math.max(0,-i),e.set(t.productId,l)}return[...e.values()]},[o]),d=s.reduce((e,t)=>({added:e.added+t.added,removed:e.removed+t.removed}),{added:0,removed:0}),c=e=>{var t,l,i;return(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)("strong",{children:n(null==(t=r.get(e))?void 0:t.title)||(null==(l=r.get(e))?void 0:l.sku)||e}),(0,eB.jsx)("span",{className:"vm-review-sku",children:(null==(i=r.get(e))?void 0:i.sku)||"—"})]})};return(0,eB.jsxs)("div",{className:"vm-restock-review",children:[(0,eB.jsx)("p",{children:a("reviewDescription")}),(0,eB.jsx)("div",{className:"vm-review-table-scroll",children:(0,eB.jsxs)("table",{className:"vm-review-table",children:[(0,eB.jsx)("caption",{children:a("reviewDetails")}),(0,eB.jsx)("thead",{children:(0,eB.jsxs)("tr",{children:[(0,eB.jsx)("th",{children:a("channel")}),(0,eB.jsx)("th",{children:a("product")}),(0,eB.jsx)("th",{children:a("reviewBefore")}),(0,eB.jsx)("th",{children:a("quantityAfter")}),(0,eB.jsx)("th",{children:a("reviewDelta")})]})}),(0,eB.jsx)("tbody",{children:o.map(e=>{let t=e.after-e.before;return(0,eB.jsxs)("tr",{children:[(0,eB.jsx)("td",{children:e.channels.map(e=>(0,eB.jsx)("div",{children:i(e)},e.id))}),(0,eB.jsxs)("td",{children:[c(e.productId),e.binding&&(0,eB.jsx)("span",{className:"vm-review-binding",children:a("removed"===e.binding?"reviewProductRemoved":"reviewProductAdded")})]}),(0,eB.jsx)("td",{children:e.before}),(0,eB.jsx)("td",{children:e.after}),(0,eB.jsxs)("td",{className:t>0?"vm-review-added":t<0?"vm-review-removed":"",children:[t>0?"+":"",t]})]},e.key)})})]})}),(0,eB.jsx)("div",{className:"vm-review-table-scroll",children:(0,eB.jsxs)("table",{className:"vm-review-table vm-review-summary",children:[(0,eB.jsx)("caption",{children:a("reviewSummary")}),(0,eB.jsx)("thead",{children:(0,eB.jsxs)("tr",{children:[(0,eB.jsx)("th",{children:a("product")}),(0,eB.jsx)("th",{children:a("reviewAdded")}),(0,eB.jsx)("th",{children:a("reviewRemoved")})]})}),(0,eB.jsx)("tbody",{children:s.map(e=>(0,eB.jsxs)("tr",{children:[(0,eB.jsx)("td",{children:c(e.productId)}),(0,eB.jsxs)("td",{className:"vm-review-added",children:["+",e.added]}),(0,eB.jsxs)("td",{className:"vm-review-removed",children:["−",e.removed]})]},e.productId))})]})}),(0,eB.jsx)("p",{className:"vm-review-totals",children:a("reviewTotals",d)})]})}let e4y=e=>({productId:e.productId,quantity:null===e.quantity?"":String(e.quantity)}),e4b=(e,t)=>t.productId!==e.productId||(null===e.quantity?""!==t.quantity:""===t.quantity.trim()||Number(t.quantity)!==e.quantity),e4x=e=>"enabled"===e.status&&!e.issue&&null!==e.quantity,e4k=(e,t)=>e4x(e)&&""!==t.quantity.trim()&&Number.isSafeInteger(Number(t.quantity))&&Number(t.quantity)>=0&&Number(t.quantity)<=e.capacity&&(null!==t.productId||0===Number(t.quantity));function e4_(e){let{context:t,staff:l,onBack:i,setLeaveGuard:a,service:n,blockNavigation:r}=e,{text:o,localized:s}=e1P(),[d,c]=eM.Modal.useModal(),[u,p]=(0,eN.useState)(null),[m,g]=(0,eN.useState)({}),[h,v]=(0,eN.useState)(!0),[f,y]=(0,eN.useState)(!1),[b,x]=(0,eN.useState)(""),[k,_]=(0,eN.useState)(!1),[w,S]=(0,eN.useState)(""),[j,N]=(0,eN.useState)(),[C,M]=(0,eN.useState)(!1),[T,I]=(0,eN.useState)(null),P=(0,eN.useRef)(null),[A,D]=(0,eN.useState)(null),[E,O]=(0,eN.useState)({}),z=(0,eN.useRef)(null),L=(0,eN.useRef)(null),R=(0,eN.useRef)(!1),$=(0,eN.useRef)(!0),F=(0,eN.useRef)(t);F.current=t;let q=(0,eN.useRef)(!1),B=(0,eN.useRef)(null),H=C||null!==T||null!==A,V=(0,eN.useCallback)(async()=>{var e,t;null==(e=L.current)||e.abort(),null==(t=z.current)||t.abort(),z.current=null,D(null),O({}),P.current=null,I(null);let l=new AbortController;L.current=l,v(!0),y(!1),x("");try{let e=await n.load(F.current,l.signal);if(l.signal.aborted)return;p(e),N(e.inventorySync),g({}),_(!1),S("")}catch(e){l.signal.aborted||(y(!0),x(e instanceof Error?e.message:""))}finally{l.signal.aborted||v(!1)}},[t.tenantDomain,t.businessCode,t.shopId,t.deviceId,n]);(0,eN.useEffect)(()=>($.current=!0,V(),()=>{var e,t;$.current=!1,null==(e=L.current)||e.abort(),null==(t=z.current)||t.abort(),P.current=null}),[V]);let U=e=>m[e.id]||e4y(e),Y=((null==u?void 0:u.channels)||[]).filter(e=>e4b(e,U(e)));q.current=Y.length>0;let W=Y.some(e=>!e4k(e,U(e))),G=(0,eN.useMemo)(()=>new Map(null==u?void 0:u.products.map(e=>[e.id,e])),[null==u?void 0:u.products]),K=(0,eN.useMemo)(()=>[{value:"",label:o("noProduct"),disabled:!1},...((null==u?void 0:u.products)||[]).map(e=>({value:e.id,label:s(e.title)||e.sku||e.id,disabled:!!e.disabled}))],[null==u?void 0:u.products,s,o]),Q=(null==u?void 0:u.groupType)==="board"?"board":"row",Z=e=>s(e.groupName)||e.row,J=e=>`${o(Q)} ${Z(e)} \xb7 ${o("editChannel",{code:e.code})}`,X=function(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:U(e);return e4x(e)&&!!l.productId&&G.has(l.productId)&&!(null==(t=G.get(l.productId))?void 0:t.disabled)},ee=(0,eN.useCallback)(()=>{let e;if(R.current||P.current||z.current)return Promise.resolve(!1);if(!q.current)return Promise.resolve(!0);if(B.current)return B.current.promise;let t=new Promise(t=>{e=t}),l=d.confirm({title:o("discardTitle"),content:o("discardDescription"),okText:o("discard"),cancelText:o("keepEditing"),className:"vm-dialog",wrapClassName:"vm-dialog-wrap",centered:!0,onOk:()=>{B.current=null,e(!0)},onCancel:()=>{B.current=null,e(!1)}});return B.current={promise:t,close:()=>{l.destroy(),e(!1)}},t},[d,o]);(0,eN.useEffect)(()=>{a(ee);let e=e=>{(q.current||R.current||z.current)&&(e.preventDefault(),e.returnValue="")};window.addEventListener("beforeunload",e);let t=null==r?void 0:r(()=>!R.current&&!P.current&&!z.current&&(q.current?o("discardDescription"):void 0));return()=>{var l;a(null),null==t||t(),window.removeEventListener("beforeunload",e),null==(l=B.current)||l.close(),B.current=null}},[r,ee,a,o]);let et=(e,t)=>{!R.current&&!P.current&&!z.current&&e4x(e)&&(_(!1),g(l=>{let i={...l};for(let a of(null==u?void 0:u.channels)||[])e4x(a)&&(a.id===e.id||void 0!==e.spaceId&&a.spaceId===e.spaceId)&&(i[a.id]={...l[a.id]||e4y(a),...t});return i}))},el=async()=>{var e;let i=P.current;if(!u||!1===u.canSubmit||R.current||z.current||!(null==i?void 0:i.length))return;R.current=!0,M(!0),_(!1),S(""),null==(e=L.current)||e.abort();let a=new AbortController;L.current=a;try{let e=await n.submit(t,i,l,a.signal);if(a.signal.aborted)return;let r=!e||"accepted"===e.status||"synced"===e.status;if(e&&"accepted"===e.status)p(e.data),N(e.data.inventorySync);else{let t=new Map(i.map(e=>[e.channelId,e.after])),l=new Set(i.map(e=>e.before.spaceId).filter(e=>void 0!==e));p({...u,channels:u.channels.map(i=>r?t.get(i.id)||i:t.has(i.id)||void 0!==i.spaceId&&l.has(i.spaceId)?{...i,status:"blocked",issue:e&&"review"===e.status?"stockSyncReview":"stockSyncPending"}:i)}),N(e||void 0)}g({}),q.current=!1,r&&(0,nB.PisellToast)({content:o("saved")})}catch(e){a.signal.aborted||(_(!0),S(e instanceof Error?e.message:""))}finally{R.current=!1,P.current=null,$.current&&(M(!1),I(null))}},ei=async e=>{if(!n.testChannel||h||f||R.current||P.current||z.current)return;let l=new AbortController;z.current=l,D(e.id),O(t=>{let l={...t};return delete l[e.id],l});try{let i=await n.testChannel(t,{...e},l.signal);!l.signal.aborted&&$.current&&O(t=>({...t,[e.id]:i}))}catch(t){!l.signal.aborted&&$.current&&O(l=>({...l,[e.id]:{success:!1,uncertain:!0,message:t instanceof Error?t.message:o("channelTestUnknown")}}))}finally{z.current===l&&(z.current=null,$.current&&D(null))}},ea=(0,eN.useMemo)(()=>{let e=new Map;return null==u||u.channels.forEach(t=>e.set(t.row,[...e.get(t.row)||[],t])),Array.from(e.entries())},[null==u?void 0:u.channels]);return(0,eB.jsxs)("section",{className:"vm-restock vm-page",children:[c,(0,eB.jsx)(eM.Modal,{open:null!==T,title:o("reviewTitle"),className:"vm-dialog vm-restock-review-dialog",wrapClassName:"vm-dialog-wrap",width:760,centered:!0,maskClosable:!1,closable:!C,keyboard:!C,confirmLoading:C,cancelButtonProps:{disabled:C},okText:o("reviewConfirm"),cancelText:o("keepEditing"),onCancel:()=>{R.current||(P.current=null,I(null))},onOk:()=>void el(),children:T&&u&&(0,eB.jsx)(e4f,{changes:T,products:u.products,channelLabel:J})}),(0,eB.jsxs)("header",{className:"vm-page-heading",children:[i&&(0,eB.jsx)("button",{className:"vm-icon-button","aria-label":o("back"),disabled:H,onClick:async()=>{await ee()&&i()},children:(0,eB.jsx)(u8,{})}),(0,eB.jsxs)("div",{className:"vm-restock-title",children:[(0,eB.jsx)("h1",{children:o("configure")}),(0,eB.jsx)("p",{children:o("configureDescription")}),n.testChannel&&(0,eB.jsx)("span",{className:"vm-caption",children:o("channelTestHint")})]}),(0,eB.jsx)("button",{className:"vm-button vm-button-outline vm-fill-all",disabled:h||f||H||!(null==u?void 0:u.channels.some(e=>X(e))),onClick:()=>{!u||h||f||R.current||P.current||z.current||(_(!1),g(e=>{let t={...e};for(let l of u.channels){let i=e[l.id]||e4y(l);X(l,i)&&(t[l.id]={...i,quantity:String(l.capacity)})}return t}))},children:o("fillAll")})]}),!h&&!f&&(null==u?void 0:u.canSubmit)===!1&&(0,eB.jsx)(eM.Alert,{className:"vm-restock-notice",type:"info",showIcon:!0,message:o("restockDraftOnly")}),(j&&"synced"!==j.status||k)&&(0,eB.jsx)(eM.Alert,{className:"vm-restock-notice",type:k?"error":(null==j?void 0:j.status)==="review"?"warning":"info",showIcon:!0,message:k?w||o("saveError"):(null==j?void 0:j.message)||o("stockSyncPending"),action:(0,eB.jsx)("button",{className:"vm-button vm-button-outline",disabled:h||H,onClick:async()=>{await ee()&&V()},children:o("stockRefresh")})}),(0,eB.jsx)("div",{className:"vm-restock-scroll","aria-busy":h||C,children:h?(0,eB.jsxs)("div",{className:"vm-state",children:[(0,eB.jsx)(eM.Spin,{}),(0,eB.jsx)("span",{children:o("loading")})]}):f?(0,eB.jsxs)("div",{className:"vm-state",role:"alert",children:[(0,eB.jsx)("p",{children:b||o("loadError")}),(0,eB.jsx)("button",{className:"vm-button",onClick:()=>void V(),children:o("retry")})]}):(null==u?void 0:u.channels.length)?(0,eB.jsxs)("div",{className:"vm-inline-list",children:[(0,eB.jsxs)("div",{className:"vm-list-labels",children:[(0,eB.jsx)("span",{children:o("channel")}),(0,eB.jsx)("span",{children:o("productStock")}),(0,eB.jsx)("span",{children:o("quantityAfter")}),(0,eB.jsx)("span",{children:o("action")})]}),ea.map(e=>{let[t,l]=e;return(0,eB.jsxs)("div",{className:"vm-channel-group",children:[ea.length>1&&(0,eB.jsxs)("div",{className:"vm-channel-group-heading",children:[o(Q)," ",Z(l[0])]}),(0,eB.jsx)("div",{className:"vm-group-items",children:l.map(e=>{let t,l,i,a,r,s,d,c,p=G.get(e.productId||""),m="enabled"!==e.status?e.status:0===e.quantity?"empty":null!==e.quantity&&e.quantity<=e.lowThreshold?"low":null;return(0,eB.jsxs)("div",{className:`vm-channel-line ${m?`vm-status-${m}`:""} ${e4b(e,U(e))?"vm-is-changed":""}`,children:[(0,eB.jsxs)("strong",{className:"vm-channel-code",children:[(0,eB.jsx)("span",{className:"vm-restock-field-label",children:o("channel")}),e.code]}),(0,eB.jsxs)("div",{className:"vm-channel-product",children:[(0,eB.jsx)("span",{className:"vm-restock-field-label",children:o("productStock")}),(t=U(e),(0,eB.jsx)("div",{className:"vm-product-picker",children:(0,eB.jsx)(eM.Select,{className:"vm-product-select",bordered:!1,showSearch:!1,virtual:!0,options:K,placeholder:e.issue?o(e.issue):o("noProduct"),"aria-label":`${J(e)} ${o("product")}`,disabled:H||!e4x(e),value:t.productId||void 0,onChange:t=>et(e,{productId:t||null,quantity:"0"})})})),(0,eB.jsxs)("span",{className:"vm-caption",children:[(0,eB.jsx)("span",{className:"vm-sku",children:(null==p?void 0:p.sku)||"—"})," ","\xb7 ",o("current")," ",e.quantity??"—","enabled"!==e.status&&(0,eB.jsxs)(eB.Fragment,{children:[" \xb7 ",o(e.status)]})]}),e.issue&&(0,eB.jsx)("span",{className:"vm-field-error",children:o(e.issue)})]}),(i=Number((l=U(e)).quantity)||0,a=H||!X(e,l),r=e4x(e)&&!e4k(e,l),(0,eB.jsxs)("div",{className:"vm-quantity-editor",children:[(0,eB.jsx)("span",{className:"vm-restock-field-label",children:o("quantityAfter")}),(0,eB.jsxs)("div",{className:"vm-stepper",children:[(0,eB.jsx)("button",{className:"vm-icon-button","aria-label":`${J(e)} −1`,disabled:a||i<=0,onClick:()=>et(e,{quantity:String(Math.max(0,Math.min(e.capacity,Math.trunc(i)-1)))}),children:(0,eB.jsx)(Nw,{})}),(0,eB.jsx)("input",{inputMode:"numeric",type:"number",step:1,min:0,max:e.capacity,"aria-label":`${J(e)} ${o("quantity")}`,"aria-invalid":r,disabled:a,placeholder:"—",value:l.quantity,onChange:t=>et(e,{quantity:t.target.value})}),(0,eB.jsx)("button",{className:"vm-icon-button","aria-label":`${J(e)} +1`,disabled:a||i>=e.capacity,onClick:()=>et(e,{quantity:String(Math.min(e.capacity,Math.max(0,Math.trunc(i)+1)))}),children:(0,eB.jsx)(dh,{})})]}),(0,eB.jsx)("span",{className:"vm-caption",children:o("capacity",{capacity:e.capacity})}),r&&(0,eB.jsx)("span",{className:"vm-field-error",role:"alert",children:o("invalidQuantity")})]})),(s=E[e.id],d=A===e.id,c="string"==typeof e.machineId&&!!e.machineId&&Number.isSafeInteger(e.boardDeviceId)&&e.boardDeviceId>0&&Number.isInteger(e.laneId)&&e.laneId>=1&&e.laneId<=100,(0,eB.jsxs)("div",{className:"vm-row-actions",children:[(0,eB.jsx)("span",{className:"vm-restock-field-label",children:o("action")}),(0,eB.jsxs)("div",{className:"vm-row-action-buttons",children:[(0,eB.jsx)("button",{className:"vm-button vm-button-outline",disabled:H||!X(e),onClick:()=>et(e,{quantity:String(e.capacity)}),children:o("fill")}),(0,eB.jsx)("button",{className:"vm-button vm-button-outline",title:o("reset"),"aria-label":`${J(e)} ${o("reset")}`,disabled:H||!e4b(e,U(e)),onClick:()=>{!R.current&&!P.current&&!z.current&&(g(t=>{let l={...t};for(let t of(null==u?void 0:u.channels)||[])(t.id===e.id||void 0!==e.spaceId&&t.spaceId===e.spaceId)&&delete l[t.id];return l}),_(!1))},children:o("reset")}),(0,eB.jsx)("button",{className:"vm-button vm-button-outline vm-channel-test",title:o("channelTestHint"),"aria-label":`${J(e)} ${o("channelTest")}`,"aria-busy":d,disabled:H||!n.testChannel||!c,onClick:()=>void ei(e),children:o(d?"channelTesting":"channelTest")})]}),!d&&s&&(0,eB.jsxs)("span",{className:`vm-channel-test-result ${s.success?"vm-test-success":s.uncertain?"vm-test-unknown":"vm-test-failed"}`,role:"status",children:[o(s.success?"channelTestSuccess":s.uncertain?"channelTestUnknown":"channelTestFailed"),!s.success&&s.message&&(0,eB.jsx)("span",{className:"vm-caption",children:s.message})]})]}))]},e.id)})})]},t)})]}):(0,eB.jsx)("div",{className:"vm-state",children:o("noChannels")})}),(0,eB.jsxs)("footer",{className:"vm-submit-bar",children:[(0,eB.jsxs)("div",{children:[(0,eB.jsx)("span",{className:"vm-caption",children:o("pending")}),(0,eB.jsxs)("strong",{children:[Y.length," ",o("channels")]})]}),(0,eB.jsxs)("button",{className:"vm-button vm-button-primary",disabled:H||h||f||(null==u?void 0:u.canSubmit)===!1||!Y.length||W,onClick:()=>{if(!u||!1===u.canSubmit||h||f||R.current||P.current||z.current||!Y.length||W)return;let e=Y.map(e=>{var t;let l=U(e),i=Number(l.quantity),a=l.productId===e.productId;return{channelId:e.id,before:{...e},after:{...e,productId:l.productId,inventoryItemId:null==(t=G.get(l.productId||""))?void 0:t.inventoryItemId,stockId:a?e.stockId:void 0,submissionId:void 0,quantity:i,availableQuantity:a?null==e.availableQuantity||null===e.quantity?e.availableQuantity:e.availableQuantity+i-e.quantity:i}}}),t=new Map;for(let l of e){let e=G.get(l.after.productId||"");if(l.after.productId&&(!e||e.disabled))return void(0,nB.PisellToast)({content:o("restockStockInvalid"),type:"error"});if(void 0===l.before.spaceId)continue;let i=t.get(l.before.spaceId);if(i&&(i.after.productId!==l.after.productId||i.after.quantity!==l.after.quantity))return void(0,nB.PisellToast)({content:o("restockChanged"),type:"error"});t.set(l.before.spaceId,l)}P.current=e,I(e)},children:[C?(0,eB.jsx)(eM.Spin,{size:"small"}):(0,eB.jsx)(gT,{}),o(C?"saving":"reviewTitle")]})]})]})}function e4w(e){let{context:t,brand:l,machine:i,staff:a=null,onBack:n,onSignOut:r,service:o,blockNavigation:s,className:d,style:c}=e,u=e4u(),p=(0,eN.useRef)(null),m=(0,eN.useRef)(!0),g=(0,eN.useCallback)(e=>{p.current=e},[]);(0,eN.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let h=async()=>{(!p.current||await p.current())&&m.current&&(null==r||r())};return(0,eB.jsxs)("main",{className:["vm-app vm-staff-mode",d].filter(Boolean).join(" "),style:{...u,...c},children:[(0,eB.jsx)(e4v,{brand:l,machine:i,staff:a,onSignOut:()=>void h()}),(0,eB.jsx)(e4_,{context:t,staff:a,onBack:n,setLeaveGuard:g,service:o,blockNavigation:s})]})}function e4S(e){let{context:t}=e;return(0,eB.jsx)(dy,{value:t.locale,children:(0,eB.jsx)(e4w,{...e},JSON.stringify([t.tenantDomain,t.businessCode,t.shopId,t.deviceId]))})}function e4j(e){let{context:t,staff:l,service:i,onConfigure:a,onResume:n}=e,{text:r}=e1P(),[o,s]=(0,eN.useState)(null),[d,c]=(0,eN.useState)(!1),[u,p]=(0,eN.useState)(0);(0,eN.useEffect)(()=>{let e=new AbortController;return c(!1),s(null),i.load(t,e.signal).then(t=>{e.signal.aborted||s(t)}).catch(()=>{e.signal.aborted||c(!0)}),()=>e.abort()},[t.businessCode,t.tenantDomain,t.shopId,t.deviceId,i,u]);let m=(null==o?void 0:o.channels)||[],g=[...new Map(m.filter(e=>"enabled"===e.status&&e.productId).map(e=>[void 0===e.spaceId?`channel:${e.id}`:`space:${e.spaceId}`,e])).values()],h=[{label:"sellable",value:g.some(e=>null===e.availableQuantity||null===e.quantity)?null:g.reduce((e,t)=>e+(t.availableQuantity??t.quantity??0),0)},{label:"low",value:m.filter(e=>"enabled"===e.status&&null!==e.quantity&&e.quantity>0&&e.quantity<=e.lowThreshold).length},{label:"empty",value:m.filter(e=>"enabled"===e.status&&0===e.quantity).length},{label:"unavailable",value:m.filter(e=>"enabled"!==e.status).length}];return(0,eB.jsxs)("section",{className:"vm-staff-home vm-page",children:[(0,eB.jsx)("header",{className:"vm-page-heading",children:(0,eB.jsxs)("div",{children:[(0,eB.jsx)("p",{children:r("welcomeStaff",{name:l.name})}),(0,eB.jsx)("h1",{children:r("staffHome")})]})}),(0,eB.jsxs)("div",{className:"vm-staff-content",children:[d?(0,eB.jsx)(eM.Alert,{type:"warning",message:r("loadError"),action:(0,eB.jsx)("button",{className:"vm-text-button",onClick:()=>p(e=>e+1),children:r("retry")})}):(0,eB.jsx)("div",{className:"vm-stats",children:h.map(e=>(0,eB.jsxs)("div",{className:`vm-stat vm-stat-${e.label}`,children:[(0,eB.jsx)("span",{children:r(e.label)}),(0,eB.jsx)("strong",{children:o?e.value??"—":"—"})]},e.label))}),(0,eB.jsxs)("button",{className:"vm-service-card",onClick:a,children:[(0,eB.jsx)(Po,{}),(0,eB.jsxs)("div",{children:[(0,eB.jsx)("h2",{children:r("configure")}),(0,eB.jsx)("p",{children:r("configureCard")})]}),(0,eB.jsx)(u5,{})]}),(0,eB.jsxs)("button",{className:"vm-button vm-button-outline vm-resume",onClick:n,children:[r("resume"),(0,eB.jsx)(u5,{})]})]})]})}function e4N(e){let{context:t,brand:l,machine:i,staff:a,service:n,onConfigure:r,onSignOut:o}=e,s=e4u();return(0,eB.jsx)(dy,{value:t.locale,children:(0,eB.jsxs)("main",{className:"vm-app vm-staff-mode",style:s,children:[(0,eB.jsx)(e4v,{brand:l,machine:i,staff:a,onSignOut:o}),(0,eB.jsx)(e4j,{context:t,staff:a,service:n,onConfigure:r,onResume:o})]})})}function e4C(e,t,l){let i=Object.entries(e).reduce((e,t)=>{let[l,i]=t;return"channel"===l&&""===String(i??"").trim()||("otherParams"===l&&i&&"object"==typeof i&&!Array.isArray(i)?e[l]={...e[l]||{},...i}:void 0!==i&&(e[l]=i)),e},{...t||{}}),a=[null==l?void 0:l.menuIds,e.menuIds,null==t?void 0:t.menuIds].map(ex_).find(e=>e.length>0);return a?i.menuIds=a:delete i.menuIds,i}function e4M(){var e;if("u"<typeof window)return"100dvh";let t=function(){if("u"<typeof window||"u"<typeof document)return 1;let e=document.body.style.transform,t=e&&"none"!==e?e:window.getComputedStyle(document.body).transform;if(!t||"none"===t)return 1;let l=new DOMMatrixReadOnly(t);return Math.sqrt(l.c*l.c+l.d*l.d)||1}();if(.001>Math.abs(t-1))return"100%";let l=(null==(e=window.visualViewport)?void 0:e.height)||window.innerHeight;return`${l/t}px`}function e4T(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];for(let e of t){let t=String(e||"").trim();if(t)return t}return""}function e4I(e){var t,l,i,a,n,r,o;let[s,d]=(0,eN.useState)(e4M),c=eR(),u=eF(),p=(null==c||null==(l=c.appHelper)||null==(t=l.constants)?void 0:t.hostPageProps)||{},m=(null==c||null==(i=c.engine)?void 0:i.props)||{},g=e4T(p.channel,null==(a=p.otherParams)?void 0:a.channel),{className:h,mode:v="retail",style:f,businessCode:y,channel:b,otherParams:x,menuIds:k,productLoadParams:_,bootstrapSlot:w,variant:S,normalProductDetailConfig:j,osModuleName:N,...C}=e4C(e,{...p,...m,channel:e4T(g,m.channel),otherParams:{...p.otherParams||{},...m.otherParams||{},...g?{channel:g}:{}}},p),M=e4T(g,b,null==x?void 0:x.channel,null==c||null==(o=c.appHelper)||null==(r=o.utils)||null==(n=r.getData)?void 0:n.call(r,"channel"),"pos"),T=eHd(eHs(null==x?void 0:x.platform,u),S),I=(0,eN.useMemo)(()=>{if(!_&&!(null==k?void 0:k.length))return;let{menu_list_ids:e,...t}=_||{};return{...t,...(null==k?void 0:k.length)?{menu_list_ids:k}:{}}},[k,_]),P=(0,eN.useMemo)(()=>({...x||{},enforceSingleBookingStartDate:!0,...M?{channel:M}:{},enableBusinessAvailability:!!T.platform,...T.platform?{platform:T.platform}:{}}),[M,T.platform,x]),A="pos"===String(M||"").trim().toLowerCase(),D=(0,eN.useMemo)(()=>({...j,resolveAppearance:(null==j?void 0:j.resolveAppearance)??((null==j?void 0:j.appearance)?void 0:eGP),...A?{allowUnavailableBookingSelection:!0,allowNoResourceBookingSelection:!0}:{},presentationPlatform:T.productDetailPresentationPlatform,hideQuantityForBookingProducts:null==j?void 0:j.hideQuantityForBookingProducts}),[A,T.productDetailPresentationPlatform,j]);return(0,eN.useEffect)(()=>{var e;let t=()=>{d(e4M())};t(),window.addEventListener("resize",t),null==(e=window.visualViewport)||e.addEventListener("resize",t);let l=new MutationObserver(t);return l.observe(document.body,{attributes:!0,attributeFilter:["style","class"]}),()=>{var e;window.removeEventListener("resize",t),null==(e=window.visualViewport)||e.removeEventListener("resize",t),l.disconnect()}},[]),(0,eB.jsx)(eqw.Provider,{value:eGI,children:(0,eB.jsx)(e1N,{...C,className:h,mode:v,businessCode:y,otherParams:P,lifecycleOwner:"provider",osModuleName:N,selectionFlowScene:"product-selection",enableGlobalScanListener:!0,normalProductDetailConfig:D,mergeBookingLinesForDisplay:T.mergeBookingLinesForDisplay,productLoadParams:I,enableMenuOverride:!!(null==k?void 0:k.length),autoCreate:!1,bootstrapSlot:w,saleDetailTemplate:"A",style:{minHeight:s,height:s,...f},template:"kiosk",variant:T.variant})})}function e4P(e){var t,l,i,a,n,r,o,s;let{kind:d,...c}=e,u=eR(),p=eF(),m=(null==u||null==(l=u.appHelper)||null==(t=l.constants)?void 0:t.hostPageProps)||{},g=e4C(c,{...m,...(null==u||null==(i=u.engine)?void 0:i.props)||{},otherParams:{...m.otherParams||{},...(null==u||null==(n=u.engine)||null==(a=n.props)?void 0:a.otherParams)||{}}},m),{otherParams:h,channel:v,businessCode:f,variant:y,...b}=g,x=(null==h?void 0:h.platform)||p,k="kiosk"===String(x||"").trim().toLowerCase(),_=f||(null==h?void 0:h.businessCode)||"venue_booking",w=v||(null==h?void 0:h.channel)||(k?"kiosk":"online_ordering"),S=String((null==u||null==(s=u.appHelper)||null==(o=s.utils)||null==(r=o.getData)?void 0:r.call(o,"timezone"))||(null==h?void 0:h.businessTimezone)||""),j=(0,eN.useMemo)(()=>({...h,businessCode:_,channel:w,platform:x,venueBookingMode:d,...k?{enableSessionStoragePersist:!1}:{},businessTimezone:S,type:"appointment_booking",enableBusinessAvailability:!0,enforceSingleBookingStartDate:!0,enablePickupTiming:!1}),[_,w,h,x,S,d,k]);return(0,eB.jsx)(e1N,{...b,osKey:g.osKey||`venue-booking-${d}`,template:"tickets"===d?"venue-ticket-booking":"venue-party-booking",mode:"retail",businessCode:_,otherParams:j,variant:"kiosk"===String(j.platform).trim().toLowerCase()?"phone":y||("h5"===j.platform?"phone":"desktop"),lifecycleOwner:"provider",orderId:void 0,autoBootstrap:!1,autoRestoreOnInit:!1,autoCreate:!1,autoInitBookingContext:!1,enableGlobalScanListener:!1,enableTempOrderSync:k,enableMenuOverride:!1,productLoadParams:void 0,autoReloadProductCatalogOnCustomerChange:!1,mergeBookingLinesForDisplay:!1})}function e4A(e){return(0,eB.jsx)(e4P,{...e,kind:"tickets"})}function e4D(e){return(0,eB.jsx)(e4P,{...e,kind:"party"})}function e4E(e){let{payload:t}=e,l=eb$(),i=l.bookingTicket,a=l.clearCartAndReset,n="picoding"===l.salesSettingsSource&&!l.salesSettings,r=(0,eN.useRef)(Promise.resolve());return(0,eN.useEffect)(()=>{if(!i||n)return;let e=!1;return r.current=r.current.then(async()=>{if(!e){if(t.tempOrder){if(!i.replaceTempOrder)return void console.warn("[SharedSecondaryBigSale] 当前销售实例不支持 replaceTempOrder");await i.replaceTempOrder(t.tempOrder)}else await a();!e&&t.walletAssetsSnapshot&&i.importWalletAssetsSnapshot&&await i.importWalletAssetsSnapshot(t.walletAssetsSnapshot)}}).catch(e=>{console.warn("[SharedSecondaryBigSale] 应用副屏订单快照失败",e)}),()=>{e=!0}},[i,a,t,n]),null}let e4O=0;function e4z(e){var t,l,i;let{osKey:a="shared-secondary-big-sale",saleDetailModuleConfig:n,secondaryScreenDisplay:r,className:o,style:s}=e,d=function(){var e,t,l,i,a;let n=eR(),r=null==n||null==(l=n.appHelper)||null==(t=l.utils)||null==(e=t.getApp)?void 0:e.call(t),o=null==r||null==(i=r.getPlugin)?void 0:i.call(r,"unifiedCommunication"),{runtime:s}=(null==o||null==(a=o.useRuntime)?void 0:a.call(o))||{},d=(null==s?void 0:s.role)==="secondary-screen",c=(0,eN.useRef)(0),[u,p]=(0,eN.useState)(null);return(0,eN.useEffect)(()=>{var e,t,l,i;if(!d)return;let a=!1,n=null==o||null==(t=o.sdk)||null==(e=t.onMessage)?void 0:e.call(t,e=>{var t;let l=eNj(e);!a&&l&&"secondary-screen"!==l.sourceRole&&(t=c.current,!0===l.isActive&&l.timestamp>t&&(c.current=l.timestamp,p(l)))});return Promise.resolve(null==o||null==(i=o.sdk)||null==(l=i.publishData)?void 0:l.call(i,{target:{type:"main"},data:{type:eNx,requestId:`shared-secondary-${Date.now()}-${Math.random().toString(16).slice(2)}`,timestamp:Date.now()},meta:{}})).catch(e=>{console.warn("[SharedSecondaryBigSale] 请求主屏订单快照失败",e)}),()=>{if(a=!0,n&&"function"==typeof n.then)n.then(e=>{var t;return null==e||null==(t=e.remove)?void 0:t.call(e)}).catch(()=>{});else{var e;null==n||null==(e=n.remove)||e.call(n)}}},[d,o]),u}(),c=eR(),u=d?eNS(d):void 0,p=null==u?void 0:u.businessCode,m=null==c||null==(i=c.appHelper)||null==(l=i.utils)||null==(t=l.getData)?void 0:t.call(l,"channel"),g=(null==u?void 0:u.channel)||("string"==typeof m&&m.trim()?m.trim():"cds"),h=(0,eN.useMemo)(()=>++e4O,[a,p,g]),v=(0,eN.useMemo)(()=>({channel:g}),[g]);return d&&p?(0,eB.jsx)(e1N,{osKey:`${a}-${encodeURIComponent(g)}-${h}`,businessCode:p,otherParams:v,mode:"ticket",template:"secondaryScreen",saleDetailTemplate:"A",autoCreate:!1,autoRestoreOnInit:!1,autoInitBookingContext:!1,enableTempOrderSync:!1,secondaryScreenDisplay:r,saleDetailModuleConfig:n,className:o,style:s,bootstrapSlot:(0,eB.jsx)(e4E,{payload:d})},h):(0,eB.jsx)("div",{className:o,style:s,"aria-busy":"true"})}let e4L=eC().memo(e1j);async function e4R(e){var t,l,i,a,n,r,o;let s=(null==(l=e.bookingTicket)||null==(t=l.getTempOrder)?void 0:t.call(l))??e.tempOrder??null,d=(null==(a=e.salesDetail)||null==(i=a.header)?void 0:i.order_id)??(null==(n=e.salesDetail)?void 0:n.order_id),c=eIw(null==s?void 0:s.order_id)||!!d,u=(null==s||null==(r=s.products)?void 0:r.length)??0,p=(null==s||null==(o=s.bookings)?void 0:o.length)??0;c?await e.restore():((u>0||p>0)&&"function"==typeof e.clearCartItemsOnly&&await e.clearCartItemsOnly(),await e.createNew())}function e4$(e){var t,l;let{open:i,contentActive:a,openNonce:n=0,orderId:r,preloadedSalesDetail:o,createSeed:s,bookingTimeRangeFromCalendar:d,bookingConfigParams:c,onCreateSeedReady:u,onCreateSeedError:p,onEditReady:m}=e,g=eb$(),h=eNa(),v=eC().useContext(eCf),f=eC().useContext(eCy),y=(0,eN.useRef)(!1),b=(0,eN.useRef)(0),x=(0,eN.useRef)(0),k=(0,eN.useRef)(g);k.current=g;let _=(0,eN.useRef)(h);_.current=h;let w=(0,eN.useRef)(s);w.current=s;let S=(0,eN.useRef)(d);S.current=d;let j=(0,eN.useRef)(o);j.current=o;let N=(0,eN.useRef)(c);N.current=c;let C=(0,eN.useRef)(v);C.current=v;let M=(0,eN.useRef)(f);M.current=f;let T=(0,eN.useRef)(u);T.current=u;let I=(0,eN.useRef)(p);I.current=p;let P=(0,eN.useRef)(m);P.current=m;let A=(0,eN.useRef)(a),D=(0,eN.useRef)(null),E=`${!s?"":`${(null==(t=s.row)?void 0:t.id)??""}-${(null==(l=s.reservationRuleProduct)?void 0:l.id)??""}`}:${(null==d?void 0:d.startAt)||""}:${(null==d?void 0:d.endAt)||""}`,O=!!g.bookingTicket;return(0,eN.useEffect)(()=>{let e=A.current;if(A.current=a,!e||a||!k.current.bookingTicket)return;let t=k.current.restore().then(()=>void 0).catch(e=>{console.warn("[BigSaleDialog] close cleanup failed",e)});D.current=t,t.finally(()=>{D.current===t&&(D.current=null)})},[a,O]),(0,eN.useEffect)(()=>{if(!i){y.current=!1,b.current+=1,x.current+=1;return}y.current=!1,b.current+=1,x.current+=1},[i,n,E]),(0,eN.useEffect)(()=>{var e;if(!i||!r||s)return;let t=k.current;if(!t.bookingTicket)return;let l=x.current;return null==(e=M.current)||e.call(M,r),(async()=>{var e,i,a,n,o,s,d;try{if(await D.current,l!==x.current)return;let d=function(e,t){if(!e||"object"!=typeof e)return;let l=e.order_id;if(null!=l&&String(l)===String(t)&&Array.isArray(e.products)&&Array.isArray(e.bookings))return e}(j.current,r);if(await t.loadDetail(d?{orderId:r,preloadedSalesDetail:d}:r),l!==x.current)return;let c=(null==(i=t.bookingTicket)||null==(e=i.getTempOrder)?void 0:e.call(i))??t.tempOrder,u=exy(c??null);if(await (null==(n=t.bookingTicket)||null==(a=n.initBookingContext)?void 0:a.call(n,exx(N.current,{date:ew()(),bookingIds:u.length?u:void 0,loadResources:!0}))),l!==x.current||(null==(o=C.current)||o.call(C),await _.current.recalcSummary(),l!==x.current))return;null==(s=P.current)||s.call(P)}catch(e){if(l!==x.current)return;null==(d=I.current)||d.call(I,e)}})(),()=>{l===x.current&&(x.current+=1)}},[i,n,r,E,O]),(0,eN.useEffect)(()=>{let e=w.current;if(!i||r)return;let t=k.current;if(!t.bookingTicket||"loading"===t.status||y.current)return;let l=b.current;return(async()=>{var t,i,a,n,r,o,s,d,c,u;try{if(await D.current,l!==b.current||(await e4R(k.current),l!==b.current)||(e&&await eB0({bookingTicket:k.current.bookingTicket,reservationRuleProduct:e.reservationRuleProduct,row:e.row,appointmentStatus:e.appointmentStatus??"started",bookingConfig:(null==(d=k.current.bookingTicket)||null==(s=d.getBookingConfig)?void 0:s.call(d))??null,tempOrder:k.current.tempOrder,date:(null==(c=S.current)?void 0:c.startAt.slice(0,10))||ew()().format("YYYY-MM-DD"),bookingTimeRangeFromCalendar:S.current,assertCurrent:()=>{if(l!==b.current)throw Error("The booking selection has closed.")}}),l!==b.current))return;let u=(null==(i=k.current.bookingTicket)||null==(t=i.getTempOrder)?void 0:t.call(i))??k.current.tempOrder,p=exy(u??null);if(await (null==(n=k.current.bookingTicket)||null==(a=n.initBookingContext)?void 0:a.call(n,exx(N.current,{date:ew()(),bookingIds:p.length?p:void 0,loadResources:!1}))),l!==b.current||(null==(r=C.current)||r.call(C),await _.current.recalcSummary(),l!==b.current))return;y.current=!0,null==(o=T.current)||o.call(T)}catch(e){if(l!==b.current)return;y.current=!1,null==(u=I.current)||u.call(I,e)}})(),()=>{l===b.current&&(b.current+=1)}},[i,n,r,E,O]),null}function e4F(e){let{onClose:t,fallbackTitle:l,variant:i}=e,a=eb$(),n=(0,eN.useMemo)(()=>{var e,t,i,n;let r=a.tempOrder,o=(null==r?void 0:r.shop_full_order_number)||(null==r?void 0:r.shop_order_number)||((null==r?void 0:r.order_number)?String(r.order_number):"");if(o)return String(o);let s=(null==(t=a.salesDetail)||null==(e=t.header)?void 0:e.shop_full_order_number)||(null==(n=a.salesDetail)||null==(i=n.header)?void 0:i.shop_order_number);return s?String(s):l||""},[a.tempOrder,a.salesDetail,l]);return n?(0,eB.jsxs)("div",{className:aj()("big-sale-dialog-header-bar",{"big-sale-dialog-header-bar--phone":"phone"===i}),children:[(0,eB.jsx)("div",{className:"big-sale-dialog-header-bar__content",children:(0,eB.jsx)("div",{className:"big-sale-dialog-header-bar__order-id",title:n,children:n})}),(0,eB.jsx)("button",{type:"button",className:"big-sale-dialog-header-bar__close","aria-label":"Close",onClick:t,children:(0,eB.jsx)(nB.Iconfont,{type:"pisell2-x-close"})})]}):null}function e4q(e){let{open:t,contentActive:l,openNonce:i,orderId:a,preloadedSalesDetail:n,createSeed:r,bookingTimeRangeFromCalendar:o,bookingConfigParams:s,onCreateSeedReady:d,onEditReady:c}=e;return(0,eB.jsx)(e4$,{open:t,contentActive:l,openNonce:i,orderId:a,preloadedSalesDetail:n,createSeed:r,bookingTimeRangeFromCalendar:o,bookingConfigParams:s,onCreateSeedReady:d,onEditReady:c})}function e4B(e){var t,l;let{open:i,contentActive:a=i,onVisualStateSettled:n,orderId:r,preloadedSalesDetail:o,resourceIdFromCalendar:s,bookingTimeRangeFromCalendar:d,createSeed:c,onClose:u,callback:p,rulesHooks:m,enableGlobalScanListener:g,title:h,preloaded:v,destroyOnUnmount:f,osKey:y="cached-dine-in-dialog",mode:b="retail",businessCode:x,bookingConfigParams:k,productDisplayConfig:_,productLoadParams:w,productCatalogReady:S=!0,orderType:j=r?void 0:"table-order",variant:N,openNonce:C=0}=e,M="phone"===N;eW(i);let T=!!r,I=T&&!M,P=(0,eN.useRef)(a);P.current=a;let A=(0,eN.useRef)(n);A.current=n;let D=String(x??"").trim()||("retail"===b?"dine_in":b),E=!(eIw(r)&&"dine_in"===D),O=h||(r?`#${r}`:"New Order"),z=(0,eN.useMemo)(()=>`${y}-${b}`,[y,b]),L=(0,eN.useCallback)(()=>{null==p||p({type:"close"}),null==u||u()},[p,u]),R=(0,eN.useCallback)(e=>{!1!==e.reset&&(null==p||p({type:e.type,data:e.data,order_id:e.order_id,reset:!0}),null==u||u())},[p,u]),$=(0,eN.useRef)(j);(!v||a)&&($.current=j);let F=v&&!a?$.current:j,q=(0,eN.useMemo)(()=>F?{type:F}:void 0,[F]),B=!!v||i,H=(0,eN.useMemo)(()=>a?(0,eB.jsx)(e4F,{onClose:L,fallbackTitle:O,variant:N}):null,[a,L,O,N]),[V,U]=(0,eN.useState)(0);(0,eN.useEffect)(()=>{a||U(0)},[a]),(0,eN.useEffect)(()=>{T||U(0)},[C,null==c||null==(t=c.row)?void 0:t.id,T]);let Y=(0,eN.useCallback)(()=>{U(e=>e+1)},[]);(0,eN.useLayoutEffect)(()=>{if(!i||"u"<typeof window)return;let e=0,t=0;return e=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>{null==n||n(!0,a)})}),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(t)}},[a,n,i]);let W=(0,eN.useCallback)(e=>{if(!e){var t;null==(t=A.current)||t.call(A,!1,P.current)}},[]),G=(0,eN.useMemo)(()=>{var e;let t=(null==o?void 0:o.customer_id)??(null==o||null==(e=o.customer)?void 0:e.id)??"anonymous",l=(null==o?void 0:o.schedule_date)??(null==o?void 0:o.booking_date)??(null==o?void 0:o.start_time)??"",i=(null==o?void 0:o.updated_at)??"",a=Array.isArray(null==w?void 0:w.menu_list_ids)?w.menu_list_ids.join(","):"";return[String(r??"new"),String(t),String(l),String(x??""),a,String(i)].join("|")},[x,r,o,w]),K=S?T?1:V:0,Q=T?`edit-${G}-p${K}`:`create-${C}-${(null==c||null==(l=c.row)?void 0:l.id)??"new"}-p${K}`,Z=i&&a,J=(0,eN.useMemo)(()=>(0,eB.jsx)(e4q,{open:Z,contentActive:a,openNonce:C,orderId:r,preloadedSalesDetail:o,createSeed:c,bookingTimeRangeFromCalendar:i&&!T?d:void 0,bookingConfigParams:k,onCreateSeedReady:Y}),[Z,a,C,r,o,c,d,i,T,k,Y]);return(0,eB.jsx)(oq,{renderType:M?"drawer":"modal",showHandlerBar:!1,onHandlerBarClick:L,props:M?{open:i,onClose:L,afterOpenChange:W,skipEnterMotion:!0,placement:"bottom",title:void 0,width:"100%",height:"95%",className:"big-sale-dialog-drawer-phone",rootClassName:"big-sale-dialog-drawer-phone-root",destroyOnClose:!1,maskClosable:!1,footer:null,closable:!1,bodyStyle:{padding:0,height:"100%",position:"relative"}}:{open:i,onCancel:L,afterOpenChange:W,skipEnterMotion:!0,title:null,width:"100%",height:"100%",className:"big-sale-dialog-modal",destroyOnClose:!1,header:!1,maskClosable:!1,footer:null,closeIcon:null,wrapClassName:"big-sale-dialog-wrapper",size:"large",styles:{content:{borderRadius:0}},bodyStyle:{padding:0,height:"100%",position:"relative"}},children:(0,eB.jsx)("div",{"aria-hidden":!i,className:aj()("big-sale-dialog-content",{"big-sale-dialog-content--inactive":!a}),children:B?(0,eB.jsx)(e4L,{osKey:y,mode:b,destroyOnUnmount:f,selectionFlowScene:"product-selection",isActive:a,enableGlobalScanListener:g,autoCreate:!1,autoBootstrap:!1,autoRestoreOnInit:!1,autoInitBookingContext:!1,orderId:r,businessCode:x,bookingConfigParams:k,resourceIdFromCalendar:i&&!T?s:void 0,bookingTimeRangeFromCalendar:i&&!T?d:void 0,productDisplayConfig:_,productLoadParams:w,productCatalogSessionKey:Q,productCatalogReady:S,hideSelectFloorMapResourceAction:E,rulesHooks:m,otherParams:q,enableTempOrderPersist:!1,preserveProductCatalogOnInactiveCustomerClear:!0,className:"pisell-big-sale--dialog-host",bootstrapSlot:J,saleDetailHeaderSlot:H,rightActionBarClose:I?L:void 0,overlaySlot:null,onOrderComplete:R},z):null})})}e4B.displayName="BigSaleDialog";let e4H=oW(e4B);function e4V(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let l=Object.keys(e),i=Object.keys(t);if(l.length!==i.length)return!1;for(let i of l)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0}function e4U(e,t,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e4V,a=(0,eN.useRef)({value:void 0,initialized:!1}),n=(0,eN.useCallback)(()=>{let e=l(),t=a.current;return t.initialized?i(t.value,e)?t.value:(t.value=e,e):(t.value=e,t.initialized=!0,e)},[i]),r=t.join("|");return LU((0,eN.useCallback)(l=>{if(!e)return()=>{};let i=t.map(t=>e.effectsOn(t,l));return()=>{for(let e of i)try{e()}catch{}}},[e,r]),n,n)}let e4Y=e=>{var t;let{runtimeRef:l}=e,i=eb$(),a=ebU();return(0,eN.useEffect)(()=>{var e,t,n,r,o;let s=null==(r=i.bookingTicket)||null==(n=r.store)||null==(t=n.bookingContext)||null==(e=t.getState)?void 0:e.call(t),d=null==s?void 0:s.date,c=d&&ew()(d).isValid()?ew()(d).format("YYYY-MM-DD"):ew()().format("YYYY-MM-DD");l.current={customerId:null==(o=a.selected)?void 0:o.id,date:c}},[i.bookingTicket,null==(t=a.selected)?void 0:t.id,l]),null},e4W=e=>{var t,l;let{children:i,uiHosts:a,...n}=e,r=eR(),o=null==r||null==(l=r.appHelper)||null==(t=l.utils)?void 0:t.action,s=(0,eN.useRef)({date:void 0,customerId:void 0}),d=(0,eN.useMemo)(()=>o?{action:o,getRuntime:()=>s.current}:void 0,[o]);return(0,eB.jsxs)(eCx,{...n,legacyOpenProductDetail:d,uiHosts:a,children:[(0,eB.jsx)(e4Y,{runtimeRef:s}),i]})},e4G={schedule_date:w=ew()().format("YYYY-MM-DD"),menu_list_ids:[44858],schedule_datetime:ew()().format(`${w} HH:mm:ss`)},e4K={orderId:97807},e4Q={loadProductsParams:{...e4G},customerId:void 0,productPicker:{variantIndex:0,num:1}},e4Z={orderId:e4K.orderId,loadProductsParams:{...e4G},customerId:void 0,productPicker:{variantIndex:0,num:1},orderNote:"SalesSdk demo note",shopDiscount:5,contactsInfo:{name:"Demo Contact",phone:"13800000000"}};function e4J(e,t){if(!t)return e;let l=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return void 0!==t}));return{...e,...l,loadProductsParams:{...e.loadProductsParams,...t.loadProductsParams||{}},productPicker:{...e.productPicker,...t.productPicker||{}}}}function e4X(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}let e40=e=>{let{sales:t,cart:l,customer:i,summary:a,products:n}=e;return(0,eB.jsxs)("section",{className:"sales-sdk-demo__panel",children:[(0,eB.jsx)("h3",{children:"Raw Snapshot"}),(0,eB.jsxs)("div",{className:"sales-sdk-demo__raw-grid",children:[(0,eB.jsx)("pre",{children:e4X({selectedCustomer:i.selected})}),(0,eB.jsx)("pre",{children:e4X({tempOrder:t.tempOrder})}),(0,eB.jsx)("pre",{children:e4X({bookings:l.bookings,items:l.items})}),(0,eB.jsx)("pre",{children:e4X({products:n})}),(0,eB.jsx)("pre",{children:e4X({summary:a})})]})]})},e42=e=>{let{entries:t,title:l="Action Log"}=e;if(!t.length)return null;let i=t[t.length-1];return(0,eB.jsxs)("section",{className:`sales-sdk-demo__panel sales-sdk-demo__panel--${i.status}`,children:[(0,eB.jsx)("h3",{children:l}),(0,eB.jsx)("div",{className:"sales-sdk-demo__action-log",children:t.map((e,t)=>(0,eB.jsx)("pre",{className:`sales-sdk-demo__action-entry sales-sdk-demo__action-entry--${e.status}`,children:e.message},t))})]})};function e41(e){let t=e.trim();if(!t)return;let l=Number(t);return Number.isFinite(l)?l:void 0}function e44(e){let{label:t,value:l,placeholder:i,onChange:a}=e;return(0,eB.jsxs)("label",{className:"sales-sdk-demo__field",children:[(0,eB.jsx)("span",{children:t}),(0,eB.jsx)("input",{value:l,placeholder:i,onChange:e=>a(e.target.value)})]})}function e43(e){let{value:t,onChange:l}=e;return(0,eB.jsx)("div",{className:"sales-sdk-demo__advanced-form",children:(0,eB.jsx)(e44,{label:"orderId",value:null!=t.orderId?String(t.orderId):"",placeholder:"使用 fixture 默认值",onChange:e=>l({...t,orderId:e41(e)})})})}function e48(e){let{value:t,onChange:l}=e,i=t.loadProductsParams||{},a=t.productPicker||{},n=e=>{l({...t,loadProductsParams:{...i,...e}})},r=e=>{l({...t,productPicker:{...a,...e}})};return(0,eB.jsxs)("div",{className:"sales-sdk-demo__advanced-form",children:[(0,eB.jsx)(e44,{label:"loadProductsParams.schedule_date",value:i.schedule_date??"",placeholder:"YYYY-MM-DD",onChange:e=>n({schedule_date:e||void 0})}),(0,eB.jsx)(e44,{label:"loadProductsParams.schedule_datetime",value:i.schedule_datetime??"",placeholder:"YYYY-MM-DD HH:mm:ss",onChange:e=>n({schedule_datetime:e||void 0})}),(0,eB.jsx)(e44,{label:"loadProductsParams.menu_list_ids",value:Array.isArray(i.menu_list_ids)?i.menu_list_ids.join(","):"",placeholder:"逗号分隔,如 44858,44859",onChange:e=>n({menu_list_ids:function(e){let t=e.trim();if(t)return t.split(/[,\s]+/).map(e=>Number(e)).filter(e=>Number.isFinite(e))}(e)})}),(0,eB.jsx)(e44,{label:"customerId",value:null!=t.customerId?String(t.customerId):"",placeholder:"缺省 = customer.list[0]",onChange:e=>{let i=e41(e);l({...t,customerId:i})}}),(0,eB.jsx)(e44,{label:"productPicker.productId",value:null!=a.productId?String(a.productId):"",placeholder:"缺省 = products[0].id",onChange:e=>r({productId:e41(e)})}),(0,eB.jsx)(e44,{label:"productPicker.variantIndex",value:null!=a.variantIndex?String(a.variantIndex):"",placeholder:"缺省 0",onChange:e=>r({variantIndex:e41(e)})}),(0,eB.jsx)(e44,{label:"productPicker.num",value:null!=a.num?String(a.num):"",placeholder:"缺省 1",onChange:e=>r({num:e41(e)})})]})}function e46(e){let{value:t,onChange:l}=e,i=void 0===t.contactsInfo?"":null===t.contactsInfo?"null":JSON.stringify(t.contactsInfo);return(0,eB.jsxs)("div",{className:"sales-sdk-demo__advanced-form sales-sdk-demo__advanced-form--meta",children:[(0,eB.jsx)(e44,{label:"orderNote(sales.setOrderNote)",value:t.orderNote??"",placeholder:"留空 = 使用 fixture 默认;填 __skip__ 跳过步骤",onChange:e=>{let i=e.trim();if("__skip__"===i||!i){let{orderNote:e,...i}=t;l(i);return}l({...t,orderNote:i})}}),(0,eB.jsx)(e44,{label:"shopDiscount(sales.setShopDiscount)",value:null!=t.shopDiscount?String(t.shopDiscount):"",placeholder:"如 5 或 5.00;填 __skip__ 跳过步骤",onChange:e=>{let i=e.trim();if("__skip__"===i||!i){let{shopDiscount:e,...i}=t;l(i);return}let a=Number(i);l({...t,shopDiscount:Number.isFinite(a)?a:i})}}),(0,eB.jsxs)("label",{className:"sales-sdk-demo__field",children:[(0,eB.jsx)("span",{children:"contactsInfo(sales.setContactsInfo,JSON)"}),(0,eB.jsx)("textarea",{className:"sales-sdk-demo__textarea",value:i,placeholder:'如 {"name":"Demo"};填 __skip__ 跳过;填 null 清空',rows:3,onChange:e=>{let i=e.target.value.trim();if("__skip__"===i||""===i){let{contactsInfo:e,...i}=t;l(i);return}if("null"===i)return void l({...t,contactsInfo:null});try{let e=JSON.parse(i);if(null===e||"object"!=typeof e||Array.isArray(e))throw Error("contactsInfo 须为 JSON 对象或 null");l({...t,contactsInfo:e})}catch{}}})]})]})}function e45(e){let{value:t,onChange:l}=e;return(0,eB.jsxs)(eB.Fragment,{children:[(0,eB.jsx)(e44,{label:"orderId",value:null!=t.orderId?String(t.orderId):"",placeholder:"使用 fixture 默认值",onChange:e=>l({...t,orderId:e41(e)})}),(0,eB.jsx)(e46,{value:t,onChange:l}),(0,eB.jsx)(e48,{value:t,onChange:l})]})}let e47=e=>(0,eB.jsx)("div",{className:"sales-sdk-demo__advanced",children:(0,eB.jsx)(eM.Collapse,{ghost:!0,items:[{key:"adv",label:"高级配置(覆盖 fixture)",children:"detail"===e.variant?(0,eB.jsx)(e43,{value:e.value,onChange:e.onChange}):"create"===e.variant?(0,eB.jsx)(e48,{value:e.value,onChange:e.onChange}):(0,eB.jsx)(e45,{value:e.value,onChange:e.onChange})}]})}),e49=e=>{let{initialOrderId:t}=e,l=eb$(),i=ebU(),a=eNa(),n=eCN(),r=eCj(),o=(0,eN.useMemo)(()=>({...e4K,...t?{orderId:t}:{}}),[t]),[s,d]=(0,eN.useState)({}),c=(0,eN.useMemo)(()=>s?{...o,...s}:o,[o,s]),[u,p]=(0,eN.useState)([]),[m,g]=(0,eN.useState)(!1),[h,v]=(0,eN.useState)("confirmed"),[f,y]=(0,eN.useState)(!1);ewu(n.summary);let b=e=>{p(t=>[...t,e])},x=async()=>{if(!Number.isFinite(c.orderId)||c.orderId<=0)return void b({status:"error",message:"orderId 必须为正整数"});g(!0),b({status:"running",message:`loadDetail(${c.orderId}) running...`});try{let e=await l.loadDetail(c.orderId);b({status:"success",message:`loadDetail(${c.orderId}) success
|
|
57
57
|
${e3e(e)}`})}catch(e){b({status:"error",message:`loadDetail(${c.orderId}) failed
|
|
58
58
|
${String((null==e?void 0:e.message)??e)}`})}finally{g(!1)}},k=async()=>{let e=h.trim();if(!e)return void b({status:"error",message:"appointment_status 不能为空"});y(!0),b({status:"running",message:`setBookingStatus(${e}) running...`});try{let t=await l.setBookingStatus(e);b({status:"success",message:`setBookingStatus(${e}) success
|
|
59
59
|
${e3e(t)}`})}catch(t){b({status:"error",message:`setBookingStatus(${e}) failed
|