@seatlayer/js 0.58.0 → 0.59.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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as P,b as z,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerController as Nt,formatMoney as Ut,loadLocale as qt,setStringOverrides as Kt,t as ee}from"@seatlayer/core";var K="seatlayer.v1";function Ot(a){let e=typeof a.default=="string"?a.default:"free",t={};if(a.seats&&typeof a.seats=="object")for(let[i,s]of Object.entries(a.seats))typeof s=="string"&&s!==e&&(t[i]=s);return{default:e,exceptions:t}}function It(a,e){if(!a||a.default!==e.default)return null;let t=[];for(let[i,s]of Object.entries(e.exceptions))a.exceptions[i]!==s&&t.push({label:i,status:s});for(let i of Object.keys(a.exceptions))i in e.exceptions||t.push({label:i,status:e.default});return t}function $t(a,e){for(let t of e)t.status===a.default?delete a.exceptions[t.label]:a.exceptions[t.label]=t.status}function Xe(a){if(/(?:^|[?&#])(?:token|access_token|bearer|authorization|ticket|tkt|bse)=/i.test(a))throw new Error("seatlayer: refusing to open a socket with a credential in the URL");if(/\bbse_[A-Za-z0-9._-]+/.test(a))throw new Error("seatlayer: refusing to open a socket with a credential in the URL")}var V=class{constructor(e){this.ws=null;this.stopped=!0;this.attempt=0;this.reconnectTimer=null;this.pingTimer=null;this.pongTimer=null;this.resumeTimer=null;this.projection=null;this.version=null;this.v1=!1;this.useQueryMarker=!1;this.hidden=null;this.closedSections=null;this.opts=e,Xe(e.url)}get protocol(){return this.ws?this.v1?"v1":"legacy":null}get snapshotVersion(){return this.version}start(){this.stopped&&(this.stopped=!1,this.connect())}stop(){this.stopped=!0,this.clearTimers();let e=this.ws;if(this.ws=null,e){e.onopen=null,e.onmessage=null,e.onclose=null,e.onerror=null;try{e.close()}catch{}}}restart(){this.stop(),this.projection=null,this.version=null,this.attempt=0,this.start()}async connect(){if(this.stopped)return;let e=[K];if(this.opts.mintTicket){let n;try{n=await this.opts.mintTicket()}catch(r){this.reportIfAccessError(r),this.scheduleReconnect();return}if(this.stopped)return;n?.protocols?.length?(e=[...n.protocols],e.includes(K)||e.unshift(K)):n?.ticket&&(e=[K,`tkt.${n.ticket}`])}let t=this.version!==null;t&&e.push(`sv.${this.version}`);let i=this.useQueryMarker?`${this.opts.url}${this.opts.url.includes("?")?"&":"?"}pv=1`:this.opts.url;Xe(i);let s;try{s=(this.opts.socketFactory??((r,o)=>new WebSocket(r,o)))(i,e)}catch{this.scheduleReconnect();return}this.ws=s,s.onopen=()=>{this.ws===s&&(this.attempt=0,this.v1=s.protocol===K,this.v1||(this.useQueryMarker=!0),this.startKeepalive(s),t?this.resumeTimer=setTimeout(()=>{this.resumeTimer=null,this.opts.sink.resync()},5e3):this.opts.sink.resync())},s.onmessage=n=>{if(this.ws!==s)return;let r;try{r=JSON.parse(typeof n.data=="string"?n.data:"")}catch{return}!r||typeof r!="object"||this.handleFrame(r)},s.onclose=n=>{if(this.ws===s){if(this.ws=null,this.clearTimers(),n?.code===4401){this.stopped=!0,this.opts.onAccessUnavailable?.({reason:"revoked",code:"access_revoked",retryable:!1});return}this.scheduleReconnect()}},s.onerror=()=>{try{s.close()}catch{}}}handleFrame(e){let t=typeof e.type=="string"?e.type:"";if(e.protocol===1&&(this.v1=!0),typeof e.snapshotVersion=="number"&&(this.version=e.snapshotVersion),t==="pong"){this.clearPongTimer();return}if(Array.isArray(e.hidden)||Array.isArray(e.closed)){let i=Array.isArray(e.hidden)?e.hidden:[],s=Array.isArray(e.closed)?e.closed:[],n=i.join("\0"),r=s.join("\0");(n!==this.hidden||r!==this.closedSections)&&(this.hidden=n,this.closedSections=r,this.opts.sink.onSections?.(i,s))}if(t!=="hidden"){if(t==="presence"){this.opts.sink.onPresence?.({shoppingSessions:Number(e.shoppingSessions)||0,activeHolds:Number(e.activeHolds)||0});return}if(t!=="allocation"){if(t==="snapshot"||!t&&e.seats){this.answered();let i=Ot(e),s=It(this.projection,i);this.projection=i,s===null?this.opts.sink.applyProjection?this.opts.sink.applyProjection(i):this.opts.sink.resync():s.length&&this.opts.sink.applyStatuses(s);return}if(t==="delta"&&Array.isArray(e.changes)){this.answered();let i=e.changes.filter(s=>typeof s?.label=="string"&&typeof s?.status=="string").map(s=>({label:s.label,status:s.status}));if(!i.length)return;this.projection&&$t(this.projection,i),this.opts.sink.applyStatuses(i)}}}}answered(){this.resumeTimer&&(clearTimeout(this.resumeTimer),this.resumeTimer=null)}reportIfAccessError(e){let t=e?.reason;e?.name==="BuyerAccessUnavailableError"&&(this.stopped=!0,this.opts.onAccessUnavailable?.({reason:t??"invalid",code:e.code,status:e.status,retryable:t==="paused"}))}startKeepalive(e){this.pingTimer=setInterval(()=>{if(this.ws===e){try{e.send(JSON.stringify({type:"ping"}))}catch{return}this.clearPongTimer(),this.pongTimer=setTimeout(()=>{this.pongTimer=null;try{e.close()}catch{}},1e4)}},25e3)}scheduleReconnect(){if(this.stopped||this.reconnectTimer)return;let e=Math.min(this.attempt++,5),t=Math.min(1e3*2**e,15e3),i=Math.random()*t;this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},i)}clearPongTimer(){this.pongTimer&&(clearTimeout(this.pongTimer),this.pongTimer=null)}clearTimers(){this.pingTimer&&clearInterval(this.pingTimer),this.pingTimer=null,this.clearPongTimer(),this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.resumeTimer&&clearTimeout(this.resumeTimer),this.resumeTimer=null}};function Bt(a){return a==="blocked"?"not_for_sale":a==="held"||a==="booked"||a==="free"||a==="not_for_sale"?a:"free"}function ne(a,e={}){let t=i=>{let s=a.tableSelection(i);if(s)return s.physicalSeatIds;let n=a.idForLabel(i);return n?[n]:[]};return{applyStatuses(i){let s=a.currentHold()?.labels??[],n={free:[],held:[],booked:[],not_for_sale:[]},r=[],o=[],l=new Map(a.getSelection().map(d=>[d.label,d.id]));for(let d of i){let h=t(d.label);if(!h.length)continue;let p=Bt(d.status);if(n[p].push(...h),e.flashOnLiveChange&&p!=="free"&&!s.includes(d.label)&&h.some(c=>a.getStatus(c)==="free")){let c=p==="held"?"#f4b740":"#f43f5e";for(let f of h)r.push({id:f,color:c})}p!=="free"&&!s.includes(d.label)&&l.has(d.label)&&o.push(d.label)}for(let d of["free","held","booked","not_for_sale"])n[d].length&&a.setStatus(n[d],d);for(let d of r)a.flashSeat(d.id,d.color);if(o.length){let d=o.flatMap(p=>t(p));d.length&&a.deselect(d);let h=i.some(p=>p.status==="blocked"&&o.includes(p.label));e.onSelectedObjectUnavailable?.(o,h?"ineligible":"taken")}e.onStatusChange?.()},async resync(){await a.refresh()},onSections(i,s){a.refresh(),e.onSections?.(i,s)}}}var Y=class extends Error{constructor(e,t,i,s,n,r){super(t),this.name="ApiError",this.status=e,this.code=i,this.conflicts=s,this.reason=n,this.retryAfterS=r}},Qe=10,Ze=1;function Je(a,e){let t=(a??"").trim();if(t){let i=Number(t);if(Number.isFinite(i)&&i>=0)return Math.ceil(i);let s=Date.parse(t);if(Number.isFinite(s))return Math.max(0,Math.ceil((s-Date.now())/1e3))}if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return Math.ceil(e)}var zt={seat_conflict:"taken",conflict:"taken",channel_assignment_conflict:"ineligible",allocation_exhausted:"exhausted"},X=class{constructor(e,t={}){this.base=e;this.viewerId=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`viewer_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;this.access=t.access,this.onObjectUnavailable=t.onObjectUnavailable}get accessScoped(){return!!this.access?.configured}async request(e,t={},i={}){let s=t.method??"GET",n={},r;t.body!==void 0&&(n["Content-Type"]="application/json",r=JSON.stringify(t.body));let o=await this.access?.authorization(i.auth?"unauthorized":"initial");o&&(n.Authorization=o);let l=await fetch(`${this.base}${e}`,{method:s,headers:n,body:r,credentials:"omit"}),h=(l.headers.get("content-type")??"").includes("application/json")?await l.json().catch(()=>null):null;if(!l.ok){let p=h,c=p?.code??p?.error;if(this.access?.configured&&(l.status===401||l.status===403||l.status===422)&&await this.access.handleFailure(l.status,c)&&!i.auth)return this.request(e,t,{...i,auth:!0});if(l.status===409){let m=c?zt[c]:void 0,v=p?.conflicts?.map(w=>w.label)??t.labels??[];m&&this.onObjectUnavailable?.({labels:v,reason:m,code:c})}let f;if(l.status===429&&(f=Je(l.headers.get("Retry-After"),p?.retryAfterSeconds)??Ze,s==="GET"&&!i.rateLimit&&f<=Qe))return await new Promise(m=>setTimeout(m,f*1e3)),this.request(e,t,{...i,rateLimit:!0});throw new Y(l.status,p?.error??`request_failed_${l.status}`,c,p?.conflicts,p?.reason,f)}return h}async requestBlob(e,t={}){let i={},s=await this.access?.authorization(t.auth?"unauthorized":"initial");s&&(i.Authorization=s);let n=await fetch(`${this.base}${e}`,{method:"GET",headers:i,credentials:"omit"});if(n.ok)return n.blob();let o=(n.headers.get("content-type")??"").includes("application/json")?await n.json().catch(()=>null):null,l=o?.code??o?.error;if(this.access?.configured&&(n.status===401||n.status===403||n.status===422)&&await this.access.handleFailure(n.status,l)&&!t.auth)return this.requestBlob(e,{...t,auth:!0});let d;if(n.status===429&&(d=Je(n.headers.get("Retry-After"),o?.retryAfterSeconds)??Ze,!t.rateLimit&&d<=Qe))return await new Promise(h=>setTimeout(h,d*1e3)),this.requestBlob(e,{...t,rateLimit:!0});throw new Y(n.status,o?.error??`request_failed_${n.status}`,l,void 0,void 0,d)}chart(e){return this.request(`/pub/events/${encodeURIComponent(e)}/chart`)}asset(e,t){return/^[a-zA-Z0-9._-]+$/.test(t)?this.requestBlob(`/pub/events/${encodeURIComponent(e)}/assets/${encodeURIComponent(t)}`):Promise.reject(new Y(404,"not_found","not_found"))}objects(e){return this.request(`/pub/events/${encodeURIComponent(e)}/objects?compact=1`)}hold(e,t,i,s){return this.request(`/pub/events/${encodeURIComponent(e)}/hold`,{method:"POST",body:{selections:t,...i?{ttlMs:i}:{},...s?{replaceHoldId:s}:{}},labels:t.map(n=>n.label)})}bestAvailable(e,t,i,s,n){return this.request(`/pub/events/${encodeURIComponent(e)}/best-available`,{method:"POST",body:{qty:t,...i?{categoryKey:i}:{},...s?{zoneId:s}:{},...n?{ttlMs:n}:{}}})}resume(e,t){return this.request(`/pub/events/${encodeURIComponent(e)}/hold/resume`,{method:"POST",body:{holdId:t}})}release(e,t,i){return this.request(`/pub/events/${encodeURIComponent(e)}/release`,{method:"POST",body:{labels:t,holdId:i}})}extend(e,t,i){return this.request(`/pub/events/${encodeURIComponent(e)}/extend`,{method:"POST",body:{holdId:t,...i?{ttlMs:i}:{}}})}paymentOptions(e){return this.request(`/pub/events/${encodeURIComponent(e)}/payment-options`)}availability(e,t=!1){return this.request(`/pub/events/${encodeURIComponent(e)}/availability${t?"?live=1":""}`)}startCheckout(e,t){return this.request(`/pub/events/${encodeURIComponent(e)}/checkout`,{method:"POST",body:t})}orderStatus(e){return this.request(`/pub/orders/${encodeURIComponent(e)}/status`)}subscribeTicket(e){return this.request(`/pub/events/${encodeURIComponent(e)}/subscribe-tickets`,{method:"POST",body:{}})}subscribeUrl(e){let t=this.base.replace(/^http/,"ws"),i=new URLSearchParams({surface:"picker",viewerId:this.viewerId});return`${t}/pub/events/${encodeURIComponent(e)}/subscribe?${i}`}socketUrl(e){return this.accessScoped?"":this.subscribeUrl(e)}socketProtocols(e){return this.accessScoped?[]:[K]}createRealtime(e,t){return this.accessScoped?null:new V({url:this.subscribeUrl(e),sink:t})}};var re=class extends Error{constructor(e){super(`buyer_access_unavailable:${e.reason}`),this.name="BuyerAccessUnavailableError",this.reason=e.reason,this.code=e.code,this.status=e.status}},Dt=new Set(["buyer_access_expired"]),Ft=new Set(["paused","provider_failed","channel_denied"]);function jt(a,e){switch(e){case"buyer_access_invalid":return"invalid";case"buyer_access_revoked":return"revoked";case"buyer_access_origin_mismatch":return"origin_mismatch";case"buyer_access_event_mismatch":return"event_mismatch";case"buyer_access_mode_mismatch":return"mode_mismatch";case"channel_access_denied":return"channel_denied";case"channel_paused":return"paused";case"invalid_channel_scope":return"invalid_scope";default:break}return a===401?"invalid":null}function Vt(a,e){return a===401&&!!e&&Dt.has(e)}var _t=3e4,I,$,Z,oe,U,_,J,ae,le,ce,B,Ae,fe,Q,be=class{constructor(e){z(this,B);z(this,I,null);z(this,$,0);z(this,Z);z(this,oe);z(this,U,null);z(this,_,null);z(this,J,null);z(this,ae);z(this,le);z(this,ce,!1);if(R(this,Z,e.provider),R(this,oe,e.skewMs??_t),R(this,ae,e.onExpired),R(this,le,e.onUnavailable),e.token){let t=typeof e.token=="string"?{token:e.token}:e.token;F(this,B,Ae).call(this,t)}R(this,ce,!!P(this,Z)||!!P(this,I))}get configured(){return P(this,ce)}get unavailable(){return P(this,_)}get hasToken(){return!!P(this,I)&&(P(this,$)===0||P(this,$)>Date.now())}get expiresAt(){return P(this,$)}async authorization(e="initial"){if(!this.configured)return null;if(P(this,_))throw new re(P(this,_));let t=Date.now();if(!P(this,I)||P(this,$)>0&&P(this,$)-P(this,oe)<=t){let s=!!P(this,I)&&P(this,$)>0&&P(this,$)<=t,n=P(this,I)?s?"expired":"expiring":e,r=await F(this,B,fe).call(this,n);if(!r)throw new re(P(this,_)??P(this,J)??F(this,B,Q).call(this,"provider_failed"));return`Bearer ${r}`}return`Bearer ${P(this,I)}`}async handleFailure(e,t){var s;if(!this.configured)return!1;if(Vt(e,t)){R(this,I,null),R(this,$,0);let n=await F(this,B,fe).call(this,"unauthorized",t);return(s=P(this,ae))==null||s.call(this,{reason:"unauthorized",code:t,refreshed:!!n}),!!n}let i=jt(e,t);return i&&F(this,B,Q).call(this,i,t,e),!1}async refresh(e="manual"){return R(this,_,null),R(this,J,null),R(this,I,null),R(this,$,0),!!await F(this,B,fe).call(this,e)}clear(){R(this,I,null),R(this,$,0),R(this,U,null)}toJSON(){return{configured:this.configured,hasToken:this.hasToken}}toString(){return"[BuyerAccessContext redacted]"}};I=new WeakMap,$=new WeakMap,Z=new WeakMap,oe=new WeakMap,U=new WeakMap,_=new WeakMap,J=new WeakMap,ae=new WeakMap,le=new WeakMap,ce=new WeakMap,B=new WeakSet,Ae=function(e){return!e||typeof e.token!="string"||!e.token?null:(R(this,I,e.token),R(this,$,typeof e.expiresAt=="number"?e.expiresAt:0),P(this,I))},fe=function(e,t){if(P(this,U))return P(this,U);let i=P(this,Z);if(!i)return F(this,B,Q).call(this,"no_token",t),Promise.resolve(null);let s=(async()=>{try{let n=await i({reason:e}),r=F(this,B,Ae).call(this,n);return r||(F(this,B,Q).call(this,"provider_failed",t),null)}catch{return F(this,B,Q).call(this,"provider_failed",t),null}finally{R(this,U,null)}})();return R(this,U,s),s},Q=function(e,t,i){var n;let s={reason:e,code:t,status:i,retryable:e==="paused"||e==="channel_denied"};return R(this,J,s),Ft.has(e)||(R(this,_,s),R(this,I,null),R(this,$,0)),(n=P(this,le))==null||n.call(this,s),s};function de(a,e={}){return!a.buyerAccessTokenProvider&&!a.buyerAccessToken?null:new be({provider:a.buyerAccessTokenProvider,token:a.buyerAccessToken,...e})}var ve='<svg viewBox="0 0 64 56" width="12" height="11" fill="none" aria-hidden="true" focusable="false" style="display:block"><path d="M4 13 Q16 6 29 7 L28.5 17 Q17 16.5 7 22 Z" fill="#f4b740"/><path d="M4 13 Q16 6 29 7 L28.5 17 Q17 16.5 7 22 Z" fill="#f4b740" transform="translate(64 0) scale(-1 1)"/><path d="M8 28 Q18 22 28.6 23 L28.2 32 Q18 28.5 10 36 Z" fill="#fcf7ee"/><path d="M8 28 Q18 22 28.6 23 L28.2 32 Q18 28.5 10 36 Z" fill="#fcf7ee" transform="translate(64 0) scale(-1 1)"/><path d="M11 41 Q19 35 28.2 36 L27.8 45 Q19.5 42 13.5 49 Z" fill="#fcf7ee"/><path d="M11 41 Q19 35 28.2 36 L27.8 45 Q19.5 42 13.5 49 Z" fill="#fcf7ee" transform="translate(64 0) scale(-1 1)"/></svg>';var Wt="https://api.seatlayer.io",Gt=10;function Yt(a){if(typeof a=="string"){let e=document.querySelector(a);if(!e)throw new Error(`seatmap: container "${a}" not found`);return e}if(!(a instanceof HTMLElement))throw new Error("seatmap: container must be a CSS selector or an HTMLElement");return a}var Le=class{constructor(e){this.mount=null;this.hostEl=null;this.rendered=!1;this.mode_=null;this.tipEl=null;this.tipPos={x:0,y:0};this.onTipMove=null;this.realtime=null;if(!e||typeof e!="object")throw new Error("seatmap: options object is required");if(!e.container)throw new Error("seatmap: `container` is required");if(!e.event||typeof e.event!="string")throw new Error("seatmap: `event` key is required");this.opts=e,this.publicKey=e.publicKey,this.access=de(e,{onExpired:i=>this.opts.onAccessExpired?.(i),onUnavailable:i=>this.opts.onAccessUnavailable?.(i)});let t=new X((e.apiBase??Wt).replace(/\/+$/,""),{access:this.access??void 0,onObjectUnavailable:i=>this.opts.onSelectedObjectUnavailable?.(i)});this.api=t,this.controller=new Nt({transport:t,eventKey:e.event,maxSelection:e.maxSelection??Gt,selectedObjects:e.selectedObjects,selectableObjects:e.selectableObjects,numberOfPlacesToSelect:e.numberOfPlacesToSelect,selectionValidators:e.selectionValidators,currency:e.currency,onSelectionChange:i=>this.opts.onSelectionChange?.(i),onSelectionValidityChange:i=>this.opts.onSelectionValidityChange?.(i),onSelectionValid:i=>this.opts.onSelectionValid?.(i),onSelectionInvalid:i=>this.opts.onSelectionInvalid?.(i),onSelectionLimit:i=>this.opts.onSelectionLimit?.(i),onHold:i=>this.opts.onHold?.({holdId:i.holdId,expiresAt:i.expiresAt,seats:i.seats,items:i.items}),onHoldRestored:i=>this.opts.onHoldRestored?.({holdId:i.holdId,expiresAt:i.expiresAt,seats:i.seats,items:i.items}),onHoldExpired:()=>this.opts.onHoldExpired?.(),onGAClick:i=>{let s=this.controller.getGAAreas().find(n=>n.id===i);s&&this.opts.onGAClick?.(s)},onError:i=>this.opts.onError?.(i),onDeckTap:i=>this.opts.onDeckTap?.(i),onHint:i=>this.opts.onHint?.(i),flashOnLiveChange:!0,onSeatHover:i=>{this.opts.onSeatHover?.(i),this.opts.seatTooltip!==!1&&this.updateTooltip(i)},colorblindSafe:e.colorblindSafe})}async render(){if(this.rendered)return this;this.rendered=!0,await qt(this.opts.locale),this.opts.messages&&Kt(this.opts.messages),this.mount=Yt(this.opts.container);let e=document.createElement("div");e.style.width="100%",e.style.height="100%",e.style.position="relative",this.mount.appendChild(e),this.hostEl=e;let t=await this.controller.render(e);if(!t)return this.rendered=!1,this.opts.errorDisplay!=="none"&&this.showLoadFailure(e),this;if(this.controller.setViewMode(this.opts.initialView??"flat"),this.startRealtime(),this.mode_=t.mode==="test"?"test":"live",this.opts.seatTooltip!==!1){let i=document.createElement("div");i.setAttribute("role","tooltip"),i.style.cssText='position:absolute;z-index:7;pointer-events:none;display:none;max-width:240px;background:#10162a;color:#fff;border-radius:10px;padding:9px 12px;font:500 12px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;box-shadow:0 10px 30px -10px rgba(0,0,0,.5);',e.appendChild(i),this.tipEl=i,this.onTipMove=s=>{let n=e.getBoundingClientRect();this.tipPos={x:s.clientX-n.left,y:s.clientY-n.top},this.tipEl&&this.tipEl.style.display!=="none"&&this.placeTooltip()},e.addEventListener("mousemove",this.onTipMove)}if(t.mode==="test"){e.style.overflow="hidden";let i=document.createElement("div");i.textContent=ee("picker.testMode"),i.setAttribute("aria-label",ee("picker.testMode")),i.style.cssText="position:absolute;top:18px;right:-34px;z-index:6;transform:rotate(45deg);width:140px;text-align:center;padding:4px 0;background:#f4b740;color:#1a1200;font:800 10.5px/1.4 -apple-system,BlinkMacSystemFont,sans-serif;letter-spacing:.12em;box-shadow:0 2px 8px rgba(0,0,0,.25);pointer-events:none;",e.appendChild(i)}return this.buildBadge(e),this}buildBadge(e){if(this.controller.doc?.theme?.hideBadge)return;let t=document.createElement("a");t.href="https://seatlayer.io",t.target="_blank",t.rel="noopener noreferrer",t.setAttribute("aria-label",ee("picker.poweredBy")),t.style.cssText='position:absolute;bottom:10px;right:12px;z-index:5;display:inline-flex;align-items:center;gap:6px;padding:5px 9px;border-radius:999px;background:rgba(255,255,255,.92);color:#4a5163;text-decoration:none;font:600 11px/1 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;letter-spacing:.02em;box-shadow:0 2px 8px rgba(0,0,0,.12);',t.innerHTML='<span aria-hidden="true" style="width:16px;height:16px;border-radius:4px;flex:none;display:flex;align-items:center;justify-content:center;background:#0c1220;color:#fcf7ee">'+ve+`</span><span>${ee("picker.poweredBy")}</span>`,e.appendChild(t)}placeTooltip(){if(!this.tipEl||!this.hostEl)return;let e=this.hostEl.clientWidth,t=this.tipEl.offsetWidth,i=this.tipEl.offsetHeight,s=this.tipPos.x+14,n=this.tipPos.y-i-12;s+t>e-8&&(s=this.tipPos.x-t-14),n<8&&(n=this.tipPos.y+18),this.tipEl.style.left=`${Math.max(8,s)}px`,this.tipEl.style.top=`${Math.max(8,n)}px`}updateTooltip(e){if(!this.tipEl)return;if(!e){this.tipEl.style.display="none";return}let t=Ut(e.price,e.currency,{locale:this.opts.locale,fallback:(s,n)=>`${s} ${n}`}),i=e.status==="free"?"":`<div style="margin-top:5px;font-size:10.5px;letter-spacing:.08em;text-transform:uppercase;color:#fca5a5;font-weight:700">${e.status==="held"?ee("map.statusHeld"):ee("map.statusTaken")}</div>`;this.tipEl.innerHTML=`<div style="font-weight:700;font-size:13px">${e.label}</div><div style="display:flex;align-items:center;gap:6px;margin-top:4px;color:#c7cddc"><span style="width:9px;height:9px;border-radius:50%;flex:none;background:${e.categoryColor}"></span><span>${e.categoryLabel}</span><span style="margin-left:auto;font-weight:700;color:#fff">${t}</span></div>`+i,this.tipEl.style.display="block",this.placeTooltip()}getMode(){return this.mode_}getSelection(){return this.controller.getSelection()}selectObjects(e){return this.controller.select(e)}deselectObjects(e){this.controller.deselect(e)}clearSelection(){this.controller.clearSelection()}selectCategories(e){return this.controller.selectCategories(e)}deselectCategories(e){this.controller.deselectCategories(e)}setSelectableObjects(e){this.controller.setSelectableObjects(e)}setMaxSelection(e){this.controller.setMaxSelection(e)}getSelectionValidity(){return this.controller.getSelectionValidity()}async hold(e={}){try{return await this.holdOrThrow(e)}catch(t){return this.opts.onError?.(t),null}}async holdOrThrow(e={}){let t=this.controller.getSelectionValidity();if(t&&!t.isValid){let s=t.violations.includes("numberOfPlacesToSelect");throw Object.assign(new Error(s?`seatmap: select exactly ${t.required} places before holding`:"seatmap: adjust the ticket selection before holding"),{code:s?"selection_count_mismatch":"selection_invalid",selection:t})}let i=await this.controller.hold(void 0,e.ttlMs);return i?{holdId:i.holdId,expiresAt:i.expiresAt,seats:i.seats,items:i.items}:null}async resumeHold(e){try{return await this.resumeHoldOrThrow(e)}catch(t){return this.opts.onError?.(t),null}}async resumeHoldOrThrow(e){let t=await this.controller.resumeHold(e);return t?{holdId:t.holdId,expiresAt:t.expiresAt,seats:t.seats,items:t.items}:null}async extendHold(e){try{let t=await this.controller.extendHold(e);return t?{holdId:t.holdId,expiresAt:t.expiresAt,seats:t.seats,items:t.items}:null}catch(t){return this.opts.onError?.(t),null}}getCurrentHold(){let e=this.controller.currentHold();return e?{holdId:e.holdId,expiresAt:e.expiresAt,seats:e.seats,items:e.items}:null}getGAAreas(){return this.controller.getGAAreas()}async holdGA(e,t,i={}){try{return await this.holdGAOrThrow(e,t,i)}catch(s){return this.opts.onError?.(s),null}}async holdGAOrThrow(e,t,i={}){let s=await this.controller.holdGA(e,t,i);return s?{holdId:s.holdId,expiresAt:s.expiresAt,seats:s.seats,items:s.items}:null}async bestAvailable(e,t,i={}){try{return await this.bestAvailableOrThrow(e,t,i)}catch(s){return this.opts.onError?.(s),null}}async bestAvailableOrThrow(e,t,i={}){let s=await this.controller.bestAvailable(e,t,i);return s?{holdId:s.holdId,expiresAt:s.expiresAt,labels:s.labels,seats:s.seats,items:s.items,...i.zoneId?{zoneId:i.zoneId}:{}}:null}setSeatTier(e,t){this.controller.setSeatTier(e,t)}getFloors(){return this.controller.getFloors()}setFloor(e){if(this.controller.getFloors().length<=1){console.warn("seatmap: setFloor() ignored \u2014 this chart has a single floor");return}this.controller.setFloor(e)}setColorblindSafe(e){this.controller.setColorblindSafe(e)}setViewMode(e){this.controller.setViewMode(e)}getViewMode(){return this.controller.getViewMode()}zoomIn(){this.controller.zoomIn()}zoomOut(){this.controller.zoomOut()}zoomToFit(){this.controller.zoomToFit()}async release(){await this.controller.release()}async releaseLabels(e){return this.controller.releaseLabels(e)}startRealtime(){!this.access?.configured||this.realtime||(this.realtime=new V({url:this.api.subscribeUrl(this.opts.event),mintTicket:()=>this.api.subscribeTicket(this.opts.event),onAccessUnavailable:e=>this.opts.onAccessUnavailable?.(e),sink:ne(this.controller,{flashOnLiveChange:!0,onSelectedObjectUnavailable:(e,t)=>this.opts.onSelectedObjectUnavailable?.({labels:e,reason:t})})}),this.realtime.start())}async refreshAccess(){if(!this.access?.configured)return!1;let e=await this.access.refresh("manual");return e&&(await this.controller.refresh(),this.realtime?.restart(),this.realtime||this.startRealtime()),e}showLoadFailure(e){let t=document.createElement("div");t.setAttribute("role","status"),t.style.cssText='display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;width:100%;height:100%;min-height:180px;box-sizing:border-box;padding:24px;text-align:center;font:500 14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#3b4256;';let i=document.createElement("div");i.textContent="The seat map didn\u2019t load.",t.appendChild(i);let s=document.createElement("button");s.type="button",s.textContent="Try again",s.style.cssText="appearance:none;border:1px solid #c9cede;background:#fff;color:#10162a;border-radius:8px;padding:8px 16px;font:600 13px/1 inherit;cursor:pointer;",s.addEventListener("click",()=>{this.destroy(),this.render().catch(n=>this.opts.onError?.(n))}),t.appendChild(s),e.appendChild(t)}destroy(){this.realtime?.stop(),this.realtime=null,this.access?.clear(),this.hostEl&&this.onTipMove&&this.hostEl.removeEventListener("mousemove",this.onTipMove),this.tipEl=null,this.onTipMove=null,this.controller.destroy(),this.hostEl&&this.hostEl.parentNode&&this.hostEl.parentNode.removeChild(this.hostEl),this.hostEl=null,this.mount=null,this.rendered=!1,this.mode_=null}};var et=["hold","resumeHold","getCurrentHold","getGAAreas","holdGA","bestAvailable","release","releaseLabels","getSelection","selectObjects","deselectObjects","clearSelection","selectCategories","deselectCategories","setSelectableObjects","setMaxSelection","getSelectionValidity","setSeatTier","getFloors","setFloor","setColorblindSafe","zoomIn","zoomOut","zoomToFit","refreshAccess"],Xt={hold:()=>Promise.resolve(null),resumeHold:()=>Promise.resolve(null),getCurrentHold:()=>null,getGAAreas:()=>[],holdGA:()=>Promise.resolve(null),bestAvailable:()=>Promise.resolve(null),release:()=>Promise.resolve(),releaseLabels:()=>Promise.resolve(!1),getSelection:()=>[],selectObjects:()=>[],deselectObjects:()=>{},clearSelection:()=>{},selectCategories:()=>[],deselectCategories:()=>{},setSelectableObjects:()=>{},setMaxSelection:()=>{},getSelectionValidity:()=>null,setSeatTier:()=>{},getFloors:()=>[],setFloor:()=>{},setColorblindSafe:()=>{},zoomIn:()=>{},zoomOut:()=>{},zoomToFit:()=>{},refreshAccess:()=>Promise.resolve(!1)};function Qt(a){let e={};for(let t of et)e[t]=(...i)=>{let s=a();return s?s[t](...i):Xt[t]()};return e}var tt=["event","apiBase","maxSelection","numberOfPlacesToSelect","selectionValidators","publicKey","locale","currency","colorblindSafe","initialView","errorDisplay"],it=[...tt,"selectedObjects","selectableObjects","messages","seatTooltip","buyerAccessTokenProvider","buyerAccessToken"],st=["onSelectionChange","onSelectionValidityChange","onSelectionValid","onSelectionInvalid","onSelectionLimit","onHold","onHoldRestored","onHoldExpired","onGAClick","onError","onDeckTap","onHint","onSeatHover","onAccessExpired","onAccessUnavailable","onSelectedObjectUnavailable"];function Zt(a,e,t){let i={container:a};for(let s of it)i[s]=e[s];for(let s of st)i[s]=t[s];return i}var Jt=new Set(["seatlayer.designer.ready","seatlayer.designer.saved","seatlayer.designer.published","seatlayer.designer.close","seatlayer.designer.error"]),ei=2e4,ti=480,ii=180*1e3,si=900*1e3,ni=.8,ri=30*1e3,oi=1e5,ai=4,li=50;function Pe(a){if(typeof a!="string")return a;let e=document.querySelector(a);if(!e)throw new Error(`EmbeddedDesigner container not found: ${a}`);return e}function ci(a){let e=(a??"").toLowerCase();return e.includes("expire")||e.includes("revoke")||e==="401"?"expired":e.includes("mismatch")?"mismatch":e.includes("timeout")?"timeout":"load"}var di={expired:{title:"This design session expired",body:"For your security, editing sessions are short-lived. Start a fresh one to keep designing."},mismatch:{title:"This editor doesn't match this chart",body:"The session that loaded belongs to a different chart or workspace. Reopen the designer to continue."},timeout:{title:"The designer is taking too long",body:"It did not finish loading in time. This is usually a slow connection \u2014 try again."},load:{title:"We couldn't load the designer",body:"Something went wrong while opening the editor. Please try again."}},Me=class{constructor(e){this.frame=null;this.designerOrigin="";this.overlay=null;this.timeoutTimer=null;this.renewTimer=null;this.autoRecoverUsed=!1;this.phase="loading";this.identityEstablished=!1;this.restoreContainerPosition=null;this.pinned=!1;this.frameStyleBeforeFs=null;this.docOverflowBeforeFs=null;this.bodyOverflowBeforeFs=null;this.fsKeyHandler=null;this.lastAutoHeight="";this.fillRaf=null;this.reprobeRaf=null;this.fillListening=!1;this.containerEl=null;this.fillMode=null;this.resizeObs=null;this.scheduleFill=()=>{this.fillRaf===null&&(this.fillRaf=requestAnimationFrame(()=>{this.fillRaf=null,this.applyFill()}))};this.scheduleReprobe=()=>{this.reprobeRaf===null&&(this.reprobeRaf=requestAnimationFrame(()=>{this.reprobeRaf=null,!this.pinned&&(this.fillMode=this.detectFillMode(),this.syncContainerObserver(),this.applyFill())}))};this.handleMessage=e=>{if(!this.frame||e.origin!==this.designerOrigin||e.source!==this.frame.contentWindow||!e.data||typeof e.data!="object")return;let t=e.data;if(t.type==="seatlayer.designer.resize"){!this.fillEnabled()&&this.autoResizeEnabled()&&typeof t.px=="number"&&Number.isFinite(t.px)&&t.px>0&&(this.lastAutoHeight=`${Math.round(t.px)}px`,this.pinned||this.setFrameHeight(this.lastAutoHeight));return}if(t.type==="seatlayer.designer.fullscreen"){t.on===!0?this.pinFullscreen():t.on===!1&&this.unpinFullscreen();return}if(typeof t.type!="string"||!Jt.has(t.type))return;let i={type:t.type,chartId:typeof t.chartId=="string"?t.chartId:void 0,workspaceId:typeof t.workspaceId=="string"?t.workspaceId:void 0,expiresAt:typeof t.expiresAt=="number"?t.expiresAt:void 0,code:typeof t.code=="string"?t.code:void 0,message:typeof t.message=="string"?t.message:void 0,meta:t.meta,fatal:typeof t.fatal=="boolean"?t.fatal:void 0,action:typeof t.action=="string"?t.action:void 0},s=this.identityEstablished||i.type==="seatlayer.designer.ready"||i.type==="seatlayer.designer.saved"||i.type==="seatlayer.designer.published"||i.type==="seatlayer.designer.close",n=this.options.expectedChartId!==void 0&&i.chartId!==this.options.expectedChartId&&(s||i.chartId!==void 0),r=this.options.expectedWorkspaceId!==void 0&&i.workspaceId!==this.options.expectedWorkspaceId&&(s||i.workspaceId!==void 0);if(n||r){this.showError("mismatch");return}switch(i.type){case"seatlayer.designer.ready":this.identityEstablished=!0,this.sessionExpiresAt=i.expiresAt,this.phase="ready",this.clearTimeoutTimer(),this.removeOverlay(),this.autoRecoverUsed=!1,this.scheduleRenewal(i.expiresAt),this.options.onReady?.(i);break;case"seatlayer.designer.saved":this.options.onSaved?.(i);break;case"seatlayer.designer.published":this.options.onPublished?.(i);break;case"seatlayer.designer.close":this.options.onClose?.(i);break;case"seatlayer.designer.error":{let o=ci(i.code);if(o==="expired"&&this.autoRenewEnabled()&&!this.autoRecoverUsed){this.autoRecoverUsed=!0,this.clearRenewTimer(),this.options.onRequestRelaunch();return}(typeof i.fatal=="boolean"?i.fatal:o!=="load"||this.phase!=="ready")&&this.showError(o),this.options.onError?.(i);break}}};this.options=e}mount(){this.destroy();let e=new URL(this.options.designerUrl,window.location.href);if(e.protocol!=="https:"&&e.hostname!=="localhost"&&e.hostname!=="127.0.0.1")throw new Error("EmbeddedDesigner requires an HTTPS designerUrl outside local development.");this.designerOrigin=e.origin;let t=document.createElement("iframe");t.title=this.options.title??"Venue chart Designer",t.allow=this.options.allow??"fullscreen; clipboard-write",t.referrerPolicy=this.options.referrerPolicy??"origin",t.src=e.toString(),t.style.setProperty("width","100%","important"),t.style.setProperty("height",typeof this.options.height=="number"?`${this.options.height}px`:"100%","important"),t.style.border="0",Object.assign(t.style,this.options.style),this.options.className&&(t.className=this.options.className);let i=Pe(this.options.container);if(this.containerEl=i,window.addEventListener("message",this.handleMessage),i.append(t),this.frame=t,this.fillEnabled()&&this.startFill(),this.phase="loading",this.loadingStateEnabled()){this.ensureContainerPositioned(i),this.renderOverlay(i,"loading");let s=this.options.loadingTimeoutMs??ei;s>0&&Number.isFinite(s)&&(this.timeoutTimer=setTimeout(()=>{this.phase==="loading"&&this.showError("timeout")},s))}return t}setDesignerUrl(e){return this.options={...this.options,designerUrl:e},this.mount()}getIframe(){return this.frame}setSizing(e,t){this.options={...this.options,height:e,minHeight:t},this.frame&&(this.stopFill(),this.lastAutoHeight="",this.fillEnabled()?(this.pinned||this.setFrameHeight("100%"),this.startFill()):this.pinned||this.setFrameHeight(`${e}px`))}setRelaunchPolicy(e,t){this.options={...this.options,onRequestRelaunch:e,autoRenewSession:t},this.clearRenewTimer(),this.phase==="ready"&&this.scheduleRenewal(this.sessionExpiresAt)}destroy(){window.removeEventListener("message",this.handleMessage),this.stopFill(),this.unpinFullscreen(),this.clearTimeoutTimer(),this.clearRenewTimer(),this.removeOverlay(),this.restoreContainerStyle(),this.frame?.remove(),this.frame=null,this.containerEl=null,this.fillMode=null,this.designerOrigin="",this.phase="loading",this.identityEstablished=!1,this.sessionExpiresAt=void 0,this.lastAutoHeight=""}loadingStateEnabled(){return this.options.showLoadingState!==!1}autoResizeEnabled(){return this.options.autoResize!==!1}fillEnabled(){return typeof this.options.height!="number"}setFrameHeight(e){this.frame?.style.setProperty("height",e,"important")}detectFillMode(){let e=this.containerEl,t=this.frame;if(this.pinned||!e||!t)return this.fillMode??"viewport";let i=()=>e.getBoundingClientRect().height,s=t.style.getPropertyValue("height"),n=t.style.getPropertyPriority("height");t.style.setProperty("height","0px","important");let r=i();t.style.setProperty("height",`${oi}px`,"important");let o=i();return s?t.style.setProperty("height",s,n):t.style.removeProperty("height"),!(o-r>ai)&&r>=li?"container":"viewport"}applyFill(){if(!this.frame||this.pinned)return;let e=this.options.minHeight??ti;if(this.fillMode==="container"&&this.containerEl){let s=Math.max(e,Math.round(this.containerEl.getBoundingClientRect().height));this.setFrameHeight(`${s}px`);return}let t=this.frame.getBoundingClientRect().top,i=Math.max(e,Math.round(window.innerHeight-t));this.setFrameHeight(`${i}px`)}syncContainerObserver(){let e=this.fillMode==="container"&&!!this.containerEl&&typeof ResizeObserver<"u";e&&!this.resizeObs?(this.resizeObs=new ResizeObserver(()=>this.scheduleFill()),this.resizeObs.observe(this.containerEl)):!e&&this.resizeObs&&(this.resizeObs.disconnect(),this.resizeObs=null)}startFill(){this.fillMode=this.detectFillMode(),this.syncContainerObserver(),this.applyFill(),!this.fillListening&&(this.fillListening=!0,window.addEventListener("resize",this.scheduleReprobe),window.addEventListener("orientationchange",this.scheduleReprobe),window.addEventListener("scroll",this.scheduleFill,{passive:!0}))}stopFill(){this.fillRaf!==null&&(cancelAnimationFrame(this.fillRaf),this.fillRaf=null),this.reprobeRaf!==null&&(cancelAnimationFrame(this.reprobeRaf),this.reprobeRaf=null),this.resizeObs&&(this.resizeObs.disconnect(),this.resizeObs=null),this.fillListening&&(this.fillListening=!1,window.removeEventListener("resize",this.scheduleReprobe),window.removeEventListener("orientationchange",this.scheduleReprobe),window.removeEventListener("scroll",this.scheduleFill))}pinFullscreen(){if(this.pinned||!this.frame)return;this.pinned=!0,this.frameStyleBeforeFs=this.frame.getAttribute("style");let e={position:"fixed",top:"0",right:"0",bottom:"0",left:"0",width:"100vw",height:"100vh",margin:"0",border:"0","z-index":"2147483000",background:"#101625"};for(let[i,s]of Object.entries(e))this.frame.style.setProperty(i,s,"important");let t=document.documentElement;this.docOverflowBeforeFs=t.style.overflow,t.style.overflow="hidden",document.body&&(this.bodyOverflowBeforeFs=document.body.style.overflow,document.body.style.overflow="hidden"),this.fsKeyHandler=i=>{i.key==="Escape"&&this.unpinFullscreen()},window.addEventListener("keydown",this.fsKeyHandler)}unpinFullscreen(){this.pinned&&(this.pinned=!1,this.frame&&(this.frameStyleBeforeFs===null?this.frame.removeAttribute("style"):this.frame.setAttribute("style",this.frameStyleBeforeFs),this.fillEnabled()?this.applyFill():this.autoResizeEnabled()&&this.lastAutoHeight?this.setFrameHeight(this.lastAutoHeight):typeof this.options.height=="number"&&this.setFrameHeight(`${this.options.height}px`)),this.frameStyleBeforeFs=null,this.docOverflowBeforeFs!==null&&(document.documentElement.style.overflow=this.docOverflowBeforeFs,this.docOverflowBeforeFs=null),this.bodyOverflowBeforeFs!==null&&document.body&&(document.body.style.overflow=this.bodyOverflowBeforeFs,this.bodyOverflowBeforeFs=null),this.fsKeyHandler&&(window.removeEventListener("keydown",this.fsKeyHandler),this.fsKeyHandler=null))}clearTimeoutTimer(){this.timeoutTimer!==null&&(clearTimeout(this.timeoutTimer),this.timeoutTimer=null)}autoRenewEnabled(){return!!this.options.onRequestRelaunch&&this.options.autoRenewSession!==!1}clearRenewTimer(){this.renewTimer!==null&&(clearTimeout(this.renewTimer),this.renewTimer=null)}scheduleRenewal(e){if(this.clearRenewTimer(),!this.autoRenewEnabled()||typeof e!="number"||!Number.isFinite(e))return;let t=e-Date.now();if(t<=0)return;let i=t<si?t*ni:t-ii,s=Math.max(ri,i);this.renewTimer=setTimeout(()=>{this.renewTimer=null,this.autoRenewEnabled()&&this.options.onRequestRelaunch()},s)}ensureContainerPositioned(e){getComputedStyle(e).position==="static"&&(this.restoreContainerPosition=e.style.position,e.style.position="relative")}restoreContainerStyle(){if(this.restoreContainerPosition!==null){try{Pe(this.options.container).style.position=this.restoreContainerPosition}catch{}this.restoreContainerPosition=null}}removeOverlay(){this.overlay?.remove(),this.overlay=null}showError(e){if(this.phase="error",this.clearTimeoutTimer(),!this.loadingStateEnabled())return;let t;try{t=Pe(this.options.container)}catch{return}this.renderOverlay(t,"error",e)}handleTryAgain(){if(this.options.onRequestRelaunch){this.options.onRequestRelaunch();return}this.mount()}renderOverlay(e,t,i){this.removeOverlay();let s=document.createElement("div");s.setAttribute("data-seatlayer-designer-overlay",t),s.setAttribute("role",t==="error"?"alert":"status"),s.setAttribute("aria-live","polite"),Object.assign(s.style,{position:"absolute",inset:"0",display:"flex",alignItems:"center",justifyContent:"center",background:"#101625",color:"#e6ebf5",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',zIndex:"2",overflow:"hidden"}),t==="loading"?this.buildSkeleton(s):this.buildErrorCard(s,i??"load"),e.append(s),this.overlay=s}buildSkeleton(e){let t=document.createElement("style");t.textContent=`
1
+ import{a as P,b as B,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerController as Wt,formatMoney as Gt,loadLocale as Yt,setStringOverrides as Xt,t as ee}from"@seatlayer/core";var K="seatlayer.v1";function zt(o){let e=typeof o.default=="string"?o.default:"free",t={};if(o.seats&&typeof o.seats=="object")for(let[i,s]of Object.entries(o.seats))typeof s=="string"&&s!==e&&(t[i]=s);return{default:e,exceptions:t}}function Dt(o,e){if(!o||o.default!==e.default)return null;let t=[];for(let[i,s]of Object.entries(e.exceptions))o.exceptions[i]!==s&&t.push({label:i,status:s});for(let i of Object.keys(o.exceptions))i in e.exceptions||t.push({label:i,status:e.default});return t}function Ft(o,e){for(let t of e)t.status===o.default?delete o.exceptions[t.label]:o.exceptions[t.label]=t.status}function Xe(o){if(/(?:^|[?&#])(?:token|access_token|bearer|authorization|ticket|tkt|bse)=/i.test(o))throw new Error("seatlayer: refusing to open a socket with a credential in the URL");if(/\bbse_[A-Za-z0-9._-]+/.test(o))throw new Error("seatlayer: refusing to open a socket with a credential in the URL")}var V=class{constructor(e){this.ws=null;this.stopped=!0;this.attempt=0;this.reconnectTimer=null;this.pingTimer=null;this.pongTimer=null;this.resumeTimer=null;this.projection=null;this.version=null;this.v1=!1;this.useQueryMarker=!1;this.hidden=null;this.closedSections=null;this.opts=e,Xe(e.url)}get protocol(){return this.ws?this.v1?"v1":"legacy":null}get snapshotVersion(){return this.version}start(){this.stopped&&(this.stopped=!1,this.connect())}stop(){this.stopped=!0,this.clearTimers();let e=this.ws;if(this.ws=null,e){e.onopen=null,e.onmessage=null,e.onclose=null,e.onerror=null;try{e.close()}catch{}}}restart(){this.stop(),this.projection=null,this.version=null,this.attempt=0,this.start()}async connect(){if(this.stopped)return;let e=[K];if(this.opts.mintTicket){let r;try{r=await this.opts.mintTicket()}catch(n){this.reportIfAccessError(n),this.scheduleReconnect();return}if(this.stopped)return;r?.protocols?.length?(e=[...r.protocols],e.includes(K)||e.unshift(K)):r?.ticket&&(e=[K,`tkt.${r.ticket}`])}let t=this.version!==null;t&&e.push(`sv.${this.version}`);let i=this.useQueryMarker?`${this.opts.url}${this.opts.url.includes("?")?"&":"?"}pv=1`:this.opts.url;Xe(i);let s;try{s=(this.opts.socketFactory??((n,a)=>new WebSocket(n,a)))(i,e)}catch{this.scheduleReconnect();return}this.ws=s,s.onopen=()=>{this.ws===s&&(this.attempt=0,this.v1=s.protocol===K,this.v1||(this.useQueryMarker=!0),this.startKeepalive(s),t?this.resumeTimer=setTimeout(()=>{this.resumeTimer=null,this.opts.sink.resync()},5e3):this.opts.sink.resync())},s.onmessage=r=>{if(this.ws!==s)return;let n;try{n=JSON.parse(typeof r.data=="string"?r.data:"")}catch{return}!n||typeof n!="object"||this.handleFrame(n)},s.onclose=r=>{if(this.ws===s){if(this.ws=null,this.clearTimers(),r?.code===4401){this.stopped=!0,this.opts.onAccessUnavailable?.({reason:"revoked",code:"access_revoked",retryable:!1});return}this.scheduleReconnect()}},s.onerror=()=>{try{s.close()}catch{}}}handleFrame(e){let t=typeof e.type=="string"?e.type:"";if(e.protocol===1&&(this.v1=!0),typeof e.snapshotVersion=="number"&&(this.version=e.snapshotVersion),t==="pong"){this.clearPongTimer();return}if(Array.isArray(e.hidden)||Array.isArray(e.closed)){let i=Array.isArray(e.hidden)?e.hidden:[],s=Array.isArray(e.closed)?e.closed:[],r=i.join("\0"),n=s.join("\0");(r!==this.hidden||n!==this.closedSections)&&(this.hidden=r,this.closedSections=n,this.opts.sink.onSections?.(i,s))}if(t!=="hidden"){if(t==="presence"){this.opts.sink.onPresence?.({shoppingSessions:Number(e.shoppingSessions)||0,activeHolds:Number(e.activeHolds)||0});return}if(t!=="allocation"){if(t==="snapshot"||!t&&e.seats){this.answered();let i=zt(e),s=Dt(this.projection,i);this.projection=i,s===null?this.opts.sink.applyProjection?this.opts.sink.applyProjection(i):this.opts.sink.resync():s.length&&this.opts.sink.applyStatuses(s);return}if(t==="delta"&&Array.isArray(e.changes)){this.answered();let i=e.changes.filter(s=>typeof s?.label=="string"&&typeof s?.status=="string").map(s=>({label:s.label,status:s.status}));if(!i.length)return;this.projection&&Ft(this.projection,i),this.opts.sink.applyStatuses(i)}}}}answered(){this.resumeTimer&&(clearTimeout(this.resumeTimer),this.resumeTimer=null)}reportIfAccessError(e){let t=e?.reason;e?.name==="BuyerAccessUnavailableError"&&(this.stopped=!0,this.opts.onAccessUnavailable?.({reason:t??"invalid",code:e.code,status:e.status,retryable:t==="paused"}))}startKeepalive(e){this.pingTimer=setInterval(()=>{if(this.ws===e){try{e.send(JSON.stringify({type:"ping"}))}catch{return}this.clearPongTimer(),this.pongTimer=setTimeout(()=>{this.pongTimer=null;try{e.close()}catch{}},1e4)}},25e3)}scheduleReconnect(){if(this.stopped||this.reconnectTimer)return;let e=Math.min(this.attempt++,5),t=Math.min(1e3*2**e,15e3),i=Math.random()*t;this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},i)}clearPongTimer(){this.pongTimer&&(clearTimeout(this.pongTimer),this.pongTimer=null)}clearTimers(){this.pingTimer&&clearInterval(this.pingTimer),this.pingTimer=null,this.clearPongTimer(),this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.resumeTimer&&clearTimeout(this.resumeTimer),this.resumeTimer=null}};function jt(o){return o==="blocked"?"not_for_sale":o==="held"||o==="booked"||o==="free"||o==="not_for_sale"?o:"free"}function re(o,e={}){let t=i=>{let s=o.tableSelection(i);if(s)return s.physicalSeatIds;let r=o.idForLabel(i);return r?[r]:[]};return{applyStatuses(i){let s=o.currentHold()?.labels??[],r={free:[],held:[],booked:[],not_for_sale:[]},n=[],a=[],l=new Map(o.getSelection().map(c=>[c.label,c.id]));for(let c of i){let u=t(c.label);if(!u.length)continue;let p=jt(c.status);if(r[p].push(...u),e.flashOnLiveChange&&p!=="free"&&!s.includes(c.label)&&u.some(d=>o.getStatus(d)==="free")){let d=p==="held"?"#f4b740":"#f43f5e";for(let f of u)n.push({id:f,color:d})}p!=="free"&&!s.includes(c.label)&&l.has(c.label)&&a.push(c.label)}for(let c of["free","held","booked","not_for_sale"])r[c].length&&o.setStatus(r[c],c);for(let c of n)o.flashSeat(c.id,c.color);if(a.length){let c=a.flatMap(p=>t(p));c.length&&o.deselect(c);let u=i.some(p=>p.status==="blocked"&&a.includes(p.label));e.onSelectedObjectUnavailable?.(a,u?"ineligible":"taken")}e.onStatusChange?.()},async resync(){await o.refresh()},onSections(i,s){o.refresh(),e.onSections?.(i,s)}}}var Y=class extends Error{constructor(e,t,i,s,r,n){super(t),this.name="ApiError",this.status=e,this.code=i,this.conflicts=s,this.reason=r,this.retryAfterS=n}},Qe=10,Ze=1;function Je(o,e){let t=(o??"").trim();if(t){let i=Number(t);if(Number.isFinite(i)&&i>=0)return Math.ceil(i);let s=Date.parse(t);if(Number.isFinite(s))return Math.max(0,Math.ceil((s-Date.now())/1e3))}if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return Math.ceil(e)}var Vt={seat_conflict:"taken",conflict:"taken",channel_assignment_conflict:"ineligible",allocation_exhausted:"exhausted"},X=class{constructor(e,t={}){this.base=e;this.viewerId=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`viewer_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;this.access=t.access,this.onObjectUnavailable=t.onObjectUnavailable}get accessScoped(){return!!this.access?.configured}async request(e,t={},i={}){let s=t.method??"GET",r={},n;t.body!==void 0&&(r["Content-Type"]="application/json",n=JSON.stringify(t.body));let a=await this.access?.authorization(i.auth?"unauthorized":"initial");a&&(r.Authorization=a);let l=await fetch(`${this.base}${e}`,{method:s,headers:r,body:n,credentials:"omit"}),u=(l.headers.get("content-type")??"").includes("application/json")?await l.json().catch(()=>null):null;if(!l.ok){let p=u,d=p?.code??p?.error;if(this.access?.configured&&(l.status===401||l.status===403||l.status===422)&&await this.access.handleFailure(l.status,d)&&!i.auth)return this.request(e,t,{...i,auth:!0});if(l.status===409){let m=d?Vt[d]:void 0,g=p?.conflicts?.map(w=>w.label)??t.labels??[];m&&this.onObjectUnavailable?.({labels:g,reason:m,code:d})}let f;if(l.status===429&&(f=Je(l.headers.get("Retry-After"),p?.retryAfterSeconds)??Ze,s==="GET"&&!i.rateLimit&&f<=Qe))return await new Promise(m=>setTimeout(m,f*1e3)),this.request(e,t,{...i,rateLimit:!0});throw new Y(l.status,p?.error??`request_failed_${l.status}`,d,p?.conflicts,p?.reason,f)}return u}async requestBlob(e,t={}){let i={},s=await this.access?.authorization(t.auth?"unauthorized":"initial");s&&(i.Authorization=s);let r=await fetch(`${this.base}${e}`,{method:"GET",headers:i,credentials:"omit"});if(r.ok)return r.blob();let a=(r.headers.get("content-type")??"").includes("application/json")?await r.json().catch(()=>null):null,l=a?.code??a?.error;if(this.access?.configured&&(r.status===401||r.status===403||r.status===422)&&await this.access.handleFailure(r.status,l)&&!t.auth)return this.requestBlob(e,{...t,auth:!0});let c;if(r.status===429&&(c=Je(r.headers.get("Retry-After"),a?.retryAfterSeconds)??Ze,!t.rateLimit&&c<=Qe))return await new Promise(u=>setTimeout(u,c*1e3)),this.requestBlob(e,{...t,rateLimit:!0});throw new Y(r.status,a?.error??`request_failed_${r.status}`,l,void 0,void 0,c)}chart(e){return this.request(`/pub/events/${encodeURIComponent(e)}/chart`)}asset(e,t){return/^[a-zA-Z0-9._-]+$/.test(t)?this.requestBlob(`/pub/events/${encodeURIComponent(e)}/assets/${encodeURIComponent(t)}`):Promise.reject(new Y(404,"not_found","not_found"))}objects(e){return this.request(`/pub/events/${encodeURIComponent(e)}/objects?compact=1`)}hold(e,t,i,s){return this.request(`/pub/events/${encodeURIComponent(e)}/hold`,{method:"POST",body:{selections:t,...i?{ttlMs:i}:{},...s?{replaceHoldId:s}:{}},labels:t.map(r=>r.label)})}bestAvailable(e,t,i,s,r){return this.request(`/pub/events/${encodeURIComponent(e)}/best-available`,{method:"POST",body:{qty:t,...i?{categoryKey:i}:{},...s?{zoneId:s}:{},...r?{ttlMs:r}:{}}})}resume(e,t){return this.request(`/pub/events/${encodeURIComponent(e)}/hold/resume`,{method:"POST",body:{holdId:t}})}release(e,t,i){return this.request(`/pub/events/${encodeURIComponent(e)}/release`,{method:"POST",body:{labels:t,holdId:i}})}extend(e,t,i){return this.request(`/pub/events/${encodeURIComponent(e)}/extend`,{method:"POST",body:{holdId:t,...i?{ttlMs:i}:{}}})}paymentOptions(e){return this.request(`/pub/events/${encodeURIComponent(e)}/payment-options`)}availability(e,t=!1){return this.request(`/pub/events/${encodeURIComponent(e)}/availability${t?"?live=1":""}`)}startCheckout(e,t){return this.request(`/pub/events/${encodeURIComponent(e)}/checkout`,{method:"POST",body:t})}orderStatus(e){return this.request(`/pub/orders/${encodeURIComponent(e)}/status`)}subscribeTicket(e){return this.request(`/pub/events/${encodeURIComponent(e)}/subscribe-tickets`,{method:"POST",body:{}})}subscribeUrl(e){let t=this.base.replace(/^http/,"ws"),i=new URLSearchParams({surface:"picker",viewerId:this.viewerId});return`${t}/pub/events/${encodeURIComponent(e)}/subscribe?${i}`}socketUrl(e){return this.accessScoped?"":this.subscribeUrl(e)}socketProtocols(e){return this.accessScoped?[]:[K]}createRealtime(e,t){return this.accessScoped?null:new V({url:this.subscribeUrl(e),sink:t})}};var ne=class extends Error{constructor(e){super(`buyer_access_unavailable:${e.reason}`),this.name="BuyerAccessUnavailableError",this.reason=e.reason,this.code=e.code,this.status=e.status}},_t=new Set(["buyer_access_expired"]),Nt=new Set(["paused","provider_failed","channel_denied"]);function Ut(o,e){switch(e){case"buyer_access_invalid":return"invalid";case"buyer_access_revoked":return"revoked";case"buyer_access_origin_mismatch":return"origin_mismatch";case"buyer_access_event_mismatch":return"event_mismatch";case"buyer_access_mode_mismatch":return"mode_mismatch";case"channel_access_denied":return"channel_denied";case"channel_paused":return"paused";case"invalid_channel_scope":return"invalid_scope";default:break}return o===401?"invalid":null}function qt(o,e){return o===401&&!!e&&_t.has(e)}var Kt=3e4,O,I,Z,oe,U,_,J,ae,le,ce,$,Ae,fe,Q,be=class{constructor(e){B(this,$);B(this,O,null);B(this,I,0);B(this,Z);B(this,oe);B(this,U,null);B(this,_,null);B(this,J,null);B(this,ae);B(this,le);B(this,ce,!1);if(R(this,Z,e.provider),R(this,oe,e.skewMs??Kt),R(this,ae,e.onExpired),R(this,le,e.onUnavailable),e.token){let t=typeof e.token=="string"?{token:e.token}:e.token;F(this,$,Ae).call(this,t)}R(this,ce,!!P(this,Z)||!!P(this,O))}get configured(){return P(this,ce)}get unavailable(){return P(this,_)}get hasToken(){return!!P(this,O)&&(P(this,I)===0||P(this,I)>Date.now())}get expiresAt(){return P(this,I)}async authorization(e="initial"){if(!this.configured)return null;if(P(this,_))throw new ne(P(this,_));let t=Date.now();if(!P(this,O)||P(this,I)>0&&P(this,I)-P(this,oe)<=t){let s=!!P(this,O)&&P(this,I)>0&&P(this,I)<=t,r=P(this,O)?s?"expired":"expiring":e,n=await F(this,$,fe).call(this,r);if(!n)throw new ne(P(this,_)??P(this,J)??F(this,$,Q).call(this,"provider_failed"));return`Bearer ${n}`}return`Bearer ${P(this,O)}`}async handleFailure(e,t){var s;if(!this.configured)return!1;if(qt(e,t)){R(this,O,null),R(this,I,0);let r=await F(this,$,fe).call(this,"unauthorized",t);return(s=P(this,ae))==null||s.call(this,{reason:"unauthorized",code:t,refreshed:!!r}),!!r}let i=Ut(e,t);return i&&F(this,$,Q).call(this,i,t,e),!1}async refresh(e="manual"){return R(this,_,null),R(this,J,null),R(this,O,null),R(this,I,0),!!await F(this,$,fe).call(this,e)}clear(){R(this,O,null),R(this,I,0),R(this,U,null)}toJSON(){return{configured:this.configured,hasToken:this.hasToken}}toString(){return"[BuyerAccessContext redacted]"}};O=new WeakMap,I=new WeakMap,Z=new WeakMap,oe=new WeakMap,U=new WeakMap,_=new WeakMap,J=new WeakMap,ae=new WeakMap,le=new WeakMap,ce=new WeakMap,$=new WeakSet,Ae=function(e){return!e||typeof e.token!="string"||!e.token?null:(R(this,O,e.token),R(this,I,typeof e.expiresAt=="number"?e.expiresAt:0),P(this,O))},fe=function(e,t){if(P(this,U))return P(this,U);let i=P(this,Z);if(!i)return F(this,$,Q).call(this,"no_token",t),Promise.resolve(null);let s=(async()=>{try{let r=await i({reason:e}),n=F(this,$,Ae).call(this,r);return n||(F(this,$,Q).call(this,"provider_failed",t),null)}catch{return F(this,$,Q).call(this,"provider_failed",t),null}finally{R(this,U,null)}})();return R(this,U,s),s},Q=function(e,t,i){var r;let s={reason:e,code:t,status:i,retryable:e==="paused"||e==="channel_denied"};return R(this,J,s),Nt.has(e)||(R(this,_,s),R(this,O,null),R(this,I,0)),(r=P(this,le))==null||r.call(this,s),s};function de(o,e={}){return!o.buyerAccessTokenProvider&&!o.buyerAccessToken?null:new be({provider:o.buyerAccessTokenProvider,token:o.buyerAccessToken,...e})}var ge='<svg viewBox="0 0 64 56" width="12" height="11" fill="none" aria-hidden="true" focusable="false" style="display:block"><path d="M4 13 Q16 6 29 7 L28.5 17 Q17 16.5 7 22 Z" fill="#f4b740"/><path d="M4 13 Q16 6 29 7 L28.5 17 Q17 16.5 7 22 Z" fill="#f4b740" transform="translate(64 0) scale(-1 1)"/><path d="M8 28 Q18 22 28.6 23 L28.2 32 Q18 28.5 10 36 Z" fill="#fcf7ee"/><path d="M8 28 Q18 22 28.6 23 L28.2 32 Q18 28.5 10 36 Z" fill="#fcf7ee" transform="translate(64 0) scale(-1 1)"/><path d="M11 41 Q19 35 28.2 36 L27.8 45 Q19.5 42 13.5 49 Z" fill="#fcf7ee"/><path d="M11 41 Q19 35 28.2 36 L27.8 45 Q19.5 42 13.5 49 Z" fill="#fcf7ee" transform="translate(64 0) scale(-1 1)"/></svg>';var Qt="https://api.seatlayer.io",Zt=10;function Jt(o){if(typeof o=="string"){let e=document.querySelector(o);if(!e)throw new Error(`seatmap: container "${o}" not found`);return e}if(!(o instanceof HTMLElement))throw new Error("seatmap: container must be a CSS selector or an HTMLElement");return o}var Le=class{constructor(e){this.mount=null;this.hostEl=null;this.rendered=!1;this.mode_=null;this.tipEl=null;this.tipPos={x:0,y:0};this.onTipMove=null;this.realtime=null;if(!e||typeof e!="object")throw new Error("seatmap: options object is required");if(!e.container)throw new Error("seatmap: `container` is required");if(!e.event||typeof e.event!="string")throw new Error("seatmap: `event` key is required");this.opts=e,this.publicKey=e.publicKey,this.access=de(e,{onExpired:i=>this.opts.onAccessExpired?.(i),onUnavailable:i=>this.opts.onAccessUnavailable?.(i)});let t=new X((e.apiBase??Qt).replace(/\/+$/,""),{access:this.access??void 0,onObjectUnavailable:i=>this.opts.onSelectedObjectUnavailable?.(i)});this.api=t,this.controller=new Wt({transport:t,eventKey:e.event,maxSelection:e.maxSelection??Zt,selectedObjects:e.selectedObjects,selectableObjects:e.selectableObjects,numberOfPlacesToSelect:e.numberOfPlacesToSelect,selectionValidators:e.selectionValidators,currency:e.currency,onSelectionChange:i=>this.opts.onSelectionChange?.(i),onSelectionValidityChange:i=>this.opts.onSelectionValidityChange?.(i),onSelectionValid:i=>this.opts.onSelectionValid?.(i),onSelectionInvalid:i=>this.opts.onSelectionInvalid?.(i),onSelectionLimit:i=>this.opts.onSelectionLimit?.(i),onHold:i=>this.opts.onHold?.({holdId:i.holdId,expiresAt:i.expiresAt,seats:i.seats,items:i.items}),onHoldRestored:i=>this.opts.onHoldRestored?.({holdId:i.holdId,expiresAt:i.expiresAt,seats:i.seats,items:i.items}),onHoldExpired:()=>this.opts.onHoldExpired?.(),onGAClick:i=>{let s=this.controller.getGAAreas().find(r=>r.id===i);s&&this.opts.onGAClick?.(s)},onError:i=>this.opts.onError?.(i),onDeckTap:i=>this.opts.onDeckTap?.(i),onHint:i=>this.opts.onHint?.(i),flashOnLiveChange:!0,onSeatHover:i=>{this.opts.onSeatHover?.(i),this.opts.seatTooltip!==!1&&this.updateTooltip(i)},colorblindSafe:e.colorblindSafe})}async render(){if(this.rendered)return this;this.rendered=!0,await Yt(this.opts.locale),this.opts.messages&&Xt(this.opts.messages),this.mount=Jt(this.opts.container);let e=document.createElement("div");e.style.width="100%",e.style.height="100%",e.style.position="relative",this.mount.appendChild(e),this.hostEl=e;let t=await this.controller.render(e);if(!t)return this.rendered=!1,this.opts.errorDisplay!=="none"&&this.showLoadFailure(e),this;if(this.controller.setViewMode(this.opts.initialView??"flat"),this.startRealtime(),this.mode_=t.mode==="test"?"test":"live",this.opts.seatTooltip!==!1){let i=document.createElement("div");i.setAttribute("role","tooltip"),i.style.cssText='position:absolute;z-index:7;pointer-events:none;display:none;max-width:240px;background:#10162a;color:#fff;border-radius:10px;padding:9px 12px;font:500 12px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;box-shadow:0 10px 30px -10px rgba(0,0,0,.5);',e.appendChild(i),this.tipEl=i,this.onTipMove=s=>{let r=e.getBoundingClientRect();this.tipPos={x:s.clientX-r.left,y:s.clientY-r.top},this.tipEl&&this.tipEl.style.display!=="none"&&this.placeTooltip()},e.addEventListener("mousemove",this.onTipMove)}if(t.mode==="test"){e.style.overflow="hidden";let i=document.createElement("div");i.textContent=ee("picker.testMode"),i.setAttribute("aria-label",ee("picker.testMode")),i.style.cssText="position:absolute;top:18px;right:-34px;z-index:6;transform:rotate(45deg);width:140px;text-align:center;padding:4px 0;background:#f4b740;color:#1a1200;font:800 10.5px/1.4 -apple-system,BlinkMacSystemFont,sans-serif;letter-spacing:.12em;box-shadow:0 2px 8px rgba(0,0,0,.25);pointer-events:none;",e.appendChild(i)}return this.buildBadge(e),this}buildBadge(e){if(this.controller.doc?.theme?.hideBadge)return;let t=document.createElement("a");t.href="https://seatlayer.io",t.target="_blank",t.rel="noopener noreferrer",t.setAttribute("aria-label",ee("picker.poweredBy")),t.style.cssText='position:absolute;bottom:10px;right:12px;z-index:5;display:inline-flex;align-items:center;gap:6px;padding:5px 9px;border-radius:999px;background:rgba(255,255,255,.92);color:#4a5163;text-decoration:none;font:600 11px/1 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;letter-spacing:.02em;box-shadow:0 2px 8px rgba(0,0,0,.12);',t.innerHTML='<span aria-hidden="true" style="width:16px;height:16px;border-radius:4px;flex:none;display:flex;align-items:center;justify-content:center;background:#0c1220;color:#fcf7ee">'+ge+`</span><span>${ee("picker.poweredBy")}</span>`,e.appendChild(t)}placeTooltip(){if(!this.tipEl||!this.hostEl)return;let e=this.hostEl.clientWidth,t=this.tipEl.offsetWidth,i=this.tipEl.offsetHeight,s=this.tipPos.x+14,r=this.tipPos.y-i-12;s+t>e-8&&(s=this.tipPos.x-t-14),r<8&&(r=this.tipPos.y+18),this.tipEl.style.left=`${Math.max(8,s)}px`,this.tipEl.style.top=`${Math.max(8,r)}px`}updateTooltip(e){if(!this.tipEl)return;if(!e){this.tipEl.style.display="none";return}let t=Gt(e.price,e.currency,{locale:this.opts.locale,fallback:(s,r)=>`${s} ${r}`}),i=e.status==="free"?"":`<div style="margin-top:5px;font-size:10.5px;letter-spacing:.08em;text-transform:uppercase;color:#fca5a5;font-weight:700">${e.status==="held"?ee("map.statusHeld"):ee("map.statusTaken")}</div>`;this.tipEl.innerHTML=`<div style="font-weight:700;font-size:13px">${e.label}</div><div style="display:flex;align-items:center;gap:6px;margin-top:4px;color:#c7cddc"><span style="width:9px;height:9px;border-radius:50%;flex:none;background:${e.categoryColor}"></span><span>${e.categoryLabel}</span><span style="margin-left:auto;font-weight:700;color:#fff">${t}</span></div>`+i,this.tipEl.style.display="block",this.placeTooltip()}getMode(){return this.mode_}getSelection(){return this.controller.getSelection()}selectObjects(e){return this.controller.select(e)}deselectObjects(e){this.controller.deselect(e)}clearSelection(){this.controller.clearSelection()}selectCategories(e){return this.controller.selectCategories(e)}deselectCategories(e){this.controller.deselectCategories(e)}setSelectableObjects(e){this.controller.setSelectableObjects(e)}setMaxSelection(e){this.controller.setMaxSelection(e)}getSelectionValidity(){return this.controller.getSelectionValidity()}async hold(e={}){try{return await this.holdOrThrow(e)}catch(t){return this.opts.onError?.(t),null}}async holdOrThrow(e={}){let t=this.controller.getSelectionValidity();if(t&&!t.isValid){let s=t.violations.includes("numberOfPlacesToSelect");throw Object.assign(new Error(s?`seatmap: select exactly ${t.required} places before holding`:"seatmap: adjust the ticket selection before holding"),{code:s?"selection_count_mismatch":"selection_invalid",selection:t})}let i=await this.controller.hold(void 0,e.ttlMs);return i?{holdId:i.holdId,expiresAt:i.expiresAt,seats:i.seats,items:i.items}:null}async resumeHold(e){try{return await this.resumeHoldOrThrow(e)}catch(t){return this.opts.onError?.(t),null}}async resumeHoldOrThrow(e){let t=await this.controller.resumeHold(e);return t?{holdId:t.holdId,expiresAt:t.expiresAt,seats:t.seats,items:t.items}:null}async extendHold(e){try{let t=await this.controller.extendHold(e);return t?{holdId:t.holdId,expiresAt:t.expiresAt,seats:t.seats,items:t.items}:null}catch(t){return this.opts.onError?.(t),null}}getCurrentHold(){let e=this.controller.currentHold();return e?{holdId:e.holdId,expiresAt:e.expiresAt,seats:e.seats,items:e.items}:null}getGAAreas(){return this.controller.getGAAreas()}async holdGA(e,t,i={}){try{return await this.holdGAOrThrow(e,t,i)}catch(s){return this.opts.onError?.(s),null}}async holdGAOrThrow(e,t,i={}){let s=await this.controller.holdGA(e,t,i);return s?{holdId:s.holdId,expiresAt:s.expiresAt,seats:s.seats,items:s.items}:null}async bestAvailable(e,t,i={}){try{return await this.bestAvailableOrThrow(e,t,i)}catch(s){return this.opts.onError?.(s),null}}async bestAvailableOrThrow(e,t,i={}){let s=await this.controller.bestAvailable(e,t,i);return s?{holdId:s.holdId,expiresAt:s.expiresAt,labels:s.labels,seats:s.seats,items:s.items,...i.zoneId?{zoneId:i.zoneId}:{}}:null}setSeatTier(e,t){this.controller.setSeatTier(e,t)}getFloors(){return this.controller.getFloors()}setFloor(e){if(this.controller.getFloors().length<=1){console.warn("seatmap: setFloor() ignored \u2014 this chart has a single floor");return}this.controller.setFloor(e)}setColorblindSafe(e){this.controller.setColorblindSafe(e)}setViewMode(e){this.controller.setViewMode(e)}getViewMode(){return this.controller.getViewMode()}zoomIn(){this.controller.zoomIn()}zoomOut(){this.controller.zoomOut()}zoomToFit(){this.controller.zoomToFit()}async release(){await this.controller.release()}async releaseLabels(e){return this.controller.releaseLabels(e)}startRealtime(){!this.access?.configured||this.realtime||(this.realtime=new V({url:this.api.subscribeUrl(this.opts.event),mintTicket:()=>this.api.subscribeTicket(this.opts.event),onAccessUnavailable:e=>this.opts.onAccessUnavailable?.(e),sink:re(this.controller,{flashOnLiveChange:!0,onSelectedObjectUnavailable:(e,t)=>this.opts.onSelectedObjectUnavailable?.({labels:e,reason:t})})}),this.realtime.start())}async refreshAccess(){if(!this.access?.configured)return!1;let e=await this.access.refresh("manual");return e&&(await this.controller.refresh(),this.realtime?.restart(),this.realtime||this.startRealtime()),e}showLoadFailure(e){let t=document.createElement("div");t.setAttribute("role","status"),t.style.cssText='display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;width:100%;height:100%;min-height:180px;box-sizing:border-box;padding:24px;text-align:center;font:500 14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#3b4256;';let i=document.createElement("div");i.textContent="The seat map didn\u2019t load.",t.appendChild(i);let s=document.createElement("button");s.type="button",s.textContent="Try again",s.style.cssText="appearance:none;border:1px solid #c9cede;background:#fff;color:#10162a;border-radius:8px;padding:8px 16px;font:600 13px/1 inherit;cursor:pointer;",s.addEventListener("click",()=>{this.destroy(),this.render().catch(r=>this.opts.onError?.(r))}),t.appendChild(s),e.appendChild(t)}destroy(){this.realtime?.stop(),this.realtime=null,this.access?.clear(),this.hostEl&&this.onTipMove&&this.hostEl.removeEventListener("mousemove",this.onTipMove),this.tipEl=null,this.onTipMove=null,this.controller.destroy(),this.hostEl&&this.hostEl.parentNode&&this.hostEl.parentNode.removeChild(this.hostEl),this.hostEl=null,this.mount=null,this.rendered=!1,this.mode_=null}};var et=["hold","resumeHold","getCurrentHold","getGAAreas","holdGA","bestAvailable","release","releaseLabels","getSelection","selectObjects","deselectObjects","clearSelection","selectCategories","deselectCategories","setSelectableObjects","setMaxSelection","getSelectionValidity","setSeatTier","getFloors","setFloor","setColorblindSafe","zoomIn","zoomOut","zoomToFit","refreshAccess"],ei={hold:()=>Promise.resolve(null),resumeHold:()=>Promise.resolve(null),getCurrentHold:()=>null,getGAAreas:()=>[],holdGA:()=>Promise.resolve(null),bestAvailable:()=>Promise.resolve(null),release:()=>Promise.resolve(),releaseLabels:()=>Promise.resolve(!1),getSelection:()=>[],selectObjects:()=>[],deselectObjects:()=>{},clearSelection:()=>{},selectCategories:()=>[],deselectCategories:()=>{},setSelectableObjects:()=>{},setMaxSelection:()=>{},getSelectionValidity:()=>null,setSeatTier:()=>{},getFloors:()=>[],setFloor:()=>{},setColorblindSafe:()=>{},zoomIn:()=>{},zoomOut:()=>{},zoomToFit:()=>{},refreshAccess:()=>Promise.resolve(!1)};function ti(o){let e={};for(let t of et)e[t]=(...i)=>{let s=o();return s?s[t](...i):ei[t]()};return e}var tt=["event","apiBase","maxSelection","numberOfPlacesToSelect","selectionValidators","publicKey","locale","currency","colorblindSafe","initialView","errorDisplay"],it=[...tt,"selectedObjects","selectableObjects","messages","seatTooltip","buyerAccessTokenProvider","buyerAccessToken"],st=["onSelectionChange","onSelectionValidityChange","onSelectionValid","onSelectionInvalid","onSelectionLimit","onHold","onHoldRestored","onHoldExpired","onGAClick","onError","onDeckTap","onHint","onSeatHover","onAccessExpired","onAccessUnavailable","onSelectedObjectUnavailable"];function ii(o,e,t){let i={container:o};for(let s of it)i[s]=e[s];for(let s of st)i[s]=t[s];return i}var si=new Set(["seatlayer.designer.ready","seatlayer.designer.saved","seatlayer.designer.published","seatlayer.designer.close","seatlayer.designer.error"]),ri=2e4,ni=480,oi=180*1e3,ai=900*1e3,li=.8,ci=30*1e3,di=1e5,pi=4,hi=50;function Pe(o){if(typeof o!="string")return o;let e=document.querySelector(o);if(!e)throw new Error(`EmbeddedDesigner container not found: ${o}`);return e}function ui(o){let e=(o??"").toLowerCase();return e.includes("expire")||e.includes("revoke")||e==="401"?"expired":e.includes("mismatch")?"mismatch":e.includes("timeout")?"timeout":"load"}var mi={expired:{title:"This design session expired",body:"For your security, editing sessions are short-lived. Start a fresh one to keep designing."},mismatch:{title:"This editor doesn't match this chart",body:"The session that loaded belongs to a different chart or workspace. Reopen the designer to continue."},timeout:{title:"The designer is taking too long",body:"It did not finish loading in time. This is usually a slow connection \u2014 try again."},load:{title:"We couldn't load the designer",body:"Something went wrong while opening the editor. Please try again."}},Me=class{constructor(e){this.frame=null;this.designerOrigin="";this.overlay=null;this.timeoutTimer=null;this.renewTimer=null;this.autoRecoverUsed=!1;this.phase="loading";this.identityEstablished=!1;this.restoreContainerPosition=null;this.pinned=!1;this.frameStyleBeforeFs=null;this.docOverflowBeforeFs=null;this.bodyOverflowBeforeFs=null;this.fsKeyHandler=null;this.lastAutoHeight="";this.fillRaf=null;this.reprobeRaf=null;this.fillListening=!1;this.containerEl=null;this.fillMode=null;this.resizeObs=null;this.scheduleFill=()=>{this.fillRaf===null&&(this.fillRaf=requestAnimationFrame(()=>{this.fillRaf=null,this.applyFill()}))};this.scheduleReprobe=()=>{this.reprobeRaf===null&&(this.reprobeRaf=requestAnimationFrame(()=>{this.reprobeRaf=null,!this.pinned&&(this.fillMode=this.detectFillMode(),this.syncContainerObserver(),this.applyFill())}))};this.handleMessage=e=>{if(!this.frame||e.origin!==this.designerOrigin||e.source!==this.frame.contentWindow||!e.data||typeof e.data!="object")return;let t=e.data;if(t.type==="seatlayer.designer.resize"){!this.fillEnabled()&&this.autoResizeEnabled()&&typeof t.px=="number"&&Number.isFinite(t.px)&&t.px>0&&(this.lastAutoHeight=`${Math.round(t.px)}px`,this.pinned||this.setFrameHeight(this.lastAutoHeight));return}if(t.type==="seatlayer.designer.fullscreen"){t.on===!0?this.pinFullscreen():t.on===!1&&this.unpinFullscreen();return}if(typeof t.type!="string"||!si.has(t.type))return;let i={type:t.type,chartId:typeof t.chartId=="string"?t.chartId:void 0,workspaceId:typeof t.workspaceId=="string"?t.workspaceId:void 0,expiresAt:typeof t.expiresAt=="number"?t.expiresAt:void 0,code:typeof t.code=="string"?t.code:void 0,message:typeof t.message=="string"?t.message:void 0,meta:t.meta,fatal:typeof t.fatal=="boolean"?t.fatal:void 0,action:typeof t.action=="string"?t.action:void 0},s=this.identityEstablished||i.type==="seatlayer.designer.ready"||i.type==="seatlayer.designer.saved"||i.type==="seatlayer.designer.published"||i.type==="seatlayer.designer.close",r=this.options.expectedChartId!==void 0&&i.chartId!==this.options.expectedChartId&&(s||i.chartId!==void 0),n=this.options.expectedWorkspaceId!==void 0&&i.workspaceId!==this.options.expectedWorkspaceId&&(s||i.workspaceId!==void 0);if(r||n){this.showError("mismatch");return}switch(i.type){case"seatlayer.designer.ready":this.identityEstablished=!0,this.sessionExpiresAt=i.expiresAt,this.phase="ready",this.clearTimeoutTimer(),this.removeOverlay(),this.autoRecoverUsed=!1,this.scheduleRenewal(i.expiresAt),this.options.onReady?.(i);break;case"seatlayer.designer.saved":this.options.onSaved?.(i);break;case"seatlayer.designer.published":this.options.onPublished?.(i);break;case"seatlayer.designer.close":this.options.onClose?.(i);break;case"seatlayer.designer.error":{let a=ui(i.code);if(a==="expired"&&this.autoRenewEnabled()&&!this.autoRecoverUsed){this.autoRecoverUsed=!0,this.clearRenewTimer(),this.options.onRequestRelaunch();return}(typeof i.fatal=="boolean"?i.fatal:a!=="load"||this.phase!=="ready")&&this.showError(a),this.options.onError?.(i);break}}};this.options=e}mount(){this.destroy();let e=new URL(this.options.designerUrl,window.location.href);if(e.protocol!=="https:"&&e.hostname!=="localhost"&&e.hostname!=="127.0.0.1")throw new Error("EmbeddedDesigner requires an HTTPS designerUrl outside local development.");this.designerOrigin=e.origin;let t=document.createElement("iframe");t.title=this.options.title??"Venue chart Designer",t.allow=this.options.allow??"fullscreen; clipboard-write",t.referrerPolicy=this.options.referrerPolicy??"origin",t.src=e.toString(),t.style.setProperty("width","100%","important"),t.style.setProperty("height",typeof this.options.height=="number"?`${this.options.height}px`:"100%","important"),t.style.border="0",Object.assign(t.style,this.options.style),this.options.className&&(t.className=this.options.className);let i=Pe(this.options.container);if(this.containerEl=i,window.addEventListener("message",this.handleMessage),i.append(t),this.frame=t,this.fillEnabled()&&this.startFill(),this.phase="loading",this.loadingStateEnabled()){this.ensureContainerPositioned(i),this.renderOverlay(i,"loading");let s=this.options.loadingTimeoutMs??ri;s>0&&Number.isFinite(s)&&(this.timeoutTimer=setTimeout(()=>{this.phase==="loading"&&this.showError("timeout")},s))}return t}setDesignerUrl(e){return this.options={...this.options,designerUrl:e},this.mount()}getIframe(){return this.frame}setSizing(e,t){this.options={...this.options,height:e,minHeight:t},this.frame&&(this.stopFill(),this.lastAutoHeight="",this.fillEnabled()?(this.pinned||this.setFrameHeight("100%"),this.startFill()):this.pinned||this.setFrameHeight(`${e}px`))}setRelaunchPolicy(e,t){this.options={...this.options,onRequestRelaunch:e,autoRenewSession:t},this.clearRenewTimer(),this.phase==="ready"&&this.scheduleRenewal(this.sessionExpiresAt)}destroy(){window.removeEventListener("message",this.handleMessage),this.stopFill(),this.unpinFullscreen(),this.clearTimeoutTimer(),this.clearRenewTimer(),this.removeOverlay(),this.restoreContainerStyle(),this.frame?.remove(),this.frame=null,this.containerEl=null,this.fillMode=null,this.designerOrigin="",this.phase="loading",this.identityEstablished=!1,this.sessionExpiresAt=void 0,this.lastAutoHeight=""}loadingStateEnabled(){return this.options.showLoadingState!==!1}autoResizeEnabled(){return this.options.autoResize!==!1}fillEnabled(){return typeof this.options.height!="number"}setFrameHeight(e){this.frame?.style.setProperty("height",e,"important")}detectFillMode(){let e=this.containerEl,t=this.frame;if(this.pinned||!e||!t)return this.fillMode??"viewport";let i=()=>e.getBoundingClientRect().height,s=t.style.getPropertyValue("height"),r=t.style.getPropertyPriority("height");t.style.setProperty("height","0px","important");let n=i();t.style.setProperty("height",`${di}px`,"important");let a=i();return s?t.style.setProperty("height",s,r):t.style.removeProperty("height"),!(a-n>pi)&&n>=hi?"container":"viewport"}applyFill(){if(!this.frame||this.pinned)return;let e=this.options.minHeight??ni;if(this.fillMode==="container"&&this.containerEl){let s=Math.max(e,Math.round(this.containerEl.getBoundingClientRect().height));this.setFrameHeight(`${s}px`);return}let t=this.frame.getBoundingClientRect().top,i=Math.max(e,Math.round(window.innerHeight-t));this.setFrameHeight(`${i}px`)}syncContainerObserver(){let e=this.fillMode==="container"&&!!this.containerEl&&typeof ResizeObserver<"u";e&&!this.resizeObs?(this.resizeObs=new ResizeObserver(()=>this.scheduleFill()),this.resizeObs.observe(this.containerEl)):!e&&this.resizeObs&&(this.resizeObs.disconnect(),this.resizeObs=null)}startFill(){this.fillMode=this.detectFillMode(),this.syncContainerObserver(),this.applyFill(),!this.fillListening&&(this.fillListening=!0,window.addEventListener("resize",this.scheduleReprobe),window.addEventListener("orientationchange",this.scheduleReprobe),window.addEventListener("scroll",this.scheduleFill,{passive:!0}))}stopFill(){this.fillRaf!==null&&(cancelAnimationFrame(this.fillRaf),this.fillRaf=null),this.reprobeRaf!==null&&(cancelAnimationFrame(this.reprobeRaf),this.reprobeRaf=null),this.resizeObs&&(this.resizeObs.disconnect(),this.resizeObs=null),this.fillListening&&(this.fillListening=!1,window.removeEventListener("resize",this.scheduleReprobe),window.removeEventListener("orientationchange",this.scheduleReprobe),window.removeEventListener("scroll",this.scheduleFill))}pinFullscreen(){if(this.pinned||!this.frame)return;this.pinned=!0,this.frameStyleBeforeFs=this.frame.getAttribute("style");let e={position:"fixed",top:"0",right:"0",bottom:"0",left:"0",width:"100vw",height:"100vh",margin:"0",border:"0","z-index":"2147483000",background:"#101625"};for(let[i,s]of Object.entries(e))this.frame.style.setProperty(i,s,"important");let t=document.documentElement;this.docOverflowBeforeFs=t.style.overflow,t.style.overflow="hidden",document.body&&(this.bodyOverflowBeforeFs=document.body.style.overflow,document.body.style.overflow="hidden"),this.fsKeyHandler=i=>{i.key==="Escape"&&this.unpinFullscreen()},window.addEventListener("keydown",this.fsKeyHandler)}unpinFullscreen(){this.pinned&&(this.pinned=!1,this.frame&&(this.frameStyleBeforeFs===null?this.frame.removeAttribute("style"):this.frame.setAttribute("style",this.frameStyleBeforeFs),this.fillEnabled()?this.applyFill():this.autoResizeEnabled()&&this.lastAutoHeight?this.setFrameHeight(this.lastAutoHeight):typeof this.options.height=="number"&&this.setFrameHeight(`${this.options.height}px`)),this.frameStyleBeforeFs=null,this.docOverflowBeforeFs!==null&&(document.documentElement.style.overflow=this.docOverflowBeforeFs,this.docOverflowBeforeFs=null),this.bodyOverflowBeforeFs!==null&&document.body&&(document.body.style.overflow=this.bodyOverflowBeforeFs,this.bodyOverflowBeforeFs=null),this.fsKeyHandler&&(window.removeEventListener("keydown",this.fsKeyHandler),this.fsKeyHandler=null))}clearTimeoutTimer(){this.timeoutTimer!==null&&(clearTimeout(this.timeoutTimer),this.timeoutTimer=null)}autoRenewEnabled(){return!!this.options.onRequestRelaunch&&this.options.autoRenewSession!==!1}clearRenewTimer(){this.renewTimer!==null&&(clearTimeout(this.renewTimer),this.renewTimer=null)}scheduleRenewal(e){if(this.clearRenewTimer(),!this.autoRenewEnabled()||typeof e!="number"||!Number.isFinite(e))return;let t=e-Date.now();if(t<=0)return;let i=t<ai?t*li:t-oi,s=Math.max(ci,i);this.renewTimer=setTimeout(()=>{this.renewTimer=null,this.autoRenewEnabled()&&this.options.onRequestRelaunch()},s)}ensureContainerPositioned(e){getComputedStyle(e).position==="static"&&(this.restoreContainerPosition=e.style.position,e.style.position="relative")}restoreContainerStyle(){if(this.restoreContainerPosition!==null){try{Pe(this.options.container).style.position=this.restoreContainerPosition}catch{}this.restoreContainerPosition=null}}removeOverlay(){this.overlay?.remove(),this.overlay=null}showError(e){if(this.phase="error",this.clearTimeoutTimer(),!this.loadingStateEnabled())return;let t;try{t=Pe(this.options.container)}catch{return}this.renderOverlay(t,"error",e)}handleTryAgain(){if(this.options.onRequestRelaunch){this.options.onRequestRelaunch();return}this.mount()}renderOverlay(e,t,i){this.removeOverlay();let s=document.createElement("div");s.setAttribute("data-seatlayer-designer-overlay",t),s.setAttribute("role",t==="error"?"alert":"status"),s.setAttribute("aria-live","polite"),Object.assign(s.style,{position:"absolute",inset:"0",display:"flex",alignItems:"center",justifyContent:"center",background:"#101625",color:"#e6ebf5",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',zIndex:"2",overflow:"hidden"}),t==="loading"?this.buildSkeleton(s):this.buildErrorCard(s,i??"load"),e.append(s),this.overlay=s}buildSkeleton(e){let t=document.createElement("style");t.textContent=`
2
2
  @media (prefers-reduced-motion: no-preference) {
3
3
  @keyframes seatlayer-designer-shimmer {
4
4
  0% { background-position: -320px 0; }
@@ -8,7 +8,7 @@ import{a as P,b as z,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerContro
8
8
  animation: seatlayer-designer-shimmer 1.25s ease-in-out infinite;
9
9
  background-size: 640px 100%;
10
10
  }
11
- }`,e.append(t);let i="linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.10) 37%, rgba(255,255,255,0.04) 63%)",s=document.createElement("div");Object.assign(s.style,{position:"absolute",inset:"0",display:"flex",flexDirection:"column",padding:"16px",gap:"14px",opacity:"0.9"});let n=d=>{let h=document.createElement("div");return h.className="sl-shimmer",Object.assign(h.style,{background:i,borderRadius:"8px"}),Object.assign(h.style,d),h};s.append(n({height:"40px",width:"100%",flex:"0 0 auto"}));let r=document.createElement("div");Object.assign(r.style,{display:"flex",gap:"14px",flex:"1 1 auto",minHeight:"0"}),r.append(n({width:"220px",height:"100%",flex:"0 0 auto"})),r.append(n({flex:"1 1 auto",height:"100%"})),s.append(r),e.append(s);let o=document.createElement("div");Object.assign(o.style,{position:"relative",zIndex:"1",display:"flex",alignItems:"center",gap:"10px",padding:"10px 16px",borderRadius:"999px",background:"rgba(16, 22, 37, 0.72)",fontSize:"13px",fontWeight:"500",letterSpacing:"0.01em"});let l=document.createElement("span");l.className="sl-shimmer",Object.assign(l.style,{width:"9px",height:"9px",borderRadius:"50%",background:i,flex:"0 0 auto"}),o.append(l),o.append(document.createTextNode("Loading designer\u2026")),e.append(o)}buildErrorCard(e,t){let i=di[t],s=document.createElement("div");Object.assign(s.style,{maxWidth:"420px",margin:"0 24px",padding:"28px",textAlign:"center",background:"rgba(255, 255, 255, 0.03)",border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:"16px",boxShadow:"0 12px 40px rgba(0, 0, 0, 0.35)"});let n=document.createElement("h2");n.textContent=i.title,Object.assign(n.style,{margin:"0 0 8px",fontSize:"17px",fontWeight:"600",color:"#f4f7ff"});let r=document.createElement("p");r.textContent=i.body,Object.assign(r.style,{margin:"0 0 20px",fontSize:"13.5px",lineHeight:"1.5",color:"#aab4c8"});let o=document.createElement("button");o.type="button",o.textContent="Try again",Object.assign(o.style,{appearance:"none",cursor:"pointer",border:"0",borderRadius:"10px",padding:"10px 22px",fontSize:"14px",fontWeight:"600",color:"#101625",background:"#7aa2ff"}),o.addEventListener("click",()=>this.handleTryAgain()),s.append(n,r,o),e.append(s)}};import{PickerController as Ii,ACCESSIBILITY_TYPES as $i,expandChart as Ue,formatMoney as Bi,generateSeatThumb as zi,loadLocale as Di,setStringOverrides as Fi,t as y,tCount as q}from"@seatlayer/core";import{isAuthoredSeatView as ji,seatViewDisclosure as At}from"@seatlayer/core/view3d/crossfade/panorama";import{seatConfidenceDisclosure as Lt}from"@seatlayer/core/core/seatConfidence";var pi=/^[a-zA-Z0-9._-]+$/;function hi(a){let e;try{e=new URL(a,"https://seatlayer.invalid")}catch{return null}if(e.search||e.hash)return null;let t=/^\/pub\/events\/([^/]+)\/assets\/([^/]+)$/.exec(e.pathname);if(!t)return null;try{let i=decodeURIComponent(t[1]),s=decodeURIComponent(t[2]);return!i||!pi.test(s)?null:{eventKey:i,asset:s}}catch{return null}}function ui(a){try{return/^\/pub\/events\/[^/]+\/assets(?:\/|$)/.test(new URL(a,"https://seatlayer.invalid").pathname)}catch{return!1}}var ge=class{constructor(e,t){this.eventKey=e;this.load=t;this.pending=new Map;this.created=new Set;this.disposed=!1}resolve(e){let t=hi(e);if(!t)return Promise.resolve(ui(e)?null:e);if(t.eventKey!==this.eventKey||!this.load||this.disposed)return Promise.resolve(null);let i=this.pending.get(e);if(i)return i;let s=this.load(this.eventKey,t.asset).then(n=>{let r=URL.createObjectURL(n);return this.disposed?(URL.revokeObjectURL(r),null):(this.created.add(r),r)}).catch(n=>{throw this.pending.delete(e),n});return this.pending.set(e,s),s}dispose(){if(!this.disposed){this.disposed=!0;for(let e of this.created)URL.revokeObjectURL(e);this.created.clear(),this.pending.clear()}}};var mi=["on-sale","low","sold-out","presale","closed"];function pe(a){return a==null?null:typeof a=="number"&&Number.isFinite(a)&&a>=0?a:void 0}function rt(a){return a==null?null:typeof a=="number"&&Number.isFinite(a)&&a>=0?a:void 0}function nt(a){if(a==null)return null;if(typeof a!="object"||Array.isArray(a))return;let e=a,t=e.count,i=e.index;if(typeof i!="number"||!Number.isInteger(i)||i<1||typeof t!="number"||!Number.isInteger(t)||t<i)return;let s=e.remaining;if(s!=null&&(typeof s!="number"||!Number.isInteger(s)||s<0))return;let n={index:i,count:t,remaining:s??null};if(e.id!==void 0){if(typeof e.id!="string"||!e.id.trim())return;n.id=e.id.trim()}if(e.name!==void 0){if(typeof e.name!="string"||!e.name.trim())return;n.name=e.name.trim()}if(e.categoryKey!==void 0){if(e.categoryKey!==null&&(typeof e.categoryKey!="string"||!e.categoryKey.trim()))return;n.categoryKey=e.categoryKey==null?null:e.categoryKey.trim()}for(let r of["startsAt","endsAt"]){if(e[r]===void 0)continue;let o=rt(e[r]);if(o===void 0)return;n[r]=o}return n}function fi(a){if(a==null)return null;if(typeof a!="object"||Array.isArray(a))return;let e=a;if(!Number.isInteger(e.assignmentVersion)||e.assignmentVersion<0||!Array.isArray(e.channels)||!Array.isArray(e.objects))return;let t=[],i=new Set;for(let r of e.channels){if(!r||typeof r!="object"||Array.isArray(r))return;let o=r,l=typeof o.channelId=="string"?o.channelId.trim():"";if(!l||i.has(l)||!Number.isInteger(o.pricingVersion)||o.pricingVersion<0||!Array.isArray(o.priceOverrides))return;let d=[],h=new Set;for(let p of o.priceOverrides){if(!p||typeof p!="object"||Array.isArray(p))return;let c=p,f=typeof c.categoryKey=="string"?c.categoryKey.trim():"",m=c.tierId===null?null:typeof c.tierId=="string"&&c.tierId.trim()?c.tierId.trim():void 0,v=pe(c.price);if(!f||m===void 0||v===void 0||v===null)return;let w=`${f}\0${m??""}`;if(h.has(w))return;h.add(w),d.push({categoryKey:f,tierId:m,price:v})}i.add(l),t.push({channelId:l,pricingVersion:o.pricingVersion,priceOverrides:d})}let s=[],n=new Set;for(let r of e.objects){if(!r||typeof r!="object"||Array.isArray(r))return;let o=r,l=typeof o.label=="string"?o.label.trim():"",d=typeof o.channelId=="string"?o.channelId.trim():"";if(!l||n.has(l)||!i.has(d))return;n.add(l),s.push({label:l,channelId:d})}return{assignmentVersion:e.assignmentVersion,channels:t,objects:s}}function He(a){if(!a||typeof a!="object"||Array.isArray(a))return null;let e=a,t=mi.find(h=>h===e.state);if(!t)return null;let i=pe(e.fromPrice),s=pe(e.previousPrice);if(i===void 0||s===void 0)return null;let n=e.currency==null?null:typeof e.currency=="string"&&e.currency.trim()?e.currency.trim():void 0;if(n===void 0)return null;let r=nt(e.release);if(r===void 0)return null;let o=e.upcoming===void 0?null:nt(e.upcoming);if(o===void 0)return null;let l=[];if(e.prices!=null){if(!Array.isArray(e.prices))return null;let h=[];for(let p of e.prices){if(!p||typeof p!="object"||Array.isArray(p))return null;let c=p,f=typeof c.categoryKey=="string"?c.categoryKey.trim():"";if(!f)return null;let m=pe(c.price),v=pe(c.previousPrice);if(m==null||v===void 0)return null;let w={categoryKey:f,price:m,previousPrice:v};if(c.offerId!==void 0){if(typeof c.offerId!="string"||!c.offerId.trim())return null;w.offerId=c.offerId.trim()}if(c.offerName!==void 0){if(typeof c.offerName!="string"||!c.offerName.trim())return null;w.offerName=c.offerName.trim()}if(c.remaining!==void 0){if(c.remaining!==null&&(typeof c.remaining!="number"||!Number.isInteger(c.remaining)||c.remaining<0))return null;w.remaining=c.remaining==null?null:c.remaining}for(let k of["startsAt","endsAt"]){if(c[k]===void 0)continue;let x=rt(c[k]);if(x===void 0)return null;w[k]=x}h.push(w)}l=h}let d=fi(e.channelPricing);return d===void 0?null:{state:t,fromPrice:i,previousPrice:s,currency:n,release:r,upcoming:o,prices:l,channelPricing:d}}function ot(a,e){if(!a)return null;let t=null,i=s=>{s!=null&&s>e&&(t===null||s<t)&&(t=s)};for(let s of[a.release,a.upcoming])i(s?.startsAt),i(s?.endsAt);for(let s of a.prices)i(s.startsAt),i(s.endsAt);return t}function Re(a){let e={};for(let t of a?.prices??[])e[t.categoryKey]=t.price;return e}var at="seatlayer-picker-style",bi=`
11
+ }`,e.append(t);let i="linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.10) 37%, rgba(255,255,255,0.04) 63%)",s=document.createElement("div");Object.assign(s.style,{position:"absolute",inset:"0",display:"flex",flexDirection:"column",padding:"16px",gap:"14px",opacity:"0.9"});let r=c=>{let u=document.createElement("div");return u.className="sl-shimmer",Object.assign(u.style,{background:i,borderRadius:"8px"}),Object.assign(u.style,c),u};s.append(r({height:"40px",width:"100%",flex:"0 0 auto"}));let n=document.createElement("div");Object.assign(n.style,{display:"flex",gap:"14px",flex:"1 1 auto",minHeight:"0"}),n.append(r({width:"220px",height:"100%",flex:"0 0 auto"})),n.append(r({flex:"1 1 auto",height:"100%"})),s.append(n),e.append(s);let a=document.createElement("div");Object.assign(a.style,{position:"relative",zIndex:"1",display:"flex",alignItems:"center",gap:"10px",padding:"10px 16px",borderRadius:"999px",background:"rgba(16, 22, 37, 0.72)",fontSize:"13px",fontWeight:"500",letterSpacing:"0.01em"});let l=document.createElement("span");l.className="sl-shimmer",Object.assign(l.style,{width:"9px",height:"9px",borderRadius:"50%",background:i,flex:"0 0 auto"}),a.append(l),a.append(document.createTextNode("Loading designer\u2026")),e.append(a)}buildErrorCard(e,t){let i=mi[t],s=document.createElement("div");Object.assign(s.style,{maxWidth:"420px",margin:"0 24px",padding:"28px",textAlign:"center",background:"rgba(255, 255, 255, 0.03)",border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:"16px",boxShadow:"0 12px 40px rgba(0, 0, 0, 0.35)"});let r=document.createElement("h2");r.textContent=i.title,Object.assign(r.style,{margin:"0 0 8px",fontSize:"17px",fontWeight:"600",color:"#f4f7ff"});let n=document.createElement("p");n.textContent=i.body,Object.assign(n.style,{margin:"0 0 20px",fontSize:"13.5px",lineHeight:"1.5",color:"#aab4c8"});let a=document.createElement("button");a.type="button",a.textContent="Try again",Object.assign(a.style,{appearance:"none",cursor:"pointer",border:"0",borderRadius:"10px",padding:"10px 22px",fontSize:"14px",fontWeight:"600",color:"#101625",background:"#7aa2ff"}),a.addEventListener("click",()=>this.handleTryAgain()),s.append(r,n,a),e.append(s)}};import{PickerController as ji,ACCESSIBILITY_TYPES as Vi,expandChart as Ue,formatMoney as _i,generateSeatThumb as Ni,loadLocale as Ui,setStringOverrides as qi,t as y,tCount as q}from"@seatlayer/core";import{isAuthoredSeatView as Ki,seatViewDisclosure as Ht}from"@seatlayer/core/view3d/crossfade/panorama";import{seatConfidenceDisclosure as Rt}from"@seatlayer/core/core/seatConfidence";function rt(o){return o?.previousPrice!=null&&o.previousPrice>o.price?o.previousPrice:null}function nt(o){return fi(o)+(o.moreLabel?`<button type="button" class="sl-price-more" aria-expanded="${!o.collapsed}">${o.moreLabel}</button>`:"")+bi(o.status)}function fi(o){let{esc:e,money:t}=o;return o.categories.map(i=>{let s=o.priceOf(i),r=o.rangeOf(i),n=o.offerOf(i.key),a=rt(n),l=o.activeKey===i.key;return`<div class="sl-price-row${o.bandKeys!=null&&!o.bandKeys.has(i.key)?" sl-dim":""}${l?" sl-active":""}" data-cat="${e(i.key)}" role="button" tabindex="0" aria-pressed="${l}" title="${e(o.titleFor(i,l))}"><span class="sl-dot" style="background:${e(o.colorOf(i))}"></span><span class="sl-price-label">${e(i.label)}`+(n?.offerName?`<small class="sl-price-offer">${e(n.offerName)}</small>`:"")+`</span><span class="sl-price-left">${o.leftCount(o.left[i.key]??0)}</span>`+(a!=null?`<span class="sl-price-was">${e(t(a))}</span>`:"")+(r!=null?`<span class="sl-price-amt">${r.min===r.max?t(r.min):`${t(r.min)}\u2013${t(r.max)}`}</span>`:s!=null?`<span class="sl-price-amt">${t(s)}</span>`:"")+"</div>"}).join("")}function bi(o){return`<div class="sl-status-key" aria-label="${o.legend}"><span class="sl-status-item"><i class="sl-status-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><rect x="5" y="10" width="14" height="10" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/></svg></i>${o.held}</span><span class="sl-status-item"><i class="sl-status-icon sold" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M7 17L17 7"/></svg></i>${o.sold}</span></div>`}function ot(o){let{esc:e,money:t}=o;return o.categories.map(i=>{let s=o.rangeOf(i),r=o.priceOf(i),n=s?s.min===s.max?t(s.min):`${t(s.min)}+`:r!=null?t(r):null,a=Object.prototype.hasOwnProperty.call(o.left,i.key)&&o.left[i.key]<=0,l=rt(o.offerOf(i.key)),c=n?`${i.label} \u2014 ${n}${a?` (${o.soldOutWord})`:""}`:i.label;return`<button type="button" class="sl-rc" data-cat="${e(i.key)}" aria-pressed="${o.activeKey===i.key}" aria-label="${e(c)}" title="${e(c)}"${a?" disabled":""}><i class="sl-rc-dot" style="background:${e(o.colorOf(i))}"></i>`+(l!=null?`<span class="sl-rc-was">${e(t(l))}</span>`:"")+`<span class="sl-rc-t">${e(n??i.label)}</span></button>`}).join("")}var gi=/^[a-zA-Z0-9._-]+$/;function vi(o){let e;try{e=new URL(o,"https://seatlayer.invalid")}catch{return null}if(e.search||e.hash)return null;let t=/^\/pub\/events\/([^/]+)\/assets\/([^/]+)$/.exec(e.pathname);if(!t)return null;try{let i=decodeURIComponent(t[1]),s=decodeURIComponent(t[2]);return!i||!gi.test(s)?null:{eventKey:i,asset:s}}catch{return null}}function yi(o){try{return/^\/pub\/events\/[^/]+\/assets(?:\/|$)/.test(new URL(o,"https://seatlayer.invalid").pathname)}catch{return!1}}var ve=class{constructor(e,t){this.eventKey=e;this.load=t;this.pending=new Map;this.created=new Set;this.disposed=!1}resolve(e){let t=vi(e);if(!t)return Promise.resolve(yi(e)?null:e);if(t.eventKey!==this.eventKey||!this.load||this.disposed)return Promise.resolve(null);let i=this.pending.get(e);if(i)return i;let s=this.load(this.eventKey,t.asset).then(r=>{let n=URL.createObjectURL(r);return this.disposed?(URL.revokeObjectURL(n),null):(this.created.add(n),n)}).catch(r=>{throw this.pending.delete(e),r});return this.pending.set(e,s),s}dispose(){if(!this.disposed){this.disposed=!0;for(let e of this.created)URL.revokeObjectURL(e);this.created.clear(),this.pending.clear()}}};var xi=["on-sale","low","sold-out","presale","closed"];function pe(o){return o==null?null:typeof o=="number"&&Number.isFinite(o)&&o>=0?o:void 0}function lt(o){return o==null?null:typeof o=="number"&&Number.isFinite(o)&&o>=0?o:void 0}function at(o){if(o==null)return null;if(typeof o!="object"||Array.isArray(o))return;let e=o,t=e.count,i=e.index;if(typeof i!="number"||!Number.isInteger(i)||i<1||typeof t!="number"||!Number.isInteger(t)||t<i)return;let s=e.remaining;if(s!=null&&(typeof s!="number"||!Number.isInteger(s)||s<0))return;let r={index:i,count:t,remaining:s??null};if(e.id!==void 0){if(typeof e.id!="string"||!e.id.trim())return;r.id=e.id.trim()}if(e.name!==void 0){if(typeof e.name!="string"||!e.name.trim())return;r.name=e.name.trim()}if(e.categoryKey!==void 0){if(e.categoryKey!==null&&(typeof e.categoryKey!="string"||!e.categoryKey.trim()))return;r.categoryKey=e.categoryKey==null?null:e.categoryKey.trim()}for(let n of["startsAt","endsAt"]){if(e[n]===void 0)continue;let a=lt(e[n]);if(a===void 0)return;r[n]=a}return r}function wi(o){if(o==null)return null;if(typeof o!="object"||Array.isArray(o))return;let e=o;if(!Number.isInteger(e.assignmentVersion)||e.assignmentVersion<0||!Array.isArray(e.channels)||!Array.isArray(e.objects))return;let t=[],i=new Set;for(let n of e.channels){if(!n||typeof n!="object"||Array.isArray(n))return;let a=n,l=typeof a.channelId=="string"?a.channelId.trim():"";if(!l||i.has(l)||!Number.isInteger(a.pricingVersion)||a.pricingVersion<0||!Array.isArray(a.priceOverrides))return;let c=[],u=new Set;for(let p of a.priceOverrides){if(!p||typeof p!="object"||Array.isArray(p))return;let d=p,f=typeof d.categoryKey=="string"?d.categoryKey.trim():"",m=d.tierId===null?null:typeof d.tierId=="string"&&d.tierId.trim()?d.tierId.trim():void 0,g=pe(d.price);if(!f||m===void 0||g===void 0||g===null)return;let w=`${f}\0${m??""}`;if(u.has(w))return;u.add(w),c.push({categoryKey:f,tierId:m,price:g})}i.add(l),t.push({channelId:l,pricingVersion:a.pricingVersion,priceOverrides:c})}let s=[],r=new Set;for(let n of e.objects){if(!n||typeof n!="object"||Array.isArray(n))return;let a=n,l=typeof a.label=="string"?a.label.trim():"",c=typeof a.channelId=="string"?a.channelId.trim():"";if(!l||r.has(l)||!i.has(c))return;r.add(l),s.push({label:l,channelId:c})}return{assignmentVersion:e.assignmentVersion,channels:t,objects:s}}function He(o){if(!o||typeof o!="object"||Array.isArray(o))return null;let e=o,t=xi.find(u=>u===e.state);if(!t)return null;let i=pe(e.fromPrice),s=pe(e.previousPrice);if(i===void 0||s===void 0)return null;let r=e.currency==null?null:typeof e.currency=="string"&&e.currency.trim()?e.currency.trim():void 0;if(r===void 0)return null;let n=at(e.release);if(n===void 0)return null;let a=e.upcoming===void 0?null:at(e.upcoming);if(a===void 0)return null;let l=[];if(e.prices!=null){if(!Array.isArray(e.prices))return null;let u=[];for(let p of e.prices){if(!p||typeof p!="object"||Array.isArray(p))return null;let d=p,f=typeof d.categoryKey=="string"?d.categoryKey.trim():"";if(!f)return null;let m=pe(d.price),g=pe(d.previousPrice);if(m==null||g===void 0)return null;let w={categoryKey:f,price:m,previousPrice:g};if(d.offerId!==void 0){if(typeof d.offerId!="string"||!d.offerId.trim())return null;w.offerId=d.offerId.trim()}if(d.offerName!==void 0){if(typeof d.offerName!="string"||!d.offerName.trim())return null;w.offerName=d.offerName.trim()}if(d.remaining!==void 0){if(d.remaining!==null&&(typeof d.remaining!="number"||!Number.isInteger(d.remaining)||d.remaining<0))return null;w.remaining=d.remaining==null?null:d.remaining}for(let k of["startsAt","endsAt"]){if(d[k]===void 0)continue;let x=lt(d[k]);if(x===void 0)return null;w[k]=x}u.push(w)}l=u}let c=wi(e.channelPricing);return c===void 0?null:{state:t,fromPrice:i,previousPrice:s,currency:r,release:n,upcoming:a,prices:l,channelPricing:c}}function ct(o,e){if(!o)return null;let t=null,i=s=>{s!=null&&s>e&&(t===null||s<t)&&(t=s)};for(let s of[o.release,o.upcoming])i(s?.startsAt),i(s?.endsAt);for(let s of o.prices)i(s.startsAt),i(s.endsAt);return t}function Re(o){let e={};for(let t of o?.prices??[])e[t.categoryKey]=t.price;return e}var dt="seatlayer-picker-style",ki=`
12
12
  .sl-picker{position:relative;display:flex;flex-direction:column;width:100%;height:100%;min-height:420px;overflow:hidden;
13
13
  background:var(--sl-bg);color:var(--sl-text);font-family:var(--sl-font);border-radius:var(--sl-radius);
14
14
  --sl-r-sm:calc(var(--sl-radius) * .55);
@@ -23,7 +23,16 @@ import{a as P,b as z,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerContro
23
23
  --sl-premium:#e8c15a;--sl-premium-deep:#c9a24b;--sl-premium-ink:#1c1608;
24
24
  --sl-premium-text:color-mix(in srgb,var(--sl-premium-deep) 48%,var(--sl-text));
25
25
  --sl-warn:#d8a425;--sl-warn-text:color-mix(in srgb,var(--sl-warn) 48%,var(--sl-text));
26
- --sl-danger:#e5484d;--sl-success:#22a06b}
26
+ --sl-danger:#e5484d;--sl-success:#22a06b;
27
+ /* THE HOME-INDICATOR GUTTER. The hosted buyer page pins the picker with
28
+ position:fixed and inset 0 on three sides, so on a phone the sheet's bottom
29
+ edge IS the screen's bottom edge \u2014 and the pill sitting there is the one
30
+ that takes money. Resolves to 0px in any host that is not inset (embeds,
31
+ desktop, Android without gesture nav), so this is inert everywhere else.
32
+ Named once because the sheet's padding and all four of its height rules
33
+ must agree: box-sizing:border-box above means padding EATS a fixed height,
34
+ so every height grows by exactly what the padding reserves. */
35
+ --sl-safe-b:env(safe-area-inset-bottom,0px)}
27
36
  .sl-picker *{box-sizing:border-box;margin:0;padding:0}
28
37
  /* Keep the reset intentionally specificity-free. Standalone map and panel
29
38
  controls must be able to establish their own token surfaces in either theme. */
@@ -95,13 +104,21 @@ import{a as P,b as z,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerContro
95
104
  map's raw-pointer gesture pipeline is untouched. */
96
105
  .sl-picker[data-layout="narrow"] .sl-body{flex-direction:column}
97
106
  .sl-picker[data-layout="narrow"] .sl-map{min-height:0;flex:1}
107
+ /* SAFE AREA LIVES ON THE SHEET, NOT ON THE FOOT. At peek the rule below hides
108
+ everything but the head \u2014 so the FOOT is not the bottom-most element, the
109
+ HEAD is, and it is the head that carries the Continue/Checkout pill. Padding
110
+ the foot alone would fix the opened sheet and leave the collapsed one (where
111
+ most buyers are) still under the home indicator. Padding the container covers
112
+ both states with one rule, and each height below grows by the same amount so
113
+ no content box shrinks. */
98
114
  .sl-picker[data-layout="narrow"] .sl-side{width:100%;border-left:0;border-top:1px solid var(--sl-line);
99
- flex:none;height:min(72%,480px);overflow:hidden;transition:height .3s cubic-bezier(.2,.8,.2,1);overscroll-behavior:contain}
100
- .sl-picker[data-layout="narrow"][data-sheet="open"][data-has-selection="false"] .sl-side{height:min(380px,64%)}
115
+ flex:none;height:calc(min(72%,480px) + var(--sl-safe-b));padding-bottom:var(--sl-safe-b);
116
+ overflow:hidden;transition:height .3s cubic-bezier(.2,.8,.2,1);overscroll-behavior:contain}
117
+ .sl-picker[data-layout="narrow"][data-sheet="open"][data-has-selection="false"] .sl-side{height:calc(min(380px,64%) + var(--sl-safe-b))}
101
118
  /* With the price list expanded the sheet takes the with-selection height so
102
119
  the tray (cart + best-seats) is never crushed under the fixed-size list. */
103
- .sl-picker[data-layout="narrow"][data-sheet="open"][data-prices-open="true"] .sl-side{height:min(480px,74%)}
104
- .sl-picker[data-layout="narrow"][data-sheet="peek"] .sl-side{height:76px;overflow:hidden}
120
+ .sl-picker[data-layout="narrow"][data-sheet="open"][data-prices-open="true"] .sl-side{height:calc(min(480px,74%) + var(--sl-safe-b))}
121
+ .sl-picker[data-layout="narrow"][data-sheet="peek"] .sl-side{height:calc(76px + var(--sl-safe-b));overflow:hidden}
105
122
  .sl-picker[data-layout="narrow"][data-sheet="peek"] .sl-side > :not(.sl-sheet-head){display:none}
106
123
  .sl-picker[data-layout="narrow"] .sl-tray{flex:1;min-height:96px;overflow-y:auto;overscroll-behavior:contain}
107
124
  .sl-picker[data-layout="narrow"][data-prices-open="true"] .sl-tray{min-height:48px}
@@ -146,9 +163,56 @@ import{a as P,b as z,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerContro
146
163
  in-flight busy states, which legitimately show with a non-empty cart \u2014 those
147
164
  set data-ba-active="true" (see setAttribute alongside data-has-selection). */
148
165
  .sl-picker[data-layout="narrow"][data-has-selection="true"]:not([data-ba-active="true"]) .sl-ba{display:none}
149
- /* touch chrome: pinch-zoom exists \u2014 hide +/\u2212 on the sheet layout (keep fit) */
150
- .sl-picker[data-layout="narrow"] .sl-zoom [data-ref="zin"],
166
+ /* Touch chrome: pinch exists, so zoom IN is a gesture and the + button is
167
+ noise. Zoom OUT is not the same case \u2014 pinching outwards repeatedly is the
168
+ fiddliest gesture on a phone, and it is the one a buyer reaches for when
169
+ they are lost. So \u2212 comes back, but only once they are deep enough to BE
170
+ lost (data-zoomed, set from the seats rung), and never +. */
171
+ .sl-picker[data-layout="narrow"] .sl-zoom [data-ref="zin"]{display:none}
151
172
  .sl-picker[data-layout="narrow"] .sl-zoom [data-ref="zout"]{display:none}
173
+ .sl-picker[data-layout="narrow"][data-zoomed="true"] .sl-zoom [data-ref="zout"]{display:inline-flex}
174
+
175
+ /* THE PRICE RAIL \u2014 the phone's legend, and the only one it gets by default.
176
+ On narrow the price LIST lives behind two gates (open the sheet, then open
177
+ the disclosure), so a buyer looking at five colours had nothing on screen
178
+ telling them what any of them costs. The list is still the detail view: it
179
+ carries "N left", offer names and the held/sold key, none of which fit a
180
+ chip. The rail carries the one thing that must never be a tap away \u2014 colour
181
+ to price.
182
+
183
+ Price-first and name-dropped on purpose: the category name is already
184
+ painted on the map, and a phone buyer is matching a colour to a number.
185
+ Chips scroll rather than truncate \u2014 a legend that hides a ticket type is
186
+ worse than one that has to be swiped. */
187
+ .sl-rail{display:none;align-items:center;gap:7px;padding:7px 10px;flex:none;
188
+ background:var(--sl-surface);border-bottom:1px solid var(--sl-line)}
189
+ .sl-picker[data-layout="narrow"] .sl-rail.has{display:flex}
190
+ /* 3D frames itself; focusCategory drives the 2D map, so the rail has nothing
191
+ to act on there \u2014 and the 3D nav wants this strip. */
192
+ .sl-picker[data-view3d="on"] .sl-rail{display:none!important}
193
+ /* The accessibility chips are pinned OUTSIDE the scroller: they are the one
194
+ control that must never be discoverable-only-by-swipe. */
195
+ .sl-picker[data-layout="narrow"] .sl-rail .sl-chips{flex:none;display:flex;gap:6px;
196
+ padding-right:7px;margin-right:1px;border-right:1px solid var(--sl-line)}
197
+ .sl-rail-scroll{display:flex;align-items:center;gap:6px;flex:1;min-width:0;
198
+ overflow-x:auto;overflow-y:hidden;scrollbar-width:none;-webkit-overflow-scrolling:touch;
199
+ scroll-snap-type:x proximity;padding:1px}
200
+ .sl-rail-scroll::-webkit-scrollbar{display:none}
201
+ .sl-rc{display:inline-flex;align-items:center;gap:6px;flex:none;min-height:34px;padding:7px 11px;
202
+ border-radius:999px;background:var(--sl-bg);border:1px solid var(--sl-line);color:var(--sl-text);
203
+ font-size:12px;font-weight:800;font-variant-numeric:tabular-nums;white-space:nowrap;
204
+ scroll-snap-align:start;transition:border-color .15s,background .15s}
205
+ .sl-rc:hover,.sl-rc:focus-visible{border-color:var(--sl-muted)}
206
+ .sl-rc-dot{width:9px;height:9px;border-radius:50%;flex:none}
207
+ .sl-rc-was{color:var(--sl-muted);font-weight:500;text-decoration:line-through}
208
+ /* Pinned = this category is framed on the map. The state lives on the control
209
+ the buyer used, so there is never a second place to go and clear it. */
210
+ .sl-rc[aria-pressed="true"]{background:var(--sl-accent);color:var(--sl-accent-ink);border-color:transparent}
211
+ .sl-rc[aria-pressed="true"] .sl-rc-was{color:color-mix(in srgb,var(--sl-accent-ink) 55%,transparent)}
212
+ /* Sold out stays on the rail, struck through. A missing chip reads as a
213
+ mystery ("was there a cheaper one?"); a struck one answers it. */
214
+ .sl-rc:disabled{opacity:.45;cursor:default}
215
+ .sl-rc:disabled .sl-rc-t{text-decoration:line-through}
152
216
 
153
217
  /* bottom-sheet head: grab handle + one-line summary (narrow only). The WHOLE
154
218
  head is the tap/swipe toggle target (min 44px), so it reads as one control. */
@@ -171,6 +235,12 @@ import{a as P,b as z,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerContro
171
235
  .sl-sheet-peek .go{margin-left:auto;flex:none;display:inline-flex;align-items:center;min-height:30px;
172
236
  padding:6px 13px;border-radius:999px;background:var(--sl-accent);color:var(--sl-accent-ink);
173
237
  font-weight:800;font-size:12.5px}
238
+ /* The add-more accelerator sits beside the primary pill and must not compete
239
+ with it: outlined, not filled. Only the first .go claims the auto margin, so
240
+ the pair stays together at the right edge rather than splitting apart. */
241
+ .sl-sheet-peek .go.ghost{background:transparent;color:var(--sl-text);border:1px solid var(--sl-line);font-weight:750}
242
+ .sl-sheet-peek .go.ghost:hover,.sl-sheet-peek .go.ghost:focus-visible{border-color:var(--sl-accent);color:var(--sl-accent-text)}
243
+ .sl-sheet-peek .go.ghost + .go{margin-left:0}
174
244
  /* state chevron: points UP while peeking, rotates to point DOWN when open.
175
245
  Base keeps an explicit rotate(0) \u2014 transitioning to/from a bare 'none' leaves
176
246
  the value stuck in some engines, so both endpoints must be real transforms. */
@@ -182,19 +252,15 @@ import{a as P,b as z,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerContro
182
252
  .sl-sheet-toggle svg{transform:rotate(0deg);transition:transform .24s cubic-bezier(.2,.8,.2,1)}
183
253
  .sl-picker[data-sheet="open"] .sl-sheet-toggle svg{transform:rotate(180deg)}
184
254
 
185
- /* consolidated Filters row inside the sheet (a11y chips + colorblind toggle
186
- dock here on narrow; they live on the map / zoom column on wide) */
255
+ /* The sheet's consolidated Filters row is RETIRED. It existed to give the a11y
256
+ chips a home on narrow, and the price rail is a better one: always in view,
257
+ on picker surface rather than canvas, and never behind the swipe that opens
258
+ the sheet. A buyer who needs a wheelchair place must not have to discover a
259
+ bottom sheet before they can ask for one. The elements stay in the skeleton
260
+ (the wide layout still routes through the same dock) but nothing sets the
261
+ has class any more, so they never paint. */
187
262
  .sl-filtersec{display:none}
188
263
  .sl-filters{display:none;gap:6px;flex-wrap:wrap;align-items:center;padding:2px 16px 10px}
189
- .sl-picker[data-layout="narrow"] .sl-filtersec.has,
190
- .sl-picker[data-layout="narrow"] .sl-filters.has{display:none}
191
- .sl-picker[data-layout="narrow"][data-has-selection="true"] .sl-filtersec.has,
192
- .sl-picker[data-layout="narrow"][data-has-selection="true"] .sl-filters.has{display:none}
193
- /* Accessibility and colour-safety controls must remain reachable on phones.
194
- Keep them out of the collapsed peek, then reveal their consolidated row whenever
195
- the buyer explicitly opens the ticket panel. */
196
- .sl-picker[data-layout="narrow"][data-sheet="open"] .sl-filtersec.has{display:block!important}
197
- .sl-picker[data-layout="narrow"][data-sheet="open"] .sl-filters.has{display:flex!important}
198
264
  /* The price list is the mobile buyer's ONLY legend \u2014 colour \u2192 ticket type \u2192
199
265
  price \u2192 how many are left. Hiding it in the peek state is right (map-first);
200
266
  never restoring it forced phone buyers to tap dots to learn prices. The OPEN
@@ -393,7 +459,12 @@ import{a as P,b as z,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerContro
393
459
  .sl-zoom{display:flex;flex-direction:column;gap:6px}
394
460
  /* CSS-fallback full screen (iOS Safari has no element fullscreen API) */
395
461
  .sl-picker.sl-fs{position:fixed;inset:0;z-index:2147483000;width:auto;height:auto;max-height:none;border-radius:0}
396
- .sl-zoom button{width:36px;height:36px;border-radius:999px;background:var(--sl-surface);border:1px solid var(--sl-line);
462
+ /* Glass, not solid: these float over the canvas, and an opaque disc parked on
463
+ a section name hides inventory. The blur keeps the glyph readable without
464
+ taking the label underneath away. */
465
+ .sl-zoom button{width:36px;height:36px;border-radius:999px;
466
+ background:color-mix(in srgb,var(--sl-surface) 72%,transparent);backdrop-filter:blur(8px);
467
+ border:1px solid color-mix(in srgb,var(--sl-line) 80%,transparent);
397
468
  color:var(--sl-text);font-size:17px;font-weight:700;display:flex;align-items:center;justify-content:center;transition:border-color .15s}
398
469
  .sl-zoom button:hover{border-color:var(--sl-muted)}
399
470
  .sl-zoom svg{width:14px;height:14px;stroke:currentColor;stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round}
@@ -409,16 +480,11 @@ import{a as P,b as z,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerContro
409
480
  .sl-fs-pill.sl-fs-pill:hover{border-color:var(--sl-muted)}
410
481
  .sl-fs-pill svg{width:14px;height:14px;stroke:currentColor;stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round}
411
482
  .sl-fs-pill .sl-zfs-lbl{display:inline;letter-spacing:.02em;white-space:nowrap}
412
- /* In the header, icons carry it (owner call): square Full screen glyph, and
413
- on narrow a price-tag toggle that opens the sheet with the list expanded. */
483
+ /* In the header, icons carry it (owner call): square Full screen glyph. The
484
+ price-tag toggle beside it is gone \u2014 it existed only to reach a legend the
485
+ narrow layout had hidden, and the rail is that legend now, already in view. */
414
486
  .sl-head .sl-fs-pill{min-height:34px;min-width:34px;width:34px;padding:0;flex:none}
415
487
  .sl-head .sl-fs-pill .sl-zfs-lbl{display:none}
416
- .sl-prices-btn{display:none;align-items:center;justify-content:center;width:34px;min-height:34px;flex:none;
417
- border-radius:999px;background:var(--sl-surface);border:1px solid var(--sl-line);color:var(--sl-text);transition:border-color .15s}
418
- .sl-prices-btn:hover{border-color:var(--sl-muted)}
419
- .sl-prices-btn svg{width:15px;height:15px;stroke:currentColor;stroke-width:1.8;fill:none;stroke-linecap:round;stroke-linejoin:round}
420
- .sl-prices-btn[aria-pressed="true"]{background:var(--sl-accent);color:var(--sl-accent-ink);border-color:transparent}
421
- .sl-picker[data-layout="narrow"] .sl-prices-btn{display:inline-flex}
422
488
 
423
489
  /* toast + boot states (toast flows in the bottom-center region) */
424
490
  .sl-toast{transform:translateY(6px) scale(.98);max-width:100%;
@@ -744,8 +810,15 @@ import{a as P,b as z,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerContro
744
810
  color:var(--sl-muted);white-space:nowrap;transition:color .15s}
745
811
  .sl-rungs button:hover{color:var(--sl-text)}
746
812
  .sl-rungs button.on{background:var(--sl-accent);color:var(--sl-accent-ink)}
747
- /* narrow: shrink the rung pills so the centered row can't reach the corner regions */
748
- .sl-picker[data-layout="narrow"] .sl-rungs button{padding:5px 9px;font-size:9px;letter-spacing:.03em}
813
+ /* NO RUNG PILLS ON A PHONE. They are a mirror of the zoom level, not the way
814
+ to change it \u2014 pinching moves between zones/sections/seats on its own, and
815
+ tapping a section glides you in. Measured on a 390px phone: 183px of pills
816
+ plus the 86px Map/3D toggle covered 269px of the map's own top edge to
817
+ restate what the finger had already done. The one thing they were genuinely
818
+ good for \u2014 getting back out from deep zoom \u2014 is now the zoom-out stepper and
819
+ the overview that reveals itself there. Wide keeps them: a mouse has no
820
+ pinch, and the space is free. */
821
+ .sl-picker[data-layout="narrow"] .sl-rungs{display:none!important}
749
822
 
750
823
  /* Projection is deliberately a separate control from zoom/LOD. Perspective
751
824
  changes geometry; the two choices stay explicit and keyboard-native. */
@@ -1014,10 +1087,21 @@ import{a as P,b as z,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerContro
1014
1087
  .sl-seccard.mini.on{display:inline-flex;align-items:center;gap:7px}
1015
1088
  .sl-seccard.mini .sl-seccard-name{font-size:12px;flex:none;max-width:120px}
1016
1089
  .sl-seccard.mini .sl-seccard-left{font-size:11px}
1017
- /* narrow: compact strip inside the sheet head (peek area) */
1018
- .sl-seccard.strip{width:100%;padding:7px 0 0;border:0;border-radius:0;box-shadow:none;background:none;cursor:default}
1090
+ /* narrow: the LOCATOR \u2014 pinned to the map's own bottom edge.
1091
+ It used to dock into the sheet head, which put it on the same edge as the
1092
+ cart; the fix for that collision was to delete it once the cart filled, which
1093
+ took the answer away from the buyer most likely to want it. On the map it
1094
+ competes with nothing and never has to be suppressed. */
1095
+ .sl-seccard.strip{position:absolute;left:50%;transform:translateX(-50%);bottom:12px;z-index:6;
1096
+ width:auto;max-width:calc(100% - 24px);padding:6px 8px 6px 12px;border-radius:999px;
1097
+ border:1px solid var(--sl-line);background:var(--sl-surface);
1098
+ box-shadow:0 12px 30px -12px rgba(0,0,0,.55);cursor:default}
1019
1099
  .sl-seccard.strip.on{display:flex;align-items:center;gap:7px;font-size:12.5px}
1020
- .sl-seccard.strip .sl-seccard-name{font-size:12.5px}
1100
+ .sl-seccard.strip .sl-seccard-name{font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
1101
+ /* The confirm card is bottom-anchored on narrow and owns this edge while it is
1102
+ open; 3D has no 2D section context to report. */
1103
+ .sl-picker[data-layout="narrow"][data-confirming="true"] .sl-seccard.strip,
1104
+ .sl-picker[data-view3d="on"] .sl-seccard.strip{display:none}
1021
1105
  .sl-seccard.strip .sl-seccard-price{margin-left:auto}
1022
1106
  .sl-seccard-head{display:flex;align-items:center;gap:8px}
1023
1107
  .sl-seccard-dot{width:10px;height:10px;border-radius:50%;flex:none}
@@ -1107,15 +1191,27 @@ import{a as P,b as z,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerContro
1107
1191
  .sl-minimap canvas{display:block}
1108
1192
  .sl-minimap canvas:focus-visible{outline:2px solid var(--sl-accent);outline-offset:-3px}
1109
1193
  .sl-minimap canvas.sl-dragging{cursor:grabbing}
1110
- .sl-minimap-toggle{display:none;width:42px;height:42px;border:1px solid var(--sl-line);border-radius:10px;background:var(--sl-surface);
1194
+ .sl-minimap-toggle{display:none;width:42px;height:42px;border-radius:10px;
1195
+ border:1px solid color-mix(in srgb,var(--sl-line) 80%,transparent);
1196
+ background:color-mix(in srgb,var(--sl-surface) 72%,transparent);backdrop-filter:blur(8px);
1111
1197
  color:var(--sl-text);box-shadow:0 10px 28px -14px rgba(0,0,0,.65);align-items:center;justify-content:center}
1112
1198
  .sl-minimap-toggle svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round}
1199
+ /* ON A PHONE THE OVERVIEW IS A PEEK, NOT A PANEL.
1200
+ It was 42vw of canvas \u2014 ~164px of a 390px screen \u2014 and most of that was not
1201
+ map: a title bar reading "MAIN \xB7 ARENA A", a four-dot state key, and a close
1202
+ button. The title duplicated the locator strip sitting beside it, the key
1203
+ explained states the thumbnail already shows, and the close duplicated the
1204
+ toggle that opened it. All three go on narrow, the thumbnail shrinks, and
1205
+ what is left is the one thing worth the space: where you are looking. */
1113
1206
  .sl-picker[data-layout="narrow"] .sl-minimap{display:none}
1114
1207
  .sl-picker[data-layout="narrow"] .sl-minimap-toggle{display:flex}
1115
1208
  .sl-picker[data-layout="narrow"][data-minimap-open="true"] .sl-minimap{display:block}
1116
- .sl-picker[data-layout="narrow"][data-minimap-open="true"] .sl-minimap-toggle{display:none}
1117
- .sl-picker[data-layout="narrow"] .sl-minimap canvas{width:min(168px,42vw)!important;height:auto!important}
1118
- .sl-picker[data-layout="narrow"] .sl-minimap-close{display:grid;place-items:center}
1209
+ .sl-picker[data-layout="narrow"] .sl-minimap-bar{display:none}
1210
+ .sl-picker[data-layout="narrow"] .sl-minimap canvas{width:min(112px,30vw)!important;height:auto!important}
1211
+ /* The toggle STAYS while open and becomes the way out \u2014 one control for both
1212
+ directions, which is why the panel no longer needs its own \u2715. */
1213
+ .sl-picker[data-layout="narrow"][data-minimap-open="true"] .sl-minimap-toggle{display:flex;
1214
+ border-color:var(--sl-accent);color:var(--sl-accent-text)}
1119
1215
 
1120
1216
  /* F4 legend reflection: rows + counts for out-of-band categories read muted */
1121
1217
  /* Out-of-band rows are exactly the rows a buyer reads while deciding whether
@@ -1173,7 +1269,7 @@ import{a as P,b as z,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerContro
1173
1269
  corners, and it is the frame. */
1174
1270
  .sl-modal-frame > .sl-picker{border-radius:0}
1175
1271
  @media(max-width:640px){.sl-modal-scrim{padding:0}.sl-modal-frame{width:100%;height:100%;border-radius:0}}
1176
- `;function Oe(){if(document.getElementById(at))return;let a=document.createElement("style");a.id=at,a.textContent=bi,document.head.appendChild(a)}import{relativeLuminance255 as vi,rgb255ToHex as gi}from"@seatlayer/core/core/color";function W(a){if(!a)return null;let e=a.trim().toLowerCase();if(e==="white")return{r:255,g:255,b:255};if(e==="black")return{r:0,g:0,b:0};let t=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(e)?.[1];if(t){let s=t.length<=4?[...t].map(n=>`${n}${n}`).join(""):t;return{r:Number.parseInt(s.slice(0,2),16),g:Number.parseInt(s.slice(2,4),16),b:Number.parseInt(s.slice(4,6),16)}}let i=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*[\d.]+%?)?\s*\)$/i.exec(e);return i?{r:Math.max(0,Math.min(255,Number(i[1]))),g:Math.max(0,Math.min(255,Number(i[2]))),b:Math.max(0,Math.min(255,Number(i[3])))}:null}function ye(a){return vi([a.r,a.g,a.b])}function N(a,e){let t=W(a),i=W(e);if(!t||!i)return null;let s=Math.max(ye(t),ye(i)),n=Math.min(ye(t),ye(i));return(s+.05)/(n+.05)}function he(a,e="#172033",t="#eef1f8"){return(N(e,a)??0)>=(N(t,a)??0)?e:t}function yi(a){return gi(a.r,a.g,a.b)}function Ie(a,e,t){let i=W(a),s=W(e);if(!i||!s)return null;let n=Math.max(0,Math.min(1,t));return yi({r:i.r*n+s.r*(1-n),g:i.g*n+s.g*(1-n),b:i.b*n+s.b*(1-n)})}function xi(a,e,t,i){if((N(a,t)??4.5)>=4.5&&(N(a,i)??4.5)>=4.5)return a;if(!W(a)||!W(e))return e;for(let s=.15;s<=1;s+=.05){let n=Ie(a,e,1-s);if(n&&(N(n,t)??0)>=4.5&&(N(n,i)??0)>=4.5)return n}return e}function xe(a,e){let t=e?.background??a?.background??"#0f1522",i=W(t)?he(t)==="#172033":!1,s=e?.surface??(i?"#ffffff":"#1a2234"),n=e?.accent??a?.accent??"#f4b740",r=a?.accentInk,o=e?.accentInk??(r&&(N(r,n)??4.5)>=4.5?r:he(n,"#1a1200","#ffffff")),l=a?.textColor,d=e?.text??(l&&(N(l,t)??4.5)>=4.5&&(N(l,s)??4.5)>=4.5?l:he(t));return{"--sl-accent":n,"--sl-accent-ink":o,"--sl-accent-text":xi(n,d,t,s),"--sl-bg":t,"--sl-surface":s,"--sl-text":d,"--sl-muted":e?.muted??(i?"#667085":"#a5aec2"),"--sl-line":e?.line??(i?"rgba(23,32,51,.16)":"rgba(165,174,194,.24)"),"--sl-font":e?.fontFamily??a?.fontFamily??"-apple-system,BlinkMacSystemFont,'Segoe UI',Inter,sans-serif","--sl-radius":`${e?.radius??14}px`}}function lt(a,e,t){let i=document.createElement("div");i.className="sl-picker",i.tabIndex=-1,a.appendChild(i),Object.entries(xe(void 0,t)).forEach(([n,r])=>i.style.setProperty(n,r)),i.innerHTML=`
1272
+ `;function Oe(){if(document.getElementById(dt))return;let o=document.createElement("style");o.id=dt,o.textContent=ki,document.head.appendChild(o)}import{relativeLuminance255 as Si,rgb255ToHex as Ti}from"@seatlayer/core/core/color";function W(o){if(!o)return null;let e=o.trim().toLowerCase();if(e==="white")return{r:255,g:255,b:255};if(e==="black")return{r:0,g:0,b:0};let t=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(e)?.[1];if(t){let s=t.length<=4?[...t].map(r=>`${r}${r}`).join(""):t;return{r:Number.parseInt(s.slice(0,2),16),g:Number.parseInt(s.slice(2,4),16),b:Number.parseInt(s.slice(4,6),16)}}let i=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*[\d.]+%?)?\s*\)$/i.exec(e);return i?{r:Math.max(0,Math.min(255,Number(i[1]))),g:Math.max(0,Math.min(255,Number(i[2]))),b:Math.max(0,Math.min(255,Number(i[3])))}:null}function ye(o){return Si([o.r,o.g,o.b])}function N(o,e){let t=W(o),i=W(e);if(!t||!i)return null;let s=Math.max(ye(t),ye(i)),r=Math.min(ye(t),ye(i));return(s+.05)/(r+.05)}function he(o,e="#172033",t="#eef1f8"){return(N(e,o)??0)>=(N(t,o)??0)?e:t}function Ci(o){return Ti(o.r,o.g,o.b)}function Ie(o,e,t){let i=W(o),s=W(e);if(!i||!s)return null;let r=Math.max(0,Math.min(1,t));return Ci({r:i.r*r+s.r*(1-r),g:i.g*r+s.g*(1-r),b:i.b*r+s.b*(1-r)})}function Ei(o,e,t,i){if((N(o,t)??4.5)>=4.5&&(N(o,i)??4.5)>=4.5)return o;if(!W(o)||!W(e))return e;for(let s=.15;s<=1;s+=.05){let r=Ie(o,e,1-s);if(r&&(N(r,t)??0)>=4.5&&(N(r,i)??0)>=4.5)return r}return e}function xe(o,e){let t=e?.background??o?.background??"#0f1522",i=W(t)?he(t)==="#172033":!1,s=e?.surface??(i?"#ffffff":"#1a2234"),r=e?.accent??o?.accent??"#f4b740",n=o?.accentInk,a=e?.accentInk??(n&&(N(n,r)??4.5)>=4.5?n:he(r,"#1a1200","#ffffff")),l=o?.textColor,c=e?.text??(l&&(N(l,t)??4.5)>=4.5&&(N(l,s)??4.5)>=4.5?l:he(t));return{"--sl-accent":r,"--sl-accent-ink":a,"--sl-accent-text":Ei(r,c,t,s),"--sl-bg":t,"--sl-surface":s,"--sl-text":c,"--sl-muted":e?.muted??(i?"#667085":"#a5aec2"),"--sl-line":e?.line??(i?"rgba(23,32,51,.16)":"rgba(165,174,194,.24)"),"--sl-font":e?.fontFamily??o?.fontFamily??"-apple-system,BlinkMacSystemFont,'Segoe UI',Inter,sans-serif","--sl-radius":`${e?.radius??14}px`}}function pt(o,e,t){let i=document.createElement("div");i.className="sl-picker",i.tabIndex=-1,o.appendChild(i),Object.entries(xe(void 0,t)).forEach(([r,n])=>i.style.setProperty(r,n)),i.innerHTML=`
1177
1273
  <div class="sl-head">
1178
1274
  <div class="sl-logo" data-ref="logo"></div>
1179
1275
  <div class="sl-head-info" data-ref="headInfo">
@@ -1189,6 +1285,9 @@ import{a as P,b as z,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerContro
1189
1285
  <svg viewBox="0 0 24 24"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
1190
1286
  </button>
1191
1287
  </div>
1288
+ <div class="sl-rail" data-ref="rail" role="group" aria-label="${e("picker.ticketPrices","Ticket prices")}">
1289
+ <div class="sl-rail-scroll" data-ref="railScroll"></div>
1290
+ </div>
1192
1291
  <div class="sl-body">
1193
1292
  <div class="sl-map">
1194
1293
  <div class="sl-map-host" data-ref="map"></div>
@@ -1244,4 +1343,4 @@ import{a as P,b as z,c as R,d as F}from"./chunk-OSZ7DOEH.js";import{PickerContro
1244
1343
  <button type="button" class="sl-cta" data-ref="cta" disabled></button>
1245
1344
  </div>
1246
1345
  </div>
1247
- </div>`;let s={};return i.querySelectorAll("[data-ref]").forEach(n=>{s[n.dataset.ref]=n}),{root:i,mapHost:s.map,els:s}}import{browserPanoramaConstraints as wi,loadPanoramaImage as ki,planPanoramaDelivery as Si,schedulePanoramaUpgrade as Ti}from"@seatlayer/core/view/panoramaDelivery";function ct(a){let{root:e,source:t,caption:i,real:s,closeLabel:n,dragHint:r,viewFromSeatLabel:o,real360Label:l,previewLabel:d,resolveAsset:h,onClose:p}=a,c=document.createElement("div");c.className="sl-view",c.setAttribute("role","dialog"),c.setAttribute("aria-label",o),c.innerHTML=`<div class="sl-view-head"><span class="sl-view-title">${o}</span><span class="sl-view-cap">${i}</span><button type="button" class="sl-view-x" aria-label="${n}"><svg viewBox="0 0 24 24"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button></div><div class="sl-view-pano"><span class="sl-view-badge">${s?l:d}</span><span class="sl-view-hint">${r}</span></div>`,e.appendChild(c);let f=c.querySelector(".sl-view-pano"),m=Si(t,wi()),v=new AbortController;f.style.backgroundImage=`url("${m.initialUrl}")`;let w=()=>{};m.upgradeUrl&&(w=Ti(()=>{h(m.upgradeUrl).then(H=>!H||v.signal.aborted?null:ki(H,v.signal).then(()=>H)).then(H=>{!H||!c.isConnected||v.signal.aborted||(f.style.backgroundImage=`url("${H}")`)}).catch(()=>{})}));let k=70,x=35,g=1,C=f.clientHeight||1,u=f.clientWidth||1,b=-(C*(180/k)*2/2-u/2),T=0,E=()=>{let H=f.clientHeight||1,Ee=H*(180/k)*g,Ge=Math.max(0,Ee-H),Ye=Math.min(Ge/2,x/180*Ee);T=Math.min(Ye,Math.max(-Ye,T)),f.style.backgroundSize=`auto ${Ee}px`,f.style.backgroundPosition=`${b}px ${T-Ge/2}px`};E();let M=!1,A=0,L=0,D=H=>{M=!0,A=H.clientX,L=H.clientY,f.classList.add("drag"),f.setPointerCapture?.(H.pointerId)},se=H=>{M&&(b+=H.clientX-A,T+=H.clientY-L,A=H.clientX,L=H.clientY,E())},me=H=>{M=!1,f.classList.remove("drag"),f.releasePointerCapture?.(H.pointerId)},Ke=H=>{H.preventDefault(),g=Math.min(2.4,Math.max(1,g+(H.deltaY<0?.12:-.12))),E()};f.addEventListener("pointerdown",D),f.addEventListener("pointermove",se),f.addEventListener("pointerup",me),f.addEventListener("pointercancel",me),f.addEventListener("wheel",Ke,{passive:!1});let Ce=c.querySelector(".sl-view-x");Ce.addEventListener("click",p);let We=H=>{H.key==="Escape"&&(H.stopPropagation(),p())};return c.addEventListener("keydown",We),Ce.focus(),{element:c,dispose(){w(),v.abort(),f.removeEventListener("pointerdown",D),f.removeEventListener("pointermove",se),f.removeEventListener("pointerup",me),f.removeEventListener("pointercancel",me),f.removeEventListener("wheel",Ke),c.removeEventListener("keydown",We),Ce.removeEventListener("click",p)}}}import{seatConfidenceDisclosure as Ai}from"@seatlayer/core/core/seatConfidence";import{t as Ci}from"@seatlayer/core";function S(a,e){let t=Ci(a);return t===a?e:t}function dt(a){if(typeof a=="string"){let e=document.querySelector(a);if(!e)throw new Error(`seatmap: container "${a}" not found`);return e}if(!(a instanceof HTMLElement))throw new Error("seatmap: container must be a CSS selector or an HTMLElement");return a}function O(a){return String(a??"").replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}var Ei=(()=>{if(typeof document<"u"&&document.currentScript instanceof HTMLScriptElement&&document.currentScript.src)return document.currentScript.src;try{let a=import.meta.url;if(typeof a=="string"&&a)return a}catch{}})(),te=null;function pt(){if(te!==null)return te;try{if(typeof document>"u")return te=!1;te=!!document.createElement("canvas").getContext("webgl2")}catch{te=!1}return te}function $e(a){let e=Ei??(typeof location<"u"?location.href:void 0);if(!e)throw new Error(`seatlayer: cannot resolve the ${a} chunk URL`);return new URL(`./${a}`,e).href}async function ht(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import($e("seatlayer-view3d.mjs")):import("@seatlayer/core/view3d")}async function ut(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import($e("seatlayer-panorama.mjs")):import("@seatlayer/core")}async function mt(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import($e("seatlayer-checkout.mjs")):import("./hostedCheckout-3Y24DB65.js")}function ft(a){return a==="unavailable_for_event"||a==="payments_off_for_event"?a:"not_configured"}function we(a,e,t){let i={month:"short",day:"numeric",hour:"numeric",minute:"2-digit"},s=new Date(a);if(e)try{return s.toLocaleString(t,{...i,timeZone:e})}catch{}return s.toLocaleString(t,i)}function j(a){return String(a??"").replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[e])}function ie(a){return a?.restrictedView?S("picker.restrictedView","Restricted view"):a?.obstructedView?S("picker.obstructedView","Obstructed view"):""}function bt(a){if(!a)return"";let e=[];a.premium&&e.push(`<div class="sl-cx-premium"><span class="sl-cx-star" aria-hidden="true">\u2605</span>${S("picker.premiumSeat","Premium seat")}</div>`);let t=ie(a);return t?e.push(`<div class="sl-cx-warn"><span class="sl-cx-glyph" aria-hidden="true">\u25D0</span><span class="sl-cx-txt"><b>${t}</b>${a.note?`<span class="sl-cx-note">${j(a.note)}</span>`:""}</span></div>`):a.note&&e.push(`<div class="sl-cx-warn"><span class="sl-cx-glyph" aria-hidden="true">\u2139</span><span class="sl-cx-txt"><span class="sl-cx-note">${j(a.note)}</span></span></div>`),e.length?`<div class="sl-cx">${e.join("")}</div>`:""}function Be(a){let e=ie(a);if(!e)return"";let t=j(a?.note?a.note:e);return`<span class="sl-cx-mark" role="img" aria-label="${t}" title="${t}">\u25D0</span>`}function ue(a){return a==="no-seat"?S("picker.emptyWheelchairSpace","Empty wheelchair space"):a==="seat-present"?S("picker.accessiblePhysicalSeat","Accessible physical seat"):""}function vt(a){let e=ue(a);return e?`<div class="sl-cx"><div class="sl-cx-warn"><span class="sl-cx-glyph" aria-hidden="true">\u267F</span><span class="sl-cx-txt"><b>${e}</b></span></div></div>`:""}function ze(a){let e=ue(a);return e?`<span class="sl-cx-mark" role="img" aria-label="${e}" title="${e}">\u267F</span>`:""}function De(a,e){if(!a)return"";let t=e?S("picker.viewFromThisSeat","View from this seat"):S("picker.seeItIn3d","See it in 3D");return`<button type="button" class="sl-confirm-3d" aria-label="${t}"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2l9 5v10l-9 5-9-5V7z"/><path d="M12 12l9-5M12 12v10M12 12L3 7"/></svg><span>${t}</span></button>`}function gt(a){if(!a)return"";let e=a.previous.label||a.previous.id,t=a.next.label||a.next.id;return`<span class="sl-seccard-nav" aria-label="${S("picker.browseSections","Browse sections")}"><button type="button" data-section-nav="${O(a.previous.id)}" aria-label="${S("picker.previousSection","Previous section")}: ${O(e)}" title="${O(e)}">\u2190</button><button type="button" data-section-nav="${O(a.next.id)}" aria-label="${S("picker.nextSection","Next section")}: ${O(t)}" title="${O(t)}">\u2192</button></span>`}function yt(a,e){if(!e)return"";let t=e,i=t.includes(a.id),s=i?t.length>1?S("picker.openComparison","Open comparison"):S("picker.savedForComparison","Saved for comparison"):t.length?S("picker.compareWithSaved","Compare with saved"):S("picker.saveToCompare","Save to compare");return`<button type="button" class="sl-confirm-compare"${i&&t.length===1?" disabled":""}><span aria-hidden="true">\u21C4</span><span>${j(s)}</span></button>`}function xt(a,e,t){if(!t)return"";let i=Ai(a.confidenceEvidence),s=i.modeledTarget??i.reality;return`<button type="button" class="sl-confirm-confidence" aria-label="Open seat confidence passport for ${j(a.displayLabel??a.label)}"><span><em>${j(e)}</em><strong>${j(i.headline)}</strong><small>${j(s)}</small></span><b>Passport</b></button>`}function G(a){let e=a?.rowLabel,t=a?.sectionLabel;if(!e||!t)return e;for(let i of["-"," ","\xB7","/","_"]){let s=`${t}${i}`;if(e.startsWith(s)&&e.length>s.length)return e.slice(s.length)}return e}import{pointInPolygon as Li}from"@seatlayer/core";import{createMinimapTransform as Pi,minimapPointToWorld as Mi,minimapViewportPlan as Hi}from"@seatlayer/core/picker/minimapGeometry";function wt(a,e){let t=new Fe(a);return t.build(e),t}var Fe=class{constructor(e){this.host=e;this.miniCanvas=null;this.miniBase=null;this.miniWrap=null;this.miniToggle=null;this.miniLabel=null;this.miniTf=null;this.miniDrag=null;this.miniSuppressClick=!1}build(e){if(!this.host.controller.getViewport())return;let i=document.createElement("button");i.type="button",i.className="sl-minimap-toggle",i.setAttribute("aria-label",S("picker.openVenueMap","Open venue overview map")),i.setAttribute("aria-expanded","false"),i.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>',e.appendChild(i),this.miniToggle=i;let s=document.createElement("div");s.className="sl-minimap",s.setAttribute("role","group");let n=document.createElement("div");n.className="sl-minimap-bar";let r=document.createElement("span");r.className="sl-minimap-label";let o=document.createElement("span");o.className="sl-minimap-key",o.setAttribute("aria-label",S("picker.minimapStateKey","Focused, selected, available, and inactive sections")),o.innerHTML='<i class="focused" title="Focused"></i><i class="selected" title="Selected"></i><i title="Available"></i><i class="inactive" title="Inactive"></i>';let l=document.createElement("button");l.type="button",l.className="sl-minimap-close",l.setAttribute("aria-label",S("picker.closeVenueMap","Close venue overview map")),l.textContent="\xD7",n.append(r,o,l);let d=document.createElement("canvas");d.tabIndex=0,d.setAttribute("role","application"),d.setAttribute("aria-label",S("picker.venueMapInstructions","Venue overview map. Drag the viewport, click a section, or use arrow keys to pan.")),s.append(n,d),e.appendChild(s),this.miniWrap=s,this.miniLabel=r,this.miniCanvas=d;let h=document.createElement("canvas");this.miniBase=h,i.addEventListener("click",()=>this.setMinimapOpen(!0)),l.addEventListener("click",()=>this.setMinimapOpen(!1)),d.addEventListener("click",p=>{if(this.miniSuppressClick){this.miniSuppressClick=!1;return}this.minimapJump(p)}),d.addEventListener("pointerdown",p=>this.minimapPointerDown(p)),d.addEventListener("pointermove",p=>this.minimapPointerMove(p)),d.addEventListener("pointerup",p=>this.minimapPointerUp(p)),d.addEventListener("pointercancel",p=>this.minimapPointerUp(p)),d.addEventListener("keydown",p=>this.minimapKeydown(p)),this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect()}setMinimapOpen(e){this.host.root()?.setAttribute("data-minimap-open",String(e)),this.miniToggle?.setAttribute("aria-expanded",String(e)),e?this.miniCanvas?.focus():this.miniToggle?.focus()}layoutMinimap(){let e=this.miniCanvas,t=this.miniBase,i=this.host.controller.getViewport()?.bounds;if(!e||!t||!i||!(i.width>0&&i.height>0))return;let s=196,n=146,r=6,o=i.width/Math.max(1,i.height),l=s,d=Math.round(s/o);d>n&&(d=n,l=Math.round(n*o)),l=Math.max(64,l),d=Math.max(48,d);let h=Math.min(2,window.devicePixelRatio||1);e.width=Math.round(l*h),e.height=Math.round(d*h),e.style.width=`${l}px`,e.style.height=`${d}px`,t.width=e.width,t.height=e.height,this.miniTf=Pi(i,e.width,e.height,h,r)}syncMinimapLabel(){if(!this.miniLabel||!this.miniWrap)return;let e=this.host.controller.getFloors(),t=this.host.controller.isFloorOverview()?S("picker.allFloors","All floors"):e.find(h=>h.id===this.host.controller.getActiveFloorId())?.name??S("picker.venueOverview","Venue overview"),i=this.host.controller.getMinimapSnapshot().sections,n=i.find(h=>h.active)?.label??this.host.focusedSectionLabel(),r=n?`${t} \xB7 ${n}`:t;this.miniLabel.textContent=r;let o=i.filter(h=>h.state==="selected").length,l=i.filter(h=>h.state==="available").length,d=i.filter(h=>h.state==="inactive").length;this.miniWrap.setAttribute("aria-label",i.length?`${r}. ${o} selected, ${l} available, ${d} inactive sections.`:r),this.miniCanvas?.setAttribute("aria-label",i.length?`${r}. ${o} selected, ${l} available, ${d} inactive sections. ${S("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click a section, or use arrow keys to pan.")}`:`${r}. ${S("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 e=this.miniBase,t=this.miniTf;if(!e||!t)return;let i=e.getContext("2d");if(!i)return;i.clearRect(0,0,e.width,e.height);let s=p=>p*t.scale+t.offX,n=p=>p*t.scale+t.offY,r=this.host.cssVar("--sl-line")||"rgba(139,147,167,.5)",o=this.host.cssVar("--sl-muted")||"#8b93a7",l=this.host.cssVar("--sl-accent")||"#6e7bff",d=this.host.cssVar("--sl-success")||"#22a06b",h=this.host.controller.getMinimapSnapshot();for(let p of h.sections)p.outline.length<3||(i.beginPath(),p.outline.forEach((c,f)=>f===0?i.moveTo(s(c.x),n(c.y)):i.lineTo(s(c.x),n(c.y))),i.closePath(),i.globalAlpha=p.state==="inactive"?.18:p.state==="selected"?.72:.34,i.fillStyle=p.state==="inactive"?o:p.state==="selected"?l:d,i.fill(),i.globalAlpha=.82,i.lineWidth=Math.max(1,t.dpr),i.strokeStyle=r,i.stroke(),p.active&&(i.globalAlpha=1,i.lineJoin="round",i.lineWidth=Math.max(4,t.dpr*3.5),i.strokeStyle=this.host.cssVar("--sl-surface")||"#fff",i.stroke(),i.lineWidth=Math.max(2,t.dpr*1.75),i.strokeStyle=l,i.stroke()));if(i.globalAlpha=1,!h.sections.length){let p=Math.max(1,t.dpr);for(let c of h.seats)i.globalAlpha=c.state==="inactive"?.22:.78,i.fillStyle=c.state==="inactive"?o:c.state==="selected"?l:d,i.beginPath(),i.arc(s(c.x),n(c.y),p,0,Math.PI*2),i.fill();i.globalAlpha=1}}drawMinimapRect(){let e=this.miniCanvas,t=this.miniBase,i=this.miniTf;if(!e||!t||!i)return;let s=e.getContext("2d");if(!s)return;s.clearRect(0,0,e.width,e.height),s.drawImage(t,0,0);let n=this.host.controller.getViewport();if(!n)return;let r=Hi(n.visible,i,e.width,e.height,Math.max(2,i.dpr*2)),o=this.host.cssVar("--sl-text")||"#12151c",l=this.host.cssVar("--sl-surface")||"#fff";s.save(),s.globalAlpha=.1,s.fillStyle=o,s.fillRect(r.raw.x,r.raw.y,r.raw.width,r.raw.height),s.globalAlpha=.9,s.lineJoin="round",s.lineWidth=Math.max(4,i.dpr*3.25),s.strokeStyle=l,s.strokeRect(r.raw.x,r.raw.y,r.raw.width,r.raw.height),s.globalAlpha=1,s.lineWidth=Math.max(2,i.dpr*1.75),s.strokeStyle=o,s.strokeRect(r.raw.x,r.raw.y,r.raw.width,r.raw.height),r.clipped&&Object.values(r.clippedEdges).some(Boolean)&&(s.setLineDash([Math.max(3,i.dpr*3),Math.max(2,i.dpr*2)]),s.strokeRect(r.clipped.x,r.clipped.y,r.clipped.width,r.clipped.height)),s.restore()}minimapWorldPoint(e){let t=this.miniCanvas,i=this.miniTf;if(!t||!i)return null;let s=t.getBoundingClientRect(),n=(e.clientX-s.left)*(t.width/Math.max(1,s.width)),r=(e.clientY-s.top)*(t.height/Math.max(1,s.height));return{...Mi({x:n,y:r},i),px:n,py:r}}minimapPointerDown(e){let t=this.minimapWorldPoint(e),i=this.host.controller.getViewport()?.visible;!t||!i||!(t.x>=i.x&&t.x<=i.x+i.width&&t.y>=i.y&&t.y<=i.y+i.height)||(this.miniDrag={pointerId:e.pointerId,offsetX:t.x-(i.x+i.width/2),offsetY:t.y-(i.y+i.height/2),startX:e.clientX,startY:e.clientY,moved:!1},this.miniCanvas?.setPointerCapture(e.pointerId),this.miniCanvas?.classList.add("sl-dragging"),e.preventDefault())}minimapPointerMove(e){let t=this.miniDrag;if(!t||t.pointerId!==e.pointerId)return;let i=this.minimapWorldPoint(e);i&&(!t.moved&&Math.hypot(e.clientX-t.startX,e.clientY-t.startY)>2&&(t.moved=!0,this.host.controller.clearSectionFocus()),this.host.controller.panToWorld({x:i.x-t.offsetX,y:i.y-t.offsetY}),e.preventDefault())}minimapPointerUp(e){let t=this.miniDrag;!t||t.pointerId!==e.pointerId||(this.miniSuppressClick=t.moved,this.miniDrag=null,this.miniCanvas?.classList.remove("sl-dragging"),this.miniCanvas?.hasPointerCapture(e.pointerId)&&this.miniCanvas.releasePointerCapture(e.pointerId))}minimapKeydown(e){let t=this.host.controller.getViewport()?.visible;if(!t)return;if(e.key==="Home"){this.host.controller.overview(),e.preventDefault();return}let i=e.key==="ArrowLeft"?-t.width*.2:e.key==="ArrowRight"?t.width*.2:0,s=e.key==="ArrowUp"?-t.height*.2:e.key==="ArrowDown"?t.height*.2:0;!i&&!s||(this.host.controller.clearSectionFocus(),this.host.controller.panToWorld({x:t.x+t.width/2+i,y:t.y+t.height/2+s}),e.preventDefault())}minimapJump(e){let t=this.minimapWorldPoint(e);if(t){for(let i of this.host.controller.getMinimapSnapshot().sections)if(!(i.state==="inactive"||i.outline.length<3)&&Li(t,i.outline)){this.host.controller.focusSection(i.id);return}this.host.controller.clearSectionFocus(),this.host.controller.panToWorld(t)}}};import{t as je}from"@seatlayer/core";var Ri=12;function kt(a,e){let t=e.floors(),i=new Set(t.map(v=>v.label.trim().toLocaleLowerCase())),s=e.zones().filter(v=>v.seatCount>0&&!i.has(v.label.trim().toLocaleLowerCase())),n=e.sections().filter(v=>v.seatCount>0&&!i.has(v.label.trim().toLocaleLowerCase())),r=s.length>1?[]:n,o=t.length>1,l=s.length>1,d=r.length>1;if(!o&&!l&&!d)return;let h=document.createElement("div");h.className="sl-view3d-nav";let p=document.createElement("button");p.type="button",p.className="sl-view3d-nav-toggle",p.setAttribute("aria-expanded","false");let c=v=>{h.classList.toggle("is-open",v),p.setAttribute("aria-expanded",String(v)),p.textContent=v?S("picker.closeVenueNav","Close"):o&&(l||d)?S("picker.levelsAndAreas","Levels & areas"):o?S("picker.levels","Levels"):S("picker.areas","Areas")};p.addEventListener("click",()=>c(!h.classList.contains("is-open"))),h.addEventListener("keydown",v=>{v.key!=="Escape"||!h.classList.contains("is-open")||(v.preventDefault(),v.stopPropagation(),c(!1),p.focus())}),c(!1),h.appendChild(p);let f=v=>{},m=v=>{};if(o){let v=document.createElement("div");v.setAttribute("role","group"),v.setAttribute("aria-label",S("picker.levels","Levels"));let w=[];m=g=>{w.forEach(C=>{C.setAttribute("aria-pressed",String((C.dataset.floor===""?null:Number(C.dataset.floor))===g))})};let k=g=>{e.focusFloor(g)&&(m(g),f(g))},x=(g,C)=>{let u=document.createElement("button");u.type="button",u.textContent=g,u.dataset.floor=C===null?"":String(C),u.setAttribute("aria-pressed",String(C===null)),u.addEventListener("click",()=>{k(C),c(!1)}),w.push(u),v.appendChild(u)};x(S("picker.allLevels","All levels"),null);for(let g of t)x(g.label||je("picker.levelNumber",{number:g.index+1}),g.index);h.appendChild(v)}if(l||d){let v=document.createElement("div");v.setAttribute("role","group"),v.setAttribute("aria-label",S("picker.areas","Areas"));let w=l?s.map(x=>({id:x.id,label:x.label||x.id,go:()=>{e.focusZone(x.id)}})):r.map(x=>({id:x.id,label:x.label||x.id,floorIndex:x.floorIndex,go:()=>{e.focusSection(x.id),Number.isFinite(x.floorIndex)&&m(x.floorIndex)}})),k=x=>{let g=l||x===null?w:w.filter(C=>C.floorIndex===void 0||C.floorIndex===x);if(v.replaceChildren(),!g.length){v.remove();return}if(v.isConnected||h.appendChild(v),!l&&g.length>Ri){let C=document.createElement("select");C.setAttribute("aria-label",S("picker.jumpToSection","Jump to section"));let u=document.createElement("option");u.value="",u.textContent=S("picker.jumpToSection","Jump to section"),C.appendChild(u);for(let b of g){let T=document.createElement("option");T.value=b.id,T.textContent=b.label,C.appendChild(T)}C.addEventListener("change",()=>{g.find(b=>b.id===C.value)?.go()}),v.appendChild(C);return}for(let C of g){let u=document.createElement("button");u.type="button",u.textContent=C.label,u.addEventListener("click",()=>{C.go(),c(!1)}),v.appendChild(u)}};f=k,k(null)}a.appendChild(h)}var ke=class{constructor(e){this.host=e;this.chip=null}sync(){let e=this.host.overlay();if(!e||this.host.savedSeatIds().length===0){this.chip?.remove(),this.chip=null;return}let t=this.chip;if(!t){t=document.createElement("div"),t.className="sl-view3d-compare-saved",t.setAttribute("role","group"),t.setAttribute("aria-label",S("picker.savedSeatComparison","Saved seat comparison"));let n=document.createElement("button");n.type="button",n.className="main",n.addEventListener("click",()=>{this.host.savedSeatIds().length>1?this.host.openComparison():this.host.toast(S("picker.chooseAnotherToCompare","Choose another seat to compare."),"neutral")});let r=document.createElement("button");r.type="button",r.className="clear",r.textContent="\xD7",r.setAttribute("aria-label",S("picker.clearSavedSeatComparison","Clear saved seat comparison")),r.addEventListener("click",()=>this.host.clearComparison()),t.append(n,r),e.appendChild(t),this.chip=t}let i=this.host.savedSeatIds().length,s=t.querySelector(".main");s&&(s.textContent=i>1?je("picker.compareCount",{count:i}):S("picker.oneSeatSaved","1 seat saved"),s.setAttribute("aria-label",i>1?je("picker.openComparisonOfSeats",{count:i}):S("picker.oneSeatSavedChooseAnother","One seat saved; choose another to compare")))}remove(){this.chip?.remove(),this.chip=null}mainButton(){return this.chip?.querySelector(".main")??null}};import{t as Se}from"@seatlayer/core";function St(a){return Array.isArray(a)?a.reduce((e,t)=>t.type==="minimumSelectedPlaces"?Math.max(e,t.minimum):e,0):0}function Ve(a,e,t=!1){let i=a.violations[0];return i==="numberOfPlacesToSelect"?a.remaining>0?Se("picker.selectExactMore",{count:a.remaining}):Se("picker.selectExactCount",{count:a.required}):i==="minimumSelectedPlaces"?Se("picker.selectMinimumMore",{count:a.remaining}):t?e("picker.adjustSeatSelection","Adjust seat selection"):i==="consecutiveSeats"?e("picker.selectSeatsTogether","Choose seats together in the same row and ticket category."):Se("picker.orphanHint")}import{t as Te,tCount as Oi}from"@seatlayer/core";function _e(a){let e=Math.max(0,a),t=Math.floor(e/6e4),i=String(Math.floor(e%6e4/1e3)).padStart(2,"0");return`${t}:${i}`}function Tt({d:a,area:e,label:t,objectType:i,quantity:s=1,identity:n}){let r=h=>String(h??"\u2014").replace(/[&<>"]/g,p=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[p]),o=i==="ga"?"ga":a?.objectType??i,l=n?.displayType?.trim()||a?.displayType?.trim()||e?.displayType?.trim()||(o==="table"?S("picker.table","Table"):o==="booth"?S("picker.booth","Booth"):o==="ga"?S("picker.generalAdmission","General admission"):S("picker.row","Row")),d=n?.rowLabel??n?.displayLabel??a?.rowLabel??a?.displayLabel??e?.displayLabel??e?.label??t;return o==="table"&&n?.bookingMode?`<div class="sl-chip-id"><span class="fld sec"><span class="sl-chip-eb">${r(l)}</span><span class="val">${r(d)}</span></span><span class="fld mid"><span class="sl-chip-eb">${S("picker.guests","Guests")}</span><span class="val">${s}</span></span></div>`:o==="ga"?`<div class="sl-chip-id"><span class="fld sec"><span class="sl-chip-eb">${r(l)}</span><span class="val">${r(d)}</span></span>`+(s>1?`<span class="fld mid"><span class="sl-chip-eb">${S("picker.tickets","Tickets")}</span><span class="val">${s}</span></span>`:"")+"</div>":o==="booth"?'<div class="sl-chip-id">'+(a?.sectionLabel?`<span class="fld sec"><span class="sl-chip-eb">${S("picker.section","Section")}</span><span class="val">${r(a.sectionLabel)}</span></span>`:"")+`<span class="fld mid"><span class="sl-chip-eb">${r(l)}</span><span class="val">${r(d)}</span></span></div>`:!a?.sectionLabel&&!a?.rowLabel&&!a?.seatNumber?`<div class="sl-chip-id"><span class="fld sec"><span class="sl-chip-eb">${S("picker.seat","Seat")}</span><span class="val">${r(d)}</span></span></div>`:'<div class="sl-chip-id">'+(a.sectionLabel?`<span class="fld sec"><span class="sl-chip-eb">${S("picker.section","Section")}</span><span class="val">${r(a.sectionLabel)}</span></span>`:"")+(a.rowLabel?`<span class="fld mid"><span class="sl-chip-eb">${r(l)}</span><span class="val">${r(G(a))}</span></span>`:"")+(a.seatNumber?`<span class="fld mid"><span class="sl-chip-eb">${S("picker.seat","Seat")}</span><span class="val">${r(a.seatNumber)}</span></span>`:"")+"</div>"}function Ct(a,e){return`<div class="sl-chip-rail"><button type="button" class="rm" aria-label="${a}"><svg viewBox="0 0 24 24"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button>`+(e?`<button type="button" class="view" data-view-label="${e}" aria-label="${Te("picker.viewFromSeat",{label:e})}"><svg viewBox="0 0 24 24"><path d="M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z"/><circle cx="12" cy="12" r="3"/></svg></button>`:"")+"</div>"}function Et({count:a,total:e,pendingCount:t,ctaPhase:i,hasHold:s,salesClosed:n,fromPrice:r,money:o}){if(a&&i==="holding")return`<span>${S("picker.securingSeats","Securing your seats\u2026")}</span>`;if(a&&i==="checkout")return`<span>${Te("picker.peekSecured",{count:a,total:o(e)})}</span>`;if(a){let l=!!s;return`<span>${Oi("picker.peekTicketsTotal",a,{total:o(e)})}</span><button type="button" class="go sl-sheet-go" data-act="${l?"checkout":"open"}">${s?t?S("picker.secureMore","Secure more"):S("picker.continue","Continue"):S("picker.review","Review")}</button>`}else return n?`<span>${S("picker.salesClosedPill","Sales are closed")}</span>`:(r!=null?`<span>${Te("picker.peekFromPrice",{price:o(r)})}</span>`:`<span>${S("picker.pickYourSeats","Pick your seats")}</span>`)+`<button type="button" class="go sl-sheet-go" data-act="open">${S("picker.bestSeatsStar","\u2726 Best seats")}</button>`}function Ne(a,e=Date.now()){return Te("picker.holdReassurance",{time:_e(a-e)})}var Vi="https://api.seatlayer.io",_i=10,Pt=6e4,Mt=6e4,Ht=new Set;function Ni(a){let e=Ht.has(a);return Ht.add(a),e}var Rt="seatmap.a11y.cb";function Ui(){try{if(typeof window>"u")return null;let a=window.localStorage.getItem(Rt);return a==null?null:a==="1"}catch{return null}}function qi(a){try{window.localStorage.setItem(Rt,a?"1":"0")}catch{}}var qe=class a{constructor(e){this.realtime=null;this.accessEl=null;this.lastSelectionValidity=null;this.root=null;this.mapHost=null;this.rendered=!1;this.destroyed=!1;this.els={};this.regions={};this.ro=null;this.holdTimer=null;this.toastTimer=null;this.offerRefreshTimer=null;this.offerBoundaryTimer=null;this.offerVisibilityHandler=null;this.motionTimers=new Set;this.currency="USD";this.eventTimezone=null;this.eventWhenText=null;this.offerAvailability=null;this.channelByObject=new Map;this.pricesByChannel=new Map;this.hold=null;this.holdExpiresAt=0;this.handedOff=!1;this.bookedShown=!1;this.paymentOptions=null;this.checkoutPanel=null;this.extendEl=null;this.bookedEl=null;this.gaQty=new Map;this.tipEl=null;this.tipPos={x:0,y:0};this.confirmEl=null;this.confirmSeat=null;this.tableDialogEl=null;this.tableDialog=null;this.tableDialogHeld=!1;this.tableDialogReturnFocus=null;this.srEl=null;this.baQty=2;this.baCat="";this.baZone="";this.baPremium=!1;this.baReopen=!1;this.bestAvailableConfirm=!1;this.releasingHold=!1;this.salesClosed=!1;this.soldOut=!1;this.soldoutEl=null;this.cbSafe=!1;this.rungsEl=null;this.projectionEl=null;this.buyerView="map";this.view3dEl=null;this.view3dHandle=null;this.view3dGen=0;this.view3dReturnSeat=null;this.view3dTargetSeatId=null;this.view3dCompareSeatIds=[];this.view3dCompareChip=new ke({overlay:()=>this.view3dEl,savedSeatIds:()=>this.view3dCompareSeatIds,openComparison:()=>this.openView3dComparison(),clearComparison:()=>this.clearView3dComparison(),toast:(e,t)=>this.toast(e,t)});this.view3dCompareEl=null;this.view3dCompareCleanup=null;this.view3dPassportEl=null;this.view3dPassportCleanup=null;this.floorsEl=null;this.secCardEl=null;this.viewEl=null;this.viewCleanup=null;this.seatViewGen=0;this.allSeatsCache=null;this.minimap=null;this.pickerLayoutSize={width:0,height:0};this.priceBandKeys=null;this.focusedCatKey=null;this.limitedViewFilter=!1;this.pricesExpanded=!1;this.lastSection=null;this.secCardCollapsed=!1;this.secCardShownAt=0;this.lastTrayCount=0;this.lastTrayTotal=0;this.lastTrayKeys=new Set;this.bestAvailableBusy=!1;this.releasingLabels=new Set;this.holdingLabels=new Set;this.ctaPhase="idle";this.a11yChipsEl=null;this.fsFallback=!1;this.fsChangeHandler=null;this.fsEscHandler=null;this.eventDetailsHidden=!1;this.holdCopyPending=!1;this.sideCollapsed=!1;this.sideToggleEl=null;this.pricesBtnEl=null;this.framedFs=!1;this.lastPostedHeight=0;this.cbEl=null;this.modalScrim=null;this.prevFocus=null;this.escHandler=null;this.closeModal=null;this.lastCatAvail=null;this.lastAvailFloorId="";this.availQuietUntil=0;this.liveTimer=null;this.perspectiveWarned=!1;if(!e||typeof e!="object")throw new Error("seatmap: options object is required");if(!e.event||typeof e.event!="string")throw new Error("seatmap: `event` key is required");if(!e.container)throw new Error("seatmap: `container` is required (or use SeatPicker.open())");this.opts={...e,confirmSelection:e.confirmSelection??!0},this.eventDetailsHidden=!!e.hideEventDetails,this.hostPricing=e.pricing,this.apiBase=(e.apiBase??Vi).replace(/\/+$/,""),this.access=e.transport?null:de(e,{onExpired:n=>{this.opts.onAccessExpired?.(n),n.refreshed||this.showAccessPanel({reason:"no_token",retryable:!1})},onUnavailable:n=>{this.opts.onAccessUnavailable?.(n),this.showAccessPanel(n)}}),this.pubApi=e.transport?null:new X(this.apiBase,{access:this.access??void 0,onObjectUnavailable:n=>this.opts.onSelectedObjectUnavailable?.(n)}),this.api=e.transport??this.pubApi,this.buyerAssetUrls=new ge(e.event,this.api.asset?(n,r)=>this.api.asset(n,r):void 0),e.checkout==="hosted"&&!this.pubApi&&console.warn('seatlayer: checkout: "hosted" needs the widget\'s own transport \u2014 a custom `transport` owns its backend, so the picker is staying on onCheckout for this mount.'),this.checkoutMode=e.checkout==="hosted"&&this.pubApi?"hosted":"handoff";let t=e.numberOfPlacesToSelect;if(t!=null&&(!Number.isInteger(t)||t<1))throw new Error("seatmap: `numberOfPlacesToSelect` must be a positive integer");this.exactTickets=t??null;let i=St(e.selectionValidators);if(this.exactTickets!=null&&i>this.exactTickets)throw new Error("seatmap: `minimumSelectedPlaces.minimum` cannot exceed `numberOfPlacesToSelect`");let s=Math.max(1,Math.floor(e.maxSelection??this.exactTickets??Math.max(_i,i)));if(this.exactTickets!=null&&s<this.exactTickets)throw new Error("seatmap: `maxSelection` cannot be lower than `numberOfPlacesToSelect`");if(e.maxSelection!=null&&s<i)throw new Error("seatmap: `maxSelection` cannot be lower than `minimumSelectedPlaces.minimum`");this.maxTickets=this.exactTickets??s,this.cbSafe=Ui()??!!e.colorblindSafe,this.controller=this.wireController(e)}chartHasStage(){let e=this.controller.doc;if(!e)return!1;let t=e.floors?.length?e.floors.map(i=>i.objects??[]):[e.objects??[]];for(let i of t)for(let s of i)if(s.type==="shape"&&(s.role==="stage"||s.stageKind))return!0;return!1}confirmThumbHtml(e){let t=this.controller.doc;if(!t)return"";let i=e.viewUrl??"",s=this.chartHasStage();if(!i&&!s)return"";let n=null;if(!i)try{n=zi(e,e.focalPoint??t.focalPoint).distanceM??null}catch{return""}let r=s&&n!=null?`<div class="sl-confirm-sight">${y("picker.sightline",{m:n})}</div>`:"";return(i?`<button type="button" class="sl-confirm-view sl-confirm-thumbwrap" aria-label="${y("picker.viewFromSeat",{label:e.label})}"><img class="sl-confirm-thumb" alt="" /><span class="sl-confirm-thumb-badge">\u{1F52D} ${this.tf("picker.viewFromHere","View from here")}</span></button>`:`<button type="button" class="sl-confirm-view sl-confirm-viewbtn" aria-label="${y("picker.viewFromSeat",{label:e.label})}"><span aria-hidden="true">\u{1F52D}</span><span>${this.tf("picker.viewFromHere","View from here")}</span></button>`)+r}isFramed(){return typeof window<"u"&&window.parent!==window}postToHost(e){if(this.isFramed())try{window.parent.postMessage(e,"*")}catch{}}measureFramedHeight(){let e=this.root;if(!e)return 0;let t=e.clientWidth||(typeof window<"u"?window.innerWidth:0)||0;if(t<=0)return 0;let i=t<640?1.2:.62;return Math.max(420,Math.round(t*i))}reportFramedHeight(){if(!this.isFramed())return;let e=this.measureFramedHeight();e<=0||e===this.lastPostedHeight||(this.lastPostedHeight=e,this.postToHost({type:"seatlayer:height",px:e}))}toggleFullscreen(){let e=this.root;if(!e)return;!!document.fullscreenElement||this.fsFallback||this.framedFs?document.fullscreenElement?document.exitFullscreen().catch(()=>{}):this.framedFs?this.setFramedFs(!1):this.setFsFallback(!1):e.requestFullscreen?e.requestFullscreen().catch(()=>this.enterFsFallback()):this.enterFsFallback()}syncFullscreenButtons(){let e=!!document.fullscreenElement||this.fsFallback||this.framedFs,t=this.eventDetailsHidden&&!e;this.root?.setAttribute("data-event-details-hidden",String(t)),this.els.zfs?.setAttribute("aria-pressed",String(e)),this.els.zfs?.setAttribute("title",e?this.tf("picker.exitFullScreen","Exit full screen"):this.tf("picker.fullScreen","Full screen"));let i=this.els.zfs?.querySelector(".sl-zfs-lbl");i&&(i.textContent=e?this.tf("picker.exitFullScreen","Exit full screen"):this.tf("picker.fullScreen","Full screen")),this.view3dEl?.querySelector(".sl-view3d-fs")?.setAttribute("aria-pressed",String(e))}enterFsFallback(){this.isFramed()?this.setFramedFs(!0):this.setFsFallback(!0)}setFramedFs(e){this.framedFs!==e&&(this.framedFs=e,this.syncFullscreenButtons(),this.postToHost({type:"seatlayer:fullscreen",on:e}),e&&!this.fsEscHandler?(this.fsEscHandler=t=>{t.key==="Escape"&&!document.fullscreenElement&&this.setFramedFs(!1)},window.addEventListener("keydown",this.fsEscHandler)):!e&&this.fsEscHandler&&(window.removeEventListener("keydown",this.fsEscHandler),this.fsEscHandler=null),requestAnimationFrame(()=>this.controller.refitCurrentView()))}setFsFallback(e){this.fsFallback!==e&&(this.fsFallback=e,this.root?.classList.toggle("sl-fs",e),this.syncFullscreenButtons(),e&&!this.fsEscHandler?(this.fsEscHandler=t=>{t.key==="Escape"&&!document.fullscreenElement&&this.setFsFallback(!1)},window.addEventListener("keydown",this.fsEscHandler)):!e&&this.fsEscHandler&&(window.removeEventListener("keydown",this.fsEscHandler),this.fsEscHandler=null),requestAnimationFrame(()=>this.controller.refitCurrentView()))}close(){this.closeModal?this.closeModal():this.destroy()}static async open(e){Oe();let t=document.activeElement instanceof HTMLElement?document.activeElement:null,i=document.createElement("div");i.className="sl-modal-scrim";let s=document.createElement("div");s.className="sl-modal-frame",s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),s.setAttribute("aria-label",S("picker.seatSelection","Seat selection")),s.tabIndex=-1,i.appendChild(s),document.body.appendChild(i);let n=document.body.style.overflow;document.body.style.overflow="hidden";let r=new a({...e,container:s});r.modalScrim=i,r.prevFocus=t;let o=["a[href]","area[href]","button","input","select","textarea","iframe","object","embed","summary","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"[tabindex]"].join(","),l=()=>{let m=[...s.querySelectorAll('[role="dialog"][aria-modal="true"]')].filter(v=>v.isConnected&&!v.closest('[hidden], [aria-hidden="true"], [inert]'));return m[m.length-1]??s},d=(m,v)=>{let w=m;for(;w;){let k=window.getComputedStyle(w);if(w.hidden||w.getAttribute("aria-hidden")==="true"||w.hasAttribute("inert")||k.display==="none"||k.visibility==="hidden"||k.visibility==="collapse")return!0;if(w===v)return!1;w=w.parentElement}return!0},h=m=>[...m.querySelectorAll(o)].filter(v=>v.tabIndex>=0&&!v.matches(":disabled")&&!d(v,m)),p=(m,v)=>{let w=h(m),k=v?w[w.length-1]:w[0];k?k.focus({preventScroll:!0}):(m.hasAttribute("tabindex")||(m.tabIndex=-1),m.focus({preventScroll:!0}))},c=!1,f=()=>{if(c)return;c=!0,document.body.style.overflow=n,r.escHandler&&document.removeEventListener("keydown",r.escHandler),i.remove(),r.modalScrim=null;let m=r.prevFocus;r.prevFocus=null,m?.isConnected&&m.focus({preventScroll:!0});let v=()=>{r.destroy(),e.onClose?.()};r.hold&&!r.handedOff?r.release().finally(v):v()};return r.closeModal=f,i.addEventListener("mousedown",m=>{m.target===i&&f()}),r.escHandler=m=>{if(m.key==="Tab"){if(m.defaultPrevented)return;let v=l(),w=h(v),k=w[0],x=w[w.length-1],g=document.activeElement;!k||!x?(m.preventDefault(),p(v,m.shiftKey)):g===v||!g||!v.contains(g)?(m.preventDefault(),(m.shiftKey?x:k).focus({preventScroll:!0})):m.shiftKey&&g===k?(m.preventDefault(),x.focus({preventScroll:!0})):!m.shiftKey&&g===x&&(m.preventDefault(),k.focus({preventScroll:!0}));return}m.key==="Escape"&&(r.tableDialog?(m.preventDefault(),r.cancelTableDialog()):r.confirmSeat?(m.preventDefault(),r.cancelConfirm()):r.bestAvailableConfirm?(m.preventDefault(),r.bestAvailableConfirm=!1,r.syncTray()):(m.preventDefault(),f()))},document.addEventListener("keydown",r.escHandler),await r.render(),r.els.close?.classList.add("on"),r.els.close?.addEventListener("click",f),p(l(),!1),r}wireController(e){return new Ii({transport:this.api,eventKey:e.event,maxSelection:this.maxTickets,selectedObjects:e.selectedObjects,selectableObjects:e.selectableObjects,numberOfPlacesToSelect:e.numberOfPlacesToSelect,selectionValidators:e.selectionValidators,currency:e.currency,flashOnLiveChange:!0,colorblindSafe:this.cbSafe,mapTheme:e.theme?.map??null,onSelectionChange:()=>{this.syncTray(),this.minimap?.refreshMinimap(),this.committedSelection().length&&this.collapseSectionCard(),this.syncSelectionTo3d()},onStatusChange:()=>{this.syncPrices(),this.scheduleOfferRefresh(!0),this.evictTakenSelections(),this.detectBooked(),this.minimap?.refreshMinimap(),this.pushAvailabilityTo3d()},onHoldExpired:()=>{this.hold=null,this.forgetHold(),this.handedOff=!1,this.bookedShown=!1,this.ctaPhase="idle",this.stopHoldTimer(),this.gaQty.clear(),this.toast(y("picker.holdExpired",void 0)||"Your hold expired \u2014 seats released. Pick again.","warning"),this.syncTray(),this.emitHoldChange(),this.opts.onHoldExpired?.()},confirmSelection:this.opts.confirmSelection,onSelect:t=>{if(this.salesClosed){this.controller.deselect([t.id]),this.toast(this.tf("picker.salesClosedToast","Sales are closed for this event."),"warning");return}this.controller.tableSelection(t.id)||(this.flashPickedSeat(t.id),this.opts.confirmSelection&&this.showConfirm(t))},onTableSelectionRequest:t=>{if(this.salesClosed){this.controller.deselect(t.physicalSeatIds),this.toast(this.tf("picker.salesClosedToast","Sales are closed for this event."),"warning");return}this.showTableDialog(t,!1)},onDeselect:t=>{this.confirmSeat?.id===t.id&&this.dismissConfirm(),this.tableDialog?.physicalSeatIds.includes(t.id)&&this.dismissTableDialog()},onSelectionLimit:()=>{this.toast(y("picker.maxTicketsForOrder",{count:this.maxTickets}),"warning"),this.opts.onSelectionLimit?.(this.maxTickets)},onViewChange:()=>{this.reanchorConfirm(),this.syncRung(),this.syncProjection(),this.minimap?.drawMinimapRect(),this.sectionCardOnView()},onSectionFocus:t=>this.showSectionCard(t),onDeckTap:()=>{this.showSectionCard(null),this.syncFloors(),this.syncRung(),this.minimap?.refreshMinimap()},onFocusSeat:t=>this.announceSeat(t),onSeatHover:t=>this.updateTooltip(t),onHint:t=>{t&&this.toast(t)},onSalesClosed:()=>this.setSalesClosed(!0),onError:t=>this.opts.onError?.(t)})}async render(){if(this.rendered)return this;let e=performance.now(),t={},i=b=>Math.round((performance.now()-b)*100)/100;this.rendered=!0,Oe();let s=performance.now();await Di(this.opts.locale),t.loadLocale=i(s),this.opts.messages&&Fi(this.opts.messages),this.checkoutMode==="hosted"&&(this.paymentOptions=this.pubApi.paymentOptions(this.opts.event));let n=performance.now(),r=dt(this.opts.container),{root:o,els:l,mapHost:d}=lt(r,(b,T)=>this.tf(b,T),this.opts.theme);this.root=o,this.els=l,this.mapHost=d,o.addEventListener("keydown",b=>{b.key==="Escape"&&(this.tableDialog?(b.preventDefault(),b.stopPropagation(),this.cancelTableDialog()):this.confirmSeat?(b.preventDefault(),b.stopPropagation(),this.cancelConfirm()):this.bestAvailableConfirm&&(b.preventDefault(),b.stopPropagation(),this.bestAvailableConfirm=!1,this.syncTray()))}),this.syncFullscreenButtons(),this.wireBuyerShell(o);let h=document.createElement("div");h.style.cssText="position:absolute;inset:0",this.mapHost.appendChild(h),t.mountBuyerShell=i(n);let p=await this.loadChart(h,t,i);if(!p)return this;this.els.boot.remove();let c=performance.now();if(this.startRealtime(),this.salesClosed=!!p.salesClosed||!!this.opts.readOnly,o.dataset.eventMode=p.mode==="test"?"test":"live",this.controller.setViewMode(this.normalizeInitialView(this.opts.initialView)),this.buildRegions(),this.regions["bottom-right"].appendChild(this.els.zoom),this.regions["bottom-center"].appendChild(this.els.toast),p.mode==="test"){let b=document.createElement("div");b.className="sl-testbadge",b.textContent=y("picker.testMode"),b.setAttribute("aria-label",y("picker.testMode")),this.regions["top-left"].appendChild(b)}let f=this.controller.doc?.theme;Object.entries(xe(f,this.opts.theme)).forEach(([b,T])=>o.style.setProperty(b,T)),this.currency=p.currency??this.opts.currency??"USD",this.eventTimezone=p.timezone??null;let m=this.opts.theme?.logoUrl??f?.logoUrl??p.posterUrl??null;m?this.els.logo.innerHTML=`<img src="${m}" alt="">`:this.els.logo.textContent=(this.opts.theme?.brandName??f?.brandName??p.eventName??"?").slice(0,1).toUpperCase(),this.els.name.textContent=p.eventName??"";let v=p.startsAt?we(p.startsAt,p.timezone??null,this.opts.locale):"";this.eventWhenText=v||null,this.els.meta.textContent=[p.venue,v].filter(Boolean).join(" \xB7 "),this.els.pricesHint&&(this.els.pricesHint.textContent=this.tf("picker.priceHint","Colours on the map are ticket types \u2014 tap one below to show just those seats.")),this.buildBadge(f);let w=new Set,k=!1;if(this.controller.doc)for(let b of Ue(this.controller.doc)){for(let T of b.accessibility??[])w.add(T);b.accessible&&!b.accessibility?.length&&w.add("wheelchair"),(b.commercial?.restrictedView||b.commercial?.obstructedView)&&(k=!0)}let x=()=>{this.rungsEl&&this.controller.getRung()!=="seats"&&(this.controller.setRung("seats"),this.collapseSectionCard(),this.syncRung())};if(w.size||k){let b=document.createElement("div");if(b.className="sl-chips",this.regions["top-left"].appendChild(b),this.a11yChipsEl=b,w.size){let T=(A,L)=>`<button type="button" class="sl-chip-f${A==="all"?" on":""}" data-a11y="1" data-f="${A}">${L}</button>`;b.insertAdjacentHTML("beforeend",T("all",this.tf("picker.allSeats","All seats"))+$i.filter(({key:A})=>w.has(A)).map(({key:A,short:L,icon:D})=>T(A,`${D} ${L}`)).join(""));let E=new Set,M=()=>{b.querySelectorAll("button[data-a11y]").forEach(L=>{let D=L.dataset.f,se=D==="all"?E.size===0:E.has(D);L.classList.toggle("on",se),L.setAttribute("aria-pressed",String(se))});let A=E.size?[...E]:null;this.controller.setAccessibilityFilter(A),A&&x()};b.querySelectorAll("button[data-a11y]").forEach(A=>{A.addEventListener("click",()=>{let L=A.dataset.f;L==="all"?E.clear():E.has(L)?E.delete(L):E.add(L),M()})})}if(k){let T=document.createElement("button");T.type="button",T.className="sl-chip-f",T.setAttribute("aria-pressed","false"),T.innerHTML=`\u25D0 ${this.tf("picker.hideLimitedView","Hide limited-view seats")}`,b.appendChild(T),T.addEventListener("click",()=>{let E=!this.limitedViewFilter;this.limitedViewFilter=E,T.classList.toggle("on",E),T.setAttribute("aria-pressed",String(E)),this.controller.setCommercialLimitedFilter(E),this.pushAvailabilityTo3d(),E&&x()})}}let g=document.createElement("button");g.type="button",g.className="sl-cbbtn",this.cbEl=g,g.setAttribute("aria-label",this.tf("picker.toggleColorblindColors","Toggle colorblind-friendly colors")),g.setAttribute("aria-pressed",String(this.cbSafe)),g.innerHTML='<svg viewBox="0 0 24 24"><path d="M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z"/><circle cx="12" cy="12" r="3"/></svg>',this.els.zfit.parentElement.appendChild(g),g.addEventListener("click",()=>{this.setColorblindSafe(!this.cbSafe)}),this.srEl=document.createElement("div"),this.srEl.className="sl-sr",this.srEl.setAttribute("aria-live","polite"),o.appendChild(this.srEl),this.buildArenaChrome(),this.buildMinimap(),this.buildPriceFilter(),this.buildExtendPrompt(),this.buildBookedOverlay(),this.buildSoldoutOverlay(),this.buildPanelToggle(),this.opts.panelCollapsed&&this.setPanelCollapsed(!0),this.dockLayoutChrome(),t.buildBuyerControls=i(c);let C=performance.now();if(await this.restoreRememberedHold(),t.restoreHold=i(C),this.destroyed)return this;this.salesClosed&&this.applySalesClosed(),this.syncPrices(),this.syncTray(),this.resumeHostedOrder();let u=this.controller.doc;return this.emitAnalytics("chart_rendered",{renderingTimeMillis:i(e),performanceProfile:t,seatCount:this.allSeats().length,objectCount:u?.objects.length??0,sectionCount:u?.objects.filter(b=>b.type==="section").length??0,view:this.buyerView,eventKey:this.opts.event,chartName:u?.name,floorCount:this.controller.getFloors().length,transport:this.opts.transport?"custom":"pubapi",load:Ni(this.opts.event)?"repeat":"cold"}),this}wireBuyerShell(e){this.refreshOfferAvailability(!1),this.api.availability&&(this.offerVisibilityHandler=()=>{!document.hidden&&!this.destroyed&&this.refreshOfferAvailability(!1)},document.addEventListener("visibilitychange",this.offerVisibilityHandler)),this.observeLayout(e),this.els.zin.addEventListener("click",()=>this.controller.zoomIn()),this.els.zout.addEventListener("click",()=>this.controller.zoomOut()),this.els.zfit.addEventListener("click",()=>this.controller.zoomToFit()),this.els.zfs.addEventListener("click",()=>this.toggleFullscreen()),this.fsChangeHandler=()=>{document.fullscreenElement||this.setFsFallback(!1),this.syncFullscreenButtons(),requestAnimationFrame(()=>this.controller.refitCurrentView())},document.addEventListener("fullscreenchange",this.fsChangeHandler);let t=this.els.sheetHead;if(t){let n=this.els.sheetToggle,r=h=>{e.dataset.sheet=h?"open":"peek",n?.setAttribute("aria-expanded",String(h)),n?.setAttribute("aria-label",h?this.tf("picker.collapseTicketPanel","Collapse ticket panel"):this.tf("picker.openTicketPanel","Open ticket panel"))};r(e.dataset.sheet==="open"),n?.addEventListener("click",h=>{h.stopPropagation(),r(e.dataset.sheet!=="open")}),this.els.peek?.addEventListener("click",h=>{let p=h.target.closest(".sl-sheet-go");p&&(h.stopPropagation(),p.dataset.act==="checkout"?this.handleCta():r(!0))});let o=0,l=!1,d=!1;t.addEventListener("pointerdown",h=>{if(h.target.closest?.(".sl-seccard,.sl-sheet-toggle,.sl-sheet-go")){d=!1;return}d=!0,l=!1,o=h.clientY,t.setPointerCapture?.(h.pointerId)}),t.addEventListener("pointermove",h=>{if(!d||l)return;let p=h.clientY-o;p<-18?(r(!0),l=!0):p>18&&(r(!1),l=!0)}),t.addEventListener("pointerup",h=>{d&&!l&&Math.abs(h.clientY-o)<6&&r(e.dataset.sheet!=="open"),d=!1,t.releasePointerCapture?.(h.pointerId)})}let i=()=>{if(this.root?.dataset.layout!=="narrow")return;let n=this.root.getAttribute("data-prices-open")==="true";if(this.root.setAttribute("data-prices-open",String(!n)),this.els.pricesSec?.setAttribute("aria-expanded",String(!n)),this.pricesBtnEl?.setAttribute("aria-pressed",String(!n)),!n&&this.root.dataset.sheet!=="open"){this.root.dataset.sheet="open";let r=this.els.sheetToggle;r?.setAttribute("aria-expanded","true"),r?.setAttribute("aria-label","Collapse ticket panel")}};this.els.pricesSec?.addEventListener("click",n=>{n.target.closest("select,button")||i()}),this.els.pricesSec?.addEventListener("keydown",n=>{n.key!=="Enter"&&n.key!==" "||n.target.closest("select,button")||(n.preventDefault(),i())});let s=document.createElement("button");s.type="button",s.className="sl-prices-btn",s.setAttribute("aria-label",this.tf("picker.ticketPrices","Ticket prices")),s.setAttribute("title",this.tf("picker.ticketPrices","Ticket prices")),s.setAttribute("aria-pressed","false"),s.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0L3 13V5a2 2 0 0 1 2-2h8l7.6 7.6a2 2 0 0 1 0 2.8z"/><circle cx="7.5" cy="7.5" r="1.3"/></svg>',s.addEventListener("click",()=>i()),this.els.headInfo?.parentElement?.insertBefore(s,this.els.hold??null),this.pricesBtnEl=s,this.tipEl=document.createElement("div"),this.tipEl.setAttribute("role","tooltip"),this.tipEl.className="sl-tip",this.els.map.appendChild(this.tipEl),this.els.map.addEventListener("mousemove",n=>{let r=this.els.map.getBoundingClientRect();this.tipPos={x:n.clientX-r.left,y:n.clientY-r.top},this.tipEl&&this.tipEl.style.display!=="none"&&this.placeTooltip()}),this.els.cta.addEventListener("click",()=>{this.handleCta()}),this.els.holdChange?.addEventListener("click",()=>{this.handleChangeSeats()})}observeLayout(e){let t=()=>{let i=e.clientWidth;if(i<=0)return;let s=e.clientHeight,n=i!==this.pickerLayoutSize.width||s!==this.pickerLayoutSize.height;this.pickerLayoutSize={width:i,height:s},this.reportFramedHeight();let r=i<640?"narrow":"wide",o=s<560?"compact":"comfortable";(e.dataset.layout!==r||e.dataset.density!==o)&&(e.dataset.layout=r,e.dataset.density=o,r==="narrow"&&!e.dataset.sheet&&(e.dataset.sheet="peek"),this.dockLayoutChrome()),n&&this.minimap?.refreshMinimap()};this.ro=new ResizeObserver(t),this.ro.observe(e),t(),requestAnimationFrame(t)}async loadChart(e,t,i){let s=performance.now(),n=await this.controller.render(e);return t.loadChartAndStatuses=i(s),this.destroyed?null:n?(Object.assign(t,n.performanceProfile),n):(this.els.boot.innerHTML=`<div class="sl-boot-title">${this.tf("picker.mapDidNotLoad","The seat map didn\u2019t load")}</div><div>${this.tf("picker.checkConnection","Check your connection and try again.")}</div><button type="button" class="sl-boot-retry">${this.tf("picker.accessRetry","Try again")}</button>`,this.els.boot.querySelector("button").addEventListener("click",()=>{let r=this.opts.container,o=this.opts;this.destroy(),new a({...o,container:r}).render()}),null)}resumeHostedOrder(){if(this.checkoutMode!=="hosted"||typeof location>"u")return;let e=new URLSearchParams(location.search),t=e.get("order");if(!t)return;let i=e.get("status");e.delete("order"),e.delete("status");try{let s=e.toString();history.replaceState(history.state,"",`${location.pathname}${s?`?${s}`:""}${location.hash}`)}catch{}i==="success"&&this.openCheckoutPanel({kind:"resume",orderId:t})}buildPanelToggle(){if(!this.regions["top-right"])return;let e=document.createElement("button");e.type="button",e.className="sl-side-toggle",e.addEventListener("click",()=>this.setPanelCollapsed(!this.sideCollapsed)),this.sideToggleEl=e,this.regions["top-right"].appendChild(e),this.syncPanelToggle()}syncPanelToggle(){let e=this.sideToggleEl;if(!e)return;let t=this.sideCollapsed;e.setAttribute("aria-expanded",String(!t)),e.setAttribute("aria-label",t?this.tf("picker.showTicketPanel","Show the ticket panel"):this.tf("picker.hideTicketPanel","Hide the ticket panel")),e.title=t?this.tf("picker.showTicketPanel","Show the ticket panel"):this.tf("picker.hideTicketPanel","Hide the ticket panel"),e.innerHTML=t?`<svg viewBox="0 0 24 24"><path d="M15 6l-6 6 6 6"/></svg><span>${this.tf("picker.tickets","Tickets")}</span>`:'<svg viewBox="0 0 24 24"><path d="M9 6l6 6-6 6"/></svg>'}setPanelCollapsed(e){this.destroyed||(this.sideCollapsed=e,this.applyPanelCollapsed(),this.scheduleMotion(()=>this.controller.refitCurrentView(),340))}applyPanelCollapsed(){let e=this.root?.dataset.layout!=="narrow";this.root?.setAttribute("data-side-collapsed",String(this.sideCollapsed)),this.els.side?.toggleAttribute("inert",this.sideCollapsed&&e),this.syncPanelToggle()}dockLayoutChrome(){let e=this.root?.dataset.layout==="narrow";this.applyPanelCollapsed();let t=this.els.zfs,i=this.els.headInfo?.parentElement;t&&i&&t.parentElement!==i&&(t.classList.add("sl-fs-pill"),i.insertBefore(t,this.els.hold??null));let s=this.els.pricesSec;s&&(e?(s.setAttribute("role","button"),s.tabIndex=0,s.setAttribute("aria-expanded",String(this.root?.getAttribute("data-prices-open")==="true"))):(s.removeAttribute("role"),s.removeAttribute("aria-expanded"),s.tabIndex=-1));let n=this.els.filters;if(n){this.cbEl&&this.els.zoom?.appendChild(this.cbEl),e?this.a11yChipsEl&&n.appendChild(this.a11yChipsEl):this.a11yChipsEl&&this.regions["top-left"]?.appendChild(this.a11yChipsEl);let r=e&&n.children.length>0;n.classList.toggle("has",r),this.els.filtersSec?.classList.toggle("has",r)}this.lastSection&&this.renderSectionCard(this.lastSection)}buildExtendPrompt(){let e=document.createElement("div");e.className="sl-extend",e.setAttribute("role","status"),e.innerHTML='<span class="sl-extend-txt" data-ref="extendTxt"></span><button type="button" class="sl-extend-btn" data-ref="extendBtn"></button>',(this.regions["bottom-center"]??this.els.map).appendChild(e),this.extendEl=e,this.els.extendTxt=e.querySelector('[data-ref="extendTxt"]'),this.els.extendBtn=e.querySelector('[data-ref="extendBtn"]'),this.els.extendBtn.textContent=this.tf("picker.addTime","Add time"),this.els.extendBtn.addEventListener("click",()=>{this.handleExtend()})}buildBookedOverlay(){let e=document.createElement("div");e.className="sl-booked",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.innerHTML=`<div class="sl-booked-badge"><svg viewBox="0 0 24 24"><path d="M20 6L9 17l-5-5"/></svg></div><div class="sl-booked-title">${this.tf("picker.allSetTitle","You're all set")}</div><div class="sl-booked-sub" data-ref="bookedSub"></div>`,this.root.appendChild(e),this.bookedEl=e,this.els.bookedSub=e.querySelector('[data-ref="bookedSub"]')}tf(e,t){return S(e,t)}buildSoldoutOverlay(){if(!this.els.map)return;let e=document.createElement("div");e.className="sl-soldout",e.setAttribute("role","status");let t=(this.controller.doc?.theme?.brandName??this.opts.theme?.brandName??this.els.name?.textContent??this.tf("picker.soldOutEyebrow","This event")).toUpperCase();e.innerHTML=`<div class="sl-soldout-eyebrow">${t}</div><div class="sl-soldout-title">${this.tf("picker.soldOutTitle","Sold out")}</div><p class="sl-soldout-copy">${this.tf("picker.soldOutCopy","No reserved seats are currently available for this event.")}</p>`,this.els.map.appendChild(e),this.soldoutEl=e}syncSoldout(e,t){let i=this.controller.getGAAreas().length>0,s=this.isSoldOut(e,t,i);s!==this.soldOut&&(this.soldOut=s,this.soldoutEl?.classList.toggle("on",s))}isSoldOut(e,t,i){return!i&&e.length>0&&e.every(s=>(t[s.key]??0)===0)}setSalesClosed(e){let t=e||!!this.opts.readOnly;this.salesClosed!==t&&(this.salesClosed=t,this.applySalesClosed())}applySalesClosed(){this.salesClosed&&this.tableDialog&&!this.tableDialogHeld&&this.cancelTableDialog();let e=this.els.closedPill;if(e){e.classList.toggle("on",this.salesClosed);let t=this.els.closedPillText??e;t.textContent=this.tf("picker.salesClosedPill","Sales are closed")}this.root?.setAttribute("data-sales-closed",String(this.salesClosed)),this.salesClosed&&this.srEl&&(this.srEl.textContent=this.tf("picker.salesClosedToast","Sales are closed for this event.")),this.syncCta(),this.syncTray()}badgeHidden(e){return!!(this.opts.hideBadge||e?.hideBadge)}buildBadge(e){if(this.badgeHidden(e))return;let t=this.els.foot;if(!t)return;let i=document.createElement("a");i.className="sl-powered",i.href="https://seatlayer.io/?ref=picker",i.target="_blank",i.rel="noopener noreferrer",i.setAttribute("aria-label",this.tf("picker.poweredBy","Powered by SeatLayer")),i.innerHTML='<span class="sl-powered-mark" aria-hidden="true">'+ve+`</span><span>${this.tf("picker.poweredBy","Powered by SeatLayer")}</span>`,t.appendChild(i)}buildRegions(){if(!this.els.map)return;let e=["top-left","top-center","top-right","left-rail","bottom-left","bottom-center","bottom-right"];for(let t of e){let i=document.createElement("div");i.className="sl-anchor",i.dataset.region=t,this.els.map.appendChild(i),this.regions[t]=i}}cssVar(e){return this.root?getComputedStyle(this.root).getPropertyValue(e).trim():""}reducedMotion(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}scheduleMotion(e,t){let i=setTimeout(()=>{this.motionTimers.delete(i),this.destroyed||e()},t);this.motionTimers.add(i)}animateOnce(e,t,i=600){!e||this.reducedMotion()||(e.classList.remove(t),e.offsetWidth,e.classList.add(t),this.scheduleMotion(()=>e.classList.remove(t),i))}flashPickedSeat(e){this.reducedMotion()||this.controller.flashSeat(e,this.cssVar("--sl-accent")||"#f4b740")}flashHeldSeats(e){if(this.reducedMotion())return;(e.items??[]).filter(i=>i.objectType!=="ga").map(i=>i.label).slice(0,10).forEach((i,s)=>{let n=this.controller.seatByLabel(i);n&&this.scheduleMotion(()=>this.controller.flashSeat(n.id,this.cssVar("--sl-accent")||"#f4b740"),s*55)})}committedSelection(){let e=this.confirmSeat?.id,t=this.tableDialog&&!this.tableDialogHeld?this.tableDialog.id:null;return this.controller.getSelection().filter(i=>i.id!==e&&i.id!==t)}pendingSelectionCount(){let e=this.hold?.items??[],t=new Set(e.map(s=>s.label));return this.committedSelection().filter(s=>!t.has(s.label)).reduce((s,n)=>s+(n.quantity??1),0)+this.pendingGACount()}heldGACounts(){let e=new Map;for(let t of(this.hold?.items??[]).filter(i=>i.objectType==="ga"))e.set(t.objectId,(e.get(t.objectId)??0)+(t.quantity??1));return e}pendingGACount(){let e=this.heldGACounts();return[...this.gaQty.entries()].reduce((t,[i,s])=>t+Math.max(0,s-(e.get(i)??0)),0)}heldTicketCount(){return(this.hold?.items??[]).reduce((e,t)=>e+(t.quantity??1),0)}totalTicketCount(){let e=new Set((this.hold?.items??[]).map(i=>i.label)),t=this.committedSelection().filter(i=>!e.has(i.label)).reduce((i,s)=>i+(s.quantity??1),0);return this.heldTicketCount()+t+this.pendingGACount()}updateSelectionCapacity(){let e=new Set((this.hold?.items??[]).map(s=>s.label)),t=this.committedSelection().filter(s=>e.has(s.label)).reduce((s,n)=>s+(n.quantity??1),0),i=Math.max(0,this.maxTickets-this.heldTicketCount()-this.pendingGACount());this.controller.setMaxSelection(t+i)}canAddTicket(){return this.totalTicketCount()<this.maxTickets?!0:(this.toast(y("picker.maxTicketsForOrder",{count:this.maxTickets}),"warning"),!1)}pendingGATotal(e){let t=new Map;for(let i of(this.hold?.items??[]).filter(s=>s.objectType==="ga"))t.set(i.objectId,(t.get(i.objectId)??0)+(i.quantity??1));return e.reduce((i,s)=>i+this.paidPrice(s.categoryKey,null,s.price,s.id)*Math.max(0,(this.gaQty.get(s.id)??0)-(t.get(s.id)??0)),0)}syncCta(e=this.lastTrayCount,t=this.pendingSelectionCount()){let i=this.els.cta;if(!i)return;if(this.salesClosed){i.disabled=!0,i.textContent=this.tf("picker.salesClosedCta","Sales closed");return}if(this.confirmSeat||this.tableDialog&&!this.tableDialogHeld){i.disabled=!0,i.textContent=this.tableDialog?this.tf("picker.confirmYourTable","Confirm your table"):this.tf("picker.confirmOrCancelSeat","Confirm or cancel this seat");return}if(this.ctaPhase==="holding"){i.disabled=!0,i.innerHTML=`<span class="sl-cta-spin" aria-hidden="true"></span>${this.tf("picker.securingSeats","Securing your seats\u2026")}`;return}if(this.ctaPhase==="checkout"){i.disabled=!0,i.innerHTML=`<span class="sl-cta-spin" aria-hidden="true"></span>${this.tf("picker.openingCheckout","Opening secure checkout\u2026")}`;return}let s=this.controller.getSelectionValidity(e);if(s&&!s.isValid){i.disabled=!0,i.textContent=Ve(s,(n,r)=>this.tf(n,r),!0);return}i.disabled=e===0,i.textContent=this.hold?t?y("picker.secureMoreAndCheckout",{count:t}):this.tf("picker.continueToCheckout","Continue to checkout"):e?this.tf("picker.holdSeatsAndCheckout","Hold seats & checkout"):this.tf("picker.selectSeats","Select seats")}setCtaPhase(e){this.ctaPhase=e,this.syncCta(),this.renderPeek(this.lastTrayCount,this.lastTrayTotal,this.pendingSelectionCount()),e==="checkout"&&this.scheduleMotion(()=>{this.ctaPhase==="checkout"&&(this.ctaPhase="idle",this.syncCta(),this.renderPeek(this.lastTrayCount,this.lastTrayTotal,this.pendingSelectionCount()))},1100)}holdStorageKey(){return`@seatlayer/hold/v1/${encodeURIComponent(this.apiBase)}/${encodeURIComponent(this.opts.event)}`}rememberedHoldId(){if(this.opts.initialHoldId)return this.opts.initialHoldId;if(this.opts.restoreHold===!1||typeof window>"u")return null;try{return window.sessionStorage.getItem(this.holdStorageKey())}catch{return null}}rememberHold(e){if(!(this.opts.restoreHold===!1||typeof window>"u"))try{window.sessionStorage.setItem(this.holdStorageKey(),e.holdId)}catch{}}forgetHold(){if(!(typeof window>"u"))try{window.sessionStorage.removeItem(this.holdStorageKey())}catch{}}async resumeHoldFromServer(e,t){try{let i=await this.controller.resumeHold(e);if(!i)return null;let s={holdId:i.holdId,expiresAt:i.expiresAt,seats:i.seats,items:i.items};return this.hold=s,this.handedOff=!0,this.bookedShown=!1,this.ctaPhase="idle",this.startHoldTimer(s.expiresAt),this.rememberHold(s),this.syncTray(),this.emitHoldChange(),this.opts.onHoldRestored?.(s,s.seats??[],this.buildHandoff(s)),t&&this.toast(this.tf("picker.heldTicketsRestored","Your held tickets have been restored."),"success"),s}catch(i){let s=i?.status;return s===404||s===409?this.forgetHold():this.opts.onError?.(i),null}}async restoreRememberedHold(){let e=this.rememberedHoldId();e&&await this.resumeHoldFromServer(e,!0)}activeFloorObjects(){let e=this.controller.doc;if(!e)return[];let t=e.floors;if(t?.length){let i=this.controller.getActiveFloorId();return(t.find(s=>s.id===i)??t[0]).objects??[]}return e.objects??[]}buildMinimap(){this.els.map&&(this.minimap=wt({controller:this.controller,root:()=>this.root,cssVar:e=>this.cssVar(e),focusedSectionLabel:()=>this.lastSection?.label},this.regions["bottom-left"]??this.els.map))}catPrice(e){let t=e.tiers?.length?e.tiers[0].price:e.price;return t===void 0||!e.key?t:this.paidPrice(e.key,e.tiers?.[0]?.id??null,t)}catPriceRange(e){let t=e.tiers?.length?e.tiers.map(i=>this.paidPrice(e.key,i.id??null,i.price)):e.price==null?[]:[this.paidPrice(e.key,null,e.price)];if(e.key)for(let i of this.pricesByChannel.values())for(let s of i)s.categoryKey===e.key&&t.push(s.price);return t.length?{min:Math.min(...t),max:Math.max(...t)}:void 0}priceBands(){let e=this.controller.doc;if(!e)return[];let t=e.categories.map(o=>({key:o.key,range:this.catPriceRange(o)})).filter(o=>o.range!=null);if(!t.length)return[];let i=[...new Map(t.map(o=>[`${o.range.min}:${o.range.max}`,o.range])).values()].sort((o,l)=>o.min-l.min||o.max-l.max);if(i.length<=5)return i.map(o=>({id:`p${o.min}-${o.max}`,label:o.min===o.max?this.money(o.min):`${this.money(o.min)}\u2013${this.money(o.max)}`,keys:t.filter(l=>l.range.min===o.min&&l.range.max===o.max).map(l=>l.key),min:o.min,max:o.max}));let s=[...t].sort((o,l)=>o.range.min-l.range.min||o.range.max-l.range.max),n=Math.ceil(s.length/4),r=[];for(let o=0;o<s.length;o+=n){let l=s.slice(o,o+n),d=Math.min(...l.map(p=>p.range.min)),h=Math.max(...l.map(p=>p.range.max));r.push({id:`b${o}`,label:d===h?this.money(d):`${this.money(d)}\u2013${this.money(h)}`,keys:l.map(p=>p.key),min:d,max:h})}return r}buildPriceFilter(){if(!this.els.prices||!this.els.pricesSec)return;let e=this.priceBands();if(e.length<2)return;let t=document.createElement("select");t.className="sl-price-select",t.setAttribute("aria-label",this.tf("picker.filterAndFocusByPrice","Filter and focus seats by price")),t.innerHTML=`<option value="all">${this.tf("picker.allPrices","All prices")}</option>`+e.map(i=>`<option value="${i.id}">${i.label}</option>`).join(""),this.els.pricesSec.appendChild(t),t.addEventListener("change",()=>{let s=e.find(n=>n.id===t.value)?.keys??null;this.focusedCatKey=null,this.priceBandKeys=s?new Set(s):null,this.controller.setCategoryFilter(s),this.controller.focusCategoryFilter(s),this.pushAvailabilityTo3d(),this.syncFloors(),this.syncRung(),this.minimap?.refreshMinimap(),this.syncPrices(),this.lastSection&&this.showSectionCard(this.lastSection)})}buildArenaChrome(){let e=this.controller.doc;if(!e||!this.els.map)return;let t=e.objects.some(i=>i.type==="section")||(e.floors??[]).some(i=>i.objects.some(s=>s.type==="section"));if(this.canOffer3d()){let i=document.createElement("div");i.className="sl-projection",i.setAttribute("role","group"),i.setAttribute("aria-label",this.tf("picker.venueView","Venue view")),i.innerHTML=`<button type="button" data-view="map" aria-pressed="true" title="${this.tf("picker.flat2dMap","Flat 2D map")}">${this.tf("picker.map","Map")}</button><button type="button" data-view="venue3d" aria-pressed="false" title="${this.tf("picker.interactive3dVenueView","Interactive 3D venue view")}">3D</button>`,i.querySelectorAll("button").forEach(s=>{s.addEventListener("click",()=>{this.setBuyerView(s.dataset.view)})}),this.regions["top-right"].appendChild(i),this.projectionEl=i,this.syncProjection()}if(t){let i=[...e.objects,...(e.floors??[]).flatMap(h=>h.objects)],s=new Set((e.zones??[]).map(h=>h.id)),r=i.some(h=>h.type==="section"&&typeof h.zone=="string"&&s.has(h.zone))?["zones","sections","seats"]:["sections","seats"],o=document.createElement("div");o.className="sl-rungs on",o.setAttribute("role","group"),o.setAttribute("aria-label",y("picker.zoomLevel"));let l={zones:y("picker.rungLabel.zones"),sections:y("picker.rungLabel.sections"),seats:y("picker.rungLabel.seats")},d={zones:y("picker.rungTip.zones"),sections:y("picker.rungTip.sections"),seats:y("picker.rungTip.seats")};o.innerHTML=r.map(h=>`<button type="button" data-rung="${h}" title="${d[h]}" aria-pressed="false">${l[h]}</button>`).join(""),o.querySelectorAll("button").forEach(h=>{h.addEventListener("click",()=>{let p=h.dataset.rung;this.controller.setRung(p),p==="seats"&&this.collapseSectionCard()})}),this.regions["top-center"].appendChild(o),this.rungsEl=o,this.syncRung()}if(this.controller.isMultiFloor()){let i=this.controller.getFloors(),s=document.createElement("div");s.className="sl-floors on";let n=document.createElement("select");n.setAttribute("aria-label",this.tf("picker.chooseLevel","Choose level"));let r=document.createElement("option");r.value="",r.textContent=this.tf("picker.allFloors","All floors"),n.appendChild(r);for(let d of i){let h=document.createElement("option");h.value=d.id,h.textContent=d.name,n.appendChild(h)}n.addEventListener("change",()=>{n.value===""?this.controller.setFloorOverview(!0):this.controller.setFloor(n.value),this.showSectionCard(null),this.syncFloors(),this.syncRung(),this.minimap?.refreshMinimap()}),s.appendChild(n);let o=document.createElement("button");o.type="button",o.className="sl-floor-info",o.textContent="i";let l=this.tf("picker.floorHelp","All floors shows the complete venue. Choose one level to inspect and select its seats.");o.setAttribute("aria-label",l),o.title=l,s.appendChild(o),this.regions["left-rail"].appendChild(s),this.floorsEl=s,this.syncFloors()}}syncRung(){if(!this.rungsEl)return;let e=this.controller.getRung();this.rungsEl.querySelectorAll("button").forEach(t=>{let i=t.dataset.rung===e;t.classList.toggle("on",i),t.setAttribute("aria-pressed",String(i))})}syncProjection(){this.projectionEl&&this.projectionEl.querySelectorAll("button").forEach(e=>{let t=e.dataset.view===this.buyerView;e.classList.toggle("on",t),e.setAttribute("aria-pressed",String(t))})}canOffer3d(){return this.opts.enable3D===!1||!this.controller.doc||!pt()?!1:this.allSeats().length<=this.max3dSeats()}max3dSeats(){let e=this.opts.max3DSeats;if(typeof e=="number"&&e>0)return e;let t=globalThis.navigator;return(t?.hardwareConcurrency??8)<=4||(t?.deviceMemory??8)<=4||(globalThis.matchMedia?.("(pointer: coarse)").matches??!1)?Mt/2:Mt}syncFloors(){if(!this.floorsEl)return;let e=this.controller.getActiveFloorId(),t=this.controller.isFloorOverview(),i=this.floorsEl.querySelector("select");i&&(i.value=t?"":e)}showSectionCard(e){if(this.lastSection=e,this.secCardEl?.remove(),this.secCardEl=null,!e){this.minimap?.refreshMinimap();return}this.secCardCollapsed=this.controller.getRung()==="seats",this.secCardShownAt=Date.now(),this.renderSectionCard(e),this.minimap?.refreshMinimap()}sectionNeighbours(e){let t=this.activeFloorObjects().filter(s=>s.type==="section"&&!this.controller.isSectionClosed(s.id)&&this.controller.getSectionSeatCount(s.id)>0);if(t.length<2)return null;let i=t.findIndex(s=>s.id===e);return i<0?null:{previous:t[(i-1+t.length)%t.length],next:t[(i+1)%t.length]}}wireSectionNavigation(e){e.querySelectorAll("[data-section-nav]").forEach(t=>{t.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation();let s=t.dataset.sectionNav;s&&this.controller.focusSection(s)})})}renderSectionCard(e){if(!this.els.map)return;if(this.secCardEl?.remove(),this.root?.dataset.layout==="narrow"&&(this.hold||this.committedSelection().length||this.pendingGACount())){this.lastSection=null;return}let t=e.categories.length?e.categories.map(p=>{let c=this.controller.doc?.categories.find(f=>f.key===p.key);return c?this.catPriceRange(c):{min:p.priceMin,max:p.priceMax}}).filter(p=>p!=null):[{min:e.priceMin,max:e.priceMax}],i=Math.min(...t.map(p=>p.min)),s=Math.max(...t.map(p=>p.max)),n=i===s?this.money(i):`${this.money(i)}\u2013${this.money(s)}`,r=q("picker.seatsLeftInSection",e.seatsLeft),o=`<button type="button" class="sl-seccard-x" aria-label="${y("picker.closeSectionSummary")}">\u2715</button>`,l=gt(this.sectionNeighbours(e.id)),d=document.createElement("div");if(this.root?.dataset.layout==="narrow")d.className="sl-seccard strip on",d.setAttribute("role","status"),d.setAttribute("aria-label",y("picker.sectionSummaryAria",{label:e.label})),d.innerHTML=`<span class="sl-seccard-dot" style="background:${e.color}"></span><span class="sl-seccard-name">${e.label}</span><span class="sl-seccard-left">${r}</span>`+(e.categories.length?`<span class="sl-seccard-price">${n}</span>`:"")+l+o,this.wireSectionNavigation(d),d.querySelector(".sl-seccard-x").addEventListener("click",()=>this.controller.overview()),(this.els.sheetHead??this.els.side??this.els.map).appendChild(d);else if(this.secCardCollapsed)d.className="sl-seccard mini on",d.setAttribute("role","button"),d.setAttribute("aria-label",y("picker.sectionSummaryAria",{label:e.label})),d.innerHTML=`<span class="sl-seccard-dot" style="background:${e.color}"></span><span class="sl-seccard-name">${e.label}</span><span class="sl-seccard-left">${r}</span>`+l+o,this.wireSectionNavigation(d),d.addEventListener("click",p=>{p.target.closest(".sl-seccard-x")||(this.secCardCollapsed=!1,this.secCardShownAt=Date.now(),this.renderSectionCard(e))}),d.querySelector(".sl-seccard-x").addEventListener("click",()=>this.controller.overview()),(this.regions["top-center"]??this.els.map).appendChild(d);else{d.className="sl-seccard on",d.setAttribute("role","dialog"),d.setAttribute("aria-label",y("picker.sectionSummaryAria",{label:e.label}));let p=e.categories.map(c=>{let f=this.priceBandKeys!=null&&!this.priceBandKeys.has(c.key),m=this.controller.doc?.categories.find(k=>k.key===c.key),v=m?this.catPriceRange(m):{min:c.priceMin,max:c.priceMax},w=v&&v.min!==v.max?`${this.money(v.min)}\u2013${this.money(v.max)}`:this.money(v?.min??c.price);return`<span class="sl-seccard-mix-item${f?" sl-dim":""}"><span class="sl-seccard-mix-dot" style="background:${c.color}"></span>${c.label} <span class="sl-seccard-mix-price">${w}</span></span>`}).join("");d.innerHTML=`<div class="sl-seccard-head"><span class="sl-seccard-dot" style="background:${e.color}"></span><span class="sl-seccard-name">${e.label}</span>`+(e.categories.length?`<span class="sl-seccard-price">${n}</span>`:"")+o+`</div><div class="sl-seccard-zone">${e.zoneLabel?`${e.zoneLabel} \xB7 `:""}<span class="sl-seccard-left">${r}</span></div>`+(e.entrance?`<div class="sl-seccard-entrance">${y("picker.entrance")} ${String(e.entrance).replace(/[&<>"]/g,c=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[c])}</div>`:"")+(p?`<div class="sl-seccard-mix">${p}</div>`:"")+`<div class="sl-seccard-foot"><button type="button" class="sl-seccard-overview">\u2190 ${y("picker.overview")}</button>`+l+`<span class="sl-seccard-hint">${y("picker.tapSeatHint")}</span></div>`,this.wireSectionNavigation(d),d.querySelector(".sl-seccard-x").addEventListener("click",()=>this.controller.overview()),d.querySelector(".sl-seccard-overview").addEventListener("click",()=>this.controller.overview()),(this.regions["top-center"]??this.els.map).appendChild(d)}this.secCardEl=d}collapseSectionCard(){!this.secCardEl||this.secCardCollapsed||!this.lastSection||this.root?.dataset.layout!=="narrow"&&(this.secCardCollapsed=!0,this.renderSectionCard(this.lastSection))}sectionCardOnView(){if(!(!this.secCardEl||this.secCardCollapsed||!this.lastSection)&&this.root?.dataset.layout!=="narrow"){if(this.controller.getRung()==="seats"){this.collapseSectionCard();return}if(Date.now()-this.secCardShownAt<1400){this.sectionCardCoverage()>.25&&this.collapseSectionCard();return}this.collapseSectionCard()}}sectionCardCoverage(){let e=this.secCardEl,t=this.lastSection;if(!e||!t||!this.els.map)return 0;let i=this.activeFloorObjects().find(k=>k.type==="section"&&k.id===t.id)?.outline;if(!i||i.length<3)return 0;let s=i.map(k=>this.controller.worldToScreen(k)),n=s.map(k=>k.x),r=s.map(k=>k.y),o=Math.min(...n),l=Math.min(...r),d=Math.max(...n)-o,h=Math.max(...r)-l;if(d<=0||h<=0)return 0;let p=this.els.map.getBoundingClientRect(),c=e.getBoundingClientRect(),f=c.left-p.left,m=c.top-p.top,v=Math.max(0,Math.min(f+c.width,o+d)-Math.max(f,o)),w=Math.max(0,Math.min(m+c.height,l+h)-Math.max(m,l));return v*w/(d*h)}announceSeat(e){if(!this.srEl)return;if(!e){this.srEl.textContent="";return}let t=this.controller.doc?.categories.find(c=>c.key===e.categoryKey),i=this.controller.getStatus(e.id)??"free",s=i==="free"?this.tf("picker.statusAvailable","available"):i==="held"?this.tf("picker.statusOnHold","on hold"):this.tf("picker.statusTaken2","taken"),n=t?this.catPriceRange(t):void 0,r=n?n.min===n.max?this.money(n.min):`${this.money(n.min)}\u2013${this.money(n.max)}`:void 0,o=this.controller.tableSelection(e.id),l=o??this.controller.seatDetails(e.id),d=this.rowTypeWord(l),h=l?.rowLabel??l?.displayLabel??e.displayLabel??e.label,p=o?`${d} ${h}, ${o.bookingMode==="variable"?y("picker.minToMaxGuests",{min:o.minOccupancy,max:o.maxOccupancy}):y("picker.capacityGuests",{count:o.capacity})}`:l?.objectType==="booth"?`${d} ${h}`:l?.objectType==="table"?`${d} ${h}, ${y("picker.seatNumberLower",{label:l.seatNumber??e.label})}`:y("picker.seatLabel",{label:l?.displayLabel??e.displayLabel??e.label});this.srEl.textContent=`${p}, ${t?.label??e.categoryKey}${r?`, ${r}`:""}, ${s}`}showTableDialog(e,t,i){this.dismissTableDialog(!1),this.tableDialog={...e},this.tableDialogHeld=t,this.tableDialogReturnFocus=i??document.activeElement;let s=d=>String(d??"").replace(/[&<>"']/g,h=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[h]),n=this.controller.doc?.categories.find(d=>d.key===e.categoryKey),r=e.bookingMode==="variable",o=this.rowTypeWord(e),l=document.createElement("div");l.className="sl-table-scrim",l.innerHTML=`<section class="sl-table-dialog" role="dialog" aria-modal="true" aria-labelledby="sl-table-title" aria-describedby="sl-table-copy"><div class="sl-table-head"><div class="sl-table-eyebrow">${s(r?y("picker.flexiblePartyTypeWord",{typeWord:o}):y("picker.wholeTypeWord",{typeWord:o}))}</div><h2 class="sl-table-title" id="sl-table-title">${s(e.displayLabel??e.label)}</h2><p class="sl-table-copy" id="sl-table-copy">${r?this.tf("picker.chooseGuestsCopy","Choose how many guests will sit together. This table is held exclusively for your party."):y("picker.allPlacesBookedTogether",{count:e.capacity})}</p></div><div class="sl-table-body"><div class="sl-table-summary"><span>${s(n?.label??e.categoryKey)}</span><b data-table-unit>${y("picker.perGuestPrice",{price:this.money(this.paidPrice(e.categoryKey,e.tierId??null,e.price,e.label))})}</b><span class="muted">${this.tf("picker.tableCapacity","Table capacity")}</span><span>${y("picker.guestsCount",{count:e.capacity})}</span><span class="muted">${this.tf("picker.total","Total")}</span><b data-table-total></b></div>`+(r?`<label class="sl-table-qtylabel" id="sl-table-qty-label">${this.tf("picker.numberOfGuests","Number of guests")}</label><div class="sl-table-stepper" role="group" aria-labelledby="sl-table-qty-label"><button type="button" data-table-step="-1" aria-label="${this.tf("picker.fewerGuests","Fewer guests")}">\u2212</button><output aria-live="polite" data-table-qty>${e.quantity}</output><button type="button" data-table-step="1" aria-label="${this.tf("picker.moreGuests","More guests")}">+</button></div><div class="sl-table-range">${y("picker.chooseMinMaxGuests",{min:e.minOccupancy,max:e.maxOccupancy})}</div>`:`<input type="hidden" data-table-qty value="${e.capacity}">`)+`<div class="sl-table-actions"><button type="button" class="sl-table-cancel">${y("common.cancel")}</button><button type="button" class="sl-table-confirm">${t?this.tf("picker.updateTable","Update table"):r?this.tf("picker.selectTable","Select table"):this.tf("picker.selectWholeTable","Select whole table")}</button></div></div></section>`,this.root.appendChild(l),this.tableDialogEl=l,this.renderTableDialogState(),l.querySelectorAll("[data-table-step]").forEach(d=>{d.addEventListener("click",()=>{if(!this.tableDialog)return;let h=Math.max(this.tableDialog.minOccupancy,Math.min(this.tableDialog.maxOccupancy,this.tableDialog.quantity+Number(d.dataset.tableStep)));this.tableDialog={...this.tableDialog,quantity:h},this.renderTableDialogState()})}),l.querySelector(".sl-table-cancel").addEventListener("click",()=>this.cancelTableDialog()),l.querySelector(".sl-table-confirm").addEventListener("click",()=>{this.confirmTableDialog()}),l.addEventListener("mousedown",d=>{d.target===l&&this.cancelTableDialog()}),l.addEventListener("keydown",d=>{if(d.key!=="Tab")return;let h=[...l.querySelectorAll('button:not(:disabled),[tabindex]:not([tabindex="-1"])')];if(!h.length)return;let p=h[0],c=h[h.length-1];d.shiftKey&&document.activeElement===p?(d.preventDefault(),c.focus()):!d.shiftKey&&document.activeElement===c&&(d.preventDefault(),p.focus())}),requestAnimationFrame(()=>l.querySelector(r?'[data-table-step="-1"]':".sl-table-confirm")?.focus())}renderTableDialogState(){let e=this.tableDialog,t=this.tableDialogEl;if(!e||!t)return;let i=t.querySelector("output[data-table-qty]");i&&(i.value=String(e.quantity));let s=t.querySelector("input[data-table-qty]");s&&(s.value=String(e.quantity)),t.querySelectorAll("[data-table-step]").forEach(o=>{let l=Number(o.dataset.tableStep);o.disabled=l<0?e.quantity<=e.minOccupancy:e.quantity>=e.maxOccupancy});let n=this.paidPrice(e.categoryKey,e.tierId??null,e.price,e.label),r=t.querySelector("[data-table-total]");r&&(r.textContent=this.money(n*e.quantity))}async confirmTableDialog(){let e=this.tableDialog,t=this.tableDialogHeld;if(!e)return;let i=this.tableDialogEl?.querySelector(".sl-table-confirm");if(i&&(i.disabled=!0,i.textContent=t?this.tf("picker.updatingEllipsis","Updating\u2026"):this.tf("picker.selectingEllipsis","Selecting\u2026")),t){try{let s=await this.controller.replaceTableQuantity(e.label,e.quantity,this.opts.holdTtlMs);if(!s){this.toast(this.tf("picker.guestCountCouldNotBeSecured","That guest count could not be secured. Your current table hold is unchanged."),"warning"),this.renderTableDialogState(),i&&(i.disabled=!1,i.textContent=this.tf("picker.updateTable","Update table"));return}this.hold={holdId:s.holdId,expiresAt:s.expiresAt,seats:s.seats,items:s.items},this.startHoldTimer(s.expiresAt),this.dismissTableDialog(),this.syncTray(),this.emitHoldChange(),this.toast(y("picker.tableUpdatedForGuests",{label:e.label,count:e.quantity}),"success")}catch(s){this.opts.onError?.(s),this.toast(this.tf("picker.guestCountNoLongerAvailable","That guest count is no longer available. Your current hold is unchanged."),"error"),i&&(i.disabled=!1,i.textContent=this.tf("picker.updateTable","Update table"))}return}if(!this.controller.setTableQuantity(e.label,e.quantity)){i&&(i.disabled=!1,i.textContent=e.bookingMode==="variable"?this.tf("picker.selectTable","Select table"):this.tf("picker.selectWholeTable","Select whole table"));return}this.dismissTableDialog(),this.collapseSectionCard(),this.syncTray()}cancelTableDialog(){let e=this.tableDialog,t=this.tableDialogHeld;this.dismissTableDialog(),e&&!t&&this.controller.deselect(e.physicalSeatIds)}dismissTableDialog(e=!0){let t=this.tableDialogReturnFocus;this.tableDialogEl?.remove(),this.tableDialogEl=null,this.tableDialog=null,this.tableDialogHeld=!1,this.tableDialogReturnFocus=null,e&&requestAnimationFrame(()=>(t?.isConnected?t:this.root)?.focus())}showConfirm(e){let t=this.confirmSeat?.id;this.confirmEl?.remove(),this.confirmEl=null,this.confirmSeat=e,this.root?.setAttribute("data-confirming","true"),this.els.side?.toggleAttribute("inert",!0),Object.values(this.regions).forEach(x=>x.toggleAttribute("inert",!0)),this.controller.setSelectionFocus(e.id),t&&t!==e.id&&this.controller.deselect([t]),this.tipEl&&(this.tipEl.style.display="none");let i=this.controller.seatDetails(e.id),s=this.controller.doc?.categories.find(x=>x.key===e.categoryKey),n=i?.price??(s?.tiers?.length?s.tiers[0].price:s?.price),r=n!=null?this.paidPrice(e.categoryKey,i?.tierId??s?.tiers?.[0]?.id??null,n,e.label):void 0,o=x=>String(x??"\u2014").replace(/[&<>"]/g,g=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[g]),l=[i?.sectionLabel?`<div class="sl-confirm-field"><span class="sl-confirm-key">${this.tf("picker.section","Section")}</span><span class="sl-confirm-value">${o(i.sectionLabel)}</span></div>`:"",i?.rowLabel||i?.objectType==="booth"?`<div class="sl-confirm-field"><span class="sl-confirm-key">${o(this.rowTypeWord(i))}</span><span class="sl-confirm-value">${o(G(i)??i?.displayLabel??e.displayLabel??e.label)}</span></div>`:"",i?.objectType!=="booth"?`<div class="sl-confirm-field"><span class="sl-confirm-key">${this.tf("picker.seat","Seat")}</span><span class="sl-confirm-value">${o(i?.seatNumber??i?.displayLabel??e.displayLabel??e.label)}</span></div>`:""].filter(Boolean).join(""),d=i?.tiers??s?.tiers??[],h=i?.tierId??d[0]?.id,p=x=>x.buyerMessage?.trim()||(x.restriction==="companion"?this.tf("picker.companionRequiresWheelchair","Requires the adjacent wheelchair place"):void 0),c=d.length>1?`<fieldset class="sl-confirm-tiers"><legend>${this.tf("picker.ticketType","Ticket type")}</legend>`+d.map(x=>{let g=p(x);return`<button type="button" class="sl-confirm-tier" data-confirm-tier="${o(x.id)}" aria-pressed="${x.id===h}"><span class="sl-confirm-tier-copy"><span class="sl-confirm-tier-name">${o(x.name)}</span>`+(g?`<small class="sl-confirm-tier-note">${o(g)}</small>`:"")+`</span><span class="sl-confirm-tier-price">${this.money(this.paidPrice(e.categoryKey,x.id,x.price,e.label))}</span></button>`}).join("")+"</fieldset>":d[0]&&p(d[0])?`<p class="sl-confirm-tier-note">${o(p(d[0]))}</p>`:"",f=this.buyerView==="venue3d",m=document.createElement("div");m.className="sl-confirm",m.setAttribute("role","dialog"),m.setAttribute("aria-label",y("picker.confirmSeatLabel",{label:e.label}));let v=s?.color??"#6e7bff",w=Ie(v,this.cssVar("--sl-surface")||"#1a2234",.76)??v;m.style.setProperty("--sl-cat",v),m.style.setProperty("--sl-cat-ink",he(w,"#172033","#ffffff")),m.innerHTML='<div class="sl-confirm-grid">'+l+`</div><div class="sl-confirm-cat"><span class="sl-dot" style="background:${s?.color??"#6e7bff"}"></span><span class="sl-confirm-cat-name">${o(i?.categoryLabel??s?.label??e.categoryKey)}</span>`+(r!=null?`<span class="sl-confirm-price">${this.money(r)}</span>`:"")+'</div><div class="sl-confirm-body">'+c+vt(i?.wheelchairSpaceType)+bt(e.commercial)+(this.seatViewEnabled()&&this.buyerView!=="venue3d"?this.confirmThumbHtml(e):"")+(f?`${xt(e,`${i?.displayLabel??e.displayLabel??e.label} \xB7 ${r==null?this.tf("picker.priceNotSupplied","Price not supplied"):this.money(r)}`,f)}<div class="sl-confirm-inspect-row">${yt(e,f?this.view3dCompareSeatIds:null)}${De(this.canOffer3d(),f)}</div>`:De(this.canOffer3d(),f))+`<div class="sl-confirm-row"><button type="button" class="sl-confirm-cancel">${y("common.cancel")}</button><button type="button" class="sl-confirm-add"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4 4L19 7"/></svg>${this.tf("picker.select","Select")}</button></div></div>`,this.els.map.appendChild(m),this.confirmEl=m;let k=m.querySelector(".sl-confirm-thumb");if(k&&e.viewUrl){let x=e.viewMeta?.previewUrl??e.viewUrl;this.buyerAssetUrls.resolve(x).then(g=>{g&&m.isConnected&&this.confirmEl===m&&(k.src=g)}).catch(g=>this.opts.onError?.(g))}this.reanchorConfirm(),m.querySelector(".sl-confirm-view")?.addEventListener("click",()=>{this.openSeatView(e)}),m.querySelector(".sl-confirm-confidence")?.addEventListener("click",x=>{this.openSeatConfidencePassport(e,x.currentTarget instanceof HTMLElement?x.currentTarget:null)}),m.querySelector(".sl-confirm-compare")?.addEventListener("click",()=>this.saveView3dComparisonSeat(e)),m.querySelectorAll("[data-confirm-tier]").forEach(x=>{x.addEventListener("click",()=>{let g=x.dataset.confirmTier,C=d.find(b=>b.id===g);if(!C)return;this.controller.setSeatTier(e.id,C.id),m.querySelectorAll("[data-confirm-tier]").forEach(b=>{b.setAttribute("aria-pressed",String(b===x))});let u=m.querySelector(".sl-confirm-price");u&&(u.textContent=this.money(this.paidPrice(e.categoryKey,C.id,C.price,e.label))),this.reanchorConfirm()})}),m.querySelector(".sl-confirm-3d")?.addEventListener("click",()=>{this.buyerView==="venue3d"?(this.dismissConfirm(),this.view3dHandle?.flyToSeat(e.id)):(this.view3dReturnSeat=e,this.dismissConfirm(),this.enter3d(e.id))}),m.querySelector(".sl-confirm-add").addEventListener("click",()=>this.commitConfirm()),m.querySelector(".sl-confirm-cancel").addEventListener("click",()=>this.cancelConfirm()),requestAnimationFrame(()=>m.querySelector(".sl-confirm-add")?.focus())}reanchorConfirm(){if(!this.confirmEl||!this.confirmSeat||this.root?.dataset.view3d==="on")return;let e=this.controller.worldToScreen({x:this.confirmSeat.x,y:this.confirmSeat.y});if(this.root?.dataset.layout==="narrow")return;let t=this.els.map.clientWidth,i=this.els.map.clientHeight,s=this.confirmEl.offsetWidth||276,n=this.confirmEl.offsetHeight||230,r=s/2+12,o=Math.max(r,Math.min(t-r,e.x)),l=e.y+n+24<=i,d=e.y<n+24&&l;this.confirmEl.dataset.placement=d?"below":"above",this.confirmEl.style.left=`${o}px`,this.confirmEl.style.top=`${Math.max(8,Math.min(i-8,e.y))}px`}dismissConfirm(){this.confirmEl?.remove(),this.confirmEl=null,this.confirmSeat=null,this.root?.removeAttribute("data-confirming"),Object.values(this.regions).forEach(e=>e.toggleAttribute("inert",!1)),this.applyPanelCollapsed(),this.controller.setSelectionFocus(null)}commitConfirm(){this.confirmSeat&&(this.dismissConfirm(),this.collapseSectionCard(),this.syncTray(),this.syncSelectionTo3d())}cancelConfirm(){let e=this.confirmSeat;e&&(this.controller.deselect([e.id]),this.confirmSeat&&this.dismissConfirm(),this.syncSelectionTo3d(),this.root?.focus({preventScroll:!0}))}closeConfirm(){this.dismissConfirm()}seatViewEnabled(){return this.opts.seatView!==!1}allSeats(){if(!this.allSeatsCache){let e=this.controller.doc;this.allSeatsCache=e?Ue(e):[]}return this.allSeatsCache}async openSeatView(e){if(!this.root||!this.seatViewEnabled())return;let t=++this.seatViewGen,i=this.controller.doc,s=this.controller.getActiveFloorId(),n=e.focalPoint??i?.floors?.find(p=>p.id===s)?.focalPoint??i?.focalPoint??{x:0,y:0},r,o,l=!1;if(e.viewUrl){let p,c=null;try{let m=e.viewMeta?.previewUrl;m&&m!==e.viewUrl?(c=await this.buyerAssetUrls.resolve(m),p=e.viewUrl):p=await this.buyerAssetUrls.resolve(e.viewUrl)}catch(m){t===this.seatViewGen&&this.opts.onError?.(m);return}if(t!==this.seatViewGen||!p||e.viewMeta?.previewUrl&&e.viewMeta.previewUrl!==e.viewUrl&&!c||!this.root||!this.seatViewEnabled())return;let f={url:p,...c?{previewUrl:c}:{},...e.viewMeta?.sourceWidth!==void 0?{sourceWidth:e.viewMeta.sourceWidth}:{},...e.viewMeta?.sourceHeight!==void 0?{sourceHeight:e.viewMeta.sourceHeight}:{},...e.viewMeta?.previewWidth!==void 0?{previewWidth:e.viewMeta.previewWidth}:{},...e.viewMeta?.previewHeight!==void 0?{previewHeight:e.viewMeta.previewHeight}:{},...e.viewMeta?.coverage?{coverage:e.viewMeta.coverage}:{},...e.viewMeta?.capturedAt?{capturedAt:e.viewMeta.capturedAt}:{},...e.viewMeta?.sourceLabel?{sourceLabel:e.viewMeta.sourceLabel}:{}};r=f,o=At(f),l=ji(f)}else{let p;try{let{generateSeatPanorama:c}=await ut();p=c(e,n,this.allSeats())}catch(c){t===this.seatViewGen&&this.opts.onError?.(c);return}if(t!==this.seatViewGen||!this.root||!this.seatViewEnabled())return;r={url:p.url,generated:!0},o=y("picker.illustrationCaption",{m:p.distanceM})}this.closeSeatView(!1);let d=y("picker.viewFromSeat",{label:e.label}),h=ct({root:this.root,source:r,caption:o,real:l,closeLabel:this.tf("picker.close","Close"),dragHint:this.tf("picker.dragToLookAround","Drag to look around \xB7 scroll to zoom"),viewFromSeatLabel:d,real360Label:y("picker.real360"),previewLabel:y("picker.preview"),resolveAsset:p=>this.buyerAssetUrls.resolve(p),onClose:()=>this.closeSeatView()});this.viewEl=h.element,this.viewCleanup=()=>h.dispose()}closeSeatView(e=!0){e&&(this.seatViewGen+=1),this.viewCleanup?.(),this.viewCleanup=null,this.viewEl?.remove(),this.viewEl=null}money(e){let t=this.opts.pricing?.formatter;return t?t(e,this.currency):Bi(e,this.currency,{locale:this.opts.locale,fallback:(i,s)=>`${i} ${s}`})}scheduleOfferBoundary(e){if(this.offerBoundaryTimer&&clearTimeout(this.offerBoundaryTimer),this.offerBoundaryTimer=null,!this.api.availability||this.destroyed)return;let t=Date.now(),i=ot(e,t);if(i==null)return;let s=6*36e5,n=Math.min(Math.max(i-t+1e3,1e3),s);this.offerBoundaryTimer=setTimeout(()=>{this.offerBoundaryTimer=null,!document.hidden&&this.refreshOfferAvailability(!1)},n)}scheduleOfferRefresh(e){!this.api.availability||this.destroyed||(this.offerRefreshTimer&&clearTimeout(this.offerRefreshTimer),this.offerRefreshTimer=setTimeout(()=>{this.offerRefreshTimer=null,this.refreshOfferAvailability(e)},e?180:0))}async refreshOfferAvailability(e){if(!(!this.api.availability||this.destroyed))try{let t=await this.api.availability(this.opts.event,e);if(this.destroyed)return;let i=He(t);if(!i)return;this.offerAvailability=i,this.applyChannelPricing(i.channelPricing),this.scheduleOfferBoundary(i);let s=Re(i),n={...this.hostPricing?.prices??{},...s},r=Object.keys(n).length>0||this.hostPricing?.formatter?{prices:n,...this.hostPricing?.formatter?{formatter:this.hostPricing.formatter}:{}}:void 0;this.setPricing(r),this.syncOffer(),this.opts.onOfferAvailabilityChange?.(i)}catch{!this.destroyed&&!this.offerBoundaryTimer&&!document.hidden&&(this.offerBoundaryTimer=setTimeout(()=>{this.offerBoundaryTimer=null,!document.hidden&&this.refreshOfferAvailability(!1)},3e4))}}offerPrice(e){return e?this.offerAvailability?.prices.find(t=>t.categoryKey===e)??null:null}applyChannelPricing(e){this.channelByObject.clear(),this.pricesByChannel.clear();for(let t of e?.channels??[])this.pricesByChannel.set(t.channelId,t.priceOverrides);for(let t of e?.objects??[])this.pricesByChannel.has(t.channelId)&&this.channelByObject.set(t.label,t.channelId)}syncOffer(){let e=this.els.offer;if(!e)return;let t=this.offerAvailability,i=t?.release??null,s=i?null:t?.upcoming??null;if(!t||t.state==="closed"||t.state==="sold-out"||!i&&!s){e.classList.remove("has"),e.replaceChildren();return}let n=i??s,r=document.createElement("div");r.className="sl-offer-main";let o=document.createElement("div");o.className="sl-offer-copy";let l=document.createElement("span");l.className="sl-offer-kicker",l.textContent=i?this.tf("picker.currentTicketOffer","Current ticket offer"):this.tf("picker.upcomingTicketOffer","Upcoming ticket offer");let d=document.createElement("strong");d.className="sl-offer-name",d.textContent=n.name||(i?this.tf("picker.currentOffer","Current offer"):this.tf("picker.scheduledOffer","Scheduled offer"));let h=document.createElement("span");h.className="sl-offer-line";let p=[];i&&t.fromPrice!=null&&p.push(this.money(t.fromPrice/100)),i&&n.remaining!=null&&p.push(y("picker.offerRemainingAvailable",{count:n.remaining})),i&&n.endsAt!=null&&p.push(y("picker.offerUntil",{time:we(n.endsAt,this.eventTimezone,this.opts.locale)})),s?.startsAt!=null&&p.push(y("picker.offerStarts",{time:we(s.startsAt,this.eventTimezone,this.opts.locale)})),h.textContent=p.join(" \xB7 "),o.append(l,d,h);let c=document.createElement("details");c.className="sl-offer-info";let f=document.createElement("summary");f.setAttribute("aria-label",y("picker.howOfferWorks",{name:d.textContent??""})),f.textContent="i";let m=document.createElement("div");m.className="sl-offer-detail",m.textContent=i?this.tf("picker.offerDetailActive","This price applies automatically to eligible seats. Tickets in active carts temporarily reduce the available quantity; released or expired holds return it. When the offer ends, the next matching offer or normal ticket price takes over."):this.tf("picker.offerDetailUpcoming","Tickets are available at their normal price now. This scheduled offer will apply automatically to eligible seats when it starts."),c.append(f,m),r.append(o,c),e.replaceChildren(r),e.classList.add("has")}paidPrice(e,t,i,s){let n=s?this.channelByObject.get(s):void 0;if(n&&e){let o=this.pricesByChannel.get(n)?.find(l=>l.categoryKey===e&&l.tierId===(t??null));if(o)return o.price}let r=e?this.opts.pricing?.prices?.[e]:void 0;return r===void 0?i:typeof r=="number"?r:t&&r.tiers?.[t]!==void 0?r.tiers[t]:r.base??i}syncPrices(){let e=this.controller.doc;if(!e||!this.els.prices)return;let t=this.controller.categoryAvailability(),i=e.categories.filter(l=>!l.notForSale);this.narrateAvailability(i,t),this.syncSoldout(i,t);let s=5,n=i.length-s,r=n>1&&!this.pricesExpanded,o=r?i.slice(0,s):i;this.els.prices.classList.toggle("sl-expanded",n>1&&this.pricesExpanded),this.els.prices.innerHTML=o.map(l=>{let d=this.catPrice(l),h=this.catPriceRange(l),p=this.offerPrice(l.key),c=p?.previousPrice!=null&&p.previousPrice>p.price?p.previousPrice:null,f=this.focusedCatKey===l.key;return`<div class="sl-price-row${this.priceBandKeys!=null&&!this.priceBandKeys.has(l.key)?" sl-dim":""}${f?" sl-active":""}" data-cat="${O(l.key)}" role="button" tabindex="0" aria-pressed="${f}" title="${O(f?this.tf("picker.showAllSeats","Show all seats"):y("picker.showLabelSeatsOnMap",{label:l.label}))}"><span class="sl-dot" style="background:${O(l.color)}"></span><span class="sl-price-label">${O(l.label)}`+(p?.offerName?`<small class="sl-price-offer">${O(p.offerName)}</small>`:"")+`</span><span class="sl-price-left">${q("picker.leftCount",t[l.key]??0)}</span>`+(c!=null?`<span class="sl-price-was">${O(this.money(c))}</span>`:"")+(h!=null?`<span class="sl-price-amt">${h.min===h.max?this.money(h.min):`${this.money(h.min)}\u2013${this.money(h.max)}`}</span>`:d!=null?`<span class="sl-price-amt">${this.money(d)}</span>`:"")+"</div>"}).join("")+(n>1?`<button type="button" class="sl-price-more" aria-expanded="${!r}">`+(r?y("picker.showAllTicketTypes",{count:i.length}):this.tf("picker.showFewer","Show fewer"))+"</button>":"")+`<div class="sl-status-key" aria-label="${this.tf("picker.seatStatusLegend","Seat status legend")}"><span class="sl-status-item"><i class="sl-status-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><rect x="5" y="10" width="14" height="10" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/></svg></i>${this.tf("picker.temporarilyHeld","Temporarily held")}</span><span class="sl-status-item"><i class="sl-status-icon sold" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M7 17L17 7"/></svg></i>${this.tf("picker.sold","Sold")}</span></div>`,this.els.prices.querySelectorAll(".sl-price-row").forEach(l=>{l.addEventListener("mouseenter",()=>this.controller.getRenderer()?.setCategoryHighlight?.(l.dataset.cat??null)),l.addEventListener("mouseleave",()=>this.controller.getRenderer()?.setCategoryHighlight?.(null));let d=()=>this.focusCategory(l.dataset.cat??"");l.addEventListener("click",d),l.addEventListener("keydown",h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),d())})}),this.els.prices.querySelector(".sl-price-more")?.addEventListener("click",()=>{this.pricesExpanded=!this.pricesExpanded,this.syncPrices()})}focusCategory(e){if(!e)return;let t=this.focusedCatKey===e?null:e;this.focusedCatKey=t,this.priceBandKeys=t?new Set([t]):null;let i=this.els.pricesSec?.querySelector(".sl-price-select");i&&(i.value="all"),this.controller.setCategoryFilter(t?[t]:null),this.controller.focusCategoryFilter(t?[t]:null),this.pushAvailabilityTo3d(),this.syncFloors(),this.syncRung(),this.minimap?.refreshMinimap(),this.syncPrices(),this.lastSection&&this.showSectionCard(this.lastSection)}narrateAvailability(e,t){let i=this.els.liveText,s=this.lastCatAvail;this.lastCatAvail={...t};let n=this.controller.getActiveFloorId();if(n!==this.lastAvailFloorId&&(this.lastAvailFloorId=n,this.availQuietUntil=performance.now()+2e3),!(!i||!s||performance.now()<this.availQuietUntil))for(let r of e){let o=s[r.key],l=t[r.key]??0;if(o===void 0||l>=o)continue;let d=o-l;i.textContent=q("picker.seatsJustTakenInCategory",d,{label:r.label,left:l}),this.els.live?.classList.remove("on"),this.els.live?.offsetWidth,this.els.live?.classList.add("on"),this.liveTimer&&clearTimeout(this.liveTimer),this.liveTimer=setTimeout(()=>this.els.live?.classList.remove("on"),8e3);return}}evictTakenSelections(){let e=new Set([...this.controller.currentHold()?.labels??[],...this.holdingLabels]),t=this.controller.getSelection().filter(i=>!e.has(i.label)&&(this.controller.getStatus(i.id)??"free")!=="free");t.length&&(this.controller.deselect(t.map(i=>i.id)),this.toast(y("picker.seatJustTakenByAnother",{label:t[0].label}),"error"))}syncTray(){if(!this.els.tray)return;this.updateSelectionCapacity();let e=this.committedSelection();this.root?.dataset.layout==="narrow"&&this.secCardEl&&(this.hold||e.length||this.pendingGACount())&&(this.secCardEl.remove(),this.secCardEl=null,this.lastSection=null);let t=this.controller.getGAAreas(),i=this.hold?.items??[],s=[],n=new Set;if(this.salesClosed&&!e.length&&!i.length){let u=this.eventWhenText?`<span class="when">${String(this.eventWhenText).replace(/[&<>"]/g,b=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[b])}</span>`:"";s.push(`<div class="sl-closed-note" role="status"><b>${this.tf("picker.salesClosedPill","Sales are closed")}</b><span>${this.tf("picker.salesClosedCopy","Ticket sales for this event have ended.")}${u}</span></div>`)}else!e.length&&!i.length&&!t.length?s.push(`<div class="sl-tray-hint">${this.tf("picker.trayHintTapOrBest","Tap a seat on the map, or let us pick the best available for you.")}</div>`):!e.length&&!i.length&&s.push(`<div class="sl-tray-hint">${this.tf("picker.trayHintTapOrStanding","Tap a seat on the map \u2014 or grab standing tickets below.")}</div>`);let r=!e.length&&!i.length&&!this.pendingGACount();if(r&&(this.baReopen=!1),!this.salesClosed&&!this.hold&&(r||this.baReopen||this.bestAvailableBusy||this.bestAvailableConfirm)){let u=(this.controller.doc?.categories??[]).filter(T=>!T.notForSale),b=this.controller.getBestAvailableZones();this.baZone&&!b.some(T=>T.id===this.baZone)&&(this.baZone=""),s.push(this.bestAvailableConfirm?`<div class="sl-ba" role="alert"><div class="sl-ba-title"><span class="spark" aria-hidden="true">\u2726</span>${this.tf("picker.replaceCurrentChoices","Replace your current choices?")}</div><div class="sl-ba-replace"><b>${y("picker.willFindSeatsTogether",{count:this.baQty})}</b><span>${this.tf("picker.manualTicketsRemovedNote","Your manually selected tickets will be removed only after a new group is secured.")}</span></div><div class="sl-ba-actions"><button type="button" data-ba-cancel>${this.tf("picker.keepMine","Keep mine")}</button><button type="button" class="replace" data-ba-replace>${this.tf("picker.findNewSeats","Find new seats")}</button></div></div>`:`<div class="sl-ba"><div class="sl-ba-title"><span class="spark" aria-hidden="true">\u2726</span>${this.tf("picker.findBestSeatsTogether","Find the best seats together")}</div><div class="sl-ba-copy"><span class="wide">${this.tf("picker.willChooseClosestGroup","We\u2019ll choose the closest available group for you.")}</span><span class="narrow">${this.tf("picker.closestGroupChosenInstantly","Closest available group, chosen instantly.")}</span></div>`+(this.controller.hasPremiumSeats()?`<button type="button" class="sl-ba-premium${this.baPremium?" on":""}" data-ba-premium aria-pressed="${this.baPremium?"true":"false"}"><span class="star" aria-hidden="true">\u2605</span>${this.tf("picker.bestSeatsPremium","Best seats")}</button>`:"")+(u.length>1?`<select aria-label="${this.tf("picker.preferredTicketType","Preferred ticket type")}" data-ba-cat><option value="">${this.tf("picker.anyTicketType","Any ticket type")}</option>`+u.map(T=>`<option value="${T.key}"${this.baCat===T.key?" selected":""}>${T.label}</option>`).join("")+"</select>":'<span aria-hidden="true"></span>')+(b.length?`<select aria-label="${this.tf("picker.preferredVenueZone","Preferred venue zone")}" data-ba-zone><option value="">${this.tf("picker.anyVenueZone","Any venue zone")}</option>`+b.map(T=>`<option value="${O(T.id)}"${this.baZone===T.id?" selected":""}>${O(T.label)}</option>`).join("")+"</select>":"")+`<div class="sl-ba-qty"><button type="button" data-ba="-1" aria-label="${this.tf("picker.fewerSeats","Fewer seats")}">\u2212</button><span>${this.baQty}</span><button type="button" data-ba="1" aria-label="${this.tf("picker.moreSeats","More seats")}">+</button></div><button type="button" class="sl-ba-go${this.bestAvailableBusy?" sl-busy":""}"${this.bestAvailableBusy?" disabled":""}>`+(this.bestAvailableBusy?`<span class="sl-ba-spin" aria-hidden="true"></span>${this.tf("picker.findingBestSeats","Finding the best seats\u2026")}`:q("picker.findBestSeatsCount",this.baQty))+"</button>"+(this.baReopen?`<button type="button" class="sl-ba-back" data-ba-close>${this.tf("picker.keepMyPicks","Keep my picks")}</button>`:"")+"</div>")}let o=(u,b,T,E=1,M,A)=>Tt({d:u?this.controller.seatDetails(u):null,area:T==="ga"?t.find(L=>L.id===M):void 0,label:b,objectType:T,quantity:E,identity:A}),l=Ct;for(let u of i){let b=`held:${u.label}`;n.add(b);let T=this.controller.doc?.categories.find(D=>D.key===u.categoryKey),E=u.tierId?T?.tiers?.find(D=>D.id===u.tierId)?.name:void 0,M=u.objectType!=="ga"?this.controller.seatByLabel(u.label):null,A=u.objectType==="table"?this.controller.tableSelection(u.label):null,L=this.seatViewEnabled()&&!!M&&u.objectType!=="table";s.push(`<div class="sl-chip sl-held${this.lastTrayKeys.has(b)?"":" sl-enter"}" data-key="${b}" data-held="${encodeURIComponent(u.label)}"${M?` data-locate="${M.id}"`:""}><div class="sl-chip-main">`+o(M?.id??null,u.label,u.objectType,u.quantity??1,u.objectId,A??void 0)+`<div class="sl-chip-sub"><span class="sl-ticket-state held" aria-label="${this.tf("picker.heldForYou","Held for you")}" title="${this.tf("picker.heldForYou","Held for you")}"><svg viewBox="0 0 24 24"><rect x="5" y="10" width="14" height="10" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/></svg></span><span class="cat">${T?.label??u.categoryKey}${E?` \xB7 ${E}`:""}</span>`+(A?.bookingMode==="variable"?`<button type="button" class="sl-table-edit" data-table-edit="${encodeURIComponent(u.label)}">${y("picker.guestsCountEdit",{count:u.quantity??1})}</button>`:"")+ze(M?.wheelchairSpaceType)+Be(M?.commercial)+`<span class="amt">${this.money(this.paidPrice(u.categoryKey,u.tierId,u.unitPrice,u.label)*(u.quantity??1))}</span></div></div>`+l(y("picker.removeHeldTicketLabel",{label:u.label}),L?u.label:null)+"</div>")}let d=new Set(i.map(u=>u.label)),h=this.seatViewEnabled();for(let u of e.filter(b=>!d.has(b.label))){let b=`seat:${u.id}`;n.add(b);let T=this.controller.doc?.categories.find(L=>L.key===u.categoryKey),E=u.tiers&&u.tiers.length?`<select class="tier" data-tier="${u.id}" aria-label="${y("picker.ticketTierFor",{label:u.label})}">`+u.tiers.map(L=>`<option value="${L.id}"${L.id===u.tierId?" selected":""}>${L.name} \xB7 ${this.money(this.paidPrice(u.categoryKey,L.id,L.price,u.label))}</option>`).join("")+"</select>":"",M=u.tiers?.find(L=>L.id===u.tierId)??u.tiers?.[0],A=M?.buyerMessage?.trim()||(M?.restriction==="companion"?this.tf("picker.companionRequiresWheelchair","Requires the adjacent wheelchair place"):"");s.push(`<div class="sl-chip${this.lastTrayKeys.has(b)?"":" sl-enter"}" data-key="${b}" data-seat="${u.id}" data-locate="${u.id}"><div class="sl-chip-main">`+o(u.id,u.label,u.objectType,u.quantity??1,u.objectId,u)+`<div class="sl-chip-sub"><span class="sl-ticket-state" aria-label="${this.tf("picker.selected","Selected")}" title="${this.tf("picker.selected","Selected")}"><svg viewBox="0 0 24 24"><path d="M5 12l4 4L19 6"/></svg></span><span class="cat">${T?.label??u.categoryKey}</span>`+(u.objectType==="table"&&u.bookingMode==="variable"?`<button type="button" class="sl-table-edit" data-table-edit="${encodeURIComponent(u.label)}">${y("picker.guestsCountEdit",{count:u.quantity??1})}</button>`:"")+`${ze(u.wheelchairSpaceType)}${Be(u.commercial)}${E}<span class="amt">${this.money(this.paidPrice(u.categoryKey,u.tierId??null,u.price,u.label)*(u.quantity??1))}</span></div>`+(A?`<small class="sl-tier-note">${O(A)}</small>`:"")+"</div>"+l(y("picker.removeSeatLabel",{label:u.label}),h&&u.objectType!=="table"?u.label:null)+"</div>")}for(let u of t){let b=this.gaQty.get(u.id)??0;s.push(`<div class="sl-ga" data-ga="${u.id}"><div class="sl-ga-info"><div class="sl-ga-name">${u.displayLabel??u.label}</div><div class="sl-ga-sub">${u.displayType??this.tf("picker.generalAdmission","General admission")} \xB7 ${this.money(this.paidPrice(u.categoryKey,null,u.price,u.id))} \xB7 ${q("picker.leftCount",u.available)}</div></div><div class="sl-ga-qty"><button type="button" data-d="-1" aria-label="${this.tf("picker.fewer","Fewer")}">\u2212</button><span>${b}</span><button type="button" data-d="1" aria-label="${this.tf("picker.more","More")}">+</button></div></div>`)}!this.salesClosed&&!this.hold&&!r&&!this.baReopen&&!this.bestAvailableBusy&&!this.bestAvailableConfirm&&s.push(`<button type="button" class="sl-ba-reopen" data-ba-reopen><span aria-hidden="true">\u2726</span>${this.tf("picker.findTogetherInstead","Find seats together instead")}</button>`),this.els.tray.innerHTML=s.join(""),this.lastTrayKeys=n,this.els.tray.querySelectorAll("[data-ba]").forEach(u=>{u.addEventListener("click",()=>{this.baQty=Math.max(1,Math.min(this.maxTickets,this.baQty+Number(u.dataset.ba))),this.syncTray()})}),this.els.tray.querySelector("[data-ba-cat]")?.addEventListener("change",u=>{this.baCat=u.target.value}),this.els.tray.querySelector("[data-ba-zone]")?.addEventListener("change",u=>{this.baZone=u.target.value}),this.els.tray.querySelector("[data-ba-premium]")?.addEventListener("click",()=>{this.baPremium=!this.baPremium,this.syncTray()}),this.els.tray.querySelector(".sl-ba-go")?.addEventListener("click",()=>{if(this.pendingSelectionCount()>0){this.bestAvailableConfirm=!0,this.syncTray(),this.els.tray.querySelector("[data-ba-replace]")?.focus();return}this.bestAvailable(this.baQty,this.baCat||void 0,{preferPremium:this.baPremium,zoneId:this.baZone||void 0})}),this.els.tray.querySelector("[data-ba-cancel]")?.addEventListener("click",()=>{this.bestAvailableConfirm=!1,this.syncTray(),this.els.tray.querySelector(".sl-ba-go")?.focus()}),this.els.tray.querySelector("[data-ba-reopen]")?.addEventListener("click",()=>{this.baReopen=!0,this.syncTray(),this.els.tray.querySelector(".sl-ba-go")?.focus()}),this.els.tray.querySelector("[data-ba-close]")?.addEventListener("click",()=>{this.baReopen=!1,this.syncTray(),this.els.tray.querySelector("[data-ba-reopen]")?.focus()}),this.els.tray.querySelector("[data-ba-replace]")?.addEventListener("click",()=>{this.bestAvailableConfirm=!1,this.bestAvailable(this.baQty,this.baCat||void 0,{preferPremium:this.baPremium,zoneId:this.baZone||void 0})}),this.els.tray.querySelectorAll(".sl-chip .rm").forEach(u=>{u.addEventListener("click",()=>{let b=u.closest(".sl-chip");if(b.dataset.held){this.removeHeldLabel(decodeURIComponent(b.dataset.held),b);return}let T=b.dataset.seat,E=this.controller.getSelection().find(A=>A.id===T)?.label??this.tf("picker.seat","Seat"),M=()=>{this.controller.deselect([T]),this.toast(y("picker.labelRemoved",{label:E}),"neutral",{label:this.tf("picker.undo","Undo"),onClick:()=>{let A=this.controller.select([T]);this.toast(A.length?y("picker.labelRestored",{label:E}):y("picker.labelNoLongerAvailable",{label:E}),A.length?"success":"warning")}})};if(this.reducedMotion()){M();return}b.classList.add("sl-leave"),this.scheduleMotion(M,150)})}),this.els.tray.querySelectorAll("[data-table-edit]").forEach(u=>{u.addEventListener("click",b=>{b.stopPropagation();let T=decodeURIComponent(u.dataset.tableEdit??""),E=this.controller.tableSelection(T);if(!E)return;let M=i.find(A=>A.label===T&&A.objectType==="table");this.showTableDialog({...E,quantity:M?.quantity??E.quantity},!!M,u)})}),this.els.tray.querySelectorAll(".sl-chip .tier").forEach(u=>{u.addEventListener("change",()=>this.controller.setSeatTier(u.dataset.tier,u.value||null))}),this.els.tray.querySelectorAll(".sl-chip .view[data-view-label]").forEach(u=>{u.addEventListener("click",()=>{let b=this.controller.seatByLabel(u.dataset.viewLabel);b&&this.openSeatView(b)})}),this.els.tray.querySelectorAll(".sl-chip[data-locate]").forEach(u=>{let b=()=>this.controller.flashSeat(u.dataset.locate,this.cssVar("--sl-accent")||"#f4b740");u.addEventListener("mouseenter",b),u.addEventListener("focusin",b)}),this.els.tray.querySelectorAll(".sl-ga button").forEach(u=>{u.addEventListener("click",()=>{let T=u.closest(".sl-ga").dataset.ga,E=t.find(L=>L.id===T),M=Number(u.dataset.d);if(M>0&&!this.canAddTicket())return;let A=Math.max(0,Math.min(E?.available??0,(this.gaQty.get(T)??0)+M));this.gaQty.set(T,A),this.syncTray()})}),this.salesClosed&&this.els.tray.querySelectorAll(".sl-ba-go,[data-ba],[data-ba-cat],[data-ba-zone],[data-ba-replace],.sl-ga button").forEach(u=>{u.disabled=!0});let p=this.pendingGATotal(t),c=this.pendingGACount(),f=i.reduce((u,b)=>u+this.paidPrice(b.categoryKey,b.tierId,b.unitPrice,b.label)*(b.quantity??1),0),m=i.reduce((u,b)=>u+(b.quantity??1),0),v=e.filter(u=>!d.has(u.label)),w=v.reduce((u,b)=>u+this.paidPrice(b.categoryKey,b.tierId??null,b.price,b.label)*(b.quantity??1),0)+p+f,k=v.reduce((u,b)=>u+(b.quantity??1),0)+c+m,x=this.pendingSelectionCount(),g=this.lastTrayCount,C=this.lastTrayTotal;if(this.els.count.textContent=k?q("picker.ticketsCount",k):this.tf("picker.noSeatsSelected","No seats selected"),this.els.total.textContent=k?this.money(w):"",this.root?.setAttribute("data-has-selection",String(k>0)),this.root?.setAttribute("data-ba-active",String(this.bestAvailableConfirm||this.bestAvailableBusy||this.baReopen)),this.els.foot?.classList.toggle("empty",k===0),this.els.seatSummary&&(this.els.seatSummary.textContent=k?q("picker.seatsSelectedCount",k):""),this.syncCta(k,x),this.hold){let u=m||this.hold.seats?.length||0;this.els.holdTitle&&(this.els.holdTitle.textContent=y("picker.securedCount",{count:u})),this.els.holdCopy&&(this.holdCopyPending=x>0,this.els.holdCopy.textContent=x?y("picker.moreSelectedCount",{count:x}):Ne(this.holdExpiresAt));let b=this.els.holdChange;b&&(b.disabled=this.releasingHold,b.textContent=this.releasingHold?this.tf("picker.releasingEllipsis","Releasing\u2026"):this.tf("picker.change","Change"))}k!==g&&this.animateOnce(this.els.count,"sl-value-pop",380),w!==C&&this.animateOnce(this.els.total,"sl-value-pop",380),g===0&&k>0&&(this.animateOnce(this.els.cta,"sl-ready",520),this.sideCollapsed&&this.root?.dataset.layout!=="narrow"&&this.setPanelCollapsed(!1)),this.renderPeek(k,w,x),this.lastTrayCount=k,this.lastTrayTotal=w,this.opts.onSelectionChange?.(e),this.emitSelectionValidity(k,e)}emitSelectionValidity(e,t){let i=this.controller.getSelectionValidity(e);i&&(i.seats=t,this.opts.onSelectionValidityChange?.(i),i.isValid?this.lastSelectionValidity!==!0&&this.opts.onSelectionValid?.(t):this.lastSelectionValidity!==!1&&this.opts.onSelectionInvalid?.(i),this.lastSelectionValidity=i.isValid)}renderPeek(e,t,i){if(!this.els.peek)return;let s=(this.controller.doc?.categories??[]).map(n=>this.catPrice(n)).filter(n=>n!=null);this.els.peek.innerHTML=Et({count:e,total:t,pendingCount:i,ctaPhase:this.ctaPhase,hasHold:!!this.hold,salesClosed:this.salesClosed,fromPrice:s.length?Math.min(...s):null,money:n=>this.money(n)})}async removeHeldLabel(e,t){if(!e||this.releasingLabels.has(e))return!1;this.releasingLabels.add(e),t?.setAttribute("aria-busy","true");let i=t?.querySelector(".rm");i&&(i.disabled=!0);try{let s=this.handedOff;if(!await this.controller.releaseLabels([e]))return this.toast(y("picker.couldNotRemoveLabel",{label:e}),"error"),!1;let r=this.controller.currentHold();return this.hold=r?{holdId:r.holdId,expiresAt:r.expiresAt,seats:r.seats,items:r.items}:null,this.handedOff=!!this.hold&&s,this.bookedShown=!1,this.ctaPhase="idle",this.hold?this.startHoldTimer(this.hold.expiresAt):(this.stopHoldTimer(),this.forgetHold()),this.syncTray(),this.emitHoldChange(),this.toast(y("picker.labelRemovedFromHold",{label:e}),"success"),!0}finally{this.releasingLabels.delete(e),t?.removeAttribute("aria-busy"),i?.isConnected&&(i.disabled=!1)}}async handleChangeSeats(){if(!this.hold||this.releasingHold)return;this.releasingHold=!0;let e=this.els.holdChange;e&&(e.disabled=!0,e.textContent=this.tf("picker.releasingEllipsis","Releasing\u2026"));try{await this.release(),this.hold||this.toast(this.tf("picker.heldTicketsReleased","Held tickets released. Choose your new seats."),"success")}finally{this.releasingHold=!1,e?.isConnected&&(e.disabled=!1,e.textContent=this.tf("picker.change","Change"))}}async handleCta(){if(this.salesClosed)return;let e=this.controller.getSelectionValidity(this.totalTicketCount());if(e&&!e.isValid){this.toast(Ve(e,(i,s)=>this.tf(i,s)),"warning");return}if(this.totalTicketCount()>this.maxTickets){this.toast(y("picker.removeTicketsUntilOrFewer",{count:this.maxTickets}),"warning");return}let t=this.committedSelection();if(this.hold&&!t.some(i=>!(this.hold.items??[]).some(s=>s.label===i.label))){let i=this.hold.seats??t;this.handedOff=!0,this.setCtaPhase("checkout"),this.checkoutHandoff(this.hold,i);return}this.holdingLabels=new Set(t.map(i=>i.label)),this.setCtaPhase("holding");try{let i=null,s=[...this.gaQty.entries()].filter(([,r])=>r>0),n=this.committedSelection();if(n.length){let r=await this.controller.hold(void 0,this.opts.holdTtlMs);i=r?{holdId:r.holdId,expiresAt:r.expiresAt,seats:r.seats,items:r.items}:null}for(let[r,o]of s){let l=await this.controller.holdGA(r,o,{ttlMs:this.opts.holdTtlMs});i=l?{holdId:l.holdId,expiresAt:l.expiresAt,seats:l.seats,items:l.items}:i}if(!i){this.toast(this.tf("picker.seatsJustTaken","One or more seats were just taken. Please pick again."),"error"),this.setCtaPhase("idle"),this.syncTray();return}this.hold=i,this.handedOff=!0,this.startHoldTimer(i.expiresAt),this.flashHeldSeats(i),this.setCtaPhase("checkout"),this.emitHoldChange(),this.checkoutHandoff(i,i.seats??n)}catch(i){this.opts.onError?.(i);let s=i,n=(s.conflicts??[]).map(o=>o.label).filter(Boolean).slice(0,3);s.reason==="event_closed"&&this.setSalesClosed(!0);let r=s.reason==="event_closed"?this.tf("picker.seatSalesClosedForEvent","Seat sales have closed for this event."):s.reason==="companion_pair_required"?this.tf("picker.companionPairRequired","Select the adjacent wheelchair place with each companion ticket."):s.reason==="ticket_option_not_applicable"?this.tf("picker.ticketOptionNotApplicable","That ticket choice is not available for the selected seat."):n.length?n.length===1?y("picker.labelsNoLongerAvailable.one",{labels:n.join(", ")}):y("picker.labelsNoLongerAvailable.other",{labels:n.join(", ")}):this.tf("picker.seatsJustTaken","One or more seats were just taken. Please pick again.");this.toast(r,"error"),this.setCtaPhase("idle")}finally{this.holdingLabels.clear(),this.ctaPhase==="holding"&&(this.ctaPhase="idle"),this.syncTray()}}startHoldTimer(e){this.stopHoldTimer(),this.holdExpiresAt=e,this.hold&&this.rememberHold(this.hold);let t=this.els.hold;t.innerHTML=`<span class="sl-hold-dot" aria-hidden="true"></span><span>${this.tf("picker.held","Held")}</span><span class="sl-hold-time" data-ref="holdTime"></span>`;let i=t.querySelector('[data-ref="holdTime"]');this.els.holdNote?.classList.add("on");let s=()=>{let n=Math.max(0,this.holdExpiresAt-Date.now());i&&(i.textContent=_e(n)),!this.holdCopyPending&&this.els.holdCopy&&(this.els.holdCopy.textContent=Ne(this.holdExpiresAt)),t.classList.add("on"),t.classList.toggle("is-expiring",n>0&&n<=Pt),this.setExtendPrompt(n>0&&n<=Pt,n),n<=0&&this.stopHoldTimer()};s(),this.holdTimer=setInterval(s,500)}stopHoldTimer(){this.holdTimer&&clearInterval(this.holdTimer),this.holdTimer=null,this.els.hold?.classList.remove("on","is-expiring"),this.els.holdNote?.classList.remove("on"),this.setExtendPrompt(!1,0)}setExtendPrompt(e,t){if(this.extendEl)if(e&&this.controller.currentHold()&&!this.bookedShown){let i=Math.ceil(t/1e3),s=Math.floor(i/60),n=String(i%60).padStart(2,"0");this.els.extendTxt.innerHTML=y("picker.seatsHeldForNeedMoreTime",{time:`${s}:${n}`}),this.extendEl.classList.add("on")}else this.extendEl.classList.remove("on")}async handleExtend(){let e=this.els.extendBtn;e.disabled=!0;let t=e.textContent;e.textContent=this.tf("picker.addingEllipsis","Adding\u2026");try{let i=await this.controller.extendHold(this.opts.holdTtlMs);i?(this.hold={holdId:i.holdId,expiresAt:i.expiresAt,seats:i.seats,items:i.items},this.holdExpiresAt=i.expiresAt,this.extendEl?.classList.remove("on"),this.rememberHold(this.hold),this.emitHoldChange(),this.toast(this.tf("picker.moreTimeAdded","More time added \u2014 your seats are still held."),"success")):this.toast(this.tf("picker.couldNotAddMoreTime","Couldn't add more time \u2014 please head to checkout now."),"warning")}catch(i){this.opts.onError?.(i),this.toast(this.tf("picker.couldNotAddMoreTime","Couldn't add more time \u2014 please head to checkout now."),"warning")}finally{e.disabled=!1,e.textContent=t}}detectBooked(){this.bookedShown||!this.handedOff||!this.hold||this.controller.currentHold()===null&&this.showBooked()}showBooked(){if(this.bookedShown||!this.hold)return;this.bookedShown=!0;let e=this.buildHandoff(this.hold);this.stopHoldTimer(),this.forgetHold();let t=e.lineItems.reduce((i,s)=>i+s.quantity,0);this.els.bookedSub&&(this.els.bookedSub.innerHTML=`<span class="sl-booked-seats">${q("picker.ticketsCount",t)}</span> ${this.tf("picker.confirmedAndOnWay","confirmed. A confirmation is on its way.")}`),this.bookedEl?.classList.add("on"),this.opts.onBooked?.(e)}checkoutHandoff(e,t){if(this.checkoutMode==="hosted"){this.startHostedCheckout(e,t);return}this.opts.onCheckout?.(e,t,this.buildHandoff(e))}async startHostedCheckout(e,t){let i=this.buildHandoff(e),s=null;try{s=await(this.paymentOptions??=this.pubApi.paymentOptions(this.opts.event))}catch(r){this.opts.onError?.(r)}if(this.destroyed)return;let n=s?.providers?.[0];if(!n){let r=ft(s?.reason),o=!!this.opts.onCheckoutUnavailable||!!this.opts.onCheckout;this.opts.onCheckoutUnavailable?.({reason:r,handoff:i}),this.opts.onCheckout?.(e,t,i),o||this.openCheckoutPanel({kind:"unavailable",reason:r,seatCount:i.lineItems.reduce((l,d)=>l+d.quantity,0)});return}await this.openCheckoutPanel({kind:"pay",provider:n,order:{holdId:i.holdId,expiresAt:i.expiresAt,currency:i.currency,total:i.total,labels:i.lineItems.map(r=>r.displayLabel??r.label)}})}async openCheckoutPanel(e){let t;try{({mountCheckout:t}=await mt())}catch(i){this.opts.onError?.(i),this.toast(this.tf("picker.checkoutCouldNotBeOpened","Checkout could not be opened. Your seats are still held \u2014 please try again."),"error"),this.setCtaPhase("idle");return}this.destroyed||!this.root||(this.closeCheckoutPanel(),this.checkoutPanel=t({root:this.root,state:e,formatMoney:i=>this.money(i),startSession:i=>this.pubApi.startCheckout(this.opts.event,{...i,...this.opts.returnUrl?{returnUrl:this.opts.returnUrl}:{}}),orderStatus:i=>this.pubApi.orderStatus(i),onCancel:()=>{this.checkoutPanel=null,this.hold||this.setCtaPhase("idle")},onConfirmed:i=>{this.opts.onOrderConfirmed?.(i),this.controller.refresh()},onError:i=>this.opts.onError?.(i)}))}closeCheckoutPanel(){this.checkoutPanel?.destroy(),this.checkoutPanel=null}buildHandoff(e){let i=(e.items??[]).map(r=>{let o=this.controller.lineItemDisplay(r);return{label:r.label,...o.displayLabel?{displayLabel:o.displayLabel}:{},...o.displayType?{displayType:o.displayType}:{},objectId:r.objectId,objectType:r.objectType,categoryKey:r.categoryKey,tierId:r.tierId,unitPrice:this.paidPrice(r.categoryKey,r.tierId,r.unitPrice,r.label),currency:r.currency??this.currency,quantity:r.quantity??1}}),s=i[0]?.currency??this.currency,n=i.reduce((r,o)=>r+o.unitPrice*o.quantity,0);return{holdId:e.holdId,expiresAt:e.expiresAt,currency:s,lineItems:i,total:n}}emitHoldChange(){let e=this.hold;this.scheduleOfferRefresh(!0),this.opts.onHoldChange?.(e,e?.seats??[],e?this.buildHandoff(e):null)}toast(e,t="neutral",i){let s=this.els.toast;if(!s)return;s.replaceChildren();let n=document.createElement("span");if(n.textContent=e,s.appendChild(n),s.classList.toggle("has-action",!!i),i){let r=document.createElement("button");r.type="button",r.className="sl-toast-action",r.textContent=i.label,r.addEventListener("click",i.onClick,{once:!0}),s.appendChild(r)}s.dataset.tone=t,s.classList.add("on"),this.toastTimer&&clearTimeout(this.toastTimer),this.toastTimer=setTimeout(()=>{s.classList.remove("on"),s.classList.remove("has-action"),s.dataset.tone="neutral"},4200)}placeTooltip(){if(!this.tipEl)return;let e=this.els.map.clientWidth,t=this.tipEl.offsetWidth,i=this.tipEl.offsetHeight,s=this.tipPos.x+14,n=this.tipPos.y-i-12;s+t>e-8&&(s=this.tipPos.x-t-14),n<8&&(n=this.tipPos.y+18),this.tipEl.style.left=`${Math.max(8,s)}px`,this.tipEl.style.top=`${Math.max(8,n)}px`}rowTypeWord(e){let t=e?.displayType?.trim()||e?.rowType?.trim();return t||(e?.objectType==="table"?this.tf("picker.table","Table"):e?.objectType==="booth"?this.tf("picker.booth","Booth"):this.tf("picker.row","Row"))}updateTooltip(e){if(!this.tipEl)return;if(!e){this.tipEl.style.display="none";return}let t=m=>String(m??"\u2014").replace(/[&<>"]/g,v=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[v]),i=this.money(this.paidPrice(e.categoryKey,e.tierId??null,e.price,e.label)),s=e.objectType==="table"&&!!e.bookingMode,n=e.objectType==="booth",r=e.sectionLabel||e.rowLabel||e.seatNumber,o=s?`<div class="sl-tip-grid"><div class="sl-tip-field"><span class="sl-tip-key">${t(this.rowTypeWord(e))}</span><span class="sl-tip-val">${t(e.rowLabel??e.displayLabel??e.label)}</span></div><div class="sl-tip-field"><span class="sl-tip-key">${this.tf("picker.guests","Guests")}</span><span class="sl-tip-val">${e.bookingMode==="variable"?`${e.minOccupancy}\u2013${e.maxOccupancy}`:e.capacity}</span></div></div>`:n?'<div class="sl-tip-grid">'+(e.sectionLabel?`<div class="sl-tip-field"><span class="sl-tip-key">${this.tf("picker.section","Section")}</span><span class="sl-tip-val">${t(e.sectionLabel)}</span></div>`:"")+`<div class="sl-tip-field"><span class="sl-tip-key">${t(this.rowTypeWord(e))}</span><span class="sl-tip-val">${t(e.rowLabel??e.displayLabel??e.label)}</span></div></div>`:r?'<div class="sl-tip-grid">'+(e.sectionLabel?`<div class="sl-tip-field"><span class="sl-tip-key">${this.tf("picker.section","Section")}</span><span class="sl-tip-val">${t(e.sectionLabel)}</span></div>`:"")+(e.rowLabel?`<div class="sl-tip-field"><span class="sl-tip-key">${t(this.rowTypeWord(e))}</span><span class="sl-tip-val">${t(G(e))}</span></div>`:"")+(e.seatNumber?`<div class="sl-tip-field"><span class="sl-tip-key">${this.tf("picker.seat","Seat")}</span><span class="sl-tip-val">${t(e.seatNumber)}</span></div>`:"")+"</div>":`<div class="sl-tip-grid one"><div class="sl-tip-field"><span class="sl-tip-key">${this.tf("picker.seat","Seat")}</span><span class="sl-tip-val">${t(e.displayLabel??e.label)}</span></div></div>`,l=e.status==="not_for_sale",d=e.status==="free"?"":`<div class="sl-tip-status">${l?this.tf("picker.notAvailable","Not available"):e.status==="held"?y("map.statusHeld"):y("map.statusTaken")}</div>`,h=ie(e.commercial),p=h?`<div class="sl-tip-cx"><span class="g" aria-hidden="true">\u25D0</span>${t(h)}</div>`:"",c=ue(e.wheelchairSpaceType),f=c?`<div class="sl-tip-cx"><span class="g" aria-hidden="true">\u267F</span>${t(c)}</div>`:"";this.tipEl.style.setProperty("--sl-cat",e.categoryColor),this.tipEl.innerHTML=o+`<div class="sl-tip-cat"><span class="sl-tip-dot" style="background:${e.categoryColor}"></span><span class="sl-tip-name">${t(e.categoryLabel)}</span>`+(l?"":`<span class="sl-tip-amt">${i}</span>`)+"</div>"+f+p+d,this.tipEl.style.display="block",this.placeTooltip()}getSelection(){return this.committedSelection()}selectObjects(e){return this.controller.select(e)}deselectObjects(e){this.controller.deselect(e)}clearSelection(){this.dismissConfirm(),this.dismissTableDialog(),this.controller.clearSelection()}selectCategories(e){return this.controller.selectCategories(e)}deselectCategories(e){this.controller.deselectCategories(e)}setSelectableObjects(e){this.controller.setSelectableObjects(e)}setMaxSelection(e){this.maxTickets=Math.max(this.exactTickets??1,Math.floor(e)),this.controller.setMaxSelection(this.maxTickets),this.updateSelectionCapacity(),this.syncTray()}getSelectionValidity(){let e=this.controller.getSelectionValidity(this.totalTicketCount());return e&&(e.seats=this.committedSelection()),e}setMapTheme(e){this.destroyed||(this.opts.theme={...this.opts.theme??{},map:e??void 0},this.controller.setMapTheme(e))}setEventDetailsHidden(e){this.eventDetailsHidden=e,this.syncFullscreenButtons()}setPricing(e){let t=JSON.stringify(this.opts.pricing??null),i=JSON.stringify(e??null);t!==i&&(this.opts.pricing=e,!(this.destroyed||!this.els.prices)&&(this.els.pricesSec?.querySelector(".sl-price-select")?.remove(),this.buildPriceFilter(),this.syncPrices(),this.syncTray(),this.lastSection&&this.showSectionCard(this.lastSection)))}isColorblindSafe(){return this.cbSafe}setColorblindSafe(e){e!==this.cbSafe&&(this.cbSafe=e,this.cbEl?.setAttribute("aria-pressed",String(e)),this.controller.setColorblindSafe(e),qi(e))}setViewMode(e){this.controller.setViewMode(this.normalizeInitialView(e)),this.syncProjection(),this.dismissConfirm()}getViewMode(){return this.controller.getViewMode()}normalizeInitialView(e){return e==="perspective"?(this.perspectiveWarned||(this.perspectiveWarned=!0,console.warn("[seatlayer] initialView:'perspective' (2.5D) is deprecated for the buyer picker and was coerced to 'flat'. Use the Map | 3D control for the immersive view.")),"flat"):e??"flat"}getBuyerView(){return this.buyerView}setBuyerView(e,t){if(e==="map"){this.exit3d();return}let i=t?.flyToSeatId;if(this.buyerView==="venue3d"){i?(this.opts.onBuyerViewChange?.({view:"venue3d",seatId:i}),this.view3dHandle?.flyToSeat(i)):t?.resetView&&this.view3dHandle?.focusOverview();return}this.enter3d(i)}seatState3dFor(e){switch(this.controller.getStatus(e.id)){case"held":return"held";case"booked":return"sold";case"not_for_sale":return"dimmed";default:break}return this.priceBandKeys!=null&&!this.priceBandKeys.has(e.categoryKey)||this.limitedViewFilter&&(e.commercial?.restrictedView||e.commercial?.obstructedView)?"dimmed":"available"}pushAvailabilityTo3d(){if(!this.view3dHandle)return;let e=this.allSeats().map(t=>({seatId:t.id,state:this.seatState3dFor(t)}));this.view3dHandle.setAvailability(e)}syncSelectionTo3d(){this.view3dHandle&&this.view3dHandle.setSelection(this.controller.getSelection().map(e=>e.id))}async seatViewFor3d(e){let t=this.allSeats().find(i=>i.id===e);if(!t)return null;if(t.viewUrl)try{let i=t.viewMeta?.previewUrl,s=!!i&&i!==t.viewUrl,n=s?await this.buyerAssetUrls.resolve(i):null,r=s?t.viewUrl:await this.buyerAssetUrls.resolve(t.viewUrl);return!r||s&&!n?null:{url:r,...n?{previewUrl:n}:{},...s?{resolveUrl:o=>this.buyerAssetUrls.resolve(o)}:{},...t.viewMeta?.sourceWidth!==void 0?{sourceWidth:t.viewMeta.sourceWidth}:{},...t.viewMeta?.sourceHeight!==void 0?{sourceHeight:t.viewMeta.sourceHeight}:{},...t.viewMeta?.previewWidth!==void 0?{previewWidth:t.viewMeta.previewWidth}:{},...t.viewMeta?.previewHeight!==void 0?{previewHeight:t.viewMeta.previewHeight}:{},...t.viewMeta?.initialBearingDeg!==void 0?{initialBearingDeg:t.viewMeta.initialBearingDeg}:{},...t.viewMeta?.initialPitchDeg!==void 0?{initialPitchDeg:t.viewMeta.initialPitchDeg}:{},...t.viewMeta?.coverage?{coverage:t.viewMeta.coverage}:{},...t.viewMeta?.capturedAt?{capturedAt:t.viewMeta.capturedAt}:{},...t.viewMeta?.sourceLabel?{sourceLabel:t.viewMeta.sourceLabel}:{}}}catch(i){return this.opts.onError?.(i),null}return{url:"",generated:!0,mediaKind:"model",coverage:"exact-seat",sourceLabel:this.tf("picker.chartDerivedModel","Chart-derived model")}}emitAnalytics(e,t){try{this.opts.onAnalytics?.(e,{...t,surface:"buyer"})}catch{}}emit3dAnalytics(e,t){this.emitAnalytics(e,t)}onView3dSeatPick(e){if(this.salesClosed){this.toast(this.tf("picker.salesClosedToast","Sales are closed for this event."),"warning"),this.syncSelectionTo3d();return}let t=this.allSeats().find(o=>o.id===e);if(!t)return;let i=this.controller.tableSelection(e);if(this.committedSelection().some(o=>i?o.label===i.label:o.id===e)){this.controller.deselect([e]),this.dismissConfirm(),this.syncSelectionTo3d();return}let n=this.controller.getStatus(t.id);if(n==="held"||n==="booked"||n==="not_for_sale"){this.showUnavailable3dSeat(t,this.seatState3dFor(t),n),this.syncSelectionTo3d();return}if(this.dismissUnavailable3dSeat(),!this.controller.select([e]).length){this.syncSelectionTo3d(),this.dismissConfirm();return}if(this.opts.onBuyerViewChange?.({view:"venue3d",seatId:e}),this.flashPickedSeat(e),i){this.showTableDialog(i,!1),this.syncSelectionTo3d();return}this.opts.confirmSelection!==!1?this.showConfirm(t):this.syncTray(),this.syncSelectionTo3d()}showUnavailable3dSeat(e,t,i){let s=this.view3dEl;if(!s)return;this.dismissUnavailable3dSeat();let n=this.controller.seatDetails(e.id),r=n?.displayLabel??e.displayLabel??e.label,o=n?.sectionLabel,l=G(n),d=[o,l?y("picker.rowLabel",{label:l}):null,r].filter(Boolean).join(" \xB7 "),h=i==="held"?{title:this.tf("picker.temporarilyHeld","Temporarily held"),message:this.tf("picker.heldSeatExplanation","Another buyer is holding this seat. It may become available again.")}:i==="booked"?{title:this.tf("picker.sold","Sold"),message:this.tf("picker.soldSeatExplanation","This seat has already been booked.")}:{title:this.tf("picker.notForSale","Not for sale"),message:this.tf("picker.notForSaleExplanation","This seat is not included in the current sale.")},p=document.createElement("div");p.className="sl-view3d-unavailable",p.dataset.state=t,p.setAttribute("role","status"),p.setAttribute("aria-live","polite");let c=document.createElement("span");c.className="sl-view3d-unavailable-eyebrow",c.textContent=d||r;let f=document.createElement("strong");f.textContent=h.title;let m=document.createElement("div");m.className="sl-view3d-unavailable-copy",m.append(c,f);let v=document.createElement("button");v.type="button",v.setAttribute("aria-label",this.tf("picker.closeSeatStatus","Close seat status")),v.textContent="\xD7";let w=document.createElement("p");w.textContent=h.message,p.append(m,v,w),v.addEventListener("click",()=>p.remove()),s.appendChild(p),this.announceSeat(e)}dismissUnavailable3dSeat(){this.view3dEl?.querySelector(".sl-view3d-unavailable")?.remove()}saveView3dComparisonSeat(e){if(this.buyerView!=="venue3d")return;let t=this.view3dCompareSeatIds;t.includes(e.id)||(this.view3dCompareSeatIds=t.length===0?[e.id]:[t[0],e.id]),this.confirmSeat?.id===e.id&&(this.controller.deselect([e.id]),this.dismissConfirm(),this.syncSelectionTo3d(),this.syncTray()),this.view3dCompareChip.sync(),this.emit3dAnalytics("3d_comparison_saved",{seatId:e.id,count:this.view3dCompareSeatIds.length}),this.view3dCompareSeatIds.length>1?this.openView3dComparison():this.toast(this.tf("picker.chooseAnotherToCompare","Seat saved. Choose another seat to compare."),"success")}clearView3dComparison(){this.closeView3dComparison(!1),this.view3dCompareSeatIds=[],this.view3dCompareChip.remove(),this.emit3dAnalytics("3d_comparison_cleared")}view3dComparisonSnapshot(e){let t=this.allSeats().find(f=>f.id===e);if(!t)return null;let i=this.controller.seatDetails(t.id),s=this.controller.doc?.categories.find(f=>f.key===t.categoryKey),n=i?.price??(s?.tiers?.length?s.tiers[0].price:s?.price),r=n!=null?this.paidPrice(t.categoryKey,i?.tierId??s?.tiers?.[0]?.id??null,n,t.label):void 0,o=this.controller.getStatus(t.id),l=o==="held"?this.tf("picker.temporarilyHeld","Temporarily held"):o==="booked"?this.tf("picker.sold","Sold"):o==="not_for_sale"?this.tf("picker.notForSale","Not for sale"):this.tf("picker.available","Available"),d=t.viewUrl?At({url:t.viewUrl,...t.viewMeta?.coverage?{coverage:t.viewMeta.coverage}:{},...t.viewMeta?.capturedAt?{capturedAt:t.viewMeta.capturedAt}:{},...t.viewMeta?.sourceLabel?{sourceLabel:t.viewMeta.sourceLabel}:{}}):this.tf("picker.chartDerivedSeatEye","Live 3D \xB7 chart-derived seat-eye \xB7 not surveyed"),h=ie(t.commercial)||this.tf("picker.noAuthoredRestriction","No organizer-authored restriction"),p=i?.wheelchairSpaceType?`${ue(i.wheelchairSpaceType)} \xB7 metadata, not access certification`:this.tf("picker.noAccessibilityMetadata","No accessibility metadata supplied"),c=Lt(t.confidenceEvidence);return{seat:t,label:i?.displayLabel??t.displayLabel??t.label,section:i?.sectionLabel??t.sectionId??"\u2014",row:G(i)??i?.rowLabel??"\u2014",category:i?.categoryLabel??s?.label??t.categoryKey,price:r==null?this.tf("picker.priceNotSupplied","Not supplied"):this.money(r),availability:l,selectable:o==null||o==="free",viewSource:d,limited:h,accessibility:p,confidence:c}}openSeatConfidencePassport(e,t=null){let i=this.view3dEl;if(!i)return;this.closeSeatConfidencePassport(!1);let s=Lt(e.confidenceEvidence),n=e.confidenceEvidence,r=this.controller.seatDetails(e.id),o=g=>j(g),l=s.limitations.length?`<h4>Known limits</h4><ul>${s.limitations.map(g=>`<li>${o(g)}</li>`).join("")}</ul>`:"",d=s.modeledTarget?`<div><dt>Modeled target</dt><dd>${o(s.modeledTarget)}</dd></div>`:"",h=n?`<div><dt>Evidence ID</dt><dd>${o(n.evidenceId)}</dd></div><div><dt>Model version</dt><dd>${o(n.modelVersion)}</dd></div><div><dt>Event configuration</dt><dd>${o(n.eventConfigurationId??"Not configuration-specific")}</dd></div><div><dt>Approval</dt><dd>${o(n.approvedByRole??"No external approval supplied")}</dd></div>`+(n.validUntil?`<div><dt>Valid until</dt><dd>${o(n.validUntil.slice(0,10))}</dd></div>`:""):"<div><dt>Evidence ID</dt><dd>None supplied</dd></div>",p=ie(e.commercial)||this.tf("picker.noAuthoredRestriction","No organizer-authored restriction"),c=`<div><dt>View restriction</dt><dd>${o(p)}</dd></div>`+(e.commercial?.note?`<div><dt>Organizer note</dt><dd>${o(e.commercial.note)}</dd></div>`:""),f=document.createElement("div");f.className="sl-view3d-passport-shell",f.innerHTML=`<div class="sl-view3d-passport-scrim" aria-hidden="true"></div><section class="sl-view3d-passport" role="dialog" aria-modal="true" aria-labelledby="sl-view3d-passport-title"><header><div><span>Seat confidence passport</span><strong id="sl-view3d-passport-title">${o(r?.displayLabel??e.displayLabel??e.label)}</strong></div><button type="button" data-close aria-label="Close seat confidence passport">\xD7</button></header><div class="sl-view3d-passport-summary"><strong>${o(s.headline)}</strong><span>${o(s.coverage)} \xB7 ${o(s.freshness)}</span></div><dl><div><dt>Model status</dt><dd>${o(s.model)}</dd></div><div><dt>Reality evidence</dt><dd>${o(s.reality)}</dd></div><div><dt>Source</dt><dd>${o(s.provenance)}</dd></div>`+c+d+h+`</dl>${l}<p class="sl-view3d-passport-note">This passport describes supplied evidence and known limits. It does not guarantee that every temporary obstruction or real-world condition is knowable before the event build.</p></section>`;let m=[...new Set([...i.children,...[...this.els.map.children].filter(g=>g!==i)])].filter(g=>g instanceof HTMLElement),v=m.map(g=>({element:g,inert:g.inert,ariaHidden:g.getAttribute("aria-hidden")}));for(let g of m)g.inert=!0,g.setAttribute("aria-hidden","true");i.appendChild(f),i.classList.add("has-passport"),this.view3dPassportEl=f;let w=f.querySelector(".sl-view3d-passport"),k=()=>[...w.querySelectorAll('button:not(:disabled),[href],[tabindex]:not([tabindex="-1"])')],x=g=>{if(g.key==="Escape"){g.preventDefault(),g.stopPropagation(),g.stopImmediatePropagation(),this.closeSeatConfidencePassport();return}if(g.key!=="Tab")return;let C=k();if(!C.length)return;let u=C[0],b=C[C.length-1];g.shiftKey&&document.activeElement===u?(g.preventDefault(),b.focus()):!g.shiftKey&&document.activeElement===b&&(g.preventDefault(),u.focus())};window.addEventListener("keydown",x,!0),this.view3dPassportCleanup=()=>{window.removeEventListener("keydown",x,!0);for(let b of v)b.element.inert=b.inert,b.ariaHidden===null?b.element.removeAttribute("aria-hidden"):b.element.setAttribute("aria-hidden",b.ariaHidden);let g=t?.isConnected?t:this.confirmEl?.querySelector(".sl-confirm-confidence")??this.view3dCompareEl?.querySelector("[data-passport-seat]")??null,C=g?.closest(".sl-confirm,.sl-view3d-compare");C?.isConnected&&(C.inert=!1,C.removeAttribute("aria-hidden")),f.remove(),i.classList.remove("has-passport"),this.view3dPassportEl===f&&(this.view3dPassportEl=null);let u=g??this.view3dCompareEl?.querySelector("[data-passport-seat]")??this.confirmEl?.querySelector(".sl-confirm-confidence")??this.view3dCompareChip.mainButton();(t?.isConnected?t:u)?.focus()},f.addEventListener("click",g=>{let C=g.target instanceof HTMLElement?g.target:null;(C?.closest("[data-close]")||C?.classList.contains("sl-view3d-passport-scrim"))&&this.closeSeatConfidencePassport()}),requestAnimationFrame(()=>k()[0]?.focus()),this.emit3dAnalytics("3d_confidence_passport_opened",{seatId:e.id,evidenceId:n?.evidenceId??null,eventConfigurationId:n?.eventConfigurationId??null,modelLevel:n?.modelLevel??"unverified",realityLevel:n?.realityLevel??"none"})}closeSeatConfidencePassport(e=!0){let t=this.view3dPassportCleanup;if(this.view3dPassportCleanup=null,!t){this.view3dPassportEl?.remove(),this.view3dPassportEl=null,this.view3dEl?.classList.remove("has-passport");return}e||(document.activeElement instanceof HTMLElement?document.activeElement:null)?.blur(),t(),e||this.root?.focus({preventScroll:!0})}openView3dComparison(){let e=this.view3dEl;if(!e||this.view3dCompareSeatIds.length<2)return;this.closeView3dComparison(!1);let t=this.view3dCompareSeatIds.map(c=>this.view3dComparisonSnapshot(c)).filter(c=>!!c);if(t.length<2){this.clearView3dComparison();return}let i=c=>j(c),s=document.createElement("div");s.className="sl-view3d-compare-shell";let n=t.map((c,f)=>`<article><span>Seat ${f===0?"A":"B"}</span><strong>${i(c.label)}</strong><small>Section ${i(c.section)} \xB7 Row ${i(c.row)}</small><dl><div><dt>Current price</dt><dd>${i(c.price)}</dd></div><div><dt>Ticket type</dt><dd>${i(c.category)}</dd></div><div><dt>Availability</dt><dd>${i(c.availability)}</dd></div><div><dt>View source</dt><dd>${i(c.viewSource)}</dd></div><div><dt>View restriction</dt><dd>${i(c.limited)}</dd></div><div><dt>Seat confidence</dt><dd>${i(c.confidence.headline)}</dd></div><div><dt>Reality check</dt><dd>${i(c.confidence.reality)}</dd></div><div><dt>Accessibility</dt><dd>${i(c.accessibility)}</dd></div></dl><div class="sl-view3d-compare-actions"><button type="button" data-passport-seat="${i(c.seat.id)}">Passport</button><button type="button" data-view-seat="${i(c.seat.id)}">View seat</button><button type="button" class="select" data-select-seat="${i(c.seat.id)}"${c.selectable?"":" disabled"}>Select seat</button></div></article>`).join("");s.innerHTML=`<div class="sl-view3d-compare-scrim" aria-hidden="true"></div><section class="sl-view3d-compare" role="dialog" aria-modal="true" aria-labelledby="sl-view3d-compare-title"><header><div><span>Seat inspection</span><strong id="sl-view3d-compare-title">Compare disclosed attributes</strong></div><button type="button" data-close aria-label="Close seat comparison">\xD7</button></header><p class="sl-view3d-compare-note">Current price and availability come from this picker. Modeled views are chart-derived unless organizer media is labeled; SeatLayer does not invent why a seat has its price.</p><div class="sl-view3d-compare-grid">${n}</div></section>`;let r=document.activeElement instanceof HTMLElement?document.activeElement:null,o=[...e.children].filter(c=>c instanceof HTMLElement),l=o.map(c=>({element:c,inert:c.inert,ariaHidden:c.getAttribute("aria-hidden")}));for(let c of o)c.inert=!0,c.setAttribute("aria-hidden","true");e.appendChild(s),e.classList.add("has-comparison"),this.view3dCompareEl=s;let d=s.querySelector(".sl-view3d-compare"),h=()=>[...d.querySelectorAll('button:not(:disabled),[href],[tabindex]:not([tabindex="-1"])')],p=c=>{if(c.key==="Escape"){c.preventDefault(),this.closeView3dComparison();return}if(c.key!=="Tab")return;let f=h();if(!f.length)return;let m=f[0],v=f[f.length-1];c.shiftKey&&document.activeElement===m?(c.preventDefault(),v.focus()):!c.shiftKey&&document.activeElement===v&&(c.preventDefault(),m.focus())};window.addEventListener("keydown",p),this.view3dCompareCleanup=()=>{window.removeEventListener("keydown",p);for(let c of l)c.element.inert=c.inert,c.ariaHidden===null?c.element.removeAttribute("aria-hidden"):c.element.setAttribute("aria-hidden",c.ariaHidden);s.remove(),e.classList.remove("has-comparison"),this.view3dCompareEl===s&&(this.view3dCompareEl=null),r?.isConnected?r.focus():this.view3dCompareChip.mainButton()?.focus()},s.querySelector("[data-close]")?.addEventListener("click",()=>this.closeView3dComparison()),s.querySelectorAll("[data-passport-seat]").forEach(c=>c.addEventListener("click",()=>{let f=c.dataset.passportSeat,m=f?this.allSeats().find(v=>v.id===f):void 0;m&&this.openSeatConfidencePassport(m,c)})),s.querySelectorAll("[data-view-seat]").forEach(c=>c.addEventListener("click",()=>{let f=c.dataset.viewSeat;this.closeView3dComparison(!1),f&&this.view3dHandle?.flyToSeat(f)})),s.querySelectorAll("[data-select-seat]").forEach(c=>c.addEventListener("click",()=>{let f=c.dataset.selectSeat;f&&this.selectComparedSeat(f)})),requestAnimationFrame(()=>h()[0]?.focus()),this.emit3dAnalytics("3d_comparison_opened",{seatIds:this.view3dCompareSeatIds.slice()})}closeView3dComparison(e=!0){let t=this.view3dCompareCleanup;if(this.view3dCompareCleanup=null,!t){this.view3dCompareEl?.remove(),this.view3dCompareEl=null,this.view3dEl?.classList.remove("has-comparison");return}e||(document.activeElement instanceof HTMLElement?document.activeElement:null)?.blur(),t(),e||this.root?.focus({preventScroll:!0})}selectComparedSeat(e){if(this.salesClosed){this.toast(this.tf("picker.salesClosedToast","Sales are closed for this event."),"warning");return}let t=this.allSeats().find(s=>s.id===e);if(!t)return;if(this.closeView3dComparison(!1),!this.controller.select([e]).length){this.syncSelectionTo3d(),this.toast(this.tf("picker.seatNoLongerAvailable","That seat is no longer available."),"warning");return}this.syncSelectionTo3d(),this.showConfirm(t),this.emit3dAnalytics("3d_comparison_selected",{seatId:e})}async enter3d(e){if(this.view3dEl||!this.canOffer3d()||!this.els.map)return;let t=this.controller.doc;if(!t)return;this.buyerView="venue3d",this.view3dTargetSeatId=null,this.opts.onBuyerViewChange?.({view:"venue3d",...e?{seatId:e}:{}}),this.root?.setAttribute("data-view3d","on"),this.dismissConfirm(),this.syncProjection();let i=document.createElement("div");i.className="sl-view3d",i.setAttribute("role","group"),i.setAttribute("aria-label",this.tf("picker.interactive3dVenueView","Interactive 3D venue view"));let s=document.createElement("button");s.type="button",s.className="sl-view3d-back",s.innerHTML=`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15 18l-6-6 6-6"/></svg><span>${this.tf("picker.backToMap","Back to map")}</span>`;let n=s.querySelector("span"),r=h=>{this.view3dTargetSeatId=h;let p=!!h;i.classList.toggle("is-seat-focused",p);let c=p?this.tf("picker.backToVenue","Back to venue"):this.tf("picker.backToMap","Back to map");n&&(n.textContent=c),s.setAttribute("aria-label",c)};s.addEventListener("click",()=>{if(this.view3dTargetSeatId&&this.view3dHandle){this.view3dHandle.focusOverview();return}this.exit3d()}),i.appendChild(s);let o=document.createElement("button");o.type="button",o.className="sl-view3d-fs",o.textContent="\u26F6",o.setAttribute("aria-label",this.tf("picker.fullScreen","Full screen")),o.setAttribute("aria-pressed",String(!!document.fullscreenElement||this.fsFallback||this.framedFs)),o.addEventListener("click",()=>this.toggleFullscreen()),i.appendChild(o);let l=document.createElement("div");l.className="sl-view3d-loading",l.setAttribute("role","status"),l.setAttribute("aria-live","polite"),l.textContent=this.tf("picker.loading3d","Building the 3D venue\u2026"),i.appendChild(l),this.els.map.appendChild(i),this.view3dEl=i,this.view3dCompareChip.sync(),requestAnimationFrame(()=>{i.style.opacity="1"});let d=++this.view3dGen;try{let h=Ue(t),p=await ht();if(d!==this.view3dGen||this.buyerView!=="venue3d"||this.view3dEl!==i)return;let c=await p.prepareVenue3D({doc:t,seats:h});if(d!==this.view3dGen||this.buyerView!=="venue3d"||this.view3dEl!==i)return;let f=p.mountVenue3D(i,{doc:t,seats:h,prepared:c},{portraitOverviewCrop:!0,arriveAtSeatEye:!0,seatViewActionLabel:m=>this.allSeats().find(v=>v.id===m)?.viewUrl?this.tf("picker.openAuthored360","Open venue 360\xB0"):this.tf("picker.lookAroundLive3d","Look around in live 3D"),onSeatPick:m=>this.onView3dSeatPick(m),onSeatInspect:m=>this.onView3dSeatPick(m),onSectionFocusChange:m=>{let v=i.querySelector('select[data-locator="section"]'),w=m??"";!v||v.value===w||(v.value=w,v.dispatchEvent(new Event("change")))},onViewTargetChange:m=>{i.querySelector(".sl-view3d-nav")?.classList.toggle("is-seat-focused",!!m),r(m),this.opts.onBuyerViewChange?.({view:"venue3d",...m?{seatId:m}:{}})},getSeatView:m=>new Promise((v,w)=>{let k=()=>{this.seatViewFor3d(m).then(g=>{g?v(g):w(new Error("seat_view_unavailable"))})},x=globalThis.requestIdleCallback;typeof x=="function"?x(k,{timeout:1500}):setTimeout(k,50)}),onAnalytics:(m,v)=>this.emit3dAnalytics(m,v)});this.view3dHandle=f,l.remove(),this.pushAvailabilityTo3d(),this.syncSelectionTo3d(),kt(i,f),e&&f.flyToSeat(e)}catch(h){if(d!==this.view3dGen||this.buyerView!=="venue3d"||this.view3dEl!==i)return;this.opts.onError?.(h),this.toast(this.tf("picker.unavailable3d","3D could not start. The seat map is still available."),"warning"),this.exit3d()}}exit3d(){if(this.buyerView!=="venue3d"&&!this.view3dEl)return;this.view3dGen++,this.buyerView="map",this.view3dTargetSeatId=null,this.opts.onBuyerViewChange?.({view:"map"}),this.root?.removeAttribute("data-view3d"),this.closeSeatConfidencePassport(!1),this.closeView3dComparison(!1),this.view3dCompareChip.remove();try{this.view3dHandle?.dispose()}catch{}this.view3dHandle=null;let e=this.view3dEl;this.view3dEl=null,e&&(e.style.opacity="0",setTimeout(()=>e.remove(),320)),this.syncProjection();let t=this.view3dReturnSeat;this.view3dReturnSeat=null,t&&this.committedSelection().some(i=>i.id===t.id)&&this.opts.confirmSelection!==!1&&this.showConfirm(t)}getCurrentHold(){return this.hold}async resumeHold(e){return this.resumeHoldFromServer(e,!1)}async removeHeldTicket(e){return this.removeHeldLabel(e)}async bestAvailable(e,t,i={}){if(this.salesClosed||this.bestAvailableBusy)return null;e=Math.max(1,Math.min(this.maxTickets,Math.floor(e))),this.confirmSeat&&this.cancelConfirm(),this.bestAvailableConfirm=!1,this.bestAvailableBusy=!0;let s=this.els.tray?.querySelector(".sl-ba-go");s&&(s.disabled=!0,s.classList.add("sl-busy"),s.innerHTML=`<span class="sl-ba-spin" aria-hidden="true"></span>${this.tf("picker.findingEllipsis","Finding\u2026")}`);try{let n=await this.controller.bestAvailable(e,t,{...i,ttlMs:this.opts.holdTtlMs});return n?(this.hold={holdId:n.holdId,expiresAt:n.expiresAt,seats:n.seats,items:n.items},this.handedOff=!1,this.bookedShown=!1,this.gaQty.clear(),this.startHoldTimer(n.expiresAt),this.flashHeldSeats(this.hold),this.syncTray(),this.emitHoldChange(),i.preferPremium&&n.seats.length&&!n.seats.every(r=>r.commercial?.premium)&&this.toast(y("picker.premiumFallbackNote",{count:e}),"neutral"),this.hold):null}catch(n){this.opts.onError?.(n);let r=n?.reason,o=r==="not_enough_together"?y("picker.couldNotFindSeatsTogether",{count:e}):r==="companion_pair_required"?this.tf("picker.companionPairRequired","Select the adjacent wheelchair place with each companion ticket."):r==="ticket_option_not_applicable"?this.tf("picker.ticketOptionNotApplicable","That ticket choice is not available for the selected seat."):r==="sold_out"?this.tf("picker.ticketTypeSoldOut","That ticket type is sold out. Try another ticket type."):r==="event_closed"?this.tf("picker.seatSalesClosedForEvent","Seat sales have closed for this event."):this.tf("picker.seatsNoLongerAvailableTryAnother","Those seats are no longer available. Try another quantity or ticket type.");return this.toast(o,"error"),null}finally{this.bestAvailableBusy=!1,this.syncTray()}}async release(){let e=this.hold,t=this.controller.currentHold(),i=!0;if(t)i=await this.controller.release();else if(e){let s=[...new Set([...(e.items??[]).map(n=>n.label),...(e.seats??[]).map(n=>n.label)])];if(s.length)try{await this.api.release(this.opts.event,s,e.holdId)}catch(n){this.opts.onError?.(n),i=!1}}if(!i){this.toast(this.tf("picker.couldNotReleaseTickets","Couldn't release your tickets. Your hold is unchanged."),"error");return}this.hold=null,this.forgetHold(),this.handedOff=!1,this.bookedShown=!1,this.ctaPhase="idle",this.stopHoldTimer(),this.gaQty.clear(),this.syncTray(),this.emitHoldChange()}startRealtime(){if(!this.access?.configured||!this.pubApi||this.realtime)return;let e=this.opts.event;this.realtime=new V({url:this.pubApi.subscribeUrl(e),mintTicket:()=>this.pubApi.subscribeTicket(e),onAccessUnavailable:t=>{this.opts.onAccessUnavailable?.(t),this.showAccessPanel(t)},sink:ne(this.controller,{flashOnLiveChange:!0,onStatusChange:()=>{this.syncPrices(),this.scheduleOfferRefresh(!0),this.detectBooked(),this.minimap?.refreshMinimap(),this.pushAvailabilityTo3d()},onSelectedObjectUnavailable:(t,i)=>{this.opts.onSelectedObjectUnavailable?.({labels:t,reason:i}),this.syncTray(),this.toast(i==="ineligible"?this.tf("picker.seatNoLongerYours","Some seats are no longer available to you. They have been removed from your order."):this.tf("picker.seatTaken","Someone else took a seat you had picked. It has been removed from your order."),"warning")}})}),this.realtime.start()}async refreshAccess(){return!this.access?.configured||!await this.access.refresh("manual")?!1:(this.dismissAccessPanel(),await this.controller.refresh(),this.realtime?this.realtime.restart():this.startRealtime(),!0)}showAccessPanel(e){if(this.destroyed||!this.root)return;let t=this.accessCopy(e.reason);this.dismissAccessPanel();let i=document.createElement("div");i.className="sl-access",i.setAttribute("role","status"),i.setAttribute("aria-live","polite");let s=document.createElement("div"),n=document.createElement("div");n.className="sl-access-title",n.textContent=t.title;let r=document.createElement("div");if(r.className="sl-access-body",r.textContent=t.body,s.appendChild(n),s.appendChild(r),t.action){let o=document.createElement("button");o.type="button",o.className="sl-access-act",o.textContent=t.action,o.addEventListener("click",()=>{this.refreshAccess()}),s.appendChild(o)}i.appendChild(s),(this.regions?.["bottom-center"]??this.root).appendChild(i),this.accessEl=i}dismissAccessPanel(){this.accessEl?.remove(),this.accessEl=null}accessCopy(e){switch(e){case"paused":return{title:this.tf("picker.accessPausedTitle","These seats are on hold right now"),body:this.tf("picker.accessPausedBody","The organizer has paused this selection. Try again in a few minutes."),action:this.tf("picker.accessRetry","Try again")};case"revoked":return{title:this.tf("picker.accessRevokedTitle","This access link is no longer active"),body:this.tf("picker.accessRevokedBody","Ask whoever sent you here for a new link to keep booking these seats.")};case"no_token":case"provider_failed":return{title:this.tf("picker.accessExpiredTitle","Your access session has ended"),body:this.tf("picker.accessExpiredBody","Sign in again, or reload the page, to keep browsing these seats. Anything you are already holding stays yours."),action:this.tf("picker.accessRetry","Try again")};default:return{title:this.tf("picker.accessInvalidTitle","We couldn\u2019t verify your access"),body:this.tf("picker.accessInvalidBody","You can still book anything shown as available. Contact whoever sent you here for access to the rest.")}}}destroy(){this.destroyed=!0,this.realtime?.stop(),this.realtime=null,this.dismissAccessPanel(),this.access?.clear(),this.hold&&!this.handedOff&&this.controller.release(),this.closeConfirm(),this.dismissTableDialog(!1),this.closeSeatView(),this.closeCheckoutPanel(),this.exit3d(),this.buyerAssetUrls.dispose(),this.stopHoldTimer(),this.toastTimer&&clearTimeout(this.toastTimer),this.liveTimer&&clearTimeout(this.liveTimer),this.offerRefreshTimer&&clearTimeout(this.offerRefreshTimer),this.offerBoundaryTimer&&clearTimeout(this.offerBoundaryTimer),this.offerRefreshTimer=null,this.offerBoundaryTimer=null,this.offerVisibilityHandler&&(document.removeEventListener("visibilitychange",this.offerVisibilityHandler),this.offerVisibilityHandler=null);for(let e of this.motionTimers)clearTimeout(e);this.motionTimers.clear(),this.ro?.disconnect(),this.ro=null,this.framedFs&&this.setFramedFs(!1),this.escHandler&&document.removeEventListener("keydown",this.escHandler),this.fsChangeHandler&&document.removeEventListener("fullscreenchange",this.fsChangeHandler),this.fsEscHandler&&window.removeEventListener("keydown",this.fsEscHandler),this.controller.destroy(),this.projectionEl=null,this.root?.remove(),this.root=null,this.modalScrim&&(this.modalScrim.remove(),this.modalScrim=null,this.prevFocus?.isConnected&&this.prevFocus.focus({preventScroll:!0}),this.prevFocus=null)}};function Ki(a,e={}){let t=e.origin??"";if(!t)try{t=new URL(a.src,window.location.href).origin}catch{t=""}let i=!1,s=null,n=null,r=null,o="",l=null,d=()=>{if(i)return;i=!0,s=a.getAttribute("style"),Object.assign(a.style,{position:"fixed",inset:"0",width:"100vw",height:"100vh",margin:"0",border:"0",zIndex:"2147483000",background:"#101625"});let c=document.documentElement;n=c.style.overflow,c.style.overflow="hidden",document.body&&(r=document.body.style.overflow,document.body.style.overflow="hidden"),l=f=>{f.key==="Escape"&&h()},window.addEventListener("keydown",l)},h=()=>{i&&(i=!1,s===null?a.removeAttribute("style"):a.setAttribute("style",s),s=null,o&&(a.style.height=o),n!==null&&(document.documentElement.style.overflow=n,n=null),r!==null&&document.body&&(document.body.style.overflow=r,r=null),l&&(window.removeEventListener("keydown",l),l=null))},p=c=>{if(c.source!==a.contentWindow||t&&c.origin!==t||!c.data||typeof c.data!="object")return;let f=c.data;if(f.type==="seatlayer:height"){typeof f.px=="number"&&Number.isFinite(f.px)&&f.px>0&&(o=`${Math.round(f.px)}px`,i||(a.style.height=o));return}f.type==="seatlayer:fullscreen"&&(f.on===!0?d():f.on===!1&&h())};return window.addEventListener("message",p),()=>{window.removeEventListener("message",p),h()}}export{Y as ApiError,be as BuyerAccessContext,re as BuyerAccessUnavailableError,V as BuyerRealtimeClient,Me as EmbeddedDesigner,st as SEATING_CHART_CALLBACK_PROPS,et as SEATING_CHART_HANDLE_METHODS,tt as SEATING_CHART_IDENTITY_PROPS,it as SEATING_CHART_VALUE_PROPS,qe as SeatPicker,Le as SeatingChart,Ki as attachPickerFrame,Qt as bindSeatingChartHandle,Zt as buildSeatingChartOptions,de as createBuyerAccessContext,ne as createControllerSink,He as parseTicketOfferAvailability,Re as ticketOfferPrices};
1346
+ </div>`;let s={};return i.querySelectorAll("[data-ref]").forEach(r=>{s[r.dataset.ref]=r}),{root:i,mapHost:s.map,els:s}}import{browserPanoramaConstraints as Ai,loadPanoramaImage as Li,planPanoramaDelivery as Pi,schedulePanoramaUpgrade as Mi}from"@seatlayer/core/view/panoramaDelivery";function ht(o){let{root:e,source:t,caption:i,real:s,closeLabel:r,dragHint:n,viewFromSeatLabel:a,real360Label:l,previewLabel:c,resolveAsset:u,onClose:p}=o,d=document.createElement("div");d.className="sl-view",d.setAttribute("role","dialog"),d.setAttribute("aria-label",a),d.innerHTML=`<div class="sl-view-head"><span class="sl-view-title">${a}</span><span class="sl-view-cap">${i}</span><button type="button" class="sl-view-x" aria-label="${r}"><svg viewBox="0 0 24 24"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button></div><div class="sl-view-pano"><span class="sl-view-badge">${s?l:c}</span><span class="sl-view-hint">${n}</span></div>`,e.appendChild(d);let f=d.querySelector(".sl-view-pano"),m=Pi(t,Ai()),g=new AbortController;f.style.backgroundImage=`url("${m.initialUrl}")`;let w=()=>{};m.upgradeUrl&&(w=Mi(()=>{u(m.upgradeUrl).then(H=>!H||g.signal.aborted?null:Li(H,g.signal).then(()=>H)).then(H=>{!H||!d.isConnected||g.signal.aborted||(f.style.backgroundImage=`url("${H}")`)}).catch(()=>{})}));let k=70,x=35,v=1,C=f.clientHeight||1,h=f.clientWidth||1,b=-(C*(180/k)*2/2-h/2),T=0,E=()=>{let H=f.clientHeight||1,Ee=H*(180/k)*v,Ge=Math.max(0,Ee-H),Ye=Math.min(Ge/2,x/180*Ee);T=Math.min(Ye,Math.max(-Ye,T)),f.style.backgroundSize=`auto ${Ee}px`,f.style.backgroundPosition=`${b}px ${T-Ge/2}px`};E();let M=!1,A=0,L=0,D=H=>{M=!0,A=H.clientX,L=H.clientY,f.classList.add("drag"),f.setPointerCapture?.(H.pointerId)},se=H=>{M&&(b+=H.clientX-A,T+=H.clientY-L,A=H.clientX,L=H.clientY,E())},me=H=>{M=!1,f.classList.remove("drag"),f.releasePointerCapture?.(H.pointerId)},Ke=H=>{H.preventDefault(),v=Math.min(2.4,Math.max(1,v+(H.deltaY<0?.12:-.12))),E()};f.addEventListener("pointerdown",D),f.addEventListener("pointermove",se),f.addEventListener("pointerup",me),f.addEventListener("pointercancel",me),f.addEventListener("wheel",Ke,{passive:!1});let Ce=d.querySelector(".sl-view-x");Ce.addEventListener("click",p);let We=H=>{H.key==="Escape"&&(H.stopPropagation(),p())};return d.addEventListener("keydown",We),Ce.focus(),{element:d,dispose(){w(),g.abort(),f.removeEventListener("pointerdown",D),f.removeEventListener("pointermove",se),f.removeEventListener("pointerup",me),f.removeEventListener("pointercancel",me),f.removeEventListener("wheel",Ke),d.removeEventListener("keydown",We),Ce.removeEventListener("click",p)}}}import{seatConfidenceDisclosure as Oi}from"@seatlayer/core/core/seatConfidence";import{t as Hi}from"@seatlayer/core";function S(o,e){let t=Hi(o);return t===o?e:t}function ut(o){if(typeof o=="string"){let e=document.querySelector(o);if(!e)throw new Error(`seatmap: container "${o}" not found`);return e}if(!(o instanceof HTMLElement))throw new Error("seatmap: container must be a CSS selector or an HTMLElement");return o}function z(o){return String(o??"").replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}var Ri=(()=>{if(typeof document<"u"&&document.currentScript instanceof HTMLScriptElement&&document.currentScript.src)return document.currentScript.src;try{let o=import.meta.url;if(typeof o=="string"&&o)return o}catch{}})(),te=null;function mt(){if(te!==null)return te;try{if(typeof document>"u")return te=!1;te=!!document.createElement("canvas").getContext("webgl2")}catch{te=!1}return te}function $e(o){let e=Ri??(typeof location<"u"?location.href:void 0);if(!e)throw new Error(`seatlayer: cannot resolve the ${o} chunk URL`);return new URL(`./${o}`,e).href}async function ft(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import($e("seatlayer-view3d.mjs")):import("@seatlayer/core/view3d")}async function bt(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import($e("seatlayer-panorama.mjs")):import("@seatlayer/core")}async function gt(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import($e("seatlayer-checkout.mjs")):import("./hostedCheckout-ILVKHB3C.js")}function vt(o){return o==="unavailable_for_event"||o==="payments_off_for_event"?o:"not_configured"}function we(o,e,t){let i={month:"short",day:"numeric",hour:"numeric",minute:"2-digit"},s=new Date(o);if(e)try{return s.toLocaleString(t,{...i,timeZone:e})}catch{}return s.toLocaleString(t,i)}function j(o){return String(o??"").replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[e])}function ie(o){return o?.restrictedView?S("picker.restrictedView","Restricted view"):o?.obstructedView?S("picker.obstructedView","Obstructed view"):""}function yt(o){if(!o)return"";let e=[];o.premium&&e.push(`<div class="sl-cx-premium"><span class="sl-cx-star" aria-hidden="true">\u2605</span>${S("picker.premiumSeat","Premium seat")}</div>`);let t=ie(o);return t?e.push(`<div class="sl-cx-warn"><span class="sl-cx-glyph" aria-hidden="true">\u25D0</span><span class="sl-cx-txt"><b>${t}</b>${o.note?`<span class="sl-cx-note">${j(o.note)}</span>`:""}</span></div>`):o.note&&e.push(`<div class="sl-cx-warn"><span class="sl-cx-glyph" aria-hidden="true">\u2139</span><span class="sl-cx-txt"><span class="sl-cx-note">${j(o.note)}</span></span></div>`),e.length?`<div class="sl-cx">${e.join("")}</div>`:""}function Be(o){let e=ie(o);if(!e)return"";let t=j(o?.note?o.note:e);return`<span class="sl-cx-mark" role="img" aria-label="${t}" title="${t}">\u25D0</span>`}function ue(o){return o==="no-seat"?S("picker.emptyWheelchairSpace","Empty wheelchair space"):o==="seat-present"?S("picker.accessiblePhysicalSeat","Accessible physical seat"):""}function xt(o){let e=ue(o);return e?`<div class="sl-cx"><div class="sl-cx-warn"><span class="sl-cx-glyph" aria-hidden="true">\u267F</span><span class="sl-cx-txt"><b>${e}</b></span></div></div>`:""}function ze(o){let e=ue(o);return e?`<span class="sl-cx-mark" role="img" aria-label="${e}" title="${e}">\u267F</span>`:""}function De(o,e){if(!o)return"";let t=e?S("picker.viewFromThisSeat","View from this seat"):S("picker.seeItIn3d","See it in 3D");return`<button type="button" class="sl-confirm-3d" aria-label="${t}"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2l9 5v10l-9 5-9-5V7z"/><path d="M12 12l9-5M12 12v10M12 12L3 7"/></svg><span>${t}</span></button>`}function wt(o){if(!o)return"";let e=o.previous.label||o.previous.id,t=o.next.label||o.next.id;return`<span class="sl-seccard-nav" aria-label="${S("picker.browseSections","Browse sections")}"><button type="button" data-section-nav="${z(o.previous.id)}" aria-label="${S("picker.previousSection","Previous section")}: ${z(e)}" title="${z(e)}">\u2190</button><button type="button" data-section-nav="${z(o.next.id)}" aria-label="${S("picker.nextSection","Next section")}: ${z(t)}" title="${z(t)}">\u2192</button></span>`}function kt(o,e){if(!e)return"";let t=e,i=t.includes(o.id),s=i?t.length>1?S("picker.openComparison","Open comparison"):S("picker.savedForComparison","Saved for comparison"):t.length?S("picker.compareWithSaved","Compare with saved"):S("picker.saveToCompare","Save to compare");return`<button type="button" class="sl-confirm-compare"${i&&t.length===1?" disabled":""}><span aria-hidden="true">\u21C4</span><span>${j(s)}</span></button>`}function St(o,e,t){if(!t)return"";let i=Oi(o.confidenceEvidence),s=i.modeledTarget??i.reality;return`<button type="button" class="sl-confirm-confidence" aria-label="Open seat confidence passport for ${j(o.displayLabel??o.label)}"><span><em>${j(e)}</em><strong>${j(i.headline)}</strong><small>${j(s)}</small></span><b>Passport</b></button>`}function G(o){let e=o?.rowLabel,t=o?.sectionLabel;if(!e||!t)return e;for(let i of["-"," ","\xB7","/","_"]){let s=`${t}${i}`;if(e.startsWith(s)&&e.length>s.length)return e.slice(s.length)}return e}import{pointInPolygon as Ii}from"@seatlayer/core";import{createMinimapTransform as $i,minimapPointToWorld as Bi,minimapViewportPlan as zi}from"@seatlayer/core/picker/minimapGeometry";function Tt(o,e){let t=new Fe(o);return t.build(e),t}var Fe=class{constructor(e){this.host=e;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}build(e){if(!this.host.controller.getViewport())return;let i=document.createElement("button");i.type="button",i.className="sl-minimap-toggle",i.setAttribute("aria-label",S("picker.openVenueMap","Open venue overview map")),i.setAttribute("aria-expanded","false"),i.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>',e.appendChild(i),this.miniToggle=i;let s=document.createElement("div");s.className="sl-minimap",s.setAttribute("role","group");let r=document.createElement("div");r.className="sl-minimap-bar";let n=document.createElement("span");n.className="sl-minimap-label";let a=document.createElement("span");a.className="sl-minimap-key",a.setAttribute("aria-label",S("picker.minimapStateKey","Focused, selected, available, and inactive sections")),a.innerHTML='<i class="focused" title="Focused"></i><i class="selected" title="Selected"></i><i title="Available"></i><i class="inactive" title="Inactive"></i>';let l=document.createElement("button");l.type="button",l.className="sl-minimap-close",l.setAttribute("aria-label",S("picker.closeVenueMap","Close venue overview map")),l.textContent="\xD7",r.append(n,a,l);let c=document.createElement("canvas");c.tabIndex=0,c.setAttribute("role","application"),c.setAttribute("aria-label",S("picker.venueMapInstructions","Venue overview map. Drag the viewport, click a section, or use arrow keys to pan.")),s.append(r,c),e.appendChild(s),this.miniWrap=s,this.miniLabel=n,this.miniCanvas=c;let u=document.createElement("canvas");this.miniBase=u,i.addEventListener("click",()=>{let p=this.host.root()?.dataset.minimapOpen==="true";this.userClosed=p,this.setMinimapOpen(!p)}),l.addEventListener("click",()=>{this.userClosed=!0,this.setMinimapOpen(!1)}),c.addEventListener("click",p=>{if(this.miniSuppressClick){this.miniSuppressClick=!1;return}this.minimapJump(p)}),c.addEventListener("pointerdown",p=>this.minimapPointerDown(p)),c.addEventListener("pointermove",p=>this.minimapPointerMove(p)),c.addEventListener("pointerup",p=>this.minimapPointerUp(p)),c.addEventListener("pointercancel",p=>this.minimapPointerUp(p)),c.addEventListener("keydown",p=>this.minimapKeydown(p)),this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect()}setAutoOpen(e){if(this.miniWrap){if(!e){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(e,t=!0){this.host.root()?.setAttribute("data-minimap-open",String(e)),this.miniToggle?.setAttribute("aria-expanded",String(e)),t&&(e?this.miniCanvas?.focus():this.miniToggle?.focus())}layoutMinimap(){let e=this.miniCanvas,t=this.miniBase,i=this.host.controller.getViewport()?.bounds;if(!e||!t||!i||!(i.width>0&&i.height>0))return;let s=196,r=146,n=6,a=i.width/Math.max(1,i.height),l=s,c=Math.round(s/a);c>r&&(c=r,l=Math.round(r*a)),l=Math.max(64,l),c=Math.max(48,c);let u=Math.min(2,window.devicePixelRatio||1);e.width=Math.round(l*u),e.height=Math.round(c*u),e.style.width=`${l}px`,e.style.height=`${c}px`,t.width=e.width,t.height=e.height,this.miniTf=$i(i,e.width,e.height,u,n)}syncMinimapLabel(){if(!this.miniLabel||!this.miniWrap)return;let e=this.host.controller.getFloors(),t=this.host.controller.isFloorOverview()?S("picker.allFloors","All floors"):e.find(u=>u.id===this.host.controller.getActiveFloorId())?.name??S("picker.venueOverview","Venue overview"),i=this.host.controller.getMinimapSnapshot().sections,r=i.find(u=>u.active)?.label??this.host.focusedSectionLabel(),n=r?`${t} \xB7 ${r}`:t;this.miniLabel.textContent=n;let a=i.filter(u=>u.state==="selected").length,l=i.filter(u=>u.state==="available").length,c=i.filter(u=>u.state==="inactive").length;this.miniWrap.setAttribute("aria-label",i.length?`${n}. ${a} selected, ${l} available, ${c} inactive sections.`:n),this.miniCanvas?.setAttribute("aria-label",i.length?`${n}. ${a} selected, ${l} available, ${c} inactive sections. ${S("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click a section, or use arrow keys to pan.")}`:`${n}. ${S("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 e=this.miniBase,t=this.miniTf;if(!e||!t)return;let i=e.getContext("2d");if(!i)return;i.clearRect(0,0,e.width,e.height);let s=p=>p*t.scale+t.offX,r=p=>p*t.scale+t.offY,n=this.host.cssVar("--sl-line")||"rgba(139,147,167,.5)",a=this.host.cssVar("--sl-muted")||"#8b93a7",l=this.host.cssVar("--sl-accent")||"#6e7bff",c=this.host.cssVar("--sl-success")||"#22a06b",u=this.host.controller.getMinimapSnapshot();for(let p of u.sections)p.outline.length<3||(i.beginPath(),p.outline.forEach((d,f)=>f===0?i.moveTo(s(d.x),r(d.y)):i.lineTo(s(d.x),r(d.y))),i.closePath(),i.globalAlpha=p.state==="inactive"?.18:p.state==="selected"?.72:.34,i.fillStyle=p.state==="inactive"?a:p.state==="selected"?l:c,i.fill(),i.globalAlpha=.82,i.lineWidth=Math.max(1,t.dpr),i.strokeStyle=n,i.stroke(),p.active&&(i.globalAlpha=1,i.lineJoin="round",i.lineWidth=Math.max(4,t.dpr*3.5),i.strokeStyle=this.host.cssVar("--sl-surface")||"#fff",i.stroke(),i.lineWidth=Math.max(2,t.dpr*1.75),i.strokeStyle=l,i.stroke()));if(i.globalAlpha=1,!u.sections.length){let p=Math.max(1,t.dpr);for(let d of u.seats)i.globalAlpha=d.state==="inactive"?.22:.78,i.fillStyle=d.state==="inactive"?a:d.state==="selected"?l:c,i.beginPath(),i.arc(s(d.x),r(d.y),p,0,Math.PI*2),i.fill();i.globalAlpha=1}}drawMinimapRect(){let e=this.miniCanvas,t=this.miniBase,i=this.miniTf;if(!e||!t||!i)return;let s=e.getContext("2d");if(!s)return;s.clearRect(0,0,e.width,e.height),s.drawImage(t,0,0);let r=this.host.controller.getViewport();if(!r)return;let n=zi(r.visible,i,e.width,e.height,Math.max(2,i.dpr*2)),a=this.host.cssVar("--sl-text")||"#12151c",l=this.host.cssVar("--sl-surface")||"#fff";s.save(),s.globalAlpha=.1,s.fillStyle=a,s.fillRect(n.raw.x,n.raw.y,n.raw.width,n.raw.height),s.globalAlpha=.9,s.lineJoin="round",s.lineWidth=Math.max(4,i.dpr*3.25),s.strokeStyle=l,s.strokeRect(n.raw.x,n.raw.y,n.raw.width,n.raw.height),s.globalAlpha=1,s.lineWidth=Math.max(2,i.dpr*1.75),s.strokeStyle=a,s.strokeRect(n.raw.x,n.raw.y,n.raw.width,n.raw.height),n.clipped&&Object.values(n.clippedEdges).some(Boolean)&&(s.setLineDash([Math.max(3,i.dpr*3),Math.max(2,i.dpr*2)]),s.strokeRect(n.clipped.x,n.clipped.y,n.clipped.width,n.clipped.height)),s.restore()}minimapWorldPoint(e){let t=this.miniCanvas,i=this.miniTf;if(!t||!i)return null;let s=t.getBoundingClientRect(),r=(e.clientX-s.left)*(t.width/Math.max(1,s.width)),n=(e.clientY-s.top)*(t.height/Math.max(1,s.height));return{...Bi({x:r,y:n},i),px:r,py:n}}minimapPointerDown(e){let t=this.minimapWorldPoint(e),i=this.host.controller.getViewport()?.visible;!t||!i||!(t.x>=i.x&&t.x<=i.x+i.width&&t.y>=i.y&&t.y<=i.y+i.height)||(this.miniDrag={pointerId:e.pointerId,offsetX:t.x-(i.x+i.width/2),offsetY:t.y-(i.y+i.height/2),startX:e.clientX,startY:e.clientY,moved:!1},this.miniCanvas?.setPointerCapture(e.pointerId),this.miniCanvas?.classList.add("sl-dragging"),e.preventDefault())}minimapPointerMove(e){let t=this.miniDrag;if(!t||t.pointerId!==e.pointerId)return;let i=this.minimapWorldPoint(e);i&&(!t.moved&&Math.hypot(e.clientX-t.startX,e.clientY-t.startY)>2&&(t.moved=!0,this.host.controller.clearSectionFocus()),this.host.controller.panToWorld({x:i.x-t.offsetX,y:i.y-t.offsetY}),e.preventDefault())}minimapPointerUp(e){let t=this.miniDrag;!t||t.pointerId!==e.pointerId||(this.miniSuppressClick=t.moved,this.miniDrag=null,this.miniCanvas?.classList.remove("sl-dragging"),this.miniCanvas?.hasPointerCapture(e.pointerId)&&this.miniCanvas.releasePointerCapture(e.pointerId))}minimapKeydown(e){let t=this.host.controller.getViewport()?.visible;if(!t)return;if(e.key==="Home"){this.host.controller.overview(),e.preventDefault();return}let i=e.key==="ArrowLeft"?-t.width*.2:e.key==="ArrowRight"?t.width*.2:0,s=e.key==="ArrowUp"?-t.height*.2:e.key==="ArrowDown"?t.height*.2:0;!i&&!s||(this.host.controller.clearSectionFocus(),this.host.controller.panToWorld({x:t.x+t.width/2+i,y:t.y+t.height/2+s}),e.preventDefault())}minimapJump(e){let t=this.minimapWorldPoint(e);if(t){for(let i of this.host.controller.getMinimapSnapshot().sections)if(!(i.state==="inactive"||i.outline.length<3)&&Ii(t,i.outline)){this.host.controller.focusSection(i.id);return}this.host.controller.clearSectionFocus(),this.host.controller.panToWorld(t)}}};import{t as je}from"@seatlayer/core";var Di=12;function Ct(o,e){let t=e.floors(),i=new Set(t.map(g=>g.label.trim().toLocaleLowerCase())),s=e.zones().filter(g=>g.seatCount>0&&!i.has(g.label.trim().toLocaleLowerCase())),r=e.sections().filter(g=>g.seatCount>0&&!i.has(g.label.trim().toLocaleLowerCase())),n=s.length>1?[]:r,a=t.length>1,l=s.length>1,c=n.length>1;if(!a&&!l&&!c)return;let u=document.createElement("div");u.className="sl-view3d-nav";let p=document.createElement("button");p.type="button",p.className="sl-view3d-nav-toggle",p.setAttribute("aria-expanded","false");let d=g=>{u.classList.toggle("is-open",g),p.setAttribute("aria-expanded",String(g)),p.textContent=g?S("picker.closeVenueNav","Close"):a&&(l||c)?S("picker.levelsAndAreas","Levels & areas"):a?S("picker.levels","Levels"):S("picker.areas","Areas")};p.addEventListener("click",()=>d(!u.classList.contains("is-open"))),u.addEventListener("keydown",g=>{g.key!=="Escape"||!u.classList.contains("is-open")||(g.preventDefault(),g.stopPropagation(),d(!1),p.focus())}),d(!1),u.appendChild(p);let f=g=>{},m=g=>{};if(a){let g=document.createElement("div");g.setAttribute("role","group"),g.setAttribute("aria-label",S("picker.levels","Levels"));let w=[];m=v=>{w.forEach(C=>{C.setAttribute("aria-pressed",String((C.dataset.floor===""?null:Number(C.dataset.floor))===v))})};let k=v=>{e.focusFloor(v)&&(m(v),f(v))},x=(v,C)=>{let h=document.createElement("button");h.type="button",h.textContent=v,h.dataset.floor=C===null?"":String(C),h.setAttribute("aria-pressed",String(C===null)),h.addEventListener("click",()=>{k(C),d(!1)}),w.push(h),g.appendChild(h)};x(S("picker.allLevels","All levels"),null);for(let v of t)x(v.label||je("picker.levelNumber",{number:v.index+1}),v.index);u.appendChild(g)}if(l||c){let g=document.createElement("div");g.setAttribute("role","group"),g.setAttribute("aria-label",S("picker.areas","Areas"));let w=l?s.map(x=>({id:x.id,label:x.label||x.id,go:()=>{e.focusZone(x.id)}})):n.map(x=>({id:x.id,label:x.label||x.id,floorIndex:x.floorIndex,go:()=>{e.focusSection(x.id),Number.isFinite(x.floorIndex)&&m(x.floorIndex)}})),k=x=>{let v=l||x===null?w:w.filter(C=>C.floorIndex===void 0||C.floorIndex===x);if(g.replaceChildren(),!v.length){g.remove();return}if(g.isConnected||u.appendChild(g),!l&&v.length>Di){let C=document.createElement("select");C.setAttribute("aria-label",S("picker.jumpToSection","Jump to section"));let h=document.createElement("option");h.value="",h.textContent=S("picker.jumpToSection","Jump to section"),C.appendChild(h);for(let b of v){let T=document.createElement("option");T.value=b.id,T.textContent=b.label,C.appendChild(T)}C.addEventListener("change",()=>{v.find(b=>b.id===C.value)?.go()}),g.appendChild(C);return}for(let C of v){let h=document.createElement("button");h.type="button",h.textContent=C.label,h.addEventListener("click",()=>{C.go(),d(!1)}),g.appendChild(h)}};f=k,k(null)}o.appendChild(u)}var ke=class{constructor(e){this.host=e;this.chip=null}sync(){let e=this.host.overlay();if(!e||this.host.savedSeatIds().length===0){this.chip?.remove(),this.chip=null;return}let t=this.chip;if(!t){t=document.createElement("div"),t.className="sl-view3d-compare-saved",t.setAttribute("role","group"),t.setAttribute("aria-label",S("picker.savedSeatComparison","Saved seat comparison"));let r=document.createElement("button");r.type="button",r.className="main",r.addEventListener("click",()=>{this.host.savedSeatIds().length>1?this.host.openComparison():this.host.toast(S("picker.chooseAnotherToCompare","Choose another seat to compare."),"neutral")});let n=document.createElement("button");n.type="button",n.className="clear",n.textContent="\xD7",n.setAttribute("aria-label",S("picker.clearSavedSeatComparison","Clear saved seat comparison")),n.addEventListener("click",()=>this.host.clearComparison()),t.append(r,n),e.appendChild(t),this.chip=t}let i=this.host.savedSeatIds().length,s=t.querySelector(".main");s&&(s.textContent=i>1?je("picker.compareCount",{count:i}):S("picker.oneSeatSaved","1 seat saved"),s.setAttribute("aria-label",i>1?je("picker.openComparisonOfSeats",{count:i}):S("picker.oneSeatSavedChooseAnother","One seat saved; choose another to compare")))}remove(){this.chip?.remove(),this.chip=null}mainButton(){return this.chip?.querySelector(".main")??null}};import{t as Se}from"@seatlayer/core";function Et(o){return Array.isArray(o)?o.reduce((e,t)=>t.type==="minimumSelectedPlaces"?Math.max(e,t.minimum):e,0):0}function Ve(o,e,t=!1){let i=o.violations[0];return i==="numberOfPlacesToSelect"?o.remaining>0?Se("picker.selectExactMore",{count:o.remaining}):Se("picker.selectExactCount",{count:o.required}):i==="minimumSelectedPlaces"?Se("picker.selectMinimumMore",{count:o.remaining}):t?e("picker.adjustSeatSelection","Adjust seat selection"):i==="consecutiveSeats"?e("picker.selectSeatsTogether","Choose seats together in the same row and ticket category."):Se("picker.orphanHint")}import{t as Te,tCount as Fi}from"@seatlayer/core";function _e(o){let e=Math.max(0,o),t=Math.floor(e/6e4),i=String(Math.floor(e%6e4/1e3)).padStart(2,"0");return`${t}:${i}`}function At({d:o,area:e,label:t,objectType:i,quantity:s=1,identity:r}){let n=u=>String(u??"\u2014").replace(/[&<>"]/g,p=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[p]),a=i==="ga"?"ga":o?.objectType??i,l=r?.displayType?.trim()||o?.displayType?.trim()||e?.displayType?.trim()||(a==="table"?S("picker.table","Table"):a==="booth"?S("picker.booth","Booth"):a==="ga"?S("picker.generalAdmission","General admission"):S("picker.row","Row")),c=r?.rowLabel??r?.displayLabel??o?.rowLabel??o?.displayLabel??e?.displayLabel??e?.label??t;return a==="table"&&r?.bookingMode?`<div class="sl-chip-id"><span class="fld sec"><span class="sl-chip-eb">${n(l)}</span><span class="val">${n(c)}</span></span><span class="fld mid"><span class="sl-chip-eb">${S("picker.guests","Guests")}</span><span class="val">${s}</span></span></div>`:a==="ga"?`<div class="sl-chip-id"><span class="fld sec"><span class="sl-chip-eb">${n(l)}</span><span class="val">${n(c)}</span></span>`+(s>1?`<span class="fld mid"><span class="sl-chip-eb">${S("picker.tickets","Tickets")}</span><span class="val">${s}</span></span>`:"")+"</div>":a==="booth"?'<div class="sl-chip-id">'+(o?.sectionLabel?`<span class="fld sec"><span class="sl-chip-eb">${S("picker.section","Section")}</span><span class="val">${n(o.sectionLabel)}</span></span>`:"")+`<span class="fld mid"><span class="sl-chip-eb">${n(l)}</span><span class="val">${n(c)}</span></span></div>`:!o?.sectionLabel&&!o?.rowLabel&&!o?.seatNumber?`<div class="sl-chip-id"><span class="fld sec"><span class="sl-chip-eb">${S("picker.seat","Seat")}</span><span class="val">${n(c)}</span></span></div>`:'<div class="sl-chip-id">'+(o.sectionLabel?`<span class="fld sec"><span class="sl-chip-eb">${S("picker.section","Section")}</span><span class="val">${n(o.sectionLabel)}</span></span>`:"")+(o.rowLabel?`<span class="fld mid"><span class="sl-chip-eb">${n(l)}</span><span class="val">${n(G(o))}</span></span>`:"")+(o.seatNumber?`<span class="fld mid"><span class="sl-chip-eb">${S("picker.seat","Seat")}</span><span class="val">${n(o.seatNumber)}</span></span>`:"")+"</div>"}function Lt(o,e){return`<div class="sl-chip-rail"><button type="button" class="rm" aria-label="${o}"><svg viewBox="0 0 24 24"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button>`+(e?`<button type="button" class="view" data-view-label="${e}" aria-label="${Te("picker.viewFromSeat",{label:e})}"><svg viewBox="0 0 24 24"><path d="M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z"/><circle cx="12" cy="12" r="3"/></svg></button>`:"")+"</div>"}function Pt(o){return o.salesClosed||o.hasHold||o.ctaPhase!=="idle"||o.formOpen||o.room<=0?null:Math.max(1,Math.min(o.wanted,o.room))}function Mt({count:o,total:e,pendingCount:t,ctaPhase:i,hasHold:s,salesClosed:r,fromPrice:n,addMore:a,money:l}){if(o&&i==="holding")return`<span>${S("picker.securingSeats","Securing your seats\u2026")}</span>`;if(o&&i==="checkout")return`<span>${Te("picker.peekSecured",{count:o,total:l(e)})}</span>`;if(o){let c=!!s;return`<span>${Fi("picker.peekTicketsTotal",o,{total:l(e)})}</span>`+(a?`<button type="button" class="go ghost sl-sheet-go" data-act="best" aria-label="${S("picker.findTogetherInstead","Find seats together instead")}">\u2726 +${a}</button>`:"")+`<button type="button" class="go sl-sheet-go" data-act="${c?"checkout":"open"}">${s?t?S("picker.secureMore","Secure more"):S("picker.continue","Continue"):S("picker.review","Review")}</button>`}else return r?`<span>${S("picker.salesClosedPill","Sales are closed")}</span>`:(n!=null?`<span>${Te("picker.peekFromPrice",{price:l(n)})}</span>`:`<span>${S("picker.pickYourSeats","Pick your seats")}</span>`)+`<button type="button" class="go sl-sheet-go" data-act="open">${S("picker.bestSeatsStar","\u2726 Best seats")}</button>`}function Ne(o,e=Date.now()){return Te("picker.holdReassurance",{time:_e(o-e)})}var Wi="https://api.seatlayer.io",Gi=10,Ot=6e4,It=6e4,$t=new Set;function Yi(o){let e=$t.has(o);return $t.add(o),e}var Bt="seatmap.a11y.cb";function Xi(){try{if(typeof window>"u")return null;let o=window.localStorage.getItem(Bt);return o==null?null:o==="1"}catch{return null}}function Qi(o){try{window.localStorage.setItem(Bt,o?"1":"0")}catch{}}var qe=class o{constructor(e){this.realtime=null;this.accessEl=null;this.lastSelectionValidity=null;this.root=null;this.mapHost=null;this.rendered=!1;this.destroyed=!1;this.els={};this.regions={};this.ro=null;this.holdTimer=null;this.toastTimer=null;this.offerRefreshTimer=null;this.offerBoundaryTimer=null;this.offerVisibilityHandler=null;this.motionTimers=new Set;this.currency="USD";this.eventTimezone=null;this.eventWhenText=null;this.offerAvailability=null;this.channelByObject=new Map;this.pricesByChannel=new Map;this.hold=null;this.holdExpiresAt=0;this.handedOff=!1;this.bookedShown=!1;this.paymentOptions=null;this.checkoutPanel=null;this.extendEl=null;this.bookedEl=null;this.gaQty=new Map;this.tipEl=null;this.tipPos={x:0,y:0};this.confirmEl=null;this.confirmSeat=null;this.tableDialogEl=null;this.tableDialog=null;this.tableDialogHeld=!1;this.tableDialogReturnFocus=null;this.srEl=null;this.baQty=2;this.baCat="";this.baZone="";this.baPremium=!1;this.baReopen=!1;this.bestAvailableConfirm=!1;this.releasingHold=!1;this.salesClosed=!1;this.soldOut=!1;this.soldoutEl=null;this.cbSafe=!1;this.rungsEl=null;this.projectionEl=null;this.buyerView="map";this.view3dEl=null;this.view3dHandle=null;this.view3dGen=0;this.view3dReturnSeat=null;this.view3dTargetSeatId=null;this.view3dCompareSeatIds=[];this.view3dCompareChip=new ke({overlay:()=>this.view3dEl,savedSeatIds:()=>this.view3dCompareSeatIds,openComparison:()=>this.openView3dComparison(),clearComparison:()=>this.clearView3dComparison(),toast:(e,t)=>this.toast(e,t)});this.view3dCompareEl=null;this.view3dCompareCleanup=null;this.view3dPassportEl=null;this.view3dPassportCleanup=null;this.floorsEl=null;this.secCardEl=null;this.viewEl=null;this.viewCleanup=null;this.seatViewGen=0;this.allSeatsCache=null;this.minimap=null;this.pickerLayoutSize={width:0,height:0};this.priceBandKeys=null;this.focusedCatKey=null;this.limitedViewFilter=!1;this.pricesExpanded=!1;this.lastSection=null;this.secCardCollapsed=!1;this.secCardShownAt=0;this.lastTrayCount=0;this.lastTrayTotal=0;this.lastTrayKeys=new Set;this.bestAvailableBusy=!1;this.releasingLabels=new Set;this.holdingLabels=new Set;this.ctaPhase="idle";this.a11yChipsEl=null;this.fsFallback=!1;this.fsChangeHandler=null;this.fsEscHandler=null;this.eventDetailsHidden=!1;this.holdCopyPending=!1;this.sideCollapsed=!1;this.sideToggleEl=null;this.framedFs=!1;this.lastPostedHeight=0;this.cbEl=null;this.modalScrim=null;this.prevFocus=null;this.escHandler=null;this.closeModal=null;this.lastCatAvail=null;this.lastAvailFloorId="";this.availQuietUntil=0;this.liveTimer=null;this.perspectiveWarned=!1;if(!e||typeof e!="object")throw new Error("seatmap: options object is required");if(!e.event||typeof e.event!="string")throw new Error("seatmap: `event` key is required");if(!e.container)throw new Error("seatmap: `container` is required (or use SeatPicker.open())");this.opts={...e,confirmSelection:e.confirmSelection??!0},this.eventDetailsHidden=!!e.hideEventDetails,this.hostPricing=e.pricing,this.apiBase=(e.apiBase??Wi).replace(/\/+$/,""),this.access=e.transport?null:de(e,{onExpired:r=>{this.opts.onAccessExpired?.(r),r.refreshed||this.showAccessPanel({reason:"no_token",retryable:!1})},onUnavailable:r=>{this.opts.onAccessUnavailable?.(r),this.showAccessPanel(r)}}),this.pubApi=e.transport?null:new X(this.apiBase,{access:this.access??void 0,onObjectUnavailable:r=>this.opts.onSelectedObjectUnavailable?.(r)}),this.api=e.transport??this.pubApi,this.buyerAssetUrls=new ve(e.event,this.api.asset?(r,n)=>this.api.asset(r,n):void 0),e.checkout==="hosted"&&!this.pubApi&&console.warn('seatlayer: checkout: "hosted" needs the widget\'s own transport \u2014 a custom `transport` owns its backend, so the picker is staying on onCheckout for this mount.'),this.checkoutMode=e.checkout==="hosted"&&this.pubApi?"hosted":"handoff";let t=e.numberOfPlacesToSelect;if(t!=null&&(!Number.isInteger(t)||t<1))throw new Error("seatmap: `numberOfPlacesToSelect` must be a positive integer");this.exactTickets=t??null;let i=Et(e.selectionValidators);if(this.exactTickets!=null&&i>this.exactTickets)throw new Error("seatmap: `minimumSelectedPlaces.minimum` cannot exceed `numberOfPlacesToSelect`");let s=Math.max(1,Math.floor(e.maxSelection??this.exactTickets??Math.max(Gi,i)));if(this.exactTickets!=null&&s<this.exactTickets)throw new Error("seatmap: `maxSelection` cannot be lower than `numberOfPlacesToSelect`");if(e.maxSelection!=null&&s<i)throw new Error("seatmap: `maxSelection` cannot be lower than `minimumSelectedPlaces.minimum`");this.maxTickets=this.exactTickets??s,this.cbSafe=Xi()??!!e.colorblindSafe,this.controller=this.wireController(e)}chartHasStage(){let e=this.controller.doc;if(!e)return!1;let t=e.floors?.length?e.floors.map(i=>i.objects??[]):[e.objects??[]];for(let i of t)for(let s of i)if(s.type==="shape"&&(s.role==="stage"||s.stageKind))return!0;return!1}confirmThumbHtml(e){let t=this.controller.doc;if(!t)return"";let i=e.viewUrl??"",s=this.chartHasStage();if(!i&&!s)return"";let r=null;if(!i)try{r=Ni(e,e.focalPoint??t.focalPoint).distanceM??null}catch{return""}let n=s&&r!=null?`<div class="sl-confirm-sight">${y("picker.sightline",{m:r})}</div>`:"";return(i?`<button type="button" class="sl-confirm-view sl-confirm-thumbwrap" aria-label="${y("picker.viewFromSeat",{label:e.label})}"><img class="sl-confirm-thumb" alt="" /><span class="sl-confirm-thumb-badge">\u{1F52D} ${this.tf("picker.viewFromHere","View from here")}</span></button>`:`<button type="button" class="sl-confirm-view sl-confirm-viewbtn" aria-label="${y("picker.viewFromSeat",{label:e.label})}"><span aria-hidden="true">\u{1F52D}</span><span>${this.tf("picker.viewFromHere","View from here")}</span></button>`)+n}isFramed(){return typeof window<"u"&&window.parent!==window}postToHost(e){if(this.isFramed())try{window.parent.postMessage(e,"*")}catch{}}measureFramedHeight(){let e=this.root;if(!e)return 0;let t=e.clientWidth||(typeof window<"u"?window.innerWidth:0)||0;if(t<=0)return 0;let i=t<640?1.2:.62;return Math.max(420,Math.round(t*i))}reportFramedHeight(){if(!this.isFramed())return;let e=this.measureFramedHeight();e<=0||e===this.lastPostedHeight||(this.lastPostedHeight=e,this.postToHost({type:"seatlayer:height",px:e}))}toggleFullscreen(){let e=this.root;if(!e)return;!!document.fullscreenElement||this.fsFallback||this.framedFs?document.fullscreenElement?document.exitFullscreen().catch(()=>{}):this.framedFs?this.setFramedFs(!1):this.setFsFallback(!1):e.requestFullscreen?e.requestFullscreen().catch(()=>this.enterFsFallback()):this.enterFsFallback()}syncFullscreenButtons(){let e=!!document.fullscreenElement||this.fsFallback||this.framedFs,t=this.eventDetailsHidden&&!e;this.root?.setAttribute("data-event-details-hidden",String(t)),this.els.zfs?.setAttribute("aria-pressed",String(e)),this.els.zfs?.setAttribute("title",e?this.tf("picker.exitFullScreen","Exit full screen"):this.tf("picker.fullScreen","Full screen"));let i=this.els.zfs?.querySelector(".sl-zfs-lbl");i&&(i.textContent=e?this.tf("picker.exitFullScreen","Exit full screen"):this.tf("picker.fullScreen","Full screen")),this.view3dEl?.querySelector(".sl-view3d-fs")?.setAttribute("aria-pressed",String(e))}enterFsFallback(){this.isFramed()?this.setFramedFs(!0):this.setFsFallback(!0)}setFramedFs(e){this.framedFs!==e&&(this.framedFs=e,this.syncFullscreenButtons(),this.postToHost({type:"seatlayer:fullscreen",on:e}),e&&!this.fsEscHandler?(this.fsEscHandler=t=>{t.key==="Escape"&&!document.fullscreenElement&&this.setFramedFs(!1)},window.addEventListener("keydown",this.fsEscHandler)):!e&&this.fsEscHandler&&(window.removeEventListener("keydown",this.fsEscHandler),this.fsEscHandler=null),requestAnimationFrame(()=>this.controller.refitCurrentView()))}setFsFallback(e){this.fsFallback!==e&&(this.fsFallback=e,this.root?.classList.toggle("sl-fs",e),this.syncFullscreenButtons(),e&&!this.fsEscHandler?(this.fsEscHandler=t=>{t.key==="Escape"&&!document.fullscreenElement&&this.setFsFallback(!1)},window.addEventListener("keydown",this.fsEscHandler)):!e&&this.fsEscHandler&&(window.removeEventListener("keydown",this.fsEscHandler),this.fsEscHandler=null),requestAnimationFrame(()=>this.controller.refitCurrentView()))}close(){this.closeModal?this.closeModal():this.destroy()}static async open(e){Oe();let t=document.activeElement instanceof HTMLElement?document.activeElement:null,i=document.createElement("div");i.className="sl-modal-scrim";let s=document.createElement("div");s.className="sl-modal-frame",s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),s.setAttribute("aria-label",S("picker.seatSelection","Seat selection")),s.tabIndex=-1,i.appendChild(s),document.body.appendChild(i);let r=document.body.style.overflow;document.body.style.overflow="hidden";let n=new o({...e,container:s});n.modalScrim=i,n.prevFocus=t;let a=["a[href]","area[href]","button","input","select","textarea","iframe","object","embed","summary","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"[tabindex]"].join(","),l=()=>{let m=[...s.querySelectorAll('[role="dialog"][aria-modal="true"]')].filter(g=>g.isConnected&&!g.closest('[hidden], [aria-hidden="true"], [inert]'));return m[m.length-1]??s},c=(m,g)=>{let w=m;for(;w;){let k=window.getComputedStyle(w);if(w.hidden||w.getAttribute("aria-hidden")==="true"||w.hasAttribute("inert")||k.display==="none"||k.visibility==="hidden"||k.visibility==="collapse")return!0;if(w===g)return!1;w=w.parentElement}return!0},u=m=>[...m.querySelectorAll(a)].filter(g=>g.tabIndex>=0&&!g.matches(":disabled")&&!c(g,m)),p=(m,g)=>{let w=u(m),k=g?w[w.length-1]:w[0];k?k.focus({preventScroll:!0}):(m.hasAttribute("tabindex")||(m.tabIndex=-1),m.focus({preventScroll:!0}))},d=!1,f=()=>{if(d)return;d=!0,document.body.style.overflow=r,n.escHandler&&document.removeEventListener("keydown",n.escHandler),i.remove(),n.modalScrim=null;let m=n.prevFocus;n.prevFocus=null,m?.isConnected&&m.focus({preventScroll:!0});let g=()=>{n.destroy(),e.onClose?.()};n.hold&&!n.handedOff?n.release().finally(g):g()};return n.closeModal=f,i.addEventListener("mousedown",m=>{m.target===i&&f()}),n.escHandler=m=>{if(m.key==="Tab"){if(m.defaultPrevented)return;let g=l(),w=u(g),k=w[0],x=w[w.length-1],v=document.activeElement;!k||!x?(m.preventDefault(),p(g,m.shiftKey)):v===g||!v||!g.contains(v)?(m.preventDefault(),(m.shiftKey?x:k).focus({preventScroll:!0})):m.shiftKey&&v===k?(m.preventDefault(),x.focus({preventScroll:!0})):!m.shiftKey&&v===x&&(m.preventDefault(),k.focus({preventScroll:!0}));return}m.key==="Escape"&&(n.tableDialog?(m.preventDefault(),n.cancelTableDialog()):n.confirmSeat?(m.preventDefault(),n.cancelConfirm()):n.bestAvailableConfirm?(m.preventDefault(),n.bestAvailableConfirm=!1,n.syncTray()):(m.preventDefault(),f()))},document.addEventListener("keydown",n.escHandler),await n.render(),n.els.close?.classList.add("on"),n.els.close?.addEventListener("click",f),p(l(),!1),n}wireController(e){return new ji({transport:this.api,eventKey:e.event,maxSelection:this.maxTickets,selectedObjects:e.selectedObjects,selectableObjects:e.selectableObjects,numberOfPlacesToSelect:e.numberOfPlacesToSelect,selectionValidators:e.selectionValidators,currency:e.currency,flashOnLiveChange:!0,colorblindSafe:this.cbSafe,mapTheme:e.theme?.map??null,onSelectionChange:()=>{this.syncTray(),this.minimap?.refreshMinimap(),this.committedSelection().length&&this.collapseSectionCard(),this.syncSelectionTo3d()},onStatusChange:()=>{this.syncPrices(),this.scheduleOfferRefresh(!0),this.evictTakenSelections(),this.detectBooked(),this.minimap?.refreshMinimap(),this.pushAvailabilityTo3d()},onHoldExpired:()=>{this.hold=null,this.forgetHold(),this.handedOff=!1,this.bookedShown=!1,this.ctaPhase="idle",this.stopHoldTimer(),this.gaQty.clear(),this.toast(y("picker.holdExpired",void 0)||"Your hold expired \u2014 seats released. Pick again.","warning"),this.syncTray(),this.emitHoldChange(),this.opts.onHoldExpired?.()},confirmSelection:this.opts.confirmSelection,onSelect:t=>{if(this.salesClosed){this.controller.deselect([t.id]),this.toast(this.tf("picker.salesClosedToast","Sales are closed for this event."),"warning");return}this.controller.tableSelection(t.id)||(this.flashPickedSeat(t.id),this.opts.confirmSelection&&this.showConfirm(t))},onTableSelectionRequest:t=>{if(this.salesClosed){this.controller.deselect(t.physicalSeatIds),this.toast(this.tf("picker.salesClosedToast","Sales are closed for this event."),"warning");return}this.showTableDialog(t,!1)},onDeselect:t=>{this.confirmSeat?.id===t.id&&this.dismissConfirm(),this.tableDialog?.physicalSeatIds.includes(t.id)&&this.dismissTableDialog()},onSelectionLimit:()=>{this.toast(y("picker.maxTicketsForOrder",{count:this.maxTickets}),"warning"),this.opts.onSelectionLimit?.(this.maxTickets)},onViewChange:()=>{this.reanchorConfirm(),this.syncRung(),this.syncProjection(),this.minimap?.drawMinimapRect(),this.sectionCardOnView()},onSectionFocus:t=>this.showSectionCard(t),onDeckTap:()=>{this.showSectionCard(null),this.syncFloors(),this.syncRung(),this.minimap?.refreshMinimap()},onFocusSeat:t=>this.announceSeat(t),onSeatHover:t=>this.updateTooltip(t),onHint:t=>{t&&this.toast(t)},onSalesClosed:()=>this.setSalesClosed(!0),onError:t=>this.opts.onError?.(t)})}async render(){if(this.rendered)return this;let e=performance.now(),t={},i=b=>Math.round((performance.now()-b)*100)/100;this.rendered=!0,Oe();let s=performance.now();await Ui(this.opts.locale),t.loadLocale=i(s),this.opts.messages&&qi(this.opts.messages),this.checkoutMode==="hosted"&&(this.paymentOptions=this.pubApi.paymentOptions(this.opts.event));let r=performance.now(),n=ut(this.opts.container),{root:a,els:l,mapHost:c}=pt(n,(b,T)=>this.tf(b,T),this.opts.theme);this.root=a,this.els=l,this.mapHost=c,a.addEventListener("keydown",b=>{b.key==="Escape"&&(this.tableDialog?(b.preventDefault(),b.stopPropagation(),this.cancelTableDialog()):this.confirmSeat?(b.preventDefault(),b.stopPropagation(),this.cancelConfirm()):this.bestAvailableConfirm&&(b.preventDefault(),b.stopPropagation(),this.bestAvailableConfirm=!1,this.syncTray()))}),this.syncFullscreenButtons(),this.wireBuyerShell(a);let u=document.createElement("div");u.style.cssText="position:absolute;inset:0",this.mapHost.appendChild(u),t.mountBuyerShell=i(r);let p=await this.loadChart(u,t,i);if(!p)return this;this.els.boot.remove();let d=performance.now();if(this.startRealtime(),this.salesClosed=!!p.salesClosed||!!this.opts.readOnly,a.dataset.eventMode=p.mode==="test"?"test":"live",this.controller.setViewMode(this.normalizeInitialView(this.opts.initialView)),this.buildRegions(),this.regions["bottom-right"].appendChild(this.els.zoom),this.regions["bottom-center"].appendChild(this.els.toast),p.mode==="test"){let b=document.createElement("div");b.className="sl-testbadge",b.textContent=y("picker.testMode"),b.setAttribute("aria-label",y("picker.testMode")),this.regions["top-left"].appendChild(b)}let f=this.controller.doc?.theme;Object.entries(xe(f,this.opts.theme)).forEach(([b,T])=>a.style.setProperty(b,T)),this.currency=p.currency??this.opts.currency??"USD",this.eventTimezone=p.timezone??null;let m=this.opts.theme?.logoUrl??f?.logoUrl??p.posterUrl??null;m?this.els.logo.innerHTML=`<img src="${m}" alt="">`:this.els.logo.textContent=(this.opts.theme?.brandName??f?.brandName??p.eventName??"?").slice(0,1).toUpperCase(),this.els.name.textContent=p.eventName??"";let g=p.startsAt?we(p.startsAt,p.timezone??null,this.opts.locale):"";this.eventWhenText=g||null,this.els.meta.textContent=[p.venue,g].filter(Boolean).join(" \xB7 "),this.els.pricesHint&&(this.els.pricesHint.textContent=this.tf("picker.priceHint","Colours on the map are ticket types \u2014 tap one below to show just those seats.")),this.buildBadge(f);let w=new Set,k=!1;if(this.controller.doc)for(let b of Ue(this.controller.doc)){for(let T of b.accessibility??[])w.add(T);b.accessible&&!b.accessibility?.length&&w.add("wheelchair"),(b.commercial?.restrictedView||b.commercial?.obstructedView)&&(k=!0)}let x=()=>{this.rungsEl&&this.controller.getRung()!=="seats"&&(this.controller.setRung("seats"),this.collapseSectionCard(),this.syncRung())};if(w.size||k){let b=document.createElement("div");if(b.className="sl-chips",this.regions["top-left"].appendChild(b),this.a11yChipsEl=b,w.size){let T=(A,L)=>`<button type="button" class="sl-chip-f${A==="all"?" on":""}" data-a11y="1" data-f="${A}">${L}</button>`;b.insertAdjacentHTML("beforeend",T("all",this.tf("picker.allSeats","All seats"))+Vi.filter(({key:A})=>w.has(A)).map(({key:A,short:L,icon:D})=>T(A,`${D} ${L}`)).join(""));let E=new Set,M=()=>{b.querySelectorAll("button[data-a11y]").forEach(L=>{let D=L.dataset.f,se=D==="all"?E.size===0:E.has(D);L.classList.toggle("on",se),L.setAttribute("aria-pressed",String(se))});let A=E.size?[...E]:null;this.controller.setAccessibilityFilter(A),A&&x()};b.querySelectorAll("button[data-a11y]").forEach(A=>{A.addEventListener("click",()=>{let L=A.dataset.f;L==="all"?E.clear():E.has(L)?E.delete(L):E.add(L),M()})})}if(k){let T=document.createElement("button");T.type="button",T.className="sl-chip-f",T.setAttribute("aria-pressed","false"),T.innerHTML=`\u25D0 ${this.tf("picker.hideLimitedView","Hide limited-view seats")}`,b.appendChild(T),T.addEventListener("click",()=>{let E=!this.limitedViewFilter;this.limitedViewFilter=E,T.classList.toggle("on",E),T.setAttribute("aria-pressed",String(E)),this.controller.setCommercialLimitedFilter(E),this.pushAvailabilityTo3d(),E&&x()})}}let v=document.createElement("button");v.type="button",v.className="sl-cbbtn",this.cbEl=v,v.setAttribute("aria-label",this.tf("picker.toggleColorblindColors","Toggle colorblind-friendly colors")),v.setAttribute("aria-pressed",String(this.cbSafe)),v.innerHTML='<svg viewBox="0 0 24 24"><path d="M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z"/><circle cx="12" cy="12" r="3"/></svg>',this.els.zfit.parentElement.appendChild(v),v.addEventListener("click",()=>{this.setColorblindSafe(!this.cbSafe)}),this.srEl=document.createElement("div"),this.srEl.className="sl-sr",this.srEl.setAttribute("aria-live","polite"),a.appendChild(this.srEl),this.buildArenaChrome(),this.buildMinimap(),this.buildPriceFilter(),this.buildExtendPrompt(),this.buildBookedOverlay(),this.buildSoldoutOverlay(),this.buildPanelToggle(),this.opts.panelCollapsed&&this.setPanelCollapsed(!0),this.dockLayoutChrome(),t.buildBuyerControls=i(d);let C=performance.now();if(await this.restoreRememberedHold(),t.restoreHold=i(C),this.destroyed)return this;this.salesClosed&&this.applySalesClosed(),this.syncPrices(),this.syncTray(),this.resumeHostedOrder();let h=this.controller.doc;return this.emitAnalytics("chart_rendered",{renderingTimeMillis:i(e),performanceProfile:t,seatCount:this.allSeats().length,objectCount:h?.objects.length??0,sectionCount:h?.objects.filter(b=>b.type==="section").length??0,view:this.buyerView,eventKey:this.opts.event,chartName:h?.name,floorCount:this.controller.getFloors().length,transport:this.opts.transport?"custom":"pubapi",load:Yi(this.opts.event)?"repeat":"cold"}),this}wireBuyerShell(e){this.refreshOfferAvailability(!1),this.api.availability&&(this.offerVisibilityHandler=()=>{!document.hidden&&!this.destroyed&&this.refreshOfferAvailability(!1)},document.addEventListener("visibilitychange",this.offerVisibilityHandler)),this.observeLayout(e),this.els.zin.addEventListener("click",()=>this.controller.zoomIn()),this.els.zout.addEventListener("click",()=>this.controller.zoomOut()),this.els.zfit.addEventListener("click",()=>this.controller.zoomToFit()),this.els.zfs.addEventListener("click",()=>this.toggleFullscreen()),this.fsChangeHandler=()=>{document.fullscreenElement||this.setFsFallback(!1),this.syncFullscreenButtons(),requestAnimationFrame(()=>this.controller.refitCurrentView())},document.addEventListener("fullscreenchange",this.fsChangeHandler);let t=this.els.sheetHead;if(t){let s=this.els.sheetToggle,r=c=>{e.dataset.sheet=c?"open":"peek",s?.setAttribute("aria-expanded",String(c)),s?.setAttribute("aria-label",c?this.tf("picker.collapseTicketPanel","Collapse ticket panel"):this.tf("picker.openTicketPanel","Open ticket panel"))};r(e.dataset.sheet==="open"),s?.addEventListener("click",c=>{c.stopPropagation(),r(e.dataset.sheet!=="open")}),this.els.peek?.addEventListener("click",c=>{let u=c.target.closest(".sl-sheet-go");u&&(c.stopPropagation(),u.dataset.act==="checkout"?this.handleCta():u.dataset.act==="best"?(this.baReopen=!0,this.baQty=Math.max(1,Math.min(this.baQty,this.maxTickets-this.totalTicketCount())),this.syncTray(),r(!0),this.els.tray?.querySelector(".sl-ba-go")?.focus()):r(!0))});let n=0,a=!1,l=!1;t.addEventListener("pointerdown",c=>{if(c.target.closest?.(".sl-seccard,.sl-sheet-toggle,.sl-sheet-go")){l=!1;return}l=!0,a=!1,n=c.clientY,t.setPointerCapture?.(c.pointerId)}),t.addEventListener("pointermove",c=>{if(!l||a)return;let u=c.clientY-n;u<-18?(r(!0),a=!0):u>18&&(r(!1),a=!0)}),t.addEventListener("pointerup",c=>{l&&!a&&Math.abs(c.clientY-n)<6&&r(e.dataset.sheet!=="open"),l=!1,t.releasePointerCapture?.(c.pointerId)})}let i=()=>{if(this.root?.dataset.layout!=="narrow")return;let s=this.root.getAttribute("data-prices-open")==="true";if(this.root.setAttribute("data-prices-open",String(!s)),this.els.pricesSec?.setAttribute("aria-expanded",String(!s)),!s&&this.root.dataset.sheet!=="open"){this.root.dataset.sheet="open";let r=this.els.sheetToggle;r?.setAttribute("aria-expanded","true"),r?.setAttribute("aria-label","Collapse ticket panel")}};this.els.pricesSec?.addEventListener("click",s=>{s.target.closest("select,button")||i()}),this.els.pricesSec?.addEventListener("keydown",s=>{s.key!=="Enter"&&s.key!==" "||s.target.closest("select,button")||(s.preventDefault(),i())}),this.tipEl=document.createElement("div"),this.tipEl.setAttribute("role","tooltip"),this.tipEl.className="sl-tip",this.els.map.appendChild(this.tipEl),this.els.map.addEventListener("mousemove",s=>{let r=this.els.map.getBoundingClientRect();this.tipPos={x:s.clientX-r.left,y:s.clientY-r.top},this.tipEl&&this.tipEl.style.display!=="none"&&this.placeTooltip()}),this.els.cta.addEventListener("click",()=>{this.handleCta()}),this.els.holdChange?.addEventListener("click",()=>{this.handleChangeSeats()})}observeLayout(e){let t=()=>{let i=e.clientWidth;if(i<=0)return;let s=e.clientHeight,r=i!==this.pickerLayoutSize.width||s!==this.pickerLayoutSize.height;this.pickerLayoutSize={width:i,height:s},this.reportFramedHeight();let n=i<640?"narrow":"wide",a=s<560?"compact":"comfortable";(e.dataset.layout!==n||e.dataset.density!==a)&&(e.dataset.layout=n,e.dataset.density=a,n==="narrow"&&!e.dataset.sheet&&(e.dataset.sheet="peek"),this.dockLayoutChrome()),r&&this.minimap?.refreshMinimap()};this.ro=new ResizeObserver(t),this.ro.observe(e),t(),requestAnimationFrame(t)}async loadChart(e,t,i){let s=performance.now(),r=await this.controller.render(e);return t.loadChartAndStatuses=i(s),this.destroyed?null:r?(Object.assign(t,r.performanceProfile),r):(this.els.boot.innerHTML=`<div class="sl-boot-title">${this.tf("picker.mapDidNotLoad","The seat map didn\u2019t load")}</div><div>${this.tf("picker.checkConnection","Check your connection and try again.")}</div><button type="button" class="sl-boot-retry">${this.tf("picker.accessRetry","Try again")}</button>`,this.els.boot.querySelector("button").addEventListener("click",()=>{let n=this.opts.container,a=this.opts;this.destroy(),new o({...a,container:n}).render()}),null)}resumeHostedOrder(){if(this.checkoutMode!=="hosted"||typeof location>"u")return;let e=new URLSearchParams(location.search),t=e.get("order");if(!t)return;let i=e.get("status");e.delete("order"),e.delete("status");try{let s=e.toString();history.replaceState(history.state,"",`${location.pathname}${s?`?${s}`:""}${location.hash}`)}catch{}i==="success"&&this.openCheckoutPanel({kind:"resume",orderId:t})}buildPanelToggle(){if(!this.regions["top-right"])return;let e=document.createElement("button");e.type="button",e.className="sl-side-toggle",e.addEventListener("click",()=>this.setPanelCollapsed(!this.sideCollapsed)),this.sideToggleEl=e,this.regions["top-right"].appendChild(e),this.syncPanelToggle()}syncPanelToggle(){let e=this.sideToggleEl;if(!e)return;let t=this.sideCollapsed;e.setAttribute("aria-expanded",String(!t)),e.setAttribute("aria-label",t?this.tf("picker.showTicketPanel","Show the ticket panel"):this.tf("picker.hideTicketPanel","Hide the ticket panel")),e.title=t?this.tf("picker.showTicketPanel","Show the ticket panel"):this.tf("picker.hideTicketPanel","Hide the ticket panel"),e.innerHTML=t?`<svg viewBox="0 0 24 24"><path d="M15 6l-6 6 6 6"/></svg><span>${this.tf("picker.tickets","Tickets")}</span>`:'<svg viewBox="0 0 24 24"><path d="M9 6l6 6-6 6"/></svg>'}setPanelCollapsed(e){this.destroyed||(this.sideCollapsed=e,this.applyPanelCollapsed(),this.scheduleMotion(()=>this.controller.refitCurrentView(),340))}applyPanelCollapsed(){let e=this.root?.dataset.layout!=="narrow";this.root?.setAttribute("data-side-collapsed",String(this.sideCollapsed)),this.els.side?.toggleAttribute("inert",this.sideCollapsed&&e),this.syncPanelToggle()}dockLayoutChrome(){let e=this.root?.dataset.layout==="narrow";this.applyPanelCollapsed();let t=this.els.zfs,i=this.els.headInfo?.parentElement;t&&i&&t.parentElement!==i&&(t.classList.add("sl-fs-pill"),i.insertBefore(t,this.els.hold??null));let s=this.els.pricesSec;s&&(e?(s.setAttribute("role","button"),s.tabIndex=0,s.setAttribute("aria-expanded",String(this.root?.getAttribute("data-prices-open")==="true"))):(s.removeAttribute("role"),s.removeAttribute("aria-expanded"),s.tabIndex=-1)),this.cbEl&&this.els.zoom?.appendChild(this.cbEl),this.a11yChipsEl&&(e?this.els.rail?.insertBefore(this.a11yChipsEl,this.els.railScroll??null):this.regions["top-left"]?.appendChild(this.a11yChipsEl)),this.lastSection&&this.renderSectionCard(this.lastSection)}buildExtendPrompt(){let e=document.createElement("div");e.className="sl-extend",e.setAttribute("role","status"),e.innerHTML='<span class="sl-extend-txt" data-ref="extendTxt"></span><button type="button" class="sl-extend-btn" data-ref="extendBtn"></button>',(this.regions["bottom-center"]??this.els.map).appendChild(e),this.extendEl=e,this.els.extendTxt=e.querySelector('[data-ref="extendTxt"]'),this.els.extendBtn=e.querySelector('[data-ref="extendBtn"]'),this.els.extendBtn.textContent=this.tf("picker.addTime","Add time"),this.els.extendBtn.addEventListener("click",()=>{this.handleExtend()})}buildBookedOverlay(){let e=document.createElement("div");e.className="sl-booked",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.innerHTML=`<div class="sl-booked-badge"><svg viewBox="0 0 24 24"><path d="M20 6L9 17l-5-5"/></svg></div><div class="sl-booked-title">${this.tf("picker.allSetTitle","You're all set")}</div><div class="sl-booked-sub" data-ref="bookedSub"></div>`,this.root.appendChild(e),this.bookedEl=e,this.els.bookedSub=e.querySelector('[data-ref="bookedSub"]')}tf(e,t){return S(e,t)}buildSoldoutOverlay(){if(!this.els.map)return;let e=document.createElement("div");e.className="sl-soldout",e.setAttribute("role","status");let t=(this.controller.doc?.theme?.brandName??this.opts.theme?.brandName??this.els.name?.textContent??this.tf("picker.soldOutEyebrow","This event")).toUpperCase();e.innerHTML=`<div class="sl-soldout-eyebrow">${t}</div><div class="sl-soldout-title">${this.tf("picker.soldOutTitle","Sold out")}</div><p class="sl-soldout-copy">${this.tf("picker.soldOutCopy","No reserved seats are currently available for this event.")}</p>`,this.els.map.appendChild(e),this.soldoutEl=e}syncSoldout(e,t){let i=this.controller.getGAAreas().length>0,s=this.isSoldOut(e,t,i);s!==this.soldOut&&(this.soldOut=s,this.soldoutEl?.classList.toggle("on",s))}isSoldOut(e,t,i){return!i&&e.length>0&&e.every(s=>(t[s.key]??0)===0)}setSalesClosed(e){let t=e||!!this.opts.readOnly;this.salesClosed!==t&&(this.salesClosed=t,this.applySalesClosed())}applySalesClosed(){this.salesClosed&&this.tableDialog&&!this.tableDialogHeld&&this.cancelTableDialog();let e=this.els.closedPill;if(e){e.classList.toggle("on",this.salesClosed);let t=this.els.closedPillText??e;t.textContent=this.tf("picker.salesClosedPill","Sales are closed")}this.root?.setAttribute("data-sales-closed",String(this.salesClosed)),this.salesClosed&&this.srEl&&(this.srEl.textContent=this.tf("picker.salesClosedToast","Sales are closed for this event.")),this.syncCta(),this.syncTray()}badgeHidden(e){return!!(this.opts.hideBadge||e?.hideBadge)}buildBadge(e){if(this.badgeHidden(e))return;let t=this.els.foot;if(!t)return;let i=document.createElement("a");i.className="sl-powered",i.href="https://seatlayer.io/?ref=picker",i.target="_blank",i.rel="noopener noreferrer",i.setAttribute("aria-label",this.tf("picker.poweredBy","Powered by SeatLayer")),i.innerHTML='<span class="sl-powered-mark" aria-hidden="true">'+ge+`</span><span>${this.tf("picker.poweredBy","Powered by SeatLayer")}</span>`,t.appendChild(i)}buildRegions(){if(!this.els.map)return;let e=["top-left","top-center","top-right","left-rail","bottom-left","bottom-center","bottom-right"];for(let t of e){let i=document.createElement("div");i.className="sl-anchor",i.dataset.region=t,this.els.map.appendChild(i),this.regions[t]=i}}cssVar(e){return this.root?getComputedStyle(this.root).getPropertyValue(e).trim():""}reducedMotion(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}scheduleMotion(e,t){let i=setTimeout(()=>{this.motionTimers.delete(i),this.destroyed||e()},t);this.motionTimers.add(i)}animateOnce(e,t,i=600){!e||this.reducedMotion()||(e.classList.remove(t),e.offsetWidth,e.classList.add(t),this.scheduleMotion(()=>e.classList.remove(t),i))}flashPickedSeat(e){this.reducedMotion()||this.controller.flashSeat(e,this.cssVar("--sl-accent")||"#f4b740")}flashHeldSeats(e){if(this.reducedMotion())return;(e.items??[]).filter(i=>i.objectType!=="ga").map(i=>i.label).slice(0,10).forEach((i,s)=>{let r=this.controller.seatByLabel(i);r&&this.scheduleMotion(()=>this.controller.flashSeat(r.id,this.cssVar("--sl-accent")||"#f4b740"),s*55)})}committedSelection(){let e=this.confirmSeat?.id,t=this.tableDialog&&!this.tableDialogHeld?this.tableDialog.id:null;return this.controller.getSelection().filter(i=>i.id!==e&&i.id!==t)}pendingSelectionCount(){let e=this.hold?.items??[],t=new Set(e.map(s=>s.label));return this.committedSelection().filter(s=>!t.has(s.label)).reduce((s,r)=>s+(r.quantity??1),0)+this.pendingGACount()}heldGACounts(){let e=new Map;for(let t of(this.hold?.items??[]).filter(i=>i.objectType==="ga"))e.set(t.objectId,(e.get(t.objectId)??0)+(t.quantity??1));return e}pendingGACount(){let e=this.heldGACounts();return[...this.gaQty.entries()].reduce((t,[i,s])=>t+Math.max(0,s-(e.get(i)??0)),0)}heldTicketCount(){return(this.hold?.items??[]).reduce((e,t)=>e+(t.quantity??1),0)}totalTicketCount(){let e=new Set((this.hold?.items??[]).map(i=>i.label)),t=this.committedSelection().filter(i=>!e.has(i.label)).reduce((i,s)=>i+(s.quantity??1),0);return this.heldTicketCount()+t+this.pendingGACount()}updateSelectionCapacity(){let e=new Set((this.hold?.items??[]).map(s=>s.label)),t=this.committedSelection().filter(s=>e.has(s.label)).reduce((s,r)=>s+(r.quantity??1),0),i=Math.max(0,this.maxTickets-this.heldTicketCount()-this.pendingGACount());this.controller.setMaxSelection(t+i)}canAddTicket(){return this.totalTicketCount()<this.maxTickets?!0:(this.toast(y("picker.maxTicketsForOrder",{count:this.maxTickets}),"warning"),!1)}pendingGATotal(e){let t=new Map;for(let i of(this.hold?.items??[]).filter(s=>s.objectType==="ga"))t.set(i.objectId,(t.get(i.objectId)??0)+(i.quantity??1));return e.reduce((i,s)=>i+this.paidPrice(s.categoryKey,null,s.price,s.id)*Math.max(0,(this.gaQty.get(s.id)??0)-(t.get(s.id)??0)),0)}syncCta(e=this.lastTrayCount,t=this.pendingSelectionCount()){let i=this.els.cta;if(!i)return;if(this.salesClosed){i.disabled=!0,i.textContent=this.tf("picker.salesClosedCta","Sales closed");return}if(this.confirmSeat||this.tableDialog&&!this.tableDialogHeld){i.disabled=!0,i.textContent=this.tableDialog?this.tf("picker.confirmYourTable","Confirm your table"):this.tf("picker.confirmOrCancelSeat","Confirm or cancel this seat");return}if(this.ctaPhase==="holding"){i.disabled=!0,i.innerHTML=`<span class="sl-cta-spin" aria-hidden="true"></span>${this.tf("picker.securingSeats","Securing your seats\u2026")}`;return}if(this.ctaPhase==="checkout"){i.disabled=!0,i.innerHTML=`<span class="sl-cta-spin" aria-hidden="true"></span>${this.tf("picker.openingCheckout","Opening secure checkout\u2026")}`;return}let s=this.controller.getSelectionValidity(e);if(s&&!s.isValid){i.disabled=!0,i.textContent=Ve(s,(r,n)=>this.tf(r,n),!0);return}i.disabled=e===0,i.textContent=this.hold?t?y("picker.secureMoreAndCheckout",{count:t}):this.tf("picker.continueToCheckout","Continue to checkout"):e?this.tf("picker.holdSeatsAndCheckout","Hold seats & checkout"):this.tf("picker.selectSeats","Select seats")}setCtaPhase(e){this.ctaPhase=e,this.syncCta(),this.renderPeek(this.lastTrayCount,this.lastTrayTotal,this.pendingSelectionCount()),e==="checkout"&&this.scheduleMotion(()=>{this.ctaPhase==="checkout"&&(this.ctaPhase="idle",this.syncCta(),this.renderPeek(this.lastTrayCount,this.lastTrayTotal,this.pendingSelectionCount()))},1100)}holdStorageKey(){return`@seatlayer/hold/v1/${encodeURIComponent(this.apiBase)}/${encodeURIComponent(this.opts.event)}`}rememberedHoldId(){if(this.opts.initialHoldId)return this.opts.initialHoldId;if(this.opts.restoreHold===!1||typeof window>"u")return null;try{return window.sessionStorage.getItem(this.holdStorageKey())}catch{return null}}rememberHold(e){if(!(this.opts.restoreHold===!1||typeof window>"u"))try{window.sessionStorage.setItem(this.holdStorageKey(),e.holdId)}catch{}}forgetHold(){if(!(typeof window>"u"))try{window.sessionStorage.removeItem(this.holdStorageKey())}catch{}}async resumeHoldFromServer(e,t){try{let i=await this.controller.resumeHold(e);if(!i)return null;let s={holdId:i.holdId,expiresAt:i.expiresAt,seats:i.seats,items:i.items};return this.hold=s,this.handedOff=!0,this.bookedShown=!1,this.ctaPhase="idle",this.startHoldTimer(s.expiresAt),this.rememberHold(s),this.syncTray(),this.emitHoldChange(),this.opts.onHoldRestored?.(s,s.seats??[],this.buildHandoff(s)),t&&this.toast(this.tf("picker.heldTicketsRestored","Your held tickets have been restored."),"success"),s}catch(i){let s=i?.status;return s===404||s===409?this.forgetHold():this.opts.onError?.(i),null}}async restoreRememberedHold(){let e=this.rememberedHoldId();e&&await this.resumeHoldFromServer(e,!0)}activeFloorObjects(){let e=this.controller.doc;if(!e)return[];let t=e.floors;if(t?.length){let i=this.controller.getActiveFloorId();return(t.find(s=>s.id===i)??t[0]).objects??[]}return e.objects??[]}buildMinimap(){this.els.map&&(this.minimap=Tt({controller:this.controller,root:()=>this.root,cssVar:e=>this.cssVar(e),focusedSectionLabel:()=>this.lastSection?.label},this.regions["bottom-left"]??this.els.map))}catPrice(e){let t=e.tiers?.length?e.tiers[0].price:e.price;return t===void 0||!e.key?t:this.paidPrice(e.key,e.tiers?.[0]?.id??null,t)}catPriceRange(e){let t=e.tiers?.length?e.tiers.map(i=>this.paidPrice(e.key,i.id??null,i.price)):e.price==null?[]:[this.paidPrice(e.key,null,e.price)];if(e.key)for(let i of this.pricesByChannel.values())for(let s of i)s.categoryKey===e.key&&t.push(s.price);return t.length?{min:Math.min(...t),max:Math.max(...t)}:void 0}priceBands(){let e=this.controller.doc;if(!e)return[];let t=e.categories.map(a=>({key:a.key,range:this.catPriceRange(a)})).filter(a=>a.range!=null);if(!t.length)return[];let i=[...new Map(t.map(a=>[`${a.range.min}:${a.range.max}`,a.range])).values()].sort((a,l)=>a.min-l.min||a.max-l.max);if(i.length<=5)return i.map(a=>({id:`p${a.min}-${a.max}`,label:a.min===a.max?this.money(a.min):`${this.money(a.min)}\u2013${this.money(a.max)}`,keys:t.filter(l=>l.range.min===a.min&&l.range.max===a.max).map(l=>l.key),min:a.min,max:a.max}));let s=[...t].sort((a,l)=>a.range.min-l.range.min||a.range.max-l.range.max),r=Math.ceil(s.length/4),n=[];for(let a=0;a<s.length;a+=r){let l=s.slice(a,a+r),c=Math.min(...l.map(p=>p.range.min)),u=Math.max(...l.map(p=>p.range.max));n.push({id:`b${a}`,label:c===u?this.money(c):`${this.money(c)}\u2013${this.money(u)}`,keys:l.map(p=>p.key),min:c,max:u})}return n}buildPriceFilter(){if(!this.els.prices||!this.els.pricesSec)return;let e=this.priceBands();if(e.length<2)return;let t=document.createElement("select");t.className="sl-price-select",t.setAttribute("aria-label",this.tf("picker.filterAndFocusByPrice","Filter and focus seats by price")),t.innerHTML=`<option value="all">${this.tf("picker.allPrices","All prices")}</option>`+e.map(i=>`<option value="${i.id}">${i.label}</option>`).join(""),this.els.pricesSec.appendChild(t),t.addEventListener("change",()=>{let s=e.find(r=>r.id===t.value)?.keys??null;this.focusedCatKey=null,this.priceBandKeys=s?new Set(s):null,this.controller.setCategoryFilter(s),this.controller.focusCategoryFilter(s),this.pushAvailabilityTo3d(),this.syncFloors(),this.syncRung(),this.minimap?.refreshMinimap(),this.syncPrices(),this.lastSection&&this.showSectionCard(this.lastSection)})}buildArenaChrome(){let e=this.controller.doc;if(!e||!this.els.map)return;let t=e.objects.some(i=>i.type==="section")||(e.floors??[]).some(i=>i.objects.some(s=>s.type==="section"));if(this.canOffer3d()){let i=document.createElement("div");i.className="sl-projection",i.setAttribute("role","group"),i.setAttribute("aria-label",this.tf("picker.venueView","Venue view")),i.innerHTML=`<button type="button" data-view="map" aria-pressed="true" title="${this.tf("picker.flat2dMap","Flat 2D map")}">${this.tf("picker.map","Map")}</button><button type="button" data-view="venue3d" aria-pressed="false" title="${this.tf("picker.interactive3dVenueView","Interactive 3D venue view")}">3D</button>`,i.querySelectorAll("button").forEach(s=>{s.addEventListener("click",()=>{this.setBuyerView(s.dataset.view)})}),this.regions["top-right"].appendChild(i),this.projectionEl=i,this.syncProjection()}if(t){let i=[...e.objects,...(e.floors??[]).flatMap(u=>u.objects)],s=new Set((e.zones??[]).map(u=>u.id)),n=i.some(u=>u.type==="section"&&typeof u.zone=="string"&&s.has(u.zone))?["zones","sections","seats"]:["sections","seats"],a=document.createElement("div");a.className="sl-rungs on",a.setAttribute("role","group"),a.setAttribute("aria-label",y("picker.zoomLevel"));let l={zones:y("picker.rungLabel.zones"),sections:y("picker.rungLabel.sections"),seats:y("picker.rungLabel.seats")},c={zones:y("picker.rungTip.zones"),sections:y("picker.rungTip.sections"),seats:y("picker.rungTip.seats")};a.innerHTML=n.map(u=>`<button type="button" data-rung="${u}" title="${c[u]}" aria-pressed="false">${l[u]}</button>`).join(""),a.querySelectorAll("button").forEach(u=>{u.addEventListener("click",()=>{let p=u.dataset.rung;this.controller.setRung(p),p==="seats"&&this.collapseSectionCard()})}),this.regions["top-center"].appendChild(a),this.rungsEl=a,this.syncRung()}if(this.controller.isMultiFloor()){let i=this.controller.getFloors(),s=document.createElement("div");s.className="sl-floors on";let r=document.createElement("select");r.setAttribute("aria-label",this.tf("picker.chooseLevel","Choose level"));let n=document.createElement("option");n.value="",n.textContent=this.tf("picker.allFloors","All floors"),r.appendChild(n);for(let c of i){let u=document.createElement("option");u.value=c.id,u.textContent=c.name,r.appendChild(u)}r.addEventListener("change",()=>{r.value===""?this.controller.setFloorOverview(!0):this.controller.setFloor(r.value),this.showSectionCard(null),this.syncFloors(),this.syncRung(),this.minimap?.refreshMinimap()}),s.appendChild(r);let a=document.createElement("button");a.type="button",a.className="sl-floor-info",a.textContent="i";let l=this.tf("picker.floorHelp","All floors shows the complete venue. Choose one level to inspect and select its seats.");a.setAttribute("aria-label",l),a.title=l,s.appendChild(a),this.regions["left-rail"].appendChild(s),this.floorsEl=s,this.syncFloors()}}syncRung(){let e=this.controller.getRung(),t=e==="seats";this.root&&(this.root.dataset.zoomed=String(t)),this.minimap?.setAutoOpen(!1),this.rungsEl&&this.rungsEl.querySelectorAll("button").forEach(i=>{let s=i.dataset.rung===e;i.classList.toggle("on",s),i.setAttribute("aria-pressed",String(s))})}syncProjection(){this.projectionEl&&this.projectionEl.querySelectorAll("button").forEach(e=>{let t=e.dataset.view===this.buyerView;e.classList.toggle("on",t),e.setAttribute("aria-pressed",String(t))})}canOffer3d(){return this.opts.enable3D===!1||!this.controller.doc||!mt()?!1:this.allSeats().length<=this.max3dSeats()}max3dSeats(){let e=this.opts.max3DSeats;if(typeof e=="number"&&e>0)return e;let t=globalThis.navigator;return(t?.hardwareConcurrency??8)<=4||(t?.deviceMemory??8)<=4||(globalThis.matchMedia?.("(pointer: coarse)").matches??!1)?It/2:It}syncFloors(){if(!this.floorsEl)return;let e=this.controller.getActiveFloorId(),t=this.controller.isFloorOverview(),i=this.floorsEl.querySelector("select");i&&(i.value=t?"":e)}showSectionCard(e){if(this.lastSection=e,this.secCardEl?.remove(),this.secCardEl=null,!e){this.minimap?.refreshMinimap();return}this.secCardCollapsed=this.controller.getRung()==="seats",this.secCardShownAt=Date.now(),this.renderSectionCard(e),this.minimap?.refreshMinimap()}sectionNeighbours(e){let t=this.activeFloorObjects().filter(s=>s.type==="section"&&!this.controller.isSectionClosed(s.id)&&this.controller.getSectionSeatCount(s.id)>0);if(t.length<2)return null;let i=t.findIndex(s=>s.id===e);return i<0?null:{previous:t[(i-1+t.length)%t.length],next:t[(i+1)%t.length]}}wireSectionNavigation(e){e.querySelectorAll("[data-section-nav]").forEach(t=>{t.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation();let s=t.dataset.sectionNav;s&&this.controller.focusSection(s)})})}renderSectionCard(e){if(!this.els.map)return;this.secCardEl?.remove();let t=e.categories.length?e.categories.map(p=>{let d=this.controller.doc?.categories.find(f=>f.key===p.key);return d?this.catPriceRange(d):{min:p.priceMin,max:p.priceMax}}).filter(p=>p!=null):[{min:e.priceMin,max:e.priceMax}],i=Math.min(...t.map(p=>p.min)),s=Math.max(...t.map(p=>p.max)),r=i===s?this.money(i):`${this.money(i)}\u2013${this.money(s)}`,n=q("picker.seatsLeftInSection",e.seatsLeft),a=`<button type="button" class="sl-seccard-x" aria-label="${y("picker.closeSectionSummary")}">\u2715</button>`,l=wt(this.sectionNeighbours(e.id)),c=document.createElement("div");if(this.root?.dataset.layout==="narrow")c.className="sl-seccard strip on",c.setAttribute("role","status"),c.setAttribute("aria-label",y("picker.sectionSummaryAria",{label:e.label})),c.innerHTML=`<span class="sl-seccard-dot" style="background:${e.color}"></span><span class="sl-seccard-name">${e.label}</span><span class="sl-seccard-left">${n}</span>`+l+a,this.wireSectionNavigation(c),c.querySelector(".sl-seccard-x").addEventListener("click",()=>this.controller.overview()),this.els.map.appendChild(c);else if(this.secCardCollapsed)c.className="sl-seccard mini on",c.setAttribute("role","button"),c.setAttribute("aria-label",y("picker.sectionSummaryAria",{label:e.label})),c.innerHTML=`<span class="sl-seccard-dot" style="background:${e.color}"></span><span class="sl-seccard-name">${e.label}</span><span class="sl-seccard-left">${n}</span>`+l+a,this.wireSectionNavigation(c),c.addEventListener("click",p=>{p.target.closest(".sl-seccard-x")||(this.secCardCollapsed=!1,this.secCardShownAt=Date.now(),this.renderSectionCard(e))}),c.querySelector(".sl-seccard-x").addEventListener("click",()=>this.controller.overview()),(this.regions["top-center"]??this.els.map).appendChild(c);else{c.className="sl-seccard on",c.setAttribute("role","dialog"),c.setAttribute("aria-label",y("picker.sectionSummaryAria",{label:e.label}));let p=e.categories.map(d=>{let f=this.priceBandKeys!=null&&!this.priceBandKeys.has(d.key),m=this.controller.doc?.categories.find(k=>k.key===d.key),g=m?this.catPriceRange(m):{min:d.priceMin,max:d.priceMax},w=g&&g.min!==g.max?`${this.money(g.min)}\u2013${this.money(g.max)}`:this.money(g?.min??d.price);return`<span class="sl-seccard-mix-item${f?" sl-dim":""}"><span class="sl-seccard-mix-dot" style="background:${d.color}"></span>${d.label} <span class="sl-seccard-mix-price">${w}</span></span>`}).join("");c.innerHTML=`<div class="sl-seccard-head"><span class="sl-seccard-dot" style="background:${e.color}"></span><span class="sl-seccard-name">${e.label}</span>`+(e.categories.length?`<span class="sl-seccard-price">${r}</span>`:"")+a+`</div><div class="sl-seccard-zone">${e.zoneLabel?`${e.zoneLabel} \xB7 `:""}<span class="sl-seccard-left">${n}</span></div>`+(e.entrance?`<div class="sl-seccard-entrance">${y("picker.entrance")} ${String(e.entrance).replace(/[&<>"]/g,d=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[d])}</div>`:"")+(p?`<div class="sl-seccard-mix">${p}</div>`:"")+`<div class="sl-seccard-foot"><button type="button" class="sl-seccard-overview">\u2190 ${y("picker.overview")}</button>`+l+`<span class="sl-seccard-hint">${y("picker.tapSeatHint")}</span></div>`,this.wireSectionNavigation(c),c.querySelector(".sl-seccard-x").addEventListener("click",()=>this.controller.overview()),c.querySelector(".sl-seccard-overview").addEventListener("click",()=>this.controller.overview()),(this.regions["top-center"]??this.els.map).appendChild(c)}this.secCardEl=c}collapseSectionCard(){!this.secCardEl||this.secCardCollapsed||!this.lastSection||this.root?.dataset.layout!=="narrow"&&(this.secCardCollapsed=!0,this.renderSectionCard(this.lastSection))}sectionCardOnView(){if(!(!this.secCardEl||this.secCardCollapsed||!this.lastSection)&&this.root?.dataset.layout!=="narrow"){if(this.controller.getRung()==="seats"){this.collapseSectionCard();return}if(Date.now()-this.secCardShownAt<1400){this.sectionCardCoverage()>.25&&this.collapseSectionCard();return}this.collapseSectionCard()}}sectionCardCoverage(){let e=this.secCardEl,t=this.lastSection;if(!e||!t||!this.els.map)return 0;let i=this.activeFloorObjects().find(k=>k.type==="section"&&k.id===t.id)?.outline;if(!i||i.length<3)return 0;let s=i.map(k=>this.controller.worldToScreen(k)),r=s.map(k=>k.x),n=s.map(k=>k.y),a=Math.min(...r),l=Math.min(...n),c=Math.max(...r)-a,u=Math.max(...n)-l;if(c<=0||u<=0)return 0;let p=this.els.map.getBoundingClientRect(),d=e.getBoundingClientRect(),f=d.left-p.left,m=d.top-p.top,g=Math.max(0,Math.min(f+d.width,a+c)-Math.max(f,a)),w=Math.max(0,Math.min(m+d.height,l+u)-Math.max(m,l));return g*w/(c*u)}announceSeat(e){if(!this.srEl)return;if(!e){this.srEl.textContent="";return}let t=this.controller.doc?.categories.find(d=>d.key===e.categoryKey),i=this.controller.getStatus(e.id)??"free",s=i==="free"?this.tf("picker.statusAvailable","available"):i==="held"?this.tf("picker.statusOnHold","on hold"):this.tf("picker.statusTaken2","taken"),r=t?this.catPriceRange(t):void 0,n=r?r.min===r.max?this.money(r.min):`${this.money(r.min)}\u2013${this.money(r.max)}`:void 0,a=this.controller.tableSelection(e.id),l=a??this.controller.seatDetails(e.id),c=this.rowTypeWord(l),u=l?.rowLabel??l?.displayLabel??e.displayLabel??e.label,p=a?`${c} ${u}, ${a.bookingMode==="variable"?y("picker.minToMaxGuests",{min:a.minOccupancy,max:a.maxOccupancy}):y("picker.capacityGuests",{count:a.capacity})}`:l?.objectType==="booth"?`${c} ${u}`:l?.objectType==="table"?`${c} ${u}, ${y("picker.seatNumberLower",{label:l.seatNumber??e.label})}`:y("picker.seatLabel",{label:l?.displayLabel??e.displayLabel??e.label});this.srEl.textContent=`${p}, ${t?.label??e.categoryKey}${n?`, ${n}`:""}, ${s}`}showTableDialog(e,t,i){this.dismissTableDialog(!1),this.tableDialog={...e},this.tableDialogHeld=t,this.tableDialogReturnFocus=i??document.activeElement;let s=c=>String(c??"").replace(/[&<>"']/g,u=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[u]),r=this.controller.doc?.categories.find(c=>c.key===e.categoryKey),n=e.bookingMode==="variable",a=this.rowTypeWord(e),l=document.createElement("div");l.className="sl-table-scrim",l.innerHTML=`<section class="sl-table-dialog" role="dialog" aria-modal="true" aria-labelledby="sl-table-title" aria-describedby="sl-table-copy"><div class="sl-table-head"><div class="sl-table-eyebrow">${s(n?y("picker.flexiblePartyTypeWord",{typeWord:a}):y("picker.wholeTypeWord",{typeWord:a}))}</div><h2 class="sl-table-title" id="sl-table-title">${s(e.displayLabel??e.label)}</h2><p class="sl-table-copy" id="sl-table-copy">${n?this.tf("picker.chooseGuestsCopy","Choose how many guests will sit together. This table is held exclusively for your party."):y("picker.allPlacesBookedTogether",{count:e.capacity})}</p></div><div class="sl-table-body"><div class="sl-table-summary"><span>${s(r?.label??e.categoryKey)}</span><b data-table-unit>${y("picker.perGuestPrice",{price:this.money(this.paidPrice(e.categoryKey,e.tierId??null,e.price,e.label))})}</b><span class="muted">${this.tf("picker.tableCapacity","Table capacity")}</span><span>${y("picker.guestsCount",{count:e.capacity})}</span><span class="muted">${this.tf("picker.total","Total")}</span><b data-table-total></b></div>`+(n?`<label class="sl-table-qtylabel" id="sl-table-qty-label">${this.tf("picker.numberOfGuests","Number of guests")}</label><div class="sl-table-stepper" role="group" aria-labelledby="sl-table-qty-label"><button type="button" data-table-step="-1" aria-label="${this.tf("picker.fewerGuests","Fewer guests")}">\u2212</button><output aria-live="polite" data-table-qty>${e.quantity}</output><button type="button" data-table-step="1" aria-label="${this.tf("picker.moreGuests","More guests")}">+</button></div><div class="sl-table-range">${y("picker.chooseMinMaxGuests",{min:e.minOccupancy,max:e.maxOccupancy})}</div>`:`<input type="hidden" data-table-qty value="${e.capacity}">`)+`<div class="sl-table-actions"><button type="button" class="sl-table-cancel">${y("common.cancel")}</button><button type="button" class="sl-table-confirm">${t?this.tf("picker.updateTable","Update table"):n?this.tf("picker.selectTable","Select table"):this.tf("picker.selectWholeTable","Select whole table")}</button></div></div></section>`,this.root.appendChild(l),this.tableDialogEl=l,this.renderTableDialogState(),l.querySelectorAll("[data-table-step]").forEach(c=>{c.addEventListener("click",()=>{if(!this.tableDialog)return;let u=Math.max(this.tableDialog.minOccupancy,Math.min(this.tableDialog.maxOccupancy,this.tableDialog.quantity+Number(c.dataset.tableStep)));this.tableDialog={...this.tableDialog,quantity:u},this.renderTableDialogState()})}),l.querySelector(".sl-table-cancel").addEventListener("click",()=>this.cancelTableDialog()),l.querySelector(".sl-table-confirm").addEventListener("click",()=>{this.confirmTableDialog()}),l.addEventListener("mousedown",c=>{c.target===l&&this.cancelTableDialog()}),l.addEventListener("keydown",c=>{if(c.key!=="Tab")return;let u=[...l.querySelectorAll('button:not(:disabled),[tabindex]:not([tabindex="-1"])')];if(!u.length)return;let p=u[0],d=u[u.length-1];c.shiftKey&&document.activeElement===p?(c.preventDefault(),d.focus()):!c.shiftKey&&document.activeElement===d&&(c.preventDefault(),p.focus())}),requestAnimationFrame(()=>l.querySelector(n?'[data-table-step="-1"]':".sl-table-confirm")?.focus())}renderTableDialogState(){let e=this.tableDialog,t=this.tableDialogEl;if(!e||!t)return;let i=t.querySelector("output[data-table-qty]");i&&(i.value=String(e.quantity));let s=t.querySelector("input[data-table-qty]");s&&(s.value=String(e.quantity)),t.querySelectorAll("[data-table-step]").forEach(a=>{let l=Number(a.dataset.tableStep);a.disabled=l<0?e.quantity<=e.minOccupancy:e.quantity>=e.maxOccupancy});let r=this.paidPrice(e.categoryKey,e.tierId??null,e.price,e.label),n=t.querySelector("[data-table-total]");n&&(n.textContent=this.money(r*e.quantity))}async confirmTableDialog(){let e=this.tableDialog,t=this.tableDialogHeld;if(!e)return;let i=this.tableDialogEl?.querySelector(".sl-table-confirm");if(i&&(i.disabled=!0,i.textContent=t?this.tf("picker.updatingEllipsis","Updating\u2026"):this.tf("picker.selectingEllipsis","Selecting\u2026")),t){try{let s=await this.controller.replaceTableQuantity(e.label,e.quantity,this.opts.holdTtlMs);if(!s){this.toast(this.tf("picker.guestCountCouldNotBeSecured","That guest count could not be secured. Your current table hold is unchanged."),"warning"),this.renderTableDialogState(),i&&(i.disabled=!1,i.textContent=this.tf("picker.updateTable","Update table"));return}this.hold={holdId:s.holdId,expiresAt:s.expiresAt,seats:s.seats,items:s.items},this.startHoldTimer(s.expiresAt),this.dismissTableDialog(),this.syncTray(),this.emitHoldChange(),this.toast(y("picker.tableUpdatedForGuests",{label:e.label,count:e.quantity}),"success")}catch(s){this.opts.onError?.(s),this.toast(this.tf("picker.guestCountNoLongerAvailable","That guest count is no longer available. Your current hold is unchanged."),"error"),i&&(i.disabled=!1,i.textContent=this.tf("picker.updateTable","Update table"))}return}if(!this.controller.setTableQuantity(e.label,e.quantity)){i&&(i.disabled=!1,i.textContent=e.bookingMode==="variable"?this.tf("picker.selectTable","Select table"):this.tf("picker.selectWholeTable","Select whole table"));return}this.dismissTableDialog(),this.collapseSectionCard(),this.syncTray()}cancelTableDialog(){let e=this.tableDialog,t=this.tableDialogHeld;this.dismissTableDialog(),e&&!t&&this.controller.deselect(e.physicalSeatIds)}dismissTableDialog(e=!0){let t=this.tableDialogReturnFocus;this.tableDialogEl?.remove(),this.tableDialogEl=null,this.tableDialog=null,this.tableDialogHeld=!1,this.tableDialogReturnFocus=null,e&&requestAnimationFrame(()=>(t?.isConnected?t:this.root)?.focus())}showConfirm(e){let t=this.confirmSeat?.id;this.confirmEl?.remove(),this.confirmEl=null,this.confirmSeat=e,this.root?.setAttribute("data-confirming","true"),this.els.side?.toggleAttribute("inert",!0),Object.values(this.regions).forEach(x=>x.toggleAttribute("inert",!0)),this.controller.setSelectionFocus(e.id),t&&t!==e.id&&this.controller.deselect([t]),this.tipEl&&(this.tipEl.style.display="none");let i=this.controller.seatDetails(e.id),s=this.controller.doc?.categories.find(x=>x.key===e.categoryKey),r=i?.price??(s?.tiers?.length?s.tiers[0].price:s?.price),n=r!=null?this.paidPrice(e.categoryKey,i?.tierId??s?.tiers?.[0]?.id??null,r,e.label):void 0,a=x=>String(x??"\u2014").replace(/[&<>"]/g,v=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[v]),l=[i?.sectionLabel?`<div class="sl-confirm-field"><span class="sl-confirm-key">${this.tf("picker.section","Section")}</span><span class="sl-confirm-value">${a(i.sectionLabel)}</span></div>`:"",i?.rowLabel||i?.objectType==="booth"?`<div class="sl-confirm-field"><span class="sl-confirm-key">${a(this.rowTypeWord(i))}</span><span class="sl-confirm-value">${a(G(i)??i?.displayLabel??e.displayLabel??e.label)}</span></div>`:"",i?.objectType!=="booth"?`<div class="sl-confirm-field"><span class="sl-confirm-key">${this.tf("picker.seat","Seat")}</span><span class="sl-confirm-value">${a(i?.seatNumber??i?.displayLabel??e.displayLabel??e.label)}</span></div>`:""].filter(Boolean).join(""),c=i?.tiers??s?.tiers??[],u=i?.tierId??c[0]?.id,p=x=>x.buyerMessage?.trim()||(x.restriction==="companion"?this.tf("picker.companionRequiresWheelchair","Requires the adjacent wheelchair place"):void 0),d=c.length>1?`<fieldset class="sl-confirm-tiers"><legend>${this.tf("picker.ticketType","Ticket type")}</legend>`+c.map(x=>{let v=p(x);return`<button type="button" class="sl-confirm-tier" data-confirm-tier="${a(x.id)}" aria-pressed="${x.id===u}"><span class="sl-confirm-tier-copy"><span class="sl-confirm-tier-name">${a(x.name)}</span>`+(v?`<small class="sl-confirm-tier-note">${a(v)}</small>`:"")+`</span><span class="sl-confirm-tier-price">${this.money(this.paidPrice(e.categoryKey,x.id,x.price,e.label))}</span></button>`}).join("")+"</fieldset>":c[0]&&p(c[0])?`<p class="sl-confirm-tier-note">${a(p(c[0]))}</p>`:"",f=this.buyerView==="venue3d",m=document.createElement("div");m.className="sl-confirm",m.setAttribute("role","dialog"),m.setAttribute("aria-label",y("picker.confirmSeatLabel",{label:e.label}));let g=s?.color??"#6e7bff",w=Ie(g,this.cssVar("--sl-surface")||"#1a2234",.76)??g;m.style.setProperty("--sl-cat",g),m.style.setProperty("--sl-cat-ink",he(w,"#172033","#ffffff")),m.innerHTML='<div class="sl-confirm-grid">'+l+`</div><div class="sl-confirm-cat"><span class="sl-dot" style="background:${s?.color??"#6e7bff"}"></span><span class="sl-confirm-cat-name">${a(i?.categoryLabel??s?.label??e.categoryKey)}</span>`+(n!=null?`<span class="sl-confirm-price">${this.money(n)}</span>`:"")+'</div><div class="sl-confirm-body">'+d+xt(i?.wheelchairSpaceType)+yt(e.commercial)+(this.seatViewEnabled()&&this.buyerView!=="venue3d"?this.confirmThumbHtml(e):"")+(f?`${St(e,`${i?.displayLabel??e.displayLabel??e.label} \xB7 ${n==null?this.tf("picker.priceNotSupplied","Price not supplied"):this.money(n)}`,f)}<div class="sl-confirm-inspect-row">${kt(e,f?this.view3dCompareSeatIds:null)}${De(this.canOffer3d(),f)}</div>`:De(this.canOffer3d(),f))+`<div class="sl-confirm-row"><button type="button" class="sl-confirm-cancel">${y("common.cancel")}</button><button type="button" class="sl-confirm-add"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4 4L19 7"/></svg>${this.tf("picker.select","Select")}</button></div></div>`,this.els.map.appendChild(m),this.confirmEl=m;let k=m.querySelector(".sl-confirm-thumb");if(k&&e.viewUrl){let x=e.viewMeta?.previewUrl??e.viewUrl;this.buyerAssetUrls.resolve(x).then(v=>{v&&m.isConnected&&this.confirmEl===m&&(k.src=v)}).catch(v=>this.opts.onError?.(v))}this.reanchorConfirm(),m.querySelector(".sl-confirm-view")?.addEventListener("click",()=>{this.openSeatView(e)}),m.querySelector(".sl-confirm-confidence")?.addEventListener("click",x=>{this.openSeatConfidencePassport(e,x.currentTarget instanceof HTMLElement?x.currentTarget:null)}),m.querySelector(".sl-confirm-compare")?.addEventListener("click",()=>this.saveView3dComparisonSeat(e)),m.querySelectorAll("[data-confirm-tier]").forEach(x=>{x.addEventListener("click",()=>{let v=x.dataset.confirmTier,C=c.find(b=>b.id===v);if(!C)return;this.controller.setSeatTier(e.id,C.id),m.querySelectorAll("[data-confirm-tier]").forEach(b=>{b.setAttribute("aria-pressed",String(b===x))});let h=m.querySelector(".sl-confirm-price");h&&(h.textContent=this.money(this.paidPrice(e.categoryKey,C.id,C.price,e.label))),this.reanchorConfirm()})}),m.querySelector(".sl-confirm-3d")?.addEventListener("click",()=>{this.buyerView==="venue3d"?(this.dismissConfirm(),this.view3dHandle?.flyToSeat(e.id)):(this.view3dReturnSeat=e,this.dismissConfirm(),this.enter3d(e.id))}),m.querySelector(".sl-confirm-add").addEventListener("click",()=>this.commitConfirm()),m.querySelector(".sl-confirm-cancel").addEventListener("click",()=>this.cancelConfirm()),requestAnimationFrame(()=>m.querySelector(".sl-confirm-add")?.focus())}reanchorConfirm(){if(!this.confirmEl||!this.confirmSeat||this.root?.dataset.view3d==="on")return;let e=this.controller.worldToScreen({x:this.confirmSeat.x,y:this.confirmSeat.y});if(this.root?.dataset.layout==="narrow")return;let t=this.els.map.clientWidth,i=this.els.map.clientHeight,s=this.confirmEl.offsetWidth||276,r=this.confirmEl.offsetHeight||230,n=s/2+12,a=Math.max(n,Math.min(t-n,e.x)),l=e.y+r+24<=i,c=e.y<r+24&&l;this.confirmEl.dataset.placement=c?"below":"above",this.confirmEl.style.left=`${a}px`,this.confirmEl.style.top=`${Math.max(8,Math.min(i-8,e.y))}px`}dismissConfirm(){this.confirmEl?.remove(),this.confirmEl=null,this.confirmSeat=null,this.root?.removeAttribute("data-confirming"),Object.values(this.regions).forEach(e=>e.toggleAttribute("inert",!1)),this.applyPanelCollapsed(),this.controller.setSelectionFocus(null)}commitConfirm(){this.confirmSeat&&(this.dismissConfirm(),this.collapseSectionCard(),this.syncTray(),this.syncSelectionTo3d())}cancelConfirm(){let e=this.confirmSeat;e&&(this.controller.deselect([e.id]),this.confirmSeat&&this.dismissConfirm(),this.syncSelectionTo3d(),this.root?.focus({preventScroll:!0}))}closeConfirm(){this.dismissConfirm()}seatViewEnabled(){return this.opts.seatView!==!1}allSeats(){if(!this.allSeatsCache){let e=this.controller.doc;this.allSeatsCache=e?Ue(e):[]}return this.allSeatsCache}async openSeatView(e){if(!this.root||!this.seatViewEnabled())return;let t=++this.seatViewGen,i=this.controller.doc,s=this.controller.getActiveFloorId(),r=e.focalPoint??i?.floors?.find(p=>p.id===s)?.focalPoint??i?.focalPoint??{x:0,y:0},n,a,l=!1;if(e.viewUrl){let p,d=null;try{let m=e.viewMeta?.previewUrl;m&&m!==e.viewUrl?(d=await this.buyerAssetUrls.resolve(m),p=e.viewUrl):p=await this.buyerAssetUrls.resolve(e.viewUrl)}catch(m){t===this.seatViewGen&&this.opts.onError?.(m);return}if(t!==this.seatViewGen||!p||e.viewMeta?.previewUrl&&e.viewMeta.previewUrl!==e.viewUrl&&!d||!this.root||!this.seatViewEnabled())return;let f={url:p,...d?{previewUrl:d}:{},...e.viewMeta?.sourceWidth!==void 0?{sourceWidth:e.viewMeta.sourceWidth}:{},...e.viewMeta?.sourceHeight!==void 0?{sourceHeight:e.viewMeta.sourceHeight}:{},...e.viewMeta?.previewWidth!==void 0?{previewWidth:e.viewMeta.previewWidth}:{},...e.viewMeta?.previewHeight!==void 0?{previewHeight:e.viewMeta.previewHeight}:{},...e.viewMeta?.coverage?{coverage:e.viewMeta.coverage}:{},...e.viewMeta?.capturedAt?{capturedAt:e.viewMeta.capturedAt}:{},...e.viewMeta?.sourceLabel?{sourceLabel:e.viewMeta.sourceLabel}:{}};n=f,a=Ht(f),l=Ki(f)}else{let p;try{let{generateSeatPanorama:d}=await bt();p=d(e,r,this.allSeats())}catch(d){t===this.seatViewGen&&this.opts.onError?.(d);return}if(t!==this.seatViewGen||!this.root||!this.seatViewEnabled())return;n={url:p.url,generated:!0},a=y("picker.illustrationCaption",{m:p.distanceM})}this.closeSeatView(!1);let c=y("picker.viewFromSeat",{label:e.label}),u=ht({root:this.root,source:n,caption:a,real:l,closeLabel:this.tf("picker.close","Close"),dragHint:this.tf("picker.dragToLookAround","Drag to look around \xB7 scroll to zoom"),viewFromSeatLabel:c,real360Label:y("picker.real360"),previewLabel:y("picker.preview"),resolveAsset:p=>this.buyerAssetUrls.resolve(p),onClose:()=>this.closeSeatView()});this.viewEl=u.element,this.viewCleanup=()=>u.dispose()}closeSeatView(e=!0){e&&(this.seatViewGen+=1),this.viewCleanup?.(),this.viewCleanup=null,this.viewEl?.remove(),this.viewEl=null}money(e){let t=this.opts.pricing?.formatter;return t?t(e,this.currency):_i(e,this.currency,{locale:this.opts.locale,fallback:(i,s)=>`${i} ${s}`})}scheduleOfferBoundary(e){if(this.offerBoundaryTimer&&clearTimeout(this.offerBoundaryTimer),this.offerBoundaryTimer=null,!this.api.availability||this.destroyed)return;let t=Date.now(),i=ct(e,t);if(i==null)return;let s=6*36e5,r=Math.min(Math.max(i-t+1e3,1e3),s);this.offerBoundaryTimer=setTimeout(()=>{this.offerBoundaryTimer=null,!document.hidden&&this.refreshOfferAvailability(!1)},r)}scheduleOfferRefresh(e){!this.api.availability||this.destroyed||(this.offerRefreshTimer&&clearTimeout(this.offerRefreshTimer),this.offerRefreshTimer=setTimeout(()=>{this.offerRefreshTimer=null,this.refreshOfferAvailability(e)},e?180:0))}async refreshOfferAvailability(e){if(!(!this.api.availability||this.destroyed))try{let t=await this.api.availability(this.opts.event,e);if(this.destroyed)return;let i=He(t);if(!i)return;this.offerAvailability=i,this.applyChannelPricing(i.channelPricing),this.scheduleOfferBoundary(i);let s=Re(i),r={...this.hostPricing?.prices??{},...s},n=Object.keys(r).length>0||this.hostPricing?.formatter?{prices:r,...this.hostPricing?.formatter?{formatter:this.hostPricing.formatter}:{}}:void 0;this.setPricing(n),this.syncOffer(),this.opts.onOfferAvailabilityChange?.(i)}catch{!this.destroyed&&!this.offerBoundaryTimer&&!document.hidden&&(this.offerBoundaryTimer=setTimeout(()=>{this.offerBoundaryTimer=null,!document.hidden&&this.refreshOfferAvailability(!1)},3e4))}}offerPrice(e){return e?this.offerAvailability?.prices.find(t=>t.categoryKey===e)??null:null}applyChannelPricing(e){this.channelByObject.clear(),this.pricesByChannel.clear();for(let t of e?.channels??[])this.pricesByChannel.set(t.channelId,t.priceOverrides);for(let t of e?.objects??[])this.pricesByChannel.has(t.channelId)&&this.channelByObject.set(t.label,t.channelId)}syncOffer(){let e=this.els.offer;if(!e)return;let t=this.offerAvailability,i=t?.release??null,s=i?null:t?.upcoming??null;if(!t||t.state==="closed"||t.state==="sold-out"||!i&&!s){e.classList.remove("has"),e.replaceChildren();return}let r=i??s,n=document.createElement("div");n.className="sl-offer-main";let a=document.createElement("div");a.className="sl-offer-copy";let l=document.createElement("span");l.className="sl-offer-kicker",l.textContent=i?this.tf("picker.currentTicketOffer","Current ticket offer"):this.tf("picker.upcomingTicketOffer","Upcoming ticket offer");let c=document.createElement("strong");c.className="sl-offer-name",c.textContent=r.name||(i?this.tf("picker.currentOffer","Current offer"):this.tf("picker.scheduledOffer","Scheduled offer"));let u=document.createElement("span");u.className="sl-offer-line";let p=[];i&&t.fromPrice!=null&&p.push(this.money(t.fromPrice/100)),i&&r.remaining!=null&&p.push(y("picker.offerRemainingAvailable",{count:r.remaining})),i&&r.endsAt!=null&&p.push(y("picker.offerUntil",{time:we(r.endsAt,this.eventTimezone,this.opts.locale)})),s?.startsAt!=null&&p.push(y("picker.offerStarts",{time:we(s.startsAt,this.eventTimezone,this.opts.locale)})),u.textContent=p.join(" \xB7 "),a.append(l,c,u);let d=document.createElement("details");d.className="sl-offer-info";let f=document.createElement("summary");f.setAttribute("aria-label",y("picker.howOfferWorks",{name:c.textContent??""})),f.textContent="i";let m=document.createElement("div");m.className="sl-offer-detail",m.textContent=i?this.tf("picker.offerDetailActive","This price applies automatically to eligible seats. Tickets in active carts temporarily reduce the available quantity; released or expired holds return it. When the offer ends, the next matching offer or normal ticket price takes over."):this.tf("picker.offerDetailUpcoming","Tickets are available at their normal price now. This scheduled offer will apply automatically to eligible seats when it starts."),d.append(f,m),n.append(a,d),e.replaceChildren(n),e.classList.add("has")}paidPrice(e,t,i,s){let r=s?this.channelByObject.get(s):void 0;if(r&&e){let a=this.pricesByChannel.get(r)?.find(l=>l.categoryKey===e&&l.tierId===(t??null));if(a)return a.price}let n=e?this.opts.pricing?.prices?.[e]:void 0;return n===void 0?i:typeof n=="number"?n:t&&n.tiers?.[t]!==void 0?n.tiers[t]:n.base??i}legendDeps(){return{colorOf:e=>this.controller.getRenderer()?.categoryDisplayColor?.(e.key)??e.color,rangeOf:e=>this.catPriceRange(e),priceOf:e=>this.catPrice(e),offerOf:e=>this.offerPrice(e),money:e=>this.money(e),esc:z}}syncPriceRail(e,t){let i=this.els.railScroll,s=e.length>1;this.els.rail?.classList.toggle("has",s||!!this.a11yChipsEl?.children.length),i&&(i.innerHTML=s?ot({...this.legendDeps(),categories:e,left:t,activeKey:this.focusedCatKey,soldOutWord:this.tf("picker.soldOut","Sold out")}):"",i.querySelectorAll(".sl-rc").forEach(r=>{r.addEventListener("click",()=>this.focusCategory(r.dataset.cat??""))}))}syncPrices(){let e=this.controller.doc;if(!e||!this.els.prices)return;let t=this.controller.categoryAvailability(),i=e.categories.filter(l=>!l.notForSale);this.narrateAvailability(i,t),this.syncSoldout(i,t),this.syncPriceRail(i,t);let s=5,r=i.length-s,n=r>1&&!this.pricesExpanded,a=n?i.slice(0,s):i;this.els.prices.classList.toggle("sl-expanded",r>1&&this.pricesExpanded),this.els.prices.innerHTML=nt({...this.legendDeps(),categories:a,left:t,collapsed:n,activeKey:this.focusedCatKey,bandKeys:this.priceBandKeys,leftCount:l=>q("picker.leftCount",l),titleFor:(l,c)=>c?this.tf("picker.showAllSeats","Show all seats"):y("picker.showLabelSeatsOnMap",{label:l.label}),moreLabel:r>1?n?y("picker.showAllTicketTypes",{count:i.length}):this.tf("picker.showFewer","Show fewer"):null,status:{legend:this.tf("picker.seatStatusLegend","Seat status legend"),held:this.tf("picker.temporarilyHeld","Temporarily held"),sold:this.tf("picker.sold","Sold")}}),this.els.prices.querySelectorAll(".sl-price-row").forEach(l=>{l.addEventListener("mouseenter",()=>this.controller.getRenderer()?.setCategoryHighlight?.(l.dataset.cat??null)),l.addEventListener("mouseleave",()=>this.controller.getRenderer()?.setCategoryHighlight?.(null));let c=()=>this.focusCategory(l.dataset.cat??"");l.addEventListener("click",c),l.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),c())})}),this.els.prices.querySelector(".sl-price-more")?.addEventListener("click",()=>{this.pricesExpanded=!this.pricesExpanded,this.syncPrices()})}focusCategory(e){if(!e)return;let t=this.focusedCatKey===e?null:e;this.focusedCatKey=t,this.priceBandKeys=t?new Set([t]):null;let i=this.els.pricesSec?.querySelector(".sl-price-select");i&&(i.value="all"),this.controller.setCategoryFilter(t?[t]:null),this.controller.focusCategoryFilter(t?[t]:null),this.pushAvailabilityTo3d(),this.syncFloors(),this.syncRung(),this.minimap?.refreshMinimap(),this.syncPrices(),this.lastSection&&this.showSectionCard(this.lastSection)}narrateAvailability(e,t){let i=this.els.liveText,s=this.lastCatAvail;this.lastCatAvail={...t};let r=this.controller.getActiveFloorId();if(r!==this.lastAvailFloorId&&(this.lastAvailFloorId=r,this.availQuietUntil=performance.now()+2e3),!(!i||!s||performance.now()<this.availQuietUntil))for(let n of e){let a=s[n.key],l=t[n.key]??0;if(a===void 0||l>=a)continue;let c=a-l;i.textContent=q("picker.seatsJustTakenInCategory",c,{label:n.label,left:l}),this.els.live?.classList.remove("on"),this.els.live?.offsetWidth,this.els.live?.classList.add("on"),this.liveTimer&&clearTimeout(this.liveTimer),this.liveTimer=setTimeout(()=>this.els.live?.classList.remove("on"),8e3);return}}evictTakenSelections(){let e=new Set([...this.controller.currentHold()?.labels??[],...this.holdingLabels]),t=this.controller.getSelection().filter(i=>!e.has(i.label)&&(this.controller.getStatus(i.id)??"free")!=="free");t.length&&(this.controller.deselect(t.map(i=>i.id)),this.toast(y("picker.seatJustTakenByAnother",{label:t[0].label}),"error"))}syncTray(){if(!this.els.tray)return;this.updateSelectionCapacity();let e=this.committedSelection(),t=this.controller.getGAAreas(),i=this.hold?.items??[],s=[],r=new Set;if(this.salesClosed&&!e.length&&!i.length){let h=this.eventWhenText?`<span class="when">${String(this.eventWhenText).replace(/[&<>"]/g,b=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[b])}</span>`:"";s.push(`<div class="sl-closed-note" role="status"><b>${this.tf("picker.salesClosedPill","Sales are closed")}</b><span>${this.tf("picker.salesClosedCopy","Ticket sales for this event have ended.")}${h}</span></div>`)}else!e.length&&!i.length&&!t.length?s.push(`<div class="sl-tray-hint">${this.tf("picker.trayHintTapOrBest","Tap a seat on the map, or let us pick the best available for you.")}</div>`):!e.length&&!i.length&&s.push(`<div class="sl-tray-hint">${this.tf("picker.trayHintTapOrStanding","Tap a seat on the map \u2014 or grab standing tickets below.")}</div>`);let n=!e.length&&!i.length&&!this.pendingGACount();if(n&&(this.baReopen=!1),!this.salesClosed&&!this.hold&&(n||this.baReopen||this.bestAvailableBusy||this.bestAvailableConfirm)){let h=(this.controller.doc?.categories??[]).filter(T=>!T.notForSale),b=this.controller.getBestAvailableZones();this.baZone&&!b.some(T=>T.id===this.baZone)&&(this.baZone=""),s.push(this.bestAvailableConfirm?`<div class="sl-ba" role="alert"><div class="sl-ba-title"><span class="spark" aria-hidden="true">\u2726</span>${this.tf("picker.replaceCurrentChoices","Replace your current choices?")}</div><div class="sl-ba-replace"><b>${y("picker.willFindSeatsTogether",{count:this.baQty})}</b><span>${this.tf("picker.manualTicketsRemovedNote","Your manually selected tickets will be removed only after a new group is secured.")}</span></div><div class="sl-ba-actions"><button type="button" data-ba-cancel>${this.tf("picker.keepMine","Keep mine")}</button><button type="button" class="replace" data-ba-replace>${this.tf("picker.findNewSeats","Find new seats")}</button></div></div>`:`<div class="sl-ba"><div class="sl-ba-title"><span class="spark" aria-hidden="true">\u2726</span>${this.tf("picker.findBestSeatsTogether","Find the best seats together")}</div><div class="sl-ba-copy"><span class="wide">${this.tf("picker.willChooseClosestGroup","We\u2019ll choose the closest available group for you.")}</span><span class="narrow">${this.tf("picker.closestGroupChosenInstantly","Closest available group, chosen instantly.")}</span></div>`+(this.controller.hasPremiumSeats()?`<button type="button" class="sl-ba-premium${this.baPremium?" on":""}" data-ba-premium aria-pressed="${this.baPremium?"true":"false"}"><span class="star" aria-hidden="true">\u2605</span>${this.tf("picker.bestSeatsPremium","Best seats")}</button>`:"")+(h.length>1?`<select aria-label="${this.tf("picker.preferredTicketType","Preferred ticket type")}" data-ba-cat><option value="">${this.tf("picker.anyTicketType","Any ticket type")}</option>`+h.map(T=>`<option value="${T.key}"${this.baCat===T.key?" selected":""}>${T.label}</option>`).join("")+"</select>":'<span aria-hidden="true"></span>')+(b.length?`<select aria-label="${this.tf("picker.preferredVenueZone","Preferred venue zone")}" data-ba-zone><option value="">${this.tf("picker.anyVenueZone","Any venue zone")}</option>`+b.map(T=>`<option value="${z(T.id)}"${this.baZone===T.id?" selected":""}>${z(T.label)}</option>`).join("")+"</select>":"")+`<div class="sl-ba-qty"><button type="button" data-ba="-1" aria-label="${this.tf("picker.fewerSeats","Fewer seats")}">\u2212</button><span>${this.baQty}</span><button type="button" data-ba="1" aria-label="${this.tf("picker.moreSeats","More seats")}">+</button></div><button type="button" class="sl-ba-go${this.bestAvailableBusy?" sl-busy":""}"${this.bestAvailableBusy?" disabled":""}>`+(this.bestAvailableBusy?`<span class="sl-ba-spin" aria-hidden="true"></span>${this.tf("picker.findingBestSeats","Finding the best seats\u2026")}`:q("picker.findBestSeatsCount",this.baQty))+"</button>"+(this.baReopen?`<button type="button" class="sl-ba-back" data-ba-close>${this.tf("picker.keepMyPicks","Keep my picks")}</button>`:"")+"</div>")}let a=(h,b,T,E=1,M,A)=>At({d:h?this.controller.seatDetails(h):null,area:T==="ga"?t.find(L=>L.id===M):void 0,label:b,objectType:T,quantity:E,identity:A}),l=Lt;for(let h of i){let b=`held:${h.label}`;r.add(b);let T=this.controller.doc?.categories.find(D=>D.key===h.categoryKey),E=h.tierId?T?.tiers?.find(D=>D.id===h.tierId)?.name:void 0,M=h.objectType!=="ga"?this.controller.seatByLabel(h.label):null,A=h.objectType==="table"?this.controller.tableSelection(h.label):null,L=this.seatViewEnabled()&&!!M&&h.objectType!=="table";s.push(`<div class="sl-chip sl-held${this.lastTrayKeys.has(b)?"":" sl-enter"}" data-key="${b}" data-held="${encodeURIComponent(h.label)}"${M?` data-locate="${M.id}"`:""}><div class="sl-chip-main">`+a(M?.id??null,h.label,h.objectType,h.quantity??1,h.objectId,A??void 0)+`<div class="sl-chip-sub"><span class="sl-ticket-state held" aria-label="${this.tf("picker.heldForYou","Held for you")}" title="${this.tf("picker.heldForYou","Held for you")}"><svg viewBox="0 0 24 24"><rect x="5" y="10" width="14" height="10" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/></svg></span><span class="cat">${T?.label??h.categoryKey}${E?` \xB7 ${E}`:""}</span>`+(A?.bookingMode==="variable"?`<button type="button" class="sl-table-edit" data-table-edit="${encodeURIComponent(h.label)}">${y("picker.guestsCountEdit",{count:h.quantity??1})}</button>`:"")+ze(M?.wheelchairSpaceType)+Be(M?.commercial)+`<span class="amt">${this.money(this.paidPrice(h.categoryKey,h.tierId,h.unitPrice,h.label)*(h.quantity??1))}</span></div></div>`+l(y("picker.removeHeldTicketLabel",{label:h.label}),L?h.label:null)+"</div>")}let c=new Set(i.map(h=>h.label)),u=this.seatViewEnabled();for(let h of e.filter(b=>!c.has(b.label))){let b=`seat:${h.id}`;r.add(b);let T=this.controller.doc?.categories.find(L=>L.key===h.categoryKey),E=h.tiers&&h.tiers.length?`<select class="tier" data-tier="${h.id}" aria-label="${y("picker.ticketTierFor",{label:h.label})}">`+h.tiers.map(L=>`<option value="${L.id}"${L.id===h.tierId?" selected":""}>${L.name} \xB7 ${this.money(this.paidPrice(h.categoryKey,L.id,L.price,h.label))}</option>`).join("")+"</select>":"",M=h.tiers?.find(L=>L.id===h.tierId)??h.tiers?.[0],A=M?.buyerMessage?.trim()||(M?.restriction==="companion"?this.tf("picker.companionRequiresWheelchair","Requires the adjacent wheelchair place"):"");s.push(`<div class="sl-chip${this.lastTrayKeys.has(b)?"":" sl-enter"}" data-key="${b}" data-seat="${h.id}" data-locate="${h.id}"><div class="sl-chip-main">`+a(h.id,h.label,h.objectType,h.quantity??1,h.objectId,h)+`<div class="sl-chip-sub"><span class="sl-ticket-state" aria-label="${this.tf("picker.selected","Selected")}" title="${this.tf("picker.selected","Selected")}"><svg viewBox="0 0 24 24"><path d="M5 12l4 4L19 6"/></svg></span><span class="cat">${T?.label??h.categoryKey}</span>`+(h.objectType==="table"&&h.bookingMode==="variable"?`<button type="button" class="sl-table-edit" data-table-edit="${encodeURIComponent(h.label)}">${y("picker.guestsCountEdit",{count:h.quantity??1})}</button>`:"")+`${ze(h.wheelchairSpaceType)}${Be(h.commercial)}${E}<span class="amt">${this.money(this.paidPrice(h.categoryKey,h.tierId??null,h.price,h.label)*(h.quantity??1))}</span></div>`+(A?`<small class="sl-tier-note">${z(A)}</small>`:"")+"</div>"+l(y("picker.removeSeatLabel",{label:h.label}),u&&h.objectType!=="table"?h.label:null)+"</div>")}for(let h of t){let b=this.gaQty.get(h.id)??0;s.push(`<div class="sl-ga" data-ga="${h.id}"><div class="sl-ga-info"><div class="sl-ga-name">${h.displayLabel??h.label}</div><div class="sl-ga-sub">${h.displayType??this.tf("picker.generalAdmission","General admission")} \xB7 ${this.money(this.paidPrice(h.categoryKey,null,h.price,h.id))} \xB7 ${q("picker.leftCount",h.available)}</div></div><div class="sl-ga-qty"><button type="button" data-d="-1" aria-label="${this.tf("picker.fewer","Fewer")}">\u2212</button><span>${b}</span><button type="button" data-d="1" aria-label="${this.tf("picker.more","More")}">+</button></div></div>`)}!this.salesClosed&&!this.hold&&!n&&!this.baReopen&&!this.bestAvailableBusy&&!this.bestAvailableConfirm&&s.push(`<button type="button" class="sl-ba-reopen" data-ba-reopen><span aria-hidden="true">\u2726</span>${this.tf("picker.findTogetherInstead","Find seats together instead")}</button>`),this.els.tray.innerHTML=s.join(""),this.lastTrayKeys=r,this.els.tray.querySelectorAll("[data-ba]").forEach(h=>{h.addEventListener("click",()=>{this.baQty=Math.max(1,Math.min(this.maxTickets,this.baQty+Number(h.dataset.ba))),this.syncTray()})}),this.els.tray.querySelector("[data-ba-cat]")?.addEventListener("change",h=>{this.baCat=h.target.value}),this.els.tray.querySelector("[data-ba-zone]")?.addEventListener("change",h=>{this.baZone=h.target.value}),this.els.tray.querySelector("[data-ba-premium]")?.addEventListener("click",()=>{this.baPremium=!this.baPremium,this.syncTray()}),this.els.tray.querySelector(".sl-ba-go")?.addEventListener("click",()=>{if(this.pendingSelectionCount()>0){this.bestAvailableConfirm=!0,this.syncTray(),this.els.tray.querySelector("[data-ba-replace]")?.focus();return}this.bestAvailable(this.baQty,this.baCat||void 0,{preferPremium:this.baPremium,zoneId:this.baZone||void 0})}),this.els.tray.querySelector("[data-ba-cancel]")?.addEventListener("click",()=>{this.bestAvailableConfirm=!1,this.syncTray(),this.els.tray.querySelector(".sl-ba-go")?.focus()}),this.els.tray.querySelector("[data-ba-reopen]")?.addEventListener("click",()=>{this.baReopen=!0,this.syncTray(),this.els.tray.querySelector(".sl-ba-go")?.focus()}),this.els.tray.querySelector("[data-ba-close]")?.addEventListener("click",()=>{this.baReopen=!1,this.syncTray(),this.els.tray.querySelector("[data-ba-reopen]")?.focus()}),this.els.tray.querySelector("[data-ba-replace]")?.addEventListener("click",()=>{this.bestAvailableConfirm=!1,this.bestAvailable(this.baQty,this.baCat||void 0,{preferPremium:this.baPremium,zoneId:this.baZone||void 0})}),this.els.tray.querySelectorAll(".sl-chip .rm").forEach(h=>{h.addEventListener("click",()=>{let b=h.closest(".sl-chip");if(b.dataset.held){this.removeHeldLabel(decodeURIComponent(b.dataset.held),b);return}let T=b.dataset.seat,E=this.controller.getSelection().find(A=>A.id===T)?.label??this.tf("picker.seat","Seat"),M=()=>{this.controller.deselect([T]),this.toast(y("picker.labelRemoved",{label:E}),"neutral",{label:this.tf("picker.undo","Undo"),onClick:()=>{let A=this.controller.select([T]);this.toast(A.length?y("picker.labelRestored",{label:E}):y("picker.labelNoLongerAvailable",{label:E}),A.length?"success":"warning")}})};if(this.reducedMotion()){M();return}b.classList.add("sl-leave"),this.scheduleMotion(M,150)})}),this.els.tray.querySelectorAll("[data-table-edit]").forEach(h=>{h.addEventListener("click",b=>{b.stopPropagation();let T=decodeURIComponent(h.dataset.tableEdit??""),E=this.controller.tableSelection(T);if(!E)return;let M=i.find(A=>A.label===T&&A.objectType==="table");this.showTableDialog({...E,quantity:M?.quantity??E.quantity},!!M,h)})}),this.els.tray.querySelectorAll(".sl-chip .tier").forEach(h=>{h.addEventListener("change",()=>this.controller.setSeatTier(h.dataset.tier,h.value||null))}),this.els.tray.querySelectorAll(".sl-chip .view[data-view-label]").forEach(h=>{h.addEventListener("click",()=>{let b=this.controller.seatByLabel(h.dataset.viewLabel);b&&this.openSeatView(b)})}),this.els.tray.querySelectorAll(".sl-chip[data-locate]").forEach(h=>{let b=()=>this.controller.flashSeat(h.dataset.locate,this.cssVar("--sl-accent")||"#f4b740");h.addEventListener("mouseenter",b),h.addEventListener("focusin",b)}),this.els.tray.querySelectorAll(".sl-ga button").forEach(h=>{h.addEventListener("click",()=>{let T=h.closest(".sl-ga").dataset.ga,E=t.find(L=>L.id===T),M=Number(h.dataset.d);if(M>0&&!this.canAddTicket())return;let A=Math.max(0,Math.min(E?.available??0,(this.gaQty.get(T)??0)+M));this.gaQty.set(T,A),this.syncTray()})}),this.salesClosed&&this.els.tray.querySelectorAll(".sl-ba-go,[data-ba],[data-ba-cat],[data-ba-zone],[data-ba-replace],.sl-ga button").forEach(h=>{h.disabled=!0});let p=this.pendingGATotal(t),d=this.pendingGACount(),f=i.reduce((h,b)=>h+this.paidPrice(b.categoryKey,b.tierId,b.unitPrice,b.label)*(b.quantity??1),0),m=i.reduce((h,b)=>h+(b.quantity??1),0),g=e.filter(h=>!c.has(h.label)),w=g.reduce((h,b)=>h+this.paidPrice(b.categoryKey,b.tierId??null,b.price,b.label)*(b.quantity??1),0)+p+f,k=g.reduce((h,b)=>h+(b.quantity??1),0)+d+m,x=this.pendingSelectionCount(),v=this.lastTrayCount,C=this.lastTrayTotal;if(this.els.count.textContent=k?q("picker.ticketsCount",k):this.tf("picker.noSeatsSelected","No seats selected"),this.els.total.textContent=k?this.money(w):"",this.root?.setAttribute("data-has-selection",String(k>0)),this.root?.setAttribute("data-ba-active",String(this.bestAvailableConfirm||this.bestAvailableBusy||this.baReopen)),this.els.foot?.classList.toggle("empty",k===0),this.els.seatSummary&&(this.els.seatSummary.textContent=k?q("picker.seatsSelectedCount",k):""),this.syncCta(k,x),this.hold){let h=m||this.hold.seats?.length||0;this.els.holdTitle&&(this.els.holdTitle.textContent=y("picker.securedCount",{count:h})),this.els.holdCopy&&(this.holdCopyPending=x>0,this.els.holdCopy.textContent=x?y("picker.moreSelectedCount",{count:x}):Ne(this.holdExpiresAt));let b=this.els.holdChange;b&&(b.disabled=this.releasingHold,b.textContent=this.releasingHold?this.tf("picker.releasingEllipsis","Releasing\u2026"):this.tf("picker.change","Change"))}k!==v&&this.animateOnce(this.els.count,"sl-value-pop",380),w!==C&&this.animateOnce(this.els.total,"sl-value-pop",380),v===0&&k>0&&(this.animateOnce(this.els.cta,"sl-ready",520),this.sideCollapsed&&this.root?.dataset.layout!=="narrow"&&this.setPanelCollapsed(!1)),this.renderPeek(k,w,x),this.lastTrayCount=k,this.lastTrayTotal=w,this.opts.onSelectionChange?.(e),this.emitSelectionValidity(k,e)}emitSelectionValidity(e,t){let i=this.controller.getSelectionValidity(e);i&&(i.seats=t,this.opts.onSelectionValidityChange?.(i),i.isValid?this.lastSelectionValidity!==!0&&this.opts.onSelectionValid?.(t):this.lastSelectionValidity!==!1&&this.opts.onSelectionInvalid?.(i),this.lastSelectionValidity=i.isValid)}renderPeek(e,t,i){if(!this.els.peek)return;let s=(this.controller.doc?.categories??[]).map(r=>this.catPrice(r)).filter(r=>r!=null);this.els.peek.innerHTML=Mt({count:e,total:t,pendingCount:i,ctaPhase:this.ctaPhase,hasHold:!!this.hold,salesClosed:this.salesClosed,fromPrice:s.length?Math.min(...s):null,addMore:Pt({salesClosed:this.salesClosed,hasHold:!!this.hold,ctaPhase:this.ctaPhase,formOpen:this.baReopen||this.bestAvailableBusy||this.bestAvailableConfirm,room:this.maxTickets-this.totalTicketCount(),wanted:this.baQty}),money:r=>this.money(r)})}async removeHeldLabel(e,t){if(!e||this.releasingLabels.has(e))return!1;this.releasingLabels.add(e),t?.setAttribute("aria-busy","true");let i=t?.querySelector(".rm");i&&(i.disabled=!0);try{let s=this.handedOff;if(!await this.controller.releaseLabels([e]))return this.toast(y("picker.couldNotRemoveLabel",{label:e}),"error"),!1;let n=this.controller.currentHold();return this.hold=n?{holdId:n.holdId,expiresAt:n.expiresAt,seats:n.seats,items:n.items}:null,this.handedOff=!!this.hold&&s,this.bookedShown=!1,this.ctaPhase="idle",this.hold?this.startHoldTimer(this.hold.expiresAt):(this.stopHoldTimer(),this.forgetHold()),this.syncTray(),this.emitHoldChange(),this.toast(y("picker.labelRemovedFromHold",{label:e}),"success"),!0}finally{this.releasingLabels.delete(e),t?.removeAttribute("aria-busy"),i?.isConnected&&(i.disabled=!1)}}async handleChangeSeats(){if(!this.hold||this.releasingHold)return;this.releasingHold=!0;let e=this.els.holdChange;e&&(e.disabled=!0,e.textContent=this.tf("picker.releasingEllipsis","Releasing\u2026"));try{await this.release(),this.hold||this.toast(this.tf("picker.heldTicketsReleased","Held tickets released. Choose your new seats."),"success")}finally{this.releasingHold=!1,e?.isConnected&&(e.disabled=!1,e.textContent=this.tf("picker.change","Change"))}}async handleCta(){if(this.salesClosed)return;let e=this.controller.getSelectionValidity(this.totalTicketCount());if(e&&!e.isValid){this.toast(Ve(e,(i,s)=>this.tf(i,s)),"warning");return}if(this.totalTicketCount()>this.maxTickets){this.toast(y("picker.removeTicketsUntilOrFewer",{count:this.maxTickets}),"warning");return}let t=this.committedSelection();if(this.hold&&!t.some(i=>!(this.hold.items??[]).some(s=>s.label===i.label))){let i=this.hold.seats??t;this.handedOff=!0,this.setCtaPhase("checkout"),this.checkoutHandoff(this.hold,i);return}this.holdingLabels=new Set(t.map(i=>i.label)),this.setCtaPhase("holding");try{let i=null,s=[...this.gaQty.entries()].filter(([,n])=>n>0),r=this.committedSelection();if(r.length){let n=await this.controller.hold(void 0,this.opts.holdTtlMs);i=n?{holdId:n.holdId,expiresAt:n.expiresAt,seats:n.seats,items:n.items}:null}for(let[n,a]of s){let l=await this.controller.holdGA(n,a,{ttlMs:this.opts.holdTtlMs});i=l?{holdId:l.holdId,expiresAt:l.expiresAt,seats:l.seats,items:l.items}:i}if(!i){this.toast(this.tf("picker.seatsJustTaken","One or more seats were just taken. Please pick again."),"error"),this.setCtaPhase("idle"),this.syncTray();return}this.hold=i,this.handedOff=!0,this.startHoldTimer(i.expiresAt),this.flashHeldSeats(i),this.setCtaPhase("checkout"),this.emitHoldChange(),this.checkoutHandoff(i,i.seats??r)}catch(i){this.opts.onError?.(i);let s=i,r=(s.conflicts??[]).map(a=>a.label).filter(Boolean).slice(0,3);s.reason==="event_closed"&&this.setSalesClosed(!0);let n=s.reason==="event_closed"?this.tf("picker.seatSalesClosedForEvent","Seat sales have closed for this event."):s.reason==="companion_pair_required"?this.tf("picker.companionPairRequired","Select the adjacent wheelchair place with each companion ticket."):s.reason==="ticket_option_not_applicable"?this.tf("picker.ticketOptionNotApplicable","That ticket choice is not available for the selected seat."):r.length?r.length===1?y("picker.labelsNoLongerAvailable.one",{labels:r.join(", ")}):y("picker.labelsNoLongerAvailable.other",{labels:r.join(", ")}):this.tf("picker.seatsJustTaken","One or more seats were just taken. Please pick again.");this.toast(n,"error"),this.setCtaPhase("idle")}finally{this.holdingLabels.clear(),this.ctaPhase==="holding"&&(this.ctaPhase="idle"),this.syncTray()}}startHoldTimer(e){this.stopHoldTimer(),this.holdExpiresAt=e,this.hold&&this.rememberHold(this.hold);let t=this.els.hold;t.innerHTML=`<span class="sl-hold-dot" aria-hidden="true"></span><span>${this.tf("picker.held","Held")}</span><span class="sl-hold-time" data-ref="holdTime"></span>`;let i=t.querySelector('[data-ref="holdTime"]');this.els.holdNote?.classList.add("on");let s=()=>{let r=Math.max(0,this.holdExpiresAt-Date.now());i&&(i.textContent=_e(r)),!this.holdCopyPending&&this.els.holdCopy&&(this.els.holdCopy.textContent=Ne(this.holdExpiresAt)),t.classList.add("on"),t.classList.toggle("is-expiring",r>0&&r<=Ot),this.setExtendPrompt(r>0&&r<=Ot,r),r<=0&&this.stopHoldTimer()};s(),this.holdTimer=setInterval(s,500)}stopHoldTimer(){this.holdTimer&&clearInterval(this.holdTimer),this.holdTimer=null,this.els.hold?.classList.remove("on","is-expiring"),this.els.holdNote?.classList.remove("on"),this.setExtendPrompt(!1,0)}setExtendPrompt(e,t){if(this.extendEl)if(e&&this.controller.currentHold()&&!this.bookedShown){let i=Math.ceil(t/1e3),s=Math.floor(i/60),r=String(i%60).padStart(2,"0");this.els.extendTxt.innerHTML=y("picker.seatsHeldForNeedMoreTime",{time:`${s}:${r}`}),this.extendEl.classList.add("on")}else this.extendEl.classList.remove("on")}async handleExtend(){let e=this.els.extendBtn;e.disabled=!0;let t=e.textContent;e.textContent=this.tf("picker.addingEllipsis","Adding\u2026");try{let i=await this.controller.extendHold(this.opts.holdTtlMs);i?(this.hold={holdId:i.holdId,expiresAt:i.expiresAt,seats:i.seats,items:i.items},this.holdExpiresAt=i.expiresAt,this.extendEl?.classList.remove("on"),this.rememberHold(this.hold),this.emitHoldChange(),this.toast(this.tf("picker.moreTimeAdded","More time added \u2014 your seats are still held."),"success")):this.toast(this.tf("picker.couldNotAddMoreTime","Couldn't add more time \u2014 please head to checkout now."),"warning")}catch(i){this.opts.onError?.(i),this.toast(this.tf("picker.couldNotAddMoreTime","Couldn't add more time \u2014 please head to checkout now."),"warning")}finally{e.disabled=!1,e.textContent=t}}detectBooked(){this.bookedShown||!this.handedOff||!this.hold||this.controller.currentHold()===null&&this.showBooked()}showBooked(){if(this.bookedShown||!this.hold)return;this.bookedShown=!0;let e=this.buildHandoff(this.hold);this.stopHoldTimer(),this.forgetHold();let t=e.lineItems.reduce((i,s)=>i+s.quantity,0);this.els.bookedSub&&(this.els.bookedSub.innerHTML=`<span class="sl-booked-seats">${q("picker.ticketsCount",t)}</span> ${this.tf("picker.confirmedAndOnWay","confirmed. A confirmation is on its way.")}`),this.bookedEl?.classList.add("on"),this.opts.onBooked?.(e)}checkoutHandoff(e,t){if(this.checkoutMode==="hosted"){this.startHostedCheckout(e,t);return}this.opts.onCheckout?.(e,t,this.buildHandoff(e))}async startHostedCheckout(e,t){let i=this.buildHandoff(e),s=null;try{s=await(this.paymentOptions??=this.pubApi.paymentOptions(this.opts.event))}catch(n){this.opts.onError?.(n)}if(this.destroyed)return;let r=s?.providers?.[0];if(!r){let n=vt(s?.reason),a=!!this.opts.onCheckoutUnavailable||!!this.opts.onCheckout;this.opts.onCheckoutUnavailable?.({reason:n,handoff:i}),this.opts.onCheckout?.(e,t,i),a||this.openCheckoutPanel({kind:"unavailable",reason:n,seatCount:i.lineItems.reduce((l,c)=>l+c.quantity,0)});return}await this.openCheckoutPanel({kind:"pay",provider:r,order:{holdId:i.holdId,expiresAt:i.expiresAt,currency:i.currency,total:i.total,labels:i.lineItems.map(n=>n.displayLabel??n.label)}})}async openCheckoutPanel(e){let t;try{({mountCheckout:t}=await gt())}catch(i){this.opts.onError?.(i),this.toast(this.tf("picker.checkoutCouldNotBeOpened","Checkout could not be opened. Your seats are still held \u2014 please try again."),"error"),this.setCtaPhase("idle");return}this.destroyed||!this.root||(this.closeCheckoutPanel(),this.checkoutPanel=t({root:this.root,state:e,formatMoney:i=>this.money(i),startSession:i=>this.pubApi.startCheckout(this.opts.event,{...i,...this.opts.returnUrl?{returnUrl:this.opts.returnUrl}:{}}),orderStatus:i=>this.pubApi.orderStatus(i),onCancel:()=>{this.checkoutPanel=null,this.hold||this.setCtaPhase("idle")},onConfirmed:i=>{this.opts.onOrderConfirmed?.(i),this.controller.refresh()},onError:i=>this.opts.onError?.(i)}))}closeCheckoutPanel(){this.checkoutPanel?.destroy(),this.checkoutPanel=null}buildHandoff(e){let i=(e.items??[]).map(n=>{let a=this.controller.lineItemDisplay(n);return{label:n.label,...a.displayLabel?{displayLabel:a.displayLabel}:{},...a.displayType?{displayType:a.displayType}:{},objectId:n.objectId,objectType:n.objectType,categoryKey:n.categoryKey,tierId:n.tierId,unitPrice:this.paidPrice(n.categoryKey,n.tierId,n.unitPrice,n.label),currency:n.currency??this.currency,quantity:n.quantity??1}}),s=i[0]?.currency??this.currency,r=i.reduce((n,a)=>n+a.unitPrice*a.quantity,0);return{holdId:e.holdId,expiresAt:e.expiresAt,currency:s,lineItems:i,total:r}}emitHoldChange(){let e=this.hold;this.scheduleOfferRefresh(!0),this.opts.onHoldChange?.(e,e?.seats??[],e?this.buildHandoff(e):null)}toast(e,t="neutral",i){let s=this.els.toast;if(!s)return;s.replaceChildren();let r=document.createElement("span");if(r.textContent=e,s.appendChild(r),s.classList.toggle("has-action",!!i),i){let n=document.createElement("button");n.type="button",n.className="sl-toast-action",n.textContent=i.label,n.addEventListener("click",i.onClick,{once:!0}),s.appendChild(n)}s.dataset.tone=t,s.classList.add("on"),this.toastTimer&&clearTimeout(this.toastTimer),this.toastTimer=setTimeout(()=>{s.classList.remove("on"),s.classList.remove("has-action"),s.dataset.tone="neutral"},4200)}placeTooltip(){if(!this.tipEl)return;let e=this.els.map.clientWidth,t=this.tipEl.offsetWidth,i=this.tipEl.offsetHeight,s=this.tipPos.x+14,r=this.tipPos.y-i-12;s+t>e-8&&(s=this.tipPos.x-t-14),r<8&&(r=this.tipPos.y+18),this.tipEl.style.left=`${Math.max(8,s)}px`,this.tipEl.style.top=`${Math.max(8,r)}px`}rowTypeWord(e){let t=e?.displayType?.trim()||e?.rowType?.trim();return t||(e?.objectType==="table"?this.tf("picker.table","Table"):e?.objectType==="booth"?this.tf("picker.booth","Booth"):this.tf("picker.row","Row"))}updateTooltip(e){if(!this.tipEl)return;if(!e){this.tipEl.style.display="none";return}let t=m=>String(m??"\u2014").replace(/[&<>"]/g,g=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[g]),i=this.money(this.paidPrice(e.categoryKey,e.tierId??null,e.price,e.label)),s=e.objectType==="table"&&!!e.bookingMode,r=e.objectType==="booth",n=e.sectionLabel||e.rowLabel||e.seatNumber,a=s?`<div class="sl-tip-grid"><div class="sl-tip-field"><span class="sl-tip-key">${t(this.rowTypeWord(e))}</span><span class="sl-tip-val">${t(e.rowLabel??e.displayLabel??e.label)}</span></div><div class="sl-tip-field"><span class="sl-tip-key">${this.tf("picker.guests","Guests")}</span><span class="sl-tip-val">${e.bookingMode==="variable"?`${e.minOccupancy}\u2013${e.maxOccupancy}`:e.capacity}</span></div></div>`:r?'<div class="sl-tip-grid">'+(e.sectionLabel?`<div class="sl-tip-field"><span class="sl-tip-key">${this.tf("picker.section","Section")}</span><span class="sl-tip-val">${t(e.sectionLabel)}</span></div>`:"")+`<div class="sl-tip-field"><span class="sl-tip-key">${t(this.rowTypeWord(e))}</span><span class="sl-tip-val">${t(e.rowLabel??e.displayLabel??e.label)}</span></div></div>`:n?'<div class="sl-tip-grid">'+(e.sectionLabel?`<div class="sl-tip-field"><span class="sl-tip-key">${this.tf("picker.section","Section")}</span><span class="sl-tip-val">${t(e.sectionLabel)}</span></div>`:"")+(e.rowLabel?`<div class="sl-tip-field"><span class="sl-tip-key">${t(this.rowTypeWord(e))}</span><span class="sl-tip-val">${t(G(e))}</span></div>`:"")+(e.seatNumber?`<div class="sl-tip-field"><span class="sl-tip-key">${this.tf("picker.seat","Seat")}</span><span class="sl-tip-val">${t(e.seatNumber)}</span></div>`:"")+"</div>":`<div class="sl-tip-grid one"><div class="sl-tip-field"><span class="sl-tip-key">${this.tf("picker.seat","Seat")}</span><span class="sl-tip-val">${t(e.displayLabel??e.label)}</span></div></div>`,l=e.status==="not_for_sale",c=e.status==="free"?"":`<div class="sl-tip-status">${l?this.tf("picker.notAvailable","Not available"):e.status==="held"?y("map.statusHeld"):y("map.statusTaken")}</div>`,u=ie(e.commercial),p=u?`<div class="sl-tip-cx"><span class="g" aria-hidden="true">\u25D0</span>${t(u)}</div>`:"",d=ue(e.wheelchairSpaceType),f=d?`<div class="sl-tip-cx"><span class="g" aria-hidden="true">\u267F</span>${t(d)}</div>`:"";this.tipEl.style.setProperty("--sl-cat",e.categoryColor),this.tipEl.innerHTML=a+`<div class="sl-tip-cat"><span class="sl-tip-dot" style="background:${e.categoryColor}"></span><span class="sl-tip-name">${t(e.categoryLabel)}</span>`+(l?"":`<span class="sl-tip-amt">${i}</span>`)+"</div>"+f+p+c,this.tipEl.style.display="block",this.placeTooltip()}getSelection(){return this.committedSelection()}selectObjects(e){return this.controller.select(e)}deselectObjects(e){this.controller.deselect(e)}clearSelection(){this.dismissConfirm(),this.dismissTableDialog(),this.controller.clearSelection()}selectCategories(e){return this.controller.selectCategories(e)}deselectCategories(e){this.controller.deselectCategories(e)}setSelectableObjects(e){this.controller.setSelectableObjects(e)}setMaxSelection(e){this.maxTickets=Math.max(this.exactTickets??1,Math.floor(e)),this.controller.setMaxSelection(this.maxTickets),this.updateSelectionCapacity(),this.syncTray()}getSelectionValidity(){let e=this.controller.getSelectionValidity(this.totalTicketCount());return e&&(e.seats=this.committedSelection()),e}setMapTheme(e){this.destroyed||(this.opts.theme={...this.opts.theme??{},map:e??void 0},this.controller.setMapTheme(e))}setEventDetailsHidden(e){this.eventDetailsHidden=e,this.syncFullscreenButtons()}setPricing(e){let t=JSON.stringify(this.opts.pricing??null),i=JSON.stringify(e??null);t!==i&&(this.opts.pricing=e,!(this.destroyed||!this.els.prices)&&(this.els.pricesSec?.querySelector(".sl-price-select")?.remove(),this.buildPriceFilter(),this.syncPrices(),this.syncTray(),this.lastSection&&this.showSectionCard(this.lastSection)))}isColorblindSafe(){return this.cbSafe}setColorblindSafe(e){e!==this.cbSafe&&(this.cbSafe=e,this.cbEl?.setAttribute("aria-pressed",String(e)),this.controller.setColorblindSafe(e),this.syncPrices(),Qi(e))}setViewMode(e){this.controller.setViewMode(this.normalizeInitialView(e)),this.syncProjection(),this.dismissConfirm()}getViewMode(){return this.controller.getViewMode()}normalizeInitialView(e){return e==="perspective"?(this.perspectiveWarned||(this.perspectiveWarned=!0,console.warn("[seatlayer] initialView:'perspective' (2.5D) is deprecated for the buyer picker and was coerced to 'flat'. Use the Map | 3D control for the immersive view.")),"flat"):e??"flat"}getBuyerView(){return this.buyerView}setBuyerView(e,t){if(e==="map"){this.exit3d();return}let i=t?.flyToSeatId;if(this.buyerView==="venue3d"){i?(this.opts.onBuyerViewChange?.({view:"venue3d",seatId:i}),this.view3dHandle?.flyToSeat(i)):t?.resetView&&this.view3dHandle?.focusOverview();return}this.enter3d(i)}seatState3dFor(e){switch(this.controller.getStatus(e.id)){case"held":return"held";case"booked":return"sold";case"not_for_sale":return"dimmed";default:break}return this.priceBandKeys!=null&&!this.priceBandKeys.has(e.categoryKey)||this.limitedViewFilter&&(e.commercial?.restrictedView||e.commercial?.obstructedView)?"dimmed":"available"}pushAvailabilityTo3d(){if(!this.view3dHandle)return;let e=this.allSeats().map(t=>({seatId:t.id,state:this.seatState3dFor(t)}));this.view3dHandle.setAvailability(e)}syncSelectionTo3d(){this.view3dHandle&&this.view3dHandle.setSelection(this.controller.getSelection().map(e=>e.id))}async seatViewFor3d(e){let t=this.allSeats().find(i=>i.id===e);if(!t)return null;if(t.viewUrl)try{let i=t.viewMeta?.previewUrl,s=!!i&&i!==t.viewUrl,r=s?await this.buyerAssetUrls.resolve(i):null,n=s?t.viewUrl:await this.buyerAssetUrls.resolve(t.viewUrl);return!n||s&&!r?null:{url:n,...r?{previewUrl:r}:{},...s?{resolveUrl:a=>this.buyerAssetUrls.resolve(a)}:{},...t.viewMeta?.sourceWidth!==void 0?{sourceWidth:t.viewMeta.sourceWidth}:{},...t.viewMeta?.sourceHeight!==void 0?{sourceHeight:t.viewMeta.sourceHeight}:{},...t.viewMeta?.previewWidth!==void 0?{previewWidth:t.viewMeta.previewWidth}:{},...t.viewMeta?.previewHeight!==void 0?{previewHeight:t.viewMeta.previewHeight}:{},...t.viewMeta?.initialBearingDeg!==void 0?{initialBearingDeg:t.viewMeta.initialBearingDeg}:{},...t.viewMeta?.initialPitchDeg!==void 0?{initialPitchDeg:t.viewMeta.initialPitchDeg}:{},...t.viewMeta?.coverage?{coverage:t.viewMeta.coverage}:{},...t.viewMeta?.capturedAt?{capturedAt:t.viewMeta.capturedAt}:{},...t.viewMeta?.sourceLabel?{sourceLabel:t.viewMeta.sourceLabel}:{}}}catch(i){return this.opts.onError?.(i),null}return{url:"",generated:!0,mediaKind:"model",coverage:"exact-seat",sourceLabel:this.tf("picker.chartDerivedModel","Chart-derived model")}}emitAnalytics(e,t){try{this.opts.onAnalytics?.(e,{...t,surface:"buyer"})}catch{}}emit3dAnalytics(e,t){this.emitAnalytics(e,t)}onView3dSeatPick(e){if(this.salesClosed){this.toast(this.tf("picker.salesClosedToast","Sales are closed for this event."),"warning"),this.syncSelectionTo3d();return}let t=this.allSeats().find(a=>a.id===e);if(!t)return;let i=this.controller.tableSelection(e);if(this.committedSelection().some(a=>i?a.label===i.label:a.id===e)){this.controller.deselect([e]),this.dismissConfirm(),this.syncSelectionTo3d();return}let r=this.controller.getStatus(t.id);if(r==="held"||r==="booked"||r==="not_for_sale"){this.showUnavailable3dSeat(t,this.seatState3dFor(t),r),this.syncSelectionTo3d();return}if(this.dismissUnavailable3dSeat(),!this.controller.select([e]).length){this.syncSelectionTo3d(),this.dismissConfirm();return}if(this.opts.onBuyerViewChange?.({view:"venue3d",seatId:e}),this.flashPickedSeat(e),i){this.showTableDialog(i,!1),this.syncSelectionTo3d();return}this.opts.confirmSelection!==!1?this.showConfirm(t):this.syncTray(),this.syncSelectionTo3d()}showUnavailable3dSeat(e,t,i){let s=this.view3dEl;if(!s)return;this.dismissUnavailable3dSeat();let r=this.controller.seatDetails(e.id),n=r?.displayLabel??e.displayLabel??e.label,a=r?.sectionLabel,l=G(r),c=[a,l?y("picker.rowLabel",{label:l}):null,n].filter(Boolean).join(" \xB7 "),u=i==="held"?{title:this.tf("picker.temporarilyHeld","Temporarily held"),message:this.tf("picker.heldSeatExplanation","Another buyer is holding this seat. It may become available again.")}:i==="booked"?{title:this.tf("picker.sold","Sold"),message:this.tf("picker.soldSeatExplanation","This seat has already been booked.")}:{title:this.tf("picker.notForSale","Not for sale"),message:this.tf("picker.notForSaleExplanation","This seat is not included in the current sale.")},p=document.createElement("div");p.className="sl-view3d-unavailable",p.dataset.state=t,p.setAttribute("role","status"),p.setAttribute("aria-live","polite");let d=document.createElement("span");d.className="sl-view3d-unavailable-eyebrow",d.textContent=c||n;let f=document.createElement("strong");f.textContent=u.title;let m=document.createElement("div");m.className="sl-view3d-unavailable-copy",m.append(d,f);let g=document.createElement("button");g.type="button",g.setAttribute("aria-label",this.tf("picker.closeSeatStatus","Close seat status")),g.textContent="\xD7";let w=document.createElement("p");w.textContent=u.message,p.append(m,g,w),g.addEventListener("click",()=>p.remove()),s.appendChild(p),this.announceSeat(e)}dismissUnavailable3dSeat(){this.view3dEl?.querySelector(".sl-view3d-unavailable")?.remove()}saveView3dComparisonSeat(e){if(this.buyerView!=="venue3d")return;let t=this.view3dCompareSeatIds;t.includes(e.id)||(this.view3dCompareSeatIds=t.length===0?[e.id]:[t[0],e.id]),this.confirmSeat?.id===e.id&&(this.controller.deselect([e.id]),this.dismissConfirm(),this.syncSelectionTo3d(),this.syncTray()),this.view3dCompareChip.sync(),this.emit3dAnalytics("3d_comparison_saved",{seatId:e.id,count:this.view3dCompareSeatIds.length}),this.view3dCompareSeatIds.length>1?this.openView3dComparison():this.toast(this.tf("picker.chooseAnotherToCompare","Seat saved. Choose another seat to compare."),"success")}clearView3dComparison(){this.closeView3dComparison(!1),this.view3dCompareSeatIds=[],this.view3dCompareChip.remove(),this.emit3dAnalytics("3d_comparison_cleared")}view3dComparisonSnapshot(e){let t=this.allSeats().find(f=>f.id===e);if(!t)return null;let i=this.controller.seatDetails(t.id),s=this.controller.doc?.categories.find(f=>f.key===t.categoryKey),r=i?.price??(s?.tiers?.length?s.tiers[0].price:s?.price),n=r!=null?this.paidPrice(t.categoryKey,i?.tierId??s?.tiers?.[0]?.id??null,r,t.label):void 0,a=this.controller.getStatus(t.id),l=a==="held"?this.tf("picker.temporarilyHeld","Temporarily held"):a==="booked"?this.tf("picker.sold","Sold"):a==="not_for_sale"?this.tf("picker.notForSale","Not for sale"):this.tf("picker.available","Available"),c=t.viewUrl?Ht({url:t.viewUrl,...t.viewMeta?.coverage?{coverage:t.viewMeta.coverage}:{},...t.viewMeta?.capturedAt?{capturedAt:t.viewMeta.capturedAt}:{},...t.viewMeta?.sourceLabel?{sourceLabel:t.viewMeta.sourceLabel}:{}}):this.tf("picker.chartDerivedSeatEye","Live 3D \xB7 chart-derived seat-eye \xB7 not surveyed"),u=ie(t.commercial)||this.tf("picker.noAuthoredRestriction","No organizer-authored restriction"),p=i?.wheelchairSpaceType?`${ue(i.wheelchairSpaceType)} \xB7 metadata, not access certification`:this.tf("picker.noAccessibilityMetadata","No accessibility metadata supplied"),d=Rt(t.confidenceEvidence);return{seat:t,label:i?.displayLabel??t.displayLabel??t.label,section:i?.sectionLabel??t.sectionId??"\u2014",row:G(i)??i?.rowLabel??"\u2014",category:i?.categoryLabel??s?.label??t.categoryKey,price:n==null?this.tf("picker.priceNotSupplied","Not supplied"):this.money(n),availability:l,selectable:a==null||a==="free",viewSource:c,limited:u,accessibility:p,confidence:d}}openSeatConfidencePassport(e,t=null){let i=this.view3dEl;if(!i)return;this.closeSeatConfidencePassport(!1);let s=Rt(e.confidenceEvidence),r=e.confidenceEvidence,n=this.controller.seatDetails(e.id),a=v=>j(v),l=s.limitations.length?`<h4>Known limits</h4><ul>${s.limitations.map(v=>`<li>${a(v)}</li>`).join("")}</ul>`:"",c=s.modeledTarget?`<div><dt>Modeled target</dt><dd>${a(s.modeledTarget)}</dd></div>`:"",u=r?`<div><dt>Evidence ID</dt><dd>${a(r.evidenceId)}</dd></div><div><dt>Model version</dt><dd>${a(r.modelVersion)}</dd></div><div><dt>Event configuration</dt><dd>${a(r.eventConfigurationId??"Not configuration-specific")}</dd></div><div><dt>Approval</dt><dd>${a(r.approvedByRole??"No external approval supplied")}</dd></div>`+(r.validUntil?`<div><dt>Valid until</dt><dd>${a(r.validUntil.slice(0,10))}</dd></div>`:""):"<div><dt>Evidence ID</dt><dd>None supplied</dd></div>",p=ie(e.commercial)||this.tf("picker.noAuthoredRestriction","No organizer-authored restriction"),d=`<div><dt>View restriction</dt><dd>${a(p)}</dd></div>`+(e.commercial?.note?`<div><dt>Organizer note</dt><dd>${a(e.commercial.note)}</dd></div>`:""),f=document.createElement("div");f.className="sl-view3d-passport-shell",f.innerHTML=`<div class="sl-view3d-passport-scrim" aria-hidden="true"></div><section class="sl-view3d-passport" role="dialog" aria-modal="true" aria-labelledby="sl-view3d-passport-title"><header><div><span>Seat confidence passport</span><strong id="sl-view3d-passport-title">${a(n?.displayLabel??e.displayLabel??e.label)}</strong></div><button type="button" data-close aria-label="Close seat confidence passport">\xD7</button></header><div class="sl-view3d-passport-summary"><strong>${a(s.headline)}</strong><span>${a(s.coverage)} \xB7 ${a(s.freshness)}</span></div><dl><div><dt>Model status</dt><dd>${a(s.model)}</dd></div><div><dt>Reality evidence</dt><dd>${a(s.reality)}</dd></div><div><dt>Source</dt><dd>${a(s.provenance)}</dd></div>`+d+c+u+`</dl>${l}<p class="sl-view3d-passport-note">This passport describes supplied evidence and known limits. It does not guarantee that every temporary obstruction or real-world condition is knowable before the event build.</p></section>`;let m=[...new Set([...i.children,...[...this.els.map.children].filter(v=>v!==i)])].filter(v=>v instanceof HTMLElement),g=m.map(v=>({element:v,inert:v.inert,ariaHidden:v.getAttribute("aria-hidden")}));for(let v of m)v.inert=!0,v.setAttribute("aria-hidden","true");i.appendChild(f),i.classList.add("has-passport"),this.view3dPassportEl=f;let w=f.querySelector(".sl-view3d-passport"),k=()=>[...w.querySelectorAll('button:not(:disabled),[href],[tabindex]:not([tabindex="-1"])')],x=v=>{if(v.key==="Escape"){v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation(),this.closeSeatConfidencePassport();return}if(v.key!=="Tab")return;let C=k();if(!C.length)return;let h=C[0],b=C[C.length-1];v.shiftKey&&document.activeElement===h?(v.preventDefault(),b.focus()):!v.shiftKey&&document.activeElement===b&&(v.preventDefault(),h.focus())};window.addEventListener("keydown",x,!0),this.view3dPassportCleanup=()=>{window.removeEventListener("keydown",x,!0);for(let b of g)b.element.inert=b.inert,b.ariaHidden===null?b.element.removeAttribute("aria-hidden"):b.element.setAttribute("aria-hidden",b.ariaHidden);let v=t?.isConnected?t:this.confirmEl?.querySelector(".sl-confirm-confidence")??this.view3dCompareEl?.querySelector("[data-passport-seat]")??null,C=v?.closest(".sl-confirm,.sl-view3d-compare");C?.isConnected&&(C.inert=!1,C.removeAttribute("aria-hidden")),f.remove(),i.classList.remove("has-passport"),this.view3dPassportEl===f&&(this.view3dPassportEl=null);let h=v??this.view3dCompareEl?.querySelector("[data-passport-seat]")??this.confirmEl?.querySelector(".sl-confirm-confidence")??this.view3dCompareChip.mainButton();(t?.isConnected?t:h)?.focus()},f.addEventListener("click",v=>{let C=v.target instanceof HTMLElement?v.target:null;(C?.closest("[data-close]")||C?.classList.contains("sl-view3d-passport-scrim"))&&this.closeSeatConfidencePassport()}),requestAnimationFrame(()=>k()[0]?.focus()),this.emit3dAnalytics("3d_confidence_passport_opened",{seatId:e.id,evidenceId:r?.evidenceId??null,eventConfigurationId:r?.eventConfigurationId??null,modelLevel:r?.modelLevel??"unverified",realityLevel:r?.realityLevel??"none"})}closeSeatConfidencePassport(e=!0){let t=this.view3dPassportCleanup;if(this.view3dPassportCleanup=null,!t){this.view3dPassportEl?.remove(),this.view3dPassportEl=null,this.view3dEl?.classList.remove("has-passport");return}e||(document.activeElement instanceof HTMLElement?document.activeElement:null)?.blur(),t(),e||this.root?.focus({preventScroll:!0})}openView3dComparison(){let e=this.view3dEl;if(!e||this.view3dCompareSeatIds.length<2)return;this.closeView3dComparison(!1);let t=this.view3dCompareSeatIds.map(d=>this.view3dComparisonSnapshot(d)).filter(d=>!!d);if(t.length<2){this.clearView3dComparison();return}let i=d=>j(d),s=document.createElement("div");s.className="sl-view3d-compare-shell";let r=t.map((d,f)=>`<article><span>Seat ${f===0?"A":"B"}</span><strong>${i(d.label)}</strong><small>Section ${i(d.section)} \xB7 Row ${i(d.row)}</small><dl><div><dt>Current price</dt><dd>${i(d.price)}</dd></div><div><dt>Ticket type</dt><dd>${i(d.category)}</dd></div><div><dt>Availability</dt><dd>${i(d.availability)}</dd></div><div><dt>View source</dt><dd>${i(d.viewSource)}</dd></div><div><dt>View restriction</dt><dd>${i(d.limited)}</dd></div><div><dt>Seat confidence</dt><dd>${i(d.confidence.headline)}</dd></div><div><dt>Reality check</dt><dd>${i(d.confidence.reality)}</dd></div><div><dt>Accessibility</dt><dd>${i(d.accessibility)}</dd></div></dl><div class="sl-view3d-compare-actions"><button type="button" data-passport-seat="${i(d.seat.id)}">Passport</button><button type="button" data-view-seat="${i(d.seat.id)}">View seat</button><button type="button" class="select" data-select-seat="${i(d.seat.id)}"${d.selectable?"":" disabled"}>Select seat</button></div></article>`).join("");s.innerHTML=`<div class="sl-view3d-compare-scrim" aria-hidden="true"></div><section class="sl-view3d-compare" role="dialog" aria-modal="true" aria-labelledby="sl-view3d-compare-title"><header><div><span>Seat inspection</span><strong id="sl-view3d-compare-title">Compare disclosed attributes</strong></div><button type="button" data-close aria-label="Close seat comparison">\xD7</button></header><p class="sl-view3d-compare-note">Current price and availability come from this picker. Modeled views are chart-derived unless organizer media is labeled; SeatLayer does not invent why a seat has its price.</p><div class="sl-view3d-compare-grid">${r}</div></section>`;let n=document.activeElement instanceof HTMLElement?document.activeElement:null,a=[...e.children].filter(d=>d instanceof HTMLElement),l=a.map(d=>({element:d,inert:d.inert,ariaHidden:d.getAttribute("aria-hidden")}));for(let d of a)d.inert=!0,d.setAttribute("aria-hidden","true");e.appendChild(s),e.classList.add("has-comparison"),this.view3dCompareEl=s;let c=s.querySelector(".sl-view3d-compare"),u=()=>[...c.querySelectorAll('button:not(:disabled),[href],[tabindex]:not([tabindex="-1"])')],p=d=>{if(d.key==="Escape"){d.preventDefault(),this.closeView3dComparison();return}if(d.key!=="Tab")return;let f=u();if(!f.length)return;let m=f[0],g=f[f.length-1];d.shiftKey&&document.activeElement===m?(d.preventDefault(),g.focus()):!d.shiftKey&&document.activeElement===g&&(d.preventDefault(),m.focus())};window.addEventListener("keydown",p),this.view3dCompareCleanup=()=>{window.removeEventListener("keydown",p);for(let d of l)d.element.inert=d.inert,d.ariaHidden===null?d.element.removeAttribute("aria-hidden"):d.element.setAttribute("aria-hidden",d.ariaHidden);s.remove(),e.classList.remove("has-comparison"),this.view3dCompareEl===s&&(this.view3dCompareEl=null),n?.isConnected?n.focus():this.view3dCompareChip.mainButton()?.focus()},s.querySelector("[data-close]")?.addEventListener("click",()=>this.closeView3dComparison()),s.querySelectorAll("[data-passport-seat]").forEach(d=>d.addEventListener("click",()=>{let f=d.dataset.passportSeat,m=f?this.allSeats().find(g=>g.id===f):void 0;m&&this.openSeatConfidencePassport(m,d)})),s.querySelectorAll("[data-view-seat]").forEach(d=>d.addEventListener("click",()=>{let f=d.dataset.viewSeat;this.closeView3dComparison(!1),f&&this.view3dHandle?.flyToSeat(f)})),s.querySelectorAll("[data-select-seat]").forEach(d=>d.addEventListener("click",()=>{let f=d.dataset.selectSeat;f&&this.selectComparedSeat(f)})),requestAnimationFrame(()=>u()[0]?.focus()),this.emit3dAnalytics("3d_comparison_opened",{seatIds:this.view3dCompareSeatIds.slice()})}closeView3dComparison(e=!0){let t=this.view3dCompareCleanup;if(this.view3dCompareCleanup=null,!t){this.view3dCompareEl?.remove(),this.view3dCompareEl=null,this.view3dEl?.classList.remove("has-comparison");return}e||(document.activeElement instanceof HTMLElement?document.activeElement:null)?.blur(),t(),e||this.root?.focus({preventScroll:!0})}selectComparedSeat(e){if(this.salesClosed){this.toast(this.tf("picker.salesClosedToast","Sales are closed for this event."),"warning");return}let t=this.allSeats().find(s=>s.id===e);if(!t)return;if(this.closeView3dComparison(!1),!this.controller.select([e]).length){this.syncSelectionTo3d(),this.toast(this.tf("picker.seatNoLongerAvailable","That seat is no longer available."),"warning");return}this.syncSelectionTo3d(),this.showConfirm(t),this.emit3dAnalytics("3d_comparison_selected",{seatId:e})}async enter3d(e){if(this.view3dEl||!this.canOffer3d()||!this.els.map)return;let t=this.controller.doc;if(!t)return;this.buyerView="venue3d",this.view3dTargetSeatId=null,this.opts.onBuyerViewChange?.({view:"venue3d",...e?{seatId:e}:{}}),this.root?.setAttribute("data-view3d","on"),this.dismissConfirm(),this.syncProjection();let i=document.createElement("div");i.className="sl-view3d",i.setAttribute("role","group"),i.setAttribute("aria-label",this.tf("picker.interactive3dVenueView","Interactive 3D venue view"));let s=document.createElement("button");s.type="button",s.className="sl-view3d-back",s.innerHTML=`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15 18l-6-6 6-6"/></svg><span>${this.tf("picker.backToMap","Back to map")}</span>`;let r=s.querySelector("span"),n=u=>{this.view3dTargetSeatId=u;let p=!!u;i.classList.toggle("is-seat-focused",p);let d=p?this.tf("picker.backToVenue","Back to venue"):this.tf("picker.backToMap","Back to map");r&&(r.textContent=d),s.setAttribute("aria-label",d)};s.addEventListener("click",()=>{if(this.view3dTargetSeatId&&this.view3dHandle){this.view3dHandle.focusOverview();return}this.exit3d()}),i.appendChild(s);let a=document.createElement("button");a.type="button",a.className="sl-view3d-fs",a.textContent="\u26F6",a.setAttribute("aria-label",this.tf("picker.fullScreen","Full screen")),a.setAttribute("aria-pressed",String(!!document.fullscreenElement||this.fsFallback||this.framedFs)),a.addEventListener("click",()=>this.toggleFullscreen()),i.appendChild(a);let l=document.createElement("div");l.className="sl-view3d-loading",l.setAttribute("role","status"),l.setAttribute("aria-live","polite"),l.textContent=this.tf("picker.loading3d","Building the 3D venue\u2026"),i.appendChild(l),this.els.map.appendChild(i),this.view3dEl=i,this.view3dCompareChip.sync(),requestAnimationFrame(()=>{i.style.opacity="1"});let c=++this.view3dGen;try{let u=Ue(t),p=await ft();if(c!==this.view3dGen||this.buyerView!=="venue3d"||this.view3dEl!==i)return;let d=await p.prepareVenue3D({doc:t,seats:u});if(c!==this.view3dGen||this.buyerView!=="venue3d"||this.view3dEl!==i)return;let f=p.mountVenue3D(i,{doc:t,seats:u,prepared:d},{portraitOverviewCrop:!0,arriveAtSeatEye:!0,seatViewActionLabel:m=>this.allSeats().find(g=>g.id===m)?.viewUrl?this.tf("picker.openAuthored360","Open venue 360\xB0"):this.tf("picker.lookAroundLive3d","Look around in live 3D"),onSeatPick:m=>this.onView3dSeatPick(m),onSeatInspect:m=>this.onView3dSeatPick(m),onSectionFocusChange:m=>{let g=i.querySelector('select[data-locator="section"]'),w=m??"";!g||g.value===w||(g.value=w,g.dispatchEvent(new Event("change")))},onViewTargetChange:m=>{i.querySelector(".sl-view3d-nav")?.classList.toggle("is-seat-focused",!!m),n(m),this.opts.onBuyerViewChange?.({view:"venue3d",...m?{seatId:m}:{}})},getSeatView:m=>new Promise((g,w)=>{let k=()=>{this.seatViewFor3d(m).then(v=>{v?g(v):w(new Error("seat_view_unavailable"))})},x=globalThis.requestIdleCallback;typeof x=="function"?x(k,{timeout:1500}):setTimeout(k,50)}),onAnalytics:(m,g)=>this.emit3dAnalytics(m,g)});this.view3dHandle=f,l.remove(),this.pushAvailabilityTo3d(),this.syncSelectionTo3d(),Ct(i,f),e&&f.flyToSeat(e)}catch(u){if(c!==this.view3dGen||this.buyerView!=="venue3d"||this.view3dEl!==i)return;this.opts.onError?.(u),this.toast(this.tf("picker.unavailable3d","3D could not start. The seat map is still available."),"warning"),this.exit3d()}}exit3d(){if(this.buyerView!=="venue3d"&&!this.view3dEl)return;this.view3dGen++,this.buyerView="map",this.view3dTargetSeatId=null,this.opts.onBuyerViewChange?.({view:"map"}),this.root?.removeAttribute("data-view3d"),this.closeSeatConfidencePassport(!1),this.closeView3dComparison(!1),this.view3dCompareChip.remove();try{this.view3dHandle?.dispose()}catch{}this.view3dHandle=null;let e=this.view3dEl;this.view3dEl=null,e&&(e.style.opacity="0",setTimeout(()=>e.remove(),320)),this.syncProjection();let t=this.view3dReturnSeat;this.view3dReturnSeat=null,t&&this.committedSelection().some(i=>i.id===t.id)&&this.opts.confirmSelection!==!1&&this.showConfirm(t)}getCurrentHold(){return this.hold}async resumeHold(e){return this.resumeHoldFromServer(e,!1)}async removeHeldTicket(e){return this.removeHeldLabel(e)}async bestAvailable(e,t,i={}){if(this.salesClosed||this.bestAvailableBusy)return null;e=Math.max(1,Math.min(this.maxTickets,Math.floor(e))),this.confirmSeat&&this.cancelConfirm(),this.bestAvailableConfirm=!1,this.bestAvailableBusy=!0;let s=this.els.tray?.querySelector(".sl-ba-go");s&&(s.disabled=!0,s.classList.add("sl-busy"),s.innerHTML=`<span class="sl-ba-spin" aria-hidden="true"></span>${this.tf("picker.findingEllipsis","Finding\u2026")}`);try{let r=await this.controller.bestAvailable(e,t,{...i,ttlMs:this.opts.holdTtlMs});return r?(this.hold={holdId:r.holdId,expiresAt:r.expiresAt,seats:r.seats,items:r.items},this.handedOff=!1,this.bookedShown=!1,this.gaQty.clear(),this.startHoldTimer(r.expiresAt),this.flashHeldSeats(this.hold),this.syncTray(),this.emitHoldChange(),i.preferPremium&&r.seats.length&&!r.seats.every(n=>n.commercial?.premium)&&this.toast(y("picker.premiumFallbackNote",{count:e}),"neutral"),this.hold):null}catch(r){this.opts.onError?.(r);let n=r?.reason,a=n==="not_enough_together"?y("picker.couldNotFindSeatsTogether",{count:e}):n==="companion_pair_required"?this.tf("picker.companionPairRequired","Select the adjacent wheelchair place with each companion ticket."):n==="ticket_option_not_applicable"?this.tf("picker.ticketOptionNotApplicable","That ticket choice is not available for the selected seat."):n==="sold_out"?this.tf("picker.ticketTypeSoldOut","That ticket type is sold out. Try another ticket type."):n==="event_closed"?this.tf("picker.seatSalesClosedForEvent","Seat sales have closed for this event."):this.tf("picker.seatsNoLongerAvailableTryAnother","Those seats are no longer available. Try another quantity or ticket type.");return this.toast(a,"error"),null}finally{this.bestAvailableBusy=!1,this.syncTray()}}async release(){let e=this.hold,t=this.controller.currentHold(),i=!0;if(t)i=await this.controller.release();else if(e){let s=[...new Set([...(e.items??[]).map(r=>r.label),...(e.seats??[]).map(r=>r.label)])];if(s.length)try{await this.api.release(this.opts.event,s,e.holdId)}catch(r){this.opts.onError?.(r),i=!1}}if(!i){this.toast(this.tf("picker.couldNotReleaseTickets","Couldn't release your tickets. Your hold is unchanged."),"error");return}this.hold=null,this.forgetHold(),this.handedOff=!1,this.bookedShown=!1,this.ctaPhase="idle",this.stopHoldTimer(),this.gaQty.clear(),this.syncTray(),this.emitHoldChange()}startRealtime(){if(!this.access?.configured||!this.pubApi||this.realtime)return;let e=this.opts.event;this.realtime=new V({url:this.pubApi.subscribeUrl(e),mintTicket:()=>this.pubApi.subscribeTicket(e),onAccessUnavailable:t=>{this.opts.onAccessUnavailable?.(t),this.showAccessPanel(t)},sink:re(this.controller,{flashOnLiveChange:!0,onStatusChange:()=>{this.syncPrices(),this.scheduleOfferRefresh(!0),this.detectBooked(),this.minimap?.refreshMinimap(),this.pushAvailabilityTo3d()},onSelectedObjectUnavailable:(t,i)=>{this.opts.onSelectedObjectUnavailable?.({labels:t,reason:i}),this.syncTray(),this.toast(i==="ineligible"?this.tf("picker.seatNoLongerYours","Some seats are no longer available to you. They have been removed from your order."):this.tf("picker.seatTaken","Someone else took a seat you had picked. It has been removed from your order."),"warning")}})}),this.realtime.start()}async refreshAccess(){return!this.access?.configured||!await this.access.refresh("manual")?!1:(this.dismissAccessPanel(),await this.controller.refresh(),this.realtime?this.realtime.restart():this.startRealtime(),!0)}showAccessPanel(e){if(this.destroyed||!this.root)return;let t=this.accessCopy(e.reason);this.dismissAccessPanel();let i=document.createElement("div");i.className="sl-access",i.setAttribute("role","status"),i.setAttribute("aria-live","polite");let s=document.createElement("div"),r=document.createElement("div");r.className="sl-access-title",r.textContent=t.title;let n=document.createElement("div");if(n.className="sl-access-body",n.textContent=t.body,s.appendChild(r),s.appendChild(n),t.action){let a=document.createElement("button");a.type="button",a.className="sl-access-act",a.textContent=t.action,a.addEventListener("click",()=>{this.refreshAccess()}),s.appendChild(a)}i.appendChild(s),(this.regions?.["bottom-center"]??this.root).appendChild(i),this.accessEl=i}dismissAccessPanel(){this.accessEl?.remove(),this.accessEl=null}accessCopy(e){switch(e){case"paused":return{title:this.tf("picker.accessPausedTitle","These seats are on hold right now"),body:this.tf("picker.accessPausedBody","The organizer has paused this selection. Try again in a few minutes."),action:this.tf("picker.accessRetry","Try again")};case"revoked":return{title:this.tf("picker.accessRevokedTitle","This access link is no longer active"),body:this.tf("picker.accessRevokedBody","Ask whoever sent you here for a new link to keep booking these seats.")};case"no_token":case"provider_failed":return{title:this.tf("picker.accessExpiredTitle","Your access session has ended"),body:this.tf("picker.accessExpiredBody","Sign in again, or reload the page, to keep browsing these seats. Anything you are already holding stays yours."),action:this.tf("picker.accessRetry","Try again")};default:return{title:this.tf("picker.accessInvalidTitle","We couldn\u2019t verify your access"),body:this.tf("picker.accessInvalidBody","You can still book anything shown as available. Contact whoever sent you here for access to the rest.")}}}destroy(){this.destroyed=!0,this.realtime?.stop(),this.realtime=null,this.dismissAccessPanel(),this.access?.clear(),this.hold&&!this.handedOff&&this.controller.release(),this.closeConfirm(),this.dismissTableDialog(!1),this.closeSeatView(),this.closeCheckoutPanel(),this.exit3d(),this.buyerAssetUrls.dispose(),this.stopHoldTimer(),this.toastTimer&&clearTimeout(this.toastTimer),this.liveTimer&&clearTimeout(this.liveTimer),this.offerRefreshTimer&&clearTimeout(this.offerRefreshTimer),this.offerBoundaryTimer&&clearTimeout(this.offerBoundaryTimer),this.offerRefreshTimer=null,this.offerBoundaryTimer=null,this.offerVisibilityHandler&&(document.removeEventListener("visibilitychange",this.offerVisibilityHandler),this.offerVisibilityHandler=null);for(let e of this.motionTimers)clearTimeout(e);this.motionTimers.clear(),this.ro?.disconnect(),this.ro=null,this.framedFs&&this.setFramedFs(!1),this.escHandler&&document.removeEventListener("keydown",this.escHandler),this.fsChangeHandler&&document.removeEventListener("fullscreenchange",this.fsChangeHandler),this.fsEscHandler&&window.removeEventListener("keydown",this.fsEscHandler),this.controller.destroy(),this.projectionEl=null,this.root?.remove(),this.root=null,this.modalScrim&&(this.modalScrim.remove(),this.modalScrim=null,this.prevFocus?.isConnected&&this.prevFocus.focus({preventScroll:!0}),this.prevFocus=null)}};function Zi(o,e={}){let t=e.origin??"";if(!t)try{t=new URL(o.src,window.location.href).origin}catch{t=""}let i=!1,s=null,r=null,n=null,a="",l=null,c=()=>{if(i)return;i=!0,s=o.getAttribute("style"),Object.assign(o.style,{position:"fixed",inset:"0",width:"100vw",height:"100vh",margin:"0",border:"0",zIndex:"2147483000",background:"#101625"});let d=document.documentElement;r=d.style.overflow,d.style.overflow="hidden",document.body&&(n=document.body.style.overflow,document.body.style.overflow="hidden"),l=f=>{f.key==="Escape"&&u()},window.addEventListener("keydown",l)},u=()=>{i&&(i=!1,s===null?o.removeAttribute("style"):o.setAttribute("style",s),s=null,a&&(o.style.height=a),r!==null&&(document.documentElement.style.overflow=r,r=null),n!==null&&document.body&&(document.body.style.overflow=n,n=null),l&&(window.removeEventListener("keydown",l),l=null))},p=d=>{if(d.source!==o.contentWindow||t&&d.origin!==t||!d.data||typeof d.data!="object")return;let f=d.data;if(f.type==="seatlayer:height"){typeof f.px=="number"&&Number.isFinite(f.px)&&f.px>0&&(a=`${Math.round(f.px)}px`,i||(o.style.height=a));return}f.type==="seatlayer:fullscreen"&&(f.on===!0?c():f.on===!1&&u())};return window.addEventListener("message",p),()=>{window.removeEventListener("message",p),u()}}export{Y as ApiError,be as BuyerAccessContext,ne as BuyerAccessUnavailableError,V as BuyerRealtimeClient,Me as EmbeddedDesigner,st as SEATING_CHART_CALLBACK_PROPS,et as SEATING_CHART_HANDLE_METHODS,tt as SEATING_CHART_IDENTITY_PROPS,it as SEATING_CHART_VALUE_PROPS,qe as SeatPicker,Le as SeatingChart,Zi as attachPickerFrame,ti as bindSeatingChartHandle,ii as buildSeatingChartOptions,de as createBuyerAccessContext,re as createControllerSink,He as parseTicketOfferAvailability,Re as ticketOfferPrices};