@seatlayer/js 0.100.0 → 0.102.0
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/dist/{chunk-URLBBOTJ.js → chunk-WFAVFYCD.js} +1 -1
- package/dist/{hostedCheckout-4BFFNCCU.js → hostedCheckout-XSQ7ISQC.js} +56 -17
- package/dist/index.cjs +196 -74
- package/dist/index.d.cts +78 -4
- package/dist/index.d.ts +78 -4
- package/dist/index.js +141 -58
- package/dist/manager.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as C}from"@seatlayer/core";import{cdnAssetUrl as P}from"@seatlayer/core/core/cdnAsset";var A=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,T=/[\s"'<>`\\]/;function E(i){return i.startsWith("//")?!1:i.startsWith("/")||i.startsWith("./")||i.startsWith("../")}function S(){try{let i=typeof location>"u"?"":location.origin;return i&&i!=="null"?i:null}catch{return null}}function x(i){if(typeof i!="string"||!i||i.length>2e6||i!==i.trim())return!1;if(i.startsWith("data:"))return A.test(i);if(T.test(i))return!1;let t=S();if(E(i)){if(!t)return!1;try{let n=new URL(i,t);return n.origin===t&&!n.username&&!n.password}catch{return!1}}try{let n=new URL(i);return n.username||n.password?!1:n.protocol==="https:"||t!=null&&n.origin===t}catch{return!1}}import{SEATLAYER_MODULE_URL as se}from"@seatlayer/core/core/cdnAsset";function d(i,t){let n=C(i);return n===i?t:n}function B(){return globalThis.matchMedia?.("(pointer: coarse)").matches??!1?d("picker.dragToLookTouch","Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close"):d("picker.dragToLookMouse","Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function X(){return{rotate:d("picker.dragToRotateVenue","Drag to rotate the venue"),move:d("picker.dragToMoveVenue","Drag to move the venue"),zoomIn:d("picker.zoomIn","Zoom in"),zoomOut:d("picker.zoomOut","Zoom out"),fitView:d("picker.fitWholeVenue","Show whole venue")}}function G(i,t){let n=t?i.toLocaleUpperCase(t):i.toLocaleUpperCase(),e=t?i.toLocaleLowerCase(t):i.toLocaleLowerCase();if(i!==n||n===e)return i;let o=[...e][0]??"";return(t?o.toLocaleUpperCase(t):o.toLocaleUpperCase())+e.slice(o.length)}function j(i){if(typeof i=="string"){let t=document.querySelector(i);if(!t)throw new Error(`seatmap: container "${i}" not found`);return t}if(!(i instanceof HTMLElement))throw new Error("seatmap: container must be a CSS selector or an HTMLElement");return i}function q(i){return String(i??"").replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}function K(i,t,n){let e=t.find(s=>x(s))??null;if(i.replaceChildren(),!e)return i.textContent=n.slice(0,1).toUpperCase(),null;let o=document.createElement("img");return o.alt="",o.referrerPolicy="no-referrer",o.src=e,i.appendChild(o),e}var b=null;function Z(){if(b!==null)return b;try{if(typeof document>"u")return b=!1;b=!!document.createElement("canvas").getContext("webgl2")}catch{b=!1}return b}function y(i){return P(i)}var v=null;function _(){return v||(v=(typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(y("seatlayer-view3d.mjs")):import("@seatlayer/core/view3d")).catch(t=>{throw v=null,t}),v)}function z(){(typeof navigator>"u"?void 0:navigator.connection)?.saveData||_().catch(()=>{})}async function J(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(y("seatlayer-panorama.mjs")):import("@seatlayer/core")}async function Q(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(y("seatlayer-checkout.mjs")):import("./hostedCheckout-4BFFNCCU.js")}function ee(i){return i==="unavailable_for_event"||i==="payments_off_for_event"?i:"not_configured"}function te(i){return i.lineItems.reduce((t,n)=>t+n.quantity,0)}function M(i,t){if(i.objectType!=="ga")return i.displayLabel??i.label;let n=t.find(e=>e.id===i.objectId);return i.displayLabel??n?.displayLabel??n?.label??d("picker.generalAdmission","General admission")}function R(i,t){let n=new Map;for(let e of i){let o=e.rowLabel&&e.seatNumber?[e.sectionLabel,`${d("picker.row","Row")} ${e.rowLabel}`,`${d("picker.seat","Seat")} ${e.seatNumber}`].filter(Boolean).join(" \xB7 "):M(e,t),s=[e.categoryLabel,e.tierLabel].filter(Boolean).join(" \xB7 "),a=Math.max(1,Math.floor(e.quantity||1)),u=`${o}\0${s}`,c=n.get(u)??{label:o,detail:s,units:0,amount:0};c.units+=a,c.amount+=e.unitPrice*a,n.set(u,c)}return[...n.values()].map(e=>({label:e.units>1?`${e.label} \xD7${e.units}`:e.label,...e.detail?{detail:e.detail}:{},amount:e.amount}))}var L=(i,t,n)=>C("picker.bookingForm.guestOfCount",{label:i,index:t,total:n});function I(i,t,n=[]){let e=new Map,o=[];for(let l of i.lineItems){let r=M(l,n),f=Math.max(1,Math.floor(l.quantity)||1);if(l.objectType!=="ga"&&!(l.objectType==="table"&&f>1)){o.push({key:l.label,name:r,unitIndex:1,quantity:1});continue}for(let h=1;h<=f;h+=1){let m=(e.get(l.label)??0)+1;e.set(l.label,m),o.push({key:`${l.label}#${m}`,name:r,unitIndex:h,quantity:f})}}let s=t?.ticketKeyDetails??[],a=t?.ticketKeys??s.map(l=>l.ticketKey),u=(a.length===o.length?a:o.map(l=>l.key)).map(l=>{let r=o.find(h=>h.key===l),f=s.find(h=>h.ticketKey===l);return{key:l,name:f?.displayLabel??r?.name,unitIndex:f?.unitIndex??r?.unitIndex??1,quantity:f?.quantity??r?.quantity??1}}),c=new Map;for(let l of u)l.name&&l.quantity<=1&&c.set(l.name,(c.get(l.name)??0)+1);let p=new Map;return u.map(({key:l,name:r,unitIndex:f,quantity:h})=>{if(!r)return{key:l};if(h>1)return{key:l,title:L(r,f,h)};let m=(p.get(r)??0)+1;p.set(r,m);let g=c.get(r)??1;return{key:l,title:g>1?L(r,m,g):r}})}function ne(i,t,n,e,o=[]){let s=new Map;for(let a of i.lineItems){let u=M(a,o);s.set(u,(s.get(u)??0)+1)}return{kind:"pay",provider:t,order:{holdId:i.holdId,expiresAt:i.expiresAt,currency:i.currency,total:i.total,labels:[...s].map(([a,u])=>u>1?`${a} \xD7${u}`:a),tickets:I(i,e,o),lines:R(i.lineItems,o)},bookingForm:n?.bookingForm??null,...n?.bookingMode==="free"?{free:!0}:{}}}function ie(i){return String(i?.code).startsWith("booking_form_")}function oe(i,t,n){let e={month:"short",day:"numeric",hour:"numeric",minute:"2-digit"},o=new Date(i);if(t)try{return o.toLocaleString(n,{...e,timeZone:t})}catch{}return o.toLocaleString(n,e)}function le(i){return i.focusedSection!==null?i.deeperThanSectionFrame===!1?"venue":"section":i.atVenueFit!==void 0?i.atVenueFit?"none":"venue":i.seatsRevealed?"venue":"none"}import{pointInPolygon as D}from"@seatlayer/core";import{createMinimapTransform as H,minimapPointToWorld as O,minimapViewportPlan as V}from"@seatlayer/core/picker/minimapGeometry";function W(i){let t={inactive:0,available:1,selected:2},n=new Map;for(let o of i){let s=n.get(o.id);(!s||t[o.state]>t[s])&&n.set(o.id,o.state)}let e={selected:0,available:0,inactive:0};for(let o of n.values())e[o]+=1;return e}function N(i,t){return i.x<=t.x&&i.y<=t.y&&i.x+i.width>=t.x+t.width&&i.y+i.height>=t.y+t.height}function he(i,t){let n=new w(i);return n.build(t),n}var w=class{constructor(t){this.host=t;this.miniCanvas=null;this.miniBase=null;this.miniWrap=null;this.miniToggle=null;this.miniLabel=null;this.miniTf=null;this.miniDrag=null;this.miniSuppressClick=!1;this.userClosed=!1}dispose(){this.miniToggle?.remove(),this.miniWrap?.remove(),this.miniToggle=null,this.miniWrap=null,this.miniCanvas=null,this.miniBase=null,this.miniLabel=null,this.miniTf=null,this.miniDrag=null,this.host.root()?.removeAttribute("data-minimap-open")}build(t){if(!this.host.controller.getViewport())return;let e=document.createElement("button");e.type="button",e.className="sl-minimap-toggle",e.setAttribute("aria-label",d("picker.openVenueMap","Open venue overview map")),e.setAttribute("aria-expanded","false"),e.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 6l5-2 8 3 5-2v13l-5 2-8-3-5 2zM8 4v13M16 7v13"/></svg>',t.appendChild(e),this.miniToggle=e;let o=document.createElement("div");o.className="sl-minimap",o.setAttribute("role","group");let s=document.createElement("div");s.className="sl-minimap-bar";let a=document.createElement("span");a.className="sl-minimap-label";let u=document.createElement("span");u.className="sl-minimap-key",u.setAttribute("aria-label",d("picker.minimapStateKey","Focused, selected, available, and inactive sections")),u.innerHTML='<i class="focused" title="Focused"></i><i class="selected" title="Selected"></i><i title="Available"></i><i class="inactive" title="Inactive"></i>';let c=document.createElement("button");c.type="button",c.className="sl-minimap-close",c.setAttribute("aria-label",d("picker.closeVenueMap","Close venue overview map")),c.textContent="\xD7",s.append(a,u,c);let p=document.createElement("canvas");p.tabIndex=0,p.setAttribute("role","application"),p.setAttribute("aria-label",d("picker.venueMapInstructions","Venue overview map. Drag the viewport, click a section, or use arrow keys to pan.")),o.append(s,p),t.appendChild(o),this.miniWrap=o,this.miniLabel=a,this.miniCanvas=p;let l=document.createElement("canvas");this.miniBase=l,e.addEventListener("click",()=>{let r=this.host.root()?.dataset.minimapOpen==="true";this.userClosed=r,this.setMinimapOpen(!r)}),c.addEventListener("click",()=>{this.userClosed=!0,this.setMinimapOpen(!1)}),p.addEventListener("click",r=>{if(this.miniSuppressClick){this.miniSuppressClick=!1;return}this.minimapJump(r)}),p.addEventListener("pointerdown",r=>this.minimapPointerDown(r)),p.addEventListener("pointermove",r=>this.minimapPointerMove(r)),p.addEventListener("pointerup",r=>this.minimapPointerUp(r)),p.addEventListener("pointercancel",r=>this.minimapPointerUp(r)),p.addEventListener("keydown",r=>this.minimapKeydown(r)),this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect()}setAutoOpen(t){if(this.miniWrap){if(!t){this.userClosed=!1,this.host.root()?.dataset.minimapOpen==="true"&&this.setMinimapOpen(!1,!1);return}this.userClosed||this.host.root()?.dataset.minimapOpen==="true"||this.setMinimapOpen(!0,!1)}}setMinimapOpen(t,n=!0){this.host.root()?.setAttribute("data-minimap-open",String(t)),this.miniToggle?.setAttribute("aria-expanded",String(t)),n&&(t?this.miniCanvas?.focus():this.miniToggle?.focus())}layoutMinimap(){let t=this.miniCanvas,n=this.miniBase,e=this.host.controller.getViewport()?.bounds;if(!t||!n||!e||!(e.width>0&&e.height>0))return;let o=196,s=146,a=6,u=e.width/Math.max(1,e.height),c=o,p=Math.round(o/u);p>s&&(p=s,c=Math.round(s*u)),c=Math.max(64,c),p=Math.max(48,p);let l=Math.min(2,window.devicePixelRatio||1);t.width=Math.round(c*l),t.height=Math.round(p*l),t.style.width=`${c}px`,t.style.height=`${p}px`,n.width=t.width,n.height=t.height,this.miniTf=H(e,t.width,t.height,l,a)}syncMinimapLabel(){if(!this.miniLabel||!this.miniWrap)return;let t=this.host.controller.getFloors(),n=this.host.controller.isFloorOverview()?d("picker.allFloors","All floors"):t.find(l=>l.id===this.host.controller.getActiveFloorId())?.name??d("picker.venueOverview","Venue overview"),e=this.host.controller.getMinimapSnapshot().sections,s=e.find(l=>l.active)?.label??this.host.focusedSectionLabel(),a=s?`${n} \xB7 ${s}`:n;this.miniLabel.textContent=a;let{selected:u,available:c,inactive:p}=W(e);this.miniWrap.setAttribute("aria-label",e.length?`${a}. ${u} selected, ${c} available, ${p} inactive sections.`:a),this.miniCanvas?.setAttribute("aria-label",e.length?`${a}. ${u} selected, ${c} available, ${p} inactive sections. ${d("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click a section, or use arrow keys to pan.")}`:`${a}. ${d("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click elsewhere, or use arrow keys to pan.")}`)}refreshMinimap(){this.miniBase&&(this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect())}drawMinimapStatic(){let t=this.miniBase,n=this.miniTf;if(!t||!n)return;let e=t.getContext("2d");if(!e)return;e.clearRect(0,0,t.width,t.height);let o=r=>r*n.scale+n.offX,s=r=>r*n.scale+n.offY,a=this.host.cssVar("--sl-line")||"rgba(139,147,167,.5)",u=this.host.cssVar("--sl-muted")||"#8b93a7",c=this.host.cssVar("--sl-accent")||"#6e7bff",p=this.host.cssVar("--sl-success")||"#22a06b",l=this.host.controller.getMinimapSnapshot();for(let r of l.sections){if(r.outline.length<3)continue;e.beginPath(),r.outline.forEach((h,m)=>m===0?e.moveTo(o(h.x),s(h.y)):e.lineTo(o(h.x),s(h.y))),e.closePath();let f=r.paint;if(e.globalAlpha=r.state==="inactive"?.5:.92,f?e.fillStyle=f.fill:(e.globalAlpha=r.state==="inactive"?.18:r.state==="selected"?.72:.34,e.fillStyle=r.state==="inactive"?u:r.state==="selected"?c:p),e.fill(),e.globalAlpha=.82,e.lineWidth=Math.max(1,n.dpr),e.strokeStyle=f?.stroke||a,e.stroke(),r.owned){e.globalAlpha=1,e.lineWidth=Math.max(2,n.dpr*1.5),e.strokeStyle=c,e.stroke();let h=r.outline.reduce((m,g)=>({x:m.x+g.x,y:m.y+g.y}),{x:0,y:0});e.beginPath(),e.arc(o(h.x/r.outline.length),s(h.y/r.outline.length),Math.max(1.5,n.dpr*1.6),0,Math.PI*2),e.fillStyle=c,e.fill(),e.beginPath(),r.outline.forEach((m,g)=>g===0?e.moveTo(o(m.x),s(m.y)):e.lineTo(o(m.x),s(m.y))),e.closePath()}r.active&&(e.globalAlpha=1,e.lineJoin="round",e.lineWidth=Math.max(4,n.dpr*3.5),e.strokeStyle=this.host.cssVar("--sl-surface")||"#fff",e.stroke(),e.lineWidth=Math.max(2,n.dpr*1.75),e.strokeStyle=c,e.stroke())}if(e.globalAlpha=1,!l.sections.length){let r=Math.max(1,n.dpr),f=new Map,h=m=>{let g=f.get(m);if(g)return g;let k=this.host.tint?.(m)||p;return f.set(m,k),k};for(let m of l.seats)e.globalAlpha=m.state==="inactive"?.22:.78,e.fillStyle=m.state==="inactive"?u:m.state==="selected"?c:h(m.categoryKey),e.beginPath(),e.arc(o(m.x),s(m.y),r,0,Math.PI*2),e.fill();e.globalAlpha=1}}drawMinimapRect(){let t=this.miniCanvas,n=this.miniBase,e=this.miniTf;if(!t||!n||!e)return;let o=t.getContext("2d");if(!o)return;o.clearRect(0,0,t.width,t.height),o.drawImage(n,0,0);let s=this.host.controller.getViewport();if(!s||N(s.visible,s.bounds))return;let a=V(s.visible,e,t.width,t.height,Math.max(2,e.dpr*2)),u=this.host.cssVar("--sl-text")||"#12151c",c=this.host.cssVar("--sl-surface")||"#fff";o.save(),o.globalAlpha=.1,o.fillStyle=u,o.fillRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),o.globalAlpha=.9,o.lineJoin="round",o.lineWidth=Math.max(4,e.dpr*3.25),o.strokeStyle=c,o.strokeRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),o.globalAlpha=1,o.lineWidth=Math.max(2,e.dpr*1.75),o.strokeStyle=u,o.strokeRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),a.clipped&&Object.values(a.clippedEdges).some(Boolean)&&(o.setLineDash([Math.max(3,e.dpr*3),Math.max(2,e.dpr*2)]),o.strokeRect(a.clipped.x,a.clipped.y,a.clipped.width,a.clipped.height)),o.restore()}minimapWorldPoint(t){let n=this.miniCanvas,e=this.miniTf;if(!n||!e)return null;let o=n.getBoundingClientRect(),s=(t.clientX-o.left)*(n.width/Math.max(1,o.width)),a=(t.clientY-o.top)*(n.height/Math.max(1,o.height));return{...O({x:s,y:a},e),px:s,py:a}}minimapPointerDown(t){let n=this.minimapWorldPoint(t),e=this.host.controller.getViewport()?.visible;!n||!e||!(n.x>=e.x&&n.x<=e.x+e.width&&n.y>=e.y&&n.y<=e.y+e.height)||(this.miniDrag={pointerId:t.pointerId,offsetX:n.x-(e.x+e.width/2),offsetY:n.y-(e.y+e.height/2),startX:t.clientX,startY:t.clientY,moved:!1},this.miniCanvas?.setPointerCapture(t.pointerId),this.miniCanvas?.classList.add("sl-dragging"),t.preventDefault())}minimapPointerMove(t){let n=this.miniDrag;if(!n||n.pointerId!==t.pointerId)return;let e=this.minimapWorldPoint(t);e&&(!n.moved&&Math.hypot(t.clientX-n.startX,t.clientY-n.startY)>2&&(n.moved=!0,this.host.controller.clearSectionFocus()),this.host.controller.panToWorld({x:e.x-n.offsetX,y:e.y-n.offsetY}),t.preventDefault())}minimapPointerUp(t){let n=this.miniDrag;!n||n.pointerId!==t.pointerId||(this.miniSuppressClick=n.moved,this.miniDrag=null,this.miniCanvas?.classList.remove("sl-dragging"),this.miniCanvas?.hasPointerCapture(t.pointerId)&&this.miniCanvas.releasePointerCapture(t.pointerId))}minimapKeydown(t){let n=this.host.controller.getViewport()?.visible;if(!n)return;if(t.key==="Home"){this.host.controller.overview(),t.preventDefault();return}let e=t.key==="ArrowLeft"?-n.width*.2:t.key==="ArrowRight"?n.width*.2:0,o=t.key==="ArrowUp"?-n.height*.2:t.key==="ArrowDown"?n.height*.2:0;!e&&!o||(this.host.controller.clearSectionFocus(),this.host.controller.panToWorld({x:n.x+n.width/2+e,y:n.y+n.height/2+o}),t.preventDefault())}minimapJump(t){let n=this.minimapWorldPoint(t);if(n){for(let e of this.host.controller.getMinimapSnapshot().sections)if(!(e.state==="inactive"||e.outline.length<3)&&D(n,e.outline)){this.host.controller.focusSection(e.id);return}this.host.controller.clearSectionFocus(),this.host.controller.panToWorld(n)}}};export{x as a,d as b,B as c,X as d,G as e,j as f,q as g,K as h,Z as i,_ as j,z as k,J as l,Q as m,ee as n,te as o,ne as p,ie as q,oe as r,le as s,he as t};
|
|
1
|
+
import{t as C}from"@seatlayer/core";import{cdnAssetUrl as P}from"@seatlayer/core/core/cdnAsset";var A=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,T=/[\s"'<>`\\]/;function E(i){return i.startsWith("//")?!1:i.startsWith("/")||i.startsWith("./")||i.startsWith("../")}function S(){try{let i=typeof location>"u"?"":location.origin;return i&&i!=="null"?i:null}catch{return null}}function x(i){if(typeof i!="string"||!i||i.length>2e6||i!==i.trim())return!1;if(i.startsWith("data:"))return A.test(i);if(T.test(i))return!1;let t=S();if(E(i)){if(!t)return!1;try{let n=new URL(i,t);return n.origin===t&&!n.username&&!n.password}catch{return!1}}try{let n=new URL(i);return n.username||n.password?!1:n.protocol==="https:"||t!=null&&n.origin===t}catch{return!1}}import{SEATLAYER_MODULE_URL as se}from"@seatlayer/core/core/cdnAsset";function d(i,t){let n=C(i);return n===i?t:n}function B(){return globalThis.matchMedia?.("(pointer: coarse)").matches??!1?d("picker.dragToLookTouch","Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close"):d("picker.dragToLookMouse","Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function X(){return{rotate:d("picker.dragToRotateVenue","Drag to rotate the venue"),move:d("picker.dragToMoveVenue","Drag to move the venue"),zoomIn:d("picker.zoomIn","Zoom in"),zoomOut:d("picker.zoomOut","Zoom out"),fitView:d("picker.fitWholeVenue","Show whole venue")}}function G(i,t){let n=t?i.toLocaleUpperCase(t):i.toLocaleUpperCase(),e=t?i.toLocaleLowerCase(t):i.toLocaleLowerCase();if(i!==n||n===e)return i;let o=[...e][0]??"";return(t?o.toLocaleUpperCase(t):o.toLocaleUpperCase())+e.slice(o.length)}function j(i){if(typeof i=="string"){let t=document.querySelector(i);if(!t)throw new Error(`seatmap: container "${i}" not found`);return t}if(!(i instanceof HTMLElement))throw new Error("seatmap: container must be a CSS selector or an HTMLElement");return i}function q(i){return String(i??"").replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}function K(i,t,n){let e=t.find(s=>x(s))??null;if(i.replaceChildren(),!e)return i.textContent=n.slice(0,1).toUpperCase(),null;let o=document.createElement("img");return o.alt="",o.referrerPolicy="no-referrer",o.src=e,i.appendChild(o),e}var b=null;function Z(){if(b!==null)return b;try{if(typeof document>"u")return b=!1;b=!!document.createElement("canvas").getContext("webgl2")}catch{b=!1}return b}function y(i){return P(i)}var v=null;function _(){return v||(v=(typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(y("seatlayer-view3d.mjs")):import("@seatlayer/core/view3d")).catch(t=>{throw v=null,t}),v)}function z(){(typeof navigator>"u"?void 0:navigator.connection)?.saveData||_().catch(()=>{})}async function J(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(y("seatlayer-panorama.mjs")):import("@seatlayer/core")}async function Q(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(y("seatlayer-checkout.mjs")):import("./hostedCheckout-XSQ7ISQC.js")}function ee(i){return i==="unavailable_for_event"||i==="payments_off_for_event"?i:"not_configured"}function te(i){return i.lineItems.reduce((t,n)=>t+n.quantity,0)}function M(i,t){if(i.objectType!=="ga")return i.displayLabel??i.label;let n=t.find(e=>e.id===i.objectId);return i.displayLabel??n?.displayLabel??n?.label??d("picker.generalAdmission","General admission")}function R(i,t){let n=new Map;for(let e of i){let o=e.rowLabel&&e.seatNumber?[e.sectionLabel,`${d("picker.row","Row")} ${e.rowLabel}`,`${d("picker.seat","Seat")} ${e.seatNumber}`].filter(Boolean).join(" \xB7 "):M(e,t),s=[e.categoryLabel,e.tierLabel].filter(Boolean).join(" \xB7 "),a=Math.max(1,Math.floor(e.quantity||1)),u=`${o}\0${s}`,c=n.get(u)??{label:o,detail:s,units:0,amount:0};c.units+=a,c.amount+=e.unitPrice*a,n.set(u,c)}return[...n.values()].map(e=>({label:e.units>1?`${e.label} \xD7${e.units}`:e.label,...e.detail?{detail:e.detail}:{},amount:e.amount}))}var L=(i,t,n)=>C("picker.bookingForm.guestOfCount",{label:i,index:t,total:n});function I(i,t,n=[]){let e=new Map,o=[];for(let l of i.lineItems){let r=M(l,n),f=Math.max(1,Math.floor(l.quantity)||1);if(l.objectType!=="ga"&&!(l.objectType==="table"&&f>1)){o.push({key:l.label,name:r,unitIndex:1,quantity:1});continue}for(let h=1;h<=f;h+=1){let m=(e.get(l.label)??0)+1;e.set(l.label,m),o.push({key:`${l.label}#${m}`,name:r,unitIndex:h,quantity:f})}}let s=t?.ticketKeyDetails??[],a=t?.ticketKeys??s.map(l=>l.ticketKey),u=(a.length===o.length?a:o.map(l=>l.key)).map(l=>{let r=o.find(h=>h.key===l),f=s.find(h=>h.ticketKey===l);return{key:l,name:f?.displayLabel??r?.name,unitIndex:f?.unitIndex??r?.unitIndex??1,quantity:f?.quantity??r?.quantity??1}}),c=new Map;for(let l of u)l.name&&l.quantity<=1&&c.set(l.name,(c.get(l.name)??0)+1);let p=new Map;return u.map(({key:l,name:r,unitIndex:f,quantity:h})=>{if(!r)return{key:l};if(h>1)return{key:l,title:L(r,f,h)};let m=(p.get(r)??0)+1;p.set(r,m);let g=c.get(r)??1;return{key:l,title:g>1?L(r,m,g):r}})}function ne(i,t,n,e,o=[]){let s=new Map;for(let a of i.lineItems){let u=M(a,o);s.set(u,(s.get(u)??0)+1)}return{kind:"pay",provider:t,order:{holdId:i.holdId,expiresAt:i.expiresAt,currency:i.currency,total:i.total,labels:[...s].map(([a,u])=>u>1?`${a} \xD7${u}`:a),tickets:I(i,e,o),lines:R(i.lineItems,o)},bookingForm:n?.bookingForm??null,...n?.bookingMode==="free"?{free:!0}:{}}}function ie(i){return String(i?.code).startsWith("booking_form_")}function oe(i,t,n){let e={month:"short",day:"numeric",hour:"numeric",minute:"2-digit"},o=new Date(i);if(t)try{return o.toLocaleString(n,{...e,timeZone:t})}catch{}return o.toLocaleString(n,e)}function le(i){return i.focusedSection!==null?i.deeperThanSectionFrame===!1?"venue":"section":i.atVenueFit!==void 0?i.atVenueFit?"none":"venue":i.seatsRevealed?"venue":"none"}import{pointInPolygon as D}from"@seatlayer/core";import{createMinimapTransform as H,minimapPointToWorld as O,minimapViewportPlan as V}from"@seatlayer/core/picker/minimapGeometry";function W(i){let t={inactive:0,available:1,selected:2},n=new Map;for(let o of i){let s=n.get(o.id);(!s||t[o.state]>t[s])&&n.set(o.id,o.state)}let e={selected:0,available:0,inactive:0};for(let o of n.values())e[o]+=1;return e}function N(i,t){return i.x<=t.x&&i.y<=t.y&&i.x+i.width>=t.x+t.width&&i.y+i.height>=t.y+t.height}function he(i,t){let n=new w(i);return n.build(t),n}var w=class{constructor(t){this.host=t;this.miniCanvas=null;this.miniBase=null;this.miniWrap=null;this.miniToggle=null;this.miniLabel=null;this.miniTf=null;this.miniDrag=null;this.miniSuppressClick=!1;this.userClosed=!1}dispose(){this.miniToggle?.remove(),this.miniWrap?.remove(),this.miniToggle=null,this.miniWrap=null,this.miniCanvas=null,this.miniBase=null,this.miniLabel=null,this.miniTf=null,this.miniDrag=null,this.host.root()?.removeAttribute("data-minimap-open")}build(t){if(!this.host.controller.getViewport())return;let e=document.createElement("button");e.type="button",e.className="sl-minimap-toggle",e.setAttribute("aria-label",d("picker.openVenueMap","Open venue overview map")),e.setAttribute("aria-expanded","false"),e.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 6l5-2 8 3 5-2v13l-5 2-8-3-5 2zM8 4v13M16 7v13"/></svg>',t.appendChild(e),this.miniToggle=e;let o=document.createElement("div");o.className="sl-minimap",o.setAttribute("role","group");let s=document.createElement("div");s.className="sl-minimap-bar";let a=document.createElement("span");a.className="sl-minimap-label";let u=document.createElement("span");u.className="sl-minimap-key",u.setAttribute("aria-label",d("picker.minimapStateKey","Focused, selected, available, and inactive sections")),u.innerHTML='<i class="focused" title="Focused"></i><i class="selected" title="Selected"></i><i title="Available"></i><i class="inactive" title="Inactive"></i>';let c=document.createElement("button");c.type="button",c.className="sl-minimap-close",c.setAttribute("aria-label",d("picker.closeVenueMap","Close venue overview map")),c.textContent="\xD7",s.append(a,u,c);let p=document.createElement("canvas");p.tabIndex=0,p.setAttribute("role","application"),p.setAttribute("aria-label",d("picker.venueMapInstructions","Venue overview map. Drag the viewport, click a section, or use arrow keys to pan.")),o.append(s,p),t.appendChild(o),this.miniWrap=o,this.miniLabel=a,this.miniCanvas=p;let l=document.createElement("canvas");this.miniBase=l,e.addEventListener("click",()=>{let r=this.host.root()?.dataset.minimapOpen==="true";this.userClosed=r,this.setMinimapOpen(!r)}),c.addEventListener("click",()=>{this.userClosed=!0,this.setMinimapOpen(!1)}),p.addEventListener("click",r=>{if(this.miniSuppressClick){this.miniSuppressClick=!1;return}this.minimapJump(r)}),p.addEventListener("pointerdown",r=>this.minimapPointerDown(r)),p.addEventListener("pointermove",r=>this.minimapPointerMove(r)),p.addEventListener("pointerup",r=>this.minimapPointerUp(r)),p.addEventListener("pointercancel",r=>this.minimapPointerUp(r)),p.addEventListener("keydown",r=>this.minimapKeydown(r)),this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect()}setAutoOpen(t){if(this.miniWrap){if(!t){this.userClosed=!1,this.host.root()?.dataset.minimapOpen==="true"&&this.setMinimapOpen(!1,!1);return}this.userClosed||this.host.root()?.dataset.minimapOpen==="true"||this.setMinimapOpen(!0,!1)}}setMinimapOpen(t,n=!0){this.host.root()?.setAttribute("data-minimap-open",String(t)),this.miniToggle?.setAttribute("aria-expanded",String(t)),n&&(t?this.miniCanvas?.focus():this.miniToggle?.focus())}layoutMinimap(){let t=this.miniCanvas,n=this.miniBase,e=this.host.controller.getViewport()?.bounds;if(!t||!n||!e||!(e.width>0&&e.height>0))return;let o=196,s=146,a=6,u=e.width/Math.max(1,e.height),c=o,p=Math.round(o/u);p>s&&(p=s,c=Math.round(s*u)),c=Math.max(64,c),p=Math.max(48,p);let l=Math.min(2,window.devicePixelRatio||1);t.width=Math.round(c*l),t.height=Math.round(p*l),t.style.width=`${c}px`,t.style.height=`${p}px`,n.width=t.width,n.height=t.height,this.miniTf=H(e,t.width,t.height,l,a)}syncMinimapLabel(){if(!this.miniLabel||!this.miniWrap)return;let t=this.host.controller.getFloors(),n=this.host.controller.isFloorOverview()?d("picker.allFloors","All floors"):t.find(l=>l.id===this.host.controller.getActiveFloorId())?.name??d("picker.venueOverview","Venue overview"),e=this.host.controller.getMinimapSnapshot().sections,s=e.find(l=>l.active)?.label??this.host.focusedSectionLabel(),a=s?`${n} \xB7 ${s}`:n;this.miniLabel.textContent=a;let{selected:u,available:c,inactive:p}=W(e);this.miniWrap.setAttribute("aria-label",e.length?`${a}. ${u} selected, ${c} available, ${p} inactive sections.`:a),this.miniCanvas?.setAttribute("aria-label",e.length?`${a}. ${u} selected, ${c} available, ${p} inactive sections. ${d("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click a section, or use arrow keys to pan.")}`:`${a}. ${d("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click elsewhere, or use arrow keys to pan.")}`)}refreshMinimap(){this.miniBase&&(this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect())}drawMinimapStatic(){let t=this.miniBase,n=this.miniTf;if(!t||!n)return;let e=t.getContext("2d");if(!e)return;e.clearRect(0,0,t.width,t.height);let o=r=>r*n.scale+n.offX,s=r=>r*n.scale+n.offY,a=this.host.cssVar("--sl-line")||"rgba(139,147,167,.5)",u=this.host.cssVar("--sl-muted")||"#8b93a7",c=this.host.cssVar("--sl-accent")||"#6e7bff",p=this.host.cssVar("--sl-success")||"#22a06b",l=this.host.controller.getMinimapSnapshot();for(let r of l.sections){if(r.outline.length<3)continue;e.beginPath(),r.outline.forEach((h,m)=>m===0?e.moveTo(o(h.x),s(h.y)):e.lineTo(o(h.x),s(h.y))),e.closePath();let f=r.paint;if(e.globalAlpha=r.state==="inactive"?.5:.92,f?e.fillStyle=f.fill:(e.globalAlpha=r.state==="inactive"?.18:r.state==="selected"?.72:.34,e.fillStyle=r.state==="inactive"?u:r.state==="selected"?c:p),e.fill(),e.globalAlpha=.82,e.lineWidth=Math.max(1,n.dpr),e.strokeStyle=f?.stroke||a,e.stroke(),r.owned){e.globalAlpha=1,e.lineWidth=Math.max(2,n.dpr*1.5),e.strokeStyle=c,e.stroke();let h=r.outline.reduce((m,g)=>({x:m.x+g.x,y:m.y+g.y}),{x:0,y:0});e.beginPath(),e.arc(o(h.x/r.outline.length),s(h.y/r.outline.length),Math.max(1.5,n.dpr*1.6),0,Math.PI*2),e.fillStyle=c,e.fill(),e.beginPath(),r.outline.forEach((m,g)=>g===0?e.moveTo(o(m.x),s(m.y)):e.lineTo(o(m.x),s(m.y))),e.closePath()}r.active&&(e.globalAlpha=1,e.lineJoin="round",e.lineWidth=Math.max(4,n.dpr*3.5),e.strokeStyle=this.host.cssVar("--sl-surface")||"#fff",e.stroke(),e.lineWidth=Math.max(2,n.dpr*1.75),e.strokeStyle=c,e.stroke())}if(e.globalAlpha=1,!l.sections.length){let r=Math.max(1,n.dpr),f=new Map,h=m=>{let g=f.get(m);if(g)return g;let k=this.host.tint?.(m)||p;return f.set(m,k),k};for(let m of l.seats)e.globalAlpha=m.state==="inactive"?.22:.78,e.fillStyle=m.state==="inactive"?u:m.state==="selected"?c:h(m.categoryKey),e.beginPath(),e.arc(o(m.x),s(m.y),r,0,Math.PI*2),e.fill();e.globalAlpha=1}}drawMinimapRect(){let t=this.miniCanvas,n=this.miniBase,e=this.miniTf;if(!t||!n||!e)return;let o=t.getContext("2d");if(!o)return;o.clearRect(0,0,t.width,t.height),o.drawImage(n,0,0);let s=this.host.controller.getViewport();if(!s||N(s.visible,s.bounds))return;let a=V(s.visible,e,t.width,t.height,Math.max(2,e.dpr*2)),u=this.host.cssVar("--sl-text")||"#12151c",c=this.host.cssVar("--sl-surface")||"#fff";o.save(),o.globalAlpha=.1,o.fillStyle=u,o.fillRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),o.globalAlpha=.9,o.lineJoin="round",o.lineWidth=Math.max(4,e.dpr*3.25),o.strokeStyle=c,o.strokeRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),o.globalAlpha=1,o.lineWidth=Math.max(2,e.dpr*1.75),o.strokeStyle=u,o.strokeRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),a.clipped&&Object.values(a.clippedEdges).some(Boolean)&&(o.setLineDash([Math.max(3,e.dpr*3),Math.max(2,e.dpr*2)]),o.strokeRect(a.clipped.x,a.clipped.y,a.clipped.width,a.clipped.height)),o.restore()}minimapWorldPoint(t){let n=this.miniCanvas,e=this.miniTf;if(!n||!e)return null;let o=n.getBoundingClientRect(),s=(t.clientX-o.left)*(n.width/Math.max(1,o.width)),a=(t.clientY-o.top)*(n.height/Math.max(1,o.height));return{...O({x:s,y:a},e),px:s,py:a}}minimapPointerDown(t){let n=this.minimapWorldPoint(t),e=this.host.controller.getViewport()?.visible;!n||!e||!(n.x>=e.x&&n.x<=e.x+e.width&&n.y>=e.y&&n.y<=e.y+e.height)||(this.miniDrag={pointerId:t.pointerId,offsetX:n.x-(e.x+e.width/2),offsetY:n.y-(e.y+e.height/2),startX:t.clientX,startY:t.clientY,moved:!1},this.miniCanvas?.setPointerCapture(t.pointerId),this.miniCanvas?.classList.add("sl-dragging"),t.preventDefault())}minimapPointerMove(t){let n=this.miniDrag;if(!n||n.pointerId!==t.pointerId)return;let e=this.minimapWorldPoint(t);e&&(!n.moved&&Math.hypot(t.clientX-n.startX,t.clientY-n.startY)>2&&(n.moved=!0,this.host.controller.clearSectionFocus()),this.host.controller.panToWorld({x:e.x-n.offsetX,y:e.y-n.offsetY}),t.preventDefault())}minimapPointerUp(t){let n=this.miniDrag;!n||n.pointerId!==t.pointerId||(this.miniSuppressClick=n.moved,this.miniDrag=null,this.miniCanvas?.classList.remove("sl-dragging"),this.miniCanvas?.hasPointerCapture(t.pointerId)&&this.miniCanvas.releasePointerCapture(t.pointerId))}minimapKeydown(t){let n=this.host.controller.getViewport()?.visible;if(!n)return;if(t.key==="Home"){this.host.controller.overview(),t.preventDefault();return}let e=t.key==="ArrowLeft"?-n.width*.2:t.key==="ArrowRight"?n.width*.2:0,o=t.key==="ArrowUp"?-n.height*.2:t.key==="ArrowDown"?n.height*.2:0;!e&&!o||(this.host.controller.clearSectionFocus(),this.host.controller.panToWorld({x:n.x+n.width/2+e,y:n.y+n.height/2+o}),t.preventDefault())}minimapJump(t){let n=this.minimapWorldPoint(t);if(n){for(let e of this.host.controller.getMinimapSnapshot().sections)if(!(e.state==="inactive"||e.outline.length<3)&&D(n,e.outline)){this.host.controller.focusSection(e.id);return}this.host.controller.clearSectionFocus(),this.host.controller.panToWorld(n)}}};export{x as a,d as b,B as c,X as d,G as e,j as f,q as g,K as h,Z as i,_ as j,z as k,J as l,Q as m,ee as n,te as o,ne as p,ie as q,oe as r,le as s,he as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Ne}from"./chunk-ICMSBXRJ.js";import"./chunk-OSZ7DOEH.js";var De=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Ue=/^[0-9 +()-]{6,20}$/,Ye=/^(\d{4})-(\d{2})-(\d{2})$/,He=["required","invalid","too_long"],Be=[["attendeeName","name","picker.bookingForm.name","Name"],["attendeeEmail","email","picker.bookingForm.email","Email"],["attendeePhone","phone","picker.bookingForm.phone","Phone"]],Qe={email:"email",phone:"tel",number:"number",date:"date"};function Pe(o){return o===void 0||o===""||o===!1||Array.isArray(o)&&!o.length}function Ie(o,u,s,f){if(Pe(s))return u?"required":null;let a=v=>!!f?.some(K=>K.id===v);if(o==="number")return typeof s=="number"&&Number.isFinite(s)?null:"invalid";if(o==="checkbox")return s===!0?null:"invalid";if(o==="select")return a(s)?null:"invalid";if(o==="multiselect")return Array.isArray(s)&&s.length<=50&&s.every(a)?null:"invalid";if(typeof s!="string")return"invalid";if(o==="phone")return Ue.test(s)?null:"invalid";if(s.length>500)return"too_long";if(o==="email")return De.test(s)?null:"invalid";if(o==="date"){let v=Ye.exec(s);if(!v)return"invalid";let[K,R,I]=[Number(v[1]),Number(v[2]),Number(v[3])],A=new Date(Date.UTC(K,R-1,I));return A.getUTCFullYear()===K&&A.getUTCMonth()===R-1&&A.getUTCDate()===I?null:"invalid"}return null}function x(o,u,s){let f=document.createElement(o);return u&&(f.className=u),s!==void 0&&(f.textContent=s),f}function Ce(o,u){let s=o?.[u];return s==="optional"||s==="required"?s:"off"}var Ve={name:"name",email:"email",phone:"tel"},je=5;function Ke(o){let{form:u,t:s,idPrefix:f}=o,a=(u?.questions??[]).filter(t=>t&&!t.archived).sort((t,n)=>t.position-n.position),v=Be.filter(([t])=>Ce(u,t)!=="off"),K=a.filter(t=>t.scope==="ticket"),R=a.filter(t=>t.scope!=="ticket"),I=v.length>0||K.length>0;if(!I&&!R.length)return{details:null,element:null,validate:()=>!0,payload:()=>({}),showServerErrors:()=>!1};let A=v.filter(([,t])=>t!=="phone"),ie=v.every(([t])=>Ce(u,t)!=="required")&&K.every(t=>!t.required),P=[...o.tickets],S=!0,se=!1,D=new Map,he=(t,n)=>n===void 0?t:`${t}|${n}`,q=[],pe=0,L=x("div","sl-hco-bf sl-hco-bf-inline"),O=x("div","sl-hco-bf"),U=x("p","sl-hco-alert is-error");U.setAttribute("role","alert"),U.hidden=!0;let Y=(t,n)=>n==="required"?s("picker.bookingForm.required","This is required."):n==="too_long"?s("picker.bookingForm.tooLong","This is too long."):t==="email"?s("picker.bookingForm.invalidEmail","Enter a valid email address."):t==="phone"?s("picker.bookingForm.invalidPhone","Enter a valid phone number."):s("picker.bookingForm.invalid","Check this answer."),G=(t,n)=>{t.error.textContent=n?Y(t.kind,n):"",t.error.hidden=!n;let c=t.kind==="multiselect"||t.control.closest(".sl-hco-chips")?t.control.closest("fieldset")??t.control:t.control;n?c.setAttribute("aria-invalid","true"):c.removeAttribute("aria-invalid"),t.control.closest(".sl-hco-block")?.classList.toggle("has-error",q.some(b=>b.ticketKey===t.ticketKey&&!b.error.hidden))},J=(t,n)=>{let c=x("span",void 0,t);if(n)return c;let b=x("span","sl-hco-label-row");return b.append(c," ",x("span","sl-hco-optional",s("checkout.optional","Optional"))),b},V=(t,n)=>{let c=`${f}-bf${pe++}`,b=he(n.key,n.ticketKey),l=D.get(b),h=x("div","sl-hco-field"),d=n.help?x("p","sl-hco-help",n.help):null;d&&(d.id=`${c}-h`);let k=x("p","sl-hco-ferr");k.id=`${c}-e`,k.hidden=!0;let T=y=>{y.setAttribute("aria-describedby",d?`${d.id} ${k.id}`:k.id),n.required&&y.tagName!=="FIELDSET"&&y.setAttribute("aria-required","true")},w=n.kind==="select"&&(n.options??[]).length<=je,N;if(n.kind==="checkbox"||n.kind==="multiselect"||w){let y=n.kind==="checkbox"?null:x("fieldset",w?"sl-hco-group sl-hco-chips":"sl-hco-group"),m=y?n.options??[]:[{id:"",label:n.label}];if(y){w&&y.setAttribute("role","radiogroup");let C=x("legend");C.appendChild(J(n.label,n.required)),y.appendChild(C),d&&y.appendChild(d),T(y)}let F=y?x("div","sl-hco-choices"):null,M=m.map((C,W)=>{let xe=x("label",w?"sl-hco-chip":"sl-hco-check"),E=x("input");E.type=w?"radio":"checkbox",E.value=C.id,w&&(E.name=c),y?(W===0&&(E.id=c),E.checked=w?l===C.id:Array.isArray(l)&&l.includes(C.id)):(E.id=c,E.checked=l===!0,T(E));let be=y?x("span",void 0,C.label):J(n.label,n.required);return xe.append(E,be),(F??h).appendChild(xe),E});y&&F?(y.appendChild(F),h.appendChild(y)):d&&h.appendChild(d),N={...n,control:M[0]??y??h,error:k,read:w?()=>M.find(C=>C.checked)?.value??"":y?()=>M.filter(C=>C.checked).map(C=>C.value):()=>!!M[0]?.checked}}else{let y=x("label","sl-hco-label");y.appendChild(J(n.label,n.required)),y.htmlFor=c;let m;if(n.kind==="textarea")m=x("textarea","sl-hco-input"),m.rows=3,m.maxLength=500;else if(n.kind==="select"){m=x("select","sl-hco-input"),m.appendChild(new Option(s("picker.bookingForm.choose","Choose\u2026"),""));for(let M of n.options??[])m.appendChild(new Option(M.label,M.id))}else m=x("input","sl-hco-input"),m.type=Qe[n.kind]??"text",n.kind==="number"?(m.step="any",m.inputMode="decimal"):n.kind!=="date"&&(m.maxLength=n.kind==="phone"?20:500),n.autocomplete&&(m.autocomplete=n.autocomplete);m.id=c,typeof l=="string"?m.value=l:typeof l=="number"&&(m.value=String(l)),T(m),h.append(y,...d?[d]:[],m);let F=m;N={...n,control:m,error:k,read:()=>{let M=F.value.trim();return n.kind!=="number"?M:F.validity?.badInput?Number.NaN:M===""?void 0:Number(M)}}}h.appendChild(k);let ce=()=>{let y=N.read();y===void 0?D.delete(b):D.set(b,y),G(N,null)};return h.addEventListener("input",ce),h.addEventListener("change",ce),t.appendChild(h),q.push(N),N},te=(t,n,c)=>V(t,{key:`question:${n.id}`,...c!==void 0?{ticketKey:c}:{},kind:n.type,label:n.label,required:!!n.required,help:n.helpText,options:n.options}),fe=(t,n,c,b)=>{let l=Be.find(([h])=>h===c);return V(t,{key:c,ticketKey:n.key,kind:l[1],label:s(l[2],l[3]),required:Ce(u,c)==="required",autocomplete:b===0&&S?Ve[l[1]]:"off"})},z=(t,n,c="sl-hco-link")=>{let b=x("button",c,t);return b.type="button",b.addEventListener("click",n),b},ye=t=>x("h3","sl-hco-h",t),ae=()=>x("section","sl-hco-sec"),Q=t=>{if(!t&&P[0]){let c=o.buyer();for(let[b,l]of A){let h=c[l];h&&D.set(he(b,P[0].key),h)}se=!0}S=t;for(let[,c]of A)o.buyerError?.(c,null);_(),(t?O.querySelector(".sl-hco-you .sl-hco-link"):O.querySelector(".sl-hco-block input"))?.focus()};function _(){q=[],L.replaceChildren(),O.replaceChildren();let t=P[0],n=P.length===1&&S;if(I&&n&&t){for(let[d,k]of v)k==="phone"&&fe(L,t,d,0);A.length&&L.appendChild(z(s("checkout.forSomeoneElse","Ticket for someone else?"),()=>Q(!1)))}let c=I&&!n&&(!ie||se||le||!S);if(I&&!n&&!c){let d=ae(),k=z("",()=>{se=!0,_(),O.querySelector(".sl-hco-block input")?.focus()},"sl-hco-disclosure");k.setAttribute("aria-expanded","false"),k.append(x("span","sl-hco-plus","+"),x("span",void 0,s("checkout.addNames","Add names for each ticket")),x("span","sl-hco-optional",s("checkout.optional","Optional"))),d.appendChild(k),O.appendChild(d)}if(c){let d=ae();d.appendChild(ye(s("bookingForm.ticketHolders","Ticket holders"))),P.forEach((k,T)=>{let w=x("fieldset","sl-hco-block"),N=x("legend","sl-hco-legend",k.title||s("picker.bookingForm.ticket","Ticket {number}",{number:T+1}));w.appendChild(N);let ce=T===0&&S&&A.length>0;if(ce){let F=o.buyer(),M=x("p","sl-hco-you"),C=F.name||F.email;M.append(x("span",void 0,C?s("checkout.holderYou","You \xB7 {name}",{name:C}):s("checkout.holderYouPlain","You")));let W=z(s("checkout.change","Change"),()=>Q(!1));W.setAttribute("aria-label",s("checkout.changeHolder","Change the holder of {ticket}",{ticket:N.textContent??""})),M.appendChild(W),w.appendChild(M)}else T===0&&!S&&A.length>0&&w.appendChild(z(s("picker.bookingForm.useMyDetails","Use my details"),()=>Q(!0),"sl-hco-link sl-hco-use"));let y=v.filter(([,F])=>!(ce&&F!=="phone")),m=y.length>1?x("div","sl-hco-pair"):w;for(let[F]of y)fe(m,k,F,T);m!==w&&w.appendChild(m);for(let F of K)te(w,F,k.key);d.appendChild(w)}),O.appendChild(d)}let l=[...I&&n&&t?K.map(d=>({q:d,ticketKey:t.key})):[],...R.map(d=>({q:d,ticketKey:void 0}))],h=[...l.filter(({q:d})=>d.type!=="checkbox"),...l.filter(({q:d})=>d.type==="checkbox")];if(h.length){let d=ae();d.appendChild(ye(s("checkout.questions","A few questions")));for(let{q:k,ticketKey:T}of h)te(d,k,T);O.appendChild(d)}O.appendChild(U)}let le=!1;_();let X=()=>{if(!P[0]||!S)return null;let n=o.buyer(),c=null;for(let[b,l]of A){let h=Ie(l,Ce(u,b)==="required",n[l]),d=o.buyerError?.(l,h?Y(l,h):null)??null;h&&!c&&(c=d)}return c},ge=t=>(U.textContent=t?s("picker.bookingForm.fix","Some details need attention."):"",U.hidden=!t,t?.focus(),!!t),me=(t,n)=>t.compareDocumentPosition(n)&4?-1:1;return{details:L,element:O,validate(){let t=[],n=X();n&&t.push(n);for(let c of q){let b=Ie(c.kind,c.required,c.read(),c.options);G(c,b),b&&t.push(c.control)}return t.sort(me),!ge(t[0]??null)},payload(){let t=new Map,n=[],c=P[0];if(c&&S){let l=o.buyer(),h={ticketKey:c.key};for(let[,d]of A){let k=l[d];k&&(h[d]=k)}(h.name||h.email)&&t.set(c.key,h)}for(let l of q){let h=l.read();if(!Pe(h)){if(l.key.startsWith("question:"))n.push({questionId:l.key.slice(9),...l.ticketKey!==void 0?{ticketKey:l.ticketKey}:{},value:h});else if(l.ticketKey!==void 0){let d=t.get(l.ticketKey)??{ticketKey:l.ticketKey},k=l.key==="attendeeName"?"name":l.key==="attendeeEmail"?"email":"phone";d[k]=String(h),t.set(l.ticketKey,d)}}}let b=P.map(l=>t.get(l.key)).filter(l=>!!l);return{...b.length?{attendees:b}:{},...n.length?{answers:n}:{}}},showServerErrors(t){let n=(Array.isArray(t)?t:[]).filter(l=>!!l&&typeof l.key=="string");if(I){let l=!1;for(let h of n)typeof h.ticketKey=="string"&&!P.some(d=>d.key===h.ticketKey)&&(P.push({key:h.ticketKey}),l=!0);le=n.some(h=>typeof h.ticketKey=="string"),(l||le)&&_()}let c=[],b=P[0];for(let l of n){let h=l.key==="attendeeName"?"name":l.key==="attendeeEmail"?"email":null;if(h&&S&&b&&l.ticketKey===b.key&&A.some(([,d])=>d===h)){let d=o.buyerError?.(h,Y(h,He.includes(l.code)?l.code:"invalid"));d&&c.push(d)}}for(let l of q){let h=n.find(k=>k.key===l.key&&(k.ticketKey??void 0)===(l.ticketKey??void 0)),d=h?He.includes(h.code)?h.code:"invalid":null;G(l,d),d&&c.push(l.control)}return c.length?(c.sort(me),ge(c[0])):(U.textContent=s("picker.bookingForm.fix","Some details need attention."),U.hidden=!1,!1)}}}var Xe=9e4,We=2e3,Oe="seatlayer-checkout-style",Ge="@seatlayer/pending-checkout/v1";function Je(o,u){try{window.sessionStorage.setItem(Ge,JSON.stringify({orderId:o,...u?{eventKey:u}:{},storedAt:Date.now()}))}catch{}}var Ze=`
|
|
1
|
+
import{a as Ne}from"./chunk-ICMSBXRJ.js";import"./chunk-OSZ7DOEH.js";var Re=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Ue=/^[0-9 +()-]{6,20}$/,Ye=/^(\d{4})-(\d{2})-(\d{2})$/,He=["required","invalid","too_long"],Be=[["attendeeName","name","picker.bookingForm.name","Name"],["attendeeEmail","email","picker.bookingForm.email","Email"],["attendeePhone","phone","picker.bookingForm.phone","Phone"]],Qe={email:"email",phone:"tel",number:"number",date:"date"};function Ie(n){return n===void 0||n===""||n===!1||Array.isArray(n)&&!n.length}function ze(n,u,s,g){if(Ie(s))return u?"required":null;let a=v=>!!g?.some(P=>P.id===v);if(n==="number")return typeof s=="number"&&Number.isFinite(s)?null:"invalid";if(n==="checkbox")return s===!0?null:"invalid";if(n==="select")return a(s)?null:"invalid";if(n==="multiselect")return Array.isArray(s)&&s.length<=50&&s.every(a)?null:"invalid";if(typeof s!="string")return"invalid";if(n==="phone")return Ue.test(s)?null:"invalid";if(s.length>500)return"too_long";if(n==="email")return Re.test(s)?null:"invalid";if(n==="date"){let v=Ye.exec(s);if(!v)return"invalid";let[P,D,z]=[Number(v[1]),Number(v[2]),Number(v[3])],M=new Date(Date.UTC(P,D-1,z));return M.getUTCFullYear()===P&&M.getUTCMonth()===D-1&&M.getUTCDate()===z?null:"invalid"}return null}function y(n,u,s){let g=document.createElement(n);return u&&(g.className=u),s!==void 0&&(g.textContent=s),g}function Ce(n,u){let s=n?.[u];return s==="optional"||s==="required"?s:"off"}var Ve={name:"name",email:"email",phone:"tel"},je=5;function Pe(n){let{form:u,t:s,idPrefix:g}=n,a=(u?.questions??[]).filter(t=>t&&!t.archived).sort((t,o)=>t.position-o.position),v=Be.filter(([t])=>Ce(u,t)!=="off"),P=a.filter(t=>t.scope==="ticket"),D=a.filter(t=>t.scope!=="ticket"),z=v.length>0||P.length>0;if(!z&&!D.length)return{details:null,element:null,validate:()=>!0,payload:()=>({}),showServerErrors:()=>!1};let M=v.filter(([,t])=>t!=="phone"),ie=v.every(([t])=>Ce(u,t)!=="required")&&P.every(t=>!t.required),I=[...n.tickets],S=!0,se=!1,R=new Map,he=(t,o)=>o===void 0?t:`${t}|${o}`,q=[],pe=0,L=y("div","sl-hco-bf sl-hco-bf-inline"),O=y("div","sl-hco-bf"),U=y("p","sl-hco-alert is-error");U.setAttribute("role","alert"),U.hidden=!0;let Y=(t,o)=>o==="required"?s("picker.bookingForm.required","This is required."):o==="too_long"?s("picker.bookingForm.tooLong","This is too long."):t==="email"?s("picker.bookingForm.invalidEmail","Enter a valid email address."):t==="phone"?s("picker.bookingForm.invalidPhone","Enter a valid phone number."):s("picker.bookingForm.invalid","Check this answer."),G=(t,o)=>{t.error.textContent=o?Y(t.kind,o):"",t.error.hidden=!o;let c=t.kind==="multiselect"||t.control.closest(".sl-hco-chips")?t.control.closest("fieldset")??t.control:t.control;o?c.setAttribute("aria-invalid","true"):c.removeAttribute("aria-invalid"),t.control.closest(".sl-hco-block")?.classList.toggle("has-error",q.some(b=>b.ticketKey===t.ticketKey&&!b.error.hidden))},J=(t,o)=>{let c=y("span",void 0,t);if(o)return c;let b=y("span","sl-hco-label-row");return b.append(c," ",y("span","sl-hco-optional",s("checkout.optional","Optional"))),b},V=(t,o)=>{let c=`${g}-bf${pe++}`,b=he(o.key,o.ticketKey),l=R.get(b),h=y("div","sl-hco-field"),d=o.help?y("p","sl-hco-help",o.help):null;d&&(d.id=`${c}-h`);let k=y("p","sl-hco-ferr");k.id=`${c}-e`,k.hidden=!0;let T=x=>{x.setAttribute("aria-describedby",d?`${d.id} ${k.id}`:k.id),o.required&&x.tagName!=="FIELDSET"&&x.setAttribute("aria-required","true")},w=o.kind==="select"&&(o.options??[]).length<=je,N;if(o.kind==="checkbox"||o.kind==="multiselect"||w){let x=o.kind==="checkbox"?null:y("fieldset",w?"sl-hco-group sl-hco-chips":"sl-hco-group"),m=x?o.options??[]:[{id:"",label:o.label}];if(x){w&&x.setAttribute("role","radiogroup");let C=y("legend");C.appendChild(J(o.label,o.required)),x.appendChild(C),d&&x.appendChild(d),T(x)}let F=x?y("div","sl-hco-choices"):null,A=m.map((C,W)=>{let ye=y("label",w?"sl-hco-chip":"sl-hco-check"),E=y("input");E.type=w?"radio":"checkbox",E.value=C.id,w&&(E.name=c),x?(W===0&&(E.id=c),E.checked=w?l===C.id:Array.isArray(l)&&l.includes(C.id)):(E.id=c,E.checked=l===!0,T(E));let be=x?y("span",void 0,C.label):J(o.label,o.required);return ye.append(E,be),(F??h).appendChild(ye),E});x&&F?(x.appendChild(F),h.appendChild(x)):d&&h.appendChild(d),N={...o,control:A[0]??x??h,error:k,read:w?()=>A.find(C=>C.checked)?.value??"":x?()=>A.filter(C=>C.checked).map(C=>C.value):()=>!!A[0]?.checked}}else{let x=y("label","sl-hco-label");x.appendChild(J(o.label,o.required)),x.htmlFor=c;let m;if(o.kind==="textarea")m=y("textarea","sl-hco-input"),m.rows=3,m.maxLength=500;else if(o.kind==="select"){m=y("select","sl-hco-input"),m.appendChild(new Option(s("picker.bookingForm.choose","Choose\u2026"),""));for(let A of o.options??[])m.appendChild(new Option(A.label,A.id))}else m=y("input","sl-hco-input"),m.type=Qe[o.kind]??"text",o.kind==="number"?(m.step="any",m.inputMode="decimal"):o.kind!=="date"&&(m.maxLength=o.kind==="phone"?20:500),o.autocomplete&&(m.autocomplete=o.autocomplete);m.id=c,typeof l=="string"?m.value=l:typeof l=="number"&&(m.value=String(l)),T(m),h.append(x,...d?[d]:[],m);let F=m;N={...o,control:m,error:k,read:()=>{let A=F.value.trim();return o.kind!=="number"?A:F.validity?.badInput?Number.NaN:A===""?void 0:Number(A)}}}h.appendChild(k);let ce=()=>{let x=N.read();x===void 0?R.delete(b):R.set(b,x),G(N,null)};return h.addEventListener("input",ce),h.addEventListener("change",ce),t.appendChild(h),q.push(N),N},te=(t,o,c)=>V(t,{key:`question:${o.id}`,...c!==void 0?{ticketKey:c}:{},kind:o.type,label:o.label,required:!!o.required,help:o.helpText,options:o.options}),ge=(t,o,c,b)=>{let l=Be.find(([h])=>h===c);return V(t,{key:c,ticketKey:o.key,kind:l[1],label:s(l[2],l[3]),required:Ce(u,c)==="required",autocomplete:b===0&&S?Ve[l[1]]:"off"})},K=(t,o,c="sl-hco-link")=>{let b=y("button",c,t);return b.type="button",b.addEventListener("click",o),b},xe=t=>y("h3","sl-hco-h",t),ae=()=>y("section","sl-hco-sec"),Q=t=>{if(!t&&I[0]){let c=n.buyer();for(let[b,l]of M){let h=c[l];h&&R.set(he(b,I[0].key),h)}se=!0}S=t;for(let[,c]of M)n.buyerError?.(c,null);_(),(t?O.querySelector(".sl-hco-you .sl-hco-link"):O.querySelector(".sl-hco-block input"))?.focus()};function _(){q=[],L.replaceChildren(),O.replaceChildren();let t=I[0],o=I.length===1&&S;if(z&&o&&t){for(let[d,k]of v)k==="phone"&&ge(L,t,d,0);M.length&&L.appendChild(K(s("checkout.forSomeoneElse","Ticket for someone else?"),()=>Q(!1)))}let c=z&&!o&&(!ie||se||le||!S);if(z&&!o&&!c){let d=ae(),k=K("",()=>{se=!0,_(),O.querySelector(".sl-hco-block input")?.focus()},"sl-hco-disclosure");k.setAttribute("aria-expanded","false"),k.append(y("span","sl-hco-plus","+"),y("span",void 0,s("checkout.addNames","Add names for each ticket")),y("span","sl-hco-optional",s("checkout.optional","Optional"))),d.appendChild(k),O.appendChild(d)}if(c){let d=ae();d.appendChild(xe(s("bookingForm.ticketHolders","Ticket holders"))),I.forEach((k,T)=>{let w=y("fieldset","sl-hco-block"),N=y("legend","sl-hco-legend",k.title||s("picker.bookingForm.ticket","Ticket {number}",{number:T+1}));w.appendChild(N);let ce=T===0&&S&&M.length>0;if(ce){let F=n.buyer(),A=y("p","sl-hco-you"),C=F.name||F.email;A.append(y("span",void 0,C?s("checkout.holderYou","You \xB7 {name}",{name:C}):s("checkout.holderYouPlain","You")));let W=K(s("checkout.change","Change"),()=>Q(!1));W.setAttribute("aria-label",s("checkout.changeHolder","Change the holder of {ticket}",{ticket:N.textContent??""})),A.appendChild(W),w.appendChild(A)}else T===0&&!S&&M.length>0&&w.appendChild(K(s("picker.bookingForm.useMyDetails","Use my details"),()=>Q(!0),"sl-hco-link sl-hco-use"));let x=v.filter(([,F])=>!(ce&&F!=="phone")),m=x.length>1?y("div","sl-hco-pair"):w;for(let[F]of x)ge(m,k,F,T);m!==w&&w.appendChild(m);for(let F of P)te(w,F,k.key);d.appendChild(w)}),O.appendChild(d)}let l=[...z&&o&&t?P.map(d=>({q:d,ticketKey:t.key})):[],...D.map(d=>({q:d,ticketKey:void 0}))],h=[...l.filter(({q:d})=>d.type!=="checkbox"),...l.filter(({q:d})=>d.type==="checkbox")];if(h.length){let d=ae();d.appendChild(xe(s("checkout.questions","A few questions")));for(let{q:k,ticketKey:T}of h)te(d,k,T);O.appendChild(d)}O.appendChild(U)}let le=!1;_();let X=()=>{if(!I[0]||!S)return null;let o=n.buyer(),c=null;for(let[b,l]of M){let h=ze(l,Ce(u,b)==="required",o[l]),d=n.buyerError?.(l,h?Y(l,h):null)??null;h&&!c&&(c=d)}return c},fe=t=>(U.textContent=t?s("picker.bookingForm.fix","Some details need attention."):"",U.hidden=!t,t?.focus(),!!t),me=(t,o)=>t.compareDocumentPosition(o)&4?-1:1;return{details:L,element:O,validate(){let t=[],o=X();o&&t.push(o);for(let c of q){let b=ze(c.kind,c.required,c.read(),c.options);G(c,b),b&&t.push(c.control)}return t.sort(me),!fe(t[0]??null)},payload(){let t=new Map,o=[],c=I[0];if(c&&S){let l=n.buyer(),h={ticketKey:c.key};for(let[,d]of M){let k=l[d];k&&(h[d]=k)}(h.name||h.email)&&t.set(c.key,h)}for(let l of q){let h=l.read();if(!Ie(h)){if(l.key.startsWith("question:"))o.push({questionId:l.key.slice(9),...l.ticketKey!==void 0?{ticketKey:l.ticketKey}:{},value:h});else if(l.ticketKey!==void 0){let d=t.get(l.ticketKey)??{ticketKey:l.ticketKey},k=l.key==="attendeeName"?"name":l.key==="attendeeEmail"?"email":"phone";d[k]=String(h),t.set(l.ticketKey,d)}}}let b=I.map(l=>t.get(l.key)).filter(l=>!!l);return{...b.length?{attendees:b}:{},...o.length?{answers:o}:{}}},showServerErrors(t){let o=(Array.isArray(t)?t:[]).filter(l=>!!l&&typeof l.key=="string");if(z){let l=!1;for(let h of o)typeof h.ticketKey=="string"&&!I.some(d=>d.key===h.ticketKey)&&(I.push({key:h.ticketKey}),l=!0);le=o.some(h=>typeof h.ticketKey=="string"),(l||le)&&_()}let c=[],b=I[0];for(let l of o){let h=l.key==="attendeeName"?"name":l.key==="attendeeEmail"?"email":null;if(h&&S&&b&&l.ticketKey===b.key&&M.some(([,d])=>d===h)){let d=n.buyerError?.(h,Y(h,He.includes(l.code)?l.code:"invalid"));d&&c.push(d)}}for(let l of q){let h=o.find(k=>k.key===l.key&&(k.ticketKey??void 0)===(l.ticketKey??void 0)),d=h?He.includes(h.code)?h.code:"invalid":null;G(l,d),d&&c.push(l.control)}return c.length?(c.sort(me),fe(c[0])):(U.textContent=s("picker.bookingForm.fix","Some details need attention."),U.hidden=!1,!1)}}}var Xe=9e4,We=2e3,Oe="seatlayer-checkout-style",Ge="@seatlayer/pending-checkout/v1";function Je(n,u){try{window.sessionStorage.setItem(Ge,JSON.stringify({orderId:n,...u?{eventKey:u}:{},storedAt:Date.now()}))}catch{}}var Ze=`
|
|
2
2
|
/* Three rows: a header naming the event with the hold's countdown, a body that
|
|
3
3
|
scrolls, and a footer that never does, so the total and the one primary
|
|
4
4
|
button are always on screen however long the organizer's form is. On a
|
|
@@ -14,8 +14,8 @@ import{a as Ne}from"./chunk-ICMSBXRJ.js";import"./chunk-OSZ7DOEH.js";var De=/^[^
|
|
|
14
14
|
.sl-hco-head{flex:none;display:flex;align-items:center;gap:10px;padding:12px 14px 10px 10px;border-bottom:1px solid var(--sl-line)}
|
|
15
15
|
.sl-hco-back-icon{flex:none;display:grid;place-items:center;width:36px;height:36px;padding:0;color:var(--sl-muted);
|
|
16
16
|
background:none;border:0;border-radius:calc(var(--sl-radius) * .5);cursor:pointer}
|
|
17
|
-
.sl-hco-back-icon:hover{background:color-mix(in srgb, var(--sl-text) 6%, transparent)}
|
|
18
|
-
.sl-hco-back-icon:focus-visible{outline:2px solid var(--sl-accent)
|
|
17
|
+
.sl-hco-back-icon:hover{background:color-mix(in srgb, var(--sl-text) 6%, transparent);color:var(--sl-text)}
|
|
18
|
+
.sl-hco-back-icon:focus-visible{outline:2px solid transparent;box-shadow:0 0 0 1px var(--sl-accent),0 0 0 4px color-mix(in srgb, var(--sl-accent) 24%, transparent)}
|
|
19
19
|
.sl-hco-htext{flex:1;min-width:0;padding-left:4px}
|
|
20
20
|
.sl-hco-title{margin:0;font-size:16px;font-weight:650;line-height:22px;letter-spacing:-.01em;
|
|
21
21
|
overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
@@ -45,16 +45,43 @@ import{a as Ne}from"./chunk-ICMSBXRJ.js";import"./chunk-OSZ7DOEH.js";var De=/^[^
|
|
|
45
45
|
.sl-hco-label-row{display:flex;justify-content:space-between;gap:8px;width:100%}
|
|
46
46
|
.sl-hco-optional{margin-left:auto;font-weight:450;color:var(--sl-muted)}
|
|
47
47
|
.sl-hco-help{margin:-2px 0 6px;font-size:12.5px;line-height:18px;color:var(--sl-muted)}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
/* ONE FIELD LANGUAGE, shared with the picker panel (pickerStylesFields.ts):
|
|
49
|
+
rest is a hairline and a 1px inner shade, so the field reads sunk into the
|
|
50
|
+
card; hover steps the edge toward the ink; ANY focus (the buyer is typing)
|
|
51
|
+
is the accent edge plus a soft 3px accent halo, never a hard outline; an
|
|
52
|
+
invalid field is the same language in --sl-danger. The transparent outline
|
|
53
|
+
is what forced-colors mode paints, where box-shadow is dropped. */
|
|
54
|
+
.sl-hco-input{box-sizing:border-box;width:100%;min-height:44px;padding:10px 13px;font:inherit;font-size:15px;line-height:22px;color:var(--sl-text);
|
|
55
|
+
background-color:var(--sl-bg);border:1px solid var(--sl-line);border-radius:calc(var(--sl-radius) * .55);
|
|
56
|
+
box-shadow:inset 0 1px 2px rgb(0 0 0 / .08);
|
|
57
|
+
transition:border-color .14s cubic-bezier(.2,0,0,1),box-shadow .14s cubic-bezier(.2,0,0,1),background-color .14s cubic-bezier(.2,0,0,1)}
|
|
58
|
+
.sl-hco-input::placeholder{color:var(--sl-muted);opacity:.8}
|
|
59
|
+
.sl-hco-input:hover:not(:focus):not(:disabled){border-color:color-mix(in srgb, var(--sl-text) 28%, var(--sl-line));
|
|
60
|
+
background-color:color-mix(in srgb, var(--sl-text) 2%, var(--sl-bg))}
|
|
61
|
+
.sl-hco-input:focus{outline:2px solid transparent;outline-offset:2px;border-color:var(--sl-accent);
|
|
62
|
+
box-shadow:inset 0 1px 2px rgb(0 0 0 / .08),0 0 0 3px color-mix(in srgb, var(--sl-accent) 24%, transparent)}
|
|
63
|
+
.sl-hco-input[aria-invalid="true"]{border-color:var(--sl-danger, #c0392b);
|
|
64
|
+
background-color:color-mix(in srgb, var(--sl-danger, #c0392b) 5%, var(--sl-bg))}
|
|
65
|
+
.sl-hco-input[aria-invalid="true"]:hover:not(:focus):not(:disabled){border-color:color-mix(in srgb, var(--sl-danger, #c0392b) 80%, var(--sl-text));
|
|
66
|
+
background-color:color-mix(in srgb, var(--sl-danger, #c0392b) 5%, var(--sl-bg))}
|
|
67
|
+
.sl-hco-input[aria-invalid="true"]:focus{border-color:var(--sl-danger, #c0392b);
|
|
68
|
+
box-shadow:inset 0 1px 2px rgb(0 0 0 / .08),0 0 0 3px color-mix(in srgb, var(--sl-danger, #c0392b) 22%, transparent)}
|
|
69
|
+
.sl-hco-input:disabled{color:var(--sl-muted);cursor:not-allowed;box-shadow:none;
|
|
70
|
+
background-color:color-mix(in srgb, var(--sl-line) 30%, var(--sl-surface))}
|
|
71
|
+
select.sl-hco-input{appearance:none;-webkit-appearance:none;padding-right:38px;cursor:pointer;
|
|
72
|
+
background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238b93a1' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
|
73
|
+
background-repeat:no-repeat;background-position:right 14px center;background-size:10px 6px}
|
|
74
|
+
select.sl-hco-input:disabled{cursor:not-allowed}
|
|
75
|
+
textarea.sl-hco-input{min-height:76px;resize:vertical}
|
|
54
76
|
.sl-hco-ferr{margin:6px 0 0;font-size:12.5px;font-weight:550;line-height:18px;color:var(--sl-danger, #c0392b)}
|
|
55
77
|
.sl-hco-link{padding:2px 0;font:inherit;font-size:13px;font-weight:600;color:var(--sl-muted);background:none;border:0;
|
|
56
78
|
text-decoration:underline;text-underline-offset:2px;cursor:pointer;align-self:flex-start}
|
|
57
|
-
.sl-hco-link:
|
|
79
|
+
.sl-hco-link:hover{color:var(--sl-text)}
|
|
80
|
+
.sl-hco-link:focus-visible{outline:2px solid transparent;border-radius:4px;
|
|
81
|
+
box-shadow:0 0 0 3px color-mix(in srgb, var(--sl-accent) 24%, transparent)}
|
|
82
|
+
.sl-hco-disclosure:hover{color:var(--sl-text);border-color:color-mix(in srgb, var(--sl-text) 28%, var(--sl-line))}
|
|
83
|
+
.sl-hco-disclosure:focus-visible{outline:2px solid transparent;border-style:solid;border-color:var(--sl-accent);
|
|
84
|
+
box-shadow:0 0 0 3px color-mix(in srgb, var(--sl-accent) 24%, transparent)}
|
|
58
85
|
.sl-hco-bf-inline{display:flex;flex-direction:column}
|
|
59
86
|
.sl-hco-bf-inline>.sl-hco-link{margin:-4px 0 4px}
|
|
60
87
|
.sl-hco-block{counter-increment:sl-hco-ticket;min-width:0;margin:0 0 10px;padding:10px 12px 0;border:1px solid var(--sl-line);
|
|
@@ -71,7 +98,8 @@ textarea.sl-hco-input{min-height:72px;resize:vertical}
|
|
|
71
98
|
.sl-hco-pair{display:grid;grid-template-columns:1fr 1fr;gap:0 10px}
|
|
72
99
|
.sl-hco-disclosure{display:flex;align-items:center;gap:8px;width:100%;min-height:44px;padding:10px 12px;font:inherit;font-size:13.5px;
|
|
73
100
|
font-weight:600;color:var(--sl-muted);text-align:left;background:none;border:1px dashed var(--sl-line);
|
|
74
|
-
border-radius:calc(var(--sl-radius) * .75);cursor:pointer
|
|
101
|
+
border-radius:calc(var(--sl-radius) * .75);cursor:pointer;
|
|
102
|
+
transition:border-color .14s cubic-bezier(.2,0,0,1),color .14s cubic-bezier(.2,0,0,1),box-shadow .14s cubic-bezier(.2,0,0,1)}
|
|
75
103
|
.sl-hco-plus{font-size:16px;line-height:1}
|
|
76
104
|
.sl-hco-group{min-width:0;margin:0 0 12px;padding:0;border:0}
|
|
77
105
|
.sl-hco-group legend{width:100%;margin:0 0 5px;padding:0;font-size:13px;font-weight:600}
|
|
@@ -79,14 +107,17 @@ textarea.sl-hco-input{min-height:72px;resize:vertical}
|
|
|
79
107
|
.sl-hco-choices{display:flex;flex-direction:column}
|
|
80
108
|
.sl-hco-chips .sl-hco-choices{flex-direction:row;flex-wrap:wrap;gap:6px}
|
|
81
109
|
.sl-hco-chip{position:relative;display:inline-flex;align-items:center;min-height:36px;padding:7px 13px;font-size:14px;
|
|
82
|
-
border:1px solid var(--sl-line);border-radius:999px;background:var(--sl-bg);cursor:pointer
|
|
110
|
+
border:1px solid var(--sl-line);border-radius:999px;background:var(--sl-bg);cursor:pointer;
|
|
111
|
+
transition:border-color .14s cubic-bezier(.2,0,0,1),background-color .14s cubic-bezier(.2,0,0,1),box-shadow .14s cubic-bezier(.2,0,0,1)}
|
|
112
|
+
.sl-hco-chip:hover:not(:has(input:checked)){border-color:color-mix(in srgb, var(--sl-text) 28%, var(--sl-line))}
|
|
83
113
|
.sl-hco-chip input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
|
|
84
114
|
.sl-hco-chip:has(input:checked){color:var(--sl-accent-ink);background:var(--sl-accent);border-color:var(--sl-accent);font-weight:600}
|
|
85
|
-
.sl-hco-chip:has(input:focus-visible){outline:2px solid var(--sl-accent);
|
|
115
|
+
.sl-hco-chip:has(input:focus-visible){outline:2px solid transparent;border-color:var(--sl-accent);
|
|
116
|
+
box-shadow:0 0 0 3px color-mix(in srgb, var(--sl-accent) 24%, transparent)}
|
|
86
117
|
.sl-hco-chips[aria-invalid="true"] .sl-hco-chip{border-color:var(--sl-danger, #c0392b)}
|
|
87
118
|
.sl-hco-check{display:flex;gap:8px;align-items:flex-start;margin:8px 0 0;font-size:14px;line-height:1.4;cursor:pointer}
|
|
88
119
|
.sl-hco-check input{flex:none;width:18px;height:18px;margin:1px 0 0;accent-color:var(--sl-accent)}
|
|
89
|
-
.sl-hco-check input:focus-visible{outline:2px solid var(--sl-accent);
|
|
120
|
+
.sl-hco-check input:focus-visible{outline:2px solid transparent;box-shadow:0 0 0 1px var(--sl-accent),0 0 0 4px color-mix(in srgb, var(--sl-accent) 24%, transparent);border-radius:4px}
|
|
90
121
|
.sl-hco-check .sl-hco-label-row{justify-content:flex-start}
|
|
91
122
|
.sl-hco-note{margin:16px 0 0;font-size:11.5px;line-height:1.5;color:var(--sl-muted)}
|
|
92
123
|
.sl-hco-note a{color:inherit;text-decoration:underline;text-underline-offset:2px}
|
|
@@ -100,14 +131,22 @@ textarea.sl-hco-input{min-height:72px;resize:vertical}
|
|
|
100
131
|
.sl-hco-total strong{font-size:18px;font-weight:700;font-variant-numeric:tabular-nums;color:var(--sl-text)}
|
|
101
132
|
.sl-hco-pay{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:48px;padding:12px;font:inherit;font-size:15.5px;
|
|
102
133
|
font-weight:650;color:var(--sl-accent-ink);background:var(--sl-accent);border:0;border-radius:calc(var(--sl-radius) * .6);cursor:pointer}
|
|
103
|
-
.sl-hco-pay
|
|
134
|
+
.sl-hco-pay{transition:filter .14s cubic-bezier(.2,0,0,1),box-shadow .14s cubic-bezier(.2,0,0,1),transform .09s cubic-bezier(.2,0,0,1)}
|
|
135
|
+
.sl-hco-pay:not([disabled]):hover{filter:brightness(1.06)}
|
|
136
|
+
.sl-hco-pay:not([disabled]):active{transform:translateY(1px)}
|
|
137
|
+
/* The button is filled with the accent, so the ring stands off it on the
|
|
138
|
+
card's own surface \u2014 the same ring the picker's CTA wears. */
|
|
139
|
+
.sl-hco-pay:focus-visible{outline:2px solid transparent;outline-offset:2px;
|
|
140
|
+
box-shadow:0 0 0 2px var(--sl-surface),0 0 0 4px var(--sl-accent),0 0 0 7px color-mix(in srgb, var(--sl-accent) 18%, transparent)}
|
|
104
141
|
.sl-hco-pay[disabled]{opacity:.8;cursor:progress}
|
|
105
142
|
.sl-hco-trust{margin:9px 0 0;font-size:12px;line-height:17px;color:var(--sl-muted);text-align:center}
|
|
106
143
|
.sl-hco-trust svg{display:inline-block;margin:0 5px -1px 0}
|
|
107
144
|
.sl-hco-spin{display:inline-block;width:16px;height:16px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;
|
|
108
145
|
animation:sl-hco-spin .8s linear infinite}
|
|
109
146
|
@keyframes sl-hco-spin{to{transform:rotate(360deg)}}
|
|
110
|
-
@media (prefers-reduced-motion:reduce){.sl-hco-spin{animation-duration:2.4s}
|
|
147
|
+
@media (prefers-reduced-motion:reduce){.sl-hco-spin{animation-duration:2.4s}
|
|
148
|
+
.sl-hco-input,.sl-hco-chip,.sl-hco-disclosure,.sl-hco-pay{transition:none}
|
|
149
|
+
.sl-hco-pay:not([disabled]):active{transform:none}}
|
|
111
150
|
.sl-hco-back{width:100%;min-height:44px;margin-top:8px;padding:10px;font:inherit;font-size:14px;font-weight:600;color:var(--sl-muted);
|
|
112
151
|
background:none;border:0;cursor:pointer}
|
|
113
152
|
.sl-hco-ghost{margin:0;color:var(--sl-text);border:1px solid var(--sl-line);border-radius:calc(var(--sl-radius) * .6)}
|
|
@@ -143,4 +182,4 @@ textarea.sl-hco-input{min-height:72px;resize:vertical}
|
|
|
143
182
|
.sl-hco-order:not([data-open]) .sl-hco-order-full{display:none}
|
|
144
183
|
.sl-hco-order{padding-top:0}
|
|
145
184
|
}
|
|
146
|
-
`;function et(){if(typeof document>"u"||document.getElementById(Oe))return;let o=document.createElement("style");o.id=Oe,o.textContent=Ze,document.head.appendChild(o)}function tt(o,u){let s=`${u} ${u===1?"seat is":"seats are"} held for a limited time.`;return o==="payments_off_for_event"?{title:"This event isn\u2019t sold online",body:`${s} The organiser isn\u2019t taking payment for this event here.`,detail:"Nothing has been charged. Check where you found this event for how to get tickets."}:o==="unavailable_for_event"?{title:"This event isn\u2019t taking payment yet",body:`${s} Online payment is not switched on for this event.`,detail:"Nothing has been charged. If you were sent here to pay, let the organiser know, only they can turn payment on for this event."}:{title:"Finish in the ticketing checkout",body:`${s} Payment for this event is taken elsewhere.`,detail:"Nothing has been charged. Continue in the checkout on this page to pay for your seats."}}var nt=3,ot=1,rt=400,it=3e3;function ze(o){if(!o||typeof o!="object")return!1;let u=o;return u.status!==503||u.code==="maintenance_mode"||u.reason==="maintenance_mode"?!1:u.code==="checkout_busy"||u.code==="database_busy"?!0:u.retryable===!0}function st(o,u=Math.random){let s=o?.retryAfterS,f=typeof s=="number"&&Number.isFinite(s)&&s>=0?s:ot,a=Math.floor(Math.max(0,Math.min(1,u()))*rt);return Math.min(it,f*1e3+a)}function at(o){return`${(typeof o?.notice=="string"?o.notice.trim():"")||(()=>{let f=o?.retryAfterS;if(typeof f!="number"||!Number.isFinite(f)||f<0)return"Booking is paused for a few minutes for maintenance. Please try again shortly.";let a=Math.max(1,Math.ceil(f/60));return`Booking is paused for maintenance. Please try again in about ${a} minute${a===1?"":"s"}.`})()} Nothing was charged. Your seats are still held.`}function ue(o,u){if(o==="maintenance_mode")return at(u);switch(o){case"checkout_busy":case"database_busy":return u?.free?"We couldn\u2019t confirm your booking yet because it\u2019s very busy. Nothing was charged. Please try again.":"We couldn\u2019t start the payment yet because it\u2019s very busy. Nothing was charged. Please try again.";case"gateway_not_connected":case"payments_not_enabled_for_event":return"This event is not taking online payments. Contact the organiser to buy these seats.";case"provider_mismatch":return"This event\u2019s payment setup changed while you were choosing. Nothing was charged. Please try again.";case"hold_not_active":case"hold_not_found":return"Your seats were released before checkout started. Nothing was charged. Please pick again.";case"checkout_already_started":return"A payment for these seats is already in progress. Finish that one, or wait for it to time out before starting again.";case"event_closed":return"Sales for this event have closed.";case"insufficient_hosted_credits":return"Ticket sales are temporarily paused while the organiser updates their SeatLayer balance. Nothing was charged. Please try again later or contact the organiser.";case"gateway_currency_mismatch":case"unsupported_currency":case"mixed_currency_hold":case"price_unusable":return"These seats cannot be checked out right now because of a pricing configuration problem. Nothing was charged. Please contact the organiser.";case"provider_refused":return"The organiser\u2019s payment provider refused to start this payment. Nothing was charged. Please contact the organiser.";case"rate_limited":return"Too many attempts. Wait a moment and try again.";case"seats_unavailable":return"Those seats were taken while you were filling this in. Nothing was charged. Please pick again.";case"booking_form_incomplete":return"The details this event asks for changed while you were choosing. Nothing was charged. Please go back and try again.";default:return"We could not start the payment. Nothing was charged. Please try again."}}function i(o,u,s){let f=document.createElement(o);return u&&(f.className=u),s!==void 0&&(f.textContent=s),f}var $e="http://www.w3.org/2000/svg";function re(o,u=18,s="0 0 20 20"){let f=document.createElementNS($e,"svg");f.setAttribute("viewBox",s),f.setAttribute("width",String(u)),f.setAttribute("height",String(u)),f.setAttribute("fill","none"),f.setAttribute("stroke","currentColor"),f.setAttribute("stroke-width","1.8"),f.setAttribute("stroke-linecap","round"),f.setAttribute("stroke-linejoin","round"),f.setAttribute("aria-hidden","true"),f.setAttribute("focusable","false");for(let a of o){let v=document.createElementNS($e,"path");v.setAttribute("d",a),f.appendChild(v)}return f}var ee={back:["M12.5 4.5 7 10l5.5 5.5"],clock:["M10 2.8a7.2 7.2 0 1 1 0 14.4a7.2 7.2 0 1 1 0-14.4","M10 6.2V10l2.6 1.7"],down:["m5 7.5 5 5 5-5"],lock:["M4.2 8.8h7.6a1.4 1.4 0 0 1 1.4 1.4v4.4a1.4 1.4 0 0 1-1.4 1.4H4.2a1.4 1.4 0 0 1-1.4-1.4v-4.4a1.4 1.4 0 0 1 1.4-1.4z","M5.4 8.8V6.6a2.6 2.6 0 0 1 5.2 0v2.2"],hour:["M12 3a9 9 0 1 1 0 18a9 9 0 1 1 0-18","M12 7v5l3 2"],seat:["M6 11V6a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v5M4 11h16v4H4zM6 15v4M18 15v4"],card:["M5 5.5h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2z","M3 10h18M7 15h3"],alert:["M12 3a9 9 0 1 1 0 18a9 9 0 1 1 0-18","M12 7.5v5.5M12 16.5v.1"]},lt=12e4;function ct(o){let u=Math.max(0,Math.ceil(o/1e3)),s=Math.floor(u/3600),f=Math.floor(u%3600/60),a=String(u%60).padStart(2,"0");return s>0?`${s}:${String(f).padStart(2,"0")}:${a}`:`${f}:${a}`}function pt(o){et();let u=!0,s=!1,f=null,a=(e,r,p)=>{let g=o.t?.(e,p);return g&&g!==e?g:p?r.replace(/\{(\w+)\}/g,(H,B)=>B in p?String(p[B]):H):r},v=i("div","sl-hco");v.setAttribute("role","dialog"),v.setAttribute("aria-modal","true");let K=i("div","sl-hco-card");v.appendChild(K);let R=()=>{f&&clearInterval(f),f=null},I=()=>{u=!1,R(),v.remove(),document.removeEventListener("keydown",P,!0)},A=()=>{I(),o.onCancel()},ie=!0;function P(e){if(v.isConnected){if(e.key==="Tab"){let r=[...K.querySelectorAll("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])")].filter(H=>H.offsetParent!==null||H===document.activeElement),p=r[0],g=r[r.length-1];if(!p||!g)return;e.shiftKey&&document.activeElement===p?(e.preventDefault(),g.focus()):!e.shiftKey&&document.activeElement===g&&(e.preventDefault(),p.focus());return}e.key==="Escape"&&(e.stopPropagation(),e.preventDefault(),ie&&A())}}document.addEventListener("keydown",P,!0);let S=`sl-hco-t-${Math.random().toString(36).slice(2,8)}`,se=i("header","sl-hco-head"),D=i("button","sl-hco-back-icon");D.type="button",D.setAttribute("aria-label",a("checkout.back","Back to seats")),D.appendChild(re([...ee.back])),D.addEventListener("click",()=>{ie&&A()});let he=i("div","sl-hco-htext"),q=i("h2","sl-hco-title",o.event?.name?.trim()||a("checkout.title","Checkout"));q.id=S;let pe=i("p","sl-hco-sub",o.event?.detail?.trim()??"");pe.hidden=!pe.textContent,he.append(q,pe);let L=i("span","sl-hco-timer");L.setAttribute("role","timer");let O=i("span");O.setAttribute("aria-hidden","true"),L.append(re([...ee.clock],14),O),L.hidden=!0,se.append(D,he,L),v.setAttribute("aria-labelledby",S);let U=i("p","sl-hco-sr");U.setAttribute("aria-live","polite");let Y=(...e)=>{K.replaceChildren(se,U,...e)},G=e=>{ie=e,D.hidden=!e},J=e=>{let r=i("div","sl-hco-state");r.setAttribute("role",e.alert?"alert":"status");let p=i("div",`sl-hco-state-icon is-${e.tone}`);return p.setAttribute("aria-hidden","true"),p.appendChild(e.icon),r.appendChild(p),e.title&&r.appendChild(i("h3","sl-hco-state-title",e.title)),e.text&&r.appendChild(i("p",`sl-hco-status${e.alert?" sl-hco-error":""}`,e.text)),e.note&&r.appendChild(i("p","sl-hco-state-note",e.note)),r},V=(...e)=>{let r=i("div","sl-hco-body");return r.append(...e),r},te=(...e)=>{let r=i("footer","sl-hco-foot");return r.append(...e),r},fe=()=>{let e=i("span","sl-hco-spin");return e.setAttribute("aria-hidden","true"),e},z=(e,r="error")=>{if(!u)return;R(),L.hidden=!0,G(!0);let p=i("button",r==="error"?"sl-hco-back sl-hco-ghost":"sl-hco-pay",r==="expired"?a("checkout.chooseAgain","Choose seats again"):r==="taken"?a("checkout.chooseOther","Choose other seats"):a("checkout.back","Back to seats"));if(p.type="button",p.addEventListener("click",A),r==="error"){let g=i("p","sl-hco-alert is-error sl-hco-status sl-hco-error",e);g.setAttribute("role","alert"),Y(V(...Q?[Q]:[],g),te(p))}else Y(V(J({tone:r==="expired"?"warn":"error",icon:re([...r==="expired"?ee.hour:ee.seat],24,"0 0 24 24"),title:r==="expired"?a("checkout.expiredTitle","Your seats were released"):a("checkout.takenTitle","Those seats were just taken"),text:e,alert:!1})),te(p));p.focus()},ye=(e,r)=>{u&&(R(),L.hidden=!0,G(!1),Y(V(J({tone:"neutral",icon:fe(),...r?{title:r}:{},text:e}))))},ae=async(e,r=!1)=>{ye(r?a("checkout.confirmingSeats","Confirming your seats\u2026"):"Payment received. Confirming your seats\u2026");let p=Date.now()+Xe;for(;u&&Date.now()<p;){try{let g=await o.orderStatus(e);if(!u)return;if(g.status==="confirmed"){s=!0,G(!1),q.textContent=a("checkout.confirmedTitle","Your tickets are confirmed");let H=i("p","sl-hco-status",`${g.seatCount} ${g.seatCount===1?"seat":"seats"} confirmed. Your tickets, with their door QR codes, are in your email.`),B=i("dl","sl-hco-receipt"),$=(g.tickets??[]).map(oe=>oe.displayLabel||oe.label);$.length&&B.append(i("dt",void 0,"Seats"),i("dd",void 0,$.join(", ")));let j=r||g.totalMinor===0;B.append(i("dt",void 0,j?a("checkout.price","Price"):a("checkout.paid","Paid")),i("dd",void 0,j?a("checkout.free","Free"):`${g.amountFormatted} ${g.currency}`),i("dt",void 0,a("checkout.order","Order")),i("dd","sl-hco-ref",g.orderId));let de=i("button","sl-hco-back","Close");de.type="button",de.addEventListener("click",A);let Z=i("div","sl-hco-state");if(Z.append(H,B),g.ticketUrl){let oe=i("a","sl-hco-tickets",a("checkout.viewTickets","View tickets & QR codes"));oe.href=g.ticketUrl,oe.target="_blank",oe.rel="noreferrer",Z.appendChild(oe)}Z.appendChild(de),Y(V(Z)),ie=!0,o.onConfirmed(g);return}if(g.status==="failed"||g.status==="expired"){g.status==="expired"?z("Your seats were released before payment completed. Nothing was charged. Please pick again.","expired"):z("The payment did not complete. If you were charged, it has been refunded automatically.");return}}catch{}await new Promise(g=>setTimeout(g,We))}!u||s||z(r?"Still confirming your booking. Once it is confirmed, your tickets will arrive by email. Nothing was charged.":"Still confirming with the payment provider. If your payment went through, your tickets will arrive by email shortly. You do not need to pay again.")},Q=null;if(o.state.kind==="unavailable"){let e=tt(o.state.reason,o.state.seatCount);q.textContent=e.title;let r=i("button","sl-hco-back sl-hco-ghost","Back to seat map");r.type="button",r.addEventListener("click",A);let p=i("p","sl-hco-label","Seats held");return Y(V(p,J({tone:"neutral",icon:re([...ee.seat],24,"0 0 24 24"),text:e.body,note:e.detail})),te(r)),o.root.appendChild(v),r.focus(),{destroy:I}}if(o.state.kind==="resume")return o.root.appendChild(v),ae(o.state.orderId),{destroy:I};let{order:_,bookingForm:le}=o.state,X=o.state.free===!0,ge=e=>X?a("checkout.free","Free"):o.formatMoney(e,_.currency),me=ge(_.total);Q=i("section","sl-hco-sec sl-hco-order sl-hco-summary");let t=_.lines?.length?_.lines:_.labels.map(e=>({label:e,detail:null,amount:null})),n=t.length===1?[t[0].label,t[0].detail].filter(Boolean).join(" \xB7 "):`${_.tickets?.length||t.length} ${(_.tickets?.length||t.length)===1?"seat":"seats"}`,c=i("button","sl-hco-order-toggle");c.type="button",c.setAttribute("aria-expanded","false"),c.append(i("span",void 0,n),re([...ee.down])),c.addEventListener("click",()=>{let e=!Q.hasAttribute("data-open");Q.toggleAttribute("data-open",e),c.setAttribute("aria-expanded",String(e))});let b=i("div","sl-hco-order-full"),l=i("ul","sl-hco-lines sl-hco-seats");for(let e of t){let r=i("li","sl-hco-line sl-hco-seat"),p=i("span","sl-hco-line-text");p.appendChild(i("span","sl-hco-where",e.label)),e.detail&&p.appendChild(i("span","sl-hco-what",e.detail)),r.appendChild(p),typeof e.amount=="number"&&r.appendChild(i("span","sl-hco-price",ge(e.amount))),l.appendChild(r)}b.append(i("h3","sl-hco-h",a("checkout.yourOrder","Your order")),l),Q.append(c,b);let h=i("form","sl-hco-form");h.noValidate=!0;let d=e=>{let r=i("div","sl-hco-field"),p=i("label","sl-hco-label"),g=i("span","sl-hco-label-row");g.appendChild(i("span",void 0,e.label));let H=i("span","sl-hco-optional",a("checkout.optional","Optional"));e.optional&&g.append(" ",H),p.appendChild(g),p.htmlFor=e.id;let B=e.hint?i("p","sl-hco-help",e.hint):null;B&&(B.id=`${e.id}-h`);let $=i("input","sl-hco-input");$.type=e.type,$.id=e.id,$.autocomplete=e.autocomplete,$.placeholder=e.placeholder;let j=i("p","sl-hco-ferr");j.id=`${e.id}-e`,j.hidden=!0,$.setAttribute("aria-describedby",B?`${B.id} ${j.id}`:j.id),r.append(p,...B?[B]:[],$,j);let de=Z=>{j.textContent=Z??"",j.hidden=!Z,Z?$.setAttribute("aria-invalid","true"):$.removeAttribute("aria-invalid")};return $.addEventListener("input",()=>de(null)),{wrap:r,input:$,optional:H,setError:de}},k=d({id:`${S}-email`,label:a("checkout.email","Email"),type:"email",autocomplete:"email",placeholder:"you@example.com",hint:a("checkout.emailHint","Your tickets are sent here."),optional:!1}),T=k.input;T.required=!0,T.inputMode="email";let w=d({id:`${S}-name`,label:a("checkout.name","Name"),type:"text",autocomplete:"name",placeholder:a("checkout.namePlaceholder","Your name"),optional:!0}),N=w.input;le?.attendeeName==="required"&&(w.optional.previousSibling?.remove(),w.optional.remove(),N.setAttribute("aria-required","true"));let y=()=>/.+@.+\..+/.test(T.value.trim()),m=Ke({form:le,tickets:_.tickets??[],idPrefix:S,t:a,buyer:()=>({name:N.value.trim(),email:T.value.trim()}),buyerError:(e,r)=>((e==="name"?w:k).setError(r),e==="name"?N:T)}),F=i("section","sl-hco-sec");F.append(i("h3","sl-hco-h",a("checkout.yourDetails","Your details")),k.wrap,w.wrap,...m.details?.childNodes.length?[m.details]:[]);let M=i("p","sl-hco-note");M.append(`${a("checkout.privacy","The organizer and SeatLayer use your details to issue and manage your tickets.")} `);let C=i("a",void 0,a("checkout.privacyLink","Privacy Policy"));C.href="https://seatlayer.io/privacy/",C.target="_blank",C.rel="noreferrer",M.appendChild(C);let W=i("fieldset","sl-hco-fields");W.append(Q,F,...m.element?[m.element]:[],M);let xe=V(W),E=i("p","sl-hco-alert is-error sl-hco-status sl-hco-error");E.setAttribute("role","alert"),E.hidden=!0;let be=e=>{E.textContent=e,E.hidden=!1},ke=i("p","sl-hco-alert is-warn");ke.hidden=!0;let Me=i("div","sl-hco-total"),Ae=_.tickets?.length||_.labels.length;Me.append(i("span",void 0,`${Ae} ${Ae===1?"seat":"seats"}`),i("strong",void 0,me));let _e=X?a("checkout.confirmBooking","Confirm booking"):a("checkout.continue","Continue to payment"),ne=i("button","sl-hco-pay",_e);ne.type="submit";let ve=i("p","sl-hco-sr");ve.setAttribute("role","status");let Fe=e=>{ne.replaceChildren(fe(),e),ve.textContent=e},Ee=i("p","sl-hco-trust");X||Ee.appendChild(re([...ee.lock],12,"0 0 16 16")),Ee.append(X?a("checkout.freeTrust","Free booking. Nothing is charged."):a("checkout.trust","Secure payment on the organizer\u2019s payment page. We never see your card.")),h.append(xe,te(E,ke,Me,ne,ve,Ee));let Se=null,Le=()=>{let e=_.expiresAt-Date.now(),r=ct(e);O.textContent=r,L.setAttribute("aria-label",a("checkout.heldFor","Seats held for {time}",{time:r}));let p=e<=lt;L.classList.toggle("is-warn",p),ke.hidden=!p||!E.hidden,p&&(ke.textContent=a("checkout.expiringSoon","Your seats are held for {time}. Finish soon to keep them.",{time:r}));let g=e<=3e4?30:p?120:null;g&&Se!==g&&(Se=g,U.textContent=ke.textContent),e<=0&&z(a("checkout.expiredBody","The hold on {seats} ran out before payment started.",{seats:t.map(H=>H.label).join(", ")}),"expired")},qe=()=>{Number.isFinite(_.expiresAt)&&(R(),L.hidden=!1,Le(),f=setInterval(Le,1e3))},we=!1,Re=async()=>{if(!we){we=!0,E.hidden=!0,W.disabled=!0,ne.disabled=!0,Fe(X?a("checkout.confirmingBooking","Confirming your booking\u2026"):a("checkout.opening","Opening secure payment\u2026"));try{let e={holdId:_.holdId,buyerEmail:T.value.trim(),...N.value.trim()?{buyerName:N.value.trim()}:{},...m.payload(),bookingFormVersion:1},r=0,p;for(;;)try{p=await o.startSession(e);break}catch(H){if(!u)return;if(r>=nt||!ze(H))throw H;if(r+=1,Fe(X?a("checkout.busyRetryingBooking","Busy right now. Still confirming your booking\u2026"):a("checkout.busyRetryingPayment","Busy right now. Still opening secure payment\u2026")),await new Promise(B=>setTimeout(B,st(H))),!u)return}if(!u)return;if(p.status==="confirmed"){ae(p.orderId,!0);return}let g=Ne(p.redirectUrl);if(g){Je(p.orderId,o.eventKey),R(),L.hidden=!0,Y(V(J({tone:"neutral",icon:re([...ee.card],24,"0 0 24 24"),title:a("checkout.redirectTitle","Taking you to secure payment"),text:a("checkout.redirectBody","You\u2019ll pay {amount} on the organizer\u2019s payment page, then come back here for your tickets.",{amount:me}),note:a("checkout.dontClose","Don\u2019t close this tab.")}))),window.location.assign(g);return}z(ue("gateway_unavailable"))}catch(e){o.onError?.(e);let r=e;if(r?.code==="booking_form_incomplete"&&m.element){Te(),m.showServerErrors(r.fields);return}if(ze(r)){Te(),be(X?a("checkout.busyFailedBooking",ue("checkout_busy",{free:!0})):a("checkout.busyFailedPayment",ue("checkout_busy"))),ne.textContent=a("checkout.tryAgain","Try again");return}if(r?.code==="hold_not_active"||r?.code==="hold_not_found"){z(ue(r.code),"expired");return}if(r?.code==="seats_unavailable"){z(a("checkout.seatsUnavailable",ue(r.code)),"taken");return}z(ue(r?.code,r))}}};h.addEventListener("submit",e=>{if(e.preventDefault(),we)return;let r=y();k.setError(r?null:a("checkout.error.email","Enter an email like name@example.com."));let p=m.validate();if(!r){be(a("bookingForm.fixErrors","Some details need attention before you continue.")),T.focus();return}if(!p){be(a("bookingForm.fixErrors","Some details need attention before you continue."));return}Re()});let Te=()=>{q.textContent=o.event?.name?.trim()||a("checkout.title","Checkout"),E.hidden=!0,E.textContent="",we=!1,W.disabled=!1,ne.disabled=!1,ne.textContent=_e,ve.textContent="",G(!0),Y(h),qe()};return Te(),o.root.appendChild(v),(typeof window.matchMedia!="function"||window.matchMedia("(min-width: 561px)").matches)&&T.focus(),{destroy:I}}export{nt as CHECKOUT_BUSY_MAX_RETRIES,st as checkoutBusyDelayMs,ue as errorCopy,ct as formatHoldClock,ze as isCheckoutBusy,pt as mountCheckout,tt as unavailableCopy};
|
|
185
|
+
`;function et(){if(typeof document>"u"||document.getElementById(Oe))return;let n=document.createElement("style");n.id=Oe,n.textContent=Ze,document.head.appendChild(n)}function tt(n,u){let s=`${u} ${u===1?"seat is":"seats are"} held for a limited time.`;return n==="payments_off_for_event"?{title:"This event isn\u2019t sold online",body:`${s} The organiser isn\u2019t taking payment for this event here.`,detail:"Nothing has been charged. Check where you found this event for how to get tickets."}:n==="unavailable_for_event"?{title:"This event isn\u2019t taking payment yet",body:`${s} Online payment is not switched on for this event.`,detail:"Nothing has been charged. If you were sent here to pay, let the organiser know, only they can turn payment on for this event."}:{title:"Finish in the ticketing checkout",body:`${s} Payment for this event is taken elsewhere.`,detail:"Nothing has been charged. Continue in the checkout on this page to pay for your seats."}}var ot=3,nt=1,rt=400,it=3e3;function Ke(n){if(!n||typeof n!="object")return!1;let u=n;return u.status!==503||u.code==="maintenance_mode"||u.reason==="maintenance_mode"?!1:u.code==="checkout_busy"||u.code==="database_busy"?!0:u.retryable===!0}function st(n,u=Math.random){let s=n?.retryAfterS,g=typeof s=="number"&&Number.isFinite(s)&&s>=0?s:nt,a=Math.floor(Math.max(0,Math.min(1,u()))*rt);return Math.min(it,g*1e3+a)}function at(n){return`${(typeof n?.notice=="string"?n.notice.trim():"")||(()=>{let g=n?.retryAfterS;if(typeof g!="number"||!Number.isFinite(g)||g<0)return"Booking is paused for a few minutes for maintenance. Please try again shortly.";let a=Math.max(1,Math.ceil(g/60));return`Booking is paused for maintenance. Please try again in about ${a} minute${a===1?"":"s"}.`})()} Nothing was charged. Your seats are still held.`}function ue(n,u){if(n==="maintenance_mode")return at(u);switch(n){case"checkout_busy":case"database_busy":return u?.free?"We couldn\u2019t confirm your booking yet because it\u2019s very busy. Nothing was charged. Please try again.":"We couldn\u2019t start the payment yet because it\u2019s very busy. Nothing was charged. Please try again.";case"gateway_not_connected":case"payments_not_enabled_for_event":return"This event is not taking online payments. Contact the organiser to buy these seats.";case"provider_mismatch":return"This event\u2019s payment setup changed while you were choosing. Nothing was charged. Please try again.";case"hold_not_active":case"hold_not_found":return"Your seats were released before checkout started. Nothing was charged. Please pick again.";case"checkout_already_started":return"A payment for these seats is already in progress. Finish that one, or wait for it to time out before starting again.";case"event_closed":return"Sales for this event have closed.";case"insufficient_hosted_credits":return"Ticket sales are temporarily paused while the organiser updates their SeatLayer balance. Nothing was charged. Please try again later or contact the organiser.";case"gateway_currency_mismatch":case"unsupported_currency":case"mixed_currency_hold":case"price_unusable":return"These seats cannot be checked out right now because of a pricing configuration problem. Nothing was charged. Please contact the organiser.";case"provider_refused":return"The organiser\u2019s payment provider refused to start this payment. Nothing was charged. Please contact the organiser.";case"rate_limited":return"Too many attempts. Wait a moment and try again.";case"seats_unavailable":return"Those seats were taken while you were filling this in. Nothing was charged. Please pick again.";case"booking_form_incomplete":return"The details this event asks for changed while you were choosing. Nothing was charged. Please go back and try again.";default:return"We could not start the payment. Nothing was charged. Please try again."}}function i(n,u,s){let g=document.createElement(n);return u&&(g.className=u),s!==void 0&&(g.textContent=s),g}var $e="http://www.w3.org/2000/svg";function re(n,u=18,s="0 0 20 20"){let g=document.createElementNS($e,"svg");g.setAttribute("viewBox",s),g.setAttribute("width",String(u)),g.setAttribute("height",String(u)),g.setAttribute("fill","none"),g.setAttribute("stroke","currentColor"),g.setAttribute("stroke-width","1.8"),g.setAttribute("stroke-linecap","round"),g.setAttribute("stroke-linejoin","round"),g.setAttribute("aria-hidden","true"),g.setAttribute("focusable","false");for(let a of n){let v=document.createElementNS($e,"path");v.setAttribute("d",a),g.appendChild(v)}return g}var ee={back:["M12.5 4.5 7 10l5.5 5.5"],clock:["M10 2.8a7.2 7.2 0 1 1 0 14.4a7.2 7.2 0 1 1 0-14.4","M10 6.2V10l2.6 1.7"],down:["m5 7.5 5 5 5-5"],lock:["M4.2 8.8h7.6a1.4 1.4 0 0 1 1.4 1.4v4.4a1.4 1.4 0 0 1-1.4 1.4H4.2a1.4 1.4 0 0 1-1.4-1.4v-4.4a1.4 1.4 0 0 1 1.4-1.4z","M5.4 8.8V6.6a2.6 2.6 0 0 1 5.2 0v2.2"],hour:["M12 3a9 9 0 1 1 0 18a9 9 0 1 1 0-18","M12 7v5l3 2"],seat:["M6 11V6a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v5M4 11h16v4H4zM6 15v4M18 15v4"],card:["M5 5.5h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2z","M3 10h18M7 15h3"],alert:["M12 3a9 9 0 1 1 0 18a9 9 0 1 1 0-18","M12 7.5v5.5M12 16.5v.1"]},lt=12e4;function ct(n){let u=Math.max(0,Math.ceil(n/1e3)),s=Math.floor(u/3600),g=Math.floor(u%3600/60),a=String(u%60).padStart(2,"0");return s>0?`${s}:${String(g).padStart(2,"0")}:${a}`:`${g}:${a}`}function pt(n){et();let u=!0,s=!1,g=null,a=(e,r,p)=>{let f=n.t?.(e,p);return f&&f!==e?f:p?r.replace(/\{(\w+)\}/g,(H,B)=>B in p?String(p[B]):H):r},v=i("div","sl-hco");v.setAttribute("role","dialog"),v.setAttribute("aria-modal","true");let P=i("div","sl-hco-card");v.appendChild(P);let D=()=>{g&&clearInterval(g),g=null},z=()=>{u=!1,D(),v.remove(),document.removeEventListener("keydown",I,!0)},M=()=>{z(),n.onCancel()},ie=!0;function I(e){if(v.isConnected){if(e.key==="Tab"){let r=[...P.querySelectorAll("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])")].filter(H=>H.offsetParent!==null||H===document.activeElement),p=r[0],f=r[r.length-1];if(!p||!f)return;e.shiftKey&&document.activeElement===p?(e.preventDefault(),f.focus()):!e.shiftKey&&document.activeElement===f&&(e.preventDefault(),p.focus());return}e.key==="Escape"&&(e.stopPropagation(),e.preventDefault(),ie&&M())}}document.addEventListener("keydown",I,!0);let S=`sl-hco-t-${Math.random().toString(36).slice(2,8)}`,se=i("header","sl-hco-head"),R=i("button","sl-hco-back-icon");R.type="button",R.setAttribute("aria-label",a("checkout.back","Back to seats")),R.appendChild(re([...ee.back])),R.addEventListener("click",()=>{ie&&M()});let he=i("div","sl-hco-htext"),q=i("h2","sl-hco-title",n.event?.name?.trim()||a("checkout.title","Checkout"));q.id=S;let pe=i("p","sl-hco-sub",n.event?.detail?.trim()??"");pe.hidden=!pe.textContent,he.append(q,pe);let L=i("span","sl-hco-timer");L.setAttribute("role","timer");let O=i("span");O.setAttribute("aria-hidden","true"),L.append(re([...ee.clock],14),O),L.hidden=!0,se.append(R,he,L),v.setAttribute("aria-labelledby",S);let U=i("p","sl-hco-sr");U.setAttribute("aria-live","polite");let Y=(...e)=>{P.replaceChildren(se,U,...e)},G=e=>{ie=e,R.hidden=!e},J=e=>{let r=i("div","sl-hco-state");r.setAttribute("role",e.alert?"alert":"status");let p=i("div",`sl-hco-state-icon is-${e.tone}`);return p.setAttribute("aria-hidden","true"),p.appendChild(e.icon),r.appendChild(p),e.title&&r.appendChild(i("h3","sl-hco-state-title",e.title)),e.text&&r.appendChild(i("p",`sl-hco-status${e.alert?" sl-hco-error":""}`,e.text)),e.note&&r.appendChild(i("p","sl-hco-state-note",e.note)),r},V=(...e)=>{let r=i("div","sl-hco-body");return r.append(...e),r},te=(...e)=>{let r=i("footer","sl-hco-foot");return r.append(...e),r},ge=()=>{let e=i("span","sl-hco-spin");return e.setAttribute("aria-hidden","true"),e},K=(e,r="error")=>{if(!u)return;D(),L.hidden=!0,G(!0);let p=i("button",r==="error"?"sl-hco-back sl-hco-ghost":"sl-hco-pay",r==="expired"?a("checkout.chooseAgain","Choose seats again"):r==="taken"?a("checkout.chooseOther","Choose other seats"):a("checkout.back","Back to seats"));if(p.type="button",p.addEventListener("click",M),r==="error"){let f=i("p","sl-hco-alert is-error sl-hco-status sl-hco-error",e);f.setAttribute("role","alert"),Y(V(...Q?[Q]:[],f),te(p))}else Y(V(J({tone:r==="expired"?"warn":"error",icon:re([...r==="expired"?ee.hour:ee.seat],24,"0 0 24 24"),title:r==="expired"?a("checkout.expiredTitle","Your seats were released"):a("checkout.takenTitle","Those seats were just taken"),text:e,alert:!1})),te(p));p.focus()},xe=(e,r)=>{u&&(D(),L.hidden=!0,G(!1),Y(V(J({tone:"neutral",icon:ge(),...r?{title:r}:{},text:e}))))},ae=async(e,r=!1)=>{xe(r?a("checkout.confirmingSeats","Confirming your seats\u2026"):"Payment received. Confirming your seats\u2026");let p=Date.now()+Xe;for(;u&&Date.now()<p;){try{let f=await n.orderStatus(e);if(!u)return;if(f.status==="confirmed"){s=!0,G(!1),q.textContent=a("checkout.confirmedTitle","Your tickets are confirmed");let H=i("p","sl-hco-status",`${f.seatCount} ${f.seatCount===1?"seat":"seats"} confirmed. Your tickets, with their door QR codes, are in your email.`),B=i("dl","sl-hco-receipt"),$=(f.tickets??[]).map(ne=>ne.displayLabel||ne.label);$.length&&B.append(i("dt",void 0,"Seats"),i("dd",void 0,$.join(", ")));let j=r||f.totalMinor===0;B.append(i("dt",void 0,j?a("checkout.price","Price"):a("checkout.paid","Paid")),i("dd",void 0,j?a("checkout.free","Free"):`${f.amountFormatted} ${f.currency}`),i("dt",void 0,a("checkout.order","Order")),i("dd","sl-hco-ref",f.orderId));let de=i("button","sl-hco-back","Close");de.type="button",de.addEventListener("click",M);let Z=i("div","sl-hco-state");if(Z.append(H,B),f.ticketUrl){let ne=i("a","sl-hco-tickets",a("checkout.viewTickets","View tickets & QR codes"));ne.href=f.ticketUrl,ne.target="_blank",ne.rel="noreferrer",Z.appendChild(ne)}Z.appendChild(de),Y(V(Z)),ie=!0,n.onConfirmed(f);return}if(f.status==="failed"||f.status==="expired"){f.status==="expired"?K("Your seats were released before payment completed. Nothing was charged. Please pick again.","expired"):K("The payment did not complete. If you were charged, it has been refunded automatically.");return}}catch{}await new Promise(f=>setTimeout(f,We))}!u||s||K(r?"Still confirming your booking. Once it is confirmed, your tickets will arrive by email. Nothing was charged.":"Still confirming with the payment provider. If your payment went through, your tickets will arrive by email shortly. You do not need to pay again.")},Q=null;if(n.state.kind==="unavailable"){let e=tt(n.state.reason,n.state.seatCount);q.textContent=e.title;let r=i("button","sl-hco-back sl-hco-ghost","Back to seat map");r.type="button",r.addEventListener("click",M);let p=i("p","sl-hco-label","Seats held");return Y(V(p,J({tone:"neutral",icon:re([...ee.seat],24,"0 0 24 24"),text:e.body,note:e.detail})),te(r)),n.root.appendChild(v),r.focus(),{destroy:z}}if(n.state.kind==="resume")return n.root.appendChild(v),ae(n.state.orderId),{destroy:z};let{order:_,bookingForm:le}=n.state,X=n.state.free===!0,fe=e=>X?a("checkout.free","Free"):n.formatMoney(e,_.currency),me=fe(_.total);Q=i("section","sl-hco-sec sl-hco-order sl-hco-summary");let t=_.lines?.length?_.lines:_.labels.map(e=>({label:e,detail:null,amount:null})),o=t.length===1?[t[0].label,t[0].detail].filter(Boolean).join(" \xB7 "):`${_.tickets?.length||t.length} ${(_.tickets?.length||t.length)===1?"seat":"seats"}`,c=i("button","sl-hco-order-toggle");c.type="button",c.setAttribute("aria-expanded","false"),c.append(i("span",void 0,o),re([...ee.down])),c.addEventListener("click",()=>{let e=!Q.hasAttribute("data-open");Q.toggleAttribute("data-open",e),c.setAttribute("aria-expanded",String(e))});let b=i("div","sl-hco-order-full"),l=i("ul","sl-hco-lines sl-hco-seats");for(let e of t){let r=i("li","sl-hco-line sl-hco-seat"),p=i("span","sl-hco-line-text");p.appendChild(i("span","sl-hco-where",e.label)),e.detail&&p.appendChild(i("span","sl-hco-what",e.detail)),r.appendChild(p),typeof e.amount=="number"&&r.appendChild(i("span","sl-hco-price",fe(e.amount))),l.appendChild(r)}b.append(i("h3","sl-hco-h",a("checkout.yourOrder","Your order")),l),Q.append(c,b);let h=i("form","sl-hco-form");h.noValidate=!0;let d=e=>{let r=i("div","sl-hco-field"),p=i("label","sl-hco-label"),f=i("span","sl-hco-label-row");f.appendChild(i("span",void 0,e.label));let H=i("span","sl-hco-optional",a("checkout.optional","Optional"));e.optional&&f.append(" ",H),p.appendChild(f),p.htmlFor=e.id;let B=e.hint?i("p","sl-hco-help",e.hint):null;B&&(B.id=`${e.id}-h`);let $=i("input","sl-hco-input");$.type=e.type,$.id=e.id,$.autocomplete=e.autocomplete,$.placeholder=e.placeholder;let j=i("p","sl-hco-ferr");j.id=`${e.id}-e`,j.hidden=!0,$.setAttribute("aria-describedby",B?`${B.id} ${j.id}`:j.id),r.append(p,...B?[B]:[],$,j);let de=Z=>{j.textContent=Z??"",j.hidden=!Z,Z?$.setAttribute("aria-invalid","true"):$.removeAttribute("aria-invalid")};return $.addEventListener("input",()=>de(null)),{wrap:r,input:$,optional:H,setError:de}},k=d({id:`${S}-email`,label:a("checkout.email","Email"),type:"email",autocomplete:"email",placeholder:"you@example.com",hint:a("checkout.emailHint","Your tickets are sent here."),optional:!1}),T=k.input;T.required=!0,T.inputMode="email";let w=d({id:`${S}-name`,label:a("checkout.name","Name"),type:"text",autocomplete:"name",placeholder:a("checkout.namePlaceholder","Your name"),optional:!0}),N=w.input;le?.attendeeName==="required"&&(w.optional.previousSibling?.remove(),w.optional.remove(),N.setAttribute("aria-required","true"));let x=()=>/.+@.+\..+/.test(T.value.trim()),m=Pe({form:le,tickets:_.tickets??[],idPrefix:S,t:a,buyer:()=>({name:N.value.trim(),email:T.value.trim()}),buyerError:(e,r)=>((e==="name"?w:k).setError(r),e==="name"?N:T)}),F=i("section","sl-hco-sec");F.append(i("h3","sl-hco-h",a("checkout.yourDetails","Your details")),k.wrap,w.wrap,...m.details?.childNodes.length?[m.details]:[]);let A=i("p","sl-hco-note");A.append(`${a("checkout.privacy","The organizer and SeatLayer use your details to issue and manage your tickets.")} `);let C=i("a",void 0,a("checkout.privacyLink","Privacy Policy"));C.href="https://seatlayer.io/privacy/",C.target="_blank",C.rel="noreferrer",A.appendChild(C);let W=i("fieldset","sl-hco-fields");W.append(Q,F,...m.element?[m.element]:[],A);let ye=V(W),E=i("p","sl-hco-alert is-error sl-hco-status sl-hco-error");E.setAttribute("role","alert"),E.hidden=!0;let be=e=>{E.textContent=e,E.hidden=!1},ke=i("p","sl-hco-alert is-warn");ke.hidden=!0;let Ae=i("div","sl-hco-total"),Me=_.tickets?.length||_.labels.length;Ae.append(i("span",void 0,`${Me} ${Me===1?"seat":"seats"}`),i("strong",void 0,me));let _e=X?a("checkout.confirmBooking","Confirm booking"):a("checkout.continue","Continue to payment"),oe=i("button","sl-hco-pay",_e);oe.type="submit";let ve=i("p","sl-hco-sr");ve.setAttribute("role","status");let Fe=e=>{oe.replaceChildren(ge(),e),ve.textContent=e},Ee=i("p","sl-hco-trust");X||Ee.appendChild(re([...ee.lock],12,"0 0 16 16")),Ee.append(X?a("checkout.freeTrust","Free booking. Nothing is charged."):a("checkout.trust","Secure payment on the organizer\u2019s payment page. We never see your card.")),h.append(ye,te(E,ke,Ae,oe,ve,Ee));let Se=null,Le=()=>{let e=_.expiresAt-Date.now(),r=ct(e);O.textContent=r,L.setAttribute("aria-label",a("checkout.heldFor","Seats held for {time}",{time:r}));let p=e<=lt;L.classList.toggle("is-warn",p),ke.hidden=!p||!E.hidden,p&&(ke.textContent=a("checkout.expiringSoon","Your seats are held for {time}. Finish soon to keep them.",{time:r}));let f=e<=3e4?30:p?120:null;f&&Se!==f&&(Se=f,U.textContent=ke.textContent),e<=0&&K(a("checkout.expiredBody","The hold on {seats} ran out before payment started.",{seats:t.map(H=>H.label).join(", ")}),"expired")},qe=()=>{Number.isFinite(_.expiresAt)&&(D(),L.hidden=!1,Le(),g=setInterval(Le,1e3))},we=!1,De=async()=>{if(!we){we=!0,E.hidden=!0,W.disabled=!0,oe.disabled=!0,Fe(X?a("checkout.confirmingBooking","Confirming your booking\u2026"):a("checkout.opening","Opening secure payment\u2026"));try{let e={holdId:_.holdId,buyerEmail:T.value.trim(),...N.value.trim()?{buyerName:N.value.trim()}:{},...m.payload(),bookingFormVersion:1},r=0,p;for(;;)try{p=await n.startSession(e);break}catch(H){if(!u)return;if(r>=ot||!Ke(H))throw H;if(r+=1,Fe(X?a("checkout.busyRetryingBooking","Busy right now. Still confirming your booking\u2026"):a("checkout.busyRetryingPayment","Busy right now. Still opening secure payment\u2026")),await new Promise(B=>setTimeout(B,st(H))),!u)return}if(!u)return;if(p.status==="confirmed"){ae(p.orderId,!0);return}let f=Ne(p.redirectUrl);if(f){Je(p.orderId,n.eventKey),D(),L.hidden=!0,Y(V(J({tone:"neutral",icon:re([...ee.card],24,"0 0 24 24"),title:a("checkout.redirectTitle","Taking you to secure payment"),text:a("checkout.redirectBody","You\u2019ll pay {amount} on the organizer\u2019s payment page, then come back here for your tickets.",{amount:me}),note:a("checkout.dontClose","Don\u2019t close this tab.")}))),window.location.assign(f);return}K(ue("gateway_unavailable"))}catch(e){n.onError?.(e);let r=e;if(r?.code==="booking_form_incomplete"&&m.element){Te(),m.showServerErrors(r.fields);return}if(Ke(r)){Te(),be(X?a("checkout.busyFailedBooking",ue("checkout_busy",{free:!0})):a("checkout.busyFailedPayment",ue("checkout_busy"))),oe.textContent=a("checkout.tryAgain","Try again");return}if(r?.code==="hold_not_active"||r?.code==="hold_not_found"){K(ue(r.code),"expired");return}if(r?.code==="seats_unavailable"){K(a("checkout.seatsUnavailable",ue(r.code)),"taken");return}K(ue(r?.code,r))}}};h.addEventListener("submit",e=>{if(e.preventDefault(),we)return;let r=x();k.setError(r?null:a("checkout.error.email","Enter an email like name@example.com."));let p=m.validate();if(!r){be(a("bookingForm.fixErrors","Some details need attention before you continue.")),T.focus();return}if(!p){be(a("bookingForm.fixErrors","Some details need attention before you continue."));return}De()});let Te=()=>{q.textContent=n.event?.name?.trim()||a("checkout.title","Checkout"),E.hidden=!0,E.textContent="",we=!1,W.disabled=!1,oe.disabled=!1,oe.textContent=_e,ve.textContent="",G(!0),Y(h),qe()};return Te(),n.root.appendChild(v),(typeof window.matchMedia!="function"||window.matchMedia("(min-width: 561px)").matches)&&T.focus(),{destroy:z}}export{ot as CHECKOUT_BUSY_MAX_RETRIES,st as checkoutBusyDelayMs,ue as errorCopy,ct as formatHoldClock,Ke as isCheckoutBusy,pt as mountCheckout,tt as unavailableCopy};
|